@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.
- package/README.md +30 -0
- package/dist/EngineExecutionLimitsPolicy-8MEFIYx1.d.cts +160 -0
- package/dist/EngineExecutionLimitsPolicy-BWAXW9D6.d.cts +160 -0
- package/dist/EngineExecutionLimitsPolicy-Bp8PS1Ss.d.cts +159 -0
- package/dist/EngineExecutionLimitsPolicy-CLxcN-D2.d.ts +159 -0
- package/dist/EngineExecutionLimitsPolicy-DZXuix51.d.ts +160 -0
- package/dist/EngineExecutionLimitsPolicy-Gfz6ngFd.d.ts +160 -0
- package/dist/EngineFactory-CBnntY3J.cjs +3152 -0
- package/dist/EngineFactory-CBnntY3J.cjs.map +1 -0
- package/dist/EngineFactory-Cwn3R2YA.js +3087 -0
- package/dist/EngineFactory-Cwn3R2YA.js.map +1 -0
- package/dist/EngineFactory-DWCnNocp.js +3063 -0
- package/dist/EngineFactory-DWCnNocp.js.map +1 -0
- package/dist/EngineFactory-DhPFou4p.cjs +3188 -0
- package/dist/EngineFactory-DhPFou4p.cjs.map +1 -0
- package/dist/EngineFactory-l_9xmBtv.cjs +3190 -0
- package/dist/EngineFactory-l_9xmBtv.cjs.map +1 -0
- package/dist/EngineFactory-w-aOWuqh.js +3089 -0
- package/dist/EngineFactory-w-aOWuqh.js.map +1 -0
- package/dist/InMemoryLiveWorkflowRepository-1J9MHN_I.js +18 -0
- package/dist/InMemoryLiveWorkflowRepository-1J9MHN_I.js.map +1 -0
- package/dist/InMemoryLiveWorkflowRepository-BTzHpQ6e.cjs +151 -0
- package/dist/InMemoryLiveWorkflowRepository-BTzHpQ6e.cjs.map +1 -0
- package/dist/InMemoryLiveWorkflowRepository-BoLNnVLg.js +139 -0
- package/dist/InMemoryLiveWorkflowRepository-BoLNnVLg.js.map +1 -0
- package/dist/InMemoryLiveWorkflowRepository-CULNqv96.d.ts +1300 -0
- package/dist/InMemoryLiveWorkflowRepository-D6eiiXxF.d.cts +1168 -0
- package/dist/InMemoryLiveWorkflowRepository-D7l8cjdZ.d.cts +1130 -0
- package/dist/InMemoryLiveWorkflowRepository-DL7LmC9S.d.ts +1340 -0
- package/dist/InMemoryLiveWorkflowRepository-jnv-OnOP.d.ts +1300 -0
- package/dist/InMemoryLiveWorkflowRepository-xny1_Z6i.cjs +24 -0
- package/dist/InMemoryLiveWorkflowRepository-xny1_Z6i.cjs.map +1 -0
- package/dist/InMemoryLiveWorkflowRepository-xr7b4kvi.d.ts +1338 -0
- package/dist/InMemoryWorkflowCatalog-BIdFpwbK.d.ts +1205 -0
- package/dist/InMemoryWorkflowCatalog-BW00_3N3.d.cts +12 -0
- package/dist/InMemoryWorkflowCatalog-BiYHGoPw.cjs +24 -0
- package/dist/InMemoryWorkflowCatalog-BiYHGoPw.cjs.map +1 -0
- package/dist/InMemoryWorkflowCatalog-BrG0ApMO.d.cts +1115 -0
- package/dist/InMemoryWorkflowCatalog-BzrAr--Y.js +139 -0
- package/dist/InMemoryWorkflowCatalog-BzrAr--Y.js.map +1 -0
- package/dist/InMemoryWorkflowCatalog-C-EJlJ7y.d.cts +1120 -0
- package/dist/InMemoryWorkflowCatalog-C4482bpw.cjs +24 -0
- package/dist/InMemoryWorkflowCatalog-C4482bpw.cjs.map +1 -0
- package/dist/InMemoryWorkflowCatalog-CZ0kZpOv.d.ts +1289 -0
- package/dist/InMemoryWorkflowCatalog-C_ACeLyW.d.cts +1119 -0
- package/dist/InMemoryWorkflowCatalog-CiHWIu5E.d.cts +12 -0
- package/dist/InMemoryWorkflowCatalog-CkH7gkya.js +18 -0
- package/dist/InMemoryWorkflowCatalog-CkH7gkya.js.map +1 -0
- package/dist/InMemoryWorkflowCatalog-CnpZVJM9.d.ts +1205 -0
- package/dist/InMemoryWorkflowCatalog-Cu68S8YR.js +18 -0
- package/dist/InMemoryWorkflowCatalog-Cu68S8YR.js.map +1 -0
- package/dist/InMemoryWorkflowCatalog-D2w9nMj2.cjs +151 -0
- package/dist/InMemoryWorkflowCatalog-D2w9nMj2.cjs.map +1 -0
- package/dist/InMemoryWorkflowCatalog-D5eMxEf7.js +18 -0
- package/dist/InMemoryWorkflowCatalog-D5eMxEf7.js.map +1 -0
- package/dist/InMemoryWorkflowCatalog-D5nCp2yZ.d.ts +1267 -0
- package/dist/InMemoryWorkflowCatalog-DIq0bjqN.d.ts +12 -0
- package/dist/InMemoryWorkflowCatalog-DLgaEaw_.d.ts +1288 -0
- package/dist/InMemoryWorkflowCatalog-DNBFdK-x.d.cts +1120 -0
- package/dist/InMemoryWorkflowCatalog-DQBkCzb7.cjs +24 -0
- package/dist/InMemoryWorkflowCatalog-DQBkCzb7.cjs.map +1 -0
- package/dist/InMemoryWorkflowCatalog-DS4-eX6i.d.cts +1118 -0
- package/dist/InMemoryWorkflowCatalog-DdVfy8MY.d.ts +12 -0
- package/dist/InMemoryWorkflowCatalog-DeVZu3g8.d.ts +12 -0
- package/dist/InMemoryWorkflowCatalog-GxkQjvt5.d.ts +1200 -0
- package/dist/InMemoryWorkflowCatalog-qaVRn1Lc.d.cts +1115 -0
- package/dist/InMemoryWorkflowCatalog-z1aIT4TC.d.cts +12 -0
- package/dist/InMemoryWorkflowRegistry-BBuOovLL.d.ts +1007 -0
- package/dist/InMemoryWorkflowRegistry-BIFnSl3k.d.ts +1201 -0
- package/dist/InMemoryWorkflowRegistry-BnGilthz.d.ts +1137 -0
- package/dist/InMemoryWorkflowRegistry-CEp5I8No.d.ts +1146 -0
- package/dist/InMemoryWorkflowRegistry-CHyMB9jW.d.cts +976 -0
- package/dist/InMemoryWorkflowRegistry-CUN7K86m.d.cts +1061 -0
- package/dist/InMemoryWorkflowRegistry-CVfHyELh.d.cts +971 -0
- package/dist/InMemoryWorkflowRegistry-CXXJrwAr.d.cts +1052 -0
- package/dist/InMemoryWorkflowRegistry-DDGfPTJy.d.ts +1013 -0
- package/dist/InMemoryWorkflowRegistry-DnYSOoT5.d.ts +1120 -0
- package/dist/InMemoryWorkflowRegistry-Dp5GiFF2.d.cts +1035 -0
- package/dist/InMemoryWorkflowRegistry-DypDBeOw.d.cts +1116 -0
- package/dist/InMemoryWorkflowRegistry-SzwJCAxT.d.ts +1012 -0
- package/dist/InMemoryWorkflowRegistry-jupvqyGc.d.cts +977 -0
- package/dist/InMemoryWorkflowRegistry-rAdKVWYT.d.ts +1117 -0
- package/dist/InProcessRetryRunner-BBNPkXjy.d.cts +292 -0
- package/dist/PersistedWorkflowSnapshotFactory-7RkOL3Kg.d.ts +14 -0
- package/dist/PersistedWorkflowSnapshotFactory-BmANa46W.cjs +141 -0
- package/dist/PersistedWorkflowSnapshotFactory-BmANa46W.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-Bwb_etSt.js +118 -0
- package/dist/PersistedWorkflowSnapshotFactory-Bwb_etSt.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-CRkKGNV6.js +123 -0
- package/dist/PersistedWorkflowSnapshotFactory-CRkKGNV6.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-CZolnGy5.js +101 -0
- package/dist/PersistedWorkflowSnapshotFactory-CZolnGy5.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-Ca_oysOv.cjs +131 -0
- package/dist/PersistedWorkflowSnapshotFactory-Ca_oysOv.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-CqIcShnX.js +103 -0
- package/dist/PersistedWorkflowSnapshotFactory-CqIcShnX.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-D-tBk4_G.js +119 -0
- package/dist/PersistedWorkflowSnapshotFactory-D-tBk4_G.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-D4cXl2e2.cjs +131 -0
- package/dist/PersistedWorkflowSnapshotFactory-D4cXl2e2.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-DINoP12r.cjs +131 -0
- package/dist/PersistedWorkflowSnapshotFactory-DINoP12r.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-DJAwSuHU.js +103 -0
- package/dist/PersistedWorkflowSnapshotFactory-DJAwSuHU.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-DSUjVCcf.cjs +131 -0
- package/dist/PersistedWorkflowSnapshotFactory-DSUjVCcf.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-DdHuhkDb.cjs +107 -0
- package/dist/PersistedWorkflowSnapshotFactory-DdHuhkDb.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-Dqc6NHis.js +119 -0
- package/dist/PersistedWorkflowSnapshotFactory-Dqc6NHis.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-Dxa2dSrw.cjs +130 -0
- package/dist/PersistedWorkflowSnapshotFactory-Dxa2dSrw.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-Ep79Ah1G.js +123 -0
- package/dist/PersistedWorkflowSnapshotFactory-Ep79Ah1G.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-GyLfRuiJ.js +119 -0
- package/dist/PersistedWorkflowSnapshotFactory-GyLfRuiJ.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-HTpBsBzn.js +102 -0
- package/dist/PersistedWorkflowSnapshotFactory-HTpBsBzn.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-LVmaaf3t.cjs +141 -0
- package/dist/PersistedWorkflowSnapshotFactory-LVmaaf3t.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-PZCpo2ZS.js +119 -0
- package/dist/PersistedWorkflowSnapshotFactory-PZCpo2ZS.js.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-UjQ1SJev.cjs +109 -0
- package/dist/PersistedWorkflowSnapshotFactory-UjQ1SJev.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-Y8kCrhcy.cjs +109 -0
- package/dist/PersistedWorkflowSnapshotFactory-Y8kCrhcy.cjs.map +1 -0
- package/dist/PersistedWorkflowSnapshotFactory-Z_nB-fmB.cjs +108 -0
- package/dist/PersistedWorkflowSnapshotFactory-Z_nB-fmB.cjs.map +1 -0
- package/dist/RunIntentService-1EE6N8ZL.cjs +963 -0
- package/dist/RunIntentService-1EE6N8ZL.cjs.map +1 -0
- package/dist/RunIntentService-2ivFmNQh.cjs +3462 -0
- package/dist/RunIntentService-2ivFmNQh.cjs.map +1 -0
- package/dist/RunIntentService-B0sUL5q-.js +761 -0
- package/dist/RunIntentService-B0sUL5q-.js.map +1 -0
- package/dist/RunIntentService-BFVbsOcg.js +3131 -0
- package/dist/RunIntentService-BFVbsOcg.js.map +1 -0
- package/dist/RunIntentService-BsBOwpVN.cjs +1051 -0
- package/dist/RunIntentService-BsBOwpVN.cjs.map +1 -0
- package/dist/RunIntentService-CSk3ETyn.js +858 -0
- package/dist/RunIntentService-CSk3ETyn.js.map +1 -0
- package/dist/RunIntentService-Ckn3u3tA.d.cts +326 -0
- package/dist/RunIntentService-DEo6GTTo.d.cts +289 -0
- package/dist/RunIntentService-DKrGtL0B.js +782 -0
- package/dist/RunIntentService-DKrGtL0B.js.map +1 -0
- package/dist/RunIntentService-DNOJc1R7.cjs +942 -0
- package/dist/RunIntentService-DNOJc1R7.cjs.map +1 -0
- package/dist/RunIntentService-Dq3pV53j.d.cts +289 -0
- package/dist/RunIntentService-NKobsfMQ.d.cts +274 -0
- package/dist/WorkflowSnapshotCodec-C3fuuS_R.d.cts +22 -0
- package/dist/WorkflowSnapshotCodec-CUudUo6f.js +123 -0
- package/dist/WorkflowSnapshotCodec-CUudUo6f.js.map +1 -0
- package/dist/WorkflowSnapshotCodec-CuCPQZTc.cjs +129 -0
- package/dist/WorkflowSnapshotCodec-CuCPQZTc.cjs.map +1 -0
- package/dist/WorkflowSnapshotCodec-DLiXQNvV.d.cts +22 -0
- package/dist/WorkflowSnapshotCodec-DNtdrZ7l.d.cts +22 -0
- package/dist/WorkflowSnapshotCodec-DTdWkoW_.d.cts +22 -0
- package/dist/bootstrap/index.cjs +1028 -0
- package/dist/bootstrap/index.cjs.map +1 -0
- package/dist/bootstrap/index.d.cts +311 -0
- package/dist/bootstrap/index.d.ts +83 -0
- package/dist/bootstrap/index.js +994 -0
- package/dist/bootstrap/index.js.map +1 -0
- package/dist/credentialTypes-B5h3dI7r.d.cts +1107 -0
- package/dist/credentialTypes-B9okPCVo.d.cts +963 -0
- package/dist/credentialTypes-BFL70rgZ.d.cts +964 -0
- package/dist/credentialTypes-BGkh1O07.d.ts +1010 -0
- package/dist/credentialTypes-BNLi4Q7u.d.ts +1030 -0
- package/dist/credentialTypes-CeSoZGj3.d.cts +994 -0
- package/dist/credentialTypes-CpHc32Ig.d.cts +984 -0
- package/dist/credentialTypes-D0m7MQQl.d.cts +1107 -0
- package/dist/credentialTypes-D4nL2sUd.d.ts +1000 -0
- package/dist/credentialTypes-DBYK2Qbu.d.ts +999 -0
- package/dist/credentialTypes-DMJVy0r1.d.ts +1000 -0
- package/dist/credentialTypes-DhUAjYQp.d.ts +1020 -0
- package/dist/credentialTypes-gGITj5KL.d.cts +964 -0
- package/dist/credentialTypes-r3KVBJBE.d.cts +974 -0
- package/dist/diTokens-ClO27tjK.cjs +34 -0
- package/dist/diTokens-ClO27tjK.cjs.map +1 -0
- package/dist/diTokens-CoHBkwG6.js +28 -0
- package/dist/diTokens-CoHBkwG6.js.map +1 -0
- package/dist/index-6Doxmfnd.d.ts +857 -0
- package/dist/index-9g6Pfe9Z.d.ts +689 -0
- package/dist/index-AZ72Ej-K.d.ts +920 -0
- package/dist/index-BEk9V-q-.d.ts +667 -0
- package/dist/index-Bjt7_7oS.d.ts +1192 -0
- package/dist/index-CFGxsYXy.d.ts +708 -0
- package/dist/index-C_u8xFgn.d.ts +690 -0
- package/dist/index-CpbfsvOJ.d.ts +1192 -0
- package/dist/index-CsReNJN_.d.ts +859 -0
- package/dist/index-D5iNnXaW.d.ts +667 -0
- package/dist/index-DD_Eft1q.d.ts +708 -0
- package/dist/index-DiSYUe0G.d.ts +1192 -0
- package/dist/index-gIcH60sp.d.ts +674 -0
- package/dist/index.cjs +520 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +345 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +412 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime-BIvd-1JA.cjs +4112 -0
- package/dist/runtime-BIvd-1JA.cjs.map +1 -0
- package/dist/runtime-D3eWKSQK.cjs +3986 -0
- package/dist/runtime-D3eWKSQK.cjs.map +1 -0
- package/dist/runtime-Dvp4xAjg.js +3799 -0
- package/dist/runtime-Dvp4xAjg.js.map +1 -0
- package/dist/runtime-vc76SSAa.js +3685 -0
- package/dist/runtime-vc76SSAa.js.map +1 -0
- package/dist/runtimeTypes-BK0b8SaG.d.cts +884 -0
- package/dist/runtimeTypes-CoYZkYQq.d.cts +851 -0
- package/dist/runtimeTypes-D-Pm0Uas.d.cts +849 -0
- package/dist/testing.cjs +18 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +19 -0
- package/dist/testing.d.ts +18 -0
- package/dist/testing.js +16 -0
- package/dist/testing.js.map +1 -0
- package/dist/types-Cb5UK7Y6.d.ts +857 -0
- package/package.json +66 -0
- package/src/ai/AiHost.ts +115 -0
- package/src/binaries/DefaultExecutionBinaryServiceFactory.ts +37 -0
- package/src/binaries/DefaultNodeBinaryAttachmentServiceFactory.ts +120 -0
- package/src/binaries/UnavailableBinaryStorage.ts +19 -0
- package/src/binaries/index.ts +2 -0
- package/src/bootstrap/index.ts +46 -0
- package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +180 -0
- package/src/bootstrap/runtime/EngineRuntimeRegistration.types.ts +43 -0
- package/src/bootstrap/runtime/index.ts +6 -0
- package/src/browser.ts +8 -0
- package/src/contracts/Clock.ts +10 -0
- package/src/contracts/ExpRetryPolicy.ts +23 -0
- package/src/contracts/NoRetryPolicy.ts +5 -0
- package/src/contracts/RetryPolicy.ts +23 -0
- package/src/contracts/credentialTypes.ts +194 -0
- package/src/contracts/index.ts +6 -0
- package/src/contracts/retryPolicySpec.types.ts +30 -0
- package/src/contracts/runFinishedAtFactory.ts +19 -0
- package/src/contracts/runTypes.ts +314 -0
- package/src/contracts/runtimeTypes.ts +373 -0
- package/src/contracts/webhookTypes.ts +49 -0
- package/src/contracts/workflowActivationPolicy.ts +16 -0
- package/src/contracts/workflowTypes.ts +280 -0
- package/src/di/CoreTokens.ts +60 -0
- package/src/di/index.ts +24 -0
- package/src/events/EventPublishingWorkflowExecutionRepository.ts +67 -0
- package/src/events/InMemoryRunEventBusRegistry.ts +37 -0
- package/src/events/InMemoryRunEventSubscription.ts +9 -0
- package/src/events/NodeEventPublisher.ts +22 -0
- package/src/events/index.ts +4 -0
- package/src/events/runEvents.ts +54 -0
- package/src/execution/ActivationEnqueueService.ts +125 -0
- package/src/execution/CredentialResolverFactory.ts +39 -0
- package/src/execution/DefaultAsyncSleeper.ts +9 -0
- package/src/execution/DefaultExecutionContextFactory.ts +48 -0
- package/src/execution/InProcessRetryRunner.ts +115 -0
- package/src/execution/InProcessRetryRunnerFactory.ts +8 -0
- package/src/execution/NodeActivationRequestComposer.ts +113 -0
- package/src/execution/NodeExecutionSnapshotFactory.ts +152 -0
- package/src/execution/NodeExecutor.ts +43 -0
- package/src/execution/NodeExecutorFactory.ts +10 -0
- package/src/execution/NodeInputsByPortFactory.ts +14 -0
- package/src/execution/NodeInstanceFactory.ts +32 -0
- package/src/execution/NodeInstanceFactoryFactory.ts +9 -0
- package/src/execution/NodeRunStateWriter.ts +185 -0
- package/src/execution/NodeRunStateWriterFactory.ts +29 -0
- package/src/execution/PersistedRunStateTerminalBuilder.ts +25 -0
- package/src/execution/RunStateSemantics.ts +158 -0
- package/src/execution/WorkflowRunExecutionContextFactory.ts +45 -0
- package/src/execution/asyncSleeper.types.ts +3 -0
- package/src/execution/index.ts +26 -0
- package/src/index.ts +18 -0
- package/src/orchestration/Engine.ts +229 -0
- package/src/orchestration/EngineWaiters.ts +37 -0
- package/src/orchestration/RunContinuationService.ts +810 -0
- package/src/orchestration/RunStartService.ts +449 -0
- package/src/orchestration/TriggerRuntimeService.ts +260 -0
- package/src/orchestration/index.ts +5 -0
- package/src/planning/CurrentStateFrontierPlanner.ts +400 -0
- package/src/planning/EngineWorkflowPlanningFactory.ts +63 -0
- package/src/planning/RunQueuePlanner.ts +302 -0
- package/src/planning/WorkflowTopologyPlanner.ts +77 -0
- package/src/planning/index.ts +4 -0
- package/src/policies/WorkflowPolicyErrorServices.ts +38 -0
- package/src/policies/executionLimits/EngineExecutionLimitsPolicy.ts +66 -0
- package/src/policies/executionLimits/EngineExecutionLimitsPolicyFactory.ts +14 -0
- package/src/policies/index.ts +10 -0
- package/src/policies/storage/RunPolicySnapshotFactory.ts +23 -0
- package/src/policies/storage/RunTerminalPersistenceCoordinator.ts +29 -0
- package/src/policies/storage/WorkflowStoragePolicyEvaluator.ts +39 -0
- package/src/runStorage/BinaryBodyBufferReader.ts +57 -0
- package/src/runStorage/BinaryBodyReadableStreamFactory.ts +21 -0
- package/src/runStorage/InMemoryBinaryStorageRegistry.ts +53 -0
- package/src/runStorage/InMemoryRunData.ts +33 -0
- package/src/runStorage/InMemoryRunDataFactory.ts +8 -0
- package/src/runStorage/InMemoryWorkflowExecutionRepository.ts +95 -0
- package/src/runStorage/RunSummaryMapper.ts +17 -0
- package/src/runStorage/index.ts +7 -0
- package/src/runtime/EngineFactory.ts +151 -0
- package/src/runtime/EngineWorkflowRunnerService.ts +39 -0
- package/src/runtime/EngineWorkflowRunnerServiceFactory.ts +11 -0
- package/src/runtime/InMemoryLiveWorkflowRepository.ts +20 -0
- package/src/runtime/RunIntentService.ts +175 -0
- package/src/runtime/RunIntentServiceFactory.ts +11 -0
- package/src/runtime/WorkflowRepositoryWebhookTriggerMatcher.ts +144 -0
- package/src/runtime/WorkflowRepositoryWebhookTriggerMatcherFactory.ts +13 -0
- package/src/runtime/index.ts +9 -0
- package/src/runtime-types/InjectableRuntimeDecoratorComposerRegistry.ts +25 -0
- package/src/runtime-types/PersistedRuntimeTypeMetadataStoreRegistry.ts +46 -0
- package/src/runtime-types/PersistedRuntimeTypeNameResolver.ts +14 -0
- package/src/runtime-types/StackTraceCallSitePathResolver.ts +25 -0
- package/src/runtime-types/persistedRuntimeTypeModelRegistry.ts +33 -0
- package/src/runtime-types/runtimeTypeDecorators.types.ts +46 -0
- package/src/scheduler/ConfigDrivenOffloadPolicy.ts +28 -0
- package/src/scheduler/DefaultDrivingScheduler.ts +100 -0
- package/src/scheduler/HintOnlyOffloadPolicy.ts +9 -0
- package/src/scheduler/InlineDrivingScheduler.ts +145 -0
- package/src/scheduler/InlineDrivingSchedulerFactory.ts +9 -0
- package/src/scheduler/LocalOnlyScheduler.ts +7 -0
- package/src/serialization/ItemsInputNormalizer.ts +36 -0
- package/src/testing/RejectingCredentialSessionService.ts +15 -0
- package/src/testing.ts +6 -0
- package/src/types/index.ts +12 -0
- package/src/workflow/definition/ConnectionInvocationIdFactory.ts +17 -0
- package/src/workflow/definition/ConnectionNodeIdFactory.ts +42 -0
- package/src/workflow/definition/WorkflowExecutableNodeClassifier.ts +71 -0
- package/src/workflow/definition/WorkflowExecutableNodeClassifierFactory.ts +9 -0
- package/src/workflow/dsl/ChainCursorResolver.ts +103 -0
- package/src/workflow/dsl/WhenBuilder.ts +57 -0
- package/src/workflow/dsl/WorkflowBuilder.ts +55 -0
- package/src/workflow/dsl/workflowBuilderTypes.ts +63 -0
- package/src/workflow/graph/DefaultWorkflowGraphFactory.ts +8 -0
- package/src/workflow/graph/ExecutableGraph.ts +24 -0
- package/src/workflow/index.ts +11 -0
- package/src/workflowSnapshots/MissingRuntimeExecutionMarker.ts +5 -0
- package/src/workflowSnapshots/MissingRuntimeFallbacksFactory.ts +27 -0
- package/src/workflowSnapshots/MissingRuntimeNode.ts +12 -0
- package/src/workflowSnapshots/MissingRuntimeNodeConfig.ts +14 -0
- package/src/workflowSnapshots/MissingRuntimeNodeToken.ts +1 -0
- package/src/workflowSnapshots/MissingRuntimeTrigger.ts +16 -0
- package/src/workflowSnapshots/MissingRuntimeTriggerConfig.ts +14 -0
- package/src/workflowSnapshots/MissingRuntimeTriggerToken.ts +1 -0
- package/src/workflowSnapshots/PersistedRuntimeTypeIdFactory.ts +19 -0
- package/src/workflowSnapshots/PersistedWorkflowTokenRegistry.ts +89 -0
- package/src/workflowSnapshots/PersistedWorkflowTokenRegistryFactory.ts +2 -0
- package/src/workflowSnapshots/WorkflowSnapshotCodec.ts +177 -0
- package/src/workflowSnapshots/WorkflowSnapshotResolver.ts +102 -0
- package/src/workflowSnapshots/index.ts +12 -0
- package/tsconfig.json +9 -0
- package/tsdown.config.ts +10 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ReadableStream } from "node:stream/web";
|
|
2
|
+
|
|
3
|
+
import type { BinaryBody } from "../types";
|
|
4
|
+
|
|
5
|
+
export class BinaryBodyBufferReader {
|
|
6
|
+
async read(body: BinaryBody): Promise<Uint8Array> {
|
|
7
|
+
if (body instanceof Uint8Array) {
|
|
8
|
+
return body;
|
|
9
|
+
}
|
|
10
|
+
if (body instanceof ArrayBuffer) {
|
|
11
|
+
return new Uint8Array(body);
|
|
12
|
+
}
|
|
13
|
+
if (body instanceof ReadableStream) {
|
|
14
|
+
return await this.readReadableStream(body);
|
|
15
|
+
}
|
|
16
|
+
return await this.readAsyncIterable(body);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private async readReadableStream(body: ReadableStream<Uint8Array>): Promise<Uint8Array> {
|
|
20
|
+
const reader = body.getReader();
|
|
21
|
+
const chunks: Uint8Array[] = [];
|
|
22
|
+
let totalSize = 0;
|
|
23
|
+
try {
|
|
24
|
+
while (true) {
|
|
25
|
+
const result = await reader.read();
|
|
26
|
+
if (result.done) {
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
chunks.push(result.value);
|
|
30
|
+
totalSize += result.value.byteLength;
|
|
31
|
+
}
|
|
32
|
+
} finally {
|
|
33
|
+
reader.releaseLock();
|
|
34
|
+
}
|
|
35
|
+
return this.joinChunks(chunks, totalSize);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private async readAsyncIterable(body: AsyncIterable<Uint8Array>): Promise<Uint8Array> {
|
|
39
|
+
const chunks: Uint8Array[] = [];
|
|
40
|
+
let totalSize = 0;
|
|
41
|
+
for await (const chunk of body) {
|
|
42
|
+
chunks.push(chunk);
|
|
43
|
+
totalSize += chunk.byteLength;
|
|
44
|
+
}
|
|
45
|
+
return this.joinChunks(chunks, totalSize);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private joinChunks(chunks: ReadonlyArray<Uint8Array>, totalSize: number): Uint8Array {
|
|
49
|
+
const bytes = new Uint8Array(totalSize);
|
|
50
|
+
let offset = 0;
|
|
51
|
+
for (const chunk of chunks) {
|
|
52
|
+
bytes.set(chunk, offset);
|
|
53
|
+
offset += chunk.byteLength;
|
|
54
|
+
}
|
|
55
|
+
return bytes;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReadableStream } from "node:stream/web";
|
|
2
|
+
|
|
3
|
+
export class BinaryBodyReadableStreamFactory {
|
|
4
|
+
constructor(private readonly bytes: Uint8Array) {}
|
|
5
|
+
|
|
6
|
+
create(): ReadableStream<Uint8Array> {
|
|
7
|
+
const value = this.bytes;
|
|
8
|
+
let consumed = false;
|
|
9
|
+
return new ReadableStream<Uint8Array>({
|
|
10
|
+
pull(controller) {
|
|
11
|
+
if (consumed) {
|
|
12
|
+
controller.close();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
consumed = true;
|
|
16
|
+
controller.enqueue(value);
|
|
17
|
+
controller.close();
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
BinaryBody,
|
|
5
|
+
BinaryStorage,
|
|
6
|
+
BinaryStorageReadResult,
|
|
7
|
+
BinaryStorageStatResult,
|
|
8
|
+
BinaryStorageWriteResult,
|
|
9
|
+
} from "../types";
|
|
10
|
+
|
|
11
|
+
import { BinaryBodyBufferReader } from "./BinaryBodyBufferReader";
|
|
12
|
+
import { BinaryBodyReadableStreamFactory } from "./BinaryBodyReadableStreamFactory";
|
|
13
|
+
|
|
14
|
+
export class InMemoryBinaryStorage implements BinaryStorage {
|
|
15
|
+
readonly driverName = "memory";
|
|
16
|
+
private readonly values = new Map<string, Uint8Array>();
|
|
17
|
+
|
|
18
|
+
async write(args: { storageKey: string; body: BinaryBody }): Promise<BinaryStorageWriteResult> {
|
|
19
|
+
const bytes = await new BinaryBodyBufferReader().read(args.body);
|
|
20
|
+
this.values.set(args.storageKey, bytes);
|
|
21
|
+
return {
|
|
22
|
+
storageKey: args.storageKey,
|
|
23
|
+
size: bytes.byteLength,
|
|
24
|
+
sha256: createHash("sha256").update(bytes).digest("hex"),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async openReadStream(storageKey: string): Promise<BinaryStorageReadResult | undefined> {
|
|
29
|
+
const bytes = this.values.get(storageKey);
|
|
30
|
+
if (!bytes) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
body: new BinaryBodyReadableStreamFactory(bytes).create(),
|
|
35
|
+
size: bytes.byteLength,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async stat(storageKey: string): Promise<BinaryStorageStatResult> {
|
|
40
|
+
const bytes = this.values.get(storageKey);
|
|
41
|
+
if (!bytes) {
|
|
42
|
+
return { exists: false };
|
|
43
|
+
}
|
|
44
|
+
return { exists: true, size: bytes.byteLength };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async delete(storageKey: string): Promise<void> {
|
|
48
|
+
this.values.delete(storageKey);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { BinaryBodyBufferReader } from "./BinaryBodyBufferReader";
|
|
53
|
+
export { BinaryBodyReadableStreamFactory } from "./BinaryBodyReadableStreamFactory";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Items, MutableRunData, NodeId, NodeOutputs, OutputPortKey } from "../types";
|
|
2
|
+
|
|
3
|
+
export class InMemoryRunData implements MutableRunData {
|
|
4
|
+
private readonly byNode = new Map<NodeId, NodeOutputs>();
|
|
5
|
+
|
|
6
|
+
constructor(initial?: Record<NodeId, NodeOutputs>) {
|
|
7
|
+
if (initial) {
|
|
8
|
+
for (const [nodeId, outputs] of Object.entries(initial)) this.byNode.set(nodeId, outputs);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
setOutputs(nodeId: NodeId, outputs: NodeOutputs): void {
|
|
13
|
+
this.byNode.set(nodeId, outputs);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
getOutputs(nodeId: NodeId): NodeOutputs | undefined {
|
|
17
|
+
return this.byNode.get(nodeId);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getOutputItems(nodeId: NodeId, output: OutputPortKey = "main"): Items {
|
|
21
|
+
return this.byNode.get(nodeId)?.[output] ?? [];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getOutputItem(nodeId: NodeId, itemIndex: number, output: OutputPortKey = "main") {
|
|
25
|
+
return this.getOutputItems(nodeId, output)[itemIndex];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
dump(): Record<NodeId, NodeOutputs> {
|
|
29
|
+
const out: Record<NodeId, NodeOutputs> = {};
|
|
30
|
+
for (const [nodeId, outputs] of this.byNode.entries()) out[nodeId] = outputs;
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MutableRunData, NodeId, NodeOutputs, RunDataFactory } from "../types";
|
|
2
|
+
import { InMemoryRunData } from "./InMemoryRunData";
|
|
3
|
+
|
|
4
|
+
export class InMemoryRunDataFactory implements RunDataFactory {
|
|
5
|
+
create(initial?: Record<NodeId, NodeOutputs>): MutableRunData {
|
|
6
|
+
return new InMemoryRunData(initial);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
EngineRunCounters,
|
|
3
|
+
NodeId,
|
|
4
|
+
NodeOutputs,
|
|
5
|
+
ParentExecutionRef,
|
|
6
|
+
PersistedRunState,
|
|
7
|
+
RunId,
|
|
8
|
+
RunSummary,
|
|
9
|
+
WorkflowExecutionListingRepository,
|
|
10
|
+
WorkflowExecutionPruneRepository,
|
|
11
|
+
WorkflowExecutionRepository,
|
|
12
|
+
RunPruneCandidate,
|
|
13
|
+
WorkflowId,
|
|
14
|
+
} from "../types";
|
|
15
|
+
import { RunFinishedAtFactory } from "../contracts/runFinishedAtFactory";
|
|
16
|
+
import { RunSummaryMapper } from "./RunSummaryMapper";
|
|
17
|
+
|
|
18
|
+
export class InMemoryWorkflowExecutionRepository
|
|
19
|
+
implements WorkflowExecutionRepository, WorkflowExecutionListingRepository, WorkflowExecutionPruneRepository
|
|
20
|
+
{
|
|
21
|
+
private readonly runs = new Map<RunId, PersistedRunState>();
|
|
22
|
+
|
|
23
|
+
async createRun(args: {
|
|
24
|
+
runId: RunId;
|
|
25
|
+
workflowId: WorkflowId;
|
|
26
|
+
startedAt: string;
|
|
27
|
+
parent?: ParentExecutionRef;
|
|
28
|
+
executionOptions?: PersistedRunState["executionOptions"];
|
|
29
|
+
control?: PersistedRunState["control"];
|
|
30
|
+
workflowSnapshot?: PersistedRunState["workflowSnapshot"];
|
|
31
|
+
mutableState?: PersistedRunState["mutableState"];
|
|
32
|
+
policySnapshot?: PersistedRunState["policySnapshot"];
|
|
33
|
+
engineCounters?: EngineRunCounters;
|
|
34
|
+
}): Promise<void> {
|
|
35
|
+
this.runs.set(args.runId, {
|
|
36
|
+
runId: args.runId,
|
|
37
|
+
workflowId: args.workflowId,
|
|
38
|
+
startedAt: args.startedAt,
|
|
39
|
+
parent: args.parent,
|
|
40
|
+
executionOptions: args.executionOptions,
|
|
41
|
+
control: args.control,
|
|
42
|
+
workflowSnapshot: args.workflowSnapshot,
|
|
43
|
+
mutableState: args.mutableState,
|
|
44
|
+
policySnapshot: args.policySnapshot,
|
|
45
|
+
engineCounters: args.engineCounters,
|
|
46
|
+
status: "running",
|
|
47
|
+
queue: [],
|
|
48
|
+
outputsByNode: {} as Record<NodeId, NodeOutputs>,
|
|
49
|
+
nodeSnapshotsByNodeId: {},
|
|
50
|
+
connectionInvocations: [],
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async load(runId: RunId): Promise<PersistedRunState | undefined> {
|
|
55
|
+
return this.runs.get(runId);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async save(state: PersistedRunState): Promise<void> {
|
|
59
|
+
this.runs.set(state.runId, state);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async deleteRun(runId: RunId): Promise<void> {
|
|
63
|
+
this.runs.delete(runId);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async listRuns(args?: Readonly<{ workflowId?: WorkflowId; limit?: number }>): Promise<ReadonlyArray<RunSummary>> {
|
|
67
|
+
const limit = args?.limit ?? 50;
|
|
68
|
+
const summaries = [...this.runs.values()]
|
|
69
|
+
.filter((s) => (args?.workflowId ? s.workflowId === args.workflowId : true))
|
|
70
|
+
.sort((a, b) => b.startedAt.localeCompare(a.startedAt))
|
|
71
|
+
.slice(0, limit)
|
|
72
|
+
.map((s) => RunSummaryMapper.fromPersistedState(s));
|
|
73
|
+
return summaries;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async listRunsOlderThan(
|
|
77
|
+
args: Readonly<{ beforeIso: string; limit?: number }>,
|
|
78
|
+
): Promise<ReadonlyArray<RunPruneCandidate>> {
|
|
79
|
+
const limit = args.limit ?? 100;
|
|
80
|
+
const out: RunPruneCandidate[] = [];
|
|
81
|
+
for (const s of this.runs.values()) {
|
|
82
|
+
if (s.status !== "completed" && s.status !== "failed") continue;
|
|
83
|
+
const finishedAt = RunFinishedAtFactory.resolveIso(s);
|
|
84
|
+
if (!finishedAt || finishedAt >= args.beforeIso) continue;
|
|
85
|
+
out.push({
|
|
86
|
+
runId: s.runId,
|
|
87
|
+
workflowId: s.workflowId,
|
|
88
|
+
startedAt: s.startedAt,
|
|
89
|
+
finishedAt,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
out.sort((a, b) => a.finishedAt.localeCompare(b.finishedAt));
|
|
93
|
+
return out.slice(0, limit);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RunFinishedAtFactory } from "../contracts/runFinishedAtFactory";
|
|
2
|
+
import type { PersistedRunState, RunSummary } from "../types";
|
|
3
|
+
|
|
4
|
+
/** Maps persisted run state to API run summaries for listings. */
|
|
5
|
+
export class RunSummaryMapper {
|
|
6
|
+
static fromPersistedState(state: PersistedRunState): RunSummary {
|
|
7
|
+
return {
|
|
8
|
+
runId: state.runId,
|
|
9
|
+
workflowId: state.workflowId,
|
|
10
|
+
startedAt: state.startedAt,
|
|
11
|
+
status: state.status,
|
|
12
|
+
finishedAt: RunFinishedAtFactory.resolveIso(state),
|
|
13
|
+
parent: state.parent,
|
|
14
|
+
executionOptions: state.executionOptions,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { BinaryBodyBufferReader } from "./BinaryBodyBufferReader";
|
|
2
|
+
export { BinaryBodyReadableStreamFactory } from "./BinaryBodyReadableStreamFactory";
|
|
3
|
+
export { InMemoryBinaryStorage } from "./InMemoryBinaryStorageRegistry";
|
|
4
|
+
export { InMemoryRunData } from "./InMemoryRunData";
|
|
5
|
+
export { InMemoryRunDataFactory } from "./InMemoryRunDataFactory";
|
|
6
|
+
export { InMemoryWorkflowExecutionRepository } from "./InMemoryWorkflowExecutionRepository";
|
|
7
|
+
export { RunSummaryMapper } from "./RunSummaryMapper";
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import type { EngineDeps } from "../types";
|
|
2
|
+
|
|
3
|
+
import { MissingRuntimeFallbacks } from "../workflowSnapshots/MissingRuntimeFallbacksFactory";
|
|
4
|
+
import { MissingRuntimeExecutionMarker } from "../workflowSnapshots/MissingRuntimeExecutionMarker";
|
|
5
|
+
import { WorkflowSnapshotCodec } from "../workflowSnapshots/WorkflowSnapshotCodec";
|
|
6
|
+
import { WorkflowSnapshotResolver } from "../workflowSnapshots/WorkflowSnapshotResolver";
|
|
7
|
+
import { ActivationEnqueueService } from "../execution/ActivationEnqueueService";
|
|
8
|
+
import { NodeActivationRequestComposer } from "../execution/NodeActivationRequestComposer";
|
|
9
|
+
import { PersistedRunStateTerminalBuilder } from "../execution/PersistedRunStateTerminalBuilder";
|
|
10
|
+
import { RunContinuationService } from "../orchestration/RunContinuationService";
|
|
11
|
+
import { RunStartService } from "../orchestration/RunStartService";
|
|
12
|
+
import { RunStateSemantics } from "../execution/RunStateSemantics";
|
|
13
|
+
import { WorkflowRunExecutionContextFactory } from "../execution/WorkflowRunExecutionContextFactory";
|
|
14
|
+
import { RunTerminalPersistenceCoordinator } from "../policies/storage/RunTerminalPersistenceCoordinator";
|
|
15
|
+
import { WorkflowPolicyErrorServices } from "../policies/WorkflowPolicyErrorServices";
|
|
16
|
+
import { WorkflowStoragePolicyEvaluator } from "../policies/storage/WorkflowStoragePolicyEvaluator";
|
|
17
|
+
import { NodeEventPublisher } from "../events/NodeEventPublisher";
|
|
18
|
+
import { EngineExecutionLimitsPolicy } from "../policies/executionLimits/EngineExecutionLimitsPolicy";
|
|
19
|
+
import { EngineWorkflowPlanningFactory } from "../planning/EngineWorkflowPlanningFactory";
|
|
20
|
+
import { TriggerRuntimeService } from "../orchestration/TriggerRuntimeService";
|
|
21
|
+
import { EngineWaiters } from "../orchestration/EngineWaiters";
|
|
22
|
+
import { Engine } from "../orchestration/Engine";
|
|
23
|
+
import { CredentialResolverFactory } from "../execution/CredentialResolverFactory";
|
|
24
|
+
import { NodeRunStateWriterFactory } from "../execution/NodeRunStateWriterFactory";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* {@link EngineDeps} plus optional overrides for workflow-snapshot materialization.
|
|
28
|
+
* Overrides keep default construction in this factory while allowing tests or advanced wiring to inject instances.
|
|
29
|
+
*/
|
|
30
|
+
export type EngineCompositionDeps = EngineDeps & {
|
|
31
|
+
workflowSnapshotCodec?: WorkflowSnapshotCodec;
|
|
32
|
+
missingRuntimeFallbacks?: MissingRuntimeFallbacks;
|
|
33
|
+
/** When set, used for run-start, trigger, and continuation limit defaults. */
|
|
34
|
+
executionLimitsPolicy?: EngineExecutionLimitsPolicy;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Composes the {@link Engine} graph from {@link EngineCompositionDeps}. Production wiring usually goes through
|
|
39
|
+
* {@link import("../bootstrap/runtime/EngineRuntimeRegistrar").EngineRuntimeRegistrar}; this factory remains for tests and custom composition.
|
|
40
|
+
* Exported from `@codemation/core/bootstrap` (not the main `@codemation/core` barrel).
|
|
41
|
+
*/
|
|
42
|
+
export class EngineFactory {
|
|
43
|
+
create(deps: EngineCompositionDeps): Engine {
|
|
44
|
+
const waiters = new EngineWaiters();
|
|
45
|
+
const credentialResolverFactory = new CredentialResolverFactory(deps.credentialSessions);
|
|
46
|
+
const nodeEventPublisher = new NodeEventPublisher(deps.eventBus);
|
|
47
|
+
const nodeStatePublisherFactory = new NodeRunStateWriterFactory(
|
|
48
|
+
deps.workflowExecutionRepository,
|
|
49
|
+
nodeEventPublisher,
|
|
50
|
+
);
|
|
51
|
+
const planningFactory = new EngineWorkflowPlanningFactory(deps.workflowNodeInstanceFactory);
|
|
52
|
+
const executionLimitsPolicy = deps.executionLimitsPolicy ?? new EngineExecutionLimitsPolicy();
|
|
53
|
+
const workflowSnapshotCodec = deps.workflowSnapshotCodec ?? new WorkflowSnapshotCodec(deps.tokenRegistry);
|
|
54
|
+
const missingRuntimeFallbacks = deps.missingRuntimeFallbacks ?? new MissingRuntimeFallbacks();
|
|
55
|
+
const workflowSnapshotResolver = new WorkflowSnapshotResolver(
|
|
56
|
+
deps.workflowRepository,
|
|
57
|
+
deps.tokenRegistry,
|
|
58
|
+
workflowSnapshotCodec,
|
|
59
|
+
missingRuntimeFallbacks,
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const semantics = new RunStateSemantics(new MissingRuntimeExecutionMarker());
|
|
63
|
+
const activationEnqueueService = new ActivationEnqueueService(
|
|
64
|
+
deps.activationScheduler,
|
|
65
|
+
deps.workflowExecutionRepository,
|
|
66
|
+
nodeEventPublisher,
|
|
67
|
+
);
|
|
68
|
+
const runExecutionContextFactory = new WorkflowRunExecutionContextFactory(
|
|
69
|
+
deps.executionContextFactory,
|
|
70
|
+
credentialResolverFactory,
|
|
71
|
+
);
|
|
72
|
+
const nodeActivationRequestComposer = new NodeActivationRequestComposer(
|
|
73
|
+
deps.activationIdFactory,
|
|
74
|
+
credentialResolverFactory,
|
|
75
|
+
);
|
|
76
|
+
const persistedRunStateTerminalBuilder = new PersistedRunStateTerminalBuilder();
|
|
77
|
+
const storagePolicyEvaluator = new WorkflowStoragePolicyEvaluator(deps.nodeResolver);
|
|
78
|
+
const terminalPersistence = new RunTerminalPersistenceCoordinator(
|
|
79
|
+
deps.workflowExecutionRepository,
|
|
80
|
+
storagePolicyEvaluator,
|
|
81
|
+
);
|
|
82
|
+
const policyErrorServices = new WorkflowPolicyErrorServices(deps.nodeResolver);
|
|
83
|
+
|
|
84
|
+
const runStartService = new RunStartService(
|
|
85
|
+
deps.runIdFactory,
|
|
86
|
+
deps.workflowExecutionRepository,
|
|
87
|
+
deps.runDataFactory,
|
|
88
|
+
workflowSnapshotCodec,
|
|
89
|
+
planningFactory,
|
|
90
|
+
nodeStatePublisherFactory,
|
|
91
|
+
runExecutionContextFactory,
|
|
92
|
+
nodeActivationRequestComposer,
|
|
93
|
+
activationEnqueueService,
|
|
94
|
+
semantics,
|
|
95
|
+
waiters,
|
|
96
|
+
deps.workflowPolicyRuntimeDefaults,
|
|
97
|
+
executionLimitsPolicy,
|
|
98
|
+
);
|
|
99
|
+
const runContinuationService = new RunContinuationService(
|
|
100
|
+
deps.activationIdFactory,
|
|
101
|
+
deps.workflowExecutionRepository,
|
|
102
|
+
deps.runDataFactory,
|
|
103
|
+
runExecutionContextFactory,
|
|
104
|
+
workflowSnapshotResolver,
|
|
105
|
+
planningFactory,
|
|
106
|
+
nodeStatePublisherFactory,
|
|
107
|
+
credentialResolverFactory,
|
|
108
|
+
nodeActivationRequestComposer,
|
|
109
|
+
persistedRunStateTerminalBuilder,
|
|
110
|
+
activationEnqueueService,
|
|
111
|
+
nodeEventPublisher,
|
|
112
|
+
semantics,
|
|
113
|
+
waiters,
|
|
114
|
+
policyErrorServices,
|
|
115
|
+
terminalPersistence,
|
|
116
|
+
executionLimitsPolicy,
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const triggerRuntime = new TriggerRuntimeService(
|
|
120
|
+
deps.workflowRepository,
|
|
121
|
+
deps.workflowActivationPolicy,
|
|
122
|
+
deps.runIdFactory,
|
|
123
|
+
deps.runDataFactory,
|
|
124
|
+
deps.executionContextFactory,
|
|
125
|
+
credentialResolverFactory,
|
|
126
|
+
nodeStatePublisherFactory,
|
|
127
|
+
deps.nodeResolver,
|
|
128
|
+
deps.triggerSetupStateRepository,
|
|
129
|
+
{
|
|
130
|
+
emit: async (workflow, triggerNodeId, items) => {
|
|
131
|
+
await runStartService.runWorkflow(workflow, triggerNodeId, items, undefined);
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
executionLimitsPolicy,
|
|
135
|
+
deps.triggerRuntimeDiagnostics,
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
const engine = new Engine({
|
|
139
|
+
liveWorkflowRepository: deps.liveWorkflowRepository,
|
|
140
|
+
tokenRegistry: deps.tokenRegistry,
|
|
141
|
+
webhookTriggerMatcher: deps.webhookTriggerMatcher,
|
|
142
|
+
workflowSnapshotResolver,
|
|
143
|
+
triggerRuntime,
|
|
144
|
+
runStartService,
|
|
145
|
+
runContinuationService,
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
deps.activationScheduler.setContinuation?.(engine);
|
|
149
|
+
return engine;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Items,
|
|
3
|
+
NodeId,
|
|
4
|
+
ParentExecutionRef,
|
|
5
|
+
RunResult,
|
|
6
|
+
WorkflowDefinition,
|
|
7
|
+
WorkflowId,
|
|
8
|
+
WorkflowRepository,
|
|
9
|
+
} from "../types";
|
|
10
|
+
import { WorkflowExecutableNodeClassifierFactory } from "../workflow";
|
|
11
|
+
|
|
12
|
+
import { Engine } from "../orchestration/Engine";
|
|
13
|
+
|
|
14
|
+
export class EngineWorkflowRunnerService {
|
|
15
|
+
constructor(
|
|
16
|
+
private readonly engine: Engine,
|
|
17
|
+
private readonly workflowRepository: WorkflowRepository,
|
|
18
|
+
) {}
|
|
19
|
+
|
|
20
|
+
async runById(args: {
|
|
21
|
+
workflowId: WorkflowId;
|
|
22
|
+
startAt?: NodeId;
|
|
23
|
+
items: Items;
|
|
24
|
+
parent?: ParentExecutionRef;
|
|
25
|
+
}): Promise<RunResult> {
|
|
26
|
+
const { workflowId, startAt, items, parent } = args;
|
|
27
|
+
const wf = this.workflowRepository.get(workflowId);
|
|
28
|
+
if (!wf) throw new Error(`Unknown workflowId: ${workflowId}`);
|
|
29
|
+
|
|
30
|
+
const startNodeId = startAt ?? this.findDefaultStartNodeId(wf);
|
|
31
|
+
const scheduled = await this.engine.runWorkflow(wf, startNodeId, items, parent);
|
|
32
|
+
if (scheduled.status !== "pending") return scheduled;
|
|
33
|
+
return await this.engine.waitForCompletion(scheduled.runId);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private findDefaultStartNodeId(wf: WorkflowDefinition): NodeId {
|
|
37
|
+
return WorkflowExecutableNodeClassifierFactory.create(wf).findDefaultExecutableStartNodeId(wf);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { WorkflowRepository } from "../types";
|
|
2
|
+
|
|
3
|
+
import { Engine } from "../orchestration/Engine";
|
|
4
|
+
|
|
5
|
+
import { EngineWorkflowRunnerService } from "./EngineWorkflowRunnerService";
|
|
6
|
+
|
|
7
|
+
export class EngineWorkflowRunnerServiceFactory {
|
|
8
|
+
create(engine: Engine, workflowRepository: WorkflowRepository): EngineWorkflowRunnerService {
|
|
9
|
+
return new EngineWorkflowRunnerService(engine, workflowRepository);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { LiveWorkflowRepository, WorkflowDefinition, WorkflowId } from "../types";
|
|
2
|
+
|
|
3
|
+
export class InMemoryLiveWorkflowRepository implements LiveWorkflowRepository {
|
|
4
|
+
private readonly workflowsById = new Map<WorkflowId, WorkflowDefinition>();
|
|
5
|
+
|
|
6
|
+
setWorkflows(workflows: ReadonlyArray<WorkflowDefinition>): void {
|
|
7
|
+
this.workflowsById.clear();
|
|
8
|
+
for (const workflow of workflows) {
|
|
9
|
+
this.workflowsById.set(workflow.id, workflow);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
list(): ReadonlyArray<WorkflowDefinition> {
|
|
14
|
+
return [...this.workflowsById.values()];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get(workflowId: WorkflowId): WorkflowDefinition | undefined {
|
|
18
|
+
return this.workflowsById.get(workflowId);
|
|
19
|
+
}
|
|
20
|
+
}
|