@codemation/core 0.0.7 → 0.0.11

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 (195) hide show
  1. package/package.json +6 -1
  2. package/dist/EngineExecutionLimitsPolicy-8MEFIYx1.d.cts +0 -160
  3. package/dist/EngineExecutionLimitsPolicy-BWAXW9D6.d.cts +0 -160
  4. package/dist/EngineExecutionLimitsPolicy-Bp8PS1Ss.d.cts +0 -159
  5. package/dist/EngineExecutionLimitsPolicy-CLxcN-D2.d.ts +0 -159
  6. package/dist/EngineExecutionLimitsPolicy-DZXuix51.d.ts +0 -160
  7. package/dist/EngineExecutionLimitsPolicy-Gfz6ngFd.d.ts +0 -160
  8. package/dist/EngineFactory-CBnntY3J.cjs +0 -3152
  9. package/dist/EngineFactory-CBnntY3J.cjs.map +0 -1
  10. package/dist/EngineFactory-Cwn3R2YA.js +0 -3087
  11. package/dist/EngineFactory-Cwn3R2YA.js.map +0 -1
  12. package/dist/EngineFactory-DWCnNocp.js +0 -3063
  13. package/dist/EngineFactory-DWCnNocp.js.map +0 -1
  14. package/dist/EngineFactory-DhPFou4p.cjs +0 -3188
  15. package/dist/EngineFactory-DhPFou4p.cjs.map +0 -1
  16. package/dist/EngineFactory-l_9xmBtv.cjs +0 -3190
  17. package/dist/EngineFactory-l_9xmBtv.cjs.map +0 -1
  18. package/dist/EngineFactory-w-aOWuqh.js +0 -3089
  19. package/dist/EngineFactory-w-aOWuqh.js.map +0 -1
  20. package/dist/InMemoryLiveWorkflowRepository-1J9MHN_I.js +0 -18
  21. package/dist/InMemoryLiveWorkflowRepository-1J9MHN_I.js.map +0 -1
  22. package/dist/InMemoryLiveWorkflowRepository-CULNqv96.d.ts +0 -1300
  23. package/dist/InMemoryLiveWorkflowRepository-D6eiiXxF.d.cts +0 -1168
  24. package/dist/InMemoryLiveWorkflowRepository-D7l8cjdZ.d.cts +0 -1130
  25. package/dist/InMemoryLiveWorkflowRepository-DL7LmC9S.d.ts +0 -1340
  26. package/dist/InMemoryLiveWorkflowRepository-jnv-OnOP.d.ts +0 -1300
  27. package/dist/InMemoryLiveWorkflowRepository-xny1_Z6i.cjs +0 -24
  28. package/dist/InMemoryLiveWorkflowRepository-xny1_Z6i.cjs.map +0 -1
  29. package/dist/InMemoryLiveWorkflowRepository-xr7b4kvi.d.ts +0 -1338
  30. package/dist/InMemoryWorkflowCatalog-BIdFpwbK.d.ts +0 -1205
  31. package/dist/InMemoryWorkflowCatalog-BW00_3N3.d.cts +0 -12
  32. package/dist/InMemoryWorkflowCatalog-BiYHGoPw.cjs +0 -24
  33. package/dist/InMemoryWorkflowCatalog-BiYHGoPw.cjs.map +0 -1
  34. package/dist/InMemoryWorkflowCatalog-BrG0ApMO.d.cts +0 -1115
  35. package/dist/InMemoryWorkflowCatalog-BzrAr--Y.js +0 -139
  36. package/dist/InMemoryWorkflowCatalog-BzrAr--Y.js.map +0 -1
  37. package/dist/InMemoryWorkflowCatalog-C-EJlJ7y.d.cts +0 -1120
  38. package/dist/InMemoryWorkflowCatalog-C4482bpw.cjs +0 -24
  39. package/dist/InMemoryWorkflowCatalog-C4482bpw.cjs.map +0 -1
  40. package/dist/InMemoryWorkflowCatalog-CZ0kZpOv.d.ts +0 -1289
  41. package/dist/InMemoryWorkflowCatalog-C_ACeLyW.d.cts +0 -1119
  42. package/dist/InMemoryWorkflowCatalog-CiHWIu5E.d.cts +0 -12
  43. package/dist/InMemoryWorkflowCatalog-CkH7gkya.js +0 -18
  44. package/dist/InMemoryWorkflowCatalog-CkH7gkya.js.map +0 -1
  45. package/dist/InMemoryWorkflowCatalog-CnpZVJM9.d.ts +0 -1205
  46. package/dist/InMemoryWorkflowCatalog-Cu68S8YR.js +0 -18
  47. package/dist/InMemoryWorkflowCatalog-Cu68S8YR.js.map +0 -1
  48. package/dist/InMemoryWorkflowCatalog-D2w9nMj2.cjs +0 -151
  49. package/dist/InMemoryWorkflowCatalog-D2w9nMj2.cjs.map +0 -1
  50. package/dist/InMemoryWorkflowCatalog-D5eMxEf7.js +0 -18
  51. package/dist/InMemoryWorkflowCatalog-D5eMxEf7.js.map +0 -1
  52. package/dist/InMemoryWorkflowCatalog-D5nCp2yZ.d.ts +0 -1267
  53. package/dist/InMemoryWorkflowCatalog-DIq0bjqN.d.ts +0 -12
  54. package/dist/InMemoryWorkflowCatalog-DLgaEaw_.d.ts +0 -1288
  55. package/dist/InMemoryWorkflowCatalog-DNBFdK-x.d.cts +0 -1120
  56. package/dist/InMemoryWorkflowCatalog-DQBkCzb7.cjs +0 -24
  57. package/dist/InMemoryWorkflowCatalog-DQBkCzb7.cjs.map +0 -1
  58. package/dist/InMemoryWorkflowCatalog-DS4-eX6i.d.cts +0 -1118
  59. package/dist/InMemoryWorkflowCatalog-DdVfy8MY.d.ts +0 -12
  60. package/dist/InMemoryWorkflowCatalog-DeVZu3g8.d.ts +0 -12
  61. package/dist/InMemoryWorkflowCatalog-GxkQjvt5.d.ts +0 -1200
  62. package/dist/InMemoryWorkflowCatalog-qaVRn1Lc.d.cts +0 -1115
  63. package/dist/InMemoryWorkflowCatalog-z1aIT4TC.d.cts +0 -12
  64. package/dist/InMemoryWorkflowRegistry-BBuOovLL.d.ts +0 -1007
  65. package/dist/InMemoryWorkflowRegistry-BIFnSl3k.d.ts +0 -1201
  66. package/dist/InMemoryWorkflowRegistry-BnGilthz.d.ts +0 -1137
  67. package/dist/InMemoryWorkflowRegistry-CEp5I8No.d.ts +0 -1146
  68. package/dist/InMemoryWorkflowRegistry-CHyMB9jW.d.cts +0 -976
  69. package/dist/InMemoryWorkflowRegistry-CUN7K86m.d.cts +0 -1061
  70. package/dist/InMemoryWorkflowRegistry-CVfHyELh.d.cts +0 -971
  71. package/dist/InMemoryWorkflowRegistry-CXXJrwAr.d.cts +0 -1052
  72. package/dist/InMemoryWorkflowRegistry-DDGfPTJy.d.ts +0 -1013
  73. package/dist/InMemoryWorkflowRegistry-DnYSOoT5.d.ts +0 -1120
  74. package/dist/InMemoryWorkflowRegistry-Dp5GiFF2.d.cts +0 -1035
  75. package/dist/InMemoryWorkflowRegistry-DypDBeOw.d.cts +0 -1116
  76. package/dist/InMemoryWorkflowRegistry-SzwJCAxT.d.ts +0 -1012
  77. package/dist/InMemoryWorkflowRegistry-jupvqyGc.d.cts +0 -977
  78. package/dist/InMemoryWorkflowRegistry-rAdKVWYT.d.ts +0 -1117
  79. package/dist/InProcessRetryRunner-BBNPkXjy.d.cts +0 -292
  80. package/dist/PersistedWorkflowSnapshotFactory-7RkOL3Kg.d.ts +0 -14
  81. package/dist/PersistedWorkflowSnapshotFactory-BmANa46W.cjs +0 -141
  82. package/dist/PersistedWorkflowSnapshotFactory-BmANa46W.cjs.map +0 -1
  83. package/dist/PersistedWorkflowSnapshotFactory-Bwb_etSt.js +0 -118
  84. package/dist/PersistedWorkflowSnapshotFactory-Bwb_etSt.js.map +0 -1
  85. package/dist/PersistedWorkflowSnapshotFactory-CRkKGNV6.js +0 -123
  86. package/dist/PersistedWorkflowSnapshotFactory-CRkKGNV6.js.map +0 -1
  87. package/dist/PersistedWorkflowSnapshotFactory-CZolnGy5.js +0 -101
  88. package/dist/PersistedWorkflowSnapshotFactory-CZolnGy5.js.map +0 -1
  89. package/dist/PersistedWorkflowSnapshotFactory-Ca_oysOv.cjs +0 -131
  90. package/dist/PersistedWorkflowSnapshotFactory-Ca_oysOv.cjs.map +0 -1
  91. package/dist/PersistedWorkflowSnapshotFactory-CqIcShnX.js +0 -103
  92. package/dist/PersistedWorkflowSnapshotFactory-CqIcShnX.js.map +0 -1
  93. package/dist/PersistedWorkflowSnapshotFactory-D-tBk4_G.js +0 -119
  94. package/dist/PersistedWorkflowSnapshotFactory-D-tBk4_G.js.map +0 -1
  95. package/dist/PersistedWorkflowSnapshotFactory-D4cXl2e2.cjs +0 -131
  96. package/dist/PersistedWorkflowSnapshotFactory-D4cXl2e2.cjs.map +0 -1
  97. package/dist/PersistedWorkflowSnapshotFactory-DINoP12r.cjs +0 -131
  98. package/dist/PersistedWorkflowSnapshotFactory-DINoP12r.cjs.map +0 -1
  99. package/dist/PersistedWorkflowSnapshotFactory-DJAwSuHU.js +0 -103
  100. package/dist/PersistedWorkflowSnapshotFactory-DJAwSuHU.js.map +0 -1
  101. package/dist/PersistedWorkflowSnapshotFactory-DSUjVCcf.cjs +0 -131
  102. package/dist/PersistedWorkflowSnapshotFactory-DSUjVCcf.cjs.map +0 -1
  103. package/dist/PersistedWorkflowSnapshotFactory-DdHuhkDb.cjs +0 -107
  104. package/dist/PersistedWorkflowSnapshotFactory-DdHuhkDb.cjs.map +0 -1
  105. package/dist/PersistedWorkflowSnapshotFactory-Dqc6NHis.js +0 -119
  106. package/dist/PersistedWorkflowSnapshotFactory-Dqc6NHis.js.map +0 -1
  107. package/dist/PersistedWorkflowSnapshotFactory-Dxa2dSrw.cjs +0 -130
  108. package/dist/PersistedWorkflowSnapshotFactory-Dxa2dSrw.cjs.map +0 -1
  109. package/dist/PersistedWorkflowSnapshotFactory-Ep79Ah1G.js +0 -123
  110. package/dist/PersistedWorkflowSnapshotFactory-Ep79Ah1G.js.map +0 -1
  111. package/dist/PersistedWorkflowSnapshotFactory-GyLfRuiJ.js +0 -119
  112. package/dist/PersistedWorkflowSnapshotFactory-GyLfRuiJ.js.map +0 -1
  113. package/dist/PersistedWorkflowSnapshotFactory-HTpBsBzn.js +0 -102
  114. package/dist/PersistedWorkflowSnapshotFactory-HTpBsBzn.js.map +0 -1
  115. package/dist/PersistedWorkflowSnapshotFactory-LVmaaf3t.cjs +0 -141
  116. package/dist/PersistedWorkflowSnapshotFactory-LVmaaf3t.cjs.map +0 -1
  117. package/dist/PersistedWorkflowSnapshotFactory-PZCpo2ZS.js +0 -119
  118. package/dist/PersistedWorkflowSnapshotFactory-PZCpo2ZS.js.map +0 -1
  119. package/dist/PersistedWorkflowSnapshotFactory-UjQ1SJev.cjs +0 -109
  120. package/dist/PersistedWorkflowSnapshotFactory-UjQ1SJev.cjs.map +0 -1
  121. package/dist/PersistedWorkflowSnapshotFactory-Y8kCrhcy.cjs +0 -109
  122. package/dist/PersistedWorkflowSnapshotFactory-Y8kCrhcy.cjs.map +0 -1
  123. package/dist/PersistedWorkflowSnapshotFactory-Z_nB-fmB.cjs +0 -108
  124. package/dist/PersistedWorkflowSnapshotFactory-Z_nB-fmB.cjs.map +0 -1
  125. package/dist/RunIntentService-1EE6N8ZL.cjs +0 -963
  126. package/dist/RunIntentService-1EE6N8ZL.cjs.map +0 -1
  127. package/dist/RunIntentService-2ivFmNQh.cjs +0 -3462
  128. package/dist/RunIntentService-2ivFmNQh.cjs.map +0 -1
  129. package/dist/RunIntentService-B0sUL5q-.js +0 -761
  130. package/dist/RunIntentService-B0sUL5q-.js.map +0 -1
  131. package/dist/RunIntentService-BFVbsOcg.js +0 -3131
  132. package/dist/RunIntentService-BFVbsOcg.js.map +0 -1
  133. package/dist/RunIntentService-BsBOwpVN.cjs +0 -1051
  134. package/dist/RunIntentService-BsBOwpVN.cjs.map +0 -1
  135. package/dist/RunIntentService-CSk3ETyn.js +0 -858
  136. package/dist/RunIntentService-CSk3ETyn.js.map +0 -1
  137. package/dist/RunIntentService-Ckn3u3tA.d.cts +0 -326
  138. package/dist/RunIntentService-DEo6GTTo.d.cts +0 -289
  139. package/dist/RunIntentService-DKrGtL0B.js +0 -782
  140. package/dist/RunIntentService-DKrGtL0B.js.map +0 -1
  141. package/dist/RunIntentService-DNOJc1R7.cjs +0 -942
  142. package/dist/RunIntentService-DNOJc1R7.cjs.map +0 -1
  143. package/dist/RunIntentService-Dq3pV53j.d.cts +0 -289
  144. package/dist/RunIntentService-NKobsfMQ.d.cts +0 -274
  145. package/dist/WorkflowSnapshotCodec-C3fuuS_R.d.cts +0 -22
  146. package/dist/WorkflowSnapshotCodec-CUudUo6f.js +0 -123
  147. package/dist/WorkflowSnapshotCodec-CUudUo6f.js.map +0 -1
  148. package/dist/WorkflowSnapshotCodec-CuCPQZTc.cjs +0 -129
  149. package/dist/WorkflowSnapshotCodec-CuCPQZTc.cjs.map +0 -1
  150. package/dist/WorkflowSnapshotCodec-DLiXQNvV.d.cts +0 -22
  151. package/dist/WorkflowSnapshotCodec-DNtdrZ7l.d.cts +0 -22
  152. package/dist/WorkflowSnapshotCodec-DTdWkoW_.d.cts +0 -22
  153. package/dist/credentialTypes-B5h3dI7r.d.cts +0 -1107
  154. package/dist/credentialTypes-B9okPCVo.d.cts +0 -963
  155. package/dist/credentialTypes-BFL70rgZ.d.cts +0 -964
  156. package/dist/credentialTypes-BGkh1O07.d.ts +0 -1010
  157. package/dist/credentialTypes-BNLi4Q7u.d.ts +0 -1030
  158. package/dist/credentialTypes-CeSoZGj3.d.cts +0 -994
  159. package/dist/credentialTypes-CpHc32Ig.d.cts +0 -984
  160. package/dist/credentialTypes-D0m7MQQl.d.cts +0 -1107
  161. package/dist/credentialTypes-D4nL2sUd.d.ts +0 -1000
  162. package/dist/credentialTypes-DBYK2Qbu.d.ts +0 -999
  163. package/dist/credentialTypes-DMJVy0r1.d.ts +0 -1000
  164. package/dist/credentialTypes-DhUAjYQp.d.ts +0 -1020
  165. package/dist/credentialTypes-gGITj5KL.d.cts +0 -964
  166. package/dist/credentialTypes-r3KVBJBE.d.cts +0 -974
  167. package/dist/diTokens-ClO27tjK.cjs +0 -34
  168. package/dist/diTokens-ClO27tjK.cjs.map +0 -1
  169. package/dist/diTokens-CoHBkwG6.js +0 -28
  170. package/dist/diTokens-CoHBkwG6.js.map +0 -1
  171. package/dist/index-6Doxmfnd.d.ts +0 -857
  172. package/dist/index-9g6Pfe9Z.d.ts +0 -689
  173. package/dist/index-AZ72Ej-K.d.ts +0 -920
  174. package/dist/index-BEk9V-q-.d.ts +0 -667
  175. package/dist/index-Bjt7_7oS.d.ts +0 -1192
  176. package/dist/index-CFGxsYXy.d.ts +0 -708
  177. package/dist/index-C_u8xFgn.d.ts +0 -690
  178. package/dist/index-CpbfsvOJ.d.ts +0 -1192
  179. package/dist/index-CsReNJN_.d.ts +0 -859
  180. package/dist/index-D5iNnXaW.d.ts +0 -667
  181. package/dist/index-DD_Eft1q.d.ts +0 -708
  182. package/dist/index-DiSYUe0G.d.ts +0 -1192
  183. package/dist/index-gIcH60sp.d.ts +0 -674
  184. package/dist/runtime-BIvd-1JA.cjs +0 -4112
  185. package/dist/runtime-BIvd-1JA.cjs.map +0 -1
  186. package/dist/runtime-D3eWKSQK.cjs +0 -3986
  187. package/dist/runtime-D3eWKSQK.cjs.map +0 -1
  188. package/dist/runtime-Dvp4xAjg.js +0 -3799
  189. package/dist/runtime-Dvp4xAjg.js.map +0 -1
  190. package/dist/runtime-vc76SSAa.js +0 -3685
  191. package/dist/runtime-vc76SSAa.js.map +0 -1
  192. package/dist/runtimeTypes-BK0b8SaG.d.cts +0 -884
  193. package/dist/runtimeTypes-CoYZkYQq.d.cts +0 -851
  194. package/dist/runtimeTypes-D-Pm0Uas.d.cts +0 -849
  195. package/dist/types-Cb5UK7Y6.d.ts +0 -857
