@makaio/framework 1.0.0-dev-1781443723575 → 1.0.0-dev-1781454904823
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.
- package/dist/.makaio-build.json +2 -2
- package/dist/adapters/index.d.mts +1 -1
- package/dist/bus/index.mjs +1 -1
- package/dist/contracts/adapter/index.d.mts +2 -2
- package/dist/contracts/adapter/schemas/session-lineage.d.mts +1 -1
- package/dist/contracts/artifact/index.d.mts +1 -1
- package/dist/contracts/extension/index.d.mts +3 -3
- package/dist/contracts/facet/index.d.mts +1 -1
- package/dist/contracts/harness/index.d.mts +1 -1
- package/dist/contracts/index.d.mts +386 -52
- package/dist/contracts/index.mjs +1 -1
- package/dist/contracts/materialization/index.d.mts +3 -3
- package/dist/contracts/session/index.d.mts +2 -2
- package/dist/contracts/shared/index.d.mts +1 -1
- package/dist/contracts/skill/index.d.mts +1 -1
- package/dist/{definition-CPc6oKaF.d.mts → definition-DSq5ErZD.d.mts} +1 -1
- package/dist/{index-BZuF4I8O.d.mts → index-B3mq3Qjf.d.mts} +1 -1
- package/dist/{index-DWBpxSGQ.d.mts → index-BKbzDEv4.d.mts} +95 -95
- package/dist/{index-Doy13wLW.d.mts → index-BQ8H7cvY.d.mts} +15 -15
- package/dist/{index-iRe4CsR5.d.mts → index-BVMF3kRv.d.mts} +4 -4
- package/dist/{index-CQuLV3jj.d.mts → index-BVf5D_xQ.d.mts} +8 -8
- package/dist/{index-N7JtH6hX.d.mts → index-BkKWL_tI.d.mts} +3 -3
- package/dist/{index-DsAfeVbS.d.mts → index-CK_hi7fg.d.mts} +12 -12
- package/dist/{index-bLWdMu_T.d.mts → index-CgJf67BC.d.mts} +20 -20
- package/dist/{index-CtVy1e5h.d.mts → index-Cs009Dqh.d.mts} +15 -15
- package/dist/{index-gYlNeEGH.d.mts → index-Cs1JVq0D.d.mts} +16 -16
- package/dist/{index-D7oEYudM.d.mts → index-D8nNK-pF.d.mts} +1 -1
- package/dist/{index-DWRwbJjQ.d.mts → index-DLPjliGd.d.mts} +1 -1
- package/dist/{index-C2tDMYm0.d.mts → index-DN0GXDlw.d.mts} +5 -5
- package/dist/{index-BM_y78ZA2.d.mts → index-iXawmtSH2.d.mts} +6 -6
- package/dist/kernel/extension/index.d.mts +1 -1
- package/dist/kernel/index.d.mts +2 -2
- package/dist/kernel/observability/index.d.mts +1 -1
- package/dist/{namespace-CK50FeCH.d.mts → namespace-CN2TfSCY.d.mts} +2 -2
- package/dist/{namespace-thr1fR3_.d.mts → namespace-CWgNi8Gv.d.mts} +6 -6
- package/dist/{namespace-D63jVkzY.d.mts → namespace-DphMg7CF.d.mts} +5 -5
- package/dist/{namespace-vfKj-JHx.d.mts → namespace-Dy0pcIqF.d.mts} +9 -9
- package/dist/{namespace-DWT6hqxX.d.mts → namespace-Dyj2m6DT.d.mts} +36 -36
- package/dist/package-CBjoefAW.mjs +1 -0
- package/dist/{package-BEbo1-6S.d.mts → package-fwIv7zzj.d.mts} +1 -1
- package/dist/package.json +1 -1
- package/dist/primitive-runtime-BHSEOIH6.mjs +1 -0
- package/dist/{schema-CXgFk-dK.d.mts → schema-D2B2V6r6.d.mts} +2 -2
- package/dist/{schemas-DMl7IKG-.d.mts → schemas-ByBtBmoL.d.mts} +3 -3
- package/dist/{schemas-YFBpHbzr.d.mts → schemas-CN9hprME.d.mts} +3 -3
- package/dist/{schemas-BS8xAZ2y2.d.mts → schemas-D0gBYOoc2.d.mts} +6 -6
- package/dist/services/adapter-subsystem/index.d.mts +2 -2
- package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
- package/dist/services/context-rules/index.d.mts +11 -11
- package/dist/services/filesystem/namespace.d.mts +12 -12
- package/dist/services/filesystem/schemas.d.mts +6 -6
- package/dist/services/index.d.mts +32 -32
- package/dist/services/log-import/browser.d.mts +2 -2
- package/dist/services/log-import/index.d.mts +2 -2
- package/dist/services/log-import/log-import.d.mts +1 -1
- package/dist/services/log-import/namespace.d.mts +2 -2
- package/dist/services/log-import/schemas.d.mts +1 -1
- package/dist/services/session/index.d.mts +5 -5
- package/dist/services/session/messages/namespace.d.mts +1 -1
- package/dist/services/session/session-events/namespace.d.mts +1 -1
- package/dist/services/session/storage/namespace.d.mts +1 -1
- package/dist/services/session/storage/schema.d.mts +1 -1
- package/dist/services/settings/namespace.d.mts +9 -9
- package/dist/services/settings/storage/extension-configs/namespace.d.mts +3 -3
- package/dist/services/subagent-template/index.d.mts +1 -1
- package/dist/services/subagent-template/schemas.d.mts +1 -1
- package/dist/services/tray-menu/index.d.mts +2 -2
- package/dist/services/tray-menu/namespace.d.mts +1 -1
- package/dist/services/tray-menu/schemas.d.mts +1 -1
- package/dist/{session-lineage-CJgqfkMj.d.mts → session-lineage-DFkJgYt5.d.mts} +1 -1
- package/dist/{types-bPzpZb7_.d.mts → types-BB8iIAjZ.d.mts} +1 -1
- package/dist/{types-8q9G9p34.d.mts → types-Co-MJvHY.d.mts} +40 -40
- package/dist/workflow-engine/index.d.mts +124 -20
- package/dist/workflow-engine/index.mjs +1 -1
- package/dist/workflow-engine/package.d.mts +1 -1
- package/dist/workflow-engine/package.mjs +1 -1
- package/dist/workflow-engine/workflow-orchestrator.mjs +1 -1
- package/package.json +1 -1
- package/dist/package-Dvk8-Gfd.mjs +0 -1
- package/dist/primitive-runtime-UEzX4Ayu.mjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./chunk-DTipWd-i.mjs";import{t}from"./ajv-Cx19PP7Q.mjs";import{z as n}from"zod";import{execFile as r}from"node:child_process";import{isAbsolute as i,relative as a,resolve as o}from"node:path";import{realpathSync as s}from"node:fs";import{localSubject as c}from"@makaio/framework/core";import{NoHandlerError as l}from"@makaio/framework/bus";import{AgentSubjects as u,ArtifactSubjects as d,ExecutionLinkListQuerySchema as f,ExecutionLinkSchema as p,ExecutionListQuerySchema as m,ExecutionStatusSchema as h,ExecutionsByArtifactRefsQuerySchema as g,GateInstanceListQuerySchema as _,JsonPatchOperationSchema as v,JsonValueSchema as y,SessionSubjects as b,SpanRecordSchema as x,SubagentSubjects as S,WORKFLOW_CANCELLED_REASON as C,WorkerNodeSubjects as ee,WorkflowDefinitionSchema as te,WorkflowExecutionSchema as w,WorkflowFrameStateSchema as ne,WorkflowGateInstanceSchema as T,WorkflowListQuerySchema as re,WorkflowRunContextSchema as E,WorkflowSchemas as ie,WorkflowSubjects as ae,WorkflowSubjects as D,WorkflowWorkerSourceSchema as oe,createStepCancelSubject as se}from"@makaio/framework/contracts";import{createStorageNamespaceDefinition as ce}from"@makaio/framework/storage";import{index as O,primaryKey as le,uniqueIndex as ue}from"drizzle-orm/sqlite-core";import{index as k,primaryKey as A,uniqueIndex as de}from"drizzle-orm/pg-core";import{defineDualTable as j}from"@makaio/framework/storage/drizzle";import{sql as fe}from"drizzle-orm";import{evaluateSync as M,resolveTemplate as N}from"@makaio/framework/expression";import*as pe from"node:os";function me(e){return{scopeType:e.textEnum(`scope_type`,{enum:[`global`,`workspace`,`session`,`external`]}).notNull().$type(),scopeKind:e.text(`scope_kind`).notNull().default(``),scopeId:e.text(`scope_id`).notNull().default(``)}}const he=j(`workflow_definitions`,e=>({id:e.text(`id`).primaryKey(),name:e.text(`name`).notNull(),description:e.text(`description`),root:e.jsonCol(`root`).notNull(),inputSchema:e.jsonCol(`input_schema`),configSchema:e.jsonCol(`config_schema`),outputSchema:e.jsonCol(`output_schema`),state:e.jsonCol(`state`),artifact:e.jsonCol(`artifact`),triggers:e.jsonCol(`triggers`),...me(e),createdAt:e.epochMs(`created_at`).notNull(),updatedAt:e.epochMs(`updated_at`).notNull(),canvasLayout:e.jsonCol(`canvas_layout`),source:e.jsonCol(`source`),executionHints:e.jsonCol(`execution_hints`)}),{sqlite:e=>[ue(`uniq_workflow_definitions_name_scope`).on(e.name,e.scopeType,e.scopeKind,e.scopeId),O(`idx_workflow_definitions_scope`).on(e.scopeType,e.scopeKind,e.scopeId)],postgres:e=>[de(`uniq_workflow_definitions_name_scope`).on(e.name,e.scopeType,e.scopeKind,e.scopeId),k(`idx_workflow_definitions_scope`).on(e.scopeType,e.scopeKind,e.scopeId)]}),ge=he.sqlite,P=j(`workflow_executions`,e=>({id:e.text(`id`).primaryKey(),workflowId:e.text(`workflow_id`).notNull(),coordinatorSessionId:e.text(`coordinator_session_id`),status:e.textEnum(`status`,{enum:[`pending`,`running`,`paused`,`completed`,`failed`,`cancelled`]}).notNull(),inputs:e.jsonCol(`inputs`),error:e.text(`error`),reason:e.text(`reason`),startedAt:e.epochMs(`started_at`).notNull(),completedAt:e.epochMs(`completed_at`),triggerPayload:e.jsonCol(`trigger_payload`),artifactKind:e.text(`artifact_kind`),artifactId:e.text(`artifact_id`),...me(e)}),{sqlite:e=>[O(`idx_workflow_executions_status`).on(e.status),O(`idx_workflow_executions_scope_started`).on(e.scopeType,e.scopeKind,e.scopeId,e.startedAt),O(`idx_workflow_executions_workflow_started`).on(e.workflowId,e.startedAt),O(`idx_workflow_executions_artifact`).on(e.artifactKind,e.artifactId,e.startedAt)],postgres:e=>[k(`idx_workflow_executions_status`).on(e.status),k(`idx_workflow_executions_scope_started`).on(e.scopeType,e.scopeKind,e.scopeId,e.startedAt),k(`idx_workflow_executions_workflow_started`).on(e.workflowId,e.startedAt),k(`idx_workflow_executions_artifact`).on(e.artifactKind,e.artifactId,e.startedAt)]}),_e=P.sqlite,ve=j(`workflow_execution_frames`,e=>({frameId:e.text(`frame_id`).primaryKey(),executionId:e.text(`execution_id`).notNull().references(()=>P.columnPair(`id`),{onDelete:`cascade`}),nodeId:e.text(`node_id`).notNull(),nodeType:e.text(`node_type`).notNull().$type(),path:e.jsonCol(`path`).notNull(),parentFrameId:e.text(`parent_frame_id`),status:e.text(`status`).notNull().default(`pending`).$type(),attempt:e.int4(`attempt`).notNull().default(0),iteration:e.int4(`iteration`),branchKey:e.text(`branch_key`),output:e.jsonCol(`output`),outputPresent:e.bool(`output_present`).notNull().default(!1),error:e.text(`error`),startedAt:e.epochMs(`started_at`),completedAt:e.epochMs(`completed_at`)}),{sqlite:e=>[O(`idx_workflow_execution_frames_execution`).on(e.executionId),O(`idx_workflow_execution_frames_parent`).on(e.parentFrameId)],postgres:e=>[k(`idx_workflow_execution_frames_execution`).on(e.executionId),k(`idx_workflow_execution_frames_parent`).on(e.parentFrameId)]}),ye=ve.sqlite,be=j(`workflow_gate_instances`,e=>({id:e.text(`id`).primaryKey(),executionId:e.text(`execution_id`).notNull().references(()=>P.columnPair(`id`),{onDelete:`cascade`}),nodeId:e.text(`node_id`).notNull(),frameId:e.text(`frame_id`).notNull(),schema:e.jsonCol(`schema`).notNull(),prompt:e.text(`prompt`),status:e.text(`status`).notNull().default(`waiting`).$type(),autoAction:e.textEnum(`auto_action`,{enum:[`approve`,`reject`]}).notNull().default(`reject`),timeoutMs:e.int4(`timeout_ms`),resumeData:e.jsonCol(`resume_data`),reason:e.text(`reason`),resumeDataPresent:e.bool(`resume_data_present`).notNull().default(!1),createdAt:e.epochMs(`created_at`).notNull(),resolvedAt:e.epochMs(`resolved_at`)}),{sqlite:e=>[O(`idx_workflow_gate_instances_execution`).on(e.executionId),O(`idx_workflow_gate_instances_frame`).on(e.frameId)],postgres:e=>[k(`idx_workflow_gate_instances_execution`).on(e.executionId),k(`idx_workflow_gate_instances_frame`).on(e.frameId)]}),xe=be.sqlite,Se=j(`workflow_step_spans`,e=>({executionId:e.text(`execution_id`).notNull().references(()=>P.columnPair(`id`),{onDelete:`cascade`}),frameId:e.text(`frame_id`).notNull(),stepId:e.text(`step_id`).notNull(),stepType:e.text(`step_type`).notNull(),status:e.text(`status`).$type().notNull(),startedAt:e.epochMs(`started_at`),completedAt:e.epochMs(`completed_at`),durationMs:e.int4(`duration_ms`),inputTokens:e.int4(`input_tokens`),outputTokens:e.int4(`output_tokens`),estimatedCost:e.float8(`estimated_cost`),toolCallCount:e.int4(`tool_call_count`),input:e.text(`input`),output:e.text(`output`)}),{sqlite:e=>[le({columns:[e.executionId,e.frameId]}),O(`idx_workflow_step_spans_status`).on(e.status)],postgres:e=>[A({columns:[e.executionId,e.frameId]}),k(`idx_workflow_step_spans_status`).on(e.status)]}),Ce=Se.sqlite,we=j(`workflow_execution_links`,e=>({sourceExecutionId:e.text(`source_execution_id`).notNull().references(()=>P.columnPair(`id`),{onDelete:`cascade`}),targetExecutionId:e.text(`target_execution_id`).notNull().references(()=>P.columnPair(`id`),{onDelete:`cascade`}),linkType:e.text(`link_type`).$type().notNull(),metadata:e.jsonCol(`metadata`)}),{sqlite:e=>[le({columns:[e.sourceExecutionId,e.targetExecutionId]}),O(`idx_workflow_execution_links_target`).on(e.targetExecutionId)],postgres:e=>[A({columns:[e.sourceExecutionId,e.targetExecutionId]}),k(`idx_workflow_execution_links_target`).on(e.targetExecutionId)]}),Te=we.sqlite,Ee=j(`workflow_run_contexts`,e=>({executionId:e.text(`execution_id`).primaryKey().references(()=>P.columnPair(`id`),{onDelete:`cascade`}),workflowId:e.text(`workflow_id`).notNull(),coordinatorSessionId:e.text(`coordinator_session_id`).notNull(),sourceKind:e.text(`source_kind`).notNull(),sourcePath:e.text(`source_path`),sourceFilename:e.text(`source_filename`),sourceCode:e.text(`source_code`),definitionSnapshot:e.jsonCol(`definition_snapshot`),workerManifest:e.jsonCol(`worker_manifest`).notNull(),inputs:e.jsonCol(`inputs`),config:e.jsonCol(`config`).notNull().default(fe`'{}'`),triggerPayload:e.jsonCol(`trigger_payload`).notNull(),artifactRef:e.jsonCol(`artifact_ref`),executionHints:e.jsonCol(`execution_hints`),dispatchMetadata:e.jsonCol(`dispatch_metadata`),scopeType:e.textEnum(`scope_type`,{enum:[`global`,`workspace`,`session`,`external`]}).notNull().default(`global`).$type(),scopeKind:e.text(`scope_kind`).notNull().default(``),scopeId:e.text(`scope_id`).notNull().default(``),cancelSubject:e.text(`cancel_subject`).notNull(),context:e.jsonCol(`context`).notNull(),env:e.jsonCol(`env`).notNull(),createdAt:e.epochMs(`created_at`).notNull(),suspensionStrategy:e.text(`suspension_strategy`).$type()}),{sqlite:e=>[O(`idx_run_contexts_workflow`).on(e.workflowId)],postgres:e=>[k(`idx_run_contexts_workflow`).on(e.workflowId)]}),De=Ee.sqlite,Oe=j(`worklog_summaries`,e=>({executionId:e.text(`execution_id`).primaryKey().references(()=>P.columnPair(`id`),{onDelete:`cascade`}),workflowId:e.text(`workflow_id`).notNull(),workflowName:e.text(`workflow_name`),status:e.textEnum(`status`,{enum:[`pending`,`running`,`paused`,`completed`,`failed`,`cancelled`]}).notNull(),startedAt:e.epochMs(`started_at`).notNull(),completedAt:e.epochMs(`completed_at`),durationMs:e.int4(`duration_ms`),totalInputTokens:e.int4(`total_input_tokens`),totalOutputTokens:e.int4(`total_output_tokens`),totalEstimatedCost:e.float8(`total_estimated_cost`),error:e.text(`error`),failedNodeId:e.text(`failed_node_id`)}),{sqlite:e=>[O(`idx_worklog_summaries_workflow_started`).on(e.workflowId,e.startedAt),O(`idx_worklog_summaries_status`).on(e.status)],postgres:e=>[k(`idx_worklog_summaries_workflow_started`).on(e.workflowId,e.startedAt),k(`idx_worklog_summaries_status`).on(e.status)]}),ke=Oe.sqlite,Ae=j(`worklog_frame_entries`,e=>({frameId:e.text(`frame_id`).primaryKey(),executionId:e.text(`execution_id`).notNull().references(()=>P.columnPair(`id`),{onDelete:`cascade`}),nodeId:e.text(`node_id`).notNull(),nodeType:e.text(`node_type`).notNull().$type(),path:e.jsonCol(`path`).notNull(),status:e.textEnum(`status`,{enum:[`pending`,`running`,`waiting`,`completed`,`failed`,`skipped`,`cancelled`]}).notNull(),attempt:e.int4(`attempt`).notNull().default(0),iteration:e.int4(`iteration`),branchKey:e.text(`branch_key`),startedAt:e.epochMs(`started_at`),completedAt:e.epochMs(`completed_at`),durationMs:e.int4(`duration_ms`),inputTokens:e.int4(`input_tokens`),outputTokens:e.int4(`output_tokens`),estimatedCost:e.float8(`estimated_cost`),error:e.text(`error`)}),{sqlite:e=>[O(`idx_worklog_frame_entries_execution`).on(e.executionId)],postgres:e=>[k(`idx_worklog_frame_entries_execution`).on(e.executionId)]}),je=Ae.sqlite,Me=j(`worklog_artifact_writes`,e=>({id:e.text(`id`).primaryKey(),executionId:e.text(`execution_id`).notNull().references(()=>P.columnPair(`id`),{onDelete:`cascade`}),frameId:e.text(`frame_id`).notNull(),nodeId:e.text(`node_id`).notNull(),artifact:e.jsonCol(`artifact`).notNull(),revision:e.text(`revision`),writtenAt:e.epochMs(`written_at`).notNull()}),{sqlite:e=>[O(`idx_worklog_artifact_writes_execution`).on(e.executionId)],postgres:e=>[k(`idx_worklog_artifact_writes_execution`).on(e.executionId)]}),Ne=Me.sqlite,Pe=j(`worklog_gate_events`,e=>({id:e.text(`id`).primaryKey(),executionId:e.text(`execution_id`).notNull().references(()=>P.columnPair(`id`),{onDelete:`cascade`}),nodeId:e.text(`node_id`).notNull(),frameId:e.text(`frame_id`).notNull(),status:e.textEnum(`status`,{enum:[`waiting`,`resumed`,`rejected`,`timed-out`,`cancelled`]}).notNull().$type(),prompt:e.text(`prompt`),openedAt:e.epochMs(`opened_at`).notNull(),resolvedAt:e.epochMs(`resolved_at`),resumeData:e.jsonCol(`resume_data`)}),{sqlite:e=>[O(`idx_worklog_gate_events_execution`).on(e.executionId),O(`idx_worklog_gate_events_status`).on(e.status)],postgres:e=>[k(`idx_worklog_gate_events_execution`).on(e.executionId),k(`idx_worklog_gate_events_status`).on(e.status)]}),Fe=Pe.sqlite,Ie=j(`workflow_execution_state`,e=>({executionId:e.text(`execution_id`).primaryKey().references(()=>P.columnPair(`id`),{onDelete:`cascade`}),sequence:e.int4(`sequence`).notNull().default(0),value:e.jsonCol(`value`).notNull(),updatedAt:e.epochMs(`updated_at`).notNull()})),Le=Ie.sqlite,Re=j(`workflow_execution_state_events`,e=>({executionId:e.text(`execution_id`).notNull().references(()=>P.columnPair(`id`),{onDelete:`cascade`}),sequence:e.int4(`sequence`).notNull(),patch:e.jsonCol(`patch`).notNull(),value:e.jsonCol(`value`).notNull(),createdAt:e.epochMs(`created_at`).notNull()}),{sqlite:e=>[le({columns:[e.executionId,e.sequence]})],postgres:e=>[A({columns:[e.executionId,e.sequence]})]}),ze=Re.sqlite,Be=n.object({executionId:n.string().min(1),status:h.optional(),error:n.string().nullable().optional(),reason:n.string().nullable().optional(),completedAt:n.number().nullable().optional()}),Ve=ce(`workflow`,{schemas:{get:{request:n.object({id:n.string()}),response:n.object({workflow:te.nullable()})},set:{request:n.object({workflow:te}),response:n.object({id:n.string()})},delete:{request:n.object({id:n.string()}),response:n.object({deleted:n.boolean()})},list:{request:re,response:n.object({workflows:n.array(te)})},getExecution:{request:n.object({executionId:n.string()}),response:n.object({execution:w.nullable()})},setExecution:{request:n.object({execution:w}),response:n.object({id:n.string()})},setExecutionStart:{request:n.object({execution:w,runContext:E,initialState:y.optional()}),response:n.object({id:n.string(),executionId:n.string()})},updateExecution:{request:Be,response:n.object({success:n.boolean()})},cancelPausedExecution:{request:n.object({executionId:n.string().min(1),completedAt:n.number(),reason:n.string().optional()}),response:n.object({cancelled:n.boolean(),gates:n.array(T.extend({status:n.literal(`cancelled`)}))})},listExecutions:{request:m,response:n.object({executions:n.array(w)})},listExecutionsByArtifactRefs:{request:g,response:n.object({executionsByRef:n.record(n.string(),n.array(w))})},setFrame:{request:n.object({executionId:n.string().min(1),frame:ne}),response:n.object({frameId:n.string()})},getFrame:{request:n.object({frameId:n.string().min(1)}),response:n.object({frame:ne.nullable()})},listFrames:{request:n.object({executionId:n.string().min(1)}),response:n.object({frames:n.array(ne)})},setGateInstance:{request:n.object({gate:T}),response:n.object({id:n.string()})},resolveWaitingGateInstance:{request:n.object({gate:T.extend({status:n.enum([`resumed`,`rejected`])})}),response:n.object({accepted:n.boolean()})},restorePausedGateResumeState:{request:n.object({execution:w.extend({status:n.literal(`paused`)}),gate:T.extend({status:n.literal(`waiting`)})}),response:n.object({executionId:n.string(),gateId:n.string()})},getGateInstance:{request:n.object({executionId:n.string().min(1),nodeId:n.string().min(1),frameId:n.string().min(1).optional()}),response:n.object({gate:T.nullable()})},listGateInstances:{request:_,response:n.object({gates:n.array(T)})},listPausedGateTimeouts:c({request:n.object({}),response:n.object({gates:n.array(T)})}),setSpan:{request:n.object({span:x}),response:n.object({id:n.string()})},listSpans:{request:n.object({executionId:n.string()}),response:n.object({spans:n.array(x)})},setExecutionLink:{request:n.object({link:p}),response:n.object({id:n.string()})},listExecutionLinks:{request:f,response:n.object({links:n.array(p)})},setRunContext:c({request:n.object({runContext:E}),response:n.object({executionId:n.string()})}),getRunContext:c({request:n.object({executionId:n.string().min(1)}),response:n.object({runContext:E.nullable()})}),initializeState:c({request:n.object({executionId:n.string().min(1),initialValue:y}),response:n.object({})}),getState:c({request:n.object({executionId:n.string().min(1)}),response:n.object({state:n.object({executionId:n.string().min(1),sequence:n.number().int().nonnegative(),value:y}).nullable()})}),patchState:c({request:n.object({executionId:n.string().min(1),expectedSequence:n.number().int().nonnegative(),nextValue:y}),response:n.object({executionId:n.string().min(1),sequence:n.number().int().positive(),patch:n.array(v),value:y})})},extensions:{drizzle:{workflowDefinitions:ge,workflowExecutions:_e,workflowExecutionFrames:ye,workflowGateInstances:xe,workflowStepSpans:Ce,workflowExecutionLinks:Te,workflowRunContexts:De,worklogSummaries:ke,worklogFrameEntries:je,worklogArtifactWrites:Ne,worklogGateEvents:Fe,workflowExecutionState:Le,workflowExecutionStateEvents:ze}}}),F=Ve.subjects;var He=e(t(),1);function Ue(e,t){let n=[];return We(n,``,e,t),n}function We(e,t,n,r){if(Array.isArray(n)&&Array.isArray(r)){Ke(e,t,n,r);return}if(qe(n)&&qe(r)){Ge(e,t,n,r);return}Xe(n,r)||e.push({op:`replace`,path:t,value:r})}function Ge(e,t,n,r){let i=Array.from(new Set([...Object.keys(n),...Object.keys(r)])).sort();for(let a of i){let i=Je(n,a),o=Je(r,a),s=`${t}/${Ye(a)}`;if(!i&&o){e.push({op:`add`,path:s,value:r[a]});continue}if(i&&!o){e.push({op:`remove`,path:s});continue}We(e,s,n[a],r[a])}}function Ke(e,t,n,r){let i=Math.min(n.length,r.length);for(let a=0;a<i;a++)We(e,`${t}/${String(a)}`,n[a],r[a]);for(let i=n.length-1;i>=r.length;i--)e.push({op:`remove`,path:`${t}/${String(i)}`});for(let i=n.length;i<r.length;i++)e.push({op:`add`,path:`${t}/${String(i)}`,value:r[i]})}function qe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Je(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ye(e){return e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}function Xe(e,t){return Object.is(e,t)}const Ze={stepTimeoutMs:300*1e3,stepCooldownMs:500,busAuth:{kind:`none`},platformDefaults:{cwd:process.cwd()},cancelTimeoutMs:1e4},Qe=new He.default({allErrors:!0,strict:!1}),$e=new Map,et=new Map;function tt(e){let t=e.$id;return typeof t==`string`?t:void 0}function nt(e,t,n){let r=tt(t);return r===void 0?`workflow:${e}:${n}`:`schema-id:${r}`}function rt(e,t){try{return JSON.stringify(it(t))}catch(t){let n=t instanceof Error?t.message:String(t);throw Error(`Workflow '${e}' state schema is invalid: ${n}`)}}function it(e){if(Array.isArray(e))return e.map(it);if(typeof e!=`object`||!e)return e;let t=e;return Object.fromEntries(Object.keys(t).sort().map(e=>[e,it(t[e])]))}function at(e,t,n){let r=et.get(t);if(r!==void 0&&r!==n)throw Error(`Workflow '${e}' state schema reuses JSON Schema $id '${t}' with different content`);return Qe.getSchema(t)}function ot(e){return e==null||e.length===0?`schema validation failed`:e.map(e=>`${e.instancePath.length>0?e.instancePath:`<root>`} ${e.message??`is invalid`}`).join(`; `)}function st(e,t){let n=rt(e,t),r=nt(e,t,n),i=$e.get(r);if(i!==void 0)return i;let a=tt(t);if(a!==void 0){let t=at(e,a,n);if(t!==void 0)return $e.set(r,t),t}try{let e=Qe.compile(t);return $e.set(r,e),a!==void 0&&et.set(a,n),e}catch(t){let n=t instanceof Error?t.message:String(t);throw Error(`Workflow '${e}' state schema is invalid: ${n}`)}}function ct(e,t,n){if(e.state===void 0)return;let r=st(e.id,e.state.schema);if(r(t))return;let i=n===`initial`?`initial state`:`next state`;throw Error(`Workflow '${e.id}' ${i} does not match workflow state schema: ${ot(r.errors)}`)}function lt(e){if(e.state===void 0)return;let t=e.state.initial===void 0?{}:e.state.initial;return ct(e,t,`initial`),t}async function ut(e,t,n){if(!(await e.request(F.updateExecution,{executionId:t.id,status:n.status,error:n.error,reason:n.reason,completedAt:n.completedAt})).success)throw Error(`Workflow execution not found: ${t.id}`)}async function dt(e,t,n,r){t.status=`completed`,t.completedAt=Date.now();try{await ut(e.bus,t,{status:t.status,completedAt:t.completedAt}),await e.bus.emit(D.execution.completed,{executionId:n,workflowId:t.workflowId,totalDuration:t.completedAt-r,completedAt:t.completedAt})}finally{e.activeExecutions.delete(n)}}async function I(e,t,n,r,i){t.status=`failed`,t.error=r,t.completedAt=Date.now();try{await ut(e.bus,t,{status:t.status,error:t.error,completedAt:t.completedAt});try{await i?.()}catch(e){console.error(`[WorkflowFinalizer] Failed to run failure pre-emit hook:`,e)}await e.bus.emit(D.execution.failed,{executionId:n,workflowId:t.workflowId,error:r,completedAt:t.completedAt})}finally{e.activeExecutions.delete(n)}}function ft(e,t,n){let{activeRunnerSteps:r,bus:i}=e,a=`${t}:`;for(let[e,o]of r){if(!e.startsWith(a))continue;let r=e.slice(a.length);o.controller.abort(),i.emit(se(o.cancelSubject),{executionId:t,stepId:r,reason:n}).catch(t=>{console.error(`[WorkflowFinalizer] Failed to emit cancellation for ${e}:`,t)})}}async function pt(e,t,n){let r=await e.bus.request(F.getExecution,{executionId:t});if(r.execution==null)return!1;let i=r.execution.workflowId;if(i===void 0)throw Error(`Paused execution ${t} is missing stored workflowId`);let a=Date.now(),{cancelled:o,gates:s}=await e.bus.request(F.cancelPausedExecution,{executionId:t,completedAt:a,reason:n});if(!o)return!1;for(let n of s)await e.bus.emit(D.gate.resolved,{executionId:t,stepId:n.nodeId,stepType:`gate`,frameId:n.frameId,source:`cancelled`}).catch(e=>{console.error(`[WorkflowFinalizer] Failed to emit cancelled gate resolution for ${n.frameId}:`,e)});return await e.bus.emit(D.execution.cancelled,{executionId:t,workflowId:i,reason:n,completedAt:a}),e.activeExecutions.delete(t),!0}async function L(e,t,n){let r=e.activeExecutions.get(t);if(!r||r.execution.status!==`running`)return pt(e,t,n);let{execution:i}=r;i.status=`cancelled`,i.reason=n,i.completedAt=Date.now();try{for(let[n,r]of e.shellAbortControllers)n.startsWith(`${t}:`)&&(r.abort(),e.shellAbortControllers.delete(n));ft(e,t,n),await ut(e.bus,i,{status:i.status,reason:n,completedAt:i.completedAt}),await e.bus.emit(D.execution.cancelled,{executionId:t,workflowId:i.workflowId,reason:n,completedAt:i.completedAt})}finally{e.activeExecutions.delete(t)}return!0}const mt=[`darwin`,`linux`,`win32`];function ht(e){return mt.find(t=>t===e)??`linux`}function gt(e,t){return t}function _t(e,t){return{...t}}function vt(e){return e.reason instanceof Error?e.reason.message:typeof e.reason==`string`&&e.reason.length>0?e.reason:C}async function yt(e,t,n){let r=e.activeExecutions.get(t);if(!r||r.execution.status!==`running`)return;let i=e.buildFinalizerDeps(),{execution:a}=await i.bus.request(F.getExecution,{executionId:t});a?.status===`running`&&(r.execution=a,await L(i,t,vt(n))||console.error(`[WorkflowExecutor] Failed to persist runner cancellation for ${t}: execution not active`))}async function bt(e,t){if(t.pausedAtGateId===void 0||t.pausedAtFrameId===void 0)throw Error(`Paused runner result for '${t.executionId}' is missing gate identity`);let{bus:n}=e.buildFinalizerDeps(),{execution:r}=await n.request(F.getExecution,{executionId:t.executionId});if(r?.status!==`running`){let n=e.activeExecutions.get(t.executionId);n!==void 0&&r?.status===`paused`&&(n.execution.status=`paused`,e.activeExecutions.delete(t.executionId));return}let i={...r,status:`paused`};await n.request(F.setExecution,{execution:i});let a=e.activeExecutions.get(t.executionId);a!==void 0&&(a.execution=i),await n.emit(D.execution.paused,{executionId:t.executionId,workflowId:t.workflowId,pausedAtGateId:t.pausedAtGateId,pausedAtFrameId:t.pausedAtFrameId}),e.activeExecutions.delete(t.executionId)}async function xt(e,t){let n=e.activeExecutions.get(t.executionId);if(!n||n.execution.status!==`running`)return;let r=e.buildFinalizerDeps(),{execution:i}=await r.bus.request(F.getExecution,{executionId:t.executionId});if(i?.status===`running`){if(n.execution=i,t.status===`completed`){await dt(r,n.execution,t.executionId,n.execution.startedAt);return}if(t.status===`cancelled`){await L(r,t.executionId,t.reason??C);return}if(t.status===`failed`){await I(r,n.execution,t.executionId,t.error);return}}}function St(e,t){let{executionId:n,workflowId:r,filePath:i,coordinatorSessionId:a,sanitizedTriggerPayload:o,scope:s,workspaceRoot:c}=t,{workflowRunner:l,workflowAbortControllers:u,executionTasks:d,activeExecutions:f,config:p}=e,m=new AbortController;u.set(n,m);let h={source:{kind:`path`,path:i},executionId:n,workflowId:r,triggerPayload:o,inputs:{},config:{},scope:s,busUrl:p.busUrl,busAuth:p.busAuth,context:e.resolveWorkflowContext(c),env:p.platformDefaults.env??{},coordinatorSessionId:a,cancelSubject:`workflow.${n}.cancel`,suspensionStrategy:`wait-in-process`};return Promise.resolve().then(()=>l.run(h,m.signal)).then(async t=>{if(t.status===`paused`){await bt(e,t);return}await xt(e,t)}).catch(async t=>{if(m.signal.aborted){await yt(e,n,m.signal).catch(e=>{console.error(`[WorkflowExecutor] Failed to persist file runner cancellation for ${n}:`,e)});return}let r=f.get(n);if(r){let i=t instanceof Error?t.message:String(t);await I(e.buildFinalizerDeps(),r.execution,n,i).catch(e=>{console.error(`[WorkflowExecutor] Failed to persist file runner boot failure for ${n}:`,e)})}}).finally(()=>{u.delete(n),d.delete(n),f.delete(n)})}function Ct(e,t){let{config:n}=e;return{source:t.source,...t.source.kind===`definition`?{definition:t.workflow}:{},executionId:t.executionId,workflowId:t.workflowId,triggerPayload:t.sanitizedTriggerPayload,inputs:t.boundInputs,config:t.boundConfig,...t.artifactRef===void 0?{}:{artifactRef:t.artifactRef},...t.executionHints===void 0?{}:{executionHints:t.executionHints},scope:t.scope,busUrl:n.busUrl,busAuth:n.busAuth,context:e.resolveWorkflowContext(t.workspaceRoot),env:n.platformDefaults.env??{},coordinatorSessionId:t.coordinatorSessionId,cancelSubject:`workflow.${t.executionId}.cancel`,suspensionStrategy:t.suspensionStrategy??`wait-in-process`}}function wt(e,t){let{executionId:n}=t,{workflowRunner:r,workflowAbortControllers:i,executionTasks:a,activeExecutions:o}=e,s=new AbortController;i.set(n,s);let c=Ct(e,t),l=t.dispatchMetadata===void 0?void 0:{dispatchMetadata:t.dispatchMetadata};return Promise.resolve().then(()=>r.run(c,s.signal,void 0,l)).then(async t=>{if(t.status===`paused`){await bt(e,t);return}await xt(e,t)}).catch(async t=>{if(s.signal.aborted){await yt(e,n,s.signal).catch(e=>{console.error(`[WorkflowExecutor] Failed to persist runner cancellation for ${n}:`,e)});return}let r=o.get(n);if(r){let i=t instanceof Error?t.message:String(t);await I(e.buildFinalizerDeps(),r.execution,n,i).catch(e=>{console.error(`[WorkflowExecutor] Failed to persist runner boot failure for ${n}:`,e)})}}).finally(()=>{i.delete(n),a.delete(n),o.delete(n)})}function Tt(e,t,n={}){let r=Et(e,n);return{executionId:e.executionId,workflowId:e.workflowId,workflow:t,source:e.source,coordinatorSessionId:e.coordinatorSessionId,sanitizedTriggerPayload:e.triggerPayload,boundInputs:e.inputs,boundConfig:e.config??{},...e.artifactRef===void 0?{}:{artifactRef:e.artifactRef},...e.executionHints===void 0?{}:{executionHints:e.executionHints},scope:e.scope,workspaceRoot:e.context.repoPath,suspensionStrategy:e.suspensionStrategy,...r===void 0?{}:{dispatchMetadata:r}}}function Et(e,t){return t.resume===!0?{...e.dispatchMetadata,resume:!0}:e.dispatchMetadata}function Dt(e){return`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function Ot(e,t,n){let r=e?N(e,n):t,c=o(t),l=o(i(r)?r:o(t,r)),u,d;try{u=s(c),d=s(l)}catch{return null}let f=a(process.platform===`win32`?u.toLowerCase():u,process.platform===`win32`?d.toLowerCase():d);return f===``||!f.startsWith(`..`)&&!i(f)?d:null}function kt(e){return e instanceof Error&&(`code`in e||`killed`in e)}function At(e){let t=e[0];return t===void 0||t.trim()===``?null:t}function jt(e){let{command:t,cwd:n,env:i,timeoutMs:a,signal:o}=e,s=At(t);if(s===null)return Promise.reject(Error(`Shell step command is empty`));let c=t.slice(1);return new Promise((e,t)=>{let l=null,u=!1,d=r(s,c,{cwd:n,env:{...process.env,...i},timeout:0,maxBuffer:10*1024*1024,shell:!1},(n,r,i)=>{n?t(Object.assign(n,{stdout:r,stderr:i,aborted:u})):e({stdout:r,stderr:i})}),f=()=>{d.exitCode===null&&(d.kill(`SIGTERM`),l=setTimeout(()=>{d.exitCode===null&&d.kill(`SIGKILL`)},5e3))},p=setTimeout(()=>{f()},a);if(d.on(`close`,()=>{clearTimeout(p),l!==null&&clearTimeout(l)}),o){let e=()=>{u=!0,f()};o.aborted?e():(o.addEventListener(`abort`,e,{once:!0}),d.on(`close`,()=>o.removeEventListener(`abort`,e)))}})}async function Mt(e){let{step:t,workspaceRoot:n,expressionContext:r,signal:i}=e,a=Ot(t.cwd,n,r);if(a===null)return{status:`failed`,error:`Shell step cwd '${t.cwd}' is outside workspace root '${n}'`};let o=t.command.map(e=>N(e,r));if(At(o)===null)return{status:`failed`,error:`Shell step command is empty`};let s=Object.fromEntries(Object.entries(t.env??{}).map(([e,t])=>[e,N(t,r)])),c=t.timeoutMs??3e5;try{let{stdout:e}=await jt({command:o,cwd:a,env:s,timeoutMs:c,signal:i});return{status:`completed`,stdout:e}}catch(e){if(!kt(e))return{status:`failed`,error:String(e)};let t=e.aborted===!0,n=!t&&(e.killed===!0||e.signal!=null);return{status:`failed`,error:t?`Command cancelled`:n?`Command timed out after ${c}ms`:e.stderr?.trim()||e.stdout?.trim()||e.message}}}const Nt=/(?:^|[_-])(authorization|token|cookie|password|set[_-]?cookie|api[_-]?key|secret|credential|private[_-]?key|api[_-]?secret)(?:$|[_-])/i;function Pt(e){if(!e)return;let t={remainingBytes:65536},n={},r=Object.entries(e).slice(0,100);for(let[e,i]of r){if(t.remainingBytes<=0)break;let r=Ft(e,i,0,t);r!==void 0&&(n[e]=r)}return Object.keys(n).length>0?n:void 0}function Ft(e,t,n,r){if(!(r.remainingBytes<=0||n>6)&&(r.remainingBytes-=e.length,!(r.remainingBytes<=0))){if(Nt.test(e))return r.remainingBytes-=10,`[REDACTED]`;if(t===null)return r.remainingBytes-=4,null;if(typeof t==`string`){let e=t.slice(0,2e3);return r.remainingBytes-=e.length,e}if(typeof t==`number`||typeof t==`boolean`)return r.remainingBytes-=String(t).length,t;if(Array.isArray(t)){let i=[];for(let a of t.slice(0,100)){if(r.remainingBytes<=0)break;let t=Ft(e,a,n+1,r);t!==void 0&&i.push(t)}return i}if(typeof t==`object`){let e={},i=Object.entries(t).slice(0,100);for(let[t,a]of i){if(r.remainingBytes<=0)break;let i=Ft(t,a,n+1,r);i!==void 0&&(e[t]=i)}return e}}}function It(e,t,n){let r=t?.requirements?.capabilities??[];if(r.length!==0)return{run:(t,i)=>e.request(ee.dispatch,{config:t,requirements:{customCapabilities:r},...n===void 0?{}:{metadata:n}},{signal:i})}}function Lt(e,t){let n=It(e.bus,t.executionHints,t.dispatchMetadata);return n===void 0?e.workflowRunner===void 0?e.runExecution(t.executionId).finally(()=>{e.executionTasks.delete(t.executionId)}):wt(e.buildRunnerTaskDeps(e.workflowRunner),t):wt(e.buildRunnerTaskDeps(n),t)}async function Rt(e,t,n,r){let i=lt(r);await e.request(F.setExecutionStart,{execution:t,runContext:n,initialState:i})}async function zt(e,t){try{await e.emit(D.execution.started,t)}catch(e){console.error(`[WorkflowExecutor] execution.started listener failed:`,e)}}async function Bt(e,t){await e.request(b.close,{sessionId:t}).catch(e=>{console.error(`[WorkflowExecutor] Failed to close coordinator session "${t}" after launch failure:`,e)})}function Vt(e,t,n,r,i,a,o,s,c){let l={id:t,workflowId:n.id,coordinatorSessionId:r,status:`running`,inputs:i,config:a,startedAt:Date.now(),triggerPayload:o,...c.artifactRef===void 0?{}:{artifactRef:c.artifactRef},scope:s};return e.set(t,{execution:l,workflow:n,runContext:c,runtimeHandlers:new Map}),l}async function Ht(e,t,n,r){await e.request(F.setExecutionStart,{execution:t,runContext:n,initialState:r})}function Ut(e,t){let n=e?.source;if(n===void 0)return;let r=oe.parse(n);return r.kind===`path`&&!i(r.path)?{...r,path:o(t,r.path)}:r}function Wt(e,t,n){return Ut(t,n)??{kind:`definition`,workflowId:e}}async function Gt(e,t,n,r){return e.set(t,n),await r,t}async function Kt(e,t){let{workflow:n}=await e.request(F.get,{id:t});if(!n)throw Error(`Workflow not found: ${t}`);return n}function qt(e,t){if(e===void 0&&t===void 0)return;let n=[...new Set([...e?.capabilities??[],...t?.capabilities??[]])];return{...e,...t,...n.length>0&&{capabilities:n}}}function Jt(e,t){if(e===void 0&&t===void 0)return;let n=qt(e?.requirements,t?.requirements),r=e?.providers!==void 0||t?.providers!==void 0?{...e?.providers,...t?.providers}:void 0;return{...e,...t,...n!==void 0&&{requirements:n},...r!==void 0&&{providers:r}}}async function Yt(e,t,n,r){let{sessionId:i}=await e.request(b.create,{parentSessionId:t,branchKind:`coordinator`,title:`Workflow: ${n}`,targetWorkingDirectory:r});return i}async function Xt(e,t,n={}){let{bus:r,activeExecutions:i,executionTasks:a}=e,{parentSessionId:o,triggerPayload:s,artifactRef:c,executionHints:l,scopeOverride:u}=n,d=n.input===void 0?{}:n.input,f=n.config??{},p=await Kt(r,t),m=Dt(`wfx`),h=Pt(s),g=gt(p,d),_=_t(p,f),v=u??p.scope,y=Jt(p.executionHints,l),b=await e.resolveExecutionWorkspaceRoot(o),x=Wt(t,y,b),S=await Yt(r,o,p.name,b),C=!1;try{let n=e.buildRunContext({executionId:m,workflowId:t,coordinatorSessionId:S,source:x,...x.kind===`definition`?{definitionSnapshot:p}:{},inputs:g,config:_,scope:v,triggerPayload:h??{},...c===void 0?{}:{artifactRef:c},...y===void 0?{}:{executionHints:y},workspaceRoot:b}),o=Vt(i,m,p,S,g,_,h,v,n);await Ht(r,o,n,x.kind===`definition`?lt(p):void 0);let s=o.startedAt,l=zt(r,{executionId:m,workflowId:t,coordinatorSessionId:S,startedAt:s,...c===void 0?{}:{artifactRef:c}}),u=Lt(e,{executionId:m,workflowId:t,workflow:p,source:x,coordinatorSessionId:S,sanitizedTriggerPayload:h??{},boundInputs:g,boundConfig:_,scope:v,...c===void 0?{}:{artifactRef:c},...y===void 0?{}:{executionHints:y},workspaceRoot:b,suspensionStrategy:n.suspensionStrategy});return C=!0,Gt(a,m,u,l)}catch(e){throw C||(i.delete(m),a.delete(m),await Bt(r,S)),e}}function Zt(e,t,n,r,i){e.set(t.id,{execution:t,workflow:{id:t.workflowId,name:n,scope:r,root:{id:`${t.workflowId}-root`,type:`sequence`,nodes:[]}},runContext:i,runtimeHandlers:new Map})}async function Qt(e,t,n={}){let{bus:r,config:i,activeExecutions:a,executionTasks:o}=e,{triggerPayload:s,scopeOverride:c}=n,l=Dt(`wfx`),u=Pt(s),d=c??{type:`global`},f=i.platformDefaults.cwd,{sessionId:p}=await r.request(b.create,{branchKind:`coordinator`,title:`Workflow: ${t}`,targetWorkingDirectory:f}),m=l,h={id:l,workflowId:m,coordinatorSessionId:p,status:`running`,inputs:{},config:{},startedAt:Date.now(),triggerPayload:u,scope:d},g=!1;try{let{workflowRunner:n}=e;if(n===void 0)throw Error(`[WorkflowExecutor] startFileExecution called without a workflow runner`);let i=e.buildRunContext({executionId:l,workflowId:m,coordinatorSessionId:p,source:{kind:`path`,path:t},inputs:{},config:{},scope:d,triggerPayload:u??{},workspaceRoot:f});await Ht(r,h,i,void 0),Zt(a,h,t,d,i);let s=zt(r,{executionId:l,workflowId:m,coordinatorSessionId:p,startedAt:h.startedAt}),c=St(e.buildRunnerTaskDeps(n),{executionId:l,workflowId:m,filePath:t,coordinatorSessionId:p,sanitizedTriggerPayload:u??{},scope:d,workspaceRoot:f});return g=!0,Gt(o,l,c,s)}catch(e){throw g||(a.delete(l),o.delete(l),await Bt(r,p)),e}}function $t(e){let t={};for(let[n,r]of Object.entries(e))r.status===`completed`?t[n]={status:`completed`,output:r.output}:r.status===`skipped`&&(t[n]={status:`skipped`});return t}function R(e){let t={...e,input:e.inputs,steps:e.frames};return{...t,ctx:t}}function en(){return{context:{repoPath:process.cwd(),makaioHome:process.env.MAKAIO_HOME??`${pe.homedir()}/.makaio`,os:process.platform===`win32`?`win32`:process.platform===`darwin`?`darwin`:`linux`,arch:process.arch},env:{}}}function tn(e){return{...e,path:[...e.path]}}function nn(e){if(e===`station`||e===`delegate-agent`||e===`delegate-role`||e===`gate`)return e}function rn(e,t){let n=nn(t.nodeType);if(n===void 0||t.status!==`running`&&t.status!==`completed`&&t.status!==`failed`&&t.status!==`skipped`)return;let r=t.startedAt!==void 0&&t.completedAt!==void 0?Math.max(0,t.completedAt-t.startedAt):void 0;return{executionId:e,frameId:t.frameId,stepId:t.nodeId,stepType:n,status:t.status,...t.startedAt===void 0?{}:{startedAt:t.startedAt},...t.completedAt===void 0?{}:{completedAt:t.completedAt},...r===void 0?{}:{durationMs:r},...t.output===void 0?{}:{output:JSON.stringify(t.output)}}}var an=class e{executionId;workflowId;definition;execution;runtimeHandlers;bus;signal;frameRegistry;framePersistenceTasks=new Map;artifactBinding;constructor(e,t,n,r,i,a,o,s,c,l=en(),u={}){this.executionId=e,this.workflowId=t,this.definition=n,this.execution=r,this.runtimeHandlers=i,this.bus=a,this.signal=o,this.frameRegistry=s??new Map,this.artifactBinding=c,this.platformContext=l.context,this.env=l.env,this.suspensionStrategy=u.suspensionStrategy??`wait-in-process`,this.resumeFrames=u.resumeFrames}platformContext;env;suspensionStrategy;resumeFrames;withSignal(t){return new e(this.executionId,this.workflowId,this.definition,this.execution,this.runtimeHandlers,this.bus,t,this.frameRegistry,this.artifactBinding,{context:this.platformContext,env:this.env},{suspensionStrategy:this.suspensionStrategy,resumeFrames:this.resumeFrames})}buildExpressionContext(){return{inputs:this.execution.inputs,config:this.execution.config??{},trigger:this.execution.triggerPayload??{},frames:{},previousSteps:{}}}createFrame(e){let t=Dt(`frm`),n=[...e.path,t],r={frameId:t,nodeId:e.nodeId,nodeType:e.nodeType,path:n,parentFrameId:e.parentFrameId,status:`pending`,attempt:0,iteration:e.iteration,branchKey:e.branchKey};return this.frameRegistry.set(t,r),this.persistFrame(r).catch(()=>void 0),r}async persistFrame(e,t={}){let n=t.requireFrameStorage===!0||this.suspensionStrategy!==`wait-in-process`,r=tn(e),i=rn(this.executionId,r),a=(this.framePersistenceTasks.get(e.frameId)??Promise.resolve()).catch(()=>void 0).then(async()=>{n?await this.bus.request(F.setFrame,{executionId:this.executionId,frame:r}):await this.bus.requestOptional(F.setFrame,{executionId:this.executionId,frame:r}),i!==void 0&&await this.bus.requestOptional(F.setSpan,{span:i})}).catch(t=>{if(n)throw t;console.warn(`[RuntimeContext] Failed to persist frame ${e.frameId}:`,t)});this.framePersistenceTasks.set(e.frameId,a);try{await a}finally{this.framePersistenceTasks.get(e.frameId)===a&&this.framePersistenceTasks.delete(e.frameId)}}async updateFrame(e,t,n={}){let r=this.frameRegistry.get(e);if(!r)throw Error(`Frame not found: ${e}`);Object.assign(r,t),await this.persistFrame(r,n)}getFrame(e){return this.frameRegistry.get(e)}getFramesByNodeId(e){let t=[];for(let n of this.frameRegistry.values())n.nodeId===e&&t.push(n);return t.sort((e,t)=>(e.startedAt??0)-(t.startedAt??0))}async emitFrameStarted(e){try{await this.bus.emit(D.frame.started,{executionId:this.executionId,frameId:e.frameId,nodeId:e.nodeId,nodeType:e.nodeType,path:e.path,parentFrameId:e.parentFrameId,startedAt:e.startedAt})}catch(t){console.error(`[RuntimeContext] frame.started observer failed for ${e.frameId}:`,t)}}async emitFrameCompleted(e,t){try{await this.bus.emit(D.frame.completed,{executionId:this.executionId,frameId:e.frameId,nodeId:e.nodeId,output:e.output,duration:t,completedAt:e.completedAt})}catch(t){console.error(`[RuntimeContext] frame.completed observer failed for ${e.frameId}:`,t)}}async emitFrameFailed(e,t,n){try{await this.bus.emit(D.frame.failed,{executionId:this.executionId,frameId:e.frameId,nodeId:e.nodeId,error:t,duration:n,completedAt:e.completedAt})}catch(t){console.error(`[RuntimeContext] frame.failed observer failed for ${e.frameId}:`,t)}}};function on(e){return{kind:`workflow-execution`,id:e,displayName:`Workflow Engine`}}function sn(e,t,n){return{inputs:n.inputs,config:n.config??{},trigger:n.triggerPayload,scope:n.scope,context:n.context,env:n.env,execution:{id:t.id,workflowId:t.workflowId,scope:t.scope},workflow:{id:e.id,name:e.name,scope:e.scope}}}function cn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ln(e){if(e!=null){if(cn(e)&&typeof e.kind==`string`&&typeof e.id==`string`)return{kind:e.kind,id:e.id};throw Error(`Artifact resolve expression must return an object with string kind and id fields.`)}}function un(e){if(e!==void 0){if(cn(e))return e;throw Error(`Artifact create expression must return an object.`)}}async function dn(e){let{bindingOptions:t,binding:n,existingArtifactRef:r,executionId:i,scope:a,initialData:o,bus:s}=e,c=null;if(r!==void 0){let e=await s.request(d.query,{kind:r.kind,ids:[r.id],currentOnly:!0});if(e.artifacts.length>0)c=e.artifacts[0];else return}else c=(await s.request(d.create,{kind:n.kind,schemaVersion:n.schemaVersion,scope:a??n.scope,data:o??{},relations:[],actor:on(i)})).artifact;return{current:c,schemaVersion:n.schemaVersion,statusPath:t.statusPath,zodSchema:t.schema}}async function fn(e){let{definition:t,execution:n,runContext:r,zodSchema:i,bus:a}=e,o=t.artifact;if(o===void 0)return;let s=sn(t,n,r),c=r.artifactRef??(o.resolve===void 0?void 0:ln(M(o.resolve,s))),l=c===void 0&&o.create!==void 0?un(M(o.create,s)):void 0,u=await dn({bindingOptions:{kind:o.kind,schemaVersion:o.schemaVersion,scope:o.scope,...o.resolve===void 0?{}:{resolve:o.resolve},...o.create===void 0?{}:{create:o.create},...o.statusPath===void 0?{}:{statusPath:o.statusPath},...i===void 0?{}:{schema:i}},binding:o,existingArtifactRef:c,executionId:n.id,scope:o.scope,initialData:l,bus:a});if(u===void 0)throw Error(`Workflow artifact binding could not be resolved for the configured artifact reference.`);return u}const pn=new WeakMap;function mn(e,t){let n=(pn.get(e)??Promise.resolve()).catch(()=>void 0).then(t);return pn.set(e,n.then(()=>void 0,()=>void 0)),n}function hn(e,t){switch(t.operation){case`set`:return t.data;case`merge`:return{...e,...t.data};case`append`:{let n={...e};for(let[r,i]of Object.entries(t.data)){let t=e[r];Array.isArray(t)&&Array.isArray(i)?n[r]=[...t,...i]:n[r]=i}return n}}}function gn(e,t,n){let[r,...i]=t;if(i.length===0)return{...e,[r]:n};let a=e[r]!==null&&typeof e[r]==`object`&&!Array.isArray(e[r])?e[r]:{};return{...e,[r]:gn(a,i,n)}}function _n(e,t,n){return gn(e,t.startsWith(`/`)?t.slice(1).split(`/`):t.split(`.`),n)}function vn(e,t,n){if(n===`set`||n===`functional`)return[];let r=[];for(let n of Object.keys(t))e[n]!==t[n]&&r.push(`/${n}`);return r}async function yn(e,t){if(typeof t==`function`)return{nextData:await t(Object.freeze({...e})),operationLabel:`functional`,changedPaths:[]};let n=hn(e,t),r=vn(e,n,t.operation);return{nextData:n,operationLabel:t.operation,changedPaths:r}}function bn(e){let{executionId:t,frameId:n,bindingState:r,bus:i}=e,a=Object.freeze({...r.current.data}),o=async e=>mn(r,async()=>{let a=r.current,{nextData:o,operationLabel:s,changedPaths:c}=await yn(a.data,e);if(r.zodSchema!==void 0){let e=r.zodSchema.safeParse(o);if(!e.success)throw Error(`Artifact data validation failed: ${e.error.message}`)}let l=await i.request(d.revise,{previous:{refClass:`artifact`,kind:a.kind,id:a.id,revision:a.revision},revision:{kind:a.kind,schemaVersion:r.schemaVersion,scope:a.scope,data:o,relations:a.relations,actor:on(t)}});r.current=l.artifact;let u=l.artifact.revision;return i.emit(ae.artifact.updated,{executionId:t,frameId:n,artifactRef:{kind:l.artifact.kind,id:l.artifact.id},paths:c,operation:s,revision:u}).catch(e=>{console.error(`[ArtifactContext] Failed to emit artifact.updated event:`,e)}),u});return{data:a,updateArtifact:o,updateStatus:async e=>{if(r.statusPath===void 0)throw Error(`updateStatus() called but no statusPath is configured on the artifact binding. Set statusPath in the .artifact() builder call to use updateStatus().`);let t=r.statusPath;return o(n=>_n(n,t,e))}}}function xn(e,t){return{async get(){return(await t.request(D.state.get,{executionId:e})).value},async update(n){let r=await t.request(D.state.get,{executionId:e}),i=structuredClone(r.value),a=await n(i),o=a===void 0?i:a,s=Ue(r.value,o);return(await t.request(D.state.patch,{executionId:e,expectedSequence:r.sequence,patch:s,nextValue:o})).value}}}async function Sn(e,t,n){if(t.signal.aborted)return{status:`cancelled`};let r=await t.bus.requestOptional(D.resolveRole,{roleId:e.roleId});if(!r.handled)return{status:`failed`,error:e.unresolvedRoleError};let i=N(e.prompt,R(n)),a=e.completion===void 0?r.data:{...r.data,completion:e.completion};return z({...e,task:i,resolvedConfig:a},t)}async function z(e,t){if(t.signal.aborted)return{status:`cancelled`};let n=await t.bus.requestOptional(S.spawn,{parentSessionId:t.execution.coordinatorSessionId??t.executionId,depth:1,config:Dn(e.task,e.resolvedConfig,e.outputSchema)});if(!n.handled)return{status:`failed`,error:e.unavailableRuntimeError};let r=await Cn(e,t,n.data.subagentId,{attempts:5}),i=await On(e,t,n.data.subagentId);return i===`aborted`?{status:`cancelled`}:(r||await Cn(e,t,n.data.subagentId,{attempts:1}),i.handled?t.signal.aborted||i.data.status===`cancelled`?{status:`cancelled`}:i.data.status===`completed`?{status:`completed`,output:i.data.result??null}:{status:`failed`,error:`${e.nodeLabel} '${e.nodeId}' subagent ${i.data.status}: ${i.data.error??`no result`}`}:{status:`failed`,error:e.unavailableAwaitError})}async function Cn(e,t,n,r){if(e.frameId===void 0)return!0;try{let i=await wn(t,n,r.attempts);return i===void 0?!1:(await t.bus.emit(D.frame.sessionLinked,{executionId:t.executionId,frameId:e.frameId,sessionId:i}),!0)}catch(t){return console.warn(`[workflow-engine] Failed to emit frame.sessionLinked for frame '${e.frameId}' and subagent '${n}'`,t),!1}}async function wn(e,t,n){for(let r=0;r<n;r+=1){if(e.signal?.aborted)return;let i=await Tn(e,t);if(i===void 0||!i.handled)return;if(i.data.childSessionId!==void 0)return i.data.childSessionId;if(r<n-1&&!await En(e.signal,20))return}}async function Tn(e,t){try{return await e.bus.requestOptional(S.getStatus,{subagentId:t},{timeout:25,signal:e.signal})}catch{return}}function En(e,t){return e.aborted?Promise.resolve(!1):new Promise(n=>{let r,i=t=>{r!==void 0&&(clearTimeout(r),r=void 0),e.removeEventListener(`abort`,a),n(t)},a=()=>i(!1);r=setTimeout(()=>i(!0),t),e.addEventListener(`abort`,a,{once:!0}),e.aborted&&i(!1)})}function Dn(e,t,n){return{task:e,adapterName:t.adapterName,...t.model===void 0?{}:{model:t.model},...t.reasoningEffort===void 0?{}:{reasoningEffort:t.reasoningEffort},...t.harnessId===void 0?{}:{harnessId:t.harnessId},...t.systemPrompt===void 0?{}:{systemPrompt:t.systemPrompt},...t.contextMode===void 0?{}:{contextMode:t.contextMode},...t.providerContext===void 0?{}:{providerContext:t.providerContext},...t.completion===void 0?{}:{completion:t.completion},...n===void 0?{}:{responseSchema:n}}}async function On(e,t,n){if(t.signal.aborted)return await B(e,t,n),`aborted`;let r=t.bus.requestOptional(S.await,{subagentId:n,...e.timeoutMs===void 0?{}:{timeoutMs:e.timeoutMs}},{timeout:0});if(t.signal.aborted)return await B(e,t,n),`aborted`;let i,a=new Promise(e=>{i=()=>e(`aborted`),t.signal.addEventListener(`abort`,i,{once:!0})}),o=await Promise.race([r,a]);return i!==void 0&&t.signal.removeEventListener(`abort`,i),o===`aborted`&&await B(e,t,n),o}async function B(e,t,n){try{await t.bus.requestOptional(S.kill,{subagentId:n,reason:`Workflow execution '${t.executionId}' cancelled ${e.cancellationLabel} '${e.nodeId}'`})}catch(t){console.warn(`[workflow-engine] Best-effort subagent kill failed for '${n}' (${e.cancellationLabel} '${e.nodeId}')`,t)}}async function kn(e,t,n,r){if(t.signal.aborted)return{status:`cancelled`};let i=$t(n.frames),a=t.runtimeHandlers.get(e.id);if(a===void 0)return An(e,t,n,r);let o=t.artifactBinding!==void 0&&r!==void 0?bn({executionId:t.executionId,frameId:r,bindingState:t.artifactBinding,bus:t.bus}):void 0,s=t.definition.state===void 0?void 0:xn(t.executionId,t.bus);async function c(n){if(r===void 0){console.warn(`[station-node] updateProgress called without frameId for node '${e.id}'; skipping emit`);return}let i=ie[`execution.progress`].parse({executionId:t.executionId,workflowId:t.workflowId,frameId:r,nodeId:e.id,progress:n,emittedAt:Date.now()});try{await t.bus.emit(D.execution.progress,i)}catch(t){console.error(`[station-node] execution.progress observer failed for ${e.id}:`,t)}}let l;try{l=await a({...t.platformContext,env:t.env,executionId:t.executionId,workflowId:t.workflowId,inputs:t.execution.inputs,config:t.execution.config??{},trigger:t.execution.triggerPayload??{},previousSteps:i,...n.item!==void 0&&{item:n.item},...n.index!==void 0&&{index:n.index},...n.previous!==void 0&&{previous:n.previous},signal:t.signal,...o!==void 0&&{artifact:o},...s!==void 0&&{state:s},bus:t.bus,updateProgress:c})}catch(e){return{status:`failed`,error:e instanceof Error?e.message:String(e)}}return{status:`completed`,output:l}}async function An(e,t,n,r){if(e.role===void 0)return{status:`failed`,error:`No handler registered for station node '${e.id}'`};let i=e.outputSchema===void 0?void 0:{schema:e.outputSchema};return Sn({nodeId:e.id,nodeLabel:`Station node`,roleId:e.role,prompt:e.prompt,...i===void 0?{}:{outputSchema:i},...e.timeoutMs===void 0?{}:{timeoutMs:e.timeoutMs},...e.completion===void 0?{}:{completion:e.completion},unresolvedRoleError:`No runtime handler registered for station node '${e.id}', and role '${e.role}' could not be resolved`,unavailableRuntimeError:`Subagent runtime is not available for station node '${e.id}'`,unavailableAwaitError:`Subagent runtime cannot await station node '${e.id}'`,cancellationLabel:`station`,...r===void 0?{}:{frameId:r}},t,n)}async function jn(e,t,n,r){if(t.signal.aborted)return{status:`cancelled`};let i=await t.bus.requestOptional(D.resolveAgent,{agentId:e.agentId});if(!i.handled)return{status:`failed`,error:`Agent '${e.agentId}' could not be resolved for delegate-agent node '${e.id}'`};if(t.signal.aborted)return{status:`cancelled`};let a=Wn(e,n);if(a.status===`failed`)return a;let o=e.outputSchema===void 0?void 0:{schema:e.outputSchema};return z({nodeId:e.id,nodeLabel:`Delegate-agent node`,task:a.task,resolvedConfig:i.data,...o===void 0?{}:{outputSchema:o},unavailableRuntimeError:`Subagent runtime is not available for delegate-agent node '${e.id}'`,unavailableAwaitError:`Subagent runtime cannot await delegate-agent node '${e.id}'`,cancellationLabel:`delegate-agent`,...r===void 0?{}:{frameId:r}},t)}async function Mn(e,t,n,r){if(t.signal.aborted)return{status:`cancelled`};let i=await t.bus.requestOptional(D.resolveRole,{roleId:e.role});if(!i.handled)return{status:`failed`,error:`Role '${e.role}' could not be resolved for delegate-role node '${e.id}'`};let a=e.outputSchema===void 0?void 0:{schema:e.outputSchema},o=N(e.prompt,R(n)),s=Bn(e,i.data),c={node:e,task:o,resolvedRole:s,...a===void 0?{}:{outputSchema:a},...r===void 0?{}:{frameId:r}};return Vn(s)?Nn(c,t):z({nodeId:e.id,nodeLabel:`Delegate-role node`,task:o,resolvedConfig:s,...a===void 0?{}:{outputSchema:a},...e.timeoutMs===void 0?{}:{timeoutMs:e.timeoutMs},unavailableRuntimeError:`Subagent runtime is not available for delegate-role node '${e.id}'`,unavailableAwaitError:`Subagent runtime cannot await delegate-role node '${e.id}'`,cancellationLabel:`delegate-role`,...r===void 0?{}:{frameId:r}},t)}async function Nn(e,t){let{node:n}=e,r=n.timeoutMs??3e5,i,a=Un(t.signal);try{let n=await Pn(e,t);return`status`in n?n:(i=n.sessionId,t.signal.aborted?{status:`cancelled`}:await Fn(e,t,{abortLink:a,childSessionId:i,timeoutMs:r}))}catch(e){if(t.signal.aborted)return{status:`cancelled`};let r=e instanceof Error?e.message:String(e);return{status:`failed`,error:`Delegate-role node '${n.id}' session turn failed: ${r}`}}finally{a.controller.abort(),a.cleanup(),i!==void 0&&await V(t,n.id,i)}}async function Pn(e,t){let n=await t.bus.requestOptional(b.create,{sessionId:Rn(t,e),parentSessionId:t.execution.coordinatorSessionId??t.executionId,branchKind:`subagent`,title:`Workflow delegate-role '${e.node.id}'`});if(!n.handled)return{status:`failed`,error:`Session runtime is not available for delegate-role node '${e.node.id}'`};let r=n.data.sessionId;return await Hn(e,t,r),(await t.bus.requestOptional(b.agent.attach,{sessionId:r,agent:zn(e.resolvedRole),role:`lead`},{signal:t.signal}).catch(async n=>{throw await V(t,e.node.id,r),n})).handled?{sessionId:r}:(await V(t,e.node.id,r),{status:`failed`,error:`Session runtime cannot attach delegate-role node '${e.node.id}'`})}async function Fn(e,t,n){let r=t.bus.once(u.complete,{timeoutMs:n.timeoutMs,filter:{sessionId:n.childSessionId},signal:n.abortLink.controller.signal});r.catch(()=>void 0);let i=await In(e,t,n);if(`status`in i)return i;let a=await Ln(e,t,n,i.turnId);if(a.status===`failed`)return a;let o=await r;return t.signal.aborted?{status:`cancelled`}:o.payload.outcome===`error`?{status:`failed`,error:`Delegate-role node '${e.node.id}' agent error: ${o.payload.error??`no result`}`}:{status:`completed`,output:o.payload.message??null}}async function In(e,t,n){let r=await t.bus.requestOptional(b.sendMessage,{sessionId:n.childSessionId,message:e.task,...e.outputSchema===void 0?{}:{responseSchema:e.outputSchema},source:`system`},{signal:t.signal});return r.handled?{turnId:r.data.turnId}:(n.abortLink.controller.abort(),{status:`failed`,error:`Session runtime cannot send delegate-role node '${e.node.id}'`})}async function Ln(e,t,n,r){let i=await t.bus.requestOptional(b.turn.await,{sessionId:n.childSessionId,turnId:r,timeoutMs:n.timeoutMs},{timeout:0,signal:t.signal});return i.handled?i.data.completion.success?{status:`completed`}:{status:`failed`,error:`Delegate-role node '${e.node.id}' session turn failed: ${i.data.completion.error??`no result`}`}:(n.abortLink.controller.abort(),{status:`failed`,error:`Session runtime cannot await delegate-role node '${e.node.id}'`})}function Rn(e,t){return`session-workflow-${e.executionId}-${t.frameId??t.node.id}`}function zn(e){return{kind:`adapter`,adapterName:e.adapterName,...e.model===void 0?{}:{model:e.model},...e.reasoningEffort===void 0?{}:{reasoningEffort:e.reasoningEffort},...e.systemPrompt===void 0?{}:{systemPrompt:e.systemPrompt},...e.providerContext===void 0?{}:{providerConfigId:e.providerContext.providerConfigId}}}function Bn(e,t){return e.completion===void 0?t:{...t,completion:e.completion}}function Vn(e){return e.completion===`turn`&&e.harnessId===void 0&&e.contextMode===void 0}async function Hn(e,t,n){if(e.frameId!==void 0)try{await t.bus.emit(D.frame.sessionLinked,{executionId:t.executionId,frameId:e.frameId,sessionId:n})}catch(t){console.warn(`[workflow-engine] Failed to emit frame.sessionLinked for frame '${e.frameId}' and session '${n}'`,t)}}async function V(e,t,n){try{await e.bus.requestOptional(b.close,{sessionId:n})}catch(e){console.warn(`[workflow-engine] Failed to close delegate-role session '${n}' for node '${t}'`,e)}}function Un(e){let t=new AbortController;if(e.aborted)return t.abort(),{controller:t,cleanup:()=>void 0};let n=()=>t.abort();return e.addEventListener(`abort`,n,{once:!0}),{controller:t,cleanup:()=>e.removeEventListener(`abort`,n)}}function Wn(e,t){try{let n=R(t);return{status:`completed`,task:Gn(e.inputExpression===void 0?n:M(e.inputExpression,n))}}catch(t){let n=t instanceof Error?t.message:String(t);return{status:`failed`,error:`delegate-agent node '${e.id}': input expression evaluation failed: ${n}`}}}function Gn(e){if(typeof e==`string`)return e;if(e===void 0)return``;try{return JSON.stringify(e,null,2)??``}catch{return String(e)}}function Kn(e,t,n,r){try{let i=M(n,R(r));return Array.isArray(i)?i:{status:`failed`,error:`${t} node '${e}': collection expression did not resolve to an array (got ${typeof i})`}}catch(n){return{status:`failed`,error:`${t} node '${e}': collection expression evaluation failed: ${n instanceof Error?n.message:String(n)}`}}}function qn(e,t,n){for(let r of[...e.nodes].reverse()){let e=n.getFramesByNodeId(r.id);for(let n of e)if(n.parentFrameId===t&&n.status===`completed`)return n.output}}function Jn(e,t,n){return qn(e.body,t,n)}function Yn(e){if(e.length===0)return;let t=new Map,n=new Map;for(let r of e){n.set(r.frameId,r);let e=t.get(r.nodeId)??[];e.push(r),t.set(r.nodeId,e)}return{byNodeId:t,byFrameId:n}}const Xn=new Set([`completed`,`skipped`,`waiting`]);function H(e,t,n){let r=e?.byNodeId.get(t)??[],i=n.statuses??Xn;return r.find(e=>e.parentFrameId===n.parentFrameId&&e.branchKey===n.branchKey&&e.iteration===n.iteration&&i.has(e.status))}function U(e,t,n){let r={...e.frames,[t]:n};return{...e,frames:r,previousSteps:$t(r),output:n.status===`completed`?n.output:e.output}}function W(e,t){if(typeof AbortSignal.any==`function`)return AbortSignal.any([e,t]);let n=new AbortController,r=()=>n.abort();return e.addEventListener(`abort`,r,{once:!0}),t.addEventListener(`abort`,r,{once:!0}),n.signal}const Zn=new Set([`completed`,`running`]);function Qn(e,t){return e.status===`running`&&t.pauseSignal?.aborted===!0&&!t.outerSignal.aborted}async function $n(e,t,n,r,i,a,o=`all-settled`){if(t.signal.aborted)return{status:`cancelled`};let s=Object.entries(e.branches);if(s.length===0)return{status:`completed`,output:G({},o)};let c=new AbortController,l=new AbortController,u=t.suspensionStrategy!==`wait-in-process`,d=o===`fail-fast`?W(c.signal,l.signal):u?l.signal:void 0,f=d===void 0?t.signal:W(t.signal,d),p=f===t.signal?t:t.withSignal(f),m=s.map(([s,c])=>er(s,c,e,p,n,r,i,a,{outerSignal:t.signal,pauseSignal:o===`fail-fast`||u?l.signal:void 0}));if(o===`all-settled`){let e=await Promise.all(u?m.map(e=>e.then(e=>(e.status===`paused`&&l.abort(),e))):m),t=e.find(e=>e.status===`paused`);return t===void 0?{status:`completed`,output:G(nr(s,e),o)}:t}let h=await tr(s,m,c,l);return h.type===`cancelled`?{status:`cancelled`}:h.type===`paused`?h.outcome:h.type===`failed`?{status:`failed`,error:h.error}:{status:`completed`,output:G(nr(s,h.outcomes),o)}}async function er(e,t,n,r,i,a,o,s,c){if(r.signal.aborted)return{status:`cancelled`};let l=H(r.resumeFrames,n.id,{parentFrameId:o,branchKey:e,statuses:Zn});if(l?.status===`completed`)return{status:`completed`,...l.output===void 0?{}:{output:l.output}};let u=l??r.createFrame({nodeId:n.id,nodeType:`parallel`,path:s,parentFrameId:o,branchKey:e});if(r.signal.aborted)return Qn(u,c)||await $(u,r),{status:`cancelled`};l===void 0&&await X(u,r);let d;try{d=await a(t,r,i,u.frameId,u.path)}catch(e){let t=e instanceof Error?e.message:String(e);return await Q(u,r,t),{status:`failed`,error:t}}switch(d.status){case`completed`:{let e=qn(t,u.frameId,r);return await Z(u,r,e),{status:`completed`,output:e}}case`skipped`:return await Z(u,r),{status:`completed`};case`cancelled`:return Qn(u,c)||await $(u,r),{status:`cancelled`};case`paused`:return d;case`failed`:return await Q(u,r,d.error),{status:`failed`,error:d.error}}}async function tr(e,t,n,r){let i,a,o=t.map(e=>e.then(e=>(e.status===`failed`&&i===void 0?(i=e.error,n.abort()):e.status===`paused`&&a===void 0&&(a=e,r.abort()),e),e=>{let t=e instanceof Error?e.message:String(e);return i===void 0&&(i=t,n.abort()),{status:`failed`,error:t}})),s=await Promise.all(o);return a===void 0?s.some(e=>e.status===`cancelled`)&&i===void 0?{type:`cancelled`}:i===void 0?{type:`completed`,outcomes:s}:{type:`failed`,error:i}:{type:`paused`,outcome:a}}function G(e,t){return{mode:t,branches:e}}function nr(e,t){let n={};for(let r=0;r<e.length;r++){let[i]=e[r],a=t[r];n[i]=rr(a)}return n}function rr(e){switch(e.status){case`completed`:return{status:`fulfilled`,...e.output===void 0?{}:{value:e.output}};case`skipped`:return{status:`fulfilled`,value:null};case`cancelled`:return{status:`cancelled`};case`paused`:return{status:`paused`,pausedAtGateId:e.pausedAtGateId,pausedAtFrameId:e.pausedAtFrameId};case`failed`:return{status:`rejected`,reason:e.error}}}const ir=new He.default({allErrors:!0,strict:!1});function K(e,t){if(t===void 0)return{status:`ok`};try{return{status:`ok`,validator:ir.compile(t)}}catch(t){return{status:`failed`,error:`Gate '${e}' has an invalid resumeSchema: ${t instanceof Error?t.message:String(t)}`}}}function ar(e,t){return e===void 0||e(t)?{valid:!0}:{valid:!1,error:sr(e.errors??[])}}function or(e,t,n){let r=K(e,t);return r.status===`failed`?{valid:!1,error:r.error}:ar(r.validator,n)}function sr(e){return e.length===0?`schema validation failed`:e.map(e=>`${e.instancePath.length>0?e.instancePath:`/`} ${e.message??`is invalid`}`).join(`; `)}const cr={action:`approve`,source:`timeout`};function lr(e){return e===void 0?{}:{reason:e}}async function ur(e,t,n,r){let i=()=>{t.value&&(t.value=!1,e.reject(`cancelled`))};n.addEventListener(`abort`,i,{once:!0}),n.aborted&&i();let a=[e.promise],o;if(r!==null){let e=mr();o=setTimeout(()=>{t.value&&(t.value=!1,n.removeEventListener(`abort`,i),e.reject(`timed-out`))},r),a.push(e.promise)}try{let e=await Promise.race(a);return n.removeEventListener(`abort`,i),o!==void 0&&clearTimeout(o),{action:e.action,resumeData:e.resumeData,timedOut:!1,wasCancelled:!1,reason:e.reason}}catch(e){return o!==void 0&&clearTimeout(o),n.removeEventListener(`abort`,i),e===`timed-out`?{action:`reject`,resumeData:null,timedOut:!0,wasCancelled:!1}:{action:`reject`,resumeData:null,timedOut:!1,wasCancelled:!0}}}async function dr(e,t,n,r,i,a){let o={required:e.suspensionStrategy!==`wait-in-process`};if(a.timedOut){let a=Date.now();if(r.autoAction===`approve`){let s=ar(i,cr);return s.valid?(await q(e,{...r,status:`resumed`,resumeData:cr,resolvedAt:a},o),await J(e,t.id,n,{action:`approve`,source:`timeout`}),{status:`completed`,output:{resumeData:cr}}):(await q(e,{...r,status:`timed-out`,resolvedAt:a},o),await J(e,t.id,n,{action:`reject`,source:`timeout`}),{status:`failed`,error:`Gate '${t.id}' auto-approve timeout resume data does not match resumeSchema: ${s.error}`})}return await q(e,{...r,status:`timed-out`,resolvedAt:a},o),await J(e,t.id,n,{action:`reject`,source:`timeout`}),{status:`failed`,error:`Gate '${t.id}' timed out after ${String(r.timeoutMs)}ms and auto-rejected`}}if(a.wasCancelled||e.signal.aborted)return await q(e,{...r,status:`cancelled`,resolvedAt:Date.now()},o),await J(e,t.id,n,{source:`cancelled`}),{status:`cancelled`};let s=Date.now();await q(e,{...r,status:a.action===`reject`?`rejected`:`resumed`,resumeData:a.resumeData,...lr(a.reason),resolvedAt:s},o);try{await e.bus.emit(D.gate.resumed,{executionId:e.executionId,frameId:n,nodeId:t.id,resumeData:a.resumeData}),await J(e,t.id,n,{action:a.action,source:`user`,...lr(a.reason)})}catch(e){console.error(`[GateNode] gate.resumed emit failed for '${t.id}':`,e)}return{status:`completed`,output:{resumeData:a.resumeData}}}async function fr(e,t,n,r){if(t.signal.aborted)return{status:`cancelled`};let i=e.resumeSchema??{};if(t.suspensionStrategy!==`wait-in-process`){let n=await _r(t,e,r);if(n!==void 0)return n}let a=K(e.id,e.resumeSchema);return a.status===`failed`?{status:`failed`,error:a.error}:pr(t,e,n,r,i,a.validator)}async function pr(e,t,n,r,i,a){let o=N(t.prompt,R(n)),s={executionId:e.executionId,nodeId:t.id,frameId:r,schema:i,prompt:o,status:`waiting`,autoAction:t.autoAction,timeoutMs:t.timeoutMs,createdAt:Date.now()},c=e.suspensionStrategy!==`wait-in-process`;if(await q(e,s,{required:c}),await e.updateFrame(r,{status:`waiting`},{requireFrameStorage:c}),c)return await hr(e,t,r,i,o,s.createdAt),{status:`paused`,pausedAtGateId:t.id,pausedAtFrameId:r};let u={value:!0},d=mr(),f=e.bus.on(D.gate.respond,async n=>{let{executionId:i,gateId:o,frameId:s,action:c,resumeData:f,reason:p}=n.payload;if(i!==e.executionId||o!==t.id||s!==void 0&&s!==r){try{await n.next()}catch(e){if(e instanceof l)n.setResult({accepted:!1});else throw e}return}if(!u.value){n.setResult({accepted:!1});return}if(!ar(a,f).valid){n.setResult({accepted:!1});return}u.value=!1,n.setResult({accepted:!0}),d.resolve({action:c,resumeData:f,reason:p})});await hr(e,t,r,i,o,s.createdAt);let p=await ur(d,u,e.signal,t.timeoutMs);return f(),dr(e,t,r,s,a,p)}function mr(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function hr(e,t,n,r,i,a){try{await e.bus.emit(D.gate.suspended,{executionId:e.executionId,frameId:n,nodeId:t.id,schema:r,prompt:i,...t.title!==void 0&&{title:t.title},autoAction:t.autoAction,timeoutMs:t.timeoutMs,openedAt:a})}catch(e){console.error(`[GateNode] gate.suspended emit failed for '${t.id}':`,e)}}async function gr(e,t,n){if(e.suspensionStrategy!==`wait-in-process`)return(await e.bus.request(F.getGateInstance,{executionId:e.executionId,nodeId:t,frameId:n})).gate;let r=await e.bus.requestOptional(F.getGateInstance,{executionId:e.executionId,nodeId:t,frameId:n});return r.handled?r.data.gate:null}async function _r(e,t,n){let r=await gr(e,t.id,n);if((r?.status===`resumed`||r?.status===`rejected`)&&r.resumeData!==void 0){let i=or(t.id,r.schema,r.resumeData);if(!i.valid)return{status:`failed`,error:`Gate '${t.id}' persisted resumeData is invalid: ${i.error}`};try{await e.bus.emit(D.gate.resumed,{executionId:e.executionId,frameId:n,nodeId:t.id,resumeData:r.resumeData})}catch(e){console.error(`[GateNode] gate.resumed emit failed for '${t.id}':`,e)}return await J(e,t.id,n,{action:r.status===`rejected`?`reject`:`approve`,source:`user`,...lr(r.reason)}),{status:`completed`,output:{resumeData:r.resumeData}}}if(r?.status===`waiting`){if(r.timeoutMs!==null&&Date.now()>=r.createdAt+r.timeoutMs){let i=K(t.id,r.schema);return i.status===`failed`?{status:`failed`,error:i.error}:dr(e,t,n,r,i.validator,{action:`reject`,resumeData:null,timedOut:!0,wasCancelled:!1})}return{status:`paused`,pausedAtGateId:t.id,pausedAtFrameId:n}}if((r?.status===`resumed`||r?.status===`rejected`)&&r.resumeData===void 0)return{status:`failed`,error:`Gate '${t.id}' has status '${r.status}' but resumeData is missing — cannot reconstruct output`};if(r!==null)return{status:`failed`,error:`Gate '${t.id}' cannot resume from status '${r.status}'`}}async function q(e,t,n={}){try{n.required===!0?await e.bus.request(F.setGateInstance,{gate:t}):await e.bus.requestOptional(F.setGateInstance,{gate:t})}catch(e){if(n.required===!0)throw e;console.warn(`[GateNode] Failed to upsert gate instance for '${t.nodeId}':`,e)}}async function J(e,t,n,r){try{await e.bus.emit(D.gate.resolved,{executionId:e.executionId,stepId:t,stepType:`gate`,frameId:n,...r})}catch(e){console.error(`[GateNode] gate.resolved emit failed for '${t}':`,e)}}function Y(e){return{status:`fulfilled`,...e===void 0?{}:{value:e}}}const vr=new Set([`completed`,`running`]);function yr(e,t){return e.status===`running`&&t.pauseSignal?.aborted===!0&&!t.outerSignal.aborted}async function br(e,t,n,r,i,a){if(t.signal.aborted)return{status:`cancelled`};let o=Kn(e.id,`iterate`,e.collection,n);if(!Array.isArray(o))return o;let s=o;if(s.length===0)return{status:`completed`,output:wr([])};let c=await xr(s,e,t,n,r,i,a,e.concurrency!==void 0&&e.concurrency>0?e.concurrency:0);if(t.signal.aborted&&c.every(e=>e.status===`cancelled`))return{status:`cancelled`};let l=c.find(e=>e.status===`paused`);return l===void 0?{status:`completed`,output:wr(c)}:{status:`paused`,pausedAtGateId:l.pausedAtGateId,pausedAtFrameId:l.pausedAtFrameId}}async function xr(e,t,n,r,i,a,o,s){let c=new AbortController,l=n.suspensionStrategy!==`wait-in-process`,u=l?W(n.signal,c.signal):n.signal,d=u===n.signal?n:n.withSignal(u),f={outerSignal:n.signal,...l?{pauseSignal:c.signal}:{}};if(s===0){let n=e.map((e,n)=>Cr(e,n,t,d,r,i,a,o,f));return Promise.all(l?n.map(e=>Sr(e,c)):n)}let p=Array(e.length);for(let n=0;n<e.length;n+=s){if(d.signal.aborted){for(let t=n;t<e.length;t++)p[t]={status:`cancelled`};break}let u=Math.min(n+s,e.length),m=[];for(let s=n;s<u;s++)m.push(Cr(e[s],s,t,d,r,i,a,o,f));let h=await Promise.all(l?m.map(e=>Sr(e,c)):m);for(let e=0;e<h.length;e++)p[n+e]=h[e];if(h.some(e=>e.status===`paused`)){for(let t=u;t<e.length;t++)p[t]={status:`cancelled`};break}}return p}function Sr(e,t){return e.then(e=>(e.status===`paused`&&t.abort(),e))}async function Cr(e,t,n,r,i,a,o,s,c){if(r.signal.aborted)return{status:`cancelled`};let l={...i,item:e,index:t},u=H(r.resumeFrames,n.id,{parentFrameId:o,iteration:t,statuses:vr});if(u?.status===`completed`)return Y(u.output);let d=u??r.createFrame({nodeId:n.id,nodeType:`iterate`,path:s,parentFrameId:o,iteration:t});if(r.signal.aborted)return yr(d,c)||await $(d,r),{status:`cancelled`};u===void 0&&await X(d,r);let f;try{f=await a(n.body,r,l,d.frameId,d.path)}catch(e){let t=e instanceof Error?e.message:String(e);return await Q(d,r,t),{status:`rejected`,reason:t}}switch(f.status){case`completed`:{let e=Jn(n,d.frameId,r);return await Z(d,r,e),Y(e)}case`skipped`:return await Z(d,r),Y();case`cancelled`:return yr(d,c)||await $(d,r),{status:`cancelled`};case`paused`:return f;case`failed`:return await Q(d,r,f.error),{status:`rejected`,reason:f.error}}}function wr(e){return{items:e}}const Tr=new Set([`completed`,`running`]);async function Er(e,t,n,r,i,a){if(t.signal.aborted)return{status:`cancelled`};let o=Kn(e.id,`iterate-chain`,e.collection,n);if(!Array.isArray(o))return o;let s=o;if(s.length===0)return{status:`completed`,output:Or([])};let c=[],l;for(let o=0;o<s.length;o++){if(t.signal.aborted)return{status:`cancelled`};let u=s[o],d=await Dr(u,o,l,e,t,n,r,i,a);switch(c.push(d),d.status){case`fulfilled`:l=d.value;break;case`rejected`:return{status:`failed`,error:d.reason};case`cancelled`:return{status:`cancelled`};case`paused`:return{status:`paused`,pausedAtGateId:d.pausedAtGateId,pausedAtFrameId:d.pausedAtFrameId}}}return{status:`completed`,output:Or(c)}}async function Dr(e,t,n,r,i,a,o,s,c){if(i.signal.aborted)return{status:`cancelled`};let l={...a,item:e,index:t,...n!==void 0&&{previous:n}},u=H(i.resumeFrames,r.id,{parentFrameId:s,iteration:t,statuses:Tr});if(u?.status===`completed`)return Y(u.output);let d=u??i.createFrame({nodeId:r.id,nodeType:`iterate-chain`,path:c,parentFrameId:s,iteration:t});if(i.signal.aborted)return await $(d,i),{status:`cancelled`};u===void 0&&await X(d,i);let f;try{f=await o(r.body,i,l,d.frameId,d.path)}catch(e){let t=e instanceof Error?e.message:String(e);return await Q(d,i,t),{status:`rejected`,reason:t}}switch(f.status){case`completed`:{let e=Jn(r,d.frameId,i);return await Z(d,i,e),Y(e)}case`skipped`:return await Z(d,i),Y();case`cancelled`:return await $(d,i),{status:`cancelled`};case`paused`:return f;case`failed`:return await Q(d,i,f.error),{status:`rejected`,reason:f.error}}}function Or(e){return{items:e}}async function X(e,t){e.status=`running`,e.startedAt=Date.now(),await t.persistFrame(e),await t.emitFrameStarted(e)}async function Z(e,t,n){let r=Date.now(),i=e.startedAt===void 0?void 0:Math.max(0,r-e.startedAt);e.status=`completed`,e.output=n,e.completedAt=r,await t.persistFrame(e),await t.emitFrameCompleted(e,i)}async function Q(e,t,n){let r=Date.now(),i=e.startedAt===void 0?void 0:Math.max(0,r-e.startedAt);e.status=`failed`,e.error=n,e.completedAt=r,await t.persistFrame(e),await t.emitFrameFailed(e,n,i)}async function kr(e,t){e.status=`skipped`,e.completedAt=Date.now(),await t.persistFrame(e)}async function $(e,t){e.status=`cancelled`,e.completedAt=Date.now(),await t.persistFrame(e)}function Ar(e,t){return!!M(e,R(t))}async function jr(e,t,n,r,i,a=[]){if(t.signal.aborted)return{status:`cancelled`};switch(e.type){case`sequence`:return r(e,t,n,i,a);case`station`:return kn(e,t,n,i);case`delegate-agent`:return jn(e,t,n,i);case`delegate-role`:return Mn(e,t,n,i);case`parallel`:return $n(e,t,n,r,i??``,a,e.mode??`all-settled`);case`gate`:return fr(e,t,n,i??``);case`iterate`:return br(e,t,n,r,i??``,a);case`iterate-chain`:return Er(e,t,n,r,i??``,a);default:return{status:`failed`,error:`Unknown node type: ${String(e.type)}`}}}const Mr=new Set([`completed`,`skipped`,`waiting`,`running`]);function Nr(e){return e.type===`parallel`||e.type===`iterate`||e.type===`iterate-chain`}function Pr(e,t,n){return H(e.resumeFrames,t.id,{parentFrameId:n,...Nr(t)?{statuses:Mr}:{}})}function Fr(e,t,n){if(n?.status===`completed`)return U(e,t.id,{status:`completed`,...n.output===void 0?{}:{output:n.output}});if(n?.status===`skipped`)return U(e,t.id,{status:`skipped`})}async function Ir(e,t,n,r,i,a,o){try{return{result:Ar(e,i)}}catch(e){let i=e instanceof Error?e.message:String(e);return await Q(r.createFrame({nodeId:n.id,nodeType:n.type,path:a,parentFrameId:o}),r,`'${t}' condition evaluation failed: ${i}`),{status:`failed`,error:`'${t}' condition evaluation failed for '${n.id}': ${i}`}}}async function Lr(e,t,n,r,i,a){let o=a??t.createFrame({nodeId:e.id,nodeType:e.type,path:r,parentFrameId:i});if(t.signal.aborted)return await $(o,t),{updatedCtx:n,outcome:{status:`cancelled`}};a===void 0&&await X(o,t);let s;try{s=await jr(e,t,n,Rr,o.frameId,o.path)}catch(e){let r=e instanceof Error?e.message:String(e);return await Q(o,t,r),{updatedCtx:n,outcome:{status:`failed`,error:r}}}switch(s.status){case`completed`:return await Z(o,t,s.output),{updatedCtx:U(n,e.id,{status:`completed`,output:s.output})};case`skipped`:return await kr(o,t),{updatedCtx:U(n,e.id,{status:`skipped`})};case`cancelled`:return await $(o,t),{updatedCtx:n,outcome:{status:`cancelled`}};case`paused`:return{updatedCtx:n,outcome:s};case`failed`:return await Q(o,t,s.error),{updatedCtx:n,outcome:{status:`failed`,error:s.error}}}}async function Rr(e,t,n,r,i=[]){let a=n;for(let n of e.nodes){if(t.signal.aborted)return{status:`cancelled`};let e=Pr(t,n,r),o=Fr(a,n,e);if(o!==void 0){a=o;continue}if(n.when!==void 0){let e=await Ir(n.when,`when`,n,t,a,i,r);if(`status`in e)return e;if(!e.result){await kr(t.createFrame({nodeId:n.id,nodeType:n.type,path:i,parentFrameId:r}),t),a=U(a,n.id,{status:`skipped`});continue}}if(n.skip!==void 0){let e=await Ir(n.skip,`skip`,n,t,a,i,r);if(`status`in e)return e;if(e.result){await kr(t.createFrame({nodeId:n.id,nodeType:n.type,path:i,parentFrameId:r}),t),a=U(a,n.id,{status:`skipped`});continue}}let s=e?.status===`waiting`&&n.type===`gate`||e?.status===`running`&&Nr(n)?e:void 0,{updatedCtx:c,outcome:l}=await Lr(n,t,a,i,r,s);if(a=c,l!==void 0)return l}return{status:`completed`}}export{Re as A,Me as B,ye as C,Le as D,we as E,De as F,ke as G,Ae as H,Ee as I,Oe as K,Ce as L,P as M,xe as N,Ie as O,be as P,Se as R,he as S,Te as T,Fe as U,je as V,Pe as W,Ze as _,an as a,F as b,Qt as c,Tt as d,ht as f,ct as g,dt as h,fn as i,_e as j,ze as k,Lt as l,I as m,or as n,Rt as o,L as p,D as q,Yn as r,Xt as s,Rr as t,Mt as u,Ue as v,ve as w,ge as x,Ve as y,Ne as z};
|
|
@@ -365,7 +365,7 @@ declare const sessions: _$drizzle_orm_sqlite_core0.SQLiteTableWithColumns<{
|
|
|
365
365
|
tableName: "sessions";
|
|
366
366
|
dataType: "string";
|
|
367
367
|
columnType: "SQLiteText";
|
|
368
|
-
data: "
|
|
368
|
+
data: "fork" | "branch" | "subagent" | "compress" | "rewrite" | "coordinator" | "aside";
|
|
369
369
|
driverParam: string;
|
|
370
370
|
notNull: false;
|
|
371
371
|
hasDefault: false;
|
|
@@ -1104,7 +1104,7 @@ declare const agents: _$drizzle_orm_sqlite_core0.SQLiteTableWithColumns<{
|
|
|
1104
1104
|
tableName: "agents";
|
|
1105
1105
|
dataType: "string";
|
|
1106
1106
|
columnType: "SQLiteText";
|
|
1107
|
-
data: "
|
|
1107
|
+
data: "idle" | "active" | "dead" | "disposed";
|
|
1108
1108
|
driverParam: string;
|
|
1109
1109
|
notNull: true;
|
|
1110
1110
|
hasDefault: false;
|
|
@@ -64,9 +64,9 @@ declare const SurfaceBindingRegistrationSchema: z.ZodObject<{
|
|
|
64
64
|
template: z.ZodString;
|
|
65
65
|
}, z.core.$strip>], "kind">;
|
|
66
66
|
appliesTo: z.ZodArray<z.ZodEnum<{
|
|
67
|
-
artifact: "artifact";
|
|
68
67
|
surface: "surface";
|
|
69
68
|
workpiece: "workpiece";
|
|
69
|
+
artifact: "artifact";
|
|
70
70
|
}>>;
|
|
71
71
|
valueMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
72
72
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -108,8 +108,8 @@ declare const ArtifactProjectionPolicySchema: z.ZodObject<{
|
|
|
108
108
|
comment: "comment";
|
|
109
109
|
}>;
|
|
110
110
|
defaultRole: z.ZodOptional<z.ZodEnum<{
|
|
111
|
-
artifact: "artifact";
|
|
112
111
|
workpiece: "workpiece";
|
|
112
|
+
artifact: "artifact";
|
|
113
113
|
}>>;
|
|
114
114
|
semanticEvents: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
115
115
|
created: "created";
|
|
@@ -141,8 +141,8 @@ declare const ArtifactMaterializationRefSchema: z.ZodObject<{
|
|
|
141
141
|
externalId: z.ZodString;
|
|
142
142
|
externalUrl: z.ZodOptional<z.ZodString>;
|
|
143
143
|
surfaceRole: z.ZodEnum<{
|
|
144
|
-
artifact: "artifact";
|
|
145
144
|
workpiece: "workpiece";
|
|
145
|
+
artifact: "artifact";
|
|
146
146
|
}>;
|
|
147
147
|
lastSyncedRevision: z.ZodOptional<z.ZodString>;
|
|
148
148
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -26,9 +26,9 @@ declare const TrayMenuEntrySchema: z.ZodObject<{
|
|
|
26
26
|
/** A group entry inherits its owning package and section from the group. */
|
|
27
27
|
declare const TrayMenuGroupEntrySchema: z.ZodObject<{
|
|
28
28
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
29
|
-
label: z.ZodString;
|
|
30
29
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
31
30
|
priority: z.ZodDefault<z.ZodNumber>;
|
|
31
|
+
label: z.ZodString;
|
|
32
32
|
entryId: z.ZodString;
|
|
33
33
|
}, z.core.$strip>;
|
|
34
34
|
/** Ordered group of tray entries contributed by one package. */
|
|
@@ -37,9 +37,9 @@ declare const TrayMenuGroupSchema: z.ZodObject<{
|
|
|
37
37
|
groupId: z.ZodString;
|
|
38
38
|
entries: z.ZodArray<z.ZodObject<{
|
|
39
39
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
40
|
-
label: z.ZodString;
|
|
41
40
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
42
41
|
priority: z.ZodDefault<z.ZodNumber>;
|
|
42
|
+
label: z.ZodString;
|
|
43
43
|
entryId: z.ZodString;
|
|
44
44
|
}, z.core.$strip>>;
|
|
45
45
|
section: z.ZodEnum<{
|
|
@@ -109,9 +109,9 @@ declare const TrayMenuSchemas: {
|
|
|
109
109
|
groupId: z.ZodString;
|
|
110
110
|
entries: z.ZodArray<z.ZodObject<{
|
|
111
111
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
112
|
-
label: z.ZodString;
|
|
113
112
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
114
113
|
priority: z.ZodDefault<z.ZodNumber>;
|
|
114
|
+
label: z.ZodString;
|
|
115
115
|
entryId: z.ZodString;
|
|
116
116
|
}, z.core.$strip>>;
|
|
117
117
|
section: z.ZodEnum<{
|
|
@@ -44,18 +44,18 @@ type SubagentTemplateSummary = z.infer<typeof SubagentTemplateSummarySchema>;
|
|
|
44
44
|
*/
|
|
45
45
|
declare const SubagentTemplateCreateSchema: z.ZodObject<{
|
|
46
46
|
name: z.ZodString;
|
|
47
|
-
adapterName: z.ZodString;
|
|
48
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
49
|
-
model: z.ZodOptional<z.ZodString>;
|
|
50
47
|
providerConfigId: z.ZodOptional<z.ZodString>;
|
|
48
|
+
model: z.ZodOptional<z.ZodString>;
|
|
51
49
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
52
50
|
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
51
|
disallowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
52
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
54
53
|
allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
55
54
|
contextMode: z.ZodDefault<z.ZodEnum<{
|
|
56
55
|
fork: "fork";
|
|
57
56
|
fresh: "fresh";
|
|
58
57
|
}>>;
|
|
58
|
+
adapterName: z.ZodString;
|
|
59
59
|
}, z.core.$strip>;
|
|
60
60
|
type SubagentTemplateCreate = z.infer<typeof SubagentTemplateCreateSchema>;
|
|
61
61
|
/**
|
|
@@ -129,18 +129,18 @@ declare const SubagentTemplateSettingsSchemas: {
|
|
|
129
129
|
create: {
|
|
130
130
|
request: z.ZodObject<{
|
|
131
131
|
name: z.ZodString;
|
|
132
|
-
adapterName: z.ZodString;
|
|
133
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
134
|
-
model: z.ZodOptional<z.ZodString>;
|
|
135
132
|
providerConfigId: z.ZodOptional<z.ZodString>;
|
|
133
|
+
model: z.ZodOptional<z.ZodString>;
|
|
136
134
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
137
135
|
allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
138
136
|
disallowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
137
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
139
138
|
allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
140
139
|
contextMode: z.ZodDefault<z.ZodEnum<{
|
|
141
140
|
fork: "fork";
|
|
142
141
|
fresh: "fresh";
|
|
143
142
|
}>>;
|
|
143
|
+
adapterName: z.ZodString;
|
|
144
144
|
}, z.core.$strip>;
|
|
145
145
|
response: z.ZodObject<{
|
|
146
146
|
id: z.ZodString;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { S as ProviderConfigFileRecordSchema, _ as BindingRecord, a as CanonicalProviderConfigPatchSchema, b as EffectiveAdapterSchema, c as CreateCanonicalProviderConfigInputSchema, d as ProviderConfigFileSet, f as AdapterFileConfig, g as AdapterSubsystemSchemas, h as AdapterReadinessSchema, i as CanonicalProviderConfigPatch, l as AdapterFileConfigSet, m as AdapterReadiness, n as CanonicalProviderConfigCredentialRefsPayload, o as CreateCanonicalProviderConfigInput, p as AdapterFileConfigSchema, r as CanonicalProviderConfigCredentialRefsSchema, s as CreateCanonicalProviderConfigInputPayload, t as CanonicalProviderConfigCredentialRefs, u as IAdapterConfigRepository, v as BindingRecordSchema, x as ProviderConfigFileRecord, y as EffectiveAdapter } from "../../index-
|
|
2
|
-
import { n as AdapterSubsystemSubjects, t as AdapterSubsystemNamespace } from "../../namespace-
|
|
1
|
+
import { S as ProviderConfigFileRecordSchema, _ as BindingRecord, a as CanonicalProviderConfigPatchSchema, b as EffectiveAdapterSchema, c as CreateCanonicalProviderConfigInputSchema, d as ProviderConfigFileSet, f as AdapterFileConfig, g as AdapterSubsystemSchemas, h as AdapterReadinessSchema, i as CanonicalProviderConfigPatch, l as AdapterFileConfigSet, m as AdapterReadiness, n as CanonicalProviderConfigCredentialRefsPayload, o as CreateCanonicalProviderConfigInput, p as AdapterFileConfigSchema, r as CanonicalProviderConfigCredentialRefsSchema, s as CreateCanonicalProviderConfigInputPayload, t as CanonicalProviderConfigCredentialRefs, u as IAdapterConfigRepository, v as BindingRecordSchema, x as ProviderConfigFileRecord, y as EffectiveAdapter } from "../../index-BVMF3kRv.mjs";
|
|
2
|
+
import { n as AdapterSubsystemSubjects, t as AdapterSubsystemNamespace } from "../../namespace-CWgNi8Gv.mjs";
|
|
3
3
|
export { AdapterFileConfig, AdapterFileConfigSchema, AdapterFileConfigSet, AdapterReadiness, AdapterReadinessSchema, AdapterSubsystemNamespace, AdapterSubsystemSchemas, AdapterSubsystemSubjects, BindingRecord, BindingRecordSchema, CanonicalProviderConfigCredentialRefs, CanonicalProviderConfigCredentialRefsPayload, CanonicalProviderConfigCredentialRefsSchema, CanonicalProviderConfigPatch, CanonicalProviderConfigPatchSchema, CreateCanonicalProviderConfigInput, CreateCanonicalProviderConfigInputPayload, CreateCanonicalProviderConfigInputSchema, EffectiveAdapter, EffectiveAdapterSchema, IAdapterConfigRepository, ProviderConfigFileRecord, ProviderConfigFileRecordSchema, ProviderConfigFileSet };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as AdapterSubsystemSubjects, t as AdapterSubsystemNamespace } from "../../namespace-
|
|
1
|
+
import { n as AdapterSubsystemSubjects, t as AdapterSubsystemNamespace } from "../../namespace-CWgNi8Gv.mjs";
|
|
2
2
|
export { AdapterSubsystemNamespace, AdapterSubsystemSubjects };
|
|
@@ -66,8 +66,8 @@ declare const ContextRuleActionSchema: z.ZodType<ContextRuleAction, ContextRuleA
|
|
|
66
66
|
* Persisted context-rule scope levels.
|
|
67
67
|
*/
|
|
68
68
|
declare const ContextRuleScopeSchema: z.ZodEnum<{
|
|
69
|
-
global: "global";
|
|
70
69
|
session: "session";
|
|
70
|
+
global: "global";
|
|
71
71
|
project: "project";
|
|
72
72
|
}>;
|
|
73
73
|
/**
|
|
@@ -101,8 +101,8 @@ declare const ContextRuleListQuerySchema: z.ZodObject<{
|
|
|
101
101
|
*/
|
|
102
102
|
declare const ContextRuleScopeIdentitySchema: z.ZodObject<{
|
|
103
103
|
scope: z.ZodEnum<{
|
|
104
|
-
global: "global";
|
|
105
104
|
session: "session";
|
|
105
|
+
global: "global";
|
|
106
106
|
project: "project";
|
|
107
107
|
}>;
|
|
108
108
|
projectId: z.ZodNullable<z.ZodString>;
|
|
@@ -160,14 +160,14 @@ declare const ResolvedContextRulesSchema: z.ZodObject<{
|
|
|
160
160
|
declare const ContextRuleChangedEventSchema: z.ZodObject<{
|
|
161
161
|
ruleId: z.ZodString;
|
|
162
162
|
changeType: z.ZodEnum<{
|
|
163
|
-
created: "created";
|
|
164
163
|
updated: "updated";
|
|
164
|
+
created: "created";
|
|
165
165
|
deleted: "deleted";
|
|
166
166
|
}>;
|
|
167
167
|
previous: z.ZodNullable<z.ZodObject<{
|
|
168
168
|
scope: z.ZodEnum<{
|
|
169
|
-
global: "global";
|
|
170
169
|
session: "session";
|
|
170
|
+
global: "global";
|
|
171
171
|
project: "project";
|
|
172
172
|
}>;
|
|
173
173
|
projectId: z.ZodNullable<z.ZodString>;
|
|
@@ -175,8 +175,8 @@ declare const ContextRuleChangedEventSchema: z.ZodObject<{
|
|
|
175
175
|
}, z.core.$strict>>;
|
|
176
176
|
current: z.ZodNullable<z.ZodObject<{
|
|
177
177
|
scope: z.ZodEnum<{
|
|
178
|
-
global: "global";
|
|
179
178
|
session: "session";
|
|
179
|
+
global: "global";
|
|
180
180
|
project: "project";
|
|
181
181
|
}>;
|
|
182
182
|
projectId: z.ZodNullable<z.ZodString>;
|
|
@@ -313,14 +313,14 @@ declare const ContextRulesServiceNamespace: _$_makaio_core0.BusNamespaceDefiniti
|
|
|
313
313
|
changed: _$zod.ZodObject<{
|
|
314
314
|
ruleId: _$zod.ZodString;
|
|
315
315
|
changeType: _$zod.ZodEnum<{
|
|
316
|
-
created: "created";
|
|
317
316
|
updated: "updated";
|
|
317
|
+
created: "created";
|
|
318
318
|
deleted: "deleted";
|
|
319
319
|
}>;
|
|
320
320
|
previous: _$zod.ZodNullable<_$zod.ZodObject<{
|
|
321
321
|
scope: _$zod.ZodEnum<{
|
|
322
|
-
global: "global";
|
|
323
322
|
session: "session";
|
|
323
|
+
global: "global";
|
|
324
324
|
project: "project";
|
|
325
325
|
}>;
|
|
326
326
|
projectId: _$zod.ZodNullable<_$zod.ZodString>;
|
|
@@ -328,8 +328,8 @@ declare const ContextRulesServiceNamespace: _$_makaio_core0.BusNamespaceDefiniti
|
|
|
328
328
|
}, _$zod_v4_core0.$strict>>;
|
|
329
329
|
current: _$zod.ZodNullable<_$zod.ZodObject<{
|
|
330
330
|
scope: _$zod.ZodEnum<{
|
|
331
|
-
global: "global";
|
|
332
331
|
session: "session";
|
|
332
|
+
global: "global";
|
|
333
333
|
project: "project";
|
|
334
334
|
}>;
|
|
335
335
|
projectId: _$zod.ZodNullable<_$zod.ZodString>;
|
|
@@ -383,14 +383,14 @@ declare const ContextRulesServiceSubjects: _$_makaio_core0.BusSubjects<_$_makaio
|
|
|
383
383
|
changed: _$zod.ZodObject<{
|
|
384
384
|
ruleId: _$zod.ZodString;
|
|
385
385
|
changeType: _$zod.ZodEnum<{
|
|
386
|
-
created: "created";
|
|
387
386
|
updated: "updated";
|
|
387
|
+
created: "created";
|
|
388
388
|
deleted: "deleted";
|
|
389
389
|
}>;
|
|
390
390
|
previous: _$zod.ZodNullable<_$zod.ZodObject<{
|
|
391
391
|
scope: _$zod.ZodEnum<{
|
|
392
|
-
global: "global";
|
|
393
392
|
session: "session";
|
|
393
|
+
global: "global";
|
|
394
394
|
project: "project";
|
|
395
395
|
}>;
|
|
396
396
|
projectId: _$zod.ZodNullable<_$zod.ZodString>;
|
|
@@ -398,8 +398,8 @@ declare const ContextRulesServiceSubjects: _$_makaio_core0.BusSubjects<_$_makaio
|
|
|
398
398
|
}, _$zod_v4_core0.$strict>>;
|
|
399
399
|
current: _$zod.ZodNullable<_$zod.ZodObject<{
|
|
400
400
|
scope: _$zod.ZodEnum<{
|
|
401
|
-
global: "global";
|
|
402
401
|
session: "session";
|
|
402
|
+
global: "global";
|
|
403
403
|
project: "project";
|
|
404
404
|
}>;
|
|
405
405
|
projectId: _$zod.ZodNullable<_$zod.ZodString>;
|
|
@@ -10,18 +10,18 @@ declare const FsNamespace: _$_makaio_core0.BusNamespaceDefinition<"fs", {
|
|
|
10
10
|
changed: _$zod.ZodObject<{
|
|
11
11
|
path: _$zod.ZodString;
|
|
12
12
|
kind: _$zod.ZodEnum<{
|
|
13
|
-
delete: "delete";
|
|
14
|
-
create: "create";
|
|
15
13
|
change: "change";
|
|
14
|
+
create: "create";
|
|
15
|
+
delete: "delete";
|
|
16
16
|
}>;
|
|
17
17
|
}, _$zod_v4_core0.$strip>;
|
|
18
18
|
batch: _$zod.ZodObject<{
|
|
19
19
|
changes: _$zod.ZodArray<_$zod.ZodObject<{
|
|
20
20
|
path: _$zod.ZodString;
|
|
21
21
|
kind: _$zod.ZodEnum<{
|
|
22
|
-
delete: "delete";
|
|
23
|
-
create: "create";
|
|
24
22
|
change: "change";
|
|
23
|
+
create: "create";
|
|
24
|
+
delete: "delete";
|
|
25
25
|
}>;
|
|
26
26
|
}, _$zod_v4_core0.$strip>>;
|
|
27
27
|
}, _$zod_v4_core0.$strip>;
|
|
@@ -153,18 +153,18 @@ declare const FsSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.FlatSubjec
|
|
|
153
153
|
changed: _$zod.ZodObject<{
|
|
154
154
|
path: _$zod.ZodString;
|
|
155
155
|
kind: _$zod.ZodEnum<{
|
|
156
|
-
delete: "delete";
|
|
157
|
-
create: "create";
|
|
158
156
|
change: "change";
|
|
157
|
+
create: "create";
|
|
158
|
+
delete: "delete";
|
|
159
159
|
}>;
|
|
160
160
|
}, _$zod_v4_core0.$strip>;
|
|
161
161
|
batch: _$zod.ZodObject<{
|
|
162
162
|
changes: _$zod.ZodArray<_$zod.ZodObject<{
|
|
163
163
|
path: _$zod.ZodString;
|
|
164
164
|
kind: _$zod.ZodEnum<{
|
|
165
|
-
delete: "delete";
|
|
166
|
-
create: "create";
|
|
167
165
|
change: "change";
|
|
166
|
+
create: "create";
|
|
167
|
+
delete: "delete";
|
|
168
168
|
}>;
|
|
169
169
|
}, _$zod_v4_core0.$strip>>;
|
|
170
170
|
}, _$zod_v4_core0.$strip>;
|
|
@@ -294,18 +294,18 @@ declare const FileSystemSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.Fl
|
|
|
294
294
|
changed: _$zod.ZodObject<{
|
|
295
295
|
path: _$zod.ZodString;
|
|
296
296
|
kind: _$zod.ZodEnum<{
|
|
297
|
-
delete: "delete";
|
|
298
|
-
create: "create";
|
|
299
297
|
change: "change";
|
|
298
|
+
create: "create";
|
|
299
|
+
delete: "delete";
|
|
300
300
|
}>;
|
|
301
301
|
}, _$zod_v4_core0.$strip>;
|
|
302
302
|
batch: _$zod.ZodObject<{
|
|
303
303
|
changes: _$zod.ZodArray<_$zod.ZodObject<{
|
|
304
304
|
path: _$zod.ZodString;
|
|
305
305
|
kind: _$zod.ZodEnum<{
|
|
306
|
-
delete: "delete";
|
|
307
|
-
create: "create";
|
|
308
306
|
change: "change";
|
|
307
|
+
create: "create";
|
|
308
|
+
delete: "delete";
|
|
309
309
|
}>;
|
|
310
310
|
}, _$zod_v4_core0.$strip>>;
|
|
311
311
|
}, _$zod_v4_core0.$strip>;
|
|
@@ -5,9 +5,9 @@ import { z } from "zod";
|
|
|
5
5
|
* File change kind.
|
|
6
6
|
*/
|
|
7
7
|
declare const FsChangeKindSchema: z.ZodEnum<{
|
|
8
|
-
delete: "delete";
|
|
9
|
-
create: "create";
|
|
10
8
|
change: "change";
|
|
9
|
+
create: "create";
|
|
10
|
+
delete: "delete";
|
|
11
11
|
}>;
|
|
12
12
|
type FsChangeKind = z.infer<typeof FsChangeKindSchema>;
|
|
13
13
|
/**
|
|
@@ -16,9 +16,9 @@ type FsChangeKind = z.infer<typeof FsChangeKindSchema>;
|
|
|
16
16
|
declare const FsChangedSchema: z.ZodObject<{
|
|
17
17
|
path: z.ZodString;
|
|
18
18
|
kind: z.ZodEnum<{
|
|
19
|
-
delete: "delete";
|
|
20
|
-
create: "create";
|
|
21
19
|
change: "change";
|
|
20
|
+
create: "create";
|
|
21
|
+
delete: "delete";
|
|
22
22
|
}>;
|
|
23
23
|
}, z.core.$strip>;
|
|
24
24
|
type FsChanged = z.infer<typeof FsChangedSchema>;
|
|
@@ -29,9 +29,9 @@ declare const FsBatchSchema: z.ZodObject<{
|
|
|
29
29
|
changes: z.ZodArray<z.ZodObject<{
|
|
30
30
|
path: z.ZodString;
|
|
31
31
|
kind: z.ZodEnum<{
|
|
32
|
-
delete: "delete";
|
|
33
|
-
create: "create";
|
|
34
32
|
change: "change";
|
|
33
|
+
create: "create";
|
|
34
|
+
delete: "delete";
|
|
35
35
|
}>;
|
|
36
36
|
}, z.core.$strip>>;
|
|
37
37
|
}, z.core.$strip>;
|