@codemation/core 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/CostCatalogContract-DZgcUBE4.d.cts +19 -0
  3. package/dist/{EngineRuntimeRegistration.types-BZ_1XWAJ.d.ts → EngineRuntimeRegistration.types-BQbS9_gs.d.ts} +2 -2
  4. package/dist/{EngineRuntimeRegistration.types-MPYWsEM0.d.cts → EngineRuntimeRegistration.types-Cggm5GVY.d.cts} +3 -2
  5. package/dist/{InMemoryRunDataFactory-hmkh0lzR.d.cts → InMemoryRunDataFactory-C7YItvHG.d.cts} +3 -18
  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-C_dpn76M.d.cts +407 -0
  11. package/dist/ItemsInputNormalizer-CwdOhSAK.cjs +43 -0
  12. package/dist/ItemsInputNormalizer-CwdOhSAK.cjs.map +1 -0
  13. package/dist/ItemsInputNormalizer-D-MH8MBs.js +36 -0
  14. package/dist/ItemsInputNormalizer-D-MH8MBs.js.map +1 -0
  15. package/dist/ItemsInputNormalizer-_Mfcd3YU.d.ts +321 -0
  16. package/dist/RunIntentService-BVur7x9n.d.ts +285 -0
  17. package/dist/RunIntentService-CEF-sFfI.d.cts +206 -0
  18. package/dist/{RunIntentService-MUHJ1bhO.d.cts → agentMcpTypes-ZiNbNsEi.d.cts} +2 -204
  19. package/dist/bootstrap/index.cjs +4 -2
  20. package/dist/bootstrap/index.d.cts +5 -3
  21. package/dist/bootstrap/index.d.ts +5 -4
  22. package/dist/bootstrap/index.js +4 -2
  23. package/dist/{bootstrap-dVmpU1ju.cjs → bootstrap-BxuTFTLB.cjs} +38 -36
  24. package/dist/{bootstrap-dVmpU1ju.cjs.map → bootstrap-BxuTFTLB.cjs.map} +1 -1
  25. package/dist/{bootstrap-Dgzsjoj7.js → bootstrap-D_Yyi0wL.js} +4 -2
  26. package/dist/{bootstrap-Dgzsjoj7.js.map → bootstrap-D_Yyi0wL.js.map} +1 -1
  27. package/dist/browser.cjs +16 -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-0Wop7z1y.js +376 -0
  40. package/dist/di-0Wop7z1y.js.map +1 -0
  41. package/dist/di-BlEKdoZS.cjs +489 -0
  42. package/dist/di-BlEKdoZS.cjs.map +1 -0
  43. package/dist/executionPersistenceContracts-BgZMRsTa.d.cts +275 -0
  44. package/dist/{index-Bes88mxT.d.ts → index-62Ba9f7D.d.ts} +6 -319
  45. package/dist/{RunIntentService-BrEq6Jm6.d.ts → index-zWGtEhrf.d.ts} +2 -283
  46. package/dist/index.cjs +29 -92
  47. package/dist/index.cjs.map +1 -1
  48. package/dist/index.d.cts +9 -715
  49. package/dist/index.d.ts +4 -2
  50. package/dist/index.js +5 -68
  51. package/dist/index.js.map +1 -1
  52. package/dist/params-B5SENSzZ.d.cts +44 -0
  53. package/dist/{runtime-vH0EeZzH.cjs → runtime-DBzq5YBi.cjs} +13 -517
  54. package/dist/runtime-DBzq5YBi.cjs.map +1 -0
  55. package/dist/{runtime-Duf3ClPw.js → runtime-cxmUkk0l.js} +3 -389
  56. package/dist/runtime-cxmUkk0l.js.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/tsdown.config.ts +1 -1
  66. package/dist/runtime-Duf3ClPw.js.map +0 -1
  67. package/dist/runtime-vH0EeZzH.cjs.map +0 -1
@@ -1,62 +1,13 @@
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);
1
+ const require_di = require('./di-BlEKdoZS.cjs');
27
2
  let zod = require("zod");
28
- zod = __toESM(zod);
3
+ zod = require_di.__toESM(zod);
29
4
  let node_stream_web = require("node:stream/web");
30
- node_stream_web = __toESM(node_stream_web);
5
+ node_stream_web = require_di.__toESM(node_stream_web);
31
6
  let node_crypto = require("node:crypto");
