@codemation/core 0.0.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 (348) hide show
  1. package/README.md +30 -0
  2. package/dist/EngineExecutionLimitsPolicy-8MEFIYx1.d.cts +160 -0
  3. package/dist/EngineExecutionLimitsPolicy-BWAXW9D6.d.cts +160 -0
  4. package/dist/EngineExecutionLimitsPolicy-Bp8PS1Ss.d.cts +159 -0
  5. package/dist/EngineExecutionLimitsPolicy-CLxcN-D2.d.ts +159 -0
  6. package/dist/EngineExecutionLimitsPolicy-DZXuix51.d.ts +160 -0
  7. package/dist/EngineExecutionLimitsPolicy-Gfz6ngFd.d.ts +160 -0
  8. package/dist/EngineFactory-CBnntY3J.cjs +3152 -0
  9. package/dist/EngineFactory-CBnntY3J.cjs.map +1 -0
  10. package/dist/EngineFactory-Cwn3R2YA.js +3087 -0
  11. package/dist/EngineFactory-Cwn3R2YA.js.map +1 -0
  12. package/dist/EngineFactory-DWCnNocp.js +3063 -0
  13. package/dist/EngineFactory-DWCnNocp.js.map +1 -0
  14. package/dist/EngineFactory-DhPFou4p.cjs +3188 -0
  15. package/dist/EngineFactory-DhPFou4p.cjs.map +1 -0
  16. package/dist/EngineFactory-l_9xmBtv.cjs +3190 -0
  17. package/dist/EngineFactory-l_9xmBtv.cjs.map +1 -0
  18. package/dist/EngineFactory-w-aOWuqh.js +3089 -0
  19. package/dist/EngineFactory-w-aOWuqh.js.map +1 -0
  20. package/dist/InMemoryLiveWorkflowRepository-1J9MHN_I.js +18 -0
  21. package/dist/InMemoryLiveWorkflowRepository-1J9MHN_I.js.map +1 -0
  22. package/dist/InMemoryLiveWorkflowRepository-BTzHpQ6e.cjs +151 -0
  23. package/dist/InMemoryLiveWorkflowRepository-BTzHpQ6e.cjs.map +1 -0
  24. package/dist/InMemoryLiveWorkflowRepository-BoLNnVLg.js +139 -0
  25. package/dist/InMemoryLiveWorkflowRepository-BoLNnVLg.js.map +1 -0
  26. package/dist/InMemoryLiveWorkflowRepository-CULNqv96.d.ts +1300 -0
  27. package/dist/InMemoryLiveWorkflowRepository-D6eiiXxF.d.cts +1168 -0
  28. package/dist/InMemoryLiveWorkflowRepository-D7l8cjdZ.d.cts +1130 -0
  29. package/dist/InMemoryLiveWorkflowRepository-DL7LmC9S.d.ts +1340 -0
  30. package/dist/InMemoryLiveWorkflowRepository-jnv-OnOP.d.ts +1300 -0
  31. package/dist/InMemoryLiveWorkflowRepository-xny1_Z6i.cjs +24 -0
  32. package/dist/InMemoryLiveWorkflowRepository-xny1_Z6i.cjs.map +1 -0
  33. package/dist/InMemoryLiveWorkflowRepository-xr7b4kvi.d.ts +1338 -0
  34. package/dist/InMemoryWorkflowCatalog-BIdFpwbK.d.ts +1205 -0
  35. package/dist/InMemoryWorkflowCatalog-BW00_3N3.d.cts +12 -0
  36. package/dist/InMemoryWorkflowCatalog-BiYHGoPw.cjs +24 -0
  37. package/dist/InMemoryWorkflowCatalog-BiYHGoPw.cjs.map +1 -0
  38. package/dist/InMemoryWorkflowCatalog-BrG0ApMO.d.cts +1115 -0
  39. package/dist/InMemoryWorkflowCatalog-BzrAr--Y.js +139 -0
  40. package/dist/InMemoryWorkflowCatalog-BzrAr--Y.js.map +1 -0
  41. package/dist/InMemoryWorkflowCatalog-C-EJlJ7y.d.cts +1120 -0
  42. package/dist/InMemoryWorkflowCatalog-C4482bpw.cjs +24 -0
  43. package/dist/InMemoryWorkflowCatalog-C4482bpw.cjs.map +1 -0
  44. package/dist/InMemoryWorkflowCatalog-CZ0kZpOv.d.ts +1289 -0
  45. package/dist/InMemoryWorkflowCatalog-C_ACeLyW.d.cts +1119 -0
  46. package/dist/InMemoryWorkflowCatalog-CiHWIu5E.d.cts +12 -0
  47. package/dist/InMemoryWorkflowCatalog-CkH7gkya.js +18 -0
  48. package/dist/InMemoryWorkflowCatalog-CkH7gkya.js.map +1 -0
  49. package/dist/InMemoryWorkflowCatalog-CnpZVJM9.d.ts +1205 -0
  50. package/dist/InMemoryWorkflowCatalog-Cu68S8YR.js +18 -0
  51. package/dist/InMemoryWorkflowCatalog-Cu68S8YR.js.map +1 -0
  52. package/dist/InMemoryWorkflowCatalog-D2w9nMj2.cjs +151 -0
  53. package/dist/InMemoryWorkflowCatalog-D2w9nMj2.cjs.map +1 -0
  54. package/dist/InMemoryWorkflowCatalog-D5eMxEf7.js +18 -0
  55. package/dist/InMemoryWorkflowCatalog-D5eMxEf7.js.map +1 -0
  56. package/dist/InMemoryWorkflowCatalog-D5nCp2yZ.d.ts +1267 -0
  57. package/dist/InMemoryWorkflowCatalog-DIq0bjqN.d.ts +12 -0
  58. package/dist/InMemoryWorkflowCatalog-DLgaEaw_.d.ts +1288 -0
  59. package/dist/InMemoryWorkflowCatalog-DNBFdK-x.d.cts +1120 -0
  60. package/dist/InMemoryWorkflowCatalog-DQBkCzb7.cjs +24 -0
  61. package/dist/InMemoryWorkflowCatalog-DQBkCzb7.cjs.map +1 -0
  62. package/dist/InMemoryWorkflowCatalog-DS4-eX6i.d.cts +1118 -0
  63. package/dist/InMemoryWorkflowCatalog-DdVfy8MY.d.ts +12 -0
  64. package/dist/InMemoryWorkflowCatalog-DeVZu3g8.d.ts +12 -0
  65. package/dist/InMemoryWorkflowCatalog-GxkQjvt5.d.ts +1200 -0
  66. package/dist/InMemoryWorkflowCatalog-qaVRn1Lc.d.cts +1115 -0
  67. package/dist/InMemoryWorkflowCatalog-z1aIT4TC.d.cts +12 -0
  68. package/dist/InMemoryWorkflowRegistry-BBuOovLL.d.ts +1007 -0
  69. package/dist/InMemoryWorkflowRegistry-BIFnSl3k.d.ts +1201 -0
  70. package/dist/InMemoryWorkflowRegistry-BnGilthz.d.ts +1137 -0
  71. package/dist/InMemoryWorkflowRegistry-CEp5I8No.d.ts +1146 -0
  72. package/dist/InMemoryWorkflowRegistry-CHyMB9jW.d.cts +976 -0
  73. package/dist/InMemoryWorkflowRegistry-CUN7K86m.d.cts +1061 -0
  74. package/dist/InMemoryWorkflowRegistry-CVfHyELh.d.cts +971 -0
  75. package/dist/InMemoryWorkflowRegistry-CXXJrwAr.d.cts +1052 -0
  76. package/dist/InMemoryWorkflowRegistry-DDGfPTJy.d.ts +1013 -0
  77. package/dist/InMemoryWorkflowRegistry-DnYSOoT5.d.ts +1120 -0
  78. package/dist/InMemoryWorkflowRegistry-Dp5GiFF2.d.cts +1035 -0
  79. package/dist/InMemoryWorkflowRegistry-DypDBeOw.d.cts +1116 -0
  80. package/dist/InMemoryWorkflowRegistry-SzwJCAxT.d.ts +1012 -0
  81. package/dist/InMemoryWorkflowRegistry-jupvqyGc.d.cts +977 -0
  82. package/dist/InMemoryWorkflowRegistry-rAdKVWYT.d.ts +1117 -0
  83. package/dist/InProcessRetryRunner-BBNPkXjy.d.cts +292 -0
  84. package/dist/PersistedWorkflowSnapshotFactory-7RkOL3Kg.d.ts +14 -0
  85. package/dist/PersistedWorkflowSnapshotFactory-BmANa46W.cjs +141 -0
  86. package/dist/PersistedWorkflowSnapshotFactory-BmANa46W.cjs.map +1 -0
  87. package/dist/PersistedWorkflowSnapshotFactory-Bwb_etSt.js +118 -0
  88. package/dist/PersistedWorkflowSnapshotFactory-Bwb_etSt.js.map +1 -0
  89. package/dist/PersistedWorkflowSnapshotFactory-CRkKGNV6.js +123 -0
  90. package/dist/PersistedWorkflowSnapshotFactory-CRkKGNV6.js.map +1 -0
  91. package/dist/PersistedWorkflowSnapshotFactory-CZolnGy5.js +101 -0
  92. package/dist/PersistedWorkflowSnapshotFactory-CZolnGy5.js.map +1 -0
  93. package/dist/PersistedWorkflowSnapshotFactory-Ca_oysOv.cjs +131 -0
  94. package/dist/PersistedWorkflowSnapshotFactory-Ca_oysOv.cjs.map +1 -0
  95. package/dist/PersistedWorkflowSnapshotFactory-CqIcShnX.js +103 -0
  96. package/dist/PersistedWorkflowSnapshotFactory-CqIcShnX.js.map +1 -0
  97. package/dist/PersistedWorkflowSnapshotFactory-D-tBk4_G.js +119 -0
  98. package/dist/PersistedWorkflowSnapshotFactory-D-tBk4_G.js.map +1 -0
  99. package/dist/PersistedWorkflowSnapshotFactory-D4cXl2e2.cjs +131 -0
  100. package/dist/PersistedWorkflowSnapshotFactory-D4cXl2e2.cjs.map +1 -0
  101. package/dist/PersistedWorkflowSnapshotFactory-DINoP12r.cjs +131 -0
  102. package/dist/PersistedWorkflowSnapshotFactory-DINoP12r.cjs.map +1 -0
  103. package/dist/PersistedWorkflowSnapshotFactory-DJAwSuHU.js +103 -0
  104. package/dist/PersistedWorkflowSnapshotFactory-DJAwSuHU.js.map +1 -0
  105. package/dist/PersistedWorkflowSnapshotFactory-DSUjVCcf.cjs +131 -0
  106. package/dist/PersistedWorkflowSnapshotFactory-DSUjVCcf.cjs.map +1 -0
  107. package/dist/PersistedWorkflowSnapshotFactory-DdHuhkDb.cjs +107 -0
  108. package/dist/PersistedWorkflowSnapshotFactory-DdHuhkDb.cjs.map +1 -0
  109. package/dist/PersistedWorkflowSnapshotFactory-Dqc6NHis.js +119 -0
  110. package/dist/PersistedWorkflowSnapshotFactory-Dqc6NHis.js.map +1 -0
  111. package/dist/PersistedWorkflowSnapshotFactory-Dxa2dSrw.cjs +130 -0
  112. package/dist/PersistedWorkflowSnapshotFactory-Dxa2dSrw.cjs.map +1 -0
  113. package/dist/PersistedWorkflowSnapshotFactory-Ep79Ah1G.js +123 -0
  114. package/dist/PersistedWorkflowSnapshotFactory-Ep79Ah1G.js.map +1 -0
  115. package/dist/PersistedWorkflowSnapshotFactory-GyLfRuiJ.js +119 -0
  116. package/dist/PersistedWorkflowSnapshotFactory-GyLfRuiJ.js.map +1 -0
  117. package/dist/PersistedWorkflowSnapshotFactory-HTpBsBzn.js +102 -0
  118. package/dist/PersistedWorkflowSnapshotFactory-HTpBsBzn.js.map +1 -0
  119. package/dist/PersistedWorkflowSnapshotFactory-LVmaaf3t.cjs +141 -0
  120. package/dist/PersistedWorkflowSnapshotFactory-LVmaaf3t.cjs.map +1 -0
  121. package/dist/PersistedWorkflowSnapshotFactory-PZCpo2ZS.js +119 -0
  122. package/dist/PersistedWorkflowSnapshotFactory-PZCpo2ZS.js.map +1 -0
  123. package/dist/PersistedWorkflowSnapshotFactory-UjQ1SJev.cjs +109 -0
  124. package/dist/PersistedWorkflowSnapshotFactory-UjQ1SJev.cjs.map +1 -0
  125. package/dist/PersistedWorkflowSnapshotFactory-Y8kCrhcy.cjs +109 -0
  126. package/dist/PersistedWorkflowSnapshotFactory-Y8kCrhcy.cjs.map +1 -0
  127. package/dist/PersistedWorkflowSnapshotFactory-Z_nB-fmB.cjs +108 -0
  128. package/dist/PersistedWorkflowSnapshotFactory-Z_nB-fmB.cjs.map +1 -0
  129. package/dist/RunIntentService-1EE6N8ZL.cjs +963 -0
  130. package/dist/RunIntentService-1EE6N8ZL.cjs.map +1 -0
  131. package/dist/RunIntentService-2ivFmNQh.cjs +3462 -0
  132. package/dist/RunIntentService-2ivFmNQh.cjs.map +1 -0
  133. package/dist/RunIntentService-B0sUL5q-.js +761 -0
  134. package/dist/RunIntentService-B0sUL5q-.js.map +1 -0
  135. package/dist/RunIntentService-BFVbsOcg.js +3131 -0
  136. package/dist/RunIntentService-BFVbsOcg.js.map +1 -0
  137. package/dist/RunIntentService-BsBOwpVN.cjs +1051 -0
  138. package/dist/RunIntentService-BsBOwpVN.cjs.map +1 -0
  139. package/dist/RunIntentService-CSk3ETyn.js +858 -0
  140. package/dist/RunIntentService-CSk3ETyn.js.map +1 -0
  141. package/dist/RunIntentService-Ckn3u3tA.d.cts +326 -0
  142. package/dist/RunIntentService-DEo6GTTo.d.cts +289 -0
  143. package/dist/RunIntentService-DKrGtL0B.js +782 -0
  144. package/dist/RunIntentService-DKrGtL0B.js.map +1 -0
  145. package/dist/RunIntentService-DNOJc1R7.cjs +942 -0
  146. package/dist/RunIntentService-DNOJc1R7.cjs.map +1 -0
  147. package/dist/RunIntentService-Dq3pV53j.d.cts +289 -0
  148. package/dist/RunIntentService-NKobsfMQ.d.cts +274 -0
  149. package/dist/WorkflowSnapshotCodec-C3fuuS_R.d.cts +22 -0
  150. package/dist/WorkflowSnapshotCodec-CUudUo6f.js +123 -0
  151. package/dist/WorkflowSnapshotCodec-CUudUo6f.js.map +1 -0
  152. package/dist/WorkflowSnapshotCodec-CuCPQZTc.cjs +129 -0
  153. package/dist/WorkflowSnapshotCodec-CuCPQZTc.cjs.map +1 -0
  154. package/dist/WorkflowSnapshotCodec-DLiXQNvV.d.cts +22 -0
  155. package/dist/WorkflowSnapshotCodec-DNtdrZ7l.d.cts +22 -0
  156. package/dist/WorkflowSnapshotCodec-DTdWkoW_.d.cts +22 -0
  157. package/dist/bootstrap/index.cjs +1028 -0
  158. package/dist/bootstrap/index.cjs.map +1 -0
  159. package/dist/bootstrap/index.d.cts +311 -0
  160. package/dist/bootstrap/index.d.ts +83 -0
  161. package/dist/bootstrap/index.js +994 -0
  162. package/dist/bootstrap/index.js.map +1 -0
  163. package/dist/credentialTypes-B5h3dI7r.d.cts +1107 -0
  164. package/dist/credentialTypes-B9okPCVo.d.cts +963 -0
  165. package/dist/credentialTypes-BFL70rgZ.d.cts +964 -0
  166. package/dist/credentialTypes-BGkh1O07.d.ts +1010 -0
  167. package/dist/credentialTypes-BNLi4Q7u.d.ts +1030 -0
  168. package/dist/credentialTypes-CeSoZGj3.d.cts +994 -0
  169. package/dist/credentialTypes-CpHc32Ig.d.cts +984 -0
  170. package/dist/credentialTypes-D0m7MQQl.d.cts +1107 -0
  171. package/dist/credentialTypes-D4nL2sUd.d.ts +1000 -0
  172. package/dist/credentialTypes-DBYK2Qbu.d.ts +999 -0
  173. package/dist/credentialTypes-DMJVy0r1.d.ts +1000 -0
  174. package/dist/credentialTypes-DhUAjYQp.d.ts +1020 -0
  175. package/dist/credentialTypes-gGITj5KL.d.cts +964 -0
  176. package/dist/credentialTypes-r3KVBJBE.d.cts +974 -0
  177. package/dist/diTokens-ClO27tjK.cjs +34 -0
  178. package/dist/diTokens-ClO27tjK.cjs.map +1 -0
  179. package/dist/diTokens-CoHBkwG6.js +28 -0
  180. package/dist/diTokens-CoHBkwG6.js.map +1 -0
  181. package/dist/index-6Doxmfnd.d.ts +857 -0
  182. package/dist/index-9g6Pfe9Z.d.ts +689 -0
  183. package/dist/index-AZ72Ej-K.d.ts +920 -0
  184. package/dist/index-BEk9V-q-.d.ts +667 -0
  185. package/dist/index-Bjt7_7oS.d.ts +1192 -0
  186. package/dist/index-CFGxsYXy.d.ts +708 -0
  187. package/dist/index-C_u8xFgn.d.ts +690 -0
  188. package/dist/index-CpbfsvOJ.d.ts +1192 -0
  189. package/dist/index-CsReNJN_.d.ts +859 -0
  190. package/dist/index-D5iNnXaW.d.ts +667 -0
  191. package/dist/index-DD_Eft1q.d.ts +708 -0
  192. package/dist/index-DiSYUe0G.d.ts +1192 -0
  193. package/dist/index-gIcH60sp.d.ts +674 -0
  194. package/dist/index.cjs +520 -0
  195. package/dist/index.cjs.map +1 -0
  196. package/dist/index.d.cts +345 -0
  197. package/dist/index.d.ts +3 -0
  198. package/dist/index.js +412 -0
  199. package/dist/index.js.map +1 -0
  200. package/dist/runtime-BIvd-1JA.cjs +4112 -0
  201. package/dist/runtime-BIvd-1JA.cjs.map +1 -0
  202. package/dist/runtime-D3eWKSQK.cjs +3986 -0
  203. package/dist/runtime-D3eWKSQK.cjs.map +1 -0
  204. package/dist/runtime-Dvp4xAjg.js +3799 -0
  205. package/dist/runtime-Dvp4xAjg.js.map +1 -0
  206. package/dist/runtime-vc76SSAa.js +3685 -0
  207. package/dist/runtime-vc76SSAa.js.map +1 -0
  208. package/dist/runtimeTypes-BK0b8SaG.d.cts +884 -0
  209. package/dist/runtimeTypes-CoYZkYQq.d.cts +851 -0
  210. package/dist/runtimeTypes-D-Pm0Uas.d.cts +849 -0
  211. package/dist/testing.cjs +18 -0
  212. package/dist/testing.cjs.map +1 -0
  213. package/dist/testing.d.cts +19 -0
  214. package/dist/testing.d.ts +18 -0
  215. package/dist/testing.js +16 -0
  216. package/dist/testing.js.map +1 -0
  217. package/dist/types-Cb5UK7Y6.d.ts +857 -0
  218. package/package.json +66 -0
  219. package/src/ai/AiHost.ts +115 -0
  220. package/src/binaries/DefaultExecutionBinaryServiceFactory.ts +37 -0
  221. package/src/binaries/DefaultNodeBinaryAttachmentServiceFactory.ts +120 -0
  222. package/src/binaries/UnavailableBinaryStorage.ts +19 -0
  223. package/src/binaries/index.ts +2 -0
  224. package/src/bootstrap/index.ts +46 -0
  225. package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +180 -0
  226. package/src/bootstrap/runtime/EngineRuntimeRegistration.types.ts +43 -0
  227. package/src/bootstrap/runtime/index.ts +6 -0
  228. package/src/browser.ts +8 -0
  229. package/src/contracts/Clock.ts +10 -0
  230. package/src/contracts/ExpRetryPolicy.ts +23 -0
  231. package/src/contracts/NoRetryPolicy.ts +5 -0
  232. package/src/contracts/RetryPolicy.ts +23 -0
  233. package/src/contracts/credentialTypes.ts +194 -0
  234. package/src/contracts/index.ts +6 -0
  235. package/src/contracts/retryPolicySpec.types.ts +30 -0
  236. package/src/contracts/runFinishedAtFactory.ts +19 -0
  237. package/src/contracts/runTypes.ts +314 -0
  238. package/src/contracts/runtimeTypes.ts +373 -0
  239. package/src/contracts/webhookTypes.ts +49 -0
  240. package/src/contracts/workflowActivationPolicy.ts +16 -0
  241. package/src/contracts/workflowTypes.ts +280 -0
  242. package/src/di/CoreTokens.ts +60 -0
  243. package/src/di/index.ts +24 -0
  244. package/src/events/EventPublishingWorkflowExecutionRepository.ts +67 -0
  245. package/src/events/InMemoryRunEventBusRegistry.ts +37 -0
  246. package/src/events/InMemoryRunEventSubscription.ts +9 -0
  247. package/src/events/NodeEventPublisher.ts +22 -0
  248. package/src/events/index.ts +4 -0
  249. package/src/events/runEvents.ts +54 -0
  250. package/src/execution/ActivationEnqueueService.ts +125 -0
  251. package/src/execution/CredentialResolverFactory.ts +39 -0
  252. package/src/execution/DefaultAsyncSleeper.ts +9 -0
  253. package/src/execution/DefaultExecutionContextFactory.ts +48 -0
  254. package/src/execution/InProcessRetryRunner.ts +115 -0
  255. package/src/execution/InProcessRetryRunnerFactory.ts +8 -0
  256. package/src/execution/NodeActivationRequestComposer.ts +113 -0
  257. package/src/execution/NodeExecutionSnapshotFactory.ts +152 -0
  258. package/src/execution/NodeExecutor.ts +43 -0
  259. package/src/execution/NodeExecutorFactory.ts +10 -0
  260. package/src/execution/NodeInputsByPortFactory.ts +14 -0
  261. package/src/execution/NodeInstanceFactory.ts +32 -0
  262. package/src/execution/NodeInstanceFactoryFactory.ts +9 -0
  263. package/src/execution/NodeRunStateWriter.ts +185 -0
  264. package/src/execution/NodeRunStateWriterFactory.ts +29 -0
  265. package/src/execution/PersistedRunStateTerminalBuilder.ts +25 -0
  266. package/src/execution/RunStateSemantics.ts +158 -0
  267. package/src/execution/WorkflowRunExecutionContextFactory.ts +45 -0
  268. package/src/execution/asyncSleeper.types.ts +3 -0
  269. package/src/execution/index.ts +26 -0
  270. package/src/index.ts +18 -0
  271. package/src/orchestration/Engine.ts +229 -0
  272. package/src/orchestration/EngineWaiters.ts +37 -0
  273. package/src/orchestration/RunContinuationService.ts +810 -0
  274. package/src/orchestration/RunStartService.ts +449 -0
  275. package/src/orchestration/TriggerRuntimeService.ts +260 -0
  276. package/src/orchestration/index.ts +5 -0
  277. package/src/planning/CurrentStateFrontierPlanner.ts +400 -0
  278. package/src/planning/EngineWorkflowPlanningFactory.ts +63 -0
  279. package/src/planning/RunQueuePlanner.ts +302 -0
  280. package/src/planning/WorkflowTopologyPlanner.ts +77 -0
  281. package/src/planning/index.ts +4 -0
  282. package/src/policies/WorkflowPolicyErrorServices.ts +38 -0
  283. package/src/policies/executionLimits/EngineExecutionLimitsPolicy.ts +66 -0
  284. package/src/policies/executionLimits/EngineExecutionLimitsPolicyFactory.ts +14 -0
  285. package/src/policies/index.ts +10 -0
  286. package/src/policies/storage/RunPolicySnapshotFactory.ts +23 -0
  287. package/src/policies/storage/RunTerminalPersistenceCoordinator.ts +29 -0
  288. package/src/policies/storage/WorkflowStoragePolicyEvaluator.ts +39 -0
  289. package/src/runStorage/BinaryBodyBufferReader.ts +57 -0
  290. package/src/runStorage/BinaryBodyReadableStreamFactory.ts +21 -0
  291. package/src/runStorage/InMemoryBinaryStorageRegistry.ts +53 -0
  292. package/src/runStorage/InMemoryRunData.ts +33 -0
  293. package/src/runStorage/InMemoryRunDataFactory.ts +8 -0
  294. package/src/runStorage/InMemoryWorkflowExecutionRepository.ts +95 -0
  295. package/src/runStorage/RunSummaryMapper.ts +17 -0
  296. package/src/runStorage/index.ts +7 -0
  297. package/src/runtime/EngineFactory.ts +151 -0
  298. package/src/runtime/EngineWorkflowRunnerService.ts +39 -0
  299. package/src/runtime/EngineWorkflowRunnerServiceFactory.ts +11 -0
  300. package/src/runtime/InMemoryLiveWorkflowRepository.ts +20 -0
  301. package/src/runtime/RunIntentService.ts +175 -0
  302. package/src/runtime/RunIntentServiceFactory.ts +11 -0
  303. package/src/runtime/WorkflowRepositoryWebhookTriggerMatcher.ts +144 -0
  304. package/src/runtime/WorkflowRepositoryWebhookTriggerMatcherFactory.ts +13 -0
  305. package/src/runtime/index.ts +9 -0
  306. package/src/runtime-types/InjectableRuntimeDecoratorComposerRegistry.ts +25 -0
  307. package/src/runtime-types/PersistedRuntimeTypeMetadataStoreRegistry.ts +46 -0
  308. package/src/runtime-types/PersistedRuntimeTypeNameResolver.ts +14 -0
  309. package/src/runtime-types/StackTraceCallSitePathResolver.ts +25 -0
  310. package/src/runtime-types/persistedRuntimeTypeModelRegistry.ts +33 -0
  311. package/src/runtime-types/runtimeTypeDecorators.types.ts +46 -0
  312. package/src/scheduler/ConfigDrivenOffloadPolicy.ts +28 -0
  313. package/src/scheduler/DefaultDrivingScheduler.ts +100 -0
  314. package/src/scheduler/HintOnlyOffloadPolicy.ts +9 -0
  315. package/src/scheduler/InlineDrivingScheduler.ts +145 -0
  316. package/src/scheduler/InlineDrivingSchedulerFactory.ts +9 -0
  317. package/src/scheduler/LocalOnlyScheduler.ts +7 -0
  318. package/src/serialization/ItemsInputNormalizer.ts +36 -0
  319. package/src/testing/RejectingCredentialSessionService.ts +15 -0
  320. package/src/testing.ts +6 -0
  321. package/src/types/index.ts +12 -0
  322. package/src/workflow/definition/ConnectionInvocationIdFactory.ts +17 -0
  323. package/src/workflow/definition/ConnectionNodeIdFactory.ts +42 -0
  324. package/src/workflow/definition/WorkflowExecutableNodeClassifier.ts +71 -0
  325. package/src/workflow/definition/WorkflowExecutableNodeClassifierFactory.ts +9 -0
  326. package/src/workflow/dsl/ChainCursorResolver.ts +103 -0
  327. package/src/workflow/dsl/WhenBuilder.ts +57 -0
  328. package/src/workflow/dsl/WorkflowBuilder.ts +55 -0
  329. package/src/workflow/dsl/workflowBuilderTypes.ts +63 -0
  330. package/src/workflow/graph/DefaultWorkflowGraphFactory.ts +8 -0
  331. package/src/workflow/graph/ExecutableGraph.ts +24 -0
  332. package/src/workflow/index.ts +11 -0
  333. package/src/workflowSnapshots/MissingRuntimeExecutionMarker.ts +5 -0
  334. package/src/workflowSnapshots/MissingRuntimeFallbacksFactory.ts +27 -0
  335. package/src/workflowSnapshots/MissingRuntimeNode.ts +12 -0
  336. package/src/workflowSnapshots/MissingRuntimeNodeConfig.ts +14 -0
  337. package/src/workflowSnapshots/MissingRuntimeNodeToken.ts +1 -0
  338. package/src/workflowSnapshots/MissingRuntimeTrigger.ts +16 -0
  339. package/src/workflowSnapshots/MissingRuntimeTriggerConfig.ts +14 -0
  340. package/src/workflowSnapshots/MissingRuntimeTriggerToken.ts +1 -0
  341. package/src/workflowSnapshots/PersistedRuntimeTypeIdFactory.ts +19 -0
  342. package/src/workflowSnapshots/PersistedWorkflowTokenRegistry.ts +89 -0
  343. package/src/workflowSnapshots/PersistedWorkflowTokenRegistryFactory.ts +2 -0
  344. package/src/workflowSnapshots/WorkflowSnapshotCodec.ts +177 -0
  345. package/src/workflowSnapshots/WorkflowSnapshotResolver.ts +102 -0
  346. package/src/workflowSnapshots/index.ts +12 -0
  347. package/tsconfig.json +9 -0
  348. package/tsdown.config.ts +10 -0
