@codemation/core-nodes-ocr 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_analyzeInvoiceNode = require('./analyzeInvoiceNode-BIw8j_Zb.cjs');
1
+ const require_analyzeInvoiceNode = require('./analyzeInvoiceNode-CmMsifbw.cjs');
2
2
 
3
3
  exports.analyzeDocumentNode = require_analyzeInvoiceNode.analyzeDocumentNode;
4
4
  exports.analyzeImageNode = require_analyzeInvoiceNode.analyzeImageNode;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as CredentialSessionFactory, a as NodeActivationId, b as WorkflowId, c as RunnableNodeConfig, d as CredentialAdvancedSectionPresentation, f as CredentialAuthDefinition, g as CredentialMaterialSourceKind, h as CredentialJsonRecord, i as Items, m as CredentialHealthTester, n as TypeToken, o as RunDataSnapshot, p as CredentialFieldSchema, r as Item, s as RunId, u as AnyCredentialType, v as CredentialTypeId, y as NodeId } from "./runtimeTypes-ffl603pJ.cjs";
1
+ import { _ as CredentialSessionFactory, a as RunId, b as WorkflowId, d as CredentialAdvancedSectionPresentation, f as CredentialAuthDefinition, g as CredentialMaterialSourceKind, h as CredentialJsonRecord, i as RunDataSnapshot, l as TypeToken, m as CredentialHealthTester, n as Items, o as RunnableNodeConfig, p as CredentialFieldSchema, r as NodeActivationId, t as Item, u as AnyCredentialType, v as CredentialTypeId, y as NodeId } from "./runtimeTypes-WCvsnJMY.cjs";
2
2
  import { ZodType } from "zod";
3
3
  import { AnalysisResult } from "@azure/ai-content-understanding";
4
4
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { d as CredentialAuthDefinition, f as CredentialFieldSchema, g as CredentialTypeId, h as CredentialSessionFactory, l as AnyCredentialType, m as CredentialMaterialSourceKind, p as CredentialHealthTester, r as DefinedNode, u as CredentialAdvancedSectionPresentation } from "./index-C2KJPzqN.js";
1
+ import { d as CredentialAuthDefinition, f as CredentialFieldSchema, g as CredentialTypeId, h as CredentialSessionFactory, l as AnyCredentialType, m as CredentialMaterialSourceKind, p as CredentialHealthTester, s as DefinedNode, u as CredentialAdvancedSectionPresentation } from "./index-DF2ht42F.js";
2
2
  import { AnalysisResult } from "@azure/ai-content-understanding";
3
3
 
4
4
  //#region src/credentials/azureContentUnderstandingCredential.d.ts
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as mapAnalysisResult, i as analyzeWithAzure, n as analyzeImageNode, o as azureContentUnderstandingCredentialType, r as analyzeDocumentNode, t as analyzeInvoiceNode } from "./analyzeInvoiceNode-uVwe3GHD.js";
1
+ import { a as mapAnalysisResult, i as analyzeWithAzure, n as analyzeImageNode, o as azureContentUnderstandingCredentialType, r as analyzeDocumentNode, t as analyzeInvoiceNode } from "./analyzeInvoiceNode-BqZsN8iL.js";
2
2
 
3
3
  export { analyzeDocumentNode, analyzeImageNode, analyzeInvoiceNode, analyzeWithAzure, azureContentUnderstandingCredentialType, mapAnalysisResult };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "packageName": "@codemation/core-nodes-ocr",
4
- "packageVersion": "0.2.2",
4
+ "packageVersion": "0.2.4",
5
5
  "description": "Azure AI Content Understanding (OCR) plugin for Codemation — prebuilt document, invoice, and image analyzers.",
6
6
  "kind": "nodes",
