3.4 KiB
01.1 — ToolPolicy round-trip
The spec's "SDK gap: ToolSchema has no metadata map" is obsolete: the crate
Tool trait has policy() -> ToolPolicy and ToolRegistry::policies().
Current status (2026-07-02): adapters expose classified SDK policies, the
crate ToolPolicyMiddleware is installed from harness.tools().policies(), and
ToolOutputMiddleware now reads per-tool result caps from that registry
snapshot instead of rebuilding a name -> Arc<dyn Tool> lookup. The remaining
crate-internal OpenHuman lookups are behavior-preserving overlays for data the
crate policy snapshot cannot represent yet: args-aware external effects,
CLI/RPC-only scope, args-aware permission level, and generated-tool runtime
context. The local tinyagents/middleware.rs module is crate-internal; turn
config types stay crate-visible only through openhuman::tinyagents re-exports.
The ToolAdapter/SharedToolAdapter execution wrappers are crate-internal
implementation details of the shared runner.
Steps
- In
src/openhuman/tinyagents/tools.rs(ToolAdapter/SharedToolAdapter), implementpolicy()by mapping OpenHuman trait methods (src/openhuman/tools/traits.rs): permission level →ToolAccess { approval_required, background_safe };external_effect→ToolSideEffects; timeout policy →ToolRuntime.timeout_ms; concurrency safety →ToolRuntime.idempotent;max_result_size_chars→ToolRuntime.max_result_bytes; sandbox mode →SandboxMode. Every adapter-produced policy setsclassified: true. - Partially done: rework
ApprovalSecurityMiddleware,CliRpcOnlyMiddleware,ToolPolicyMiddleware, andToolOutputMiddleware(src/openhuman/tinyagents/middleware.rs) to readToolPolicyfrom the registry instead of the sharedname → Arc<dyn Tool>side-lookup.ToolOutputMiddlewareis registry-backed. Keep the crate-internal OpenHuman overlays the static crate policy cannot yet express:external_effect_with_args,ToolScope::CliRpcOnly,permission_level_with_args, andgenerated_runtime_context. - Partially done: install crate
ToolPolicyMiddlewareinassemble_turn_harness(src/openhuman/tinyagents/mod.rs) withrequire_sandbox(true)only. TinyAgents 1.3 exposes classification, approval, and result-byte gates, but OpenHuman still keeps args-aware approval/audit and legacy result-cap wording in local overlays. Enable the stricter crate gates only after those overlays have equivalent policy coverage or can be deleted. Assert every registered tool is classified in the adapter-inventory test when those gates become fail-closed. - Done for output budgeting:
TurnContextMiddleware.installtakes the SDK policy snapshot instead of the&tool_setsparameter.
Deletions
- Deleted:
ToolOutputMiddleware'sname → Arc<dyn Tool>policy snapshot intinyagents/middleware.rs. - Remaining as crate-internal overlays by design until the SDK policy surface
grows equivalent metadata:
external_effect_with_args,ToolScope::CliRpcOnly,permission_level_with_args, andgenerated_runtime_contextoverlays. - Deleted: redundant per-call trait re-queries in the legacy
agent_tool_exec.rspolicy chain.
Acceptance
ToolRegistry::policies()snapshot test: all tools classified, policies serialize stably.- Approval/security/output behavior parity tests still green (middleware suite ~22 tests).