@docmana/sdk 0.45.0 → 0.47.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.
- package/CHANGELOG.md +13 -0
- package/README.md +36 -0
- package/dist/cli.mjs +428 -219
- package/dist/cli.mjs.map +1 -1
- package/dist/execution-events.d.ts +2 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +452 -235
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +448 -235
- package/dist/index.mjs.map +1 -1
- package/dist/resume-progress.d.ts +81 -0
- package/dist/reviews.d.ts +43 -2
- package/package.json +13 -9
|
@@ -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,6 +1,37 @@
|
|
|
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";
|
|
5
|
+
export type ReviewExecutionSort = "createdAt" | "executionResultId" | "flowId" | "executionStatus";
|
|
6
|
+
export interface ReviewExecutionListOptions extends ReviewReadOptions {
|
|
7
|
+
flowId?: string;
|
|
8
|
+
executionId?: string;
|
|
9
|
+
/** Defaults to 50. Maximum 100. */
|
|
10
|
+
limit?: number;
|
|
11
|
+
/** Zero-based offset. Defaults to zero. */
|
|
12
|
+
offset?: number;
|
|
13
|
+
sortBy?: ReviewExecutionSort;
|
|
14
|
+
sortDirection?: "asc" | "desc";
|
|
15
|
+
}
|
|
16
|
+
export interface ReviewExecution {
|
|
17
|
+
executionResultId: string;
|
|
18
|
+
flowId: string;
|
|
19
|
+
flowVersion: number | null;
|
|
20
|
+
executionStatus: ExecutionStatus | "UNKNOWN";
|
|
21
|
+
createdAt: string | null;
|
|
22
|
+
activeReview: {
|
|
23
|
+
reviewId: string;
|
|
24
|
+
version: number;
|
|
25
|
+
nodeName: string | null;
|
|
26
|
+
nodeType: string | null;
|
|
27
|
+
} | null;
|
|
28
|
+
}
|
|
29
|
+
export interface ReviewExecutionPage {
|
|
30
|
+
items: ReviewExecution[];
|
|
31
|
+
limit: number;
|
|
32
|
+
offset: number;
|
|
33
|
+
total: number;
|
|
34
|
+
}
|
|
4
35
|
export interface ReviewCalculation {
|
|
5
36
|
executionResultId: string;
|
|
6
37
|
executionStatus: ExecutionStatus;
|
|
@@ -58,7 +89,8 @@ export interface DocumentPreviewManifest {
|
|
|
58
89
|
}
|
|
59
90
|
export interface ReviewItem {
|
|
60
91
|
itemId: string;
|
|
61
|
-
|
|
92
|
+
/** Native Receivability verdict: field __decision__, accepted/rejected; independent of formula fields. */
|
|
93
|
+
kind: "field" | "classification" | "status" | "verdict";
|
|
62
94
|
nodeId: string | null;
|
|
63
95
|
nodeName: string;
|
|
64
96
|
field: string;
|
|
@@ -138,6 +170,8 @@ export interface ReviewTask extends ReviewSummary {
|
|
|
138
170
|
submittedAt?: string | null;
|
|
139
171
|
resumingAt?: string | null;
|
|
140
172
|
closedAt?: string | null;
|
|
173
|
+
/** Human business outcome of an approved conclusion, distinct from technical execution status. */
|
|
174
|
+
outcome?: "accepted" | "refused";
|
|
141
175
|
}
|
|
142
176
|
export interface ReviewFinding {
|
|
143
177
|
id: string;
|
|
@@ -161,7 +195,7 @@ export interface ReviewDecision {
|
|
|
161
195
|
*/
|
|
162
196
|
reviewer?: ReviewReviewerIdentity | string;
|
|
163
197
|
version: number;
|
|
164
|
-
/** Current
|
|
198
|
+
/** Current/upstream fields, classifications or native verdicts; never downstream/status items. */
|
|
165
199
|
corrections?: Array<{
|
|
166
200
|
itemId: string;
|
|
167
201
|
value: unknown;
|
|
@@ -180,7 +214,10 @@ export interface ReviewDecision {
|
|
|
180
214
|
excludedDocuments?: string[];
|
|
181
215
|
rerunDocuments?: string[];
|
|
182
216
|
hint?: string;
|
|
217
|
+
/** Required for a final outcome or technical rejection; optional for exclusion. */
|
|
183
218
|
reason?: string;
|
|
219
|
+
/** Finish only: continue with reason and no corrections, without recomputing calculated values. */
|
|
220
|
+
outcome?: "accepted" | "refused";
|
|
184
221
|
}
|
|
185
222
|
export interface ReviewReadOptions {
|
|
186
223
|
organization: string;
|
|
@@ -210,7 +247,11 @@ export interface ReviewLocationsResponse {
|
|
|
210
247
|
/** Human review of a formula execution. Independent of pipelines and final callbacks. */
|
|
211
248
|
export declare class Reviews {
|
|
212
249
|
private readonly http;
|
|
250
|
+
/** One non-consuming snapshot read for opening/reconnecting a view. No polling. */
|
|
251
|
+
progress(executionId: string, options: ReviewReadOptions): Promise<ResumeProgressResponse>;
|
|
213
252
|
constructor(http: HttpClient);
|
|
253
|
+
/** Read a page of HITL execution metadata without consuming any result. */
|
|
254
|
+
listExecutions(options: ReviewExecutionListOptions): Promise<ReviewExecutionPage>;
|
|
214
255
|
/** Repeatable metadata read: never consumes the final execution result. */
|
|
215
256
|
calculation(executionId: string, options: ReviewReadOptions): Promise<ReviewCalculation>;
|
|
216
257
|
/** Published formula structure only. Compare its version with the review's flowVersion. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docmana/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.0",
|
|
4
4
|
"description": "Official Docmana SDK — run document-analysis flows with a single call.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -51,20 +51,24 @@
|
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@eslint/js": "^10.0.1",
|
|
53
53
|
"@types/node": "^25.9.3",
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
55
|
-
"@typescript-eslint/parser": "^8.
|
|
56
|
-
"@vitest/coverage-v8": "^4.1.
|
|
57
|
-
"eslint": "^10.
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "^8.73.0",
|
|
55
|
+
"@typescript-eslint/parser": "^8.73.0",
|
|
56
|
+
"@vitest/coverage-v8": "^4.1.12",
|
|
57
|
+
"eslint": "^10.15.0",
|
|
58
58
|
"prettier": "^3.8.4",
|
|
59
59
|
"tsup": "^8.5.1",
|
|
60
60
|
"tsx": "^4.22.4",
|
|
61
61
|
"typescript": "^6.0.3",
|
|
62
|
-
"typescript-eslint": "^8.
|
|
63
|
-
"undici": "^8.
|
|
64
|
-
"vitest": "^4.1.
|
|
62
|
+
"typescript-eslint": "^8.73.0",
|
|
63
|
+
"undici": "^8.12.2",
|
|
64
|
+
"vitest": "^4.1.12",
|
|
65
65
|
"yalc": "^1.0.0-pre.53"
|
|
66
66
|
},
|
|
67
67
|
"overrides": {
|
|
68
|
-
"esbuild": "0.28.1"
|
|
68
|
+
"esbuild": "0.28.1",
|
|
69
|
+
"brace-expansion@1": "1.1.21",
|
|
70
|
+
"brace-expansion@5": "5.0.12",
|
|
71
|
+
"source-map-js": "1.2.2",
|
|
72
|
+
"vite": "8.3.8"
|
|
69
73
|
}
|
|
70
74
|
}
|