Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion THRUM.md
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,9 @@ The stream runs on four carriers:
you trust.
- **TLS**, the same stream wrapped in TLS.
- **iroh**, QUIC with Noise, ALPN `hum/0.5`, hole-punching through the
public relay mesh when bound relayed; the daemon binds direct-only.
public n0 relay mesh. A humd publishes its home relay under its node
id, so `iroh:<node>` alone is enough to dial it; `iroh-ip:<sockaddr>`
and `iroh-relay:<url>` hints skip the lookup.

Between humds the stream opens with an Ed25519 handshake: each humd
sounds a `hello` signed by its key, carrying `humd_id`, `proto_version`,
Expand Down
23 changes: 14 additions & 9 deletions ensemble/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ the *same* humd talk, they're already on `thrum`. When nestlers on
| how does humd A reach humd B? | `Transport` trait + a `peers.json` of known addresses, or `kad_find(target)` for discovery among peers already known. |
| how do messages flow? | `chi:"prompt"` / `chi:"unfurl"` / `chi:"wilt"` between humds via `route(tone)` (unicast) or `publish(topic, …)` (gossip). |
| how do you trust a stranger? | Ed25519-signed `hello` handshake. `Hid` = hash(pubkey), so the signature proves identity. |
| who handles NAT, firewalls, dynamic IPs? | `IrohEndpoint::bind_relayed()`, which is QUIC + Noise + hole-punching via the public iroh relay mesh. The daemon binds direct-only; the relay path lives in the crate and needs a network that can reach the relay servers. |
| who handles NAT, firewalls, dynamic IPs? | `IrohTransport`, which is QUIC + Noise + hole-punching via the public n0 relay mesh. The daemon binds with `bind_with_key_on()`: each humd keeps a home relay and publishes it under its node id through n0's DNS, so a humd behind NAT is dialled by its `iroh:` hint alone. An `iroh-relay:` hint skips the lookup. |

Nothing in ensemble knows about models, MCP, JSONL, plugins, or
billing. Those live in `humd` and `hives`. This crate is purely
Expand All @@ -62,14 +62,14 @@ billing. Those live in `humd` and `hives`. This crate is purely
|---|---|---|---|---|
| **T1** own-devices | implicit (you own all) | static `peers.json` | `InMemoryEndpoint` (tests) or `TcpEndpoint` (LAN) | laptop ↔ phone roam |
| **T2** trusted-group | pre-shared (team, family) | static + fingerprint pinning | `TlsTcpEndpoint` with pinned-fingerprint verifier | co-pilot session, 2-3 operators |
| **T3** federation | signed handshake (cross-org) | static `peers.json` | `IrohEndpoint` (direct) or `TlsTcpEndpoint` | partner-with-partner agents |
| **T3** federation | signed handshake (cross-org) | static `peers.json` | `IrohEndpoint` or `TlsTcpEndpoint` | partner-with-partner agents |
| **T4** open p2p | verify everything (strangers) | Kademlia DHT + ensemble gossip | `IrohEndpoint` + relay | autonomous agents finding each other on the open mesh |

