@codemation/core-nodes 0.12.0 → 0.14.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/index.cjs +180 -413
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +99 -1303
  5. package/dist/index.d.ts +99 -1303
  6. package/dist/index.js +181 -415
  7. package/dist/index.js.map +1 -1
  8. package/dist/metadata.json +1 -1
  9. package/package.json +2 -2
  10. package/src/authoring/defineRestNode.types.ts +0 -84
  11. package/src/canvasIconName.ts +0 -7
  12. package/src/chatModels/CodemationChatModelConfig.ts +0 -10
  13. package/src/chatModels/CodemationChatModelFactory.ts +0 -7
  14. package/src/chatModels/ManagedHmacSignerFactory.types.ts +0 -35
  15. package/src/chatModels/OpenAIChatModelFactory.ts +0 -2
  16. package/src/chatModels/OpenAiChatModelPresetsFactory.ts +0 -5
  17. package/src/chatModels/OpenAiCredentialSession.ts +0 -1
  18. package/src/chatModels/OpenAiStrictJsonSchemaFactory.ts +0 -21
  19. package/src/credentials/ApiKeyCredentialType.ts +0 -3
  20. package/src/credentials/BasicAuthCredentialType.ts +0 -4
  21. package/src/credentials/BearerTokenCredentialType.ts +0 -4
  22. package/src/credentials/OAuth2ClientCredentialsTypeFactory.ts +0 -19
  23. package/src/credentials/OAuth2TokenExchangeFactory.ts +0 -7
  24. package/src/http/HttpBodyBuilder.ts +0 -16
  25. package/src/http/HttpRequestExecutor.ts +0 -35
  26. package/src/http/HttpUrlBuilder.ts +0 -4
  27. package/src/http/SSRFBlockedError.ts +0 -4
  28. package/src/http/SsrfGuard.ts +10 -50
  29. package/src/http/httpRequest.types.ts +0 -49
  30. package/src/index.ts +1 -0
  31. package/src/nodes/AIAgentConfig.ts +3 -39
  32. package/src/nodes/AIAgentExecutionHelpersFactory.ts +0 -37
  33. package/src/nodes/AIAgentNode.ts +4 -134
  34. package/src/nodes/AgentBinaryContentFactory.ts +0 -12
  35. package/src/nodes/AgentLoopCheckpoint.types.ts +0 -13
  36. package/src/nodes/AgentMessageFactory.ts +17 -19
  37. package/src/nodes/AgentStructuredOutputRunner.ts +0 -17
  38. package/src/nodes/AgentToolExecutionCoordinator.ts +0 -12
  39. package/src/nodes/AgentToolResultContentFactory.ts +126 -0
  40. package/src/nodes/AssertionNode.ts +0 -14
  41. package/src/nodes/BM25Index.ts +0 -14
  42. package/src/nodes/ConnectionCredentialExecutionContextFactory.ts +0 -5
  43. package/src/nodes/ConnectionCredentialNode.ts +0 -4
  44. package/src/nodes/CronTriggerFactory.ts +0 -9
  45. package/src/nodes/DeferredMetaToolStrategy.ts +0 -18
  46. package/src/nodes/DeferredMetaToolStrategyFactory.ts +0 -5
  47. package/src/nodes/HttpRequestNodeFactory.ts +0 -14
  48. package/src/nodes/InboxApprovalNode.types.ts +0 -16
  49. package/src/nodes/IsTestRunNode.ts +0 -8
  50. package/src/nodes/ManualTriggerFactory.ts +0 -3
  51. package/src/nodes/ManualTriggerNode.ts +0 -4
  52. package/src/nodes/MergeNode.ts +0 -1
  53. package/src/nodes/NodeBackedToolRuntime.ts +0 -14
  54. package/src/nodes/SubWorkflowNode.ts +0 -3
  55. package/src/nodes/SwitchNode.ts +0 -3
  56. package/src/nodes/TestTriggerNode.ts +0 -9
  57. package/src/nodes/aiAgentSupport.types.ts +0 -16
  58. package/src/nodes/assertion.ts +0 -10
  59. package/src/nodes/codemationDocumentScannerNode.ts +0 -18
  60. package/src/nodes/collections/collectionListNode.types.ts +0 -1
  61. package/src/nodes/httpRequest.ts +0 -68
  62. package/src/nodes/isTestRun.ts +0 -4
  63. package/src/nodes/mapData.ts +0 -1
  64. package/src/nodes/merge.ts +0 -4
  65. package/src/nodes/mergeExecutionUtils.types.ts +0 -3
  66. package/src/nodes/nodeOptions.types.ts +0 -8
  67. package/src/nodes/schedulePollingTrigger.ts +37 -0
  68. package/src/nodes/split.ts +0 -4
  69. package/src/nodes/testTrigger.ts +0 -21
  70. package/src/nodes/wait.ts +0 -1
  71. package/src/nodes/webhookTriggerNode.ts +0 -5
  72. package/src/register.types.ts +0 -10
  73. package/src/workflows/AIAgentConnectionWorkflowExpander.ts +0 -3
package/dist/index.d.ts CHANGED
@@ -5,82 +5,27 @@ import { DependencyContainer as Container, InjectionToken as TypeToken } from "t
5
5
  import { ReadableStream } from "node:stream/web";
6
6
 
7
7
  //#region src/canvasIconName.d.ts
8
- /**
9
- * Canvas / agent presentation:
10
- * - Lucide: `lucide:<kebab-name>` or legacy kebab name
11
- * - Built-in brand SVGs: `builtin:<id>` (host resolves to shipped SVG assets under `public/canvas-icons/builtin/`)
12
- * - Simple Icons: `si:<slug>` (host cherry-picks from `simple-icons`) or builtin asset when slug matches
13
- * - Image URLs: `http(s):`, `data:`, `/…`
14
- */
15
8
  type CanvasIconName = string;
16
9
  //#endregion
17
10
  //#region ../core/src/contracts/testTriggerTypes.d.ts
18
- /**
19
- * Identifier minted by the host (or in-memory test runner) for one execution of a test suite.
20
- * One TestSuiteRun produces N child workflow runs, one per item yielded by `generateItems`.
21
- */
22
11
  type TestSuiteRunId = string;
23
- /**
24
- * Setup context passed to a {@link TestTriggerNodeConfig.generateItems} callback. Distinct from
25
- * {@link import("./runtimeTypes").TriggerSetupContext} on purpose: test triggers are not
26
- * activated by the live trigger lifecycle (webhooks, cron, polling) and never call `emit` —
27
- * the orchestrator pulls from the iterable they return and dispatches one run per item.
28
- */
29
12
  interface TestTriggerSetupContext<TConfig extends TestTriggerNodeConfig<unknown> = TestTriggerNodeConfig<unknown>> {
30
13
  readonly workflowId: WorkflowId;
31
14
  readonly nodeId: NodeId;
32
15
  readonly config: TConfig;
33
16
  readonly testSuiteRunId: TestSuiteRunId;
34
- /**
35
- * Resolves a credential session for a slot declared on this trigger's
36
- * {@link import("./workflowTypes").NodeConfigBase.getCredentialRequirements}. Same contract as
37
- * {@link import("./runtimeTypes").ExecutionContext.getCredential}.
38
- */
39
17
  getCredential<TSession = unknown>(slotKey: string): Promise<TSession>;
40
- /** AbortSignal raised when the suite is cancelled — long-running pulls should bail out. */
41
18
  readonly signal: AbortSignal;
42
19
  }
43
- /**
44
- * A trigger config that emits **test cases**. Each item yielded by {@link generateItems}
45
- * becomes one workflow run (with `executionOptions.testContext` set), so 10 yielded items
46
- * → 10 runs marked under the same TestSuiteRun.
47
- *
48
- * The trigger is otherwise a normal {@link TriggerNodeConfig} (so the canvas treats it like
49
- * any other trigger), but its `triggerKind` is `"test"` so the live activation policy skips it.
50
- */
51
20
  interface TestTriggerNodeConfig<TOutputJson$1 = unknown> extends TriggerNodeConfig<TOutputJson$1, undefined> {
52
21
  readonly triggerKind: "test";
53
- /**
54
- * Author-supplied async iterable of items, evaluated lazily. Implementations may fetch from
55
- * credentialed APIs, read fixture files, or yield hard-coded items. The orchestrator iterates
56
- * and dispatches one run per item, with concurrency capped by {@link concurrency} (default 4).
57
- */
58
22
  generateItems(ctx: TestTriggerSetupContext<TestTriggerNodeConfig<TOutputJson$1>>): AsyncIterable<Item<TOutputJson$1>>;
59
- /** Per-suite-run cap on simultaneously-executing test cases. Default: 4. */
60
23
  readonly concurrency?: number;
61
- /**
62
- * Free-form description of where the test cases come from — surfaced in the node properties
63
- * panel and the suite-detail header so authors revisiting the workflow six months later
64
- * remember which mailbox / folder / fixture file the cases originate from.
65
- *
66
- * Example: `"All emails in the Gmail label \"test/triage-fixtures\" — 14 messages as of 2026-05-03."`
67
- */
68
24
  readonly description?: string;
69
- /**
70
- * Resolves a human-readable label for one yielded test case (e.g. email subject). The
71
- * orchestrator calls this once per yielded item, persists the result on the run, and the
72
- * Tests-tab UI uses it to render the case row instead of the opaque runId. Return
73
- * `undefined` to fall back to "Case #N".
74
- */
75
25
  caseLabel?(item: Item<TOutputJson$1>): string | undefined;
76
26
  }
77
27
  //#endregion
78
28
  //#region ../core/src/contracts/baseTypes.d.ts
79
- /**
80
- * Minimal base types that have no dependencies on other contracts.
81
- * Used by credentialTypes, workflowTypes, and other contract layers
82
- * to avoid circular dependencies.
83
- */
84
29
  type WorkflowId = string;
85
30
  type NodeId = string;
86
31
  type OutputPortKey = string;
