@codemation/core 0.11.0 → 0.12.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 (101) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/CostCatalogContract-DD7fQ4FF.d.cts +19 -0
  3. package/dist/{EngineRuntimeRegistration.types-MPYWsEM0.d.cts → EngineRuntimeRegistration.types-DTV5_7Jw.d.cts} +3 -2
  4. package/dist/{EngineRuntimeRegistration.types-BZ_1XWAJ.d.ts → EngineRuntimeRegistration.types-Dl92Hdoi.d.ts} +2 -2
  5. package/dist/InMemoryRunDataFactory-qMiYjhCK.d.cts +202 -0
  6. package/dist/{InMemoryRunEventBusRegistry-sM4z4n_i.js → InMemoryRunEventBusRegistry-Bwunvt1T.js} +1 -1
  7. package/dist/{InMemoryRunEventBusRegistry-sM4z4n_i.js.map → InMemoryRunEventBusRegistry-Bwunvt1T.js.map} +1 -1
  8. package/dist/{InMemoryRunEventBusRegistry-VM3OWnHo.cjs → InMemoryRunEventBusRegistry-Sa86VxuV.cjs} +1 -1
  9. package/dist/{InMemoryRunEventBusRegistry-VM3OWnHo.cjs.map → InMemoryRunEventBusRegistry-Sa86VxuV.cjs.map} +1 -1
  10. package/dist/ItemsInputNormalizer-BhuxvZh5.js +36 -0
  11. package/dist/ItemsInputNormalizer-BhuxvZh5.js.map +1 -0
  12. package/dist/ItemsInputNormalizer-C09a7iFP.d.ts +321 -0
  13. package/dist/ItemsInputNormalizer-DLaD6rTl.d.cts +407 -0
  14. package/dist/ItemsInputNormalizer-Div-fb6a.cjs +43 -0
  15. package/dist/ItemsInputNormalizer-Div-fb6a.cjs.map +1 -0
  16. package/dist/RunIntentService-BOSGwmqn.d.ts +299 -0
  17. package/dist/RunIntentService-CWMMrAP4.d.cts +220 -0
  18. package/dist/{RunIntentService-MUHJ1bhO.d.cts → agentMcpTypes-DUmniLOY.d.cts} +183 -206
  19. package/dist/bootstrap/index.cjs +4 -2
  20. package/dist/bootstrap/index.d.cts +63 -5
  21. package/dist/bootstrap/index.d.ts +5 -4
  22. package/dist/bootstrap/index.js +4 -2
  23. package/dist/{bootstrap-Dgzsjoj7.js → bootstrap-CKTMMNmL.js} +174 -3
  24. package/dist/bootstrap-CKTMMNmL.js.map +1 -0
  25. package/dist/{bootstrap-dVmpU1ju.cjs → bootstrap-D460dCgS.cjs} +209 -36
  26. package/dist/bootstrap-D460dCgS.cjs.map +1 -0
  27. package/dist/browser.cjs +17 -0
  28. package/dist/browser.d.cts +4 -0
  29. package/dist/browser.d.ts +3 -0
  30. package/dist/browser.js +4 -0
  31. package/dist/contracts-CK0x6w_G.cjs +74 -0
  32. package/dist/contracts-CK0x6w_G.cjs.map +1 -0
  33. package/dist/contracts-DXdfTdpW.js +50 -0
  34. package/dist/contracts-DXdfTdpW.js.map +1 -0
  35. package/dist/contracts.cjs +6 -0
  36. package/dist/contracts.d.cts +5 -0
  37. package/dist/contracts.d.ts +2 -0
  38. package/dist/contracts.js +3 -0
  39. package/dist/di-DdsgWfVy.js +405 -0
  40. package/dist/di-DdsgWfVy.js.map +1 -0
  41. package/dist/di-tO6R7VJV.cjs +524 -0
  42. package/dist/di-tO6R7VJV.cjs.map +1 -0
  43. package/dist/executionPersistenceContracts-DenJJK2T.d.cts +275 -0
  44. package/dist/{index-Bes88mxT.d.ts → index-BZDhEQ6W.d.ts} +278 -415
  45. package/dist/{RunIntentService-BrEq6Jm6.d.ts → index-CSKKuK60.d.ts} +441 -286
  46. package/dist/index.cjs +97 -250
  47. package/dist/index.cjs.map +1 -1
  48. package/dist/index.d.cts +395 -803
  49. package/dist/index.d.ts +5 -3
  50. package/dist/index.js +58 -224
  51. package/dist/index.js.map +1 -1
  52. package/dist/params-DqRvku2h.d.cts +44 -0
  53. package/dist/{runtime-Duf3ClPw.js → runtime-BPZgnZ9G.js} +591 -382
  54. package/dist/runtime-BPZgnZ9G.js.map +1 -0
  55. package/dist/{runtime-vH0EeZzH.cjs → runtime-CyW9c9XM.cjs} +651 -500
  56. package/dist/runtime-CyW9c9XM.cjs.map +1 -0
  57. package/dist/testing.cjs +23 -21
  58. package/dist/testing.cjs.map +1 -1
  59. package/dist/testing.d.cts +3 -2
  60. package/dist/testing.d.ts +3 -2
  61. package/dist/testing.js +5 -3
  62. package/dist/testing.js.map +1 -1
  63. package/package.json +9 -5
  64. package/src/ai/AgentConnectionNodeCollector.ts +1 -1
  65. package/src/authoring/defineHumanApprovalNode.types.ts +379 -0
  66. package/src/authoring/index.ts +6 -0
  67. package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +29 -0
  68. package/src/contracts/CodemationTelemetryAttributeNames.ts +10 -0
  69. package/src/contracts/credentialTypes.ts +10 -0
  70. package/src/contracts/hitlSeamTypes.ts +34 -0
  71. package/src/contracts/humanTaskStoreTypes.ts +48 -0
  72. package/src/contracts/inboxChannelTypes.ts +58 -0
  73. package/src/contracts/index.ts +3 -0
  74. package/src/contracts/runTypes.ts +61 -3
  75. package/src/contracts/runtimeTypes.ts +112 -0
  76. package/src/credentials/CredentialMaterialProvider.types.ts +61 -0
  77. package/src/credentials/ManagedCredentialMaterialWriteError.ts +14 -0
  78. package/src/credentials/ManagedMaterialFetchError.ts +16 -0
  79. package/src/execution/ActivationEnqueueService.ts +16 -0
  80. package/src/execution/DefaultExecutionContextFactory.ts +11 -0
  81. package/src/execution/NodeExecutionSnapshotFactory.ts +7 -1
  82. package/src/execution/NodeExecutor.ts +60 -1
  83. package/src/execution/NodeExecutorFactory.ts +12 -2
  84. package/src/execution/NodeSuspensionHandler.ts +220 -0
  85. package/src/execution/PersistedRunStateTerminalBuilder.ts +5 -2
  86. package/src/execution/RunStateSemantics.ts +5 -0
  87. package/src/execution/RunSuspendedError.ts +21 -0
  88. package/src/index.ts +40 -0
  89. package/src/orchestration/Engine.ts +12 -2
  90. package/src/orchestration/EngineWaiters.ts +1 -1
  91. package/src/orchestration/NodeExecutionRequestHandlerService.ts +25 -2
  92. package/src/orchestration/RunContinuationService.ts +226 -2
  93. package/src/orchestration/TestSuiteOrchestrator.ts +5 -4
  94. package/src/runtime/RunIntentService.ts +3 -0
  95. package/src/workflow/dsl/ChainCursorResolver.ts +36 -0
  96. package/tsdown.config.ts +1 -1
  97. package/dist/InMemoryRunDataFactory-hmkh0lzR.d.cts +0 -138
  98. package/dist/bootstrap-Dgzsjoj7.js.map +0 -1
  99. package/dist/bootstrap-dVmpU1ju.cjs.map +0 -1
  100. package/dist/runtime-Duf3ClPw.js.map +0 -1
  101. package/dist/runtime-vH0EeZzH.cjs.map +0 -1
