@ai-matrx/agents 0.42.0 → 0.43.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../generated/workflow-events.ts"],"sourcesContent":["// AUTO-GENERATED — do not edit manually.\n// Sources:\n// matrx_graph.types.events — the durable workflow run events\n// matrx_graph.types.primitives — run status vocabulary\n// aidream.services.runtime.workflow_events — ephemeral node_stream,\n// router handshake, run_announce\n// Run: uv run python scripts/generate_types.py workflow-events\n// or fetch via `pnpm sync-types` (pulls /schema/bundle/workflow-events-ts).\n//\n// The backend emits each durable event as `{event: \"data\", data: {event:\n// \"<one_of>\", ...}}` on the NDJSON run stream, and as `data:` JSON frames on\n// the per-run SSE feed (`GET /runs/{id}/events/stream`).\n\n// --- Run status vocabulary ---\n\n/** Every value `workflow.run.status` can hold — scheduler outcomes plus the\n * transitional control states (`pausing` / `cancelling`). */\nexport type WorkflowRunStatus =\n | \"pending\"\n | \"running\"\n | \"paused\"\n | \"interrupted\"\n | \"awaiting_input\"\n | \"errored\"\n | \"completed\"\n | \"failed\"\n | \"cancelled\"\n | \"pausing\"\n | \"cancelling\";\n\n/** Finished forever — no resume, no recovery. */\nexport const TERMINAL_RUN_STATUSES: ReadonlySet<WorkflowRunStatus> = new Set<WorkflowRunStatus>([\"completed\", \"failed\", \"cancelled\"]);\n\n/** The scheduler is (or is about to be) making progress. */\nexport const ACTIVE_RUN_STATUSES: ReadonlySet<WorkflowRunStatus> = new Set<WorkflowRunStatus>([\"pending\", \"running\", \"pausing\", \"cancelling\"]);\n\n// --- Agent-step liveness vocabulary ---\n\n/** What an agent-family step is DOING right now, carried as the `delta`\n * of a `node_stream` frame with `kind: \"phase\"`. CLOSED: the server folds\n * every label onto this set before it reaches the wire, so a renderer may\n * switch exhaustively. An unrecognised string is still possible (the server\n * passes an unmapped label through and logs it) — render it verbatim. */\nexport type AgentStepPhase =\n | \"preparing\"\n | \"streaming\"\n | \"tool\"\n | \"reasoning\"\n | \"finalizing\"\n | \"retrying\"\n | \"complete\";\n\n/** The same set, ordered as a healthy step walks it. */\nexport const AGENT_STEP_PHASES: readonly AgentStepPhase[] = [\"preparing\", \"streaming\", \"tool\", \"reasoning\", \"finalizing\", \"retrying\", \"complete\"];\n\n// --- Durable scheduler events (recorded in wf_node_events, replayed) ---\n\nexport interface RunStartedEvent {\n ts: string;\n event: \"run_started\";\n run_id: string;\n thread_id: string;\n definition_id: string;\n definition_hash: string;\n}\n\nexport interface NodeStartedEvent {\n ts: string;\n event: \"node_started\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n inputs: Record<string, unknown>;\n output_kind: string | null;\n}\n\nexport interface NodeCompletedEvent {\n ts: string;\n event: \"node_completed\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n duration_ms: number;\n output: Record<string, unknown>;\n output_kind: string | null;\n output_kind_ok: boolean | null;\n output_kind_errors: string[] | null;\n output_kind_version: number | null;\n output_kind_degraded: string | null;\n metadata: Record<string, unknown> | null;\n wrapper: Record<string, unknown> | null;\n}\n\nexport interface NodeSkippedEvent {\n ts: string;\n event: \"node_skipped\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n output: Record<string, unknown>;\n}\n\nexport interface NodeFailedEvent {\n ts: string;\n event: \"node_failed\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n error_type: string;\n error_message: string;\n error: Record<string, unknown> | null;\n wrapper: Record<string, unknown> | null;\n}\n\nexport interface NodeRetryScheduledEvent {\n ts: string;\n event: \"node_retry_scheduled\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n next_attempt: number;\n delay_ms: number;\n error_type: string;\n error_message: string;\n}\n\nexport interface NodeProgressEvent {\n ts: string;\n event: \"node_progress\";\n run_id: string;\n step: number;\n node_id: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n message: string;\n fraction: number | null;\n current: number | null;\n total: number | null;\n}\n\nexport interface CheckpointSavedEvent {\n ts: string;\n event: \"checkpoint_saved\";\n run_id: string;\n checkpoint_id: string;\n step: number;\n parent_checkpoint_id: string | null;\n}\n\nexport interface RunInterruptedEvent {\n ts: string;\n event: \"run_interrupted\";\n run_id: string;\n node_id: string;\n payload: Record<string, unknown>;\n checkpoint_id: string | null;\n}\n\nexport type RunStatus = \"pending\" | \"running\" | \"paused\" | \"interrupted\" | \"awaiting_input\" | \"errored\" | \"completed\" | \"failed\" | \"cancelled\";\n\nexport interface RunCompletedEvent {\n ts: string;\n event: \"run_completed\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n last_outputs: Record<string, unknown>;\n channel_values: Record<string, unknown>;\n}\n\nexport interface RunFailedEvent {\n ts: string;\n event: \"run_failed\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n error_type: string;\n error_message: string;\n}\n\nexport interface RunCancelledEvent {\n ts: string;\n event: \"run_cancelled\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n reason: \"graceful\" | \"immediate\" | \"candidate_stopped\";\n}\n\nexport interface RunPausedEvent {\n ts: string;\n event: \"run_paused\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n checkpoint_id: string | null;\n}\n\nexport interface RunResumedEvent {\n ts: string;\n event: \"run_resumed\";\n run_id: string;\n from_checkpoint_id: string;\n mode: \"pause\" | \"interrupt\" | \"user_skip\" | \"user_manual\" | \"retry\";\n}\n\nexport interface RunErroredEvent {\n ts: string;\n event: \"run_errored\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n node_id: string;\n step: number;\n attempt: number;\n error_type: string;\n error_message: string;\n checkpoint_id: string | null;\n}\n\nexport interface NodeEmittedEvent {\n ts: string;\n event: \"node_emitted\";\n run_id: string;\n step: number;\n node_id: string;\n dispatch_id?: string;\n item_index?: number;\n attempt: number;\n mode: \"confirmation\" | \"summary\" | \"full\" | \"restructured\";\n payload: Record<string, unknown>;\n component_ref: string | null;\n surface: string;\n title: string | null;\n presentation: \"panel\" | \"showcase\";\n kind: string | null;\n kind_ok: boolean | null;\n metadata: Record<string, unknown> | null;\n empty_values: string[];\n empty_notice: string | null;\n}\n\nexport interface NodeCostEvent {\n ts: string;\n event: \"node_cost\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string | null;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n cost_usd: number;\n input_tokens: number;\n output_tokens: number;\n total_tokens: number;\n model: string | null;\n models: string[];\n conversation_id: string | null;\n request_id: string | null;\n}\n\nexport interface WorkSetProgressEvent {\n ts: string;\n event: \"work_set_progress\";\n run_id: string;\n step: number;\n node_id: string;\n set_name: string;\n wave: number;\n dispatched: number;\n pending: number;\n in_progress: number;\n succeeded: number;\n failed: number;\n dead_letter: number;\n discovered: number;\n done: boolean;\n}\n\nexport interface SubgraphRunLinkedEvent {\n ts: string;\n event: \"subgraph_run_linked\";\n run_id: string;\n step: number;\n node_id: string;\n dispatch_id?: string;\n item_index?: number;\n child_run_id: string;\n child_definition_id: string;\n child_definition_name: string | null;\n reattached: boolean;\n child_status: string;\n}\n\n/** The durable scheduler events — recorded in wf_node_events and replayed\n * on reconnect via the per-run `seq` cursor. */\nexport type WorkflowRunEvent =\n | RunStartedEvent\n | NodeStartedEvent\n | NodeCompletedEvent\n | NodeSkippedEvent\n | NodeFailedEvent\n | NodeRetryScheduledEvent\n | NodeProgressEvent\n | CheckpointSavedEvent\n | RunInterruptedEvent\n | RunCompletedEvent\n | RunFailedEvent\n | RunCancelledEvent\n | RunPausedEvent\n | RunResumedEvent\n | RunErroredEvent\n | NodeEmittedEvent\n | NodeCostEvent\n | WorkSetProgressEvent\n | SubgraphRunLinkedEvent;\n\nconst WORKFLOW_RUN_EVENT_TYPES: ReadonlySet<string> = new Set([\n \"run_started\",\n \"node_started\",\n \"node_completed\",\n \"node_skipped\",\n \"node_failed\",\n \"node_retry_scheduled\",\n \"node_progress\",\n \"checkpoint_saved\",\n \"run_interrupted\",\n \"run_completed\",\n \"run_failed\",\n \"run_cancelled\",\n \"run_paused\",\n \"run_resumed\",\n \"run_errored\",\n \"node_emitted\",\n \"node_cost\",\n \"work_set_progress\",\n \"subgraph_run_linked\",\n]);\n\nexport function isWorkflowRunEvent(value: unknown): value is WorkflowRunEvent {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as { event?: unknown; run_id?: unknown };\n return (\n typeof candidate.event === \"string\" &&\n WORKFLOW_RUN_EVENT_TYPES.has(candidate.event) &&\n typeof candidate.run_id === \"string\"\n );\n}\n\n// --- Ephemeral live-token frame (never persisted, never replayed) ---\n\nexport interface NodeStreamEvent {\n event: \"node_stream\";\n run_id: string;\n node_id: string | null;\n dispatch_id?: string;\n item_index?: number;\n kind: \"chunk\" | \"reasoning\" | \"phase\" | \"tool\" | \"warning\" | \"record_update\" | \"resource_changed\" | \"render_block\" | \"media\";\n delta: string;\n stream_seq: number;\n ts: string;\n chunks_received: number;\n chars_streamed: number;\n frame_id?: string | null;\n frame_index?: number;\n frame_count?: number;\n block_shadowed?: boolean;\n}\n\nexport function isNodeStreamEvent(value: unknown): value is NodeStreamEvent {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as { event?: unknown; run_id?: unknown; delta?: unknown };\n return (\n candidate.event === \"node_stream\" &&\n typeof candidate.run_id === \"string\" &&\n typeof candidate.delta === \"string\"\n );\n}\n\n// --- Router handshake frames ---\n// Emitted on the synchronous POST /workflows/{id}/runs response BEFORE the\n// run detaches to wf_node_events. They only carry the run_id (plus a note) so\n// the client can adopt it and hand off to the live event feed.\n\nexport interface WorkflowRunStartedEvent {\n [key: string]: unknown;\n event: \"workflow_run_started\";\n run_id: string;\n}\n\nexport interface WorkflowRunResumedEvent {\n [key: string]: unknown;\n event: \"workflow_run_resumed\";\n run_id: string;\n checkpoint_id: string;\n}\n\nexport interface WorkflowRunDetachedEvent {\n [key: string]: unknown;\n event: \"workflow_run_detached\";\n run_id: string;\n message: string;\n}\n\nexport type WorkflowRouterEvent =\n | WorkflowRunStartedEvent\n | WorkflowRunResumedEvent\n | WorkflowRunDetachedEvent;\n\n/** Every frame a client can see on a run's stream. */\nexport type WorkflowStreamEvent =\n | WorkflowRunEvent\n | NodeStreamEvent\n | WorkflowRouterEvent;\n\n// --- User-scoped run announcements (GET /runs/stream) ---\n// Deliberately OUTSIDE WorkflowStreamEvent: fired by a Postgres trigger on\n// every workflow.run INSERT + real status transition owned by the caller.\n// EPHEMERAL — no SSE id, no replay; the runs-list fetch is the snapshot.\n\nexport interface RunAnnounceEvent {\n event: \"run_announce\";\n run_id: string;\n workflow_id: string;\n status: string;\n kind: \"inserted\" | \"status\";\n ts: string;\n}\n\nexport function isRunAnnounceEvent(value: unknown): value is RunAnnounceEvent {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as { event?: unknown; run_id?: unknown };\n return (\n candidate.event === \"run_announce\" &&\n typeof candidate.run_id === \"string\"\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BO,IAAM,wBAAwD,oBAAI,IAAuB,CAAC,aAAa,UAAU,WAAW,CAAC;AAG7H,IAAM,sBAAsD,oBAAI,IAAuB,CAAC,WAAW,WAAW,WAAW,YAAY,CAAC;AAmBtI,IAAM,oBAA+C,CAAC,aAAa,aAAa,QAAQ,aAAa,cAAc,YAAY,UAAU;AAmShJ,IAAM,2BAAgD,oBAAI,IAAI;AAAA,EAC5D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,SAAS,mBAAmB,OAA2C;AAC5E,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,YAAY;AAClB,SACE,OAAO,UAAU,UAAU,YAC3B,yBAAyB,IAAI,UAAU,KAAK,KAC5C,OAAO,UAAU,WAAW;AAEhC;AAsBO,SAAS,kBAAkB,OAA0C;AAC1E,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,YAAY;AAClB,SACE,UAAU,UAAU,iBACpB,OAAO,UAAU,WAAW,YAC5B,OAAO,UAAU,UAAU;AAE/B;AAoDO,SAAS,mBAAmB,OAA2C;AAC5E,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,YAAY;AAClB,SACE,UAAU,UAAU,kBACpB,OAAO,UAAU,WAAW;AAEhC;","names":[]}
1
+ {"version":3,"sources":["../../generated/workflow-events.ts"],"sourcesContent":["// AUTO-GENERATED — do not edit manually.\n// Sources:\n// matrx_graph.types.events — the durable workflow run events\n// matrx_graph.types.primitives — run status vocabulary\n// aidream.services.runtime.workflow_events — ephemeral node_stream,\n// router handshake, run_announce\n// Run: uv run python scripts/generate_types.py workflow-events\n// or fetch via `pnpm sync-types` (pulls /schema/bundle/workflow-events-ts).\n//\n// The backend emits each durable event as `{event: \"data\", data: {event:\n// \"<one_of>\", ...}}` on the NDJSON run stream, and as `data:` JSON frames on\n// the per-run SSE feed (`GET /runs/{id}/events/stream`).\n\n// --- Run status vocabulary ---\n\n/** Every value `workflow.run.status` can hold — scheduler outcomes plus the\n * transitional control states (`pausing` / `cancelling`). */\nexport type WorkflowRunStatus =\n | \"pending\"\n | \"running\"\n | \"paused\"\n | \"interrupted\"\n | \"awaiting_input\"\n | \"errored\"\n | \"completed\"\n | \"failed\"\n | \"cancelled\"\n | \"pausing\"\n | \"cancelling\";\n\n/** Finished forever — no resume, no recovery. */\nexport const TERMINAL_RUN_STATUSES: ReadonlySet<WorkflowRunStatus> = new Set<WorkflowRunStatus>([\"completed\", \"failed\", \"cancelled\"]);\n\n/** The scheduler is (or is about to be) making progress. */\nexport const ACTIVE_RUN_STATUSES: ReadonlySet<WorkflowRunStatus> = new Set<WorkflowRunStatus>([\"pending\", \"running\", \"pausing\", \"cancelling\"]);\n\n// --- Agent-step liveness vocabulary ---\n\n/** What an agent-family step is DOING right now, carried as the `delta`\n * of a `node_stream` frame with `kind: \"phase\"`. CLOSED: the server folds\n * every label onto this set before it reaches the wire, so a renderer may\n * switch exhaustively. An unrecognised string is still possible (the server\n * passes an unmapped label through and logs it) — render it verbatim. */\nexport type AgentStepPhase =\n | \"preparing\"\n | \"streaming\"\n | \"tool\"\n | \"reasoning\"\n | \"finalizing\"\n | \"retrying\"\n | \"complete\";\n\n/** The same set, ordered as a healthy step walks it. */\nexport const AGENT_STEP_PHASES: readonly AgentStepPhase[] = [\"preparing\", \"streaming\", \"tool\", \"reasoning\", \"finalizing\", \"retrying\", \"complete\"];\n\n// --- Durable scheduler events (recorded in wf_node_events, replayed) ---\n\nexport interface RunStartedEvent {\n ts: string;\n event: \"run_started\";\n run_id: string;\n thread_id: string;\n definition_id: string;\n definition_hash: string;\n}\n\nexport interface NodeStartedEvent {\n ts: string;\n event: \"node_started\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n inputs: Record<string, unknown>;\n output_kind: string | null;\n}\n\nexport interface NodeCompletedEvent {\n ts: string;\n event: \"node_completed\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n duration_ms: number;\n output: Record<string, unknown>;\n output_kind: string | null;\n output_kind_ok: boolean | null;\n output_kind_errors: string[] | null;\n output_kind_version: number | null;\n output_kind_degraded: string | null;\n metadata: Record<string, unknown> | null;\n wrapper: Record<string, unknown> | null;\n}\n\nexport interface NodeSkippedEvent {\n ts: string;\n event: \"node_skipped\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n output: Record<string, unknown>;\n source: \"executor\" | \"user_skip\" | \"user_manual\" | \"retry\" | \"mocked\" | null;\n}\n\nexport interface NodeFailedEvent {\n ts: string;\n event: \"node_failed\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n error_type: string;\n error_message: string;\n error: Record<string, unknown> | null;\n wrapper: Record<string, unknown> | null;\n}\n\nexport interface NodeRetryScheduledEvent {\n ts: string;\n event: \"node_retry_scheduled\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n next_attempt: number;\n delay_ms: number;\n error_type: string;\n error_message: string;\n}\n\nexport interface NodeProgressEvent {\n ts: string;\n event: \"node_progress\";\n run_id: string;\n step: number;\n node_id: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n message: string;\n fraction: number | null;\n current: number | null;\n total: number | null;\n}\n\nexport interface CheckpointSavedEvent {\n ts: string;\n event: \"checkpoint_saved\";\n run_id: string;\n checkpoint_id: string;\n step: number;\n parent_checkpoint_id: string | null;\n}\n\nexport interface RunInterruptedEvent {\n ts: string;\n event: \"run_interrupted\";\n run_id: string;\n node_id: string;\n payload: Record<string, unknown>;\n checkpoint_id: string | null;\n}\n\nexport type RunStatus = \"pending\" | \"running\" | \"paused\" | \"interrupted\" | \"awaiting_input\" | \"errored\" | \"completed\" | \"failed\" | \"cancelled\";\n\nexport interface RunCompletedEvent {\n ts: string;\n event: \"run_completed\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n last_outputs: Record<string, unknown>;\n channel_values: Record<string, unknown>;\n}\n\nexport interface RunFailedEvent {\n ts: string;\n event: \"run_failed\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n error_type: string;\n error_message: string;\n}\n\nexport interface RunCancelledEvent {\n ts: string;\n event: \"run_cancelled\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n reason: \"graceful\" | \"immediate\" | \"candidate_stopped\";\n}\n\nexport interface RunPausedEvent {\n ts: string;\n event: \"run_paused\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n checkpoint_id: string | null;\n}\n\nexport interface RunResumedEvent {\n ts: string;\n event: \"run_resumed\";\n run_id: string;\n from_checkpoint_id: string;\n mode: \"pause\" | \"interrupt\" | \"user_skip\" | \"user_manual\" | \"retry\";\n}\n\nexport interface RunErroredEvent {\n ts: string;\n event: \"run_errored\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n node_id: string;\n step: number;\n attempt: number;\n error_type: string;\n error_message: string;\n checkpoint_id: string | null;\n}\n\nexport interface NodeEmittedEvent {\n ts: string;\n event: \"node_emitted\";\n run_id: string;\n step: number;\n node_id: string;\n dispatch_id?: string;\n item_index?: number;\n attempt: number;\n mode: \"confirmation\" | \"summary\" | \"full\" | \"restructured\";\n payload: Record<string, unknown>;\n component_ref: string | null;\n surface: string;\n title: string | null;\n presentation: \"panel\" | \"showcase\";\n kind: string | null;\n kind_ok: boolean | null;\n metadata: Record<string, unknown> | null;\n empty_values: string[];\n empty_notice: string | null;\n}\n\nexport interface NodeCostEvent {\n ts: string;\n event: \"node_cost\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string | null;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n cost_usd: number;\n input_tokens: number;\n output_tokens: number;\n total_tokens: number;\n model: string | null;\n models: string[];\n conversation_id: string | null;\n request_id: string | null;\n}\n\nexport interface WorkSetProgressEvent {\n ts: string;\n event: \"work_set_progress\";\n run_id: string;\n step: number;\n node_id: string;\n set_name: string;\n wave: number;\n dispatched: number;\n pending: number;\n in_progress: number;\n succeeded: number;\n failed: number;\n dead_letter: number;\n discovered: number;\n done: boolean;\n}\n\nexport interface SubgraphRunLinkedEvent {\n ts: string;\n event: \"subgraph_run_linked\";\n run_id: string;\n step: number;\n node_id: string;\n dispatch_id?: string;\n item_index?: number;\n child_run_id: string;\n child_definition_id: string;\n child_definition_name: string | null;\n reattached: boolean;\n child_status: string;\n}\n\n/** The durable scheduler events — recorded in wf_node_events and replayed\n * on reconnect via the per-run `seq` cursor. */\nexport type WorkflowRunEvent =\n | RunStartedEvent\n | NodeStartedEvent\n | NodeCompletedEvent\n | NodeSkippedEvent\n | NodeFailedEvent\n | NodeRetryScheduledEvent\n | NodeProgressEvent\n | CheckpointSavedEvent\n | RunInterruptedEvent\n | RunCompletedEvent\n | RunFailedEvent\n | RunCancelledEvent\n | RunPausedEvent\n | RunResumedEvent\n | RunErroredEvent\n | NodeEmittedEvent\n | NodeCostEvent\n | WorkSetProgressEvent\n | SubgraphRunLinkedEvent;\n\nconst WORKFLOW_RUN_EVENT_TYPES: ReadonlySet<string> = new Set([\n \"run_started\",\n \"node_started\",\n \"node_completed\",\n \"node_skipped\",\n \"node_failed\",\n \"node_retry_scheduled\",\n \"node_progress\",\n \"checkpoint_saved\",\n \"run_interrupted\",\n \"run_completed\",\n \"run_failed\",\n \"run_cancelled\",\n \"run_paused\",\n \"run_resumed\",\n \"run_errored\",\n \"node_emitted\",\n \"node_cost\",\n \"work_set_progress\",\n \"subgraph_run_linked\",\n]);\n\nexport function isWorkflowRunEvent(value: unknown): value is WorkflowRunEvent {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as { event?: unknown; run_id?: unknown };\n return (\n typeof candidate.event === \"string\" &&\n WORKFLOW_RUN_EVENT_TYPES.has(candidate.event) &&\n typeof candidate.run_id === \"string\"\n );\n}\n\n// --- Ephemeral live-token frame (never persisted, never replayed) ---\n\nexport interface NodeStreamEvent {\n event: \"node_stream\";\n run_id: string;\n node_id: string | null;\n dispatch_id?: string;\n item_index?: number;\n kind: \"chunk\" | \"reasoning\" | \"phase\" | \"tool\" | \"warning\" | \"record_update\" | \"resource_changed\" | \"render_block\" | \"media\";\n delta: string;\n stream_seq: number;\n ts: string;\n chunks_received: number;\n chars_streamed: number;\n frame_id?: string | null;\n frame_index?: number;\n frame_count?: number;\n block_shadowed?: boolean;\n}\n\nexport function isNodeStreamEvent(value: unknown): value is NodeStreamEvent {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as { event?: unknown; run_id?: unknown; delta?: unknown };\n return (\n candidate.event === \"node_stream\" &&\n typeof candidate.run_id === \"string\" &&\n typeof candidate.delta === \"string\"\n );\n}\n\n// --- Router handshake frames ---\n// Emitted on the synchronous POST /workflows/{id}/runs response BEFORE the\n// run detaches to wf_node_events. They only carry the run_id (plus a note) so\n// the client can adopt it and hand off to the live event feed.\n\nexport interface WorkflowRunStartedEvent {\n [key: string]: unknown;\n event: \"workflow_run_started\";\n run_id: string;\n}\n\nexport interface WorkflowRunResumedEvent {\n [key: string]: unknown;\n event: \"workflow_run_resumed\";\n run_id: string;\n checkpoint_id: string;\n}\n\nexport interface WorkflowRunDetachedEvent {\n [key: string]: unknown;\n event: \"workflow_run_detached\";\n run_id: string;\n message: string;\n}\n\nexport type WorkflowRouterEvent =\n | WorkflowRunStartedEvent\n | WorkflowRunResumedEvent\n | WorkflowRunDetachedEvent;\n\n/** Every frame a client can see on a run's stream. */\nexport type WorkflowStreamEvent =\n | WorkflowRunEvent\n | NodeStreamEvent\n | WorkflowRouterEvent;\n\n// --- User-scoped run announcements (GET /runs/stream) ---\n// Deliberately OUTSIDE WorkflowStreamEvent: fired by a Postgres trigger on\n// every workflow.run INSERT + real status transition owned by the caller.\n// EPHEMERAL — no SSE id, no replay; the runs-list fetch is the snapshot.\n\nexport interface RunAnnounceEvent {\n event: \"run_announce\";\n run_id: string;\n workflow_id: string;\n status: string;\n kind: \"inserted\" | \"status\";\n ts: string;\n}\n\nexport function isRunAnnounceEvent(value: unknown): value is RunAnnounceEvent {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as { event?: unknown; run_id?: unknown };\n return (\n candidate.event === \"run_announce\" &&\n typeof candidate.run_id === \"string\"\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BO,IAAM,wBAAwD,oBAAI,IAAuB,CAAC,aAAa,UAAU,WAAW,CAAC;AAG7H,IAAM,sBAAsD,oBAAI,IAAuB,CAAC,WAAW,WAAW,WAAW,YAAY,CAAC;AAmBtI,IAAM,oBAA+C,CAAC,aAAa,aAAa,QAAQ,aAAa,cAAc,YAAY,UAAU;AAoShJ,IAAM,2BAAgD,oBAAI,IAAI;AAAA,EAC5D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,SAAS,mBAAmB,OAA2C;AAC5E,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,YAAY;AAClB,SACE,OAAO,UAAU,UAAU,YAC3B,yBAAyB,IAAI,UAAU,KAAK,KAC5C,OAAO,UAAU,WAAW;AAEhC;AAsBO,SAAS,kBAAkB,OAA0C;AAC1E,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,YAAY;AAClB,SACE,UAAU,UAAU,iBACpB,OAAO,UAAU,WAAW,YAC5B,OAAO,UAAU,UAAU;AAE/B;AAoDO,SAAS,mBAAmB,OAA2C;AAC5E,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,YAAY;AAClB,SACE,UAAU,UAAU,kBACpB,OAAO,UAAU,WAAW;AAEhC;","names":[]}
@@ -68,6 +68,7 @@ interface NodeSkippedEvent {
68
68
  item_index?: number;
69
69
  invocation_count?: number;
70
70
  output: Record<string, unknown>;
71
+ source: "executor" | "user_skip" | "user_manual" | "retry" | "mocked" | null;
71
72
  }
72
73
  interface NodeFailedEvent {
73
74
  ts: string;
@@ -68,6 +68,7 @@ interface NodeSkippedEvent {
68
68
  item_index?: number;
69
69
  invocation_count?: number;
70
70
  output: Record<string, unknown>;
71
+ source: "executor" | "user_skip" | "user_manual" | "retry" | "mocked" | null;
71
72
  }
72
73
  interface NodeFailedEvent {
73
74
  ts: string;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../generated/workflow-events.ts"],"sourcesContent":["// AUTO-GENERATED — do not edit manually.\n// Sources:\n// matrx_graph.types.events — the durable workflow run events\n// matrx_graph.types.primitives — run status vocabulary\n// aidream.services.runtime.workflow_events — ephemeral node_stream,\n// router handshake, run_announce\n// Run: uv run python scripts/generate_types.py workflow-events\n// or fetch via `pnpm sync-types` (pulls /schema/bundle/workflow-events-ts).\n//\n// The backend emits each durable event as `{event: \"data\", data: {event:\n// \"<one_of>\", ...}}` on the NDJSON run stream, and as `data:` JSON frames on\n// the per-run SSE feed (`GET /runs/{id}/events/stream`).\n\n// --- Run status vocabulary ---\n\n/** Every value `workflow.run.status` can hold — scheduler outcomes plus the\n * transitional control states (`pausing` / `cancelling`). */\nexport type WorkflowRunStatus =\n | \"pending\"\n | \"running\"\n | \"paused\"\n | \"interrupted\"\n | \"awaiting_input\"\n | \"errored\"\n | \"completed\"\n | \"failed\"\n | \"cancelled\"\n | \"pausing\"\n | \"cancelling\";\n\n/** Finished forever — no resume, no recovery. */\nexport const TERMINAL_RUN_STATUSES: ReadonlySet<WorkflowRunStatus> = new Set<WorkflowRunStatus>([\"completed\", \"failed\", \"cancelled\"]);\n\n/** The scheduler is (or is about to be) making progress. */\nexport const ACTIVE_RUN_STATUSES: ReadonlySet<WorkflowRunStatus> = new Set<WorkflowRunStatus>([\"pending\", \"running\", \"pausing\", \"cancelling\"]);\n\n// --- Agent-step liveness vocabulary ---\n\n/** What an agent-family step is DOING right now, carried as the `delta`\n * of a `node_stream` frame with `kind: \"phase\"`. CLOSED: the server folds\n * every label onto this set before it reaches the wire, so a renderer may\n * switch exhaustively. An unrecognised string is still possible (the server\n * passes an unmapped label through and logs it) — render it verbatim. */\nexport type AgentStepPhase =\n | \"preparing\"\n | \"streaming\"\n | \"tool\"\n | \"reasoning\"\n | \"finalizing\"\n | \"retrying\"\n | \"complete\";\n\n/** The same set, ordered as a healthy step walks it. */\nexport const AGENT_STEP_PHASES: readonly AgentStepPhase[] = [\"preparing\", \"streaming\", \"tool\", \"reasoning\", \"finalizing\", \"retrying\", \"complete\"];\n\n// --- Durable scheduler events (recorded in wf_node_events, replayed) ---\n\nexport interface RunStartedEvent {\n ts: string;\n event: \"run_started\";\n run_id: string;\n thread_id: string;\n definition_id: string;\n definition_hash: string;\n}\n\nexport interface NodeStartedEvent {\n ts: string;\n event: \"node_started\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n inputs: Record<string, unknown>;\n output_kind: string | null;\n}\n\nexport interface NodeCompletedEvent {\n ts: string;\n event: \"node_completed\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n duration_ms: number;\n output: Record<string, unknown>;\n output_kind: string | null;\n output_kind_ok: boolean | null;\n output_kind_errors: string[] | null;\n output_kind_version: number | null;\n output_kind_degraded: string | null;\n metadata: Record<string, unknown> | null;\n wrapper: Record<string, unknown> | null;\n}\n\nexport interface NodeSkippedEvent {\n ts: string;\n event: \"node_skipped\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n output: Record<string, unknown>;\n}\n\nexport interface NodeFailedEvent {\n ts: string;\n event: \"node_failed\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n error_type: string;\n error_message: string;\n error: Record<string, unknown> | null;\n wrapper: Record<string, unknown> | null;\n}\n\nexport interface NodeRetryScheduledEvent {\n ts: string;\n event: \"node_retry_scheduled\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n next_attempt: number;\n delay_ms: number;\n error_type: string;\n error_message: string;\n}\n\nexport interface NodeProgressEvent {\n ts: string;\n event: \"node_progress\";\n run_id: string;\n step: number;\n node_id: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n message: string;\n fraction: number | null;\n current: number | null;\n total: number | null;\n}\n\nexport interface CheckpointSavedEvent {\n ts: string;\n event: \"checkpoint_saved\";\n run_id: string;\n checkpoint_id: string;\n step: number;\n parent_checkpoint_id: string | null;\n}\n\nexport interface RunInterruptedEvent {\n ts: string;\n event: \"run_interrupted\";\n run_id: string;\n node_id: string;\n payload: Record<string, unknown>;\n checkpoint_id: string | null;\n}\n\nexport type RunStatus = \"pending\" | \"running\" | \"paused\" | \"interrupted\" | \"awaiting_input\" | \"errored\" | \"completed\" | \"failed\" | \"cancelled\";\n\nexport interface RunCompletedEvent {\n ts: string;\n event: \"run_completed\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n last_outputs: Record<string, unknown>;\n channel_values: Record<string, unknown>;\n}\n\nexport interface RunFailedEvent {\n ts: string;\n event: \"run_failed\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n error_type: string;\n error_message: string;\n}\n\nexport interface RunCancelledEvent {\n ts: string;\n event: \"run_cancelled\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n reason: \"graceful\" | \"immediate\" | \"candidate_stopped\";\n}\n\nexport interface RunPausedEvent {\n ts: string;\n event: \"run_paused\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n checkpoint_id: string | null;\n}\n\nexport interface RunResumedEvent {\n ts: string;\n event: \"run_resumed\";\n run_id: string;\n from_checkpoint_id: string;\n mode: \"pause\" | \"interrupt\" | \"user_skip\" | \"user_manual\" | \"retry\";\n}\n\nexport interface RunErroredEvent {\n ts: string;\n event: \"run_errored\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n node_id: string;\n step: number;\n attempt: number;\n error_type: string;\n error_message: string;\n checkpoint_id: string | null;\n}\n\nexport interface NodeEmittedEvent {\n ts: string;\n event: \"node_emitted\";\n run_id: string;\n step: number;\n node_id: string;\n dispatch_id?: string;\n item_index?: number;\n attempt: number;\n mode: \"confirmation\" | \"summary\" | \"full\" | \"restructured\";\n payload: Record<string, unknown>;\n component_ref: string | null;\n surface: string;\n title: string | null;\n presentation: \"panel\" | \"showcase\";\n kind: string | null;\n kind_ok: boolean | null;\n metadata: Record<string, unknown> | null;\n empty_values: string[];\n empty_notice: string | null;\n}\n\nexport interface NodeCostEvent {\n ts: string;\n event: \"node_cost\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string | null;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n cost_usd: number;\n input_tokens: number;\n output_tokens: number;\n total_tokens: number;\n model: string | null;\n models: string[];\n conversation_id: string | null;\n request_id: string | null;\n}\n\nexport interface WorkSetProgressEvent {\n ts: string;\n event: \"work_set_progress\";\n run_id: string;\n step: number;\n node_id: string;\n set_name: string;\n wave: number;\n dispatched: number;\n pending: number;\n in_progress: number;\n succeeded: number;\n failed: number;\n dead_letter: number;\n discovered: number;\n done: boolean;\n}\n\nexport interface SubgraphRunLinkedEvent {\n ts: string;\n event: \"subgraph_run_linked\";\n run_id: string;\n step: number;\n node_id: string;\n dispatch_id?: string;\n item_index?: number;\n child_run_id: string;\n child_definition_id: string;\n child_definition_name: string | null;\n reattached: boolean;\n child_status: string;\n}\n\n/** The durable scheduler events — recorded in wf_node_events and replayed\n * on reconnect via the per-run `seq` cursor. */\nexport type WorkflowRunEvent =\n | RunStartedEvent\n | NodeStartedEvent\n | NodeCompletedEvent\n | NodeSkippedEvent\n | NodeFailedEvent\n | NodeRetryScheduledEvent\n | NodeProgressEvent\n | CheckpointSavedEvent\n | RunInterruptedEvent\n | RunCompletedEvent\n | RunFailedEvent\n | RunCancelledEvent\n | RunPausedEvent\n | RunResumedEvent\n | RunErroredEvent\n | NodeEmittedEvent\n | NodeCostEvent\n | WorkSetProgressEvent\n | SubgraphRunLinkedEvent;\n\nconst WORKFLOW_RUN_EVENT_TYPES: ReadonlySet<string> = new Set([\n \"run_started\",\n \"node_started\",\n \"node_completed\",\n \"node_skipped\",\n \"node_failed\",\n \"node_retry_scheduled\",\n \"node_progress\",\n \"checkpoint_saved\",\n \"run_interrupted\",\n \"run_completed\",\n \"run_failed\",\n \"run_cancelled\",\n \"run_paused\",\n \"run_resumed\",\n \"run_errored\",\n \"node_emitted\",\n \"node_cost\",\n \"work_set_progress\",\n \"subgraph_run_linked\",\n]);\n\nexport function isWorkflowRunEvent(value: unknown): value is WorkflowRunEvent {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as { event?: unknown; run_id?: unknown };\n return (\n typeof candidate.event === \"string\" &&\n WORKFLOW_RUN_EVENT_TYPES.has(candidate.event) &&\n typeof candidate.run_id === \"string\"\n );\n}\n\n// --- Ephemeral live-token frame (never persisted, never replayed) ---\n\nexport interface NodeStreamEvent {\n event: \"node_stream\";\n run_id: string;\n node_id: string | null;\n dispatch_id?: string;\n item_index?: number;\n kind: \"chunk\" | \"reasoning\" | \"phase\" | \"tool\" | \"warning\" | \"record_update\" | \"resource_changed\" | \"render_block\" | \"media\";\n delta: string;\n stream_seq: number;\n ts: string;\n chunks_received: number;\n chars_streamed: number;\n frame_id?: string | null;\n frame_index?: number;\n frame_count?: number;\n block_shadowed?: boolean;\n}\n\nexport function isNodeStreamEvent(value: unknown): value is NodeStreamEvent {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as { event?: unknown; run_id?: unknown; delta?: unknown };\n return (\n candidate.event === \"node_stream\" &&\n typeof candidate.run_id === \"string\" &&\n typeof candidate.delta === \"string\"\n );\n}\n\n// --- Router handshake frames ---\n// Emitted on the synchronous POST /workflows/{id}/runs response BEFORE the\n// run detaches to wf_node_events. They only carry the run_id (plus a note) so\n// the client can adopt it and hand off to the live event feed.\n\nexport interface WorkflowRunStartedEvent {\n [key: string]: unknown;\n event: \"workflow_run_started\";\n run_id: string;\n}\n\nexport interface WorkflowRunResumedEvent {\n [key: string]: unknown;\n event: \"workflow_run_resumed\";\n run_id: string;\n checkpoint_id: string;\n}\n\nexport interface WorkflowRunDetachedEvent {\n [key: string]: unknown;\n event: \"workflow_run_detached\";\n run_id: string;\n message: string;\n}\n\nexport type WorkflowRouterEvent =\n | WorkflowRunStartedEvent\n | WorkflowRunResumedEvent\n | WorkflowRunDetachedEvent;\n\n/** Every frame a client can see on a run's stream. */\nexport type WorkflowStreamEvent =\n | WorkflowRunEvent\n | NodeStreamEvent\n | WorkflowRouterEvent;\n\n// --- User-scoped run announcements (GET /runs/stream) ---\n// Deliberately OUTSIDE WorkflowStreamEvent: fired by a Postgres trigger on\n// every workflow.run INSERT + real status transition owned by the caller.\n// EPHEMERAL — no SSE id, no replay; the runs-list fetch is the snapshot.\n\nexport interface RunAnnounceEvent {\n event: \"run_announce\";\n run_id: string;\n workflow_id: string;\n status: string;\n kind: \"inserted\" | \"status\";\n ts: string;\n}\n\nexport function isRunAnnounceEvent(value: unknown): value is RunAnnounceEvent {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as { event?: unknown; run_id?: unknown };\n return (\n candidate.event === \"run_announce\" &&\n typeof candidate.run_id === \"string\"\n );\n}\n"],"mappings":";AA+BO,IAAM,wBAAwD,oBAAI,IAAuB,CAAC,aAAa,UAAU,WAAW,CAAC;AAG7H,IAAM,sBAAsD,oBAAI,IAAuB,CAAC,WAAW,WAAW,WAAW,YAAY,CAAC;AAmBtI,IAAM,oBAA+C,CAAC,aAAa,aAAa,QAAQ,aAAa,cAAc,YAAY,UAAU;AAmShJ,IAAM,2BAAgD,oBAAI,IAAI;AAAA,EAC5D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,SAAS,mBAAmB,OAA2C;AAC5E,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,YAAY;AAClB,SACE,OAAO,UAAU,UAAU,YAC3B,yBAAyB,IAAI,UAAU,KAAK,KAC5C,OAAO,UAAU,WAAW;AAEhC;AAsBO,SAAS,kBAAkB,OAA0C;AAC1E,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,YAAY;AAClB,SACE,UAAU,UAAU,iBACpB,OAAO,UAAU,WAAW,YAC5B,OAAO,UAAU,UAAU;AAE/B;AAoDO,SAAS,mBAAmB,OAA2C;AAC5E,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,YAAY;AAClB,SACE,UAAU,UAAU,kBACpB,OAAO,UAAU,WAAW;AAEhC;","names":[]}
1
+ {"version":3,"sources":["../../generated/workflow-events.ts"],"sourcesContent":["// AUTO-GENERATED — do not edit manually.\n// Sources:\n// matrx_graph.types.events — the durable workflow run events\n// matrx_graph.types.primitives — run status vocabulary\n// aidream.services.runtime.workflow_events — ephemeral node_stream,\n// router handshake, run_announce\n// Run: uv run python scripts/generate_types.py workflow-events\n// or fetch via `pnpm sync-types` (pulls /schema/bundle/workflow-events-ts).\n//\n// The backend emits each durable event as `{event: \"data\", data: {event:\n// \"<one_of>\", ...}}` on the NDJSON run stream, and as `data:` JSON frames on\n// the per-run SSE feed (`GET /runs/{id}/events/stream`).\n\n// --- Run status vocabulary ---\n\n/** Every value `workflow.run.status` can hold — scheduler outcomes plus the\n * transitional control states (`pausing` / `cancelling`). */\nexport type WorkflowRunStatus =\n | \"pending\"\n | \"running\"\n | \"paused\"\n | \"interrupted\"\n | \"awaiting_input\"\n | \"errored\"\n | \"completed\"\n | \"failed\"\n | \"cancelled\"\n | \"pausing\"\n | \"cancelling\";\n\n/** Finished forever — no resume, no recovery. */\nexport const TERMINAL_RUN_STATUSES: ReadonlySet<WorkflowRunStatus> = new Set<WorkflowRunStatus>([\"completed\", \"failed\", \"cancelled\"]);\n\n/** The scheduler is (or is about to be) making progress. */\nexport const ACTIVE_RUN_STATUSES: ReadonlySet<WorkflowRunStatus> = new Set<WorkflowRunStatus>([\"pending\", \"running\", \"pausing\", \"cancelling\"]);\n\n// --- Agent-step liveness vocabulary ---\n\n/** What an agent-family step is DOING right now, carried as the `delta`\n * of a `node_stream` frame with `kind: \"phase\"`. CLOSED: the server folds\n * every label onto this set before it reaches the wire, so a renderer may\n * switch exhaustively. An unrecognised string is still possible (the server\n * passes an unmapped label through and logs it) — render it verbatim. */\nexport type AgentStepPhase =\n | \"preparing\"\n | \"streaming\"\n | \"tool\"\n | \"reasoning\"\n | \"finalizing\"\n | \"retrying\"\n | \"complete\";\n\n/** The same set, ordered as a healthy step walks it. */\nexport const AGENT_STEP_PHASES: readonly AgentStepPhase[] = [\"preparing\", \"streaming\", \"tool\", \"reasoning\", \"finalizing\", \"retrying\", \"complete\"];\n\n// --- Durable scheduler events (recorded in wf_node_events, replayed) ---\n\nexport interface RunStartedEvent {\n ts: string;\n event: \"run_started\";\n run_id: string;\n thread_id: string;\n definition_id: string;\n definition_hash: string;\n}\n\nexport interface NodeStartedEvent {\n ts: string;\n event: \"node_started\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n inputs: Record<string, unknown>;\n output_kind: string | null;\n}\n\nexport interface NodeCompletedEvent {\n ts: string;\n event: \"node_completed\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n duration_ms: number;\n output: Record<string, unknown>;\n output_kind: string | null;\n output_kind_ok: boolean | null;\n output_kind_errors: string[] | null;\n output_kind_version: number | null;\n output_kind_degraded: string | null;\n metadata: Record<string, unknown> | null;\n wrapper: Record<string, unknown> | null;\n}\n\nexport interface NodeSkippedEvent {\n ts: string;\n event: \"node_skipped\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n output: Record<string, unknown>;\n source: \"executor\" | \"user_skip\" | \"user_manual\" | \"retry\" | \"mocked\" | null;\n}\n\nexport interface NodeFailedEvent {\n ts: string;\n event: \"node_failed\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n error_type: string;\n error_message: string;\n error: Record<string, unknown> | null;\n wrapper: Record<string, unknown> | null;\n}\n\nexport interface NodeRetryScheduledEvent {\n ts: string;\n event: \"node_retry_scheduled\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n invocation_count?: number;\n next_attempt: number;\n delay_ms: number;\n error_type: string;\n error_message: string;\n}\n\nexport interface NodeProgressEvent {\n ts: string;\n event: \"node_progress\";\n run_id: string;\n step: number;\n node_id: string;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n message: string;\n fraction: number | null;\n current: number | null;\n total: number | null;\n}\n\nexport interface CheckpointSavedEvent {\n ts: string;\n event: \"checkpoint_saved\";\n run_id: string;\n checkpoint_id: string;\n step: number;\n parent_checkpoint_id: string | null;\n}\n\nexport interface RunInterruptedEvent {\n ts: string;\n event: \"run_interrupted\";\n run_id: string;\n node_id: string;\n payload: Record<string, unknown>;\n checkpoint_id: string | null;\n}\n\nexport type RunStatus = \"pending\" | \"running\" | \"paused\" | \"interrupted\" | \"awaiting_input\" | \"errored\" | \"completed\" | \"failed\" | \"cancelled\";\n\nexport interface RunCompletedEvent {\n ts: string;\n event: \"run_completed\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n last_outputs: Record<string, unknown>;\n channel_values: Record<string, unknown>;\n}\n\nexport interface RunFailedEvent {\n ts: string;\n event: \"run_failed\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n error_type: string;\n error_message: string;\n}\n\nexport interface RunCancelledEvent {\n ts: string;\n event: \"run_cancelled\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n reason: \"graceful\" | \"immediate\" | \"candidate_stopped\";\n}\n\nexport interface RunPausedEvent {\n ts: string;\n event: \"run_paused\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n checkpoint_id: string | null;\n}\n\nexport interface RunResumedEvent {\n ts: string;\n event: \"run_resumed\";\n run_id: string;\n from_checkpoint_id: string;\n mode: \"pause\" | \"interrupt\" | \"user_skip\" | \"user_manual\" | \"retry\";\n}\n\nexport interface RunErroredEvent {\n ts: string;\n event: \"run_errored\";\n run_id: string;\n status: RunStatus;\n steps_executed: number;\n node_id: string;\n step: number;\n attempt: number;\n error_type: string;\n error_message: string;\n checkpoint_id: string | null;\n}\n\nexport interface NodeEmittedEvent {\n ts: string;\n event: \"node_emitted\";\n run_id: string;\n step: number;\n node_id: string;\n dispatch_id?: string;\n item_index?: number;\n attempt: number;\n mode: \"confirmation\" | \"summary\" | \"full\" | \"restructured\";\n payload: Record<string, unknown>;\n component_ref: string | null;\n surface: string;\n title: string | null;\n presentation: \"panel\" | \"showcase\";\n kind: string | null;\n kind_ok: boolean | null;\n metadata: Record<string, unknown> | null;\n empty_values: string[];\n empty_notice: string | null;\n}\n\nexport interface NodeCostEvent {\n ts: string;\n event: \"node_cost\";\n run_id: string;\n step: number;\n node_id: string;\n spec_type: string | null;\n attempt: number;\n dispatch_id?: string;\n item_index?: number;\n cost_usd: number;\n input_tokens: number;\n output_tokens: number;\n total_tokens: number;\n model: string | null;\n models: string[];\n conversation_id: string | null;\n request_id: string | null;\n}\n\nexport interface WorkSetProgressEvent {\n ts: string;\n event: \"work_set_progress\";\n run_id: string;\n step: number;\n node_id: string;\n set_name: string;\n wave: number;\n dispatched: number;\n pending: number;\n in_progress: number;\n succeeded: number;\n failed: number;\n dead_letter: number;\n discovered: number;\n done: boolean;\n}\n\nexport interface SubgraphRunLinkedEvent {\n ts: string;\n event: \"subgraph_run_linked\";\n run_id: string;\n step: number;\n node_id: string;\n dispatch_id?: string;\n item_index?: number;\n child_run_id: string;\n child_definition_id: string;\n child_definition_name: string | null;\n reattached: boolean;\n child_status: string;\n}\n\n/** The durable scheduler events — recorded in wf_node_events and replayed\n * on reconnect via the per-run `seq` cursor. */\nexport type WorkflowRunEvent =\n | RunStartedEvent\n | NodeStartedEvent\n | NodeCompletedEvent\n | NodeSkippedEvent\n | NodeFailedEvent\n | NodeRetryScheduledEvent\n | NodeProgressEvent\n | CheckpointSavedEvent\n | RunInterruptedEvent\n | RunCompletedEvent\n | RunFailedEvent\n | RunCancelledEvent\n | RunPausedEvent\n | RunResumedEvent\n | RunErroredEvent\n | NodeEmittedEvent\n | NodeCostEvent\n | WorkSetProgressEvent\n | SubgraphRunLinkedEvent;\n\nconst WORKFLOW_RUN_EVENT_TYPES: ReadonlySet<string> = new Set([\n \"run_started\",\n \"node_started\",\n \"node_completed\",\n \"node_skipped\",\n \"node_failed\",\n \"node_retry_scheduled\",\n \"node_progress\",\n \"checkpoint_saved\",\n \"run_interrupted\",\n \"run_completed\",\n \"run_failed\",\n \"run_cancelled\",\n \"run_paused\",\n \"run_resumed\",\n \"run_errored\",\n \"node_emitted\",\n \"node_cost\",\n \"work_set_progress\",\n \"subgraph_run_linked\",\n]);\n\nexport function isWorkflowRunEvent(value: unknown): value is WorkflowRunEvent {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as { event?: unknown; run_id?: unknown };\n return (\n typeof candidate.event === \"string\" &&\n WORKFLOW_RUN_EVENT_TYPES.has(candidate.event) &&\n typeof candidate.run_id === \"string\"\n );\n}\n\n// --- Ephemeral live-token frame (never persisted, never replayed) ---\n\nexport interface NodeStreamEvent {\n event: \"node_stream\";\n run_id: string;\n node_id: string | null;\n dispatch_id?: string;\n item_index?: number;\n kind: \"chunk\" | \"reasoning\" | \"phase\" | \"tool\" | \"warning\" | \"record_update\" | \"resource_changed\" | \"render_block\" | \"media\";\n delta: string;\n stream_seq: number;\n ts: string;\n chunks_received: number;\n chars_streamed: number;\n frame_id?: string | null;\n frame_index?: number;\n frame_count?: number;\n block_shadowed?: boolean;\n}\n\nexport function isNodeStreamEvent(value: unknown): value is NodeStreamEvent {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as { event?: unknown; run_id?: unknown; delta?: unknown };\n return (\n candidate.event === \"node_stream\" &&\n typeof candidate.run_id === \"string\" &&\n typeof candidate.delta === \"string\"\n );\n}\n\n// --- Router handshake frames ---\n// Emitted on the synchronous POST /workflows/{id}/runs response BEFORE the\n// run detaches to wf_node_events. They only carry the run_id (plus a note) so\n// the client can adopt it and hand off to the live event feed.\n\nexport interface WorkflowRunStartedEvent {\n [key: string]: unknown;\n event: \"workflow_run_started\";\n run_id: string;\n}\n\nexport interface WorkflowRunResumedEvent {\n [key: string]: unknown;\n event: \"workflow_run_resumed\";\n run_id: string;\n checkpoint_id: string;\n}\n\nexport interface WorkflowRunDetachedEvent {\n [key: string]: unknown;\n event: \"workflow_run_detached\";\n run_id: string;\n message: string;\n}\n\nexport type WorkflowRouterEvent =\n | WorkflowRunStartedEvent\n | WorkflowRunResumedEvent\n | WorkflowRunDetachedEvent;\n\n/** Every frame a client can see on a run's stream. */\nexport type WorkflowStreamEvent =\n | WorkflowRunEvent\n | NodeStreamEvent\n | WorkflowRouterEvent;\n\n// --- User-scoped run announcements (GET /runs/stream) ---\n// Deliberately OUTSIDE WorkflowStreamEvent: fired by a Postgres trigger on\n// every workflow.run INSERT + real status transition owned by the caller.\n// EPHEMERAL — no SSE id, no replay; the runs-list fetch is the snapshot.\n\nexport interface RunAnnounceEvent {\n event: \"run_announce\";\n run_id: string;\n workflow_id: string;\n status: string;\n kind: \"inserted\" | \"status\";\n ts: string;\n}\n\nexport function isRunAnnounceEvent(value: unknown): value is RunAnnounceEvent {\n if (typeof value !== \"object\" || value === null) return false;\n const candidate = value as { event?: unknown; run_id?: unknown };\n return (\n candidate.event === \"run_announce\" &&\n typeof candidate.run_id === \"string\"\n );\n}\n"],"mappings":";AA+BO,IAAM,wBAAwD,oBAAI,IAAuB,CAAC,aAAa,UAAU,WAAW,CAAC;AAG7H,IAAM,sBAAsD,oBAAI,IAAuB,CAAC,WAAW,WAAW,WAAW,YAAY,CAAC;AAmBtI,IAAM,oBAA+C,CAAC,aAAa,aAAa,QAAQ,aAAa,cAAc,YAAY,UAAU;AAoShJ,IAAM,2BAAgD,oBAAI,IAAI;AAAA,EAC5D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,SAAS,mBAAmB,OAA2C;AAC5E,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,YAAY;AAClB,SACE,OAAO,UAAU,UAAU,YAC3B,yBAAyB,IAAI,UAAU,KAAK,KAC5C,OAAO,UAAU,WAAW;AAEhC;AAsBO,SAAS,kBAAkB,OAA0C;AAC1E,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,YAAY;AAClB,SACE,UAAU,UAAU,iBACpB,OAAO,UAAU,WAAW,YAC5B,OAAO,UAAU,UAAU;AAE/B;AAoDO,SAAS,mBAAmB,OAA2C;AAC5E,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,YAAY;AAClB,SACE,UAAU,UAAU,kBACpB,OAAO,UAAU,WAAW;AAEhC;","names":[]}
package/dist/index.d.cts CHANGED
@@ -8,7 +8,7 @@ export { ApiTargetLogContext, BackendApiError, BackendApiErrorData, BackendError
8
8
  export { F as FollowRuntimeOperationOptions, a as FollowRuntimeOperationToEndOptions, b as FollowRuntimeOperationToEndResult, M as MatrxAgentStartRequest, c as MatrxCancelResponse, d as MatrxChatMessage, e as MatrxCompletedRun, f as MatrxContextAnchor, g as MatrxConversationContinueRequest, h as MatrxConversationResumeRequest, i as MatrxConversationStart, j as MatrxEphemeralConversation, k as MatrxJsonObject, l as MatrxJsonValue, m as MatrxMandateStartRequest, n as MatrxOperationEventsPage, o as MatrxOperationFollowEvent, p as MatrxOperationStatusResponse, q as MatrxOperationsByLinkResponse, r as MatrxRequestScope, s as MatrxRunError, t as MatrxRunHandle, u as MatrxRuntimeExecutionStatus, v as MatrxRuntimeOperationEvent, w as MatrxRuntimeOperationView, x as MatrxStoredConversationContinue, y as MatrxStoredConversationCreate, z as MatrxStreamCallOptions, A as MatrxTurnFields, R as RunAgentToCompletionOptions, T as TERMINAL_MATRX_RUNTIME_STATUSES, B as cancelAgentRun, C as continueAgentConversation, D as continueEphemeralConversationStart, E as continueStoredConversationStart, G as followRuntimeOperationEvents, H as followRuntimeOperationToEnd, I as getRuntimeOperationStatus, J as getRuntimeOperationsByLink, K as listRuntimeOperationEvents, L as mintMatrxConversationId, N as newEphemeralConversationStart, O as newStoredConversationStart, P as rejoinRuntimeOperation, Q as resumeAgentConversation, S as runAgentToCompletion, U as startAgentRun, V as startMandateRun } from './operations-C9QvBH_2.cjs';
9
9
  import '@ai-matrx/data';
10
10
  import '@ai-matrx/data/net';
11
- import './keys.generated-DsQcsQuC.cjs';
11
+ import './keys.generated-CQaOZm1t.cjs';
12
12
 
13
13
  /**
14
14
  * Media reference roles — the builder's side of the one vocabulary.
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export { ApiTargetLogContext, BackendApiError, BackendApiErrorData, BackendError
8
8
  export { F as FollowRuntimeOperationOptions, a as FollowRuntimeOperationToEndOptions, b as FollowRuntimeOperationToEndResult, M as MatrxAgentStartRequest, c as MatrxCancelResponse, d as MatrxChatMessage, e as MatrxCompletedRun, f as MatrxContextAnchor, g as MatrxConversationContinueRequest, h as MatrxConversationResumeRequest, i as MatrxConversationStart, j as MatrxEphemeralConversation, k as MatrxJsonObject, l as MatrxJsonValue, m as MatrxMandateStartRequest, n as MatrxOperationEventsPage, o as MatrxOperationFollowEvent, p as MatrxOperationStatusResponse, q as MatrxOperationsByLinkResponse, r as MatrxRequestScope, s as MatrxRunError, t as MatrxRunHandle, u as MatrxRuntimeExecutionStatus, v as MatrxRuntimeOperationEvent, w as MatrxRuntimeOperationView, x as MatrxStoredConversationContinue, y as MatrxStoredConversationCreate, z as MatrxStreamCallOptions, A as MatrxTurnFields, R as RunAgentToCompletionOptions, T as TERMINAL_MATRX_RUNTIME_STATUSES, B as cancelAgentRun, C as continueAgentConversation, D as continueEphemeralConversationStart, E as continueStoredConversationStart, G as followRuntimeOperationEvents, H as followRuntimeOperationToEnd, I as getRuntimeOperationStatus, J as getRuntimeOperationsByLink, K as listRuntimeOperationEvents, L as mintMatrxConversationId, N as newEphemeralConversationStart, O as newStoredConversationStart, P as rejoinRuntimeOperation, Q as resumeAgentConversation, S as runAgentToCompletion, U as startAgentRun, V as startMandateRun } from './operations-C3iHFcnt.js';
9
9
  import '@ai-matrx/data';
10
10
  import '@ai-matrx/data/net';
11
- import './keys.generated-DsQcsQuC.js';
11
+ import './keys.generated-CQaOZm1t.js';
12
12
 
13
13
  /**
14
14
  * Media reference roles — the builder's side of the one vocabulary.
@@ -6,9 +6,9 @@
6
6
  * from the IN-PROCESS mandate declarations — the same `declared_mandates()` the
7
7
  * boot sync writes to the database from. There is no hand list anywhere.
8
8
  *
9
- * aidream revision: 03ed5a373b85bb6d5d208bfb0cc6f72a36308744
9
+ * aidream revision: 00147ac11b6b7fdb4219d14dde965528d3c82679
10
10
  * generator version: 1.0.0
11
- * package version: 0.42.0
11
+ * package version: 0.43.1
12
12
  * active keys: 544
13
13
  * retiring keys: 0
14
14
  *
@@ -19,9 +19,9 @@
19
19
  */
20
20
  /** Where this module came from — surfaced so a report can name the exact build. */
21
21
  declare const MANDATE_KEYS_META: {
22
- readonly aidreamRevision: "03ed5a373b85bb6d5d208bfb0cc6f72a36308744";
22
+ readonly aidreamRevision: "00147ac11b6b7fdb4219d14dde965528d3c82679";
23
23
  readonly generatorVersion: "1.0.0";
24
- readonly packageVersion: "0.42.0";
24
+ readonly packageVersion: "0.43.1";
25
25
  readonly retireWindow: 3;
26
26
  };
27
27
  /** Every declared mandate key, by THE IDENTIFIER RULE. */
@@ -6,9 +6,9 @@
6
6
  * from the IN-PROCESS mandate declarations — the same `declared_mandates()` the
7
7
  * boot sync writes to the database from. There is no hand list anywhere.
8
8
  *
9
- * aidream revision: 03ed5a373b85bb6d5d208bfb0cc6f72a36308744
9
+ * aidream revision: 00147ac11b6b7fdb4219d14dde965528d3c82679
10
10
  * generator version: 1.0.0
11
- * package version: 0.42.0
11
+ * package version: 0.43.1
12
12
  * active keys: 544
13
13
  * retiring keys: 0
14
14
  *
@@ -19,9 +19,9 @@
19
19
  */
20
20
  /** Where this module came from — surfaced so a report can name the exact build. */
21
21
  declare const MANDATE_KEYS_META: {
22
- readonly aidreamRevision: "03ed5a373b85bb6d5d208bfb0cc6f72a36308744";
22
+ readonly aidreamRevision: "00147ac11b6b7fdb4219d14dde965528d3c82679";
23
23
  readonly generatorVersion: "1.0.0";
24
- readonly packageVersion: "0.42.0";
24
+ readonly packageVersion: "0.43.1";
25
25
  readonly retireWindow: 3;
26
26
  };
27
27
  /** Every declared mandate key, by THE IDENTIFIER RULE. */
@@ -42,9 +42,9 @@ module.exports = __toCommonJS(mandates_exports);
42
42
 
43
43
  // mandates/keys.generated.ts
44
44
  var MANDATE_KEYS_META = {
45
- aidreamRevision: "03ed5a373b85bb6d5d208bfb0cc6f72a36308744",
45
+ aidreamRevision: "00147ac11b6b7fdb4219d14dde965528d3c82679",
46
46
  generatorVersion: "1.0.0",
47
- packageVersion: "0.42.0",
47
+ packageVersion: "0.43.1",
48
48
  retireWindow: 3
49
49
  };
50
50
  var MANDATE_KEYS = {