Skip to content

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

refactor(document): pass dispatch context to document tool execution

Steven Enamakel1c32994b91ae
diff --git a/crates/openhuman-core/src/tools/impl/document/mod.rs b/crates/openhuman-core/src/tools/impl/document/mod.rs
index c5b3a76640..68c9f3d9fd 100644
--- a/crates/openhuman-core/src/tools/impl/document/mod.rs
+++ b/crates/openhuman-core/src/tools/impl/document/mod.rs
@@ -198,7 +198,8 @@ impl Tool for DocumentTool {
}
async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {
- self.run(args, None).await
+ self.run(args, None, &crate::core::runtime::DispatchCtx::ambient())
+ .await
}
async fn execute_with_context(
@@ -208,7 +209,12 @@ impl Tool for DocumentTool {
context: Option<&dyn tinytools::ToolRunContext>,
) -> anyhow::Result<ToolResult> {
let approval = crate::agent::tinyagents::host::run_context::approval_for_tool(context);
- self.run(args, approval.chat.as_ref()).await
+ self.run(
+ args,
+ approval.chat.as_ref(),
+ &crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool(context),
+ )
+ .await
}
}
@@ -219,6 +225,7 @@ impl DocumentTool {
&self,
args: Value,
chat: Option<&crate::security::approval::ApprovalChatContext>,
+ ctx: &crate::core::runtime::DispatchCtx,
) -> anyhow::Result<ToolResult> {
// The document wire contract is `deny_unknown_fields`, so the optional
// `artifact_id` is read here (and stripped from the args before
@@ -258,7 +265,8 @@ impl DocumentTool {
// Reserve the file and open the artifact: a new one, or a new version
// of `artifact_id` (same id, same file, history kept).
- let production = Production::start(
+ let production = Production::start_in(
+ ctx,
&self.workspace_dir,
self.files_dir.clone(),
tiny_artifacts::ArtifactKind::File,