@codemation/core-nodes 0.0.25 → 0.1.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/dist/index.d.ts CHANGED
@@ -14,6 +14,38 @@ import { ZodType, input, output, z } from "zod";
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, 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<infer _TIn, infer TNextJson, TCurrentJson> ? TRest extends ReadonlyArray<AnyRunnableNodeConfig> ? readonly [TFirst, ...ValidStepSequence<TNextJson, TRest>] : never : never : TSteps;
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<infer _TIn, infer TNextJson, TCurrentJson> ? TRest extends ReadonlyArray<AnyRunnableNodeConfig> ? StepSequenceOutput<TNextJson, TRest> : never : never : TCurrentJson : TCurrentJson;
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<any, any, TCurrentJson>, TRestSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TRestSteps & ValidStepSequence<RunnableNodeOutputJson<TFirstStep>, TRestSteps>;
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<any, any, TCurrentJson>, TRestSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(branch: boolean, step: TFirstStep, ...more: BranchMoreArgs<TCurrentJson, TFirstStep, TRestSteps>): TReturn;
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 cursor;
152
- private readonly cursorOutput;
153
- constructor(wf: WorkflowBuilder, cursor: NodeRef, cursorOutput: OutputPortKey);
154
- then<TInputJson$1, TOutputJson$1, TConfig extends RunnableNodeConfig<TInputJson$1, TOutputJson$1, TCurrentJson>>(config: TConfig): ChainCursor<RunnableNodeOutputJson<TConfig>>;
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
- * Single-input runnable node with per-item execution on `main` only (1→1 default).
284
- * Engine applies {@link RunnableNodeConfig.mapInput} (if any) + `inputSchema.parse` before `executeOne`.
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 ItemNode<TConfig extends NodeConfigBase = NodeConfigBase, TInputJson$1 = unknown, TOutputJson$1 = unknown> {
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
- readonly outputPorts: readonly ["main"];
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
- executeOne(args: Readonly<{
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
- outputPorts: ReadonlyArray<OutputPortKey>;
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
- * Read-only execution slice passed to {@link RunnableNodeConfig.mapInput} (aligned with the engine’s
397
- * node execution context for `runId`, `data`, etc.). Use **`ctx.data`** to read **any completed** upstream
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.
412
- */
413
- interface ItemInputMapperArgs<TWireJson$1 = unknown> {
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).
447
+ * Runnable node: **`TInputJson`** is what **`inputSchema`** validates on **`item.json`** (the wire payload).
448
+ * **`TOutputJson`** is emitted `item.json` on outputs.
423
449
  */
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 ItemNode} when not set on the node class.
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
- * Optional per-item mapper: engine applies it before validating against the node’s `inputSchema`.
444
- * When omitted, the engine validates `item.json` directly.
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 mapInput?: ItemInputMapper<TWireJson$1, TInputJson$1>;
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, any>> = TConfig extends RunnableNodeConfig<infer TInputJson, any, any> ? TInputJson : never;
455
- type RunnableNodeOutputJson<TConfig extends RunnableNodeConfig<any, any, any>> = TConfig extends RunnableNodeConfig<any, infer TOutputJson, any> ? TOutputJson : never;
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 {
@@ -692,19 +715,19 @@ type DefinedNodeCredentialBinding = ResolvableCredentialType | Readonly<{
692
715
  readonly helpUrl?: string;
693
716
  }>;
694
717
  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, TWireJson$1 = TInputJson$1> {
718
+ interface DefinedNode<TKey$1 extends string, TConfig extends CredentialJsonRecord, TInputJson$1, TOutputJson$1, _TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
696
719
  readonly kind: "defined-node";
697
720
  readonly key: TKey$1;
698
721
  readonly title: string;
699
722
  readonly description?: string;
700
- create(config: TConfig, name?: string, id?: string): RunnableNodeConfig<TInputJson$1, TOutputJson$1, TWireJson$1>;
723
+ create(config: TConfig, name?: string, id?: string): RunnableNodeConfig<TInputJson$1, TOutputJson$1>;
701
724
  register(context: {
702
725
  registerNode<TValue>(token: TypeToken<TValue>, implementation?: TypeToken<TValue>): void;
703
726
  }): void;
704
727
  }
705
728
  //#endregion
706
729
  //#region ../core/src/ai/NodeBackedToolConfig.d.ts
707
- declare class NodeBackedToolConfig<TNodeConfig extends RunnableNodeConfig<any, any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> implements ToolConfig {
730
+ declare class NodeBackedToolConfig<TNodeConfig extends RunnableNodeConfig<any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> implements ToolConfig {
708
731
  readonly name: string;
709
732
  readonly node: TNodeConfig;
710
733
  readonly type: TypeToken<unknown>;
@@ -768,7 +791,7 @@ type AgentMessageLine<TInputJson$1 = unknown> = AgentMessageDto | AgentMessageTe
768
791
  * Message list for an agent. Prefer a **plain array** of `{ role, content }` (optionally with function `content` for templates).
769
792
  * Use the object form only when you need `buildMessages` to append messages after optional `prompt` lines.
770
793
  */
771
- type AgentMessageConfig<TInputJson$1 = unknown> = ReadonlyArray<AgentMessageLine<TInputJson$1>> | {
794
+ type AgentMessageConfig<TInputJson$1 = unknown> = ItemValue<ReadonlyArray<AgentMessageLine<TInputJson$1>>, TInputJson$1> | ReadonlyArray<AgentMessageLine<TInputJson$1>> | {
772
795
  readonly prompt?: ReadonlyArray<AgentMessageLine<TInputJson$1>>;
773
796
  readonly buildMessages?: (args: AgentMessageBuildArgs<TInputJson$1>) => ReadonlyArray<AgentMessageDto>;
774
797
  };
@@ -803,7 +826,7 @@ interface ChatModelFactory<TConfig extends ChatModelConfig = ChatModelConfig> {
803
826
  ctx: NodeExecutionContext<any>;
804
827
  }>): Promise<LangChainChatModelLike> | LangChainChatModelLike;
805
828
  }
806
- type NodeBackedToolInputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, any, any>, TToolInput = unknown> = Readonly<{
829
+ type NodeBackedToolInputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown> = Readonly<{
807
830
  input: TToolInput;
808
831
  item: Item;
809
832
  itemIndex: number;
@@ -811,7 +834,7 @@ type NodeBackedToolInputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, a
811
834
  ctx: NodeExecutionContext<any>;
812
835
  node: TNodeConfig;
813
836
  }>;
814
- type NodeBackedToolOutputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, any, any>, TToolInput = unknown> = Readonly<{
837
+ type NodeBackedToolOutputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown> = Readonly<{
815
838
  input: TToolInput;
816
839
  item: Item;
817
840
  itemIndex: number;
@@ -820,9 +843,9 @@ type NodeBackedToolOutputMapperArgs<TNodeConfig extends RunnableNodeConfig<any,
820
843
  node: TNodeConfig;
821
844
  outputs: NodeOutputs;
822
845
  }>;
823
- type NodeBackedToolInputMapper<TNodeConfig extends RunnableNodeConfig<any, any, any>, TToolInput = unknown> = (args: NodeBackedToolInputMapperArgs<TNodeConfig, TToolInput>) => Item<RunnableNodeInputJson<TNodeConfig>> | RunnableNodeInputJson<TNodeConfig>;
824
- type NodeBackedToolOutputMapper<TNodeConfig extends RunnableNodeConfig<any, any, any>, TToolInput = unknown, TToolOutput = unknown> = (args: NodeBackedToolOutputMapperArgs<TNodeConfig, TToolInput>) => TToolOutput;
825
- type NodeBackedToolConfigOptions<TNodeConfig extends RunnableNodeConfig<any, any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> = Readonly<{
846
+ type NodeBackedToolInputMapper<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown> = (args: NodeBackedToolInputMapperArgs<TNodeConfig, TToolInput>) => Item<RunnableNodeInputJson<TNodeConfig>> | RunnableNodeInputJson<TNodeConfig>;
847
+ type NodeBackedToolOutputMapper<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown, TToolOutput = unknown> = (args: NodeBackedToolOutputMapperArgs<TNodeConfig, TToolInput>) => TToolOutput;
848
+ type NodeBackedToolConfigOptions<TNodeConfig extends RunnableNodeConfig<any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> = Readonly<{
826
849
  description?: string;
827
850
  presentation?: AgentCanvasPresentation;
828
851
  inputSchema: TInputSchema;
@@ -830,13 +853,35 @@ type NodeBackedToolConfigOptions<TNodeConfig extends RunnableNodeConfig<any, any
830
853
  mapInput?: NodeBackedToolInputMapper<TNodeConfig, input<TInputSchema>>;
831
854
  mapOutput?: NodeBackedToolOutputMapper<TNodeConfig, input<TInputSchema>, output<TOutputSchema>>;
832
855
  }>;
833
- interface AgentNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown, TWireJson$1 = TInputJson$1> extends RunnableNodeConfig<TInputJson$1, TOutputJson$1, TWireJson$1> {
856
+ interface AgentNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> extends RunnableNodeConfig<TInputJson$1, TOutputJson$1> {
834
857
  readonly messages: AgentMessageConfig<TInputJson$1>;
835
858
  readonly chatModel: ChatModelConfig;
836
859
  readonly tools?: ReadonlyArray<ToolConfig>;
837
860
  readonly guardrails?: AgentGuardrailConfig;
838
861
  }
839
862
  //#endregion
863
+ //#region ../core/src/execution/ItemValueResolver.d.ts
864
+ /**
865
+ * Resolves {@link import("../contracts/itemValue").ItemValue} leaves on runnable config before {@link RunnableNode.execute}.
866
+ */
867
+ declare class ItemValueResolver {
868
+ resolveConfigForItem<TConfig extends RunnableNodeConfig<any, any>>(ctx: NodeExecutionContext<TConfig>, item: Item, itemIndex: number, items: ReadonlyArray<Item>): Promise<NodeExecutionContext<TConfig>>;
869
+ }
870
+ //#endregion
871
+ //#region ../core/src/execution/NodeOutputNormalizer.d.ts
872
+ declare class NodeOutputNormalizer {
873
+ normalizeExecuteResult(args: Readonly<{
874
+ baseItem: Item;
875
+ raw: unknown;
876
+ carry: LineageCarryPolicy;
877
+ }>): NodeOutputs;
878
+ private arrayFanOutToMain;
879
+ private emitPortsToOutputs;
880
+ private normalizePortPayload;
881
+ private isItemLike;
882
+ private applyLineage;
883
+ }
884
+ //#endregion
840
885
  //#region src/chatModels/openAiChatModelConfig.d.ts
841
886
  declare class OpenAIChatModelConfig implements ChatModelConfig {
842
887
  readonly name: string;
@@ -908,7 +953,7 @@ declare class AgentToolCallPortMap {
908
953
  }
909
954
  //#endregion
910
955
  //#region src/nodes/AIAgentConfig.d.ts
911
- interface AIAgentOptions<TInputJson$1 = unknown, _TOutputJson = unknown, TWireJson$1 = TInputJson$1> {
956
+ interface AIAgentOptions<TInputJson$1 = unknown, _TOutputJson = unknown> {
912
957
  readonly name: string;
913
958
  readonly messages: AgentMessageConfig<TInputJson$1>;
914
959
  readonly chatModel: ChatModelConfig;
@@ -916,16 +961,14 @@ interface AIAgentOptions<TInputJson$1 = unknown, _TOutputJson = unknown, TWireJs
916
961
  readonly id?: string;
917
962
  readonly retryPolicy?: RetryPolicySpec;
918
963
  readonly guardrails?: AgentGuardrailConfig;
919
- /** Engine applies with {@link RunnableNodeConfig.inputSchema} before {@link AIAgentNode.executeOne}. */
964
+ /** Engine applies with {@link RunnableNodeConfig.inputSchema} before {@link AIAgentNode.execute}. */
920
965
  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
966
  }
924
967
  /**
925
968
  * AI agent: credential bindings are keyed to connection-owned LLM/tool node ids (ConnectionNodeIdFactory),
926
969
  * not to the agent workflow node id.
927
970
  */
928
- declare class AIAgent<TInputJson$1 = unknown, TOutputJson$1 = unknown, TWireJson$1 = TInputJson$1> implements RunnableNodeConfig<TInputJson$1, TOutputJson$1, TWireJson$1>, AgentNodeConfig<TInputJson$1, TOutputJson$1, TWireJson$1> {
971
+ declare class AIAgent<TInputJson$1 = unknown, TOutputJson$1 = unknown> implements RunnableNodeConfig<TInputJson$1, TOutputJson$1>, AgentNodeConfig<TInputJson$1, TOutputJson$1> {
929
972
  readonly kind: "node";
930
973
  readonly type: TypeToken<unknown>;
931
974
  readonly execution: {
@@ -940,8 +983,7 @@ declare class AIAgent<TInputJson$1 = unknown, TOutputJson$1 = unknown, TWireJson
940
983
  readonly retryPolicy: RetryPolicySpec;
941
984
  readonly guardrails?: AgentGuardrailConfig;
942
985
  readonly inputSchema?: ZodType<TInputJson$1>;
943
- readonly mapInput?: ItemInputMapper<TWireJson$1, TInputJson$1>;
944
- constructor(options: AIAgentOptions<TInputJson$1, TOutputJson$1, TWireJson$1>);
986
+ constructor(options: AIAgentOptions<TInputJson$1, TOutputJson$1>);
945
987
  }
946
988
  //#endregion
947
989
  //#region src/nodes/ConnectionCredentialExecutionContextFactory.d.ts
@@ -1014,36 +1056,33 @@ declare class AIAgentExecutionHelpersFactory {
1014
1056
  //#region src/nodes/NodeBackedToolRuntime.d.ts
1015
1057
  declare class NodeBackedToolRuntime {
1016
1058
  private readonly nodeResolver;
1017
- constructor(nodeResolver: NodeResolver);
1059
+ private readonly itemValueResolver;
1060
+ private readonly outputNormalizer;
1061
+ constructor(nodeResolver: NodeResolver, itemValueResolver: ItemValueResolver, outputNormalizer: NodeOutputNormalizer);
1018
1062
  execute(config: NodeBackedToolConfig<any, ZodSchemaAny, ZodSchemaAny>, args: ToolExecuteArgs): Promise<unknown>;
1019
1063
  private executeResolvedNode;
1020
- private isNode;
1064
+ private isRunnableNode;
1021
1065
  private isMultiInputNode;
1022
1066
  }
1023
1067
  //#endregion
1024
1068
  //#region src/nodes/AIAgentNode.d.ts
1025
- declare class AIAgentNode implements ItemNode<AIAgent<any, any>, unknown, unknown> {
1069
+ declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
1026
1070
  private readonly nodeResolver;
1027
1071
  private readonly nodeBackedToolRuntime;
1028
1072
  private readonly executionHelpers;
1029
1073
  kind: "node";
1030
1074
  outputPorts: readonly ["main"];
1031
1075
  /**
1032
- * Engine applies {@link RunnableNodeConfig.mapInput} + parse before {@link #executeOne}. Prefer modeling
1033
- * prompts as {@code { messages: [{ role, content }, ...] }} so persisted inputs are visible in the UI.
1076
+ * Engine validates {@link RunnableNodeConfig.inputSchema} (Zod) on {@code item.json} before enqueue, then resolves
1077
+ * per-item **`itemValue`** leaves on config before {@link #execute}. Prefer modeling prompts as
1078
+ * {@code { messages: [{ role, content }, ...] }} (on input or config) so persisted inputs are visible in the UI.
1034
1079
  */
1035
1080
  readonly inputSchema: z.ZodUnknown;
1036
1081
  private readonly connectionCredentialExecutionContextFactory;
1037
1082
  /** One resolved model/tools bundle per activation context (same ctx across items in a batch). */
1038
1083
  private readonly preparedByExecutionContext;
1039
1084
  constructor(nodeResolver: NodeResolver, credentialSessions: CredentialSessionService, nodeBackedToolRuntime: NodeBackedToolRuntime, executionHelpers: AIAgentExecutionHelpersFactory);
1040
- executeOne(args: {
1041
- input: unknown;
1042
- item: Item;
1043
- itemIndex: number;
1044
- items: Items;
1045
- ctx: NodeExecutionContext<AIAgent<any, any>>;
1046
- }): Promise<unknown>;
1085
+ execute(args: RunnableNodeExecuteArgs<AIAgent<any, any>>): Promise<unknown>;
1047
1086
  private getOrPrepareExecution;
1048
1087
  /**
1049
1088
  * Resolves the chat model and tools once per activation, then reuses for every item in the batch.
@@ -1085,38 +1124,48 @@ declare class AIAgentNode implements ItemNode<AIAgent<any, any>, unknown, unknow
1085
1124
  }
1086
1125
  //#endregion
1087
1126
  //#region src/nodes/CallbackNode.d.ts
1088
- declare class CallbackNode implements Node<Callback<any, any>> {
1127
+ declare class CallbackNode implements RunnableNode<Callback<any, any>> {
1089
1128
  kind: "node";
1090
1129
  outputPorts: readonly ["main"];
1091
- execute(items: Items, ctx: NodeExecutionContext<Callback<any, any>>): Promise<NodeOutputs>;
1130
+ execute(args: RunnableNodeExecuteArgs<Callback<any, any>>): Promise<unknown>;
1092
1131
  }
1093
1132
  //#endregion
1094
1133
  //#region src/nodes/CallbackResultNormalizerFactory.d.ts
1095
1134
  declare class CallbackResultNormalizer {
1096
- static toNodeOutputs(result: Items | void, items: Items): NodeOutputs;
1135
+ static toPortsEmission(result: Items | PortsEmission | void, items: Items): PortsEmission;
1097
1136
  }
1098
1137
  //#endregion
1099
1138
  //#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;
1139
+ 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;
1140
+ type CallbackOptions = Readonly<{
1141
+ id?: string;
1142
+ retryPolicy?: RetryPolicySpec;
1143
+ nodeErrorHandler?: NodeErrorHandlerSpec;
1144
+ declaredOutputPorts?: ReadonlyArray<string>;
1145
+ }>;
1101
1146
  declare class Callback<TInputJson$1 = unknown, TOutputJson$1 = TInputJson$1> implements RunnableNodeConfig<TInputJson$1, TOutputJson$1> {
1102
1147
  readonly name: string;
1103
1148
  readonly callback: CallbackHandler<TInputJson$1, TOutputJson$1>;
1104
- readonly id?: string | undefined;
1105
1149
  readonly kind: "node";
1106
1150
  readonly type: TypeToken<unknown>;
1107
1151
  readonly execution: {
1108
1152
  readonly hint: "local";
1109
1153
  };
1110
1154
  readonly icon: "lucide:braces";
1111
- constructor(name?: string, callback?: CallbackHandler<TInputJson$1, TOutputJson$1>, id?: string | undefined);
1155
+ readonly emptyBatchExecution: "runOnce";
1156
+ readonly id?: string;
1157
+ readonly retryPolicy?: RetryPolicySpec;
1158
+ readonly nodeErrorHandler?: NodeErrorHandlerSpec;
1159
+ readonly declaredOutputPorts?: ReadonlyArray<string>;
1160
+ constructor(name?: string, callback?: CallbackHandler<TInputJson$1, TOutputJson$1>, idOrOptions?: string | CallbackOptions, options?: CallbackOptions);
1112
1161
  private static defaultCallback;
1113
1162
  }
1114
1163
  //#endregion
1115
1164
  //#region src/nodes/HttpRequestNodeFactory.d.ts
1116
- declare class HttpRequestNode implements Node<HttpRequest<any, any>> {
1165
+ declare class HttpRequestNode implements RunnableNode<HttpRequest<any, any>> {
1117
1166
  readonly kind: "node";
1118
1167
  readonly outputPorts: readonly ["main"];
1119
- execute(items: Items, ctx: NodeExecutionContext<HttpRequest<any, any>>): Promise<NodeOutputs>;
1168
+ execute(args: RunnableNodeExecuteArgs<HttpRequest<any, any>>): Promise<unknown>;
1120
1169
  private executeItem;
1121
1170
  private resolveUrl;
1122
1171
  private asRecord;
@@ -1172,10 +1221,10 @@ declare class HttpRequest<TInputJson$1 = Readonly<{
1172
1221
  }
1173
1222
  //#endregion
1174
1223
  //#region src/nodes/AggregateNode.d.ts
1175
- declare class AggregateNode implements Node<Aggregate<any, any>> {
1224
+ declare class AggregateNode implements RunnableNode<Aggregate<any, any>> {
1176
1225
  kind: "node";
1177
1226
  outputPorts: readonly ["main"];
1178
- execute(items: Items, ctx: NodeExecutionContext<Aggregate<any, any>>): Promise<NodeOutputs>;
1227
+ execute(args: RunnableNodeExecuteArgs<Aggregate<any, any>>): Promise<unknown>;
1179
1228
  }
1180
1229
  //#endregion
1181
1230
  //#region src/nodes/aggregate.d.ts
@@ -1193,10 +1242,10 @@ declare class Aggregate<TIn = unknown, TOut = unknown> implements RunnableNodeCo
1193
1242
  }
1194
1243
  //#endregion
1195
1244
  //#region src/nodes/FilterNode.d.ts
1196
- declare class FilterNode implements Node<Filter<any>> {
1245
+ declare class FilterNode implements RunnableNode<Filter<any>> {
1197
1246
  kind: "node";
1198
1247
  outputPorts: readonly ["main"];
1199
- execute(items: Items, ctx: NodeExecutionContext<Filter<any>>): Promise<NodeOutputs>;
1248
+ execute(args: RunnableNodeExecuteArgs<Filter<any>>): unknown;
1200
1249
  }
1201
1250
  //#endregion
1202
1251
  //#region src/nodes/filter.d.ts
@@ -1214,10 +1263,9 @@ declare class Filter<TIn = unknown> implements RunnableNodeConfig<TIn, TIn> {
1214
1263
  }
1215
1264
  //#endregion
1216
1265
  //#region src/nodes/IfNode.d.ts
1217
- declare class IfNode implements Node<If<any>> {
1266
+ declare class IfNode implements RunnableNode<If<any>> {
1218
1267
  kind: "node";
1219
- outputPorts: readonly ["true", "false"];
1220
- execute(items: Items, ctx: NodeExecutionContext<If<any>>): Promise<NodeOutputs>;
1268
+ execute(args: RunnableNodeExecuteArgs<If<any>>): unknown;
1221
1269
  }
1222
1270
  //#endregion
1223
1271
  //#region src/nodes/if.d.ts
@@ -1231,14 +1279,49 @@ declare class If<TInputJson$1 = unknown> implements RunnableNodeConfig<TInputJso
1231
1279
  readonly hint: "local";
1232
1280
  };
1233
1281
  readonly icon: "lucide:split";
1282
+ readonly declaredOutputPorts: readonly ["true", "false"];
1234
1283
  constructor(name: string, predicate: (item: Item<TInputJson$1>, index: number, items: Items<TInputJson$1>, ctx: NodeExecutionContext<If<TInputJson$1>>) => boolean, id?: string | undefined);
1235
1284
  }
1236
1285
  //#endregion
1286
+ //#region src/nodes/SwitchNode.d.ts
1287
+ /**
1288
+ * Routes each item to exactly one output port. Port names must match workflow edges (see {@link Switch} config).
1289
+ */
1290
+ declare class SwitchNode implements RunnableNode<Switch<any>> {
1291
+ kind: "node";
1292
+ execute(args: RunnableNodeExecuteArgs<Switch<any>>): Promise<unknown>;
1293
+ }
1294
+ //#endregion
1295
+ //#region src/nodes/switch.d.ts
1296
+ type SwitchCaseKeyResolver<TInputJson$1 = unknown> = (item: Item<TInputJson$1>, index: number, items: Items<TInputJson$1>, ctx: NodeExecutionContext<Switch<TInputJson$1>>) => string | Promise<string>;
1297
+ declare class Switch<TInputJson$1 = unknown> implements RunnableNodeConfig<TInputJson$1, TInputJson$1> {
1298
+ readonly name: string;
1299
+ readonly cfg: Readonly<{
1300
+ cases: readonly string[];
1301
+ defaultCase: string;
1302
+ resolveCaseKey: SwitchCaseKeyResolver<TInputJson$1>;
1303
+ }>;
1304
+ readonly id?: string | undefined;
1305
+ readonly kind: "node";
1306
+ readonly type: TypeToken<unknown>;
1307
+ readonly execution: {
1308
+ readonly hint: "local";
1309
+ };
1310
+ readonly icon: "lucide:git-branch-plus";
1311
+ readonly lineageCarry: "carryThrough";
1312
+ readonly declaredOutputPorts: ReadonlyArray<string>;
1313
+ constructor(name: string, cfg: Readonly<{
1314
+ cases: readonly string[];
1315
+ defaultCase: string;
1316
+ resolveCaseKey: SwitchCaseKeyResolver<TInputJson$1>;
1317
+ }>, id?: string | undefined);
1318
+ }
1319
+ //#endregion
1237
1320
  //#region src/nodes/SplitNode.d.ts
1238
- declare class SplitNode implements Node<Split<any, any>> {
1321
+ declare class SplitNode implements RunnableNode<Split<any, any>> {
1239
1322
  kind: "node";
1240
1323
  outputPorts: readonly ["main"];
1241
- execute(items: Items, ctx: NodeExecutionContext<Split<any, any>>): Promise<NodeOutputs>;
1324
+ execute(args: RunnableNodeExecuteArgs<Split<any, any>>): unknown;
1242
1325
  }
1243
1326
  //#endregion
1244
1327
  //#region src/nodes/split.d.ts
@@ -1293,17 +1376,11 @@ declare class ManualTrigger<TOutputJson$1 = unknown> implements TriggerNodeConfi
1293
1376
  }
1294
1377
  //#endregion
1295
1378
  //#region src/nodes/MapDataNode.d.ts
1296
- declare class MapDataNode implements ItemNode<MapData<any, any>, unknown, unknown> {
1379
+ declare class MapDataNode implements RunnableNode<MapData<any, any>> {
1297
1380
  kind: "node";
1298
1381
  outputPorts: readonly ["main"];
1299
1382
  readonly inputSchema: z.ZodUnknown;
1300
- executeOne(args: {
1301
- input: unknown;
1302
- item: Item;
1303
- itemIndex: number;
1304
- items: Items;
1305
- ctx: NodeExecutionContext<MapData<any, any>>;
1306
- }): Promise<unknown>;
1383
+ execute(args: RunnableNodeExecuteArgs<MapData<any, any>>): Promise<unknown>;
1307
1384
  }
1308
1385
  //#endregion
1309
1386
  //#region src/nodes/mapData.d.ts
@@ -1355,10 +1432,10 @@ declare class Merge<TInputJson$1 = unknown, TOutputJson$1 = TInputJson$1> implem
1355
1432
  }
1356
1433
  //#endregion
1357
1434
  //#region src/nodes/NoOpNode.d.ts
1358
- declare class NoOpNode implements Node<NoOp<any>> {
1435
+ declare class NoOpNode implements RunnableNode<NoOp<any>> {
1359
1436
  kind: "node";
1360
1437
  outputPorts: readonly ["main"];
1361
- execute(items: Items, _ctx: NodeExecutionContext<NoOp<any>>): Promise<NodeOutputs>;
1438
+ execute(args: RunnableNodeExecuteArgs<NoOp<any>>): unknown;
1362
1439
  }
1363
1440
  //#endregion
1364
1441
  //#region src/nodes/noOp.d.ts
@@ -1374,12 +1451,12 @@ declare class NoOp<TItemJson = unknown> implements RunnableNodeConfig<TItemJson,
1374
1451
  }
1375
1452
  //#endregion
1376
1453
  //#region src/nodes/SubWorkflowNode.d.ts
1377
- declare class SubWorkflowNode implements Node<SubWorkflow<any, any>> {
1454
+ declare class SubWorkflowNode implements RunnableNode<SubWorkflow<any, any>> {
1378
1455
  private readonly workflows;
1379
1456
  kind: "node";
1380
1457
  outputPorts: readonly ["main"];
1381
1458
  constructor(workflows: WorkflowRunnerService);
1382
- execute(items: Items, ctx: NodeExecutionContext<SubWorkflow<any, any>>): Promise<NodeOutputs>;
1459
+ execute(args: RunnableNodeExecuteArgs<SubWorkflow<any, any>>): Promise<unknown>;
1383
1460
  }
1384
1461
  //#endregion
1385
1462
  //#region src/nodes/subWorkflow.d.ts
@@ -1404,10 +1481,10 @@ declare class WaitDuration {
1404
1481
  }
1405
1482
  //#endregion
1406
1483
  //#region src/nodes/WaitNode.d.ts
1407
- declare class WaitNode implements Node<Wait<any>> {
1484
+ declare class WaitNode implements RunnableNode<Wait<any>> {
1408
1485
  kind: "node";
1409
1486
  outputPorts: readonly ["main"];
1410
- execute(items: Items, ctx: NodeExecutionContext<Wait<any>>): Promise<NodeOutputs>;
1487
+ execute(args: RunnableNodeExecuteArgs<Wait<any>>): Promise<unknown>;
1411
1488
  }
1412
1489
  //#endregion
1413
1490
  //#region src/nodes/wait.d.ts
@@ -1508,11 +1585,17 @@ interface WorkflowAgentOptions<TCurrentJson, TOutputSchema extends z.ZodTypeAny
1508
1585
  declare class WorkflowBranchBuilder<TCurrentJson> {
1509
1586
  private readonly steps;
1510
1587
  constructor(steps?: ReadonlyArray<AnyRunnableNodeConfig>);
1511
- then<TInputJson$1, TOutputJson$1, TConfig extends RunnableNodeConfig<TInputJson$1, TOutputJson$1, TCurrentJson>>(config: TConfig): WorkflowBranchBuilder<RunnableNodeOutputJson<TConfig>>;
1588
+ then<TOutputJson$1, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson$1>>(config: TConfig): WorkflowBranchBuilder<RunnableNodeOutputJson<TConfig>>;
1512
1589
  map<TNextJson$1>(mapper: (item: TCurrentJson) => TNextJson$1): WorkflowBranchBuilder<TNextJson$1>;
1513
1590
  map<TNextJson$1>(name: string, mapper: (item: TCurrentJson) => TNextJson$1, id?: string): WorkflowBranchBuilder<TNextJson$1>;
1514
1591
  wait(duration: number | string): WorkflowBranchBuilder<TCurrentJson>;
1515
1592
  wait(name: string, duration: number | string, id?: string): WorkflowBranchBuilder<TCurrentJson>;
1593
+ split<TElem>(getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[]): WorkflowBranchBuilder<TElem>;
1594
+ split<TElem>(name: string, getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[], id?: string): WorkflowBranchBuilder<TElem>;
1595
+ filter(predicate: (item: Item<TCurrentJson>, index: number, items: Items<TCurrentJson>, ctx: NodeExecutionContext<Filter<TCurrentJson>>) => boolean): WorkflowBranchBuilder<TCurrentJson>;
1596
+ filter(name: string, predicate: (item: Item<TCurrentJson>, index: number, items: Items<TCurrentJson>, ctx: NodeExecutionContext<Filter<TCurrentJson>>) => boolean, id?: string): WorkflowBranchBuilder<TCurrentJson>;
1597
+ aggregate<TOut>(aggregateFn: (items: Items<TCurrentJson>, ctx: NodeExecutionContext<Aggregate<TCurrentJson, TOut>>) => TOut | Promise<TOut>): WorkflowBranchBuilder<TOut>;
1598
+ aggregate<TOut>(name: string, aggregateFn: (items: Items<TCurrentJson>, ctx: NodeExecutionContext<Aggregate<TCurrentJson, TOut>>) => TOut | Promise<TOut>, id?: string): WorkflowBranchBuilder<TOut>;
1516
1599
  agent<TOutputSchema extends z.ZodTypeAny>(options: WorkflowAgentOptions<TCurrentJson, TOutputSchema>): WorkflowBranchBuilder<z.output<TOutputSchema>>;
1517
1600
  agent(options: WorkflowAgentOptions<TCurrentJson, undefined>): WorkflowBranchBuilder<Record<string, unknown>>;
1518
1601
  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 +1605,30 @@ declare class WorkflowBranchBuilder<TCurrentJson> {
1522
1605
  //#endregion
1523
1606
  //#region src/workflowAuthoring/WorkflowChain.types.d.ts
1524
1607
  type BranchCallback<TCurrentJson, TNextJson$1> = (branch: WorkflowBranchBuilder<TCurrentJson>) => WorkflowBranchBuilder<TNextJson$1>;
1608
+ type RouteBranchCallback<TCurrentJson, TNextJson$1> = (branch: WorkflowChain<TCurrentJson>) => WorkflowChain<TNextJson$1>;
1525
1609
  declare class WorkflowChain<TCurrentJson> {
1526
1610
  private readonly chain;
1527
1611
  constructor(chain: ChainCursor<TCurrentJson>);
1528
- then<TInputJson$1, TOutputJson$1, TConfig extends RunnableNodeConfig<TInputJson$1, TOutputJson$1, TCurrentJson>>(config: TConfig): WorkflowChain<RunnableNodeOutputJson<TConfig>>;
1612
+ then<TOutputJson$1, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson$1>>(config: TConfig): WorkflowChain<RunnableNodeOutputJson<TConfig>>;
1529
1613
  map<TNextJson$1>(mapper: (item: TCurrentJson) => TNextJson$1): WorkflowChain<TNextJson$1>;
1530
1614
  map<TNextJson$1>(name: string, mapper: (item: TCurrentJson) => TNextJson$1, id?: string): WorkflowChain<TNextJson$1>;
1531
1615
  wait(duration: number | string): WorkflowChain<TCurrentJson>;
1532
1616
  wait(name: string, duration: number | string, id?: string): WorkflowChain<TCurrentJson>;
1617
+ split<TElem>(getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[]): WorkflowChain<TElem>;
1618
+ split<TElem>(name: string, getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[], id?: string): WorkflowChain<TElem>;
1619
+ filter(predicate: (item: Item<TCurrentJson>, index: number, items: Items<TCurrentJson>, ctx: NodeExecutionContext<Filter<TCurrentJson>>) => boolean): WorkflowChain<TCurrentJson>;
1620
+ filter(name: string, predicate: (item: Item<TCurrentJson>, index: number, items: Items<TCurrentJson>, ctx: NodeExecutionContext<Filter<TCurrentJson>>) => boolean, id?: string): WorkflowChain<TCurrentJson>;
1621
+ aggregate<TOut>(aggregateFn: (items: Items<TCurrentJson>, ctx: NodeExecutionContext<Aggregate<TCurrentJson, TOut>>) => TOut | Promise<TOut>): WorkflowChain<TOut>;
1622
+ aggregate<TOut>(name: string, aggregateFn: (items: Items<TCurrentJson>, ctx: NodeExecutionContext<Aggregate<TCurrentJson, TOut>>) => TOut | Promise<TOut>, id?: string): WorkflowChain<TOut>;
1623
+ merge(): WorkflowChain<TCurrentJson>;
1624
+ merge(cfg: Readonly<{
1625
+ mode: MergeMode;
1626
+ prefer?: ReadonlyArray<string>;
1627
+ }>, id?: string): WorkflowChain<TCurrentJson>;
1628
+ merge(name: string, cfg?: Readonly<{
1629
+ mode: MergeMode;
1630
+ prefer?: ReadonlyArray<string>;
1631
+ }>, id?: string): WorkflowChain<TCurrentJson>;
1533
1632
  if<TBranchJson>(predicate: (item: TCurrentJson) => boolean, branches: Readonly<{
1534
1633
  true?: BranchCallback<TCurrentJson, TBranchJson>;
1535
1634
  false?: BranchCallback<TCurrentJson, TBranchJson>;
@@ -1538,6 +1637,19 @@ declare class WorkflowChain<TCurrentJson> {
1538
1637
  true?: BranchCallback<TCurrentJson, TBranchJson>;
1539
1638
  false?: BranchCallback<TCurrentJson, TBranchJson>;
1540
1639
  }>): WorkflowChain<TBranchJson>;
1640
+ route<TBranchJson>(branches: Readonly<Record<string, RouteBranchCallback<TCurrentJson, TBranchJson> | undefined>>): WorkflowChain<TBranchJson>;
1641
+ switch<TBranchJson>(cfg: Readonly<{
1642
+ cases: readonly string[];
1643
+ defaultCase: string;
1644
+ resolveCaseKey: (item: TCurrentJson) => string | Promise<string>;
1645
+ branches: Readonly<Record<string, RouteBranchCallback<TCurrentJson, TBranchJson> | undefined>>;
1646
+ }>): WorkflowChain<TBranchJson>;
1647
+ switch<TBranchJson>(name: string, cfg: Readonly<{
1648
+ cases: readonly string[];
1649
+ defaultCase: string;
1650
+ resolveCaseKey: (item: TCurrentJson) => string | Promise<string>;
1651
+ branches: Readonly<Record<string, RouteBranchCallback<TCurrentJson, TBranchJson> | undefined>>;
1652
+ }>, id?: string): WorkflowChain<TBranchJson>;
1541
1653
  agent<TOutputSchema extends z.ZodTypeAny>(options: WorkflowAgentOptions<TCurrentJson, TOutputSchema>): WorkflowChain<z.output<TOutputSchema>>;
1542
1654
  agent(options: WorkflowAgentOptions<TCurrentJson, undefined>): WorkflowChain<Record<string, unknown>>;
1543
1655
  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 +1675,10 @@ declare function workflow(id: string): WorkflowAuthoringBuilder;
1563
1675
  * Placeholder runnable node for connection-owned workflow nodes (LLM/tool slots).
1564
1676
  * The engine does not schedule these; they exist for credentials, tokens, and UI identity.
1565
1677
  */
1566
- declare class ConnectionCredentialNode implements Node<ConnectionCredentialNodeConfig> {
1678
+ declare class ConnectionCredentialNode implements RunnableNode<ConnectionCredentialNodeConfig> {
1567
1679
  kind: "node";
1568
1680
  outputPorts: readonly ["main"];
1569
- execute(_items: Items, _ctx: NodeExecutionContext<ConnectionCredentialNodeConfig>): Promise<NodeOutputs>;
1681
+ execute(_args: RunnableNodeExecuteArgs<ConnectionCredentialNodeConfig>): unknown;
1570
1682
  }
1571
1683
  //#endregion
1572
1684
  //#region src/nodes/ConnectionCredentialNodeConfig.d.ts
@@ -1602,5 +1714,5 @@ declare class AIAgentConnectionWorkflowExpander {
1602
1714
  private assertNoIdCollision;
1603
1715
  }
1604
1716
  //#endregion
1605
- export { AIAgent, AIAgentConnectionWorkflowExpander, AIAgentExecutionHelpersFactory, AIAgentNode, AgentItemPortMap, AgentMessageFactory, AgentOutputFactory, AgentToolCallPortMap, Aggregate, AggregateNode, Callback, CallbackHandler, CallbackNode, CallbackResultNormalizer, CanvasIconName, ConnectionCredentialExecutionContextFactory, ConnectionCredentialNode, ConnectionCredentialNodeConfig, ConnectionCredentialNodeConfigFactory, type ExecutedToolCall, Filter, FilterNode, HttpRequest, HttpRequestDownloadMode, HttpRequestNode, HttpRequestOutputJson, If, IfNode, type ItemScopedToolBinding, ManualTrigger, ManualTriggerNode, MapData, MapDataNode, Merge, MergeMode, MergeNode, NoOp, NoOpNode, OpenAIChatModelConfig, OpenAIChatModelFactory, OpenAiChatModelPresets, OpenAiCredentialSession, type PlannedToolCall, type ResolvedTool, Split, SplitNode, SubWorkflow, SubWorkflowNode, Wait, WaitDuration, WaitNode, WebhookRespondNowAndContinueError, WebhookRespondNowError, WebhookTrigger, WebhookTriggerNode, type WorkflowAgentOptions, WorkflowAuthoringBuilder, WorkflowBranchBuilder, WorkflowChain, createWorkflowBuilder, openAiChatModelPresets, registerCoreNodes, workflow };
1717
+ export { AIAgent, AIAgentConnectionWorkflowExpander, AIAgentExecutionHelpersFactory, AIAgentNode, AgentItemPortMap, AgentMessageFactory, AgentOutputFactory, AgentToolCallPortMap, Aggregate, AggregateNode, Callback, CallbackHandler, CallbackNode, CallbackOptions, CallbackResultNormalizer, CanvasIconName, ConnectionCredentialExecutionContextFactory, ConnectionCredentialNode, ConnectionCredentialNodeConfig, ConnectionCredentialNodeConfigFactory, type ExecutedToolCall, Filter, FilterNode, HttpRequest, HttpRequestDownloadMode, HttpRequestNode, HttpRequestOutputJson, If, IfNode, type ItemScopedToolBinding, ManualTrigger, ManualTriggerNode, MapData, MapDataNode, Merge, MergeMode, MergeNode, NoOp, NoOpNode, OpenAIChatModelConfig, OpenAIChatModelFactory, OpenAiChatModelPresets, OpenAiCredentialSession, type PlannedToolCall, type 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
1718
  //# sourceMappingURL=index.d.ts.map