@@ -166,13 +111,6 @@ interface TelemetrySpanScope extends TelemetryScope {
166
111
  readonly traceId: string;
167
112
  readonly spanId: string;
168
113
  end(args?: TelemetrySpanEnd): Promise<void> | void;
169
- /**
170
- * Lift this span into a {@link NodeExecutionTelemetry} scoped to a different (nodeId, activationId).
171
- * Children created via the returned telemetry's `startChildSpan` get this span as their parent.
172
- *
173
- * Used at the sub-agent boundary so that nested runtime telemetry parents under the agent.tool.call
174
- * span instead of the orchestrator's node-level span.
175
- */
176
114
  asNodeTelemetry(args: Readonly<{
177
115
  nodeId: NodeId;
178
116
  activationId: NodeActivationId;
@@ -191,32 +129,8 @@ interface ExecutionTelemetry extends TelemetryScope {
191
129
  }
192
130
  //#endregion
193
131
  //#region ../core/src/contracts/agentMcpTypes.d.ts
194
- /**
195
- * An opaque MCP tool map: keyed by serverId → (toolName → tool definition).
196
- * Typed as unknown so core does not depend on the AI SDK's ToolSet type.
197
- * AIAgentNode (in core-nodes, which does depend on ai) casts this to
198
- * ReadonlyMap<string, ToolSet> before passing to DeferredMetaToolStrategyFactory.
199
- */
200
132
  type AgentMcpToolMap = ReadonlyMap<string, Readonly<Record<string, unknown>>>;
201
- /**
202
- * Contract implemented by the host. Resolves MCP server bindings for an agent run
203
- * via the standard credential-binding table (one slot per declared server, keyed
204
- * by `(workflowId, mcpConnectionNodeId, "credential")`), and returns a ready-to-use
205
- * tool map with wrapped execute callbacks for telemetry and 403 detection.
206
- * Core-nodes imports this interface so AIAgentNode can inject it without
207
- * depending on the host.
208
- */
209
133
  interface AgentMcpIntegration {
210
- /**
211
- * Look up the credential binding per server, validate scopes, open pool
212
- * connections, and return a tool map keyed by serverId. Each tool's
213
- * execute callback includes:
214
- * - Telemetry child span (mcp.server_id, mcp.tool_name attributes)
215
- * - 403/permission error detection → emits a NeedsReconsentEvent span event
216
- *
217
- * Throws `AgentBindError` on validation failures (missing server, unbound
218
- * credential slot, missing credential instance, insufficient scopes).
219
- */
220
134
  prepareMcpTools(args: {
221
135
  readonly workflowId: WorkflowId;
222
136
  readonly agentNodeId: NodeId;
@@ -232,44 +146,23 @@ interface AgentMcpIntegration {
232
146
  statusMessage?: string;
233
147
  }) => void;
234
148
  };
235
- /** Per-MCP-tool-call invocation appender. Optional; when omitted the wrapper emits only telemetry spans. */
236
149
  readonly appendMcpInvocation?: (args: ConnectionInvocationAppendArgs) => Promise<void>;
237
- /** Agent activation id to attach to each invocation record (used by canvas + inspector grouping). */
238
150
  readonly parentAgentActivationId?: NodeActivationId;
239
- /** Per-item iteration id when the agent runs inside a per-item loop. */
240
151
  readonly iterationId?: NodeIterationId;
241
- /** Item index (0-based) of the iteration that owns these tool calls. */
242
152
  readonly itemIndex?: number;
243
- /** Parent invocation id when this agent is itself executing as a sub-agent. */
244
153
  readonly parentInvocationId?: ConnectionInvocationId;
245
154
  }): Promise<AgentMcpToolMap>;
246
155
  }
247
156
  //#endregion
248
157
  //#region ../core/src/contracts/assertionTypes.d.ts
249
- /**
250
- * One assertion emitted by an assertion-emitting node (a node whose config sets
251
- * `emitsAssertions: true`). Each emitted item on `main` carries one of these as `item.json`.
252
- *
253
- * Pass/fail is derived from `score >= (passThreshold ?? 0.5)` — see {@link deriveAssertionPassed}.
254
- * The `errored` marker is for cases where the assertion code itself threw (distinct from
255
- * "the assertion was evaluated and the score was low") and is treated as a hard fail in rollups
256
- * regardless of `score`.
257
- */
258
158
  interface AssertionResult {
259
159
  readonly name: string;
260
- /** 0..1 score. Source of truth for pass/fail (compared against `passThreshold`). */
261
160
  readonly score: number;
262
- /** 0..1 threshold for "passed". When omitted, consumers default to 0.5. */
263
161
  readonly passThreshold?: number;
264
- /** True when evaluating the assertion threw — treated as fail regardless of `score`. */
265
162
  readonly errored?: true;
266
- /** What the assertion expected. Free-form JSON; UIs render with a JSON viewer. */
267
163
  readonly expected?: JsonValue;
268
- /** What the workflow actually produced. */
269
164
  readonly actual?: JsonValue;
270
- /** Short human-readable explanation, especially for fails / errors. */
271
165
  readonly message?: string;
272
- /** Bag of supplemental fields (e.g. judge prompt, judge raw response, comparison method). */
273
166
  readonly details?: Readonly<Record<string, JsonValue>>;
274
167
  }
275
168
  //#endregion
@@ -281,9 +174,6 @@ type ItemExprResolvedContext = Readonly<{
281
174
  activationId: NodeActivationId;
282
175
  data: RunDataSnapshot;
283
176
  }>;
284
- /**
285
- * Context aligned with former {@link ItemInputMapperContext} — use **`data`** to read any completed upstream node.
286
- */
287
177
  type ItemExprContext = ItemExprResolvedContext;
288
178
  type ItemExprArgs<TItemJson = unknown> = Readonly<{
289
179
  item: Item<TItemJson>;
@@ -302,30 +192,21 @@ type Expr<T, TItemJson = unknown> = ItemExpr<T, TItemJson>;
302
192
  type ParamDeep<T, TItemJson = unknown> = Expr<T, TItemJson> | (T extends readonly (infer U)[] ? ReadonlyArray<ParamDeep<U, TItemJson>> : never) | (T extends object ? { [K in keyof T]: ParamDeep<T[K], TItemJson> } : T);
303
193
  //#endregion
304
194
  //#region ../core/src/contracts/retryPolicySpec.types.d.ts
305
- /**
306
- * In-process retry policy for runnable nodes. Serialized configs use the same
307
- * `kind` discriminator (`JSON.stringify` / persisted workflows).
308
- *
309
- * `maxAttempts` is the total number of tries including the first (e.g. 3 means up to 2 delays after failures).
310
- */
311
195
  type RetryPolicySpec = NoneRetryPolicySpec | FixedRetryPolicySpec | ExponentialRetryPolicySpec;
312
196
  interface NoneRetryPolicySpec {
313
197
  readonly kind: "none";
314
198
  }
315
199
  interface FixedRetryPolicySpec {
316
200
  readonly kind: "fixed";
317
- /** Total attempts including the first execution. Must be >= 1. */
318
201
  readonly maxAttempts: number;
319
202
  readonly delayMs: number;
320
203
  }
321
204
  interface ExponentialRetryPolicySpec {
322
205
  readonly kind: "exponential";
323
- /** Total attempts including the first execution. Must be >= 1. */
324
206
  readonly maxAttempts: number;
325
207
  readonly initialDelayMs: number;
326
208
  readonly multiplier: number;
327
209
  readonly maxDelayMs?: number;
328
- /** When true, each delay is multiplied by a random factor in [1, 1.2). */
329
210
  readonly jitter?: boolean;
330
211
  }
331
212
  //#endregion
@@ -354,22 +235,11 @@ type CredentialFieldSchema = Readonly<{
354
235
  type: "string" | "password" | "textarea" | "json" | "boolean";
355
236
  required?: true;
356
237
  order?: number;
357
- /**
358
- * Where this field appears in the credential dialog. Use `"advanced"` for optional or
359
- * power-user fields; they render inside a collapsible section (see `CredentialTypeDefinition.advancedSection`).
360
- * Defaults to `"default"` when omitted.
361
- */
362
238
  visibility?: "default" | "advanced";
363
239
  placeholder?: string;
364
240
  helpText?: string;
365
- /** When set, host resolves this field from process.env at runtime; env wins over stored values. */
366
241
  envVarName?: string;
367
- /**
368
- * When set, the dialog shows a copy action for this exact string (e.g. a static OAuth redirect URI
369
- * pattern or documentation URL). Do not use for secret values.
370
- */
371
242
  copyValue?: string;
372
- /** Accessible label for the copy control (default: Copy). */
373
243
  copyButtonLabel?: string;
374
244
  }>;
375
245
  type CredentialRequirement = Readonly<{
@@ -414,20 +284,9 @@ type CredentialOAuth2AuthDefinition = Readonly<{
414
284
  clientSecretFieldKey?: string;
415
285
  } | {
416
286
  kind: "oauth2";
417
- /**
418
- * Free-form provider identifier for telemetry, DB rows, and Better Auth provider naming.
419
- * Not used for any registry lookup — URLs come from {@link authorizeUrl} / {@link tokenUrl}.
420
- */
421
287
  providerId: string;
422
- /**
423
- * Authorization endpoint. May contain `{publicFieldKey}` placeholders that the runtime
424
- * substitutes from the credential's resolved public config (URL-encoded).
425
- * Example: `https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/authorize`
426
- */
427
288
  authorizeUrl: string;
428
- /** Token endpoint. Same templating rules as {@link authorizeUrl}. */
429
289
  tokenUrl: string;
430
- /** Optional userinfo endpoint. Same templating rules as {@link authorizeUrl}. */
431
290
  userInfoUrl?: string;
432
291
  scopes: ReadonlyArray<string>;
433
292
  scopesFromPublicConfig?: CredentialOAuth2ScopesFromPublicConfig;
@@ -436,11 +295,8 @@ type CredentialOAuth2AuthDefinition = Readonly<{
436
295
  }>;
437
296
  type CredentialAuthDefinition = CredentialOAuth2AuthDefinition;
438
297
  type CredentialAdvancedSectionPresentation = Readonly<{
439
- /** Collapsible section title (default: "Advanced"). */
440
298
  title?: string;
441
- /** Optional short helper text shown inside the section (above the fields). */
442
299
  description?: string;
443
- /** When true, the advanced section starts expanded. Default: false (collapsed). */
444
300
  defaultOpen?: boolean;
445
301
  }>;
446
302
  type CredentialTypeDefinition = Readonly<{
@@ -449,23 +305,11 @@ type CredentialTypeDefinition = Readonly<{
449
305
  description?: string;
450
306
  publicFields?: ReadonlyArray<CredentialFieldSchema>;
451
307
  secretFields?: ReadonlyArray<CredentialFieldSchema>;
452
- /**
453
- * Optional labels for the collapsible block that contains every field with `visibility: "advanced"`.
454
- * If omitted, the UI still shows that block with defaults (title "Advanced", collapsed).
455
- */
456
308
  advancedSection?: CredentialAdvancedSectionPresentation;
457
309
  supportedSourceKinds?: ReadonlyArray<CredentialMaterialSourceKind>;
458
310
  auth?: CredentialAuthDefinition;
459
311
  }>;
460
- /**
461
- * JSON-shaped credential field bag (public config, resolved secret material, etc.).
462
- */
463
312
  type CredentialJsonRecord = Readonly<Record<string, unknown>>;
464
- /**
465
- * Persisted credential instance with typed `publicConfig`.
466
- * Hosts may specialize `secretRef` with a stricter union while remaining
467
- * assignable here for session/test callbacks.
468
- */
469
313
  type CredentialInstanceRecord<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord> = Readonly<{
470
314
  instanceId: CredentialInstanceId;
471
315
  typeId: CredentialTypeId;
@@ -477,46 +321,30 @@ type CredentialInstanceRecord<TPublicConfig extends CredentialJsonRecord = Crede
477
321
  setupStatus: CredentialSetupStatus;
478
322
  createdAt: string;
479
323
  updatedAt: string;
480
- /**
481
- * Pointer to where the credential material bytes live. For OSS / standalone
482
- * rows this is `{source: "local", ref: instanceId}` and the bytes co-locate
483
- * with the row in the workspace DB. For managed-mode rows this is
484
- * `{source: "control-plane", ref: <cp_id>}` and the bytes live at CP.
485
- *
486
- * The seam is read through `CredentialMaterialProvider`. See
487
- * `docs/design/credentials-oauth-unification.md` ("Material provider seam").
488
- */
489
324
  material: Readonly<{
490
325
  source: "local" | "control-plane";
491
326
  ref: string;
492
327
  }>;
493
328
  }>;
494
- /**
495
- * Arguments passed to `CredentialType.createSession` and `CredentialType.test`.
496
- * Declare `TPublicConfig` / `TMaterial` on `CredentialType` so implementations are checked
497
- * against your credential shapes (similar to `NodeExecutionContext.config` for nodes).
498
- */
499
329
  type CredentialSessionFactoryArgs<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord> = Readonly<{
500
330
  instance: CredentialInstanceRecord<TPublicConfig>;
501
331
  material: TMaterial;
502
332
  publicConfig: TPublicConfig;
503
333
  }>;
504
334
  type CredentialSessionFactory<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord, TSession = unknown> = (args: CredentialSessionFactoryArgs<TPublicConfig, TMaterial>) => Promise<TSession>;
335
+ type CredentialAccessTokenSessionArgs<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord> = Readonly<{
336
+ accessToken: string;
337
+ grantedScopes: ReadonlyArray<string>;
338
+ publicConfig: TPublicConfig;
339
+ }>;
340
+ type CredentialAccessTokenSessionFactory<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TSession = unknown> = (args: CredentialAccessTokenSessionArgs<TPublicConfig>) => Promise<TSession>;
505
341
  type CredentialHealthTester<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord> = (args: CredentialSessionFactoryArgs<TPublicConfig, TMaterial>) => Promise<CredentialHealth>;
506
- /**
507
- * Full credential type implementation: `definition` (UI/schema), `createSession`, and `test`.
508
- * Use this at registration and config boundaries; `CredentialTypeDefinition` is only the schema slice.
509
- */
510
342
  type CredentialType<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord, TSession = unknown> = Readonly<{
511
343
  definition: CredentialTypeDefinition;
512
344
  createSession: CredentialSessionFactory<TPublicConfig, TMaterial, TSession>;
345
+ createSessionFromAccessToken?: CredentialAccessTokenSessionFactory<TPublicConfig, TSession>;
513
346
  test: CredentialHealthTester<TPublicConfig, TMaterial>;
514
347
  }>;
515
- /**
516
- * Credential type with unspecified generics — used for `CodemationConfig.credentialTypes`, the host registry,
517
- * and anywhere a concrete `CredentialType<YourPublic, YourMaterial, YourSession>` is placed in a heterogeneous list.
518
- * Using `any` here avoids unsafe `as` casts while keeping typed `satisfies CredentialType<…>` definitions.
519
- */
520
348
  type AnyCredentialType = CredentialType<any, any, unknown>;
521
349
  interface CredentialSessionService {
522
350
  getSession<TSession = unknown>(args: Readonly<{
@@ -529,65 +357,34 @@ interface CredentialSessionService {
529
357
  //#region ../core/src/contracts/mcpTypes.d.ts
530
358
  type McpServerTransport = "http";
531
359
  interface McpServerDeclaration {
532
- /** Globally unique slug, e.g. "gmail". Workflow authors reference this. */
533
360
  id: string;
534
361
  displayName: string;
535
362
  description: string;
536
363
  transport: McpServerTransport;
537
364
  url: string;
538
- /**
539
- * Credential types accepted by this MCP server, matching CredentialRequirement.acceptedTypes.
540
- * Absent or empty means no credential is required.
541
- */
542
365
  acceptedCredentialTypes?: ReadonlyArray<string>;
543
- /**
544
- * Documentation only in MVP. The bind-time validator checks
545
- * requiredScopes ⊆ CredentialInstance.scopesGranted.
546
- */
547
366
  requiredScopes?: string[];
548
- /** Non-secret static headers merged onto every MCP request. */
549
367
  staticHeaders?: Record<string, string>;
550
- /**
551
- * Overrides for tool descriptions advertised by the MCP server.
552
- * Applied by the connection pool after tools/list.
553
- * Key: exact tool name as returned by the server.
554
- */
555
368
  toolDescriptionOverrides?: Record<string, string>;
556
369
  }
557
370
  //#endregion
558
371
  //#region ../core/src/contracts/collectionTypes.d.ts
559
- /**
560
- * Represents a typed store for a single collection.
561
- * All rows include auto-managed id, created_at, and updated_at fields.
562
- */
563
372
  interface CollectionStore<TRow extends Record<string, unknown> = Record<string, unknown>> {
564
- /**
565
- * Insert a new row. id, created_at, and updated_at are auto-populated.
566
- */
567
373
  insert(row: TRow): Promise<TRow & {
568
374
  id: string;
569
375
  created_at: Date;
570
376
  updated_at: Date;
571
377
  }>;
572
- /**
573
- * Get a single row by id.
574
- */
575
378
  get(id: string): Promise<(TRow & {
576
379
  id: string;
577
380
  created_at: Date;
578
381
  updated_at: Date;
579
382
  }) | null>;
580
- /**
581
- * Find a single row matching the provided filter.
582
- */
583
383
  findOne(filter: Partial<TRow>): Promise<(TRow & {
584
384
  id: string;
585
385
  created_at: Date;
586
386
  updated_at: Date;
587
387
  }) | null>;
588
- /**
589
- * List rows with optional pagination and filtering.
590
- */
591
388
  list(opts?: {
592
389
  limit?: number;
593
390
  offset?: number;
@@ -600,24 +397,15 @@ interface CollectionStore<TRow extends Record<string, unknown> = Record<string,
600
397
  }>;
601
398
  total: number;
602
399
  }>;
603
- /**
604
- * Update a row by id with partial data.
605
- */
606
400
  update(id: string, patch: Partial<TRow>): Promise<TRow & {
607
401
  id: string;
608
402
  created_at: Date;
609
403
  updated_at: Date;
610
404
  }>;
611
- /**
612
- * Delete a row by id. Hard delete only (no soft delete).
613
- */
614
405
  delete(id: string): Promise<{
615
406
  deleted: boolean;
616
407
  }>;
617
408
  }
618
- /**
619
- * Runtime collections context: keyed by collection name.
620
- */
621
409
  type CollectionsContext = Readonly<Record<string, CollectionStore>>;
622
410
  //#endregion
623
411
  //#region ../core/src/contracts/emitPorts.d.ts
@@ -628,20 +416,6 @@ type PortsEmission = Readonly<{
628
416
  }>;
629
417
  //#endregion
630
418
  //#region ../core/src/authoring/nodeBaseOptions.types.d.ts
631
- /**
632
- * Core-local copy of the per-instance authoring options every `define*` factory's `create(...)`
633
- * accepts in its trailing argument: a stable `id` plus a plain-language `description` (the
634
- * non-technical "what does this step do" line surfaced in the node sidebar).
635
- *
636
- * `description` is a first-class option — passed inline exactly like `id` — and is threaded onto
637
- * the config instance as an OWN ENUMERABLE field so it flows into the persisted workflow snapshot
638
- * (`WorkflowSnapshotCodec` serializes via `JSON.parse(JSON.stringify(config))`, which only captures
639
- * own enumerable properties — never a getter).
640
- *
641
- * `@codemation/core-nodes` declares an identical `NodeBaseOptions` for its bare-id built-in nodes;
642
- * core keeps its own copy because core must not depend on `@codemation/core-nodes` (dependency
643
- * direction). The two types are structurally identical by design.
644
- */
645
419
  interface NodeBaseOptions$1 {
646
420
  readonly id?: string;
647
421
  readonly description?: string;
@@ -649,6 +423,7 @@ interface NodeBaseOptions$1 {
649
423
  //#endregion
650
424
  //#region ../core/src/authoring/defineNode.types.d.ts
651
425
  type ResolvableCredentialType = AnyCredentialType | CredentialTypeId;
426
+ type SessionForCredentialType<TCredential extends ResolvableCredentialType> = TCredential extends AnyCredentialType ? Awaited<ReturnType<TCredential["createSession"]>> : unknown;
652
427
  type DefinedNodeCredentialBinding = ResolvableCredentialType | Readonly<{
653
428
  readonly type: ResolvableCredentialType | ReadonlyArray<ResolvableCredentialType>;
654
429
  readonly label?: string;
@@ -657,6 +432,10 @@ type DefinedNodeCredentialBinding = ResolvableCredentialType | Readonly<{
657
432
  readonly helpUrl?: string;
658
433
  }>;
659
434
  type DefinedNodeCredentialBindings = Readonly<Record<string, DefinedNodeCredentialBinding>>;
435
+ type SessionForBinding<TBinding extends DefinedNodeCredentialBinding> = TBinding extends Readonly<{
436
+ type: infer TType;
437
+ }> ? TType extends ReadonlyArray<infer TEntry> ? SessionForCredentialType<TEntry & ResolvableCredentialType> : SessionForCredentialType<TType & ResolvableCredentialType> : SessionForCredentialType<TBinding & ResolvableCredentialType>;
438
+ type DefinedNodeCredentialAccessors<TBindings extends DefinedNodeCredentialBindings | undefined> = TBindings extends DefinedNodeCredentialBindings ? Readonly<{ [TKey in keyof TBindings]: () => Promise<SessionForBinding<TBindings[TKey]>> }> : Readonly<Record<string, never>>;
660
439
  type DefinedNodeConfigInput<TConfigResolved extends CredentialJsonRecord, TItemJson> = ParamDeep<TConfigResolved, TItemJson>;
661
440
  interface DefinedNode<TKey$1 extends string, TConfig extends CredentialJsonRecord, TInputJson$1, TOutputJson$1, _TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
662
441
  readonly kind: "defined-node";
@@ -670,47 +449,17 @@ interface DefinedNode<TKey$1 extends string, TConfig extends CredentialJsonRecor
670
449
  }
671
450
  //#endregion
672
451
  //#region ../core/src/authoring/defineHumanApprovalNode.types.d.ts
673
- /**
674
- * Decision shape merged into `item.json` after a HITL approval task resolves.
675
- *
676
- * - `"approved"` / `"rejected"` — from a human decision (uses `approvedPredicate`).
677
- * - `"timed-out"` — timeout fired with `onTimeout: "halt"`.
678
- * - `"auto-accepted"` — timeout fired with `onTimeout: "auto-accept"`.
679
- */
680
452
  interface HumanApprovalDecisionResult {
681
453
  readonly status: "approved" | "rejected" | "timed-out" | "auto-accepted";
682
- /** Identity of the person who decided; absent for automated outcomes. */
683
454
  readonly actor?: HumanTaskActor;
684
- /** ISO 8601 timestamp of the decision. */
685
455
  readonly decidedAt?: Date;
686
- /** Optional free-text note from the reviewer. */
687
456
  readonly note?: string;
688
- /**
689
- * Full raw decision payload (only present for `"approved"` / `"rejected"`).
690
- * Shape is determined by the channel's `decisionSchema`.
691
- */
692
457
  readonly payload?: Record<string, unknown>;
693
458
  }
694
- /**
695
- * Output item shape emitted by a `defineHumanApprovalNode`-based node.
696
- * Original `item.json` fields are preserved and `decision` is merged in.
697
- * If the input `item.json` already contained a `decision` key it is **overwritten**.
698
- */
699
459
  type HumanApprovalOutputJson<TInputJson$1 extends Record<string, unknown>> = TInputJson$1 & {
700
460
  readonly decision: HumanApprovalDecisionResult;
701
461
  };
702
- /**
703
- * Extends {@link DefinedNode} with the `humanApprovalToolBehavior` metadata marker.
704
- * Story 10 reads this field when attaching the node as an agent tool.
705
- */
706
462
  interface DefinedHumanApprovalNode<TKey$1 extends string, TConfig extends CredentialJsonRecord, TInputJson$1 extends Record<string, unknown>, TBindings extends DefinedNodeCredentialBindings | undefined = undefined> extends DefinedNode<TKey$1, TConfig, TInputJson$1, HumanApprovalOutputJson<TInputJson$1>, TBindings> {
707
- /**
708
- * Behavior hint consumed by the agent runtime (story 10) when this node is attached as a tool.
709
- * `"return"` (default) — return the rejection to the agent as a tool result.
710
- * `"halt"` — halt the agent run on rejection.
711
- *
712
- * Standalone DSL usage ignores this field.
713
- */
714
463
  readonly humanApprovalToolBehavior: {
715
464
  onRejected: "return" | "halt";
716
465
  };
@@ -731,7 +480,6 @@ type BooleanWhenOverloads<TCurrentJson, TReturn> = {
731
480
  };
732
481
  //#endregion
733
482
  //#region ../core/src/workflow/dsl/WhenBuilder.d.ts
734
- /** Structurally identical to ChainCursorResolver's (unexported) ChainCursorEndpoint. */
735
483
  type WhenEndpoint = Readonly<{
736
484
  node: NodeRef;
737
485
  output: OutputPortKey;
@@ -741,32 +489,17 @@ declare class WhenBuilder<TCurrentJson> {
741
489
  private readonly wf;
742
490
  private readonly from;
743
491
  private readonly branchPort;
744
- /** Tails of arms added by earlier `.when(...)` calls in this chain. */
745
492
  private readonly priorEndpoints;
746
- /** Tail endpoint of the arm this builder added (set by addBranch). */
747
493
  private armEndpoint;
748
- constructor(wf: WorkflowBuilder, from: NodeRef, branchPort: OutputPortKey, /** Tails of arms added by earlier `.when(...)` calls in this chain. */
749
- priorEndpoints?: ReadonlyArray<WhenEndpoint>);
494
+ constructor(wf: WorkflowBuilder, from: NodeRef, branchPort: OutputPortKey, priorEndpoints?: ReadonlyArray<WhenEndpoint>);
750
495
  addBranch<TSteps extends ReadonlyArray<AnyRunnableNodeConfig>>(steps: TSteps & ValidStepSequence<TCurrentJson, TSteps>): this;
751
496
  readonly when: BooleanWhenOverloads<TCurrentJson, WhenBuilder<TCurrentJson>>;
752
- /**
753
- * Continue the trunk after a boolean `.when(...)` branch chain, auto-merging EVERY branch
754
- * tail accumulated across the chain into the next node — the same fan-in the object form
755
- * produces. Typed as `ChainCursor<TCurrentJson>` (the pre-branch item type): boolean arms
756
- * carry no output guard so the merged item type is underdetermined — use the object form
757
- * `.when({ true: [...], false: [...] })` when you need a precise merged type inline.
758
- */
759
497
  then<TOutputJson$1, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson$1>>(config: TConfig): ChainCursor<RunnableNodeOutputJson<TConfig>>;
760
- /**
761
- * Chainable human-approval step after a boolean `.when(...)` branch chain — merges every
762
- * branch tail into the approval node. Mirrors `ChainCursor.humanApproval`.
763
- */
764
498
  humanApproval<TKey$1 extends string, TConfig extends Record<string, unknown>, TBindings extends DefinedNodeCredentialBindings | undefined = undefined>(node: DefinedHumanApprovalNode<TKey$1, TConfig, TCurrentJson & Record<string, unknown>, TBindings>, config: TConfig, metadata?: {
765
499
  name?: string;
766
500
  nodeId?: string;
767
501
  }): ChainCursor<HumanApprovalOutputJson<TCurrentJson & Record<string, unknown>>>;
768
502
  build(): WorkflowDefinition;
769
- /** Endpoints of every arm added so far in this chain (prior arms + this one). */
770
503
  private get accumulatedEndpoints();
771
504
  private toCursor;
772
505
  }
@@ -788,30 +521,10 @@ declare class ChainCursor<TCurrentJson> {
788
521
  private readonly endpoints;
789
522
  constructor(wf: WorkflowBuilder, endpoints: ReadonlyArray<ChainCursorEndpoint>);
790
523
  then<TOutputJson$1, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson$1>>(config: TConfig): ChainCursor<RunnableNodeOutputJson<TConfig>>;
791
- /**
792
- * Append a step whose output is MERGED onto `item.json` (shallow, output-wins) instead of
793
- * replacing it — so earlier fields (e.g. trigger metadata) survive a transform/OCR/extraction
794
- * node. Use for any node in a pipeline where you need data from before it.
795
- */
796
524
  thenMerge<TOutputJson$1, TConfig extends RunnableNodeConfig<TCurrentJson, TOutputJson$1>>(config: TConfig): ChainCursor<TCurrentJson & RunnableNodeOutputJson<TConfig>>;
797
525
  thenIntoInputHints<TOutputJson$1, TConfig extends RunnableNodeConfig<any, TOutputJson$1>>(config: TConfig): ChainCursor<RunnableNodeOutputJson<TConfig>>;
798
526
  readonly when: ChainCursorWhenOverloads<TCurrentJson>;
799
527
  route<TNextJson$1>(branches: Readonly<Record<OutputPortKey, (branch: ChainCursor<TCurrentJson>) => ChainCursor<TNextJson$1> | undefined>>): ChainCursor<TNextJson$1>;
800
- /**
801
- * Chainable shorthand for `.then(node.create(config, metadata?.name, metadata?.nodeId))`.
802
- *
803
- * Signals to readers that this step suspends the run and waits for a human decision.
804
- * Throws at workflow-build time if `node` was not created via `defineHumanApprovalNode`.
805
- *
806
- * @example
807
- * ```ts
808
- * workflow
809
- * .trigger(...)
810
- * .humanApproval(inboxApproval, { title: "Approve?", body: "...", priority: "normal" })
811
- * .then(nextStep.create(...))
812
- * .build();
813
- * ```
814
- */
815
528
  humanApproval<TKey$1 extends string, TConfig extends Record<string, unknown>, TBindings extends DefinedNodeCredentialBindings | undefined = undefined>(node: DefinedHumanApprovalNode<TKey$1, TConfig, TCurrentJson & Record<string, unknown>, TBindings>, config: TConfig, metadata?: {
816
529
  name?: string;
817
530
  nodeId?: string;
@@ -839,20 +552,9 @@ declare class WorkflowBuilder {
839
552
  }
840
553
  //#endregion
841
554
  //#region ../core/src/contracts/runTypes.d.ts
842
- /**
843
- * Test-suite linkage for a run. When set, this run was started by a TestSuiteOrchestrator
844
- * as one test case inside a TestSuiteRun. The `IsTestRun` node and host-side persisters key
845
- * off the presence of this field. Subworkflow runs inherit it from their parent run.
846
- */
847
555
  interface RunTestContext {
848
556
  readonly testSuiteRunId: string;
849
557
  readonly testCaseIndex: number;
850
- /**
851
- * Optional human-friendly label for this test case (e.g. an email subject when fixtures
852
- * are loaded from a mailbox). Resolved per item by `TestTrigger.caseLabel(item)` if set,
853
- * persisted on `Run.test_case_label` so the Tests-tab tree-table can show "RFQ for batch 14"
854
- * instead of "run_1777755971399_bbb86beac1396".
855
- */
856
558
  readonly testCaseLabel?: string;
857
559
  }
858
560
  type NodeInputsByPort = Readonly<Record<InputPortKey, Items>>;
@@ -863,9 +565,7 @@ interface NodeExecutionError {
863
565
  stack?: string;
864
566
  details?: JsonValue;
865
567
  }
866
- /** Stable id for a single connection invocation row in {@link ConnectionInvocationRecord}. */
867
568
  type ConnectionInvocationId = string;
868
- /** Arguments for appending a {@link ConnectionInvocationRecord} (engine fills run/workflow ids and timestamps). */
869
569
  type ConnectionInvocationAppendArgs = Readonly<{
870
570
  invocationId: ConnectionInvocationId;
871
571
  connectionNodeId: NodeId;
@@ -884,7 +584,6 @@ type ConnectionInvocationAppendArgs = Readonly<{
884
584
  itemIndex?: number;
885
585
  parentInvocationId?: ConnectionInvocationId;
886
586
  }>;
887
- /** Reason a run transitioned to {@link RunStatus} `"halted"`. */
888
587
  type RunHaltReason = "hitl-rejected" | "hitl-timeout" | "hitl-cancelled";
889
588
  interface PendingNodeExecution {
890
589
  runId: RunId;
@@ -937,7 +636,6 @@ interface JsonObject {
937
636
  }
938
637
  type JsonValue = JsonPrimitive | JsonObject | JsonArray;
939
638
  type JsonArray = ReadonlyArray<JsonValue>;
940
- /** JSON value that is not a top-level array (nested arrays inside objects are allowed). */
941
639
  type JsonNonArray = JsonPrimitive | JsonObject;
942
640
  interface Edge {
943
641
  from: {
@@ -949,11 +647,6 @@ interface Edge {
949
647
  input: InputPortKey;
950
648
  };
951
649
  }
952
- /**
953
- * Named connection from a parent node to child nodes that exist in {@link WorkflowDefinition.nodes}
954
- * but are not traversed by the main execution graph. Parents are commonly executable nodes, but may
955
- * also be connection-owned nodes for recursive agent attachments.
956
- */
957
650
  interface WorkflowNodeConnection {
958
651
  readonly parentNodeId: NodeId;
959
652
  readonly connectionName: NodeConnectionName;
@@ -964,18 +657,10 @@ interface WorkflowDefinition {
964
657
  name: string;
965
658
  nodes: NodeDefinition[];
966
659
  edges: Edge[];
967
- /**
968
- * Optional metadata: which nodes are connection-owned children (e.g. AI agent `llm` / `tools` slots).
969
- * When omitted, all nodes in {@link nodes} are treated as executable for topology.
970
- */
971
660
  readonly connections?: ReadonlyArray<WorkflowNodeConnection>;
972
- /** Directory + file-stem path under a workflow discovery root (for UI grouping only). */
973
661
  discoveryPathSegments?: readonly string[];
974
- /** Retention for run JSON and binaries (seconds). Host/env may supply defaults when omitted. */
975
662
  readonly prunePolicy?: WorkflowPrunePolicySpec;
976
- /** Whether to keep run data after completion. Host/env may supply defaults when omitted. */
977
663
  readonly storagePolicy?: WorkflowStoragePolicySpec;
978
- /** Invoked after a node fails permanently (retries exhausted) and node error handler did not recover. */
979
664
  readonly workflowErrorHandler?: WorkflowErrorHandlerSpec;
980
665
  }
981
666
  interface NodeConfigBase {
@@ -984,59 +669,26 @@ interface NodeConfigBase {
984
669
  readonly name?: string;
985
670
  readonly id?: NodeId;
986
671
  readonly icon?: string;
987
- /**
988
- * Plain-language, non-technical explanation of what this node does, surfaced in the workflow
989
- * inspector / node properties sidebar. A first-class config option every authorable node accepts
990
- * directly (alongside `id`), so it flows into the persisted config the mappers read. Distinct from
991
- * {@link inspectorSummary} (config-derived label/value rows).
992
- */
993
672
  readonly description?: string;
994
673
  readonly execution?: Readonly<{
995
674
  hint?: "local" | "worker";
996
675
  queue?: string;
997
676
  }>;
998
- /** In-process execute retries (runnable nodes). Triggers typically omit this. */
999
677
  readonly retryPolicy?: RetryPolicySpec;
1000
- /** Recover from execute failures; return outputs to continue, or rethrow to fail the node. */
1001
678
  readonly nodeErrorHandler?: NodeErrorHandlerSpec;
1002
- /**
1003
- * When true, edges carrying zero items on an output port still schedule single-input downstream nodes.
1004
- * Decided from the **source** node that produced the (empty) output. Default (false/undefined): empty
1005
- * main batches skip downstream execution and propagate the empty path.
1006
- */
1007
679
  readonly continueWhenEmptyOutput?: boolean;
1008
- /**
1009
- * Declared I/O port names for canvas authoring (unioned with ports inferred from edges).
1010
- * Use for dynamic routers (Switch) and future error ports.
1011
- */
1012
680
  readonly declaredOutputPorts?: ReadonlyArray<OutputPortKey>;
1013
681
  readonly declaredInputPorts?: ReadonlyArray<InputPortKey>;
1014
682
  getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
1015
- /**
1016
- * Marker: this node emits {@link import("./assertionTypes").AssertionResult}-shaped items on its
1017
- * `main` port. The TestSuiteOrchestrator (and host-side TestAssertionPersister) listen for
1018
- * `nodeCompleted` events from nodes with this flag set, and persist their output items as
1019
- * TestAssertion records (only when the run carries a `testContext`). Set on assertion node
1020
- * configs (e.g. `AssertionNodeConfig`, `StringEqualsAssertionNodeConfig`).
1021
- */
1022
683
  readonly emitsAssertions?: true;
1023
- /**
1024
- * Static configuration summary surfaced in the workflow inspector — the design-time
1025
- * "what does this node do" panel that renders before any run telemetry exists.
1026
- *
1027
- * Return 2–6 short label/value pairs derived from this config (method + url for an HTTP
1028
- * call, model + tool list for an agent, schedule + timezone for a cron trigger, etc.).
1029
- * Values are truncated by the UI; aim for one line each. Return `undefined` to opt out
1030
- * — the inspector hides the section when no rows are produced.
1031
- *
1032
- * Implement on the config class instance so the function can read sibling config fields.
1033
- * `defineNode({ inspectorSummary })` plumbs through to this.
1034
- */
1035
684
  inspectorSummary?(): ReadonlyArray<NodeInspectorSummaryRow> | undefined;
1036
685
  }
1037
- /**
1038
- * One row of a node's static configuration summary. See {@link NodeConfigBase.inspectorSummary}.
1039
- */
686
+ interface PollingTriggerConfig {
687
+ getTriggerPollConfig(): Readonly<{
688
+ config: JsonObject;
689
+ pollIntervalMs?: number;
690
+ }>;
691
+ }
1040
692
  interface NodeInspectorSummaryRow {
1041
693
  readonly label: string;
1042
694
  readonly value: string;
@@ -1044,24 +696,11 @@ interface NodeInspectorSummaryRow {
1044
696
  declare const runnableNodeInputType: unique symbol;
1045
697
  declare const runnableNodeOutputType: unique symbol;
1046
698
  declare const triggerNodeOutputType: unique symbol;
1047
- /**
1048
- * Runnable node: **`TInputJson`** is what **`inputSchema`** validates on **`item.json`** (the wire payload).
1049
- * **`TOutputJson`** is emitted `item.json` on outputs.
1050
- */
1051
699
  interface RunnableNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> extends NodeConfigBase {
1052
700
  readonly kind: "node";
1053
701
  readonly [runnableNodeInputType]?: TInputJson$1;
1054
702
  readonly [runnableNodeOutputType]?: TOutputJson$1;
1055
- /**
1056
- * Optional Zod input contract for {@link RunnableNode} when not set on the node class.
1057
- * Resolution order: node instance `inputSchema`, then config `inputSchema`, then `z.unknown()`.
1058
- */
1059
703
  readonly inputSchema?: ZodType<TInputJson$1>;
1060
- /**
1061
- * When an activation receives **zero** input items, the engine normally runs `execute` zero times.
1062
- * Set to **`runOnce`** to run `execute` once with an empty `items` batch (and a synthetic wire item for schema parsing).
1063
- * Used by batch-style callback nodes (built-in `Callback`) so `callback([], ctx)` still runs.
1064
- */
1065
704
  readonly emptyBatchExecution?: "skip" | "runOnce";
1066
705
  }
1067
706
  declare const triggerNodeSetupStateType: unique symbol;
@@ -1069,11 +708,6 @@ interface TriggerNodeConfig<TOutputJson$1 = unknown, TSetupState$1 extends JsonV
1069
708
  readonly kind: "trigger";
1070
709
  readonly [triggerNodeOutputType]?: TOutputJson$1;
1071
710
  readonly [triggerNodeSetupStateType]?: TSetupState$1;
1072
- /**
1073
- * Distinguishes triggers driven by the live activation policy (webhooks, cron, polling) from
1074
- * triggers driven only by the {@link TestSuiteOrchestrator}. `WorkflowActivation` skips
1075
- * `"test"` triggers; the orchestrator skips `"live"` triggers. Defaults to `"live"` when omitted.
1076
- */
1077
711
  readonly triggerKind?: "live" | "test";
1078
712
  }
1079
713
  type RunnableNodeInputJson<TConfig extends RunnableNodeConfig<any, any>> = TConfig extends RunnableNodeConfig<infer TInputJson, any> ? TInputJson : never;
@@ -1124,27 +758,14 @@ type Items<TJson = unknown> = ReadonlyArray<Item<TJson>>;
1124
758
  type NodeOutputs = Partial<Record<OutputPortKey, Items>>;
1125
759
  type RunId = string;
1126
760
  type NodeActivationId = string;
1127
- /**
1128
- * One per-item iteration of a runnable node's execute loop. Refines `NodeActivationId` for
1129
- * per-item connection invocations and telemetry. Undefined when the executing node is a batch
1130
- * node or trigger that does not iterate items.
1131
- */
1132
761
  type NodeIterationId = string;
1133
762
  interface ParentExecutionRef {
1134
763
  runId: RunId;
1135
764
  workflowId: WorkflowId;
1136
765
  nodeId: NodeId;
1137
- /** Subworkflow depth of the **spawning** run (0 = root). Passed when starting a child run. */
1138
766
  subworkflowDepth?: number;
1139
- /** Effective max node activations from the parent run (propagated to child policy merge). */
1140
767
  engineMaxNodeActivations?: number;
1141
- /** Effective max subworkflow depth from the parent run (propagated to child policy merge). */
1142
768
  engineMaxSubworkflowDepth?: number;
1143
- /**
1144
- * Test-suite linkage inherited by the child subworkflow run. Set by whichever node
1145
- * spawns the subworkflow when its own `ctx.testContext` is present, so assertions
1146
- * emitted inside a subworkflow land under the correct parent test case.
1147
- */
1148
769
  testContext?: RunTestContext;
1149
770
  }
1150
771
  interface RunDataSnapshot {
@@ -1156,7 +777,6 @@ interface ActivationIdFactory {
1156
777
  makeActivationId(): NodeActivationId;
1157
778
  }
1158
779
  type UpstreamRefPlaceholder = `$${number}`;
1159
- /** Whether to persist run execution data after the workflow finishes. */
1160
780
  type WorkflowStoragePolicyMode = "ALL" | "SUCCESS" | "ERROR" | "NEVER";
1161
781
  type WorkflowStoragePolicySpec = WorkflowStoragePolicyMode | TypeToken<WorkflowStoragePolicyResolver>;
1162
782
  interface WorkflowStoragePolicyResolver {
@@ -1203,46 +823,25 @@ interface NodeErrorHandler {
1203
823
  type NodeErrorHandlerSpec = TypeToken<NodeErrorHandler> | NodeErrorHandler;
1204
824
  //#endregion
1205
825
  //#region ../core/src/triggers/polling/PollingTriggerDedupWindow.d.ts
1206
- /**
1207
- * Merges processed-ID windows for polling triggers, capping the total to avoid unbounded growth.
1208
- * Plugin code receives an instance of this class via {@link PollingTriggerHandle.dedup}.
1209
- */
1210
826
  declare class PollingTriggerDedupWindow {
1211
827
  static readonly defaultCapN = 2000;
1212
828
  merge(previous: ReadonlyArray<string>, incoming: ReadonlyArray<string>, capN?: number): ReadonlyArray<string>;
1213
829
  }
1214
830
  //#endregion
1215
831
  //#region ../core/src/contracts/runtimeTypes.d.ts
1216
- /** Opaque unique identifier for a single HumanTask instance. */
1217
832
  type HumanTaskId = string;
1218
- /**
1219
- * Minimal handle handed to the `deliver` callback so it can route to the correct
1220
- * inbox channel.
1221
- */
1222
833
  interface HumanTaskHandle {
1223
834
  readonly taskId: HumanTaskId;
1224
835
  readonly runId: string;
1225
836
  readonly nodeId: string;
1226
837
  readonly expiresAt: Date;
1227
- /** TODO: real signed URL; placeholder empty string for now. */
1228
838
  readonly resumeUrl: string;
1229
- /**
1230
- * Arbitrary JSON metadata copied from `SuspensionRequest.request.metadata` at suspension time.
1231
- * Used by the agent runtime to round-trip the `agentCheckpoint` back to the
1232
- * resumed node via `ctx.resumeContext.task.metadata`.
1233
- */
1234
839
  readonly metadata?: Readonly<Record<string, JsonValue>>;
1235
840
  }
1236
- /** Identity of the person who made a decision on the task. */
1237
841
  interface HumanTaskActor {
1238
842
  readonly actorId: string;
1239
843
  readonly displayName?: string;
1240
844
  }
1241
- /**
1242
- * Resume context injected into `NodeExecutionContext` when the engine re-activates
1243
- * a previously suspended node. `defineHumanApprovalNode` wraps this with parsed
1244
- * `TDecision`; at the engine layer `decision.value` is `unknown`.
1245
- */
1246
845
  interface ResumeContext {
1247
846
  readonly decision: Readonly<{
1248
847
  kind: "decided";
@@ -1294,11 +893,6 @@ interface NodeExecutionStatePublisher {
1294
893
  error: Error;
1295
894
  }): Promise<void>;
1296
895
  appendConnectionInvocation(args: ConnectionInvocationAppendArgs): Promise<void>;
1297
- /**
1298
- * Annotates the current snapshot for `nodeId` with the id of the child run spawned by a
1299
- * SubWorkflow invocation. Called from `SubWorkflowNode.execute` after `runById` resolves.
1300
- * The engine's subsequent `markCompleted` call preserves the value via `previous.childRunId`.
1301
- */
1302
896
  setChildRunId?(args: {
1303
897
  nodeId: NodeId;
1304
898
  childRunId: RunId;
@@ -1326,32 +920,16 @@ interface ExecutionBinaryService {
1326
920
  activationId: NodeActivationId;
1327
921
  }): NodeBinaryAttachmentService;
1328
922
  openReadStream(attachment: BinaryAttachment): Promise<BinaryStorageReadResult | undefined>;
1329
- /**
1330
- * Reads all bytes from the attachment into a contiguous `Uint8Array`.
1331
- * Checks `attachment.size` against `maxBytes` *before* any allocation; throws a bounded-read
1332
- * error when exceeded (no OOM). Throws if the stream is unavailable or the byte count mismatches.
1333
- */
1334
923
  getBytes(attachment: BinaryAttachment, maxBytes?: number): Promise<Uint8Array>;
1335
- /**
1336
- * Reads the attachment and decodes the bytes as UTF-8 text.
1337
- * Subject to the same bounded-read safety as `getBytes`.
1338
- */
1339
924
  getText(attachment: BinaryAttachment, maxBytes?: number): Promise<string>;
1340
- /**
1341
- * Reads the attachment, decodes as UTF-8 text, and parses as JSON.
1342
- * Throws a clear error on invalid JSON. Subject to the same bounded-read safety.
1343
- */
1344
925
  getJson<T = unknown>(attachment: BinaryAttachment, maxBytes?: number): Promise<T>;
1345
926
  }
1346
927
  interface ExecutionContext {
1347
928
  runId: RunId;
1348
929
  workflowId: WorkflowId;
1349
930
  parent?: ParentExecutionRef;
1350
- /** This run's subworkflow depth (0 = root). */
1351
931
  subworkflowDepth: number;
1352
- /** Effective activation budget cap for this run (after policy merge). */
1353
932
  engineMaxNodeActivations: number;
1354
- /** Effective subworkflow nesting cap for this run (after policy merge). */
1355
933
  engineMaxSubworkflowDepth: number;
1356
934
  now: () => Date;
1357
935
  data: RunDataSnapshot;
@@ -1359,28 +937,11 @@ interface ExecutionContext {
1359
937
  telemetry: ExecutionTelemetry;
1360
938
  binary: ExecutionBinaryService;
1361
939
  getCredential<TSession = unknown>(slotKey: string): Promise<TSession>;
1362
- /** Per-item iteration id, set by {@link NodeExecutor} on the ctx passed into runnable `execute`. */
1363
940
  iterationId?: NodeIterationId;
1364
- /** Item index (0-based) within the current activation's batch; set alongside {@link iterationId}. */
1365
941
  itemIndex?: number;
1366
- /** When set, this ctx is executing inside a sub-agent triggered by the named parent invocation. */
1367
942
  parentInvocationId?: ConnectionInvocationId;
1368
- /**
1369
- * Present iff the run was started by a TestSuiteOrchestrator. The {@link IsTestRunNode}
1370
- * branches on this; assertion-emitting nodes use it to decide whether to record results.
1371
- */
1372
943
  testContext?: RunTestContext;
1373
- /**
1374
- * Collections registered in the codemation config, keyed by collection name.
1375
- */
1376
944
  readonly collections?: CollectionsContext;
1377
- /**
1378
- * Resolve a DI token from the host container.
1379
- * Allows nodes to reach host-side services (e.g. `InboxChannelResolverToken`)
1380
- * without importing host code. Wired by `DefaultExecutionContextFactory`; throws
1381
- * a clear error when no resolver is configured (e.g. in unit tests that don't
1382
- * set up the full container).
1383
- */
1384
945
  resolve<T>(token: TypeToken<T>): T;
1385
946
  }
1386
947
  interface NodeExecutionContext<TConfig extends NodeConfigBase = NodeConfigBase> extends ExecutionContext {
@@ -1389,18 +950,9 @@ interface NodeExecutionContext<TConfig extends NodeConfigBase = NodeConfigBase>
1389
950
  config: TConfig;
1390
951
  telemetry: NodeExecutionTelemetry;
1391
952
  binary: NodeBinaryAttachmentService;
1392
- /**
1393
- * Present when this node activation is a HITL resume.
1394
- * The node checks `ctx.resumeContext !== undefined` and takes the resume branch.
1395
- */
1396
953
  resumeContext?: ResumeContext;
1397
954
  }
1398
- interface PollingTriggerHandle {
1399
- /**
1400
- * Start the polling loop. The runtime registers its own cleanup handle so callers do not need to
1401
- * call {@link TriggerSetupContext.registerCleanup} for the loop.
1402
- * @returns The state returned by the first cycle (or `undefined` when the overlap guard fired).
1403
- */
955
+ interface TriggerPollingPort {
1404
956
  start<TState, TItem>(args: {
1405
957
  intervalMs: number;
1406
958
  seedState?: TState;
@@ -1412,7 +964,8 @@ interface PollingTriggerHandle {
1412
964
  nextState: TState;
1413
965
  }>;
1414
966
  }): Promise<TState | undefined>;
1415
- /** Convenience dedup-window helper. */
967
+ }
968
+ interface PollingTriggerHandle extends TriggerPollingPort {
1416
969
  readonly dedup: PollingTriggerDedupWindow;
1417
970
  }
1418
971
  interface TriggerSetupContext<TConfig extends TriggerNodeConfig<any, any> = TriggerNodeConfig<any, any>, TSetupState$1 extends JsonValue | undefined = TriggerNodeSetupState<TConfig>> extends ExecutionContext {
@@ -1421,7 +974,6 @@ interface TriggerSetupContext<TConfig extends TriggerNodeConfig<any, any> = Trig
1421
974
  previousState: TSetupState$1;
1422
975
  registerCleanup(cleanup: TriggerCleanupHandle): void;
1423
976
  emit(items: Items): Promise<void>;
1424
- /** Generic polling-trigger surface. Pre-binds trigger id, emit, and registerCleanup. */
1425
977
  readonly polling: PollingTriggerHandle;
1426
978
  }
1427
979
  interface TriggerTestItemsContext<TConfig extends TriggerNodeConfig<any, any> = TriggerNodeConfig<any, any>, TSetupState$1 extends JsonValue | undefined = TriggerNodeSetupState<TConfig>> extends ExecutionContext {
@@ -1433,12 +985,6 @@ interface TriggerTestItemsContext<TConfig extends TriggerNodeConfig<any, any> =
1433
985
  interface TriggerCleanupHandle {
1434
986
  stop(): Promise<void> | void;
1435
987
  }
1436
- /**
1437
- * Per-item runnable node: return JSON, an array to fan-out on `main`, an explicit `Item`, or {@link emitPorts}
1438
- * for multi-port emission. Engine applies `inputSchema.parse(item.json)` and passes the result as `args.input`
1439
- * (wire `item.json` is unchanged). Transform helpers may opt into binary preservation, while routers and
1440
- * pass-through nodes should return explicit items when they need to preserve full item state.
1441
- */
1442
988
  interface RunnableNodeExecuteArgs<TConfig extends RunnableNodeConfig<any, any> = RunnableNodeConfig<any, any>, TInputJson$1 = unknown> {
1443
989
  readonly input: TInputJson$1;
1444
990
  readonly item: Item;
@@ -1448,25 +994,12 @@ interface RunnableNodeExecuteArgs<TConfig extends RunnableNodeConfig<any, any> =
1448
994
  }
1449
995
  interface RunnableNode<TConfig extends RunnableNodeConfig<any, any> = RunnableNodeConfig<any, any>, TInputJson$1 = unknown, _TOutputJson = unknown> {
1450
996
  readonly kind: "node";
1451
- /**
1452
- * Declared output ports (e.g. `["main"]`).
1453
- *
1454
- * Prefer describing dynamic router ports (Switch) and fixed multi-ports (If true/false)
1455
- * via {@link NodeConfigBase.declaredOutputPorts}. Engine defaults to `["main"]` when omitted.
1456
- */
1457
997
  readonly outputPorts?: ReadonlyArray<OutputPortKey>;
1458
- /** When omitted, engine uses {@link RunnableNodeConfig.inputSchema} or `z.unknown()`. */
1459
998
  readonly inputSchema?: ZodType<TInputJson$1>;
1460
999
  execute(args: RunnableNodeExecuteArgs<TConfig, TInputJson$1>): Promise<unknown> | unknown;
1461
1000
  }
1462
1001
  interface MultiInputNode<TConfig extends NodeConfigBase = NodeConfigBase> {
1463
1002
  kind: "node";
1464
- /**
1465
- * Declared output ports (typically `["main"]`).
1466
- *
1467
- * Prefer describing ports for authoring/canvas via {@link NodeConfigBase.declaredOutputPorts}.
1468
- * Engine defaults to `["main"]` when omitted.
1469
- */
1470
1003
  outputPorts?: ReadonlyArray<OutputPortKey>;
1471
1004
  executeMulti(inputsByPort: NodeInputsByPort, ctx: NodeExecutionContext<TConfig>): Promise<NodeOutputs>;
1472
1005
  }
@@ -1525,11 +1058,6 @@ type ToolExecuteArgs<TConfig extends ToolConfig = ToolConfig, TInput = unknown>
1525
1058
  item: Item;
1526
1059
  itemIndex: number;
1527
1060
  items: Items;
1528
- /**
1529
- * Optional sub-agent boundary hooks: when present, the live `agent.tool.call` span and the
1530
- * planned tool-call invocationId are forwarded so node-backed runtimes can re-root their child
1531
- * execution scope. Plain function tools may safely ignore these hooks.
1532
- */
1533
1061
  hooks?: Readonly<{
1534
1062
  parentSpan?: TelemetrySpanScope;
1535
1063
  parentInvocationId?: ConnectionInvocationId;
@@ -1551,12 +1079,7 @@ interface AgentMessageTemplate<TInputJson$1 = unknown> {
1551
1079
  readonly role: AgentMessageRole;
1552
1080
  readonly content: AgentMessageTemplateContent<TInputJson$1>;
1553
1081
  }
1554
- /** A single prompt line: fixed DTO or template with optional function `content`. */
1555
1082
  type AgentMessageLine<TInputJson$1 = unknown> = AgentMessageDto | AgentMessageTemplate<TInputJson$1>;
1556
- /**
1557
- * Message list for an agent. Prefer a **plain array** of `{ role, content }` (optionally with function `content` for templates).
1558
- * Use the object form only when you need `buildMessages` to append messages after optional `prompt` lines.
1559
- */
1560
1083
  type AgentMessageConfig<TInputJson$1 = unknown> = Expr<ReadonlyArray<AgentMessageLine<TInputJson$1>>, TInputJson$1> | ReadonlyArray<AgentMessageLine<TInputJson$1>> | {
1561
1084
  readonly prompt?: ReadonlyArray<AgentMessageLine<TInputJson$1>>;
1562
1085
  readonly buildMessages?: (args: AgentMessageBuildArgs<TInputJson$1>) => ReadonlyArray<AgentMessageDto>;
@@ -1584,25 +1107,10 @@ interface ChatModelConfig {
1584
1107
  readonly presentation?: AgentCanvasPresentation;
1585
1108
  getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
1586
1109
  }
1587
- /**
1588
- * Provider-neutral chat language model wrapper returned by a {@link ChatModelFactory}.
1589
- *
1590
- * Thin adapter around an AI SDK `LanguageModelV2` (from `@ai-sdk/provider`) plus the call-site
1591
- * defaults Codemation needs at every generate/stream: the provider label, the model name used for
1592
- * pricing / telemetry, and the default invocation options (max output tokens, temperature,
1593
- * provider-specific overrides).
1594
- *
1595
- * The consumer (AIAgentNode / AgentStructuredOutputRunner) passes `languageModel` directly into
1596
- * `generateText({ model, ... })` from the `ai` package.
1597
- */
1598
1110
  interface ChatLanguageModel {
1599
- /** AI SDK `LanguageModelV2` instance (kept `unknown` to avoid leaking the SDK type into `@codemation/core`). */
1600
1111
  readonly languageModel: unknown;
1601
- /** Stable pricing/telemetry key — e.g. `"gpt-4.1-nano"`. */
1602
1112
  readonly modelName: string;
1603
- /** Provider label — e.g. `"openai"`. Used for cost tracking. */
1604
1113
  readonly provider?: string;
1605
- /** Defaults merged into every call. Consumers may override per-invocation. */
1606
1114
  readonly defaultCallOptions?: ChatLanguageModelCallOptions;
1607
1115
  }
1608
1116
  interface ChatLanguageModelCallOptions {
@@ -1610,14 +1118,8 @@ interface ChatLanguageModelCallOptions {
1610
1118
  readonly temperature?: number;
1611
1119
  readonly providerOptions?: Readonly<Record<string, Readonly<Record<string, JsonValue>>>>;
1612
1120
  }
1613
- /**
1614
- * Options for a structured-output generate call. Mirrors
1615
- * `generateText({ output: Output.object(...) })` from the `ai` package.
1616
- */
1617
1121
  interface StructuredOutputOptions {
1618
- /** Optional schema name — used by some providers as the JSON schema name attribute. */
1619
1122
  readonly schemaName?: string;
1620
- /** When `true`, the consumer should pass a strict-mode-compatible JSON Schema record. */
1621
1123
  readonly strict?: boolean;
1622
1124
  }
1623
1125
  interface ChatModelFactory<TConfig extends ChatModelConfig = ChatModelConfig> {
@@ -1652,12 +1154,6 @@ type NodeBackedToolConfigOptions<TNodeConfig extends RunnableNodeConfig<any, any
1652
1154
  outputSchema: TOutputSchema;
1653
1155
  mapInput?: NodeBackedToolInputMapper<TNodeConfig, input<TInputSchema>>;
1654
1156
  mapOutput?: NodeBackedToolOutputMapper<TNodeConfig, input<TInputSchema>, output<TOutputSchema>>;
1655
- /**
1656
- * Marks THIS tool binding as human-in-the-loop and sets the behavior when a human rejects the
1657
- * approval: `"return"` feeds the rejection back to the agent as a tool result, `"halt"` stops the
1658
- * run. Set per binding, so two tools backed by the same node can reject differently. When set, it
1659
- * takes precedence over any `humanApprovalToolBehavior` marker carried by the backing node.
1660
- */
1661
1157
  onRejected?: "halt" | "return";
1662
1158
  }>;
1663
1159
  interface AgentNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> extends RunnableNodeConfig<TInputJson$1, TOutputJson$1> {
@@ -1668,23 +1164,59 @@ interface AgentNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> exten
1668
1164
  readonly outputSchema?: ZodType<TOutputJson$1>;
1669
1165
  }
1670
1166
  //#endregion
1167
+ //#region ../core/src/authoring/definePollingTrigger.types.d.ts
1168
+ type MaybePromise$1<TValue> = TValue | Promise<TValue>;
1169
+ interface DefinePollingTriggerPollContext<TConfig extends CredentialJsonRecord, TState extends JsonValue | undefined, TBindings extends DefinedNodeCredentialBindings | undefined> {
1170
+ readonly config: TConfig;
1171
+ readonly state: TState;
1172
+ readonly credentials: DefinedNodeCredentialAccessors<TBindings>;
1173
+ }
1174
+ interface DefinePollingTriggerPollResult<TItemJson, TState extends JsonValue | undefined> {
1175
+ readonly items: ReadonlyArray<{
1176
+ json: TItemJson;
1177
+ dedupKey?: string;
1178
+ }>;
1179
+ readonly nextState: TState;
1180
+ }
1181
+ interface DefinedPollingTrigger<TKey$1 extends string, TConfig extends CredentialJsonRecord, TItemJson, TState extends JsonValue | undefined, TBindings extends DefinedNodeCredentialBindings | undefined = undefined> {
1182
+ readonly kind: "defined-polling-trigger";
1183
+ readonly key: TKey$1;
1184
+ readonly title: string;
1185
+ readonly description?: string;
1186
+ create(cfg: TConfig, name?: string, idOrOptions?: string | NodeBaseOptions$1): DefinedPollingTriggerConfig<TConfig, TItemJson>;
1187
+ poll(pollCtx: Omit<DefinePollingTriggerPollContext<TConfig, TState, TBindings>, "credentials"> & {
1188
+ credentials?: DefinedNodeCredentialAccessors<TBindings>;
1189
+ }): MaybePromise$1<DefinePollingTriggerPollResult<TItemJson, TState>>;
1190
+ register(context: {
1191
+ registerNode<TValue>(token: TypeToken<TValue>, implementation?: TypeToken<TValue>): void;
1192
+ }): void;
1193
+ }
1194
+ declare class DefinedPollingTriggerConfig<TConfig extends CredentialJsonRecord, TItemJson> implements TriggerNodeConfig<TItemJson, JsonValue | undefined>, PollingTriggerConfig {
1195
+ readonly name: string;
1196
+ readonly cfg: TConfig;
1197
+ private readonly credentialRequirements;
1198
+ private readonly inspectorSummaryFn?;
1199
+ private readonly defaultPollIntervalMs?;
1200
+ readonly kind: "trigger";
1201
+ readonly type: TypeToken<unknown>;
1202
+ readonly icon: string | undefined;
1203
+ readonly id?: string;
1204
+ readonly description?: string;
1205
+ constructor(name: string, cfg: TConfig, typeToken: TypeToken<unknown>, icon: string | undefined, credentialRequirements: ReadonlyArray<CredentialRequirement>, idOrOptions?: string | NodeBaseOptions$1, inspectorSummaryFn?: ((args: Readonly<{
1206
+ config: TConfig;
1207
+ }>) => ReadonlyArray<NodeInspectorSummaryRow> | undefined) | undefined, defaultPollIntervalMs?: number | undefined);
1208
+ getCredentialRequirements(): ReadonlyArray<CredentialRequirement>;
1209
+ getTriggerPollConfig(): Readonly<{
1210
+ config: JsonObject;
1211
+ pollIntervalMs?: number;
1212
+ }>;
1213
+ inspectorSummary(): ReadonlyArray<NodeInspectorSummaryRow> | undefined;
1214
+ }
1215
+ //#endregion
1671
1216
  //#region ../core/src/ai/AgentConnectionNodeCollector.d.ts
1672
1217
  type McpServerResolver = (id: string) => McpServerDeclaration | undefined;
1673
1218
  //#endregion
1674
1219
  //#region ../core/src/execution/ChildExecutionScopeFactory.d.ts
1675
- /**
1676
- * Builds a re-rooted child execution context for sub-agent (and other deeply-nested) invocations.
1677
- *
1678
- * At the orchestrator's `agent.tool.call` boundary the inner runtime needs a ctx whose:
1679
- * - `nodeId` is the tool's connection node id (so inner LLM/tool connection ids derive correctly),
1680
- * - `activationId` is fresh (so its connection-invocation rows are uniquely identifiable),
1681
- * - `telemetry` parents children under the tool-call span (not the orchestrator's node span),
1682
- * - `binary` is scoped to the new (nodeId, activationId),
1683
- * - `parentInvocationId` points back to the tool-call invocation for downstream lineage.
1684
- *
1685
- * Registered via factory in {@link EngineRuntimeRegistrar} so constructors stay free of parameter
1686
- * decorators (Next/SWC and coverage tooling cannot parse them on in-repo sources).
1687
- */
1688
1220
  declare class ChildExecutionScopeFactory {
1689
1221
  private readonly activationIdFactory;
1690
1222
  constructor(activationIdFactory: ActivationIdFactory);
@@ -1698,9 +1230,6 @@ declare class ChildExecutionScopeFactory {
1698
1230
  }
1699
1231
  //#endregion
1700
1232
  //#region ../core/src/execution/ItemExprResolver.d.ts
1701
- /**
1702
- * Resolves {@link import("../contracts/itemExpr").ItemExpr} leaves on runnable config before {@link RunnableNode.execute}.
1703
- */
1704
1233
  declare class ItemExprResolver {
1705
1234
  resolveConfigForItem<TConfig extends RunnableNodeConfig<any, any>>(ctx: NodeExecutionContext<TConfig>, item: Item, itemIndex: number, items: ReadonlyArray<Item>): Promise<NodeExecutionContext<TConfig>>;
1706
1235
  }
@@ -1732,23 +1261,11 @@ declare class NodeOutputNormalizer {
1732
1261
  }
1733
1262
  //#endregion
1734
1263
  //#region src/http/httpRequest.types.d.ts
1735
- /**
1736
- * Binary reference key into `item.binary`.
1737
- */
1738
1264
  type BinaryRef = string;
1739
- /**
1740
- * Discriminated union for the HTTP request body.
1741
- */
1742
1265
  type HttpBodySpec = Readonly<{
1743
1266
  kind: "none";
1744
1267
  }> | Readonly<{
1745
1268
  kind: "json";
1746
- /**
1747
- * Serializable object/array to encode as the JSON body. Encoded exactly once via
1748
- * `JSON.stringify`, so pass the value directly (e.g. `{ a: 1 }`) — never a
1749
- * pre-stringified string (`JSON.stringify(...)`), which would double-encode it.
1750
- * Typed as `object` so a bare string/primitive is a compile-time error.
1751
- */
1752
1269
  data: object;
1753
1270
  }> | Readonly<{
1754
1271
  kind: "form";
@@ -1758,34 +1275,16 @@ type HttpBodySpec = Readonly<{
1758
1275
  fields: Readonly<Record<string, string>>;
1759
1276
  binaries?: Readonly<Record<string, BinaryRef>>;
1760
1277
  }> | Readonly<{
1761
- /**
1762
- * Send raw bytes from a binary slot as the request body.
1763
- * The binary attachment's `mimeType` is used as `Content-Type` unless
1764
- * the request `headers` map already contains `content-type`.
1765
- */
1766
1278
  kind: "binary";
1767
- /** Key into `item.binary` to read the request body bytes from. */
1768
1279
  slot: string;
1769
1280
  }>;
1770
- /**
1771
- * Session interface that credential types implement.
1772
- * Returns header/query deltas so the executor can merge them without
1773
- * mutating the immutable HttpRequestSpec.
1774
- */
1775
1281
  interface CredentialSession {
1776
1282
  applyToRequest(spec: HttpRequestSpec): HttpCredentialDelta;
1777
1283
  }
1778
- /**
1779
- * Mutations the credential session wants to apply to the outgoing request.
1780
- */
1781
1284
  type HttpCredentialDelta = Readonly<{
1782
1285
  headers?: Readonly<Record<string, string>>;
1783
1286
  query?: Readonly<Record<string, string>>;
1784
1287
  }>;
1785
- /**
1786
- * Full specification of one HTTP request. All URLs are fully resolved before
1787
- * being passed here (template substitution already applied by the caller).
1788
- */
1789
1288
  type HttpRequestSpec = Readonly<{
1790
1289
  url: string;
1791
1290
  method: string;
@@ -1797,27 +1296,12 @@ type HttpRequestSpec = Readonly<{
1797
1296
  mode: "auto" | "always" | "never";
1798
1297
  binaryName: string;
1799
1298
  }>;
1800
- /**
1801
- * When set to `"binary"`, the response body is written to a binary slot
1802
- * instead of being parsed as JSON/text. Overrides `download` mode.
1803
- */
1804
1299
  responseFormat?: "json" | "text" | "binary";
1805
- /** Binary slot name for the response body when `responseFormat === "binary"`. Defaults to `"response"`. */
1806
1300
  responseBinarySlot?: string;
1807
- /** Maximum allowed response size in bytes (checked against Content-Length before allocating). Defaults to 100 MiB. */
1808
1301
  responseSizeCapBytes?: number;
1809
- /**
1810
- * When `false` (default), requests whose target host resolves to an RFC-1918,
1811
- * link-local (169.254/16), or loopback address are blocked to prevent SSRF attacks.
1812
- * Set to `true` only for workflows that intentionally reach private infrastructure.
1813
- */
1814
1302
  allowPrivateNetworkTargets?: boolean;
1815
- /** Execution context — needed for binary attach. */
1816
1303
  ctx: NodeExecutionContext<RunnableNodeConfig<unknown, unknown>>;
1817
1304
  }>;
1818
- /**
1819
- * Result of executing an HTTP request.
1820
- */
1821
1305
  type HttpRequestResult = Readonly<{
1822
1306
  url: string;
1823
1307
  method: string;
@@ -1829,20 +1313,13 @@ type HttpRequestResult = Readonly<{
1829
1313
  json?: unknown;
1830
1314
  text?: string;
1831
1315
  bodyBinaryName?: string;
1832
- /** Set when `responseFormat === "binary"`. Name of the binary slot the response body was written to. */
1833
1316
  binarySlot?: string;
1834
- /** Set when `responseFormat === "binary"`. The MIME type of the stored response. */
1835
1317
  contentType?: string;
1836
- /** Set when `responseFormat === "binary"`. Size in bytes of the stored response. */
1837
1318
  size?: number;
1838
- /** Set when `responseFormat === "binary"`. Filename inferred from URL or Content-Disposition. */
1839
1319
  filename?: string;
1840
1320
  }>;
1841
1321
  //#endregion
1842
1322
  //#region src/credentials/ApiKeyCredentialType.d.ts
1843
- /**
1844
- * API key credential that injects a key either as an HTTP header or a query parameter.
1845
- */
1846
1323
  declare const apiKeyCredentialType: Readonly<{
1847
1324
  definition: Readonly<{
1848
1325
  typeId: CredentialTypeId;
@@ -1860,6 +1337,10 @@ declare const apiKeyCredentialType: Readonly<{
1860
1337
  }, {
1861
1338
  apiKey: unknown;
1862
1339
  }, CredentialSession>;
1340
+ createSessionFromAccessToken?: CredentialAccessTokenSessionFactory<{
1341
+ placement: unknown;
1342
+ name: unknown;
1343
+ }, CredentialSession> | undefined;
1863
1344
  test: CredentialHealthTester<{
1864
1345
  placement: unknown;
1865
1346
  name: unknown;
@@ -1871,10 +1352,6 @@ declare const apiKeyCredentialType: Readonly<{
1871
1352
  };
1872
1353
  //#endregion
1873
1354
  //#region src/credentials/BasicAuthCredentialType.d.ts
1874
- /**
1875
- * HTTP Basic authentication credential.
1876
- * Session sets `Authorization: Basic <base64(username:password)>`.
1877
- */
1878
1355
  declare const basicAuthCredentialType: Readonly<{
1879
1356
  definition: Readonly<{
1880
1357
  typeId: CredentialTypeId;
@@ -1891,6 +1368,9 @@ declare const basicAuthCredentialType: Readonly<{
1891
1368
  }, {
1892
1369
  password: unknown;
1893
1370
  }, CredentialSession>;
1371
+ createSessionFromAccessToken?: CredentialAccessTokenSessionFactory<{
1372
+ username: unknown;
1373
+ }, CredentialSession> | undefined;
1894
1374
  test: CredentialHealthTester<{
1895
1375
  username: unknown;
1896
1376
  }, {
@@ -1901,10 +1381,6 @@ declare const basicAuthCredentialType: Readonly<{
1901
1381
  };
1902
1382
  //#endregion
1903
1383
  //#region src/credentials/BearerTokenCredentialType.d.ts
1904
- /**
1905
- * Simple Bearer token credential.
1906
- * Session sets `Authorization: Bearer <token>` on every request.
1907
- */
1908
1384
  declare const bearerTokenCredentialType: Readonly<{
1909
1385
  definition: Readonly<{
1910
1386
  typeId: CredentialTypeId;
@@ -1919,6 +1395,7 @@ declare const bearerTokenCredentialType: Readonly<{
1919
1395
  createSession: CredentialSessionFactory<Readonly<Record<string, unknown>>, {
1920
1396
  token: unknown;
1921
1397
  }, CredentialSession>;
1398
+ createSessionFromAccessToken?: CredentialAccessTokenSessionFactory<Readonly<Record<string, unknown>>, CredentialSession> | undefined;
1922
1399
  test: CredentialHealthTester<Readonly<Record<string, unknown>>, {
1923
1400
  token: unknown;
1924
1401
  }>;
@@ -1927,24 +1404,6 @@ declare const bearerTokenCredentialType: Readonly<{
1927
1404
  };
1928
1405
  //#endregion
1929
1406
  //#region src/credentials/OAuth2ClientCredentialsTypeFactory.d.ts
1930
- /**
1931
- * OAuth2 client-credentials flow credential.
1932
- *
1933
- * This is a machine-to-machine flow: no user redirect occurs. The session
1934
- * POSTs to the configured `tokenUrl` with `client_credentials` grant, caches
1935
- * the resulting access token for the duration of the session, and injects it
1936
- * as `Authorization: Bearer <token>` on each request.
1937
- *
1938
- * Token caching is per-session only (one createSession call = one token fetch
1939
- * at most). Cross-session caching would require host-level state and is out of
1940
- * scope here. Because the engine creates a fresh session per execution, a new
1941
- * token is fetched once per node activation.
1942
- *
1943
- * NOTE: `auth` is intentionally omitted from the definition. The OAuth2
1944
- * `auth: { kind: "oauth2" }` shape signals an authorization-code / user-redirect
1945
- * flow; using it here would cause the host UI to render an OAuth consent button
1946
- * that goes nowhere. Client-credentials is a purely server-side flow.
1947
- */
1948
1407
  declare const oauth2ClientCredentialsType: Readonly<{
1949
1408
  definition: Readonly<{
1950
1409
  typeId: CredentialTypeId;
@@ -1964,6 +1423,11 @@ declare const oauth2ClientCredentialsType: Readonly<{
1964
1423
  clientId: unknown;
1965
1424
  clientSecret: unknown;
1966
1425
  }, CredentialSession>;
1426
+ createSessionFromAccessToken?: CredentialAccessTokenSessionFactory<{
1427
+ tokenUrl: unknown;
1428
+ scopes: unknown;
1429
+ audience: unknown;
1430
+ }, CredentialSession> | undefined;
1967
1431
  test: CredentialHealthTester<{
1968
1432
  tokenUrl: unknown;
1969
1433
  scopes: unknown;
@@ -1977,51 +1441,16 @@ declare const oauth2ClientCredentialsType: Readonly<{
1977
1441
  };
1978
1442
  //#endregion
1979
1443
  //#region src/http/SSRFBlockedError.d.ts
1980
- /**
1981
- * Thrown when an HTTP request target resolves to a private, link-local, or
1982
- * loopback address and `allowPrivateNetworkTargets` is not set.
1983
- */
1984
1444
  declare class SSRFBlockedError extends Error {
1985
1445
  readonly resolvedIp: string;
1986
1446
  constructor(host: string, resolvedIp: string);
1987
1447
  }
1988
1448
  //#endregion
1989
1449
  //#region src/http/SsrfGuard.d.ts
1990
- /**
1991
- * Guards HTTP requests against Server-Side Request Forgery (SSRF) by
1992
- * DNS-resolving the target host and rejecting private/link-local/loopback
1993
- * addresses.
1994
- *
1995
- * Blocked ranges:
1996
- * - RFC-1918: 10/8, 172.16/12, 192.168/16
1997
- * - Link-local: 169.254/16
1998
- * - Loopback: 127/8, ::1
1999
- *
2000
- * When `allowedOutboundHosts` is set, every resolved DNS target must match
2001
- * at least one entry in the list (exact hostname or `*.example.com` wildcard).
2002
- * When unset, existing behaviour applies: private ranges blocked, public allowed.
2003
- *
2004
- * Call {@link check} before making any outbound HTTP request.
2005
- * Pass `allowPrivate: true` to bypass the private-network guard for trusted workflows
2006
- * (allowedOutboundHosts allowlist is still applied when set).
2007
- */
2008
1450
  declare class SsrfGuard {
2009
1451
  private readonly allowedOutboundHosts?;
2010
1452
  constructor(allowedOutboundHosts?: ReadonlyArray<string> | undefined);
2011
- /**
2012
- * Resolves the host of `url` via DNS and throws {@link SSRFBlockedError}
2013
- * if any resolved address falls in a blocked range, or if the host does not
2014
- * match the operator-configured allowlist (when set).
2015
- *
2016
- * @param url - Fully-qualified URL of the intended request target.
2017
- * @param allowPrivate - When `true`, the private-network check is skipped.
2018
- * The allowedOutboundHosts check is still applied when set.
2019
- */
2020
1453
  check(url: string, allowPrivate: boolean): Promise<void>;
2021
- /**
2022
- * Returns true when `host` matches at least one entry in `allowedOutboundHosts`.
2023
- * Supports exact hostnames (`api.example.com`) and wildcard prefixes (`*.example.com`).
2024
- */
2025
1454
  private isHostAllowed;
2026
1455
  private isPrivateAddress;
2027
1456
  private isPrivateIPv4;
@@ -2030,26 +1459,11 @@ declare class SsrfGuard {
2030
1459
  //#endregion
2031
1460
  //#region src/authoring/defineRestNode.types.d.ts
2032
1461
  type MaybePromise<T> = T | Promise<T>;
2033
- /**
2034
- * API endpoint descriptor.
2035
- */
2036
1462
  type RestNodeApi = Readonly<{
2037
- /**
2038
- * Base URL, e.g. `"https://api.slack.com"`.
2039
- */
2040
1463
  baseUrl: string;
2041
- /**
2042
- * Path relative to `baseUrl`. May contain `{paramName}` placeholders that
2043
- * are substituted from `input` keys before the request is made.
2044
- * Example: `"/users/{userId}/profile"`
2045
- */
2046
1464
  path: string;
2047
- /** HTTP method (default: GET). */
2048
1465
  method?: string;
2049
1466
  }>;
2050
- /**
2051
- * The HTTP result shape passed into the `response` mapper.
2052
- */
2053
1467
  type RestNodeResponseContext = Readonly<{
2054
1468
  status: number;
2055
1469
  ok: boolean;
@@ -2059,24 +1473,12 @@ type RestNodeResponseContext = Readonly<{
2059
1473
  json?: unknown;
2060
1474
  text?: string;
2061
1475
  }>;
2062
- /**
2063
- * What the `request` callback may return to customise the request.
2064
- */
2065
1476
  type RestNodeRequestShape = Readonly<{
2066
- /** Additional path parameters to substitute (merged with `input`). */
2067
1477
  pathParams?: Readonly<Record<string, string>>;
2068
- /** Extra query params. */
2069
1478
  query?: Readonly<Record<string, string>>;
2070
- /** Extra headers. */
2071
1479
  headers?: Readonly<Record<string, string>>;
2072
- /** Request body. */
2073
1480
  body?: HttpBodySpec;
2074
1481
  }>;
2075
- /**
2076
- * Error handling policy for non-2xx responses.
2077
- * - `"throw"` (default) — throws an `Error` for non-2xx responses.
2078
- * - `"passthrough"` — returns the result regardless of status.
2079
- */
2080
1482
  type RestNodeErrorPolicy = "throw" | "passthrough";
2081
1483
  interface DefineRestNodeOptions<TKey$1 extends string, TCredentials extends DefinedNodeCredentialBindings | undefined, TInputJson$1, TOutputJson$1> {
2082
1484
  readonly key: TKey$1;
@@ -2084,68 +1486,19 @@ interface DefineRestNodeOptions<TKey$1 extends string, TCredentials extends Defi
2084
1486
  readonly description?: string;
2085
1487
  readonly icon?: string;
2086
1488
  readonly api: RestNodeApi;
2087
- /**
2088
- * Credential bindings keyed by slot. Use the built-in credential types from
2089
- * `@codemation/core-nodes` (e.g. `bearerTokenCredentialType`) or any custom one.
2090
- * The slot key must match what the `request` callback's context uses.
2091
- */
2092
1489
  readonly credentials?: TCredentials;
2093
- /**
2094
- * Zod schema for per-item input. Validated before `execute`.
2095
- */
2096
1490
  readonly inputSchema?: ZodType<TInputJson$1>;
2097
- /**
2098
- * Builds the per-request customisations from the item input.
2099
- * Return `body`, `query`, `headers`, and/or `pathParams`.
2100
- */
2101
1491
  request?(context: Readonly<{
2102
1492
  input: TInputJson$1;
2103
1493
  }>): MaybePromise<RestNodeRequestShape>;
2104
- /**
2105
- * Maps the HTTP response to the node's output JSON.
2106
- * When omitted, the output is `{ status, ok, statusText, mimeType, headers, json, text }`.
2107
- */
2108
1494
  response?(context: RestNodeResponseContext & Readonly<{
2109
1495
  input: TInputJson$1;
2110
1496
  }>): MaybePromise<TOutputJson$1>;
2111
- /**
2112
- * How to handle non-2xx responses.
2113
- * @default "throw"
2114
- */
2115
1497
  readonly errorPolicy?: RestNodeErrorPolicy;
2116
- /**
2117
- * Static configuration summary surfaced in the workflow inspector.
2118
- * Receives the static config (empty record for defineRestNode — config lives on item input).
2119
- * Most callers return rows based on the static `api` descriptor instead.
2120
- */
2121
1498
  readonly inspectorSummary?: (args: Readonly<{
2122
1499
  config: Record<string, never>;
2123
1500
  }>) => ReadonlyArray<NodeInspectorSummaryRow> | undefined;
2124
1501
  }
2125
- /**
2126
- * Declarative helper for creating thin API-wrapper nodes.
2127
- *
2128
- * Usage:
2129
- * ```ts
2130
- * export const postMessage = defineRestNode({
2131
- * key: "slack.post-message",
2132
- * title: "Send Slack message",
2133
- * icon: "si:slack",
2134
- * api: { baseUrl: "https://slack.com/api", path: "/chat.postMessage", method: "POST" },
2135
- * credentials: { auth: bearerTokenCredentialType },
2136
- * inputSchema: z.object({ channel: z.string(), text: z.string() }),
2137
- * request: ({ input }) => ({
2138
- * body: { kind: "json", data: { channel: input.channel, text: input.text } },
2139
- * }),
2140
- * response: ({ json }) => ({ messageTs: (json as any).ts }),
2141
- * });
2142
- * ```
2143
- *
2144
- * - `defineRestNode` is a thin wrapper over `defineNode`; it does not introduce a new runtime kind.
2145
- * - Credential sessions are resolved via the `credentials` binding map (same as `defineNode`).
2146
- * - Path `{placeholder}` substitution is applied from `input` keys before the request is made.
2147
- * - Non-2xx responses throw an `Error` by default (`errorPolicy: "throw"`).
2148
- */
2149
1502
  declare function defineRestNode<TKey$1 extends string, TCredentials extends DefinedNodeCredentialBindings | undefined, TInputJson$1, TOutputJson$1 = RestNodeResponseContext>(options: DefineRestNodeOptions<TKey$1, TCredentials, TInputJson$1, TOutputJson$1>): DefinedNode<TKey$1, Record<string, never>, TInputJson$1, TOutputJson$1, TCredentials>;
2150
1503
  //#endregion
2151
1504
  //#region src/chatModels/openAiChatModelConfig.d.ts
@@ -2177,11 +1530,6 @@ declare class OpenAIChatModelFactory implements ChatModelFactory<OpenAIChatModel
2177
1530
  }
2178
1531
  //#endregion
2179
1532
  //#region src/nodes/ConnectionCredentialExecutionContextFactory.d.ts
2180
- /**
2181
- * Builds a {@link NodeExecutionContext} whose identity for credential binding and `getCredential`
2182
- * is a **connection-owned** workflow node id (`ConnectionNodeIdFactory` in `@codemation/core`),
2183
- * not the executing parent node. Use for LLM slots, tool slots, or any connection-scoped owner.
2184
- */
2185
1533
  declare class ConnectionCredentialExecutionContextFactory {
2186
1534
  private readonly credentialResolverFactory;
2187
1535
  constructor(credentialSessions: CredentialSessionService);
@@ -2192,65 +1540,17 @@ declare class ConnectionCredentialExecutionContextFactory {
2192
1540
  }
2193
1541
  //#endregion
2194
1542
  //#region src/nodes/AIAgentExecutionHelpersFactory.d.ts
2195
- /**
2196
- * Helper utilities shared by {@link AIAgentNode} and supporting runners.
2197
- *
2198
- * Responsibilities:
2199
- * - {@link #createConnectionCredentialExecutionContextFactory} centralizes credential-context wiring.
2200
- * - {@link #createJsonSchemaRecord} is a pure Zod → draft-07 converter used by both
2201
- * `OpenAiStrictJsonSchemaFactory` (to feed OpenAI-strict structured output) and the
2202
- * `AgentStructuredOutputRepairPromptFactory` (to show a required-schema reminder).
2203
- */
2204
1543
  declare class AIAgentExecutionHelpersFactory {
2205
1544
  createConnectionCredentialExecutionContextFactory(credentialSessions: CredentialSessionService): ConnectionCredentialExecutionContextFactory;
2206
- /**
2207
- * Produces a plain JSON Schema object (`draft-07`) from a Zod schema, as needed by
2208
- * OpenAI tool-parameter schemas and the structured-output repair prompt.
2209
- * - Prefers the schema's **instance** `toJSONSchema(...)` method so we stay inside the Zod
2210
- * instance that created the schema (works across consumer/framework tsx namespaces — see
2211
- * {@link ZodInstanceToJsonSchema}). Falls back to the framework-imported module function.
2212
- * - Strips root `$schema` (OpenAI ignores it).
2213
- * - Sanitizes `required` for cfworker json-schema compatibility (must be a string array or absent).
2214
- */
2215
1545
  createJsonSchemaRecord(inputSchema: ZodSchemaAny, options: Readonly<{
2216
1546
  schemaName: string;
2217
1547
  requireObjectRoot: boolean;
2218
1548
  }>): Record<string, unknown>;
2219
- /**
2220
- * Runs Zod's `toJSONSchema` via the schema's own instance method when available, so consumer
2221
- * schemas loaded under a different tsx namespace still convert correctly. If the caller handed us
2222
- * a payload that lacks that method (e.g. a plain JSON Schema record or a Zod instance whose
2223
- * prototype was stripped), we fall back to the framework-bundled module function.
2224
- */
2225
1549
  private convertZodSchemaToJsonSchema;
2226
- /**
2227
- * `@cfworker/json-schema` iterates `schema.required` with `for...of`; it must be a string array or absent.
2228
- */
2229
1550
  private sanitizeJsonSchemaRequiredKeywordsForCfworker;
2230
1551
  }
2231
1552
  //#endregion
2232
1553
  //#region src/chatModels/OpenAiStrictJsonSchemaFactory.d.ts
2233
- /**
2234
- * Produces an OpenAI **strict mode**–compliant JSON Schema for an AIAgent `outputSchema`.
2235
- *
2236
- * Why this exists: AI SDK's default Zod → JSON Schema conversion (Zod v4's `toJSONSchema`) can
2237
- * emit `unevaluatedProperties: false` or skip `additionalProperties: false` on object branches.
2238
- * OpenAI's strict-mode validator rejects anything missing `additionalProperties: false` at
2239
- * `context=()` (the root) and requires **all properties** in `required`. We convert here so all
2240
- * legal Zod root shapes work (object, union, discriminated union, nullable-object wrapper, array,
2241
- * intersection, …) and hand AI SDK a pre-tagged `jsonSchema(...)` record that passes straight
2242
- * through to the provider.
2243
- *
2244
- * Rules enforced on the produced JSON Schema record:
2245
- * - Every `type: "object"` node (root and nested under `allOf`/`anyOf`/`oneOf`/`items`/`prefixItems`/`$defs`):
2246
- * - `additionalProperties: false`
2247
- * - `required` lists **every** key in `properties` (OpenAI strict requires all properties required;
2248
- * express optionality via `.nullable()` / `z.union([..., z.null()])`).
2249
- * - `properties` is always an object (empty object allowed).
2250
- * - `$schema`, `unevaluatedProperties`, and `default` are stripped (OpenAI rejects / ignores them).
2251
- * - `sanitizeJsonSchemaRequiredKeywordsForCfworker` invariants from
2252
- * {@link AIAgentExecutionHelpersFactory.createJsonSchemaRecord} are preserved as a starting point.
2253
- */
2254
1554
  declare class OpenAiStrictJsonSchemaFactory {
2255
1555
  private readonly executionHelpers;
2256
1556
  constructor(executionHelpers: AIAgentExecutionHelpersFactory);
@@ -2266,18 +1566,12 @@ declare class OpenAiStrictJsonSchemaFactory {
2266
1566
  }
2267
1567
  //#endregion
2268
1568
  //#region src/chatModels/OpenAiCredentialSession.d.ts
2269
- /** Resolved credential session for OpenAI-compatible chat models (API key + optional custom base URL). */
2270
1569
  type OpenAiCredentialSession = Readonly<{
2271
1570
  apiKey: string;
2272
1571
  baseUrl?: string;
2273
1572
  }>;
2274
1573
  //#endregion
2275
1574
  //#region src/chatModels/OpenAiChatModelPresetsFactory.d.ts
2276
- /**
2277
- * Default OpenAI chat model configs for scaffolds and demos (icon + label match {@link OpenAIChatModelConfig} defaults).
2278
- * Prefer importing {@link openAiChatModelPresets} from here or from the consumer template re-export
2279
- * instead of repeating {@link OpenAIChatModelConfig} construction in app workflows.
2280
- */
2281
1575
  declare class OpenAiChatModelPresets {
2282
1576
  readonly demoGpt4oMini: OpenAIChatModelConfig;
2283
1577
  readonly demoGpt41: OpenAIChatModelConfig;
@@ -2285,14 +1579,6 @@ declare class OpenAiChatModelPresets {
2285
1579
  declare const openAiChatModelPresets: OpenAiChatModelPresets;
2286
1580
  //#endregion
2287
1581
  //#region src/chatModels/CodemationChatModelConfig.d.ts
2288
- /**
2289
- * Complexity token sent to the managed LLM broker.
2290
- * The broker maps this to a concrete provider model and thinking effort.
2291
- * low = cheapest/fastest (short classification, simple extraction)
2292
- * medium = default for most extraction/agent work
2293
- * high = complex multi-step reasoning
2294
- * xhigh = hardest problems, most capable model
2295
- */
2296
1582
  type ManagedComplexity = "low" | "medium" | "high" | "xhigh";
2297
1583
  declare class CodemationChatModelConfig implements ChatModelConfig {
2298
1584
  readonly name: string;
@@ -2329,31 +1615,16 @@ type ResolvedTool = Readonly<{
2329
1615
  execute(args: ToolExecuteArgs<ToolConfig, unknown>): Promise<unknown>;
2330
1616
  }>;
2331
1617
  }>;
2332
- /**
2333
- * Per-item binding of a tool: the user config plus the resolved runtime and a snapshot of the
2334
- * original Zod `inputSchema`.
2335
- *
2336
- * `execute` accepts optional `hooks` so the agent coordinator can pass the live `agent.tool.call`
2337
- * span and the planned tool-call's `invocationId`. Node-backed sub-agent tools use these hooks
2338
- * via {@link ChildExecutionScopeFactory} to re-root their runtime ctx under the tool-call boundary
2339
- * (fresh activationId, telemetry parented at the tool-call span, `parentInvocationId` set).
2340
- *
2341
- * `humanApproval` is present only when the tool was created via `defineHumanApprovalNode`
2342
- * (via its marker) — detected during `resolveTools` in `AIAgentNode`.
2343
- */
2344
1618
  type ItemScopedToolBinding = Readonly<{
2345
1619
  config: ToolConfig;
2346
1620
  inputSchema: ZodSchemaAny;
2347
1621
  execute(input: unknown, hooks?: ItemScopedToolCallHooks): Promise<unknown>;
2348
- /** Present when this binding is backed by a HITL-approval node (story 10). */
2349
1622
  humanApproval?: Readonly<{
2350
1623
  onRejected: "halt" | "return";
2351
1624
  }>;
2352
1625
  }>;
2353
1626
  type ItemScopedToolCallHooks = Readonly<{
2354
- /** Live agent.tool.call span (used to parent sub-agent telemetry). */
2355
1627
  parentSpan?: TelemetrySpanScope;
2356
- /** invocationId of the parent tool call (used to thread `parentInvocationId` through ctx). */
2357
1628
  parentInvocationId?: ConnectionInvocationId;
2358
1629
  }>;
2359
1630
  type PlannedToolCall = Readonly<{
@@ -2361,7 +1632,6 @@ type PlannedToolCall = Readonly<{
2361
1632
  toolCall: AgentToolCall;
2362
1633
  invocationIndex: number;
2363
1634
  nodeId: string;
2364
- /** Stable id reused across queued / running / completed connection invocation rows for this tool call. */
2365
1635
  invocationId: string;
2366
1636
  }>;
2367
1637
  type ExecutedToolCall = Readonly<{
@@ -2372,23 +1642,11 @@ type ExecutedToolCall = Readonly<{
2372
1642
  }>;
2373
1643
  //#endregion
2374
1644
  //#region src/nodes/AgentMessageFactory.d.ts
2375
- /**
2376
- * AI-SDK-shaped message construction for the AIAgent stack. Emits plain `ModelMessage[]`
2377
- * ( `{ role: 'system' | 'user' | 'assistant' | 'tool', content: ... }` ) as consumed by
2378
- * `generateText({ messages })` from the `ai` package.
2379
- */
2380
1645
  declare class AgentMessageFactory {
2381
1646
  static createPromptMessages(messages: ReadonlyArray<AgentMessageDto>): ReadonlyArray<ModelMessage>;
2382
- /**
2383
- * Builds the assistant message that contains optional text plus one or more tool-call parts,
2384
- * matching the shape AI SDK emits between steps.
2385
- */
2386
1647
  static createAssistantWithToolCalls(text: string | undefined, toolCalls: ReadonlyArray<AgentToolCall>): AssistantModelMessage;
2387
- /**
2388
- * Builds the `{ role: "tool", content: [{ type: "tool-result", ... }, ...] }` message returned
2389
- * to the model after each tool round.
2390
- */
2391
- static createToolResultsMessage(executedToolCalls: ReadonlyArray<ExecutedToolCall>): ToolModelMessage;
1648
+ static createToolResultsMessage(executedToolCalls: ReadonlyArray<ExecutedToolCall>, passToolBinariesToModel?: boolean): ToolModelMessage;
1649
+ private static toToolResultOutput;
2392
1650
  private static toToolResultJson;
2393
1651
  private static createPromptMessage;
2394
1652
  }
@@ -2417,19 +1675,6 @@ declare class AgentStructuredOutputRepairPromptFactory {
2417
1675
  //#endregion
2418
1676
  //#region src/nodes/AgentStructuredOutputRunner.d.ts
2419
1677
  type StructuredOutputSchemaForModel = ZodSchemaAny | Readonly<Record<string, unknown>>;
2420
- /**
2421
- * Orchestrates a 2-attempt repair loop on top of `generateText({ output: Output.object(...) })`.
2422
- *
2423
- * Strategy:
2424
- * 1. If the caller already has a raw final text (from a prior tool-calling turn), try parsing it
2425
- * directly against the schema — fast path for models that already emit strict JSON.
2426
- * 2. Otherwise, run a native structured-output call via {@link invokeStructuredModel}. For the
2427
- * OpenAI-strict path, a {@link OpenAiStrictJsonSchemaFactory}-built JSON Schema record is
2428
- * handed to AI SDK's `jsonSchema(...)` wrapper (preserves `additionalProperties: false` at
2429
- * every object depth).
2430
- * 3. If the structured call fails (AI_NoObjectGeneratedError / ZodError / schema reject), run a
2431
- * text-mode repair prompt with the validation error appended, up to 2 attempts.
2432
- */
2433
1678
  declare class AgentStructuredOutputRunner {
2434
1679
  private readonly repairPromptFactory;
2435
1680
  private readonly openAiStrictJsonSchemaFactory;
@@ -2450,10 +1695,6 @@ declare class AgentStructuredOutputRunner {
2450
1695
  invokeStructuredModel: (schema: StructuredOutputSchemaForModel, messages: ReadonlyArray<ModelMessage>, options: StructuredOutputOptions | undefined) => Promise<unknown>;
2451
1696
  }>): Promise<TOutput>;
2452
1697
  private retryWithRepairPrompt;
2453
- /**
2454
- * Chooses strict mode for OpenAI chat-model configs, off otherwise. Extendable in future for
2455
- * other providers that adopt the same "supply a JSON Schema record directly" contract.
2456
- */
2457
1698
  private resolveStructuredOutputOptions;
2458
1699
  private resolveOutputSchemaForModel;
2459
1700
  private tryParseAndValidate;
@@ -2514,53 +1755,15 @@ interface AIAgentOptions<TInputJson$1 = unknown, _TOutputJson = unknown> {
2514
1755
  readonly description?: string;
2515
1756
  readonly retryPolicy?: RetryPolicySpec;
2516
1757
  readonly guardrails?: AgentGuardrailConfig;
2517
- /** Engine applies with {@link RunnableNodeConfig.inputSchema} before {@link AIAgentNode.execute}. */
2518
1758
  readonly inputSchema?: ZodType<TInputJson$1>;
2519
1759
  readonly outputSchema?: ZodType<_TOutputJson>;
2520
- /**
2521
- * MCP servers to connect for this agent run. Each entry is the server id from
2522
- * the MCP catalog (e.g. `"gmail"`). Credential instances are bound via the
2523
- * standard credential-binding flow — each server materializes an MCP connection
2524
- * node and the slot lives on that node, keyed by
2525
- * `(workflowId, mcpConnectionNodeId, "credential")` (same shape as ChatModel and
2526
- * Tool connection nodes). There is no inline credential field; bind through the
2527
- * canvas credential dropdown before activation.
2528
- */
2529
1760
  readonly mcpServers?: ReadonlyArray<string>;
2530
- /**
2531
- * Tool ids to always include without going through `find_tools`.
2532
- * Format: `"serverId:toolName"` (e.g. `"gmail:send_message"`). Max 16.
2533
- */
2534
1761
  readonly pinnedMcpTools?: readonly string[];
2535
- /**
2536
- * Source identifiers that should be treated as untrusted external content.
2537
- * When an incoming `Item.json.__source` matches one of these values, every
2538
- * user-role message is wrapped with an untrusted-source preamble so the LLM
2539
- * treats the content as data rather than instructions (prompt-injection defense).
2540
- *
2541
- * Defaults to `["gmail", "ocr", "webhook"]` when unset.
2542
- */
2543
1762
  readonly untrustedSources?: ReadonlyArray<string>;
2544
- /**
2545
- * Whether file binaries are automatically passed to the chat model as native inline
2546
- * multimodal blocks. Defaults to `true`. Set to `false` to skip the binary-passdown step
2547
- * entirely (the node then behaves as if no binaries were present).
2548
- */
2549
1763
  readonly passBinariesToModel?: boolean;
2550
- /**
2551
- * Explicit binaries to pass to the chat model, instead of the ones on the current item.
2552
- * Either a static array or a function resolved per item (so an author can forward binaries
2553
- * produced by an earlier node further back in the workflow). When provided, these replace
2554
- * `item.binary` as the passdown source. Ignored when {@link passBinariesToModel} is `false`.
2555
- * Every binary is passed (images as image blocks, all other types as file blocks); the
2556
- * provider surfaces an error at runtime if it doesn't support a given file type.
2557
- */
1764
+ readonly passToolBinariesToModel?: boolean;
2558
1765
  readonly binaries?: ReadonlyArray<BinaryAttachment> | ((args: AgentMessageBuildArgs<TInputJson$1>) => ReadonlyArray<BinaryAttachment>);
2559
1766
  }
2560
- /**
2561
- * AI agent: credential bindings are keyed to connection-owned LLM/tool node ids (ConnectionNodeIdFactory),
2562
- * not to the agent workflow node id.
2563
- */
2564
1767
  declare class AIAgent<TInputJson$1 = unknown, TOutputJson$1 = unknown> implements RunnableNodeConfig<TInputJson$1, TOutputJson$1>, AgentNodeConfig<TInputJson$1, TOutputJson$1> {
2565
1768
  readonly kind: "node";
2566
1769
  readonly type: TypeToken<unknown>;
@@ -2582,6 +1785,7 @@ declare class AIAgent<TInputJson$1 = unknown, TOutputJson$1 = unknown> implement
2582
1785
  readonly pinnedMcpTools?: readonly string[];
2583
1786
  readonly untrustedSources?: ReadonlyArray<string>;
2584
1787
  readonly passBinariesToModel?: boolean;
1788
+ readonly passToolBinariesToModel?: boolean;
2585
1789
  readonly binaries?: ReadonlyArray<BinaryAttachment> | ((args: AgentMessageBuildArgs<TInputJson$1>) => ReadonlyArray<BinaryAttachment>);
2586
1790
  constructor(options: AIAgentOptions<TInputJson$1, TOutputJson$1>);
2587
1791
  inspectorSummary(): ReadonlyArray<NodeInspectorSummaryRow>;
@@ -2603,13 +1807,9 @@ declare class AgentToolExecutionCoordinator {
2603
1807
  ctx: NodeExecutionContext<AIAgent<any, any>>;
2604
1808
  agentName: string;
2605
1809
  repairAttemptsByToolName: Map<string, number>;
2606
- /** Conversation including the assistant message that emitted these tool_use blocks. Stored in checkpoint on HITL suspension. */
2607
1810
  conversationSnapshot?: ReadonlyArray<ModelMessage>;
2608
- /** Turn count at the moment of this coordinator invocation. */
2609
1811
  turnCount?: number;
2610
- /** Cumulative tool-call count up to and including this batch. */
2611
1812
  toolCallCount?: number;
2612
- /** Model id for checkpoint migration safety. */
2613
1813
  modelId?: string;
2614
1814
  }>): Promise<ReadonlyArray<ExecutedToolCall>>;
2615
1815
  private executePlannedToolCall;
@@ -2619,10 +1819,6 @@ declare class AgentToolExecutionCoordinator {
2619
1819
  private createValidationMessage;
2620
1820
  private toJsonValue;
2621
1821
  private extractErrorDetails;
2622
- /**
2623
- * Extracts the text content from the last assistant message in the conversation snapshot.
2624
- * Used to populate `agentReasoning` in the HITL suspension metadata.
2625
- */
2626
1822
  private extractLastAssistantText;
2627
1823
  private serializeIssue;
2628
1824
  }
@@ -2650,20 +1846,6 @@ declare class NodeBackedToolRuntime {
2650
1846
  private readonly childExecutionScopeFactory;
2651
1847
  constructor(nodeResolver: NodeResolver, itemExprResolver: ItemExprResolver, outputNormalizer: NodeOutputNormalizer, outputBehaviorResolver: RunnableOutputBehaviorResolver, childExecutionScopeFactory: ChildExecutionScopeFactory);
2652
1848
  execute(config: NodeBackedToolConfig<any, ZodSchemaAny, ZodSchemaAny>, args: ToolExecuteArgs): Promise<unknown>;
2653
- /**
2654
- * Returns a re-rooted child ctx for nested-agent tools (so their LLM/tool connection ids derive
2655
- * from the tool connection node, telemetry parents under the tool-call span, and connection
2656
- * invocations carry `parentInvocationId`). Plain runnable tools (non-agent) keep the orchestrator
2657
- * ctx with only `config` swapped — no nesting concern.
2658
- *
2659
- * The caller (`AIAgentNode.createItemScopedTools`) already wraps the orchestrator ctx via
2660
- * `ConnectionCredentialExecutionContextFactory.forConnectionNode`, so `args.ctx.nodeId` is the
2661
- * tool's own connection node id (e.g. `AIAgentNode:2__conn__tool__searchInMail`). We pass that
2662
- * through as the sub-agent's `nodeId`; deriving another `toolConnectionNodeId(args.ctx.nodeId,
2663
- * config.name)` here would prepend a duplicate `__conn__tool__<name>` segment and exponentially
2664
- * deepen ids on each invocation, which also breaks credential resolution because user-provided
2665
- * bindings sit on the single-level connection node id.
2666
- */
2667
1849
  private resolveNodeCtx;
2668
1850
  private executeResolvedNode;
2669
1851
  private isRunnableNode;
@@ -2696,11 +1878,6 @@ interface ToolLoadingStrategy {
2696
1878
  }
2697
1879
  //#endregion
2698
1880
  //#region src/nodes/DeferredMetaToolStrategyFactory.d.ts
2699
- /**
2700
- * Factory for creating and initializing a DeferredMetaToolStrategy per agent execution.
2701
- * Injected into AIAgentNode; each agent call creates its own initialized strategy instance.
2702
- * BM25Index is constructed here (this file is a composition root via the Factory suffix).
2703
- */
2704
1881
  declare class DeferredMetaToolStrategyFactory {
2705
1882
  create(input: ToolLoadingStrategyInitInput): Promise<ToolLoadingStrategy>;
2706
1883
  }
@@ -2719,42 +1896,17 @@ declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
2719
1896
  readonly inputSchema: z.ZodUnknown;
2720
1897
  private readonly connectionCredentialExecutionContextFactory;
2721
1898
  private readonly preparedByExecutionContext;
2722
- /**
2723
- * The `ai` SDK, loaded lazily in {@link execute} so the SDK (~28MB RSS) stays
2724
- * off the boot path — non-AI workflows never load it. Every path runs through
2725
- * `execute` → `ensureAiSdk` before any sync helper touches `this.aiSdk`.
2726
- */
2727
1899
  private aiSdk;
2728
1900
  private aiSdkPromise;
2729
1901
  constructor(nodeResolver: NodeResolver, credentialSessions: CredentialSessionService, nodeBackedToolRuntime: NodeBackedToolRuntime, executionHelpers: AIAgentExecutionHelpersFactory, structuredOutputRunner: AgentStructuredOutputRunner, toolExecutionCoordinator: AgentToolExecutionCoordinator, toolLoadingStrategyFactory: DeferredMetaToolStrategyFactory, agentMcpIntegration: AgentMcpIntegration);
2730
1902
  execute(args: RunnableNodeExecuteArgs<AIAgent<any, any>>): Promise<unknown>;
2731
- /** Load the `ai` SDK once per node instance (cached promise guards concurrent items). */
2732
1903
  private ensureAiSdk;
2733
- /**
2734
- * Resume path: re-enters the agent loop after a HITL suspension.
2735
- * Reconstructs the conversation from the checkpoint, injects the human decision
2736
- * as a tool_result, and continues the loop from where it suspended.
2737
- */
2738
1904
  private executeResumed;
2739
- /**
2740
- * Normalizes a {@link ResumeContext} decision into a flat JSON-serializable shape
2741
- * suitable for injection as a tool_result content.
2742
- */
2743
1905
  private normalizeDecision;
2744
1906
  private getOrPrepareExecution;
2745
1907
  private prepareExecution;
2746
1908
  private prepareMcpToolsByServer;
2747
1909
  private runAgentForItem;
2748
- /**
2749
- * Multi-turn loop:
2750
- * - Each turn is a single `generateText` call with tools exposed but **not auto-executed**
2751
- * (we control tool dispatch so that {@link AgentToolExecutionCoordinator} drives repair /
2752
- * connection-invocation recording / transient-error handling exactly like before).
2753
- * - When the model returns no tool calls the loop ends with the model's text as the final answer.
2754
- * - Respects `guardrails.maxTurns` and `guardrails.onTurnLimitReached`.
2755
- * - Strategy-owned tool calls (e.g. `find_tools`) are dispatched via the strategy, not the
2756
- * coordinator; their results are tracked so subsequent turns receive the discovered tools.
2757
- */
2758
1910
  private runTurnLoopUntilFinalAnswer;
2759
1911
  private cannotExecuteAnotherToolRound;
2760
1912
  private finishOrThrowWhenTurnCapHitWithToolCalls;
@@ -2763,66 +1915,15 @@ declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
2763
1915
  private buildOutputItem;
2764
1916
  private resolveTools;
2765
1917
  private createItemScopedTools;
2766
- /**
2767
- * Resolves the HITL behavior for a tool binding, or `undefined` when it is not a HITL tool.
2768
- * A binding is HITL if either the backing node carries a `defineHumanApprovalNode` marker or the
2769
- * binding sets a per-binding `onRejected` via `asTool(..., { onRejected })`. The per-binding value
2770
- * wins over the node marker, so two tools backed by the same node can reject differently.
2771
- */
2772
1918
  private resolveHumanApprovalBehavior;
2773
- /**
2774
- * Invoke a text turn using the merged tool set from item-scoped tools (coordinator-managed)
2775
- * and strategy tools (find_tools + discovered MCP tools).
2776
- * Strategy tools take precedence for names that overlap.
2777
- */
2778
1919
  private invokeTextTurnWithStrategyTools;
2779
- /**
2780
- * Removes `execute` properties from ToolSet entries so the AI SDK does not
2781
- * auto-execute them within `generateText`. Codemation owns all tool dispatch.
2782
- */
2783
1920
  private stripExecuteCallbacks;
2784
- /**
2785
- * Builds a ToolSet from resolved tools for strategy initialization.
2786
- * The strategy uses this for its "always-included" node-backed tool descriptions.
2787
- * HITL tools (detected via the `humanApprovalToolBehavior` field set by `defineHumanApprovalNode`) get the solo-constraint sentence
2788
- * appended to their description.
2789
- */
2790
1921
  private buildToolSetFromResolved;
2791
- /**
2792
- * Builds an AI SDK {@link ToolSet} where every tool ships a pre-converted JSON Schema (via
2793
- * {@link jsonSchema}) — not the raw Zod schema — and carries **no** `execute`. Two reasons:
2794
- *
2795
- * 1. Codemation owns tool dispatch + the per-tool repair loop (see {@link AgentToolExecutionCoordinator}),
2796
- * so the AI SDK must surface tool calls back to us instead of auto-running them.
2797
- * 2. The AI SDK's `asSchema` helper discriminates between Zod v3 / Zod v4 / Standard Schema via
2798
- * runtime feature-detection (`~standard`, `_zod`, etc.). Handing it a pre-built
2799
- * {@link jsonSchema} record — which is tagged with `Symbol.for('vercel.ai.schema')` — skips all
2800
- * of that detection and guarantees the provider receives a draft-07 JSON Schema with
2801
- * `additionalProperties: false` at every object depth (see {@link OpenAiStrictJsonSchemaFactory}
2802
- * for the same logic applied to structured-output schemas). Codemation still runs its own Zod
2803
- * validation on tool inputs before execute — the schema handed to the model is advisory.
2804
- */
2805
1922
  private buildToolSet;
2806
- /**
2807
- * One `generateText` turn (no auto tool execution) with Codemation-owned child-span telemetry
2808
- * and connection-invocation state recording. Accepts a pre-built ToolSet.
2809
- */
2810
1923
  private invokeTextTurnWithToolSet;
2811
- /**
2812
- * Structured-output turn: runs `generateText({ output: Output.object({ schema }) })` via the
2813
- * structured-output runner. We keep this as a separate helper because the runner needs the raw
2814
- * validated value (not just text) back, and must be able to retry on Zod failures.
2815
- */
2816
1924
  private invokeStructuredTurn;
2817
1925
  private isZodSchema;
2818
1926
  private resolveCallOptions;
2819
- /**
2820
- * Build a no-code-friendly output payload for an LLM round.
2821
- *
2822
- * Always includes `content` (matching the canvas snapshot shape used elsewhere) and adds a
2823
- * `toolCalls` array when the round produced tool calls so the execution inspector surfaces the
2824
- * planned calls instead of just an empty `""` for tool-only rounds.
2825
- */
2826
1927
  private summarizeTurnOutput;
2827
1928
  private extractTurnResult;
2828
1929
  private extractAssistantMessage;
@@ -2838,28 +1939,8 @@ declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
2838
1939
  private summarizeLlmMessages;
2839
1940
  private resultToJsonValue;
2840
1941
  private createPromptMessages;
2841
- /**
2842
- * Picks which attachments feed the passdown. When the author supplies `config.binaries`
2843
- * (a static array or a per-item function — e.g. to forward binaries from an earlier node),
2844
- * those replace the current item's attachments; otherwise the current item's `item.binary`
2845
- * is used.
2846
- */
2847
1942
  private selectBinaryAttachments;
2848
- /**
2849
- * Reads every attachment through `ctx.binary` (storage-backed, by reference — never base64 on
2850
- * `item.json`) and resolves it to inline base64 so the agent can pass it to the chat model as a
2851
- * native multimodal block. Images become image blocks; every other type (PDF, office docs, CSV,
2852
- * JSON, …) becomes a file block — we don't filter by media type, so any binary can be fed to the
2853
- * model. If the provider rejects an unsupported type the error surfaces at runtime, and the
2854
- * workflow can filter the binary upstream.
2855
- */
2856
1943
  private resolveInlineBinaries;
2857
- /**
2858
- * When `item.json.__source` matches an entry in `config.untrustedSources`
2859
- * (default: `["gmail", "ocr", "webhook"]`), wraps every user-role message
2860
- * content with an untrusted-external-source preamble so the LLM treats the
2861
- * content as data, not instructions.
2862
- */
2863
1944
  private wrapUntrustedSourceMessages;
2864
1945
  private resolveToolRuntime;
2865
1946
  private isNodeBackedToolConfig;
@@ -2870,42 +1951,19 @@ declare class AIAgentNode implements RunnableNode<AIAgent<any, any>> {
2870
1951
  }
2871
1952
  //#endregion
2872
1953
  //#region src/nodes/BM25Index.d.ts
2873
- /**
2874
- * Minimal BM25 (Okapi BM25) implementation for indexing MCP tool descriptions.
2875
- *
2876
- * Parameters: k1=1.5, b=0.75 (standard defaults).
2877
- * Tokenisation: lowercase, split on non-alphanumerics, filter empties.
2878
- */
2879
1954
  declare class BM25Index {
2880
1955
  private readonly k1;
2881
1956
  private readonly b;
2882
1957
  private readonly tf;
2883
1958
  private readonly df;
2884
1959
  private avgDocLen;
2885
- /**
2886
- * Add all documents at once. After calling this, search is available.
2887
- * Documents are indexed in insertion order; search returns their indices.
2888
- */
2889
1960
  add(docs: ReadonlyArray<string>): void;
2890
- /**
2891
- * Returns up to `limit` document indices ranked by BM25 score (highest first).
2892
- * Returns an empty array if the index is empty or the query matches nothing.
2893
- */
2894
1961
  search(query: string, limit: number): ReadonlyArray<number>;
2895
1962
  tokenize(text: string): string[];
2896
1963
  private docLen;
2897
1964
  }
2898
1965
  //#endregion
2899
1966
  //#region src/nodes/DeferredMetaToolStrategy.d.ts
2900
- /**
2901
- * Default tool-loading strategy: BM25-indexed MCP tool deferral via a `find_tools` meta-tool.
2902
- *
2903
- * - Node-backed tools and pinned MCP tools are always included in every turn.
2904
- * - `find_tools(query, limit?)` is added to the tool set when MCP tools are indexed.
2905
- * - Tools surfaced by `find_tools` are included in subsequent turns.
2906
- *
2907
- * Not DI-managed; instantiated per agent execution by DeferredMetaToolStrategyFactory.
2908
- */
2909
1967
  declare class DeferredMetaToolStrategy implements ToolLoadingStrategy {
2910
1968
  private readonly bm25;
2911
1969
  private readonly warnFn;
@@ -2914,11 +1972,6 @@ declare class DeferredMetaToolStrategy implements ToolLoadingStrategy {
2914
1972
  private mcpEntries;
2915
1973
  private toolsByServerId;
2916
1974
  private foundToolIds;
2917
- /**
2918
- * `jsonSchema` from the `ai` SDK, loaded lazily in {@link initialize} so the SDK
2919
- * (~28MB RSS) stays off the boot path. `initialize` always runs before the sync
2920
- * `getToolsForTurn` → `buildFindToolsDefinition` path, so this is set before use.
2921
- */
2922
1975
  private jsonSchema;
2923
1976
  constructor(bm25: BM25Index, warnFn: (message: string) => void);
2924
1977
  initialize(input: ToolLoadingStrategyInitInput): Promise<void>;
@@ -2931,17 +1984,6 @@ declare class DeferredMetaToolStrategy implements ToolLoadingStrategy {
2931
1984
  }
2932
1985
  //#endregion
2933
1986
  //#region src/nodes/AssertionNode.d.ts
2934
- /**
2935
- * Runs the author's `assertions` callback for each input item and emits one workflow `Item` per
2936
- * returned {@link AssertionResult} on `main`. Persistence is handled by a host-side subscriber
2937
- * to `nodeCompleted` events that filters on `config.emitsAssertions === true`; this node does
2938
- * not write to any store on its own.
2939
- *
2940
- * If the author callback throws, we emit a single synthetic AssertionResult with `errored: true`
2941
- * and `score: 0`. Without this catch the whole node would fail and no assertion row would be
2942
- * persisted — making the rollup blind to "the assertion code itself is broken." The synthetic
2943
- * row keeps `failedAssertionsByRunId` consistent and gives the UI something to surface.
2944
- */
2945
1987
  declare class AssertionNode implements RunnableNode<Assertion<any>> {
2946
1988
  kind: "node";
2947
1989
  outputPorts: readonly ["main"];
@@ -2954,18 +1996,8 @@ interface AssertionOptions<TInputJson$1> {
2954
1996
  readonly id?: string;
2955
1997
  readonly icon?: string;
2956
1998
  readonly description?: string;
2957
- /**
2958
- * Author callback. Returns one or more {@link AssertionResult}s per input item. Each becomes
2959
- * one emitted output item — useful for per-row reporting in the Tests tab. Return `[]` to
2960
- * emit nothing for this case (rare; usually you want at least a "no-op" pass).
2961
- */
2962
1999
  assertions(item: Item<TInputJson$1>, ctx: NodeExecutionContext<Assertion<TInputJson$1>>): Promise<ReadonlyArray<AssertionResult>> | ReadonlyArray<AssertionResult>;
2963
2000
  }
2964
- /**
2965
- * Generic assertion node — the "callback" form. For declarative shorthands (StringEquals,
2966
- * JudgeByAgent) compose this with helpers added in later phases. Sets `emitsAssertions: true`
2967
- * so host-side persisters know to record its outputs as `TestAssertion` rows.
2968
- */
2969
2001
  declare class Assertion<TInputJson$1 = unknown> implements RunnableNodeConfig<TInputJson$1, AssertionResult> {
2970
2002
  readonly kind: "node";
2971
2003
  readonly type: TypeToken<unknown>;
@@ -2980,14 +2012,6 @@ declare class Assertion<TInputJson$1 = unknown> implements RunnableNodeConfig<TI
2980
2012
  }
2981
2013
  //#endregion
2982
2014
  //#region src/nodes/nodeOptions.types.d.ts
2983
- /**
2984
- * Options shared by every authorable built-in node: a stable `id` and a plain-language
2985
- * `description` (the non-technical "what does this node do" line surfaced in the node sidebar).
2986
- *
2987
- * `description` is a first-class config option — passed inline in the node's options, exactly like
2988
- * `id` — and is threaded onto the config instance so it flows into the persisted workflow snapshot
2989
- * the host / canvas mappers read. Node-specific option types extend this.
2990
- */
2991
2015
  interface NodeBaseOptions {
2992
2016
  readonly id?: string;
2993
2017
  readonly description?: string;
@@ -3052,7 +2076,6 @@ declare class HttpRequestNode implements RunnableNode<HttpRequest<any, any>> {
3052
2076
  //#endregion
3053
2077
  //#region src/nodes/httpRequest.d.ts
3054
2078
  type HttpRequestDownloadMode = "auto" | "always" | "never";
3055
- /** JSON emitted by {@link HttpRequest} — response metadata only (input item fields are not passed through). */
3056
2079
  type HttpRequestOutputJson = Readonly<{
3057
2080
  url: string;
3058
2081
  method: string;
@@ -3064,99 +2087,34 @@ type HttpRequestOutputJson = Readonly<{
3064
2087
  json?: unknown;
3065
2088
  text?: string;
3066
2089
  bodyBinaryName?: string;
3067
- /** Set when `responseFormat === "binary"`. Name of the binary slot the response was stored in. */
3068
2090
  binarySlot?: string;
3069
- /** Set when `responseFormat === "binary"`. MIME type of the stored response. */
3070
2091
  contentType?: string;
3071
- /** Set when `responseFormat === "binary"`. Size in bytes of the stored response. */
3072
2092
  size?: number;
3073
- /** Set when `responseFormat === "binary"`. Filename inferred from URL or Content-Disposition. */
3074
2093
  filename?: string;
3075
2094
  }>;
3076
- /**
3077
- * The built-in HTTP request credential type IDs accepted by the `HttpRequest` node.
3078
- * These match the four generic credential types shipped with `@codemation/core-nodes`.
3079
- */
3080
2095
  declare const HTTP_REQUEST_ACCEPTED_CREDENTIAL_TYPES: ReadonlyArray<string>;
3081
2096
  declare class HttpRequest<TInputJson$1 = Readonly<{
3082
2097
  url?: string;
3083
2098
  }>, TOutputJson$1 = HttpRequestOutputJson> implements RunnableNodeConfig<TInputJson$1, TOutputJson$1> {
3084
2099
  readonly name: string;
3085
2100
  readonly args: Readonly<{
3086
- /** HTTP method (default: GET). */
3087
2101
  method?: string;
3088
- /**
3089
- * Legacy: field name on item.json to read the URL from.
3090
- * Use `url` for a literal/templated URL instead.
3091
- */
3092
2102
  urlField?: string;
3093
- /** Literal or templated URL. When present, takes precedence over `urlField`. */
3094
2103
  url?: string;
3095
- /** Extra headers to add to every request. */
3096
2104
  headers?: Readonly<Record<string, string>>;
3097
- /** Query parameters to append to the URL. */
3098
2105
  query?: Readonly<Record<string, string>>;
3099
- /** Request body specification. For `kind:"json"`, pass the object directly in `body.data` — it is JSON-encoded exactly once, so never a pre-stringified string. */
3100
2106
  body?: HttpBodySpec;
3101
- /**
3102
- * Credential slot.
3103
- *
3104
- * **String shorthand** (existing): `credentialSlot: "auth"` — the slot accepts all four
3105
- * default HTTP credential types (bearer, API-key, basic, OAuth2).
3106
- *
3107
- * **Object form** (new): narrows the accepted types to the caller-supplied list, useful
3108
- * when only a subset of credential types makes sense for a specific endpoint.
3109
- * ```ts
3110
- * credentialSlot: { name: "auth", acceptedTypes: [bearerTokenCredentialType] }
3111
- * ```
3112
- * The slot must be declared in `getCredentialRequirements()`, which is wired automatically.
3113
- */
3114
2107
  credentialSlot?: string | Readonly<{
3115
2108
  name: string;
3116
2109
  acceptedTypes?: ReadonlyArray<AnyCredentialType>;
3117
2110
  }>;
3118
2111
  binaryName?: string;
3119
2112
  downloadMode?: HttpRequestDownloadMode;
3120
- /**
3121
- * Controls how the response body is handled.
3122
- * - `"json"` / `"text"`: existing behaviour (parse + emit on `item.json`).
3123
- * - `"binary"`: read the response as raw bytes and store via `ctx.binary.attach`.
3124
- * The output JSON contains `{ status, headers, binarySlot, contentType, size, filename }`
3125
- * but NOT the raw bytes. Use `responseBinarySlot` to name the slot (default `"response"`).
3126
- *
3127
- * When omitted, the existing `downloadMode` logic applies (backward-compatible).
3128
- */
3129
2113
  responseFormat?: "json" | "text" | "binary";
3130
- /**
3131
- * Name of the binary slot to write the response body into when `responseFormat === "binary"`.
3132
- * Defaults to `"response"`.
3133
- */
3134
2114
  responseBinarySlot?: string;
3135
- /**
3136
- * Maximum response size in bytes for binary mode. Checked against the `Content-Length`
3137
- * response header before allocating memory. Defaults to 100 MiB (104857600).
3138
- * Requests whose `Content-Length` exceeds this cap are rejected before the body is read.
3139
- */
3140
2115
  responseSizeCapBytes?: number;
3141
- /**
3142
- * Operator-configurable outbound host allowlist.
3143
- *
3144
- * When set, every HTTP request target must match an entry in this list before the
3145
- * request is made — requests to any other host are rejected with {@link SSRFBlockedError}.
3146
- * Supports exact hostnames (`api.example.com`) and wildcard subdomain patterns
3147
- * (`*.example.com` matches `sub.example.com` but not `example.com` itself).
3148
- *
3149
- * When unset (default), the existing SSRF private-network guard applies:
3150
- * public hosts are allowed and private/loopback ranges are blocked.
3151
- *
3152
- * **Production warning**: when `NODE_ENV === "production"` and this is unset, a one-time
3153
- * warning is logged at workflow startup.
3154
- *
3155
- * Setting this to an empty array `[]` is equivalent to "block everything".
3156
- */
3157
2116
  allowedOutboundHosts?: ReadonlyArray<string>;
3158
2117
  id?: string;
3159
- /** Plain-language explanation surfaced in the node sidebar. */
3160
2118
  description?: string;
3161
2119
  }>;
3162
2120
  readonly retryPolicy: RetryPolicySpec;
@@ -3168,80 +2126,23 @@ declare class HttpRequest<TInputJson$1 = Readonly<{
3168
2126
  readonly icon: "lucide:globe";
3169
2127
  readonly description?: string;
3170
2128
  constructor(name: string, args?: Readonly<{
3171
- /** HTTP method (default: GET). */
3172
2129
  method?: string;
3173
- /**
3174
- * Legacy: field name on item.json to read the URL from.
3175
- * Use `url` for a literal/templated URL instead.
3176
- */
3177
2130
  urlField?: string;
3178
- /** Literal or templated URL. When present, takes precedence over `urlField`. */
3179
2131
  url?: string;
3180
- /** Extra headers to add to every request. */
3181
2132
  headers?: Readonly<Record<string, string>>;
3182
- /** Query parameters to append to the URL. */
3183
2133
  query?: Readonly<Record<string, string>>;
3184
- /** Request body specification. For `kind:"json"`, pass the object directly in `body.data` — it is JSON-encoded exactly once, so never a pre-stringified string. */
3185
2134
  body?: HttpBodySpec;
3186
- /**
3187
- * Credential slot.
3188
- *
3189
- * **String shorthand** (existing): `credentialSlot: "auth"` — the slot accepts all four
3190
- * default HTTP credential types (bearer, API-key, basic, OAuth2).
3191
- *
3192
- * **Object form** (new): narrows the accepted types to the caller-supplied list, useful
3193
- * when only a subset of credential types makes sense for a specific endpoint.
3194
- * ```ts
3195
- * credentialSlot: { name: "auth", acceptedTypes: [bearerTokenCredentialType] }
3196
- * ```
3197
- * The slot must be declared in `getCredentialRequirements()`, which is wired automatically.
3198
- */
3199
2135
  credentialSlot?: string | Readonly<{
3200
2136
  name: string;
3201
2137
  acceptedTypes?: ReadonlyArray<AnyCredentialType>;
3202
2138
  }>;
3203
2139
  binaryName?: string;
3204
2140
  downloadMode?: HttpRequestDownloadMode;
3205
- /**
3206
- * Controls how the response body is handled.
3207
- * - `"json"` / `"text"`: existing behaviour (parse + emit on `item.json`).
3208
- * - `"binary"`: read the response as raw bytes and store via `ctx.binary.attach`.
3209
- * The output JSON contains `{ status, headers, binarySlot, contentType, size, filename }`
3210
- * but NOT the raw bytes. Use `responseBinarySlot` to name the slot (default `"response"`).
3211
- *
3212
- * When omitted, the existing `downloadMode` logic applies (backward-compatible).
3213
- */
3214
2141
  responseFormat?: "json" | "text" | "binary";
3215
- /**
3216
- * Name of the binary slot to write the response body into when `responseFormat === "binary"`.
3217
- * Defaults to `"response"`.
3218
- */
3219
2142
  responseBinarySlot?: string;
3220
- /**
3221
- * Maximum response size in bytes for binary mode. Checked against the `Content-Length`
3222
- * response header before allocating memory. Defaults to 100 MiB (104857600).
3223
- * Requests whose `Content-Length` exceeds this cap are rejected before the body is read.
3224
- */
3225
2143
  responseSizeCapBytes?: number;
3226
- /**
3227
- * Operator-configurable outbound host allowlist.
3228
- *
3229
- * When set, every HTTP request target must match an entry in this list before the
3230
- * request is made — requests to any other host are rejected with {@link SSRFBlockedError}.
3231
- * Supports exact hostnames (`api.example.com`) and wildcard subdomain patterns
3232
- * (`*.example.com` matches `sub.example.com` but not `example.com` itself).
3233
- *
3234
- * When unset (default), the existing SSRF private-network guard applies:
3235
- * public hosts are allowed and private/loopback ranges are blocked.
3236
- *
3237
- * **Production warning**: when `NODE_ENV === "production"` and this is unset, a one-time
3238
- * warning is logged at workflow startup.
3239
- *
3240
- * Setting this to an empty array `[]` is equivalent to "block everything".
3241
- */
3242
2144
  allowedOutboundHosts?: ReadonlyArray<string>;
3243
2145
  id?: string;
3244
- /** Plain-language explanation surfaced in the node sidebar. */
3245
2146
  description?: string;
3246
2147
  }>, retryPolicy?: RetryPolicySpec);
3247
2148
  get id(): string | undefined;
@@ -3328,24 +2229,12 @@ declare class If<TInputJson$1 = unknown> implements RunnableNodeConfig<TInputJso
3328
2229
  }
3329
2230
  //#endregion
3330
2231
  //#region src/nodes/IsTestRunNode.d.ts
3331
- /**
3332
- * Routes each item to the `true` port if `ctx.testContext` is set (the run was started by the
3333
- * TestSuiteOrchestrator), else to `false`. Lets workflow authors guard real side-effects:
3334
- *
3335
- * GmailTrigger / TestTrigger → ClassifyAgent → IsTestRun
3336
- * ├── true → AssertionNode
3337
- * └── false → SendReply
3338
- */
3339
2232
  declare class IsTestRunNode implements RunnableNode<IsTestRun<unknown>> {
3340
2233
  kind: "node";
3341
2234
  execute(args: RunnableNodeExecuteArgs<IsTestRun<unknown>>): unknown;
3342
2235
  }
3343
2236
  //#endregion
3344
2237
  //#region src/nodes/isTestRun.d.ts
3345
- /**
3346
- * Branches per-item on whether the current run is a test run. Output ports: `true`, `false`.
3347
- * The wire payload is unchanged — this is a router, not a transform.
3348
- */
3349
2238
  declare class IsTestRun<TInputJson$1 = unknown> implements RunnableNodeConfig<TInputJson$1, TInputJson$1> {
3350
2239
  readonly kind: "node";
3351
2240
  readonly type: TypeToken<unknown>;
@@ -3361,9 +2250,6 @@ declare class IsTestRun<TInputJson$1 = unknown> implements RunnableNodeConfig<TI
3361
2250
  }
3362
2251
  //#endregion
3363
2252
  //#region src/nodes/SwitchNode.d.ts
3364
- /**
3365
- * Routes each item to exactly one output port. Port names must match workflow edges (see {@link Switch} config).
3366
- */
3367
2253
  declare class SwitchNode implements RunnableNode<Switch<any>> {
3368
2254
  kind: "node";
3369
2255
  execute(args: RunnableNodeExecuteArgs<Switch<any>>): Promise<unknown>;
@@ -3412,10 +2298,6 @@ declare class Split<TIn = unknown, TElem = unknown> implements RunnableNodeConfi
3412
2298
  readonly hint: "local";
3413
2299
  };
3414
2300
  readonly keepBinaries: true;
3415
- /**
3416
- * When splitting yields zero items for a batch, downstream single-input nodes still run once with an empty batch.
3417
- * Mirrors {@link MapData}'s empty-output behavior.
3418
- */
3419
2301
  readonly continueWhenEmptyOutput: true;
3420
2302
  readonly icon: "builtin:split-rows";
3421
2303
  readonly id?: string;
@@ -3429,15 +2311,6 @@ type CronTickJson = {
3429
2311
  firedAt: string;
3430
2312
  scheduledFor: string;
3431
2313
  };
3432
- /**
3433
- * Schedules a workflow on a standard cron expression.
3434
- *
3435
- * Each tick emits one item: `{ firedAt: string, scheduledFor: string }` — both ISO-8601 timestamps.
3436
- * `firedAt` is the wall-clock moment the callback ran; `scheduledFor` is the cron-computed
3437
- * firing instant (these differ when the job was delayed).
3438
- *
3439
- * Timezone defaults to UTC when omitted — cron without an explicit TZ is a DST footgun.
3440
- */
3441
2314
  declare class CronTrigger implements TriggerNodeConfig<CronTickJson> {
3442
2315
  readonly name: string;
3443
2316
  private readonly args;
@@ -3466,10 +2339,6 @@ declare class CronTriggerNode implements TestableTriggerNode<CronTrigger> {
3466
2339
  }
3467
2340
  //#endregion
3468
2341
  //#region src/nodes/ManualTriggerNode.d.ts
3469
- /**
3470
- * Setup is intentionally a no-op: the engine host can run workflows manually
3471
- * by calling `engine.runWorkflow(workflow, triggerNodeId, items)`.
3472
- */
3473
2342
  declare class ManualTriggerNode implements TestableTriggerNode<ManualTrigger<any>> {
3474
2343
  kind: "trigger";
3475
2344
  outputPorts: readonly ["main"];
@@ -3490,7 +2359,6 @@ declare class ManualTrigger<TOutputJson$1 = unknown> implements TriggerNodeConfi
3490
2359
  readonly defaultItems?: Items<TOutputJson$1>;
3491
2360
  readonly id?: string;
3492
2361
  readonly description?: string;
3493
- /** Manual runs often emit an empty batch; still schedule downstream by default. */
3494
2362
  readonly continueWhenEmptyOutput: true;
3495
2363
  constructor(name?: string, idOrOptions?: string | NodeBaseOptions);
3496
2364
  constructor(name: string, defaultItems: ManualTriggerDefaultValue<TOutputJson$1> | undefined, idOrOptions?: string | NodeBaseOptions);
@@ -3519,7 +2387,6 @@ declare class MapData<TInputJson$1 = unknown, TOutputJson$1 = unknown> implement
3519
2387
  readonly execution: {
3520
2388
  readonly hint: "local";
3521
2389
  };
3522
- /** Zero mapped items should still allow downstream nodes to run. */
3523
2390
  readonly continueWhenEmptyOutput: true;
3524
2391
  readonly icon: "lucide:square-pen";
3525
2392
  readonly keepBinaries: boolean;
@@ -3542,10 +2409,6 @@ declare class Merge<TInputJson$1 = unknown, TOutputJson$1 = TInputJson$1> implem
3542
2409
  readonly name: string;
3543
2410
  readonly cfg: Readonly<{
3544
2411
  mode: MergeMode;
3545
- /**
3546
- * Deterministic input precedence order (only used for passThrough/append).
3547
- * Any inputs not listed are appended in lexicographic order.
3548
- */
3549
2412
  prefer?: ReadonlyArray<InputPortKey>;
3550
2413
  }>;
3551
2414
  readonly kind: "node";
@@ -3555,10 +2418,6 @@ declare class Merge<TInputJson$1 = unknown, TOutputJson$1 = TInputJson$1> implem
3555
2418
  readonly description?: string;
3556
2419
  constructor(name: string, cfg?: Readonly<{
3557
2420
  mode: MergeMode;
3558
- /**
3559
- * Deterministic input precedence order (only used for passThrough/append).
3560
- * Any inputs not listed are appended in lexicographic order.
3561
- */
3562
2421
  prefer?: ReadonlyArray<InputPortKey>;
3563
2422
  }>, idOrOptions?: string | NodeBaseOptions);
3564
2423
  inspectorSummary(): ReadonlyArray<NodeInspectorSummaryRow>;
@@ -3614,15 +2473,6 @@ declare class SubWorkflow<TInputJson$1 = unknown, TOutputJson$1 = unknown> imple
3614
2473
  }
3615
2474
  //#endregion
3616
2475
  //#region src/nodes/TestTriggerNode.d.ts
3617
- /**
3618
- * Author-defined test-fixture trigger. Live activation skips this trigger (filtered by
3619
- * `triggerKind === "test"` in `TriggerRuntimeService`); the `TestSuiteOrchestrator` drives its
3620
- * `generateItems` callback during a TestSuiteRun and dispatches one workflow run per yielded item.
3621
- *
3622
- * `setup` is intentionally a no-op for symmetry with other trigger nodes — the real work happens
3623
- * in the orchestrator. `execute` is a passthrough so items provided to `engine.runWorkflow(...)`
3624
- * (one per case) flow downstream unchanged on `main`.
3625
- */
3626
2476
  declare class TestTriggerNode implements TriggerNode<TestTriggerNodeConfig<any>> {
3627
2477
  kind: "trigger";
3628
2478
  outputPorts: readonly ["main"];
@@ -3635,33 +2485,12 @@ interface TestTriggerOptions<TOutputJson$1> {
3635
2485
  readonly name?: string;
3636
2486
  readonly id?: string;
3637
2487
  readonly icon?: string;
3638
- /** Cap on simultaneous in-flight test cases for one suite run. Default: 4 (orchestrator). */
3639
2488
  readonly concurrency?: number;
3640
2489
  readonly credentialRequirements?: ReadonlyArray<CredentialRequirement>;
3641
- /**
3642
- * Free-form description of where the test cases come from. Shown in the node properties
3643
- * panel and the Tests-tab suite-detail header so authors revisiting the workflow six months
3644
- * later remember which mailbox / folder / fixture file the cases originate from.
3645
- */
3646
2490
  readonly description?: string;
3647
- /**
3648
- * Author callback that yields one item per test case. Items are dispatched as separate
3649
- * workflow runs by the TestSuiteOrchestrator, with `executionOptions.testContext` set.
3650
- * The provided context exposes credential resolution and an AbortSignal for cancellation.
3651
- */
3652
2491
  generateItems(ctx: TestTriggerSetupContext<TestTrigger<TOutputJson$1>>): AsyncIterable<Item<TOutputJson$1>>;
3653
- /**
3654
- * Optional resolver: extract a human-readable label from a yielded item. The orchestrator
3655
- * persists this on the run, so the Tests-tab tree-table shows e.g. "RFQ for batch 14"
3656
- * instead of an opaque runId. Typical use: `(item) => item.json.subject` for mailbox tests.
3657
- */
3658
2492
  caseLabel?(item: Item<TOutputJson$1>): string | undefined;
3659
2493
  }
3660
- /**
3661
- * Trigger config for a test fixture source. Drop one (or more) of these on the canvas alongside
3662
- * a workflow's live triggers; clicking "Run tests" on the Tests tab invokes
3663
- * {@link TestTriggerOptions.generateItems} via the TestSuiteOrchestrator.
3664
- */
3665
2494
  declare class TestTrigger<TOutputJson$1 = unknown> implements TestTriggerNodeConfig<TOutputJson$1> {
3666
2495
  readonly kind: "trigger";
3667
2496
  readonly triggerKind: "test";
@@ -3700,7 +2529,6 @@ declare class Wait<TItemJson = unknown> implements RunnableNodeConfig<TItemJson,
3700
2529
  readonly execution: {
3701
2530
  readonly hint: "local";
3702
2531
  };
3703
- /** Pass-through empty batches should still advance to downstream nodes. */
3704
2532
  readonly continueWhenEmptyOutput: true;
3705
2533
  readonly icon: "lucide:hourglass";
3706
2534
  readonly id?: string;
@@ -3752,11 +2580,6 @@ declare class WebhookTrigger<TSchema extends WebhookInputSchema | undefined = un
3752
2580
  }
3753
2581
  //#endregion
3754
2582
  //#region src/nodes/webhookTriggerNode.d.ts
3755
- /**
3756
- * HTTP webhooks are not registered in trigger setup. The host exposes a single catch-all route
3757
- * (e.g. `/api/webhooks/:endpointPath`); the engine's catalog-backed webhook matcher resolves the
3758
- * user-defined endpoint path to this workflow + node, then runs the workflow from this trigger.
3759
- */
3760
2583
  declare class WebhookTriggerNode implements ExecutableTriggerNode<WebhookTrigger<any>> {
3761
2584
  readonly kind: "trigger";
3762
2585
  readonly outputPorts: readonly ["main"];
@@ -3764,12 +2587,17 @@ declare class WebhookTriggerNode implements ExecutableTriggerNode<WebhookTrigger
3764
2587
  execute(items: Items, _ctx: NodeExecutionContext<WebhookTrigger<any>>): Promise<NodeOutputs>;
3765
2588
  }
3766
2589
  //#endregion
2590
+ //#region src/nodes/schedulePollingTrigger.d.ts
2591
+ type ScheduleItem = {
2592
+ firedAt: string;
2593
+ tick: number;
2594
+ };
2595
+ type ScheduleState = {
2596
+ tick: number;
2597
+ };
2598
+ declare const schedulePollingTrigger: DefinedPollingTrigger<"schedule.interval", Readonly<Record<string, unknown>>, ScheduleItem, ScheduleState, undefined>;
2599
+ //#endregion
3767
2600
  //#region src/register.types.d.ts
3768
- /**
3769
- * Registrar for built-in nodes. In a real project, this would use tsyringe's
3770
- * container.registerSingleton(...). For the skeleton we keep it token-based:
3771
- * the engine resolves node implementations by class token.
3772
- */
3773
2601
  declare function registerCoreNodes(container: Container): void;
3774
2602
  //#endregion
3775
2603
  //#region src/workflowBuilder.types.d.ts
@@ -3884,10 +2712,6 @@ declare class WorkflowAuthoringBuilder {
3884
2712
  declare function workflow(id: string): WorkflowAuthoringBuilder;
3885
2713
  //#endregion
3886
2714
  //#region src/nodes/ConnectionCredentialNode.d.ts
3887
- /**
3888
- * Placeholder runnable node for connection-owned workflow nodes (LLM/tool slots).
3889
- * The engine does not schedule these; they exist for credentials, tokens, and UI identity.
3890
- */
3891
2715
  declare class ConnectionCredentialNode implements RunnableNode<ConnectionCredentialNodeConfig> {
3892
2716
  kind: "node";
3893
2717
  outputPorts: readonly ["main"];
@@ -3914,9 +2738,6 @@ declare class ConnectionCredentialNodeConfigFactory {
3914
2738
  }
3915
2739
  //#endregion
3916
2740
  //#region src/workflows/AIAgentConnectionWorkflowExpander.d.ts
3917
- /**
3918
- * Materializes connection-owned child nodes and {@link WorkflowDefinition.connections} for AI agent nodes.
3919
- */
3920
2741
  declare class AIAgentConnectionWorkflowExpander {
3921
2742
  private readonly connectionCredentialNodeConfigFactory;
3922
2743
  private readonly mcpServerResolver?;
@@ -3991,25 +2812,9 @@ declare const collectionDeleteNode: DefinedNode<"collection-delete", {
3991
2812
  }, undefined>;
3992
2813
  //#endregion
3993
2814
  //#region src/nodes/InboxApprovalNode.types.d.ts
3994
- /**
3995
- * A subject field (title / body) for an inbox approval. Either a static string
3996
- * or a contextual callback that builds the string from the item using ordinary
3997
- * JavaScript template literals — e.g. `({ item }) => `Approve ${item.json.vendor}``.
3998
- * Code-first: no template DSL, just functions.
3999
- */
4000
2815
  type InboxSubjectField = string | ((args: {
4001
2816
  item: Item;
4002
2817
  }) => string);
4003
- /**
4004
- * Auto-detecting inbox approval node.
4005
- *
4006
- * Uses `ctx.resolve(InboxChannelResolverToken)` to pick the right inbox channel
4007
- * at runtime:
4008
- * - In managed mode (PairingConfig present): routes to the control-plane inbox.
4009
- * - Otherwise: routes to the local inbox.
4010
- *
4011
- * Authors use this node directly; no extra wiring needed per deployment mode.
4012
- */
4013
2818
  declare const inboxApproval: DefinedHumanApprovalNode<"inbox.approval", {
4014
2819
  title: InboxSubjectField;
4015
2820
  body: InboxSubjectField;
@@ -4021,28 +2826,19 @@ declare const inboxApproval: DefinedHumanApprovalNode<"inbox.approval", {
4021
2826
  //#region src/nodes/codemationDocumentScannerNode.d.ts
4022
2827
  declare const ANALYZER_TYPES: readonly ["document", "invoice", "image", "auto"];
4023
2828
  type DocScannerAnalyzerType = (typeof ANALYZER_TYPES)[number];
4024
- /** Per-field value/confidence shape as returned by apps/doc-scanner. */
4025
2829
  type DocScannerField = Readonly<{
4026
2830
  value: unknown;
4027
2831
  confidence: number | null;
4028
2832
  }>;
4029
- /** Output shape of CodemationDocumentScanner — identical to the service wire response. */
4030
2833
  type DocScannerOutput = Readonly<{
4031
2834
  markdown: string;
4032
2835
  fields: Readonly<Record<string, DocScannerField>>;
4033
2836
  }>;
4034
2837
  type CodemationDocumentScannerConfig = Readonly<{
4035
- /** Key on `item.binary` that holds the document. Default: "data". */
4036
2838
  binaryField?: string;
4037
- /** Analyzer type. Default: "auto" (routes on mime type on the service side). */
4038
2839
  analyzerType?: DocScannerAnalyzerType;
4039
- /** MIME type override. Falls back to attachment.mimeType. */
4040
2840
  contentType?: string;
4041
- /** Include per-field confidence scores (0–1). Default: false.
4042
- * Enabling this roughly doubles contextualization tokens for document analyzers.
4043
- * Image and auto-to-image requests silently ignore this flag (confidence stays null). */
4044
2841
  includeConfidence?: boolean;
4045
- /** Max bytes checked before any read. Default: 50 MiB (same cap as OCR nodes, LD10). */
4046
2842
  maxBytes?: number;
4047
2843
  }>;
4048
2844
  declare const codemationDocumentScannerNode: DefinedNode<"codemation.document-scanner", {
@@ -4056,5 +2852,5 @@ declare const codemationDocumentScannerNode: DefinedNode<"codemation.document-sc
4056
2852
  fields: Readonly<Record<string, DocScannerField>>;
4057
2853
  }>, undefined>;
4058
2854
  //#endregion
4059
- export { AIAgent, AIAgentConnectionWorkflowExpander, AIAgentExecutionHelpersFactory, AIAgentNode, AgentItemPortMap, AgentMessageFactory, AgentOutputFactory, AgentStructuredOutputRepairPromptFactory, AgentStructuredOutputRunner, AgentToolCallPortMap, AgentToolErrorClassifier, AgentToolExecutionCoordinator, AgentToolRepairExhaustedError, AgentToolRepairPolicy, Aggregate, AggregateNode, Assertion, AssertionNode, AssertionOptions, BM25Index, BinaryRef, Callback, CallbackHandler, CallbackNode, CallbackOptions, CallbackResultNormalizer, CanvasIconName, CodemationChatModelConfig, CodemationChatModelFactory, CodemationDocumentScannerConfig, ConnectionCredentialExecutionContextFactory, ConnectionCredentialNode, ConnectionCredentialNodeConfig, ConnectionCredentialNodeConfigFactory, CredentialSession, CronTickJson, CronTrigger, CronTriggerNode, DeferredMetaToolStrategy, DeferredMetaToolStrategyFactory, DefineRestNodeOptions, DocScannerAnalyzerType, DocScannerField, DocScannerOutput, type ExecutedToolCall, Filter, FilterNode, type FindToolsResult, HTTP_REQUEST_ACCEPTED_CREDENTIAL_TYPES, HttpBodySpec, HttpCredentialDelta, HttpRequest, HttpRequestDownloadMode, HttpRequestNode, HttpRequestOutputJson, HttpRequestResult, HttpRequestSpec, If, IfNode, IsTestRun, IsTestRunNode, type ItemScopedToolBinding, ManagedComplexity, ManualTrigger, ManualTriggerNode, MapData, MapDataNode, MapDataOptions, Merge, MergeMode, MergeNode, NoOp, NoOpNode, NodeBaseOptions, OpenAIChatModelConfig, OpenAIChatModelFactory, OpenAiChatModelPresets, OpenAiCredentialSession, OpenAiStrictJsonSchemaFactory, type PlannedToolCall, type ResolvedTool, RestNodeApi, RestNodeErrorPolicy, RestNodeRequestShape, RestNodeResponseContext, SSRFBlockedError, Split, SplitNode, SsrfGuard, SubWorkflow, SubWorkflowNode, Switch, SwitchCaseKeyResolver, SwitchNode, TestTrigger, TestTriggerNode, TestTriggerOptions, type ToolLoadingStrategy, type ToolLoadingStrategyInitInput, type ToolLoadingStrategyTurnContext, Wait, WaitDuration, WaitNode, WebhookRespondNowAndContinueError, WebhookRespondNowError, WebhookTrigger, WebhookTriggerNode, type WorkflowAgentMessages, type WorkflowAgentOptions, WorkflowAuthoringBuilder, WorkflowBranchBuilder, WorkflowChain, apiKeyCredentialType, basicAuthCredentialType, bearerTokenCredentialType, codemationDocumentScannerNode, collectionDeleteNode, collectionFindOneNode, collectionGetNode, collectionInsertNode, collectionListNode, collectionUpdateNode, createWorkflowBuilder, defineRestNode, inboxApproval, oauth2ClientCredentialsType, openAiChatModelPresets, registerCoreNodes, workflow };
2855
+ export { AIAgent, AIAgentConnectionWorkflowExpander, AIAgentExecutionHelpersFactory, AIAgentNode, AgentItemPortMap, AgentMessageFactory, AgentOutputFactory, AgentStructuredOutputRepairPromptFactory, AgentStructuredOutputRunner, AgentToolCallPortMap, AgentToolErrorClassifier, AgentToolExecutionCoordinator, AgentToolRepairExhaustedError, AgentToolRepairPolicy, Aggregate, AggregateNode, Assertion, AssertionNode, AssertionOptions, BM25Index, BinaryRef, Callback, CallbackHandler, CallbackNode, CallbackOptions, CallbackResultNormalizer, CanvasIconName, CodemationChatModelConfig, CodemationChatModelFactory, CodemationDocumentScannerConfig, ConnectionCredentialExecutionContextFactory, ConnectionCredentialNode, ConnectionCredentialNodeConfig, ConnectionCredentialNodeConfigFactory, CredentialSession, CronTickJson, CronTrigger, CronTriggerNode, DeferredMetaToolStrategy, DeferredMetaToolStrategyFactory, DefineRestNodeOptions, DocScannerAnalyzerType, DocScannerField, DocScannerOutput, type ExecutedToolCall, Filter, FilterNode, type FindToolsResult, HTTP_REQUEST_ACCEPTED_CREDENTIAL_TYPES, HttpBodySpec, HttpCredentialDelta, HttpRequest, HttpRequestDownloadMode, HttpRequestNode, HttpRequestOutputJson, HttpRequestResult, HttpRequestSpec, If, IfNode, IsTestRun, IsTestRunNode, type ItemScopedToolBinding, ManagedComplexity, ManualTrigger, ManualTriggerNode, MapData, MapDataNode, MapDataOptions, Merge, MergeMode, MergeNode, NoOp, NoOpNode, NodeBaseOptions, OpenAIChatModelConfig, OpenAIChatModelFactory, OpenAiChatModelPresets, OpenAiCredentialSession, OpenAiStrictJsonSchemaFactory, type PlannedToolCall, type ResolvedTool, RestNodeApi, RestNodeErrorPolicy, RestNodeRequestShape, RestNodeResponseContext, SSRFBlockedError, Split, SplitNode, SsrfGuard, SubWorkflow, SubWorkflowNode, Switch, SwitchCaseKeyResolver, SwitchNode, TestTrigger, TestTriggerNode, TestTriggerOptions, type ToolLoadingStrategy, type ToolLoadingStrategyInitInput, type ToolLoadingStrategyTurnContext, Wait, WaitDuration, WaitNode, WebhookRespondNowAndContinueError, WebhookRespondNowError, WebhookTrigger, WebhookTriggerNode, type WorkflowAgentMessages, type WorkflowAgentOptions, WorkflowAuthoringBuilder, WorkflowBranchBuilder, WorkflowChain, apiKeyCredentialType, basicAuthCredentialType, bearerTokenCredentialType, codemationDocumentScannerNode, collectionDeleteNode, collectionFindOneNode, collectionGetNode, collectionInsertNode, collectionListNode, collectionUpdateNode, createWorkflowBuilder, defineRestNode, inboxApproval, oauth2ClientCredentialsType, openAiChatModelPresets, registerCoreNodes, schedulePollingTrigger, workflow };
4060
2856
  //# sourceMappingURL=index.d.ts.map