Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

Merge upstream/main into ta-rem-7598

Steven Enamakel215f783b7b14
diff --cc crates/openhuman-core/src/agent/tinyagents/README.md
index 5966160e2c,5966160e2c..feb35c5a28
--- a/crates/openhuman-core/src/agent/tinyagents/README.md
+++ b/crates/openhuman-core/src/agent/tinyagents/README.md
@@@ -32,7 -32,7 +32,7 @@@ The adapter seam between OpenHuman and
| `replay/` | Read-only agent-run replay/status RPC (`mod.rs`, `ops.rs`, `schemas.rs`): three `agent`-namespace controllers; `ops.rs` is a workspace adapter over `tinyagents_harness::observability::replay`. |
| `journal.rs` | `TurnJournal` and `attach_turn_journal`: a crate `StoreEventJournal` over a JSONL append store plus a `HarnessStatusStore` writer (`FileStatusStore`, `mint_run_id` and the env-secret redaction seed are upstream in `tinyagents_harness::observability`) under `{workspace}/tinyagents_store`. Attached alongside the live `observability` bridge as an independent `EventSink` subscriber, wrapped in `RedactingSink`; best-effort and non-fatal. |
| `reaper.rs` | `reap_orphaned_runs`: workspace adapter over the upstream sweep (`tinyagents_harness::observability::reap_orphaned_runs`) that marks non-terminal runs `Cancelled` in the durable status store. The only writer over the status seam that `replay/` reads. |
--| [`middleware.rs`](./middleware.rs) + `middleware/` | The named OpenHuman middleware stack. `turn_context.rs`: `TurnContextMiddleware` (bundles config and installs the enabled hooks), `TranscriptSnapshotMiddleware`/`TranscriptSnapshotSink`. `tool_output.rs`: `ToolOutputMiddleware` (per-result byte cap and optional payload summarizer). `approval.rs`: `ApprovalSecurityMiddleware`. `cli_rpc_only.rs`: `CliRpcOnlyMiddleware`. `tool_policy.rs`: the `ToolPolicyMiddleware` struct and impl (records blocks into `crate::tools::registry::denials`). `tool_outcome_capture.rs`: `ToolOutcomeCaptureMiddleware`. `embedder_hooks.rs`: `EmbedderToolHooksMiddleware`. `memory_protocol.rs`: the OpenHuman tool vocabulary (`memory_protocol_spec()`) for the upstream `MemoryProtocolMiddleware`. `cost_budget.rs`: `CostBudgetMiddleware`. `repeated_failure.rs`: `RepeatedToolFailureMiddleware` (class-specific recovery budgets before the next model call; equivalent failures share a stable resource scope even when arguments differ). `loop_guards.rs`: `TerminalInferenceFailure`. `credential_scrub.rs`: the browser confirmation-token exemption and `credential_scrub_middleware()`, which wires the harness `CredentialScrubMiddleware`. The generic context-ladder and loop-guard middleware live in `tinyagents-harness` (`middleware::library`) and are installed by [`context_wiring.rs`](./context_wiring.rs) / `harness_assembly.rs`: `ImageAwareMessageTrimMiddleware`, `FinalCallWrapUpMiddleware` (host passes the `file_write`/`apply_patch` deliverable tools and `CLEARED_PLACEHOLDER`), `ArtifactIndexTocMiddleware` (issue #6014), `RepeatProgressMiddleware`/`RepeatEvictionObserver` (host passes the `wait_subagent` exemption), and `ArgRecoveryMiddleware`. |
++| [`middleware.rs`](./middleware.rs) + `middleware/` | The named OpenHuman middleware stack. `turn_context.rs`: `TurnContextMiddleware` (bundles config and installs the enabled hooks), `TranscriptSnapshotMiddleware`/`TranscriptSnapshotSink`. `tool_output.rs`: `ToolOutputMiddleware` (per-result byte cap and optional payload summarizer). `approval.rs`: `ApprovalSecurityMiddleware`. `tool_policy.rs`: the `ToolPolicyMiddleware` struct and impl (records blocks into `crate::tools::registry::denials`). `tool_outcome_capture.rs`: `ToolOutcomeCaptureMiddleware`. `embedder_hooks.rs`: `EmbedderToolHooksMiddleware`. `memory_protocol.rs`: the OpenHuman tool vocabulary (`memory_protocol_spec()`) for the upstream `MemoryProtocolMiddleware`. `cost_budget.rs`: `CostBudgetMiddleware`. `repeated_failure.rs`: `RepeatedToolFailureMiddleware` (class-specific recovery budgets before the next model call; equivalent failures share a stable resource scope even when arguments differ). `loop_guards.rs`: `TerminalInferenceFailure`. `credential_scrub.rs`: the browser confirmation-token exemption and `credential_scrub_middleware()`, which wires the harness `CredentialScrubMiddleware`. The generic context-ladder and loop-guard middleware live in `tinyagents-harness` (`middleware::library`) and are installed by [`context_wiring.rs`](./context_wiring.rs) / `harness_assembly.rs`: `ImageAwareMessageTrimMiddleware`, `FinalCallWrapUpMiddleware` (host passes the `file_write`/`apply_patch` deliverable tools and `CLEARED_PLACEHOLDER`), `ArtifactIndexTocMiddleware` (issue #6014), `RepeatProgressMiddleware`/`RepeatEvictionObserver` (host passes the `wait_subagent` exemption), and `ArgRecoveryMiddleware`. |
| [`middleware/research_budget.rs`](./middleware/research_budget.rs) | Withdraws the web tools from a top-level turn after eight successful search or fetch calls (forcing an answer only when no other tool remains), and notes once when consecutive web calls fail. |
| `model.rs` | Helpers and wrappers over native crate `ChatModel` values: message/response translation, usage merging, stream-delta forwarding, `MaxTokensModel`, `ProfileOverrideModel`. |
| [`tools.rs`](./tools.rs) | `CanonicalSharedToolAdapter`: resolves an OpenHuman shared tool registry and forwards the canonical `tinytools::Tool` contract; `EarlyExitHook` pauses successful `ask_user_clarification`-style calls. |
diff --cc crates/openhuman-core/src/agent/tinyagents/middleware.rs
index 4e9fae25ac,ebc01d15e2..a14fdd54e2
--- a/crates/openhuman-core/src/agent/tinyagents/middleware.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware.rs
@@@ -21,35 -21,23 +21,21 @@@
//! [`TurnContextMiddleware`] bundles the config and installs whichever hooks are
//! enabled onto a harness.
//!
- //! Each middleware lives in its own submodule below; this file only wires and
- //! re-exports them so `tinyagents::middleware::*` paths stay stable.
+ //! Each middleware lives in its own submodule below; callers import from the
+ //! owning submodule directly (no re-export facade).
- mod approval;
- mod credential_scrub;
- mod embedder_hooks;
- mod failure_policy;
- mod fetched_site;
- mod memory_pack;
- mod packed_tool_route;
- mod repeated_failure;
- mod tool_outcome_capture;
- mod tool_output;
- mod tool_policy;
- mod turn_context;
-
- pub(crate) use approval::ApprovalSecurityMiddleware;
- pub(crate) use credential_scrub::credential_scrub_middleware;
- pub(crate) use embedder_hooks::EmbedderToolHooksMiddleware;
- pub(crate) use memory_pack::memory_pack_middleware;
- pub(crate) use packed_tool_route::packed_tool_route_middleware;
- pub(crate) use repeated_failure::RepeatedToolFailureMiddleware;
- pub(crate) use tool_outcome_capture::ToolOutcomeCaptureMiddleware;
- #[cfg(test)]
- pub(crate) use tool_output::ToolOutputMiddleware;
- pub(crate) use tool_policy::{AllowAllToolPolicy, ToolPolicyMiddleware};
- pub(crate) use turn_context::{
- render_unanswered_steps, TranscriptSnapshot, TranscriptSnapshotSink, TurnContextMiddleware,
- };
+ pub(crate) mod approval;
-pub(crate) mod cli_rpc_only;
+ pub(crate) mod credential_scrub;
+ pub(crate) mod embedder_hooks;
+ pub(crate) mod failure_policy;
+ pub(crate) mod fetched_site;
+ pub(crate) mod memory_pack;
+ pub(crate) mod packed_tool_route;
+ pub(crate) mod repeated_failure;
-pub(crate) mod tool_exposure;
+ pub(crate) mod tool_outcome_capture;
+ pub(crate) mod tool_output;
+ pub(crate) mod tool_policy;
+ pub(crate) mod turn_context;
/// Render the canonical TinyTools content blocks at the OpenHuman boundary.
/// Middleware that used the retired string-shaped harness result must not