Skip to content

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

feat(artifacts): add dispatch context to production artifact

Steven Enamakelbbfe68efae61
diff --git a/crates/openhuman-core/src/artifacts/production.rs b/crates/openhuman-core/src/artifacts/production.rs
index 18e303a424..fc60573ccd 100644
--- a/crates/openhuman-core/src/artifacts/production.rs
+++ b/crates/openhuman-core/src/artifacts/production.rs
@@ -37,6 +37,7 @@ pub struct Production {
workspace_dir: PathBuf,
files: FileRoots,
chat: Option<ApprovalChatContext>,
+ ctx: crate::core::runtime::DispatchCtx,
id: String,
path: PathBuf,
/// Whether this adds a version to an artifact that already has one: its
@@ -73,6 +74,32 @@ impl Production {
tool_call_id: Option<&str>,
revise: Option<&str>,
chat: Option<&ApprovalChatContext>,
+ ) -> Result<Self, String> {
+ Self::start_in(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ workspace_dir,
+ files,
+ kind,
+ title,
+ extension,
+ tool_call_id,
+ revise,
+ chat,
+ )
+ .await
+ }
+
+ /// Start production using the explicit dispatch scope of the producing turn.
+ pub async fn start_in(
+ ctx: &crate::core::runtime::DispatchCtx,
+ workspace_dir: &Path,
+ files: FileRoots,
+ kind: ArtifactKind,
+ title: &str,
+ extension: &str,
+ tool_call_id: Option<&str>,
+ revise: Option<&str>,
+ chat: Option<&ApprovalChatContext>,
) -> Result<Self, String> {
let legacy_kind = if kind == ArtifactKind::Image {
LegacyArtifactKind::Image
@@ -92,12 +119,13 @@ impl Production {
)
.await?;
- let artifacts = artifacts_service(workspace_dir, files.clone(), None, chat);
+ let artifacts = artifacts_service(workspace_dir, files.clone(), None, chat, ctx);
let mut production = Self {
artifacts,
workspace_dir: workspace_dir.to_path_buf(),
files,
chat: chat.cloned(),
+ ctx: ctx.clone(),
id: meta.id.clone(),
path,
revision: false,
@@ -239,6 +267,7 @@ impl Production {
let bridge = super::tiny_store::LegacyUiBridge::new(
&self.workspace_dir,
self.files.clone(),
+ super::tiny_store::file_store_for(&self.workspace_dir, &self.ctx),
self.chat.as_ref(),
);
if let Err(err) = bridge.show_newest(&record).await {