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