@codemation/core-nodes 0.4.1 → 0.4.3

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.cts CHANGED
@@ -78,6 +78,98 @@ interface ExponentialRetryPolicySpec {
78
78
  readonly jitter?: boolean;
79
79
  }
80
80
  //#endregion
81
+ //#region ../core/src/contracts/telemetryTypes.d.ts
82
+ type TelemetryAttributePrimitive = string | number | boolean | null;
83
+ interface TelemetryAttributes {
84
+ readonly [key: string]: TelemetryAttributePrimitive | undefined;
85
+ }
86
+ interface TelemetryMetricRecord {
87
+ readonly name: string;
88
+ readonly value: number;
89
+ readonly unit?: string;
90
+ readonly attributes?: TelemetryAttributes;
91
+ }
92
+ interface TelemetrySpanEventRecord {
93
+ readonly name: string;
94
+ readonly occurredAt?: Date;
95
+ readonly attributes?: TelemetryAttributes;
96
+ }
97
+ interface TelemetryArtifactAttachment {
98
+ readonly kind: string;
99
+ readonly contentType: string;
100
+ readonly previewText?: string;
101
+ readonly previewJson?: JsonValue;
102
+ readonly payloadText?: string;
103
+ readonly payloadJson?: JsonValue;
104
+ readonly bytes?: number;
105
+ readonly truncated?: boolean;
106
+ readonly expiresAt?: Date;
107
+ }
108
+ interface TelemetryArtifactReference {
109
+ readonly artifactId: string;
110
+ readonly traceId?: string;
111
+ readonly spanId?: string;
112
+ }
113
+ interface TelemetrySpanEnd {
114
+ readonly status?: "ok" | "error";
115
+ readonly statusMessage?: string;
116
+ readonly endedAt?: Date;
117
+ readonly attributes?: TelemetryAttributes;
118
+ }
119
+ interface TelemetryChildSpanStart {
120
+ readonly name: string;
121
+ readonly kind?: "internal" | "client";
122
+ readonly startedAt?: Date;
123
+ readonly attributes?: TelemetryAttributes;
124
+ }
125
+ interface TelemetryScope {
126
+ readonly traceId?: string;
127
+ readonly spanId?: string;
128
+ readonly costTracking?: CostTrackingTelemetry;
129
+ addSpanEvent(args: TelemetrySpanEventRecord): Promise<void> | void;
130
+ recordMetric(args: TelemetryMetricRecord): Promise<void> | void;
131
+ attachArtifact(args: TelemetryArtifactAttachment): Promise<TelemetryArtifactReference> | TelemetryArtifactReference;
132
+ }
133
+ interface TelemetrySpanScope extends TelemetryScope {
134
+ readonly traceId: string;
135
+ readonly spanId: string;
136
+ end(args?: TelemetrySpanEnd): Promise<void> | void;
137
+ }
138
+ interface NodeExecutionTelemetry extends ExecutionTelemetry, TelemetrySpanScope {
139
+ startChildSpan(args: TelemetryChildSpanStart): TelemetrySpanScope;
140
+ }
141
+ interface ExecutionTelemetry extends TelemetryScope {
142
+ readonly traceId: string;
143
+ readonly spanId: string;
144
+ forNode(args: Readonly<{
145
+ nodeId: NodeId;
146
+ activationId: NodeActivationId;
147
+ }>): NodeExecutionTelemetry;
148
+ }
149
+ //#endregion
150
+ //#region ../core/src/contracts/CostTrackingTelemetryContract.d.ts
151
+ type CostTrackingComponent = "chat" | "ocr" | "rag";
152
+ interface CostTrackingUsageRecord {
153
+ readonly component: CostTrackingComponent;
154
+ readonly provider: string;
155
+ readonly operation: string;
156
+ readonly pricingKey: string;
157
+ readonly usageUnit: string;
158
+ readonly quantity: number;
159
+ readonly modelName?: string;
160
+ readonly attributes?: TelemetryAttributes;
161
+ }
162
+ interface CostTrackingPriceQuote {
163
+ readonly currency: string;
164
+ readonly currencyScale: number;
165
+ readonly estimatedAmountMinor: number;
166
+ readonly estimateKind: "catalog";
167
+ }
168
+ interface CostTrackingTelemetry {
169
+ captureUsage(args: CostTrackingUsageRecord): Promise<CostTrackingPriceQuote | undefined>;
170
+ forScope(scope: TelemetryScope): CostTrackingTelemetry;
171
+ }
172
+ //#endregion
81
173
  //#region ../core/src/contracts/runTypes.d.ts
