Skip to content

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

refactor(tools): register the document producers through for_config

M3gA-Mindc450494817c2
diff --git a/crates/openhuman-core/src/tools/impl/document/mod.rs b/crates/openhuman-core/src/tools/impl/document/mod.rs
index ebaffffb88..374fbcb178 100644
--- a/crates/openhuman-core/src/tools/impl/document/mod.rs
+++ b/crates/openhuman-core/src/tools/impl/document/mod.rs
@@ -93,6 +93,16 @@ impl DocumentTool {
security,
}
}
+
+ /// The agent-registry constructor: the artifact metadata goes to
+ /// `config.workspace_dir`, the document to the files folder (#5505).
+ pub fn for_config(config: &crate::config::Config, security: Arc<SecurityPolicy>) -> Self {
+ Self::new(
+ config.workspace_dir.clone(),
+ crate::config::default_files_dir(),
+ security,
+ )
+ }
}
#[async_trait]
diff --git a/crates/openhuman-core/src/tools/impl/presentation/mod.rs b/crates/openhuman-core/src/tools/impl/presentation/mod.rs
index 0c646d581f..702c30ebcb 100644
--- a/crates/openhuman-core/src/tools/impl/presentation/mod.rs
+++ b/crates/openhuman-core/src/tools/impl/presentation/mod.rs
@@ -95,6 +95,16 @@ impl PresentationTool {
}
}
+ /// The agent-registry constructor: the artifact metadata goes to
+ /// `config.workspace_dir`, the deck to the files folder (#5505).
+ pub fn for_config(config: &crate::config::Config, security: Arc<SecurityPolicy>) -> Self {
+ Self::new(
+ config.workspace_dir.clone(),
+ crate::config::default_files_dir(),
+ security,
+ )
+ }
+
/// Construct the tool with an authoritative host config snapshot.
pub(crate) fn with_config(
workspace_dir: PathBuf,
diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rs
index 7c7fd80c17..db2be1df23 100644
--- a/crates/openhuman-core/src/tools/ops.rs
+++ b/crates/openhuman-core/src/tools/ops.rs
@@ -660,9 +660,8 @@ pub fn all_tools_with_runtime(
// managed Python venv, no first-call install latency. Always
// registered.
#[cfg(feature = "documents")]
- tools.push(Box::new(PresentationTool::new(
- root_config.workspace_dir.clone(),
- crate::config::default_files_dir(),
+ tools.push(Box::new(PresentationTool::for_config(
+ root_config,
security.clone(),
)));
@@ -671,9 +670,8 @@ pub fn all_tools_with_runtime(
// real `.docx` through the same byte-agnostic artifact pipeline as
// the presentation tool. Always registered; same constructor shape.
#[cfg(feature = "documents")]
- tools.push(Box::new(DocumentTool::new(
- root_config.workspace_dir.clone(),
- crate::config::default_files_dir(),
+ tools.push(Box::new(DocumentTool::for_config(
+ root_config,
security.clone(),
)));