Skip to content

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

feat(scripts): add chat wire type generation scripts

Steven Enamakeld96ff52017a4
diff --git a/app/src/services/chatWire.generated.ts b/app/src/services/chatWire.generated.ts
new file mode 100644
index 0000000000..68fef2c481
--- /dev/null
+++ b/app/src/services/chatWire.generated.ts
@@ -0,0 +1,815 @@
+/* eslint-disable */
+// @generated by scripts/generate-chat-wire-types.mjs from
+// vendor/tinychannels/crates/tinychannels-bus/schema/web-channel-event.schema.json.
+// Do not edit by hand; run `pnpm chat-wire:generate`.
+
+/**
+ * The tagged, strongly typed web event contract.
+ *
+ * Optional fields are omitted to preserve the deployed struct's wire shape.
+ * The `chat_error` variant intentionally remains able to represent the legacy
+ * `error_type: "cancelled"` payload during the compatibility window.
+ */
+export type WebChannelEvent = ({
+citations?: any
+client_id: string
+event: "chat_done"
+full_response?: (string | null)
+parts?: (OutboundContentPart[] | null)
+request_id: string
+seq?: (number | null)
+thread_id: string
+timing?: (WebTurnTimingPayload | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+usage?: (WebTurnUsagePayload | null)
+} | {
+client_id: string
+event: "chat_interim"
+full_response?: (string | null)
+request_id: string
+round?: (number | null)
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "chat_suggestions"
+request_id: string
+seq?: (number | null)
+suggestions: ChatSuggestion[]
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+copy_key?: (string | null)
+copy_params?: any
+error_fallback_available?: (boolean | null)
+error_provider?: (string | null)
+error_retry_after_ms?: (number | null)
+error_retryable?: (boolean | null)
+error_source?: (string | null)
+error_type?: (string | null)
+event: "chat_error"
+guardrail?: (WebGuardrailPayload | null)
+message?: (string | null)
+request_id: string
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+cancel_reason?: (string | null)
+client_id: string
+event: "chat_cancelled"
+request_id: string
+seq?: (number | null)
+superseded_by?: (string | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+delta?: (string | null)
+delta_kind?: (string | null)
+event: "text_delta"
+request_id: string
+round?: (number | null)
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+delta?: (string | null)
+delta_kind?: (string | null)
+event: "thinking_delta"
+request_id: string
+round?: (number | null)
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+delta?: (string | null)
+delta_kind?: (string | null)
+event: "tool_args_delta"
+request_id: string
+round?: (number | null)
+seq?: (number | null)
+skill_id?: (string | null)
+thread_id: string
+tool_call_id?: (string | null)
+tool_name?: (string | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "inference_start"
+request_id: string
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "inference_heartbeat"
+request_id: string
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "iteration_start"
+message?: (string | null)
+request_id: string
+round?: (number | null)
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+args?: any
+client_id: string
+event: "tool_call"
+request_id: string
+round?: (number | null)
+seq?: (number | null)
+skill_id?: (string | null)
+thread_id: string
+tool_call_id?: (string | null)
+tool_display_detail?: (string | null)
+tool_display_label?: (string | null)
+tool_name?: (string | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "tool_progress"
+message?: (string | null)
+request_id: string
+seq?: (number | null)
+thread_id: string
+tool_call_id?: (string | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+args?: any
+client_id: string
+elapsed_ms?: (number | null)
+event: "tool_result"
+failure?: any
+output?: (string | null)
+request_id: string
+round?: (number | null)
+seq?: (number | null)
+skill_id?: (string | null)
+structured?: any
+success?: (boolean | null)
+thread_id: string
+tool_call_id?: (string | null)
+tool_display_detail?: (string | null)
+tool_display_label?: (string | null)
+tool_name?: (string | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "turn_cost"
+request_id: string
+round?: (number | null)
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+usage?: (WebTurnUsagePayload | null)
+} | {
+client_id: string
+event: "subagent_spawned"
+message?: (string | null)
+request_id: string
+round?: (number | null)
+seq?: (number | null)
+skill_id?: (string | null)
+subagent?: (WebSubagentProgressDetail | null)
+thread_id: string
+tool_name?: (string | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "subagent_completed"
+message?: (string | null)
+request_id: string
+round?: (number | null)
+seq?: (number | null)
+skill_id?: (string | null)
+subagent?: (WebSubagentProgressDetail | null)
+success?: (boolean | null)
+thread_id: string
+tool_name?: (string | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "subagent_failed"
+message?: (string | null)
+request_id: string
+round?: (number | null)
+seq?: (number | null)
+skill_id?: (string | null)
+subagent?: (WebSubagentProgressDetail | null)
+success?: (boolean | null)
+thread_id: string
+tool_name?: (string | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "subagent_awaiting_user"
+message?: (string | null)
+request_id: string
+round?: (number | null)
+seq?: (number | null)
+skill_id?: (string | null)
+subagent?: (WebSubagentProgressDetail | null)
+success?: (boolean | null)
+thread_id: string
+tool_name?: (string | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "subagent_iteration_start"
+message?: (string | null)
+request_id: string
+round?: (number | null)
+seq?: (number | null)
+skill_id?: (string | null)
+subagent?: (WebSubagentProgressDetail | null)
+thread_id: string
+tool_name?: (string | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+args?: any
+client_id: string
+event: "subagent_tool_call"
+request_id: string
+round?: (number | null)
+seq?: (number | null)
+skill_id?: (string | null)
+subagent?: (WebSubagentProgressDetail | null)
+thread_id: string
+tool_call_id?: (string | null)
+tool_display_detail?: (string | null)
+tool_display_label?: (string | null)
+tool_name?: (string | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+args?: any
+client_id: string
+elapsed_ms?: (number | null)
+event: "subagent_tool_result"
+failure?: any
+output?: (string | null)
+request_id: string
+round?: (number | null)
+seq?: (number | null)
+skill_id?: (string | null)
+structured?: any
+subagent?: (WebSubagentProgressDetail | null)
+success?: (boolean | null)
+thread_id: string
+tool_call_id?: (string | null)
+tool_display_detail?: (string | null)
+tool_display_label?: (string | null)
+tool_name?: (string | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+delta?: (string | null)
+delta_kind?: (string | null)
+event: "subagent_text_delta"
+request_id: string
+round?: (number | null)
+seq?: (number | null)
+skill_id?: (string | null)
+subagent?: (WebSubagentProgressDetail | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+delta?: (string | null)
+delta_kind?: (string | null)
+event: "subagent_thinking_delta"
+request_id: string
+round?: (number | null)
+seq?: (number | null)
+skill_id?: (string | null)
+subagent?: (WebSubagentProgressDetail | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+args?: any
+client_id: string
+detached?: (boolean | null)
+event: "approval_request"
+expires_at?: (string | null)
+message?: (string | null)
+request_id: string
+seq?: (number | null)
+thread_id: string
+tool_call_id?: (string | null)
+tool_name?: (string | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+cancel_reason?: (string | null)
+client_id: string
+event: "approval_decided"
+message?: (string | null)
+request_id: string
+seq?: (number | null)
+thread_id: string
+tool_call_id?: (string | null)
+tool_name?: (string | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+args?: any
+client_id: string
+event: "plan_review_request"
+expires_at?: (string | null)
+message?: (string | null)
+request_id: string
+seq?: (number | null)
+thread_id: string
+tool_call_id?: (string | null)
+tool_name?: (string | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+cancel_reason?: (string | null)
+client_id: string
+event: "plan_review_decided"
+message?: (string | null)
+request_id: string
+seq?: (number | null)
+thread_id: string
+tool_call_id?: (string | null)
+tool_name?: (string | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "queue_item_queued"
+queue_item?: (WebQueueItemPayload | null)
+request_id: string
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "queue_item_delivered"
+queue_item?: (WebQueueItemPayload | null)
+request_id: string
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "queue_item_removed"
+queue_item?: (WebQueueItemPayload | null)
+request_id: string
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "thread_goal_updated"
+goal?: any
+request_id: string
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "thread_goal_cleared"
+request_id: string
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "thread_todos_changed"
+request_id: string
+seq?: (number | null)
+thread_id: string
+todos?: any
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "run_mode_changed"
+message?: (string | null)
+request_id: string
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+args?: any
+client_id: string
+event: "artifact_ready"
+request_id: string
+seq?: (number | null)
+thread_id: string
+tool_call_id?: (string | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+args?: any
+client_id: string
+event: "artifact_failed"
+request_id: string
+seq?: (number | null)
+thread_id: string
+tool_call_id?: (string | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+args?: any
+client_id: string
+event: "artifact_pending"
+request_id: string
+seq?: (number | null)
+thread_id: string
+tool_call_id?: (string | null)
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+args?: any
+client_id: string
+event: "memory_activity"
+request_id: string
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+args?: any
+client_id: string
+event: "external_transfer_pending"
+request_id: string
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "proactive_message"
+full_response?: (string | null)
+message?: (string | null)
+parts?: (OutboundContentPart[] | null)
+persisted_message_id?: (string | null)
+request_id: string
+seq?: (number | null)
+success?: (boolean | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "voice_speak"
+full_response?: (string | null)
+request_id: string
+seq?: (number | null)
+success?: (boolean | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+error_source?: (string | null)
+error_type?: (string | null)
+event: "user_error"
+request_id: string
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "chat_message"
+full_response?: (string | null)
+message?: (string | null)
+parts?: (OutboundContentPart[] | null)
+request_id: string
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+} | {
+client_id: string
+event: "chat_segment"
+full_response?: (string | null)
+message?: (string | null)
+parts?: (OutboundContentPart[] | null)
+request_id: string
+segment_index?: (number | null)
+segment_total?: (number | null)
+seq?: (number | null)
+thread_id: string
+ts?: (number | null)
+turn_request_id?: (string | null)
+})
+/**
+ * Typed outbound parts accepted by migrated provider adapters.
+ */
+export type OutboundContentPart = ({
+kind: "content"
+part: ContentPart
+} | {
+kind: "voice"
+voice: OutboundVoice
+})
+/**
+ * Provider-neutral ordered inbound content.
+ */
+export type ContentPart = ({
+kind: "text"
+/**
+ * Formatting dialect; formatting remains text, never HTML authority.
+ */
+markdownDialect?: (string | null)
+text: string
+} | {
+altText?: (string | null)
+caption?: (string | null)
+kind: "image"
+media: MediaReference
+} | {
+caption?: (string | null)
+durationMs?: (number | null)
+kind: "video"
+media: MediaReference
+thumbnail?: (MediaReference | null)
+} | {
+codec?: (string | null)
+durationMs?: (number | null)
+kind: "audio"
+media: MediaReference
+title?: (string | null)
+transcript?: (string | null)
+} | {
+caption?: (string | null)
+fileName?: (string | null)
+kind: "file"
+media: MediaReference
+} | {
+kind: "voice_note"
+voiceNote: VoiceNote
+} | {
+altText?: (string | null)
+emoji?: (string | null)
+kind: "sticker"
+media: MediaReference
+packId?: (string | null)
+stickerId?: (string | null)
+} | {
+accuracyMeters?: (number | null)
+address?: (string | null)
+kind: "location"
+label?: (string | null)
+latitude: number
+liveUntilUnixMs?: (number | null)
+longitude: number
+} | {
+displayName: string
+emails: ContactMethod[]
+kind: "contact"
+organization?: (string | null)
+phoneNumbers: ContactMethod[]
+} | {
+kind: "buttons"
+rows: ButtonAction[][]
+} | {
+closesAtUnixMs?: (number | null)
+kind: "poll"
+multipleChoice: boolean
+options: string[]
+providerPollId?: (string | null)
+question: string
+} | {
+blocks: any
+kind: "presentation"
+} | {
+data: any
+kind: "native"
+provider: string
+})
+/**
+ * Origin of voice transcript enrichment.
+ */
+export type VoiceTranscriptSource = ("provider" | "host_stt")
+/**
+ * Whether a voice transcript is still being produced or is final.
+ */
+export type VoiceTranscriptState = ("pending" | "complete" | "unavailable")
+/**
+ * Visual button emphasis; it does not change action authority.
+ */
+export type ButtonStyle = ("primary" | "secondary" | "danger")
+/**
+ * Explicit outbound voice operation. Synthesis is opt-in and keeps its text.
+ */
+export type OutboundVoice = ({
+/**
+ * Optional bounded inline payload for one native upload. The durable
+ * reference remains the canonical media identity.
+ */
+audioBase64?: (string | null)
+codec?: (string | null)
+durationMs?: (number | null)
+kind: "media"
+media: MediaReference
+/**
+ * Normalised 0.0-1.0 loudness preview for providers that draw one
+ * (WhatsApp push-to-talk). Absent when the codec path produced none.
+ */
+waveform?: (number[] | null)
+} | {
+kind: "synthesize"
+text: string
+voice?: (string | null)
+})
+
+/**
+ * One inbound media reference, preserving provider attachment order.
+ */
+export interface MediaReference {
+codec?: (string | null)
+contentType?: (string | null)
+durationMs?: (number | null)
+fileName?: (string | null)
+height?: (number | null)
+/**
+ * Provider-neutral media kind.
+ */
+kind?: ("image" | "video" | "audio" | "document" | "unknown")
+localCachePath?: (string | null)
+/**
+ * Stable host-owned identifier for media stored outside the channel
+ * provider. It is safe to persist and does not imply a shared filesystem.
+ */
+opaqueId?: (string | null)
+path?: (string | null)
+platformMessageId?: (string | null)
+sizeBytes?: (number | null)
+transcribed?: boolean
+url?: (string | null)
+width?: (number | null)
+}
+/**
+ * Audio message metadata and optional transcript enrichment.
+ */
+export interface VoiceNote {
+codec?: (string | null)
+durationMs?: (number | null)
+media?: MediaReference1
+pushToTalk?: boolean
+transcript?: (VoiceTranscript | null)
+waveform?: (number[] | null)
+}
+/**
+ * One inbound media reference, preserving provider attachment order.
+ */
+export interface MediaReference1 {
+codec?: (string | null)
+contentType?: (string | null)
+durationMs?: (number | null)
+fileName?: (string | null)
+height?: (number | null)
+/**
+ * Provider-neutral media kind.
+ */
+kind?: ("image" | "video" | "audio" | "document" | "unknown")
+localCachePath?: (string | null)
+/**
+ * Stable host-owned identifier for media stored outside the channel
+ * provider. It is safe to persist and does not imply a shared filesystem.
+ */
+opaqueId?: (string | null)
+path?: (string | null)
+platformMessageId?: (string | null)
+sizeBytes?: (number | null)
+transcribed?: boolean
+url?: (string | null)
+width?: (number | null)
+}
+/**
+ * Transcript enrichment attached to a voice note without replacing its audio.
+ */
+export interface VoiceTranscript {
+language?: (string | null)
+source: VoiceTranscriptSource
+state: VoiceTranscriptState
+text: string
+}
+/**
+ * One typed phone number or email address on a contact card.
+ */
+export interface ContactMethod {
+label?: (string | null)
+value: string
+}
+/**
+ * One provider-neutral action button in an ordered content row.
+ */
+export interface ButtonAction {
+disabled: boolean
+id: string
+label: string
+style?: (ButtonStyle | null)
+}
+export interface WebTurnTimingPayload {
+first_token_ms?: (number | null)
+first_tool_ms?: (number | null)
+tokens_per_second?: (number | null)
+total_ms?: (number | null)
+}
+export interface WebTurnUsagePayload {
+cached_input_tokens: number
+context_tokens?: number
+context_window: number
+/**
+ * Cost provenance copied as a wire enum to avoid depending on the harness.
+ */
+cost_source?: ("charged" | "estimated" | "unknown")
+cost_usd?: (number | null)
+input_tokens: number
+output_tokens: number
+subagents?: WebSubagentUsagePayload[]
+}
+export interface WebSubagentUsagePayload {
+agent_id: string
+cost_usd?: (number | null)
+input_tokens: number
+output_tokens: number
+task_id: string
+}
+export interface ChatSuggestion {
+label?: (string | null)
+prompt: string
+}
+export interface WebGuardrailPayload {
+reasons?: WebGuardrailReason[]
+score: number
+verdict: string
+}
+export interface WebGuardrailReason {
+code: string
+message: string
+}
+export interface WebSubagentProgressDetail {
+agent_id?: (string | null)
+cached_input_tokens?: (number | null)
+changed_files?: (string[] | null)
+child_iteration?: (number | null)
+child_max_iterations?: (number | null)
+cost_usd?: (number | null)
+dedicated_thread?: (boolean | null)
+dirty_status?: (boolean | null)
+display_name?: (string | null)
+elapsed_ms?: (number | null)
+input_tokens?: (number | null)
+iterations?: (number | null)
+mode?: (string | null)
+output?: (string | null)
+output_chars?: (number | null)
+output_tokens?: (number | null)
+parent_call_id?: (string | null)
+prompt_chars?: (number | null)
+task_id?: (string | null)
+worker_thread_id?: (string | null)
+worktree_path?: (string | null)
+}
+export interface WebQueueItemPayload {
+id: string
+lane?: (string | null)
+text_preview?: (string | null)
+}
diff --git a/package.json b/package.json
index fee458ce9d..220af56e5a 100644
--- a/package.json
+++ b/package.json
@@ -8,6 +8,8 @@
"scripts": {
"build": "pnpm --filter openhuman-app build",
"docs:generate": "node scripts/generate-architecture-docs.mjs",
+ "chat-wire:generate": "node scripts/generate-chat-wire-types.mjs && prettier --write app/src/services/chatWire.generated.ts",
+ "chat-wire:check": "node scripts/generate-chat-wire-types.mjs --check",
"docs:check": "node scripts/generate-architecture-docs.mjs --check",
"docs:test": "node --test scripts/__tests__/generate-architecture-docs.test.mjs scripts/__tests__/generate-embed-docs.test.mjs",
"test:scripts": "node --test scripts/__tests__/*.test.mjs scripts/mock-api/*.test.mjs scripts/mock-api/routes/__tests__/*.test.mjs",
diff --git a/scripts/generate-chat-wire-types.mjs b/scripts/generate-chat-wire-types.mjs
new file mode 100644
index 0000000000..14771322f7
--- /dev/null
+++ b/scripts/generate-chat-wire-types.mjs
@@ -0,0 +1,55 @@
+#!/usr/bin/env node
+// Generates the frontend's chat wire types from the tinychannels web wire
+// schema (vendor/tinychannels, `WebChannelEvent`). The schema is the single
+// source of truth: do not hand-write mirrors of these types.
+//
+// node scripts/generate-chat-wire-types.mjs write the file
+// node scripts/generate-chat-wire-types.mjs --check fail if it is stale
+import { readFileSync, writeFileSync, existsSync } from 'node:fs';
+import { dirname, resolve } from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { compile } from 'json-schema-to-typescript';
+
+const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
+const schemaPath = resolve(
+ root,
+ 'vendor/tinychannels/crates/tinychannels-bus/schema/web-channel-event.schema.json'
+);
+const outPath = resolve(root, 'app/src/services/chatWire.generated.ts');
+
+export async function render() {
+ const schema = JSON.parse(readFileSync(schemaPath, 'utf8'));
+ const body = await compile(schema, 'WebChannelEvent', {
+ bannerComment: '',
+ additionalProperties: false,
+ unknownAny: false,
+ format: false,
+ style: { singleQuote: true },
+ });
+ return (
+ '/* eslint-disable */\n' +
+ '// @generated by scripts/generate-chat-wire-types.mjs from\n' +
+ '// vendor/tinychannels/crates/tinychannels-bus/schema/web-channel-event.schema.json.\n' +
+ '// Do not edit by hand; run `pnpm chat-wire:generate`.\n\n' +
+ body
+ );
+}
+
+if (process.argv[1] === fileURLToPath(import.meta.url)) {
+ if (!existsSync(schemaPath)) {
+ console.error(`schema not found: ${schemaPath} (init submodules)`);
+ process.exit(2);
+ }
+ const next = await render();
+ if (process.argv.includes('--check')) {
+ const cur = existsSync(outPath) ? readFileSync(outPath, 'utf8') : '';
+ if (cur !== next) {
+ console.error('chatWire.generated.ts is stale; run `pnpm chat-wire:generate`');
+ process.exit(1);
+ }
+ console.log('chatWire.generated.ts is current');
+ } else {
+ writeFileSync(outPath, next);
+ console.log(`wrote ${outPath}`);
+ }
+}