Part III — Branches, sap and seeds
08 · The seeds: federation
Wind and animals carry baobab seeds far away. Federation carries public saberes beyond the network of mucuas: to chat clients (XMPP) and to the Fediverse (ActivityPub).
Files to read
federacao/visibilidade.py— the gate: onlyprotecao: publico+visibility: public+ not encrypted goes out.federacao/mapeador.py,federacao/atores.py— saber → Dublin Core / ActivityStreams; mucua, galaxy, mocambola → actors.federacao/adaptadores/base.pyand the adapters (xmpp*.py,activitypub.py).federacao/ingestao.py— what arrives from outside enters the collection.federacao/xmpp_bot.py+xmpp_i18n.py+bot_backend.py— the bot that publishes and searches over chat.federacao/xmpp_ponte.py,xmpp_extauth.py,api/v3/xmpp.py— the mucua's own XMPP (what the protocol calls a server), using Baobáxia's accounts.federacao/http_sig.py,api/v3/activitypub.py.
Pluggable adapters
classDiagram
class Adaptador {
<<abstract>>
+nome
+habilitado
+publicar(saber)
+consumir(atividade)
+status()
}
class XMPPAdaptador
class ActivityPubAdaptador {
+documento_ator()
+documento_outbox()
-_assina_entrega()
}
class Transporte {
<<xmpp>>
}
class TransporteHTTP {
<<activitypub>>
}
class SlixmppTransporte
class ComponenteTransporte
class HttpxTransporte
Adaptador <|-- XMPPAdaptador
Adaptador <|-- ActivityPubAdaptador
XMPPAdaptador --> Transporte
ActivityPubAdaptador --> TransporteHTTP
Transporte <|-- SlixmppTransporte : client
Transporte <|-- ComponenteTransporte : XEP-0114
TransporteHTTP <|-- HttpxTransporte
Each adapter lights up with BBX_FED_<NAME>=on (federacao/config.py).
What arrives from outside (version 3.3)
sequenceDiagram
participant R as remote mucua
participant I as POST /ap/galaxia/{uuid}/inbox
participant H as _remetente_verificado
participant G as ingestao.ingerir
R->>I: Create + Signature(keyId=…/ap/mucua/X#main-key) + Digest + Date
I->>H: checks Digest, Date (±5 min) and Ed25519 with mucua X's pubkey
alt signature missing or invalid
I-->>R: 401
end
I->>G: external saber
G->>G: well-formed uuid? nature is not an identity one?
G->>G: does the uuid already exist and is it LOCAL? → refuse
G->>G: marks origem_externa, origem_mucua, _verificado
G-->>I: saber ingested (enters normal search)
Up to 3.2 this route was always mounted, with no signature, and the upsert accepted the uuid of any local saber — see module 11.
The bot
The bot talks in several languages (xmpp_i18n.py): buscar pesca, publicar, sending a photo, titulo …, enviar. It uses the same publica/operacoes.py layer as the CLI. Messages and commands are kept apart from the logic — a new language is a new dictionary.
Practice
- Read
visibilidade.pode_federarand list three saberes that never go out. - In
test_xmpp_bot_i18n.py, add a command in another language. - Run
testes/test_federacao_inbox_segura.py. Change one line of the gate iningestao.pyand see which test breaks.
To talk about
- Which saberes does a community want to scatter to the wind, and which does it want to keep only among its own mucuas?
