Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
41691b7
feat(workspace): add openhuman-process crate and reqwest dependency
senamakel Nov 25, 2026
d0bf86f
feat(host): add refused error variant for unsupported seats
senamakel Nov 25, 2026
a791c23
test(host): cover refused seat preserving the client error
senamakel Nov 25, 2026
15d2492
feat(capability): add capability module for openhuman process
senamakel Nov 25, 2026
143eecc
test(capability): add tests for capability handling
senamakel Nov 25, 2026
e176ea1
feat(config): add openhuman process config module
senamakel Nov 25, 2026
a737666
feat(config): add toml config loader
senamakel Nov 25, 2026
2c91a71
feat(config): add tests for openhuman process config
senamakel Nov 25, 2026
5e9caec
feat(openhuman-process): add crate for spawning and supervising OpenH…
senamakel Nov 25, 2026
acd29a3
test(capability): tighten fixtures for unsupported field checks
senamakel Nov 25, 2026
028c3c7
test(openhuman-process): add http test support helper
senamakel Nov 25, 2026
4d19cf8
feat(tests): add fake surface for openhuman process tests
senamakel Nov 25, 2026
1e9938d
feat(fixture): add openhuman process fixture
senamakel Nov 25, 2026
f47d6fd
test(rpc): add tests for openhuman rpc process handling
senamakel Nov 25, 2026
c0cde4c
test(rpc): fix malformed sse fixture in split-frame test
senamakel Nov 25, 2026
7a7a4f3
feat(openhuman-process): add rpc module and test fixtures
senamakel Nov 25, 2026
6e7555e
feat(turn): add turn module for openhuman process
senamakel Nov 25, 2026
01f534e
fix(openhuman-process): keep the active turn when a failure is not te…
senamakel Nov 25, 2026
cb344c0
test(instance): add coverage for process instance handling
senamakel Nov 25, 2026
ab9e06b
feat(openhuman-process): add error and instance modules
senamakel Nov 25, 2026
a2f603a
test(fake): clear subscribers when the fake surface is dropped
senamakel Nov 25, 2026
86e4b27
refactor(turn): carry the thread on the active turn
senamakel Nov 25, 2026
05a8458
feat(instance): start and verify an openhuman instance
senamakel Nov 25, 2026
382155e
refactor(instance): simplify launch argument construction and probe h…
senamakel Nov 25, 2026
534298b
feat(harness): add harness module for openhuman process
senamakel Nov 25, 2026
f7ca461
feat(harness): add seat module for openhuman process
senamakel Nov 25, 2026
969d5a3
feat(openhuman): add resume and render errors and document the harness
senamakel Nov 25, 2026
870a073
test(openhuman-process): add conformance suite over a fake core child
senamakel Nov 25, 2026
39492b7
test(live): allow dead code in shared http test helper
senamakel Nov 25, 2026
4b7eb00
test: share seat and process helpers across conformance suites
senamakel Nov 25, 2026
1bec2b9
test(live): run the conformance cases against the pinned core
senamakel Nov 25, 2026
fadd238
fix(openhuman-process): disable tool-output compaction in the written…
senamakel Nov 25, 2026
4ef18be
feat(ci): add harness fetch script and lock file
senamakel Nov 25, 2026
e9376b7
fix(ci): suppress sha256sum stderr during harness cache check
senamakel Nov 25, 2026
922be66
ci(assert-pure): include process harness client in host crates
senamakel Nov 25, 2026
7b6efc9
fix(ci): exclude the checked crate's own line from purity check
senamakel Nov 25, 2026
0944efc
docs(tinyhivemind-openhuman-process): add READMEs for crate modules a…
senamakel Nov 25, 2026
70af08d
docs(harnesses): document the openhuman process runner
senamakel Nov 26, 2026
191bac3
style(tinyhivemind-openhuman-process): apply rustfmt formatting
senamakel Nov 26, 2026
8fb62c5
refactor(tinyhivemind-openhuman-process): move error module into a di…
senamakel Nov 26, 2026
004ab8d
test(instance): cover every tool source the start check must see
senamakel Nov 26, 2026
75fdc8f
fix(openhuman-process): resolve visible tools from the chat agent's a…
senamakel Nov 26, 2026
375b7c6
test(conformance): cover a failed first turn leaving the seat startable
senamakel Nov 26, 2026
ea4cf99
fix(seat): report a failed first turn as having no session
senamakel Nov 26, 2026
b448a96
fix(openhuman-process): redact secrets from debug output
senamakel Nov 26, 2026
37271bc
fix(harness): reserve seats before starting and stop instances starte…
senamakel Nov 26, 2026
d1ea13c
fix(instance): harden key and config file handling and surface stop f…
senamakel Nov 26, 2026
de44427
docs: document seat reservation, visible-tool computation and approva…
senamakel Nov 26, 2026
6b38ad5
refactor(instance): rename chmod helper and drop unused import
senamakel Nov 26, 2026
72acb30
Merge tinyhivemind-host into openhuman-process
sanil-23 Nov 26, 2026
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
15 changes: 9 additions & 6 deletions .github/scripts/assert-pure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ set -euo pipefail
# whose vocabulary dependency includes `anyhow` and `async-trait`.
pure_crates=("tinyhivemind-core" "tinyhivemind-lang")
tool_crates=("tinyhivemind-tools")
# Host runs harnesses as processes (ADR 0035), and the MCP server serves them
# hive tools over loopback (ADR 0036), so both may hold a runtime and a
# listener, but neither may link a harness.
host_crates=("tinyhivemind-host" "tinyhivemind-mcp")
# Host and the process harness clients run harnesses as processes (ADR 0035),
# and the MCP server serves them hive tools over loopback (ADR 0036), so they may
# hold a runtime, a listener and an HTTP client, but none may link a harness.
host_crates=("tinyhivemind-host" "tinyhivemind-mcp" "tinyhivemind-openhuman-process")

