@codemation/core-nodes-ocr 0.2.7 → 0.2.8

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.
@@ -3,11 +3,6 @@ import { DependencyContainer as Container, InjectionToken as TypeToken } from "t
3
3
  import { ReadableStream as ReadableStream$1 } from "node:stream/web";
4
4
 
5
5
  //#region ../core/src/contracts/baseTypes.d.ts
6
- /**
7
- * Minimal base types that have no dependencies on other contracts.
8
- * Used by credentialTypes, workflowTypes, and other contract layers
9
- * to avoid circular dependencies.
10
- */
11
6
  type WorkflowId = string;
12
7
  type NodeId = string;
13
8
  type OutputPortKey = string;
@@ -93,13 +88,6 @@ interface TelemetrySpanScope extends TelemetryScope {
93
88
  readonly traceId: string;
94
89
  readonly spanId: string;
95
90
  end(args?: TelemetrySpanEnd): Promise<void> | void;
96
- /**
97
- * Lift this span into a {@link NodeExecutionTelemetry} scoped to a different (nodeId, activationId).
98
- * Children created via the returned telemetry's `startChildSpan` get this span as their parent.
99
- *
100
- * Used at the sub-agent boundary so that nested runtime telemetry parents under the agent.tool.call
101
- * span instead of the orchestrator's node-level span.
102
- */
103
91
  asNodeTelemetry(args: Readonly<{
104
92
  nodeId: NodeId;
105
93
  activationId: NodeActivationId;
@@ -125,9 +113,6 @@ type ItemExprResolvedContext = Readonly<{
125
113
  activationId: NodeActivationId;
126
114
  data: RunDataSnapshot;
127
115
  }>;
128
- /**
129
- * Context aligned with former {@link ItemInputMapperContext} — use **`data`** to read any completed upstream node.
130
- */
131
116
  type ItemExprContext = ItemExprResolvedContext;
132
117
  type ItemExprArgs<TItemJson = unknown> = Readonly<{
133
118
  item: Item<TItemJson>;
@@ -146,30 +131,21 @@ type Expr<T, TItemJson = unknown> = ItemExpr<T, TItemJson>;
146
131
  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);
147
132
  //#endregion
148
133
  //#region ../core/src/contracts/retryPolicySpec.types.d.ts
149
- /**
150
- * In-process retry policy for runnable nodes. Serialized configs use the same
151
- * `kind` discriminator (`JSON.stringify` / persisted workflows).
152
- *
153
- * `maxAttempts` is the total number of tries including the first (e.g. 3 means up to 2 delays after failures).
154
- */
155
134
  type RetryPolicySpec = NoneRetryPolicySpec | FixedRetryPolicySpec | ExponentialRetryPolicySpec;
156
135
  interface NoneRetryPolicySpec {
157
136
  readonly kind: "none";
158
137
  }
159
138
  interface FixedRetryPolicySpec {
160
139
  readonly kind: "fixed";
161
- /** Total attempts including the first execution. Must be >= 1. */
162
140
  readonly maxAttempts: number;
163
141
  readonly delayMs: number;
164
142
  }
165
143
  interface ExponentialRetryPolicySpec {
166
144
  readonly kind: "exponential";
167
- /** Total attempts including the first execution. Must be >= 1. */
168
145
  readonly maxAttempts: number;
169
146
  readonly initialDelayMs: number;
170
147
  readonly multiplier: number;
171
148
  readonly maxDelayMs?: number;
172
- /** When true, each delay is multiplied by a random factor in [1, 1.2). */
173
149
  readonly jitter?: boolean;
174
150
  }
175
151
  //#endregion
@@ -185,22 +161,11 @@ type CredentialFieldSchema = Readonly<{
185
161
  type: "string" | "password" | "textarea" | "json" | "boolean";
186
162
  required?: true;
187
163
  order?: number;
188
- /**
189
- * Where this field appears in the credential dialog. Use `"advanced"` for optional or
190
- * power-user fields; they render inside a collapsible section (see `CredentialTypeDefinition.advancedSection`).
191
- * Defaults to `"default"` when omitted.
192
- */
193
164
  visibility?: "default" | "advanced";
194
165
  placeholder?: string;
195
166
  helpText?: string;
196
- /** When set, host resolves this field from process.env at runtime; env wins over stored values. */
197
167
  envVarName?: string;
198
- /**
199
- * When set, the dialog shows a copy action for this exact string (e.g. a static OAuth redirect URI
200
- * pattern or documentation URL). Do not use for secret values.
201
- */
202
168
  copyValue?: string;
203
- /** Accessible label for the copy control (default: Copy). */
204
169
  copyButtonLabel?: string;
205
170
  }>;
206
171
  type CredentialRequirement = Readonly<{
@@ -245,20 +210,9 @@ type CredentialOAuth2AuthDefinition = Readonly<{
245
210
  clientSecretFieldKey?: string;
246
211
  } | {
247
212
  kind: "oauth2";
248
- /**
249
- * Free-form provider identifier for telemetry, DB rows, and Better Auth provider naming.
250
- * Not used for any registry lookup — URLs come from {@link authorizeUrl} / {@link tokenUrl}.
251
- */
252
213
  providerId: string;
253
- /**
254
- * Authorization endpoint. May contain `{publicFieldKey}` placeholders that the runtime
255
- * substitutes from the credential's resolved public config (URL-encoded).
256
- * Example: `https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/authorize`
257
- */
258
214
  authorizeUrl: string;
259
- /** Token endpoint. Same templating rules as {@link authorizeUrl}. */
260
215
  tokenUrl: string;
261
- /** Optional userinfo endpoint. Same templating rules as {@link authorizeUrl}. */
262
216
  userInfoUrl?: string;
263
217
  scopes: ReadonlyArray<string>;
264
218
  scopesFromPublicConfig?: CredentialOAuth2ScopesFromPublicConfig;
@@ -267,11 +221,8 @@ type CredentialOAuth2AuthDefinition = Readonly<{
267
221
  }>;
268
222
  type CredentialAuthDefinition = CredentialOAuth2AuthDefinition;
269
223
  type CredentialAdvancedSectionPresentation = Readonly<{
270
- /** Collapsible section title (default: "Advanced"). */
271
224
  title?: string;
272
- /** Optional short helper text shown inside the section (above the fields). */
273
225
  description?: string;
274
- /** When true, the advanced section starts expanded. Default: false (collapsed). */
275
226
  defaultOpen?: boolean;
276
227
  }>;
277
228
  type CredentialTypeDefinition = Readonly<{
@@ -280,23 +231,11 @@ type CredentialTypeDefinition = Readonly<{
280
231
  description?: string;
281
232
  publicFields?: ReadonlyArray<CredentialFieldSchema>;
282
233
  secretFields?: ReadonlyArray<CredentialFieldSchema>;
283
- /**
284
- * Optional labels for the collapsible block that contains every field with `visibility: "advanced"`.
285
- * If omitted, the UI still shows that block with defaults (title "Advanced", collapsed).
286
- */
287
234
  advancedSection?: CredentialAdvancedSectionPresentation;
288
235
  supportedSourceKinds?: ReadonlyArray<CredentialMaterialSourceKind>;
289
236
  auth?: CredentialAuthDefinition;
290
237
  }>;
291
- /**
292
- * JSON-shaped credential field bag (public config, resolved secret material, etc.).
293
- */
294
238
  type CredentialJsonRecord = Readonly<Record<string, unknown>>;
295
- /**
296
- * Persisted credential instance with typed `publicConfig`.
297
- * Hosts may specialize `secretRef` with a stricter union while remaining
298
- * assignable here for session/test callbacks.
299
- */
300
239
  type CredentialInstanceRecord<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord> = Readonly<{
301
240
  instanceId: CredentialInstanceId;
302
241
  typeId: CredentialTypeId;
@@ -308,110 +247,63 @@ type CredentialInstanceRecord<TPublicConfig extends CredentialJsonRecord = Crede
308
247
  setupStatus: CredentialSetupStatus;
309
248
  createdAt: string;
310
249
  updatedAt: string;
311
- /**
312
- * Pointer to where the credential material bytes live. For OSS / standalone
313
- * rows this is `{source: "local", ref: instanceId}` and the bytes co-locate
314
- * with the row in the workspace DB. For managed-mode rows this is
315
- * `{source: "control-plane", ref: <cp_id>}` and the bytes live at CP.
316
- *
317
- * The seam is read through `CredentialMaterialProvider`. See
318
- * `docs/design/credentials-oauth-unification.md` ("Material provider seam").
319
- */
320
250
  material: Readonly<{
321
251
  source: "local" | "control-plane";
322
252
  ref: string;
323
253
  }>;
324
254
  }>;
325
- /**
326
- * Arguments passed to `CredentialType.createSession` and `CredentialType.test`.
327
- * Declare `TPublicConfig` / `TMaterial` on `CredentialType` so implementations are checked
328
- * against your credential shapes (similar to `NodeExecutionContext.config` for nodes).
329
- */
330
255
  type CredentialSessionFactoryArgs<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord> = Readonly<{
331
256
  instance: CredentialInstanceRecord<TPublicConfig>;
332
257
  material: TMaterial;
333
258
  publicConfig: TPublicConfig;
334
259
  }>;
335
260
  type CredentialSessionFactory<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord, TSession = unknown> = (args: CredentialSessionFactoryArgs<TPublicConfig, TMaterial>) => Promise<TSession>;
261
+ type CredentialAccessTokenSessionArgs<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord> = Readonly<{
262
+ accessToken: string;
263
+ grantedScopes: ReadonlyArray<string>;
264
+ publicConfig: TPublicConfig;
265
+ }>;
266
+ type CredentialAccessTokenSessionFactory<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TSession = unknown> = (args: CredentialAccessTokenSessionArgs<TPublicConfig>) => Promise<TSession>;
336
267
  type CredentialHealthTester<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord> = (args: CredentialSessionFactoryArgs<TPublicConfig, TMaterial>) => Promise<CredentialHealth>;
337
- /**
338
- * Full credential type implementation: `definition` (UI/schema), `createSession`, and `test`.
339
- * Use this at registration and config boundaries; `CredentialTypeDefinition` is only the schema slice.
340
- */
341
268
  type CredentialType<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord, TSession = unknown> = Readonly<{
342
269
  definition: CredentialTypeDefinition;
343
270
  createSession: CredentialSessionFactory<TPublicConfig, TMaterial, TSession>;
271
+ createSessionFromAccessToken?: CredentialAccessTokenSessionFactory<TPublicConfig, TSession>;
344
272
  test: CredentialHealthTester<TPublicConfig, TMaterial>;
345
273
  }>;
346
- /**
347
- * Credential type with unspecified generics — used for `CodemationConfig.credentialTypes`, the host registry,
348
- * and anywhere a concrete `CredentialType<YourPublic, YourMaterial, YourSession>` is placed in a heterogeneous list.
349
- * Using `any` here avoids unsafe `as` casts while keeping typed `satisfies CredentialType<…>` definitions.
350
- */
351
274
  type AnyCredentialType = CredentialType<any, any, unknown>;
352
275
  //#endregion
353
276
  //#region ../core/src/contracts/mcpTypes.d.ts
354
277
  type McpServerTransport = "http";
355
278
  interface McpServerDeclaration {
356
- /** Globally unique slug, e.g. "gmail". Workflow authors reference this. */
357
279
  id: string;
358
280
  displayName: string;
359
281
  description: string;
360
282
  transport: McpServerTransport;
361
283
  url: string;
362
- /**
363
- * Credential types accepted by this MCP server, matching CredentialRequirement.acceptedTypes.
364
- * Absent or empty means no credential is required.
365
- */
366
284
  acceptedCredentialTypes?: ReadonlyArray<string>;
367
- /**
368
- * Documentation only in MVP. The bind-time validator checks
369
- * requiredScopes ⊆ CredentialInstance.scopesGranted.
370
- */
371
285
  requiredScopes?: string[];
372
- /** Non-secret static headers merged onto every MCP request. */
373
286
  staticHeaders?: Record<string, string>;
374
- /**
375
- * Overrides for tool descriptions advertised by the MCP server.
376
- * Applied by the connection pool after tools/list.
377
- * Key: exact tool name as returned by the server.
378
- */
379
287
  toolDescriptionOverrides?: Record<string, string>;
380
288
  }
381
289
  //#endregion
382
290
  //#region ../core/src/contracts/collectionTypes.d.ts
383
- /**
384
- * Represents a typed store for a single collection.
385
- * All rows include auto-managed id, created_at, and updated_at fields.
386
- */
387
291
  interface CollectionStore<TRow extends Record<string, unknown> = Record<string, unknown>> {
388
- /**
389
- * Insert a new row. id, created_at, and updated_at are auto-populated.
390
- */
391
292
  insert(row: TRow): Promise<TRow & {
392
293
  id: string;
393
294
  created_at: Date;
394
295
  updated_at: Date;
395
296
  }>;
396
- /**
397
- * Get a single row by id.
398
- */
399
297
  get(id: string): Promise<(TRow & {
400
298
  id: string;
401
299
  created_at: Date;
402
300
  updated_at: Date;
403
301
  }) | null>;
404
- /**
405
- * Find a single row matching the provided filter.
406
- */
407
302
  findOne(filter: Partial<TRow>): Promise<(TRow & {
408
303
  id: string;
409
304
  created_at: Date;
410
305
  updated_at: Date;
411
306
  }) | null>;
412
- /**
413
- * List rows with optional pagination and filtering.
414
- */
415
307
  list(opts?: {
416
308
  limit?: number;
417
309
  offset?: number;
@@ -424,41 +316,18 @@ interface CollectionStore<TRow extends Record<string, unknown> = Record<string,
424
316
  }>;
425
317
  total: number;
426
318
  }>;
427
- /**
428
- * Update a row by id with partial data.
429
- */
430
319
  update(id: string, patch: Partial<TRow>): Promise<TRow & {
431
320
  id: string;
432
321
  created_at: Date;
433
322
  updated_at: Date;
434
323
  }>;
435
- /**
436
- * Delete a row by id. Hard delete only (no soft delete).
437
- */
438
324
  delete(id: string): Promise<{
439
325
  deleted: boolean;
440
326
  }>;
441
327
  }
442
- /**
443
- * Runtime collections context: keyed by collection name.
444
- */
445
328
  type CollectionsContext = Readonly<Record<string, CollectionStore>>;
446
329
  //#endregion
447
330
  //#region ../core/src/authoring/nodeBaseOptions.types.d.ts
448
- /**
449
- * Core-local copy of the per-instance authoring options every `define*` factory's `create(...)`
450
- * accepts in its trailing argument: a stable `id` plus a plain-language `description` (the
451
- * non-technical "what does this step do" line surfaced in the node sidebar).
452
- *
453
- * `description` is a first-class option — passed inline exactly like `id` — and is threaded onto
454
- * the config instance as an OWN ENUMERABLE field so it flows into the persisted workflow snapshot
455
- * (`WorkflowSnapshotCodec` serializes via `JSON.parse(JSON.stringify(config))`, which only captures
456
- * own enumerable properties — never a getter).
457
- *
458
- * `@codemation/core-nodes` declares an identical `NodeBaseOptions` for its bare-id built-in nodes;
459
- * core keeps its own copy because core must not depend on `@codemation/core-nodes` (dependency
460
- * direction). The two types are structurally identical by design.
461
- */
462
331
  interface NodeBaseOptions {
463
332
  readonly id?: string;
464
333
  readonly description?: string;
@@ -495,20 +364,9 @@ interface EngineExecutionLimitsPolicyConfig {
495
364
  }
496
365
  //#endregion
497
366
  //#region ../core/src/contracts/runTypes.d.ts
498
- /**
499
- * Test-suite linkage for a run. When set, this run was started by a TestSuiteOrchestrator
500
- * as one test case inside a TestSuiteRun. The `IsTestRun` node and host-side persisters key
501
- * off the presence of this field. Subworkflow runs inherit it from their parent run.
502
- */
503
367
  interface RunTestContext {
504
368
  readonly testSuiteRunId: string;
505
369
  readonly testCaseIndex: number;
506
- /**
507
- * Optional human-friendly label for this test case (e.g. an email subject when fixtures
508
- * are loaded from a mailbox). Resolved per item by `TestTrigger.caseLabel(item)` if set,
509
- * persisted on `Run.test_case_label` so the Tests-tab tree-table can show "RFQ for batch 14"
510
- * instead of "run_1777755971399_bbb86beac1396".
511
- */
512
370
  readonly testCaseLabel?: string;
513
371
  }
514
372
  type NodeInputsByPort = Readonly<Record<InputPortKey, Items>>;
@@ -519,9 +377,7 @@ interface NodeExecutionError {
519
377
  stack?: string;
520
378
  details?: JsonValue;
521
379
  }
522
- /** Stable id for a single connection invocation row in {@link ConnectionInvocationRecord}. */
523
380
  type ConnectionInvocationId = string;
524
- /** Arguments for appending a {@link ConnectionInvocationRecord} (engine fills run/workflow ids and timestamps). */
525
381
  type ConnectionInvocationAppendArgs = Readonly<{
526
382
  invocationId: ConnectionInvocationId;
527
383
  connectionNodeId: NodeId;
@@ -562,11 +418,6 @@ interface Edge {
562
418
  input: InputPortKey;
563
419
  };
564
420
  }
565
- /**
566
- * Named connection from a parent node to child nodes that exist in {@link WorkflowDefinition.nodes}
567
- * but are not traversed by the main execution graph. Parents are commonly executable nodes, but may
568
- * also be connection-owned nodes for recursive agent attachments.
569
- */
570
421
  interface WorkflowNodeConnection {
571
422
  readonly parentNodeId: NodeId;
572
423
  readonly connectionName: NodeConnectionName;
@@ -577,18 +428,10 @@ interface WorkflowDefinition {
577
428
  name: string;
578
429
  nodes: NodeDefinition[];
579
430
  edges: Edge[];
580
- /**
581
- * Optional metadata: which nodes are connection-owned children (e.g. AI agent `llm` / `tools` slots).
582
- * When omitted, all nodes in {@link nodes} are treated as executable for topology.
583
- */
584
431
  readonly connections?: ReadonlyArray<WorkflowNodeConnection>;
585
- /** Directory + file-stem path under a workflow discovery root (for UI grouping only). */
586
432
  discoveryPathSegments?: readonly string[];
587
- /** Retention for run JSON and binaries (seconds). Host/env may supply defaults when omitted. */
588
433
  readonly prunePolicy?: WorkflowPrunePolicySpec;
589
- /** Whether to keep run data after completion. Host/env may supply defaults when omitted. */
590
434
  readonly storagePolicy?: WorkflowStoragePolicySpec;
591
- /** Invoked after a node fails permanently (retries exhausted) and node error handler did not recover. */
592
435
  readonly workflowErrorHandler?: WorkflowErrorHandlerSpec;
593
436
  }
594
437
  interface NodeConfigBase {
@@ -597,83 +440,31 @@ interface NodeConfigBase {
597
440
  readonly name?: string;
598
441
  readonly id?: NodeId;
599
442
  readonly icon?: string;
600
- /**
601
- * Plain-language, non-technical explanation of what this node does, surfaced in the workflow
602
- * inspector / node properties sidebar. A first-class config option every authorable node accepts
603
- * directly (alongside `id`), so it flows into the persisted config the mappers read. Distinct from
604
- * {@link inspectorSummary} (config-derived label/value rows).
605
- */
606
443
  readonly description?: string;
607
444
  readonly execution?: Readonly<{
608
445
  hint?: "local" | "worker";
609
446
  queue?: string;
610
447
  }>;
611
- /** In-process execute retries (runnable nodes). Triggers typically omit this. */
612
448
  readonly retryPolicy?: RetryPolicySpec;
613
- /** Recover from execute failures; return outputs to continue, or rethrow to fail the node. */
614
449
  readonly nodeErrorHandler?: NodeErrorHandlerSpec;
615
- /**
616
- * When true, edges carrying zero items on an output port still schedule single-input downstream nodes.
617
- * Decided from the **source** node that produced the (empty) output. Default (false/undefined): empty
618
- * main batches skip downstream execution and propagate the empty path.
619
- */
620
450
  readonly continueWhenEmptyOutput?: boolean;
621
- /**
622
- * Declared I/O port names for canvas authoring (unioned with ports inferred from edges).
623
- * Use for dynamic routers (Switch) and future error ports.
624
- */
625
451
  readonly declaredOutputPorts?: ReadonlyArray<OutputPortKey>;
626
452
  readonly declaredInputPorts?: ReadonlyArray<InputPortKey>;
627
453
  getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
628
- /**
629
- * Marker: this node emits {@link import("./assertionTypes").AssertionResult}-shaped items on its
630
- * `main` port. The TestSuiteOrchestrator (and host-side TestAssertionPersister) listen for
631
- * `nodeCompleted` events from nodes with this flag set, and persist their output items as
632
- * TestAssertion records (only when the run carries a `testContext`). Set on assertion node
633
- * configs (e.g. `AssertionNodeConfig`, `StringEqualsAssertionNodeConfig`).
634
- */
635
454
  readonly emitsAssertions?: true;
636
- /**
637
- * Static configuration summary surfaced in the workflow inspector — the design-time
638
- * "what does this node do" panel that renders before any run telemetry exists.
639
- *
640
- * Return 2–6 short label/value pairs derived from this config (method + url for an HTTP
641
- * call, model + tool list for an agent, schedule + timezone for a cron trigger, etc.).
642
- * Values are truncated by the UI; aim for one line each. Return `undefined` to opt out
643
- * — the inspector hides the section when no rows are produced.
644
- *
645
- * Implement on the config class instance so the function can read sibling config fields.
646
- * `defineNode({ inspectorSummary })` plumbs through to this.
647
- */
648
455
  inspectorSummary?(): ReadonlyArray<NodeInspectorSummaryRow> | undefined;
649
456
  }
650
- /**
651
- * One row of a node's static configuration summary. See {@link NodeConfigBase.inspectorSummary}.
652
- */
653
457
  interface NodeInspectorSummaryRow {
654
458
  readonly label: string;
655
459
  readonly value: string;
656
460
  }
657
461
  declare const runnableNodeInputType: unique symbol;
658
462
  declare const runnableNodeOutputType: unique symbol;
659
- /**
660
- * Runnable node: **`TInputJson`** is what **`inputSchema`** validates on **`item.json`** (the wire payload).
661
- * **`TOutputJson`** is emitted `item.json` on outputs.
662
- */
663
463
  interface RunnableNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> extends NodeConfigBase {
664
464
  readonly kind: "node";
665
465
  readonly [runnableNodeInputType]?: TInputJson$1;
666
466
  readonly [runnableNodeOutputType]?: TOutputJson$1;
667
- /**
668
- * Optional Zod input contract for {@link RunnableNode} when not set on the node class.
669
- * Resolution order: node instance `inputSchema`, then config `inputSchema`, then `z.unknown()`.
670
- */
671
467
  readonly inputSchema?: ZodType<TInputJson$1>;
672
- /**
673
- * When an activation receives **zero** input items, the engine normally runs `execute` zero times.
674
- * Set to **`runOnce`** to run `execute` once with an empty `items` batch (and a synthetic wire item for schema parsing).
675
- * Used by batch-style callback nodes (built-in `Callback`) so `callback([], ctx)` still runs.
676
- */
677
468
  readonly emptyBatchExecution?: "skip" | "runOnce";
678
469
  }
679
470
  interface NodeDefinition {
@@ -715,27 +506,14 @@ type Items<TJson = unknown> = ReadonlyArray<Item<TJson>>;
715
506
  type NodeOutputs = Partial<Record<OutputPortKey, Items>>;
716
507
  type RunId = string;
717
508
  type NodeActivationId = string;
718
- /**
719
- * One per-item iteration of a runnable node's execute loop. Refines `NodeActivationId` for
720
- * per-item connection invocations and telemetry. Undefined when the executing node is a batch
721
- * node or trigger that does not iterate items.
722
- */
723
509
  type NodeIterationId = string;
724
510
  interface ParentExecutionRef {
725
511
  runId: RunId;
726
512
  workflowId: WorkflowId;
727
513
  nodeId: NodeId;
728
- /** Subworkflow depth of the **spawning** run (0 = root). Passed when starting a child run. */
729
514
  subworkflowDepth?: number;
730
- /** Effective max node activations from the parent run (propagated to child policy merge). */
731
515
  engineMaxNodeActivations?: number;
732
- /** Effective max subworkflow depth from the parent run (propagated to child policy merge). */
733
516
  engineMaxSubworkflowDepth?: number;
734
- /**
735
- * Test-suite linkage inherited by the child subworkflow run. Set by whichever node
736
- * spawns the subworkflow when its own `ctx.testContext` is present, so assertions
737
- * emitted inside a subworkflow land under the correct parent test case.
738
- */
739
517
  testContext?: RunTestContext;
740
518
  }
741
519
  interface RunDataSnapshot {
@@ -743,7 +521,6 @@ interface RunDataSnapshot {
743
521
  getOutputItems<TJson = unknown>(nodeId: NodeId | NodeIdRef<TJson>, output?: OutputPortKey): Items<TJson>;
744
522
  getOutputItem<TJson = unknown>(nodeId: NodeId | NodeIdRef<TJson>, itemIndex: number, output?: OutputPortKey): Item<TJson> | undefined;
745
523
  }
746
- /** Whether to persist run execution data after the workflow finishes. */
747
524
  type WorkflowStoragePolicyMode = "ALL" | "SUCCESS" | "ERROR" | "NEVER";
748
525
  type WorkflowStoragePolicySpec = WorkflowStoragePolicyMode | TypeToken<WorkflowStoragePolicyResolver>;
749
526
  interface WorkflowStoragePolicyResolver {
@@ -790,36 +567,19 @@ interface NodeErrorHandler {
790
567
  type NodeErrorHandlerSpec = TypeToken<NodeErrorHandler> | NodeErrorHandler;
791
568
  //#endregion
792
569
  //#region ../core/src/contracts/runtimeTypes.d.ts
793
- /** Opaque unique identifier for a single HumanTask instance. */
794
570
  type HumanTaskId = string;
795
- /**
796
- * Minimal handle handed to the `deliver` callback so it can route to the correct
797
- * inbox channel.
798
- */
799
571
  interface HumanTaskHandle {
800
572
  readonly taskId: HumanTaskId;
801
573
  readonly runId: string;
802
574
  readonly nodeId: string;
803
575
  readonly expiresAt: Date;
804
- /** TODO: real signed URL; placeholder empty string for now. */
805
576
  readonly resumeUrl: string;
806
- /**
807
- * Arbitrary JSON metadata copied from `SuspensionRequest.request.metadata` at suspension time.
808
- * Used by the agent runtime to round-trip the `agentCheckpoint` back to the
809
- * resumed node via `ctx.resumeContext.task.metadata`.
810
- */
811
577
  readonly metadata?: Readonly<Record<string, JsonValue>>;
812
578
  }
813
- /** Identity of the person who made a decision on the task. */
814
579
  interface HumanTaskActor {
815
580
  readonly actorId: string;
816
581
  readonly displayName?: string;
817
582
  }
818
- /**
819
- * Resume context injected into `NodeExecutionContext` when the engine re-activates
820
- * a previously suspended node. `defineHumanApprovalNode` wraps this with parsed
821
- * `TDecision`; at the engine layer `decision.value` is `unknown`.
822
- */
823
583
  interface ResumeContext {
824
584
  readonly decision: Readonly<{
825
585
  kind: "decided";
@@ -860,11 +620,6 @@ interface NodeExecutionStatePublisher {
860
620
  error: Error;
861
621
  }): Promise<void>;
862
622
  appendConnectionInvocation(args: ConnectionInvocationAppendArgs): Promise<void>;
863
- /**
864
- * Annotates the current snapshot for `nodeId` with the id of the child run spawned by a
865
- * SubWorkflow invocation. Called from `SubWorkflowNode.execute` after `runById` resolves.
866
- * The engine's subsequent `markCompleted` call preserves the value via `previous.childRunId`.
867
- */
868
623
  setChildRunId?(args: {
869
624
  nodeId: NodeId;
870
625
  childRunId: RunId;
@@ -892,32 +647,16 @@ interface ExecutionBinaryService {
892
647
  activationId: NodeActivationId;
893
648
  }): NodeBinaryAttachmentService;
894
649
  openReadStream(attachment: BinaryAttachment): Promise<BinaryStorageReadResult | undefined>;
895
- /**
896
- * Reads all bytes from the attachment into a contiguous `Uint8Array`.
897
- * Checks `attachment.size` against `maxBytes` *before* any allocation; throws a bounded-read
898
- * error when exceeded (no OOM). Throws if the stream is unavailable or the byte count mismatches.
899
- */
900
650
  getBytes(attachment: BinaryAttachment, maxBytes?: number): Promise<Uint8Array>;
901
- /**
902
- * Reads the attachment and decodes the bytes as UTF-8 text.
903
- * Subject to the same bounded-read safety as `getBytes`.
904
- */
905
651
  getText(attachment: BinaryAttachment, maxBytes?: number): Promise<string>;
906
- /**
907
- * Reads the attachment, decodes as UTF-8 text, and parses as JSON.
908
- * Throws a clear error on invalid JSON. Subject to the same bounded-read safety.
909
- */
910
652
  getJson<T = unknown>(attachment: BinaryAttachment, maxBytes?: number): Promise<T>;
911
653
  }
912
654
  interface ExecutionContext {
913
655
  runId: RunId;
914
656
  workflowId: WorkflowId;
915
657
  parent?: ParentExecutionRef;
916
- /** This run's subworkflow depth (0 = root). */
917
658
  subworkflowDepth: number;
918
- /** Effective activation budget cap for this run (after policy merge). */
919
659
  engineMaxNodeActivations: number;
920
- /** Effective subworkflow nesting cap for this run (after policy merge). */
921
660
  engineMaxSubworkflowDepth: number;
922
661
  now: () => Date;
923
662
  data: RunDataSnapshot;
@@ -925,28 +664,11 @@ interface ExecutionContext {
925
664
  telemetry: ExecutionTelemetry;
926
665
  binary: ExecutionBinaryService;
927
666
  getCredential<TSession = unknown>(slotKey: string): Promise<TSession>;
928
- /** Per-item iteration id, set by {@link NodeExecutor} on the ctx passed into runnable `execute`. */
929
667
  iterationId?: NodeIterationId;
930
- /** Item index (0-based) within the current activation's batch; set alongside {@link iterationId}. */
931
668
  itemIndex?: number;
932
- /** When set, this ctx is executing inside a sub-agent triggered by the named parent invocation. */
933
669
  parentInvocationId?: ConnectionInvocationId;
934
- /**
935
- * Present iff the run was started by a TestSuiteOrchestrator. The {@link IsTestRunNode}
936
- * branches on this; assertion-emitting nodes use it to decide whether to record results.
937
- */
938
670
  testContext?: RunTestContext;
939
- /**
940
- * Collections registered in the codemation config, keyed by collection name.
941
- */
942
671
  readonly collections?: CollectionsContext;
943
- /**
944
- * Resolve a DI token from the host container.
945
- * Allows nodes to reach host-side services (e.g. `InboxChannelResolverToken`)
946
- * without importing host code. Wired by `DefaultExecutionContextFactory`; throws
947
- * a clear error when no resolver is configured (e.g. in unit tests that don't
948
- * set up the full container).
949
- */
950
672
  resolve<T>(token: TypeToken<T>): T;
951
673
  }
952
674
  interface NodeExecutionContext<TConfig$1 extends NodeConfigBase = NodeConfigBase> extends ExecutionContext {
@@ -955,10 +677,6 @@ interface NodeExecutionContext<TConfig$1 extends NodeConfigBase = NodeConfigBase
955
677
  config: TConfig$1;
956
678
  telemetry: NodeExecutionTelemetry;
957
679
  binary: NodeBinaryAttachmentService;
958
- /**
959
- * Present when this node activation is a HITL resume.
960
- * The node checks `ctx.resumeContext !== undefined` and takes the resume branch.
961
- */
962
680
  resumeContext?: ResumeContext;
963
681
  }
964
682
  //#endregion
@@ -986,5 +704,5 @@ interface DefinedCollection<TDefinition extends CollectionDefinition = Collectio
986
704
  }): void;
987
705
  }
988
706
  //#endregion
989
- export { TypeToken as a, McpServerDeclaration as c, CredentialAuthDefinition as d, CredentialFieldSchema as f, CredentialTypeId as g, CredentialSessionFactory as h, Container as i, AnyCredentialType as l, CredentialMaterialSourceKind as m, DefinedCollection as n, EngineExecutionLimitsPolicyConfig as o, CredentialHealthTester as p, WorkflowDefinition as r, DefinedNode as s, CollectionDefinition as t, CredentialAdvancedSectionPresentation as u };
990
- //# sourceMappingURL=index-RNoZqCPr.d.ts.map
707
+ export { CredentialTypeId as _, TypeToken as a, McpServerDeclaration as c, CredentialAdvancedSectionPresentation as d, CredentialAuthDefinition as f, CredentialSessionFactory as g, CredentialMaterialSourceKind as h, Container as i, AnyCredentialType as l, CredentialHealthTester as m, DefinedCollection as n, EngineExecutionLimitsPolicyConfig as o, CredentialFieldSchema as p, WorkflowDefinition as r, DefinedNode as s, CollectionDefinition as t, CredentialAccessTokenSessionFactory as u };
708
+ //# sourceMappingURL=index-DdjAAXvy.d.ts.map
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_analyzeInvoiceNode = require('./analyzeInvoiceNode-CmMsifbw.cjs');
1
+ const require_analyzeInvoiceNode = require('./analyzeInvoiceNode-CW_SXNQf.cjs');
2
2
 
3
3
  exports.analyzeDocumentNode = require_analyzeInvoiceNode.analyzeDocumentNode;
4
4
  exports.analyzeImageNode = require_analyzeInvoiceNode.analyzeImageNode;