32
- node_crypto = __toESM(node_crypto);
33
-
34
- //#region src/di/CoreTokens.ts
35
- const CoreTokens = {
36
- PersistedWorkflowTokenRegistry: Symbol.for("codemation.core.PersistedWorkflowTokenRegistry"),
37
- CredentialSessionService: Symbol.for("codemation.core.CredentialSessionService"),
38
- CredentialTypeRegistry: Symbol.for("codemation.core.CredentialTypeRegistry"),
39
- WorkflowRunnerService: Symbol.for("codemation.core.WorkflowRunnerService"),
40
- LiveWorkflowRepository: Symbol.for("codemation.core.LiveWorkflowRepository"),
41
- WorkflowRepository: Symbol.for("codemation.core.WorkflowRepository"),
42
- NodeResolver: Symbol.for("codemation.core.NodeResolver"),
43
- WorkflowNodeInstanceFactory: Symbol.for("codemation.core.WorkflowNodeInstanceFactory"),
44
- RunIdFactory: Symbol.for("codemation.core.RunIdFactory"),
45
- ActivationIdFactory: Symbol.for("codemation.core.ActivationIdFactory"),
46
- WorkflowExecutionRepository: Symbol.for("codemation.core.WorkflowExecutionRepository"),
47
- TriggerSetupStateRepository: Symbol.for("codemation.core.TriggerSetupStateRepository"),
48
- NodeActivationScheduler: Symbol.for("codemation.core.NodeActivationScheduler"),
49
- RunDataFactory: Symbol.for("codemation.core.RunDataFactory"),
50
- ExecutionContextFactory: Symbol.for("codemation.core.ExecutionContextFactory"),
51
- RunEventBus: Symbol.for("codemation.core.RunEventBus"),
52
- BinaryStorage: Symbol.for("codemation.core.BinaryStorage"),
53
- WebhookBasePath: Symbol.for("codemation.core.WebhookBasePath"),
54
- EngineExecutionLimitsPolicy: Symbol.for("codemation.core.EngineExecutionLimitsPolicy"),
55
- WorkflowActivationPolicy: Symbol.for("codemation.core.WorkflowActivationPolicy"),
56
- AgentMcpIntegration: Symbol.for("codemation.core.AgentMcpIntegration")
57
- };
7
+ node_crypto = require_di.__toESM(node_crypto);
8
+ let tsyringe = require("tsyringe");
9
+ tsyringe = require_di.__toESM(tsyringe);
58
10
 
59
- //#endregion
60
11
  //#region src/runtime-types/persistedRuntimeTypeModelRegistry.ts
61
12
  /** Shared metadata key used to attach persisted runtime-type information to decorated classes. */
62
13
  const persistedRuntimeTypeMetadataKey = Symbol.for("codemation.core.persistedRuntimeTypeMetadata");
@@ -165,289 +116,6 @@ function chatModel(options = {}) {
165
116
  return InjectableRuntimeDecoratorComposer.compose("chatModel", options, require("url").pathToFileURL(__filename).href);
166
117
  }
167
118
 