Daemon code is identical across all four tiers. The tier is *which*
`Transport` impl you plug in. The transport column lists what the
crate implements; the daemon ships T1 and T3 over TCP and direct
iroh, and wires neither TLS nor the relay. See [not here
yet](#not-here-yet).
crate implements; the daemon ships T1 and T3 over TCP and over
iroh through the n0 relay mesh, and does not wire TLS. See [not
here yet](#not-here-yet).

## Quick tour

Expand Down Expand Up @@ -136,12 +136,20 @@ let peer_id = Hid::random_humd();
let transport = IrohTransport::bind_relayed().await?;
let addr = HumdAddr::new(peer_id)
.with_hint("iroh:0fb1c87a4d5e4e3a9c1b2d3e4f5061728394a5b6c7d8e9f0a1b2c3d4e5f60718")
.with_hint("iroh-ip:203.0.113.4:18820");
.with_hint("iroh-ip:203.0.113.4:18820")
.with_hint("iroh-relay:https://euc1-1.relay.n0.iroh-canary.iroh.link./");
let conn = transport.connect(&addr).await?;
# Ok(())
# }
```

Only the `iroh:` hint is needed. With it alone the dialer looks up
the peer's current home relay by its node id and meets it there, then
hole-punches to a direct path when the NATs allow it. `iroh-ip:` and
`iroh-relay:` are shortcuts that skip the lookup. `tests/iroh_relay.rs`
proves both ways across the live n0 mesh with no reachable IP; it is
`#[ignore]`d so CI never depends on n0.

### Sending a tone to one peer

```rust,no_run
Expand Down Expand Up @@ -250,9 +258,6 @@ These are written as if they work. They do not.
`peers.json` and from the persisted routing store. There is no DNS
seeding, no bootstrap node, no contact exchange, so `kad_find` can
only find peers the node already knows.
- **The relay path is unproven.** `bind_relayed()` exists; the n0
relay servers were unreachable from the network this was developed
on, and no traffic has crossed a relay.
- **TLS is a library capability the daemon never uses.**
`TlsTcpEndpoint` and its pinned-fingerprint verifier are here and
tested; `humd` wires only TCP and iroh.
Expand Down
4 changes: 2 additions & 2 deletions hives/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ A forager picks a contract that already exists in the wild and hides the rest of

Put an `Orchfile` at the root of your hive's directory. That is what makes it a hive, and the directory's name is the hive's name, a plain name of letters, digits, `-`, `_` and `.` that does not start with `.`. hum recognises one unit in it, `hive-install`, and nothing else. `hum hive <ref> install` records the hive on the humd and then runs that unit's `RUN` with `sh -c` in the foreground, in the unit's `WORKDIR` or else your directory, with the unit's `ENV`, `HUM_SRC` set to your directory, `HUM_HIVE` to your hive's name, `HUM_HIVE_STATE` to your hive's state directory, and `hum` on its `PATH`; if the unit fails, the hive is not installed. An `ARG` your Orchfile declares takes its value from the environment of `hum hive <ref> install`, which the unit inherits. The copy hum records carries `HUM_SRC`, `HUM_HIVE` and `HUM_HIVE_STATE` as `ARG`s. A supervisor that reads your own Orchfile sees an `ARG` only as you pass it: the bundled `install` passes orchd every `ARG` the Orchfile declares that is set in its environment, which is how a unit there can say `${HUM_HIVE_STATE}`.

What the unit does is yours: build, fetch a model, start processes and keep them alive with whatever supervisor you like. The bundled hives that run a process use one small `install` script each, which runs the hive's `build` and then grows the hive's units under [orchd](https://github.com/adiled/orchd), in the namespace `hum-<hive>` with its state in `${HUM_HIVE_STATE}/orch`: the unit named after the hive, or every unit for a hive with several (dwarfstar, one per model; ollama-server, its forager and its nurse). The process enters its own bee when it starts. A unit's settings are empty `ARG`s passed on as its `ENV`, as in `bp7/Orchfile`, so `BP7_ROUTE=router.local:4556 hum hive bp7 install` sets one, and an empty one keeps the process's own default. vercel-ai, whose bee lives in the app that imports it, only builds. Every other unit in the Orchfile is only what your own tooling makes of it.
What the unit does is yours: build, fetch a model, start processes and keep them alive with whatever supervisor you like. The bundled hives that run a process use one small `install` script each, which runs the hive's `build` and then grows the hive's units under [orchd](https://github.com/adiled/orchd), in the grove `hum-<hive>` with its state in `${HUM_HIVE_STATE}/orch`: the unit named after the hive, or every unit for a hive with several (dwarfstar, one per model; ollama-server, its forager and its nurse). The process enters its own bee when it starts. A unit's settings are empty `ARG`s passed on as its `ENV`, as in `bp7/Orchfile`, so `BP7_ROUTE=router.local:4556 hum hive bp7 install` sets one, and an empty one keeps the process's own default. vercel-ai, whose bee lives in the app that imports it, only builds. Every other unit in the Orchfile is only what your own tooling makes of it.

```
ARG HUM_SRC=
Expand Down Expand Up @@ -150,7 +150,7 @@ Whatever the shape, the humd a bee lands on must have its hive installed and the

In the **ensemble**, a bee nestled on one humd is gossiped to others. A humd routes to a remote bee only when it has that bee's hive installed too, so it knows the kind it is handing work to; it need not have entered any bee of it. It hands a prompt to a peer's nurse only with `humd.trustRemoteNurses` in `hum.json` (or `HUM_TRUST_REMOTE_NURSES=1`), and a reach or a bloom's tools to a peer's attendant only with `humd.trustRemoteAttendants` (or `HUM_TRUST_REMOTE_ATTENDANTS=1`); both are off by default. A humd dials the peers in its `peers.json` (`hum ensemble peer add`), and one entry is enough to join an ensemble. The `source` URL stays purely informational.

As a **managed service** your hive keeps its processes alive itself. The bundled hives do it with orchd, which the hum installer puts at `~/.local/bin/orchd`, pinned, for any hive to use; nothing in hum calls it.
As a **managed service** your hive keeps its processes alive itself. The bundled hives do it with orchd, which the hum installer puts at `~/.local/bin/orchd`, pinned, beside the `orch` it reads Orchfiles through, for any hive to use; nothing in hum calls it.

```
hum hive --list # the catalogue, what is installed, bees entered under each
Expand Down
2 changes: 1 addition & 1 deletion hives/apple-fm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ hum hive apple-fm install
`install` builds the nurse (`cargo build --release --locked`) and the
bridge beside it (`swiftc`, into `target/release/apple-fm-gen`), and
keeps the Orchfile's `apple-fm` unit running under orchd, in the
`hum-apple-fm` namespace. A setting rides in the environment of the
`hum-apple-fm` grove. A setting rides in the environment of the
install:

```bash
Expand Down
2 changes: 1 addition & 1 deletion hives/dwarfstar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ DWARFSTAR_DIR=~/ds4 hum hive ./hives/dwarfstar install
```

`install` builds the bee and grows every unit of the Orchfile under
orchd, in the `hum-dwarfstar` namespace. Each unit's bee enters itself
orchd, in the `hum-dwarfstar` grove. Each unit's bee enters itself
under the hive, as the unit's name, when it starts. A unit whose model is
not on this machine logs so and stays down. It builds on macOS, where
ds4's Metal backend is what it links.
Expand Down
2 changes: 1 addition & 1 deletion hives/ollama-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ hum hive ollama-server install

`install` builds both binaries (`cargo build --release --locked`) and
keeps both of the Orchfile's units running under orchd, `ollama-server`
and `ollama-nurse`, in the `hum-ollama-server` namespace. A setting
and `ollama-nurse`, in the `hum-ollama-server` grove. A setting
rides in the environment of the install:

```bash
Expand Down
4 changes: 2 additions & 2 deletions hum-paths/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ small struct humd writes to `state_dir/runtime.json` when it
boots and removes when it shuts down. Other tools (`hum status`,
`hum ensemble`, dev scripts, third-party probes) read it to learn the
running daemon's pid, socket path, version, and the wire-shaped reach
hints (`ensemble_addrs`: `iroh:<node>`, `iroh-ip:<sockaddr>`, `tcp:...`)
a peer would paste into its `peers.json`.
hints (`ensemble_addrs`: `iroh:<node>`, `iroh-ip:<sockaddr>`,
`iroh-relay:<url>`, `tcp:...`) a peer would paste into its `peers.json`.

```rust
let info = RuntimeInfo {
Expand Down
6 changes: 4 additions & 2 deletions hum/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ Inspect or edit on-disk peer-mesh state.
| `hum ensemble peer rm <humd_id|alias>` | drop matching entries |

Hints are wire-shaped strings: `tcp:host:port`, `iroh:<64-hex>`,
`iroh-ip:<sockaddr>`. The `reach` field of `hum ensemble` is exactly
what a remote peer pastes in.
`iroh-ip:<sockaddr>`, `iroh-relay:<url>`. An `iroh:` hint alone reaches
a humd anywhere, through the n0 relay mesh; `iroh-ip:` and
`iroh-relay:` are shortcuts to it. The `reach` field of `hum ensemble`
is exactly what a remote peer pastes in.

### `hive`
Hives are the kinds this humd understands. A directory with an
Expand Down
10 changes: 7 additions & 3 deletions man/hum.1
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ Inspect or edit the peer-mesh state.
.B hum ensemble peer add \fIhumd_id\fR [\-\-hint \fIHINT\fR]... [\-\-alias \fIname\fR]
\(em append a peer to peers.json. \fIhumd_id\fR is hex (with or without the
\fBhumd_\fR prefix). Repeated \fB\-\-hint\fR flags accumulate; hints are
\fBtcp:host:port\fR or \fBiroh:<64-hex>\fR. An existing entry with the same
\fBtcp:host:port\fR, \fBiroh:<64-hex>\fR, \fBiroh-ip:<sockaddr>\fR or
\fBiroh-relay:<url>\fR. An existing entry with the same
humd_id is replaced (idempotent). Alias enables \fBhum://<alias>/path\fR
URI resolution.
.br
Expand Down Expand Up @@ -212,7 +213,9 @@ them.
Source checkout the installer builds from.
.TP
.B ~/.local/bin/
Installed binaries: \fBhum\fR, \fBhumd\fR, \fBhumctl\fR, \fBorchd\fR.
Installed binaries: \fBhum\fR, \fBhumd\fR, \fBhumctl\fR, \fBorchd\fR,
with \fBorch\fR, which orchd reads Orchfiles through, and orchd's
\fBorchd-rootstock-*\fR plugins.
hum never calls \fBorchd\fR; it is installed as a supervisor hives may use
for their own processes, as the bundled hives do.
.SH ENVIRONMENT
Expand Down Expand Up @@ -280,7 +283,8 @@ curl -fsSL https://raw.githubusercontent.com/adiled/hum/main/install | bash
.PP
The installer builds and registers \fBhumd\fR as a user service (launchd on
macOS, systemd-style on Linux), mints the identity key, pulls in the
\fBorchd\fR supervisor binary for hives to use, and installs this page into
\fBorchd\fR supervisor and \fBorch\fR from orchd's release, pinned and
checksum-verified, for hives to use, and installs this page into
\fB/usr/local/share/man/man1\fR or \fB~/.local/share/man/man1\fR. Re-running
it upgrades in place.

Expand Down
Loading