@codemation/core 0.14.0 → 0.15.0

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.
Files changed (208) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/dist/{CostCatalogContract-B9aYIqJu.d.cts → CostCatalogContract-Dwo-ZamG.d.cts} +2 -2
  3. package/dist/EngineRuntimeRegistration.types-BiNasx3G.d.cts +54 -0
  4. package/dist/EngineRuntimeRegistration.types-Dq4ucrdo.d.ts +21 -0
  5. package/dist/{InMemoryRunDataFactory-C3rIszrW.d.cts → InMemoryRunDataFactory-D2U9azmZ.d.cts} +2 -20
  6. package/dist/{InMemoryRunEventBusRegistry-Sa86VxuV.cjs → InMemoryRunEventBusRegistry-DO0WM9Lw.cjs} +1 -1
  7. package/dist/{InMemoryRunEventBusRegistry-Sa86VxuV.cjs.map → InMemoryRunEventBusRegistry-DO0WM9Lw.cjs.map} +1 -1
  8. package/dist/{InMemoryRunEventBusRegistry-Bwunvt1T.js → InMemoryRunEventBusRegistry-Layt2xgm.js} +1 -1
  9. package/dist/{InMemoryRunEventBusRegistry-Bwunvt1T.js.map → InMemoryRunEventBusRegistry-Layt2xgm.js.map} +1 -1
  10. package/dist/{ItemsInputNormalizer-UCpn7luX.d.cts → ItemsInputNormalizer-A5txcOWX.d.cts} +3 -98
  11. package/dist/{ItemsInputNormalizer-B9SdLG24.cjs → ItemsInputNormalizer-C1fv3sMW.cjs} +2 -2
  12. package/dist/ItemsInputNormalizer-C1fv3sMW.cjs.map +1 -0
  13. package/dist/{ItemsInputNormalizer-DoOawd9R.d.ts → ItemsInputNormalizer-D2vrMrX1.d.ts} +2 -62
  14. package/dist/{ItemsInputNormalizer-CZEODg94.js → ItemsInputNormalizer-fUYo4GLV.js} +2 -2
  15. package/dist/ItemsInputNormalizer-fUYo4GLV.js.map +1 -0
  16. package/dist/{RunIntentService-0f3ICjAz.d.cts → RunIntentService-DKxuHTUz.d.cts} +2 -15
  17. package/dist/{RunIntentService-Dx_HHxDX.d.ts → RunIntentService-DrpKli2k.d.ts} +2 -22
  18. package/dist/{agentMcpTypes-B11B3Hd-.d.cts → agentMcpTypes-BHX4RQCC.d.cts} +24 -524
  19. package/dist/bootstrap/index.cjs +9 -5
  20. package/dist/bootstrap/index.d.cts +32 -106
  21. package/dist/bootstrap/index.d.ts +18 -17
  22. package/dist/bootstrap/index.js +6 -5
  23. package/dist/{bootstrap-Be0LB0nh.cjs → bootstrap-CTB53rEF.cjs} +9 -60
  24. package/dist/bootstrap-CTB53rEF.cjs.map +1 -0
  25. package/dist/{bootstrap-pSQdsMfa.js → bootstrap-DmqKheCI.js} +6 -57
  26. package/dist/bootstrap-DmqKheCI.js.map +1 -0
  27. package/dist/browser.cjs +12 -11
  28. package/dist/browser.d.cts +4 -4
  29. package/dist/browser.d.ts +3 -3
  30. package/dist/browser.js +3 -2
  31. package/dist/contracts-7L1wJHdk.cjs +569 -0
  32. package/dist/contracts-7L1wJHdk.cjs.map +1 -0
  33. package/dist/contracts-CjJ5CZ7N.js +447 -0
  34. package/dist/contracts-CjJ5CZ7N.js.map +1 -0
  35. package/dist/contracts.cjs +9 -2
  36. package/dist/contracts.d.cts +5 -5
  37. package/dist/contracts.d.ts +2 -2
  38. package/dist/contracts.js +3 -2
  39. package/dist/{executionPersistenceContracts-CX9Ql8N1.d.cts → deploymentManifestTypes-B8CDmZZK.d.cts} +65 -81
  40. package/dist/di-C6Ubf9o5.cjs +179 -0
  41. package/dist/di-C6Ubf9o5.cjs.map +1 -0
  42. package/dist/di-Cjiil7U-.js +114 -0
  43. package/dist/di-Cjiil7U-.js.map +1 -0
  44. package/dist/{index-CbJdbIHe.d.ts → index-CRv3_pY3.d.ts} +87 -870
  45. package/dist/{index-uPnD9EE6.d.ts → index-mnLS0iQl.d.ts} +27 -400
  46. package/dist/index.cjs +44 -115
  47. package/dist/index.cjs.map +1 -1
  48. package/dist/index.d.cts +17 -524
  49. package/dist/index.d.ts +5 -5
  50. package/dist/index.js +21 -98
  51. package/dist/index.js.map +1 -1
  52. package/dist/{params-Dwl10Ws9.d.cts → params-CrK4iuG1.d.cts} +2 -11
  53. package/dist/{runtime-CSunvf7A.js → runtime-CBFDpmiz.js} +46 -679
  54. package/dist/runtime-CBFDpmiz.js.map +1 -0
  55. package/dist/{runtime-n2tqRwaf.cjs → runtime-Due-FOZ2.cjs} +69 -752
  56. package/dist/runtime-Due-FOZ2.cjs.map +1 -0
  57. package/dist/testing.cjs +8 -40
  58. package/dist/testing.cjs.map +1 -1
  59. package/dist/testing.d.cts +3 -32
  60. package/dist/testing.d.ts +3 -32
  61. package/dist/testing.js +6 -38
  62. package/dist/testing.js.map +1 -1
  63. package/dist/{di-DhwtDRgs.cjs → workflowTypes-BW6Hhee7.cjs} +4 -229
  64. package/dist/workflowTypes-BW6Hhee7.cjs.map +1 -0
  65. package/dist/{di-CEV6wTc4.js → workflowTypes-DZtBTmKf.js} +3 -162
  66. package/dist/workflowTypes-DZtBTmKf.js.map +1 -0
  67. package/package.json +1 -1
  68. package/src/ai/AgentConnectionNodeCollector.ts +0 -4
  69. package/src/ai/AgentMessageConfigNormalizerFactory.ts +0 -4
  70. package/src/ai/AiHost.ts +0 -38
  71. package/src/ai/CallableToolConfig.ts +0 -9
  72. package/src/ai/CallableToolKindToken.ts +0 -4
  73. package/src/authoring/callableTool.types.ts +0 -3
  74. package/src/authoring/defineCollection.types.ts +0 -11
  75. package/src/authoring/defineHumanApprovalNode.types.ts +0 -116
  76. package/src/authoring/defineNode.types.ts +0 -25
  77. package/src/authoring/definePollingTrigger.types.ts +18 -152
  78. package/src/authoring/definePollingTriggerInternals.ts +0 -4
  79. package/src/authoring/nodeBaseOptions.types.ts +0 -14
  80. package/src/binaries/boundedReadBinary.types.ts +0 -16
  81. package/src/bootstrap/index.ts +8 -2
  82. package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +0 -5
  83. package/src/bootstrap/runtime/EngineRuntimeRegistration.types.ts +0 -23
  84. package/src/browser.ts +0 -3
  85. package/src/contracts/AgentBindError.ts +0 -5
  86. package/src/contracts/Clock.ts +0 -1
  87. package/src/contracts/CodemationTelemetryAttributeNames.ts +0 -10
  88. package/src/contracts/NoOpAgentMcpIntegration.ts +0 -6
  89. package/src/contracts/NoOpTelemetrySpanScope.ts +0 -7
  90. package/src/contracts/RetryPolicy.ts +0 -2
  91. package/src/contracts/agentMcpTypes.ts +0 -34
  92. package/src/contracts/assertionTypes.ts +0 -33
  93. package/src/contracts/baseTypes.ts +0 -6
  94. package/src/contracts/collectionTypes.ts +0 -25
  95. package/src/contracts/credentialTypes.ts +13 -60
  96. package/src/contracts/deploymentManifestTypes.ts +158 -0
  97. package/src/contracts/dispatchTypes.ts +29 -0
  98. package/src/contracts/executionPersistenceContracts.ts +0 -33
  99. package/src/contracts/hitlSeamTypes.ts +0 -14
  100. package/src/contracts/humanTaskStoreTypes.ts +0 -2
  101. package/src/contracts/inboxChannelTypes.ts +0 -9
  102. package/src/contracts/index.ts +3 -0
  103. package/src/contracts/itemExpr.ts +0 -18
  104. package/src/contracts/itemMeta.ts +0 -3
  105. package/src/contracts/mcpTypes.ts +0 -16
  106. package/src/contracts/retryPolicySpec.types.ts +0 -10
  107. package/src/contracts/runFinishedAtFactory.ts +0 -1
  108. package/src/contracts/runTypes.ts +0 -74
  109. package/src/contracts/runtimeTypes.ts +4 -131
  110. package/src/contracts/telemetryTypes.ts +0 -7
  111. package/src/contracts/testTriggerTypes.ts +0 -43
  112. package/src/contracts/triggerInvokerTypes.ts +6 -0
  113. package/src/contracts/webhookTypes.ts +0 -8
  114. package/src/contracts/workflowActivationPolicy.ts +0 -5
  115. package/src/contracts/workflowTypes.ts +4 -86
  116. package/src/contracts/workspaceFileTypes.ts +0 -72
  117. package/src/contracts.ts +18 -10
  118. package/src/credentials/CredentialMaterialProvider.types.ts +0 -28
  119. package/src/credentials/ManagedCredentialMaterialWriteError.ts +0 -6
  120. package/src/credentials/ManagedMaterialFetchError.ts +0 -6
  121. package/src/credentials/OAuthFlowExecutor.types.ts +0 -15
  122. package/src/di/CoreTokens.ts +2 -6
  123. package/src/events/ConnectionInvocationEventPublisher.ts +0 -7
  124. package/src/events/NodeEventPublisher.ts +0 -1
  125. package/src/events/runEvents.ts +0 -8
  126. package/src/execution/ActivationEnqueueService.ts +0 -10
  127. package/src/execution/ChildExecutionScopeFactory.ts +0 -13
  128. package/src/execution/FanInMergeByOriginMerger.ts +0 -11
  129. package/src/execution/InProcessRetryRunner.ts +0 -1
  130. package/src/execution/ItemExprResolver.ts +0 -3
  131. package/src/execution/NodeActivationRequestComposer.ts +0 -3
  132. package/src/execution/NodeActivationRequestInputPreparer.ts +0 -5
  133. package/src/execution/NodeExecutionSnapshotFactory.ts +0 -1
  134. package/src/execution/NodeExecutor.ts +1 -17
  135. package/src/execution/NodeSuspensionHandler.ts +1 -39
  136. package/src/execution/PersistedRunStateTerminalBuilder.ts +0 -5
  137. package/src/execution/RunSuspendedError.ts +0 -10
  138. package/src/execution/WorkflowRunExecutionContextFactory.ts +0 -3
  139. package/src/orchestration/AbortControllerFactory.ts +0 -4
  140. package/src/orchestration/Engine.ts +0 -9
  141. package/src/orchestration/NodeExecutionRequestHandlerService.ts +3 -4
  142. package/src/orchestration/RunContinuationService.ts +7 -39
  143. package/src/orchestration/RunStartService.ts +0 -7
  144. package/src/orchestration/TestSuiteOrchestrator.ts +0 -18
  145. package/src/orchestration/TestSuiteRunIdFactory.ts +0 -4
  146. package/src/orchestration/TriggerRuntimeService.ts +3 -2
  147. package/src/planning/CurrentStateFrontierPlanner.ts +0 -1
  148. package/src/planning/RunQueuePlanner.ts +0 -6
  149. package/src/policies/executionLimits/EngineExecutionLimitsPolicy.ts +0 -8
  150. package/src/policies/executionLimits/EngineExecutionLimitsPolicyFactory.ts +0 -3
  151. package/src/runStorage/RunSummaryMapper.ts +0 -1
  152. package/src/runtime/EngineFactory.ts +6 -11
  153. package/src/runtime/RunIntentService.ts +0 -4
  154. package/src/runtime/WorkflowRepositoryWebhookTriggerMatcher.ts +0 -4
  155. package/src/runtime-types/InjectableRuntimeDecoratorComposerRegistry.ts +0 -4
  156. package/src/runtime-types/PersistedRuntimeTypeMetadataStoreRegistry.ts +0 -4
  157. package/src/runtime-types/PersistedRuntimeTypeNameResolver.ts +0 -1
  158. package/src/runtime-types/persistedRuntimeTypeModelRegistry.ts +0 -4
  159. package/src/runtime-types/runtimeTypeDecorators.types.ts +0 -12
  160. package/src/scheduler/ConfigDrivenOffloadPolicy.ts +0 -1
  161. package/src/scheduler/DefaultDrivingScheduler.ts +0 -6
  162. package/src/scheduler/InlineDrivingScheduler.ts +0 -13
  163. package/src/serialization/ItemsInputNormalizer.ts +0 -5
  164. package/src/testing/CapturingScheduler.ts +0 -3
  165. package/src/testing/EngineTestKitRunIdFactory.ts +0 -3
  166. package/src/testing/ItemHarnessNode.ts +0 -3
  167. package/src/testing/ItemHarnessNodeConfig.ts +0 -4
  168. package/src/testing/PrefixedSequentialIdGenerator.ts +0 -3
  169. package/src/testing/RegistrarEngineTestKit.types.ts +0 -2
  170. package/src/testing/RejectingCredentialSessionService.ts +0 -4
  171. package/src/testing/SubWorkflowRunnerTestNode.ts +0 -3
  172. package/src/testing/WorkflowTestHarnessManualTrigger.ts +0 -3
  173. package/src/testing/WorkflowTestKitBuilder.ts +0 -4
  174. package/src/testing/WorkflowTestKitRunNodeWorkflowFactory.ts +0 -3
  175. package/src/testing.ts +0 -3
  176. package/src/triggers/polling/PollingTriggerDedupWindow.ts +0 -4
  177. package/src/triggers/polling/PollingTriggerLogger.ts +0 -5
  178. package/src/triggers/polling/PollingTriggerRuntime.ts +0 -5
  179. package/src/types/index.ts +0 -6
  180. package/src/validation/WorkflowEdgePortValidator.ts +0 -5
  181. package/src/workflow/definition/ConnectionInvocationIdFactory.ts +0 -7
  182. package/src/workflow/definition/ConnectionNodeIdFactory.ts +0 -6
  183. package/src/workflow/definition/NodeIterationIdFactory.ts +0 -13
  184. package/src/workflow/definition/WorkflowExecutableNodeClassifier.ts +0 -6
  185. package/src/workflow/dsl/ChainCursorResolver.ts +0 -20
  186. package/src/workflow/dsl/NodeIdSlugifier.ts +0 -9
  187. package/src/workflow/dsl/WhenBuilder.ts +0 -17
  188. package/src/workflow/dsl/WorkflowDefinitionError.ts +0 -9
  189. package/src/workflow/dsl/workflowBuilderTypes.ts +0 -24
  190. package/src/workflowSnapshots/MissingRuntimeParityGuard.ts +24 -0
  191. package/src/workflowSnapshots/PersistedWorkflowTokenRegistry.ts +0 -6
  192. package/src/workflowSnapshots/WorkflowParityMismatchError.ts +18 -0
  193. package/src/workflowSnapshots/WorkflowSnapshotCodec.ts +0 -5
  194. package/src/workflowSnapshots/index.ts +3 -0
  195. package/dist/EngineRuntimeRegistration.types-BYAmGMdS.d.cts +0 -81
  196. package/dist/EngineRuntimeRegistration.types-CVLI8DsJ.d.ts +0 -44
  197. package/dist/ItemsInputNormalizer-B9SdLG24.cjs.map +0 -1
  198. package/dist/ItemsInputNormalizer-CZEODg94.js.map +0 -1
  199. package/dist/bootstrap-Be0LB0nh.cjs.map +0 -1
  200. package/dist/bootstrap-pSQdsMfa.js.map +0 -1
  201. package/dist/contracts-CK0x6w_G.cjs +0 -74
  202. package/dist/contracts-CK0x6w_G.cjs.map +0 -1
  203. package/dist/contracts-DXdfTdpW.js +0 -50
  204. package/dist/contracts-DXdfTdpW.js.map +0 -1
  205. package/dist/di-CEV6wTc4.js.map +0 -1
  206. package/dist/di-DhwtDRgs.cjs.map +0 -1
  207. package/dist/runtime-CSunvf7A.js.map +0 -1
  208. package/dist/runtime-n2tqRwaf.cjs.map +0 -1
