@codemation/core-nodes-ocr 0.2.6 → 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.
Files changed (54) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/{analyzeInvoiceNode-BqZsN8iL.js → analyzeInvoiceNode-BQzww-XC.js} +1 -9
  3. package/dist/analyzeInvoiceNode-BQzww-XC.js.map +1 -0
  4. package/dist/{analyzeInvoiceNode-CmMsifbw.cjs → analyzeInvoiceNode-CW_SXNQf.cjs} +1 -9
  5. package/dist/analyzeInvoiceNode-CW_SXNQf.cjs.map +1 -0
  6. package/dist/codemation.plugin.cjs +1204 -14695
  7. package/dist/codemation.plugin.cjs.map +1 -1
  8. package/dist/codemation.plugin.d.cts +1 -73
  9. package/dist/codemation.plugin.d.ts +1 -58
  10. package/dist/codemation.plugin.js +1248 -14738
  11. package/dist/codemation.plugin.js.map +1 -1
  12. package/dist/dist-BDgdLisG.js +5378 -0
  13. package/dist/dist-BDgdLisG.js.map +1 -0
  14. package/dist/dist-BYInIjS8.js +2246 -0
  15. package/dist/dist-BYInIjS8.js.map +1 -0
  16. package/dist/dist-BlD4pqf2.cjs +4358 -0
  17. package/dist/dist-BlD4pqf2.cjs.map +1 -0
  18. package/dist/dist-CUcwHflE.cjs +14870 -0
  19. package/dist/dist-CUcwHflE.cjs.map +1 -0
  20. package/dist/dist-DB2xMXXm.cjs +5380 -0
  21. package/dist/dist-DB2xMXXm.cjs.map +1 -0
  22. package/dist/dist-DBYFkhSG.js +14739 -0
  23. package/dist/dist-DBYFkhSG.js.map +1 -0
  24. package/dist/dist-DZfaPW8T.js +4356 -0
  25. package/dist/dist-DZfaPW8T.js.map +1 -0
  26. package/dist/dist-Zdvm5pqX.cjs +2464 -0
  27. package/dist/dist-Zdvm5pqX.cjs.map +1 -0
  28. package/dist/{index-DF2ht42F.d.ts → index-DdjAAXvy.d.ts} +18 -274
  29. package/dist/index.cjs +1 -1
  30. package/dist/index.d.cts +15 -35
  31. package/dist/index.d.ts +7 -29
  32. package/dist/index.js +1 -1
  33. package/dist/metadata.json +1 -1
  34. package/dist/{runtimeTypes-WCvsnJMY.d.cts → runtimeTypes-D_9j5Pat.d.cts} +10 -253
  35. package/dist/{token-CgF09kyP.cjs → token-Cbd8b88n.cjs} +2 -2
  36. package/dist/{token-CgF09kyP.cjs.map → token-Cbd8b88n.cjs.map} +1 -1
  37. package/dist/{token-CIu4PqRI.js → token-P-r3QR1d.js} +2 -2
  38. package/dist/{token-CIu4PqRI.js.map → token-P-r3QR1d.js.map} +1 -1
  39. package/dist/{token-util-B2kSJtEV.cjs → token-util-B2Ofk2zk.cjs} +77 -77
  40. package/dist/token-util-B2Ofk2zk.cjs.map +1 -0
  41. package/dist/{token-util-Lr5foG4r.cjs → token-util-CT85hbGe.cjs} +1 -1
  42. package/dist/{token-util-EUxa8JtH.js → token-util-CfNdwRXi.js} +77 -77
  43. package/dist/token-util-CfNdwRXi.js.map +1 -0
  44. package/dist/token-util-rTxWuZPt.js +5 -0
  45. package/package.json +2 -2
  46. package/src/lib/analyzeWithAzure.ts +0 -9
  47. package/src/nodes/analyzeDocumentNode.ts +0 -9
  48. package/src/nodes/analyzeImageNode.ts +0 -9
  49. package/src/nodes/analyzeInvoiceNode.ts +0 -4
  50. package/dist/analyzeInvoiceNode-BqZsN8iL.js.map +0 -1
  51. package/dist/analyzeInvoiceNode-CmMsifbw.cjs.map +0 -1
  52. package/dist/token-util-B2kSJtEV.cjs.map +0 -1
  53. package/dist/token-util-BsR6OYHz.js +0 -5
  54. package/dist/token-util-EUxa8JtH.js.map +0 -1
@@ -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;
@@ -118,7 +106,6 @@ interface ExecutionTelemetry extends TelemetryScope {
118
106
  }
119
107
  //#endregion
120
108
  //#region ../core/src/contracts/itemExpr.d.ts