@@ -1,942 +0,0 @@
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
- let node_crypto = require("node:crypto");
25
- node_crypto = __toESM(node_crypto);
26
- require("reflect-metadata");
27
- let tsyringe = require("tsyringe");
28
- tsyringe = __toESM(tsyringe);
29
- let node_stream_web = require("node:stream/web");
30
- node_stream_web = __toESM(node_stream_web);
31
-
32
- //#region src/workflow/definition/ConnectionNodeIdFactory.ts
33
- /**
34
- * Deterministic ids for workflow connection-owned child nodes (LLM slot, tools, etc.).
35
- * These are stable across loads.
36
- */
37
- var ConnectionNodeIdFactory = class {
38
- static connectionSegment = "__conn__";
39
- static languageModelConnectionNodeId(parentNodeId) {
40
- return `${parentNodeId}${this.connectionSegment}llm`;
41
- }
42
- static toolConnectionNodeId(parentNodeId, toolName) {
43
- const normalized = this.normalizeToolName(toolName);
44
- return `${parentNodeId}${this.connectionSegment}tool${this.connectionSegment}${normalized}`;
45
- }
46
- static isLanguageModelConnectionNodeId(nodeId) {
47
- return nodeId.endsWith(`${this.connectionSegment}llm`);
48
- }
49
- static isToolConnectionNodeId(nodeId) {
50
- return nodeId.includes(`${this.connectionSegment}tool${this.connectionSegment}`);
51
- }
52
- /** True when `nodeId` is a connection-owned child of `parentNodeId` (LLM or tool slot). */
53
- static isConnectionOwnedDescendantOf(parentNodeId, nodeId) {
54
- return nodeId.startsWith(`${parentNodeId}${this.connectionSegment}`);
55
- }
56
- /** Normalizes a tool display name to a stable id segment. */
57
- static normalizeToolName(toolName) {
58
- return toolName.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "tool";
59
- }
60
- };
61
-
62
- //#endregion
63
- //#region src/workflow/definition/WorkflowExecutableNodeClassifier.ts
64
- /**
65
- * Derives which workflow nodes participate in the main execution graph vs connection-only children.
66
- */
67
- var WorkflowExecutableNodeClassifier = class {
68
- connectionOwnedIds;
69
- constructor(workflow) {
70
- this.connectionOwnedIds = this.collectConnectionOwnedIds(workflow);
71
- }
72
- isConnectionOwnedNodeId(nodeId) {
73
- return this.connectionOwnedIds.has(nodeId);
74
- }
75
- isExecutableNodeId(nodeId) {
76
- return !this.connectionOwnedIds.has(nodeId);
77
- }
78
- filterExecutableNodeDefinitions(nodes) {
79
- return nodes.filter((n) => this.isExecutableNodeId(n.id));
80
- }
81
- collectConnectionOwnedIds(workflow) {
82
- const ids = /* @__PURE__ */ new Set();
83
- for (const connection of workflow.connections ?? []) for (const childId of connection.childNodeIds) ids.add(childId);
84
- return ids;
85
- }
86
- /**
87
- * Resolves the default start node: first trigger, else first executable node with no incoming edges from executable nodes.
88
- */
89
- findDefaultExecutableStartNodeId(workflow) {
90
- const firstTrigger = workflow.nodes.find((n) => n.kind === "trigger" && this.isExecutableNodeId(n.id))?.id;
91
- if (firstTrigger) return firstTrigger;
92
- const incoming = /* @__PURE__ */ new Map();
93
- for (const n of workflow.nodes) if (this.isExecutableNodeId(n.id)) incoming.set(n.id, 0);
94
- for (const e of workflow.edges) {
95
- if (!this.isExecutableNodeId(e.from.nodeId) || !this.isExecutableNodeId(e.to.nodeId)) continue;
96
- incoming.set(e.to.nodeId, (incoming.get(e.to.nodeId) ?? 0) + 1);
97
- }
98
- return workflow.nodes.find((n) => this.isExecutableNodeId(n.id) && (incoming.get(n.id) ?? 0) === 0)?.id ?? workflow.nodes.find((n) => this.isExecutableNodeId(n.id))?.id ?? (() => {
99
- throw new Error(`Workflow ${workflow.id} has no executable nodes`);
100
- })();
101
- }
102
- firstExecutableNodeIdInDefinitionOrder(workflow) {
103
- return workflow.nodes.find((n) => this.isExecutableNodeId(n.id))?.id;
104
- }
105
- lastExecutableNodeIdInDefinitionOrder(workflow) {
106
- for (let i = workflow.nodes.length - 1; i >= 0; i--) {
107
- const n = workflow.nodes[i];
108
- if (this.isExecutableNodeId(n.id)) return n.id;
109
- }
110
- throw new Error(`Workflow ${workflow.id} has no executable nodes`);
111
- }
112
- };
113
-
114
- //#endregion
115
- //#region src/workflow/definition/WorkflowExecutableNodeClassifierFactory.ts
116
- function createWorkflowExecutableNodeClassifier(workflow) {
117
- return new WorkflowExecutableNodeClassifier(workflow);
118
- }
119
-
120
- //#endregion
121
- //#region src/diTokens/index.ts
122
- const CoreTokens = {
123
- PersistedWorkflowTokenRegistry: Symbol.for("codemation.core.PersistedWorkflowTokenRegistry"),
124
- CredentialSessionService: Symbol.for("codemation.core.CredentialSessionService"),
125
- CredentialTypeRegistry: Symbol.for("codemation.core.CredentialTypeRegistry"),
126
- WorkflowRunnerService: Symbol.for("codemation.core.WorkflowRunnerService"),
127
- WorkflowRunnerResolver: Symbol.for("codemation.core.WorkflowRunnerResolver"),
128
- WorkflowCatalog: Symbol.for("codemation.core.WorkflowCatalog"),
129
- WorkflowRepository: Symbol.for("codemation.core.WorkflowRepository"),
130
- ServiceContainer: Symbol.for("codemation.core.ServiceContainer"),
131
- NodeResolver: Symbol.for("codemation.core.NodeResolver"),
132
- RunIdFactory: Symbol.for("codemation.core.RunIdFactory"),
133
- ActivationIdFactory: Symbol.for("codemation.core.ActivationIdFactory"),
134
- RunStateStore: Symbol.for("codemation.core.RunStateStore"),
135
- TriggerSetupStateStore: Symbol.for("codemation.core.TriggerSetupStateStore"),
136
- NodeActivationScheduler: Symbol.for("codemation.core.NodeActivationScheduler"),
137
- RunDataFactory: Symbol.for("codemation.core.RunDataFactory"),
138
- ExecutionContextFactory: Symbol.for("codemation.core.ExecutionContextFactory"),
139
- RunEventBus: Symbol.for("codemation.core.RunEventBus"),
140
- BinaryStorage: Symbol.for("codemation.core.BinaryStorage"),
141
- WebhookBasePath: Symbol.for("codemation.core.WebhookBasePath"),
142
- EngineExecutionLimitsPolicy: Symbol.for("codemation.core.EngineExecutionLimitsPolicy"),
143
- WorkflowActivationPolicy: Symbol.for("codemation.core.WorkflowActivationPolicy")
144
- };
145
-
146
- //#endregion
147
- //#region src/events/NodeEventPublisher.ts
148
- /** Publishes node lifecycle snapshots onto the run {@link RunEventBus}. */
149
- var NodeEventPublisher = class {
150
- constructor(eventBus) {
151
- this.eventBus = eventBus;
152
- }
153
- async publish(kind, snapshot) {
154
- if (!this.eventBus) return;
155
- await this.eventBus.publish({
156
- kind,
157
- runId: snapshot.runId,
158
- workflowId: snapshot.workflowId,
159
- parent: snapshot.parent,
160
- at: snapshot.updatedAt,
161
- snapshot
162
- });
163
- }
164
- };
165
-
166
- //#endregion
167
- //#region src/runtime-types/persistedRuntimeTypeModelRegistry.ts
168
- const persistedRuntimeTypeMetadataKey = Symbol.for("codemation.core.persistedRuntimeTypeMetadata");
169
- var PersistedRuntimeTypeDecoratorDefaults = class {
170
- static appPackageName = "app";
171
- static apply(options) {
172
- return {
173
- ...options,
174
- packageName: options.packageName ?? this.appPackageName
175
- };
176
- }
177
- };
178
-
179
- //#endregion
180
- //#region src/runtime-types/PersistedRuntimeTypeNameResolver.ts
181
- var PersistedRuntimeTypeNameResolver = class {
182
- static resolve(target, override) {
183
- const resolved = override ?? target.name;
184
- if (!resolved) throw new Error("Persisted runtime token metadata requires a named class or an explicit decorator name override.");
185
- return resolved;
186
- }
187
- };
188
-
189
- //#endregion
190
- //#region src/runtime-types/StackTraceCallSitePathResolver.ts
191
- var StackTraceCallSitePathResolver = class {
192
- static resolve(decoratorFileUrl) {
193
- const stack = (/* @__PURE__ */ new Error()).stack ?? "";
194
- for (const line of stack.split("\n")) {
195
- const candidate = this.extractPath(line.trim());
196
- if (!candidate) continue;
197
- if (candidate === decoratorFileUrl || candidate.includes("runtimeTypeDecorators")) continue;
198
- return candidate;
199
- }
200
- }
201
- static extractPath(line) {
202
- const fileUrlMatch = line.match(/file:\/\/[^\s)]+/);
203
- if (fileUrlMatch) return fileUrlMatch[0];
204
- const parenMatch = line.match(/\((\/[^)]+)\)/);
205
- if (parenMatch) return parenMatch[1];
206
- return line.match(/at (\/[^\s]+)/)?.[1];
207
- }
208
- };
209
-
210
- //#endregion
211
- //#region src/runtime-types/PersistedRuntimeTypeMetadataStoreRegistry.ts
212
- var PersistedRuntimeTypeMetadataStore = class {
213
- static define(target, kind, options, decoratorFileUrl) {
214
- const normalizedOptions = PersistedRuntimeTypeDecoratorDefaults.apply(options);
215
- const metadata = {
216
- persistedName: PersistedRuntimeTypeNameResolver.resolve(target, normalizedOptions.name),
217
- kind,
218
- packageName: normalizedOptions.packageName ?? PersistedRuntimeTypeDecoratorDefaults.appPackageName,
219
- sourceHint: normalizedOptions.moduleUrl ?? StackTraceCallSitePathResolver.resolve(decoratorFileUrl)
220
- };
221
- Object.defineProperty(target, persistedRuntimeTypeMetadataKey, {
222
- configurable: false,
223
- enumerable: false,
224
- writable: false,
225
- value: metadata
226
- });
227
- }
228
- static get(target) {
229
- if (!target || typeof target !== "function" && typeof target !== "object") return;
230
- return target[persistedRuntimeTypeMetadataKey];
231
- }
232
- };
233
-
234
- //#endregion
235
- //#region src/runtime-types/InjectableRuntimeDecoratorComposerRegistry.ts
236
- var InjectableRuntimeDecoratorComposer = class {
237
- static compose(kind, options, decoratorFileUrl) {
238
- return (target) => {
239
- (0, tsyringe.injectable)()(target);
240
- PersistedRuntimeTypeMetadataStore.define(target, kind, options, decoratorFileUrl);
241
- };
242
- }
243
- };
244
-
245
- //#endregion
246
- //#region src/runtime-types/runtimeTypeDecorators.types.ts
247
- function getPersistedRuntimeTypeMetadata(target) {
248
- return PersistedRuntimeTypeMetadataStore.get(target);
249
- }
250
- function node(options = {}) {
251
- return InjectableRuntimeDecoratorComposer.compose("node", options, require("url").pathToFileURL(__filename).href);
252
- }
253
- function tool(options = {}) {
254
- return InjectableRuntimeDecoratorComposer.compose("tool", options, require("url").pathToFileURL(__filename).href);
255
- }
256
- function chatModel(options = {}) {
257
- return InjectableRuntimeDecoratorComposer.compose("chatModel", options, require("url").pathToFileURL(__filename).href);
258
- }
259
-
260
- //#endregion
261
- //#region src/binaries/DefaultNodeBinaryAttachmentServiceFactory.ts
262
- var DefaultNodeBinaryAttachmentService = class DefaultNodeBinaryAttachmentService {
263
- constructor(storage, workflowId, runId, nodeId, activationId, now) {
264
- this.storage = storage;
265
- this.workflowId = workflowId;
266
- this.runId = runId;
267
- this.nodeId = nodeId;
268
- this.activationId = activationId;
269
- this.now = now;
270
- }
271
- async attach(args) {
272
- const attachmentId = this.createAttachmentId();
273
- const createdAt = this.now().toISOString();
274
- const storageKey = this.createStorageKey(args, attachmentId);
275
- const stored = await this.storage.write({
276
- storageKey,
277
- body: args.body
278
- });
279
- return {
280
- id: attachmentId,
281
- storageKey: stored.storageKey,
282
- mimeType: args.mimeType,
283
- size: stored.size,
284
- storageDriver: this.storage.driverName,
285
- previewKind: args.previewKind ?? this.resolvePreviewKind(args.mimeType),
286
- createdAt,
287
- runId: this.runId,
288
- workflowId: this.workflowId,
289
- nodeId: this.nodeId,
290
- activationId: this.activationId,
291
- filename: args.filename,
292
- sha256: stored.sha256
293
- };
294
- }
295
- withAttachment(item, name, attachment) {
296
- return {
297
- ...item,
298
- binary: {
299
- ...item.binary ?? {},
300
- [name]: attachment
301
- }
302
- };
303
- }
304
- forNode(args) {
305
- return new DefaultNodeBinaryAttachmentService(this.storage, this.workflowId, this.runId, args.nodeId, args.activationId, this.now);
306
- }
307
- async openReadStream(attachment) {
308
- return await this.storage.openReadStream(attachment.storageKey);
309
- }
310
- createAttachmentId() {
311
- return DefaultNodeBinaryAttachmentService.createAttachmentIdValue(`${this.activationId}-${this.now().getTime()}`);
312
- }
313
- static createAttachmentIdValue(fallbackValue) {
314
- const cryptoObject = globalThis.crypto;
315
- if (cryptoObject && typeof cryptoObject.randomUUID === "function") return cryptoObject.randomUUID();
316
- return fallbackValue;
317
- }
318
- createStorageKey(args, attachmentId) {
319
- const safeName = this.sanitizeSegment(args.name);
320
- const safeFilename = this.sanitizeFilename(args.filename);
321
- const filenameSuffix = safeFilename ? `-${safeFilename}` : "";
322
- return `${this.sanitizeSegment(this.workflowId)}/${this.sanitizeSegment(this.runId)}/${this.sanitizeSegment(this.nodeId)}/${this.sanitizeSegment(this.activationId)}/${attachmentId}-${safeName}${filenameSuffix}`;
323
- }
324
- sanitizeSegment(value) {
325
- const normalized = value.trim();
326
- if (!normalized) return "item";
327
- return normalized.replace(/[^a-zA-Z0-9._-]+/g, "_");
328
- }
329
- sanitizeFilename(value) {
330
- if (!value) return;
331
- const normalized = value.trim().split("/").at(-1)?.split("\\").at(-1) ?? value.trim();
332
- if (!normalized) return;
333
- return normalized.replace(/[^a-zA-Z0-9._-]+/g, "_");
334
- }
335
- resolvePreviewKind(mimeType) {
336
- if (mimeType.startsWith("image/")) return "image";
337
- if (mimeType.startsWith("audio/")) return "audio";
338
- if (mimeType.startsWith("video/")) return "video";
339
- return "download";
340
- }
341
- };
342
-
343
- //#endregion
344
- //#region src/binaries/UnavailableBinaryStorage.ts
345
- var UnavailableBinaryStorage = class {
346
- driverName = "unavailable";
347
- async write() {
348
- throw new Error("Binary storage is not configured for this runtime.");
349
- }
350
- async openReadStream() {}
351
- async stat() {
352
- return { exists: false };
353
- }
354
- async delete() {}
355
- };
356
-
357
- //#endregion
358
- //#region src/binaries/DefaultExecutionBinaryServiceFactory.ts
359
- var DefaultExecutionBinaryService = class {
360
- constructor(storage, workflowId, runId, now) {
361
- this.storage = storage;
362
- this.workflowId = workflowId;
363
- this.runId = runId;
364
- this.now = now;
365
- }
366
- forNode(args) {
367
- return new DefaultNodeBinaryAttachmentService(this.storage, this.workflowId, this.runId, args.nodeId, args.activationId, this.now);
368
- }
369
- async openReadStream(attachment) {
370
- return await this.storage.openReadStream(attachment.storageKey);
371
- }
372
- };
373
-
374
- //#endregion
375
- //#region src/execution/DefaultAsyncSleeper.ts
376
- var DefaultAsyncSleeper = class {
377
- sleep(ms) {
378
- return new Promise((resolve) => {
379
- setTimeout(resolve, ms);
380
- });
381
- }
382
- };
383
-
384
- //#endregion
385
- //#region src/execution/InProcessRetryRunner.ts
386
- var InProcessRetryRunner = class InProcessRetryRunner {
387
- constructor(sleeper) {
388
- this.sleeper = sleeper;
389
- }
390
- async run(policy, work) {
391
- const spec = InProcessRetryRunner.normalizePolicy(policy);
392
- let lastError;
393
- for (let attempt = 1; attempt <= spec.maxAttempts; attempt++) try {
394
- return await work();
395
- } catch (error) {
396
- lastError = error;
397
- if (attempt >= spec.maxAttempts) break;
398
- const delayMs = InProcessRetryRunner.delayAfterFailureMs(spec, attempt);
399
- await this.sleeper.sleep(delayMs);
400
- }
401
- throw lastError instanceof Error ? lastError : new Error(String(lastError));
402
- }
403
- static delayAfterFailureMs(spec, failedAttempt) {
404
- if (spec.kind === "none") return 0;
405
- if (spec.kind === "fixed") return spec.delayMs;
406
- const exponent = failedAttempt - 1;
407
- let ms = spec.initialDelayMs * Math.pow(spec.multiplier, exponent);
408
- if (spec.jitter === true) ms *= 1 + Math.random() * .2;
409
- if (spec.maxDelayMs !== void 0 && ms > spec.maxDelayMs) ms = spec.maxDelayMs;
410
- return Math.max(0, Math.floor(ms));
411
- }
412
- static normalizePolicy(policy) {
413
- if (policy === void 0) return {
414
- kind: "none",
415
- maxAttempts: 1
416
- };
417
- if (typeof policy !== "object" || policy === null) return {
418
- kind: "none",
419
- maxAttempts: 1
420
- };
421
- const kind = policy.kind;
422
- if (kind === "none") return {
423
- kind: "none",
424
- maxAttempts: 1
425
- };
426
- if (kind === "fixed") {
427
- const p = policy;
428
- return {
429
- kind: "fixed",
430
- maxAttempts: InProcessRetryRunner.assertPositiveInt(p.maxAttempts, "fixed.maxAttempts"),
431
- delayMs: InProcessRetryRunner.assertNonNegativeFinite(p.delayMs, "fixed.delayMs")
432
- };
433
- }
434
- if (kind === "exponential") {
435
- const p = policy;
436
- return {
437
- kind: "exponential",
438
- maxAttempts: InProcessRetryRunner.assertPositiveInt(p.maxAttempts, "exponential.maxAttempts"),
439
- initialDelayMs: InProcessRetryRunner.assertNonNegativeFinite(p.initialDelayMs, "exponential.initialDelayMs"),
440
- multiplier: InProcessRetryRunner.assertMultiplier(p.multiplier),
441
- maxDelayMs: p.maxDelayMs === void 0 ? void 0 : InProcessRetryRunner.assertNonNegativeFinite(p.maxDelayMs, "exponential.maxDelayMs"),
442
- jitter: p.jitter === true
443
- };
444
- }
445
- return {
446
- kind: "none",
447
- maxAttempts: 1
448
- };
449
- }
450
- static assertPositiveInt(value, label) {
451
- if (typeof value !== "number" || !Number.isFinite(value) || value < 1 || !Number.isInteger(value)) throw new Error(`Retry policy ${label} must be a positive integer`);
452
- return value;
453
- }
454
- static assertNonNegativeFinite(value, label) {
455
- if (typeof value !== "number" || !Number.isFinite(value) || value < 0) throw new Error(`Retry policy ${label} must be a non-negative finite number`);
456
- return value;
457
- }
458
- static assertMultiplier(value) {
459
- if (typeof value !== "number" || !Number.isFinite(value) || value < 1) throw new Error(`Retry policy exponential.multiplier must be >= 1`);
460
- return value;
461
- }
462
- };
463
-
464
- //#endregion
465
- //#region src/executionContext/CredentialResolverFactory.ts
466
- var CredentialResolverFactory = class {
467
- constructor(credentialSessions) {
468
- this.credentialSessions = credentialSessions;
469
- }
470
- create(workflowId, nodeId, config) {
471
- const acceptedTypesBySlot = /* @__PURE__ */ new Map();
472
- for (const requirement of config?.getCredentialRequirements?.() ?? []) acceptedTypesBySlot.set(requirement.slotKey, requirement.acceptedTypes);
473
- return async (slotKey) => {
474
- try {
475
- return await this.credentialSessions.getSession({
476
- workflowId,
477
- nodeId,
478
- slotKey
479
- });
480
- } catch (error) {
481
- const acceptedTypes = acceptedTypesBySlot.get(slotKey) ?? [];
482
- const message = error instanceof Error ? error.message : String(error);
483
- const alreadyListsAcceptedTypes = message.includes("Accepted types:") || message.includes("Accepted credential types:") || message.includes("binding points at an unknown type");
484
- const acceptedTypesSuffix = acceptedTypes.length > 0 && !alreadyListsAcceptedTypes ? ` Accepted types: ${acceptedTypes.join(", ")}.` : "";
485
- throw new Error(`Failed to resolve credential for workflow ${workflowId} node ${nodeId} slot "${slotKey}". ${message}${acceptedTypesSuffix}`, { cause: error });
486
- }
487
- };
488
- }
489
- };
490
-
491
- //#endregion
492
- //#region src/executionContext/DefaultExecutionContextFactory.ts
493
- var DefaultExecutionContextFactory = class {
494
- constructor(binaryStorage = new UnavailableBinaryStorage(), currentDate = () => /* @__PURE__ */ new Date()) {
495
- this.binaryStorage = binaryStorage;
496
- this.currentDate = currentDate;
497
- }
498
- create(args) {
499
- return {
500
- runId: args.runId,
501
- workflowId: args.workflowId,
502
- parent: args.parent,
503
- subworkflowDepth: args.subworkflowDepth,
504
- engineMaxNodeActivations: args.engineMaxNodeActivations,
505
- engineMaxSubworkflowDepth: args.engineMaxSubworkflowDepth,
506
- now: this.currentDate,
507
- data: args.data,
508
- nodeState: args.nodeState,
509
- binary: new DefaultExecutionBinaryService(this.binaryStorage, args.workflowId, args.runId, this.currentDate),
510
- getCredential: args.getCredential
511
- };
512
- }
513
- };
514
-
515
- //#endregion
516
- //#region src/policies/EngineExecutionLimitsPolicy.ts
517
- /** Framework defaults for {@link EngineExecutionLimitsPolicy} (merged with host `runtime.engineExecutionLimits`). */
518
- const ENGINE_EXECUTION_LIMITS_DEFAULTS = {
519
- defaultMaxNodeActivations: 1e5,
520
- hardMaxNodeActivations: 1e5,
521
- defaultMaxSubworkflowDepth: 32,
522
- hardMaxSubworkflowDepth: 32
523
- };
524
- /**
525
- * Resolves per-run execution limits: defaults, hard ceilings, and subworkflow depth for new runs.
526
- */
527
- var EngineExecutionLimitsPolicy = class {
528
- constructor(config = ENGINE_EXECUTION_LIMITS_DEFAULTS) {
529
- this.config = config;
530
- }
531
- /**
532
- * Effective options for a new root run (depth 0): defaults merged with engine ceilings.
533
- * Replaces a separate one-method factory for root-run bootstrap.
534
- */
535
- createRootExecutionOptions() {
536
- return this.mergeExecutionOptionsForNewRun(void 0, void 0);
537
- }
538
- mergeExecutionOptionsForNewRun(parent, user) {
539
- const subworkflowDepth = parent === void 0 ? 0 : (parent.subworkflowDepth ?? 0) + 1;
540
- const inheritedMaxNode = parent?.engineMaxNodeActivations;
541
- const inheritedMaxSub = parent?.engineMaxSubworkflowDepth;
542
- const maxNodeActivations = this.capNumber(user?.maxNodeActivations ?? inheritedMaxNode, this.config.defaultMaxNodeActivations, this.config.hardMaxNodeActivations);
543
- const maxSubworkflowDepth = this.capNumber(user?.maxSubworkflowDepth ?? inheritedMaxSub, this.config.defaultMaxSubworkflowDepth, this.config.hardMaxSubworkflowDepth);
544
- if (subworkflowDepth > maxSubworkflowDepth) throw new Error(`Subworkflow nesting depth ${subworkflowDepth} exceeds maxSubworkflowDepth ${maxSubworkflowDepth} (run would be a child of parent run).`);
545
- return {
546
- ...user,
547
- subworkflowDepth,
548
- maxNodeActivations,
549
- maxSubworkflowDepth
550
- };
551
- }
552
- capNumber(requested, defaultValue, hardCeiling) {
553
- const base = requested === void 0 ? defaultValue : requested;
554
- return Math.min(base, hardCeiling);
555
- }
556
- };
557
-
558
- //#endregion
559
- //#region src/runStorage/BinaryBodyBufferReader.ts
560
- var BinaryBodyBufferReader = class {
561
- async read(body) {
562
- if (body instanceof Uint8Array) return body;
563
- if (body instanceof ArrayBuffer) return new Uint8Array(body);
564
- if (body instanceof node_stream_web.ReadableStream) return await this.readReadableStream(body);
565
- return await this.readAsyncIterable(body);
566
- }
567
- async readReadableStream(body) {
568
- const reader = body.getReader();
569
- const chunks = [];
570
- let totalSize = 0;
571
- try {
572
- while (true) {
573
- const result = await reader.read();
574
- if (result.done) break;
575
- chunks.push(result.value);
576
- totalSize += result.value.byteLength;
577
- }
578
- } finally {
579
- reader.releaseLock();
580
- }
581
- return this.joinChunks(chunks, totalSize);
582
- }
583
- async readAsyncIterable(body) {
584
- const chunks = [];
585
- let totalSize = 0;
586
- for await (const chunk of body) {
587
- chunks.push(chunk);
588
- totalSize += chunk.byteLength;
589
- }
590
- return this.joinChunks(chunks, totalSize);
591
- }
592
- joinChunks(chunks, totalSize) {
593
- const bytes = new Uint8Array(totalSize);
594
- let offset = 0;
595
- for (const chunk of chunks) {
596
- bytes.set(chunk, offset);
597
- offset += chunk.byteLength;
598
- }
599
- return bytes;
600
- }
601
- };
602
-
603
- //#endregion
604
- //#region src/runStorage/BinaryBodyReadableStreamFactory.ts
605
- var BinaryBodyReadableStreamFactory = class {
606
- constructor(bytes) {
607
- this.bytes = bytes;
608
- }
609
- create() {
610
- const value = this.bytes;
611
- let consumed = false;
612
- return new node_stream_web.ReadableStream({ pull(controller) {
613
- if (consumed) {
614
- controller.close();
615
- return;
616
- }
617
- consumed = true;
618
- controller.enqueue(value);
619
- controller.close();
620
- } });
621
- }
622
- };
623
-
624
- //#endregion
625
- //#region src/runStorage/InMemoryBinaryStorageRegistry.ts
626
- var InMemoryBinaryStorage = class {
627
- driverName = "memory";
628
- values = /* @__PURE__ */ new Map();
629
- async write(args) {
630
- const bytes = await new BinaryBodyBufferReader().read(args.body);
631
- this.values.set(args.storageKey, bytes);
632
- return {
633
- storageKey: args.storageKey,
634
- size: bytes.byteLength,
635
- sha256: (0, node_crypto.createHash)("sha256").update(bytes).digest("hex")
636
- };
637
- }
638
- async openReadStream(storageKey) {
639
- const bytes = this.values.get(storageKey);
640
- if (!bytes) return;
641
- return {
642
- body: new BinaryBodyReadableStreamFactory(bytes).create(),
643
- size: bytes.byteLength
644
- };
645
- }
646
- async stat(storageKey) {
647
- const bytes = this.values.get(storageKey);
648
- if (!bytes) return { exists: false };
649
- return {
650
- exists: true,
651
- size: bytes.byteLength
652
- };
653
- }
654
- async delete(storageKey) {
655
- this.values.delete(storageKey);
656
- }
657
- };
658
-
659
- //#endregion
660
- //#region src/runStorage/InMemoryRunData.ts
661
- var InMemoryRunData = class {
662
- byNode = /* @__PURE__ */ new Map();
663
- constructor(initial) {
664
- if (initial) for (const [nodeId, outputs] of Object.entries(initial)) this.byNode.set(nodeId, outputs);
665
- }
666
- setOutputs(nodeId, outputs) {
667
- this.byNode.set(nodeId, outputs);
668
- }
669
- getOutputs(nodeId) {
670
- return this.byNode.get(nodeId);
671
- }
672
- getOutputItems(nodeId, output = "main") {
673
- return this.byNode.get(nodeId)?.[output] ?? [];
674
- }
675
- getOutputItem(nodeId, itemIndex, output = "main") {
676
- return this.getOutputItems(nodeId, output)[itemIndex];
677
- }
678
- dump() {
679
- const out = {};
680
- for (const [nodeId, outputs] of this.byNode.entries()) out[nodeId] = outputs;
681
- return out;
682
- }
683
- };
684
-
685
- //#endregion
686
- //#region src/runStorage/InMemoryRunDataFactory.ts
687
- var InMemoryRunDataFactory = class {
688
- create(initial) {
689
- return new InMemoryRunData(initial);
690
- }
691
- };
692
-
693
- //#endregion
694
- //#region src/contracts/runFinishedAtFactory.ts
695
- /** Derives workflow end time from node snapshots for run listings. */
696
- var RunFinishedAtFactory = class {
697
- static resolveIso(state) {
698
- if (state.status === "running" || state.status === "pending") return;
699
- let max;
700
- for (const snap of Object.values(state.nodeSnapshotsByNodeId)) if (snap?.finishedAt && (!max || snap.finishedAt > max)) max = snap.finishedAt;
701
- return max;
702
- }
703
- };
704
-
705
- //#endregion
706
- //#region src/runtime/RunIntentService.ts
707
- var RunIntentService = class {
708
- constructor(engine, workflowRepository) {
709
- this.engine = engine;
710
- this.workflowRepository = workflowRepository;
711
- }
712
- async startWorkflow(args) {
713
- if (args.startAt && !args.currentState && !args.stopCondition && !args.reset) return await this.engine.runWorkflow(args.workflow, args.startAt, args.items, args.parent, args.executionOptions, {
714
- workflowSnapshot: args.workflowSnapshot,
715
- mutableState: args.mutableState
716
- });
717
- return await this.engine.runWorkflowFromState({
718
- workflow: args.workflow,
719
- items: args.items,
720
- parent: args.parent,
721
- executionOptions: args.executionOptions,
722
- workflowSnapshot: args.workflowSnapshot,
723
- mutableState: args.mutableState,
724
- currentState: args.currentState,
725
- stopCondition: args.stopCondition ?? { kind: "workflowCompleted" },
726
- reset: args.reset
727
- });
728
- }
729
- async rerunFromNode(args) {
730
- if (args.items) return await this.engine.runWorkflow(args.workflow, args.nodeId, args.items, args.parent, args.executionOptions, {
731
- workflowSnapshot: args.workflowSnapshot,
732
- mutableState: args.mutableState
733
- });
734
- return await this.engine.runWorkflowFromState({
735
- workflow: args.workflow,
736
- parent: args.parent,
737
- executionOptions: args.executionOptions,
738
- workflowSnapshot: args.workflowSnapshot,
739
- mutableState: args.mutableState,
740
- currentState: args.currentState,
741
- stopCondition: { kind: "workflowCompleted" },
742
- reset: { clearFromNodeId: args.nodeId }
743
- });
744
- }
745
- resolveWebhookTrigger(args) {
746
- return this.engine.resolveWebhookTrigger(args);
747
- }
748
- async runMatchedWebhook(args) {
749
- const resolution = this.resolveWebhookTrigger(args);
750
- if (resolution.status === "notFound") throw new Error("Unknown webhook endpoint");
751
- if (resolution.status === "methodNotAllowed") throw new Error("Method not allowed");
752
- return await this.runWebhookMatch({
753
- match: resolution.match,
754
- requestItem: args.requestItem
755
- });
756
- }
757
- async runWebhookMatch(args) {
758
- const workflow = this.workflowRepository.get(args.match.workflowId);
759
- if (!workflow) throw new Error(`Unknown workflowId: ${args.match.workflowId}`);
760
- const scheduled = await this.engine.runWorkflow(workflow, args.match.nodeId, [args.requestItem], void 0, {
761
- localOnly: true,
762
- webhook: true
763
- });
764
- if (scheduled.status === "failed") throw new Error(scheduled.error.message);
765
- if (scheduled.status === "completed") return {
766
- runId: scheduled.runId,
767
- workflowId: scheduled.workflowId,
768
- startedAt: scheduled.startedAt,
769
- runStatus: "completed",
770
- response: scheduled.outputs
771
- };
772
- return await Promise.race([this.engine.waitForWebhookResponse(scheduled.runId), this.engine.waitForCompletion(scheduled.runId).then((completed) => {
773
- if (completed.status === "failed") throw new Error(completed.error.message);
774
- return {
775
- runId: completed.runId,
776
- workflowId: completed.workflowId,
777
- startedAt: completed.startedAt,
778
- runStatus: "completed",
779
- response: completed.outputs
780
- };
781
- })]);
782
- }
783
- };
784
-
785
- //#endregion
786
- Object.defineProperty(exports, 'ConnectionNodeIdFactory', {
787
- enumerable: true,
788
- get: function () {
789
- return ConnectionNodeIdFactory;
790
- }
791
- });
792
- Object.defineProperty(exports, 'CoreTokens', {
793
- enumerable: true,
794
- get: function () {
795
- return CoreTokens;
796
- }
797
- });
798
- Object.defineProperty(exports, 'CredentialResolverFactory', {
799
- enumerable: true,
800
- get: function () {
801
- return CredentialResolverFactory;
802
- }
803
- });
804
- Object.defineProperty(exports, 'DefaultAsyncSleeper', {
805
- enumerable: true,
806
- get: function () {
807
- return DefaultAsyncSleeper;
808
- }
809
- });
810
- Object.defineProperty(exports, 'DefaultExecutionBinaryService', {
811
- enumerable: true,
812
- get: function () {
813
- return DefaultExecutionBinaryService;
814
- }
815
- });
816
- Object.defineProperty(exports, 'DefaultExecutionContextFactory', {
817
- enumerable: true,
818
- get: function () {
819
- return DefaultExecutionContextFactory;
820
- }
821
- });
822
- Object.defineProperty(exports, 'ENGINE_EXECUTION_LIMITS_DEFAULTS', {
823
- enumerable: true,
824
- get: function () {
825
- return ENGINE_EXECUTION_LIMITS_DEFAULTS;
826
- }
827
- });
828
- Object.defineProperty(exports, 'EngineExecutionLimitsPolicy', {
829
- enumerable: true,
830
- get: function () {
831
- return EngineExecutionLimitsPolicy;
832
- }
833
- });
834
- Object.defineProperty(exports, 'InMemoryBinaryStorage', {
835
- enumerable: true,
836
- get: function () {
837
- return InMemoryBinaryStorage;
838
- }
839
- });
840
- Object.defineProperty(exports, 'InMemoryRunDataFactory', {
841
- enumerable: true,
842
- get: function () {
843
- return InMemoryRunDataFactory;
844
- }
845
- });
846
- Object.defineProperty(exports, 'InProcessRetryRunner', {
847
- enumerable: true,
848
- get: function () {
849
- return InProcessRetryRunner;
850
- }
851
- });
852
- Object.defineProperty(exports, 'InjectableRuntimeDecoratorComposer', {
853
- enumerable: true,
854
- get: function () {
855
- return InjectableRuntimeDecoratorComposer;
856
- }
857
- });
858
- Object.defineProperty(exports, 'NodeEventPublisher', {
859
- enumerable: true,
860
- get: function () {
861
- return NodeEventPublisher;
862
- }
863
- });
864
- Object.defineProperty(exports, 'PersistedRuntimeTypeMetadataStore', {
865
- enumerable: true,
866
- get: function () {
867
- return PersistedRuntimeTypeMetadataStore;
868
- }
869
- });
870
- Object.defineProperty(exports, 'PersistedRuntimeTypeNameResolver', {
871
- enumerable: true,
872
- get: function () {
873
- return PersistedRuntimeTypeNameResolver;
874
- }
875
- });
876
- Object.defineProperty(exports, 'RunFinishedAtFactory', {
877
- enumerable: true,
878
- get: function () {
879
- return RunFinishedAtFactory;
880
- }
881
- });
882
- Object.defineProperty(exports, 'RunIntentService', {
883
- enumerable: true,
884
- get: function () {
885
- return RunIntentService;
886
- }
887
- });
888
- Object.defineProperty(exports, 'StackTraceCallSitePathResolver', {
889
- enumerable: true,
890
- get: function () {
891
- return StackTraceCallSitePathResolver;
892
- }
893
- });
894
- Object.defineProperty(exports, 'UnavailableBinaryStorage', {
895
- enumerable: true,
896
- get: function () {
897
- return UnavailableBinaryStorage;
898
- }
899
- });
900
- Object.defineProperty(exports, 'WorkflowExecutableNodeClassifier', {
901
- enumerable: true,
902
- get: function () {
903
- return WorkflowExecutableNodeClassifier;
904
- }
905
- });
906
- Object.defineProperty(exports, '__toESM', {
907
- enumerable: true,
908
- get: function () {
909
- return __toESM;
910
- }
911
- });
912
- Object.defineProperty(exports, 'chatModel', {
913
- enumerable: true,
914
- get: function () {
915
- return chatModel;
916
- }
917
- });
918
- Object.defineProperty(exports, 'createWorkflowExecutableNodeClassifier', {
919
- enumerable: true,
920
- get: function () {
921
- return createWorkflowExecutableNodeClassifier;
922
- }
923
- });
924
- Object.defineProperty(exports, 'getPersistedRuntimeTypeMetadata', {
925
- enumerable: true,
926
- get: function () {
927
- return getPersistedRuntimeTypeMetadata;
928
- }
929
- });
930
- Object.defineProperty(exports, 'node', {
931
- enumerable: true,
932
- get: function () {
933
- return node;
934
- }
935
- });
936
- Object.defineProperty(exports, 'tool', {
937
- enumerable: true,
938
- get: function () {
939
- return tool;
940
- }
941
- });
942
- //# sourceMappingURL=RunIntentService-DNOJc1R7.cjs.map