The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(artifact_offload): correct contract type for offload request
Steven Enamakel5eb2c29a3574
diff --git a/crates/openhuman-core/src/agent/harness/artifact_offload/contract.rs b/crates/openhuman-core/src/agent/harness/artifact_offload/contract.rsdeleted file mode 100644index e856edd6ff..0000000000--- a/crates/openhuman-core/src/agent/harness/artifact_offload/contract.rs+++ /dev/null@@ -1,69 +0,0 @@-//! The prompt-side half of the artifact-offload convention (#3883).-//!-//! Single source of truth for the directory names the model is told about, so-//! the prompt and [`super::paths::resolve_artifact_path`] can never drift.--use std::collections::HashSet;--use tinyagents_harness::artifacts::{OUTPUTS_DIR, SCRATCH_DIR};--/// Approximate token budget quoted to the model as the offload trigger.-/// Mirrors [`super::types::DEFAULT_OFFLOAD_THRESHOLD_BYTES`] at the harness-wide-/// 4-chars-per-token estimate.-const CONTRACT_THRESHOLD_TOKENS: usize = 2_000;--/// Heading the contract is rendered under. Used by the idempotence check in-/// `subagent_host::ops::prompt` so a re-rendered prompt never stacks two-/// copies.-pub const ARTIFACT_OFFLOAD_HEADING: &str = "## Long-horizon Artifact Offload";--/// Tool a sub-agent must actually hold before the contract is worth rendering.-///-/// A prompt may only name tools the agent can really call: advertising one it-/// lacks produces hallucinated calls that fail. Every skill-filtered specialist-/// has no filesystem tools, and a dedicated guard asserts its prompt never-/// mentions one — see-/// `subagent_host::ops_tests::typed_mode_filters_tools_by_skill_filter`.-pub const OFFLOAD_WRITE_TOOL: &str = "file_write";--/// Whether the offload contract should be rendered for an agent whose visible-/// tools are `visible_tool_names`.-///-/// Only agents that can actually write a file are told to. Everyone else stays-/// covered by the harness-side automatic offload in-/// [`super::offload_oversized_result`], which needs no cooperation from the-/// model — which is exactly why that half exists.-pub fn should_render_offload_contract(visible_tool_names: &HashSet<String>) -> bool {- visible_tool_names.contains(OFFLOAD_WRITE_TOOL)-}--/// Render the offload contract for a sub-agent that holds a file-write tool.-///-/// Deliberately parameter-free and byte-stable: the sub-agent system prompt is-/// prefix-cached, so this must render identically on every run. Absolute paths-/// are never interpolated for the same reason (and because a worktree-isolated-/// worker resolves its own action root).-///-/// Names no tool other than [`OFFLOAD_WRITE_TOOL`]. In particular it does not-/// name the parent's *reading* tool: how the parent opens the file is not this-/// agent's business, and mentioning it would leak a tool name into prompts of-/// agents that do not hold it.-pub fn render_artifact_offload_contract() -> String {- format!(- "{ARTIFACT_OFFLOAD_HEADING}\n\n\-Large results belong on disk, not in your reply. Two directories sit under your action directory:\n\-- `{OUTPUTS_DIR}/` for deliverables, anything the parent or a later step needs to read.\n\-- `{SCRATCH_DIR}/` for scratch, intermediate files you do not intend to hand back.\n\-\n\-When a result would run past roughly {CONTRACT_THRESHOLD_TOKENS} tokens:\n\-1. Write the full content to a file under `{OUTPUTS_DIR}/` with `{OFFLOAD_WRITE_TOOL}`.\n\-2. Reply with that relative path plus a short abstract, not the full payload.\n\-3. Quote the path exactly, so the parent can open it verbatim.\n\-\n\-Rules:\n\-- Offload paths are always relative to your action directory. Never write outside it, and never target the core's internal workspace state.\n\-- Keep the abstract honest: say what the file holds and what is still open. Never present it as the complete result.\n\-- Small results stay inline. A pointer to a two-line file costs the parent more than the two lines.\n\-- If you inline an oversized result anyway, the harness persists it under `{OUTPUTS_DIR}/` and hands the parent the path instead.\n"- )-}diff --git a/crates/openhuman-core/src/agent/harness/artifact_offload/mod.rs b/crates/openhuman-core/src/agent/harness/artifact_offload/mod.rsindex 4ac02620a2..5a59acc465 100644--- a/crates/openhuman-core/src/agent/harness/artifact_offload/mod.rs+++ b/crates/openhuman-core/src/agent/harness/artifact_offload/mod.rs@@ -9,10 +9,11 @@//!//! ## What stayed, and why//!-//! * **[`contract`] — the prompt half.** It is OpenHuman prompt text naming-//! OpenHuman tools, which `plan-agents.md` §6 lists as not publishable. The-//! crate's [`render_artifact_pointer`] takes the read-tool name as a-//! parameter for the same reason, and [`READ_TOOL`] is what OpenHuman passes.+//! * **The tool names.** The prompt contract now lives in the crate too+//! (`render_artifact_offload_contract`); the write-tool name it may mention,+//! [`OFFLOAD_WRITE_TOOL`], and the read-tool name for+//! [`render_artifact_pointer`], [`READ_TOOL`], are host vocabulary and are+//! passed in.//! * **[`policy`] — the two host policies.** `SecurityPolicy`'s workspace//! containment and `sanitize_text`'s credential scrubbing. The crate asks;//! these answer.@@ -32,7 +33,7 @@//!//! Two halves enforce it://!-//! * **Prompt** — [`render_artifact_offload_contract`] is appended to every+//! * **Prompt** — `render_artifact_offload_contract` is appended to every//! typed sub-agent's system prompt, so workers offload on purpose.//! * **Harness** — [`offload_oversized_result`] runs on every sub-agent//! outcome, so an oversized result is offloaded even when the worker inlined@@ -45,7 +46,6 @@//! failure mode here — a refused path, a full disk — the caller keeps its//! inline payload and falls through to them.-mod contract;pub mod policy;use std::path::PathBuf;@@ -55,10 +55,15 @@ use tinyagents_harness::artifacts::ArtifactOffload;use crate::security::SecurityPolicy;-pub use contract::{- render_artifact_offload_contract, should_render_offload_contract, ARTIFACT_OFFLOAD_HEADING,- OFFLOAD_WRITE_TOOL,-};++/// Tool a sub-agent must actually hold before the offload contract is worth+/// rendering. Passed to the crate's+/// [`render_artifact_offload_contract`](tinyagents_harness::artifacts::render_artifact_offload_contract)+/// and `should_render_offload_contract`: a prompt may only name tools its agent+/// can really call, and every skill-filtered specialist has no filesystem tools+/// (see `subagent_host::ops_tests::typed_mode_filters_tools_by_skill_filter`).+pub const OFFLOAD_WRITE_TOOL: &str = "file_write";+pub use policy::{SanitizingRedactor, WorkspaceGuard};pub use tinyagents_harness::artifacts::{build_abstract, effective_offload_threshold, extract_artifact_paths, note_artifact_handoff,diff --git a/vendor/tinyagents b/vendor/tinyagentsindex ecf849a362..13bceca50b 160000--- a/vendor/tinyagents+++ b/vendor/tinyagents@@ -1 +1 @@-Subproject commit ecf849a3626ed0342c8feaa55a19b8bfc55ba619+Subproject commit 13bceca50ba2461333d20676fd14b0d9059d3cc2