168
- //#endregion
169
- //#region src/ai/NodeBackedToolConfig.ts
170
- var NodeBackedToolConfig = class {
171
- type;
172
- toolKind = "nodeBacked";
173
- description;
174
- presentation;
175
- inputSchemaValue;
176
- outputSchemaValue;
177
- mapInputValue;
178
- mapOutputValue;
179
- constructor(name, node$1, options) {
180
- this.name = name;
181
- this.node = node$1;
182
- this.type = node$1.type;
183
- this.description = options.description;
184
- this.presentation = options.presentation;
185
- this.inputSchemaValue = options.inputSchema;
186
- this.outputSchemaValue = options.outputSchema;
187
- this.mapInputValue = options.mapInput;
188
- this.mapOutputValue = options.mapOutput;
189
- }
190
- getCredentialRequirements() {
191
- return this.node.getCredentialRequirements?.() ?? [];
192
- }
193
- getInputSchema() {
194
- return this.inputSchemaValue;
195
- }
196
- getOutputSchema() {
197
- return this.outputSchemaValue;
198
- }
199
- toNodeItem(args) {
200
- const mapped = this.mapInputValue?.(args) ?? args.input;
201
- if (this.isItem(mapped)) return mapped;
202
- return { json: mapped };
203
- }
204
- toToolOutput(args) {
205
- const raw = this.mapOutputValue?.(args) ?? this.readDefaultToolOutput(args.outputs);
206
- return this.outputSchemaValue.parse(raw);
207
- }
208
- readDefaultToolOutput(outputs) {
209
- const firstMainItem = outputs.main?.[0];
210
- if (!firstMainItem) throw new Error(`Node-backed tool "${this.name}" did not produce a main output item.`);
211
- return firstMainItem.json;
212
- }
213
- isItem(value) {
214
- return typeof value === "object" && value !== null && "json" in value;
215
- }
216
- };
217
-
218
- //#endregion
219
- //#region src/contracts/itemExpr.ts
220
- const ITEM_EXPR_BRAND = Symbol.for("codemation.itemExpr");
221
- function itemExpr(fn) {
222
- return {
223
- [ITEM_EXPR_BRAND]: true,
224
- fn
225
- };
226
- }
227
- function isItemExpr(value) {
228
- if (typeof value !== "object" || value === null) return false;
229
- const v = value;
230
- if (v[ITEM_EXPR_BRAND] === true) return true;
231
- const keys = Object.keys(v);
232
- if (keys.length === 1 && keys[0] === "fn" && typeof v.fn === "function") return true;
233
- for (const sym of Object.getOwnPropertySymbols(v)) if (sym.description === "codemation.itemExpr" && v[sym] === true) return true;
234
- return false;
235
- }
236
- function containsItemExprInUnknown(value, seen = /* @__PURE__ */ new WeakSet()) {
237
- if (isItemExpr(value)) return true;
238
- if (value === null || typeof value !== "object") return false;
239
- if (seen.has(value)) return false;
240
- seen.add(value);
241
- if (Array.isArray(value)) return value.some((entry) => containsItemExprInUnknown(entry, seen));
242
- for (const entry of Object.values(value)) if (containsItemExprInUnknown(entry, seen)) return true;
243
- return false;
244
- }
245
- /**
246
- * Deep-resolves {@link itemExpr} leaves. Returns a new graph (does not mutate the original config object).
247
- */
248
- async function resolveItemExprsInUnknown(value, args, seen = /* @__PURE__ */ new WeakSet()) {
249
- if (isItemExpr(value)) return await Promise.resolve(value.fn(args));
250
- if (value === null || typeof value !== "object") return value;
251
- if (seen.has(value)) return value;
252
- seen.add(value);
253
- if (Array.isArray(value)) {
254
- const out$1 = [];
255
- for (let i = 0; i < value.length; i++) out$1.push(await resolveItemExprsInUnknown(value[i], args, seen));
256
- return out$1;
257
- }
258
- const rec = value;
259
- const entries = Object.entries(rec);
260
- const proto = Object.getPrototypeOf(value);
261
- if (proto !== Object.prototype && proto !== null && entries.length === 0) return value;
262
- const out = Object.create(proto);
263
- for (const [k, v] of entries) out[k] = await resolveItemExprsInUnknown(v, args, seen);
264
- return out;
265
- }
266
- /**
267
- * Clones runnable config (best-effort) so per-item {@link itemExpr} resolution never mutates shared instances.
268
- */
269
- async function resolveItemExprsForExecution(config, nodeCtx, item, itemIndex, items) {
270
- const exprArgs = {
271
- item,
272
- itemIndex,
273
- items,
274
- ctx: {
275
- runId: nodeCtx.runId,
276
- workflowId: nodeCtx.workflowId,
277
- nodeId: nodeCtx.nodeId,
278
- activationId: nodeCtx.activationId,
279
- data: nodeCtx.data
280
- }
281
- };
282
- if (!containsItemExprInUnknown(config)) return;
283
- return await resolveItemExprsInUnknown(config, exprArgs);
284
- }
285
-
286
- //#endregion
287
- //#region src/ai/AgentConfigInspectorFactory.ts
288
- var AgentConfigInspector = class {
289
- static isAgentNodeConfig(config) {
290
- if (!config) return false;
291
- const candidate = config;
292
- return !!candidate.chatModel && this.hasCompatibleMessageConfiguration(candidate);
293
- }
294
- static hasCompatibleMessageConfiguration(candidate) {
295
- const messages = candidate.messages;
296
- if (messages === void 0 || messages === null) return false;
297
- if (Array.isArray(messages)) return messages.length > 0;
298
- if (typeof messages === "object") {
299
- if (isItemExpr(messages)) return true;
300
- const o = messages;
301
- return Array.isArray(o.prompt) && o.prompt.length > 0 || typeof o.buildMessages === "function";
302
- }
303
- return false;
304
- }
305
- };
306
-
307
- //#endregion
308
- //#region src/workflow/definition/ConnectionNodeIdFactory.ts
309
- /**
310
- * Deterministic ids for workflow connection-owned child nodes (LLM slot, tools, etc.).
311
- * These are stable across loads.
312
- */
313
- var ConnectionNodeIdFactory = class {
314
- static connectionSegment = "__conn__";
315
- static languageModelConnectionNodeId(parentNodeId) {
316
- return `${parentNodeId}${this.connectionSegment}llm`;
317
- }
318
- static toolConnectionNodeId(parentNodeId, toolName) {
319
- const normalized = this.normalizeToolName(toolName);
320
- return `${parentNodeId}${this.connectionSegment}tool${this.connectionSegment}${normalized}`;
321
- }
322
- static mcpConnectionNodeId(parentNodeId, serverId) {
323
- return `${parentNodeId}${this.connectionSegment}mcp${this.connectionSegment}${serverId}`;
324
- }
325
- static isMcpConnectionNodeId(nodeId) {
326
- return nodeId.includes(`${this.connectionSegment}mcp${this.connectionSegment}`);
327
- }
328
- static parseMcpConnectionNodeId(nodeId) {
329
- if (!this.isMcpConnectionNodeId(nodeId)) return;
330
- const marker = `${this.connectionSegment}mcp${this.connectionSegment}`;
331
- const idx = nodeId.lastIndexOf(marker);
332
- if (idx < 0) return;
333
- const parentNodeId = nodeId.slice(0, idx);
334
- const serverId = nodeId.slice(idx + marker.length);
335
- if (!parentNodeId || !serverId) return;
336
- return {
337
- parentNodeId,
338
- serverId
339
- };
340
- }
341
- static isLanguageModelConnectionNodeId(nodeId) {
342
- return nodeId.endsWith(`${this.connectionSegment}llm`);
343
- }
344
- static isToolConnectionNodeId(nodeId) {
345
- return nodeId.includes(`${this.connectionSegment}tool${this.connectionSegment}`);
346
- }
347
- static parseLanguageModelConnectionNodeId(nodeId) {
348
- if (!this.isLanguageModelConnectionNodeId(nodeId)) return;
349
- const suffix = `${this.connectionSegment}llm`;
350
- const parentNodeId = nodeId.slice(0, -suffix.length);
351
- return parentNodeId ? { parentNodeId } : void 0;
352
- }
353
- static parseToolConnectionNodeId(nodeId) {
354
- if (!this.isToolConnectionNodeId(nodeId)) return;
355
- const marker = `${this.connectionSegment}tool${this.connectionSegment}`;
356
- const idx = nodeId.lastIndexOf(marker);
357
- if (idx < 0) return;
358
- const parentNodeId = nodeId.slice(0, idx);
359
- const normalizedToolName = nodeId.slice(idx + marker.length);
360
- if (!parentNodeId || !normalizedToolName) return;
361
- return {
362
- parentNodeId,
363
- normalizedToolName
364
- };
365
- }
366
- /** True when `nodeId` is a connection-owned child of `parentNodeId` (LLM or tool slot). */
367
- static isConnectionOwnedDescendantOf(parentNodeId, nodeId) {
368
- return nodeId.startsWith(`${parentNodeId}${this.connectionSegment}`);
369
- }
370
- /** Normalizes a tool display name to a stable id segment. */
371
- static normalizeToolName(toolName) {
372
- return toolName.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "tool";
373
- }
374
- };
375
-
376
- //#endregion
377
- //#region src/ai/AgentConnectionNodeCollector.ts
378
- const AgentConnectionNodeCollector = new class {
379
- collect(parentNodeId, agentConfig, mcpServerResolver) {
380
- const collected = [];
381
- this.collectInto(parentNodeId, agentConfig, collected, mcpServerResolver);
382
- return collected;
383
- }
384
- collectInto(parentNodeId, agentConfig, collected, mcpServerResolver) {
385
- collected.push({
386
- nodeId: ConnectionNodeIdFactory.languageModelConnectionNodeId(parentNodeId),
387
- parentNodeId,
388
- connectionName: "llm",
389
- role: "languageModel",
390
- name: agentConfig.chatModel.presentation?.label ?? agentConfig.chatModel.name,
391
- typeName: agentConfig.chatModel.name,
392
- icon: agentConfig.chatModel.presentation?.icon,
393
- credentialSource: agentConfig.chatModel
394
- });
395
- for (const tool$1 of agentConfig.tools ?? []) {
396
- const toolNodeId = ConnectionNodeIdFactory.toolConnectionNodeId(parentNodeId, tool$1.name);
397
- const isNestedAgent = this.isNodeBackedAgentTool(tool$1);
398
- collected.push({
399
- nodeId: toolNodeId,
400
- parentNodeId,
401
- connectionName: "tools",
402
- role: isNestedAgent ? "nestedAgent" : "tool",
403
- name: tool$1.presentation?.label ?? tool$1.name,
404
- typeName: tool$1.name,
405
- icon: tool$1.presentation?.icon,
406
- credentialSource: tool$1
407
- });
408
- this.collectNestedAgentTools(toolNodeId, tool$1, collected, mcpServerResolver);
409
- }
410
- if (mcpServerResolver) {
411
- const mcpServers = agentConfig.mcpServers;
412
- for (const serverId of mcpServers ?? []) {
413
- const decl = mcpServerResolver(serverId);
414
- if (!decl) continue;
415
- const acceptedTypes = decl.acceptedCredentialTypes ?? [];
416
- collected.push({
417
- nodeId: ConnectionNodeIdFactory.mcpConnectionNodeId(parentNodeId, serverId),
418
- parentNodeId,
419
- connectionName: "tools",
420
- role: "tool",
421
- name: decl.displayName,
422
- typeName: serverId,
423
- icon: "lucide:plug",
424
- credentialSource: { getCredentialRequirements: () => [{
425
- slotKey: "credential",
426
- label: decl.displayName,
427
- acceptedTypes
428
- }] }
429
- });
430
- }
431
- }
432
- }
433
- collectNestedAgentTools(toolNodeId, tool$1, collected, mcpServerResolver) {
434
- if (!this.isNodeBackedAgentTool(tool$1)) return;
435
- const innerAgent = tool$1 instanceof NodeBackedToolConfig ? tool$1.node : tool$1.node;
436
- this.collectInto(toolNodeId, innerAgent, collected, mcpServerResolver);
437
- }
438
- /**
439
- * After JSON round-trip (persisted snapshots), tools are plain objects — `instanceof NodeBackedToolConfig` fails.
440
- * Detect node-backed tools structurally via {@link NodeBackedToolConfig#toolKind}.
441
- */
442
- isNodeBackedAgentTool(tool$1) {
443
- if (tool$1 instanceof NodeBackedToolConfig) return AgentConfigInspector.isAgentNodeConfig(tool$1.node);
444
- if (!tool$1 || typeof tool$1 !== "object") return false;
445
- const t = tool$1;
446
- if (t.toolKind !== "nodeBacked") return false;
447
- return AgentConfigInspector.isAgentNodeConfig(t.node);
448
- }
449
- }();
450
-
451
119
  //#endregion