@@ -0,0 +1,524 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+
23
+ //#endregion
24
+ require("reflect-metadata");
25
+ let tsyringe = require("tsyringe");
26
+ tsyringe = __toESM(tsyringe);
27
+
28
+ //#region src/workflow/definition/ConnectionNodeIdFactory.ts
29
+ /**
30
+ * Deterministic ids for workflow connection-owned child nodes (LLM slot, tools, etc.).
31
+ * These are stable across loads.
32
+ */
33
+ var ConnectionNodeIdFactory = class {
34
+ static connectionSegment = "__conn__";
35
+ static languageModelConnectionNodeId(parentNodeId) {
36
+ return `${parentNodeId}${this.connectionSegment}llm`;
37
+ }
38
+ static toolConnectionNodeId(parentNodeId, toolName) {
39
+ const normalized = this.normalizeToolName(toolName);
40
+ return `${parentNodeId}${this.connectionSegment}tool${this.connectionSegment}${normalized}`;
41
+ }
42
+ static mcpConnectionNodeId(parentNodeId, serverId) {
43
+ return `${parentNodeId}${this.connectionSegment}mcp${this.connectionSegment}${serverId}`;
44
+ }
45
+ static isMcpConnectionNodeId(nodeId) {
46
+ return nodeId.includes(`${this.connectionSegment}mcp${this.connectionSegment}`);
47
+ }
48
+ static parseMcpConnectionNodeId(nodeId) {
49
+ if (!this.isMcpConnectionNodeId(nodeId)) return;
50
+ const marker = `${this.connectionSegment}mcp${this.connectionSegment}`;
51
+ const idx = nodeId.lastIndexOf(marker);
52
+ if (idx < 0) return;
53
+ const parentNodeId = nodeId.slice(0, idx);
54
+ const serverId = nodeId.slice(idx + marker.length);
55
+ if (!parentNodeId || !serverId) return;
56
+ return {
57
+ parentNodeId,
58
+ serverId
59
+ };
60
+ }
61
+ static isLanguageModelConnectionNodeId(nodeId) {
62
+ return nodeId.endsWith(`${this.connectionSegment}llm`);
63
+ }
64
+ static isToolConnectionNodeId(nodeId) {
65
+ return nodeId.includes(`${this.connectionSegment}tool${this.connectionSegment}`);
66
+ }
67
+ static parseLanguageModelConnectionNodeId(nodeId) {
68
+ if (!this.isLanguageModelConnectionNodeId(nodeId)) return;
69
+ const suffix = `${this.connectionSegment}llm`;
70
+ const parentNodeId = nodeId.slice(0, -suffix.length);
71
+ return parentNodeId ? { parentNodeId } : void 0;
72
+ }
73
+ static parseToolConnectionNodeId(nodeId) {
74
+ if (!this.isToolConnectionNodeId(nodeId)) return;
75
+ const marker = `${this.connectionSegment}tool${this.connectionSegment}`;
76
+ const idx = nodeId.lastIndexOf(marker);
77
+ if (idx < 0) return;
78
+ const parentNodeId = nodeId.slice(0, idx);
79
+ const normalizedToolName = nodeId.slice(idx + marker.length);
80
+ if (!parentNodeId || !normalizedToolName) return;
81
+ return {
82
+ parentNodeId,
83
+ normalizedToolName
84
+ };
85
+ }
86
+ /** True when `nodeId` is a connection-owned child of `parentNodeId` (LLM or tool slot). */
87
+ static isConnectionOwnedDescendantOf(parentNodeId, nodeId) {
88
+ return nodeId.startsWith(`${parentNodeId}${this.connectionSegment}`);
89
+ }
90
+ /** Normalizes a tool display name to a stable id segment. */
91
+ static normalizeToolName(toolName) {
92
+ return toolName.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "tool";
93
+ }
94
+ };
95
+
96
+ //#endregion
97
+ //#region src/contracts/itemExpr.ts
98
+ const ITEM_EXPR_BRAND = Symbol.for("codemation.itemExpr");
99
+ function itemExpr(fn) {
100
+ return {
101
+ [ITEM_EXPR_BRAND]: true,
102
+ fn
103
+ };
104
+ }
105
+ function isItemExpr(value) {
106
+ if (typeof value !== "object" || value === null) return false;
107
+ const v = value;
108
+ if (v[ITEM_EXPR_BRAND] === true) return true;
109
+ const keys = Object.keys(v);
110
+ if (keys.length === 1 && keys[0] === "fn" && typeof v.fn === "function") return true;
111
+ for (const sym of Object.getOwnPropertySymbols(v)) if (sym.description === "codemation.itemExpr" && v[sym] === true) return true;
112
+ return false;
113
+ }
114
+ function containsItemExprInUnknown(value, seen = /* @__PURE__ */ new WeakSet()) {
115
+ if (isItemExpr(value)) return true;
116
+ if (value === null || typeof value !== "object") return false;
117
+ if (seen.has(value)) return false;
118
+ seen.add(value);
119
+ if (Array.isArray(value)) return value.some((entry) => containsItemExprInUnknown(entry, seen));
120
+ for (const entry of Object.values(value)) if (containsItemExprInUnknown(entry, seen)) return true;
121
+ return false;
122
+ }
123
+ /**
124
+ * Deep-resolves {@link itemExpr} leaves. Returns a new graph (does not mutate the original config object).
125
+ */
126
+ async function resolveItemExprsInUnknown(value, args, seen = /* @__PURE__ */ new WeakSet()) {
127
+ if (isItemExpr(value)) return await Promise.resolve(value.fn(args));
128
+ if (value === null || typeof value !== "object") return value;
129
+ if (seen.has(value)) return value;
130
+ seen.add(value);
131
+ if (Array.isArray(value)) {
132
+ const out$1 = [];
133
+ for (let i = 0; i < value.length; i++) out$1.push(await resolveItemExprsInUnknown(value[i], args, seen));
134
+ return out$1;
135
+ }
136
+ const rec = value;
137
+ const entries = Object.entries(rec);
138
+ const proto = Object.getPrototypeOf(value);
139
+ if (proto !== Object.prototype && proto !== null && entries.length === 0) return value;
140
+ const out = Object.create(proto);
141
+ for (const [k, v] of entries) out[k] = await resolveItemExprsInUnknown(v, args, seen);
142
+ return out;
143
+ }
144
+ /**
145
+ * Clones runnable config (best-effort) so per-item {@link itemExpr} resolution never mutates shared instances.
146
+ */
147
+ async function resolveItemExprsForExecution(config, nodeCtx, item, itemIndex, items) {
148
+ const exprArgs = {
149
+ item,
150
+ itemIndex,
151
+ items,
152
+ ctx: {
153
+ runId: nodeCtx.runId,
154
+ workflowId: nodeCtx.workflowId,
155
+ nodeId: nodeCtx.nodeId,
156
+ activationId: nodeCtx.activationId,
157
+ data: nodeCtx.data
158
+ }
159
+ };
160
+ if (!containsItemExprInUnknown(config)) return;
161
+ return await resolveItemExprsInUnknown(config, exprArgs);
162
+ }
163
+
164
+ //#endregion
165
+ //#region src/ai/AgentConfigInspectorFactory.ts
166
+ var AgentConfigInspector = class {
167
+ static isAgentNodeConfig(config) {
168
+ if (!config) return false;
169
+ const candidate = config;
170
+ return !!candidate.chatModel && this.hasCompatibleMessageConfiguration(candidate);
171
+ }
172
+ static hasCompatibleMessageConfiguration(candidate) {
173
+ const messages = candidate.messages;
174
+ if (messages === void 0 || messages === null) return false;
175
+ if (Array.isArray(messages)) return messages.length > 0;
176
+ if (typeof messages === "object") {
177
+ if (isItemExpr(messages)) return true;
178
+ const o = messages;
179
+ return Array.isArray(o.prompt) && o.prompt.length > 0 || typeof o.buildMessages === "function";
180
+ }
181
+ return false;
182
+ }
183
+ };
184
+
185
+ //#endregion
186
+ //#region src/ai/NodeBackedToolConfig.ts
187
+ var NodeBackedToolConfig = class {
188
+ type;
189
+ toolKind = "nodeBacked";
190
+ description;
191
+ presentation;
192
+ inputSchemaValue;
193
+ outputSchemaValue;
194
+ mapInputValue;
195
+ mapOutputValue;
196
+ constructor(name, node, options) {
197
+ this.name = name;
198
+ this.node = node;
199
+ this.type = node.type;
200
+ this.description = options.description;
201
+ this.presentation = options.presentation;
202
+ this.inputSchemaValue = options.inputSchema;
203
+ this.outputSchemaValue = options.outputSchema;
204
+ this.mapInputValue = options.mapInput;
205
+ this.mapOutputValue = options.mapOutput;
206
+ }
207
+ getCredentialRequirements() {
208
+ return this.node.getCredentialRequirements?.() ?? [];
209
+ }
210
+ getInputSchema() {
211
+ return this.inputSchemaValue;
212
+ }
213
+ getOutputSchema() {
214
+ return this.outputSchemaValue;
215
+ }
216
+ toNodeItem(args) {
217
+ const mapped = this.mapInputValue?.(args) ?? args.input;
218
+ if (this.isItem(mapped)) return mapped;
219
+ return { json: mapped };
220
+ }
221
+ toToolOutput(args) {
222
+ const raw = this.mapOutputValue?.(args) ?? this.readDefaultToolOutput(args.outputs);
223
+ return this.outputSchemaValue.parse(raw);
224
+ }
225
+ readDefaultToolOutput(outputs) {
226
+ const firstMainItem = outputs.main?.[0];
227
+ if (!firstMainItem) throw new Error(`Node-backed tool "${this.name}" did not produce a main output item.`);
228
+ return firstMainItem.json;
229
+ }
230
+ isItem(value) {
231
+ return typeof value === "object" && value !== null && "json" in value;
232
+ }
233
+ };
234
+
235
+ //#endregion
236
+ //#region src/ai/AgentConnectionNodeCollector.ts
237
+ const AgentConnectionNodeCollector = new class {
238
+ collect(parentNodeId, agentConfig, mcpServerResolver) {
239
+ const collected = [];
240
+ this.collectInto(parentNodeId, agentConfig, collected, mcpServerResolver);
241
+ return collected;
242
+ }
243
+ collectInto(parentNodeId, agentConfig, collected, mcpServerResolver) {
244
+ collected.push({
245
+ nodeId: ConnectionNodeIdFactory.languageModelConnectionNodeId(parentNodeId),
246
+ parentNodeId,
247
+ connectionName: "llm",
248
+ role: "languageModel",
249
+ name: agentConfig.chatModel.presentation?.label ?? agentConfig.chatModel.name,
250
+ typeName: agentConfig.chatModel.name,
251
+ icon: agentConfig.chatModel.presentation?.icon,
252
+ credentialSource: agentConfig.chatModel
253
+ });
254
+ for (const tool of agentConfig.tools ?? []) {
255
+ const toolNodeId = ConnectionNodeIdFactory.toolConnectionNodeId(parentNodeId, tool.name);
256
+ const isNestedAgent = this.isNodeBackedAgentTool(tool);
257
+ collected.push({
258
+ nodeId: toolNodeId,
259
+ parentNodeId,
260
+ connectionName: "tools",
261
+ role: isNestedAgent ? "nestedAgent" : "tool",
262
+ name: tool.presentation?.label ?? tool.name,
263
+ typeName: tool.name,
264
+ icon: tool.presentation?.icon,
265
+ credentialSource: tool
266
+ });
267
+ this.collectNestedAgentTools(toolNodeId, tool, collected, mcpServerResolver);
268
+ }
269
+ if (mcpServerResolver) {
270
+ const mcpServers = agentConfig.mcpServers;
271
+ for (const serverId of mcpServers ?? []) {
272
+ const decl = mcpServerResolver(serverId);
273
+ if (!decl) continue;
274
+ const acceptedTypes = decl.acceptedCredentialTypes ?? [];
275
+ collected.push({
276
+ nodeId: ConnectionNodeIdFactory.mcpConnectionNodeId(parentNodeId, serverId),
277
+ parentNodeId,
278
+ connectionName: "tools",
279
+ role: "tool",
280
+ name: decl.displayName,
281
+ typeName: "MCP server",
282
+ icon: "lucide:plug",
283
+ credentialSource: { getCredentialRequirements: () => [{
284
+ slotKey: "credential",
285
+ label: decl.displayName,
286
+ acceptedTypes
287
+ }] }
288
+ });
289
+ }
290
+ }
291
+ }
292
+ collectNestedAgentTools(toolNodeId, tool, collected, mcpServerResolver) {
293
+ if (!this.isNodeBackedAgentTool(tool)) return;
294
+ const innerAgent = tool instanceof NodeBackedToolConfig ? tool.node : tool.node;
295
+ this.collectInto(toolNodeId, innerAgent, collected, mcpServerResolver);
296
+ }
297
+ /**
298
+ * After JSON round-trip (persisted snapshots), tools are plain objects — `instanceof NodeBackedToolConfig` fails.
299
+ * Detect node-backed tools structurally via {@link NodeBackedToolConfig#toolKind}.
300
+ */
301
+ isNodeBackedAgentTool(tool) {
302
+ if (tool instanceof NodeBackedToolConfig) return AgentConfigInspector.isAgentNodeConfig(tool.node);
303
+ if (!tool || typeof tool !== "object") return false;
304
+ const t = tool;
305
+ if (t.toolKind !== "nodeBacked") return false;
306
+ return AgentConfigInspector.isAgentNodeConfig(t.node);
307
+ }
308
+ }();
309
+
310
+ //#endregion
311
+ //#region src/workflow/definition/NodeIterationIdFactory.ts
312
+ /**
313
+ * Unique ids for one per-item iteration of a runnable node's execute loop.
314
+ *
315
+ * Activations are per-batch (one scheduled execution of a node, possibly with N items).
316
+ * Iterations refine that to one identifier per item-index inside the batch loop, so per-item
317
+ * connection invocations and telemetry can be grouped without time-window heuristics.
318
+ *
319
+ * Uses Web Crypto's `randomUUID` (Node 19+ and all modern browsers) so this module is safe
320
+ * to include in the browser entry. Importing `node:crypto` here previously leaked into the
321
+ * canvas client bundle through `browser.ts` and OOM'd consumers' Turbopack builds.
322
+ */
323
+ var NodeIterationIdFactory = class {
324
+ static create() {
325
+ return `iter_${globalThis.crypto.randomUUID()}`;
326
+ }
327
+ /** Deterministic id for tests when a stable sequence is needed. */
328
+ static createForTest(seed, sequence) {
329
+ return `iter_${seed}_${sequence}`;
330
+ }
331
+ /** Deterministic id derived from a connection node id (for sub-agent / tool-call scopes). */
332
+ static createForConnection(connectionNodeId, sequence) {
333
+ return `iter_${connectionNodeId}_${sequence}`;
334
+ }
335
+ };
336
+
337
+ //#endregion
338
+ //#region src/contracts/credentialTypes.ts
339
+ var CredentialUnboundError = class CredentialUnboundError extends Error {
340
+ constructor(bindingKey, acceptedTypes = []) {
341
+ super(CredentialUnboundError.createMessage(bindingKey, acceptedTypes));
342
+ this.bindingKey = bindingKey;
343
+ this.acceptedTypes = acceptedTypes;
344
+ this.name = "CredentialUnboundError";
345
+ }
346
+ static createMessage(bindingKey, acceptedTypes) {
347
+ const acceptedTypesSuffix = acceptedTypes.length > 0 ? ` Accepted credential types: ${acceptedTypes.join(", ")}.` : "";
348
+ return `Credential slot "${bindingKey.slotKey}" is not bound for workflow ${bindingKey.workflowId} node ${bindingKey.nodeId}.${acceptedTypesSuffix}`;
349
+ }
350
+ };
351
+
352
+ //#endregion
353
+ //#region src/contracts/runtimeTypes.ts
354
+ /**
355
+ * Thrown by a node's `execute()` to request durable suspension of the current item.
356
+ * The engine catches this, persists the suspension entry, calls `deliver`, and
357
+ * continues to the next item (per-item semantics).
358
+ *
359
+ * @example
360
+ * ```ts
361
+ * throw new SuspensionRequest({
362
+ * decisionSchema: z.object({ approved: z.boolean() }),
363
+ * timeout: "PT24H",
364
+ * onTimeout: "halt",
365
+ * subject: { title: "Approve invoice", summary: "Invoice #1234 needs approval" },
366
+ * deliver: async (handle) => {
367
+ * await notifySlack(handle);
368
+ * return { channel: "slack", ts: "..." };
369
+ * },
370
+ * });
371
+ * ```
372
+ */
373
+ var SuspensionRequest = class extends Error {
374
+ constructor(request) {
375
+ super(`SuspensionRequest(${request.subject?.title ?? "untitled"})`);
376
+ this.request = request;
377
+ this.name = "SuspensionRequest";
378
+ }
379
+ };
380
+
381
+ //#endregion
382
+ //#region src/contracts/runFinishedAtFactory.ts
383
+ /** Derives workflow end time from persisted run root or node snapshots for run listings. */
384
+ var RunFinishedAtFactory = class {
385
+ static resolveIso(state) {
386
+ if (state.finishedAt && state.status !== "running" && state.status !== "pending") return state.finishedAt;
387
+ if (state.status === "running" || state.status === "pending") return;
388
+ let max;
389
+ for (const snap of Object.values(state.nodeSnapshotsByNodeId)) if (snap?.finishedAt && (!max || snap.finishedAt > max)) max = snap.finishedAt;
390
+ return max;
391
+ }
392
+ };
393
+
394
+ //#endregion
395
+ //#region src/contracts/workflowTypes.ts
396
+ function nodeRef(nodeId) {
397
+ return nodeId;
398
+ }
399
+ const branchRef = (index) => `$${index}`;
400
+
401
+ //#endregion
402
+ //#region src/di/CoreTokens.ts
403
+ const CoreTokens = {
404
+ PersistedWorkflowTokenRegistry: Symbol.for("codemation.core.PersistedWorkflowTokenRegistry"),
405
+ CredentialSessionService: Symbol.for("codemation.core.CredentialSessionService"),
406
+ CredentialTypeRegistry: Symbol.for("codemation.core.CredentialTypeRegistry"),
407
+ WorkflowRunnerService: Symbol.for("codemation.core.WorkflowRunnerService"),
408
+ LiveWorkflowRepository: Symbol.for("codemation.core.LiveWorkflowRepository"),
409
+ WorkflowRepository: Symbol.for("codemation.core.WorkflowRepository"),
410
+ NodeResolver: Symbol.for("codemation.core.NodeResolver"),
411
+ WorkflowNodeInstanceFactory: Symbol.for("codemation.core.WorkflowNodeInstanceFactory"),
412
+ RunIdFactory: Symbol.for("codemation.core.RunIdFactory"),
413
+ ActivationIdFactory: Symbol.for("codemation.core.ActivationIdFactory"),
414
+ WorkflowExecutionRepository: Symbol.for("codemation.core.WorkflowExecutionRepository"),
415
+ TriggerSetupStateRepository: Symbol.for("codemation.core.TriggerSetupStateRepository"),
416
+ NodeActivationScheduler: Symbol.for("codemation.core.NodeActivationScheduler"),
417
+ RunDataFactory: Symbol.for("codemation.core.RunDataFactory"),
418
+ ExecutionContextFactory: Symbol.for("codemation.core.ExecutionContextFactory"),
419
+ RunEventBus: Symbol.for("codemation.core.RunEventBus"),
420
+ BinaryStorage: Symbol.for("codemation.core.BinaryStorage"),
421
+ WebhookBasePath: Symbol.for("codemation.core.WebhookBasePath"),
422
+ EngineExecutionLimitsPolicy: Symbol.for("codemation.core.EngineExecutionLimitsPolicy"),
423
+ WorkflowActivationPolicy: Symbol.for("codemation.core.WorkflowActivationPolicy"),
424
+ AgentMcpIntegration: Symbol.for("codemation.core.AgentMcpIntegration")
425
+ };
426
+
427
+ //#endregion
428
+ Object.defineProperty(exports, 'AgentConfigInspector', {
429
+ enumerable: true,
430
+ get: function () {
431
+ return AgentConfigInspector;
432
+ }
433
+ });
434
+ Object.defineProperty(exports, 'AgentConnectionNodeCollector', {
435
+ enumerable: true,
436
+ get: function () {
437
+ return AgentConnectionNodeCollector;
438
+ }
439
+ });
440
+ Object.defineProperty(exports, 'ConnectionNodeIdFactory', {
441
+ enumerable: true,
442
+ get: function () {
443
+ return ConnectionNodeIdFactory;
444
+ }
445
+ });
446
+ Object.defineProperty(exports, 'CoreTokens', {
447
+ enumerable: true,
448
+ get: function () {
449
+ return CoreTokens;
450
+ }
451
+ });
452
+ Object.defineProperty(exports, 'CredentialUnboundError', {
453
+ enumerable: true,
454
+ get: function () {
455
+ return CredentialUnboundError;
456
+ }
457
+ });
458
+ Object.defineProperty(exports, 'NodeBackedToolConfig', {
459
+ enumerable: true,
460
+ get: function () {
461
+ return NodeBackedToolConfig;
462
+ }
463
+ });
464
+ Object.defineProperty(exports, 'NodeIterationIdFactory', {
465
+ enumerable: true,
466
+ get: function () {
467
+ return NodeIterationIdFactory;
468
+ }
469
+ });
470
+ Object.defineProperty(exports, 'RunFinishedAtFactory', {
471
+ enumerable: true,
472
+ get: function () {
473
+ return RunFinishedAtFactory;
474
+ }
475
+ });
476
+ Object.defineProperty(exports, 'SuspensionRequest', {
477
+ enumerable: true,
478
+ get: function () {
479
+ return SuspensionRequest;
480
+ }
481
+ });
482
+ Object.defineProperty(exports, '__toESM', {
483
+ enumerable: true,
484
+ get: function () {
485
+ return __toESM;
486
+ }
487
+ });
488
+ Object.defineProperty(exports, 'branchRef', {
489
+ enumerable: true,
490
+ get: function () {
491
+ return branchRef;
492
+ }
493
+ });
494
+ Object.defineProperty(exports, 'isItemExpr', {
495
+ enumerable: true,
496
+ get: function () {
497
+ return isItemExpr;
498
+ }
499
+ });
500
+ Object.defineProperty(exports, 'itemExpr', {
501
+ enumerable: true,
502
+ get: function () {
503
+ return itemExpr;
504
+ }
505
+ });
506
+ Object.defineProperty(exports, 'nodeRef', {
507
+ enumerable: true,
508
+ get: function () {
509
+ return nodeRef;
510
+ }
511
+ });
512
+ Object.defineProperty(exports, 'resolveItemExprsForExecution', {
513
+ enumerable: true,
514
+ get: function () {
515
+ return resolveItemExprsForExecution;
516
+ }
517
+ });
518
+ Object.defineProperty(exports, 'resolveItemExprsInUnknown', {
519
+ enumerable: true,
520
+ get: function () {
521
+ return resolveItemExprsInUnknown;
522
+ }
523
+ });
524
+ //# sourceMappingURL=di-tO6R7VJV.cjs.map