@@ -0,0 +1,23 @@
1
+ import type { ExponentialRetryPolicySpec } from "./retryPolicySpec.types";
2
+
3
+ export class ExpRetryPolicy implements ExponentialRetryPolicySpec {
4
+ readonly kind = "exponential" as const;
5
+
6
+ constructor(
7
+ public readonly maxAttempts: number,
8
+ public readonly initialDelayMs: number,
9
+ public readonly multiplier: number,
10
+ public readonly maxDelayMs?: number,
11
+ public readonly jitter?: boolean,
12
+ ) {
13
+ if (!Number.isFinite(maxAttempts) || maxAttempts < 1 || !Number.isInteger(maxAttempts)) {
14
+ throw new Error(`ExpRetryPolicy.maxAttempts must be a positive integer, got ${maxAttempts}`);
15
+ }
16
+ if (!Number.isFinite(initialDelayMs) || initialDelayMs < 0) {
17
+ throw new Error(`ExpRetryPolicy.initialDelayMs must be a non-negative finite number, got ${initialDelayMs}`);
18
+ }
19
+ if (!Number.isFinite(multiplier) || multiplier < 1) {
20
+ throw new Error(`ExpRetryPolicy.multiplier must be >= 1, got ${multiplier}`);
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,5 @@
1
+ import type { NoneRetryPolicySpec } from "./retryPolicySpec.types";
2
+
3
+ export class NoRetryPolicy implements NoneRetryPolicySpec {
4
+ readonly kind = "none" as const;
5
+ }
@@ -0,0 +1,23 @@
1
+ import type { FixedRetryPolicySpec } from "./retryPolicySpec.types";
2
+
3
+ export class RetryPolicy implements FixedRetryPolicySpec {
4
+ readonly kind = "fixed" as const;
5
+
6
+ constructor(
7
+ public readonly maxAttempts: number,
8
+ public readonly delayMs: number,
9
+ ) {
10
+ if (!Number.isFinite(maxAttempts) || maxAttempts < 1 || !Number.isInteger(maxAttempts)) {
11
+ throw new Error(`RetryPolicy.maxAttempts must be a positive integer, got ${maxAttempts}`);
12
+ }
13
+ if (!Number.isFinite(delayMs) || delayMs < 0) {
14
+ throw new Error(`RetryPolicy.delayMs must be a non-negative finite number, got ${delayMs}`);
15
+ }
16
+ }
17
+
18
+ /** Default for HTTP-style transient failures: 3 tries, 1s between attempts. */
19
+ static readonly defaultForHttp: FixedRetryPolicySpec = { kind: "fixed", maxAttempts: 3, delayMs: 1000 };
20
+
21
+ /** Default for LLM / agent calls: 3 tries, 2s fixed backoff. */
22
+ static readonly defaultForAiAgent: FixedRetryPolicySpec = { kind: "fixed", maxAttempts: 3, delayMs: 2000 };
23
+ }
@@ -0,0 +1,194 @@
1
+ import type { NodeId, WorkflowId } from "./workflowTypes";
2
+
3
+ export type CredentialTypeId = string;
4
+ export type CredentialInstanceId = string;
5
+
6
+ export type CredentialMaterialSourceKind = "db" | "env" | "code";
7
+ export type CredentialSetupStatus = "draft" | "ready";
8
+ export type CredentialHealthStatus = "unknown" | "healthy" | "failing";
9
+
10
+ export type CredentialFieldSchema = Readonly<{
11
+ key: string;
12
+ label: string;
13
+ type: "string" | "password" | "textarea" | "json" | "boolean";
14
+ required?: true;
15
+ order?: number;
16
+ placeholder?: string;
17
+ helpText?: string;
18
+ /** When set, host resolves this field from process.env at runtime; env wins over stored values. */
19
+ envVarName?: string;
20
+ /**
21
+ * When set, the dialog shows a copy action for this exact string (e.g. a static OAuth redirect URI
22
+ * pattern or documentation URL). Do not use for secret values.
23
+ */
24
+ copyValue?: string;
25
+ /** Accessible label for the copy control (default: Copy). */
26
+ copyButtonLabel?: string;
27
+ }>;
28
+
29
+ export type CredentialRequirement = Readonly<{
30
+ slotKey: string;
31
+ label: string;
32
+ acceptedTypes: ReadonlyArray<CredentialTypeId>;
33
+ optional?: true;
34
+ helpText?: string;
35
+ helpUrl?: string;
36
+ }>;
37
+
38
+ export type CredentialBindingKey = Readonly<{
39
+ workflowId: WorkflowId;
40
+ nodeId: NodeId;
41
+ slotKey: string;
42
+ }>;
43
+
44
+ export type CredentialBinding = Readonly<{
45
+ key: CredentialBindingKey;
46
+ instanceId: CredentialInstanceId;
47
+ updatedAt: string;
48
+ }>;
49
+
50
+ export type CredentialHealth = Readonly<{
51
+ status: CredentialHealthStatus;
52
+ message?: string;
53
+ testedAt?: string;
54
+ expiresAt?: string;
55
+ details?: Readonly<Record<string, unknown>>;
56
+ }>;
57
+
58
+ export type OAuth2ProviderFromPublicConfig = Readonly<{
59
+ authorizeUrlFieldKey: string;
60
+ tokenUrlFieldKey: string;
61
+ userInfoUrlFieldKey?: string;
62
+ }>;
63
+
64
+ export type CredentialOAuth2AuthDefinition = Readonly<
65
+ | {
66
+ kind: "oauth2";
67
+ providerId: string;
68
+ scopes: ReadonlyArray<string>;
69
+ clientIdFieldKey?: string;
70
+ clientSecretFieldKey?: string;
71
+ }
72
+ | {
73
+ kind: "oauth2";
74
+ providerFromPublicConfig: OAuth2ProviderFromPublicConfig;
75
+ scopes: ReadonlyArray<string>;
76
+ clientIdFieldKey?: string;
77
+ clientSecretFieldKey?: string;
78
+ }
79
+ >;
80
+
81
+ export type CredentialAuthDefinition = CredentialOAuth2AuthDefinition;
82
+
83
+ export type CredentialTypeDefinition = Readonly<{
84
+ typeId: CredentialTypeId;
85
+ displayName: string;
86
+ description?: string;
87
+ publicFields?: ReadonlyArray<CredentialFieldSchema>;
88
+ secretFields?: ReadonlyArray<CredentialFieldSchema>;
89
+ supportedSourceKinds?: ReadonlyArray<CredentialMaterialSourceKind>;
90
+ auth?: CredentialAuthDefinition;
91
+ }>;
92
+
93
+ /**
94
+ * JSON-shaped credential field bag (public config, resolved secret material, etc.).
95
+ */
96
+ export type CredentialJsonRecord = Readonly<Record<string, unknown>>;
97
+
98
+ /**
99
+ * Persisted credential instance with typed `publicConfig`.
100
+ * Hosts may specialize `secretRef` with a stricter union while remaining
101
+ * assignable here for session/test callbacks.
102
+ */
103
+ export type CredentialInstanceRecord<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord> = Readonly<{
104
+ instanceId: CredentialInstanceId;
105
+ typeId: CredentialTypeId;
106
+ displayName: string;
107
+ sourceKind: CredentialMaterialSourceKind;
108
+ publicConfig: TPublicConfig;
109
+ secretRef: CredentialJsonRecord;
110
+ tags: ReadonlyArray<string>;
111
+ setupStatus: CredentialSetupStatus;
112
+ createdAt: string;
113
+ updatedAt: string;
114
+ }>;
115
+
116
+ /**
117
+ * Arguments passed to `CredentialType.createSession` and `CredentialType.test`.
118
+ * Declare `TPublicConfig` / `TMaterial` on `CredentialType` so implementations are checked
119
+ * against your credential shapes (similar to `NodeExecutionContext.config` for nodes).
120
+ */
121
+ export type CredentialSessionFactoryArgs<
122
+ TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord,
123
+ TMaterial extends CredentialJsonRecord = CredentialJsonRecord,
124
+ > = Readonly<{
125
+ instance: CredentialInstanceRecord<TPublicConfig>;
126
+ material: TMaterial;
127
+ publicConfig: TPublicConfig;
128
+ }>;
129
+
130
+ export type CredentialSessionFactory<
131
+ TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord,
132
+ TMaterial extends CredentialJsonRecord = CredentialJsonRecord,
133
+ TSession = unknown,
134
+ > = (args: CredentialSessionFactoryArgs<TPublicConfig, TMaterial>) => Promise<TSession>;
135
+
136
+ export type CredentialHealthTester<
137
+ TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord,
138
+ TMaterial extends CredentialJsonRecord = CredentialJsonRecord,
139
+ > = (args: CredentialSessionFactoryArgs<TPublicConfig, TMaterial>) => Promise<CredentialHealth>;
140
+
141
+ /**
142
+ * Full credential type implementation: `definition` (UI/schema), `createSession`, and `test`.
143
+ * Use this at registration and config boundaries; `CredentialTypeDefinition` is only the schema slice.
144
+ */
145
+ export type CredentialType<
146
+ TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord,
147
+ TMaterial extends CredentialJsonRecord = CredentialJsonRecord,
148
+ TSession = unknown,
149
+ > = Readonly<{
150
+ definition: CredentialTypeDefinition;
151
+ createSession: CredentialSessionFactory<TPublicConfig, TMaterial, TSession>;
152
+ test: CredentialHealthTester<TPublicConfig, TMaterial>;
153
+ }>;
154
+
155
+ /**
156
+ * Credential type with unspecified generics — used for `CodemationConfig.credentialTypes`, the host registry,
157
+ * and anywhere a concrete `CredentialType<YourPublic, YourMaterial, YourSession>` is placed in a heterogeneous list.
158
+ * Using `any` here avoids unsafe `as` casts while keeping typed `satisfies CredentialType<…>` definitions.
159
+ */
160
+ export type AnyCredentialType = CredentialType<any, any, unknown>;
161
+
162
+ export interface CredentialSessionService {
163
+ getSession<TSession = unknown>(
164
+ args: Readonly<{
165
+ workflowId: WorkflowId;
166
+ nodeId: NodeId;
167
+ slotKey: string;
168
+ }>,
169
+ ): Promise<TSession>;
170
+ }
171
+
172
+ export interface CredentialTypeRegistry {
173
+ listTypes(): ReadonlyArray<CredentialTypeDefinition>;
174
+ getType(typeId: CredentialTypeId): CredentialTypeDefinition | undefined;
175
+ }
176
+
177
+ export class CredentialUnboundError extends Error {
178
+ constructor(
179
+ public readonly bindingKey: CredentialBindingKey,
180
+ public readonly acceptedTypes: ReadonlyArray<CredentialTypeId> = [],
181
+ ) {
182
+ super(CredentialUnboundError.createMessage(bindingKey, acceptedTypes));
183
+ this.name = "CredentialUnboundError";
184
+ }
185
+
186
+ private static createMessage(
187
+ bindingKey: CredentialBindingKey,
188
+ acceptedTypes: ReadonlyArray<CredentialTypeId>,
189
+ ): string {
190
+ const acceptedTypesSuffix =
191
+ acceptedTypes.length > 0 ? ` Accepted credential types: ${acceptedTypes.join(", ")}.` : "";
192
+ return `Credential slot "${bindingKey.slotKey}" is not bound for workflow ${bindingKey.workflowId} node ${bindingKey.nodeId}.${acceptedTypesSuffix}`;
193
+ }
194
+ }
@@ -0,0 +1,6 @@
1
+ export * from "./credentialTypes";
2
+ export * from "./runtimeTypes";
3
+ export * from "./runFinishedAtFactory";
4
+ export * from "./runTypes";
5
+ export * from "./webhookTypes";
6
+ export * from "./workflowTypes";
@@ -0,0 +1,30 @@
1
+ /**
2
+ * In-process retry policy for runnable nodes. Serialized configs use the same
3
+ * `kind` discriminator (`JSON.stringify` / persisted workflows).
4
+ *
5
+ * `maxAttempts` is the total number of tries including the first (e.g. 3 means up to 2 delays after failures).
6
+ */
7
+
8
+ export type RetryPolicySpec = NoneRetryPolicySpec | FixedRetryPolicySpec | ExponentialRetryPolicySpec;
9
+
10
+ export interface NoneRetryPolicySpec {
11
+ readonly kind: "none";
12
+ }
13
+
14
+ export interface FixedRetryPolicySpec {
15
+ readonly kind: "fixed";
16
+ /** Total attempts including the first execution. Must be >= 1. */
17
+ readonly maxAttempts: number;
18
+ readonly delayMs: number;
19
+ }
20
+
21
+ export interface ExponentialRetryPolicySpec {
22
+ readonly kind: "exponential";
23
+ /** Total attempts including the first execution. Must be >= 1. */
24
+ readonly maxAttempts: number;
25
+ readonly initialDelayMs: number;
26
+ readonly multiplier: number;
27
+ readonly maxDelayMs?: number;
28
+ /** When true, each delay is multiplied by a random factor in [1, 1.2). */
29
+ readonly jitter?: boolean;
30
+ }
@@ -0,0 +1,19 @@
1
+ import type { PersistedRunState } from "./runTypes";
2
+
3
+ type RunFinishedAtSource = Pick<PersistedRunState, "status" | "nodeSnapshotsByNodeId">;
4
+
5
+ /** Derives workflow end time from node snapshots for run listings. */
6
+ export class RunFinishedAtFactory {
7
+ static resolveIso(state: RunFinishedAtSource): string | undefined {
8
+ if (state.status === "running" || state.status === "pending") {
9
+ return undefined;
10
+ }
11
+ let max: string | undefined;
12
+ for (const snap of Object.values(state.nodeSnapshotsByNodeId)) {
13
+ if (snap?.finishedAt && (!max || snap.finishedAt > max)) {
14
+ max = snap.finishedAt;
15
+ }
16
+ }
17
+ return max;
18
+ }
19
+ }
@@ -0,0 +1,314 @@
1
+ import type { TypeToken } from "../di";
2
+ import type { RunEventBus } from "../events/runEvents";
3
+ import type {
4
+ Edge,
5
+ InputPortKey,
6
+ Items,
7
+ JsonValue,
8
+ NodeActivationId,
9
+ NodeId,
10
+ NodeKind,
11
+ NodeOutputs,
12
+ OutputPortKey,
13
+ ParentExecutionRef,
14
+ PersistedRunPolicySnapshot,
15
+ PersistedTokenId,
16
+ RunId,
17
+ WorkflowDefinition,
18
+ WorkflowId,
19
+ WorkflowNodeConnection,
20
+ } from "./workflowTypes";
21
+
22
+ export interface RunExecutionOptions {
23
+ /** Run-intent override: force the inline scheduler and bypass node-level offload decisions. */
24
+ localOnly?: boolean;
25
+ /** Marks runs started from webhook handling so orchestration can apply webhook-specific continuation rules. */
26
+ webhook?: boolean;
27
+ mode?: "manual" | "debug";
28
+ sourceWorkflowId?: WorkflowId;
29
+ sourceRunId?: RunId;
30
+ derivedFromRunId?: RunId;
31
+ isMutable?: boolean;
32
+ /** Set by the engine for this run: 0 = root, 1 = first child subworkflow, … */
33
+ subworkflowDepth?: number;
34
+ /** Effective cap after engine policy merge (successful node completions per run). */
35
+ maxNodeActivations?: number;
36
+ /** Effective cap after engine policy merge (subworkflow nesting). */
37
+ maxSubworkflowDepth?: number;
38
+ }
39
+
40
+ /** Engine-owned counters persisted with the run (worker-safe). */
41
+ export interface EngineRunCounters {
42
+ completedNodeActivations: number;
43
+ }
44
+
45
+ export type RunStopCondition =
46
+ | Readonly<{
47
+ kind: "workflowCompleted";
48
+ }>
49
+ | Readonly<{
50
+ kind: "nodeCompleted";
51
+ nodeId: NodeId;
52
+ }>;
53
+
54
+ export interface RunStateResetRequest {
55
+ clearFromNodeId: NodeId;
56
+ }
57
+
58
+ export interface PersistedRunControlState {
59
+ stopCondition?: RunStopCondition;
60
+ }
61
+
62
+ export interface PersistedWorkflowSnapshotNode {
63
+ id: NodeId;
64
+ kind: NodeKind;
65
+ name?: string;
66
+ nodeTokenId: PersistedTokenId;
67
+ configTokenId: PersistedTokenId;
68
+ tokenName?: string;
69
+ configTokenName?: string;
70
+ config: unknown;
71
+ }
72
+
73
+ export interface PersistedWorkflowSnapshot {
74
+ id: WorkflowId;
75
+ name: string;
76
+ nodes: ReadonlyArray<PersistedWorkflowSnapshotNode>;
77
+ edges: ReadonlyArray<Edge>;
78
+ /** When the snapshot was built from a live workflow definition that configured a workflow error handler. */
79
+ workflowErrorHandlerConfigured?: boolean;
80
+ /** Connection metadata for child nodes not in the execution graph (e.g. AI agent attachments). */
81
+ connections?: ReadonlyArray<WorkflowNodeConnection>;
82
+ }
83
+
84
+ export type PinnedNodeOutputsByPort = Readonly<Record<OutputPortKey, Items>>;
85
+
86
+ export interface PersistedMutableNodeState {
87
+ pinnedOutputsByPort?: PinnedNodeOutputsByPort;
88
+ lastDebugInput?: Items;
89
+ }
90
+
91
+ export interface PersistedMutableRunState {
92
+ nodesById: Readonly<Record<NodeId, PersistedMutableNodeState>>;
93
+ }
94
+
95
+ export type NodeInputsByPort = Readonly<Record<InputPortKey, Items>>;
96
+
97
+ export interface RunQueueEntry {
98
+ nodeId: NodeId;
99
+ input: Items;
100
+ toInput?: InputPortKey;
101
+ batchId?: string;
102
+ from?: Readonly<{ nodeId: NodeId; output: OutputPortKey }>;
103
+ collect?: Readonly<{
104
+ expectedInputs: ReadonlyArray<InputPortKey>;
105
+ received: Readonly<Record<InputPortKey, Items>>;
106
+ }>;
107
+ }
108
+
109
+ export type NodeExecutionStatus = "pending" | "queued" | "running" | "completed" | "failed" | "skipped";
110
+
111
+ export interface NodeExecutionError {
112
+ message: string;
113
+ name?: string;
114
+ stack?: string;
115
+ }
116
+
117
+ export interface NodeExecutionSnapshot {
118
+ runId: RunId;
119
+ workflowId: WorkflowId;
120
+ nodeId: NodeId;
121
+ activationId?: NodeActivationId;
122
+ parent?: ParentExecutionRef;
123
+ status: NodeExecutionStatus;
124
+ usedPinnedOutput?: boolean;
125
+ queuedAt?: string;
126
+ startedAt?: string;
127
+ finishedAt?: string;
128
+ updatedAt: string;
129
+ inputsByPort?: NodeInputsByPort;
130
+ outputs?: NodeOutputs;
131
+ error?: NodeExecutionError;
132
+ }
133
+
134
+ /** Stable id for a single connection invocation row in {@link ConnectionInvocationRecord}. */
135
+ export type ConnectionInvocationId = string;
136
+
137
+ /**
138
+ * One logical LLM or tool call under an owning workflow node (e.g. AI agent).
139
+ * The owning node defines what {@link managedInput} and {@link managedOutput} contain.
140
+ */
141
+ export interface ConnectionInvocationRecord {
142
+ readonly invocationId: ConnectionInvocationId;
143
+ readonly runId: RunId;
144
+ readonly workflowId: WorkflowId;
145
+ readonly connectionNodeId: NodeId;
146
+ readonly parentAgentNodeId: NodeId;
147
+ readonly parentAgentActivationId: NodeActivationId;
148
+ readonly status: NodeExecutionStatus;
149
+ readonly managedInput?: JsonValue;
150
+ readonly managedOutput?: JsonValue;
151
+ readonly error?: NodeExecutionError;
152
+ readonly queuedAt?: string;
153
+ readonly startedAt?: string;
154
+ readonly finishedAt?: string;
155
+ readonly updatedAt: string;
156
+ }
157
+
158
+ /** Arguments for appending a {@link ConnectionInvocationRecord} (engine fills run/workflow ids and timestamps). */
159
+ export type ConnectionInvocationAppendArgs = Readonly<{
160
+ invocationId: ConnectionInvocationId;
161
+ connectionNodeId: NodeId;
162
+ parentAgentNodeId: NodeId;
163
+ parentAgentActivationId: NodeActivationId;
164
+ status: NodeExecutionStatus;
165
+ managedInput?: JsonValue;
166
+ managedOutput?: JsonValue;
167
+ error?: NodeExecutionError;
168
+ queuedAt?: string;
169
+ startedAt?: string;
170
+ finishedAt?: string;
171
+ }>;
172
+
173
+ export interface RunCurrentState {
174
+ outputsByNode: Record<NodeId, NodeOutputs>;
175
+ nodeSnapshotsByNodeId: Record<NodeId, NodeExecutionSnapshot>;
176
+ /** Append-only history of connection-scoped invocations (LLM/tool) for inspector and canvas. */
177
+ connectionInvocations?: ReadonlyArray<ConnectionInvocationRecord>;
178
+ mutableState?: PersistedMutableRunState;
179
+ }
180
+
181
+ export interface CurrentStateExecutionRequest {
182
+ workflow: WorkflowDefinition;
183
+ items?: Items;
184
+ parent?: ParentExecutionRef;
185
+ executionOptions?: RunExecutionOptions;
186
+ workflowSnapshot?: PersistedWorkflowSnapshot;
187
+ mutableState?: PersistedMutableRunState;
188
+ currentState?: RunCurrentState;
189
+ stopCondition?: RunStopCondition;
190
+ reset?: RunStateResetRequest;
191
+ }
192
+
193
+ export interface ExecutionFrontierPlan {
194
+ rootNodeId?: NodeId;
195
+ rootNodeInput?: Items;
196
+ queue: RunQueueEntry[];
197
+ currentState: RunCurrentState;
198
+ stopCondition: RunStopCondition;
199
+ satisfiedNodeIds: ReadonlyArray<NodeId>;
200
+ skippedNodeIds: ReadonlyArray<NodeId>;
201
+ clearedNodeIds: ReadonlyArray<NodeId>;
202
+ preservedPinnedNodeIds: ReadonlyArray<NodeId>;
203
+ }
204
+
205
+ export type RunStatus = "running" | "pending" | "completed" | "failed";
206
+
207
+ export interface RunSummary {
208
+ runId: RunId;
209
+ workflowId: WorkflowId;
210
+ startedAt: string;
211
+ status: RunStatus;
212
+ /** ISO timestamp when the run finished (derived from node snapshots or store `updatedAt`); omit while running/pending. */
213
+ finishedAt?: string;
214
+ parent?: ParentExecutionRef;
215
+ executionOptions?: RunExecutionOptions;
216
+ }
217
+
218
+ export interface PendingNodeExecution {
219
+ runId: RunId;
220
+ activationId: NodeActivationId;
221
+ workflowId: WorkflowId;
222
+ nodeId: NodeId;
223
+ itemsIn: number;
224
+ inputsByPort: NodeInputsByPort;
225
+ receiptId: string;
226
+ queue?: string;
227
+ batchId?: string;
228
+ enqueuedAt: string;
229
+ }
230
+
231
+ export interface PersistedRunState {
232
+ runId: RunId;
233
+ workflowId: WorkflowId;
234
+ startedAt: string;
235
+ parent?: ParentExecutionRef;
236
+ executionOptions?: RunExecutionOptions;
237
+ control?: PersistedRunControlState;
238
+ workflowSnapshot?: PersistedWorkflowSnapshot;
239
+ mutableState?: PersistedMutableRunState;
240
+ /** Frozen at createRun from workflow + runtime defaults for prune/storage decisions. */
241
+ policySnapshot?: PersistedRunPolicySnapshot;
242
+ /** Successful node completions so far (for activation budget). */
243
+ engineCounters?: EngineRunCounters;
244
+ status: RunStatus;
245
+ pending?: PendingNodeExecution;
246
+ queue: RunQueueEntry[];
247
+ outputsByNode: Record<NodeId, NodeOutputs>;
248
+ nodeSnapshotsByNodeId: Record<NodeId, NodeExecutionSnapshot>;
249
+ /** Append-only history of connection invocations (LLM/tool) nested under owning nodes. */
250
+ connectionInvocations?: ReadonlyArray<ConnectionInvocationRecord>;
251
+ }
252
+
253
+ export interface WorkflowExecutionRepository {
254
+ createRun(args: {
255
+ runId: RunId;
256
+ workflowId: WorkflowId;
257
+ startedAt: string;
258
+ parent?: ParentExecutionRef;
259
+ executionOptions?: RunExecutionOptions;
260
+ control?: PersistedRunControlState;
261
+ workflowSnapshot?: PersistedWorkflowSnapshot;
262
+ mutableState?: PersistedMutableRunState;
263
+ policySnapshot?: PersistedRunPolicySnapshot;
264
+ engineCounters?: EngineRunCounters;
265
+ }): Promise<void>;
266
+ load(runId: RunId): Promise<PersistedRunState | undefined>;
267
+ save(state: PersistedRunState): Promise<void>;
268
+ deleteRun?(runId: RunId): Promise<void>;
269
+ }
270
+
271
+ export interface WorkflowExecutionListingRepository {
272
+ listRuns(args?: Readonly<{ workflowId?: WorkflowId; limit?: number }>): Promise<ReadonlyArray<RunSummary>>;
273
+ }
274
+
275
+ /** Runs eligible for retention-based pruning (completed or failed, older than cutoff). */
276
+ export interface RunPruneCandidate {
277
+ readonly runId: RunId;
278
+ readonly workflowId: WorkflowId;
279
+ readonly startedAt: string;
280
+ readonly finishedAt: string;
281
+ }
282
+
283
+ export interface WorkflowExecutionPruneRepository {
284
+ listRunsOlderThan(args: Readonly<{ beforeIso: string; limit?: number }>): Promise<ReadonlyArray<RunPruneCandidate>>;
285
+ }
286
+
287
+ export type RunResult =
288
+ | { runId: RunId; workflowId: WorkflowId; startedAt: string; status: "completed"; outputs: Items }
289
+ | { runId: RunId; workflowId: WorkflowId; startedAt: string; status: "pending"; pending: PendingNodeExecution }
290
+ | { runId: RunId; workflowId: WorkflowId; startedAt: string; status: "failed"; error: { message: string } };
291
+
292
+ export type WebhookRunResult = Readonly<{
293
+ runId: RunId;
294
+ workflowId: WorkflowId;
295
+ startedAt: string;
296
+ runStatus: "pending" | "completed";
297
+ response: Items;
298
+ }>;
299
+
300
+ export interface PersistedWorkflowTokenRegistryLike {
301
+ register(type: TypeToken<unknown>, packageId: string, persistedNameOverride?: string): string;
302
+ getTokenId(type: TypeToken<unknown>): string | undefined;
303
+ resolve(tokenId: string): TypeToken<unknown> | undefined;
304
+ registerFromWorkflows?(workflows: ReadonlyArray<WorkflowDefinition>): void;
305
+ }
306
+
307
+ export interface RunCompletionNotifier {
308
+ resolveRunCompletion(result: RunResult): void;
309
+ resolveWebhookResponse(result: WebhookRunResult): void;
310
+ }
311
+
312
+ export interface RunEventPublisherDeps {
313
+ eventBus?: RunEventBus;
314
+ }