@docmana/sdk 0.46.0 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,81 @@
1
+ export declare const EXECUTION_PROGRESS_TYPE: "execution.progress";
2
+ export declare const PROGRESS_MESSAGE_KEYS: readonly ["resume.running", "resume.awaitingReview", "resume.completed", "resume.rejected", "resume.failed", "node.pending", "node.running", "node.done", "node.failed", "node.reused", "node.skipped", "item.pending", "item.running", "item.llmCall", "item.llmCallRetry", "item.subagent", "item.subagentBatch", "item.ocrCall", "item.done", "item.failed", "item.reused", "item.skippedAncestorFailed", "item.skippedBranchNotTaken"];
3
+ export type ResumeProgressStatus = "pending" | "running" | "done" | "failed" | "skipped" | "reused";
4
+ export interface ProgressMessage {
5
+ key: (typeof PROGRESS_MESSAGE_KEYS)[number];
6
+ params: {
7
+ nodeId?: string;
8
+ docKey?: string;
9
+ branchId?: string | null;
10
+ done?: number;
11
+ total?: number;
12
+ attempt?: number;
13
+ batch?: number;
14
+ batches?: number;
15
+ };
16
+ }
17
+ export interface ResumeProgressItem {
18
+ documentKey: string;
19
+ branchId: string | null;
20
+ status: ResumeProgressStatus;
21
+ startedAt: string | null;
22
+ endedAt: string | null;
23
+ activity: null | {
24
+ kind: "llm_call" | "subagent" | "ocr_call";
25
+ attempt: number | null;
26
+ batch: number | null;
27
+ batches: number | null;
28
+ };
29
+ message: ProgressMessage;
30
+ }
31
+ export interface ResumeProgressNode {
32
+ nodeId: string;
33
+ nodeType: string;
34
+ status: ResumeProgressStatus;
35
+ /** Work items, including branches; not a count of unique physical documents. */
36
+ documents: {
37
+ total: number;
38
+ pending: number;
39
+ running: number;
40
+ done: number;
41
+ failed: number;
42
+ skipped: number;
43
+ reused: number;
44
+ };
45
+ message: ProgressMessage;
46
+ items: ResumeProgressItem[];
47
+ }
48
+ export interface ExecutionResumeProgress {
49
+ schemaVersion: 1;
50
+ eventId: string;
51
+ type: typeof EXECUTION_PROGRESS_TYPE;
52
+ organization: string;
53
+ executionResultId: string;
54
+ flowId: string;
55
+ flowVersion: number | null;
56
+ reviewId: string;
57
+ /** Opaque resume-attempt timestamp. Order snapshots using stateVersion only. */
58
+ revision: string;
59
+ stateVersion: number;
60
+ phase: "running" | "awaiting_review" | "completed" | "rejected" | "failed";
61
+ message: ProgressMessage;
62
+ updatedAt: string;
63
+ publishedAt?: string;
64
+ itemsTruncated: boolean;
65
+ nodesTruncated: boolean;
66
+ nodes: ResumeProgressNode[];
67
+ }
68
+ export interface ResumeProgressLabels {
69
+ nodes: Record<string, {
70
+ name: string | null;
71
+ type: string;
72
+ }>;
73
+ documents: Record<string, string | null>;
74
+ branches: Record<string, string | null>;
75
+ }
76
+ export interface ResumeProgressResponse extends ExecutionResumeProgress {
77
+ labels: ResumeProgressLabels;
78
+ }
79
+ /** Validates and projects the closed public callback contract. Never returns output values or labels. */
80
+ export declare function parseExecutionProgress(value: unknown): ExecutionResumeProgress;
81
+ export declare function parseResumeProgressResponse(value: unknown): ResumeProgressResponse;
package/dist/reviews.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { HttpClient } from "./http/http-client.js";
2
+ import { type ResumeProgressResponse } from "./resume-progress.js";
2
3
  import type { GroundingBox, GroundingOrigin } from "./models/docmana-extraction-result.model.js";
3
4
  import type { ExecutionStatus } from "./models/execution-status.enum.js";
4
5
  export type ReviewExecutionSort = "createdAt" | "executionResultId" | "flowId" | "executionStatus";
@@ -85,10 +86,26 @@ export interface DocumentPreviewManifest {
85
86
  height?: number;
86
87
  }>;
