@codemation/core-nodes 0.0.25 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/index.cjs +267 -141
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +260 -140
- package/dist/index.d.ts +260 -140
- package/dist/index.js +256 -137
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
- package/src/index.ts +1 -0
- package/src/nodes/AIAgentConfig.ts +5 -10
- package/src/nodes/AIAgentNode.ts +7 -11
- package/src/nodes/AggregateNode.ts +6 -7
- package/src/nodes/CallbackNode.ts +18 -6
- package/src/nodes/CallbackNodeFactory.ts +31 -4
- package/src/nodes/CallbackResultNormalizerFactory.ts +7 -3
- package/src/nodes/ConnectionCredentialNode.ts +4 -4
- package/src/nodes/FilterNode.ts +6 -10
- package/src/nodes/HttpRequestNodeFactory.ts +4 -8
- package/src/nodes/IfNode.ts +15 -27
- package/src/nodes/MapDataNode.ts +3 -9
- package/src/nodes/NoOpNode.ts +4 -4
- package/src/nodes/NodeBackedToolRuntime.ts +40 -8
- package/src/nodes/SplitNode.ts +5 -15
- package/src/nodes/SubWorkflowNode.ts +43 -45
- package/src/nodes/SwitchNode.ts +29 -0
- package/src/nodes/WaitNode.ts +11 -9
- package/src/nodes/if.ts +1 -0
- package/src/nodes/mergeExecutionUtils.types.ts +31 -5
- package/src/nodes/switch.ts +33 -0
- package/src/register.types.ts +2 -0
- package/src/workflowAuthoring/WorkflowBranchBuilder.types.ts +108 -2
- package/src/workflowAuthoring/WorkflowChain.types.ts +207 -2
- package/src/workflowBuilder.types.ts +1 -4
package/dist/index.d.cts
CHANGED
|
@@ -14,6 +14,38 @@ import { DynamicStructuredTool } from "@langchain/core/tools";
|
|
|
14
14
|
*/
|
|
15
15
|
type CanvasIconName = string;
|
|
16
16
|
//#endregion
|
|
17
|
+
//#region ../core/src/contracts/emitPorts.d.ts
|
|
18
|
+
declare const EMIT_PORTS_BRAND: unique symbol;
|
|
19
|
+
type PortsEmission = Readonly<{
|
|
20
|
+
readonly [EMIT_PORTS_BRAND]: true;
|
|
21
|
+
readonly ports: Readonly<Partial<Record<OutputPortKey, Items | ReadonlyArray<JsonNonArray>>>>;
|
|
22
|
+
}>;
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region ../core/src/contracts/itemValue.d.ts
|
|
25
|
+
declare const ITEM_VALUE_BRAND: unique symbol;
|
|
26
|
+
type ItemValueResolvedContext = Readonly<{
|
|
27
|
+
runId: RunId;
|
|
28
|
+
workflowId: WorkflowId;
|
|
29
|
+
nodeId: NodeId;
|
|
30
|
+
activationId: NodeActivationId;
|
|
31
|
+
data: RunDataSnapshot;
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* Context aligned with former {@link ItemInputMapperContext} — use **`data`** to read any completed upstream node.
|
|
35
|
+
*/
|
|
36
|
+
type ItemValueContext = ItemValueResolvedContext;
|
|
37
|
+
type ItemValueArgs<TItemJson = unknown> = Readonly<{
|
|
38
|
+
item: Item<TItemJson>;
|
|
39
|
+
itemIndex: number;
|
|
40
|
+
items: Items<TItemJson>;
|
|
41
|
+
ctx: ItemValueContext;
|
|
42
|
+
}>;
|
|
43
|
+
type ItemValueCallback<T, TItemJson = unknown> = (args: ItemValueArgs<TItemJson>) => T | Promise<T>;
|
|
44
|
+
type ItemValue<T, TItemJson = unknown> = Readonly<{
|
|
45
|
+
readonly [ITEM_VALUE_BRAND]: true;
|
|
46
|
+
readonly fn: ItemValueCallback<T, TItemJson>;
|
|
47
|
+
}>;
|
|
48
|
+
//#endregion
|
|
17
49
|
//#region ../core/src/contracts/retryPolicySpec.types.d.ts
|
|
18
50
|
/**
|
|
19
51
|
* In-process retry policy for runnable nodes. Serialized configs use the same
|
|
@@ -43,7 +75,6 @@ interface ExponentialRetryPolicySpec {
|
|
|
43
75
|
}
|
|
44
76
|
//#endregion
|
|
45
77
|
//#region ../core/src/contracts/runTypes.d.ts
|
|
46
|
-
|
|
47
78
|
type NodeInputsByPort = Readonly<Record<InputPortKey, Items>>;
|
|
48
79
|
type NodeExecutionStatus = "pending" | "queued" | "running" | "completed" | "failed" | "skipped";
|
|
49
80
|
interface NodeExecutionError {
|
|
@@ -115,17 +146,17 @@ interface TriggerInstanceId {
|
|
|
115
146
|
}
|
|
116
147
|
//#endregion
|
|
117
148
|
//#region ../core/src/workflow/dsl/workflowBuilderTypes.d.ts
|
|
118
|
-
type AnyRunnableNodeConfig = RunnableNodeConfig<any, any
|
|
149
|
+
type AnyRunnableNodeConfig = RunnableNodeConfig<any, any>;
|
|
119
150
|
type AnyTriggerNodeConfig = TriggerNodeConfig<any>;
|
|
120
|
-
type ValidStepSequence<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TSteps extends readonly [] ? readonly [] : TSteps extends readonly [infer TFirst, ...infer TRest] ? TFirst extends RunnableNodeConfig<
|
|
121
|
-
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<
|
|
151
|
+
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;
|
|
152
|
+
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;
|
|
122
153
|
type TypesMatch<TLeft, TRight> = [TLeft] extends [TRight] ? ([TRight] extends [TLeft] ? true : false) : false;
|
|
123
154
|
type BranchOutputGuard<TCurrentJson, TTrueSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined, TFalseSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined> = TypesMatch<StepSequenceOutput<TCurrentJson, TTrueSteps>, StepSequenceOutput<TCurrentJson, TFalseSteps>> extends true ? unknown : never;
|
|
124
155
|
type BranchStepsArg<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TSteps & ValidStepSequence<TCurrentJson, TSteps>;
|
|
125
|
-
type BranchMoreArgs<TCurrentJson, TFirstStep extends RunnableNodeConfig<
|
|
156
|
+
type BranchMoreArgs<TCurrentJson, TFirstStep extends RunnableNodeConfig<TCurrentJson, any>, TRestSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TRestSteps & ValidStepSequence<RunnableNodeOutputJson<TFirstStep>, TRestSteps>;
|
|
126
157
|
type BooleanWhenOverloads<TCurrentJson, TReturn> = {
|
|
127
158
|
<TSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(branch: boolean, steps: BranchStepsArg<TCurrentJson, TSteps>): TReturn;
|
|
128
|
-
<TFirstStep extends RunnableNodeConfig<
|
|
159
|
+
<TFirstStep extends RunnableNodeConfig<TCurrentJson, any>, TRestSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(branch: boolean, step: TFirstStep, ...more: BranchMoreArgs<TCurrentJson, TFirstStep, TRestSteps>): TReturn;
|
|
129
160
|
};
|
|
130
161
|
//#endregion
|
|
131
162
|
//#region ../core/src/workflow/dsl/WhenBuilder.d.ts
|
|
@@ -140,6 +171,11 @@ declare class WhenBuilder<TCurrentJson> {
|
|
|
140
171
|
}
|
|
141
172
|
//#endregion
|
|
142
173
|
//#region ../core/src/workflow/dsl/ChainCursorResolver.d.ts
|
|
174
|
+
type ChainCursorEndpoint = Readonly<{
|
|
175
|
+
node: NodeRef;
|
|
176
|
+
output: OutputPortKey;
|
|
177
|
+
inputPortHint?: InputPortKey;
|
|
178
|
+
}>;
|
|
143
179
|
type ChainCursorWhenOverloads<TCurrentJson> = BooleanWhenOverloads<TCurrentJson, WhenBuilder<TCurrentJson>> & {
|
|
144
180
|
<TTrueSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined, TFalseSteps extends ReadonlyArray<AnyRunnableNodeConfig> | undefined>(branches: Readonly<{
|
|
145
181
|
true?: TTrueSteps extends ReadonlyArray<AnyRunnableNodeConfig> ? BranchStepsArg<TCurrentJson, TTrueSteps> : never;
|
|
@@ -148,12 +184,14 @@ type ChainCursorWhenOverloads<TCurrentJson> = BooleanWhenOverloads<TCurrentJson,
|
|
|
148
184
|
};
|
|
149
185
|
declare class ChainCursor<TCurrentJson> {
|
|
150
186
|
private readonly wf;
|
|
151
|
-
private readonly
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
187
|
+
private readonly endpoints;
|
|
188
|
+
constructor(wf: WorkflowBuilder, endpoints: ReadonlyArray<ChainCursorEndpoint>);
|
|
189
|
+
then<TOutputJson$1, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson$1>>(config: TConfig): ChainCursor<RunnableNodeOutputJson<TConfig>>;
|
|
190
|
+
thenIntoInputHints<TOutputJson$1, TConfig extends RunnableNodeConfig<any, TOutputJson$1>>(config: TConfig): ChainCursor<RunnableNodeOutputJson<TConfig>>;
|
|
155
191
|
readonly when: ChainCursorWhenOverloads<TCurrentJson>;
|
|
192
|
+
route<TNextJson$1>(branches: Readonly<Record<OutputPortKey, (branch: ChainCursor<TCurrentJson>) => ChainCursor<TNextJson$1> | undefined>>): ChainCursor<TNextJson$1>;
|
|
156
193
|
build(): WorkflowDefinition;
|
|
194
|
+
private resolveSharedInputPortHint;
|
|
157
195
|
}
|
|
158
196
|
//#endregion
|
|
159
197
|
//#region ../core/src/workflow/dsl/WorkflowBuilder.d.ts
|
|
@@ -166,9 +204,7 @@ declare class WorkflowBuilder {
|
|
|
166
204
|
constructor(meta: {
|
|
167
205
|
id: WorkflowId;
|
|
168
206
|
name: string;
|
|
169
|
-
}, options?: Readonly<
|
|
170
|
-
makeMergeNode?: (name: string) => AnyRunnableNodeConfig;
|
|
171
|
-
}> | undefined);
|
|
207
|
+
}, options?: Readonly<Record<string, never>> | undefined);
|
|
172
208
|
private add;
|
|
173
209
|
private connect;
|
|
174
210
|
trigger<TConfig extends AnyTriggerNodeConfig>(config: TConfig): ChainCursor<TriggerNodeOutputJson<TConfig>>;
|
|
@@ -274,31 +310,39 @@ interface TriggerTestItemsContext<TConfig extends TriggerNodeConfig<any, any> =
|
|
|
274
310
|
interface TriggerCleanupHandle {
|
|
275
311
|
stop(): Promise<void> | void;
|
|
276
312
|
}
|
|
277
|
-
interface Node<TConfig extends NodeConfigBase = NodeConfigBase> {
|
|
278
|
-
kind: "node";
|
|
279
|
-
outputPorts: ReadonlyArray<OutputPortKey>;
|
|
280
|
-
execute(items: Items, ctx: NodeExecutionContext<TConfig>): Promise<NodeOutputs>;
|
|
281
|
-
}
|
|
282
313
|
/**
|
|
283
|
-
*
|
|
284
|
-
* Engine applies
|
|
314
|
+
* Per-item runnable node: return JSON, an array to fan-out on `main`, or {@link emitPorts} for multi-port emission.
|
|
315
|
+
* Engine applies `inputSchema.parse(item.json)` and passes the result as `args.input` (wire `item.json` is unchanged).
|
|
285
316
|
*/
|
|
286
|
-
interface
|
|
317
|
+
interface RunnableNodeExecuteArgs<TConfig extends RunnableNodeConfig<any, any> = RunnableNodeConfig<any, any>, TInputJson$1 = unknown> {
|
|
318
|
+
readonly input: TInputJson$1;
|
|
319
|
+
readonly item: Item;
|
|
320
|
+
readonly itemIndex: number;
|
|
321
|
+
readonly items: Items;
|
|
322
|
+
readonly ctx: NodeExecutionContext<TConfig>;
|
|
323
|
+
}
|
|
324
|
+
interface RunnableNode<TConfig extends RunnableNodeConfig<any, any> = RunnableNodeConfig<any, any>, TInputJson$1 = unknown, _TOutputJson = unknown> {
|
|
287
325
|
readonly kind: "node";
|
|
288
|
-
|
|
326
|
+
/**
|
|
327
|
+
* Declared output ports (e.g. `["main"]`).
|
|
328
|
+
*
|
|
329
|
+
* Prefer describing dynamic router ports (Switch) and fixed multi-ports (If true/false)
|
|
330
|
+
* via {@link NodeConfigBase.declaredOutputPorts}. Engine defaults to `["main"]` when omitted.
|
|
331
|
+
*/
|
|
332
|
+
readonly outputPorts?: ReadonlyArray<OutputPortKey>;
|
|
289
333
|
/** When omitted, engine uses {@link RunnableNodeConfig.inputSchema} or `z.unknown()`. */
|
|
290
334
|
readonly inputSchema?: ZodType<TInputJson$1>;
|
|
291
|
-
|
|
292
|
-
input: TInputJson$1;
|
|
293
|
-
item: Item;
|
|
294
|
-
itemIndex: number;
|
|
295
|
-
items: Items;
|
|
296
|
-
ctx: NodeExecutionContext<TConfig>;
|
|
297
|
-
}>): Promise<TOutputJson$1> | TOutputJson$1;
|
|
335
|
+
execute(args: RunnableNodeExecuteArgs<TConfig, TInputJson$1>): Promise<unknown> | unknown;
|
|
298
336
|
}
|
|
299
337
|
interface MultiInputNode<TConfig extends NodeConfigBase = NodeConfigBase> {
|
|
300
338
|
kind: "node";
|
|
301
|
-
|
|
339
|
+
/**
|
|
340
|
+
* Declared output ports (typically `["main"]`).
|
|
341
|
+
*
|
|
342
|
+
* Prefer describing ports for authoring/canvas via {@link NodeConfigBase.declaredOutputPorts}.
|
|
343
|
+
* Engine defaults to `["main"]` when omitted.
|
|
344
|
+
*/
|
|
345
|
+
outputPorts?: ReadonlyArray<OutputPortKey>;
|
|
302
346
|
executeMulti(inputsByPort: NodeInputsByPort, ctx: NodeExecutionContext<TConfig>): Promise<NodeOutputs>;
|
|
303
347
|
}
|
|
304
348
|
type TriggerSetupStateFor<TConfig extends TriggerNodeConfig<any, any>> = TriggerNodeSetupState<TConfig>;
|
|
@@ -325,6 +369,8 @@ interface JsonObject {
|
|
|
325
369
|
}
|
|
326
370
|
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
327
371
|
type JsonArray = ReadonlyArray<JsonValue>;
|
|
372
|
+
/** JSON value that is not a top-level array (nested arrays inside objects are allowed). */
|
|
373
|
+
type JsonNonArray = JsonPrimitive | JsonObject;
|
|
328
374
|
interface Edge {
|
|
329
375
|
from: {
|
|
330
376
|
nodeId: NodeId;
|
|
@@ -385,65 +431,42 @@ interface NodeConfigBase {
|
|
|
385
431
|
* main batches skip downstream execution and propagate the empty path.
|
|
386
432
|
*/
|
|
387
433
|
readonly continueWhenEmptyOutput?: boolean;
|
|
434
|
+
/**
|
|
435
|
+
* Declared I/O port names for canvas authoring (unioned with ports inferred from edges).
|
|
436
|
+
* Use for dynamic routers (Switch) and future error ports.
|
|
437
|
+
*/
|
|
438
|
+
readonly declaredOutputPorts?: ReadonlyArray<OutputPortKey>;
|
|
439
|
+
readonly declaredInputPorts?: ReadonlyArray<InputPortKey>;
|
|
388
440
|
getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
|
|
389
441
|
}
|
|
390
442
|
declare const runnableNodeInputType: unique symbol;
|
|
391
443
|
declare const runnableNodeOutputType: unique symbol;
|
|
392
|
-
/** Phantom: JSON shape on the wire from upstream before {@link RunnableNodeConfig.mapInput}. */
|
|
393
|
-
declare const runnableNodeWireType: unique symbol;
|
|
394
444
|
declare const triggerNodeOutputType: unique symbol;
|
|
445
|
+
type LineageCarryPolicy = "emitOnly" | "carryThrough";
|
|
395
446
|
/**
|
|
396
|
-
*
|
|
397
|
-
*
|
|
398
|
-
* node’s outputs in this run (e.g. `ctx.data.getOutputItems(nodeIdA, "main")` while mapping at D), not only
|
|
399
|
-
* the immediate predecessor’s {@link ItemInputMapperArgs.item}.
|
|
400
|
-
*/
|
|
401
|
-
interface ItemInputMapperContext {
|
|
402
|
-
readonly runId: RunId;
|
|
403
|
-
readonly workflowId: WorkflowId;
|
|
404
|
-
/** Node whose activation is being prepared (the consumer of `mapInput`). */
|
|
405
|
-
readonly nodeId: NodeId;
|
|
406
|
-
readonly activationId: NodeActivationId;
|
|
407
|
-
readonly parent?: ParentExecutionRef;
|
|
408
|
-
readonly data: RunDataSnapshot;
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* Arguments for optional per-item input mapping applied by the engine before Zod validation.
|
|
447
|
+
* Runnable node: **`TInputJson`** is what **`inputSchema`** validates on **`item.json`** (the wire payload).
|
|
448
|
+
* **`TOutputJson`** is emitted `item.json` on outputs.
|
|
412
449
|
*/
|
|
413
|
-
interface
|
|
414
|
-
readonly item: Item<TWireJson$1>;
|
|
415
|
-
readonly itemIndex: number;
|
|
416
|
-
readonly items: Items<TWireJson$1>;
|
|
417
|
-
readonly ctx: ItemInputMapperContext;
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* Per-item mapper before Zod validation. Uses a **bivariant** method signature so concrete
|
|
421
|
-
* `ItemInputMapper<SpecificWire, TIn>` remains assignable to `RunnableNodeConfig` fields typed as
|
|
422
|
-
* `ItemInputMapper<unknown, unknown>` (same pattern as React-style callbacks).
|
|
423
|
-
*/
|
|
424
|
-
type ItemInputMapper<TWireJson$1 = unknown, TInputJson$1 = unknown> = {
|
|
425
|
-
bivarianceHack(args: ItemInputMapperArgs<TWireJson$1>): TInputJson$1 | Promise<TInputJson$1>;
|
|
426
|
-
}["bivarianceHack"];
|
|
427
|
-
/**
|
|
428
|
-
* Runnable node: **`TInputJson`** is the payload after `mapInput` (if any) + Zod validation — what {@link ItemNode}
|
|
429
|
-
* `executeOne` receives. **`TOutputJson`** is emitted `item.json` on outputs. **`TWireJson`** is `item.json` from
|
|
430
|
-
* upstream **before** `mapInput`; it defaults to **`TInputJson`** when there is no mapper or wire differs from execute input.
|
|
431
|
-
*/
|
|
432
|
-
interface RunnableNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown, TWireJson$1 = TInputJson$1> extends NodeConfigBase {
|
|
450
|
+
interface RunnableNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> extends NodeConfigBase {
|
|
433
451
|
readonly kind: "node";
|
|
434
452
|
readonly [runnableNodeInputType]?: TInputJson$1;
|
|
435
453
|
readonly [runnableNodeOutputType]?: TOutputJson$1;
|
|
436
|
-
readonly [runnableNodeWireType]?: TWireJson$1;
|
|
437
454
|
/**
|
|
438
|
-
* Optional Zod input contract for {@link
|
|
455
|
+
* Optional Zod input contract for {@link RunnableNode} when not set on the node class.
|
|
439
456
|
* Resolution order: node instance `inputSchema`, then config `inputSchema`, then `z.unknown()`.
|
|
440
457
|
*/
|
|
441
458
|
readonly inputSchema?: ZodType<TInputJson$1>;
|
|
442
459
|
/**
|
|
443
|
-
*
|
|
444
|
-
*
|
|
460
|
+
* Overrides default lineage propagation for `execute` outputs (binary/meta/paired).
|
|
461
|
+
* Routers with multiple {@link RunnableNode#outputPorts} default to **`carryThrough`**; others default to **`emitOnly`**.
|
|
462
|
+
*/
|
|
463
|
+
readonly lineageCarry?: LineageCarryPolicy;
|
|
464
|
+
/**
|
|
465
|
+
* When an activation receives **zero** input items, the engine normally runs `execute` zero times.
|
|
466
|
+
* Set to **`runOnce`** to run `execute` once with an empty `items` batch (and a synthetic wire item for schema parsing).
|
|
467
|
+
* Used by batch-style callback nodes (built-in `Callback`) so `callback([], ctx)` still runs.
|
|
445
468
|
*/
|
|
446
|
-
readonly
|
|
469
|
+
readonly emptyBatchExecution?: "skip" | "runOnce";
|
|
447
470
|
}
|
|
448
471
|
declare const triggerNodeSetupStateType: unique symbol;
|
|
449
472
|
interface TriggerNodeConfig<TOutputJson$1 = unknown, TSetupState$1 extends JsonValue | undefined = undefined> extends NodeConfigBase {
|
|
@@ -451,8 +474,8 @@ interface TriggerNodeConfig<TOutputJson$1 = unknown, TSetupState$1 extends JsonV
|
|
|
451
474
|
readonly [triggerNodeOutputType]?: TOutputJson$1;
|
|
452
475
|
readonly [triggerNodeSetupStateType]?: TSetupState$1;
|
|
453
476
|
}
|
|
454
|
-
type RunnableNodeInputJson<TConfig extends RunnableNodeConfig<any, any
|
|
455
|
-
type RunnableNodeOutputJson<TConfig extends RunnableNodeConfig<any, any
|
|
477
|
+
type RunnableNodeInputJson<TConfig extends RunnableNodeConfig<any, any>> = TConfig extends RunnableNodeConfig<infer TInputJson, any> ? TInputJson : never;
|
|
478
|
+
type RunnableNodeOutputJson<TConfig extends RunnableNodeConfig<any, any>> = TConfig extends RunnableNodeConfig<any, infer TOutputJson> ? TOutputJson : never;
|
|
456
479
|
type TriggerNodeOutputJson<TConfig extends TriggerNodeConfig<any, any>> = TConfig extends TriggerNodeConfig<infer TOutputJson, any> ? TOutputJson : never;
|
|
457
480
|
type TriggerNodeSetupState<TConfig extends TriggerNodeConfig<any, any>> = TConfig extends TriggerNodeConfig<any, infer TSetupState> ? TSetupState : never;
|
|
458
481
|
interface NodeDefinition {
|
|
@@ -603,16 +626,24 @@ type OAuth2ProviderFromPublicConfig = Readonly<{
|
|
|
603
626
|
tokenUrlFieldKey: string;
|
|
604
627
|
userInfoUrlFieldKey?: string;
|
|
605
628
|
}>;
|
|
629
|
+
type CredentialOAuth2ScopesFromPublicConfig = Readonly<{
|
|
630
|
+
presetFieldKey: string;
|
|
631
|
+
presetScopes: Readonly<Record<string, ReadonlyArray<string>>>;
|
|
632
|
+
customPresetKey?: string;
|
|
633
|
+
customScopesFieldKey?: string;
|
|
634
|
+
}>;
|
|
606
635
|
type CredentialOAuth2AuthDefinition = Readonly<{
|
|
607
636
|
kind: "oauth2";
|
|
608
637
|
providerId: string;
|
|
609
638
|
scopes: ReadonlyArray<string>;
|
|
639
|
+
scopesFromPublicConfig?: CredentialOAuth2ScopesFromPublicConfig;
|
|
610
640
|
clientIdFieldKey?: string;
|
|
611
641
|
clientSecretFieldKey?: string;
|
|
612
642
|
} | {
|
|
613
643
|
kind: "oauth2";
|
|
614
644
|
providerFromPublicConfig: OAuth2ProviderFromPublicConfig;
|
|
615
645
|
scopes: ReadonlyArray<string>;
|
|
646
|
+
scopesFromPublicConfig?: CredentialOAuth2ScopesFromPublicConfig;
|
|
616
647
|
clientIdFieldKey?: string;
|
|
617
648
|
clientSecretFieldKey?: string;
|
|
618
649
|
}>;
|
|
@@ -692,19 +723,19 @@ type DefinedNodeCredentialBinding = ResolvableCredentialType | Readonly<{
|
|
|
692
723
|
readonly helpUrl?: string;
|
|
693
724
|
}>;
|
|
694
725
|
type DefinedNodeCredentialBindings = Readonly<Record<string, DefinedNodeCredentialBinding>>;
|
|
695
|
-
interface DefinedNode<TKey$1 extends string, TConfig extends CredentialJsonRecord, TInputJson$1, TOutputJson$1, _TBindings extends DefinedNodeCredentialBindings | undefined = undefined
|
|
726
|
+
interface DefinedNode<TKey$1 extends string, TConfig extends CredentialJsonRecord, TInputJson$1, TOutputJson$1, _TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
|
|
696
727
|
readonly kind: "defined-node";
|
|
697
728
|
readonly key: TKey$1;
|
|
698
729
|
readonly title: string;
|
|
699
730
|
readonly description?: string;
|
|
700
|
-
create(config: TConfig, name?: string, id?: string): RunnableNodeConfig<TInputJson$1, TOutputJson$1
|
|
731
|
+
create(config: TConfig, name?: string, id?: string): RunnableNodeConfig<TInputJson$1, TOutputJson$1>;
|
|
701
732
|
register(context: {
|
|
702
733
|
registerNode<TValue>(token: TypeToken<TValue>, implementation?: TypeToken<TValue>): void;
|
|
703
734
|
}): void;
|
|
704
735
|
}
|
|
705
736
|
//#endregion
|
|
706
737
|
//#region ../core/src/ai/NodeBackedToolConfig.d.ts
|
|
707
|
-
declare class NodeBackedToolConfig<TNodeConfig extends RunnableNodeConfig<any, any
|
|
738
|
+
declare class NodeBackedToolConfig<TNodeConfig extends RunnableNodeConfig<any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> implements ToolConfig {
|
|
708
739
|
readonly name: string;
|
|
709
740
|
readonly node: TNodeConfig;
|
|
710
741
|
readonly type: TypeToken<unknown>;
|
|
@@ -768,7 +799,7 @@ type AgentMessageLine<TInputJson$1 = unknown> = AgentMessageDto | AgentMessageTe
|
|
|
768
799
|
* Message list for an agent. Prefer a **plain array** of `{ role, content }` (optionally with function `content` for templates).
|
|
769
800
|
* Use the object form only when you need `buildMessages` to append messages after optional `prompt` lines.
|
|
770
801
|
*/
|
|
771
|
-
type AgentMessageConfig<TInputJson$1 = unknown> = ReadonlyArray<AgentMessageLine<TInputJson$1>> | {
|
|
802
|
+
type AgentMessageConfig<TInputJson$1 = unknown> = ItemValue<ReadonlyArray<AgentMessageLine<TInputJson$1>>, TInputJson$1> | ReadonlyArray<AgentMessageLine<TInputJson$1>> | {
|
|
772
803
|
readonly prompt?: ReadonlyArray<AgentMessageLine<TInputJson$1>>;
|
|
773
804
|
readonly buildMessages?: (args: AgentMessageBuildArgs<TInputJson$1>) => ReadonlyArray<AgentMessageDto>;
|
|
774
805
|
};
|
|
@@ -803,7 +834,7 @@ interface ChatModelFactory<TConfig extends ChatModelConfig = ChatModelConfig> {
|
|
|
803
834
|
ctx: NodeExecutionContext<any>;
|
|
804
835
|
}>): Promise<LangChainChatModelLike> | LangChainChatModelLike;
|
|
805
836
|
}
|
|
806
|
-
type NodeBackedToolInputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, any
|
|
837
|
+
type NodeBackedToolInputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown> = Readonly<{
|
|
807
838
|
input: TToolInput;
|
|
808
839
|
item: Item;
|
|
809
840
|
itemIndex: number;
|
|
@@ -811,7 +842,7 @@ type NodeBackedToolInputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, a
|
|
|
811
842
|
ctx: NodeExecutionContext<any>;
|
|
812
843
|
node: TNodeConfig;
|
|
813
844
|
}>;
|
|
814
|
-
type NodeBackedToolOutputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, any
|
|
845
|
+
type NodeBackedToolOutputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown> = Readonly<{
|
|
815
846
|
input: TToolInput;
|
|
816
847
|
item: Item;
|
|
817
848
|
itemIndex: number;
|
|
@@ -820,9 +851,9 @@ type NodeBackedToolOutputMapperArgs<TNodeConfig extends RunnableNodeConfig<any,
|
|
|
820
851
|
node: TNodeConfig;
|
|
821
852
|
outputs: NodeOutputs;
|
|
822
853
|
}>;
|
|
823
|
-
type NodeBackedToolInputMapper<TNodeConfig extends RunnableNodeConfig<any, any
|
|
824
|
-
type NodeBackedToolOutputMapper<TNodeConfig extends RunnableNodeConfig<any, any
|
|
825
|
-
type NodeBackedToolConfigOptions<TNodeConfig extends RunnableNodeConfig<any, any
|
|
854
|
+
type NodeBackedToolInputMapper<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown> = (args: NodeBackedToolInputMapperArgs<TNodeConfig, TToolInput>) => Item<RunnableNodeInputJson<TNodeConfig>> | RunnableNodeInputJson<TNodeConfig>;
|
|
855
|
+
type NodeBackedToolOutputMapper<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown, TToolOutput = unknown> = (args: NodeBackedToolOutputMapperArgs<TNodeConfig, TToolInput>) => TToolOutput;
|
|
856
|
+
type NodeBackedToolConfigOptions<TNodeConfig extends RunnableNodeConfig<any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> = Readonly<{
|
|
826
857
|
description?: string;
|
|
827
858
|
presentation?: AgentCanvasPresentation;
|
|
828
859
|
inputSchema: TInputSchema;
|
|
@@ -830,13 +861,35 @@ type NodeBackedToolConfigOptions<TNodeConfig extends RunnableNodeConfig<any, any
|
|
|
830
861
|
mapInput?: NodeBackedToolInputMapper<TNodeConfig, input<TInputSchema>>;
|
|
831
862
|
mapOutput?: NodeBackedToolOutputMapper<TNodeConfig, input<TInputSchema>, output<TOutputSchema>>;
|
|
832
863
|
}>;
|
|
833
|
-
interface AgentNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown
|
|
864
|
+
interface AgentNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> extends RunnableNodeConfig<TInputJson$1, TOutputJson$1> {
|
|
834
865
|
readonly messages: AgentMessageConfig<TInputJson$1>;
|
|
835
866
|
readonly chatModel: ChatModelConfig;
|
|
836
867
|
readonly tools?: ReadonlyArray<ToolConfig>;
|
|
837
868
|
readonly guardrails?: AgentGuardrailConfig;
|
|
838
869
|
}
|
|
839
870
|
//#endregion
|
|
871
|
+
//#region ../core/src/execution/ItemValueResolver.d.ts
|
|
872
|
+
/**
|
|
873
|
+
* Resolves {@link import("../contracts/itemValue").ItemValue} leaves on runnable config before {@link RunnableNode.execute}.
|
|
874
|
+
*/
|
|
875
|
+
declare class ItemValueResolver {
|
|
876
|
+
resolveConfigForItem<TConfig extends RunnableNodeConfig<any, any>>(ctx: NodeExecutionContext<TConfig>, item: Item, itemIndex: number, items: ReadonlyArray<Item>): Promise<NodeExecutionContext<TConfig>>;
|
|
877
|
+
}
|
|
878
|
+
//#endregion
|
|
879
|
+
//#region ../core/src/execution/NodeOutputNormalizer.d.ts
|
|
880
|
+
declare class NodeOutputNormalizer {
|
|
881
|
+
normalizeExecuteResult(args: Readonly<{
|
|
882
|
+
baseItem: Item;
|
|
883
|
+
raw: unknown;
|
|
884
|
+
carry: LineageCarryPolicy;
|
|
885
|
+
}>): NodeOutputs;
|
|
886
|
+
private arrayFanOutToMain;
|
|
887
|
+
private emitPortsToOutputs;
|
|
888
|
+
private normalizePortPayload;
|
|
889
|
+
private isItemLike;
|
|
890
|
+
private applyLineage;
|
|
891
|
+
}
|
|
892
|
+
//#endregion
|
|
840
893
|
//#region src/chatModels/openAiChatModelConfig.d.ts
|
|
841
894
|
declare class OpenAIChatModelConfig implements ChatModelConfig {
|
|
842
895
|
readonly name: string;
|
|
@@ -908,7 +961,7 @@ declare class AgentToolCallPortMap {
|
|
|
908
961
|
}
|
|
909
962
|
//#endregion
|
|
910
963
|
//#region src/nodes/AIAgentConfig.d.ts
|
|
911
|
-
interface AIAgentOptions<TInputJson$1 = unknown, _TOutputJson = unknown
|
|
964
|
+
interface AIAgentOptions<TInputJson$1 = unknown, _TOutputJson = unknown> {
|
|
912
965
|
readonly name: string;
|
|
913
966
|
readonly messages: AgentMessageConfig<TInputJson$1>;
|
|
914
967
|
readonly chatModel: ChatModelConfig;
|
|
@@ -916,16 +969,14 @@ interface AIAgentOptions<TInputJson$1 = unknown, _TOutputJson = unknown, TWireJs
|
|
|
916
969
|
readonly id?: string;
|
|
917
970
|
readonly retryPolicy?: RetryPolicySpec;
|
|
918
971
|
readonly guardrails?: AgentGuardrailConfig;
|
|
919
|
-
/** Engine applies with {@link RunnableNodeConfig.inputSchema} before {@link AIAgentNode.
|
|
972
|
+
/** Engine applies with {@link RunnableNodeConfig.inputSchema} before {@link AIAgentNode.execute}. */
|
|
920
973
|
readonly inputSchema?: ZodType<TInputJson$1>;
|
|
921
|
-
/** Per-item mapper before validation; use with {@link inputSchema} so persisted run inputs show the prompt payload. */
|
|
922
|
-
readonly mapInput?: ItemInputMapper<TWireJson$1, TInputJson$1>;
|
|
923
974
|
}
|
|
924
975
|
/**
|
|
925
976
|
* AI agent: credential bindings are keyed to connection-owned LLM/tool node ids (ConnectionNodeIdFactory),
|
|
926
977
|
* not to the agent workflow node id.
|
|
927
978
|
*/
|
|
928
|
-
declare class AIAgent<TInputJson$1 = unknown, TOutputJson$1 = unknown
|
|
979
|
+
declare class AIAgent<TInputJson$1 = unknown, TOutputJson$1 = unknown> implements RunnableNodeConfig<TInputJson$1, TOutputJson$1>, AgentNodeConfig<TInputJson$1, TOutputJson$1> {
|
|
929
980
|
readonly kind: "node";
|
|
930
981
|
readonly type: TypeToken<unknown>;
|
|
931
982
|
readonly execution: {
|
|
@@ -940,8 +991,7 @@ declare class AIAgent<TInputJson$1 = unknown, TOutputJson$1 = unknown, TWireJson
|
|
|
940
991
|
readonly retryPolicy: RetryPolicySpec;
|
|
941
992
|
readonly guardrails?: AgentGuardrailConfig;
|
|
942
993
|
readonly inputSchema?: ZodType<TInputJson$1>;
|
|
943
|
-
|
|
944
|
-
constructor(options: AIAgentOptions<TInputJson$1, TOutputJson$1, TWireJson$1>);
|
|
994
|
+
constructor(options: AIAgentOptions<TInputJson$1, TOutputJson$1>);
|
|
945
995
|
}
|
|
946
996
|
//#endregion
|
|
947
997
|
//#region src/nodes/ConnectionCredentialExecutionContextFactory.d.ts
|
|
@@ -1014,36 +1064,33 @@ declare class AIAgentExecutionHelpersFactory {
|
|
|
1014
1064
|
//#region src/nodes/NodeBackedToolRuntime.d.ts
|
|
1015
1065
|
declare class NodeBackedToolRuntime {
|
|
1016
1066
|
private readonly nodeResolver;
|
|
1017
|
-
|
|
1067
|
+
private readonly itemValueResolver;
|
|
1068
|
+
private readonly outputNormalizer;
|
|
1069
|
+
constructor(nodeResolver: NodeResolver, itemValueResolver: ItemValueResolver, outputNormalizer: NodeOutputNormalizer);
|
|
1018
1070
|
execute(config: NodeBackedToolConfig<any, ZodSchemaAny, ZodSchemaAny>, args: ToolExecuteArgs): Promise<unknown>;
|
|
1019
1071
|
private executeResolvedNode;
|
|
1020
|
-
private
|
|
1072
|
+
private isRunnableNode;
|
|
1021
1073
|
private isMultiInputNode;
|
|
1022
1074
|
}
|
|
1023
1075
|
//#endregion
|
|
1024
1076
|
//#region src/nodes/AIAgentNode.d.ts
|
|
1025
|
-
declare class AIAgentNode implements
|
|
1077
|
+
declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
|
|
1026
1078
|
private readonly nodeResolver;
|
|
1027
1079
|
private readonly nodeBackedToolRuntime;
|
|
1028
1080
|
private readonly executionHelpers;
|
|
1029
1081
|
kind: "node";
|
|
1030
1082
|
outputPorts: readonly ["main"];
|
|
1031
1083
|
/**
|
|
1032
|
-
* Engine
|
|
1033
|
-
*
|
|
1084
|
+
* Engine validates {@link RunnableNodeConfig.inputSchema} (Zod) on {@code item.json} before enqueue, then resolves
|
|
1085
|
+
* per-item **`itemValue`** leaves on config before {@link #execute}. Prefer modeling prompts as
|
|
1086
|
+
* {@code { messages: [{ role, content }, ...] }} (on input or config) so persisted inputs are visible in the UI.
|
|
1034
1087
|
*/
|
|
1035
1088
|
readonly inputSchema: z.ZodUnknown;
|
|
1036
1089
|
private readonly connectionCredentialExecutionContextFactory;
|
|
1037
1090
|
/** One resolved model/tools bundle per activation context (same ctx across items in a batch). */
|
|
1038
1091
|
private readonly preparedByExecutionContext;
|
|
1039
1092
|
constructor(nodeResolver: NodeResolver, credentialSessions: CredentialSessionService, nodeBackedToolRuntime: NodeBackedToolRuntime, executionHelpers: AIAgentExecutionHelpersFactory);
|
|
1040
|
-
|
|
1041
|
-
input: unknown;
|
|
1042
|
-
item: Item;
|
|
1043
|
-
itemIndex: number;
|
|
1044
|
-
items: Items;
|
|
1045
|
-
ctx: NodeExecutionContext<AIAgent<any, any>>;
|
|
1046
|
-
}): Promise<unknown>;
|
|
1093
|
+
execute(args: RunnableNodeExecuteArgs<AIAgent<any, any>>): Promise<unknown>;
|
|
1047
1094
|
private getOrPrepareExecution;
|
|
1048
1095
|
/**
|
|
1049
1096
|
* Resolves the chat model and tools once per activation, then reuses for every item in the batch.
|
|
@@ -1085,38 +1132,48 @@ declare class AIAgentNode implements ItemNode<AIAgent<any, any>, unknown, unknow
|
|
|
1085
1132
|
}
|
|
1086
1133
|
//#endregion
|
|
1087
1134
|
//#region src/nodes/CallbackNode.d.ts
|
|
1088
|
-
declare class CallbackNode implements
|
|
1135
|
+
declare class CallbackNode implements RunnableNode<Callback<any, any>> {
|
|
1089
1136
|
kind: "node";
|
|
1090
1137
|
outputPorts: readonly ["main"];
|
|
1091
|
-
execute(
|
|
1138
|
+
execute(args: RunnableNodeExecuteArgs<Callback<any, any>>): Promise<unknown>;
|
|
1092
1139
|
}
|
|
1093
1140
|
//#endregion
|
|
1094
1141
|
//#region src/nodes/CallbackResultNormalizerFactory.d.ts
|
|
1095
1142
|
declare class CallbackResultNormalizer {
|
|
1096
|
-
static
|
|
1143
|
+
static toPortsEmission(result: Items | PortsEmission | void, items: Items): PortsEmission;
|
|
1097
1144
|
}
|
|
1098
1145
|
//#endregion
|
|
1099
1146
|
//#region src/nodes/CallbackNodeFactory.d.ts
|
|
1100
|
-
type CallbackHandler<TInputJson$1 = unknown, TOutputJson$1 = TInputJson$1, TConfig extends Callback<TInputJson$1, TOutputJson$1> = Callback<TInputJson$1, TOutputJson$1>> = (items: Items<TInputJson$1>, ctx: NodeExecutionContext<TConfig>) => Promise<Items<TOutputJson$1> | void> | Items<TOutputJson$1> | void;
|
|
1147
|
+
type CallbackHandler<TInputJson$1 = unknown, TOutputJson$1 = TInputJson$1, TConfig extends Callback<TInputJson$1, TOutputJson$1> = Callback<TInputJson$1, TOutputJson$1>> = (items: Items<TInputJson$1>, ctx: NodeExecutionContext<TConfig>) => Promise<Items<TOutputJson$1> | PortsEmission | void> | Items<TOutputJson$1> | PortsEmission | void;
|
|
1148
|
+
type CallbackOptions = Readonly<{
|
|
1149
|
+
id?: string;
|
|
1150
|
+
retryPolicy?: RetryPolicySpec;
|
|
1151
|
+
nodeErrorHandler?: NodeErrorHandlerSpec;
|
|
1152
|
+
declaredOutputPorts?: ReadonlyArray<string>;
|
|
1153
|
+
}>;
|
|
1101
1154
|
declare class Callback<TInputJson$1 = unknown, TOutputJson$1 = TInputJson$1> implements RunnableNodeConfig<TInputJson$1, TOutputJson$1> {
|
|
1102
1155
|
readonly name: string;
|
|
1103
1156
|
readonly callback: CallbackHandler<TInputJson$1, TOutputJson$1>;
|
|
1104
|
-
readonly id?: string | undefined;
|
|
1105
1157
|
readonly kind: "node";
|
|
1106
1158
|
readonly type: TypeToken<unknown>;
|
|
1107
1159
|
readonly execution: {
|
|
1108
1160
|
readonly hint: "local";
|
|
1109
1161
|
};
|
|
1110
1162
|
readonly icon: "lucide:braces";
|
|
1111
|
-
|
|
1163
|
+
readonly emptyBatchExecution: "runOnce";
|
|
1164
|
+
readonly id?: string;
|
|
1165
|
+
readonly retryPolicy?: RetryPolicySpec;
|
|
1166
|
+
readonly nodeErrorHandler?: NodeErrorHandlerSpec;
|
|
1167
|
+
readonly declaredOutputPorts?: ReadonlyArray<string>;
|
|
1168
|
+
constructor(name?: string, callback?: CallbackHandler<TInputJson$1, TOutputJson$1>, idOrOptions?: string | CallbackOptions, options?: CallbackOptions);
|
|
1112
1169
|
private static defaultCallback;
|
|
1113
1170
|
}
|
|
1114
1171
|
//#endregion
|
|
1115
1172
|
//#region src/nodes/HttpRequestNodeFactory.d.ts
|
|
1116
|
-
declare class HttpRequestNode implements
|
|
1173
|
+
declare class HttpRequestNode implements RunnableNode<HttpRequest<any, any>> {
|
|
1117
1174
|
readonly kind: "node";
|
|
1118
1175
|
readonly outputPorts: readonly ["main"];
|
|
1119
|
-
execute(
|
|
1176
|
+
execute(args: RunnableNodeExecuteArgs<HttpRequest<any, any>>): Promise<unknown>;
|
|
1120
1177
|
private executeItem;
|
|
1121
1178
|
private resolveUrl;
|
|
1122
1179
|
private asRecord;
|
|
@@ -1172,10 +1229,10 @@ declare class HttpRequest<TInputJson$1 = Readonly<{
|
|
|
1172
1229
|
}
|
|
1173
1230
|
//#endregion
|
|
1174
1231
|
//#region src/nodes/AggregateNode.d.ts
|
|
1175
|
-
declare class AggregateNode implements
|
|
1232
|
+
declare class AggregateNode implements RunnableNode<Aggregate<any, any>> {
|
|
1176
1233
|
kind: "node";
|
|
1177
1234
|
outputPorts: readonly ["main"];
|
|
1178
|
-
execute(
|
|
1235
|
+
execute(args: RunnableNodeExecuteArgs<Aggregate<any, any>>): Promise<unknown>;
|
|
1179
1236
|
}
|
|
1180
1237
|
//#endregion
|
|
1181
1238
|
//#region src/nodes/aggregate.d.ts
|
|
@@ -1193,10 +1250,10 @@ declare class Aggregate<TIn = unknown, TOut = unknown> implements RunnableNodeCo
|
|
|
1193
1250
|
}
|
|
1194
1251
|
//#endregion
|
|
1195
1252
|
//#region src/nodes/FilterNode.d.ts
|
|
1196
|
-
declare class FilterNode implements
|
|
1253
|
+
declare class FilterNode implements RunnableNode<Filter<any>> {
|
|
1197
1254
|
kind: "node";
|
|
1198
1255
|
outputPorts: readonly ["main"];
|
|
1199
|
-
execute(
|
|
1256
|
+
execute(args: RunnableNodeExecuteArgs<Filter<any>>): unknown;
|
|
1200
1257
|
}
|
|
1201
1258
|
//#endregion
|
|
1202
1259
|
//#region src/nodes/filter.d.ts
|
|
@@ -1214,10 +1271,9 @@ declare class Filter<TIn = unknown> implements RunnableNodeConfig<TIn, TIn> {
|
|
|
1214
1271
|
}
|
|
1215
1272
|
//#endregion
|
|
1216
1273
|
//#region src/nodes/IfNode.d.ts
|
|
1217
|
-
declare class IfNode implements
|
|
1274
|
+
declare class IfNode implements RunnableNode<If<any>> {
|
|
1218
1275
|
kind: "node";
|
|
1219
|
-
|
|
1220
|
-
execute(items: Items, ctx: NodeExecutionContext<If<any>>): Promise<NodeOutputs>;
|
|
1276
|
+
execute(args: RunnableNodeExecuteArgs<If<any>>): unknown;
|
|
1221
1277
|
}
|
|
1222
1278
|
//#endregion
|
|
1223
1279
|
//#region src/nodes/if.d.ts
|
|
@@ -1231,14 +1287,49 @@ declare class If<TInputJson$1 = unknown> implements RunnableNodeConfig<TInputJso
|
|
|
1231
1287
|
readonly hint: "local";
|
|
1232
1288
|
};
|
|
1233
1289
|
readonly icon: "lucide:split";
|
|
1290
|
+
readonly declaredOutputPorts: readonly ["true", "false"];
|
|
1234
1291
|
constructor(name: string, predicate: (item: Item<TInputJson$1>, index: number, items: Items<TInputJson$1>, ctx: NodeExecutionContext<If<TInputJson$1>>) => boolean, id?: string | undefined);
|
|
1235
1292
|
}
|
|
1236
1293
|
//#endregion
|
|
1294
|
+
//#region src/nodes/SwitchNode.d.ts
|
|
1295
|
+
/**
|
|
1296
|
+
* Routes each item to exactly one output port. Port names must match workflow edges (see {@link Switch} config).
|
|
1297
|
+
*/
|
|
1298
|
+
declare class SwitchNode implements RunnableNode<Switch<any>> {
|
|
1299
|
+
kind: "node";
|
|
1300
|
+
execute(args: RunnableNodeExecuteArgs<Switch<any>>): Promise<unknown>;
|
|
1301
|
+
}
|
|
1302
|
+
//#endregion
|
|
1303
|
+
//#region src/nodes/switch.d.ts
|
|
1304
|
+
type SwitchCaseKeyResolver<TInputJson$1 = unknown> = (item: Item<TInputJson$1>, index: number, items: Items<TInputJson$1>, ctx: NodeExecutionContext<Switch<TInputJson$1>>) => string | Promise<string>;
|
|
1305
|
+
declare class Switch<TInputJson$1 = unknown> implements RunnableNodeConfig<TInputJson$1, TInputJson$1> {
|
|
1306
|
+
readonly name: string;
|
|
1307
|
+
readonly cfg: Readonly<{
|
|
1308
|
+
cases: readonly string[];
|
|
1309
|
+
defaultCase: string;
|
|
1310
|
+
resolveCaseKey: SwitchCaseKeyResolver<TInputJson$1>;
|
|
1311
|
+
}>;
|
|
1312
|
+
readonly id?: string | undefined;
|
|
1313
|
+
readonly kind: "node";
|
|
1314
|
+
readonly type: TypeToken<unknown>;
|
|
1315
|
+
readonly execution: {
|
|
1316
|
+
readonly hint: "local";
|
|
1317
|
+
};
|
|
1318
|
+
readonly icon: "lucide:git-branch-plus";
|
|
1319
|
+
readonly lineageCarry: "carryThrough";
|
|
1320
|
+
readonly declaredOutputPorts: ReadonlyArray<string>;
|
|
1321
|
+
constructor(name: string, cfg: Readonly<{
|
|
1322
|
+
cases: readonly string[];
|
|
1323
|
+
defaultCase: string;
|
|
1324
|
+
resolveCaseKey: SwitchCaseKeyResolver<TInputJson$1>;
|
|
1325
|
+
}>, id?: string | undefined);
|
|
1326
|
+
}
|
|
1327
|
+
//#endregion
|
|
1237
1328
|
//#region src/nodes/SplitNode.d.ts
|
|
1238
|
-
declare class SplitNode implements
|
|
1329
|
+
declare class SplitNode implements RunnableNode<Split<any, any>> {
|
|
1239
1330
|
kind: "node";
|
|
1240
1331
|
outputPorts: readonly ["main"];
|
|
1241
|
-
execute(
|
|
1332
|
+
execute(args: RunnableNodeExecuteArgs<Split<any, any>>): unknown;
|
|
1242
1333
|
}
|
|
1243
1334
|
//#endregion
|
|
1244
1335
|
//#region src/nodes/split.d.ts
|
|
@@ -1293,17 +1384,11 @@ declare class ManualTrigger<TOutputJson$1 = unknown> implements TriggerNodeConfi
|
|
|
1293
1384
|
}
|
|
1294
1385
|
//#endregion
|
|
1295
1386
|
//#region src/nodes/MapDataNode.d.ts
|
|
1296
|
-
declare class MapDataNode implements
|
|
1387
|
+
declare class MapDataNode implements RunnableNode<MapData<any, any>> {
|
|
1297
1388
|
kind: "node";
|
|
1298
1389
|
outputPorts: readonly ["main"];
|
|
1299
1390
|
readonly inputSchema: z.ZodUnknown;
|
|
1300
|
-
|
|
1301
|
-
input: unknown;
|
|
1302
|
-
item: Item;
|
|
1303
|
-
itemIndex: number;
|
|
1304
|
-
items: Items;
|
|
1305
|
-
ctx: NodeExecutionContext<MapData<any, any>>;
|
|
1306
|
-
}): Promise<unknown>;
|
|
1391
|
+
execute(args: RunnableNodeExecuteArgs<MapData<any, any>>): Promise<unknown>;
|
|
1307
1392
|
}
|
|
1308
1393
|
//#endregion
|
|
1309
1394
|
//#region src/nodes/mapData.d.ts
|
|
@@ -1355,10 +1440,10 @@ declare class Merge<TInputJson$1 = unknown, TOutputJson$1 = TInputJson$1> implem
|
|
|
1355
1440
|
}
|
|
1356
1441
|
//#endregion
|
|
1357
1442
|
//#region src/nodes/NoOpNode.d.ts
|
|
1358
|
-
declare class NoOpNode implements
|
|
1443
|
+
declare class NoOpNode implements RunnableNode<NoOp<any>> {
|
|
1359
1444
|
kind: "node";
|
|
1360
1445
|
outputPorts: readonly ["main"];
|
|
1361
|
-
execute(
|
|
1446
|
+
execute(args: RunnableNodeExecuteArgs<NoOp<any>>): unknown;
|
|
1362
1447
|
}
|
|
1363
1448
|
//#endregion
|
|
1364
1449
|
//#region src/nodes/noOp.d.ts
|
|
@@ -1374,12 +1459,12 @@ declare class NoOp<TItemJson = unknown> implements RunnableNodeConfig<TItemJson,
|
|
|
1374
1459
|
}
|
|
1375
1460
|
//#endregion
|
|
1376
1461
|
//#region src/nodes/SubWorkflowNode.d.ts
|
|
1377
|
-
declare class SubWorkflowNode implements
|
|
1462
|
+
declare class SubWorkflowNode implements RunnableNode<SubWorkflow<any, any>> {
|
|
1378
1463
|
private readonly workflows;
|
|
1379
1464
|
kind: "node";
|
|
1380
1465
|
outputPorts: readonly ["main"];
|
|
1381
1466
|
constructor(workflows: WorkflowRunnerService);
|
|
1382
|
-
execute(
|
|
1467
|
+
execute(args: RunnableNodeExecuteArgs<SubWorkflow<any, any>>): Promise<unknown>;
|
|
1383
1468
|
}
|
|
1384
1469
|
//#endregion
|
|
1385
1470
|
//#region src/nodes/subWorkflow.d.ts
|
|
@@ -1404,10 +1489,10 @@ declare class WaitDuration {
|
|
|
1404
1489
|
}
|
|
1405
1490
|
//#endregion
|
|
1406
1491
|
//#region src/nodes/WaitNode.d.ts
|
|
1407
|
-
declare class WaitNode implements
|
|
1492
|
+
declare class WaitNode implements RunnableNode<Wait<any>> {
|
|
1408
1493
|
kind: "node";
|
|
1409
1494
|
outputPorts: readonly ["main"];
|
|
1410
|
-
execute(
|
|
1495
|
+
execute(args: RunnableNodeExecuteArgs<Wait<any>>): Promise<unknown>;
|
|
1411
1496
|
}
|
|
1412
1497
|
//#endregion
|
|
1413
1498
|
//#region src/nodes/wait.d.ts
|
|
@@ -1508,11 +1593,17 @@ interface WorkflowAgentOptions<TCurrentJson, TOutputSchema extends z.ZodTypeAny
|
|
|
1508
1593
|
declare class WorkflowBranchBuilder<TCurrentJson> {
|
|
1509
1594
|
private readonly steps;
|
|
1510
1595
|
constructor(steps?: ReadonlyArray<AnyRunnableNodeConfig>);
|
|
1511
|
-
then<
|
|
1596
|
+
then<TOutputJson$1, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson$1>>(config: TConfig): WorkflowBranchBuilder<RunnableNodeOutputJson<TConfig>>;
|
|
1512
1597
|
map<TNextJson$1>(mapper: (item: TCurrentJson) => TNextJson$1): WorkflowBranchBuilder<TNextJson$1>;
|
|
1513
1598
|
map<TNextJson$1>(name: string, mapper: (item: TCurrentJson) => TNextJson$1, id?: string): WorkflowBranchBuilder<TNextJson$1>;
|
|
1514
1599
|
wait(duration: number | string): WorkflowBranchBuilder<TCurrentJson>;
|
|
1515
1600
|
wait(name: string, duration: number | string, id?: string): WorkflowBranchBuilder<TCurrentJson>;
|
|
1601
|
+
split<TElem>(getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[]): WorkflowBranchBuilder<TElem>;
|
|
1602
|
+
split<TElem>(name: string, getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[], id?: string): WorkflowBranchBuilder<TElem>;
|
|
1603
|
+
filter(predicate: (item: Item<TCurrentJson>, index: number, items: Items<TCurrentJson>, ctx: NodeExecutionContext<Filter<TCurrentJson>>) => boolean): WorkflowBranchBuilder<TCurrentJson>;
|
|
1604
|
+
filter(name: string, predicate: (item: Item<TCurrentJson>, index: number, items: Items<TCurrentJson>, ctx: NodeExecutionContext<Filter<TCurrentJson>>) => boolean, id?: string): WorkflowBranchBuilder<TCurrentJson>;
|
|
1605
|
+
aggregate<TOut>(aggregateFn: (items: Items<TCurrentJson>, ctx: NodeExecutionContext<Aggregate<TCurrentJson, TOut>>) => TOut | Promise<TOut>): WorkflowBranchBuilder<TOut>;
|
|
1606
|
+
aggregate<TOut>(name: string, aggregateFn: (items: Items<TCurrentJson>, ctx: NodeExecutionContext<Aggregate<TCurrentJson, TOut>>) => TOut | Promise<TOut>, id?: string): WorkflowBranchBuilder<TOut>;
|
|
1516
1607
|
agent<TOutputSchema extends z.ZodTypeAny>(options: WorkflowAgentOptions<TCurrentJson, TOutputSchema>): WorkflowBranchBuilder<z.output<TOutputSchema>>;
|
|
1517
1608
|
agent(options: WorkflowAgentOptions<TCurrentJson, undefined>): WorkflowBranchBuilder<Record<string, unknown>>;
|
|
1518
1609
|
agent<TOutputSchema extends z.ZodTypeAny>(name: string, options: WorkflowAgentOptions<TCurrentJson, TOutputSchema | undefined>): WorkflowBranchBuilder<TOutputSchema extends z.ZodTypeAny ? z.output<TOutputSchema> : Record<string, unknown>>;
|
|
@@ -1522,14 +1613,30 @@ declare class WorkflowBranchBuilder<TCurrentJson> {
|
|
|
1522
1613
|
//#endregion
|
|
1523
1614
|
//#region src/workflowAuthoring/WorkflowChain.types.d.ts
|
|
1524
1615
|
type BranchCallback<TCurrentJson, TNextJson$1> = (branch: WorkflowBranchBuilder<TCurrentJson>) => WorkflowBranchBuilder<TNextJson$1>;
|
|
1616
|
+
type RouteBranchCallback<TCurrentJson, TNextJson$1> = (branch: WorkflowChain<TCurrentJson>) => WorkflowChain<TNextJson$1>;
|
|
1525
1617
|
declare class WorkflowChain<TCurrentJson> {
|
|
1526
1618
|
private readonly chain;
|
|
1527
1619
|
constructor(chain: ChainCursor<TCurrentJson>);
|
|
1528
|
-
then<
|
|
1620
|
+
then<TOutputJson$1, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson$1>>(config: TConfig): WorkflowChain<RunnableNodeOutputJson<TConfig>>;
|
|
1529
1621
|
map<TNextJson$1>(mapper: (item: TCurrentJson) => TNextJson$1): WorkflowChain<TNextJson$1>;
|
|
1530
1622
|
map<TNextJson$1>(name: string, mapper: (item: TCurrentJson) => TNextJson$1, id?: string): WorkflowChain<TNextJson$1>;
|
|
1531
1623
|
wait(duration: number | string): WorkflowChain<TCurrentJson>;
|
|
1532
1624
|
wait(name: string, duration: number | string, id?: string): WorkflowChain<TCurrentJson>;
|
|
1625
|
+
split<TElem>(getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[]): WorkflowChain<TElem>;
|
|
1626
|
+
split<TElem>(name: string, getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[], id?: string): WorkflowChain<TElem>;
|
|
1627
|
+
filter(predicate: (item: Item<TCurrentJson>, index: number, items: Items<TCurrentJson>, ctx: NodeExecutionContext<Filter<TCurrentJson>>) => boolean): WorkflowChain<TCurrentJson>;
|
|
1628
|
+
filter(name: string, predicate: (item: Item<TCurrentJson>, index: number, items: Items<TCurrentJson>, ctx: NodeExecutionContext<Filter<TCurrentJson>>) => boolean, id?: string): WorkflowChain<TCurrentJson>;
|
|
1629
|
+
aggregate<TOut>(aggregateFn: (items: Items<TCurrentJson>, ctx: NodeExecutionContext<Aggregate<TCurrentJson, TOut>>) => TOut | Promise<TOut>): WorkflowChain<TOut>;
|
|
1630
|
+
aggregate<TOut>(name: string, aggregateFn: (items: Items<TCurrentJson>, ctx: NodeExecutionContext<Aggregate<TCurrentJson, TOut>>) => TOut | Promise<TOut>, id?: string): WorkflowChain<TOut>;
|
|
1631
|
+
merge(): WorkflowChain<TCurrentJson>;
|
|
1632
|
+
merge(cfg: Readonly<{
|
|
1633
|
+
mode: MergeMode;
|
|
1634
|
+
prefer?: ReadonlyArray<string>;
|
|
1635
|
+
}>, id?: string): WorkflowChain<TCurrentJson>;
|
|
1636
|
+
merge(name: string, cfg?: Readonly<{
|
|
1637
|
+
mode: MergeMode;
|
|
1638
|
+
prefer?: ReadonlyArray<string>;
|
|
1639
|
+
}>, id?: string): WorkflowChain<TCurrentJson>;
|
|
1533
1640
|
if<TBranchJson>(predicate: (item: TCurrentJson) => boolean, branches: Readonly<{
|
|
1534
1641
|
true?: BranchCallback<TCurrentJson, TBranchJson>;
|
|
1535
1642
|
false?: BranchCallback<TCurrentJson, TBranchJson>;
|
|
@@ -1538,6 +1645,19 @@ declare class WorkflowChain<TCurrentJson> {
|
|
|
1538
1645
|
true?: BranchCallback<TCurrentJson, TBranchJson>;
|
|
1539
1646
|
false?: BranchCallback<TCurrentJson, TBranchJson>;
|
|
1540
1647
|
}>): WorkflowChain<TBranchJson>;
|
|
1648
|
+
route<TBranchJson>(branches: Readonly<Record<string, RouteBranchCallback<TCurrentJson, TBranchJson> | undefined>>): WorkflowChain<TBranchJson>;
|
|
1649
|
+
switch<TBranchJson>(cfg: Readonly<{
|
|
1650
|
+
cases: readonly string[];
|
|
1651
|
+
defaultCase: string;
|
|
1652
|
+
resolveCaseKey: (item: TCurrentJson) => string | Promise<string>;
|
|
1653
|
+
branches: Readonly<Record<string, RouteBranchCallback<TCurrentJson, TBranchJson> | undefined>>;
|
|
1654
|
+
}>): WorkflowChain<TBranchJson>;
|
|
1655
|
+
switch<TBranchJson>(name: string, cfg: Readonly<{
|
|
1656
|
+
cases: readonly string[];
|
|
1657
|
+
defaultCase: string;
|
|
1658
|
+
resolveCaseKey: (item: TCurrentJson) => string | Promise<string>;
|
|
1659
|
+
branches: Readonly<Record<string, RouteBranchCallback<TCurrentJson, TBranchJson> | undefined>>;
|
|
1660
|
+
}>, id?: string): WorkflowChain<TBranchJson>;
|
|
1541
1661
|
agent<TOutputSchema extends z.ZodTypeAny>(options: WorkflowAgentOptions<TCurrentJson, TOutputSchema>): WorkflowChain<z.output<TOutputSchema>>;
|
|
1542
1662
|
agent(options: WorkflowAgentOptions<TCurrentJson, undefined>): WorkflowChain<Record<string, unknown>>;
|
|
1543
1663
|
agent<TOutputSchema extends z.ZodTypeAny>(name: string, options: WorkflowAgentOptions<TCurrentJson, TOutputSchema | undefined>): WorkflowChain<TOutputSchema extends z.ZodTypeAny ? z.output<TOutputSchema> : Record<string, unknown>>;
|
|
@@ -1563,10 +1683,10 @@ declare function workflow(id: string): WorkflowAuthoringBuilder;
|
|
|
1563
1683
|
* Placeholder runnable node for connection-owned workflow nodes (LLM/tool slots).
|
|
1564
1684
|
* The engine does not schedule these; they exist for credentials, tokens, and UI identity.
|
|
1565
1685
|
*/
|
|
1566
|
-
declare class ConnectionCredentialNode implements
|
|
1686
|
+
declare class ConnectionCredentialNode implements RunnableNode<ConnectionCredentialNodeConfig> {
|
|
1567
1687
|
kind: "node";
|
|
1568
1688
|
outputPorts: readonly ["main"];
|
|
1569
|
-
execute(
|
|
1689
|
+
execute(_args: RunnableNodeExecuteArgs<ConnectionCredentialNodeConfig>): unknown;
|
|
1570
1690
|
}
|
|
1571
1691
|
//#endregion
|
|
1572
1692
|
//#region src/nodes/ConnectionCredentialNodeConfig.d.ts
|
|
@@ -1602,5 +1722,5 @@ declare class AIAgentConnectionWorkflowExpander {
|
|
|
1602
1722
|
private assertNoIdCollision;
|
|
1603
1723
|
}
|
|
1604
1724
|
//#endregion
|
|
1605
|
-
export { AIAgent, AIAgentConnectionWorkflowExpander, AIAgentExecutionHelpersFactory, AIAgentNode, AgentItemPortMap, AgentMessageFactory, AgentOutputFactory, AgentToolCallPortMap, Aggregate, AggregateNode, Callback, CallbackHandler, CallbackNode, CallbackResultNormalizer, CanvasIconName, ConnectionCredentialExecutionContextFactory, ConnectionCredentialNode, ConnectionCredentialNodeConfig, ConnectionCredentialNodeConfigFactory, ExecutedToolCall, Filter, FilterNode, HttpRequest, HttpRequestDownloadMode, HttpRequestNode, HttpRequestOutputJson, If, IfNode, ItemScopedToolBinding, ManualTrigger, ManualTriggerNode, MapData, MapDataNode, Merge, MergeMode, MergeNode, NoOp, NoOpNode, OpenAIChatModelConfig, OpenAIChatModelFactory, OpenAiChatModelPresets, OpenAiCredentialSession, PlannedToolCall, ResolvedTool, Split, SplitNode, SubWorkflow, SubWorkflowNode, Wait, WaitDuration, WaitNode, WebhookRespondNowAndContinueError, WebhookRespondNowError, WebhookTrigger, WebhookTriggerNode, type WorkflowAgentOptions, WorkflowAuthoringBuilder, WorkflowBranchBuilder, WorkflowChain, createWorkflowBuilder, openAiChatModelPresets, registerCoreNodes, workflow };
|
|
1725
|
+
export { AIAgent, AIAgentConnectionWorkflowExpander, AIAgentExecutionHelpersFactory, AIAgentNode, AgentItemPortMap, AgentMessageFactory, AgentOutputFactory, AgentToolCallPortMap, Aggregate, AggregateNode, Callback, CallbackHandler, CallbackNode, CallbackOptions, CallbackResultNormalizer, CanvasIconName, ConnectionCredentialExecutionContextFactory, ConnectionCredentialNode, ConnectionCredentialNodeConfig, ConnectionCredentialNodeConfigFactory, ExecutedToolCall, Filter, FilterNode, HttpRequest, HttpRequestDownloadMode, HttpRequestNode, HttpRequestOutputJson, If, IfNode, ItemScopedToolBinding, ManualTrigger, ManualTriggerNode, MapData, MapDataNode, Merge, MergeMode, MergeNode, NoOp, NoOpNode, OpenAIChatModelConfig, OpenAIChatModelFactory, OpenAiChatModelPresets, OpenAiCredentialSession, PlannedToolCall, ResolvedTool, Split, SplitNode, SubWorkflow, SubWorkflowNode, Switch, SwitchCaseKeyResolver, SwitchNode, Wait, WaitDuration, WaitNode, WebhookRespondNowAndContinueError, WebhookRespondNowError, WebhookTrigger, WebhookTriggerNode, type WorkflowAgentOptions, WorkflowAuthoringBuilder, WorkflowBranchBuilder, WorkflowChain, createWorkflowBuilder, openAiChatModelPresets, registerCoreNodes, workflow };
|
|
1606
1726
|
//# sourceMappingURL=index.d.cts.map
|