Skip to content

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

fix(artifacts): emit artifact kind as a plain string on the wire

Steven Enamakel3823254749d8
diff --git a/app/src/services/chatWire.ts b/app/src/services/chatWire.ts
index 472716b50e..7eaf226e7e 100644
--- a/app/src/services/chatWire.ts
+++ b/app/src/services/chatWire.ts
@@ -247,9 +247,11 @@ interface ArtifactContext {
request_id?: string;
}
-export type ArtifactReadyEvent = ArtifactReadyPayload & ArtifactContext;
-export type ArtifactFailedEvent = ArtifactFailedPayload & ArtifactContext;
-export type ArtifactPendingEvent = ArtifactPendingPayload & ArtifactContext;
+type ValidatedArtifactKind<T> = Omit<T, 'kind'> & { kind: ArtifactKind };
+
+export type ArtifactReadyEvent = ValidatedArtifactKind<ArtifactReadyPayload> & ArtifactContext;
+export type ArtifactFailedEvent = ValidatedArtifactKind<ArtifactFailedPayload> & ArtifactContext;
+export type ArtifactPendingEvent = ValidatedArtifactKind<ArtifactPendingPayload> & ArtifactContext;
// ── Queue and suggestions ────────────────────────────────────────────────────
diff --git a/crates/openhuman-core/src/agent/artifacts/types.rs b/crates/openhuman-core/src/agent/artifacts/types.rs
index 975ff05dd5..e01b59d425 100644
--- a/crates/openhuman-core/src/agent/artifacts/types.rs
+++ b/crates/openhuman-core/src/agent/artifacts/types.rs
@@ -74,7 +74,7 @@ impl ArtifactStatus {
#[derive(Debug, Clone, Serialize, Deserialize, schemars::JsonSchema)]
pub struct ArtifactPendingPayload {
pub artifact_id: String,
- pub kind: ArtifactKind,
+ pub kind: String,
pub title: String,
pub workspace_dir: String,
pub path: String,
@@ -85,7 +85,7 @@ pub struct ArtifactPendingPayload {
#[derive(Debug, Clone, Serialize, Deserialize, schemars::JsonSchema)]
pub struct ArtifactReadyPayload {
pub artifact_id: String,
- pub kind: ArtifactKind,
+ pub kind: String,
pub title: String,
pub workspace_dir: String,
pub path: String,
@@ -97,7 +97,7 @@ pub struct ArtifactReadyPayload {
#[derive(Debug, Clone, Serialize, Deserialize, schemars::JsonSchema)]
pub struct ArtifactFailedPayload {
pub artifact_id: String,
- pub kind: ArtifactKind,
+ pub kind: String,
pub title: String,
pub workspace_dir: String,
pub error: String,
diff --git a/crates/openhuman-core/src/threads/wire_schema_tests.rs b/crates/openhuman-core/src/threads/wire_schema_tests.rs
index c1895ab238..4794098ae8 100644
--- a/crates/openhuman-core/src/threads/wire_schema_tests.rs
+++ b/crates/openhuman-core/src/threads/wire_schema_tests.rs
@@ -134,16 +134,7 @@ fn thread_wire_schema_exports_the_core_and_session_records() {
"{property} schema is missing {field}: {payload}"
);
}
- assert_eq!(
- schema_string_values(&schema, &payload["properties"]["kind"]),
- vec![
- "document".to_owned(),
- "image".to_owned(),
- "other".to_owned(),
- "presentation".to_owned(),
- "video".to_owned(),
- ]
- );
+ assert_eq!(payload["properties"]["kind"]["type"], "string");
}
let ack = resolve_schema(&schema, &properties["queuedChatAck"]);
for field in [
diff --git a/crates/openhuman-core/src/web_chat/event_bus.rs b/crates/openhuman-core/src/web_chat/event_bus.rs
index f4dca555b4..78e22af6e7 100644
--- a/crates/openhuman-core/src/web_chat/event_bus.rs
+++ b/crates/openhuman-core/src/web_chat/event_bus.rs
@@ -379,7 +379,7 @@ impl EventHandler<DomainEvent> for ArtifactSurfaceSubscriber {
args: Some(serde_json::json!(
crate::agent::artifacts::types::ArtifactReadyPayload {
artifact_id: artifact_id.clone(),
- kind: crate::agent::artifacts::types::ArtifactKind::parse(kind),
+ kind: kind.clone(),
title: title.clone(),
workspace_dir: workspace_dir.clone(),
path: path.clone(),
@@ -419,7 +419,7 @@ impl EventHandler<DomainEvent> for ArtifactSurfaceSubscriber {
args: Some(serde_json::json!(
crate::agent::artifacts::types::ArtifactFailedPayload {
artifact_id: artifact_id.clone(),
- kind: crate::agent::artifacts::types::ArtifactKind::parse(kind),
+ kind: kind.clone(),
title: title.clone(),
workspace_dir: workspace_dir.clone(),
error: error.clone(),
@@ -457,7 +457,7 @@ impl EventHandler<DomainEvent> for ArtifactSurfaceSubscriber {
args: Some(serde_json::json!(
crate::agent::artifacts::types::ArtifactPendingPayload {
artifact_id: artifact_id.clone(),
- kind: crate::agent::artifacts::types::ArtifactKind::parse(kind),
+ kind: kind.clone(),
title: title.clone(),
workspace_dir: workspace_dir.clone(),
path: path.clone(),