7
7
  "nodes": [
@@ -1,6 +1,6 @@
1
- import { ReadableStream } from "node:stream/web";
2
1
  import { ZodType } from "zod";
3
2
  import { DependencyContainer as Container, InjectionToken as TypeToken } from "tsyringe";
3
+ import { ReadableStream } from "node:stream/web";
4
4
 
5
5
  //#region ../core/src/contracts/baseTypes.d.ts
6
6
  /**
@@ -14,6 +14,137 @@ type OutputPortKey = string;
14
14
  type InputPortKey = string;
15
15
  type NodeConnectionName = string;
16
16
  //#endregion
17
+ //#region ../core/src/contracts/CostTrackingTelemetryContract.d.ts
18
+ type CostTrackingComponent = "chat" | "ocr" | "rag";
19
+ interface CostTrackingUsageRecord {
20
+ readonly component: CostTrackingComponent;
21
+ readonly provider: string;
22
+ readonly operation: string;
23
+ readonly pricingKey: string;
24
+ readonly usageUnit: string;
25
+ readonly quantity: number;
26
+ readonly modelName?: string;
27
+ readonly attributes?: TelemetryAttributes;
28
+ }
29
+ interface CostTrackingPriceQuote {
30
+ readonly currency: string;
31
+ readonly currencyScale: number;
32
+ readonly estimatedAmountMinor: number;
33
+ readonly estimateKind: "catalog";
34
+ }
35
+ interface CostTrackingTelemetry {
36
+ captureUsage(args: CostTrackingUsageRecord): Promise<CostTrackingPriceQuote | undefined>;
37
+ forScope(scope: TelemetryScope): CostTrackingTelemetry;
38
+ }
39
+ //#endregion
40
+ //#region ../core/src/contracts/telemetryTypes.d.ts
41
+ type TelemetryAttributePrimitive = string | number | boolean | null;
42
+ interface TelemetryAttributes {
43
+ readonly [key: string]: TelemetryAttributePrimitive | undefined;
44
+ }
45
+ interface TelemetryMetricRecord {
46
+ readonly name: string;
47
+ readonly value: number;
48
+ readonly unit?: string;
49
+ readonly attributes?: TelemetryAttributes;
50
+ }
51
+ interface TelemetrySpanEventRecord {
52
+ readonly name: string;
53
+ readonly occurredAt?: Date;
54
+ readonly attributes?: TelemetryAttributes;
55
+ }
56
+ interface TelemetryArtifactAttachment {
57
+ readonly kind: string;
58
+ readonly contentType: string;
59
+ readonly previewText?: string;
60
+ readonly previewJson?: JsonValue;
61
+ readonly payloadText?: string;
62
+ readonly payloadJson?: JsonValue;
63
+ readonly bytes?: number;
64
+ readonly truncated?: boolean;
65
+ readonly expiresAt?: Date;
66
+ }
67
+ interface TelemetryArtifactReference {
68
+ readonly artifactId: string;
69
+ readonly traceId?: string;
70
+ readonly spanId?: string;
71
+ }
72
+ interface TelemetrySpanEnd {
73
+ readonly status?: "ok" | "error";
74
+ readonly statusMessage?: string;
75
+ readonly endedAt?: Date;
76
+ readonly attributes?: TelemetryAttributes;
77
+ }
78
+ interface TelemetryChildSpanStart {
79
+ readonly name: string;
80
+ readonly kind?: "internal" | "client";
81
+ readonly startedAt?: Date;
82
+ readonly attributes?: TelemetryAttributes;
83
+ }
84
+ interface TelemetryScope {
85
+ readonly traceId?: string;
86
+ readonly spanId?: string;
87
+ readonly costTracking?: CostTrackingTelemetry;
88
+ addSpanEvent(args: TelemetrySpanEventRecord): Promise<void> | void;
89
+ recordMetric(args: TelemetryMetricRecord): Promise<void> | void;
90
+ attachArtifact(args: TelemetryArtifactAttachment): Promise<TelemetryArtifactReference> | TelemetryArtifactReference;
91
+ }
92
+ interface TelemetrySpanScope extends TelemetryScope {
93
+ readonly traceId: string;
94
+ readonly spanId: string;
95
+ 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
+ asNodeTelemetry(args: Readonly<{
104
+ nodeId: NodeId;
105
+ activationId: NodeActivationId;
106
+ }>): NodeExecutionTelemetry;
107
+ }
108
+ interface NodeExecutionTelemetry extends ExecutionTelemetry, TelemetrySpanScope {
109
+ startChildSpan(args: TelemetryChildSpanStart): TelemetrySpanScope;
110
+ }
111
+ interface ExecutionTelemetry extends TelemetryScope {
112
+ readonly traceId: string;
113
+ readonly spanId: string;
114
+ forNode(args: Readonly<{
115
+ nodeId: NodeId;
116
+ activationId: NodeActivationId;
117
+ }>): NodeExecutionTelemetry;
118
+ }
119
+ //#endregion
120
+ //#region ../core/src/contracts/retryPolicySpec.types.d.ts
121
+ /**
122
+ * In-process retry policy for runnable nodes. Serialized configs use the same
123
+ * `kind` discriminator (`JSON.stringify` / persisted workflows).
124
+ *
125
+ * `maxAttempts` is the total number of tries including the first (e.g. 3 means up to 2 delays after failures).
126
+ */
127
+ type RetryPolicySpec = NoneRetryPolicySpec | FixedRetryPolicySpec | ExponentialRetryPolicySpec;
128
+ interface NoneRetryPolicySpec {
129
+ readonly kind: "none";
130
+ }
131
+ interface FixedRetryPolicySpec {
132
+ readonly kind: "fixed";
133
+ /** Total attempts including the first execution. Must be >= 1. */
134
+ readonly maxAttempts: number;
135
+ readonly delayMs: number;
136
+ }
137
+ interface ExponentialRetryPolicySpec {
138
+ readonly kind: "exponential";
139
+ /** Total attempts including the first execution. Must be >= 1. */
140
+ readonly maxAttempts: number;
141
+ readonly initialDelayMs: number;
142
+ readonly multiplier: number;
143
+ readonly maxDelayMs?: number;
144
+ /** When true, each delay is multiplied by a random factor in [1, 1.2). */
145
+ readonly jitter?: boolean;
146
+ }
147
+ //#endregion
17
148
  //#region ../core/src/contracts/credentialTypes.d.ts
18
149
  type CredentialTypeId = string;
19
150
  type CredentialInstanceId = string;
@@ -149,6 +280,19 @@ type CredentialInstanceRecord<TPublicConfig extends CredentialJsonRecord = Crede
149
280
  setupStatus: CredentialSetupStatus;
150
281
  createdAt: string;
151
282
  updatedAt: string;
283
+ /**
284
+ * Pointer to where the credential material bytes live. For OSS / standalone
285
+ * rows this is `{source: "local", ref: instanceId}` and the bytes co-locate
286
+ * with the row in the workspace DB. For managed-mode rows this is
287
+ * `{source: "control-plane", ref: <cp_id>}` and the bytes live at CP.
288
+ *
289
+ * The seam is read through `CredentialMaterialProvider`. See
290
+ * `docs/design/credentials-oauth-unification.md` ("Material provider seam").
291
+ */
292
+ material: Readonly<{
293
+ source: "local" | "control-plane";
294
+ ref: string;
295
+ }>;
152
296
  }>;