121
- declare const ITEM_EXPR_BRAND: unique symbol;
122
109
  type ItemExprResolvedContext = Readonly<{
123
110
  runId: RunId;
124
111
  workflowId: WorkflowId;
@@ -126,9 +113,6 @@ type ItemExprResolvedContext = Readonly<{
126
113
  activationId: NodeActivationId;
127
114
  data: RunDataSnapshot;
128
115
  }>;
129
- /**
130
- * Context aligned with former {@link ItemInputMapperContext} — use **`data`** to read any completed upstream node.
131
- */
132
116
  type ItemExprContext = ItemExprResolvedContext;
133
117
  type ItemExprArgs<TItemJson = unknown> = Readonly<{
134
118
  item: Item<TItemJson>;
@@ -138,7 +122,7 @@ type ItemExprArgs<TItemJson = unknown> = Readonly<{
138
122
  }>;
139
123
  type ItemExprCallback<T, TItemJson = unknown> = (args: ItemExprArgs<TItemJson>) => T | Promise<T>;
140
124
  type ItemExpr<T, TItemJson = unknown> = Readonly<{
141
- readonly [ITEM_EXPR_BRAND]: true;
125
+ readonly __codemationItemExpr: "codemation.itemExpr";
142
126
  readonly fn: ItemExprCallback<T, TItemJson>;
143
127
  }>;
144
128
  //#endregion
@@ -147,30 +131,21 @@ type Expr<T, TItemJson = unknown> = ItemExpr<T, TItemJson>;
147
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);
148
132
  //#endregion
149
133
  //#region ../core/src/contracts/retryPolicySpec.types.d.ts
150
- /**
151
- * In-process retry policy for runnable nodes. Serialized configs use the same
152
- * `kind` discriminator (`JSON.stringify` / persisted workflows).
153
- *
154
- * `maxAttempts` is the total number of tries including the first (e.g. 3 means up to 2 delays after failures).
155
- */
156
134
  type RetryPolicySpec = NoneRetryPolicySpec | FixedRetryPolicySpec | ExponentialRetryPolicySpec;
157
135
  interface NoneRetryPolicySpec {
158
136
  readonly kind: "none";
159
137
  }
160
138
  interface FixedRetryPolicySpec {
161
139
  readonly kind: "fixed";
162
- /** Total attempts including the first execution. Must be >= 1. */
163
140
  readonly maxAttempts: number;
164
141
  readonly delayMs: number;
165
142
  }
166
143
  interface ExponentialRetryPolicySpec {
167
144
  readonly kind: "exponential";
168
- /** Total attempts including the first execution. Must be >= 1. */
169
145
  readonly maxAttempts: number;
170
146
  readonly initialDelayMs: number;
171
147
  readonly multiplier: number;
172
148
  readonly maxDelayMs?: number;
173
- /** When true, each delay is multiplied by a random factor in [1, 1.2). */
174
149
  readonly jitter?: boolean;
175
150
  }
176
151
  //#endregion
@@ -186,22 +161,11 @@ type CredentialFieldSchema = Readonly<{
186
161
  type: "string" | "password" | "textarea" | "json" | "boolean";
187
162
  required?: true;
188
163
  order?: number;
189
- /**
190
- * Where this field appears in the credential dialog. Use `"advanced"` for optional or
191
- * power-user fields; they render inside a collapsible section (see `CredentialTypeDefinition.advancedSection`).
192
- * Defaults to `"default"` when omitted.
193
- */
194
164
  visibility?: "default" | "advanced";
195
165
  placeholder?: string;
196
166
  helpText?: string;
197
- /** When set, host resolves this field from process.env at runtime; env wins over stored values. */
198
167
  envVarName?: string;
199
- /**
200
- * When set, the dialog shows a copy action for this exact string (e.g. a static OAuth redirect URI
201
- * pattern or documentation URL). Do not use for secret values.
202
- */
203
168
  copyValue?: string;
204
- /** Accessible label for the copy control (default: Copy). */
205
169
  copyButtonLabel?: string;
206
170
  }>;
207
171
  type CredentialRequirement = Readonly<{
@@ -246,20 +210,9 @@ type CredentialOAuth2AuthDefinition = Readonly<{
246
210
  clientSecretFieldKey?: string;
247
211
  } | {
248
212
  kind: "oauth2";
249
- /**
250
- * Free-form provider identifier for telemetry, DB rows, and Better Auth provider naming.
251
- * Not used for any registry lookup — URLs come from {@link authorizeUrl} / {@link tokenUrl}.
252
- */
253
213
  providerId: string;
254
- /**
255
- * Authorization endpoint. May contain `{publicFieldKey}` placeholders that the runtime
256
- * substitutes from the credential's resolved public config (URL-encoded).
257
- * Example: `https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/authorize`
258
- */
259
214
  authorizeUrl: string;
260
- /** Token endpoint. Same templating rules as {@link authorizeUrl}. */
261
215
  tokenUrl: string;
262
- /** Optional userinfo endpoint. Same templating rules as {@link authorizeUrl}. */
263
216
  userInfoUrl?: string;
264
217
  scopes: ReadonlyArray<string>;
265
218
  scopesFromPublicConfig?: CredentialOAuth2ScopesFromPublicConfig;
@@ -268,11 +221,8 @@ type CredentialOAuth2AuthDefinition = Readonly<{
268
221
  }>;
269
222
  type CredentialAuthDefinition = CredentialOAuth2AuthDefinition;
270
223
  type CredentialAdvancedSectionPresentation = Readonly<{
271
- /** Collapsible section title (default: "Advanced"). */
272
224
  title?: string;
273
- /** Optional short helper text shown inside the section (above the fields). */
274
225
  description?: string;
275
- /** When true, the advanced section starts expanded. Default: false (collapsed). */
276
226
  defaultOpen?: boolean;
277
227
  }>;
278
228
  type CredentialTypeDefinition = Readonly<{
@@ -281,23 +231,11 @@ type CredentialTypeDefinition = Readonly<{
281
231
  description?: string;
282
232
  publicFields?: ReadonlyArray<CredentialFieldSchema>;
283
233
  secretFields?: ReadonlyArray<CredentialFieldSchema>;
284
- /**
285
- * Optional labels for the collapsible block that contains every field with `visibility: "advanced"`.
286
- * If omitted, the UI still shows that block with defaults (title "Advanced", collapsed).
287
- */
288
234
  advancedSection?: CredentialAdvancedSectionPresentation;
289
235
  supportedSourceKinds?: ReadonlyArray<CredentialMaterialSourceKind>;
290
236
  auth?: CredentialAuthDefinition;
291
237
  }>;
292
- /**
293
- * JSON-shaped credential field bag (public config, resolved secret material, etc.).
294
- */
295
238
  type CredentialJsonRecord = Readonly<Record<string, unknown>>;
296
- /**
297
- * Persisted credential instance with typed `publicConfig`.
298
- * Hosts may specialize `secretRef` with a stricter union while remaining
299
- * assignable here for session/test callbacks.
300
- */
301
239
  type CredentialInstanceRecord<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord> = Readonly<{
302
240
  instanceId: CredentialInstanceId;
303
241
  typeId: CredentialTypeId;
@@ -309,110 +247,63 @@ type CredentialInstanceRecord<TPublicConfig extends CredentialJsonRecord = Crede
309
247
  setupStatus: CredentialSetupStatus;
310
248
  createdAt: string;
311
249
  updatedAt: string;
312
- /**
313
- * Pointer to where the credential material bytes live. For OSS / standalone
314
- * rows this is `{source: "local", ref: instanceId}` and the bytes co-locate
315
- * with the row in the workspace DB. For managed-mode rows this is
316
- * `{source: "control-plane", ref: <cp_id>}` and the bytes live at CP.
317
- *
318
- * The seam is read through `CredentialMaterialProvider`. See
319
- * `docs/design/credentials-oauth-unification.md` ("Material provider seam").
320
- */
321
250
  material: Readonly<{
322
251
  source: "local" | "control-plane";
323
252
  ref: string;
324
253
  }>;
325
254
  }>;
326
- /**
327
- * Arguments passed to `CredentialType.createSession` and `CredentialType.test`.
328
- * Declare `TPublicConfig` / `TMaterial` on `CredentialType` so implementations are checked
329
- * against your credential shapes (similar to `NodeExecutionContext.config` for nodes).
330
- */
331
255
  type CredentialSessionFactoryArgs<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord> = Readonly<{
332
256
  instance: CredentialInstanceRecord<TPublicConfig>;
333
257
  material: TMaterial;
334
258
  publicConfig: TPublicConfig;
335
259
  }>;
336
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>;
337
267
  type CredentialHealthTester<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord> = (args: CredentialSessionFactoryArgs<TPublicConfig, TMaterial>) => Promise<CredentialHealth>;
338
- /**
339
- * Full credential type implementation: `definition` (UI/schema), `createSession`, and `test`.
340
- * Use this at registration and config boundaries; `CredentialTypeDefinition` is only the schema slice.
341
- */
342
268
  type CredentialType<TPublicConfig extends CredentialJsonRecord = CredentialJsonRecord, TMaterial extends CredentialJsonRecord = CredentialJsonRecord, TSession = unknown> = Readonly<{
343
269
  definition: CredentialTypeDefinition;
344
270
  createSession: CredentialSessionFactory<TPublicConfig, TMaterial, TSession>;
271
+ createSessionFromAccessToken?: CredentialAccessTokenSessionFactory<TPublicConfig, TSession>;
345
272
  test: CredentialHealthTester<TPublicConfig, TMaterial>;
346
273
  }>;
347
- /**
348
- * Credential type with unspecified generics — used for `CodemationConfig.credentialTypes`, the host registry,
349
- * and anywhere a concrete `CredentialType<YourPublic, YourMaterial, YourSession>` is placed in a heterogeneous list.
350
- * Using `any` here avoids unsafe `as` casts while keeping typed `satisfies CredentialType<…>` definitions.
351
- */
352
274
  type AnyCredentialType = CredentialType<any, any, unknown>;
353
275
  //#endregion
354
276
  //#region ../core/src/contracts/mcpTypes.d.ts
355
277
  type McpServerTransport = "http";
356
278
  interface McpServerDeclaration {
357
- /** Globally unique slug, e.g. "gmail". Workflow authors reference this. */
358
279
  id: string;
359
280
  displayName: string;
360
281
  description: string;
361
282
  transport: McpServerTransport;
362
283
  url: string;
363
- /**
364
- * Credential types accepted by this MCP server, matching CredentialRequirement.acceptedTypes.
365
- * Absent or empty means no credential is required.
366
- */
367
284
  acceptedCredentialTypes?: ReadonlyArray<string>;
368
- /**
369
- * Documentation only in MVP. The bind-time validator checks
370
- * requiredScopes ⊆ CredentialInstance.scopesGranted.
371
- */
372
285
  requiredScopes?: string[];
373
- /** Non-secret static headers merged onto every MCP request. */
374
286
  staticHeaders?: Record<string, string>;
375
- /**
376
- * Overrides for tool descriptions advertised by the MCP server.
377
- * Applied by the connection pool after tools/list.
378
- * Key: exact tool name as returned by the server.
379
- */
380
287
  toolDescriptionOverrides?: Record<string, string>;
381
288
  }
382
289
  //#endregion
383
290
  //#region ../core/src/contracts/collectionTypes.d.ts
384
- /**
385
- * Represents a typed store for a single collection.
386
- * All rows include auto-managed id, created_at, and updated_at fields.
387
- */
388
291
  interface CollectionStore<TRow extends Record<string, unknown> = Record<string, unknown>> {
389
- /**
390
- * Insert a new row. id, created_at, and updated_at are auto-populated.
391
- */
392
292
  insert(row: TRow): Promise<TRow & {
393
293
  id: string;
394
294
  created_at: Date;
395
295
  updated_at: Date;
396
296
  }>;
397
- /**
398
- * Get a single row by id.
399
- */
400
297
  get(id: string): Promise<(TRow & {
401
298
  id: string;
402
299
  created_at: Date;
403
300
  updated_at: Date;
404
301
  }) | null>;
405
- /**
406
- * Find a single row matching the provided filter.
407
- */
408
302
  findOne(filter: Partial<TRow>): Promise<(TRow & {
409
303
  id: string;
410
304
  created_at: Date;
411
305
  updated_at: Date;
412
306
  }) | null>;
413
- /**
414
- * List rows with optional pagination and filtering.
415
- */
416
307
  list(opts?: {
417
308
  limit?: number;
418
309
  offset?: number;
@@ -425,26 +316,23 @@ interface CollectionStore<TRow extends Record<string, unknown> = Record<string,
425
316
  }>;
426
317
  total: number;
427
318
  }>;
428
- /**
429
- * Update a row by id with partial data.
430
- */
431
319
  update(id: string, patch: Partial<TRow>): Promise<TRow & {
432
320
  id: string;
433
321
  created_at: Date;
434
322
  updated_at: Date;
435
323
  }>;
436
- /**
437
- * Delete a row by id. Hard delete only (no soft delete).
438
- */
439
324
  delete(id: string): Promise<{
440
325
  deleted: boolean;
441
326
  }>;
442
327
  }
443
- /**
444
- * Runtime collections context: keyed by collection name.
445
- */
446
328
  type CollectionsContext = Readonly<Record<string, CollectionStore>>;
447
329
  //#endregion
330
+ //#region ../core/src/authoring/nodeBaseOptions.types.d.ts
331
+ interface NodeBaseOptions {
332
+ readonly id?: string;
333
+ readonly description?: string;
334
+ }
335
+ //#endregion
448
336
  //#region ../core/src/authoring/defineNode.types.d.ts
449
337
  type ResolvableCredentialType = AnyCredentialType | CredentialTypeId;
450
338
  type DefinedNodeCredentialBinding = ResolvableCredentialType | Readonly<{
@@ -461,7 +349,7 @@ interface DefinedNode<TKey$1 extends string, TConfig$1 extends CredentialJsonRec
461
349
  readonly key: TKey$1;
462
350
  readonly title: string;
463
351
  readonly description?: string;
464
- create<TConfigItemJson = TInputJson$1>(config: DefinedNodeConfigInput<TConfig$1, TConfigItemJson>, name?: string, id?: string): RunnableNodeConfig<TInputJson$1, TOutputJson$1>;
352
+ create<TConfigItemJson = TInputJson$1>(config: DefinedNodeConfigInput<TConfig$1, TConfigItemJson>, name?: string, idOrOptions?: string | NodeBaseOptions): RunnableNodeConfig<TInputJson$1, TOutputJson$1>;
465
353
  register(context: {
466
354
  registerNode<TValue>(token: TypeToken<TValue>, implementation?: TypeToken<TValue>): void;
467
355
  }): void;
@@ -476,20 +364,9 @@ interface EngineExecutionLimitsPolicyConfig {
476
364
  }
477
365
  //#endregion
478
366
  //#region ../core/src/contracts/runTypes.d.ts
479
- /**
480
- * Test-suite linkage for a run. When set, this run was started by a TestSuiteOrchestrator
481
- * as one test case inside a TestSuiteRun. The `IsTestRun` node and host-side persisters key
482
- * off the presence of this field. Subworkflow runs inherit it from their parent run.
483
- */
484
367
  interface RunTestContext {
485
368
  readonly testSuiteRunId: string;
486
369
  readonly testCaseIndex: number;
487
- /**
488
- * Optional human-friendly label for this test case (e.g. an email subject when fixtures
489
- * are loaded from a mailbox). Resolved per item by `TestTrigger.caseLabel(item)` if set,
490
- * persisted on `Run.test_case_label` so the Tests-tab tree-table can show "RFQ for batch 14"
491
- * instead of "run_1777755971399_bbb86beac1396".
492
- */
493
370
  readonly testCaseLabel?: string;
494
371
  }
495
372
  type NodeInputsByPort = Readonly<Record<InputPortKey, Items>>;
@@ -500,9 +377,7 @@ interface NodeExecutionError {
500
377
  stack?: string;
501
378
  details?: JsonValue;
502
379
  }
503
- /** Stable id for a single connection invocation row in {@link ConnectionInvocationRecord}. */
504
380
  type ConnectionInvocationId = string;
505
- /** Arguments for appending a {@link ConnectionInvocationRecord} (engine fills run/workflow ids and timestamps). */
506
381
  type ConnectionInvocationAppendArgs = Readonly<{
507
382
  invocationId: ConnectionInvocationId;
508
383
  connectionNodeId: NodeId;
@@ -543,11 +418,6 @@ interface Edge {
543
418
  input: InputPortKey;
544
419
  };
545
420
  }
546
- /**
547
- * Named connection from a parent node to child nodes that exist in {@link WorkflowDefinition.nodes}
548
- * but are not traversed by the main execution graph. Parents are commonly executable nodes, but may
549
- * also be connection-owned nodes for recursive agent attachments.
550
- */
551
421
  interface WorkflowNodeConnection {
552
422
  readonly parentNodeId: NodeId;
553
423
  readonly connectionName: NodeConnectionName;
@@ -558,18 +428,10 @@ interface WorkflowDefinition {
558
428
  name: string;
559
429
  nodes: NodeDefinition[];
560
430
  edges: Edge[];
561
- /**
562
- * Optional metadata: which nodes are connection-owned children (e.g. AI agent `llm` / `tools` slots).
563
- * When omitted, all nodes in {@link nodes} are treated as executable for topology.
564
- */
565
431
  readonly connections?: ReadonlyArray<WorkflowNodeConnection>;
566
- /** Directory + file-stem path under a workflow discovery root (for UI grouping only). */
567
432
  discoveryPathSegments?: readonly string[];
568
- /** Retention for run JSON and binaries (seconds). Host/env may supply defaults when omitted. */
569
433
  readonly prunePolicy?: WorkflowPrunePolicySpec;
570
- /** Whether to keep run data after completion. Host/env may supply defaults when omitted. */
571
434
  readonly storagePolicy?: WorkflowStoragePolicySpec;
572
- /** Invoked after a node fails permanently (retries exhausted) and node error handler did not recover. */
573
435
  readonly workflowErrorHandler?: WorkflowErrorHandlerSpec;
574
436
  }
575
437
  interface NodeConfigBase {
@@ -578,76 +440,31 @@ interface NodeConfigBase {
578
440
  readonly name?: string;
579
441
  readonly id?: NodeId;
580
442
  readonly icon?: string;
443
+ readonly description?: string;
581
444
  readonly execution?: Readonly<{
582
445
  hint?: "local" | "worker";
583
446
  queue?: string;
584
447
  }>;
585
- /** In-process execute retries (runnable nodes). Triggers typically omit this. */
586
448
  readonly retryPolicy?: RetryPolicySpec;
587
- /** Recover from execute failures; return outputs to continue, or rethrow to fail the node. */
588
449
  readonly nodeErrorHandler?: NodeErrorHandlerSpec;
589
- /**
590
- * When true, edges carrying zero items on an output port still schedule single-input downstream nodes.
591
- * Decided from the **source** node that produced the (empty) output. Default (false/undefined): empty
592
- * main batches skip downstream execution and propagate the empty path.
593
- */
594
450
  readonly continueWhenEmptyOutput?: boolean;
595
- /**
596
- * Declared I/O port names for canvas authoring (unioned with ports inferred from edges).
597
- * Use for dynamic routers (Switch) and future error ports.
598
- */
599
451
  readonly declaredOutputPorts?: ReadonlyArray<OutputPortKey>;
600
452
  readonly declaredInputPorts?: ReadonlyArray<InputPortKey>;
601
453
  getCredentialRequirements?(): ReadonlyArray<CredentialRequirement>;
602
- /**
603
- * Marker: this node emits {@link import("./assertionTypes").AssertionResult}-shaped items on its
604
- * `main` port. The TestSuiteOrchestrator (and host-side TestAssertionPersister) listen for
605
- * `nodeCompleted` events from nodes with this flag set, and persist their output items as
606
- * TestAssertion records (only when the run carries a `testContext`). Set on assertion node
607
- * configs (e.g. `AssertionNodeConfig`, `StringEqualsAssertionNodeConfig`).
608
- */
609
454
  readonly emitsAssertions?: true;
610
- /**
611
- * Static configuration summary surfaced in the workflow inspector — the design-time
612
- * "what does this node do" panel that renders before any run telemetry exists.
613
- *
614
- * Return 2–6 short label/value pairs derived from this config (method + url for an HTTP
615
- * call, model + tool list for an agent, schedule + timezone for a cron trigger, etc.).
616
- * Values are truncated by the UI; aim for one line each. Return `undefined` to opt out
617
- * — the inspector hides the section when no rows are produced.
618
- *
619
- * Implement on the config class instance so the function can read sibling config fields.
620
- * `defineNode({ inspectorSummary })` plumbs through to this.
621
- */
622
455
  inspectorSummary?(): ReadonlyArray<NodeInspectorSummaryRow> | undefined;
623
456
  }
624
- /**
625
- * One row of a node's static configuration summary. See {@link NodeConfigBase.inspectorSummary}.
626
- */
627
457
  interface NodeInspectorSummaryRow {
628
458
  readonly label: string;
629
459
  readonly value: string;
630
460
  }
631
461
  declare const runnableNodeInputType: unique symbol;
632
462
  declare const runnableNodeOutputType: unique symbol;
633
- /**
634
- * Runnable node: **`TInputJson`** is what **`inputSchema`** validates on **`item.json`** (the wire payload).
635
- * **`TOutputJson`** is emitted `item.json` on outputs.
636
- */
637
463
  interface RunnableNodeConfig<TInputJson$1 = unknown, TOutputJson$1 = unknown> extends NodeConfigBase {
638
464
  readonly kind: "node";
639
465
  readonly [runnableNodeInputType]?: TInputJson$1;
640
466
  readonly [runnableNodeOutputType]?: TOutputJson$1;
641
- /**
642
- * Optional Zod input contract for {@link RunnableNode} when not set on the node class.
643
- * Resolution order: node instance `inputSchema`, then config `inputSchema`, then `z.unknown()`.
644
- */
645
467
  readonly inputSchema?: ZodType<TInputJson$1>;
646
- /**
647
- * When an activation receives **zero** input items, the engine normally runs `execute` zero times.
648
- * Set to **`runOnce`** to run `execute` once with an empty `items` batch (and a synthetic wire item for schema parsing).
649
- * Used by batch-style callback nodes (built-in `Callback`) so `callback([], ctx)` still runs.
650
- */
651
468
  readonly emptyBatchExecution?: "skip" | "runOnce";
652
469
  }
653
470
  interface NodeDefinition {
@@ -689,27 +506,14 @@ type Items<TJson = unknown> = ReadonlyArray<Item<TJson>>;
689
506
  type NodeOutputs = Partial<Record<OutputPortKey, Items>>;
690
507
  type RunId = string;
691
508
  type NodeActivationId = string;
692
- /**
693
- * One per-item iteration of a runnable node's execute loop. Refines `NodeActivationId` for
694
- * per-item connection invocations and telemetry. Undefined when the executing node is a batch
695
- * node or trigger that does not iterate items.
696
- */
697
509
  type NodeIterationId = string;
698
510
  interface ParentExecutionRef {
699
511
  runId: RunId;
700
512
  workflowId: WorkflowId;
701
513
  nodeId: NodeId;
702
- /** Subworkflow depth of the **spawning** run (0 = root). Passed when starting a child run. */
703
514
  subworkflowDepth?: number;
704
- /** Effective max node activations from the parent run (propagated to child policy merge). */
705
515
  engineMaxNodeActivations?: number;
706
- /** Effective max subworkflow depth from the parent run (propagated to child policy merge). */
707
516
  engineMaxSubworkflowDepth?: number;
708
- /**
709
- * Test-suite linkage inherited by the child subworkflow run. Set by whichever node
710
- * spawns the subworkflow when its own `ctx.testContext` is present, so assertions
711
- * emitted inside a subworkflow land under the correct parent test case.
712
- */
713
517
  testContext?: RunTestContext;
714
518
  }
715
519
  interface RunDataSnapshot {
@@ -717,7 +521,6 @@ interface RunDataSnapshot {
717
521
  getOutputItems<TJson = unknown>(nodeId: NodeId | NodeIdRef<TJson>, output?: OutputPortKey): Items<TJson>;
718
522
  getOutputItem<TJson = unknown>(nodeId: NodeId | NodeIdRef<TJson>, itemIndex: number, output?: OutputPortKey): Item<TJson> | undefined;
719
523
  }
720
- /** Whether to persist run execution data after the workflow finishes. */
721
524
  type WorkflowStoragePolicyMode = "ALL" | "SUCCESS" | "ERROR" | "NEVER";
722
525
  type WorkflowStoragePolicySpec = WorkflowStoragePolicyMode | TypeToken<WorkflowStoragePolicyResolver>;
723
526
  interface WorkflowStoragePolicyResolver {
@@ -764,36 +567,19 @@ interface NodeErrorHandler {
764
567
  type NodeErrorHandlerSpec = TypeToken<NodeErrorHandler> | NodeErrorHandler;
765
568
  //#endregion
766
569
  //#region ../core/src/contracts/runtimeTypes.d.ts
767
- /** Opaque unique identifier for a single HumanTask instance. */
768
570
  type HumanTaskId = string;
769
- /**
770
- * Minimal handle handed to the `deliver` callback so it can route to the correct
771
- * inbox channel.
772
- */
773
571
  interface HumanTaskHandle {
774
572
  readonly taskId: HumanTaskId;
775
573
  readonly runId: string;
776
574
  readonly nodeId: string;
777
575
  readonly expiresAt: Date;
778
- /** TODO: real signed URL; placeholder empty string for now. */
779
576
  readonly resumeUrl: string;
780
- /**
781
- * Arbitrary JSON metadata copied from `SuspensionRequest.request.metadata` at suspension time.
782
- * Used by the agent runtime to round-trip the `agentCheckpoint` back to the
783
- * resumed node via `ctx.resumeContext.task.metadata`.
784
- */
785
577
  readonly metadata?: Readonly<Record<string, JsonValue>>;
786
578
  }
787
- /** Identity of the person who made a decision on the task. */
788
579
  interface HumanTaskActor {
789
580
  readonly actorId: string;
790
581
  readonly displayName?: string;
791
582
  }
792
- /**
793
- * Resume context injected into `NodeExecutionContext` when the engine re-activates
794
- * a previously suspended node. `defineHumanApprovalNode` wraps this with parsed
795
- * `TDecision`; at the engine layer `decision.value` is `unknown`.
796
- */
797
583
  interface ResumeContext {
798
584
  readonly decision: Readonly<{
799
585
  kind: "decided";
@@ -834,11 +620,6 @@ interface NodeExecutionStatePublisher {
834
620
  error: Error;
835
621
  }): Promise<void>;
836
622
  appendConnectionInvocation(args: ConnectionInvocationAppendArgs): Promise<void>;
837
- /**
838
- * Annotates the current snapshot for `nodeId` with the id of the child run spawned by a
839
- * SubWorkflow invocation. Called from `SubWorkflowNode.execute` after `runById` resolves.
840
- * The engine's subsequent `markCompleted` call preserves the value via `previous.childRunId`.
841
- */
842
623
  setChildRunId?(args: {
843
624
  nodeId: NodeId;
844
625
  childRunId: RunId;
@@ -866,32 +647,16 @@ interface ExecutionBinaryService {
866
647
  activationId: NodeActivationId;
867
648
  }): NodeBinaryAttachmentService;
868
649
  openReadStream(attachment: BinaryAttachment): Promise<BinaryStorageReadResult | undefined>;
869
- /**
870
- * Reads all bytes from the attachment into a contiguous `Uint8Array`.
871
- * Checks `attachment.size` against `maxBytes` *before* any allocation; throws a bounded-read
872
- * error when exceeded (no OOM). Throws if the stream is unavailable or the byte count mismatches.
873
- */
874
650
  getBytes(attachment: BinaryAttachment, maxBytes?: number): Promise<Uint8Array>;
875
- /**
876
- * Reads the attachment and decodes the bytes as UTF-8 text.
877
- * Subject to the same bounded-read safety as `getBytes`.
878
- */
879
651
  getText(attachment: BinaryAttachment, maxBytes?: number): Promise<string>;
880
- /**
881
- * Reads the attachment, decodes as UTF-8 text, and parses as JSON.
882
- * Throws a clear error on invalid JSON. Subject to the same bounded-read safety.
883
- */
884
652
  getJson<T = unknown>(attachment: BinaryAttachment, maxBytes?: number): Promise<T>;
885
653
  }
886
654
  interface ExecutionContext {
887
655
  runId: RunId;
888
656
  workflowId: WorkflowId;
889
657
  parent?: ParentExecutionRef;
890
- /** This run's subworkflow depth (0 = root). */
891
658
  subworkflowDepth: number;
892
- /** Effective activation budget cap for this run (after policy merge). */
893
659
  engineMaxNodeActivations: number;
894
- /** Effective subworkflow nesting cap for this run (after policy merge). */
895
660
  engineMaxSubworkflowDepth: number;
896
661
  now: () => Date;
897
662
  data: RunDataSnapshot;
@@ -899,28 +664,11 @@ interface ExecutionContext {
899
664
  telemetry: ExecutionTelemetry;
900
665
  binary: ExecutionBinaryService;
901
666
  getCredential<TSession = unknown>(slotKey: string): Promise<TSession>;
902
- /** Per-item iteration id, set by {@link NodeExecutor} on the ctx passed into runnable `execute`. */
903
667
  iterationId?: NodeIterationId;
904
- /** Item index (0-based) within the current activation's batch; set alongside {@link iterationId}. */
905
668
  itemIndex?: number;
906
- /** When set, this ctx is executing inside a sub-agent triggered by the named parent invocation. */
907
669
  parentInvocationId?: ConnectionInvocationId;
908
- /**
909
- * Present iff the run was started by a TestSuiteOrchestrator. The {@link IsTestRunNode}
910
- * branches on this; assertion-emitting nodes use it to decide whether to record results.
911
- */
912
670
  testContext?: RunTestContext;
913
- /**
914
- * Collections registered in the codemation config, keyed by collection name.
915
- */
916
671
  readonly collections?: CollectionsContext;
917
- /**
918
- * Resolve a DI token from the host container.
919
- * Allows nodes to reach host-side services (e.g. `InboxChannelResolverToken`)
920
- * without importing host code. Wired by `DefaultExecutionContextFactory`; throws
921
- * a clear error when no resolver is configured (e.g. in unit tests that don't
922
- * set up the full container).
923
- */
924
672
  resolve<T>(token: TypeToken<T>): T;
925
673
  }
926
674
  interface NodeExecutionContext<TConfig$1 extends NodeConfigBase = NodeConfigBase> extends ExecutionContext {
@@ -929,10 +677,6 @@ interface NodeExecutionContext<TConfig$1 extends NodeConfigBase = NodeConfigBase
929
677
  config: TConfig$1;
930
678
  telemetry: NodeExecutionTelemetry;
931
679
  binary: NodeBinaryAttachmentService;
932
- /**
933
- * Present when this node activation is a HITL resume.
934
- * The node checks `ctx.resumeContext !== undefined` and takes the resume branch.
935
- */
936
680
  resumeContext?: ResumeContext;
937
681
  }
938
682
  //#endregion
@@ -960,5 +704,5 @@ interface DefinedCollection<TDefinition extends CollectionDefinition = Collectio
960
704
  }): void;
961
705
  }
962
706
  //#endregion
963
- 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 };
964
- //# sourceMappingURL=index-DF2ht42F.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;