forbidden_pure='tokio|futures|async-trait|axum|hyper|reqwest|ureq|curl|anyhow|rusqlite|git2|openhuman|tinyagents|tinytools'
# Whole families: `openhuman-embed`, `tinyagents-harness` and so on.
Expand All @@ -40,7 +40,9 @@ check_crate() {
echo "assert-pure: cargo tree failed for '$crate'" >&2
exit 1
}
found="$(grep -Ei "^(${forbidden})(-embed)? v" <<<"$tree" || true)"
# The crate's own line is not a dependency: `tinyhivemind-openhuman-process`
# is named like the forbidden linked adapter's family.
found="$(grep -Ei "^(${forbidden})(-embed)? v" <<<"$tree" | grep -v "^${crate} v" || true)"
if [ -n "$found" ]; then
echo "$crate pulled in a dependency its manifest forbids:" >&2
echo "$found" >&2
Expand All @@ -64,7 +66,8 @@ if [ "$status" -ne 0 ]; then
echo "A pure crate is linked into the hot path of every agent turn and must" >&2
echo "compile in a host's default build. It must stay free of async" >&2
echo "runtimes, transports, HTTP clients and web frameworks. The host crate" >&2
echo "runs harnesses as processes and must link none (ADR 0035)." >&2
echo "and the process harness clients run harnesses as processes and must" >&2
echo "link none (ADR 0035)." >&2
exit 1
fi

Expand Down
75 changes: 75 additions & 0 deletions .github/scripts/fetch-harness.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/env bash
# fetch-harness.sh <kind> <directory> [target]
#
# Fetch the harness binary `harnesses.lock` pins for <kind> and <target>
# (default: this machine's), verify it, and print the binary's absolute path.
# The asset's sha256 must match the lock, and so must the binary's where the
# lock records it. Nothing is installed or run; the library takes the path.
#
# THM_OPENHUMAN_CORE=$(.github/scripts/fetch-harness.sh openhuman target/harness)
set -euo pipefail

kind="${1:?usage: fetch-harness.sh <kind> <directory> [target]}"
dest="${2:?usage: fetch-harness.sh <kind> <directory> [target]}"
target="${3:-$(uname -m)-unknown-linux-gnu}"
root="$(cd "$(dirname "$0")/../.." && pwd)"
lock="$root/harnesses.lock"

