Reusable crates for remote hives: carve hum-identity/hum-thrum/hum-mcp leaf libs - #56
Open
adiled wants to merge 7 commits into
Open
Reusable crates for remote hives: carve hum-identity/hum-thrum/hum-mcp leaf libs#56adiled wants to merge 7 commits into
adiled wants to merge 7 commits into
Conversation
Move the content-addressable identity primitive (Hid, HidPrefix,
HidParseError) from ensemble into ids so light bee/identity crates can
mint Hids without dragging the whole mesh (iroh/rustls/etc). ensemble
re-exports ids::{Hid,HidPrefix,HidParseError} for back-compat, so
existing ensemble::Hid call sites keep compiling.
ids gains a hex dep for the wire-form encoding.
Extract load_or_mint_bee_key / BeeKey / bee_key_path from nest-common into a standalone hum-identity crate so remote hives can depend on it without pulling the daemon tree (ensemble/iroh, nest, mcp, etc). - New crate hum-identity: ids (Hid) + hum-paths + ed25519-dalek + rand. - hives/common/src/identity.rs becomes a thin re-export shim for back-compat; existing nest_common::load_or_mint_bee_key call sites keep resolving. - Registered in workspace members; added to hives/common deps.
…r serve_forager
Factor the thrum wire loop (dial Unix socket, split, send NDJSON,
read tones, reconnect with jittered backoff) out of nest-common into a
standalone hum-thrum crate so remote hives can dial humd without
pulling the daemon tree.
- New crate hum-thrum: connect / send_json / read_tones / serve_forever.
Deps: ids + hum-paths + hum-identity + thrum-core + tokio + serde_json.
- serve_forager (forager.rs) now uses hum-thrum for the wire; the
ToolDispatcher / ToolDef / ToolResult semantics stay in nest-common.
- hum-identity re-exports ids::{Hid,HidPrefix} so consumers get the
role type through hum_identity::HidPrefix.
- Wire round-trip test: real Unix socket, NDJSON hello contract.
Registered in workspace members; added to hives/common deps.
Swap the worker's manual Unix-socket connect/split/hello-write/read loop for hum_thrum::connect / send_json / read_tones, keeping the nest-specific dispatch (cells, MCP bridge, handle_prompt) in the closure. The cancel / tool-result arms now spawn per-tone to fit the sync read_tones closure, matching the forager's all-spawn pattern. Behavior preserved: hello envelope, MCP bridge, per-sid cell routing, grace-window reconnect policy all unchanged.
Move the axum JSON-RPC bridge (spawn_local_mcp / McpBridge / handle)
from nest-common into a standalone hum-mcp crate so remote worker
hives can expose tools to their compute over MCP without pulling the
daemon tree.
- New crate hum-mcp: mcp (protocol/catalogue/translate) + thrum-core
(rid) + axum + tokio + parking_lot. Keeps the mcp crate pure (no
server) — the bridge is the axum layer on top.
- hives/common/src/mcp_bridge.rs becomes a thin re-export shim for
back-compat; existing nest_common::{spawn_local_mcp, McpBridge}
call sites keep resolving.
- Moved the bridge tests (tools/list + tools/call round-trip) along.
Registered in workspace members; added to hives/common deps.
forager.rs defined its own ToolDef/ToolResult with the same shape as
mcp::protocol's. Remove the duplicates and use mcp::protocol::{ToolDef,
ToolResult} everywhere; nest-common now re-exports them from mcp.
humfs and the forager dispatch construct both types identically, so the
unify is a no-op at call sites (mcp's ToolResult also derives
Serialize/Default + serde attrs).
No separate hum-tooldef crate — mcp is already a pure library, so the
shared tool-surface types re-export straight from it (per the doc's
'...or just from mcp' option).
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
Lands the "reusable crates for remote hives" boundary proposed in
hives/common/REUSABLE_CRATES.md. A remote hive (source in a foreignrepo, shallow-cloned by
hum hive install) should depend on small leafcrates for the wire, not the daemon's whole dependency tree.
Today every Rust hive that wants identity minting, the serve loop, or an
MCP bridge pulls
nest-common, which transitively dragsensemble(iroh/rustls),
nest(command-group/portable-pty/sysinfo),drone,mcp,hum-paths. The carve reduces that to tokio + serde + ed25519 + sha2 + hex(+ axum for MCP).
Commits (c3cd7a6..a39c878)
ids— moveHid/HidPrefix/HidParseErrorout ofensemble;ensemblere-exportsids::{...}for back-compat.hum-identity(new) —load_or_mint_bee_key/BeeKey/bee_key_pathas a leaf crate (ids+hum-paths+ed25519-dalek+rand).hives/common::identityis a thin re-export shim.hum-thrum(new) — the wire client (connect/send_json/read_tones/serve_forever).serve_foragerandserve_workernow use it; chi semantics stay in
nest-common.hum-mcp(new) — the axum JSON-RPC bridge (spawn_local_mcp/McpBridge).hives/common::mcp_bridgeis a thin shim; themcpcrate stays a pure library (no server).
ToolDef/ToolResultonmcp::protocol(dropped the
forager.rsduplicates;nest-commonre-exports frommcp).What stays in the daemon tree
nest's cell pool /WorkerBee/Egg,drone+suspicion_regex(sentinel), and
ensembleitself (the mesh is humd-to-humd; a beereaches a remote humd through that humd's transport, never opening the
mesh). Each new crate is independently publishable so an
Orchfilecanpoint a hive at
hum-thrum+hum-identityinstead of the whole repo.Verification
cargo build --workspace --exclude grpc-foragerclean(MCP bridge), nest-common, mcp, humfs (39) — 68 tests, 0 failed
grpc-foragerexcluded: needsprotoc(environment prerequisite,unrelated to this change)
Docs
hives/common/REUSABLE_CRATES.mdupdated to mark the carve as landed andlist what's done.