87
88
  retryAfterMs: number;
89
+ requestedLanguage?: string;
90
+ servedLanguage?: string | null;
91
+ variant?: DocumentVariant;
92
+ fallback?: boolean;
93
+ translationState?: DocumentTranslationState;
94
+ }
95
+ export type DocumentVariant = "original" | "translation";
96
+ export type DocumentTranslationState = "absent" | "preparing" | "ready" | "failed" | "unsupported";
97
+ export interface DocumentTranslation {
98
+ status: 200 | 202;
99
+ requestedLanguage: string;
100
+ servedLanguage: string | null;
101
+ variant: DocumentVariant;
102
+ fallback: boolean;
103
+ translationState: DocumentTranslationState;
88
104
  }
89
105
  export interface ReviewItem {
90
106
  itemId: string;
91
- kind: "field" | "classification" | "status";
107
+ /** Native Receivability verdict: field __decision__, accepted/rejected; independent of formula fields. */
108
+ kind: "field" | "classification" | "status" | "verdict";
92
109
  nodeId: string | null;
93
110
  nodeName: string;
94
111
  field: string;
@@ -168,6 +185,8 @@ export interface ReviewTask extends ReviewSummary {
168
185
  submittedAt?: string | null;
169
186
  resumingAt?: string | null;
170
187
  closedAt?: string | null;
188
+ /** Human business outcome of an approved conclusion, distinct from technical execution status. */
189
+ outcome?: "accepted" | "refused";
171
190
  }
172
191
  export interface ReviewFinding {
173
192
  id: string;
@@ -191,7 +210,7 @@ export interface ReviewDecision {
191
210
  */
192
211
  reviewer?: ReviewReviewerIdentity | string;
193
212
  version: number;
194
- /** Current items or upstream context fields/classifications, never downstream/status items. */
213
+ /** Current/upstream fields, classifications or native verdicts; never downstream/status items. */
195
214
  corrections?: Array<{
196
215
  itemId: string;
197
216
  value: unknown;
@@ -210,7 +229,10 @@ export interface ReviewDecision {
210
229
  excludedDocuments?: string[];
211
230
  rerunDocuments?: string[];
212
231
  hint?: string;
232
+ /** Required for a final outcome or technical rejection; optional for exclusion. */
213
233
  reason?: string;
234
+ /** Finish only: continue with reason and no corrections, without recomputing calculated values. */
235
+ outcome?: "accepted" | "refused";
214
236
  }
215
237
  export interface ReviewReadOptions {
216
238
  organization: string;
@@ -219,6 +241,7 @@ export interface ReviewReadOptions {
219
241
  export interface ReviewDocumentOptions extends ReviewReadOptions {
220
242
  version?: string;
221
243
  size?: "full" | "thumb";
244
+ language?: string;
222
245
  range?: string;
223
246
  ifRange?: string;
224
247
  ifNoneMatch?: string;
@@ -240,6 +263,8 @@ export interface ReviewLocationsResponse {
240
263
  /** Human review of a formula execution. Independent of pipelines and final callbacks. */
241
264
  export declare class Reviews {
242
265
  private readonly http;
266
+ /** One non-consuming snapshot read for opening/reconnecting a view. No polling. */
267
+ progress(executionId: string, options: ReviewReadOptions): Promise<ResumeProgressResponse>;
243
268
  constructor(http: HttpClient);
244
269
  /** Read a page of HITL execution metadata without consuming any result. */
245
270
  listExecutions(options: ReviewExecutionListOptions): Promise<ReviewExecutionPage>;
@@ -266,4 +291,5 @@ export declare class Reviews {
266
291
  document(executionId: string, docKey: string, resource: "content" | "locations" | "preview" | {
267
292
  page: number;
268
293
  }, options: ReviewDocumentOptions): Promise<Response>;
294
+ requestDocumentTranslation(executionId: string, docKey: string, language: string, options: ReviewReadOptions): Promise<DocumentTranslation>;
269
295
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docmana/sdk",
3
- "version": "0.46.0",
3
+ "version": "0.48.0",
4
4
  "description": "Official Docmana SDK — run document-analysis flows with a single call.",
5
5
  "license": "MIT",
6
6
  "type": "module",