82
174
  type NodeInputsByPort = Readonly<Record<InputPortKey, Items>>;
83
175
  type NodeExecutionStatus = "pending" | "queued" | "running" | "completed" | "failed" | "skipped";
@@ -85,6 +177,7 @@ interface NodeExecutionError {
85
177
  message: string;
86
178
  name?: string;
87
179
  stack?: string;
180
+ details?: JsonValue;
88
181
  }
89
182
  /** Stable id for a single connection invocation row in {@link ConnectionInvocationRecord}. */
90
183
  type ConnectionInvocationId = string;
@@ -289,6 +382,7 @@ interface ExecutionContext {
289
382
  now: () => Date;
290
383
  data: RunDataSnapshot;
291
384
  nodeState?: NodeExecutionStatePublisher;
385
+ telemetry: ExecutionTelemetry;
292
386
  binary: ExecutionBinaryService;
293
387
  getCredential<TSession = unknown>(slotKey: string): Promise<TSession>;
294
388
  }
@@ -296,6 +390,7 @@ interface NodeExecutionContext<TConfig extends NodeConfigBase = NodeConfigBase>
296
390
  nodeId: NodeId;
297
391
  activationId: NodeActivationId;
298
392
  config: TConfig;
393
+ telemetry: NodeExecutionTelemetry;
299
394
  binary: NodeBinaryAttachmentService;
300
395
  }
