@docmana/sdk 0.28.1 → 0.36.0-hitl.2

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,180 @@
1
+ import type { HttpClient } from "./http/http-client.js";
2
+ import type { ExecutionStatus } from "./models/execution-status.enum.js";
3
+ export interface ReviewCalculation {
4
+ executionResultId: string;
5
+ executionStatus: ExecutionStatus;
6
+ /** Null for legacy/unmarked executions. Never inferred from review status. */
7
+ calculation: {
8
+ /** Review owning these coherent outputs; absent during calculation/finalization. */
9
+ reviewId?: string;
10
+ mode: "runAhead";
11
+ status: "calculating" | "completed" | "recalculating" | "finalizing" | "finalized" | "failed";
12
+ /** Coherent calculation revision; distinct from ReviewTask.version. */
13
+ revision: number;
14
+ targetRevision?: number;
15
+ provisional: boolean;
16
+ totalReviews?: number;
17
+ approvedReviews?: number;
18
+ remainingReviews?: number;
19
+ /** Node executions, not individual model calls. */
20
+ computedNodes?: number;
21
+ reusedNodes?: number;
22
+ } | null;
23
+ }
24
+ export interface ReviewFlowOutline {
25
+ flowId: string;
26
+ name?: string;
27
+ version: number | null;
28
+ nodes: Array<{
29
+ nodeId: string;
30
+ name?: string | null;
31
+ label?: string | null;
32
+ type: string;
33
+ enabled: boolean;
34
+ order: number;
35
+ humanReview?: {
36
+ enabled: boolean;
37
+ instructions?: string;
38
+ skipWhenScoreAtLeast?: number | null;
39
+ };
40
+ }>;
41
+ edges: Array<{
42
+ source: string;
43
+ target: string;
44
+ }>;
45
+ }
46
+ export interface DocumentPreviewManifest {
47
+ status: "queued" | "processing" | "ready" | "limited" | "failed" | "unavailable";
48
+ version: string;
49
+ pageCount: number;
50
+ renderedPages: number;
51
+ pages: Array<{
52
+ number: number;
53
+ width?: number;
54
+ height?: number;
55
+ }>;
56
+ retryAfterMs: number;
57
+ }
58
+ export interface ReviewItem {
59
+ itemId: string;
60
+ kind: "field" | "classification" | "status";
61
+ nodeId: string | null;
62
+ nodeName: string;
63
+ field: string;
64
+ value: unknown;
65
+ }
66
+ export interface ReviewDocument {
67
+ docKey: string;
68
+ name: string | null;
69
+ pageFrom?: number | null;
70
+ pageTo?: number | null;
71
+ pageCount?: number | null;
72
+ pages?: Array<{
73
+ number: number;
74
+ imageUrl: string;
75
+ thumbnailUrl: string;
76
+ }>;
77
+ renderedPages?: number;
78
+ pagesComplete?: boolean;
79
+ contentUrl?: string;
80
+ items?: ReviewItem[];
81
+ context?: ReviewItem[];
82
+ /** Read-only evidence from the frozen pause; absent on older backends. */
83
+ assessments?: ReviewAssessment[];
84
+ }
85
+ export interface ReviewAssessment {
86
+ nodeId: string | null;
87
+ nodeName: string;
88
+ /** Stored node score, 0..100. Not a per-field confidence estimate. */
89
+ score?: number;
90
+ scoreDescription?: unknown;
91
+ feedback?: unknown;
92
+ explanation?: unknown;
93
+ reasoning?: unknown;
94
+ }
95
+ export interface ReviewSummary {
96
+ reviewId: string;
97
+ executionResultId: string;
98
+ flowId: string;
99
+ flowVersion: number | string | null;
100
+ status: string;
101
+ version: number;
102
+ createdAt?: string | null;
103
+ expiresAt: string | null;
104
+ node: {
105
+ nodeId: string;
106
+ nodeName: string | null;
107
+ nodeType: string | null;
108
+ instructions?: string;
109
+ };
110
+ documents: ReviewDocument[];
111
+ level?: "dossier";
112
+ }
113
+ export interface ReviewTask extends ReviewSummary {
114
+ /** Explicit frozen field signals. Missing/empty keeps legacy UI and global confirmation. */
115
+ findings?: ReviewFinding[];
116
+ /** Native lifecycle timestamps, absent on older backends; never inferred from callbacks. */
117
+ submittedAt?: string | null;
118
+ resumingAt?: string | null;
119
+ closedAt?: string | null;
120
+ }
121
+ export interface ReviewFinding {
122
+ id: string;
123
+ code: string;
124
+ /** Producer's concise user-facing explanation, never hidden model reasoning. */
125
+ message: string;
126
+ itemIds: string[];
127
+ source?: "model" | "rule";
128
+ }
129
+ export interface ReviewDecision {
130
+ decision: "continue" | "exclude" | "rerun" | "reject";
131
+ reviewer: string;
132
+ version: number;
133
+ corrections?: Array<{
134
+ itemId: string;
135
+ value: unknown;
136
+ }>;
137
+ excludedDocuments?: string[];
138
+ rerunDocuments?: string[];
139
+ hint?: string;
140
+ reason?: string;
141
+ }
142
+ export interface ReviewReadOptions {
143
+ organization: string;
144
+ signal?: AbortSignal;
145
+ }
146
+ export interface ReviewDocumentOptions extends ReviewReadOptions {
147
+ version?: string;
148
+ size?: "full" | "thumb";
149
+ range?: string;
150
+ ifRange?: string;
151
+ ifNoneMatch?: string;
152
+ ifModifiedSince?: string;
153
+ }
154
+ /** Human review of a formula execution. Independent of pipelines and final callbacks. */
155
+ export declare class Reviews {
156
+ private readonly http;
157
+ constructor(http: HttpClient);
158
+ /** Repeatable metadata read: never consumes the final execution result. */
159
+ calculation(executionId: string, options: ReviewReadOptions): Promise<ReviewCalculation>;
160
+ /** Published formula structure only. Compare its version with the review's flowVersion. */
161
+ outline(flowId: string, options: ReviewReadOptions): Promise<ReviewFlowOutline>;
162
+ list(options: ReviewReadOptions & {
163
+ status?: "pending" | "submitted" | "resuming";
164
+ cursor?: string;
165
+ limit?: number;
166
+ }): Promise<{
167
+ reviews: ReviewSummary[];
168
+ nextCursor: string | null;
169
+ }>;
170
+ get(executionId: string, options: ReviewReadOptions): Promise<ReviewTask>;
171
+ decide(executionId: string, decision: ReviewDecision, options: ReviewReadOptions): Promise<{
172
+ executionResultId: string;
173
+ reviewId: string;
174
+ status: "Queued";
175
+ }>;
176
+ /** Streaming Response: callers own consumption/cancellation. Never buffers the PDF. */
177
+ document(executionId: string, docKey: string, resource: "content" | "locations" | "preview" | {
178
+ page: number;
179
+ }, options: ReviewDocumentOptions): Promise<Response>;
180
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docmana/sdk",
3
- "version": "0.28.1",
3
+ "version": "0.36.0-hitl.2",
4
4
  "description": "Official Docmana SDK — run document-analysis flows with a single call.",
5
5
  "license": "MIT",
6
6
  "type": "module",