@codemation/core-nodes 0.1.1 → 0.3.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
@@ -311,8 +311,10 @@ interface TriggerCleanupHandle {
311
311
  stop(): Promise<void> | void;
312
312
  }
313
313
  /**
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).
314
+ * Per-item runnable node: return JSON, an array to fan-out on `main`, an explicit `Item`, or {@link emitPorts}
315
+ * for multi-port emission. Engine applies `inputSchema.parse(item.json)` and passes the result as `args.input`
316
+ * (wire `item.json` is unchanged). Transform helpers may opt into binary preservation, while routers and
317
+ * pass-through nodes should return explicit items when they need to preserve full item state.
316
318
  */
317
319
  interface RunnableNodeExecuteArgs<TConfig extends RunnableNodeConfig<any, any> = RunnableNodeConfig<any, any>, TInputJson$1 = unknown> {
318
320
  readonly input: TInputJson$1;
@@ -442,7 +444,6 @@ interface NodeConfigBase {
442
444
  declare const runnableNodeInputType: unique symbol;
443
445
  declare const runnableNodeOutputType: unique symbol;
444
446
  declare const triggerNodeOutputType: unique symbol;
445
- type LineageCarryPolicy = "emitOnly" | "carryThrough";
446
447
  /**
447
448
  * Runnable node: **`TInputJson`** is what **`inputSchema`** validates on **`item.json`** (the wire payload).
448
449
  * **`TOutputJson`** is emitted `item.json` on outputs.
@@ -456,11 +457,6 @@ interface RunnableNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> ex
456
457
  * Resolution order: node instance `inputSchema`, then config `inputSchema`, then `z.unknown()`.
457
458
  */
458
459
  readonly inputSchema?: ZodType<TInputJson$1>;
459
- /**
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
460
  /**
465
461
  * When an activation receives **zero** input items, the engine normally runs `execute` zero times.
466
462
  * Set to **`runOnce`** to run `execute` once with an empty `items` batch (and a synthetic wire item for schema parsing).
@@ -594,6 +590,12 @@ type CredentialFieldSchema = Readonly<{
594
590
  type: "string" | "password" | "textarea" | "json" | "boolean";
595
591
  required?: true;
596
592
  order?: number;
593
+ /**
594
+ * Where this field appears in the credential dialog. Use `"advanced"` for optional or
595
+ * power-user fields; they render inside a collapsible section (see `CredentialTypeDefinition.advancedSection`).
596
+ * Defaults to `"default"` when omitted.
597
+ */
598
+ visibility?: "default" | "advanced";
597
599
  placeholder?: string;
598
600
  helpText?: string;
599
601
  /** When set, host resolves this field from process.env at runtime; env wins over stored values. */
@@ -648,12 +650,25 @@ type CredentialOAuth2AuthDefinition = Readonly<{
648
650
  clientSecretFieldKey?: string;
649
651
  }>;
650
652
  type CredentialAuthDefinition = CredentialOAuth2AuthDefinition;
653
+ type CredentialAdvancedSectionPresentation = Readonly<{
654
+ /** Collapsible section title (default: "Advanced"). */
655
+ title?: string;
656
+ /** Optional short helper text shown inside the section (above the fields). */
657
+ description?: string;
658
+ /** When true, the advanced section starts expanded. Default: false (collapsed). */
659
+ defaultOpen?: boolean;
660
+ }>;
651
661
  type CredentialTypeDefinition = Readonly<{
652
662
  typeId: CredentialTypeId;
653
663
  displayName: string;
654
664
  description?: string;
655
665
  publicFields?: ReadonlyArray<CredentialFieldSchema>;
656
666
  secretFields?: ReadonlyArray<CredentialFieldSchema>;
667
+ /**
668
+ * Optional labels for the collapsible block that contains every field with `visibility: "advanced"`.
669
+ * If omitted, the UI still shows that block with defaults (title "Advanced", collapsed).
670
+ */
671
+ advancedSection?: CredentialAdvancedSectionPresentation;
657
672
  supportedSourceKinds?: ReadonlyArray<CredentialMaterialSourceKind>;
658
673
  auth?: CredentialAuthDefinition;
659
674
  }>;
@@ -827,6 +842,16 @@ interface ChatModelConfig {
827
842
  interface LangChainChatModelLike {
828
843
  invoke(input: unknown, options?: unknown): Promise<unknown>;
829
844
  bindTools?(tools: ReadonlyArray<unknown>): LangChainChatModelLike;
845
+ withStructuredOutput?(outputSchema: ZodSchemaAny, config?: ChatModelStructuredOutputOptions): LangChainStructuredOutputModelLike;
846
+ }
847
+ interface LangChainStructuredOutputModelLike {
848
+ invoke(input: unknown, options?: unknown): Promise<unknown>;
849
+ }
850
+ interface ChatModelStructuredOutputOptions {
851
+ readonly method?: "jsonSchema" | "functionCalling" | "jsonMode";
852
+ readonly strict?: boolean;
853
+ readonly includeRaw?: boolean;
854
+ readonly tools?: ReadonlyArray<unknown>;
830
855
  }
831
856
  interface ChatModelFactory<TConfig extends ChatModelConfig = ChatModelConfig> {
832
857
  create(args: Readonly<{
@@ -866,6 +891,7 @@ interface AgentNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> exten
866
891
  readonly chatModel: ChatModelConfig;
867
892
  readonly tools?: ReadonlyArray<ToolConfig>;
868
893
  readonly guardrails?: AgentGuardrailConfig;
894
+ readonly outputSchema?: ZodType<TOutputJson$1>;
869
895
  }
870
896
  //#endregion
871
897
  //#region ../core/src/execution/ItemValueResolver.d.ts
@@ -876,18 +902,27 @@ declare class ItemValueResolver {
876
902
  resolveConfigForItem<TConfig extends RunnableNodeConfig<any, any>>(ctx: NodeExecutionContext<TConfig>, item: Item, itemIndex: number, items: ReadonlyArray<Item>): Promise<NodeExecutionContext<TConfig>>;
877
903
  }
878
904
  //#endregion
905
+ //#region ../core/src/execution/RunnableOutputBehaviorResolver.d.ts
906
+ type RunnableOutputBehavior = Readonly<{
907
+ keepBinaries: boolean;
908
+ }>;
909
+ declare class RunnableOutputBehaviorResolver {
910
+ resolve(config: RunnableNodeConfig): RunnableOutputBehavior;
911
+ private isKeepBinariesEnabled;
912
+ }
913
+ //#endregion
879
914
  //#region ../core/src/execution/NodeOutputNormalizer.d.ts
880
915
  declare class NodeOutputNormalizer {
881
916
  normalizeExecuteResult(args: Readonly<{
882
917
  baseItem: Item;
883
918
  raw: unknown;
884
- carry: LineageCarryPolicy;
919
+ behavior: RunnableOutputBehavior;
885
920
  }>): NodeOutputs;
886
921
  private arrayFanOutToMain;
887
922
  private emitPortsToOutputs;
888
923
  private normalizePortPayload;
889
924
  private isItemLike;
890
- private applyLineage;
925
+ private applyOutput;
891
926
  }
892
927
  //#endregion
893
928
  //#region src/chatModels/openAiChatModelConfig.d.ts
@@ -916,6 +951,15 @@ declare class OpenAIChatModelFactory implements ChatModelFactory<OpenAIChatModel
916
951
  }>): Promise<LangChainChatModelLike>;
917
952
  }
918
953
  //#endregion
954
+ //#region src/chatModels/OpenAIStructuredOutputMethodFactory.d.ts
955
+ declare class OpenAIStructuredOutputMethodFactory {
956
+ private static readonly isoDatePattern;
957
+ create(chatModelConfig: ChatModelConfig): ChatModelStructuredOutputOptions | undefined;
958
+ private readModelName;
959
+ private supportsJsonSchema;
960
+ private supportsSnapshotAtOrAfter;
961
+ }
962
+ //#endregion
919
963
  //#region src/chatModels/OpenAiCredentialSession.d.ts
920
964
  /** Resolved credential session for OpenAI-compatible chat models (API key + optional custom base URL). */
921
965
  type OpenAiCredentialSession = Readonly<{
@@ -955,45 +999,6 @@ declare class AgentOutputFactory {
955
999
  static fromAgentContent(content: string): unknown;
956
1000
  }
957
1001
  //#endregion
958
- //#region src/nodes/AgentToolCallPortMapFactory.d.ts
959
- declare class AgentToolCallPortMap {
960
- static fromInput(input: unknown): NodeInputsByPort;
961
- }
962
- //#endregion
963
- //#region src/nodes/AIAgentConfig.d.ts
964
- interface AIAgentOptions<TInputJson$1 = unknown, _TOutputJson = unknown> {
965
- readonly name: string;
966
- readonly messages: AgentMessageConfig<TInputJson$1>;
967
- readonly chatModel: ChatModelConfig;
968
- readonly tools?: ReadonlyArray<ToolConfig>;
969
- readonly id?: string;
970
- readonly retryPolicy?: RetryPolicySpec;
971
- readonly guardrails?: AgentGuardrailConfig;
972
- /** Engine applies with {@link RunnableNodeConfig.inputSchema} before {@link AIAgentNode.execute}. */
973
- readonly inputSchema?: ZodType<TInputJson$1>;
974
- }
975
- /**
976
- * AI agent: credential bindings are keyed to connection-owned LLM/tool node ids (ConnectionNodeIdFactory),
977
- * not to the agent workflow node id.
978
- */
979
- declare class AIAgent<TInputJson$1 = unknown, TOutputJson$1 = unknown> implements RunnableNodeConfig<TInputJson$1, TOutputJson$1>, AgentNodeConfig<TInputJson$1, TOutputJson$1> {
980
- readonly kind: "node";
981
- readonly type: TypeToken<unknown>;
982
- readonly execution: {
983
- readonly hint: "local";
984
- };
985
- readonly icon: "lucide:bot";
986
- readonly name: string;
987
- readonly messages: AgentMessageConfig<TInputJson$1>;
988
- readonly chatModel: ChatModelConfig;
989
- readonly tools: ReadonlyArray<ToolConfig>;
990
- readonly id?: string;
991
- readonly retryPolicy: RetryPolicySpec;
992
- readonly guardrails?: AgentGuardrailConfig;
993
- readonly inputSchema?: ZodType<TInputJson$1>;
994
- constructor(options: AIAgentOptions<TInputJson$1, TOutputJson$1>);
995
- }
996
- //#endregion
997
1002
  //#region src/nodes/ConnectionCredentialExecutionContextFactory.d.ts
998
1003
  /**
999
1004
  * Builds a {@link NodeExecutionContext} whose identity for credential binding and `getCredential`
@@ -1054,19 +1059,106 @@ declare class AIAgentExecutionHelpersFactory {
1054
1059
  * (duplicate `zod` copies), fall back to Zod `toJSONSchema` with draft-07.
1055
1060
  * - Strip root `$schema` for OpenAI; normalize invalid `required` keywords for cfworker; ensure `properties`.
1056
1061
  */
1057
- private normalizeToolInputSchemaForOpenAiDynamicStructuredTool;
1062
+ createJsonSchemaRecord(inputSchema: ZodSchemaAny, options: Readonly<{
1063
+ schemaName: string;
1064
+ requireObjectRoot: boolean;
1065
+ }>): Record<string, unknown>;
1058
1066
  /**
1059
1067
  * `@cfworker/json-schema` iterates `schema.required` with `for...of`; it must be a string array or absent.
1060
1068
  */
1061
1069
  private sanitizeJsonSchemaRequiredKeywordsForCfworker;
1062
1070
  }
1063
1071
  //#endregion
1072
+ //#region src/nodes/AgentStructuredOutputRepairPromptFactory.d.ts
1073
+ declare class AgentStructuredOutputRepairPromptFactory {
1074
+ private readonly executionHelpers;
1075
+ private static readonly maxSchemaLength;
1076
+ private static readonly maxInvalidContentLength;
1077
+ private static readonly maxValidationErrorLength;
1078
+ constructor(executionHelpers: AIAgentExecutionHelpersFactory);
1079
+ create(args: Readonly<{
1080
+ schema: ZodSchemaAny;
1081
+ invalidContent: string;
1082
+ validationError: string;
1083
+ }>): ReadonlyArray<AgentMessageDto>;
1084
+ private truncate;
1085
+ }
1086
+ //#endregion
1087
+ //#region src/nodes/AgentStructuredOutputRunner.d.ts
1088
+ declare class AgentStructuredOutputRunner {
1089
+ private readonly repairPromptFactory;
1090
+ private readonly openAiStructuredOutputMethodFactory;
1091
+ private static readonly repairAttemptCount;
1092
+ constructor(repairPromptFactory: AgentStructuredOutputRepairPromptFactory, openAiStructuredOutputMethodFactory: OpenAIStructuredOutputMethodFactory);
1093
+ resolve<TOutput>(args: Readonly<{
1094
+ model: LangChainChatModelLike;
1095
+ chatModelConfig: ChatModelConfig;
1096
+ schema: ZodSchemaAny;
1097
+ conversation: ReadonlyArray<BaseMessage>;
1098
+ rawFinalResponse?: AIMessage;
1099
+ agentName: string;
1100
+ nodeId: string;
1101
+ invokeTextModel: (messages: ReadonlyArray<BaseMessage>) => Promise<AIMessage>;
1102
+ invokeStructuredModel: (model: LangChainStructuredOutputModelLike, messages: ReadonlyArray<BaseMessage>) => Promise<unknown>;
1103
+ }>): Promise<TOutput>;
1104
+ private retryWithRepairPrompt;
1105
+ private createStructuredOutputModel;
1106
+ private getStructuredOutputOptions;
1107
+ private supportsNativeStructuredOutput;
1108
+ private tryParseAndValidate;
1109
+ private tryValidateStructuredValue;
1110
+ private summarizeError;
1111
+ private toJson;
1112
+ }
1113
+ //#endregion
1114
+ //#region src/nodes/AgentToolCallPortMapFactory.d.ts
1115
+ declare class AgentToolCallPortMap {
1116
+ static fromInput(input: unknown): NodeInputsByPort;
1117
+ }
1118
+ //#endregion
1119
+ //#region src/nodes/AIAgentConfig.d.ts
1120
+ interface AIAgentOptions<TInputJson$1 = unknown, _TOutputJson = unknown> {
1121
+ readonly name: string;
1122
+ readonly messages: AgentMessageConfig<TInputJson$1>;
1123
+ readonly chatModel: ChatModelConfig;
1124
+ readonly tools?: ReadonlyArray<ToolConfig>;
1125
+ readonly id?: string;
1126
+ readonly retryPolicy?: RetryPolicySpec;
1127
+ readonly guardrails?: AgentGuardrailConfig;
1128
+ /** Engine applies with {@link RunnableNodeConfig.inputSchema} before {@link AIAgentNode.execute}. */
1129
+ readonly inputSchema?: ZodType<TInputJson$1>;
1130
+ readonly outputSchema?: ZodType<_TOutputJson>;
1131
+ }
1132
+ /**
1133
+ * AI agent: credential bindings are keyed to connection-owned LLM/tool node ids (ConnectionNodeIdFactory),
1134
+ * not to the agent workflow node id.
1135
+ */
1136
+ declare class AIAgent<TInputJson$1 = unknown, TOutputJson$1 = unknown> implements RunnableNodeConfig<TInputJson$1, TOutputJson$1>, AgentNodeConfig<TInputJson$1, TOutputJson$1> {
1137
+ readonly kind: "node";
1138
+ readonly type: TypeToken<unknown>;
1139
+ readonly execution: {
1140
+ readonly hint: "local";
1141
+ };
1142
+ readonly icon: "lucide:bot";
1143
+ readonly name: string;
1144
+ readonly messages: AgentMessageConfig<TInputJson$1>;
1145
+ readonly chatModel: ChatModelConfig;
1146
+ readonly tools: ReadonlyArray<ToolConfig>;
1147
+ readonly id?: string;
1148
+ readonly retryPolicy: RetryPolicySpec;
1149
+ readonly guardrails?: AgentGuardrailConfig;
1150
+ readonly inputSchema?: ZodType<TInputJson$1>;
1151
+ readonly outputSchema?: ZodType<TOutputJson$1>;
1152
+ constructor(options: AIAgentOptions<TInputJson$1, TOutputJson$1>);
1153
+ }
1154
+ //#endregion
1064
1155
  //#region src/nodes/NodeBackedToolRuntime.d.ts
1065
1156
  declare class NodeBackedToolRuntime {
1066
1157
  private readonly nodeResolver;
1067
1158
  private readonly itemValueResolver;
1068
1159
  private readonly outputNormalizer;
1069
- constructor(nodeResolver: NodeResolver, itemValueResolver: ItemValueResolver, outputNormalizer: NodeOutputNormalizer);
1160
+ private readonly outputBehaviorResolver;
1161
+ constructor(nodeResolver: NodeResolver, itemValueResolver: ItemValueResolver, outputNormalizer: NodeOutputNormalizer, outputBehaviorResolver: RunnableOutputBehaviorResolver);
1070
1162
  execute(config: NodeBackedToolConfig<any, ZodSchemaAny, ZodSchemaAny>, args: ToolExecuteArgs): Promise<unknown>;
1071
1163
  private executeResolvedNode;
1072
1164
  private isRunnableNode;
@@ -1078,6 +1170,7 @@ declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
1078
1170
  private readonly nodeResolver;
1079
1171
  private readonly nodeBackedToolRuntime;
1080
1172
  private readonly executionHelpers;
1173
+ private readonly structuredOutputRunner;
1081
1174
  kind: "node";
1082
1175
  outputPorts: readonly ["main"];
1083
1176
  /**
@@ -1089,7 +1182,7 @@ declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
1089
1182
  private readonly connectionCredentialExecutionContextFactory;
1090
1183
  /** One resolved model/tools bundle per activation context (same ctx across items in a batch). */
1091
1184
  private readonly preparedByExecutionContext;
1092
- constructor(nodeResolver: NodeResolver, credentialSessions: CredentialSessionService, nodeBackedToolRuntime: NodeBackedToolRuntime, executionHelpers: AIAgentExecutionHelpersFactory);
1185
+ constructor(nodeResolver: NodeResolver, credentialSessions: CredentialSessionService, nodeBackedToolRuntime: NodeBackedToolRuntime, executionHelpers: AIAgentExecutionHelpersFactory, structuredOutputRunner: AgentStructuredOutputRunner);
1093
1186
  execute(args: RunnableNodeExecuteArgs<AIAgent<any, any>>): Promise<unknown>;
1094
1187
  private getOrPrepareExecution;
1095
1188
  /**
@@ -1107,11 +1200,13 @@ declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
1107
1200
  private cannotExecuteAnotherToolRound;
1108
1201
  private finishOrThrowWhenTurnCapHitWithToolCalls;
1109
1202
  private appendAssistantAndToolMessages;
1203
+ private resolveFinalOutputJson;
1110
1204
  private buildOutputItem;
1111
1205
  private bindToolsToModel;
1112
1206
  private resolveTools;
1113
1207
  private createItemScopedTools;
1114
1208
  private invokeModel;
1209
+ private invokeStructuredModel;
1115
1210
  private markQueuedTools;
1116
1211
  private executeToolCalls;
1117
1212
  private planToolCalls;
@@ -1128,7 +1223,12 @@ declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
1128
1223
  * json-schema validation). {@link NodeBackedToolConfig#toolKind} is stable across copies.
1129
1224
  */
1130
1225
  private isNodeBackedToolConfig;
1226
+ /**
1227
+ * Callable tools use {@link CallableToolConfig#toolKind} for cross-package / JSON round-trip safety.
1228
+ */
1229
+ private isCallableToolConfig;
1131
1230
  private resolveGuardrails;
1231
+ private getAgentDisplayName;
1132
1232
  }
1133
1233
  //#endregion
1134
1234
  //#region src/nodes/CallbackNode.d.ts
@@ -1316,7 +1416,6 @@ declare class Switch<TInputJson$1 = unknown> implements RunnableNodeConfig<TInpu
1316
1416
  readonly hint: "local";
1317
1417
  };
1318
1418
  readonly icon: "lucide:git-branch-plus";
1319
- readonly lineageCarry: "carryThrough";
1320
1419
  readonly declaredOutputPorts: ReadonlyArray<string>;
1321
1420
  constructor(name: string, cfg: Readonly<{
1322
1421
  cases: readonly string[];
@@ -1392,10 +1491,14 @@ declare class MapDataNode implements RunnableNode<MapData<any, any>> {
1392
1491
  }
1393
1492
  //#endregion
1394
1493
  //#region src/nodes/mapData.d.ts
1494
+ interface MapDataOptions {
1495
+ readonly id?: string;
1496
+ readonly keepBinaries?: boolean;
1497
+ }
1395
1498
  declare class MapData<TInputJson$1 = unknown, TOutputJson$1 = unknown> implements RunnableNodeConfig<TInputJson$1, TOutputJson$1> {
1396
1499
  readonly name: string;
1397
1500
  readonly map: (item: Item<TInputJson$1>, ctx: NodeExecutionContext<MapData<TInputJson$1, TOutputJson$1>>) => TOutputJson$1;
1398
- readonly id?: string | undefined;
1501
+ private readonly options;
1399
1502
  readonly kind: "node";
1400
1503
  readonly type: TypeToken<unknown>;
1401
1504
  readonly execution: {
@@ -1403,7 +1506,9 @@ declare class MapData<TInputJson$1 = unknown, TOutputJson$1 = unknown> implement
1403
1506
  };
1404
1507
  /** Zero mapped items should still allow downstream nodes to run. */
1405
1508
  readonly continueWhenEmptyOutput: true;
1406
- constructor(name: string, map: (item: Item<TInputJson$1>, ctx: NodeExecutionContext<MapData<TInputJson$1, TOutputJson$1>>) => TOutputJson$1, id?: string | undefined);
1509
+ readonly keepBinaries: boolean;
1510
+ constructor(name: string, map: (item: Item<TInputJson$1>, ctx: NodeExecutionContext<MapData<TInputJson$1, TOutputJson$1>>) => TOutputJson$1, options?: MapDataOptions);
1511
+ get id(): string | undefined;
1407
1512
  }
1408
1513
  //#endregion
1409
1514
  //#region src/nodes/MergeNode.d.ts
@@ -1578,9 +1683,9 @@ declare function createWorkflowBuilder(meta: Readonly<{
1578
1683
  }>): WorkflowBuilder;
1579
1684
  //#endregion
1580
1685
  //#region src/workflowAuthoring/WorkflowAuthoringOptions.types.d.ts
1581
- type WorkflowAgentPrompt<TCurrentJson> = string | ((item: TCurrentJson) => string);
1686
+ type WorkflowAgentMessages<TCurrentJson> = AgentMessageConfig<TCurrentJson>;
1582
1687
  interface WorkflowAgentOptions<TCurrentJson, TOutputSchema extends z.ZodTypeAny | undefined = undefined> {
1583
- readonly prompt: WorkflowAgentPrompt<TCurrentJson>;
1688
+ readonly messages: WorkflowAgentMessages<TCurrentJson>;
1584
1689
  readonly model: string | ChatModelConfig;
1585
1690
  readonly tools?: ReadonlyArray<ToolConfig>;
1586
1691
  readonly outputSchema?: TOutputSchema;
@@ -1590,12 +1695,13 @@ interface WorkflowAgentOptions<TCurrentJson, TOutputSchema extends z.ZodTypeAny
1590
1695
  }
1591
1696
  //#endregion
1592
1697
  //#region src/workflowAuthoring/WorkflowBranchBuilder.types.d.ts
1698
+ type WorkflowMapCallback$1<TCurrentJson, TNextJson$1> = (item: Item<TCurrentJson>, ctx: NodeExecutionContext<MapData<TCurrentJson, TNextJson$1>>) => TNextJson$1;
1593
1699
  declare class WorkflowBranchBuilder<TCurrentJson> {
1594
1700
  private readonly steps;
1595
1701
  constructor(steps?: ReadonlyArray<AnyRunnableNodeConfig>);
1596
1702
  then<TOutputJson$1, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson$1>>(config: TConfig): WorkflowBranchBuilder<RunnableNodeOutputJson<TConfig>>;
1597
- map<TNextJson$1>(mapper: (item: TCurrentJson) => TNextJson$1): WorkflowBranchBuilder<TNextJson$1>;
1598
- map<TNextJson$1>(name: string, mapper: (item: TCurrentJson) => TNextJson$1, id?: string): WorkflowBranchBuilder<TNextJson$1>;
1703
+ map<TNextJson$1>(mapper: WorkflowMapCallback$1<TCurrentJson, TNextJson$1>): WorkflowBranchBuilder<TNextJson$1>;
1704
+ map<TNextJson$1>(name: string, mapper: WorkflowMapCallback$1<TCurrentJson, TNextJson$1>, options?: MapDataOptions): WorkflowBranchBuilder<TNextJson$1>;
1599
1705
  wait(duration: number | string): WorkflowBranchBuilder<TCurrentJson>;
1600
1706
  wait(name: string, duration: number | string, id?: string): WorkflowBranchBuilder<TCurrentJson>;
1601
1707
  split<TElem>(getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[]): WorkflowBranchBuilder<TElem>;
@@ -1614,12 +1720,15 @@ declare class WorkflowBranchBuilder<TCurrentJson> {
1614
1720
  //#region src/workflowAuthoring/WorkflowChain.types.d.ts
1615
1721
  type BranchCallback<TCurrentJson, TNextJson$1> = (branch: WorkflowBranchBuilder<TCurrentJson>) => WorkflowBranchBuilder<TNextJson$1>;
1616
1722
  type RouteBranchCallback<TCurrentJson, TNextJson$1> = (branch: WorkflowChain<TCurrentJson>) => WorkflowChain<TNextJson$1>;
1723
+ type WorkflowMapCallback<TCurrentJson, TNextJson$1> = (item: Item<TCurrentJson>, ctx: NodeExecutionContext<MapData<TCurrentJson, TNextJson$1>>) => TNextJson$1;
1724
+ type WorkflowIfPredicate<TCurrentJson> = (item: Item<TCurrentJson>, ctx: NodeExecutionContext<If<TCurrentJson>>) => boolean;
1725
+ type WorkflowSwitchCaseKeyResolver<TCurrentJson> = (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Switch<TCurrentJson>>) => string | Promise<string>;
1617
1726
  declare class WorkflowChain<TCurrentJson> {
1618
1727
  private readonly chain;
1619
1728
  constructor(chain: ChainCursor<TCurrentJson>);
1620
1729
  then<TOutputJson$1, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson$1>>(config: TConfig): WorkflowChain<RunnableNodeOutputJson<TConfig>>;
1621
- map<TNextJson$1>(mapper: (item: TCurrentJson) => TNextJson$1): WorkflowChain<TNextJson$1>;
1622
- map<TNextJson$1>(name: string, mapper: (item: TCurrentJson) => TNextJson$1, id?: string): WorkflowChain<TNextJson$1>;
1730
+ map<TNextJson$1>(mapper: WorkflowMapCallback<TCurrentJson, TNextJson$1>): WorkflowChain<TNextJson$1>;
1731
+ map<TNextJson$1>(name: string, mapper: WorkflowMapCallback<TCurrentJson, TNextJson$1>, options?: MapDataOptions): WorkflowChain<TNextJson$1>;
1623
1732
  wait(duration: number | string): WorkflowChain<TCurrentJson>;
1624
1733
  wait(name: string, duration: number | string, id?: string): WorkflowChain<TCurrentJson>;
1625
1734
  split<TElem>(getElements: (item: Item<TCurrentJson>, ctx: NodeExecutionContext<Split<TCurrentJson, TElem>>) => readonly TElem[]): WorkflowChain<TElem>;
@@ -1637,11 +1746,11 @@ declare class WorkflowChain<TCurrentJson> {
1637
1746
  mode: MergeMode;
1638
1747
  prefer?: ReadonlyArray<string>;
1639
1748
  }>, id?: string): WorkflowChain<TCurrentJson>;
1640
- if<TBranchJson>(predicate: (item: TCurrentJson) => boolean, branches: Readonly<{
1749
+ if<TBranchJson>(predicate: WorkflowIfPredicate<TCurrentJson>, branches: Readonly<{
1641
1750
  true?: BranchCallback<TCurrentJson, TBranchJson>;
1642
1751
  false?: BranchCallback<TCurrentJson, TBranchJson>;
1643
1752
  }>): WorkflowChain<TBranchJson>;
1644
- if<TBranchJson>(name: string, predicate: (item: TCurrentJson) => boolean, branches: Readonly<{
1753
+ if<TBranchJson>(name: string, predicate: WorkflowIfPredicate<TCurrentJson>, branches: Readonly<{
1645
1754
  true?: BranchCallback<TCurrentJson, TBranchJson>;
1646
1755
  false?: BranchCallback<TCurrentJson, TBranchJson>;
1647
1756
  }>): WorkflowChain<TBranchJson>;
@@ -1649,13 +1758,13 @@ declare class WorkflowChain<TCurrentJson> {
1649
1758
  switch<TBranchJson>(cfg: Readonly<{
1650
1759
  cases: readonly string[];
1651
1760
  defaultCase: string;
1652
- resolveCaseKey: (item: TCurrentJson) => string | Promise<string>;
1761
+ resolveCaseKey: WorkflowSwitchCaseKeyResolver<TCurrentJson>;
1653
1762
  branches: Readonly<Record<string, RouteBranchCallback<TCurrentJson, TBranchJson> | undefined>>;
1654
1763
  }>): WorkflowChain<TBranchJson>;
1655
1764
  switch<TBranchJson>(name: string, cfg: Readonly<{
1656
1765
  cases: readonly string[];
1657
1766
  defaultCase: string;
1658
- resolveCaseKey: (item: TCurrentJson) => string | Promise<string>;
1767
+ resolveCaseKey: WorkflowSwitchCaseKeyResolver<TCurrentJson>;
1659
1768
  branches: Readonly<Record<string, RouteBranchCallback<TCurrentJson, TBranchJson> | undefined>>;
1660
1769
  }>, id?: string): WorkflowChain<TBranchJson>;
1661
1770
  agent<TOutputSchema extends z.ZodTypeAny>(options: WorkflowAgentOptions<TCurrentJson, TOutputSchema>): WorkflowChain<z.output<TOutputSchema>>;
@@ -1722,5 +1831,5 @@ declare class AIAgentConnectionWorkflowExpander {
1722
1831
  private assertNoIdCollision;
1723
1832
  }
1724
1833
  //#endregion
1725
- 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 };
1834
+ export { AIAgent, AIAgentConnectionWorkflowExpander, AIAgentExecutionHelpersFactory, AIAgentNode, AgentItemPortMap, AgentMessageFactory, AgentOutputFactory, AgentStructuredOutputRepairPromptFactory, AgentStructuredOutputRunner, 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, MapDataOptions, Merge, MergeMode, MergeNode, NoOp, NoOpNode, OpenAIChatModelConfig, OpenAIChatModelFactory, OpenAIStructuredOutputMethodFactory, OpenAiChatModelPresets, OpenAiCredentialSession, type PlannedToolCall, type ResolvedTool, Split, SplitNode, SubWorkflow, SubWorkflowNode, Switch, SwitchCaseKeyResolver, SwitchNode, Wait, WaitDuration, WaitNode, WebhookRespondNowAndContinueError, WebhookRespondNowError, WebhookTrigger, WebhookTriggerNode, type WorkflowAgentMessages, type WorkflowAgentOptions, WorkflowAuthoringBuilder, WorkflowBranchBuilder, WorkflowChain, createWorkflowBuilder, openAiChatModelPresets, registerCoreNodes, workflow };
1726
1835
  //# sourceMappingURL=index.d.ts.map