@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,175 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CurrentStateExecutionRequest,
|
|
3
|
+
HttpMethod,
|
|
4
|
+
Items,
|
|
5
|
+
NodeId,
|
|
6
|
+
RunCurrentState,
|
|
7
|
+
RunExecutionOptions,
|
|
8
|
+
RunResult,
|
|
9
|
+
RunStopCondition,
|
|
10
|
+
WebhookInvocationMatch,
|
|
11
|
+
WebhookRunResult,
|
|
12
|
+
WebhookTriggerResolution,
|
|
13
|
+
WorkflowDefinition,
|
|
14
|
+
WorkflowRepository,
|
|
15
|
+
} from "../types";
|
|
16
|
+
|
|
17
|
+
import { Engine } from "../orchestration/Engine";
|
|
18
|
+
|
|
19
|
+
export type StartWorkflowIntent = {
|
|
20
|
+
workflow: WorkflowDefinition;
|
|
21
|
+
startAt?: string;
|
|
22
|
+
items: Items;
|
|
23
|
+
parent?: CurrentStateExecutionRequest["parent"];
|
|
24
|
+
executionOptions?: RunExecutionOptions;
|
|
25
|
+
workflowSnapshot?: CurrentStateExecutionRequest["workflowSnapshot"];
|
|
26
|
+
mutableState?: CurrentStateExecutionRequest["mutableState"];
|
|
27
|
+
currentState?: RunCurrentState;
|
|
28
|
+
stopCondition?: RunStopCondition;
|
|
29
|
+
reset?: CurrentStateExecutionRequest["reset"];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type RerunFromNodeIntent = {
|
|
33
|
+
workflow: WorkflowDefinition;
|
|
34
|
+
nodeId: NodeId;
|
|
35
|
+
currentState: RunCurrentState;
|
|
36
|
+
items?: Items;
|
|
37
|
+
parent?: CurrentStateExecutionRequest["parent"];
|
|
38
|
+
executionOptions?: RunExecutionOptions;
|
|
39
|
+
workflowSnapshot?: CurrentStateExecutionRequest["workflowSnapshot"];
|
|
40
|
+
mutableState?: CurrentStateExecutionRequest["mutableState"];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type MatchedWebhookRunIntent = {
|
|
44
|
+
endpointPath: string;
|
|
45
|
+
method: HttpMethod;
|
|
46
|
+
requestItem: Items[number];
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type WebhookMatchRunIntent = {
|
|
50
|
+
match: WebhookInvocationMatch;
|
|
51
|
+
requestItem: Items[number];
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export class RunIntentService {
|
|
55
|
+
constructor(
|
|
56
|
+
private readonly engine: Engine,
|
|
57
|
+
private readonly workflowRepository: WorkflowRepository,
|
|
58
|
+
) {}
|
|
59
|
+
|
|
60
|
+
async startWorkflow(args: StartWorkflowIntent): Promise<RunResult> {
|
|
61
|
+
if (args.startAt && !args.currentState && !args.stopCondition && !args.reset) {
|
|
62
|
+
return await this.engine.runWorkflow(
|
|
63
|
+
args.workflow,
|
|
64
|
+
args.startAt,
|
|
65
|
+
args.items,
|
|
66
|
+
args.parent,
|
|
67
|
+
args.executionOptions,
|
|
68
|
+
{
|
|
69
|
+
workflowSnapshot: args.workflowSnapshot,
|
|
70
|
+
mutableState: args.mutableState,
|
|
71
|
+
},
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
return await this.engine.runWorkflowFromState({
|
|
75
|
+
workflow: args.workflow,
|
|
76
|
+
items: args.items,
|
|
77
|
+
parent: args.parent,
|
|
78
|
+
executionOptions: args.executionOptions,
|
|
79
|
+
workflowSnapshot: args.workflowSnapshot,
|
|
80
|
+
mutableState: args.mutableState,
|
|
81
|
+
currentState: args.currentState,
|
|
82
|
+
stopCondition: args.stopCondition ?? { kind: "workflowCompleted" },
|
|
83
|
+
reset: args.reset,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async rerunFromNode(args: RerunFromNodeIntent): Promise<RunResult> {
|
|
88
|
+
if (args.items) {
|
|
89
|
+
return await this.engine.runWorkflow(args.workflow, args.nodeId, args.items, args.parent, args.executionOptions, {
|
|
90
|
+
workflowSnapshot: args.workflowSnapshot,
|
|
91
|
+
mutableState: args.mutableState,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return await this.engine.runWorkflowFromState({
|
|
95
|
+
workflow: args.workflow,
|
|
96
|
+
parent: args.parent,
|
|
97
|
+
executionOptions: args.executionOptions,
|
|
98
|
+
workflowSnapshot: args.workflowSnapshot,
|
|
99
|
+
mutableState: args.mutableState,
|
|
100
|
+
currentState: args.currentState,
|
|
101
|
+
stopCondition: { kind: "workflowCompleted" },
|
|
102
|
+
reset: { clearFromNodeId: args.nodeId },
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
resolveWebhookTrigger(args: { endpointPath: string; method: HttpMethod }): WebhookTriggerResolution {
|
|
107
|
+
return this.engine.resolveWebhookTrigger(args);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async runMatchedWebhook(args: MatchedWebhookRunIntent): Promise<WebhookRunResult> {
|
|
111
|
+
const resolution = this.resolveWebhookTrigger(args);
|
|
112
|
+
if (resolution.status === "notFound") {
|
|
113
|
+
throw new Error("Unknown webhook endpoint");
|
|
114
|
+
}
|
|
115
|
+
if (resolution.status === "methodNotAllowed") {
|
|
116
|
+
throw new Error("Method not allowed");
|
|
117
|
+
}
|
|
118
|
+
return await this.runWebhookMatch({
|
|
119
|
+
match: resolution.match,
|
|
120
|
+
requestItem: args.requestItem,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async runWebhookMatch(args: WebhookMatchRunIntent): Promise<WebhookRunResult> {
|
|
125
|
+
const workflow = this.workflowRepository.get(args.match.workflowId);
|
|
126
|
+
if (!workflow) {
|
|
127
|
+
throw new Error(`Unknown workflowId: ${args.match.workflowId}`);
|
|
128
|
+
}
|
|
129
|
+
const scheduled = await this.engine.runWorkflow(
|
|
130
|
+
workflow,
|
|
131
|
+
args.match.nodeId,
|
|
132
|
+
[args.requestItem],
|
|
133
|
+
undefined,
|
|
134
|
+
this.createWebhookExecutionOptions(),
|
|
135
|
+
);
|
|
136
|
+
if (scheduled.status === "failed") {
|
|
137
|
+
throw new Error(scheduled.error.message);
|
|
138
|
+
}
|
|
139
|
+
if (scheduled.status === "completed") {
|
|
140
|
+
return {
|
|
141
|
+
runId: scheduled.runId,
|
|
142
|
+
workflowId: scheduled.workflowId,
|
|
143
|
+
startedAt: scheduled.startedAt,
|
|
144
|
+
runStatus: "completed",
|
|
145
|
+
response: scheduled.outputs,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
return await Promise.race([
|
|
149
|
+
this.engine.waitForWebhookResponse(scheduled.runId),
|
|
150
|
+
this.engine.waitForCompletion(scheduled.runId).then((completed) => {
|
|
151
|
+
if (completed.status === "failed") {
|
|
152
|
+
throw new Error(completed.error.message);
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
runId: completed.runId,
|
|
156
|
+
workflowId: completed.workflowId,
|
|
157
|
+
startedAt: completed.startedAt,
|
|
158
|
+
runStatus: "completed" as const,
|
|
159
|
+
response: completed.outputs,
|
|
160
|
+
} satisfies WebhookRunResult;
|
|
161
|
+
}),
|
|
162
|
+
]);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Webhook-triggered runs always force inline execution first.
|
|
167
|
+
* This is the highest-precedence scheduler override: it wins over node hints and container defaults.
|
|
168
|
+
*/
|
|
169
|
+
private createWebhookExecutionOptions(): RunExecutionOptions {
|
|
170
|
+
return {
|
|
171
|
+
localOnly: true,
|
|
172
|
+
webhook: true,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { WorkflowRepository } from "../types";
|
|
2
|
+
|
|
3
|
+
import { Engine } from "../orchestration/Engine";
|
|
4
|
+
|
|
5
|
+
import { RunIntentService } from "./RunIntentService";
|
|
6
|
+
|
|
7
|
+
export class RunIntentServiceFactory {
|
|
8
|
+
create(engine: Engine, workflowRepository: WorkflowRepository): RunIntentService {
|
|
9
|
+
return new RunIntentService(engine, workflowRepository);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
HttpMethod,
|
|
3
|
+
NodeDefinition,
|
|
4
|
+
NodeId,
|
|
5
|
+
TriggerNodeConfig,
|
|
6
|
+
WebhookInvocationMatch,
|
|
7
|
+
WebhookTriggerMatcher,
|
|
8
|
+
WebhookTriggerRoutingDiagnostics,
|
|
9
|
+
WorkflowActivationPolicy,
|
|
10
|
+
WorkflowDefinition,
|
|
11
|
+
WorkflowId,
|
|
12
|
+
WorkflowRepository,
|
|
13
|
+
} from "../types";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Resolves webhook HTTP routes from the live workflow repository (no trigger setup / registration).
|
|
17
|
+
* Maintains an in-memory index keyed by user-defined endpoint path for O(1) lookups after reload.
|
|
18
|
+
*/
|
|
19
|
+
export class WorkflowRepositoryWebhookTriggerMatcher implements WebhookTriggerMatcher {
|
|
20
|
+
private readonly routeByPath = new Map<string, WebhookInvocationMatch>();
|
|
21
|
+
private engineRoutesActive = false;
|
|
22
|
+
|
|
23
|
+
constructor(
|
|
24
|
+
private readonly workflowRepository: WorkflowRepository,
|
|
25
|
+
private readonly workflowActivationPolicy: WorkflowActivationPolicy,
|
|
26
|
+
private readonly diagnostics?: WebhookTriggerRoutingDiagnostics,
|
|
27
|
+
) {}
|
|
28
|
+
|
|
29
|
+
onEngineWorkflowsLoaded(): void {
|
|
30
|
+
this.engineRoutesActive = true;
|
|
31
|
+
this.rebuildRouteIndex();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
onEngineStopped(): void {
|
|
35
|
+
this.engineRoutesActive = false;
|
|
36
|
+
this.routeByPath.clear();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
reloadWebhookRoutes(): void {
|
|
40
|
+
if (!this.engineRoutesActive) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
this.rebuildRouteIndex();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
lookup(endpointPath: string): WebhookInvocationMatch | undefined {
|
|
47
|
+
if (!this.engineRoutesActive) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
const normalized = this.normalizeEndpointPath(endpointPath);
|
|
51
|
+
return this.routeByPath.get(normalized);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
match(args: { endpointPath: string; method: HttpMethod }): WebhookInvocationMatch | undefined {
|
|
55
|
+
const entry = this.lookup(args.endpointPath);
|
|
56
|
+
if (!entry) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
return entry.methods.includes(args.method) ? entry : undefined;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private rebuildRouteIndex(): void {
|
|
63
|
+
this.routeByPath.clear();
|
|
64
|
+
for (const workflow of this.workflowRepository.list()) {
|
|
65
|
+
if (!this.workflowActivationPolicy.isActive(workflow.id)) {
|
|
66
|
+
const triggerCount = workflow.nodes.filter((n) => n.kind === "trigger").length;
|
|
67
|
+
if (triggerCount > 0) {
|
|
68
|
+
const paths = this.collectWebhookEndpointPaths(workflow);
|
|
69
|
+
if (paths.length > 0) {
|
|
70
|
+
this.diagnostics?.info?.(
|
|
71
|
+
`Workflow "${workflow.name}" (${workflow.id}) is inactive; webhook routes not registered: ${paths.map((p) => `"${p}"`).join(", ")}`,
|
|
72
|
+
);
|
|
73
|
+
} else {
|
|
74
|
+
this.diagnostics?.info?.(
|
|
75
|
+
`Workflow "${workflow.name}" (${workflow.id}) is inactive; no repository webhook routes for its triggers (other trigger kinds are unchanged).`,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
for (const def of workflow.nodes) {
|
|
82
|
+
const match = this.tryMatchFromTriggerNode(workflow, def);
|
|
83
|
+
if (!match) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const key = this.normalizeEndpointPath(match.endpointPath);
|
|
87
|
+
const existing = this.routeByPath.get(key);
|
|
88
|
+
if (existing) {
|
|
89
|
+
this.diagnostics?.warn(
|
|
90
|
+
`Duplicate webhook endpoint path "${key}" (workflows "${existing.workflowId}" and "${match.workflowId}"); using "${match.workflowId}".`,
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
this.routeByPath.set(key, match);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private collectWebhookEndpointPaths(workflow: WorkflowDefinition): string[] {
|
|
99
|
+
const paths: string[] = [];
|
|
100
|
+
for (const def of workflow.nodes) {
|
|
101
|
+
if (def.kind !== "trigger") {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const match = this.tryMatchFromTriggerNode(workflow, def);
|
|
105
|
+
if (match) {
|
|
106
|
+
paths.push(match.endpointPath);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return paths;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
private tryMatchFromTriggerNode(
|
|
113
|
+
workflow: WorkflowDefinition,
|
|
114
|
+
def: NodeDefinition,
|
|
115
|
+
): WebhookInvocationMatch | undefined {
|
|
116
|
+
if (def.kind !== "trigger") {
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
const config = def.config as TriggerNodeConfig & {
|
|
120
|
+
endpointKey?: unknown;
|
|
121
|
+
methods?: unknown;
|
|
122
|
+
parseJsonBody?: (body: unknown) => unknown;
|
|
123
|
+
};
|
|
124
|
+
if (typeof config.endpointKey !== "string" || config.endpointKey.length === 0) {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
if (!Array.isArray(config.methods) || config.methods.length === 0) {
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
const methods = config.methods as HttpMethod[];
|
|
131
|
+
const parseJsonBody = typeof config.parseJsonBody === "function" ? config.parseJsonBody.bind(config) : undefined;
|
|
132
|
+
return {
|
|
133
|
+
endpointPath: config.endpointKey,
|
|
134
|
+
workflowId: workflow.id as WorkflowId,
|
|
135
|
+
nodeId: def.id as NodeId,
|
|
136
|
+
methods: [...methods],
|
|
137
|
+
parseJsonBody,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private normalizeEndpointPath(endpointPath: string): string {
|
|
142
|
+
return endpointPath.trim();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { WebhookTriggerRoutingDiagnostics, WorkflowActivationPolicy, WorkflowRepository } from "../types";
|
|
2
|
+
|
|
3
|
+
import { WorkflowRepositoryWebhookTriggerMatcher } from "./WorkflowRepositoryWebhookTriggerMatcher";
|
|
4
|
+
|
|
5
|
+
export class WorkflowRepositoryWebhookTriggerMatcherFactory {
|
|
6
|
+
create(
|
|
7
|
+
workflowRepository: WorkflowRepository,
|
|
8
|
+
workflowActivationPolicy: WorkflowActivationPolicy,
|
|
9
|
+
diagnostics?: WebhookTriggerRoutingDiagnostics,
|
|
10
|
+
): WorkflowRepositoryWebhookTriggerMatcher {
|
|
11
|
+
return new WorkflowRepositoryWebhookTriggerMatcher(workflowRepository, workflowActivationPolicy, diagnostics);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { EngineFactory, type EngineCompositionDeps } from "./EngineFactory";
|
|
2
|
+
export { EngineWorkflowRunnerService } from "./EngineWorkflowRunnerService";
|
|
3
|
+
export { EngineWorkflowRunnerServiceFactory } from "./EngineWorkflowRunnerServiceFactory";
|
|
4
|
+
export { InMemoryLiveWorkflowRepository } from "./InMemoryLiveWorkflowRepository";
|
|
5
|
+
export { RunIntentService } from "./RunIntentService";
|
|
6
|
+
export { RunIntentServiceFactory } from "./RunIntentServiceFactory";
|
|
7
|
+
export { WorkflowRepositoryWebhookTriggerMatcher } from "./WorkflowRepositoryWebhookTriggerMatcher";
|
|
8
|
+
export { WorkflowRepositoryWebhookTriggerMatcherFactory } from "./WorkflowRepositoryWebhookTriggerMatcherFactory";
|
|
9
|
+
export { Engine, EngineWaiters, TriggerRuntimeService } from "../orchestration";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { injectable } from "../di";
|
|
2
|
+
|
|
3
|
+
import { PersistedRuntimeTypeMetadataStore } from "./PersistedRuntimeTypeMetadataStoreRegistry";
|
|
4
|
+
import type {
|
|
5
|
+
DecoratedRuntimeType,
|
|
6
|
+
PersistedRuntimeTypeDecoratorOptions,
|
|
7
|
+
PersistedRuntimeTypeKind,
|
|
8
|
+
} from "./persistedRuntimeTypeModelRegistry";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Applies both tsyringe injectability and persisted runtime metadata in one decorator.
|
|
12
|
+
* This keeps runtime-type decorators thin while still recording enough data for snapshot hydration.
|
|
13
|
+
*/
|
|
14
|
+
export class InjectableRuntimeDecoratorComposer {
|
|
15
|
+
static compose(
|
|
16
|
+
kind: PersistedRuntimeTypeKind,
|
|
17
|
+
options: PersistedRuntimeTypeDecoratorOptions,
|
|
18
|
+
decoratorFileUrl: string,
|
|
19
|
+
): ClassDecorator {
|
|
20
|
+
return (target) => {
|
|
21
|
+
injectable()(target as never);
|
|
22
|
+
PersistedRuntimeTypeMetadataStore.define(target as DecoratedRuntimeType, kind, options, decoratorFileUrl);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PersistedRuntimeTypeDecoratorDefaults,
|
|
3
|
+
persistedRuntimeTypeMetadataKey,
|
|
4
|
+
type DecoratedRuntimeType,
|
|
5
|
+
type PersistedRuntimeTypeDecoratorOptions,
|
|
6
|
+
type PersistedRuntimeTypeKind,
|
|
7
|
+
type PersistedRuntimeTypeMetadata,
|
|
8
|
+
} from "./persistedRuntimeTypeModelRegistry";
|
|
9
|
+
import { PersistedRuntimeTypeNameResolver } from "./PersistedRuntimeTypeNameResolver";
|
|
10
|
+
import { StackTraceCallSitePathResolver } from "./StackTraceCallSitePathResolver";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Defines and retrieves persisted runtime metadata on decorated classes.
|
|
14
|
+
* The metadata is attached as a non-enumerable property so runtime objects stay serializable.
|
|
15
|
+
*/
|
|
16
|
+
export class PersistedRuntimeTypeMetadataStore {
|
|
17
|
+
static define(
|
|
18
|
+
target: DecoratedRuntimeType,
|
|
19
|
+
kind: PersistedRuntimeTypeKind,
|
|
20
|
+
options: PersistedRuntimeTypeDecoratorOptions,
|
|
21
|
+
decoratorFileUrl: string,
|
|
22
|
+
): void {
|
|
23
|
+
const normalizedOptions = PersistedRuntimeTypeDecoratorDefaults.apply(options);
|
|
24
|
+
const metadata: PersistedRuntimeTypeMetadata = {
|
|
25
|
+
persistedName: PersistedRuntimeTypeNameResolver.resolve(target, normalizedOptions.name),
|
|
26
|
+
kind,
|
|
27
|
+
packageName: normalizedOptions.packageName ?? PersistedRuntimeTypeDecoratorDefaults.appPackageName,
|
|
28
|
+
sourceHint: normalizedOptions.moduleUrl ?? StackTraceCallSitePathResolver.resolve(decoratorFileUrl),
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(target, persistedRuntimeTypeMetadataKey, {
|
|
31
|
+
configurable: false,
|
|
32
|
+
enumerable: false,
|
|
33
|
+
writable: false,
|
|
34
|
+
value: metadata,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static get(target: unknown): PersistedRuntimeTypeMetadata | undefined {
|
|
39
|
+
if (!target || (typeof target !== "function" && typeof target !== "object")) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
return (target as Record<PropertyKey, unknown>)[persistedRuntimeTypeMetadataKey] as
|
|
43
|
+
| PersistedRuntimeTypeMetadata
|
|
44
|
+
| undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DecoratedRuntimeType } from "./persistedRuntimeTypeModelRegistry";
|
|
2
|
+
|
|
3
|
+
/** Resolves the persisted type name from either an explicit override or the class name itself. */
|
|
4
|
+
export class PersistedRuntimeTypeNameResolver {
|
|
5
|
+
static resolve(target: DecoratedRuntimeType, override: string | undefined): string {
|
|
6
|
+
const resolved = override ?? target.name;
|
|
7
|
+
if (!resolved) {
|
|
8
|
+
throw new Error(
|
|
9
|
+
"Persisted runtime token metadata requires a named class or an explicit decorator name override.",
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
return resolved;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export class StackTraceCallSitePathResolver {
|
|
2
|
+
static resolve(decoratorFileUrl: string): string | undefined {
|
|
3
|
+
const stack = new Error().stack ?? "";
|
|
4
|
+
for (const line of stack.split("\n")) {
|
|
5
|
+
const candidate = this.extractPath(line.trim());
|
|
6
|
+
if (!candidate) {
|
|
7
|
+
continue;
|
|
8
|
+
}
|
|
9
|
+
if (candidate === decoratorFileUrl || candidate.includes("runtimeTypeDecorators")) {
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
return candidate;
|
|
13
|
+
}
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
private static extractPath(line: string): string | undefined {
|
|
18
|
+
const fileUrlMatch = line.match(/file:\/\/[^\s)]+/);
|
|
19
|
+
if (fileUrlMatch) return fileUrlMatch[0];
|
|
20
|
+
const parenMatch = line.match(/\((\/[^)]+)\)/);
|
|
21
|
+
if (parenMatch) return parenMatch[1];
|
|
22
|
+
const bareMatch = line.match(/at (\/[^\s]+)/);
|
|
23
|
+
return bareMatch?.[1];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Shared metadata key used to attach persisted runtime-type information to decorated classes. */
|
|
2
|
+
export const persistedRuntimeTypeMetadataKey = Symbol.for("codemation.core.persistedRuntimeTypeMetadata");
|
|
3
|
+
|
|
4
|
+
export type DecoratedRuntimeType = Readonly<{ name?: string }> & object;
|
|
5
|
+
|
|
6
|
+
/** Categories of runtime classes that can be discovered and rehydrated from persisted snapshots. */
|
|
7
|
+
export type PersistedRuntimeTypeKind = "node" | "tool" | "chatModel";
|
|
8
|
+
|
|
9
|
+
export interface PersistedRuntimeTypeDecoratorOptions {
|
|
10
|
+
readonly name?: string;
|
|
11
|
+
readonly packageName?: string;
|
|
12
|
+
readonly moduleUrl?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Serialized metadata attached to a decorated runtime type. */
|
|
16
|
+
export interface PersistedRuntimeTypeMetadata {
|
|
17
|
+
readonly persistedName: string;
|
|
18
|
+
readonly kind: PersistedRuntimeTypeKind;
|
|
19
|
+
readonly packageName: string;
|
|
20
|
+
readonly sourceHint?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Normalizes decorator options so persistence metadata has stable defaults. */
|
|
24
|
+
export class PersistedRuntimeTypeDecoratorDefaults {
|
|
25
|
+
static readonly appPackageName = "app";
|
|
26
|
+
|
|
27
|
+
static apply(options: PersistedRuntimeTypeDecoratorOptions): PersistedRuntimeTypeDecoratorOptions {
|
|
28
|
+
return {
|
|
29
|
+
...options,
|
|
30
|
+
packageName: options.packageName ?? this.appPackageName,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
PersistedRuntimeTypeDecoratorOptions,
|
|
3
|
+
PersistedRuntimeTypeMetadata,
|
|
4
|
+
} from "./persistedRuntimeTypeModelRegistry";
|
|
5
|
+
|
|
6
|
+
import { InjectableRuntimeDecoratorComposer } from "./InjectableRuntimeDecoratorComposerRegistry";
|
|
7
|
+
import { PersistedRuntimeTypeMetadataStore } from "./PersistedRuntimeTypeMetadataStoreRegistry";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Public decorator entry points for runtime-discoverable classes.
|
|
11
|
+
*
|
|
12
|
+
* These exports intentionally stay as plain decorator factory functions because TypeScript's
|
|
13
|
+
* `@decorator()` syntax expects callable values rather than instance methods. The helpers below
|
|
14
|
+
* attach DI metadata and persisted-name metadata in one step so hosts can discover nodes, tools,
|
|
15
|
+
* and chat models without duplicating registration boilerplate.
|
|
16
|
+
*/
|
|
17
|
+
export type {
|
|
18
|
+
PersistedRuntimeTypeDecoratorOptions,
|
|
19
|
+
PersistedRuntimeTypeKind,
|
|
20
|
+
PersistedRuntimeTypeMetadata,
|
|
21
|
+
} from "./persistedRuntimeTypeModelRegistry";
|
|
22
|
+
|
|
23
|
+
/** Reads persisted runtime metadata from a decorated class or object. */
|
|
24
|
+
export function getPersistedRuntimeTypeMetadata(target: unknown): PersistedRuntimeTypeMetadata | undefined {
|
|
25
|
+
return PersistedRuntimeTypeMetadataStore.get(target);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Marks a class as a persisted node runtime type and an injectable tsyringe service. */
|
|
29
|
+
export function node(options: PersistedRuntimeTypeDecoratorOptions = {}): ClassDecorator {
|
|
30
|
+
return InjectableRuntimeDecoratorComposer.compose("node", options, import.meta.url);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Marks a class as a persisted tool runtime type and an injectable tsyringe service. */
|
|
34
|
+
export function tool(options: PersistedRuntimeTypeDecoratorOptions = {}): ClassDecorator {
|
|
35
|
+
return InjectableRuntimeDecoratorComposer.compose("tool", options, import.meta.url);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Marks a class as a persisted chat-model runtime type and an injectable tsyringe service. */
|
|
39
|
+
export function chatModel(options: PersistedRuntimeTypeDecoratorOptions = {}): ClassDecorator {
|
|
40
|
+
return InjectableRuntimeDecoratorComposer.compose("chatModel", options, import.meta.url);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { InjectableRuntimeDecoratorComposer } from "./InjectableRuntimeDecoratorComposerRegistry";
|
|
44
|
+
export { PersistedRuntimeTypeMetadataStore } from "./PersistedRuntimeTypeMetadataStoreRegistry";
|
|
45
|
+
export { PersistedRuntimeTypeNameResolver } from "./PersistedRuntimeTypeNameResolver";
|
|
46
|
+
export { StackTraceCallSitePathResolver } from "./StackTraceCallSitePathResolver";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ExecutionMode,
|
|
3
|
+
NodeConfigBase,
|
|
4
|
+
NodeId,
|
|
5
|
+
NodeOffloadPolicy,
|
|
6
|
+
NodeSchedulerDecision,
|
|
7
|
+
WorkflowId,
|
|
8
|
+
} from "../types";
|
|
9
|
+
export class ConfigDrivenOffloadPolicy implements NodeOffloadPolicy {
|
|
10
|
+
private readonly defaultMode: ExecutionMode;
|
|
11
|
+
|
|
12
|
+
constructor(defaultMode: ExecutionMode = "worker") {
|
|
13
|
+
this.defaultMode = defaultMode;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
decide(args: { workflowId: WorkflowId; nodeId: NodeId; config: NodeConfigBase }): NodeSchedulerDecision {
|
|
17
|
+
const hint = args.config.execution?.hint;
|
|
18
|
+
const queue = args.config.execution?.queue;
|
|
19
|
+
|
|
20
|
+
if (hint === "local") return { mode: "local" };
|
|
21
|
+
if (hint === "worker") return { mode: "worker", queue };
|
|
22
|
+
|
|
23
|
+
// If a queue is specified, treat it as an implicit worker hint.
|
|
24
|
+
if (queue) return { mode: "worker", queue };
|
|
25
|
+
|
|
26
|
+
return { mode: this.defaultMode };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
NodeActivationContinuation,
|
|
3
|
+
NodeActivationReceipt,
|
|
4
|
+
NodeActivationRequest,
|
|
5
|
+
NodeActivationScheduler,
|
|
6
|
+
NodeExecutionRequest,
|
|
7
|
+
NodeExecutionScheduler,
|
|
8
|
+
NodeOffloadPolicy,
|
|
9
|
+
} from "../types";
|
|
10
|
+
import { InlineDrivingScheduler } from "./InlineDrivingScheduler";
|
|
11
|
+
|
|
12
|
+
type SchedulerSelection = Readonly<{
|
|
13
|
+
mode: NodeActivationReceipt["mode"];
|
|
14
|
+
queue?: string;
|
|
15
|
+
decision: "runIntentOverride" | "nodePolicy" | "containerDefault";
|
|
16
|
+
}>;
|
|
17
|
+
|
|
18
|
+
export class DefaultDrivingScheduler implements NodeActivationScheduler {
|
|
19
|
+
constructor(
|
|
20
|
+
private readonly offloadPolicy: NodeOffloadPolicy,
|
|
21
|
+
private readonly workerScheduler: NodeExecutionScheduler,
|
|
22
|
+
private readonly inline: InlineDrivingScheduler,
|
|
23
|
+
) {}
|
|
24
|
+
|
|
25
|
+
setContinuation(continuation: NodeActivationContinuation): void {
|
|
26
|
+
this.inline.setContinuation(continuation);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async enqueue(request: NodeActivationRequest): Promise<NodeActivationReceipt> {
|
|
30
|
+
const selection = await this.selectScheduler(request);
|
|
31
|
+
if (selection.mode === "worker") {
|
|
32
|
+
if (request.kind === "multi") {
|
|
33
|
+
throw new Error(`Multi-input node ${request.nodeId} cannot be scheduled to worker (insert local placement)`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const workerRequest: NodeExecutionRequest = {
|
|
37
|
+
runId: request.runId,
|
|
38
|
+
activationId: request.activationId,
|
|
39
|
+
workflowId: request.workflowId,
|
|
40
|
+
nodeId: request.nodeId,
|
|
41
|
+
input: request.input,
|
|
42
|
+
parent: request.parent,
|
|
43
|
+
queue: selection.queue,
|
|
44
|
+
executionOptions: request.executionOptions,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const receipt = await this.workerScheduler.enqueue(workerRequest);
|
|
48
|
+
return { receiptId: receipt.receiptId, mode: "worker", queue: selection.queue };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return await this.enqueueInline(request);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
notifyPendingStatePersisted(runId: string): void {
|
|
55
|
+
this.inline.notifyPendingStatePersisted(runId);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Scheduler precedence is explicit:
|
|
60
|
+
* 1. run-intent override (`executionOptions.localOnly`)
|
|
61
|
+
* 2. node-level execution hint / queue policy
|
|
62
|
+
* 3. container-default scheduler policy fallback
|
|
63
|
+
*/
|
|
64
|
+
private async selectScheduler(request: NodeActivationRequest): Promise<SchedulerSelection> {
|
|
65
|
+
if (request.executionOptions?.localOnly) {
|
|
66
|
+
return {
|
|
67
|
+
mode: "local",
|
|
68
|
+
decision: "runIntentOverride",
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const decision = this.offloadPolicy.decide({
|
|
73
|
+
workflowId: request.workflowId,
|
|
74
|
+
nodeId: request.nodeId,
|
|
75
|
+
config: request.ctx.config,
|
|
76
|
+
});
|
|
77
|
+
if (this.hasNodeSchedulingPreference(request)) {
|
|
78
|
+
return {
|
|
79
|
+
mode: decision.mode,
|
|
80
|
+
queue: decision.queue,
|
|
81
|
+
decision: "nodePolicy",
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
mode: decision.mode,
|
|
87
|
+
queue: decision.queue,
|
|
88
|
+
decision: "containerDefault",
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private hasNodeSchedulingPreference(request: NodeActivationRequest): boolean {
|
|
93
|
+
return request.ctx.config.execution?.hint !== undefined || request.ctx.config.execution?.queue !== undefined;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private async enqueueInline(request: NodeActivationRequest): Promise<NodeActivationReceipt> {
|
|
97
|
+
const receipt = await this.inline.enqueue(request);
|
|
98
|
+
return { ...receipt, mode: "local" };
|
|
99
|
+
}
|
|
100
|
+
}
|