153
297
  /**
154
298
  * Arguments passed to `CredentialType.createSession` and `CredentialType.test`.
@@ -178,6 +322,71 @@ type CredentialType<TPublicConfig extends CredentialJsonRecord = CredentialJsonR
178
322
  */
179
323
  type AnyCredentialType = CredentialType<any, any, unknown>;
180
324
  //#endregion
325
+ //#region ../core/src/contracts/collectionTypes.d.ts
326
+ /**
327
+ * Represents a typed store for a single collection.
328
+ * All rows include auto-managed id, created_at, and updated_at fields.
329
+ */
330
+ interface CollectionStore<TRow extends Record<string, unknown> = Record<string, unknown>> {
331
+ /**
332
+ * Insert a new row. id, created_at, and updated_at are auto-populated.
333
+ */
334
+ insert(row: TRow): Promise<TRow & {
335
+ id: string;
336
+ created_at: Date;
337
+ updated_at: Date;
338
+ }>;
339
+ /**
340
+ * Get a single row by id.
341
+ */
342
+ get(id: string): Promise<(TRow & {
343
+ id: string;
344
+ created_at: Date;
345
+ updated_at: Date;
346
+ }) | null>;
347
+ /**
348
+ * Find a single row matching the provided filter.
349
+ */
350
+ findOne(filter: Partial<TRow>): Promise<(TRow & {
351
+ id: string;
352
+ created_at: Date;
353
+ updated_at: Date;
354
+ }) | null>;
355
+ /**
356
+ * List rows with optional pagination and filtering.
357
+ */
358
+ list(opts?: {
359
+ limit?: number;
360
+ offset?: number;
361
+ where?: Partial<TRow>;
362
+ }): Promise<{
363
+ rows: ReadonlyArray<TRow & {
364
+ id: string;
365
+ created_at: Date;
366
+ updated_at: Date;
367
+ }>;
368
+ total: number;
369
+ }>;
370
+ /**
371
+ * Update a row by id with partial data.
372
+ */
373
+ update(id: string, patch: Partial<TRow>): Promise<TRow & {
374
+ id: string;
375
+ created_at: Date;
376
+ updated_at: Date;
377
+ }>;
378
+ /**
379
+ * Delete a row by id. Hard delete only (no soft delete).
380
+ */
381
+ delete(id: string): Promise<{
382
+ deleted: boolean;
383
+ }>;
384
+ }
385
+ /**
386
+ * Runtime collections context: keyed by collection name.
387
+ */
388
+ type CollectionsContext = Readonly<Record<string, CollectionStore>>;
389
+ //#endregion
181
390
  //#region ../core/src/contracts/runTypes.d.ts
