Skip to content

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

chore: files changed crates/openhuman-core/src/agent/artifacts/ops.rs,crates/openhuman-core/src/tool

Steven Enamakel3fbe232a3a43
diff --git a/crates/openhuman-core/src/agent/artifacts/ops.rs b/crates/openhuman-core/src/agent/artifacts/ops.rs
index eb0cca8b57..e70a21288f 100644
--- a/crates/openhuman-core/src/agent/artifacts/ops.rs
+++ b/crates/openhuman-core/src/agent/artifacts/ops.rs
@@ -151,7 +151,7 @@ pub async fn ai_delete_artifact(
/// "not regenerable" error rather than a silent no-op.
/// 3. Rebuild the producer tool + a fresh [`SecurityPolicy`] from the
/// live config and run it inside both:
-/// - `REGENERATE_TARGET_ID.scope(artifact_id, …)` so `create_artifact`
+/// - `PresentationTool::with_regenerate_target(artifact_id)` so `create_artifact`
/// reuses the id + directory instead of minting a new one, and
/// - `APPROVAL_CHAT_CONTEXT.scope({thread_id, client_id}, …)` so the
/// Pending/Ready/Failed events route back to the originating chat
@@ -210,12 +210,16 @@ async fn regenerate_presentation(
&config.workspace_dir,
&config.action_dir,
));
+ // The regenerate target is an explicit constructor argument of the tool
+ // that produces the artifact: its `create_artifact_regenerating` call
+ // reuses this id instead of minting a new one.
let tool = PresentationTool::with_config(
config.workspace_dir.clone(),
super::files::FileRoots::from_config(config),
security,
config.clone(),
- );
+ )
+ .with_regenerate_target(artifact_id);
let chat_ctx = ApprovalChatContext {
thread_id: thread_id.to_string(),
@@ -225,11 +229,8 @@ async fn regenerate_presentation(
request_id: None,
};
- let result = store::REGENERATE_TARGET_ID
- .scope(
- artifact_id.to_string(),
- APPROVAL_CHAT_CONTEXT.scope(chat_ctx, async move { tool.execute(args).await }),
- )
+ let result = APPROVAL_CHAT_CONTEXT
+ .scope(chat_ctx, async move { tool.execute(args).await })
.await;
match result {
diff --git a/crates/openhuman-core/src/tools/impl/presentation/mod.rs b/crates/openhuman-core/src/tools/impl/presentation/mod.rs
index bdc03b09f2..ccf348c0b3 100644
--- a/crates/openhuman-core/src/tools/impl/presentation/mod.rs
+++ b/crates/openhuman-core/src/tools/impl/presentation/mod.rs
@@ -35,7 +35,7 @@ use async_trait::async_trait;
use serde_json::{json, Value};
use crate::agent::artifacts::{
- create_artifact, fail_artifact, finalize_artifact, read_artifact_bytes, ArtifactKind,
+ create_artifact_regenerating, fail_artifact, finalize_artifact, read_artifact_bytes, ArtifactKind,
};
use crate::security::SecurityPolicy;
use tinytools::{PermissionLevel, Tool, ToolResult};