The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(chat): update artifact payload structures
Steven Enamakel7919f4ee47ac
diff --git a/app/src/services/chatWire.ts b/app/src/services/chatWire.tsindex 29421c1c52..56c06dadce 100644--- a/app/src/services/chatWire.ts+++ b/app/src/services/chatWire.ts@@ -19,6 +19,9 @@import type { ChatErrorCopyParams } from '../lib/chatErrorCopy';import type {ArtifactKind as ArtifactKindWire,+ ArtifactFailedPayload,+ ArtifactPendingPayload,+ ArtifactReadyPayload,ChatSuggestion,ContentPart,OutboundContentPart,@@ -236,27 +239,16 @@ export function decodeRunModeChanged(// The artifact payload rides the wire event's open `args` JSON; chatService// validates it and flattens it into these views.-interface ArtifactBase {+interface ArtifactContext {thread_id: string;client_id?: string;- artifact_id: string;- kind: ArtifactKind;- title: string;- workspace_dir: string;tool_call_id?: string;request_id?: string;}-export interface ArtifactReadyEvent extends ArtifactBase {- path: string;- size_bytes: number;-}-export interface ArtifactFailedEvent extends ArtifactBase {- error: string;-}-export interface ArtifactPendingEvent extends ArtifactBase {- path: string;-}+export type ArtifactReadyEvent = ArtifactReadyPayload & ArtifactContext;+export type ArtifactFailedEvent = ArtifactFailedPayload & ArtifactContext;+export type ArtifactPendingEvent = ArtifactPendingPayload & ArtifactContext;// ── Queue and suggestions ────────────────────────────────────────────────────diff --git a/crates/openhuman-core/src/agent/artifacts/types.rs b/crates/openhuman-core/src/agent/artifacts/types.rsindex 22977fe004..975ff05dd5 100644--- a/crates/openhuman-core/src/agent/artifacts/types.rs+++ b/crates/openhuman-core/src/agent/artifacts/types.rs@@ -69,6 +69,40 @@ impl ArtifactStatus {}}+/// Artifact fields carried inside the generic `WebChannelEvent.args` payload+/// when an artifact has been reserved and generation is in progress.+#[derive(Debug, Clone, Serialize, Deserialize, schemars::JsonSchema)]+pub struct ArtifactPendingPayload {+ pub artifact_id: String,+ pub kind: ArtifactKind,+ pub title: String,+ pub workspace_dir: String,+ pub path: String,+}++/// Artifact fields carried inside `WebChannelEvent.args` after a file is+/// available for download.+#[derive(Debug, Clone, Serialize, Deserialize, schemars::JsonSchema)]+pub struct ArtifactReadyPayload {+ pub artifact_id: String,+ pub kind: ArtifactKind,+ pub title: String,+ pub workspace_dir: String,+ pub path: String,+ pub size_bytes: u64,+}++/// Artifact fields carried inside `WebChannelEvent.args` when generation+/// failed. The producer truncates `error` before publishing this payload.+#[derive(Debug, Clone, Serialize, Deserialize, schemars::JsonSchema)]+pub struct ArtifactFailedPayload {+ pub artifact_id: String,+ pub kind: ArtifactKind,+ pub title: String,+ pub workspace_dir: String,+ pub error: String,+}+/// Metadata record for a single agent-generated artifact.////// Persisted as `<workspace>/artifacts/<id>/meta.json`.diff --git a/crates/openhuman-core/src/threads/wire_schema.rs b/crates/openhuman-core/src/threads/wire_schema.rsindex 72fc108270..675ff1d7ca 100644--- a/crates/openhuman-core/src/threads/wire_schema.rs+++ b/crates/openhuman-core/src/threads/wire_schema.rs@@ -40,6 +40,9 @@ pub struct ThreadWireTypes {pub turn_citation: crate::memory::types::TurnCitation,pub queue_mode: tinychannels_bus::web::QueueMode,pub artifact_kind: crate::agent::artifacts::types::ArtifactKind,+ pub artifact_pending_payload: crate::agent::artifacts::types::ArtifactPendingPayload,+ pub artifact_ready_payload: crate::agent::artifacts::types::ArtifactReadyPayload,+ pub artifact_failed_payload: crate::agent::artifacts::types::ArtifactFailedPayload,pub thread_goal: tinyagents_graph::goals::ThreadGoal,pub thread_todo_item: tinyagents_graph::todos::TodoItem,pub run_mode: tinyagents_harness::middleware::library::RunMode,diff --git a/crates/openhuman-core/src/web_chat/event_bus.rs b/crates/openhuman-core/src/web_chat/event_bus.rsindex 2e787db373..f4dca555b4 100644--- a/crates/openhuman-core/src/web_chat/event_bus.rs+++ b/crates/openhuman-core/src/web_chat/event_bus.rs@@ -376,14 +376,16 @@ impl EventHandler<DomainEvent> for ArtifactSurfaceSubscriber {context},tool_call_id: tool_call_id.clone(),- args: Some(serde_json::json!({- "artifact_id": artifact_id,- "kind": kind,- "title": title,- "workspace_dir": workspace_dir,- "path": path,- "size_bytes": size_bytes,- })),+ args: Some(serde_json::json!(+ crate::agent::artifacts::types::ArtifactReadyPayload {+ artifact_id: artifact_id.clone(),+ kind: crate::agent::artifacts::types::ArtifactKind::parse(kind),+ title: title.clone(),+ workspace_dir: workspace_dir.clone(),+ path: path.clone(),+ size_bytes: *size_bytes,+ }+ )),});}DomainEvent::ArtifactFailed {@@ -414,13 +416,15 @@ impl EventHandler<DomainEvent> for ArtifactSurfaceSubscriber {context},tool_call_id: tool_call_id.clone(),- args: Some(serde_json::json!({- "artifact_id": artifact_id,- "kind": kind,- "title": title,- "workspace_dir": workspace_dir,- "error": error,- })),+ args: Some(serde_json::json!(+ crate::agent::artifacts::types::ArtifactFailedPayload {+ artifact_id: artifact_id.clone(),+ kind: crate::agent::artifacts::types::ArtifactKind::parse(kind),+ title: title.clone(),+ workspace_dir: workspace_dir.clone(),+ error: error.clone(),+ }+ )),});}DomainEvent::ArtifactPending {@@ -450,13 +454,15 @@ impl EventHandler<DomainEvent> for ArtifactSurfaceSubscriber {context},tool_call_id: tool_call_id.clone(),- args: Some(serde_json::json!({- "artifact_id": artifact_id,- "kind": kind,- "title": title,- "workspace_dir": workspace_dir,- "path": path,- })),+ args: Some(serde_json::json!(+ crate::agent::artifacts::types::ArtifactPendingPayload {+ artifact_id: artifact_id.clone(),+ kind: crate::agent::artifacts::types::ArtifactKind::parse(kind),+ title: title.clone(),+ workspace_dir: workspace_dir.clone(),+ path: path.clone(),+ }+ )),});}_ => {}