@codemation/core 0.0.5 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{InMemoryLiveWorkflowRepository-DL7LmC9S.d.ts → InMemoryLiveWorkflowRepository-DxoualoC.d.ts} +6 -2
- package/dist/{InMemoryLiveWorkflowRepository-D6eiiXxF.d.cts → InMemoryLiveWorkflowRepository-orY1VsWG.d.cts} +6 -2
- package/dist/{RunIntentService-NKobsfMQ.d.cts → RunIntentService-ByuUYsAL.d.cts} +8 -3
- package/dist/{RunIntentService-BFVbsOcg.js → RunIntentService-CYnn140t.js} +9 -4
- package/dist/RunIntentService-CYnn140t.js.map +1 -0
- package/dist/{RunIntentService-2ivFmNQh.cjs → RunIntentService-DlQH5eZ2.cjs} +9 -4
- package/dist/RunIntentService-DlQH5eZ2.cjs.map +1 -0
- package/dist/{WorkflowSnapshotCodec-DTdWkoW_.d.cts → WorkflowSnapshotCodec-DSEzKyt3.d.cts} +2 -2
- package/dist/bootstrap/index.cjs +133 -4
- package/dist/bootstrap/index.cjs.map +1 -1
- package/dist/bootstrap/index.d.cts +4 -3
- package/dist/bootstrap/index.d.ts +3 -2
- package/dist/bootstrap/index.js +133 -4
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/{index-9g6Pfe9Z.d.ts → index-CTjfVHJh.d.ts} +8 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/testing.d.cts +2 -2
- package/dist/testing.d.ts +1 -1
- package/package.json +6 -1
- package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +10 -2
- package/src/contracts/runtimeTypes.ts +5 -0
- package/src/execution/NodeActivationRequestComposer.ts +15 -4
- package/src/orchestration/Engine.ts +12 -1
- package/src/orchestration/NodeExecutionRequestHandlerService.ts +179 -0
- package/src/runtime/EngineFactory.ts +13 -0
- package/dist/EngineExecutionLimitsPolicy-8MEFIYx1.d.cts +0 -160
- package/dist/EngineExecutionLimitsPolicy-BWAXW9D6.d.cts +0 -160
- package/dist/EngineExecutionLimitsPolicy-Bp8PS1Ss.d.cts +0 -159
- package/dist/EngineExecutionLimitsPolicy-CLxcN-D2.d.ts +0 -159
- package/dist/EngineExecutionLimitsPolicy-DZXuix51.d.ts +0 -160
- package/dist/EngineExecutionLimitsPolicy-Gfz6ngFd.d.ts +0 -160
- package/dist/EngineFactory-CBnntY3J.cjs +0 -3152
- package/dist/EngineFactory-CBnntY3J.cjs.map +0 -1
- package/dist/EngineFactory-Cwn3R2YA.js +0 -3087
- package/dist/EngineFactory-Cwn3R2YA.js.map +0 -1
- package/dist/EngineFactory-DWCnNocp.js +0 -3063
- package/dist/EngineFactory-DWCnNocp.js.map +0 -1
- package/dist/EngineFactory-DhPFou4p.cjs +0 -3188
- package/dist/EngineFactory-DhPFou4p.cjs.map +0 -1
- package/dist/EngineFactory-l_9xmBtv.cjs +0 -3190
- package/dist/EngineFactory-l_9xmBtv.cjs.map +0 -1
- package/dist/EngineFactory-w-aOWuqh.js +0 -3089
- package/dist/EngineFactory-w-aOWuqh.js.map +0 -1
- package/dist/InMemoryLiveWorkflowRepository-1J9MHN_I.js +0 -18
- package/dist/InMemoryLiveWorkflowRepository-1J9MHN_I.js.map +0 -1
- package/dist/InMemoryLiveWorkflowRepository-CULNqv96.d.ts +0 -1300
- package/dist/InMemoryLiveWorkflowRepository-D7l8cjdZ.d.cts +0 -1130
- package/dist/InMemoryLiveWorkflowRepository-jnv-OnOP.d.ts +0 -1300
- package/dist/InMemoryLiveWorkflowRepository-xny1_Z6i.cjs +0 -24
- package/dist/InMemoryLiveWorkflowRepository-xny1_Z6i.cjs.map +0 -1
- package/dist/InMemoryLiveWorkflowRepository-xr7b4kvi.d.ts +0 -1338
- package/dist/InMemoryWorkflowCatalog-BIdFpwbK.d.ts +0 -1205
- package/dist/InMemoryWorkflowCatalog-BW00_3N3.d.cts +0 -12
- package/dist/InMemoryWorkflowCatalog-BiYHGoPw.cjs +0 -24
- package/dist/InMemoryWorkflowCatalog-BiYHGoPw.cjs.map +0 -1
- package/dist/InMemoryWorkflowCatalog-BrG0ApMO.d.cts +0 -1115
- package/dist/InMemoryWorkflowCatalog-BzrAr--Y.js +0 -139
- package/dist/InMemoryWorkflowCatalog-BzrAr--Y.js.map +0 -1
- package/dist/InMemoryWorkflowCatalog-C-EJlJ7y.d.cts +0 -1120
- package/dist/InMemoryWorkflowCatalog-C4482bpw.cjs +0 -24
- package/dist/InMemoryWorkflowCatalog-C4482bpw.cjs.map +0 -1
- package/dist/InMemoryWorkflowCatalog-CZ0kZpOv.d.ts +0 -1289
- package/dist/InMemoryWorkflowCatalog-C_ACeLyW.d.cts +0 -1119
- package/dist/InMemoryWorkflowCatalog-CiHWIu5E.d.cts +0 -12
- package/dist/InMemoryWorkflowCatalog-CkH7gkya.js +0 -18
- package/dist/InMemoryWorkflowCatalog-CkH7gkya.js.map +0 -1
- package/dist/InMemoryWorkflowCatalog-CnpZVJM9.d.ts +0 -1205
- package/dist/InMemoryWorkflowCatalog-Cu68S8YR.js +0 -18
- package/dist/InMemoryWorkflowCatalog-Cu68S8YR.js.map +0 -1
- package/dist/InMemoryWorkflowCatalog-D2w9nMj2.cjs +0 -151
- package/dist/InMemoryWorkflowCatalog-D2w9nMj2.cjs.map +0 -1
- package/dist/InMemoryWorkflowCatalog-D5eMxEf7.js +0 -18
- package/dist/InMemoryWorkflowCatalog-D5eMxEf7.js.map +0 -1
- package/dist/InMemoryWorkflowCatalog-D5nCp2yZ.d.ts +0 -1267
- package/dist/InMemoryWorkflowCatalog-DIq0bjqN.d.ts +0 -12
- package/dist/InMemoryWorkflowCatalog-DLgaEaw_.d.ts +0 -1288
- package/dist/InMemoryWorkflowCatalog-DNBFdK-x.d.cts +0 -1120
- package/dist/InMemoryWorkflowCatalog-DQBkCzb7.cjs +0 -24
- package/dist/InMemoryWorkflowCatalog-DQBkCzb7.cjs.map +0 -1
- package/dist/InMemoryWorkflowCatalog-DS4-eX6i.d.cts +0 -1118
- package/dist/InMemoryWorkflowCatalog-DdVfy8MY.d.ts +0 -12
- package/dist/InMemoryWorkflowCatalog-DeVZu3g8.d.ts +0 -12
- package/dist/InMemoryWorkflowCatalog-GxkQjvt5.d.ts +0 -1200
- package/dist/InMemoryWorkflowCatalog-qaVRn1Lc.d.cts +0 -1115
- package/dist/InMemoryWorkflowCatalog-z1aIT4TC.d.cts +0 -12
- package/dist/InMemoryWorkflowRegistry-BBuOovLL.d.ts +0 -1007
- package/dist/InMemoryWorkflowRegistry-BIFnSl3k.d.ts +0 -1201
- package/dist/InMemoryWorkflowRegistry-BnGilthz.d.ts +0 -1137
- package/dist/InMemoryWorkflowRegistry-CEp5I8No.d.ts +0 -1146
- package/dist/InMemoryWorkflowRegistry-CHyMB9jW.d.cts +0 -976
- package/dist/InMemoryWorkflowRegistry-CUN7K86m.d.cts +0 -1061
- package/dist/InMemoryWorkflowRegistry-CVfHyELh.d.cts +0 -971
- package/dist/InMemoryWorkflowRegistry-CXXJrwAr.d.cts +0 -1052
- package/dist/InMemoryWorkflowRegistry-DDGfPTJy.d.ts +0 -1013
- package/dist/InMemoryWorkflowRegistry-DnYSOoT5.d.ts +0 -1120
- package/dist/InMemoryWorkflowRegistry-Dp5GiFF2.d.cts +0 -1035
- package/dist/InMemoryWorkflowRegistry-DypDBeOw.d.cts +0 -1116
- package/dist/InMemoryWorkflowRegistry-SzwJCAxT.d.ts +0 -1012
- package/dist/InMemoryWorkflowRegistry-jupvqyGc.d.cts +0 -977
- package/dist/InMemoryWorkflowRegistry-rAdKVWYT.d.ts +0 -1117
- package/dist/InProcessRetryRunner-BBNPkXjy.d.cts +0 -292
- package/dist/PersistedWorkflowSnapshotFactory-7RkOL3Kg.d.ts +0 -14
- package/dist/PersistedWorkflowSnapshotFactory-BmANa46W.cjs +0 -141
- package/dist/PersistedWorkflowSnapshotFactory-BmANa46W.cjs.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-Bwb_etSt.js +0 -118
- package/dist/PersistedWorkflowSnapshotFactory-Bwb_etSt.js.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-CRkKGNV6.js +0 -123
- package/dist/PersistedWorkflowSnapshotFactory-CRkKGNV6.js.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-CZolnGy5.js +0 -101
- package/dist/PersistedWorkflowSnapshotFactory-CZolnGy5.js.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-Ca_oysOv.cjs +0 -131
- package/dist/PersistedWorkflowSnapshotFactory-Ca_oysOv.cjs.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-CqIcShnX.js +0 -103
- package/dist/PersistedWorkflowSnapshotFactory-CqIcShnX.js.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-D-tBk4_G.js +0 -119
- package/dist/PersistedWorkflowSnapshotFactory-D-tBk4_G.js.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-D4cXl2e2.cjs +0 -131
- package/dist/PersistedWorkflowSnapshotFactory-D4cXl2e2.cjs.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-DINoP12r.cjs +0 -131
- package/dist/PersistedWorkflowSnapshotFactory-DINoP12r.cjs.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-DJAwSuHU.js +0 -103
- package/dist/PersistedWorkflowSnapshotFactory-DJAwSuHU.js.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-DSUjVCcf.cjs +0 -131
- package/dist/PersistedWorkflowSnapshotFactory-DSUjVCcf.cjs.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-DdHuhkDb.cjs +0 -107
- package/dist/PersistedWorkflowSnapshotFactory-DdHuhkDb.cjs.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-Dqc6NHis.js +0 -119
- package/dist/PersistedWorkflowSnapshotFactory-Dqc6NHis.js.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-Dxa2dSrw.cjs +0 -130
- package/dist/PersistedWorkflowSnapshotFactory-Dxa2dSrw.cjs.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-Ep79Ah1G.js +0 -123
- package/dist/PersistedWorkflowSnapshotFactory-Ep79Ah1G.js.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-GyLfRuiJ.js +0 -119
- package/dist/PersistedWorkflowSnapshotFactory-GyLfRuiJ.js.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-HTpBsBzn.js +0 -102
- package/dist/PersistedWorkflowSnapshotFactory-HTpBsBzn.js.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-LVmaaf3t.cjs +0 -141
- package/dist/PersistedWorkflowSnapshotFactory-LVmaaf3t.cjs.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-PZCpo2ZS.js +0 -119
- package/dist/PersistedWorkflowSnapshotFactory-PZCpo2ZS.js.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-UjQ1SJev.cjs +0 -109
- package/dist/PersistedWorkflowSnapshotFactory-UjQ1SJev.cjs.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-Y8kCrhcy.cjs +0 -109
- package/dist/PersistedWorkflowSnapshotFactory-Y8kCrhcy.cjs.map +0 -1
- package/dist/PersistedWorkflowSnapshotFactory-Z_nB-fmB.cjs +0 -108
- package/dist/PersistedWorkflowSnapshotFactory-Z_nB-fmB.cjs.map +0 -1
- package/dist/RunIntentService-1EE6N8ZL.cjs +0 -963
- package/dist/RunIntentService-1EE6N8ZL.cjs.map +0 -1
- package/dist/RunIntentService-2ivFmNQh.cjs.map +0 -1
- package/dist/RunIntentService-B0sUL5q-.js +0 -761
- package/dist/RunIntentService-B0sUL5q-.js.map +0 -1
- package/dist/RunIntentService-BFVbsOcg.js.map +0 -1
- package/dist/RunIntentService-BsBOwpVN.cjs +0 -1051
- package/dist/RunIntentService-BsBOwpVN.cjs.map +0 -1
- package/dist/RunIntentService-CSk3ETyn.js +0 -858
- package/dist/RunIntentService-CSk3ETyn.js.map +0 -1
- package/dist/RunIntentService-Ckn3u3tA.d.cts +0 -326
- package/dist/RunIntentService-DEo6GTTo.d.cts +0 -289
- package/dist/RunIntentService-DKrGtL0B.js +0 -782
- package/dist/RunIntentService-DKrGtL0B.js.map +0 -1
- package/dist/RunIntentService-DNOJc1R7.cjs +0 -942
- package/dist/RunIntentService-DNOJc1R7.cjs.map +0 -1
- package/dist/RunIntentService-Dq3pV53j.d.cts +0 -289
- package/dist/WorkflowSnapshotCodec-C3fuuS_R.d.cts +0 -22
- package/dist/WorkflowSnapshotCodec-CUudUo6f.js +0 -123
- package/dist/WorkflowSnapshotCodec-CUudUo6f.js.map +0 -1
- package/dist/WorkflowSnapshotCodec-CuCPQZTc.cjs +0 -129
- package/dist/WorkflowSnapshotCodec-CuCPQZTc.cjs.map +0 -1
- package/dist/WorkflowSnapshotCodec-DLiXQNvV.d.cts +0 -22
- package/dist/WorkflowSnapshotCodec-DNtdrZ7l.d.cts +0 -22
- package/dist/credentialTypes-B5h3dI7r.d.cts +0 -1107
- package/dist/credentialTypes-B9okPCVo.d.cts +0 -963
- package/dist/credentialTypes-BFL70rgZ.d.cts +0 -964
- package/dist/credentialTypes-BGkh1O07.d.ts +0 -1010
- package/dist/credentialTypes-BNLi4Q7u.d.ts +0 -1030
- package/dist/credentialTypes-CeSoZGj3.d.cts +0 -994
- package/dist/credentialTypes-CpHc32Ig.d.cts +0 -984
- package/dist/credentialTypes-D0m7MQQl.d.cts +0 -1107
- package/dist/credentialTypes-D4nL2sUd.d.ts +0 -1000
- package/dist/credentialTypes-DBYK2Qbu.d.ts +0 -999
- package/dist/credentialTypes-DMJVy0r1.d.ts +0 -1000
- package/dist/credentialTypes-DhUAjYQp.d.ts +0 -1020
- package/dist/credentialTypes-gGITj5KL.d.cts +0 -964
- package/dist/credentialTypes-r3KVBJBE.d.cts +0 -974
- package/dist/diTokens-ClO27tjK.cjs +0 -34
- package/dist/diTokens-ClO27tjK.cjs.map +0 -1
- package/dist/diTokens-CoHBkwG6.js +0 -28
- package/dist/diTokens-CoHBkwG6.js.map +0 -1
- package/dist/index-6Doxmfnd.d.ts +0 -857
- package/dist/index-AZ72Ej-K.d.ts +0 -920
- package/dist/index-BEk9V-q-.d.ts +0 -667
- package/dist/index-Bjt7_7oS.d.ts +0 -1192
- package/dist/index-CFGxsYXy.d.ts +0 -708
- package/dist/index-C_u8xFgn.d.ts +0 -690
- package/dist/index-CpbfsvOJ.d.ts +0 -1192
- package/dist/index-CsReNJN_.d.ts +0 -859
- package/dist/index-D5iNnXaW.d.ts +0 -667
- package/dist/index-DD_Eft1q.d.ts +0 -708
- package/dist/index-DiSYUe0G.d.ts +0 -1192
- package/dist/index-gIcH60sp.d.ts +0 -674
- package/dist/runtime-BIvd-1JA.cjs +0 -4112
- package/dist/runtime-BIvd-1JA.cjs.map +0 -1
- package/dist/runtime-D3eWKSQK.cjs +0 -3986
- package/dist/runtime-D3eWKSQK.cjs.map +0 -1
- package/dist/runtime-Dvp4xAjg.js +0 -3799
- package/dist/runtime-Dvp4xAjg.js.map +0 -1
- package/dist/runtime-vc76SSAa.js +0 -3685
- package/dist/runtime-vc76SSAa.js.map +0 -1
- package/dist/runtimeTypes-BK0b8SaG.d.cts +0 -884
- package/dist/runtimeTypes-CoYZkYQq.d.cts +0 -851
- package/dist/runtimeTypes-D-Pm0Uas.d.cts +0 -849
- package/dist/types-Cb5UK7Y6.d.ts +0 -857
|
@@ -1,1117 +0,0 @@
|
|
|
1
|
-
import "reflect-metadata";
|
|
2
|
-
import { DependencyContainer, DependencyContainer as Container, Disposable, InjectionToken, InjectionToken as TypeToken, Lifecycle, RegistrationOptions, container, delay, inject, injectAll, injectable, instanceCachingFactory, instancePerContainerCachingFactory, predicateAwareClassFactory, registry, singleton } from "tsyringe";
|
|
3
|
-
import { ReadableStream } from "node:stream/web";
|
|
4
|
-
|
|
5
|
-
//#region src/contracts/retryPolicySpec.types.d.ts
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* In-process retry policy for runnable nodes. Serialized configs use the same
|
|
9
|
-
* `kind` discriminator (`JSON.stringify` / persisted workflows).
|
|
10
|
-
*
|
|
11
|
-
* `maxAttempts` is the total number of tries including the first (e.g. 3 means up to 2 delays after failures).
|
|
12
|
-
*/
|
|
13
|
-
type RetryPolicySpec = NoneRetryPolicySpec | FixedRetryPolicySpec | ExponentialRetryPolicySpec;
|
|
14
|
-
interface NoneRetryPolicySpec {
|
|
15
|
-
readonly kind: "none";
|
|
16
|
-
}
|
|
17
|
-
interface FixedRetryPolicySpec {
|
|
18
|
-
readonly kind: "fixed";
|
|
19
|
-
/** Total attempts including the first execution. Must be >= 1. */
|
|
20
|
-
readonly maxAttempts: number;
|
|
21
|
-
readonly delayMs: number;
|
|
22
|
-
}
|
|
23
|
-
interface ExponentialRetryPolicySpec {
|
|
24
|
-
readonly kind: "exponential";
|
|
25
|
-
/** Total attempts including the first execution. Must be >= 1. */
|
|
26
|
-
readonly maxAttempts: number;
|
|
27
|
-
readonly initialDelayMs: number;
|
|
28
|
-
readonly multiplier: number;
|
|
29
|
-
readonly maxDelayMs?: number;
|
|
30
|
-
/** When true, each delay is multiplied by a random factor in [1, 1.2). */
|
|
31
|
-
readonly jitter?: boolean;
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region src/contracts/NoRetryPolicy.d.ts
|
|
35
|
-
declare class NoRetryPolicy implements NoneRetryPolicySpec {
|
|
36
|
-
readonly kind: "none";
|
|
37
|
-
}
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region src/contracts/RetryPolicy.d.ts
|
|
40
|
-
declare class RetryPolicy implements FixedRetryPolicySpec {
|
|
41
|
-
readonly maxAttempts: number;
|
|
42
|
-
readonly delayMs: number;
|
|
43
|
-
readonly kind: "fixed";
|
|
44
|
-
constructor(maxAttempts: number, delayMs: number);
|
|
45
|
-
/** Default for HTTP-style transient failures: 3 tries, 1s between attempts. */
|
|
46
|
-
static readonly defaultForHttp: FixedRetryPolicySpec;
|
|
47
|
-
/** Default for LLM / agent calls: 3 tries, 2s fixed backoff. */
|
|
48
|
-
static readonly defaultForAiAgent: FixedRetryPolicySpec;
|
|
49
|
-
}
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region src/contracts/ExpRetryPolicy.d.ts
|
|
52
|
-
declare class ExpRetryPolicy implements ExponentialRetryPolicySpec {
|
|
53
|
-
readonly maxAttempts: number;
|
|
54
|
-
readonly initialDelayMs: number;
|
|
55
|
-
readonly multiplier: number;
|
|
56
|
-
readonly maxDelayMs?: number | undefined;
|
|
57
|
-
readonly jitter?: boolean | undefined;
|
|
58
|
-
readonly kind: "exponential";
|
|
59
|
-
constructor(maxAttempts: number, initialDelayMs: number, multiplier: number, maxDelayMs?: number | undefined, jitter?: boolean | undefined);
|
|
60
|
-
}
|
|
61
|
-
//#endregion
|
|
62
|
-
//#region src/contracts/runTypes.d.ts
|
|
63
|
-
interface RunExecutionOptions {
|
|
64
|
-
localOnly?: boolean;
|
|
65
|
-
webhook?: boolean;
|
|
66
|
-
mode?: "manual" | "debug";
|
|
67
|
-
sourceWorkflowId?: WorkflowId;
|
|
68
|
-
sourceRunId?: RunId;
|
|
69
|
-
derivedFromRunId?: RunId;
|
|
70
|
-
isMutable?: boolean;
|
|
71
|
-
/** Set by the engine for this run: 0 = root, 1 = first child subworkflow, … */
|
|
72
|
-
subworkflowDepth?: number;
|
|
73
|
-
/** Effective cap after engine policy merge (successful node completions per run). */
|
|
74
|
-
maxNodeActivations?: number;
|
|
75
|
-
/** Effective cap after engine policy merge (subworkflow nesting). */
|
|
76
|
-
maxSubworkflowDepth?: number;
|
|
77
|
-
}
|
|
78
|
-
/** Engine-owned counters persisted with the run (worker-safe). */
|
|
79
|
-
interface EngineRunCounters {
|
|
80
|
-
completedNodeActivations: number;
|
|
81
|
-
}
|
|
82
|
-
type RunStopCondition = Readonly<{
|
|
83
|
-
kind: "workflowCompleted";
|
|
84
|
-
}> | Readonly<{
|
|
85
|
-
kind: "nodeCompleted";
|
|
86
|
-
nodeId: NodeId;
|
|
87
|
-
}>;
|
|
88
|
-
interface RunStateResetRequest {
|
|
89
|
-
clearFromNodeId: NodeId;
|
|
90
|
-
}
|
|
91
|
-
interface PersistedRunControlState {
|
|
92
|
-
stopCondition?: RunStopCondition;
|
|
93
|
-
}
|
|
94
|
-
interface PersistedWorkflowSnapshotNode {
|
|
95
|
-
id: NodeId;
|
|
96
|
-
kind: NodeKind;
|
|
97
|
-
name?: string;
|
|
98
|
-
nodeTokenId: PersistedTokenId;
|
|
99
|
-
configTokenId: PersistedTokenId;
|
|
100
|
-
tokenName?: string;
|
|
101
|
-
configTokenName?: string;
|
|
102
|
-
config: unknown;
|
|
103
|
-
}
|
|
104
|
-
interface PersistedWorkflowSnapshot {
|
|
105
|
-
id: WorkflowId;
|
|
106
|
-
name: string;
|
|
107
|
-
nodes: ReadonlyArray<PersistedWorkflowSnapshotNode>;
|
|
108
|
-
edges: ReadonlyArray<Edge>;
|
|
109
|
-
/** When the snapshot was built from a live workflow definition that configured a workflow error handler. */
|
|
110
|
-
workflowErrorHandlerConfigured?: boolean;
|
|
111
|
-
/** Connection metadata for child nodes not in the execution graph (e.g. AI agent attachments). */
|
|
112
|
-
connections?: ReadonlyArray<WorkflowNodeConnection>;
|
|
113
|
-
}
|
|
114
|
-
type PinnedNodeOutputsByPort = Readonly<Record<OutputPortKey, Items>>;
|
|
115
|
-
interface PersistedMutableNodeState {
|
|
116
|
-
pinnedOutputsByPort?: PinnedNodeOutputsByPort;
|
|
117
|
-
lastDebugInput?: Items;
|
|
118
|
-
}
|
|
119
|
-
interface PersistedMutableRunState {
|
|
120
|
-
nodesById: Readonly<Record<NodeId, PersistedMutableNodeState>>;
|
|
121
|
-
}
|
|
122
|
-
type NodeInputsByPort = Readonly<Record<InputPortKey, Items>>;
|
|
123
|
-
interface RunQueueEntry {
|
|
124
|
-
nodeId: NodeId;
|
|
125
|
-
input: Items;
|
|
126
|
-
toInput?: InputPortKey;
|
|
127
|
-
batchId?: string;
|
|
128
|
-
from?: Readonly<{
|
|
129
|
-
nodeId: NodeId;
|
|
130
|
-
output: OutputPortKey;
|
|
131
|
-
}>;
|
|
132
|
-
collect?: Readonly<{
|
|
133
|
-
expectedInputs: ReadonlyArray<InputPortKey>;
|
|
134
|
-
received: Readonly<Record<InputPortKey, Items>>;
|
|
135
|
-
}>;
|
|
136
|
-
}
|
|
137
|
-
type NodeExecutionStatus = "pending" | "queued" | "running" | "completed" | "failed" | "skipped";
|
|
138
|
-
interface NodeExecutionError {
|
|
139
|
-
message: string;
|
|
140
|
-
name?: string;
|
|
141
|
-
stack?: string;
|
|
142
|
-
}
|
|
143
|
-
interface NodeExecutionSnapshot {
|
|
144
|
-
runId: RunId;
|
|
145
|
-
workflowId: WorkflowId;
|
|
146
|
-
nodeId: NodeId;
|
|
147
|
-
activationId?: NodeActivationId;
|
|
148
|
-
parent?: ParentExecutionRef;
|
|
149
|
-
status: NodeExecutionStatus;
|
|
150
|
-
usedPinnedOutput?: boolean;
|
|
151
|
-
queuedAt?: string;
|
|
152
|
-
startedAt?: string;
|
|
153
|
-
finishedAt?: string;
|
|
154
|
-
updatedAt: string;
|
|
155
|
-
inputsByPort?: NodeInputsByPort;
|
|
156
|
-
outputs?: NodeOutputs;
|
|
157
|
-
error?: NodeExecutionError;
|
|
158
|
-
}
|
|
159
|
-
/** Stable id for a single connection invocation row in {@link ConnectionInvocationRecord}. */
|
|
160
|
-
type ConnectionInvocationId = string;
|
|
161
|
-
/**
|
|
162
|
-
* One logical LLM or tool call under an owning workflow node (e.g. AI agent).
|
|
163
|
-
* The owning node defines what {@link managedInput} and {@link managedOutput} contain.
|
|
164
|
-
*/
|
|
165
|
-
interface ConnectionInvocationRecord {
|
|
166
|
-
readonly invocationId: ConnectionInvocationId;
|
|
167
|
-
readonly runId: RunId;
|
|
168
|
-
readonly workflowId: WorkflowId;
|
|
169
|
-
readonly connectionNodeId: NodeId;
|
|
170
|
-
readonly parentAgentNodeId: NodeId;
|
|
171
|
-
readonly parentAgentActivationId: NodeActivationId;
|
|
172
|
-
readonly status: NodeExecutionStatus;
|
|
173
|
-
readonly managedInput?: JsonValue;
|
|
174
|
-
readonly managedOutput?: JsonValue;
|
|
175
|
-
readonly error?: NodeExecutionError;
|
|
176
|
-
readonly queuedAt?: string;
|
|
177
|
-
readonly startedAt?: string;
|
|
178
|
-
readonly finishedAt?: string;
|
|
179
|
-
readonly updatedAt: string;
|
|
180
|
-
}
|
|
181
|
-
/** Arguments for appending a {@link ConnectionInvocationRecord} (engine fills run/workflow ids and timestamps). */
|
|
182
|
-
type ConnectionInvocationAppendArgs = Readonly<{
|
|
183
|
-
invocationId: ConnectionInvocationId;
|
|
184
|
-
connectionNodeId: NodeId;
|
|
185
|
-
parentAgentNodeId: NodeId;
|
|
186
|
-
parentAgentActivationId: NodeActivationId;
|
|
187
|
-
status: NodeExecutionStatus;
|
|
188
|
-
managedInput?: JsonValue;
|
|
189
|
-
managedOutput?: JsonValue;
|
|
190
|
-
error?: NodeExecutionError;
|
|
191
|
-
queuedAt?: string;
|
|
192
|
-
startedAt?: string;
|
|
193
|
-
finishedAt?: string;
|
|
194
|
-
}>;
|
|
195
|
-
interface RunCurrentState {
|
|
196
|
-
outputsByNode: Record<NodeId, NodeOutputs>;
|
|
197
|
-
nodeSnapshotsByNodeId: Record<NodeId, NodeExecutionSnapshot>;
|
|
198
|
-
/** Append-only history of connection-scoped invocations (LLM/tool) for inspector and canvas. */
|
|
199
|
-
connectionInvocations?: ReadonlyArray<ConnectionInvocationRecord>;
|
|
200
|
-
mutableState?: PersistedMutableRunState;
|
|
201
|
-
}
|
|
202
|
-
interface CurrentStateExecutionRequest {
|
|
203
|
-
workflow: WorkflowDefinition;
|
|
204
|
-
items?: Items;
|
|
205
|
-
parent?: ParentExecutionRef;
|
|
206
|
-
executionOptions?: RunExecutionOptions;
|
|
207
|
-
workflowSnapshot?: PersistedWorkflowSnapshot;
|
|
208
|
-
mutableState?: PersistedMutableRunState;
|
|
209
|
-
currentState?: RunCurrentState;
|
|
210
|
-
stopCondition?: RunStopCondition;
|
|
211
|
-
reset?: RunStateResetRequest;
|
|
212
|
-
}
|
|
213
|
-
interface ExecutionFrontierPlan {
|
|
214
|
-
rootNodeId?: NodeId;
|
|
215
|
-
rootNodeInput?: Items;
|
|
216
|
-
queue: RunQueueEntry[];
|
|
217
|
-
currentState: RunCurrentState;
|
|
218
|
-
stopCondition: RunStopCondition;
|
|
219
|
-
satisfiedNodeIds: ReadonlyArray<NodeId>;
|
|
220
|
-
skippedNodeIds: ReadonlyArray<NodeId>;
|
|
221
|
-
clearedNodeIds: ReadonlyArray<NodeId>;
|
|
222
|
-
preservedPinnedNodeIds: ReadonlyArray<NodeId>;
|
|
223
|
-
}
|
|
224
|
-
type RunStatus = "running" | "pending" | "completed" | "failed";
|
|
225
|
-
interface RunSummary {
|
|
226
|
-
runId: RunId;
|
|
227
|
-
workflowId: WorkflowId;
|
|
228
|
-
startedAt: string;
|
|
229
|
-
status: RunStatus;
|
|
230
|
-
/** ISO timestamp when the run finished (derived from node snapshots or store `updatedAt`); omit while running/pending. */
|
|
231
|
-
finishedAt?: string;
|
|
232
|
-
parent?: ParentExecutionRef;
|
|
233
|
-
executionOptions?: RunExecutionOptions;
|
|
234
|
-
}
|
|
235
|
-
interface PendingNodeExecution {
|
|
236
|
-
runId: RunId;
|
|
237
|
-
activationId: NodeActivationId;
|
|
238
|
-
workflowId: WorkflowId;
|
|
239
|
-
nodeId: NodeId;
|
|
240
|
-
itemsIn: number;
|
|
241
|
-
inputsByPort: NodeInputsByPort;
|
|
242
|
-
receiptId: string;
|
|
243
|
-
queue?: string;
|
|
244
|
-
batchId?: string;
|
|
245
|
-
enqueuedAt: string;
|
|
246
|
-
}
|
|
247
|
-
interface PersistedRunState {
|
|
248
|
-
runId: RunId;
|
|
249
|
-
workflowId: WorkflowId;
|
|
250
|
-
startedAt: string;
|
|
251
|
-
parent?: ParentExecutionRef;
|
|
252
|
-
executionOptions?: RunExecutionOptions;
|
|
253
|
-
control?: PersistedRunControlState;
|
|
254
|
-
workflowSnapshot?: PersistedWorkflowSnapshot;
|
|
255
|
-
mutableState?: PersistedMutableRunState;
|
|
256
|
-
/** Frozen at createRun from workflow + runtime defaults for prune/storage decisions. */
|
|
257
|
-
policySnapshot?: PersistedRunPolicySnapshot;
|
|
258
|
-
/** Successful node completions so far (for activation budget). */
|
|
259
|
-
engineCounters?: EngineRunCounters;
|
|
260
|
-
status: RunStatus;
|
|
261
|
-
pending?: PendingNodeExecution;
|
|
262
|
-
queue: RunQueueEntry[];
|
|
263
|
-
outputsByNode: Record<NodeId, NodeOutputs>;
|
|
264
|
-
nodeSnapshotsByNodeId: Record<NodeId, NodeExecutionSnapshot>;
|
|
265
|
-
/** Append-only history of connection invocations (LLM/tool) nested under owning nodes. */
|
|
266
|
-
connectionInvocations?: ReadonlyArray<ConnectionInvocationRecord>;
|
|
267
|
-
}
|
|
268
|
-
interface RunStateStore {
|
|
269
|
-
createRun(args: {
|
|
270
|
-
runId: RunId;
|
|
271
|
-
workflowId: WorkflowId;
|
|
272
|
-
startedAt: string;
|
|
273
|
-
parent?: ParentExecutionRef;
|
|
274
|
-
executionOptions?: RunExecutionOptions;
|
|
275
|
-
control?: PersistedRunControlState;
|
|
276
|
-
workflowSnapshot?: PersistedWorkflowSnapshot;
|
|
277
|
-
mutableState?: PersistedMutableRunState;
|
|
278
|
-
policySnapshot?: PersistedRunPolicySnapshot;
|
|
279
|
-
engineCounters?: EngineRunCounters;
|
|
280
|
-
}): Promise<void>;
|
|
281
|
-
load(runId: RunId): Promise<PersistedRunState | undefined>;
|
|
282
|
-
save(state: PersistedRunState): Promise<void>;
|
|
283
|
-
deleteRun?(runId: RunId): Promise<void>;
|
|
284
|
-
}
|
|
285
|
-
interface RunListingStore {
|
|
286
|
-
listRuns(args?: Readonly<{
|
|
287
|
-
workflowId?: WorkflowId;
|
|
288
|
-
limit?: number;
|
|
289
|
-
}>): Promise<ReadonlyArray<RunSummary>>;
|
|
290
|
-
}
|
|
291
|
-
/** Runs eligible for retention-based pruning (completed or failed, older than cutoff). */
|
|
292
|
-
interface RunPruneCandidate {
|
|
293
|
-
readonly runId: RunId;
|
|
294
|
-
readonly workflowId: WorkflowId;
|
|
295
|
-
readonly startedAt: string;
|
|
296
|
-
readonly finishedAt: string;
|
|
297
|
-
}
|
|
298
|
-
interface RunPruneListingStore {
|
|
299
|
-
listRunsOlderThan(args: Readonly<{
|
|
300
|
-
beforeIso: string;
|
|
301
|
-
limit?: number;
|
|
302
|
-
}>): Promise<ReadonlyArray<RunPruneCandidate>>;
|
|
303
|
-
}
|
|
304
|
-
type RunResult = {
|
|
305
|
-
runId: RunId;
|
|
306
|
-
workflowId: WorkflowId;
|
|
307
|
-
startedAt: string;
|
|
308
|
-
status: "completed";
|
|
309
|
-
outputs: Items;
|
|
310
|
-
} | {
|
|
311
|
-
runId: RunId;
|
|
312
|
-
workflowId: WorkflowId;
|
|
313
|
-
startedAt: string;
|
|
314
|
-
status: "pending";
|
|
315
|
-
pending: PendingNodeExecution;
|
|
316
|
-
} | {
|
|
317
|
-
runId: RunId;
|
|
318
|
-
workflowId: WorkflowId;
|
|
319
|
-
startedAt: string;
|
|
320
|
-
status: "failed";
|
|
321
|
-
error: {
|
|
322
|
-
message: string;
|
|
323
|
-
};
|
|
324
|
-
};
|
|
325
|
-
type WebhookRunResult = Readonly<{
|
|
326
|
-
runId: RunId;
|
|
327
|
-
workflowId: WorkflowId;
|
|
328
|
-
startedAt: string;
|
|
329
|
-
runStatus: "pending" | "completed";
|
|
330
|
-
response: Items;
|
|
331
|
-
}>;
|
|
332
|
-
interface PersistedWorkflowTokenRegistryLike {
|
|
333
|
-
register(type: TypeToken<unknown>, packageId: string, persistedNameOverride?: string): string;
|
|
334
|
-
getTokenId(type: TypeToken<unknown>): string | undefined;
|
|
335
|
-
resolve(tokenId: string): TypeToken<unknown> | undefined;
|
|
336
|
-
registerFromWorkflows?(workflows: ReadonlyArray<WorkflowDefinition>): void;
|
|
337
|
-
}
|
|
338
|
-
interface RunCompletionNotifier {
|
|
339
|
-
resolveRunCompletion(result: RunResult): void;
|
|
340
|
-
resolveWebhookResponse(result: WebhookRunResult): void;
|
|
341
|
-
}
|
|
342
|
-
interface RunEventPublisherDeps {
|
|
343
|
-
eventBus?: RunEventBus;
|
|
344
|
-
}
|
|
345
|
-
//#endregion
|
|
346
|
-
//#region src/contracts/runFinishedAtFactory.d.ts
|
|
347
|
-
type RunFinishedAtSource = Pick<PersistedRunState, "status" | "nodeSnapshotsByNodeId">;
|
|
348
|
-
/** Derives workflow end time from node snapshots for run listings. */
|
|
349
|
-
declare class RunFinishedAtFactory {
|
|
350
|
-
static resolveIso(state: RunFinishedAtSource): string | undefined;
|
|
351
|
-
}
|
|
352
|
-
//#endregion
|
|
353
|
-
//#region src/contracts/webhookTypes.d.ts
|
|
354
|
-
type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
355
|
-
interface WebhookControlSignal {
|
|
356
|
-
readonly __webhookControl: true;
|
|
357
|
-
readonly kind: "respondNow" | "respondNowAndContinue";
|
|
358
|
-
readonly responseItems: Items;
|
|
359
|
-
readonly continueItems?: Items;
|
|
360
|
-
}
|
|
361
|
-
interface WebhookTriggerRoutingDiagnostics {
|
|
362
|
-
warn(message: string): void;
|
|
363
|
-
}
|
|
364
|
-
interface TriggerInstanceId {
|
|
365
|
-
workflowId: WorkflowId;
|
|
366
|
-
nodeId: NodeId;
|
|
367
|
-
}
|
|
368
|
-
/** Match for an incoming HTTP request: user-defined URL segment + workflow trigger node. */
|
|
369
|
-
interface WebhookInvocationMatch {
|
|
370
|
-
/** Same value as the webhook trigger's configured endpoint key (URL segment under the webhook base path). */
|
|
371
|
-
endpointPath: string;
|
|
372
|
-
workflowId: WorkflowId;
|
|
373
|
-
nodeId: NodeId;
|
|
374
|
-
methods: ReadonlyArray<HttpMethod>;
|
|
375
|
-
parseJsonBody?: (body: unknown) => unknown;
|
|
376
|
-
}
|
|
377
|
-
/** Result of resolving an HTTP method + endpoint path against the catalog webhook index (404 vs 405 vs match). */
|
|
378
|
-
type WebhookTriggerResolution = {
|
|
379
|
-
status: "notFound";
|
|
380
|
-
} | {
|
|
381
|
-
status: "methodNotAllowed";
|
|
382
|
-
match: WebhookInvocationMatch;
|
|
383
|
-
} | {
|
|
384
|
-
status: "ok";
|
|
385
|
-
match: WebhookInvocationMatch;
|
|
386
|
-
};
|
|
387
|
-
/**
|
|
388
|
-
* Resolves webhook routes from workflow definitions (catalog-backed index, no registration at trigger setup).
|
|
389
|
-
*/
|
|
390
|
-
interface WebhookTriggerMatcher {
|
|
391
|
-
match(args: {
|
|
392
|
-
endpointPath: string;
|
|
393
|
-
method: HttpMethod;
|
|
394
|
-
}): WebhookInvocationMatch | undefined;
|
|
395
|
-
lookup(endpointPath: string): WebhookInvocationMatch | undefined;
|
|
396
|
-
onEngineWorkflowsLoaded?(): void;
|
|
397
|
-
onEngineStopped?(): void;
|
|
398
|
-
}
|
|
399
|
-
//#endregion
|
|
400
|
-
//#region src/workflow/ConnectionInvocationIdFactory.d.ts
|
|
401
|
-
/**
|
|
402
|
-
* Unique ids for persisted connection invocation history rows (LLM/tool calls under an owning node).
|
|
403
|
-
*/
|
|
404
|
-
declare class ConnectionInvocationIdFactory {
|
|
405
|
-
static create(): string;
|
|
406
|
-
/** Deterministic id for tests when a stable sequence is needed. */
|
|
407
|
-
static createForTest(runId: string, connectionNodeId: NodeId, sequence: number): string;
|
|
408
|
-
}
|
|
409
|
-
//#endregion
|
|
410
|
-
//#region src/workflow/ConnectionNodeIdFactory.d.ts
|
|
411
|
-
/**
|
|
412
|
-
* Deterministic ids for workflow connection-owned child nodes (LLM slot, tools, etc.).
|
|
413
|
-
* These are stable across loads.
|
|
414
|
-
*/
|
|
415
|
-
declare class ConnectionNodeIdFactory {
|
|
416
|
-
static readonly connectionSegment: "__conn__";
|
|
417
|
-
static languageModelConnectionNodeId(parentNodeId: NodeId): NodeId;
|
|
418
|
-
static toolConnectionNodeId(parentNodeId: NodeId, toolName: string): NodeId;
|
|
419
|
-
static isLanguageModelConnectionNodeId(nodeId: NodeId): boolean;
|
|
420
|
-
static isToolConnectionNodeId(nodeId: NodeId): boolean;
|
|
421
|
-
/** True when `nodeId` is a connection-owned child of `parentNodeId` (LLM or tool slot). */
|
|
422
|
-
static isConnectionOwnedDescendantOf(parentNodeId: NodeId, nodeId: NodeId): boolean;
|
|
423
|
-
/** Normalizes a tool display name to a stable id segment. */
|
|
424
|
-
static normalizeToolName(toolName: string): string;
|
|
425
|
-
}
|
|
426
|
-
//#endregion
|
|
427
|
-
//#region src/workflow/WorkflowExecutableNodeClassifier.d.ts
|
|
428
|
-
/**
|
|
429
|
-
* Derives which workflow nodes participate in the main execution graph vs connection-only children.
|
|
430
|
-
*/
|
|
431
|
-
declare class WorkflowExecutableNodeClassifier {
|
|
432
|
-
private readonly connectionOwnedIds;
|
|
433
|
-
constructor(workflow: WorkflowDefinition);
|
|
434
|
-
isConnectionOwnedNodeId(nodeId: NodeId): boolean;
|
|
435
|
-
isExecutableNodeId(nodeId: NodeId): boolean;
|
|
436
|
-
filterExecutableNodeDefinitions(nodes: ReadonlyArray<NodeDefinition>): ReadonlyArray<NodeDefinition>;
|
|
437
|
-
private static collectConnectionOwnedIds;
|
|
438
|
-
/**
|
|
439
|
-
* Resolves the default start node: first trigger, else first executable node with no incoming edges from executable nodes.
|
|
440
|
-
*/
|
|
441
|
-
findDefaultExecutableStartNodeId(workflow: WorkflowDefinition): NodeId;
|
|
442
|
-
firstExecutableNodeIdInDefinitionOrder(workflow: WorkflowDefinition): NodeId | undefined;
|
|
443
|
-
lastExecutableNodeIdInDefinitionOrder(workflow: WorkflowDefinition): NodeId;
|
|
444
|
-
}
|
|
445
|
-
//#endregion
|
|
446
|
-
//#region src/events/runEvents.d.ts
|
|
447
|
-
type RunEvent = Readonly<{
|
|
448
|
-
kind: "runCreated";
|
|
449
|
-
runId: RunId;
|
|
450
|
-
workflowId: WorkflowId;
|
|
451
|
-
parent?: ParentExecutionRef;
|
|
452
|
-
at: string;
|
|
453
|
-
}> | Readonly<{
|
|
454
|
-
kind: "runSaved";
|
|
455
|
-
runId: RunId;
|
|
456
|
-
workflowId: WorkflowId;
|
|
457
|
-
parent?: ParentExecutionRef;
|
|
458
|
-
at: string;
|
|
459
|
-
state: PersistedRunState;
|
|
460
|
-
}> | Readonly<{
|
|
461
|
-
kind: "nodeQueued";
|
|
462
|
-
runId: RunId;
|
|
463
|
-
workflowId: WorkflowId;
|
|
464
|
-
parent?: ParentExecutionRef;
|
|
465
|
-
at: string;
|
|
466
|
-
snapshot: NodeExecutionSnapshot;
|
|
467
|
-
}> | Readonly<{
|
|
468
|
-
kind: "nodeStarted";
|
|
469
|
-
runId: RunId;
|
|
470
|
-
workflowId: WorkflowId;
|
|
471
|
-
parent?: ParentExecutionRef;
|
|
472
|
-
at: string;
|
|
473
|
-
snapshot: NodeExecutionSnapshot;
|
|
474
|
-
}> | Readonly<{
|
|
475
|
-
kind: "nodeCompleted";
|
|
476
|
-
runId: RunId;
|
|
477
|
-
workflowId: WorkflowId;
|
|
478
|
-
parent?: ParentExecutionRef;
|
|
479
|
-
at: string;
|
|
480
|
-
snapshot: NodeExecutionSnapshot;
|
|
481
|
-
}> | Readonly<{
|
|
482
|
-
kind: "nodeFailed";
|
|
483
|
-
runId: RunId;
|
|
484
|
-
workflowId: WorkflowId;
|
|
485
|
-
parent?: ParentExecutionRef;
|
|
486
|
-
at: string;
|
|
487
|
-
snapshot: NodeExecutionSnapshot;
|
|
488
|
-
}>;
|
|
489
|
-
interface RunEventSubscription {
|
|
490
|
-
close(): Promise<void>;
|
|
491
|
-
}
|
|
492
|
-
interface RunEventBus {
|
|
493
|
-
publish(event: RunEvent): Promise<void>;
|
|
494
|
-
subscribe(onEvent: (event: RunEvent) => void): Promise<RunEventSubscription>;
|
|
495
|
-
subscribeToWorkflow(workflowId: WorkflowId, onEvent: (event: RunEvent) => void): Promise<RunEventSubscription>;
|
|
496
|
-
}
|
|
497
|
-
//#endregion
|
|
498
|
-
//#region src/contracts/runtimeTypes.d.ts
|
|
499
|
-
interface WorkflowRunnerService {
|
|
500
|
-
runById(args: {
|
|
501
|
-
workflowId: WorkflowId;
|
|
502
|
-
startAt?: NodeId;
|
|
503
|
-
items: Items;
|
|
504
|
-
parent?: ParentExecutionRef;
|
|
505
|
-
}): Promise<RunResult>;
|
|
506
|
-
}
|
|
507
|
-
interface WorkflowRunnerResolver {
|
|
508
|
-
resolve(): WorkflowRunnerService | undefined;
|
|
509
|
-
}
|
|
510
|
-
interface WorkflowRepository {
|
|
511
|
-
list(): ReadonlyArray<WorkflowDefinition>;
|
|
512
|
-
get(workflowId: WorkflowId): WorkflowDefinition | undefined;
|
|
513
|
-
}
|
|
514
|
-
interface WorkflowCatalog extends WorkflowRepository {
|
|
515
|
-
setWorkflows(workflows: ReadonlyArray<WorkflowDefinition>): void;
|
|
516
|
-
}
|
|
517
|
-
type WorkflowRegistry = WorkflowCatalog;
|
|
518
|
-
interface NodeResolver {
|
|
519
|
-
resolve<T>(token: TypeToken<T>): T;
|
|
520
|
-
getContainer(): Container | undefined;
|
|
521
|
-
}
|
|
522
|
-
interface NodeExecutionStatePublisher {
|
|
523
|
-
markQueued(args: {
|
|
524
|
-
nodeId: NodeId;
|
|
525
|
-
activationId?: NodeActivationId;
|
|
526
|
-
inputsByPort?: NodeInputsByPort;
|
|
527
|
-
}): Promise<void>;
|
|
528
|
-
markRunning(args: {
|
|
529
|
-
nodeId: NodeId;
|
|
530
|
-
activationId?: NodeActivationId;
|
|
531
|
-
inputsByPort?: NodeInputsByPort;
|
|
532
|
-
}): Promise<void>;
|
|
533
|
-
markCompleted(args: {
|
|
534
|
-
nodeId: NodeId;
|
|
535
|
-
activationId?: NodeActivationId;
|
|
536
|
-
inputsByPort?: NodeInputsByPort;
|
|
537
|
-
outputs?: NodeOutputs;
|
|
538
|
-
}): Promise<void>;
|
|
539
|
-
markFailed(args: {
|
|
540
|
-
nodeId: NodeId;
|
|
541
|
-
activationId?: NodeActivationId;
|
|
542
|
-
inputsByPort?: NodeInputsByPort;
|
|
543
|
-
error: Error;
|
|
544
|
-
}): Promise<void>;
|
|
545
|
-
appendConnectionInvocation(args: ConnectionInvocationAppendArgs): Promise<void>;
|
|
546
|
-
}
|
|
547
|
-
type BinaryBody = ReadableStream<Uint8Array> | AsyncIterable<Uint8Array> | Uint8Array | ArrayBuffer;
|
|
548
|
-
interface BinaryStorageWriteRequest {
|
|
549
|
-
storageKey: string;
|
|
550
|
-
body: BinaryBody;
|
|
551
|
-
}
|
|
552
|
-
interface BinaryStorageWriteResult {
|
|
553
|
-
storageKey: string;
|
|
554
|
-
size: number;
|
|
555
|
-
sha256?: string;
|
|
556
|
-
}
|
|
557
|
-
interface BinaryStorageReadResult {
|
|
558
|
-
body: ReadableStream<Uint8Array>;
|
|
559
|
-
size?: number;
|
|
560
|
-
}
|
|
561
|
-
interface BinaryStorageStatResult {
|
|
562
|
-
exists: boolean;
|
|
563
|
-
size?: number;
|
|
564
|
-
}
|
|
565
|
-
interface BinaryStorage {
|
|
566
|
-
readonly driverName: string;
|
|
567
|
-
write(args: BinaryStorageWriteRequest): Promise<BinaryStorageWriteResult>;
|
|
568
|
-
openReadStream(storageKey: string): Promise<BinaryStorageReadResult | undefined>;
|
|
569
|
-
stat(storageKey: string): Promise<BinaryStorageStatResult>;
|
|
570
|
-
delete(storageKey: string): Promise<void>;
|
|
571
|
-
}
|
|
572
|
-
interface BinaryAttachmentCreateRequest {
|
|
573
|
-
name: string;
|
|
574
|
-
body: BinaryBody;
|
|
575
|
-
mimeType: string;
|
|
576
|
-
filename?: string;
|
|
577
|
-
previewKind?: BinaryAttachment["previewKind"];
|
|
578
|
-
}
|
|
579
|
-
interface NodeBinaryAttachmentService extends ExecutionBinaryService {
|
|
580
|
-
attach(args: BinaryAttachmentCreateRequest): Promise<BinaryAttachment>;
|
|
581
|
-
withAttachment<TJson>(item: Item<TJson>, name: string, attachment: BinaryAttachment): Item<TJson>;
|
|
582
|
-
}
|
|
583
|
-
interface ExecutionBinaryService {
|
|
584
|
-
forNode(args: {
|
|
585
|
-
nodeId: NodeId;
|
|
586
|
-
activationId: NodeActivationId;
|
|
587
|
-
}): NodeBinaryAttachmentService;
|
|
588
|
-
openReadStream(attachment: BinaryAttachment): Promise<BinaryStorageReadResult | undefined>;
|
|
589
|
-
}
|
|
590
|
-
interface ExecutionContext {
|
|
591
|
-
runId: RunId;
|
|
592
|
-
workflowId: WorkflowId;
|
|
593
|
-
parent?: ParentExecutionRef;
|
|
594
|
-
/** This run's subworkflow depth (0 = root). */
|
|
595
|
-
subworkflowDepth: number;
|
|
596
|
-
/** Effective activation budget cap for this run (after policy merge). */
|
|
597
|
-
engineMaxNodeActivations: number;
|
|
598
|
-
/** Effective subworkflow nesting cap for this run (after policy merge). */
|
|
599
|
-
engineMaxSubworkflowDepth: number;
|
|
600
|
-
now: () => Date;
|
|
601
|
-
data: RunDataSnapshot;
|
|
602
|
-
nodeState?: NodeExecutionStatePublisher;
|
|
603
|
-
binary: ExecutionBinaryService;
|
|
604
|
-
getCredential<TSession = unknown>(slotKey: string): Promise<TSession>;
|
|
605
|
-
}
|
|
606
|
-
interface ExecutionContextFactory {
|
|
607
|
-
create(args: {
|
|
608
|
-
runId: RunId;
|
|
609
|
-
workflowId: WorkflowId;
|
|
610
|
-
parent?: ParentExecutionRef;
|
|
611
|
-
subworkflowDepth: number;
|
|
612
|
-
engineMaxNodeActivations: number;
|
|
613
|
-
engineMaxSubworkflowDepth: number;
|
|
614
|
-
data: RunDataSnapshot;
|
|
615
|
-
nodeState?: NodeExecutionStatePublisher;
|
|
616
|
-
getCredential<TSession = unknown>(slotKey: string): Promise<TSession>;
|
|
617
|
-
}): ExecutionContext;
|
|
618
|
-
}
|
|
619
|
-
interface NodeExecutionContext<TConfig extends NodeConfigBase = NodeConfigBase> extends ExecutionContext {
|
|
620
|
-
nodeId: NodeId;
|
|
621
|
-
activationId: NodeActivationId;
|
|
622
|
-
config: TConfig;
|
|
623
|
-
binary: NodeBinaryAttachmentService;
|
|
624
|
-
}
|
|
625
|
-
interface TriggerSetupContext<TConfig extends TriggerNodeConfig<any, any> = TriggerNodeConfig<any, any>, TSetupState$1 extends JsonValue | undefined = TriggerNodeSetupState<TConfig>> extends ExecutionContext {
|
|
626
|
-
trigger: TriggerInstanceId;
|
|
627
|
-
config: TConfig;
|
|
628
|
-
previousState: TSetupState$1;
|
|
629
|
-
registerCleanup(cleanup: TriggerCleanupHandle): void;
|
|
630
|
-
emit(items: Items): Promise<void>;
|
|
631
|
-
}
|
|
632
|
-
interface TriggerTestItemsContext<TConfig extends TriggerNodeConfig<any, any> = TriggerNodeConfig<any, any>, TSetupState$1 extends JsonValue | undefined = TriggerNodeSetupState<TConfig>> extends ExecutionContext {
|
|
633
|
-
trigger: TriggerInstanceId;
|
|
634
|
-
nodeId: NodeId;
|
|
635
|
-
config: TConfig;
|
|
636
|
-
previousState: TSetupState$1;
|
|
637
|
-
}
|
|
638
|
-
/**
|
|
639
|
-
* Trigger setup state is intentionally engine-owned so future ownership and
|
|
640
|
-
* leader-election metadata can be coordinated centrally rather than pushed into
|
|
641
|
-
* package-level setup code.
|
|
642
|
-
*/
|
|
643
|
-
interface PersistedTriggerSetupState<TState extends JsonValue | undefined = JsonValue | undefined> {
|
|
644
|
-
trigger: TriggerInstanceId;
|
|
645
|
-
updatedAt: string;
|
|
646
|
-
state: TState;
|
|
647
|
-
}
|
|
648
|
-
interface TriggerSetupStateStore {
|
|
649
|
-
load(trigger: TriggerInstanceId): Promise<PersistedTriggerSetupState | undefined>;
|
|
650
|
-
save(state: PersistedTriggerSetupState): Promise<void>;
|
|
651
|
-
delete(trigger: TriggerInstanceId): Promise<void>;
|
|
652
|
-
}
|
|
653
|
-
interface TriggerCleanupHandle {
|
|
654
|
-
stop(): Promise<void> | void;
|
|
655
|
-
}
|
|
656
|
-
interface EngineHost {
|
|
657
|
-
credentialSessions: CredentialSessionService;
|
|
658
|
-
workflows?: WorkflowRunnerService;
|
|
659
|
-
}
|
|
660
|
-
interface Node<TConfig extends NodeConfigBase = NodeConfigBase> {
|
|
661
|
-
kind: "node";
|
|
662
|
-
outputPorts: ReadonlyArray<OutputPortKey>;
|
|
663
|
-
execute(items: Items, ctx: NodeExecutionContext<TConfig>): Promise<NodeOutputs>;
|
|
664
|
-
}
|
|
665
|
-
interface MultiInputNode<TConfig extends NodeConfigBase = NodeConfigBase> {
|
|
666
|
-
kind: "node";
|
|
667
|
-
outputPorts: ReadonlyArray<OutputPortKey>;
|
|
668
|
-
executeMulti(inputsByPort: NodeInputsByPort, ctx: NodeExecutionContext<TConfig>): Promise<NodeOutputs>;
|
|
669
|
-
}
|
|
670
|
-
type TriggerSetupStateFor<TConfig extends TriggerNodeConfig<any, any>> = TriggerNodeSetupState<TConfig>;
|
|
671
|
-
interface TriggerNode<TConfig extends TriggerNodeConfig<any, any> = TriggerNodeConfig<any, any>> {
|
|
672
|
-
kind: "trigger";
|
|
673
|
-
outputPorts: readonly ["main"];
|
|
674
|
-
setup(ctx: TriggerSetupContext<TConfig>): Promise<TriggerSetupStateFor<TConfig>>;
|
|
675
|
-
execute(items: Items, ctx: NodeExecutionContext<TConfig>): Promise<NodeOutputs>;
|
|
676
|
-
}
|
|
677
|
-
interface TestableTriggerNode<TConfig extends TriggerNodeConfig<any, any> = TriggerNodeConfig<any, any>> extends TriggerNode<TConfig> {
|
|
678
|
-
getTestItems(ctx: TriggerTestItemsContext<TConfig>): Promise<Items>;
|
|
679
|
-
}
|
|
680
|
-
type ExecutableTriggerNode<TConfig extends TriggerNodeConfig<any, any> = TriggerNodeConfig<any, any>> = TriggerNode<TConfig>;
|
|
681
|
-
interface NodeExecutionRequest {
|
|
682
|
-
runId: RunId;
|
|
683
|
-
activationId: NodeActivationId;
|
|
684
|
-
workflowId: WorkflowId;
|
|
685
|
-
nodeId: NodeId;
|
|
686
|
-
input: Items;
|
|
687
|
-
parent?: ParentExecutionRef;
|
|
688
|
-
queue?: string;
|
|
689
|
-
executionOptions?: RunExecutionOptions;
|
|
690
|
-
}
|
|
691
|
-
interface NodeExecutionScheduler {
|
|
692
|
-
enqueue(request: NodeExecutionRequest): Promise<{
|
|
693
|
-
receiptId: string;
|
|
694
|
-
}>;
|
|
695
|
-
cancel?(receiptId: string): Promise<void>;
|
|
696
|
-
}
|
|
697
|
-
type NodeActivationRequestBase = Readonly<{
|
|
698
|
-
runId: RunId;
|
|
699
|
-
activationId: NodeActivationId;
|
|
700
|
-
workflowId: WorkflowId;
|
|
701
|
-
nodeId: NodeId;
|
|
702
|
-
parent?: ParentExecutionRef;
|
|
703
|
-
executionOptions?: RunExecutionOptions;
|
|
704
|
-
batchId?: string;
|
|
705
|
-
ctx: NodeExecutionContext;
|
|
706
|
-
}>;
|
|
707
|
-
type NodeActivationRequest = (NodeActivationRequestBase & Readonly<{
|
|
708
|
-
kind: "single";
|
|
709
|
-
input: Items;
|
|
710
|
-
}>) | (NodeActivationRequestBase & Readonly<{
|
|
711
|
-
kind: "multi";
|
|
712
|
-
inputsByPort: NodeInputsByPort;
|
|
713
|
-
}>);
|
|
714
|
-
interface NodeActivationReceipt {
|
|
715
|
-
receiptId: string;
|
|
716
|
-
mode?: "local" | "worker";
|
|
717
|
-
queue?: string;
|
|
718
|
-
}
|
|
719
|
-
interface NodeActivationContinuation {
|
|
720
|
-
markNodeRunning(args: {
|
|
721
|
-
runId: RunId;
|
|
722
|
-
activationId: NodeActivationId;
|
|
723
|
-
nodeId: NodeId;
|
|
724
|
-
inputsByPort: NodeInputsByPort;
|
|
725
|
-
}): Promise<void>;
|
|
726
|
-
resumeFromNodeResult(args: {
|
|
727
|
-
runId: RunId;
|
|
728
|
-
activationId: NodeActivationId;
|
|
729
|
-
nodeId: NodeId;
|
|
730
|
-
outputs: NodeOutputs;
|
|
731
|
-
}): Promise<RunResult>;
|
|
732
|
-
resumeFromNodeError(args: {
|
|
733
|
-
runId: RunId;
|
|
734
|
-
activationId: NodeActivationId;
|
|
735
|
-
nodeId: NodeId;
|
|
736
|
-
error: Error;
|
|
737
|
-
}): Promise<RunResult>;
|
|
738
|
-
}
|
|
739
|
-
interface NodeActivationScheduler {
|
|
740
|
-
setContinuation?(continuation: NodeActivationContinuation): void;
|
|
741
|
-
enqueue(request: NodeActivationRequest): Promise<NodeActivationReceipt>;
|
|
742
|
-
notifyPendingStatePersisted?(runId: RunId): void;
|
|
743
|
-
cancel?(receiptId: string): Promise<void>;
|
|
744
|
-
}
|
|
745
|
-
interface WorkflowNodeInstanceFactory {
|
|
746
|
-
createNodes(workflow: WorkflowDefinition): ReadonlyMap<NodeId, unknown>;
|
|
747
|
-
}
|
|
748
|
-
interface WorkflowSnapshotFactory {
|
|
749
|
-
create(workflow: WorkflowDefinition): PersistedWorkflowSnapshot;
|
|
750
|
-
}
|
|
751
|
-
interface WorkflowSnapshotResolver {
|
|
752
|
-
resolve(args: {
|
|
753
|
-
workflowId: WorkflowId;
|
|
754
|
-
workflowSnapshot?: PersistedWorkflowSnapshot;
|
|
755
|
-
}): WorkflowDefinition | undefined;
|
|
756
|
-
}
|
|
757
|
-
interface EngineDeps {
|
|
758
|
-
credentialSessions: CredentialSessionService;
|
|
759
|
-
workflowRunnerResolver: WorkflowRunnerResolver;
|
|
760
|
-
workflowCatalog: WorkflowCatalog;
|
|
761
|
-
workflowRepository: WorkflowRepository;
|
|
762
|
-
nodeResolver: NodeResolver;
|
|
763
|
-
triggerSetupStateStore: TriggerSetupStateStore;
|
|
764
|
-
webhookTriggerMatcher: WebhookTriggerMatcher;
|
|
765
|
-
runIdFactory: RunIdFactory;
|
|
766
|
-
activationIdFactory: ActivationIdFactory;
|
|
767
|
-
runStore: RunStateStore;
|
|
768
|
-
activationScheduler: NodeActivationScheduler;
|
|
769
|
-
runDataFactory: RunDataFactory;
|
|
770
|
-
executionContextFactory: ExecutionContextFactory;
|
|
771
|
-
eventBus?: RunEventBus;
|
|
772
|
-
tokenRegistry: PersistedWorkflowTokenRegistryLike;
|
|
773
|
-
workflowNodeInstanceFactory: WorkflowNodeInstanceFactory;
|
|
774
|
-
/** Defaults for prune/storage snapshot when workflow omits explicit policy fields. */
|
|
775
|
-
workflowPolicyRuntimeDefaults?: WorkflowPolicyRuntimeDefaults;
|
|
776
|
-
}
|
|
777
|
-
//#endregion
|
|
778
|
-
//#region src/contracts/workflowTypes.d.ts
|
|
779
|
-
type WorkflowId = string;
|
|
780
|
-
type NodeId = string;
|
|
781
|
-
type OutputPortKey = string;
|
|
782
|
-
type InputPortKey = string;
|
|
783
|
-
type PersistedTokenId = string;
|
|
784
|
-
type NodeKind = "trigger" | "node";
|
|
785
|
-
type JsonPrimitive = string | number | boolean | null;
|
|
786
|
-
interface JsonObject {
|
|
787
|
-
readonly [key: string]: JsonValue;
|
|
788
|
-
}
|
|
789
|
-
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
790
|
-
type JsonArray = ReadonlyArray<JsonValue>;
|
|
791
|
-
interface Edge {
|
|
792
|
-
from: {
|
|
793
|
-
nodeId: NodeId;
|
|
794
|
-
output: OutputPortKey;
|
|
795
|
-
};
|
|
796
|
-
to: {
|
|
797
|
-
nodeId: NodeId;
|
|
798
|
-
input: InputPortKey;
|
|
799
|
-
};
|
|
800
|
-
}
|
|
801
|
-
type NodeConnectionName = string;
|
|
802
|
-
/**
|
|
803
|
-
* Named connection from an executable parent node to child nodes that exist in {@link WorkflowDefinition.nodes}
|
|
804
|
-
* but are not traversed by the main execution graph.
|
|
805
|
-
*/
|
|
806
|
-
interface WorkflowNodeConnection {
|
|
807
|
-
readonly parentNodeId: NodeId;
|
|
808
|
-
readonly connectionName: NodeConnectionName;
|
|
809
|
-
readonly childNodeIds: ReadonlyArray<NodeId>;
|
|
810
|
-
}
|
|
811
|
-
interface WorkflowDefinition {
|
|
812
|
-
id: WorkflowId;
|
|
813
|
-
name: string;
|
|
814
|
-
nodes: NodeDefinition[];
|
|
815
|
-
edges: Edge[];
|
|
816
|
-
/**
|
|
817
|
-
* Optional metadata: which nodes are connection-owned children (e.g. AI agent `llm` / `tools` slots).
|
|
818
|
-
* When omitted, all nodes in {@link nodes} are treated as executable for topology.
|
|
819
|
-
*/
|
|
820
|
-
readonly connections?: ReadonlyArray<WorkflowNodeConnection>;
|
|
821
|
-
/** Directory + file-stem path under a workflow discovery root (for UI grouping only). */
|
|
822
|
-
discoveryPathSegments?: readonly string[];
|
|
823
|
-
/** Retention for run JSON and binaries (seconds). Host/env may supply defaults when omitted. */
|
|
824
|
-
readonly prunePolicy?: WorkflowPrunePolicySpec;
|
|
825
|
-
/** Whether to keep run data after completion. Host/env may supply defaults when omitted. */
|
|
826
|
-
readonly storagePolicy?: WorkflowStoragePolicySpec;
|
|
827
|
-
/** Invoked after a node fails permanently (retries exhausted) and node error handler did not recover. */
|
|
828
|
-
readonly workflowErrorHandler?: WorkflowErrorHandlerSpec;
|
|
829
|
-
}
|
|
830
|
-
interface WorkflowGraph {
|
|
831
|
-
next(nodeId: NodeId, output: OutputPortKey): ReadonlyArray<Readonly<{
|
|
832
|
-
nodeId: NodeId;
|
|
833
|
-
input: InputPortKey;
|
|
834
|
-
}>>;
|
|
835
|
-
}
|
|
836
|
-
interface WorkflowGraphFactory {
|
|
837
|
-
create(def: WorkflowDefinition): WorkflowGraph;
|
|
838
|
-
}
|
|
839
|
-
interface NodeConfigBase {
|
|
840
|
-
readonly kind: NodeKind;
|
|
841
|
-
readonly type: TypeToken<unknown>;
|
|
842
|
-
readonly name?: string;
|
|
843
|
-
readonly id?: NodeId;
|
|
844
|
-
readonly icon?: string;
|
|
845
|
-
readonly execution?: Readonly<{
|
|
846
|
-
hint?: "local" | "worker";
|
|
847
|
-
queue?: string;
|
|
848
|
-
}>;
|
|
849
|
-
/** In-process execute retries (runnable nodes). Triggers typically omit this. */
|
|
850
|
-
readonly retryPolicy?: RetryPolicySpec;
|
|
851
|
-
/** Recover from execute failures; return outputs to continue, or rethrow to fail the node. */
|
|
852
|
-
readonly nodeErrorHandler?: NodeErrorHandlerSpec;
|
|
853
|
-
/**
|
|
854
|
-
* When true, edges carrying zero items on an output port still schedule single-input downstream nodes.
|
|
855
|
-
* Decided from the **source** node that produced the (empty) output. Default (false/undefined): empty
|
|
856
|
-
* main batches skip downstream execution and propagate the empty path.
|
|
857
|
-
*/
|
|
858
|
-
readonly continueWhenEmptyOutput?: boolean;
|
|
859
|
-
getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
|
|
860
|
-
}
|
|
861
|
-
declare const runnableNodeInputType: unique symbol;
|
|
862
|
-
declare const runnableNodeOutputType: unique symbol;
|
|
863
|
-
declare const triggerNodeOutputType: unique symbol;
|
|
864
|
-
interface RunnableNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> extends NodeConfigBase {
|
|
865
|
-
readonly kind: "node";
|
|
866
|
-
readonly [runnableNodeInputType]?: TInputJson$1;
|
|
867
|
-
readonly [runnableNodeOutputType]?: TOutputJson$1;
|
|
868
|
-
}
|
|
869
|
-
declare const triggerNodeSetupStateType: unique symbol;
|
|
870
|
-
interface TriggerNodeConfig<TOutputJson$1 = unknown, TSetupState$1 extends JsonValue | undefined = undefined> extends NodeConfigBase {
|
|
871
|
-
readonly kind: "trigger";
|
|
872
|
-
readonly [triggerNodeOutputType]?: TOutputJson$1;
|
|
873
|
-
readonly [triggerNodeSetupStateType]?: TSetupState$1;
|
|
874
|
-
}
|
|
875
|
-
type RunnableNodeInputJson<TConfig extends RunnableNodeConfig<any, any>> = TConfig extends RunnableNodeConfig<infer TInputJson, any> ? TInputJson : never;
|
|
876
|
-
type RunnableNodeOutputJson<TConfig extends RunnableNodeConfig<any, any>> = TConfig extends RunnableNodeConfig<any, infer TOutputJson> ? TOutputJson : never;
|
|
877
|
-
type TriggerNodeOutputJson<TConfig extends TriggerNodeConfig<any, any>> = TConfig extends TriggerNodeConfig<infer TOutputJson, any> ? TOutputJson : never;
|
|
878
|
-
type TriggerNodeSetupState<TConfig extends TriggerNodeConfig<any, any>> = TConfig extends TriggerNodeConfig<any, infer TSetupState> ? TSetupState : never;
|
|
879
|
-
interface NodeDefinition {
|
|
880
|
-
id: NodeId;
|
|
881
|
-
kind: NodeKind;
|
|
882
|
-
type: TypeToken<unknown>;
|
|
883
|
-
name?: string;
|
|
884
|
-
config: NodeConfigBase;
|
|
885
|
-
}
|
|
886
|
-
interface NodeRef {
|
|
887
|
-
id: NodeId;
|
|
888
|
-
kind: NodeKind;
|
|
889
|
-
name?: string;
|
|
890
|
-
}
|
|
891
|
-
type PairedItemRef = Readonly<{
|
|
892
|
-
nodeId: NodeId;
|
|
893
|
-
output: OutputPortKey;
|
|
894
|
-
itemIndex: number;
|
|
895
|
-
}>;
|
|
896
|
-
type BinaryPreviewKind = "image" | "audio" | "video" | "download";
|
|
897
|
-
type BinaryAttachment = Readonly<{
|
|
898
|
-
id: string;
|
|
899
|
-
storageKey: string;
|
|
900
|
-
mimeType: string;
|
|
901
|
-
size: number;
|
|
902
|
-
storageDriver: string;
|
|
903
|
-
previewKind: BinaryPreviewKind;
|
|
904
|
-
createdAt: string;
|
|
905
|
-
runId: RunId;
|
|
906
|
-
workflowId: WorkflowId;
|
|
907
|
-
nodeId: NodeId;
|
|
908
|
-
activationId: NodeActivationId;
|
|
909
|
-
filename?: string;
|
|
910
|
-
sha256?: string;
|
|
911
|
-
}>;
|
|
912
|
-
type ItemBinary = Readonly<Record<string, BinaryAttachment>>;
|
|
913
|
-
type Item<TJson = unknown> = Readonly<{
|
|
914
|
-
json: TJson;
|
|
915
|
-
binary?: ItemBinary;
|
|
916
|
-
meta?: Readonly<Record<string, unknown>>;
|
|
917
|
-
paired?: ReadonlyArray<PairedItemRef>;
|
|
918
|
-
}>;
|
|
919
|
-
type Items<TJson = unknown> = ReadonlyArray<Item<TJson>>;
|
|
920
|
-
type NodeOutputs = Partial<Record<OutputPortKey, Items>>;
|
|
921
|
-
type RunId = string;
|
|
922
|
-
type NodeActivationId = string;
|
|
923
|
-
interface ParentExecutionRef {
|
|
924
|
-
runId: RunId;
|
|
925
|
-
workflowId: WorkflowId;
|
|
926
|
-
nodeId: NodeId;
|
|
927
|
-
/** Subworkflow depth of the **spawning** run (0 = root). Passed when starting a child run. */
|
|
928
|
-
subworkflowDepth?: number;
|
|
929
|
-
/** Effective max node activations from the parent run (propagated to child policy merge). */
|
|
930
|
-
engineMaxNodeActivations?: number;
|
|
931
|
-
/** Effective max subworkflow depth from the parent run (propagated to child policy merge). */
|
|
932
|
-
engineMaxSubworkflowDepth?: number;
|
|
933
|
-
}
|
|
934
|
-
interface RunDataSnapshot {
|
|
935
|
-
getOutputs(nodeId: NodeId): NodeOutputs | undefined;
|
|
936
|
-
getOutputItems(nodeId: NodeId, output?: OutputPortKey): Items;
|
|
937
|
-
getOutputItem(nodeId: NodeId, itemIndex: number, output?: OutputPortKey): Item | undefined;
|
|
938
|
-
}
|
|
939
|
-
interface MutableRunData extends RunDataSnapshot {
|
|
940
|
-
setOutputs(nodeId: NodeId, outputs: NodeOutputs): void;
|
|
941
|
-
dump(): Record<NodeId, NodeOutputs>;
|
|
942
|
-
}
|
|
943
|
-
interface RunDataFactory {
|
|
944
|
-
create(initial?: Record<NodeId, NodeOutputs>): MutableRunData;
|
|
945
|
-
}
|
|
946
|
-
interface RunIdFactory {
|
|
947
|
-
makeRunId(): RunId;
|
|
948
|
-
}
|
|
949
|
-
interface ActivationIdFactory {
|
|
950
|
-
makeActivationId(): NodeActivationId;
|
|
951
|
-
}
|
|
952
|
-
type UpstreamRefPlaceholder = `$${number}`;
|
|
953
|
-
declare const branchRef: (index: number) => UpstreamRefPlaceholder;
|
|
954
|
-
type ExecutionMode = "local" | "worker";
|
|
955
|
-
interface NodeSchedulerDecision {
|
|
956
|
-
mode: ExecutionMode;
|
|
957
|
-
queue?: string;
|
|
958
|
-
}
|
|
959
|
-
interface NodeOffloadPolicy {
|
|
960
|
-
decide(args: {
|
|
961
|
-
workflowId: WorkflowId;
|
|
962
|
-
nodeId: NodeId;
|
|
963
|
-
config: NodeConfigBase;
|
|
964
|
-
}): NodeSchedulerDecision;
|
|
965
|
-
}
|
|
966
|
-
/** Whether to persist run execution data after the workflow finishes. */
|
|
967
|
-
type WorkflowStoragePolicyMode = "ALL" | "SUCCESS" | "ERROR" | "NEVER";
|
|
968
|
-
type WorkflowStoragePolicySpec = WorkflowStoragePolicyMode | TypeToken<WorkflowStoragePolicyResolver>;
|
|
969
|
-
interface WorkflowStoragePolicyResolver {
|
|
970
|
-
shouldPersist(args: WorkflowStoragePolicyDecisionArgs): boolean | Promise<boolean>;
|
|
971
|
-
}
|
|
972
|
-
interface WorkflowStoragePolicyDecisionArgs {
|
|
973
|
-
readonly runId: RunId;
|
|
974
|
-
readonly workflowId: WorkflowId;
|
|
975
|
-
readonly workflow: WorkflowDefinition;
|
|
976
|
-
readonly finalStatus: "completed" | "failed";
|
|
977
|
-
readonly startedAt: string;
|
|
978
|
-
readonly finishedAt: string;
|
|
979
|
-
}
|
|
980
|
-
interface WorkflowPrunePolicySpec {
|
|
981
|
-
readonly runDataRetentionSeconds?: number;
|
|
982
|
-
readonly binaryRetentionSeconds?: number;
|
|
983
|
-
}
|
|
984
|
-
interface PersistedRunPolicySnapshot {
|
|
985
|
-
readonly retentionSeconds?: number;
|
|
986
|
-
readonly binaryRetentionSeconds?: number;
|
|
987
|
-
readonly storagePolicy: WorkflowStoragePolicyMode;
|
|
988
|
-
}
|
|
989
|
-
interface WorkflowErrorHandler {
|
|
990
|
-
onError(ctx: WorkflowErrorContext): void | Promise<void>;
|
|
991
|
-
}
|
|
992
|
-
interface WorkflowErrorContext {
|
|
993
|
-
readonly runId: RunId;
|
|
994
|
-
readonly workflowId: WorkflowId;
|
|
995
|
-
readonly workflow: WorkflowDefinition;
|
|
996
|
-
readonly failedNodeId: NodeId;
|
|
997
|
-
readonly error: Error;
|
|
998
|
-
readonly startedAt: string;
|
|
999
|
-
readonly finishedAt: string;
|
|
1000
|
-
}
|
|
1001
|
-
type WorkflowErrorHandlerSpec = TypeToken<WorkflowErrorHandler> | WorkflowErrorHandler;
|
|
1002
|
-
interface NodeErrorHandlerArgs<TConfig extends NodeConfigBase = NodeConfigBase> {
|
|
1003
|
-
readonly kind: "single" | "multi";
|
|
1004
|
-
readonly items: Items;
|
|
1005
|
-
readonly inputsByPort: Readonly<Record<InputPortKey, Items>> | undefined;
|
|
1006
|
-
readonly ctx: NodeExecutionContext<TConfig>;
|
|
1007
|
-
readonly error: Error;
|
|
1008
|
-
}
|
|
1009
|
-
interface NodeErrorHandler {
|
|
1010
|
-
handle<TConfig extends NodeConfigBase>(args: NodeErrorHandlerArgs<TConfig>): Promise<NodeOutputs>;
|
|
1011
|
-
}
|
|
1012
|
-
type NodeErrorHandlerSpec = TypeToken<NodeErrorHandler> | NodeErrorHandler;
|
|
1013
|
-
/** Runtime defaults when workflow omits prune/storage fields (typically from host env). */
|
|
1014
|
-
interface WorkflowPolicyRuntimeDefaults {
|
|
1015
|
-
readonly retentionSeconds?: number;
|
|
1016
|
-
readonly binaryRetentionSeconds?: number;
|
|
1017
|
-
readonly storagePolicy?: WorkflowStoragePolicyMode;
|
|
1018
|
-
}
|
|
1019
|
-
//#endregion
|
|
1020
|
-
//#region src/contracts/credentialTypes.d.ts
|
|
1021
|
-
type CredentialTypeId = string;
|
|
1022
|
-
type CredentialInstanceId = string;
|
|
1023
|
-
type CredentialMaterialSourceKind = "db" | "env" | "code";
|
|
1024
|
-
type CredentialSetupStatus = "draft" | "ready";
|
|
1025
|
-
type CredentialHealthStatus = "unknown" | "healthy" | "failing";
|
|
1026
|
-
type CredentialFieldSchema = Readonly<{
|
|
1027
|
-
key: string;
|
|
1028
|
-
label: string;
|
|
1029
|
-
type: "string" | "password" | "textarea" | "json" | "boolean";
|
|
1030
|
-
required?: true;
|
|
1031
|
-
order?: number;
|
|
1032
|
-
placeholder?: string;
|
|
1033
|
-
helpText?: string;
|
|
1034
|
-
/** When set, host resolves this field from process.env at runtime; env wins over stored values. */
|
|
1035
|
-
envVarName?: string;
|
|
1036
|
-
}>;
|
|
1037
|
-
type CredentialRequirement = Readonly<{
|
|
1038
|
-
slotKey: string;
|
|
1039
|
-
label: string;
|
|
1040
|
-
acceptedTypes: ReadonlyArray<CredentialTypeId>;
|
|
1041
|
-
optional?: true;
|
|
1042
|
-
helpText?: string;
|
|
1043
|
-
helpUrl?: string;
|
|
1044
|
-
}>;
|
|
1045
|
-
type CredentialBindingKey = Readonly<{
|
|
1046
|
-
workflowId: WorkflowId;
|
|
1047
|
-
nodeId: NodeId;
|
|
1048
|
-
slotKey: string;
|
|
1049
|
-
}>;
|
|
1050
|
-
type CredentialBinding = Readonly<{
|
|
1051
|
-
key: CredentialBindingKey;
|
|
1052
|
-
instanceId: CredentialInstanceId;
|
|
1053
|
-
updatedAt: string;
|
|
1054
|
-
}>;
|
|
1055
|
-
type CredentialHealth = Readonly<{
|
|
1056
|
-
status: CredentialHealthStatus;
|
|
1057
|
-
message?: string;
|
|
1058
|
-
testedAt?: string;
|
|
1059
|
-
expiresAt?: string;
|
|
1060
|
-
details?: Readonly<Record<string, unknown>>;
|
|
1061
|
-
}>;
|
|
1062
|
-
type OAuth2ProviderFromPublicConfig = Readonly<{
|
|
1063
|
-
authorizeUrlFieldKey: string;
|
|
1064
|
-
tokenUrlFieldKey: string;
|
|
1065
|
-
userInfoUrlFieldKey?: string;
|
|
1066
|
-
}>;
|
|
1067
|
-
type CredentialOAuth2AuthDefinition = Readonly<{
|
|
1068
|
-
kind: "oauth2";
|
|
1069
|
-
providerId: string;
|
|
1070
|
-
scopes: ReadonlyArray<string>;
|
|
1071
|
-
clientIdFieldKey?: string;
|
|
1072
|
-
clientSecretFieldKey?: string;
|
|
1073
|
-
} | {
|
|
1074
|
-
kind: "oauth2";
|
|
1075
|
-
providerFromPublicConfig: OAuth2ProviderFromPublicConfig;
|
|
1076
|
-
scopes: ReadonlyArray<string>;
|
|
1077
|
-
clientIdFieldKey?: string;
|
|
1078
|
-
clientSecretFieldKey?: string;
|
|
1079
|
-
}>;
|
|
1080
|
-
type CredentialAuthDefinition = CredentialOAuth2AuthDefinition;
|
|
1081
|
-
type CredentialTypeDefinition = Readonly<{
|
|
1082
|
-
typeId: CredentialTypeId;
|
|
1083
|
-
displayName: string;
|
|
1084
|
-
description?: string;
|
|
1085
|
-
publicFields?: ReadonlyArray<CredentialFieldSchema>;
|
|
1086
|
-
secretFields?: ReadonlyArray<CredentialFieldSchema>;
|
|
1087
|
-
supportedSourceKinds?: ReadonlyArray<CredentialMaterialSourceKind>;
|
|
1088
|
-
auth?: CredentialAuthDefinition;
|
|
1089
|
-
}>;
|
|
1090
|
-
interface CredentialSessionService {
|
|
1091
|
-
getSession<TSession = unknown>(args: Readonly<{
|
|
1092
|
-
workflowId: WorkflowId;
|
|
1093
|
-
nodeId: NodeId;
|
|
1094
|
-
slotKey: string;
|
|
1095
|
-
}>): Promise<TSession>;
|
|
1096
|
-
}
|
|
1097
|
-
interface CredentialTypeRegistry {
|
|
1098
|
-
listTypes(): ReadonlyArray<CredentialTypeDefinition>;
|
|
1099
|
-
getType(typeId: CredentialTypeId): CredentialTypeDefinition | undefined;
|
|
1100
|
-
}
|
|
1101
|
-
declare class CredentialUnboundError extends Error {
|
|
1102
|
-
readonly bindingKey: CredentialBindingKey;
|
|
1103
|
-
readonly acceptedTypes: ReadonlyArray<CredentialTypeId>;
|
|
1104
|
-
constructor(bindingKey: CredentialBindingKey, acceptedTypes?: ReadonlyArray<CredentialTypeId>);
|
|
1105
|
-
private static createMessage;
|
|
1106
|
-
}
|
|
1107
|
-
//#endregion
|
|
1108
|
-
//#region src/engine/adapters/registry/InMemoryWorkflowRegistry.d.ts
|
|
1109
|
-
declare class InMemoryWorkflowRegistry implements WorkflowCatalog {
|
|
1110
|
-
private readonly workflowsById;
|
|
1111
|
-
setWorkflows(workflows: ReadonlyArray<WorkflowDefinition>): void;
|
|
1112
|
-
list(): ReadonlyArray<WorkflowDefinition>;
|
|
1113
|
-
get(workflowId: WorkflowId): WorkflowDefinition | undefined;
|
|
1114
|
-
}
|
|
1115
|
-
//#endregion
|
|
1116
|
-
export { RunId as $, RunPruneCandidate as $n, PersistedTriggerSetupState as $t, JsonPrimitive as A, ConnectionInvocationId as An, predicateAwareClassFactory as Ar, BinaryStorageReadResult as At, NodeId as B, PersistedMutableNodeState as Bn, MultiInputNode as Bt, ExecutionMode as C, WebhookControlSignal as Cn, container as Cr, runnableNodeInputType as Ct, Items as D, WebhookTriggerRoutingDiagnostics as Dn, injectable as Dr, BinaryAttachmentCreateRequest as Dt, ItemBinary as E, WebhookTriggerResolution as En, injectAll as Er, triggerNodeSetupStateType as Et, NodeConnectionName as F, NodeExecutionError as Fn, EngineHost as Ft, NodeSchedulerDecision as G, PersistedWorkflowSnapshotNode as Gn, NodeActivationRequestBase as Gt, NodeOffloadPolicy as H, PersistedRunControlState as Hn, NodeActivationContinuation as Ht, NodeDefinition as I, NodeExecutionSnapshot as In, ExecutableTriggerNode as It, ParentExecutionRef as J, RunCompletionNotifier as Jn, NodeExecutionContext as Jt, OutputPortKey as K, PersistedWorkflowTokenRegistryLike as Kn, NodeActivationScheduler as Kt, NodeErrorHandler as L, NodeExecutionStatus as Ln, ExecutionBinaryService as Lt, MutableRunData as M, CurrentStateExecutionRequest as Mn, singleton as Mr, BinaryStorageWriteRequest as Mt, NodeActivationId as N, EngineRunCounters as Nn, BinaryStorageWriteResult as Nt, JsonArray as O, RunFinishedAtFactory as On, instanceCachingFactory as Or, BinaryBody as Ot, NodeConfigBase as P, ExecutionFrontierPlan as Pn, EngineDeps as Pt, RunDataSnapshot as Q, RunListingStore as Qn, NodeResolver as Qt, NodeErrorHandlerArgs as R, NodeInputsByPort as Rn, ExecutionContext as Rt, Edge as S, TriggerInstanceId as Sn, TypeToken as Sr, branchRef as St, Item as T, WebhookTriggerMatcher as Tn, inject as Tr, triggerNodeOutputType as Tt, NodeOutputs as U, PersistedRunState as Un, NodeActivationReceipt as Ut, NodeKind as V, PersistedMutableRunState as Vn, Node as Vt, NodeRef as W, PersistedWorkflowSnapshot as Wn, NodeActivationRequest as Wt, PersistedTokenId as X, RunEventPublisherDeps as Xn, NodeExecutionScheduler as Xt, PersistedRunPolicySnapshot as Y, RunCurrentState as Yn, NodeExecutionRequest as Yt, RunDataFactory as Z, RunExecutionOptions as Zn, NodeExecutionStatePublisher as Zt, CredentialUnboundError as _, RunEventSubscription as _n, DependencyContainer as _r, WorkflowPrunePolicySpec as _t, CredentialFieldSchema as a, TriggerSetupStateStore as an, RunStatus as ar, TriggerNodeOutputJson as at, BinaryAttachment as b, ConnectionInvocationIdFactory as bn, Lifecycle as br, WorkflowStoragePolicyResolver as bt, CredentialInstanceId as c, WorkflowNodeInstanceFactory as cn, WebhookRunResult as cr, WorkflowDefinition as ct, CredentialRequirement as d, WorkflowRunnerResolver as dn, NoRetryPolicy as dr, WorkflowErrorHandlerSpec as dt, TestableTriggerNode as en, RunPruneListingStore as er, RunIdFactory as et, CredentialSessionService as f, WorkflowRunnerService as fn, ExponentialRetryPolicySpec as fr, WorkflowGraph as ft, CredentialTypeRegistry as g, RunEventBus as gn, Container as gr, WorkflowPolicyRuntimeDefaults as gt, CredentialTypeId as h, RunEvent as hn, RetryPolicySpec as hr, WorkflowNodeConnection as ht, CredentialBindingKey as i, TriggerSetupStateFor as in, RunStateStore as ir, TriggerNodeConfig as it, JsonValue as j, ConnectionInvocationRecord as jn, registry as jr, BinaryStorageStatResult as jt, JsonObject as k, ConnectionInvocationAppendArgs as kn, instancePerContainerCachingFactory as kr, BinaryStorage as kt, CredentialMaterialSourceKind as l, WorkflowRegistry as ln, ExpRetryPolicy as lr, WorkflowErrorContext as lt, CredentialTypeDefinition as m, WorkflowSnapshotResolver as mn, NoneRetryPolicySpec as mr, WorkflowId as mt, CredentialAuthDefinition as n, TriggerNode as nn, RunResult as nr, RunnableNodeInputJson as nt, CredentialHealth as o, TriggerTestItemsContext as on, RunStopCondition as or, TriggerNodeSetupState as ot, CredentialSetupStatus as p, WorkflowSnapshotFactory as pn, FixedRetryPolicySpec as pr, WorkflowGraphFactory as pt, PairedItemRef as q, PinnedNodeOutputsByPort as qn, NodeBinaryAttachmentService as qt, CredentialBinding as r, TriggerSetupContext as rn, RunStateResetRequest as rr, RunnableNodeOutputJson as rt, CredentialHealthStatus as s, WorkflowCatalog as sn, RunSummary as sr, UpstreamRefPlaceholder as st, InMemoryWorkflowRegistry as t, TriggerCleanupHandle as tn, RunQueueEntry as tr, RunnableNodeConfig as tt, CredentialOAuth2AuthDefinition as u, WorkflowRepository as un, RetryPolicy as ur, WorkflowErrorHandler as ut, OAuth2ProviderFromPublicConfig as v, WorkflowExecutableNodeClassifier as vn, Disposable as vr, WorkflowStoragePolicyDecisionArgs as vt, InputPortKey as w, WebhookInvocationMatch as wn, delay as wr, runnableNodeOutputType as wt, BinaryPreviewKind as x, HttpMethod as xn, RegistrationOptions as xr, WorkflowStoragePolicySpec as xt, ActivationIdFactory as y, ConnectionNodeIdFactory as yn, InjectionToken as yr, WorkflowStoragePolicyMode as yt, NodeErrorHandlerSpec as z, PendingNodeExecution as zn, ExecutionContextFactory as zt };
|
|
1117
|
-
//# sourceMappingURL=InMemoryWorkflowRegistry-rAdKVWYT.d.ts.map
|