# The entry of the lock for this kind and target, as `key=value` lines.
entry="$(awk -v kind="[[$kind]]" -v target="$target" '
$0 == kind { inside = 1; delete fields; next }
/^\[\[/ { inside = 0 }
inside && /^[a-z_0-9]+ = "/ {
key = $1; value = $0; sub(/^[^"]*"/, "", value); sub(/"[^"]*$/, "", value)
fields[key] = value
if (key == "binary" && fields["target"] == target) {
for (k in fields) print k "=" fields[k]
}
}
inside && /^binary_sha256 = / && fields["target"] == target { print "binary_sha256=" fields["binary_sha256"] }
' "$lock" | sort -u)"
# One entry per kind and target: two would leave the pin ambiguous.
count="$(awk -v kind="[[$kind]]" -v target="target = \"$target\"" '
$0 == kind { inside = 1; next }
/^\[\[/ { inside = 0 }
inside && $0 == target { n++ }
END { print n + 0 }
' "$lock")"
if [ "$count" -gt 1 ]; then
echo "fetch-harness: harnesses.lock has $count $kind entries for $target" >&2
exit 1
fi
field() { sed -n "s/^$1=//p" <<<"$entry"; }
url="$(field url)"; sha="$(field sha256)"; version="$(field version)"
binary="$(field binary)"; binary_sha="$(field binary_sha256)"
if [ -z "$url" ] || [ -z "$sha" ] || [ -z "$binary" ]; then
echo "fetch-harness: no $kind entry for $target in harnesses.lock" >&2
exit 1
fi

mkdir -p "$dest"
dest="$(cd "$dest" && pwd)"
asset="$dest/$(basename "$url")"
if ! echo "$sha $asset" | sha256sum -c --status >/dev/null 2>&1; then
curl -fsSL --proto '=https' --proto-redir '=https' -o "$asset.partial" "$url"
mv "$asset.partial" "$asset"
fi
if ! echo "$sha $asset" | sha256sum -c --status; then
echo "fetch-harness: $asset does not have the sha256 harnesses.lock pins" >&2
rm -f "$asset"
exit 1
fi

unpacked="$dest/$kind-$version-$target"
rm -rf "$unpacked" && mkdir -p "$unpacked"
tar -xzf "$asset" -C "$unpacked"
path="$(find "$unpacked" -type f -name "$binary" | head -n 1)"
if [ -z "$path" ]; then
echo "fetch-harness: $asset holds no $binary" >&2
exit 1
fi
if [ -n "$binary_sha" ] && ! echo "$binary_sha $path" | sha256sum -c --status; then
echo "fetch-harness: $path does not have the sha256 harnesses.lock pins" >&2
exit 1
fi
echo "$path"
4 changes: 4 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ crates/
├── tinyhivemind-host/ # hive tool belt, policies, package plans, harness processes
├── tinyhivemind-mcp/ # hive and package tools served to harness processes over loopback MCP
├── tinyhivemind-openhuman/ # package deployment, seat runners, host integration
├── tinyhivemind-openhuman-process/ # OpenHuman seats as supervised processes
├── tinyhivemind-hives/ # durable cross-hive coordinator
└── tinyhivemind-lang/ # pure hive packages: structure, integrations, edits, lineage
wiki/ # GitHub wiki submodule
Expand All @@ -99,6 +100,9 @@ permissions, profiles, hooks, session, Jev, features and workflows — as data,
and lowering resolves it per seat; it names no harness type and starts no
process. `tinyhivemind-exec` runs those executable tools and hooks
(`docs/specs/executable-tools.md`) and is not one of the pure crates.
`tinyhivemind-openhuman-process` implements the host's harness port for the
`openhuman` kind over a pinned `openhuman-core` binary (`harnesses.lock`); it
links no harness either.
`tinyhivemind-host` depends on core, hives and lang, and owns what every harness
shares: the hive tools and their dispatch, the send and management policy ports,
turn scope and prompt, package loading, the deployment plan, and supervised
Expand Down
17 changes: 17 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resolver = "3"
# package, each directory named for the package it holds. There is no root
# package: the crate a host links is `crates/tinyhivemind-core`, the same as any
# other member. Keeping the root virtual is what makes that uniform.
members = ["crates/tinyhivemind-core", "crates/tinyhivemind-tools", "crates/tinyhivemind-openhuman", "crates/tinyhivemind-hives", "crates/tinyhivemind-lang", "crates/tinyhivemind-exec", "crates/tinyhivemind-host", "crates/tinyhivemind-mcp"]
members = ["crates/tinyhivemind-core", "crates/tinyhivemind-tools", "crates/tinyhivemind-openhuman", "crates/tinyhivemind-hives", "crates/tinyhivemind-lang", "crates/tinyhivemind-exec", "crates/tinyhivemind-host", "crates/tinyhivemind-mcp", "crates/tinyhivemind-openhuman-process"]
# `worktrees/` holds `git worktree` checkouts of this same repository; each
# contains a full copy of this manifest. Keep them excluded from Cargo
# workspace discovery.
Expand Down Expand Up @@ -48,6 +48,14 @@ http-body-util = "0.1"
subtle = { version = "2", default-features = false, features = ["std"] }
# Random per-seat bearers, from the operating system.
getrandom = "0.3"
# The HTTP client process harness clients speak to a harness's loopback API
# with: JSON-RPC posts and a Server-Sent Events stream. Default features off,
# so no TLS stack, no HTTP/2 and no proxy lookup from the environment: every
# URL is `http://127.0.0.1`, and a proxy must never see a seat's token. It is
# already in this lockfile through the linked OpenHuman tree and `wiremock`,
# and it is `MIT OR Apache-2.0`. Its streaming `Response::chunk` is all SSE
# needs, so the `stream` feature is not taken either.
reqwest = { version = "0.12", default-features = false }
# Durable cross-hive coordinator used at the harness boundary.
tinyhivemind-hives = { path = "crates/tinyhivemind-hives" }
# Concurrent owned runner futures in the coordinator, outside core.
Expand Down
4 changes: 4 additions & 0 deletions crates/tinyhivemind-host/src/harness/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ pub enum Error {
/// The started instance is not what was asked for.
#[error(transparent)]
Mismatch(#[from] Mismatch),
/// The seat asks for something this harness cannot honour, so it is not
/// started. The client's own error says what, and may be downcast to it.
#[error("the seat cannot run on this harness: {0}")]
Refused(#[source] Box<dyn std::error::Error + Send + Sync>),
/// The harness refused a call, broke its protocol or went away.
#[error("harness failed: {0}")]
Harness(String),
Expand Down
14 changes: 14 additions & 0 deletions crates/tinyhivemind-host/src/harness/test/payloads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,17 @@ fn a_port_error_reaches_the_coordinator_as_its_own_message() {
};
assert!(resume.to_string().contains("s1"));
}

#[test]
fn a_refused_seat_keeps_the_clients_own_error() {
let reason = std::io::Error::other("no provider");
let error = Error::Refused(Box::new(reason));
assert_eq!(
error.to_string(),
"the seat cannot run on this harness: no provider"
);
let Error::Refused(source) = error else {
unreachable!("built as refused")
};
assert!(source.downcast_ref::<std::io::Error>().is_some());
}
72 changes: 72 additions & 0 deletions crates/tinyhivemind-openhuman-process/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
[package]
name = "tinyhivemind-openhuman-process"
description = "Hive seats on OpenHuman as supervised `openhuman-core` child processes, through its JSON-RPC and event stream."
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true
readme = "README.md"
publish = false
# This crate names no OpenHuman type and links no harness (ADR 0035): it talks
# to a pinned `openhuman-core` binary over loopback HTTP. It is a crate of its
# own, not a module of `tinyhivemind-openhuman`, so that removing the linked
# adapter and `vendor/openhuman` deletes that crate without touching this one.
# `.github/scripts/assert-pure.sh` asserts that no harness enters its graph.

[features]
# The host's conformance suite, and the scripted fake `openhuman-core` it runs
# against, which has to be a real process and so is a binary.
conformance = ["tinyhivemind-host/conformance", "dep:toml", "dep:rustix"]

[[bin]]
name = "tinyhivemind-fake-openhuman"
path = "tests/fake/child.rs"
required-features = ["conformance"]
test = false
doc = false

[[test]]
name = "conformance"
required-features = ["conformance"]

[[test]]
name = "live"
required-features = ["conformance"]

[dependencies]
# The harness port, seat runner, verification and process supervision.
tinyhivemind-host.workspace = true
# `AgentRunner`, `TurnRequest` and `TurnOutcome`.
tinyhivemind-hives.workspace = true
# The lowered seat and its provider, which decide what may be written.
tinyhivemind-lang.workspace = true
# Loopback JSON-RPC and the `/events` stream.
reqwest.workspace = true
# Request and event payloads, and the effective config.
serde_json.workspace = true
# Typed errors.
thiserror.workspace = true
# Deadlines, the seat's locks and the close signal of a running turn.
tokio = { workspace = true, features = ["time", "sync", "macros", "rt", "net", "io-util"] }
# The fake child reads the config the runner wrote, as `openhuman-core` does.
toml = { version = "0.8", optional = true }
# The fake child's grandchild leaves its session with `setsid`; the workspace
# forbids `unsafe`, so `std`'s `pre_exec` is out. Already in the lockfile.
rustix = { version = "1.1", default-features = false, features = ["std", "process"], optional = true }

[dev-dependencies]
tinyhivemind-host = { workspace = true, features = ["conformance"] }
# Fallible tests over several error types.
anyhow.workspace = true
# Async tests, and the in-process fake's listener.
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "net", "io-util", "time", "sync", "process"] }
# Seat and control directories.
tempfile.workspace = true
# The in-process fake reads the written config.
toml = "0.8"
# Killing a seat's child in the conformance suite.
rustix = { version = "1.1", default-features = false, features = ["std", "process"] }

[lints]
workspace = true
21 changes: 21 additions & 0 deletions crates/tinyhivemind-openhuman-process/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# tinyhivemind-openhuman-process

Hive seats on OpenHuman without linking it: each seat is one supervised
`openhuman-core run --headless-api`, pinned by version and checksum, driven
over its loopback JSON-RPC and event stream. A seat starts only once the
running instance is shown to be the child that was started, at the pinned
version, with the config that was written, offering its model exactly the
hive's tools.

It implements the `openhuman` kind of the harness port in
[`tinyhivemind-host`](../tinyhivemind-host/README.md), names no OpenHuman type,
and is a crate of its own so that the linked
[`tinyhivemind-openhuman`](../tinyhivemind-openhuman/README.md) adapter and
`vendor/openhuman` can be deleted without touching it.
[The spec](../../docs/specs/harnesses.md) says what a seat may ask for; the
repository [README](../../README.md) says how this fits the rest.

| Path | Purpose |
| --- | --- |
| [`src/`](src/README.md) | The crate's modules |
| [`tests/`](tests/README.md) | Conformance over a fake child, and `live_*` on the pin |
13 changes: 13 additions & 0 deletions crates/tinyhivemind-openhuman-process/src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Source

| Path | Purpose |
| --- | --- |
| `lib.rs` | Crate overview and public surface: `OpenHumanHarness`, `Program`, `Options`, `capability`. |
| [`error/`](error/README.md) | The crate's internal `Error`, and how it reaches the port as `harness::Error`. |
| `fixture.rs` | Unit tests only: the in-process fake surface with a written config, and a client. |
| [`capability/`](capability/README.md) | What a lowered seat may ask of this harness: `check`, `Refusal`, `SeatModel`. |
| [`config/`](config/README.md) | The generated `config.toml`, and comparing an effective config with it. |
| [`rpc/`](rpc/README.md) | The loopback client: JSON-RPC, `/health`, `/events`. |
| [`turn/`](turn/README.md) | One turn over `channel_web_chat` and its events; cancellation. |
| [`instance/`](instance/README.md) | Launching an instance, tool discovery, start-up verification. |
| [`harness/`](harness/README.md) | `OpenHumanHarness` and the seat it runs. |
22 changes: 22 additions & 0 deletions crates/tinyhivemind-openhuman-process/src/capability/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Capability

`check` holds a `LoweredSeat` to the `openhuman` column of the capability
table in [the spec](../../../../docs/specs/harnesses.md#capabilities) and
returns the `SeatModel` the config is written from, or the first `Refusal`.

- Providers: only `openai` with an explicit endpoint and no credential. No
model, no provider (inherit), `inherit`, `openrouter`, `anthropic`, a missing
endpoint and a credential are each a `Refusal`.
- `temperature` and `max_tokens` are refused: nothing proves the binary honours them.
- `limits.iterations` above `ITERATION_CAP` (8) is refused; below it, a turn
past the limit fails. `limits.budget_usd` is refused.
- A sandbox other than `none`, a built-in tool group not `off`, `memory`,
`agent_id`, `definition_base`, `subagents`, `skills`, `context` and
`bare_prompt` are refused.
- Hive and executable tools, hooks, permissions other than `sandbox`,
`autonomy`, `access` and package MCP servers are host side and not judged here.

| File | Purpose |
| --- | --- |
| `mod.rs` | `check`, `Refusal`, `SeatModel`, `ITERATION_CAP` |
| `test.rs` | Every row and refusal |
Loading
Loading