182
391
  /**
183
392
  * Test-suite linkage for a run. When set, this run was started by a TestSuiteOrchestrator
@@ -196,7 +405,7 @@ interface RunTestContext {
196
405
  readonly testCaseLabel?: string;
197
406
  }
198
407
  type NodeInputsByPort = Readonly<Record<InputPortKey, Items>>;
199
- type NodeExecutionStatus = "pending" | "queued" | "running" | "completed" | "failed" | "skipped";
408
+ type NodeExecutionStatus = "pending" | "queued" | "running" | "completed" | "failed" | "skipped" | "hitl-approved" | "hitl-rejected" | "hitl-timeout" | "hitl-auto-accepted" | "hitl-cancelled";
200
409
  interface NodeExecutionError {
201
410
  message: string;
202
411
  name?: string;
@@ -225,34 +434,6 @@ type ConnectionInvocationAppendArgs = Readonly<{
225
434
  parentInvocationId?: ConnectionInvocationId;
226
435
  }>;
227
436
  //#endregion
228
- //#region ../core/src/contracts/retryPolicySpec.types.d.ts
229
- /**
230
- * In-process retry policy for runnable nodes. Serialized configs use the same
231
- * `kind` discriminator (`JSON.stringify` / persisted workflows).
232
- *
233
- * `maxAttempts` is the total number of tries including the first (e.g. 3 means up to 2 delays after failures).
234
- */
235
- type RetryPolicySpec = NoneRetryPolicySpec | FixedRetryPolicySpec | ExponentialRetryPolicySpec;
236
- interface NoneRetryPolicySpec {
237
- readonly kind: "none";
238
- }
239
- interface FixedRetryPolicySpec {
240
- readonly kind: "fixed";
241
- /** Total attempts including the first execution. Must be >= 1. */
242
- readonly maxAttempts: number;
243
- readonly delayMs: number;
244
- }
245
- interface ExponentialRetryPolicySpec {
246
- readonly kind: "exponential";
247
- /** Total attempts including the first execution. Must be >= 1. */
248
- readonly maxAttempts: number;
249
- readonly initialDelayMs: number;
250
- readonly multiplier: number;
251
- readonly maxDelayMs?: number;
252
- /** When true, each delay is multiplied by a random factor in [1, 1.2). */
253
- readonly jitter?: boolean;
254
- }
255
- //#endregion
256
437
  //#region ../core/src/contracts/workflowTypes.d.ts
