@codemation/core 0.2.3 → 0.4.0
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/CHANGELOG.md +23 -0
- package/README.md +2 -0
- package/dist/{EngineRuntimeRegistration.types-Bjeo7Sfq.d.ts → EngineRuntimeRegistration.types-DU6MsjU9.d.ts} +2 -2
- package/dist/{EngineWorkflowRunnerService-Dd4yD31l.d.cts → EngineWorkflowRunnerService-BBkL4VQF.d.cts} +2 -2
- package/dist/{InMemoryRunDataFactory-OUzDmAHt.d.cts → InMemoryRunDataFactory-CsYEMJK2.d.cts} +11 -3
- package/dist/{RunIntentService-Bkg4oYrM.d.cts → RunIntentService-BvlTpmEb.d.cts} +224 -237
- package/dist/{RunIntentService-BAKikN8h.d.ts → RunIntentService-zbTchO9T.d.ts} +305 -259
- package/dist/bootstrap/index.cjs +2 -2
- package/dist/bootstrap/index.d.cts +19 -7
- package/dist/bootstrap/index.d.ts +3 -3
- package/dist/bootstrap/index.js +2 -2
- package/dist/{bootstrap-DwS5S7s9.cjs → bootstrap-DHH2uo-W.cjs} +4 -2
- package/dist/bootstrap-DHH2uo-W.cjs.map +1 -0
- package/dist/{bootstrap-BD6CobHl.js → bootstrap-DbUlOl11.js} +4 -2
- package/dist/bootstrap-DbUlOl11.js.map +1 -0
- package/dist/{index-BDHCiN22.d.ts → index-CUt13qs1.d.ts} +85 -16
- package/dist/index.cjs +74 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +131 -24
- package/dist/index.d.ts +3 -3
- package/dist/index.js +64 -13
- package/dist/index.js.map +1 -1
- package/dist/{runtime-Cy-3FTI_.js → runtime-BdH94eBR.js} +502 -123
- package/dist/runtime-BdH94eBR.js.map +1 -0
- package/dist/{runtime-ZJUpWmPH.cjs → runtime-feFn8OmG.cjs} +561 -122
- package/dist/runtime-feFn8OmG.cjs.map +1 -0
- package/dist/testing.cjs +40 -36
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.cts +17 -26
- package/dist/testing.d.ts +17 -26
- package/dist/testing.js +40 -36
- package/dist/testing.js.map +1 -1
- package/dist/{workflowActivationPolicy-BzyzXLa_.cjs → workflowActivationPolicy-6V3OJD3N.cjs} +65 -19
- package/dist/workflowActivationPolicy-6V3OJD3N.cjs.map +1 -0
- package/dist/{workflowActivationPolicy-B8HzTk3o.js → workflowActivationPolicy-Td9HTOuD.js} +65 -19
- package/dist/workflowActivationPolicy-Td9HTOuD.js.map +1 -0
- package/package.json +2 -1
- package/src/ai/AgentConfigInspectorFactory.ts +4 -0
- package/src/ai/AgentMessageConfigNormalizerFactory.ts +7 -0
- package/src/ai/AgentToolFactory.ts +2 -2
- package/src/ai/AiHost.ts +11 -10
- package/src/ai/NodeBackedToolConfig.ts +1 -1
- package/src/authoring/defineNode.types.ts +144 -25
- package/src/authoring/index.ts +3 -1
- package/src/bootstrap/runtime/EngineRuntimeRegistrar.ts +8 -0
- package/src/contracts/emitPorts.ts +27 -0
- package/src/contracts/index.ts +3 -0
- package/src/contracts/itemMeta.ts +11 -0
- package/src/contracts/itemValue.ts +147 -0
- package/src/contracts/runtimeTypes.ts +39 -22
- package/src/contracts/workflowTypes.ts +26 -56
- package/src/execution/FanInMergeByOriginMerger.ts +67 -0
- package/src/execution/ItemValueResolver.ts +27 -0
- package/src/execution/NodeActivationRequestComposer.ts +25 -0
- package/src/execution/NodeActivationRequestInputPreparer.ts +57 -25
- package/src/execution/NodeExecutor.ts +199 -30
- package/src/execution/NodeOutputNormalizer.ts +90 -0
- package/src/execution/index.ts +2 -0
- package/src/index.ts +2 -0
- package/src/orchestration/NodeExecutionRequestHandlerService.ts +39 -18
- package/src/orchestration/RunContinuationService.ts +11 -17
- package/src/planning/CurrentStateFrontierPlanner.ts +20 -20
- package/src/planning/RunQueuePlanner.ts +56 -19
- package/src/planning/WorkflowTopologyPlanner.ts +57 -33
- package/src/testing/ItemHarnessNode.ts +4 -10
- package/src/testing/ItemHarnessNodeConfig.ts +7 -16
- package/src/testing/RegistrarEngineTestKitFactory.ts +2 -0
- package/src/testing/SubWorkflowRunnerTestNode.ts +28 -43
- package/src/testing/SwitchHarnessNode.ts +54 -0
- package/src/types/index.ts +3 -0
- package/src/workflow/dsl/ChainCursorResolver.ts +68 -23
- package/src/workflow/dsl/WorkflowBuilder.ts +3 -5
- package/src/workflow/dsl/workflowBuilderTypes.ts +5 -8
- package/src/workflowSnapshots/MissingRuntimeNode.ts +4 -4
- package/src/workflowSnapshots/MissingRuntimeNodeConfig.ts +2 -2
- package/src/workflowSnapshots/WorkflowSnapshotCodec.ts +16 -7
- package/dist/bootstrap-BD6CobHl.js.map +0 -1
- package/dist/bootstrap-DwS5S7s9.cjs.map +0 -1
- package/dist/runtime-Cy-3FTI_.js.map +0 -1
- package/dist/runtime-ZJUpWmPH.cjs.map +0 -1
- package/dist/workflowActivationPolicy-B8HzTk3o.js.map +0 -1
- package/dist/workflowActivationPolicy-BzyzXLa_.cjs.map +0 -1
|
@@ -3,62 +3,6 @@ import { DependencyContainer as Container, DependencyContainer as DependencyCont
|
|
|
3
3
|
import { ZodType } from "zod";
|
|
4
4
|
import { ReadableStream } from "node:stream/web";
|
|
5
5
|
|
|
6
|
-
//#region src/contracts/retryPolicySpec.types.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* In-process retry policy for runnable nodes. Serialized configs use the same
|
|
9
|
-
* `kind` discriminator (`JSON.stringify` / persisted workflows).
|
|
10
|
-
*
|
|
11
|
-
* `maxAttempts` is the total number of tries including the first (e.g. 3 means up to 2 delays after failures).
|
|
12
|
-
*/
|
|
13
|
-
type RetryPolicySpec = NoneRetryPolicySpec | FixedRetryPolicySpec | ExponentialRetryPolicySpec;
|
|
14
|
-
interface NoneRetryPolicySpec {
|
|
15
|
-
readonly kind: "none";
|
|
16
|
-
}
|
|
17
|
-
interface FixedRetryPolicySpec {
|
|
18
|
-
readonly kind: "fixed";
|
|
19
|
-
/** Total attempts including the first execution. Must be >= 1. */
|
|
20
|
-
readonly maxAttempts: number;
|
|
21
|
-
readonly delayMs: number;
|
|
22
|
-
}
|
|
23
|
-
interface ExponentialRetryPolicySpec {
|
|
24
|
-
readonly kind: "exponential";
|
|
25
|
-
/** Total attempts including the first execution. Must be >= 1. */
|
|
26
|
-
readonly maxAttempts: number;
|
|
27
|
-
readonly initialDelayMs: number;
|
|
28
|
-
readonly multiplier: number;
|
|
29
|
-
readonly maxDelayMs?: number;
|
|
30
|
-
/** When true, each delay is multiplied by a random factor in [1, 1.2). */
|
|
31
|
-
readonly jitter?: boolean;
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region src/contracts/NoRetryPolicy.d.ts
|
|
35
|
-
declare class NoRetryPolicy implements NoneRetryPolicySpec {
|
|
36
|
-
readonly kind: "none";
|
|
37
|
-
}
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region src/contracts/RetryPolicy.d.ts
|
|
40
|
-
declare class RetryPolicy implements FixedRetryPolicySpec {
|
|
41
|
-
readonly maxAttempts: number;
|
|
42
|
-
readonly delayMs: number;
|
|
43
|
-
readonly kind: "fixed";
|
|
44
|
-
constructor(maxAttempts: number, delayMs: number);
|
|
45
|
-
/** Default for HTTP-style transient failures: 3 tries, 1s between attempts. */
|
|
46
|
-
static readonly defaultForHttp: FixedRetryPolicySpec;
|
|
47
|
-
/** Default for LLM / agent calls: 3 tries, 2s fixed backoff. */
|
|
48
|
-
static readonly defaultForAiAgent: FixedRetryPolicySpec;
|
|
49
|
-
}
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region src/contracts/ExpRetryPolicy.d.ts
|
|
52
|
-
declare class ExpRetryPolicy implements ExponentialRetryPolicySpec {
|
|
53
|
-
readonly maxAttempts: number;
|
|
54
|
-
readonly initialDelayMs: number;
|
|
55
|
-
readonly multiplier: number;
|
|
56
|
-
readonly maxDelayMs?: number | undefined;
|
|
57
|
-
readonly jitter?: boolean | undefined;
|
|
58
|
-
readonly kind: "exponential";
|
|
59
|
-
constructor(maxAttempts: number, initialDelayMs: number, multiplier: number, maxDelayMs?: number | undefined, jitter?: boolean | undefined);
|
|
60
|
-
}
|
|
61
|
-
//#endregion
|
|
62
6
|
//#region src/events/runEvents.d.ts
|
|
63
7
|
type RunEvent = Readonly<{
|
|
64
8
|
kind: "runCreated";
|
|
@@ -160,6 +104,149 @@ declare const CoreTokens: {
|
|
|
160
104
|
readonly WorkflowActivationPolicy: TypeToken<WorkflowActivationPolicy>;
|
|
161
105
|
};
|
|
162
106
|
//#endregion
|
|
107
|
+
//#region src/contracts/credentialTypes.d.ts
|
|
108
|
+
type CredentialTypeId = string;
|
|
109
|
+
type CredentialInstanceId = string;
|
|
110
|
+
type CredentialMaterialSourceKind = "db" | "env" | "code";
|
|
111
|
+
type CredentialSetupStatus = "draft" | "ready";
|
|
112
|
+
type CredentialHealthStatus = "unknown" | "healthy" | "failing";
|
|
113
|
+
type CredentialFieldSchema = Readonly<{
|
|
114
|
+
key: string;
|
|
115
|
+
label: string;
|
|
116
|
+
type: "string" | "password" | "textarea" | "json" | "boolean";
|
|
117
|
+
required?: true;
|
|
118
|
+
order?: number;
|
|
119
|
+
placeholder?: string;
|
|
120
|
+
helpText?: string;
|
|
121
|
+
/** When set, host resolves this field from process.env at runtime; env wins over stored values. */
|
|
122
|
+
envVarName?: string;
|
|
123
|
+
/**
|
|
124
|
+
* When set, the dialog shows a copy action for this exact string (e.g. a static OAuth redirect URI
|
|
125
|
+
* pattern or documentation URL). Do not use for secret values.
|
|
126
|
+
*/
|
|
127
|
+
copyValue?: string;
|
|
128
|
+
/** Accessible label for the copy control (default: Copy). */
|
|
129
|
+
copyButtonLabel?: string;
|
|
130
|
+
}>;
|
|
131
|
+
type CredentialRequirement = Readonly<{
|
|
132
|
+
slotKey: string;
|
|
133
|
+
label: string;
|
|
134
|
+
acceptedTypes: ReadonlyArray<CredentialTypeId>;
|
|
135
|
+
optional?: true;
|
|
136
|
+
helpText?: string;
|
|
137
|
+
helpUrl?: string;
|
|
138
|
+
}>;
|
|
139
|
+
type CredentialBindingKey = Readonly<{
|
|
140
|
+
workflowId: WorkflowId;
|
|
141
|
+
nodeId: NodeId;
|
|
142
|
+
slotKey: string;
|
|
143
|
+
}>;
|
|
144
|
+
type CredentialBinding = Readonly<{
|
|
145
|
+
key: CredentialBindingKey;
|
|
146
|
+
instanceId: CredentialInstanceId;
|
|
147
|
+
updatedAt: string;
|
|
148
|
+
}>;
|
|
149
|
+
type CredentialHealth = Readonly<{
|
|
150
|
+
status: CredentialHealthStatus;
|
|
151
|
+
message?: string;
|
|
152
|
+
testedAt?: string;
|
|
153
|
+
expiresAt?: string;
|
|
154
|
+
details?: Readonly<Record<string, unknown>>;
|
|
155
|
+
}>;
|
|
156
|
+
type OAuth2ProviderFromPublicConfig = Readonly<{
|
|
157
|
+
authorizeUrlFieldKey: string;
|
|
158
|
+
tokenUrlFieldKey: string;
|
|
159
|
+
userInfoUrlFieldKey?: string;
|
|
160
|
+
}>;
|
|
161
|
+
type CredentialOAuth2AuthDefinition = Readonly<{
|
|
162
|
+
kind: "oauth2";
|
|
163
|
+
providerId: string;
|
|
164
|
+
scopes: ReadonlyArray<string>;
|
|
165
|
+
clientIdFieldKey?: string;
|
|
166
|
+
clientSecretFieldKey?: string;
|
|
167
|
+
} | {
|
|
168
|
+
kind: "oauth2";
|
|
169
|
+
providerFromPublicConfig: OAuth2ProviderFromPublicConfig;
|
|
170
|
+
scopes: ReadonlyArray<string>;
|
|
171
|
+
clientIdFieldKey?: string;
|
|
172
|
+
clientSecretFieldKey?: string;
|
|
173
|
+
}>;
|
|
174
|
+
type CredentialAuthDefinition = CredentialOAuth2AuthDefinition;
|
|
175
|
+
type CredentialTypeDefinition = Readonly<{
|
|
176
|
+
typeId: CredentialTypeId;
|
|
177
|
+
displayName: string;
|
|
178
|
+
description?: string;
|
|
179
|
+
publicFields?: ReadonlyArray<CredentialFieldSchema>;
|
|
180
|
+
secretFields?: ReadonlyArray<CredentialFieldSchema>;
|
|
181
|
+
supportedSourceKinds?: ReadonlyArray<CredentialMaterialSourceKind>;
|
|
182
|
+
auth?: CredentialAuthDefinition;
|
|
183
|
+
}>;
|
|
184
|
+
/**
|
|
185
|
+
* JSON-shaped credential field bag (public config, resolved secret material, etc.).
|
|
186
|
+
*/
|
|
187
|
+
type CredentialJsonRecord = Readonly<Record<string, unknown>>;
|
|
188
|
+
/**
|
|
189
|
+
* Persisted credential instance with typed `publicConfig`.
|
|
190
|
+
* Hosts may specialize `secretRef` with a stricter union while remaining
|
|
191
|
+
* assignable here for session/test callbacks.
|
|
192
|
+
*/
|
|
193
|
+
type CredentialInstanceRecord<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord> = Readonly<{
|
|
194
|
+
instanceId: CredentialInstanceId;
|
|
195
|
+
typeId: CredentialTypeId;
|
|
196
|
+
displayName: string;
|
|
197
|
+
sourceKind: CredentialMaterialSourceKind;
|
|
198
|
+
publicConfig: TPublicConfig;
|
|
199
|
+
secretRef: CredentialJsonRecord;
|
|
200
|
+
tags: ReadonlyArray<string>;
|
|
201
|
+
setupStatus: CredentialSetupStatus;
|
|
202
|
+
createdAt: string;
|
|
203
|
+
updatedAt: string;
|
|
204
|
+
}>;
|
|
205
|
+
/**
|
|
206
|
+
* Arguments passed to `CredentialType.createSession` and `CredentialType.test`.
|
|
207
|
+
* Declare `TPublicConfig` / `TMaterial` on `CredentialType` so implementations are checked
|
|
208
|
+
* against your credential shapes (similar to `NodeExecutionContext.config` for nodes).
|
|
209
|
+
*/
|
|
210
|
+
type CredentialSessionFactoryArgs<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord> = Readonly<{
|
|
211
|
+
instance: CredentialInstanceRecord<TPublicConfig>;
|
|
212
|
+
material: TMaterial;
|
|
213
|
+
publicConfig: TPublicConfig;
|
|
214
|
+
}>;
|
|
215
|
+
type CredentialSessionFactory<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord, TSession = unknown> = (args: CredentialSessionFactoryArgs<TPublicConfig, TMaterial>) => Promise<TSession>;
|
|
216
|
+
type CredentialHealthTester<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord> = (args: CredentialSessionFactoryArgs<TPublicConfig, TMaterial>) => Promise<CredentialHealth>;
|
|
217
|
+
/**
|
|
218
|
+
* Full credential type implementation: `definition` (UI/schema), `createSession`, and `test`.
|
|
219
|
+
* Use this at registration and config boundaries; `CredentialTypeDefinition` is only the schema slice.
|
|
220
|
+
*/
|
|
221
|
+
type CredentialType<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord, TSession = unknown> = Readonly<{
|
|
222
|
+
definition: CredentialTypeDefinition;
|
|
223
|
+
createSession: CredentialSessionFactory<TPublicConfig, TMaterial, TSession>;
|
|
224
|
+
test: CredentialHealthTester<TPublicConfig, TMaterial>;
|
|
225
|
+
}>;
|
|
226
|
+
/**
|
|
227
|
+
* Credential type with unspecified generics — used for `CodemationConfig.credentialTypes`, the host registry,
|
|
228
|
+
* and anywhere a concrete `CredentialType<YourPublic, YourMaterial, YourSession>` is placed in a heterogeneous list.
|
|
229
|
+
* Using `any` here avoids unsafe `as` casts while keeping typed `satisfies CredentialType<…>` definitions.
|
|
230
|
+
*/
|
|
231
|
+
type AnyCredentialType = CredentialType<any, any, unknown>;
|
|
232
|
+
interface CredentialSessionService {
|
|
233
|
+
getSession<TSession = unknown>(args: Readonly<{
|
|
234
|
+
workflowId: WorkflowId;
|
|
235
|
+
nodeId: NodeId;
|
|
236
|
+
slotKey: string;
|
|
237
|
+
}>): Promise<TSession>;
|
|
238
|
+
}
|
|
239
|
+
interface CredentialTypeRegistry {
|
|
240
|
+
listTypes(): ReadonlyArray<CredentialTypeDefinition>;
|
|
241
|
+
getType(typeId: CredentialTypeId): CredentialTypeDefinition | undefined;
|
|
242
|
+
}
|
|
243
|
+
declare class CredentialUnboundError extends Error {
|
|
244
|
+
readonly bindingKey: CredentialBindingKey;
|
|
245
|
+
readonly acceptedTypes: ReadonlyArray<CredentialTypeId>;
|
|
246
|
+
constructor(bindingKey: CredentialBindingKey, acceptedTypes?: ReadonlyArray<CredentialTypeId>);
|
|
247
|
+
private static createMessage;
|
|
248
|
+
}
|
|
249
|
+
//#endregion
|
|
163
250
|
//#region src/contracts/runTypes.d.ts
|
|
164
251
|
interface RunExecutionOptions {
|
|
165
252
|
/** Run-intent override: force the inline scheduler and bypass node-level offload decisions. */
|
|
@@ -679,31 +766,41 @@ interface EngineHost {
|
|
|
679
766
|
credentialSessions: CredentialSessionService;
|
|
680
767
|
workflows?: WorkflowRunnerService;
|
|
681
768
|
}
|
|
682
|
-
interface Node<TConfig extends NodeConfigBase = NodeConfigBase> {
|
|
683
|
-
kind: "node";
|
|
684
|
-
outputPorts: ReadonlyArray<OutputPortKey>;
|
|
685
|
-
execute(items: Items, ctx: NodeExecutionContext<TConfig>): Promise<NodeOutputs>;
|
|
686
|
-
}
|
|
687
769
|
/**
|
|
688
|
-
*
|
|
689
|
-
* Engine applies
|
|
770
|
+
* Per-item runnable node: return JSON, an array to fan-out on `main`, or {@link emitPorts} for multi-port emission.
|
|
771
|
+
* Engine applies `inputSchema.parse(item.json)` and passes the result as `args.input` (wire `item.json` is unchanged).
|
|
690
772
|
*/
|
|
691
|
-
interface
|
|
773
|
+
interface RunnableNodeExecuteArgs<TConfig extends RunnableNodeConfig<any, any> = RunnableNodeConfig<any, any>, TInputJson$1 = unknown> {
|
|
774
|
+
readonly input: TInputJson$1;
|
|
775
|
+
readonly item: Item;
|
|
776
|
+
readonly itemIndex: number;
|
|
777
|
+
readonly items: Items;
|
|
778
|
+
readonly ctx: NodeExecutionContext<TConfig>;
|
|
779
|
+
}
|
|
780
|
+
interface RunnableNode<TConfig extends RunnableNodeConfig<any, any> = RunnableNodeConfig<any, any>, TInputJson$1 = unknown, _TOutputJson = unknown> {
|
|
692
781
|
readonly kind: "node";
|
|
693
|
-
|
|
782
|
+
/**
|
|
783
|
+
* Declared output ports (e.g. `["main"]`).
|
|
784
|
+
*
|
|
785
|
+
* Prefer describing dynamic router ports (Switch) and fixed multi-ports (If true/false)
|
|
786
|
+
* via {@link NodeConfigBase.declaredOutputPorts}. Engine defaults to `["main"]` when omitted.
|
|
787
|
+
*/
|
|
788
|
+
readonly outputPorts?: ReadonlyArray<OutputPortKey>;
|
|
694
789
|
/** When omitted, engine uses {@link RunnableNodeConfig.inputSchema} or `z.unknown()`. */
|
|
695
790
|
readonly inputSchema?: ZodType<TInputJson$1>;
|
|
696
|
-
|
|
697
|
-
input: TInputJson$1;
|
|
698
|
-
item: Item;
|
|
699
|
-
itemIndex: number;
|
|
700
|
-
items: Items;
|
|
701
|
-
ctx: NodeExecutionContext<TConfig>;
|
|
702
|
-
}>): Promise<TOutputJson$1> | TOutputJson$1;
|
|
791
|
+
execute(args: RunnableNodeExecuteArgs<TConfig, TInputJson$1>): Promise<unknown> | unknown;
|
|
703
792
|
}
|
|
793
|
+
/** @deprecated Use {@link RunnableNode} */
|
|
794
|
+
type ItemNode<TConfig extends RunnableNodeConfig<any, any> = RunnableNodeConfig<any, any>, TInputJson$1 = unknown, TOutputJson$1 = unknown> = RunnableNode<TConfig, TInputJson$1, TOutputJson$1>;
|
|
704
795
|
interface MultiInputNode<TConfig extends NodeConfigBase = NodeConfigBase> {
|
|
705
796
|
kind: "node";
|
|
706
|
-
|
|
797
|
+
/**
|
|
798
|
+
* Declared output ports (typically `["main"]`).
|
|
799
|
+
*
|
|
800
|
+
* Prefer describing ports for authoring/canvas via {@link NodeConfigBase.declaredOutputPorts}.
|
|
801
|
+
* Engine defaults to `["main"]` when omitted.
|
|
802
|
+
*/
|
|
803
|
+
outputPorts?: ReadonlyArray<OutputPortKey>;
|
|
707
804
|
executeMulti(inputsByPort: NodeInputsByPort, ctx: NodeExecutionContext<TConfig>): Promise<NodeOutputs>;
|
|
708
805
|
}
|
|
709
806
|
type TriggerSetupStateFor<TConfig extends TriggerNodeConfig<any, any>> = TriggerNodeSetupState<TConfig>;
|
|
@@ -833,6 +930,34 @@ interface EngineDeps {
|
|
|
833
930
|
triggerRuntimeDiagnostics?: TriggerRuntimeDiagnostics;
|
|
834
931
|
}
|
|
835
932
|
//#endregion
|
|
933
|
+
//#region src/contracts/retryPolicySpec.types.d.ts
|
|
934
|
+
/**
|
|
935
|
+
* In-process retry policy for runnable nodes. Serialized configs use the same
|
|
936
|
+
* `kind` discriminator (`JSON.stringify` / persisted workflows).
|
|
937
|
+
*
|
|
938
|
+
* `maxAttempts` is the total number of tries including the first (e.g. 3 means up to 2 delays after failures).
|
|
939
|
+
*/
|
|
940
|
+
type RetryPolicySpec = NoneRetryPolicySpec | FixedRetryPolicySpec | ExponentialRetryPolicySpec;
|
|
941
|
+
interface NoneRetryPolicySpec {
|
|
942
|
+
readonly kind: "none";
|
|
943
|
+
}
|
|
944
|
+
interface FixedRetryPolicySpec {
|
|
945
|
+
readonly kind: "fixed";
|
|
946
|
+
/** Total attempts including the first execution. Must be >= 1. */
|
|
947
|
+
readonly maxAttempts: number;
|
|
948
|
+
readonly delayMs: number;
|
|
949
|
+
}
|
|
950
|
+
interface ExponentialRetryPolicySpec {
|
|
951
|
+
readonly kind: "exponential";
|
|
952
|
+
/** Total attempts including the first execution. Must be >= 1. */
|
|
953
|
+
readonly maxAttempts: number;
|
|
954
|
+
readonly initialDelayMs: number;
|
|
955
|
+
readonly multiplier: number;
|
|
956
|
+
readonly maxDelayMs?: number;
|
|
957
|
+
/** When true, each delay is multiplied by a random factor in [1, 1.2). */
|
|
958
|
+
readonly jitter?: boolean;
|
|
959
|
+
}
|
|
960
|
+
//#endregion
|
|
836
961
|
//#region src/contracts/workflowTypes.d.ts
|
|
837
962
|
type WorkflowId = string;
|
|
838
963
|
type NodeId = string;
|
|
@@ -846,6 +971,8 @@ interface JsonObject {
|
|
|
846
971
|
}
|
|
847
972
|
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
848
973
|
type JsonArray = ReadonlyArray<JsonValue>;
|
|
974
|
+
/** JSON value that is not a top-level array (nested arrays inside objects are allowed). */
|
|
975
|
+
type JsonNonArray = JsonPrimitive | JsonObject;
|
|
849
976
|
interface Edge {
|
|
850
977
|
from: {
|
|
851
978
|
nodeId: NodeId;
|
|
@@ -915,65 +1042,42 @@ interface NodeConfigBase {
|
|
|
915
1042
|
* main batches skip downstream execution and propagate the empty path.
|
|
916
1043
|
*/
|
|
917
1044
|
readonly continueWhenEmptyOutput?: boolean;
|
|
1045
|
+
/**
|
|
1046
|
+
* Declared I/O port names for canvas authoring (unioned with ports inferred from edges).
|
|
1047
|
+
* Use for dynamic routers (Switch) and future error ports.
|
|
1048
|
+
*/
|
|
1049
|
+
readonly declaredOutputPorts?: ReadonlyArray<OutputPortKey>;
|
|
1050
|
+
readonly declaredInputPorts?: ReadonlyArray<InputPortKey>;
|
|
918
1051
|
getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
|
|
919
1052
|
}
|
|
920
1053
|
declare const runnableNodeInputType: unique symbol;
|
|
921
1054
|
declare const runnableNodeOutputType: unique symbol;
|
|
922
|
-
/** Phantom: JSON shape on the wire from upstream before {@link RunnableNodeConfig.mapInput}. */
|
|
923
|
-
declare const runnableNodeWireType: unique symbol;
|
|
924
1055
|
declare const triggerNodeOutputType: unique symbol;
|
|
1056
|
+
type LineageCarryPolicy = "emitOnly" | "carryThrough";
|
|
925
1057
|
/**
|
|
926
|
-
*
|
|
927
|
-
*
|
|
928
|
-
* node’s outputs in this run (e.g. `ctx.data.getOutputItems(nodeIdA, "main")` while mapping at D), not only
|
|
929
|
-
* the immediate predecessor’s {@link ItemInputMapperArgs.item}.
|
|
930
|
-
*/
|
|
931
|
-
interface ItemInputMapperContext {
|
|
932
|
-
readonly runId: RunId;
|
|
933
|
-
readonly workflowId: WorkflowId;
|
|
934
|
-
/** Node whose activation is being prepared (the consumer of `mapInput`). */
|
|
935
|
-
readonly nodeId: NodeId;
|
|
936
|
-
readonly activationId: NodeActivationId;
|
|
937
|
-
readonly parent?: ParentExecutionRef;
|
|
938
|
-
readonly data: RunDataSnapshot;
|
|
939
|
-
}
|
|
940
|
-
/**
|
|
941
|
-
* Arguments for optional per-item input mapping applied by the engine before Zod validation.
|
|
942
|
-
*/
|
|
943
|
-
interface ItemInputMapperArgs<TWireJson$1 = unknown> {
|
|
944
|
-
readonly item: Item<TWireJson$1>;
|
|
945
|
-
readonly itemIndex: number;
|
|
946
|
-
readonly items: Items<TWireJson$1>;
|
|
947
|
-
readonly ctx: ItemInputMapperContext;
|
|
948
|
-
}
|
|
949
|
-
/**
|
|
950
|
-
* Per-item mapper before Zod validation. Uses a **bivariant** method signature so concrete
|
|
951
|
-
* `ItemInputMapper<SpecificWire, TIn>` remains assignable to `RunnableNodeConfig` fields typed as
|
|
952
|
-
* `ItemInputMapper<unknown, unknown>` (same pattern as React-style callbacks).
|
|
1058
|
+
* Runnable node: **`TInputJson`** is what **`inputSchema`** validates on **`item.json`** (the wire payload).
|
|
1059
|
+
* **`TOutputJson`** is emitted `item.json` on outputs.
|
|
953
1060
|
*/
|
|
954
|
-
|
|
955
|
-
bivarianceHack(args: ItemInputMapperArgs<TWireJson$1>): TInputJson$1 | Promise<TInputJson$1>;
|
|
956
|
-
}["bivarianceHack"];
|
|
957
|
-
/**
|
|
958
|
-
* Runnable node: **`TInputJson`** is the payload after `mapInput` (if any) + Zod validation — what {@link ItemNode}
|
|
959
|
-
* `executeOne` receives. **`TOutputJson`** is emitted `item.json` on outputs. **`TWireJson`** is `item.json` from
|
|
960
|
-
* upstream **before** `mapInput`; it defaults to **`TInputJson`** when there is no mapper or wire differs from execute input.
|
|
961
|
-
*/
|
|
962
|
-
interface RunnableNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown, TWireJson$1 = TInputJson$1> extends NodeConfigBase {
|
|
1061
|
+
interface RunnableNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> extends NodeConfigBase {
|
|
963
1062
|
readonly kind: "node";
|
|
964
1063
|
readonly [runnableNodeInputType]?: TInputJson$1;
|
|
965
1064
|
readonly [runnableNodeOutputType]?: TOutputJson$1;
|
|
966
|
-
readonly [runnableNodeWireType]?: TWireJson$1;
|
|
967
1065
|
/**
|
|
968
|
-
* Optional Zod input contract for {@link
|
|
1066
|
+
* Optional Zod input contract for {@link RunnableNode} when not set on the node class.
|
|
969
1067
|
* Resolution order: node instance `inputSchema`, then config `inputSchema`, then `z.unknown()`.
|
|
970
1068
|
*/
|
|
971
1069
|
readonly inputSchema?: ZodType<TInputJson$1>;
|
|
972
1070
|
/**
|
|
973
|
-
*
|
|
974
|
-
*
|
|
1071
|
+
* Overrides default lineage propagation for `execute` outputs (binary/meta/paired).
|
|
1072
|
+
* Routers with multiple {@link RunnableNode#outputPorts} default to **`carryThrough`**; others default to **`emitOnly`**.
|
|
1073
|
+
*/
|
|
1074
|
+
readonly lineageCarry?: LineageCarryPolicy;
|
|
1075
|
+
/**
|
|
1076
|
+
* When an activation receives **zero** input items, the engine normally runs `execute` zero times.
|
|
1077
|
+
* Set to **`runOnce`** to run `execute` once with an empty `items` batch (and a synthetic wire item for schema parsing).
|
|
1078
|
+
* Used by batch-style callback nodes (built-in `Callback`) so `callback([], ctx)` still runs.
|
|
975
1079
|
*/
|
|
976
|
-
readonly
|
|
1080
|
+
readonly emptyBatchExecution?: "skip" | "runOnce";
|
|
977
1081
|
}
|
|
978
1082
|
declare const triggerNodeSetupStateType: unique symbol;
|
|
979
1083
|
interface TriggerNodeConfig<TOutputJson$1 = unknown, TSetupState$1 extends JsonValue | undefined = undefined> extends NodeConfigBase {
|
|
@@ -981,9 +1085,8 @@ interface TriggerNodeConfig<TOutputJson$1 = unknown, TSetupState$1 extends JsonV
|
|
|
981
1085
|
readonly [triggerNodeOutputType]?: TOutputJson$1;
|
|
982
1086
|
readonly [triggerNodeSetupStateType]?: TSetupState$1;
|
|
983
1087
|
}
|
|
984
|
-
type RunnableNodeInputJson<TConfig extends RunnableNodeConfig<any, any
|
|
985
|
-
type
|
|
986
|
-
type RunnableNodeOutputJson<TConfig extends RunnableNodeConfig<any, any, any>> = TConfig extends RunnableNodeConfig<any, infer TOutputJson, any> ? TOutputJson : never;
|
|
1088
|
+
type RunnableNodeInputJson<TConfig extends RunnableNodeConfig<any, any>> = TConfig extends RunnableNodeConfig<infer TInputJson, any> ? TInputJson : never;
|
|
1089
|
+
type RunnableNodeOutputJson<TConfig extends RunnableNodeConfig<any, any>> = TConfig extends RunnableNodeConfig<any, infer TOutputJson> ? TOutputJson : never;
|
|
987
1090
|
type TriggerNodeOutputJson<TConfig extends TriggerNodeConfig<any, any>> = TConfig extends TriggerNodeConfig<infer TOutputJson, any> ? TOutputJson : never;
|
|
988
1091
|
type TriggerNodeSetupState<TConfig extends TriggerNodeConfig<any, any>> = TConfig extends TriggerNodeConfig<any, infer TSetupState> ? TSetupState : never;
|
|
989
1092
|
interface NodeDefinition {
|
|
@@ -1127,147 +1230,85 @@ interface WorkflowPolicyRuntimeDefaults {
|
|
|
1127
1230
|
readonly storagePolicy?: WorkflowStoragePolicyMode;
|
|
1128
1231
|
}
|
|
1129
1232
|
//#endregion
|
|
1130
|
-
//#region src/contracts/
|
|
1131
|
-
|
|
1132
|
-
type
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
type CredentialHealthStatus = "unknown" | "healthy" | "failing";
|
|
1136
|
-
type CredentialFieldSchema = Readonly<{
|
|
1137
|
-
key: string;
|
|
1138
|
-
label: string;
|
|
1139
|
-
type: "string" | "password" | "textarea" | "json" | "boolean";
|
|
1140
|
-
required?: true;
|
|
1141
|
-
order?: number;
|
|
1142
|
-
placeholder?: string;
|
|
1143
|
-
helpText?: string;
|
|
1144
|
-
/** When set, host resolves this field from process.env at runtime; env wins over stored values. */
|
|
1145
|
-
envVarName?: string;
|
|
1146
|
-
/**
|
|
1147
|
-
* When set, the dialog shows a copy action for this exact string (e.g. a static OAuth redirect URI
|
|
1148
|
-
* pattern or documentation URL). Do not use for secret values.
|
|
1149
|
-
*/
|
|
1150
|
-
copyValue?: string;
|
|
1151
|
-
/** Accessible label for the copy control (default: Copy). */
|
|
1152
|
-
copyButtonLabel?: string;
|
|
1233
|
+
//#region src/contracts/emitPorts.d.ts
|
|
1234
|
+
declare const EMIT_PORTS_BRAND: unique symbol;
|
|
1235
|
+
type PortsEmission = Readonly<{
|
|
1236
|
+
readonly [EMIT_PORTS_BRAND]: true;
|
|
1237
|
+
readonly ports: Readonly<Partial<Record<OutputPortKey, Items | ReadonlyArray<JsonNonArray>>>>;
|
|
1153
1238
|
}>;
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
optional?: true;
|
|
1159
|
-
helpText?: string;
|
|
1160
|
-
helpUrl?: string;
|
|
1239
|
+
declare function emitPorts(ports: Readonly<Partial<Record<OutputPortKey, Items | ReadonlyArray<JsonNonArray>>>>): PortsEmission;
|
|
1240
|
+
declare function isPortsEmission(value: unknown): value is PortsEmission;
|
|
1241
|
+
declare function isUnbrandedPortsEmissionShape(value: unknown): value is Readonly<{
|
|
1242
|
+
ports: unknown;
|
|
1161
1243
|
}>;
|
|
1162
|
-
|
|
1244
|
+
//#endregion
|
|
1245
|
+
//#region src/contracts/itemMeta.d.ts
|
|
1246
|
+
/**
|
|
1247
|
+
* Reads `meta._cm.originIndex` when present (used for fan-in merge-by-origin and Merge routing).
|
|
1248
|
+
*/
|
|
1249
|
+
declare function getOriginIndexFromItem(item: Item): number | undefined;
|
|
1250
|
+
//#endregion
|
|
1251
|
+
//#region src/contracts/itemValue.d.ts
|
|
1252
|
+
declare const ITEM_VALUE_BRAND: unique symbol;
|
|
1253
|
+
type ItemValueResolvedContext = Readonly<{
|
|
1254
|
+
runId: RunId;
|
|
1163
1255
|
workflowId: WorkflowId;
|
|
1164
1256
|
nodeId: NodeId;
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
type CredentialBinding = Readonly<{
|
|
1168
|
-
key: CredentialBindingKey;
|
|
1169
|
-
instanceId: CredentialInstanceId;
|
|
1170
|
-
updatedAt: string;
|
|
1171
|
-
}>;
|
|
1172
|
-
type CredentialHealth = Readonly<{
|
|
1173
|
-
status: CredentialHealthStatus;
|
|
1174
|
-
message?: string;
|
|
1175
|
-
testedAt?: string;
|
|
1176
|
-
expiresAt?: string;
|
|
1177
|
-
details?: Readonly<Record<string, unknown>>;
|
|
1178
|
-
}>;
|
|
1179
|
-
type OAuth2ProviderFromPublicConfig = Readonly<{
|
|
1180
|
-
authorizeUrlFieldKey: string;
|
|
1181
|
-
tokenUrlFieldKey: string;
|
|
1182
|
-
userInfoUrlFieldKey?: string;
|
|
1183
|
-
}>;
|
|
1184
|
-
type CredentialOAuth2AuthDefinition = Readonly<{
|
|
1185
|
-
kind: "oauth2";
|
|
1186
|
-
providerId: string;
|
|
1187
|
-
scopes: ReadonlyArray<string>;
|
|
1188
|
-
clientIdFieldKey?: string;
|
|
1189
|
-
clientSecretFieldKey?: string;
|
|
1190
|
-
} | {
|
|
1191
|
-
kind: "oauth2";
|
|
1192
|
-
providerFromPublicConfig: OAuth2ProviderFromPublicConfig;
|
|
1193
|
-
scopes: ReadonlyArray<string>;
|
|
1194
|
-
clientIdFieldKey?: string;
|
|
1195
|
-
clientSecretFieldKey?: string;
|
|
1196
|
-
}>;
|
|
1197
|
-
type CredentialAuthDefinition = CredentialOAuth2AuthDefinition;
|
|
1198
|
-
type CredentialTypeDefinition = Readonly<{
|
|
1199
|
-
typeId: CredentialTypeId;
|
|
1200
|
-
displayName: string;
|
|
1201
|
-
description?: string;
|
|
1202
|
-
publicFields?: ReadonlyArray<CredentialFieldSchema>;
|
|
1203
|
-
secretFields?: ReadonlyArray<CredentialFieldSchema>;
|
|
1204
|
-
supportedSourceKinds?: ReadonlyArray<CredentialMaterialSourceKind>;
|
|
1205
|
-
auth?: CredentialAuthDefinition;
|
|
1257
|
+
activationId: NodeActivationId;
|
|
1258
|
+
data: RunDataSnapshot;
|
|
1206
1259
|
}>;
|
|
1207
1260
|
/**
|
|
1208
|
-
*
|
|
1209
|
-
*/
|
|
1210
|
-
type CredentialJsonRecord = Readonly<Record<string, unknown>>;
|
|
1211
|
-
/**
|
|
1212
|
-
* Persisted credential instance with typed `publicConfig`.
|
|
1213
|
-
* Hosts may specialize `secretRef` with a stricter union while remaining
|
|
1214
|
-
* assignable here for session/test callbacks.
|
|
1261
|
+
* Context aligned with former {@link ItemInputMapperContext} — use **`data`** to read any completed upstream node.
|
|
1215
1262
|
*/
|
|
1216
|
-
type
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
secretRef: CredentialJsonRecord;
|
|
1223
|
-
tags: ReadonlyArray<string>;
|
|
1224
|
-
setupStatus: CredentialSetupStatus;
|
|
1225
|
-
createdAt: string;
|
|
1226
|
-
updatedAt: string;
|
|
1263
|
+
type ItemValueContext = ItemValueResolvedContext;
|
|
1264
|
+
type ItemValueArgs<TItemJson = unknown> = Readonly<{
|
|
1265
|
+
item: Item<TItemJson>;
|
|
1266
|
+
itemIndex: number;
|
|
1267
|
+
items: Items<TItemJson>;
|
|
1268
|
+
ctx: ItemValueContext;
|
|
1227
1269
|
}>;
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
*/
|
|
1233
|
-
type CredentialSessionFactoryArgs<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord> = Readonly<{
|
|
1234
|
-
instance: CredentialInstanceRecord<TPublicConfig>;
|
|
1235
|
-
material: TMaterial;
|
|
1236
|
-
publicConfig: TPublicConfig;
|
|
1270
|
+
type ItemValueCallback<T, TItemJson = unknown> = (args: ItemValueArgs<TItemJson>) => T | Promise<T>;
|
|
1271
|
+
type ItemValue<T, TItemJson = unknown> = Readonly<{
|
|
1272
|
+
readonly [ITEM_VALUE_BRAND]: true;
|
|
1273
|
+
readonly fn: ItemValueCallback<T, TItemJson>;
|
|
1237
1274
|
}>;
|
|
1238
|
-
|
|
1239
|
-
|
|
1275
|
+
declare function itemValue<T, TItemJson = unknown>(fn: ItemValueCallback<T, TItemJson>): ItemValue<T, TItemJson>;
|
|
1276
|
+
declare function isItemValue<T, TItemJson = unknown>(value: unknown): value is ItemValue<T, TItemJson>;
|
|
1240
1277
|
/**
|
|
1241
|
-
*
|
|
1242
|
-
* Use this at registration and config boundaries; `CredentialTypeDefinition` is only the schema slice.
|
|
1278
|
+
* Deep-resolves {@link itemValue} leaves. Returns a new graph (does not mutate the original config object).
|
|
1243
1279
|
*/
|
|
1244
|
-
|
|
1245
|
-
definition: CredentialTypeDefinition;
|
|
1246
|
-
createSession: CredentialSessionFactory<TPublicConfig, TMaterial, TSession>;
|
|
1247
|
-
test: CredentialHealthTester<TPublicConfig, TMaterial>;
|
|
1248
|
-
}>;
|
|
1280
|
+
declare function resolveItemValuesInUnknown(value: unknown, args: ItemValueArgs, seen?: WeakSet<object>): Promise<unknown>;
|
|
1249
1281
|
/**
|
|
1250
|
-
*
|
|
1251
|
-
* and anywhere a concrete `CredentialType<YourPublic, YourMaterial, YourSession>` is placed in a heterogeneous list.
|
|
1252
|
-
* Using `any` here avoids unsafe `as` casts while keeping typed `satisfies CredentialType<…>` definitions.
|
|
1282
|
+
* Clones runnable config (best-effort) so per-item {@link itemValue} resolution never mutates shared instances.
|
|
1253
1283
|
*/
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
slotKey: string;
|
|
1260
|
-
}>): Promise<TSession>;
|
|
1284
|
+
declare function resolveItemValuesForExecution(config: unknown, nodeCtx: NodeExecutionContext, item: Item, itemIndex: number, items: Items): Promise<unknown | undefined>;
|
|
1285
|
+
//#endregion
|
|
1286
|
+
//#region src/contracts/NoRetryPolicy.d.ts
|
|
1287
|
+
declare class NoRetryPolicy implements NoneRetryPolicySpec {
|
|
1288
|
+
readonly kind: "none";
|
|
1261
1289
|
}
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1290
|
+
//#endregion
|
|
1291
|
+
//#region src/contracts/RetryPolicy.d.ts
|
|
1292
|
+
declare class RetryPolicy implements FixedRetryPolicySpec {
|
|
1293
|
+
readonly maxAttempts: number;
|
|
1294
|
+
readonly delayMs: number;
|
|
1295
|
+
readonly kind: "fixed";
|
|
1296
|
+
constructor(maxAttempts: number, delayMs: number);
|
|
1297
|
+
/** Default for HTTP-style transient failures: 3 tries, 1s between attempts. */
|
|
1298
|
+
static readonly defaultForHttp: FixedRetryPolicySpec;
|
|
1299
|
+
/** Default for LLM / agent calls: 3 tries, 2s fixed backoff. */
|
|
1300
|
+
static readonly defaultForAiAgent: FixedRetryPolicySpec;
|
|
1265
1301
|
}
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1302
|
+
//#endregion
|
|
1303
|
+
//#region src/contracts/ExpRetryPolicy.d.ts
|
|
1304
|
+
declare class ExpRetryPolicy implements ExponentialRetryPolicySpec {
|
|
1305
|
+
readonly maxAttempts: number;
|
|
1306
|
+
readonly initialDelayMs: number;
|
|
1307
|
+
readonly multiplier: number;
|
|
1308
|
+
readonly maxDelayMs?: number | undefined;
|
|
1309
|
+
readonly jitter?: boolean | undefined;
|
|
1310
|
+
readonly kind: "exponential";
|
|
1311
|
+
constructor(maxAttempts: number, initialDelayMs: number, multiplier: number, maxDelayMs?: number | undefined, jitter?: boolean | undefined);
|
|
1271
1312
|
}
|
|
1272
1313
|
//#endregion
|
|
1273
1314
|
//#region src/contracts/executionPersistenceContracts.d.ts
|
|
@@ -1437,17 +1478,17 @@ declare class RunFinishedAtFactory {
|
|
|
1437
1478
|
}
|
|
1438
1479
|
//#endregion
|
|
1439
1480
|
//#region src/workflow/dsl/workflowBuilderTypes.d.ts
|
|
1440
|
-
type AnyRunnableNodeConfig = RunnableNodeConfig<any, any
|
|
1481
|
+
type AnyRunnableNodeConfig = RunnableNodeConfig<any, any>;
|
|
1441
1482
|
type AnyTriggerNodeConfig = TriggerNodeConfig<any>;
|
|
1442
|
-
type ValidStepSequence<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TSteps extends readonly [] ? readonly [] : TSteps extends readonly [infer TFirst, ...infer TRest] ? TFirst extends RunnableNodeConfig<
|
|
1443
|
-
type StepSequenceOutput<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined> = TSteps extends ReadonlyArray<AnyRunnableNodeConfig> ? TSteps extends readonly [] ? TCurrentJson : TSteps extends readonly [infer TFirst, ...infer TRest] ? TFirst extends RunnableNodeConfig<
|
|
1483
|
+
type ValidStepSequence<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TSteps extends readonly [] ? readonly [] : TSteps extends readonly [infer TFirst, ...infer TRest] ? TFirst extends RunnableNodeConfig<TCurrentJson, infer TNextJson> ? TRest extends ReadonlyArray<AnyRunnableNodeConfig> ? readonly [TFirst, ...ValidStepSequence<TNextJson, TRest>] : never : never : TSteps;
|
|
1484
|
+
type StepSequenceOutput<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined> = TSteps extends ReadonlyArray<AnyRunnableNodeConfig> ? TSteps extends readonly [] ? TCurrentJson : TSteps extends readonly [infer TFirst, ...infer TRest] ? TFirst extends RunnableNodeConfig<TCurrentJson, infer TNextJson> ? TRest extends ReadonlyArray<AnyRunnableNodeConfig> ? StepSequenceOutput<TNextJson, TRest> : never : never : TCurrentJson : TCurrentJson;
|
|
1444
1485
|
type TypesMatch<TLeft, TRight> = [TLeft] extends [TRight] ? ([TRight] extends [TLeft] ? true : false) : false;
|
|
1445
1486
|
type BranchOutputGuard<TCurrentJson, TTrueSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined, TFalseSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined> = TypesMatch<StepSequenceOutput<TCurrentJson, TTrueSteps>, StepSequenceOutput<TCurrentJson, TFalseSteps>> extends true ? unknown : never;
|
|
1446
1487
|
type BranchStepsArg<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TSteps & ValidStepSequence<TCurrentJson, TSteps>;
|
|
1447
|
-
type BranchMoreArgs<TCurrentJson, TFirstStep extends RunnableNodeConfig<
|
|
1488
|
+
type BranchMoreArgs<TCurrentJson, TFirstStep extends RunnableNodeConfig<TCurrentJson, any>, TRestSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TRestSteps & ValidStepSequence<RunnableNodeOutputJson<TFirstStep>, TRestSteps>;
|
|
1448
1489
|
type BooleanWhenOverloads<TCurrentJson, TReturn> = {
|
|
1449
1490
|
<TSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(branch: boolean, steps: BranchStepsArg<TCurrentJson, TSteps>): TReturn;
|
|
1450
|
-
<TFirstStep extends RunnableNodeConfig<
|
|
1491
|
+
<TFirstStep extends RunnableNodeConfig<TCurrentJson, any>, TRestSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(branch: boolean, step: TFirstStep, ...more: BranchMoreArgs<TCurrentJson, TFirstStep, TRestSteps>): TReturn;
|
|
1451
1492
|
};
|
|
1452
1493
|
//#endregion
|
|
1453
1494
|
//#region src/workflow/dsl/WhenBuilder.d.ts
|
|
@@ -1462,6 +1503,11 @@ declare class WhenBuilder<TCurrentJson> {
|
|
|
1462
1503
|
}
|
|
1463
1504
|
//#endregion
|
|
1464
1505
|
//#region src/workflow/dsl/ChainCursorResolver.d.ts
|
|
1506
|
+
type ChainCursorEndpoint = Readonly<{
|
|
1507
|
+
node: NodeRef;
|
|
1508
|
+
output: OutputPortKey;
|
|
1509
|
+
inputPortHint?: InputPortKey;
|
|
1510
|
+
}>;
|
|
1465
1511
|
type ChainCursorWhenOverloads<TCurrentJson> = BooleanWhenOverloads<TCurrentJson, WhenBuilder<TCurrentJson>> & {
|
|
1466
1512
|
<TTrueSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined, TFalseSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined>(branches: Readonly<{
|
|
1467
1513
|
true?: TTrueSteps extends ReadonlyArray<AnyRunnableNodeConfig> ? BranchStepsArg<TCurrentJson, TTrueSteps> : never;
|
|
@@ -1470,12 +1516,14 @@ type ChainCursorWhenOverloads<TCurrentJson> = BooleanWhenOverloads<TCurrentJson,
|
|
|
1470
1516
|
};
|
|
1471
1517
|
declare class ChainCursor<TCurrentJson> {
|
|
1472
1518
|
private readonly wf;
|
|
1473
|
-
private readonly
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1519
|
+
private readonly endpoints;
|
|
1520
|
+
constructor(wf: WorkflowBuilder, endpoints: ReadonlyArray<ChainCursorEndpoint>);
|
|
1521
|
+
then<TOutputJson$1, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson$1>>(config: TConfig): ChainCursor<RunnableNodeOutputJson<TConfig>>;
|
|
1522
|
+
thenIntoInputHints<TOutputJson$1, TConfig extends RunnableNodeConfig<any, TOutputJson$1>>(config: TConfig): ChainCursor<RunnableNodeOutputJson<TConfig>>;
|
|
1477
1523
|
readonly when: ChainCursorWhenOverloads<TCurrentJson>;
|
|
1524
|
+
route<TNextJson$1>(branches: Readonly<Record<OutputPortKey, (branch: ChainCursor<TCurrentJson>) => ChainCursor<TNextJson$1> | undefined>>): ChainCursor<TNextJson$1>;
|
|
1478
1525
|
build(): WorkflowDefinition;
|
|
1526
|
+
private resolveSharedInputPortHint;
|
|
1479
1527
|
}
|
|
1480
1528
|
//#endregion
|
|
1481
1529
|
//#region src/workflow/dsl/WorkflowBuilder.d.ts
|
|
@@ -1488,9 +1536,7 @@ declare class WorkflowBuilder {
|
|
|
1488
1536
|
constructor(meta: {
|
|
1489
1537
|
id: WorkflowId;
|
|
1490
1538
|
name: string;
|
|
1491
|
-
}, options?: Readonly<
|
|
1492
|
-
makeMergeNode?: (name: string) => AnyRunnableNodeConfig;
|
|
1493
|
-
}> | undefined);
|
|
1539
|
+
}, options?: Readonly<Record<string, never>> | undefined);
|
|
1494
1540
|
private add;
|
|
1495
1541
|
private connect;
|
|
1496
1542
|
trigger<TConfig extends AnyTriggerNodeConfig>(config: TConfig): ChainCursor<TriggerNodeOutputJson<TConfig>>;
|
|
@@ -1837,5 +1883,5 @@ declare class RunIntentService {
|
|
|
1837
1883
|
private createWebhookExecutionOptions;
|
|
1838
1884
|
}
|
|
1839
1885
|
//#endregion
|
|
1840
|
-
export {
|
|
1841
|
-
//# sourceMappingURL=RunIntentService-
|
|
1886
|
+
export { ItemValueResolvedContext as $, RunEventSubscription as $i, PreparedNodeActivationDispatch as $n, RunStatus as $r, UpstreamRefPlaceholder as $t, ExecutionInstanceDto as A, Container as Ai, EngineDeps as An, ExecutionFrontierPlan as Ar, NodeErrorHandlerArgs as At, RunSlotProjectionState as B, injectAll as Bi, NodeActivationReceipt as Bn, PersistedRunState as Br, ParentExecutionRef as Bt, BranchOutputGuard as C, CredentialSetupStatus as Ci, BinaryAttachmentCreateRequest as Cn, AllWorkflowsActiveWorkflowActivationPolicy as Cr, LineageCarryPolicy as Ct, RunFinishedAtFactory as D, CredentialTypeRegistry as Di, BinaryStorageStatResult as Dn, ConnectionInvocationRecord as Dr, NodeConnectionName as Dt, ValidStepSequence as E, CredentialTypeId as Ei, BinaryStorageReadResult as En, ConnectionInvocationId as Er, NodeConfigBase as Et, PersistedExecutionInstanceRecord as F, RegistrationOptions as Fi, ExecutionContextFactory as Fn, PendingNodeExecution as Fr, NodeOutputs as Ft, WorkflowRunDetailDto as G, registry as Gi, NodeExecutionContext as Gn, RunCompletionNotifier as Gr, RunId as Gt, WorkItemId as H, instanceCachingFactory as Hi, NodeActivationRequestBase as Hn, PersistedWorkflowSnapshotNode as Hr, PersistedTokenId as Ht, PersistedRunSlotProjectionRecord as I, TypeToken as Ii, ItemNode as In, PersistedMutableNodeState as Ir, NodeRef as It, NoRetryPolicy as J, ENGINE_EXECUTION_LIMITS_DEFAULTS as Ji, NodeExecutionScheduler as Jn, RunExecutionOptions as Jr, RunnableNodeInputJson as Jt, ExpRetryPolicy as K, singleton as Ki, NodeExecutionRequest as Kn, RunCurrentState as Kr, RunIdFactory as Kt, PersistedRunWorkItemKind as L, container$1 as Li, LiveWorkflowRepository as Ln, PersistedMutableRunState as Lr, NodeSchedulerDecision as Lt, ExecutionPayloadPolicyFields as M, Disposable as Mi, ExecutableTriggerNode as Mn, NodeExecutionSnapshot as Mr, NodeId as Mt, PayloadStorageKind as N, InjectionToken$1 as Ni, ExecutionBinaryService as Nn, NodeExecutionStatus as Nr, NodeKind as Nt, BatchId as O, CredentialUnboundError as Oi, BinaryStorageWriteRequest as On, CurrentStateExecutionRequest as Or, NodeDefinition as Ot, PersistedExecutionInstanceKind as P, Lifecycle as Pi, ExecutionContext as Pn, NodeInputsByPort as Pr, NodeOffloadPolicy as Pt, ItemValueContext as Q, RunEventBus as Qi, PersistedTriggerSetupState as Qn, RunStateResetRequest as Qr, TriggerNodeSetupState as Qt, PersistedRunWorkItemRecord as R, delay as Ri, MultiInputNode as Rn, PersistedRunControlState as Rr, OutputPortKey as Rt, BranchMoreArgs as S, CredentialSessionService as Si, RetryPolicySpec as Sn, WebhookTriggerRoutingDiagnostics as Sr, JsonValue as St, StepSequenceOutput as T, CredentialTypeDefinition as Ti, BinaryStorage as Tn, ConnectionInvocationAppendArgs as Tr, NodeActivationId as Tt, WorkItemStatus as U, instancePerContainerCachingFactory as Ui, NodeActivationScheduler as Un, PersistedWorkflowTokenRegistryLike as Ur, RunDataFactory as Ut, SlotExecutionStateDto as V, injectable as Vi, NodeActivationRequest as Vn, PersistedWorkflowSnapshot as Vr, PersistedRunPolicySnapshot as Vt, WorkflowDetailSelectionState as W, predicateAwareClassFactory as Wi, NodeBinaryAttachmentService as Wn, PinnedNodeOutputsByPort as Wr, RunDataSnapshot as Wt, ItemValueArgs as X, EngineExecutionLimitsPolicyConfig as Xi, NodeExecutor as Xn, RunQueueEntry as Xr, TriggerNodeConfig as Xt, ItemValue as Y, EngineExecutionLimitsPolicy as Yi, NodeExecutionStatePublisher as Yn, RunPruneCandidate as Yr, RunnableNodeOutputJson as Yt, ItemValueCallback as Z, RunEvent as Zi, NodeResolver as Zn, RunResult as Zr, TriggerNodeOutputJson as Zt, ChainCursor as _, CredentialMaterialSourceKind as _i, triggerNodeOutputType as _n, TriggerInstanceId as _r, Items as _t, RunTerminalPersistenceCoordinator as a, WorkflowExecutionRepository as ai, WorkflowGraphFactory as an, TriggerRuntimeDiagnostics as ar, PortsEmission as at, AnyTriggerNodeConfig as b, CredentialSessionFactory as bi, FixedRetryPolicySpec as bn, WebhookTriggerMatcher as br, JsonObject as bt, EngineExecutionLimitsPolicyFactory as c, CredentialBinding as ci, WorkflowPolicyRuntimeDefaults as cn, TriggerSetupStateRepository as cr, isUnbrandedPortsEmissionShape as ct, DefaultWorkflowGraphFactory as d, CredentialHealth as di, WorkflowStoragePolicyMode as dn, WorkflowRepository as dr, BinaryPreviewKind as dt, RunStopCondition as ei, WorkflowDefinition as en, RunnableNode as er, isItemValue as et, WorkflowExecutableNodeClassifierFactory as f, CredentialHealthStatus as fi, WorkflowStoragePolicyResolver as fn, WorkflowRunnerResolver as fr, Edge as ft, WorkflowBuilder as g, CredentialJsonRecord as gi, runnableNodeOutputType as gn, HttpMethod as gr, ItemBinary as gt, ConnectionInvocationIdFactory as h, CredentialInstanceRecord as hi, runnableNodeInputType as hn, WorkflowSnapshotResolver as hr, Item as ht, WorkflowPolicyErrorServices as i, WorkflowExecutionPruneRepository as ii, WorkflowGraph as in, TriggerNode as ir, getOriginIndexFromItem as it, ExecutionInstanceId as j, DependencyContainer$1 as ji, EngineHost as jn, NodeExecutionError as jr, NodeErrorHandlerSpec as jt, ConnectionInvocationKind as k, OAuth2ProviderFromPublicConfig as ki, BinaryStorageWriteResult as kn, EngineRunCounters as kr, NodeErrorHandler as kt, WorkflowSnapshotCodec as l, CredentialBindingKey as li, WorkflowPrunePolicySpec as ln, TriggerTestItemsContext as lr, ActivationIdFactory as lt, ConnectionNodeIdFactory as m, CredentialInstanceId as mi, branchRef as mn, WorkflowSnapshotFactory as mr, InputPortKey as mt, InMemoryLiveWorkflowRepository as n, WebhookRunResult as ni, WorkflowErrorHandler as nn, TestableTriggerNode as nr, resolveItemValuesForExecution as nt, WorkflowStoragePolicyEvaluator as o, AnyCredentialType as oi, WorkflowId as on, TriggerSetupContext as or, emitPorts as ot, WorkflowExecutableNodeClassifier as p, CredentialHealthTester as pi, WorkflowStoragePolicySpec as pn, WorkflowRunnerService as pr, ExecutionMode as pt, RetryPolicy as q, CoreTokens as qi, NodeExecutionRequestHandler as qn, RunEventPublisherDeps as qr, RunnableNodeConfig as qt, EngineWorkflowRunnerService as r, WorkflowExecutionListingRepository as ri, WorkflowErrorHandlerSpec as rn, TriggerCleanupHandle as rr, resolveItemValuesInUnknown as rt, RunPolicySnapshotFactory as s, CredentialAuthDefinition as si, WorkflowNodeConnection as sn, TriggerSetupStateFor as sr, isPortsEmission as st, RunIntentService as t, RunSummary as ti, WorkflowErrorContext as tn, RunnableNodeExecuteArgs as tr, itemValue as tt, Engine as u, CredentialFieldSchema as ui, WorkflowStoragePolicyDecisionArgs as un, WorkflowNodeInstanceFactory as ur, BinaryAttachment as ut, WhenBuilder as v, CredentialOAuth2AuthDefinition as vi, triggerNodeSetupStateType as vn, WebhookControlSignal as vr, JsonArray as vt, BranchStepsArg as w, CredentialType as wi, BinaryBody as wn, WorkflowActivationPolicy as wr, MutableRunData as wt, BooleanWhenOverloads as x, CredentialSessionFactoryArgs as xi, NoneRetryPolicySpec as xn, WebhookTriggerResolution as xr, JsonPrimitive as xt, AnyRunnableNodeConfig as y, CredentialRequirement as yi, ExponentialRetryPolicySpec as yn, WebhookInvocationMatch as yr, JsonNonArray as yt, RunRevision as z, inject as zi, NodeActivationContinuation as zn, PersistedRunSchedulingState as zr, PairedItemRef as zt };
|
|
1887
|
+
//# sourceMappingURL=RunIntentService-zbTchO9T.d.ts.map
|