Repository navigation
hive: a bee is a key its hive entered, and hum launches nothing - #86
Merged
Merged
Conversation
A hive is a kind. A bee is a participant. An archetype is a shape a bee of that kind can take. The Orchfile is the addressable target: point a humd at one and it sets the hive up, with no knowledge of the hive itself. So the CLI stopped knowing how hives are built. cargo, pnpm and go are gone from it; each hive carries a build script and the CLI runs that. The Orchfile's RUN execs the artifact where the hive keeps it — nothing is installed into the system's PATH, because a bee is a participant, not an installed program. The Orchfile may declare several SERVICE directives: those are the archetypes of the kind, named <kind>-<archetype> for now while the hives overlay the central Orchfile and share one hum namespace. The first SERVICE is the kind's own bee; the rest are alternatives. A bee tells which archetype it is with HUM_BEE_ARCHETYPE, and says so in the hello: the hive it belongs to, and the nestler id that lets two nestlers of one kind register without their manifests collapsing into one. The identity key follows the archetype, so each is its own participant with its own hid. Paths come from the environment. Standalone: this carries the hum-core refactor and the build-script split for the existing hives; the dwarfstar hive (the C bee / the engine linked in) is the exemplar and lands via its own PR.
The grow() function now reads the base Orchfile to inherit ARGs like HOME
for ${VAR} expansion in overlay ENV lines. This allows services like
dwarfstar-ds4flash-q2 to inherit HOME from the base Orchfile and have
DWARFSTAR_DIR populated from the env override.
decl_args superseded declared_args (it carries values, not just names); this branch swapped the one caller over, which left declared_args and its HashMap import dead. grow() was reading the base Orchfile twice — once for the discarded 'base' binding, once fresh for base_args; read it once and reuse. Both were dead code the refactor left behind; removing them leaves the hum package warning-free.
A hive is a kind. A directory with an Orchfile is one, and hum asks a single thing of it: a hive-install unit, which `hum hive <ref> install` runs after recording the hive in hives.d. Everything else the hive runs, and how it keeps it alive, is the hive's own business. The archetype naming, the unit-as-bee reading of the Orchfile and every call from hum into orchd are gone; `hum nest` with them. The installer still puts orchd on the machine, for hives to use. A bee is a participant, not an instance of its kind. It is a key: `hum bee enter --hive <hive>` mints one at bees/<id>.key, records it under the hive in bees.d, and prints the id. Whatever the hive runs as that bee is told its id in HUM_BEE and signs its hello with the key. `hum bee <id> exit` signs it out and `reenter` signs it back in. humd admits a hello only when its hive is installed and it is signed by a key entered under that hive and not exited. An unsigned hello, a stale or forged signature, or a key from another hive is refused, so a process can no longer claim another bee's hid. A remote bee of a kind this humd never installed is never routed to. The hello names its hive and its roles; roles replace the old `bee` field, which is still read, and hids are bee_<sha256(pubkey)>. The comb counts per hive (hive:<name>:…), folding older bee:<name>:… keys in. HiveManifest is BeeManifest, and hive_advertise/discover are bee_*, on the same announce topic. THRUM_VERSION is 0.8.0. Each bundled hive's hive-install runs its own install script: build, enter a bee (reused on reinstall), and run its process under orchd in its own hum-<hive> namespace with HUM_BEE set. Every bee — Rust through hum-nest or by hand, TS, Go, Kotlin, the paid-oracle buyer — loads its key from HUM_BEE and signs.
… the spec Entering takes a label. `hum bee enter --hive <hive> --as <label>` is the same bee every time for one hive and label, so a process enters itself when it starts (`--as main`) and a runtime that holds many bees enters each by a label of its own. HUM_BEE is gone: nothing hands a process its id any more. The bundled hives' install scripts only build and run; Rust bees call hum_identity::enter_as, the TS, Go and buyer bees go through the hum CLI, so entering has one implementation. openai-server treats every requester as a bee. A requester is fingerprinted by a hash of its bearer token, X-Tenant and `user`, and entered as an asker labelled requester-<fingerprint>. Its requests go to humd over its own socket, signed by its own key, so humd sees, logs and can exit or revoke each one apart. Idle requester sockets close after ten minutes; the process's main bee keeps the upstream worker. The views in thrum-core are the spec, read from their own serde shape by thrum_core::spec, and a new chi does not compile without one. humd checks every tone it hears and sends against it: in the field each undeclared key is logged once, in the simulator it fails the test. That removed toolNames from hello, toolName from tool results, the legacy `bee` roles field and stray keys in test fixtures. WIRE.md states the rule. Code is speech: the code files this branch touches keep only their top-of-file header, hives included. MIGRATING.md is gone, and the docs carry no em dashes in what this branch wrote.
Read through runuz, the names that still argued with the model: A role is never part of who a bee is, so the hid prefixes are humd and bee alone. Wbee, Fbee and same_key are gone, and with them the revocation list's and the manifest's readings of the older spellings; no old-prefixed bee can enter, so nothing was left for them to keep. nestler_id was a phase word used as an identity, and humd read `nestlerId` from a hello that never declared it. Signed hids made it dead; it is gone. A worker is a role a bee plays, so the hum-nest trait is Worker, not WorkerBee, and what a worker says about itself is WorkerAdvert, beside ForagerAdvert. A hive's config is the hive's: hum_paths::hive_config at hives/<hive>.json, and HiveConfig in the TS hives. anthropic-server's registrar is its bee. bee_retract retracts a bee by its id, not a hive by its name. VOCABULARY names the forager contract it has (ToolDispatcher), and the hives guide points at hum-nest.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is
The hive/bee model, settled. A hive is a kind, installed on a humd. A bee is a participant: a key its hive entered, and whatever signs a hello with that key. hum launches nothing; what runs is each hive's own business.
No C and no dwarfstar here. The dwarfstar hive (#85) lands on top and needs to follow this model (see the end).
The first commit's archetypes are gone: no archetype, no
<kind>-<archetype>naming, noHUM_BEE_ARCHETYPE, and noHUM_BEEeither.The model
Orchfile. hum recognises one unit in it,hive-install.hum hive <ref> installrecords the hive in~/.config/hum/hives.d/<hive>.orch, then runs that unit in the foreground withHUM_SRC,HUM_HIVE, andhumon itsPATH. If the unit fails, the record is removed. hum reads nothing else in the Orchfile.hum bee enter --hive <hive> --as <label>mints an ed25519 key at~/.local/state/hum/bees/<id>.key, records it under the hive and label inbees.d/<id>.json, and prints the id (bee_<sha256(pubkey)>). The same hive and label are always the same bee, so a process enters itself each time it starts (--as main), and a runtime holding many bees enters each by its own label.hum bee <id> exitsigns a bee out andreentersigns it back in.pubkey,signedAt, and asignatureoverhum-bee-socket-v1:<hid>:<signedAt>), and that key entered under that hive and hasn't exited. Unsigned, stale or forged hellos, and keys entered under another hive, are refused, so a process can no longer claim another bee's hid. The record is read at every hello, so an exit takes effect from the next one.hum nest. The installer still installs orchd, for hives to use. Each bundled hive'shive-installruns its owninstallscript, which builds and runs its process under orchd in its ownhum-<hive>namespace; the process enters its ownmainbee when it starts.openai-server: every requester is a bee
Each HTTP requester is fingerprinted by a hash of its bearer token, its
X-Tenantand the request'suser, and entered as anaskerbee labelledrequester-<fingerprint>. Its requests go to humd over its own socket, signed by its own key, so humd sees, logs and can exit or revoke each requester separately. The fingerprint is the only trace of the token on disk. Idle requester sockets close after ten minutes. The process's ownmainbee keeps the upstream OpenAI worker.The spec is enforced
The per-chi body structs in
thrum-core/src/views.rsare now machine-readable as the spec (thrum_core::spec, read from the structs' own serde shape, and a new chi does not compile without a view). A key that is neither an envelope key nor in its chi's view is undeclared; a bee's private data belongs underext. humd checks every tone it hears and sends: in the field it logs each undeclared key once (thrum.tone.undeclared), and in the simulator any undeclared key fails the test. This found and removedtoolNameson hello,toolNameon tool results, the legacybeeroles field, and several stray keys in test fixtures. WIRE.md states the rule.Wire (THRUM_VERSION 0.8.0)
hiveandrolesand must carryhid,pubkey,signedAtandsignature. The canonicalHelloBodymatches, and the TS/Python/Go clients are regenerated from it.bee_. A role is a claim in the hello, never part of the identity.wbee_/fbee_still parse, so older revocation entries keep working.HiveManifestisBeeManifest(hive,roles; still reads an older humd'sname/beein gossip), andhive_advertise/discoverarebee_*, on the same topic.hive:<name>:…); olderbee:<name>:…keys are folded in on load.Bees
Rust bees use
hum_identity::enter_as(hive, "main")(orhum_nest::serve_worker/serve_forager, which do it). TS, Go and the paid-oracle buyer enter throughhum bee enter … --as …and sign with the same key format and message. The Kotlin bee (wifi-p2p) reads a provisioned id and key and signs with BouncyCastle; the old code derived the wrong public key.Code is speech
Every code file this PR touches keeps only its top-of-file header; other comments were removed, hives included. Generated client files keep their WIRE.md descriptions.
Verification
cargo test --workspacegreen, with the simulator in strict wire mode. New coverage: uninstalled hive, unsigned hello, never-entered key, key entered under another hive, exited bee, remote routing gated on a locally installed hive, labelled entering.tools/speech.pyclean; Go and Python client tests pass.bun testgreen, including a new test that two requesters become two asker bees and one requester stays one bee.Not verified: the bundled
installscripts against the real orchd (that writes launchd agents), the Kotlin build, and typechecking anthropic-server and vercel-ai (nonode_modules; theiridentity.tsis identical to openai-server's).Upgrading
Reinstall the hives you run (
hum hive <name> install). Every bee is entered fresh. Bees started by an older hum in hum's own orchd namespace are not stopped by the upgrade;orchd --project-dir ~/.config/hum fellonce clears them.Relation to #85
#85's C bee was written for archetypes and per-archetype keys. On top of this it should enter itself with
hum bee enter --hive dwarfstar --as main(or a label per bee it hosts), sign its hello as above, and leave process supervision to the dwarfstar hive's ownhive-install.