257
438
  type NodeIdRef<TJson = unknown> = NodeId & Readonly<{
258
439
  __codemationNodeJson?: TJson;
@@ -494,175 +675,53 @@ interface NodeErrorHandler {
494
675
  }
495
676
  type NodeErrorHandlerSpec = TypeToken<NodeErrorHandler> | NodeErrorHandler;
496
677
  //#endregion
497
- //#region ../core/src/contracts/CostTrackingTelemetryContract.d.ts
498
- type CostTrackingComponent = "chat" | "ocr" | "rag";
499
- interface CostTrackingUsageRecord {
500
- readonly component: CostTrackingComponent;
501
- readonly provider: string;
502
- readonly operation: string;
503
- readonly pricingKey: string;
504
- readonly usageUnit: string;
505
- readonly quantity: number;
506
- readonly modelName?: string;
507
- readonly attributes?: TelemetryAttributes;
508
- }
509
- interface CostTrackingPriceQuote {
510
- readonly currency: string;
511
- readonly currencyScale: number;
512
- readonly estimatedAmountMinor: number;
513
- readonly estimateKind: "catalog";
514
- }
515
- interface CostTrackingTelemetry {
516
- captureUsage(args: CostTrackingUsageRecord): Promise<CostTrackingPriceQuote | undefined>;
517
- forScope(scope: TelemetryScope): CostTrackingTelemetry;
518
- }
519
- //#endregion
520
- //#region ../core/src/contracts/telemetryTypes.d.ts
521
- type TelemetryAttributePrimitive = string | number | boolean | null;
522
- interface TelemetryAttributes {
523
- readonly [key: string]: TelemetryAttributePrimitive | undefined;
524
- }
525
- interface TelemetryMetricRecord {
526
- readonly name: string;
527
- readonly value: number;
528
- readonly unit?: string;
529
- readonly attributes?: TelemetryAttributes;
530
- }
531
- interface TelemetrySpanEventRecord {
532
- readonly name: string;
533
- readonly occurredAt?: Date;
534
- readonly attributes?: TelemetryAttributes;
535
- }
536
- interface TelemetryArtifactAttachment {
537
- readonly kind: string;
538
- readonly contentType: string;
539
- readonly previewText?: string;
540
- readonly previewJson?: JsonValue;
541
- readonly payloadText?: string;
542
- readonly payloadJson?: JsonValue;
543
- readonly bytes?: number;
544
- readonly truncated?: boolean;
545
- readonly expiresAt?: Date;
546
- }
547
- interface TelemetryArtifactReference {
548
- readonly artifactId: string;
549
- readonly traceId?: string;
550
- readonly spanId?: string;
551
- }
552
- interface TelemetrySpanEnd {
553
- readonly status?: "ok" | "error";
554
- readonly statusMessage?: string;
555
- readonly endedAt?: Date;
556
- readonly attributes?: TelemetryAttributes;
557
- }
558
- interface TelemetryChildSpanStart {
559
- readonly name: string;
560
- readonly kind?: "internal" | "client";
561
- readonly startedAt?: Date;
562
- readonly attributes?: TelemetryAttributes;
563
- }
564
- interface TelemetryScope {
565
- readonly traceId?: string;
566
- readonly spanId?: string;
567
- readonly costTracking?: CostTrackingTelemetry;
568
- addSpanEvent(args: TelemetrySpanEventRecord): Promise<void> | void;
569
- recordMetric(args: TelemetryMetricRecord): Promise<void> | void;
570
- attachArtifact(args: TelemetryArtifactAttachment): Promise<TelemetryArtifactReference> | TelemetryArtifactReference;
571
- }
572
- interface TelemetrySpanScope extends TelemetryScope {
573
- readonly traceId: string;
574
- readonly spanId: string;
575
- end(args?: TelemetrySpanEnd): Promise<void> | void;
678
+ //#region ../core/src/contracts/runtimeTypes.d.ts
679
+ /** Opaque unique identifier for a single HumanTask instance. */
680
+ type HumanTaskId = string;
681
+ /**
682
+ * Minimal handle handed to the `deliver` callback so it can route to the correct
683
+ * inbox channel.
684
+ */
685
+ interface HumanTaskHandle {
686
+ readonly taskId: HumanTaskId;
687
+ readonly runId: string;
688
+ readonly nodeId: string;
689
+ readonly expiresAt: Date;
690
+ /** TODO: real signed URL; placeholder empty string for now. */
691
+ readonly resumeUrl: string;
576
692
  /**
577
- * Lift this span into a {@link NodeExecutionTelemetry} scoped to a different (nodeId, activationId).
578
- * Children created via the returned telemetry's `startChildSpan` get this span as their parent.
579
- *
580
- * Used at the sub-agent boundary so that nested runtime telemetry parents under the agent.tool.call
581
- * span instead of the orchestrator's node-level span.
693
+ * Arbitrary JSON metadata copied from `SuspensionRequest.request.metadata` at suspension time.
694
+ * Used by the agent runtime to round-trip the `agentCheckpoint` back to the
695
+ * resumed node via `ctx.resumeContext.task.metadata`.
582
696
  */
583
- asNodeTelemetry(args: Readonly<{
584
- nodeId: NodeId;
585
- activationId: NodeActivationId;
586
- }>): NodeExecutionTelemetry;
697
+ readonly metadata?: Readonly<Record<string, JsonValue>>;
587
698
  }
588
- interface NodeExecutionTelemetry extends ExecutionTelemetry, TelemetrySpanScope {
589
- startChildSpan(args: TelemetryChildSpanStart): TelemetrySpanScope;
699
+ /** Identity of the person who made a decision on the task. */
700
+ interface HumanTaskActor {
701
+ readonly actorId: string;
702
+ readonly displayName?: string;
590
703
  }
591
- interface ExecutionTelemetry extends TelemetryScope {
592
- readonly traceId: string;
593
- readonly spanId: string;
594
- forNode(args: Readonly<{
595
- nodeId: NodeId;
596
- activationId: NodeActivationId;
597
- }>): NodeExecutionTelemetry;
598
- }
599
- //#endregion
600
- //#region ../core/src/contracts/collectionTypes.d.ts
601
704
  /**
602
- * Represents a typed store for a single collection.
603
- * All rows include auto-managed id, created_at, and updated_at fields.
705
+ * Resume context injected into `NodeExecutionContext` when the engine re-activates
706
+ * a previously suspended node. `defineHumanApprovalNode` wraps this with parsed
707
+ * `TDecision`; at the engine layer `decision.value` is `unknown`.
604
708
  */
605
- interface CollectionStore<TRow extends Record<string, unknown> = Record<string, unknown>> {
606
- /**
607
- * Insert a new row. id, created_at, and updated_at are auto-populated.
608
- */
609
- insert(row: TRow): Promise<TRow & {
610
- id: string;
611
- created_at: Date;
612
- updated_at: Date;
613
- }>;
614
- /**
615
- * Get a single row by id.
616
- */
617
- get(id: string): Promise<(TRow & {
618
- id: string;
619
- created_at: Date;
620
- updated_at: Date;
621
- }) | null>;
622
- /**
623
- * Find a single row matching the provided filter.
624
- */
625
- findOne(filter: Partial<TRow>): Promise<(TRow & {
626
- id: string;
627
- created_at: Date;
628
- updated_at: Date;
629
- }) | null>;
630
- /**
631
- * List rows with optional pagination and filtering.
632
- */
633
- list(opts?: {
634
- limit?: number;
635
- offset?: number;
636
- where?: Partial<TRow>;
637
- }): Promise<{
638
- rows: ReadonlyArray<TRow & {
639
- id: string;
640
- created_at: Date;
641
- updated_at: Date;
642
- }>;
643
- total: number;
644
- }>;
645
- /**
646
- * Update a row by id with partial data.
647
- */
648
- update(id: string, patch: Partial<TRow>): Promise<TRow & {
649
- id: string;
650
- created_at: Date;
651
- updated_at: Date;
652
- }>;
653
- /**
654
- * Delete a row by id. Hard delete only (no soft delete).
655
- */
656
- delete(id: string): Promise<{
657
- deleted: boolean;
709
+ interface ResumeContext {
710
+ readonly decision: Readonly<{
711
+ kind: "decided";
712
+ value: unknown;
713
+ actor: HumanTaskActor;
714
+ decidedAt: Date;
715
+ }> | Readonly<{
716
+ kind: "timed_out";
717
+ at: Date;
718
+ }> | Readonly<{
719
+ kind: "auto_accepted";
720
+ at: Date;
658
721
  }>;
722
+ readonly delivery: JsonValue;
723
+ readonly task: HumanTaskHandle;
659
724
  }
660
- /**
661
- * Runtime collections context: keyed by collection name.
662
- */
663
- type CollectionsContext = Readonly<Record<string, CollectionStore>>;
664
- //#endregion
665
- //#region ../core/src/contracts/runtimeTypes.d.ts
666
725
  interface NodeExecutionStatePublisher {
667
726
  markQueued(args: {
668
727
  nodeId: NodeId;
@@ -719,6 +778,22 @@ interface ExecutionBinaryService {
719
778
  activationId: NodeActivationId;
720
779
  }): NodeBinaryAttachmentService;
721
780
  openReadStream(attachment: BinaryAttachment): Promise<BinaryStorageReadResult | undefined>;
781
+ /**
782
+ * Reads all bytes from the attachment into a contiguous `Uint8Array`.
783
+ * Checks `attachment.size` against `maxBytes` *before* any allocation; throws a bounded-read
784
+ * error when exceeded (no OOM). Throws if the stream is unavailable or the byte count mismatches.
785
+ */
786
+ getBytes(attachment: BinaryAttachment, maxBytes?: number): Promise<Uint8Array>;
787
+ /**
788
+ * Reads the attachment and decodes the bytes as UTF-8 text.
789
+ * Subject to the same bounded-read safety as `getBytes`.
790
+ */
791
+ getText(attachment: BinaryAttachment, maxBytes?: number): Promise<string>;
792
+ /**
793
+ * Reads the attachment, decodes as UTF-8 text, and parses as JSON.
794
+ * Throws a clear error on invalid JSON. Subject to the same bounded-read safety.
795
+ */
796
+ getJson<T = unknown>(attachment: BinaryAttachment, maxBytes?: number): Promise<T>;
722
797
  }
723
798
  interface ExecutionContext {
724
799
  runId: RunId;
@@ -751,6 +826,14 @@ interface ExecutionContext {
751
826
  * Collections registered in the codemation config, keyed by collection name.
752
827
  */
753
828
  readonly collections?: CollectionsContext;
829
+ /**
830
+ * Resolve a DI token from the host container.
831
+ * Allows nodes to reach host-side services (e.g. `InboxChannelResolverToken`)
832
+ * without importing host code. Wired by `DefaultExecutionContextFactory`; throws
833
+ * a clear error when no resolver is configured (e.g. in unit tests that don't
834
+ * set up the full container).
835
+ */
836
+ resolve<T>(token: TypeToken<T>): T;
754
837
  }
755
838
  interface NodeExecutionContext<TConfig extends NodeConfigBase = NodeConfigBase> extends ExecutionContext {
756
839
  nodeId: NodeId;
@@ -758,7 +841,12 @@ interface NodeExecutionContext<TConfig extends NodeConfigBase = NodeConfigBase>
758
841
  config: TConfig;
759
842
  telemetry: NodeExecutionTelemetry;
760
843
  binary: NodeBinaryAttachmentService;
844
+ /**
845
+ * Present when this node activation is a HITL resume.
846
+ * The node checks `ctx.resumeContext !== undefined` and takes the resume branch.
847
+ */
848
+ resumeContext?: ResumeContext;
761
849
  }
762
850
  //#endregion
763
- export { CredentialSessionFactory as _, NodeActivationId as a, WorkflowId as b, RunnableNodeConfig as c, CredentialAdvancedSectionPresentation as d, CredentialAuthDefinition as f, CredentialMaterialSourceKind as g, CredentialJsonRecord as h, Items as i, WorkflowDefinition as l, CredentialHealthTester as m, TypeToken as n, RunDataSnapshot as o, CredentialFieldSchema as p, Item as r, RunId as s, Container as t, AnyCredentialType as u, CredentialTypeId as v, NodeId as y };
764
- //# sourceMappingURL=runtimeTypes-ffl603pJ.d.cts.map
851
+ export { CredentialSessionFactory as _, RunId as a, WorkflowId as b, Container as c, CredentialAdvancedSectionPresentation as d, CredentialAuthDefinition as f, CredentialMaterialSourceKind as g, CredentialJsonRecord as h, RunDataSnapshot as i, TypeToken as l, CredentialHealthTester as m, Items as n, RunnableNodeConfig as o, CredentialFieldSchema as p, NodeActivationId as r, WorkflowDefinition as s, Item as t, AnyCredentialType as u, CredentialTypeId as v, NodeId as y };
852
+ //# sourceMappingURL=runtimeTypes-WCvsnJMY.d.cts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemation/core-nodes-ocr",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Azure AI Content Understanding (OCR) plugin for Codemation — prebuilt document, invoice, and image analyzers.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -44,7 +44,7 @@
44
44
  "@azure/ai-content-understanding": "^1.0.0",
45
45
  "@azure/core-auth": "^1.10.1",
46
46
  "zod": "^4.3.6",
47
- "@codemation/core": "0.11.1"
47
+ "@codemation/core": "0.13.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/node": "^25.3.5",
@@ -2,7 +2,6 @@ import { defineNode } from "@codemation/core";
2
2
  import type { AzureContentUnderstandingSession } from "../credentials/azureContentUnderstandingCredential";
3
3
  import { azureContentUnderstandingCredentialType } from "../credentials/azureContentUnderstandingCredential";
4
4
  import { analyzeWithAzure } from "../lib/analyzeWithAzure";
5
- import { readBinaryBody } from "../lib/readBinaryBody";
6
5
 
7
6
  /** Default Azure Content Understanding prebuilt general document analyzer ID. */
8
7
  const DEFAULT_DOCUMENT_ANALYZER_ID = "prebuilt-document";
@@ -64,7 +63,7 @@ export const analyzeDocumentNode = defineNode({
64
63
  }
65
64
  const analyzerId = config.analyzerId ?? DEFAULT_DOCUMENT_ANALYZER_ID;
66
65
  const contentType = config.contentType ?? attachment.mimeType ?? "application/octet-stream";
67
- const body = await readBinaryBody(ctx, attachment, config.maxBytes);
66
+ const body = await ctx.binary.getBytes(attachment, config.maxBytes);
68
67
  return analyzeWithAzure({ session, analyzerId, body, contentType });
69
68
  },
70
69
  });
@@ -2,7 +2,6 @@ import { defineNode } from "@codemation/core";
2
2
  import type { AzureContentUnderstandingSession } from "../credentials/azureContentUnderstandingCredential";
3
3
  import { azureContentUnderstandingCredentialType } from "../credentials/azureContentUnderstandingCredential";
4
4
  import { analyzeWithAzure } from "../lib/analyzeWithAzure";
5
- import { readBinaryBody } from "../lib/readBinaryBody";
6
5
 
7
6
  /** Default Azure Content Understanding prebuilt image analyzer ID. */
8
7
  const DEFAULT_IMAGE_ANALYZER_ID = "prebuilt-imageAnalyzer";
@@ -64,7 +63,7 @@ export const analyzeImageNode = defineNode({
64
63
  }
65
64
  const analyzerId = config.analyzerId ?? DEFAULT_IMAGE_ANALYZER_ID;
66
65
  const contentType = config.contentType ?? attachment.mimeType ?? "application/octet-stream";
67
- const body = await readBinaryBody(ctx, attachment, config.maxBytes);
66
+ const body = await ctx.binary.getBytes(attachment, config.maxBytes);
68
67
  return analyzeWithAzure({ session, analyzerId, body, contentType });
69
68
  },
70
69
  });
@@ -2,7 +2,6 @@ import { defineNode } from "@codemation/core";
2
2
  import type { AzureContentUnderstandingSession } from "../credentials/azureContentUnderstandingCredential";
3
3
  import { azureContentUnderstandingCredentialType } from "../credentials/azureContentUnderstandingCredential";
4
4
  import { analyzeWithAzure } from "../lib/analyzeWithAzure";
5
- import { readBinaryBody } from "../lib/readBinaryBody";
6
5
 
7
6
  /** Azure Content Understanding prebuilt invoice analyzer ID. */
8
7
  const PREBUILT_INVOICE_ANALYZER_ID = "prebuilt-invoice";
@@ -55,7 +54,7 @@ export const analyzeInvoiceNode = defineNode({
55
54
  throw new Error(`Analyze Invoice: no binary attachment at key "${binaryField}".`);
56
55
  }
57
56
  const contentType = config.contentType ?? attachment.mimeType ?? "application/octet-stream";
58
- const body = await readBinaryBody(ctx, attachment, config.maxBytes);
57
+ const body = await ctx.binary.getBytes(attachment, config.maxBytes);
59
58
  return analyzeWithAzure({ session, analyzerId: PREBUILT_INVOICE_ANALYZER_ID, body, contentType });
60
59
  },
61
60
  });