@codemation/core-nodes 0.0.22 → 0.0.25
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 +25 -0
- package/dist/index.cjs +1606 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +191 -29
- package/dist/index.d.ts +191 -29
- package/dist/index.js +1580 -60
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +3 -0
- package/src/nodes/AIAgentConfig.ts +14 -4
- package/src/nodes/AIAgentNode.ts +40 -12
- package/src/nodes/AggregateNode.ts +19 -0
- package/src/nodes/FilterNode.ts +22 -0
- package/src/nodes/MapDataNode.ts +12 -9
- package/src/nodes/SplitNode.ts +26 -0
- package/src/nodes/aggregate.ts +21 -0
- package/src/nodes/filter.ts +23 -0
- package/src/nodes/split.ts +23 -0
- package/src/register.types.ts +6 -0
- package/src/workflowAuthoring/WorkflowBranchBuilder.types.ts +1 -1
- package/src/workflowAuthoring/WorkflowChain.types.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -115,17 +115,17 @@ interface TriggerInstanceId {
|
|
|
115
115
|
}
|
|
116
116
|
//#endregion
|
|
117
117
|
//#region ../core/src/workflow/dsl/workflowBuilderTypes.d.ts
|
|
118
|
-
type AnyRunnableNodeConfig = RunnableNodeConfig<any, any>;
|
|
118
|
+
type AnyRunnableNodeConfig = RunnableNodeConfig<any, any, any>;
|
|
119
119
|
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<
|
|
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;
|
|
122
122
|
type TypesMatch<TLeft, TRight> = [TLeft] extends [TRight] ? ([TRight] extends [TLeft] ? true : false) : false;
|
|
123
123
|
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
124
|
type BranchStepsArg<TCurrentJson, TSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TSteps & ValidStepSequence<TCurrentJson, TSteps>;
|
|
125
|
-
type BranchMoreArgs<TCurrentJson, TFirstStep extends RunnableNodeConfig<
|
|
125
|
+
type BranchMoreArgs<TCurrentJson, TFirstStep extends RunnableNodeConfig<any, any, TCurrentJson>, TRestSteps extends ReadonlyArray<AnyRunnableNodeConfig>> = TRestSteps & ValidStepSequence<RunnableNodeOutputJson<TFirstStep>, TRestSteps>;
|
|
126
126
|
type BooleanWhenOverloads<TCurrentJson, TReturn> = {
|
|
127
127
|
<TSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(branch: boolean, steps: BranchStepsArg<TCurrentJson, TSteps>): TReturn;
|
|
128
|
-
<TFirstStep extends RunnableNodeConfig<
|
|
128
|
+
<TFirstStep extends RunnableNodeConfig<any, any, TCurrentJson>, TRestSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(branch: boolean, step: TFirstStep, ...more: BranchMoreArgs<TCurrentJson, TFirstStep, TRestSteps>): TReturn;
|
|
129
129
|
};
|
|
130
130
|
//#endregion
|
|
131
131
|
//#region ../core/src/workflow/dsl/WhenBuilder.d.ts
|
|
@@ -151,7 +151,7 @@ declare class ChainCursor<TCurrentJson> {
|
|
|
151
151
|
private readonly cursor;
|
|
152
152
|
private readonly cursorOutput;
|
|
153
153
|
constructor(wf: WorkflowBuilder, cursor: NodeRef, cursorOutput: OutputPortKey);
|
|
154
|
-
then<TConfig extends RunnableNodeConfig<
|
|
154
|
+
then<TInputJson$1, TOutputJson$1, TConfig extends RunnableNodeConfig<TInputJson$1, TOutputJson$1, TCurrentJson>>(config: TConfig): ChainCursor<RunnableNodeOutputJson<TConfig>>;
|
|
155
155
|
readonly when: ChainCursorWhenOverloads<TCurrentJson>;
|
|
156
156
|
build(): WorkflowDefinition;
|
|
157
157
|
}
|
|
@@ -279,6 +279,23 @@ interface Node<TConfig extends NodeConfigBase = NodeConfigBase> {
|
|
|
279
279
|
outputPorts: ReadonlyArray<OutputPortKey>;
|
|
280
280
|
execute(items: Items, ctx: NodeExecutionContext<TConfig>): Promise<NodeOutputs>;
|
|
281
281
|
}
|
|
282
|
+
/**
|
|
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`.
|
|
285
|
+
*/
|
|
286
|
+
interface ItemNode<TConfig extends NodeConfigBase = NodeConfigBase, TInputJson$1 = unknown, TOutputJson$1 = unknown> {
|
|
287
|
+
readonly kind: "node";
|
|
288
|
+
readonly outputPorts: readonly ["main"];
|
|
289
|
+
/** When omitted, engine uses {@link RunnableNodeConfig.inputSchema} or `z.unknown()`. */
|
|
290
|
+
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;
|
|
298
|
+
}
|
|
282
299
|
interface MultiInputNode<TConfig extends NodeConfigBase = NodeConfigBase> {
|
|
283
300
|
kind: "node";
|
|
284
301
|
outputPorts: ReadonlyArray<OutputPortKey>;
|
|
@@ -372,11 +389,61 @@ interface NodeConfigBase {
|
|
|
372
389
|
}
|
|
373
390
|
declare const runnableNodeInputType: unique symbol;
|
|
374
391
|
declare const runnableNodeOutputType: unique symbol;
|
|
392
|
+
/** Phantom: JSON shape on the wire from upstream before {@link RunnableNodeConfig.mapInput}. */
|
|
393
|
+
declare const runnableNodeWireType: unique symbol;
|
|
375
394
|
declare const triggerNodeOutputType: unique symbol;
|
|
376
|
-
|
|
395
|
+
/**
|
|
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).
|
|
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 {
|
|
377
433
|
readonly kind: "node";
|
|
378
434
|
readonly [runnableNodeInputType]?: TInputJson$1;
|
|
379
435
|
readonly [runnableNodeOutputType]?: TOutputJson$1;
|
|
436
|
+
readonly [runnableNodeWireType]?: TWireJson$1;
|
|
437
|
+
/**
|
|
438
|
+
* Optional Zod input contract for {@link ItemNode} when not set on the node class.
|
|
439
|
+
* Resolution order: node instance `inputSchema`, then config `inputSchema`, then `z.unknown()`.
|
|
440
|
+
*/
|
|
441
|
+
readonly inputSchema?: ZodType<TInputJson$1>;
|
|
442
|
+
/**
|
|
443
|
+
* Optional per-item mapper: engine applies it before validating against the node’s `inputSchema`.
|
|
444
|
+
* When omitted, the engine validates `item.json` directly.
|
|
445
|
+
*/
|
|
446
|
+
readonly mapInput?: ItemInputMapper<TWireJson$1, TInputJson$1>;
|
|
380
447
|
}
|
|
381
448
|
declare const triggerNodeSetupStateType: unique symbol;
|
|
382
449
|
interface TriggerNodeConfig<TOutputJson$1 = unknown, TSetupState$1 extends JsonValue | undefined = undefined> extends NodeConfigBase {
|
|
@@ -384,8 +451,8 @@ interface TriggerNodeConfig<TOutputJson$1 = unknown, TSetupState$1 extends JsonV
|
|
|
384
451
|
readonly [triggerNodeOutputType]?: TOutputJson$1;
|
|
385
452
|
readonly [triggerNodeSetupStateType]?: TSetupState$1;
|
|
386
453
|
}
|
|
387
|
-
type RunnableNodeInputJson<TConfig extends RunnableNodeConfig<any, any>> = TConfig extends RunnableNodeConfig<infer TInputJson, any> ? TInputJson : never;
|
|
388
|
-
type RunnableNodeOutputJson<TConfig extends RunnableNodeConfig<any, any>> = TConfig extends RunnableNodeConfig<any, infer TOutputJson> ? TOutputJson : never;
|
|
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;
|
|
389
456
|
type TriggerNodeOutputJson<TConfig extends TriggerNodeConfig<any, any>> = TConfig extends TriggerNodeConfig<infer TOutputJson, any> ? TOutputJson : never;
|
|
390
457
|
type TriggerNodeSetupState<TConfig extends TriggerNodeConfig<any, any>> = TConfig extends TriggerNodeConfig<any, infer TSetupState> ? TSetupState : never;
|
|
391
458
|
interface NodeDefinition {
|
|
@@ -625,19 +692,19 @@ type DefinedNodeCredentialBinding = ResolvableCredentialType | Readonly<{
|
|
|
625
692
|
readonly helpUrl?: string;
|
|
626
693
|
}>;
|
|
627
694
|
type DefinedNodeCredentialBindings = Readonly<Record<string, DefinedNodeCredentialBinding>>;
|
|
628
|
-
interface DefinedNode<TKey$1 extends string, TConfig extends CredentialJsonRecord, TInputJson$1, TOutputJson$1, _TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
|
|
695
|
+
interface DefinedNode<TKey$1 extends string, TConfig extends CredentialJsonRecord, TInputJson$1, TOutputJson$1, _TBindings extends DefinedNodeCredentialBindings | undefined = undefined, TWireJson$1 = TInputJson$1> {
|
|
629
696
|
readonly kind: "defined-node";
|
|
630
697
|
readonly key: TKey$1;
|
|
631
698
|
readonly title: string;
|
|
632
699
|
readonly description?: string;
|
|
633
|
-
create(config: TConfig, name?: string, id?: string): RunnableNodeConfig<TInputJson$1, TOutputJson$1>;
|
|
700
|
+
create(config: TConfig, name?: string, id?: string): RunnableNodeConfig<TInputJson$1, TOutputJson$1, TWireJson$1>;
|
|
634
701
|
register(context: {
|
|
635
702
|
registerNode<TValue>(token: TypeToken<TValue>, implementation?: TypeToken<TValue>): void;
|
|
636
703
|
}): void;
|
|
637
704
|
}
|
|
638
705
|
//#endregion
|
|
639
706
|
//#region ../core/src/ai/NodeBackedToolConfig.d.ts
|
|
640
|
-
declare class NodeBackedToolConfig<TNodeConfig extends RunnableNodeConfig<any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> implements ToolConfig {
|
|
707
|
+
declare class NodeBackedToolConfig<TNodeConfig extends RunnableNodeConfig<any, any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> implements ToolConfig {
|
|
641
708
|
readonly name: string;
|
|
642
709
|
readonly node: TNodeConfig;
|
|
643
710
|
readonly type: TypeToken<unknown>;
|
|
@@ -736,7 +803,7 @@ interface ChatModelFactory<TConfig extends ChatModelConfig = ChatModelConfig> {
|
|
|
736
803
|
ctx: NodeExecutionContext<any>;
|
|
737
804
|
}>): Promise<LangChainChatModelLike> | LangChainChatModelLike;
|
|
738
805
|
}
|
|
739
|
-
type NodeBackedToolInputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown> = Readonly<{
|
|
806
|
+
type NodeBackedToolInputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, any, any>, TToolInput = unknown> = Readonly<{
|
|
740
807
|
input: TToolInput;
|
|
741
808
|
item: Item;
|
|
742
809
|
itemIndex: number;
|
|
@@ -744,7 +811,7 @@ type NodeBackedToolInputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, a
|
|
|
744
811
|
ctx: NodeExecutionContext<any>;
|
|
745
812
|
node: TNodeConfig;
|
|
746
813
|
}>;
|
|
747
|
-
type NodeBackedToolOutputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown> = Readonly<{
|
|
814
|
+
type NodeBackedToolOutputMapperArgs<TNodeConfig extends RunnableNodeConfig<any, any, any>, TToolInput = unknown> = Readonly<{
|
|
748
815
|
input: TToolInput;
|
|
749
816
|
item: Item;
|
|
750
817
|
itemIndex: number;
|
|
@@ -753,9 +820,9 @@ type NodeBackedToolOutputMapperArgs<TNodeConfig extends RunnableNodeConfig<any,
|
|
|
753
820
|
node: TNodeConfig;
|
|
754
821
|
outputs: NodeOutputs;
|
|
755
822
|
}>;
|
|
756
|
-
type NodeBackedToolInputMapper<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown> = (args: NodeBackedToolInputMapperArgs<TNodeConfig, TToolInput>) => Item<RunnableNodeInputJson<TNodeConfig>> | RunnableNodeInputJson<TNodeConfig>;
|
|
757
|
-
type NodeBackedToolOutputMapper<TNodeConfig extends RunnableNodeConfig<any, any>, TToolInput = unknown, TToolOutput = unknown> = (args: NodeBackedToolOutputMapperArgs<TNodeConfig, TToolInput>) => TToolOutput;
|
|
758
|
-
type NodeBackedToolConfigOptions<TNodeConfig extends RunnableNodeConfig<any, any>, TInputSchema extends ZodSchemaAny, TOutputSchema extends ZodSchemaAny> = Readonly<{
|
|
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<{
|
|
759
826
|
description?: string;
|
|
760
827
|
presentation?: AgentCanvasPresentation;
|
|
761
828
|
inputSchema: TInputSchema;
|
|
@@ -763,7 +830,7 @@ type NodeBackedToolConfigOptions<TNodeConfig extends RunnableNodeConfig<any, any
|
|
|
763
830
|
mapInput?: NodeBackedToolInputMapper<TNodeConfig, input<TInputSchema>>;
|
|
764
831
|
mapOutput?: NodeBackedToolOutputMapper<TNodeConfig, input<TInputSchema>, output<TOutputSchema>>;
|
|
765
832
|
}>;
|
|
766
|
-
interface AgentNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> extends RunnableNodeConfig<TInputJson$1, TOutputJson$1> {
|
|
833
|
+
interface AgentNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown, TWireJson$1 = TInputJson$1> extends RunnableNodeConfig<TInputJson$1, TOutputJson$1, TWireJson$1> {
|
|
767
834
|
readonly messages: AgentMessageConfig<TInputJson$1>;
|
|
768
835
|
readonly chatModel: ChatModelConfig;
|
|
769
836
|
readonly tools?: ReadonlyArray<ToolConfig>;
|
|
@@ -841,7 +908,7 @@ declare class AgentToolCallPortMap {
|
|
|
841
908
|
}
|
|
842
909
|
//#endregion
|
|
843
910
|
//#region src/nodes/AIAgentConfig.d.ts
|
|
844
|
-
interface AIAgentOptions<TInputJson$1 = unknown, _TOutputJson = unknown> {
|
|
911
|
+
interface AIAgentOptions<TInputJson$1 = unknown, _TOutputJson = unknown, TWireJson$1 = TInputJson$1> {
|
|
845
912
|
readonly name: string;
|
|
846
913
|
readonly messages: AgentMessageConfig<TInputJson$1>;
|
|
847
914
|
readonly chatModel: ChatModelConfig;
|
|
@@ -849,12 +916,16 @@ interface AIAgentOptions<TInputJson$1 = unknown, _TOutputJson = unknown> {
|
|
|
849
916
|
readonly id?: string;
|
|
850
917
|
readonly retryPolicy?: RetryPolicySpec;
|
|
851
918
|
readonly guardrails?: AgentGuardrailConfig;
|
|
919
|
+
/** Engine applies with {@link RunnableNodeConfig.inputSchema} before {@link AIAgentNode.executeOne}. */
|
|
920
|
+
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>;
|
|
852
923
|
}
|
|
853
924
|
/**
|
|
854
925
|
* AI agent: credential bindings are keyed to connection-owned LLM/tool node ids (ConnectionNodeIdFactory),
|
|
855
926
|
* not to the agent workflow node id.
|
|
856
927
|
*/
|
|
857
|
-
declare class AIAgent<TInputJson$1 = unknown, TOutputJson$1 = unknown> implements RunnableNodeConfig<TInputJson$1, TOutputJson$1>, AgentNodeConfig<TInputJson$1, TOutputJson$1> {
|
|
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> {
|
|
858
929
|
readonly kind: "node";
|
|
859
930
|
readonly type: TypeToken<unknown>;
|
|
860
931
|
readonly execution: {
|
|
@@ -868,7 +939,9 @@ declare class AIAgent<TInputJson$1 = unknown, TOutputJson$1 = unknown> implement
|
|
|
868
939
|
readonly id?: string;
|
|
869
940
|
readonly retryPolicy: RetryPolicySpec;
|
|
870
941
|
readonly guardrails?: AgentGuardrailConfig;
|
|
871
|
-
|
|
942
|
+
readonly inputSchema?: ZodType<TInputJson$1>;
|
|
943
|
+
readonly mapInput?: ItemInputMapper<TWireJson$1, TInputJson$1>;
|
|
944
|
+
constructor(options: AIAgentOptions<TInputJson$1, TOutputJson$1, TWireJson$1>);
|
|
872
945
|
}
|
|
873
946
|
//#endregion
|
|
874
947
|
//#region src/nodes/ConnectionCredentialExecutionContextFactory.d.ts
|
|
@@ -949,17 +1022,31 @@ declare class NodeBackedToolRuntime {
|
|
|
949
1022
|
}
|
|
950
1023
|
//#endregion
|
|
951
1024
|
//#region src/nodes/AIAgentNode.d.ts
|
|
952
|
-
declare class AIAgentNode implements
|
|
1025
|
+
declare class AIAgentNode implements ItemNode<AIAgent<any, any>, unknown, unknown> {
|
|
953
1026
|
private readonly nodeResolver;
|
|
954
1027
|
private readonly nodeBackedToolRuntime;
|
|
955
1028
|
private readonly executionHelpers;
|
|
956
1029
|
kind: "node";
|
|
957
1030
|
outputPorts: readonly ["main"];
|
|
1031
|
+
/**
|
|
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.
|
|
1034
|
+
*/
|
|
1035
|
+
readonly inputSchema: z.ZodUnknown;
|
|
958
1036
|
private readonly connectionCredentialExecutionContextFactory;
|
|
1037
|
+
/** One resolved model/tools bundle per activation context (same ctx across items in a batch). */
|
|
1038
|
+
private readonly preparedByExecutionContext;
|
|
959
1039
|
constructor(nodeResolver: NodeResolver, credentialSessions: CredentialSessionService, nodeBackedToolRuntime: NodeBackedToolRuntime, executionHelpers: AIAgentExecutionHelpersFactory);
|
|
960
|
-
|
|
1040
|
+
executeOne(args: {
|
|
1041
|
+
input: unknown;
|
|
1042
|
+
item: Item;
|
|
1043
|
+
itemIndex: number;
|
|
1044
|
+
items: Items;
|
|
1045
|
+
ctx: NodeExecutionContext<AIAgent<any, any>>;
|
|
1046
|
+
}): Promise<unknown>;
|
|
1047
|
+
private getOrPrepareExecution;
|
|
961
1048
|
/**
|
|
962
|
-
* Resolves the chat model and tools once, then
|
|
1049
|
+
* Resolves the chat model and tools once per activation, then reuses for every item in the batch.
|
|
963
1050
|
*/
|
|
964
1051
|
private prepareExecution;
|
|
965
1052
|
/**
|
|
@@ -1084,6 +1171,48 @@ declare class HttpRequest<TInputJson$1 = Readonly<{
|
|
|
1084
1171
|
get downloadMode(): HttpRequestDownloadMode;
|
|
1085
1172
|
}
|
|
1086
1173
|
//#endregion
|
|
1174
|
+
//#region src/nodes/AggregateNode.d.ts
|
|
1175
|
+
declare class AggregateNode implements Node<Aggregate<any, any>> {
|
|
1176
|
+
kind: "node";
|
|
1177
|
+
outputPorts: readonly ["main"];
|
|
1178
|
+
execute(items: Items, ctx: NodeExecutionContext<Aggregate<any, any>>): Promise<NodeOutputs>;
|
|
1179
|
+
}
|
|
1180
|
+
//#endregion
|
|
1181
|
+
//#region src/nodes/aggregate.d.ts
|
|
1182
|
+
declare class Aggregate<TIn = unknown, TOut = unknown> implements RunnableNodeConfig<TIn, TOut> {
|
|
1183
|
+
readonly name: string;
|
|
1184
|
+
readonly aggregate: (items: Items<TIn>, ctx: NodeExecutionContext<Aggregate<TIn, TOut>>) => TOut | Promise<TOut>;
|
|
1185
|
+
readonly id?: string | undefined;
|
|
1186
|
+
readonly kind: "node";
|
|
1187
|
+
readonly type: TypeToken<unknown>;
|
|
1188
|
+
readonly execution: {
|
|
1189
|
+
readonly hint: "local";
|
|
1190
|
+
};
|
|
1191
|
+
readonly icon: "lucide:layers";
|
|
1192
|
+
constructor(name: string, aggregate: (items: Items<TIn>, ctx: NodeExecutionContext<Aggregate<TIn, TOut>>) => TOut | Promise<TOut>, id?: string | undefined);
|
|
1193
|
+
}
|
|
1194
|
+
//#endregion
|
|
1195
|
+
//#region src/nodes/FilterNode.d.ts
|
|
1196
|
+
declare class FilterNode implements Node<Filter<any>> {
|
|
1197
|
+
kind: "node";
|
|
1198
|
+
outputPorts: readonly ["main"];
|
|
1199
|
+
execute(items: Items, ctx: NodeExecutionContext<Filter<any>>): Promise<NodeOutputs>;
|
|
1200
|
+
}
|
|
1201
|
+
//#endregion
|
|
1202
|
+
//#region src/nodes/filter.d.ts
|
|
1203
|
+
declare class Filter<TIn = unknown> implements RunnableNodeConfig<TIn, TIn> {
|
|
1204
|
+
readonly name: string;
|
|
1205
|
+
readonly predicate: (item: Item<TIn>, index: number, items: Items<TIn>, ctx: NodeExecutionContext<Filter<TIn>>) => boolean;
|
|
1206
|
+
readonly id?: string | undefined;
|
|
1207
|
+
readonly kind: "node";
|
|
1208
|
+
readonly type: TypeToken<unknown>;
|
|
1209
|
+
readonly execution: {
|
|
1210
|
+
readonly hint: "local";
|
|
1211
|
+
};
|
|
1212
|
+
readonly icon: "lucide:filter";
|
|
1213
|
+
constructor(name: string, predicate: (item: Item<TIn>, index: number, items: Items<TIn>, ctx: NodeExecutionContext<Filter<TIn>>) => boolean, id?: string | undefined);
|
|
1214
|
+
}
|
|
1215
|
+
//#endregion
|
|
1087
1216
|
//#region src/nodes/IfNode.d.ts
|
|
1088
1217
|
declare class IfNode implements Node<If<any>> {
|
|
1089
1218
|
kind: "node";
|
|
@@ -1105,6 +1234,32 @@ declare class If<TInputJson$1 = unknown> implements RunnableNodeConfig<TInputJso
|
|
|
1105
1234
|
constructor(name: string, predicate: (item: Item<TInputJson$1>, index: number, items: Items<TInputJson$1>, ctx: NodeExecutionContext<If<TInputJson$1>>) => boolean, id?: string | undefined);
|
|
1106
1235
|
}
|
|
1107
1236
|
//#endregion
|
|
1237
|
+
//#region src/nodes/SplitNode.d.ts
|
|
1238
|
+
declare class SplitNode implements Node<Split<any, any>> {
|
|
1239
|
+
kind: "node";
|
|
1240
|
+
outputPorts: readonly ["main"];
|
|
1241
|
+
execute(items: Items, ctx: NodeExecutionContext<Split<any, any>>): Promise<NodeOutputs>;
|
|
1242
|
+
}
|
|
1243
|
+
//#endregion
|
|
1244
|
+
//#region src/nodes/split.d.ts
|
|
1245
|
+
declare class Split<TIn = unknown, TElem = unknown> implements RunnableNodeConfig<TIn, TElem> {
|
|
1246
|
+
readonly name: string;
|
|
1247
|
+
readonly getElements: (item: Item<TIn>, ctx: NodeExecutionContext<Split<TIn, TElem>>) => readonly TElem[];
|
|
1248
|
+
readonly id?: string | undefined;
|
|
1249
|
+
readonly kind: "node";
|
|
1250
|
+
readonly type: TypeToken<unknown>;
|
|
1251
|
+
readonly execution: {
|
|
1252
|
+
readonly hint: "local";
|
|
1253
|
+
};
|
|
1254
|
+
/**
|
|
1255
|
+
* When splitting yields zero items for a batch, downstream single-input nodes still run once with an empty batch.
|
|
1256
|
+
* Mirrors {@link MapData}'s empty-output behavior.
|
|
1257
|
+
*/
|
|
1258
|
+
readonly continueWhenEmptyOutput: true;
|
|
1259
|
+
readonly icon: "lucide:ungroup";
|
|
1260
|
+
constructor(name: string, getElements: (item: Item<TIn>, ctx: NodeExecutionContext<Split<TIn, TElem>>) => readonly TElem[], id?: string | undefined);
|
|
1261
|
+
}
|
|
1262
|
+
//#endregion
|
|
1108
1263
|
//#region src/nodes/ManualTriggerNode.d.ts
|
|
1109
1264
|
/**
|
|
1110
1265
|
* Setup is intentionally a no-op: the engine host can run workflows manually
|
|
@@ -1138,10 +1293,17 @@ declare class ManualTrigger<TOutputJson$1 = unknown> implements TriggerNodeConfi
|
|
|
1138
1293
|
}
|
|
1139
1294
|
//#endregion
|
|
1140
1295
|
//#region src/nodes/MapDataNode.d.ts
|
|
1141
|
-
declare class MapDataNode implements
|
|
1296
|
+
declare class MapDataNode implements ItemNode<MapData<any, any>, unknown, unknown> {
|
|
1142
1297
|
kind: "node";
|
|
1143
1298
|
outputPorts: readonly ["main"];
|
|
1144
|
-
|
|
1299
|
+
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>;
|
|
1145
1307
|
}
|
|
1146
1308
|
//#endregion
|
|
1147
1309
|
//#region src/nodes/mapData.d.ts
|
|
@@ -1346,7 +1508,7 @@ interface WorkflowAgentOptions<TCurrentJson, TOutputSchema extends z.ZodTypeAny
|
|
|
1346
1508
|
declare class WorkflowBranchBuilder<TCurrentJson> {
|
|
1347
1509
|
private readonly steps;
|
|
1348
1510
|
constructor(steps?: ReadonlyArray<AnyRunnableNodeConfig>);
|
|
1349
|
-
then<TConfig extends RunnableNodeConfig<
|
|
1511
|
+
then<TInputJson$1, TOutputJson$1, TConfig extends RunnableNodeConfig<TInputJson$1, TOutputJson$1, TCurrentJson>>(config: TConfig): WorkflowBranchBuilder<RunnableNodeOutputJson<TConfig>>;
|
|
1350
1512
|
map<TNextJson$1>(mapper: (item: TCurrentJson) => TNextJson$1): WorkflowBranchBuilder<TNextJson$1>;
|
|
1351
1513
|
map<TNextJson$1>(name: string, mapper: (item: TCurrentJson) => TNextJson$1, id?: string): WorkflowBranchBuilder<TNextJson$1>;
|
|
1352
1514
|
wait(duration: number | string): WorkflowBranchBuilder<TCurrentJson>;
|
|
@@ -1363,7 +1525,7 @@ type BranchCallback<TCurrentJson, TNextJson$1> = (branch: WorkflowBranchBuilder<
|
|
|
1363
1525
|
declare class WorkflowChain<TCurrentJson> {
|
|
1364
1526
|
private readonly chain;
|
|
1365
1527
|
constructor(chain: ChainCursor<TCurrentJson>);
|
|
1366
|
-
then<TConfig extends RunnableNodeConfig<
|
|
1528
|
+
then<TInputJson$1, TOutputJson$1, TConfig extends RunnableNodeConfig<TInputJson$1, TOutputJson$1, TCurrentJson>>(config: TConfig): WorkflowChain<RunnableNodeOutputJson<TConfig>>;
|
|
1367
1529
|
map<TNextJson$1>(mapper: (item: TCurrentJson) => TNextJson$1): WorkflowChain<TNextJson$1>;
|
|
1368
1530
|
map<TNextJson$1>(name: string, mapper: (item: TCurrentJson) => TNextJson$1, id?: string): WorkflowChain<TNextJson$1>;
|
|
1369
1531
|
wait(duration: number | string): WorkflowChain<TCurrentJson>;
|
|
@@ -1440,5 +1602,5 @@ declare class AIAgentConnectionWorkflowExpander {
|
|
|
1440
1602
|
private assertNoIdCollision;
|
|
1441
1603
|
}
|
|
1442
1604
|
//#endregion
|
|
1443
|
-
export { AIAgent, AIAgentConnectionWorkflowExpander, AIAgentExecutionHelpersFactory, AIAgentNode, AgentItemPortMap, AgentMessageFactory, AgentOutputFactory, AgentToolCallPortMap, Callback, CallbackHandler, CallbackNode, CallbackResultNormalizer, CanvasIconName, ConnectionCredentialExecutionContextFactory, ConnectionCredentialNode, ConnectionCredentialNodeConfig, ConnectionCredentialNodeConfigFactory, type ExecutedToolCall, 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, SubWorkflow, SubWorkflowNode, Wait, WaitDuration, WaitNode, WebhookRespondNowAndContinueError, WebhookRespondNowError, WebhookTrigger, WebhookTriggerNode, type WorkflowAgentOptions, WorkflowAuthoringBuilder, WorkflowBranchBuilder, WorkflowChain, createWorkflowBuilder, openAiChatModelPresets, registerCoreNodes, workflow };
|
|
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 };
|
|
1444
1606
|
//# sourceMappingURL=index.d.ts.map
|