1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! The team mind without a server: the members of a collective sync its lessons peer to peer.
//!
//! - **Identity** (identity.rs): one ed25519 key per node and collective, kept in the collective's
//! store (mode 0600). The same key is the node's iroh id, so the transport authenticates it.
//! - **Membership** (membership.rs): a JSON document listing member keys, roles and revocations,
//! signed by an admin. A newer version is adopted only if it is the next one, names the held one
//! as its parent and an admin of the held version signed it; concurrent admins' forks resolve the
//! same way on every node, keeping every revocation. A node talks only to peers its verified
//! membership lists.
//! - **Data** (lines.rs, origin.rs): the append-only `lessons.jsonl`, addressed per line by blake3,
//! each line with a signed origin (who stamped it, when). Merge is a union; the latest version
//! of a lesson wins, as `conscience::load` expects. Raw episodes stay on the node that captured
//! them, so each is learned exactly once. Reasoning excerpts (git notes, `borg notes`) go from
//! their author to two member replicas, and any holder answers a member asking for a commit's.
//! - **Sync** (sync.rs, recon.rs): iroh QUIC between two nodes, trust first (membership and
//! revocations before any data), then range-based set reconciliation, cost ∝ difference.
//! - **Live** (live.rs): presence of the members' drones, ephemeral, carried in every session after
//! the logs; never reconciled into a log.
//! - **Steering** (steer.rs): a pause, resume or veto is a message line, authenticated by its origin;
//! another node's counts only under its member role `admin` or `steer`, admitted when stored.
//! - **Daemon** (daemon.rs, peers.rs): `serve` accepts members and dials the known ones every
//! interval and on local change, with backoff, until Ctrl-C / SIGTERM.
//! - **Reach** (addr.rs): peers are dialled by key; across NAT through iroh's hole punching with
//! relay fallback (n0's public relays and address lookup by default, a self-hosted relay, or
//! direct addresses only), set per collective.
//! - **Onboarding** (invite.rs): an admin's signed, expiring, use-limited invite in a ticket string
//! or QR code; `join <ticket>` dials the admin, which adds the key to the signed membership.
//!
//! The gate: `borg::collective::may_sync` is asked before any byte of a collective leaves, on both
//! sides, on the config as it is at that moment. A local collective or an off repo is refused before
//! a connection is even opened, and so is a store a local collective also maps to.
//!
//! **Internal API, no semver.** The product is the `borg-mesh` binary; this library exists for borg's own
//! crates, which pin it `=` to the same version. Any release may change or remove any item.
/// Lowercase hex, the form keys and hashes take in files, tickets and on the wire.