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