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 wire schema definitions and tests
Steven Enamakel04265974b8d5
diff --git a/app/src/services/chatWire.ts b/app/src/services/chatWire.tsindex 56c06dadce..472716b50e 100644--- a/app/src/services/chatWire.ts+++ b/app/src/services/chatWire.ts@@ -1,10 +1,11 @@/*** Frontend view of the chat wire contract.*- * Every shape here is DERIVED from `chatWire.generated.ts`, which is generated- * from the tinychannels `WebChannelEvent` JSON schema (`pnpm chat-wire:generate`;- * CI runs `pnpm chat-wire:check`). Do not re-declare a wire field by hand: change- * the schema upstream and regenerate.+ * Wire envelopes here are derived from `chatWire.generated.ts`, generated from+ * the tinychannels `WebChannelEvent` schema. Core-owned artifact and thread+ * records come from `threadWire.generated.ts` (`pnpm chat-wire:generate`; CI+ * runs `pnpm chat-wire:check`). Do not re-declare owner record fields by hand:+ * change the schema source and regenerate.** Two derivations are applied to the generated variants:* - `null` is dropped from optional fields. The core omits `None` on the wirediff --git a/crates/openhuman-core/src/threads/wire_schema_tests.rs b/crates/openhuman-core/src/threads/wire_schema_tests.rsindex 7f569f2b74..c1895ab238 100644--- a/crates/openhuman-core/src/threads/wire_schema_tests.rs+++ b/crates/openhuman-core/src/threads/wire_schema_tests.rs@@ -63,6 +63,9 @@ fn thread_wire_schema_exports_the_core_and_session_records() {"turnCitation","queueMode","artifactKind",+ "artifactPendingPayload",+ "artifactReadyPayload",+ "artifactFailedPayload","threadGoal","threadTodoItem","runMode",@@ -103,6 +106,45 @@ fn thread_wire_schema_exports_the_core_and_session_records() {"citation schema is missing {field}: {citation_schema}");}+ for (property, fields) in [+ (+ "artifactPendingPayload",+ &["artifact_id", "kind", "title", "workspace_dir", "path"][..],+ ),+ (+ "artifactReadyPayload",+ &[+ "artifact_id",+ "kind",+ "title",+ "workspace_dir",+ "path",+ "size_bytes",+ ][..],+ ),+ (+ "artifactFailedPayload",+ &["artifact_id", "kind", "title", "workspace_dir", "error"][..],+ ),+ ] {+ let payload = resolve_schema(&schema, &properties[property]);+ for field in fields {+ assert!(+ payload["properties"].get(field).is_some(),+ "{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(),+ ]+ );+ }let ack = resolve_schema(&schema, &properties["queuedChatAck"]);for field in ["queued",diff --git a/crates/openhuman-core/src/web_chat/event_bus_tests.rs b/crates/openhuman-core/src/web_chat/event_bus_tests.rsindex ba2e05a12b..8ea4e4573c 100644--- a/crates/openhuman-core/src/web_chat/event_bus_tests.rs+++ b/crates/openhuman-core/src/web_chat/event_bus_tests.rs@@ -188,6 +188,16 @@ async fn artifact_surface_bridges_tool_call_id_and_request_id() {let ev = find_artifact_web_event(&mut web_rx, "artifact_pending", pending_id).await;assert_eq!(wire(&ev)["tool_call_id"], "call-1");assert_eq!(wire(&ev)["turn_request_id"], "req-1");+ assert_eq!(+ wire(&ev)["args"],+ serde_json::json!({+ "artifact_id": pending_id,+ "kind": "image",+ "title": "A cat",+ "workspace_dir": "/tmp/ws",+ "path": "artifact-corr-pending/a-cat.png",+ })+ );let ready_id = "artifact-corr-ready";crate::core::bus::BUS.publish(DomainEvent::ArtifactReady {@@ -205,6 +215,17 @@ async fn artifact_surface_bridges_tool_call_id_and_request_id() {let ev = find_artifact_web_event(&mut web_rx, "artifact_ready", ready_id).await;assert_eq!(wire(&ev)["tool_call_id"], "call-2");assert_eq!(wire(&ev)["turn_request_id"], "req-2");+ assert_eq!(+ wire(&ev)["args"],+ serde_json::json!({+ "artifact_id": ready_id,+ "kind": "image",+ "title": "A cat",+ "workspace_dir": "/tmp/ws",+ "path": "artifact-corr-ready/a-cat.png",+ "size_bytes": 42,+ })+ );let failed_id = "artifact-corr-failed";crate::core::bus::BUS.publish(DomainEvent::ArtifactFailed {@@ -221,6 +242,16 @@ async fn artifact_surface_bridges_tool_call_id_and_request_id() {let ev = find_artifact_web_event(&mut web_rx, "artifact_failed", failed_id).await;assert_eq!(wire(&ev)["tool_call_id"], "call-3");assert_eq!(wire(&ev)["turn_request_id"], "req-3");+ assert_eq!(+ wire(&ev)["args"],+ serde_json::json!({+ "artifact_id": failed_id,+ "kind": "image",+ "title": "A cat",+ "workspace_dir": "/tmp/ws",+ "error": "provider timeout",+ })+ );}/// A producer that ran outside a harness tool-call context (CLI, cron)