301
396
  interface TriggerSetupContext<TConfig extends TriggerNodeConfig<any, any> = TriggerNodeConfig<any, any>, TSetupState$1 extends JsonValue | undefined = TriggerNodeSetupState<TConfig>> extends ExecutionContext {
@@ -559,6 +654,9 @@ interface WorkflowStoragePolicyDecisionArgs {
559
654
  interface WorkflowPrunePolicySpec {
560
655
  readonly runDataRetentionSeconds?: number;
561
656
  readonly binaryRetentionSeconds?: number;
657
+ readonly telemetrySpanRetentionSeconds?: number;
658
+ readonly telemetryArtifactRetentionSeconds?: number;
659
+ readonly telemetryMetricRetentionSeconds?: number;
562
660
  }
563
661
  interface WorkflowErrorHandler {
564
662
  onError(ctx: WorkflowErrorContext): void | Promise<void>;
@@ -844,6 +942,8 @@ type AgentToolCall = Readonly<{
844
942
  interface ChatModelConfig {
845
943
  readonly type: TypeToken<ChatModelFactory<ChatModelConfig>>;
846
944
  readonly name: string;
945
+ readonly provider?: string;
946
+ readonly modelName?: string;
847
947
  readonly presentation?: AgentCanvasPresentation;
848
948
  getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
849
949
  }
@@ -944,6 +1044,8 @@ declare class OpenAIChatModelConfig implements ChatModelConfig {
944
1044
  }> | undefined;
945
1045
  readonly type: typeof OpenAIChatModelFactory;
946
1046
  readonly presentation: AgentCanvasPresentation<CanvasIconName>;
1047
+ readonly provider = "openai";
1048
+ readonly modelName: string;
947
1049
  constructor(name: string, model: string, credentialSlotKey?: string, presentationIn?: AgentCanvasPresentation<CanvasIconName>, options?: Readonly<{
948
1050
  temperature?: number;
949
1051
  maxTokens?: number;
@@ -1124,6 +1226,43 @@ declare class AgentToolCallPortMap {
1124
1226
  static fromInput(input: unknown): NodeInputsByPort;
1125
1227
  }
1126
1228
  //#endregion
1229
+ //#region src/nodes/AgentToolRepair.types.d.ts
1230
+ type AgentToolFailureKind = "repairable_validation_error" | "transient_execution_error" | "non_repairable_error";
1231
+ type AgentToolRepairNextAction = "model_retry_with_tool_error_message" | "fail_agent_run";
1232
+ interface AgentToolValidationIssue {
1233
+ readonly path: ReadonlyArray<string | number>;
1234
+ readonly code: string;
1235
+ readonly message: string;
1236
+ readonly expected?: string;
1237
+ readonly received?: string;
1238
+ }
1239
+ interface AgentToolRepairDecision {
1240
+ readonly attempt: number;
1241
+ readonly maxAttempts: number;
1242
+ readonly nextAction: AgentToolRepairNextAction;
1243
+ }
1244
+ interface AgentToolFailureClassification {
1245
+ readonly kind: AgentToolFailureKind;
1246
+ readonly effectiveError: Error;
1247
+ readonly issues?: ReadonlyArray<AgentToolValidationIssue>;
1248
+ readonly requiredSchemaReminder?: JsonValue;
1249
+ }
1250
+ //#endregion
1251
+ //#region src/nodes/AgentToolErrorClassifier.d.ts
1252
+ declare class AgentToolErrorClassifier {
1253
+ classify(args: Readonly<{
1254
+ error: unknown;
1255
+ toolName: string;
1256
+ schema?: unknown;
1257
+ }>): AgentToolFailureClassification;
1258
+ private isRepairableValidationError;
1259
+ private extractIssues;
1260
+ private isTransientExecutionError;
1261
+ private toError;
1262
+ private toJsonValue;
1263
+ private toOptionalString;
1264
+ }
1265
+ //#endregion
1127
1266
  //#region src/nodes/AIAgentConfig.d.ts
1128
1267
  interface AIAgentOptions<TInputJson$1 = unknown, _TOutputJson = unknown> {
1129
1268
  readonly name: string;
@@ -1160,6 +1299,48 @@ declare class AIAgent<TInputJson$1 = unknown, TOutputJson$1 = unknown> implement
1160
1299
  constructor(options: AIAgentOptions<TInputJson$1, TOutputJson$1>);
1161
1300
  }
1162
1301
  //#endregion
1302
+ //#region src/nodes/AgentToolRepairPolicy.d.ts
1303
+ declare class AgentToolRepairPolicy {
1304
+ private static readonly maxRepairAttemptsPerTool;
1305
+ createDecision(toolName: string, attemptsByToolName: Map<string, number>): AgentToolRepairDecision;
1306
+ }
1307
+ //#endregion
1308
+ //#region src/nodes/AgentToolExecutionCoordinator.d.ts
1309
+ declare class AgentToolExecutionCoordinator {
1310
+ private readonly errorClassifier;
1311
+ private readonly repairPolicy;
1312
+ constructor(errorClassifier: AgentToolErrorClassifier, repairPolicy: AgentToolRepairPolicy);
1313
+ execute(args: Readonly<{
1314
+ plannedToolCalls: ReadonlyArray<PlannedToolCall>;
1315
+ ctx: NodeExecutionContext<AIAgent<any, any>>;
1316
+ agentName: string;
1317
+ repairAttemptsByToolName: Map<string, number>;
1318
+ }>): Promise<ReadonlyArray<ExecutedToolCall>>;
1319
+ private executePlannedToolCall;
1320
+ private recordFailedInvocation;
1321
+ private createRepairPayload;
1322
+ private createRepairDetails;
1323
+ private createValidationMessage;
1324
+ private parseToolOutput;
1325
+ private toJsonValue;
1326
+ private extractErrorDetails;
1327
+ private serializeIssue;
1328
+ }
1329
+ //#endregion
1330
+ //#region src/nodes/AgentToolRepairExhaustedError.d.ts
1331
+ declare class AgentToolRepairExhaustedError extends Error {
1332
+ readonly details: JsonValue;
1333
+ constructor(args: Readonly<{
1334
+ agentName: string;
1335
+ nodeId: string;
1336
+ toolName: string;
1337
+ maxAttempts: number;
1338
+ lastManagedInput?: JsonValue;
1339
+ lastValidationIssues?: ReadonlyArray<AgentToolValidationIssue>;
1340
+ }>);
1341
+ private serializeIssue;
1342
+ }
1343
+ //#endregion
1163
1344
  //#region src/nodes/NodeBackedToolRuntime.d.ts
1164
1345
  declare class NodeBackedToolRuntime {
1165
1346
  private readonly nodeResolver;
@@ -1179,6 +1360,7 @@ declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
1179
1360
  private readonly nodeBackedToolRuntime;
1180
1361
  private readonly executionHelpers;
1181
1362
  private readonly structuredOutputRunner;
1363
+ private readonly toolExecutionCoordinator;
1182
1364
  kind: "node";
1183
1365
  outputPorts: readonly ["main"];
1184
1366
  /**
@@ -1190,7 +1372,7 @@ declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
1190
1372
  private readonly connectionCredentialExecutionContextFactory;
1191
1373
  /** One resolved model/tools bundle per activation context (same ctx across items in a batch). */
1192
1374
  private readonly preparedByExecutionContext;
1193
- constructor(nodeResolver: NodeResolver, credentialSessions: CredentialSessionService, nodeBackedToolRuntime: NodeBackedToolRuntime, executionHelpers: AIAgentExecutionHelpersFactory, structuredOutputRunner: AgentStructuredOutputRunner);
1375
+ constructor(nodeResolver: NodeResolver, credentialSessions: CredentialSessionService, nodeBackedToolRuntime: NodeBackedToolRuntime, executionHelpers: AIAgentExecutionHelpersFactory, structuredOutputRunner: AgentStructuredOutputRunner, toolExecutionCoordinator: AgentToolExecutionCoordinator);
1194
1376
  execute(args: RunnableNodeExecuteArgs<AIAgent<any, any>>): Promise<unknown>;
1195
1377
  private getOrPrepareExecution;
1196
1378
  /**
@@ -1215,13 +1397,19 @@ declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
1215
1397
  private createItemScopedTools;
1216
1398
  private invokeModel;
1217
1399
  private invokeStructuredModel;
1400
+ private createModelInvocationSpan;
1401
+ private recordModelUsageMetrics;
1402
+ private captureCostTrackingUsage;
1403
+ private resolveChatModelName;
1404
+ private extractModelUsageMetrics;
1405
+ private extractUsageObject;
1406
+ private readUsageNumber;
1407
+ private readNestedUsageValue;
1408
+ private isRecord;
1218
1409
  private markQueuedTools;
1219
- private executeToolCalls;
1220
1410
  private planToolCalls;
1221
- private parseToolOutput;
1222
1411
  private failTrackedNodeInvocation;
1223
1412
  private summarizeLlmMessages;
1224
- private toolCallInputToJson;
1225
1413
  private resultToJsonValue;
1226
1414
  private createPromptMessages;
1227
1415
  private resolveToolRuntime;
@@ -1237,6 +1425,7 @@ declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
1237
1425
  private isCallableToolConfig;
1238
1426
  private resolveGuardrails;
1239
1427
  private getAgentDisplayName;
1428
+ private extractErrorDetails;
1240
1429
  }
1241
1430
  //#endregion
1242
1431
  //#region src/nodes/CallbackNode.d.ts
@@ -1841,5 +2030,5 @@ declare class AIAgentConnectionWorkflowExpander {
1841
2030
  private assertNoIdCollision;
1842
2031
  }
1843
2032
  //#endregion
1844
- export { AIAgent, AIAgentConnectionWorkflowExpander, AIAgentExecutionHelpersFactory, AIAgentNode, AgentItemPortMap, AgentMessageFactory, AgentOutputFactory, AgentStructuredOutputRepairPromptFactory, AgentStructuredOutputRunner, AgentToolCallPortMap, Aggregate, AggregateNode, Callback, CallbackHandler, CallbackNode, CallbackOptions, CallbackResultNormalizer, CanvasIconName, ConnectionCredentialExecutionContextFactory, ConnectionCredentialNode, ConnectionCredentialNodeConfig, ConnectionCredentialNodeConfigFactory, ExecutedToolCall, Filter, FilterNode, HttpRequest, HttpRequestDownloadMode, HttpRequestNode, HttpRequestOutputJson, If, IfNode, ItemScopedToolBinding, ManualTrigger, ManualTriggerNode, MapData, MapDataNode, MapDataOptions, Merge, MergeMode, MergeNode, NoOp, NoOpNode, OpenAIChatModelConfig, OpenAIChatModelFactory, OpenAIStructuredOutputMethodFactory, OpenAiChatModelPresets, OpenAiCredentialSession, PlannedToolCall, 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 };
2033
+ export { AIAgent, AIAgentConnectionWorkflowExpander, AIAgentExecutionHelpersFactory, AIAgentNode, AgentItemPortMap, AgentMessageFactory, AgentOutputFactory, AgentStructuredOutputRepairPromptFactory, AgentStructuredOutputRunner, AgentToolCallPortMap, AgentToolErrorClassifier, AgentToolExecutionCoordinator, AgentToolRepairExhaustedError, AgentToolRepairPolicy, Aggregate, AggregateNode, Callback, CallbackHandler, CallbackNode, CallbackOptions, CallbackResultNormalizer, CanvasIconName, ConnectionCredentialExecutionContextFactory, ConnectionCredentialNode, ConnectionCredentialNodeConfig, ConnectionCredentialNodeConfigFactory, ExecutedToolCall, Filter, FilterNode, HttpRequest, HttpRequestDownloadMode, HttpRequestNode, HttpRequestOutputJson, If, IfNode, ItemScopedToolBinding, ManualTrigger, ManualTriggerNode, MapData, MapDataNode, MapDataOptions, Merge, MergeMode, MergeNode, NoOp, NoOpNode, OpenAIChatModelConfig, OpenAIChatModelFactory, OpenAIStructuredOutputMethodFactory, OpenAiChatModelPresets, OpenAiCredentialSession, PlannedToolCall, 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 };
1845
2034
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -78,6 +78,98 @@ interface ExponentialRetryPolicySpec {
78
78
  readonly jitter?: boolean;
79
79
  }
80
80
  //#endregion
81
+ //#region ../core/src/contracts/telemetryTypes.d.ts
82
+ type TelemetryAttributePrimitive = string | number | boolean | null;
83
+ interface TelemetryAttributes {
84
+ readonly [key: string]: TelemetryAttributePrimitive | undefined;
85
+ }
86
+ interface TelemetryMetricRecord {
87
+ readonly name: string;
88
+ readonly value: number;
89
+ readonly unit?: string;
90
+ readonly attributes?: TelemetryAttributes;
91
+ }
92
+ interface TelemetrySpanEventRecord {
93
+ readonly name: string;
94
+ readonly occurredAt?: Date;
95
+ readonly attributes?: TelemetryAttributes;
96
+ }
97
+ interface TelemetryArtifactAttachment {
98
+ readonly kind: string;
99
+ readonly contentType: string;
100
+ readonly previewText?: string;
101
+ readonly previewJson?: JsonValue;
102
+ readonly payloadText?: string;
103
+ readonly payloadJson?: JsonValue;
104
+ readonly bytes?: number;
105
+ readonly truncated?: boolean;
106
+ readonly expiresAt?: Date;
107
+ }
108
+ interface TelemetryArtifactReference {
109
+ readonly artifactId: string;
110
+ readonly traceId?: string;
111
+ readonly spanId?: string;
112
+ }
113
+ interface TelemetrySpanEnd {
114
+ readonly status?: "ok" | "error";
115
+ readonly statusMessage?: string;
116
+ readonly endedAt?: Date;
117
+ readonly attributes?: TelemetryAttributes;
118
+ }
119
+ interface TelemetryChildSpanStart {
120
+ readonly name: string;
121
+ readonly kind?: "internal" | "client";
122
+ readonly startedAt?: Date;
123
+ readonly attributes?: TelemetryAttributes;
124
+ }
125
+ interface TelemetryScope {
126
+ readonly traceId?: string;
127
+ readonly spanId?: string;
128
+ readonly costTracking?: CostTrackingTelemetry;
129
+ addSpanEvent(args: TelemetrySpanEventRecord): Promise<void> | void;
130
+ recordMetric(args: TelemetryMetricRecord): Promise<void> | void;
131
+ attachArtifact(args: TelemetryArtifactAttachment): Promise<TelemetryArtifactReference> | TelemetryArtifactReference;
132
+ }
133
+ interface TelemetrySpanScope extends TelemetryScope {
134
+ readonly traceId: string;
135
+ readonly spanId: string;
136
+ end(args?: TelemetrySpanEnd): Promise<void> | void;
137
+ }
138
+ interface NodeExecutionTelemetry extends ExecutionTelemetry, TelemetrySpanScope {
139
+ startChildSpan(args: TelemetryChildSpanStart): TelemetrySpanScope;
140
+ }
141
+ interface ExecutionTelemetry extends TelemetryScope {
142
+ readonly traceId: string;
143
+ readonly spanId: string;
144
+ forNode(args: Readonly<{
145
+ nodeId: NodeId;
146
+ activationId: NodeActivationId;
147
+ }>): NodeExecutionTelemetry;
148
+ }
149
+ //#endregion
150
+ //#region ../core/src/contracts/CostTrackingTelemetryContract.d.ts
151
+ type CostTrackingComponent = "chat" | "ocr" | "rag";
152
+ interface CostTrackingUsageRecord {
153
+ readonly component: CostTrackingComponent;
154
+ readonly provider: string;
155
+ readonly operation: string;
156
+ readonly pricingKey: string;
157
+ readonly usageUnit: string;
158
+ readonly quantity: number;
159
+ readonly modelName?: string;
160
+ readonly attributes?: TelemetryAttributes;
161
+ }
162
+ interface CostTrackingPriceQuote {
163
+ readonly currency: string;
164
+ readonly currencyScale: number;
165
+ readonly estimatedAmountMinor: number;
166
+ readonly estimateKind: "catalog";
167
+ }
168
+ interface CostTrackingTelemetry {
169
+ captureUsage(args: CostTrackingUsageRecord): Promise<CostTrackingPriceQuote | undefined>;
170
+ forScope(scope: TelemetryScope): CostTrackingTelemetry;
171
+ }
172
+ //#endregion
81
173
  //#region ../core/src/contracts/runTypes.d.ts
82
174
  type NodeInputsByPort = Readonly<Record<InputPortKey, Items>>;
83
175
  type NodeExecutionStatus = "pending" | "queued" | "running" | "completed" | "failed" | "skipped";
@@ -85,6 +177,7 @@ interface NodeExecutionError {
85
177
  message: string;
86
178
  name?: string;
87
179
  stack?: string;
180
+ details?: JsonValue;
88
181
  }
89
182
  /** Stable id for a single connection invocation row in {@link ConnectionInvocationRecord}. */
90
183
  type ConnectionInvocationId = string;
@@ -289,6 +382,7 @@ interface ExecutionContext {
289
382
  now: () => Date;
290
383
  data: RunDataSnapshot;
291
384
  nodeState?: NodeExecutionStatePublisher;
385
+ telemetry: ExecutionTelemetry;
292
386
  binary: ExecutionBinaryService;
293
387
  getCredential<TSession = unknown>(slotKey: string): Promise<TSession>;
294
388
  }
@@ -296,6 +390,7 @@ interface NodeExecutionContext<TConfig extends NodeConfigBase = NodeConfigBase>
296
390
  nodeId: NodeId;
297
391
  activationId: NodeActivationId;
298
392
  config: TConfig;
393
+ telemetry: NodeExecutionTelemetry;
299
394
  binary: NodeBinaryAttachmentService;
300
395
  }
301
396
  interface TriggerSetupContext<TConfig extends TriggerNodeConfig<any, any> = TriggerNodeConfig<any, any>, TSetupState$1 extends JsonValue | undefined = TriggerNodeSetupState<TConfig>> extends ExecutionContext {
@@ -559,6 +654,9 @@ interface WorkflowStoragePolicyDecisionArgs {
559
654
  interface WorkflowPrunePolicySpec {
560
655
  readonly runDataRetentionSeconds?: number;
561
656
  readonly binaryRetentionSeconds?: number;
657
+ readonly telemetrySpanRetentionSeconds?: number;
658
+ readonly telemetryArtifactRetentionSeconds?: number;
659
+ readonly telemetryMetricRetentionSeconds?: number;
562
660
  }
563
661
  interface WorkflowErrorHandler {
564
662
  onError(ctx: WorkflowErrorContext): void | Promise<void>;
@@ -844,6 +942,8 @@ type AgentToolCall = Readonly<{
844
942
  interface ChatModelConfig {
845
943
  readonly type: TypeToken<ChatModelFactory<ChatModelConfig>>;
846
944
  readonly name: string;
945
+ readonly provider?: string;
946
+ readonly modelName?: string;
847
947
  readonly presentation?: AgentCanvasPresentation;
848
948
  getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
849
949
  }
@@ -944,6 +1044,8 @@ declare class OpenAIChatModelConfig implements ChatModelConfig {
944
1044
  }> | undefined;
945
1045
  readonly type: typeof OpenAIChatModelFactory;
946
1046
  readonly presentation: AgentCanvasPresentation<CanvasIconName>;
1047
+ readonly provider = "openai";
1048
+ readonly modelName: string;
947
1049
  constructor(name: string, model: string, credentialSlotKey?: string, presentationIn?: AgentCanvasPresentation<CanvasIconName>, options?: Readonly<{
948
1050
  temperature?: number;
949
1051
  maxTokens?: number;
@@ -1124,6 +1226,43 @@ declare class AgentToolCallPortMap {
1124
1226
  static fromInput(input: unknown): NodeInputsByPort;
1125
1227
  }
1126
1228
  //#endregion
1229
+ //#region src/nodes/AgentToolRepair.types.d.ts
1230
+ type AgentToolFailureKind = "repairable_validation_error" | "transient_execution_error" | "non_repairable_error";
1231
+ type AgentToolRepairNextAction = "model_retry_with_tool_error_message" | "fail_agent_run";
1232
+ interface AgentToolValidationIssue {
1233
+ readonly path: ReadonlyArray<string | number>;
1234
+ readonly code: string;
1235
+ readonly message: string;
1236
+ readonly expected?: string;
1237
+ readonly received?: string;
1238
+ }
1239
+ interface AgentToolRepairDecision {
1240
+ readonly attempt: number;
1241
+ readonly maxAttempts: number;
1242
+ readonly nextAction: AgentToolRepairNextAction;
1243
+ }
1244
+ interface AgentToolFailureClassification {
1245
+ readonly kind: AgentToolFailureKind;
1246
+ readonly effectiveError: Error;
1247
+ readonly issues?: ReadonlyArray<AgentToolValidationIssue>;
1248
+ readonly requiredSchemaReminder?: JsonValue;
1249
+ }
1250
+ //#endregion
1251
+ //#region src/nodes/AgentToolErrorClassifier.d.ts
1252
+ declare class AgentToolErrorClassifier {
1253
+ classify(args: Readonly<{
1254
+ error: unknown;
1255
+ toolName: string;
1256
+ schema?: unknown;
1257
+ }>): AgentToolFailureClassification;
1258
+ private isRepairableValidationError;
1259
+ private extractIssues;
1260
+ private isTransientExecutionError;
1261
+ private toError;
1262
+ private toJsonValue;
1263
+ private toOptionalString;
1264
+ }
1265
+ //#endregion
1127
1266
  //#region src/nodes/AIAgentConfig.d.ts
1128
1267
  interface AIAgentOptions<TInputJson$1 = unknown, _TOutputJson = unknown> {
1129
1268
  readonly name: string;
@@ -1160,6 +1299,48 @@ declare class AIAgent<TInputJson$1 = unknown, TOutputJson$1 = unknown> implement
1160
1299
  constructor(options: AIAgentOptions<TInputJson$1, TOutputJson$1>);
1161
1300
  }
1162
1301
  //#endregion
1302
+ //#region src/nodes/AgentToolRepairPolicy.d.ts
1303
+ declare class AgentToolRepairPolicy {
1304
+ private static readonly maxRepairAttemptsPerTool;
1305
+ createDecision(toolName: string, attemptsByToolName: Map<string, number>): AgentToolRepairDecision;
1306
+ }
1307
+ //#endregion
1308
+ //#region src/nodes/AgentToolExecutionCoordinator.d.ts
1309
+ declare class AgentToolExecutionCoordinator {
1310
+ private readonly errorClassifier;
1311
+ private readonly repairPolicy;
1312
+ constructor(errorClassifier: AgentToolErrorClassifier, repairPolicy: AgentToolRepairPolicy);
1313
+ execute(args: Readonly<{
1314
+ plannedToolCalls: ReadonlyArray<PlannedToolCall>;
1315
+ ctx: NodeExecutionContext<AIAgent<any, any>>;
1316
+ agentName: string;
1317
+ repairAttemptsByToolName: Map<string, number>;
1318
+ }>): Promise<ReadonlyArray<ExecutedToolCall>>;
1319
+ private executePlannedToolCall;
1320
+ private recordFailedInvocation;
1321
+ private createRepairPayload;
1322
+ private createRepairDetails;
1323
+ private createValidationMessage;
1324
+ private parseToolOutput;
1325
+ private toJsonValue;
1326
+ private extractErrorDetails;
1327
+ private serializeIssue;
1328
+ }
1329
+ //#endregion
1330
+ //#region src/nodes/AgentToolRepairExhaustedError.d.ts
1331
+ declare class AgentToolRepairExhaustedError extends Error {
1332
+ readonly details: JsonValue;
1333
+ constructor(args: Readonly<{
1334
+ agentName: string;
1335
+ nodeId: string;
1336
+ toolName: string;
1337
+ maxAttempts: number;
1338
+ lastManagedInput?: JsonValue;
1339
+ lastValidationIssues?: ReadonlyArray<AgentToolValidationIssue>;
1340
+ }>);
1341
+ private serializeIssue;
1342
+ }
1343
+ //#endregion
1163
1344
  //#region src/nodes/NodeBackedToolRuntime.d.ts
1164
1345
  declare class NodeBackedToolRuntime {
1165
1346
  private readonly nodeResolver;
@@ -1179,6 +1360,7 @@ declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
1179
1360
  private readonly nodeBackedToolRuntime;
1180
1361
  private readonly executionHelpers;
1181
1362
  private readonly structuredOutputRunner;
1363
+ private readonly toolExecutionCoordinator;
1182
1364
  kind: "node";
1183
1365
  outputPorts: readonly ["main"];
1184
1366
  /**
@@ -1190,7 +1372,7 @@ declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
1190
1372
  private readonly connectionCredentialExecutionContextFactory;
1191
1373
  /** One resolved model/tools bundle per activation context (same ctx across items in a batch). */
1192
1374
  private readonly preparedByExecutionContext;
1193
- constructor(nodeResolver: NodeResolver, credentialSessions: CredentialSessionService, nodeBackedToolRuntime: NodeBackedToolRuntime, executionHelpers: AIAgentExecutionHelpersFactory, structuredOutputRunner: AgentStructuredOutputRunner);
1375
+ constructor(nodeResolver: NodeResolver, credentialSessions: CredentialSessionService, nodeBackedToolRuntime: NodeBackedToolRuntime, executionHelpers: AIAgentExecutionHelpersFactory, structuredOutputRunner: AgentStructuredOutputRunner, toolExecutionCoordinator: AgentToolExecutionCoordinator);
1194
1376
  execute(args: RunnableNodeExecuteArgs<AIAgent<any, any>>): Promise<unknown>;
1195
1377
  private getOrPrepareExecution;
1196
1378
  /**
@@ -1215,13 +1397,19 @@ declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
1215
1397
  private createItemScopedTools;
1216
1398
  private invokeModel;
1217
1399
  private invokeStructuredModel;
1400
+ private createModelInvocationSpan;
1401
+ private recordModelUsageMetrics;
1402
+ private captureCostTrackingUsage;
1403
+ private resolveChatModelName;
1404
+ private extractModelUsageMetrics;
1405
+ private extractUsageObject;
1406
+ private readUsageNumber;
1407
+ private readNestedUsageValue;
1408
+ private isRecord;
1218
1409
  private markQueuedTools;
1219
- private executeToolCalls;
1220
1410
  private planToolCalls;
1221
- private parseToolOutput;
1222
1411
  private failTrackedNodeInvocation;
1223
1412
  private summarizeLlmMessages;
1224
- private toolCallInputToJson;
1225
1413
  private resultToJsonValue;
1226
1414
  private createPromptMessages;
1227
1415
  private resolveToolRuntime;
@@ -1237,6 +1425,7 @@ declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
1237
1425
  private isCallableToolConfig;
1238
1426
  private resolveGuardrails;
1239
1427
  private getAgentDisplayName;
1428
+ private extractErrorDetails;
1240
1429
  }
1241
1430
  //#endregion
1242
1431
  //#region src/nodes/CallbackNode.d.ts
@@ -1841,5 +2030,5 @@ declare class AIAgentConnectionWorkflowExpander {
1841
2030
  private assertNoIdCollision;
1842
2031
  }
1843
2032
  //#endregion
1844
- 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 };
2033
+ export { AIAgent, AIAgentConnectionWorkflowExpander, AIAgentExecutionHelpersFactory, AIAgentNode, AgentItemPortMap, AgentMessageFactory, AgentOutputFactory, AgentStructuredOutputRepairPromptFactory, AgentStructuredOutputRunner, AgentToolCallPortMap, AgentToolErrorClassifier, AgentToolExecutionCoordinator, AgentToolRepairExhaustedError, AgentToolRepairPolicy, 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 };
1845
2034
  //# sourceMappingURL=index.d.ts.map