452
120
  //#region src/workflow/dsl/WhenBuilder.ts
453
121
  var WhenBuilder = class WhenBuilder {
@@ -685,7 +353,7 @@ var WorkflowBuilder = class {
685
353
  tokenName,
686
354
  label: node$1.name ?? ""
687
355
  });
688
- if (AgentConfigInspector.isAgentNodeConfig(node$1.config)) for (const child of AgentConnectionNodeCollector.collect(node$1.id, node$1.config)) entries.push({
356
+ if (require_di.AgentConfigInspector.isAgentNodeConfig(node$1.config)) for (const child of require_di.AgentConnectionNodeCollector.collect(node$1.id, node$1.config)) entries.push({
689
357
  nodeId: child.nodeId,
690
358
  tokenName: child.typeName,
691
359
  label: child.name
@@ -738,33 +406,6 @@ var ConnectionInvocationIdFactory = class {
738
406
  }
739
407
  };
740
408
 
741
- //#endregion
742
- //#region src/workflow/definition/NodeIterationIdFactory.ts
743
- /**
744
- * Unique ids for one per-item iteration of a runnable node's execute loop.
745
- *
746
- * Activations are per-batch (one scheduled execution of a node, possibly with N items).
747
- * Iterations refine that to one identifier per item-index inside the batch loop, so per-item
748
- * connection invocations and telemetry can be grouped without time-window heuristics.
749
- *
750
- * Uses Web Crypto's `randomUUID` (Node 19+ and all modern browsers) so this module is safe
751
- * to include in the browser entry. Importing `node:crypto` here previously leaked into the
752
- * canvas client bundle through `browser.ts` and OOM'd consumers' Turbopack builds.
753
- */
754
- var NodeIterationIdFactory = class {
755
- static create() {
756
- return `iter_${globalThis.crypto.randomUUID()}`;
757
- }
758
- /** Deterministic id for tests when a stable sequence is needed. */
759
- static createForTest(seed, sequence) {
760
- return `iter_${seed}_${sequence}`;
761
- }
762
- /** Deterministic id derived from a connection node id (for sub-agent / tool-call scopes). */
763
- static createForConnection(connectionNodeId, sequence) {
764
- return `iter_${connectionNodeId}_${sequence}`;
765
- }
766
- };
767
-
768
409
  //#endregion
769
410
  //#region src/workflow/definition/WorkflowExecutableNodeClassifier.ts
770
411
  /**
@@ -1446,20 +1087,6 @@ var DefaultAsyncSleeper = class {
1446
1087
  }
1447
1088
  };
1448
1089
 
1449
- //#endregion
1450
- //#region src/contracts/NoOpAgentMcpIntegration.ts
1451
- /**
1452
- * No-op implementation of AgentMcpIntegration.
1453
- * Registered by the core engine runtime as a fallback when the host does not
1454
- * supply a real implementation (e.g. in unit tests or headless engine setups).
1455
- * Always returns an empty tool map so the agent runs with node-backed tools only.
1456
- */
1457
- var NoOpAgentMcpIntegration = class {
1458
- async prepareMcpTools() {
1459
- return /* @__PURE__ */ new Map();
1460
- }
1461
- };
1462
-
1463
1090
  //#endregion
1464
1091
  //#region src/contracts/emitPorts.ts
1465
1092
  const EMIT_PORTS_BRAND = Symbol.for("codemation.emitPorts");
@@ -1522,21 +1149,6 @@ var ExpRetryPolicy = class {
1522
1149
  }
1523
1150
  };
1524
1151
 
1525
- //#endregion
1526
- //#region src/contracts/credentialTypes.ts
1527
- var CredentialUnboundError = class CredentialUnboundError extends Error {
1528
- constructor(bindingKey, acceptedTypes = []) {
1529
- super(CredentialUnboundError.createMessage(bindingKey, acceptedTypes));
1530
- this.bindingKey = bindingKey;
1531
- this.acceptedTypes = acceptedTypes;
1532
- this.name = "CredentialUnboundError";
1533
- }
1534
- static createMessage(bindingKey, acceptedTypes) {
1535
- const acceptedTypesSuffix = acceptedTypes.length > 0 ? ` Accepted credential types: ${acceptedTypes.join(", ")}.` : "";
1536
- return `Credential slot "${bindingKey.slotKey}" is not bound for workflow ${bindingKey.workflowId} node ${bindingKey.nodeId}.${acceptedTypesSuffix}`;
1537
- }
1538
- };
1539
-
1540
1152
  //#endregion
1541
1153
  //#region src/contracts/CostTrackingTelemetryContract.ts
1542
1154
  const CostTrackingTelemetryMetricNames = {
@@ -1658,19 +1270,6 @@ var NoOpExecutionTelemetryFactory = class {
1658
1270
  }
1659
1271
  };
1660
1272
 
1661
- //#endregion
1662
- //#region src/contracts/runFinishedAtFactory.ts
1663
- /** Derives workflow end time from persisted run root or node snapshots for run listings. */
1664
- var RunFinishedAtFactory = class {
1665
- static resolveIso(state) {
1666
- if (state.finishedAt && state.status !== "running" && state.status !== "pending") return state.finishedAt;
1667
- if (state.status === "running" || state.status === "pending") return;
1668
- let max;
1669
- for (const snap of Object.values(state.nodeSnapshotsByNodeId)) if (snap?.finishedAt && (!max || snap.finishedAt > max)) max = snap.finishedAt;
1670
- return max;
1671
- }
1672
- };
1673
-
1674
1273
  //#endregion
1675
1274
  //#region src/contracts/workflowActivationPolicy.ts
1676
1275
  /** Default for tests and harnesses: every workflow is treated as active (legacy behavior). */
@@ -1728,13 +1327,6 @@ var CodemationTelemetryMetricNames = class {
1728
1327
  static gmailAttachmentBytes = "codemation.gmail.attachment_bytes";
1729
1328
  };
1730
1329
 
1731
- //#endregion
1732
- //#region src/contracts/workflowTypes.ts
1733
- function nodeRef(nodeId) {
1734
- return nodeId;
1735
- }
1736
- const branchRef = (index) => `$${index}`;
1737
-
1738
1330
  //#endregion
1739
1331
  //#region src/execution/ExecutionTelemetryCostTrackingDecoratorFactory.ts
1740
1332
  var ExecutionTelemetryCostTrackingDecoratorFactory = class {
@@ -2016,7 +1608,7 @@ var InProcessRetryRunner = class InProcessRetryRunner {
2016
1608
  var ItemExprResolver = class {
2017
1609
  async resolveConfigForItem(ctx, item, itemIndex, items) {
2018
1610
  if (!ctx) throw new Error("ItemExprResolver.resolveConfigForItem: ctx is required");
2019
- const resolvedConfig = await resolveItemExprsForExecution(ctx.config, ctx, item, itemIndex, items);
1611
+ const resolvedConfig = await require_di.resolveItemExprsForExecution(ctx.config, ctx, item, itemIndex, items);
2020
1612
  const merged = resolvedConfig !== void 0 && resolvedConfig !== null ? resolvedConfig : ctx.config;
2021
1613
  if (merged === void 0 || merged === null) return ctx;
2022
1614
  return {
@@ -2212,8 +1804,8 @@ var NodeExecutor = class {
2212
1804
  }
2213
1805
  }
2214
1806
  isCredentialError(e) {
2215
- if (e instanceof CredentialUnboundError) return true;
2216
- return (e instanceof Error ? e.cause : void 0) instanceof CredentialUnboundError;
1807
+ if (e instanceof require_di.CredentialUnboundError) return true;
1808
+ return (e instanceof Error ? e.cause : void 0) instanceof require_di.CredentialUnboundError;
2217
1809
  }
2218
1810
  async executeMultiInputActivation(request, node$1) {
2219
1811
  const multiInputNode = node$1;
@@ -2299,7 +1891,7 @@ var NodeExecutor = class {
2299
1891
  const resolvedCtx = await this.itemExprResolver.resolveConfigForItem(runnableCtx, item, i, inputBatch);
2300
1892
  const iterationCtx = {
2301
1893
  ...this.pickExecutionContext(runnableCtx, resolvedCtx),
2302
- iterationId: NodeIterationIdFactory.create(),
1894
+ iterationId: require_di.NodeIterationIdFactory.create(),
2303
1895
  itemIndex: i
2304
1896
  };
2305
1897
  const args = {
@@ -4201,7 +3793,7 @@ var CurrentStateFrontierPlanner = class CurrentStateFrontierPlanner {
4201
3793
  isRuntimeDescendant(nodeId, descendantNodeIds) {
4202
3794
  for (const descendantNodeId of descendantNodeIds) {
4203
3795
  if (nodeId === descendantNodeId) return false;
4204
- if (ConnectionNodeIdFactory.isConnectionOwnedDescendantOf(descendantNodeId, nodeId)) return true;
3796
+ if (require_di.ConnectionNodeIdFactory.isConnectionOwnedDescendantOf(descendantNodeId, nodeId)) return true;
4205
3797
  }
4206
3798
  return false;
4207
3799
  }
@@ -6305,18 +5897,6 @@ var WorkflowRepositoryWebhookTriggerMatcherFactory = class {
6305
5897
  };
6306
5898
 
6307
5899
  //#endregion
6308
- Object.defineProperty(exports, 'AgentConfigInspector', {
6309
- enumerable: true,
6310
- get: function () {
6311
- return AgentConfigInspector;
6312
- }
6313
- });
6314
- Object.defineProperty(exports, 'AgentConnectionNodeCollector', {
6315
- enumerable: true,
6316
- get: function () {
6317
- return AgentConnectionNodeCollector;
6318
- }
6319
- });
6320
5900
  Object.defineProperty(exports, 'AllWorkflowsActiveWorkflowActivationPolicy', {
6321
5901
  enumerable: true,
6322
5902
  get: function () {
@@ -6371,18 +5951,6 @@ Object.defineProperty(exports, 'ConnectionInvocationIdFactory', {
6371
5951
  return ConnectionInvocationIdFactory;
6372
5952
  }
6373
5953
  });
6374
- Object.defineProperty(exports, 'ConnectionNodeIdFactory', {
6375
- enumerable: true,
6376
- get: function () {
6377
- return ConnectionNodeIdFactory;
6378
- }
6379
- });
6380
- Object.defineProperty(exports, 'CoreTokens', {
6381
- enumerable: true,
6382
- get: function () {
6383
- return CoreTokens;
6384
- }
6385
- });
6386
5954
  Object.defineProperty(exports, 'CostTrackingTelemetryAttributeNames', {
6387
5955
  enumerable: true,
6388
5956
  get: function () {
@@ -6401,12 +5969,6 @@ Object.defineProperty(exports, 'CredentialResolverFactory', {
6401
5969
  return CredentialResolverFactory;
6402
5970
  }
6403
5971
  });
6404
- Object.defineProperty(exports, 'CredentialUnboundError', {
6405
- enumerable: true,
6406
- get: function () {
6407
- return CredentialUnboundError;
6408
- }
6409
- });
6410
5972
  Object.defineProperty(exports, 'DefaultAsyncSleeper', {
6411
5973
  enumerable: true,
6412
5974
  get: function () {
@@ -6551,12 +6113,6 @@ Object.defineProperty(exports, 'MissingRuntimeTriggerToken', {
6551
6113
  return MissingRuntimeTriggerToken;
6552
6114
  }
6553
6115
  });
6554
- Object.defineProperty(exports, 'NoOpAgentMcpIntegration', {
6555
- enumerable: true,
6556
- get: function () {
6557
- return NoOpAgentMcpIntegration;
6558
- }
6559
- });
6560
6116
  Object.defineProperty(exports, 'NoOpCostTrackingTelemetry', {
6561
6117
  enumerable: true,
6562
6118
  get: function () {
@@ -6611,12 +6167,6 @@ Object.defineProperty(exports, 'NoRetryPolicy', {
6611
6167
  return NoRetryPolicy;
6612
6168
  }
6613
6169
  });
6614
- Object.defineProperty(exports, 'NodeBackedToolConfig', {
6615
- enumerable: true,
6616
- get: function () {
6617
- return NodeBackedToolConfig;
6618
- }
6619
- });
6620
6170
  Object.defineProperty(exports, 'NodeEventPublisher', {
6621
6171
  enumerable: true,
6622
6172
  get: function () {
@@ -6653,12 +6203,6 @@ Object.defineProperty(exports, 'NodeInstanceFactoryFactory', {
6653
6203
  return NodeInstanceFactoryFactory;
6654
6204
  }
6655
6205
  });
6656
- Object.defineProperty(exports, 'NodeIterationIdFactory', {
6657
- enumerable: true,
6658
- get: function () {
6659
- return NodeIterationIdFactory;
6660
- }
6661
- });
6662
6206
  Object.defineProperty(exports, 'NodeOutputNormalizer', {
6663
6207
  enumerable: true,
6664
6208
  get: function () {
@@ -6701,12 +6245,6 @@ Object.defineProperty(exports, 'RetryPolicy', {
6701
6245
  return RetryPolicy;
6702
6246
  }
6703
6247
  });
6704
- Object.defineProperty(exports, 'RunFinishedAtFactory', {
6705
- enumerable: true,
6706
- get: function () {
6707
- return RunFinishedAtFactory;
6708
- }
6709
- });
6710
6248
  Object.defineProperty(exports, 'RunIntentService', {
6711
6249
  enumerable: true,
6712
6250
  get: function () {
@@ -6815,18 +6353,6 @@ Object.defineProperty(exports, 'WorkflowStoragePolicyEvaluator', {
6815
6353
  return WorkflowStoragePolicyEvaluator;
6816
6354
  }
6817
6355
  });
6818
- Object.defineProperty(exports, '__toESM', {
6819
- enumerable: true,
6820
- get: function () {
6821
- return __toESM;
6822
- }
6823
- });
6824
- Object.defineProperty(exports, 'branchRef', {
6825
- enumerable: true,
6826
- get: function () {
6827
- return branchRef;
6828
- }
6829
- });
6830
6356
  Object.defineProperty(exports, 'chatModel', {
6831
6357
  enumerable: true,
6832
6358
  get: function () {
@@ -6851,12 +6377,6 @@ Object.defineProperty(exports, 'getPersistedRuntimeTypeMetadata', {
6851
6377
  return getPersistedRuntimeTypeMetadata;
6852
6378
  }
6853
6379
  });
6854
- Object.defineProperty(exports, 'isItemExpr', {
6855
- enumerable: true,
6856
- get: function () {
6857
- return isItemExpr;
6858
- }
6859
- });
6860
6380
  Object.defineProperty(exports, 'isPortsEmission', {
6861
6381
  enumerable: true,
6862
6382
  get: function () {
@@ -6869,40 +6389,16 @@ Object.defineProperty(exports, 'isUnbrandedPortsEmissionShape', {
6869
6389
  return isUnbrandedPortsEmissionShape;
6870
6390
  }
6871
6391
  });
6872
- Object.defineProperty(exports, 'itemExpr', {
6873
- enumerable: true,
6874
- get: function () {
6875
- return itemExpr;
6876
- }
6877
- });
6878
6392
  Object.defineProperty(exports, 'node', {
6879
6393
  enumerable: true,
6880
6394
  get: function () {
6881
6395
  return node;
6882
6396
  }
6883
6397
  });
6884
- Object.defineProperty(exports, 'nodeRef', {
6885
- enumerable: true,
6886
- get: function () {
6887
- return nodeRef;
6888
- }
6889
- });
6890
- Object.defineProperty(exports, 'resolveItemExprsForExecution', {
6891
- enumerable: true,
6892
- get: function () {
6893
- return resolveItemExprsForExecution;
6894
- }
6895
- });
6896
- Object.defineProperty(exports, 'resolveItemExprsInUnknown', {
6897
- enumerable: true,
6898
- get: function () {
6899
- return resolveItemExprsInUnknown;
6900
- }
6901
- });
6902
6398
  Object.defineProperty(exports, 'tool', {
6903
6399
  enumerable: true,
6904
6400
  get: function () {
6905
6401
  return tool;
6906
6402
  }
6907
6403
  });
6908
- //# sourceMappingURL=runtime-vH0EeZzH.cjs.map
6404
+ //# sourceMappingURL=runtime-DBzq5YBi.cjs.map