@@ -7,16 +7,12 @@ import type {
7
7
  RunStatus,
8
8
  } from "./runTypes";
9
9
 
10
- /** Canonical id for persisted execution rows (activation or connection invocation). */
11
10
  export type ExecutionInstanceId = string;
12
11
 
13
- /** Stable id for persisted work-queue rows. */
14
12
  export type WorkItemId = string;
15
13
 
16
- /** Batch grouping for planner activations. */
17
14
  export type BatchId = string;
18
15
 
19
- /** Optimistic concurrency on the run root. */
20
16
  export type RunRevision = number;
21
17
 
22
18
  export type PersistedRunWorkItemKind = "queue" | "pending";
@@ -29,10 +25,6 @@ export type ConnectionInvocationKind = "languageModel" | "tool" | "nestedAgent";
29
25
 
30
26
  export type PayloadStorageKind = "inline" | "external" | "omitted";
31
27
 
32
- /**
33
- * Persisted run-work-queue row (queue entry or pending activation).
34
- * Serialized to {@link RunWorkItem} in Prisma; engine still uses {@link PersistedRunState} queue + pending.
35
- */
36
28
  export interface PersistedRunWorkItemRecord {
37
29
  readonly workItemId: WorkItemId;
38
30
  readonly runId: RunId;
@@ -51,14 +43,10 @@ export interface PersistedRunWorkItemRecord {
51
43
  readonly sourceInstanceId?: ExecutionInstanceId;
52
44
  readonly parentInstanceId?: ExecutionInstanceId;
53
45
  readonly itemsIn: number;
54
- /** Queue entry when kind is queue; pending activation when kind is pending. */
55
46
  readonly payloadJson: string;
56
47
  readonly error?: Readonly<NodeExecutionError>;
57
48
  }
58
49
 
59
- /**
60
- * Payload policy fields for large-batch externalization (optional on first rollout).
61
- */
62
50
  export interface ExecutionPayloadPolicyFields {
63
51
  readonly inputStorageKind: PayloadStorageKind;
64
52
  readonly outputStorageKind: PayloadStorageKind;
@@ -72,9 +60,6 @@ export interface ExecutionPayloadPolicyFields {
72
60
  readonly outputTruncated?: boolean;
73
61
  }
74
62
 
75
- /**
76
- * One persisted execution row (workflow node activation or connection invocation).
77
- */
78
63
  export interface PersistedExecutionInstanceRecord {
79
64
  readonly instanceId: ExecutionInstanceId;
80
65
  readonly runId: RunId;
@@ -110,9 +95,6 @@ export interface PersistedExecutionInstanceRecord {
110
95
  readonly payloadPolicy?: ExecutionPayloadPolicyFields;
111
96
  }
112
97
 
113
- /**
114
- * Cached slot projection for planner/debugger/UI (not canonical history).
115
- */
116
98
  export interface RunSlotProjectionState {
117
99
  readonly runId: RunId;
118
100
  readonly workflowId: WorkflowId;
@@ -151,12 +133,6 @@ export interface WorkflowRunDetailDto {
151
133
  readonly iterations?: ReadonlyArray<RunIterationDto>;
152
134
  }
153
135
 
154
- /**
155
- * Per-item iteration projected from connection invocations and node activations.
156
- *
157
- * One iteration = one item processed by an agent within an activation. Multiple invocations
158
- * (LLM rounds, tool calls) belonging to the same iteration share the iterationId.
159
- */
160
136
  export interface RunIterationDto {
161
137
  readonly iterationId: string;
162
138
  readonly agentNodeId: NodeId;
@@ -168,9 +144,7 @@ export interface RunIterationDto {
168
144
  readonly finishedAt?: string;
169
145
  readonly invocationIds: ReadonlyArray<string>;
170
146
  readonly parentInvocationId?: string;
171
- /** Estimated cost rolled up from telemetry cost metric points, keyed by ISO currency code (e.g. "USD"). Values are minor units (cents-of-cents per the metric's `cost.currency_scale`). */
172
147
  readonly estimatedCostMinorByCurrency?: Readonly<Record<string, number>>;
173
- /** Currency scale (denominator) per currency, when present on the metric points. Joined with `estimatedCostMinorByCurrency` to format human-readable amounts. */
174
148
  readonly estimatedCostCurrencyScaleByCurrency?: Readonly<Record<string, number>>;
175
149
  }
176
150
 
@@ -202,16 +176,9 @@ export interface ExecutionInstanceDto {
202
176
  readonly inputJson?: JsonValue;
203
177
  readonly outputJson?: JsonValue;
204
178
  readonly error?: Readonly<NodeExecutionError>;
205
- /** Per-item iteration that produced this instance. Set on connectionInvocation rows produced inside per-item runnable loops. */
206
179
  readonly iterationId?: string;
207
- /** Item index (0-based) of the iteration. */
208
180
  readonly itemIndex?: number;
209
- /** Parent invocation id when this instance was emitted by a sub-agent triggered by an outer LLM/tool call. */
210
181
  readonly parentInvocationId?: string;
211
- /**
212
- * When this instance is a SubWorkflow node activation, the run id of the child run it spawned.
213
- * Used by the UI to deep-link directly to the child execution.
214
- */
215
182
  readonly childRunId?: string;
216
183
  }
217
184
 
@@ -1,18 +1,10 @@
1
1
  import type { TypeToken } from "../di";
2
2
 
3
- /**
4
- * Seam interfaces for HITL collaborators that are implemented in `@codemation/host`
5
- * and injected into `NodeSuspensionHandler` at runtime. Core defines the interface only —
6
- * no HTTP, vendor SDK, or Prisma dependencies here.
7
- */
8
-
9
- /** Signs and hashes a HITL resume token. Core only needs the sign and hash operations. */
10
3
  export interface HitlResumeTokenSignerSeam {
11
4
  sign(args: { taskId: string; expiresAt: Date; schemaHash: string }): string;
12
5
  hashToken(token: string): string;
13
6
  }
14
7
 
15
- /** Schedules a delayed BullMQ job that drives the timeout path. */
16
8
  export interface HitlTimeoutJobSchedulerSeam {
17
9
  enqueueTimeoutJob(args: { taskId: string; expiresAt: Date }): Promise<void>;
18
10
  }
@@ -25,10 +17,4 @@ export const HitlTimeoutJobSchedulerToken = Symbol.for("codemation.core.HitlTime
25
17
  HitlTimeoutJobSchedulerSeam | undefined
26
18
  >;
27
19
 
28
- /**
29
- * Optional workspace ID injected into NodeSuspensionHandler in managed mode (T7 security fix).
30
- * Allows the handler to stamp the workspaceId on each HumanTaskRecord so HitlCallbackHandler
31
- * can assert workspace identity independently of the HMAC middleware.
32
- * Not registered in non-managed mode; NodeSuspensionHandler defaults to null.
33
- */
34
20
  export const HitlWorkspaceIdToken = Symbol.for("codemation.core.HitlWorkspaceId") as TypeToken<string | undefined>;
@@ -4,7 +4,6 @@ import type { JsonValue } from "./workflowTypes";
4
4
 
5
5
  export type HumanTaskStatus = "pending" | "decided" | "timed_out" | "auto_accepted" | "cancelled";
6
6
 
7
- /** Persisted record for a single HITL task instance. */
8
7
  export interface HumanTaskRecord {
9
8
  readonly id: string;
10
9
  readonly runId: string;
@@ -34,7 +33,6 @@ export interface HumanTaskStore {
34
33
  findById(taskId: string): Promise<HumanTaskRecord | undefined>;
35
34
  findByResumeTokenHash(tokenHash: string): Promise<HumanTaskRecord | undefined>;
36
35
  findPendingForWorkspace(workspaceId: string): Promise<ReadonlyArray<HumanTaskRecord>>;
37
- /** Returns all pending tasks regardless of workspace. Used by the local dev inbox (non-managed mode). */
38
36
  findAllPending(): Promise<ReadonlyArray<HumanTaskRecord>>;
39
37
  markDecided(args: { taskId: string; decision: JsonValue; decidedBy: HumanTaskActor; decidedAt: Date }): Promise<void>;
40
38
  markTimedOut(taskId: string): Promise<void>;
@@ -2,10 +2,6 @@ import type { TypeToken } from "../di";
2
2
  import type { HumanTaskActor, HumanTaskHandle, HumanTaskSubject } from "./runtimeTypes";
3
3
  import type { Item } from "./workflowTypes";
4
4
 
5
- /**
6
- * A single inbox delivery channel.
7
- * Implementations: `LocalInboxChannel`, `ControlPlaneInboxChannel`.
8
- */
9
5
  export interface InboxChannel {
10
6
  readonly kind: "local" | "control-plane-inbox";
11
7
  deliver(args: InboxDeliverArgs): Promise<InboxDelivery>;
@@ -18,7 +14,6 @@ export type InboxDeliverArgs = Readonly<{
18
14
  subject: HumanTaskSubject;
19
15
  priority: "low" | "normal" | "high";
20
16
  item: Item;
21
- /** Present in managed mode (from `PairingConfig.workspaceId`). */
22
17
  workspaceId?: string;
23
18
  }>;
24
19
 
@@ -37,10 +32,6 @@ export type InboxOnTimeoutArgs = Readonly<{
37
32
  policy: "halt" | "auto-accept";
38
33
  }>;
39
34
 
40
- /**
41
- * Resolves the correct `InboxChannel` for the current deployment mode
42
- * (local dev vs. managed/CP). Implemented in `@codemation/host`.
43
- */
44
35
  export interface InboxChannelResolverSeam {
45
36
  resolve(): { channel: InboxChannel; workspaceId?: string };
46
37
  }
@@ -1,5 +1,7 @@
1
1
  export * from "./AgentBindError";
2
+ export * from "./dispatchTypes";
2
3
  export * from "./agentMcpTypes";
4
+ export * from "./deploymentManifestTypes";
3
5
  export * from "./hitlSeamTypes";
4
6
  export * from "./humanTaskStoreTypes";
5
7
  export * from "./inboxChannelTypes";
@@ -15,6 +17,7 @@ export * from "./itemMeta";
15
17
  export * from "./params";
16
18
  export * from "./itemExpr";
17
19
  export * from "./runtimeTypes";
20
+ export * from "./triggerInvokerTypes";
18
21
  export * from "./telemetryTypes";
19
22
  export * from "./testTriggerTypes";
20
23
  export * from "./runFinishedAtFactory";
@@ -1,12 +1,6 @@
1
1
  import type { NodeExecutionContext } from "./runtimeTypes";
2
2
  import type { Item, Items, NodeActivationId, NodeId, RunDataSnapshot, RunId, WorkflowId } from "./workflowTypes";
3
3
 
4
- // Structural string-literal brand (NOT a `unique symbol`): independently-bundled copies of
5
- // `ItemExpr` across node packages must be STRUCTURALLY identical to stay cross-assignable. A
6
- // `unique symbol` makes each bundled copy a nominally-distinct type, which breaks passing an
7
- // `itemExpr()` into a node-config field whose package resolved a different (duplicated) copy of
8
- // core. A plain string-literal property is identical across copies and also survives JSON.
9
-
10
4
  export type ItemExprResolvedContext = Readonly<{
11
5
  runId: RunId;
12
6
  workflowId: WorkflowId;
@@ -15,9 +9,6 @@ export type ItemExprResolvedContext = Readonly<{
15
9
  data: RunDataSnapshot;
16
10
  }>;
17
11
 
18
- /**
19
- * Context aligned with former {@link ItemInputMapperContext} — use **`data`** to read any completed upstream node.
20
- */
21
12
  export type ItemExprContext = ItemExprResolvedContext;
22
13
 
23
14
  export type ItemExprArgs<TItemJson = unknown> = Readonly<{
@@ -43,17 +34,14 @@ export function isItemExpr<T, TItemJson = unknown>(value: unknown): value is Ite
43
34
  return false;
44
35
  }
45
36
  const v = value as Record<PropertyKey, unknown>;
46
- // Current structural brand (a plain string property; survives JSON serialization).
47
37
  if (v["__codemationItemExpr"] === "codemation.itemExpr" && typeof v["fn"] === "function") {
48
38
  return true;
49
39
  }
50
- // Legacy: the old `Symbol.for("codemation.itemExpr")` brand (configs from an older core build).
51
40
  for (const sym of Object.getOwnPropertySymbols(v)) {
52
41
  if (sym.description === "codemation.itemExpr" && v[sym] === true) {
53
42
  return true;
54
43
  }
55
44
  }
56
- // Snapshot-hydrated wrappers where the brand was dropped but the callback survived.
57
45
  const keys = Object.keys(v);
58
46
  if (keys.length === 1 && keys[0] === "fn" && typeof (v as { fn?: unknown }).fn === "function") {
59
47
  return true;
@@ -83,9 +71,6 @@ function containsItemExprInUnknown(value: unknown, seen: WeakSet<object> = new W
83
71
  return false;
84
72
  }
85
73
 
86
- /**
87
- * Deep-resolves {@link itemExpr} leaves. Returns a new graph (does not mutate the original config object).
88
- */
89
74
  export async function resolveItemExprsInUnknown(
90
75
  value: unknown,
91
76
  args: ItemExprArgs,
@@ -121,9 +106,6 @@ export async function resolveItemExprsInUnknown(
121
106
  return out;
122
107
  }
123
108
 
124
- /**
125
- * Clones runnable config (best-effort) so per-item {@link itemExpr} resolution never mutates shared instances.
126
- */
127
109
  export async function resolveItemExprsForExecution(
128
110
  config: unknown,
129
111
  nodeCtx: NodeExecutionContext,
@@ -1,8 +1,5 @@
1
1
  import type { Item } from "./workflowTypes";
2
2
 
3
- /**
4
- * Reads `meta._cm.originIndex` when present (used for fan-in merge-by-origin and Merge routing).
5
- */
6
3
  export function getOriginIndexFromItem(item: Item): number | undefined {
7
4
  const meta = item.meta as Record<string, unknown> | undefined;
8
5
  const cm = meta?._cm as Record<string, unknown> | undefined;
@@ -1,29 +1,13 @@
1
1
  export type McpServerTransport = "http";
2
- // "stdio" is a self-host-only escape hatch (CODEMATION_ALLOW_STDIO_MCP=true); not typed here for managed.
3
2
 
4
3
  export interface McpServerDeclaration {
5
- /** Globally unique slug, e.g. "gmail". Workflow authors reference this. */
6
4
  id: string;
7
5
  displayName: string;
8
6
  description: string;
9
7
  transport: McpServerTransport;
10
8
  url: string;
11
- /**
12
- * Credential types accepted by this MCP server, matching CredentialRequirement.acceptedTypes.
13
- * Absent or empty means no credential is required.
14
- */
15
9
  acceptedCredentialTypes?: ReadonlyArray<string>;
16
- /**
17
- * Documentation only in MVP. The bind-time validator checks
18
- * requiredScopes ⊆ CredentialInstance.scopesGranted.
19
- */
20
10
  requiredScopes?: string[];
21
- /** Non-secret static headers merged onto every MCP request. */
22
11
  staticHeaders?: Record<string, string>;
23
- /**
24
- * Overrides for tool descriptions advertised by the MCP server.
25
- * Applied by the connection pool after tools/list.
26
- * Key: exact tool name as returned by the server.
27
- */
28
12
  toolDescriptionOverrides?: Record<string, string>;
29
13
  }
@@ -1,10 +1,3 @@
1
- /**
2
- * In-process retry policy for runnable nodes. Serialized configs use the same
3
- * `kind` discriminator (`JSON.stringify` / persisted workflows).
4
- *
5
- * `maxAttempts` is the total number of tries including the first (e.g. 3 means up to 2 delays after failures).
6
- */
7
-
8
1
  export type RetryPolicySpec = NoneRetryPolicySpec | FixedRetryPolicySpec | ExponentialRetryPolicySpec;
9
2
 
10
3
  export interface NoneRetryPolicySpec {
@@ -13,18 +6,15 @@ export interface NoneRetryPolicySpec {
13
6
 
14
7
  export interface FixedRetryPolicySpec {
15
8
  readonly kind: "fixed";
16
- /** Total attempts including the first execution. Must be >= 1. */
17
9
  readonly maxAttempts: number;
18
10
  readonly delayMs: number;
19
11
  }
20
12
 
21
13
  export interface ExponentialRetryPolicySpec {
22
14
  readonly kind: "exponential";
23
- /** Total attempts including the first execution. Must be >= 1. */
24
15
  readonly maxAttempts: number;
25
16
  readonly initialDelayMs: number;
26
17
  readonly multiplier: number;
27
18
  readonly maxDelayMs?: number;
28
- /** When true, each delay is multiplied by a random factor in [1, 1.2). */
29
19
  readonly jitter?: boolean;
30
20
  }
@@ -2,7 +2,6 @@ import type { PersistedRunState } from "./runTypes";
2
2
 
3
3
  type RunFinishedAtSource = Pick<PersistedRunState, "status" | "nodeSnapshotsByNodeId" | "finishedAt">;
4
4
 
5
- /** Derives workflow end time from persisted run root or node snapshots for run listings. */
6
5
  export class RunFinishedAtFactory {
7
6
  static resolveIso(state: RunFinishedAtSource): string | undefined {
8
7
  if (state.finishedAt && state.status !== "running" && state.status !== "pending") {
@@ -20,44 +20,26 @@ import type {
20
20
  WorkflowNodeConnection,
21
21
  } from "./workflowTypes";
22
22
 
23
- /**
24
- * Test-suite linkage for a run. When set, this run was started by a TestSuiteOrchestrator
25
- * as one test case inside a TestSuiteRun. The `IsTestRun` node and host-side persisters key
26
- * off the presence of this field. Subworkflow runs inherit it from their parent run.
27
- */
28
23
  export interface RunTestContext {
29
24
  readonly testSuiteRunId: string;
30
25
  readonly testCaseIndex: number;
31
- /**
32
- * Optional human-friendly label for this test case (e.g. an email subject when fixtures
33
- * are loaded from a mailbox). Resolved per item by `TestTrigger.caseLabel(item)` if set,
34
- * persisted on `Run.test_case_label` so the Tests-tab tree-table can show "RFQ for batch 14"
35
- * instead of "run_1777755971399_bbb86beac1396".
36
- */
37
26
  readonly testCaseLabel?: string;
38
27
  }
39
28
 
40
29
  export interface RunExecutionOptions {
41
- /** Run-intent override: force the inline scheduler and bypass node-level offload decisions. */
42
30
  localOnly?: boolean;
43
- /** Marks runs started from webhook handling so orchestration can apply webhook-specific continuation rules. */
44
31
  webhook?: boolean;
45
32
  mode?: "manual" | "debug";
46
33
  sourceWorkflowId?: WorkflowId;
47
34
  sourceRunId?: RunId;
48
35
  derivedFromRunId?: RunId;
49
36
  isMutable?: boolean;
50
- /** Set by the engine for this run: 0 = root, 1 = first child subworkflow, … */
51
37
  subworkflowDepth?: number;
52
- /** Effective cap after engine policy merge (successful node completions per run). */
53
38
  maxNodeActivations?: number;
54
- /** Effective cap after engine policy merge (subworkflow nesting). */
55
39
  maxSubworkflowDepth?: number;
56
- /** Present iff started by a TestSuiteOrchestrator; propagates to subworkflow runs via {@link ParentExecutionRef.testContext}. */
57
40
  testContext?: RunTestContext;
58
41
  }
59
42
 
60
- /** Engine-owned counters persisted with the run (worker-safe). */
61
43
  export interface EngineRunCounters {
62
44
  completedNodeActivations: number;
63
45
  }
@@ -88,7 +70,6 @@ export interface PersistedWorkflowSnapshotNode {
88
70
  tokenName?: string;
89
71
  configTokenName?: string;
90
72
  config: unknown;
91
- /** Pre-computed static configuration summary; populated by WorkflowSnapshotCodec. */
92
73
  inspectorSummary?: ReadonlyArray<Readonly<{ label: string; value: string }>>;
93
74
  }
94
75
 
@@ -97,9 +78,7 @@ export interface PersistedWorkflowSnapshot {
97
78
  name: string;
98
79
  nodes: ReadonlyArray<PersistedWorkflowSnapshotNode>;
99
80
  edges: ReadonlyArray<Edge>;
100
- /** When the snapshot was built from a live workflow definition that configured a workflow error handler. */
101
81
  workflowErrorHandlerConfigured?: boolean;
102
- /** Connection metadata for child nodes not in the execution graph (e.g. AI agent attachments). */
103
82
  connections?: ReadonlyArray<WorkflowNodeConnection>;
104
83
  }
105
84
 
@@ -163,20 +142,11 @@ export interface NodeExecutionSnapshot {
163
142
  inputsByPort?: NodeInputsByPort;
164
143
  outputs?: NodeOutputs;
165
144
  error?: NodeExecutionError;
166
- /**
167
- * When the node is a SubWorkflow invocation, the run id of the child run it spawned.
168
- * Populated after the child run completes so the UI can deep-link to that specific execution.
169
- */
170
145
  childRunId?: RunId;
171
146
  }
172
147
 
173
- /** Stable id for a single connection invocation row in {@link ConnectionInvocationRecord}. */
174
148
  export type ConnectionInvocationId = string;
175
149
 
176
- /**
177
- * One logical LLM or tool call under an owning workflow node (e.g. AI agent).
178
- * The owning node defines what {@link managedInput} and {@link managedOutput} contain.
179
- */
180
150
  export interface ConnectionInvocationRecord {
181
151
  readonly invocationId: ConnectionInvocationId;
182
152
  readonly runId: RunId;
@@ -187,24 +157,18 @@ export interface ConnectionInvocationRecord {
187
157
  readonly status: NodeExecutionStatus;
188
158
  readonly managedInput?: JsonValue;
189
159
  readonly managedOutput?: JsonValue;
190
- /** Short human-readable description of what this invocation is doing right now (e.g. `"calling search_messages"`). Rendered as a sub-line on the canvas node card. */
191
160
  readonly statusLabel?: string;
192
- /** Stable identifier for the thing this invocation acts on (e.g. an MCP tool name like `"search_messages"`). Persists across status transitions so the inspector can show it on completed/failed entries too. Connection nodes that ARE the tool (e.g. node-backed agent tools) leave this unset — the parent node id already identifies the subject. */
193
161
  readonly subjectName?: string;
194
162
  readonly error?: NodeExecutionError;
195
163
  readonly queuedAt?: string;
196
164
  readonly startedAt?: string;
197
165
  readonly finishedAt?: string;
198
166
  readonly updatedAt: string;
199
- /** Per-item iteration id minted by the engine when this invocation occurred inside a runnable node's per-item loop. */
200
167
  readonly iterationId?: NodeIterationId;
201
- /** Item index (0-based) of the iteration that produced this invocation. */
202
168
  readonly itemIndex?: number;
203
- /** When set, this invocation was produced inside a sub-agent triggered by the named parent invocation. */
204
169
  readonly parentInvocationId?: ConnectionInvocationId;
205
170
  }
206
171
 
207
- /** Arguments for appending a {@link ConnectionInvocationRecord} (engine fills run/workflow ids and timestamps). */
208
172
  export type ConnectionInvocationAppendArgs = Readonly<{
209
173
  invocationId: ConnectionInvocationId;
210
174
  connectionNodeId: NodeId;
@@ -227,7 +191,6 @@ export type ConnectionInvocationAppendArgs = Readonly<{
227
191
  export interface RunCurrentState {
228
192
  outputsByNode: Record<NodeId, NodeOutputs>;
229
193
  nodeSnapshotsByNodeId: Record<NodeId, NodeExecutionSnapshot>;
230
- /** Append-only history of connection-scoped invocations (LLM/tool) for inspector and canvas. */
231
194
  connectionInvocations?: ReadonlyArray<ConnectionInvocationRecord>;
232
195
  mutableState?: PersistedMutableRunState;
233
196
  }
@@ -258,7 +221,6 @@ export interface ExecutionFrontierPlan {
258
221
 
259
222
  export type RunStatus = "running" | "pending" | "completed" | "failed" | "suspended" | "halted";
260
223
 
261
- /** Reason a run transitioned to {@link RunStatus} `"halted"`. */
262
224
  export type RunHaltReason = "hitl-rejected" | "hitl-timeout" | "hitl-cancelled";
263
225
 
264
226
  export interface RunSummary {
@@ -266,14 +228,7 @@ export interface RunSummary {
266
228
  workflowId: WorkflowId;
267
229
  startedAt: string;
268
230
  status: RunStatus;
269
- /**
270
- * Test-case status for runs dispatched as part of a TestSuiteRun. Carries the
271
- * assertion-rollup-corrected outcome the test orchestrator persists onto the row, so the
272
- * executions list can show "failed" for a run whose workflow completed cleanly but whose
273
- * assertions caught regressions. Absent for non-test runs and legacy rows.
274
- */
275
231
  testCaseStatus?: TestCaseRunStatus;
276
- /** ISO timestamp when the run finished (derived from node snapshots or store `updatedAt`); omit while running/pending. */
277
232
  finishedAt?: string;
278
233
  parent?: ParentExecutionRef;
279
234
  executionOptions?: RunExecutionOptions;
@@ -297,34 +252,20 @@ export interface PersistedRunSchedulingState {
297
252
  queue: RunQueueEntry[];
298
253
  }
299
254
 
300
- /** One persisted suspension entry per suspended item. */
301
255
  export interface PersistedSuspensionEntry {
302
- /** Opaque task identifier (UUID v4). */
303
256
  readonly taskId: string;
304
257
  readonly nodeId: NodeId;
305
258
  readonly activationId: NodeActivationId;
306
259
  readonly itemIndex: number;
307
- /** SHA-256 hex digest of the decision schema JSON (for schema-drift detection). */
308
260
  readonly decisionSchemaHash: string;
309
- /** Serialized return value from `SuspensionRequest.deliver` (stored on the HumanTask row). */
310
261
  readonly deliveryRef: JsonValue;
311
- /** ISO timestamp when the task expires. */
312
262
  readonly timeoutAt: string;
313
263
  readonly onTimeout: "halt" | "auto-accept";
314
264
  }
315
265
 
316
- /**
317
- * When a node is re-activated after suspension, the engine writes the resume context here
318
- * so `NodeExecutionRequestHandlerService` can splice `resumeContext` into ctx.
319
- * Cleared once the re-activation is consumed.
320
- */
321
266
  export interface PendingResumeEntry {
322
267
  readonly activationId: NodeActivationId;
323
268
  readonly nodeId: NodeId;
324
- /**
325
- * Typed as `unknown` here to avoid a circular import between runTypes ↔ runtimeTypes.
326
- * `NodeExecutionRequestHandlerService` casts this to `ResumeContext` from runtimeTypes.
327
- */
328
269
  readonly resumeContext: unknown;
329
270
  }
330
271
 
@@ -332,37 +273,23 @@ export interface PersistedRunState {
332
273
  runId: RunId;
333
274
  workflowId: WorkflowId;
334
275
  startedAt: string;
335
- /** Canonical terminal time for listings and retention when persisted on the run root. */
336
276
  finishedAt?: string;
337
- /** Optimistic concurrency / CAS on the run aggregate (repository may increment on save). */
338
277
  revision?: number;
339
278
  parent?: ParentExecutionRef;
340
279
  executionOptions?: RunExecutionOptions;
341
280
  control?: PersistedRunControlState;
342
281
  workflowSnapshot?: PersistedWorkflowSnapshot;
343
282
  mutableState?: PersistedMutableRunState;
344
- /** Frozen at createRun from workflow + runtime defaults for prune/storage decisions. */
345
283
  policySnapshot?: PersistedRunPolicySnapshot;
346
- /** Successful node completions so far (for activation budget). */
347
284
  engineCounters?: EngineRunCounters;
348
285
  status: RunStatus;
349
- /** Populated when `status === "halted"` to discriminate why the run was halted. */
350
286
  reason?: RunHaltReason;
351
287
  pending?: PendingNodeExecution;
352
288
  queue: RunQueueEntry[];
353
289
  outputsByNode: Record<NodeId, NodeOutputs>;
354
290
  nodeSnapshotsByNodeId: Record<NodeId, NodeExecutionSnapshot>;
355
- /** Append-only history of connection invocations (LLM/tool) nested under owning nodes. */
356
291
  connectionInvocations?: ReadonlyArray<ConnectionInvocationRecord>;
357
- /**
358
- * One entry per outstanding HITL suspension (per-item).
359
- * Present and non-empty iff `status === "suspended"`.
360
- */
361
292
  suspension?: ReadonlyArray<PersistedSuspensionEntry>;
362
- /**
363
- * Written by `resumeRun()` so `NodeExecutionRequestHandlerService` can splice `resumeContext`
364
- * into the ctx when re-executing the suspended node. Cleared once consumed.
365
- */
366
293
  pendingResume?: PendingResumeEntry;
367
294
  }
368
295
 
@@ -389,7 +316,6 @@ export interface WorkflowExecutionListingRepository {
389
316
  listRuns(args?: Readonly<{ workflowId?: WorkflowId; limit?: number }>): Promise<ReadonlyArray<RunSummary>>;
390
317
  }
391
318
 
392
- /** Runs eligible for retention-based pruning (completed or failed, older than cutoff). */
393
319
  export interface RunPruneCandidate {
394
320
  readonly runId: RunId;
395
321
  readonly workflowId: WorkflowId;