dsh-ab-ocr 0.1.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/LICENSE +21 -0
- package/README.md +378 -0
- package/cordis.patch.yml +7 -0
- package/lib/artifacts.d.ts +100 -0
- package/lib/artifacts.d.ts.map +1 -0
- package/lib/artifacts.js +97 -0
- package/lib/artifacts.js.map +1 -0
- package/lib/config.d.ts +77 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +51 -0
- package/lib/config.js.map +1 -0
- package/lib/documents.d.ts +62 -0
- package/lib/documents.d.ts.map +1 -0
- package/lib/documents.js +173 -0
- package/lib/documents.js.map +1 -0
- package/lib/events.d.ts +161 -0
- package/lib/events.d.ts.map +1 -0
- package/lib/events.js +158 -0
- package/lib/events.js.map +1 -0
- package/lib/filename.d.ts +47 -0
- package/lib/filename.d.ts.map +1 -0
- package/lib/filename.js +77 -0
- package/lib/filename.js.map +1 -0
- package/lib/index.d.ts +85 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +1761 -0
- package/lib/index.js.map +1 -0
- package/lib/levels.d.ts +24 -0
- package/lib/levels.d.ts.map +1 -0
- package/lib/levels.js +52 -0
- package/lib/levels.js.map +1 -0
- package/lib/plan.d.ts +103 -0
- package/lib/plan.d.ts.map +1 -0
- package/lib/plan.js +210 -0
- package/lib/plan.js.map +1 -0
- package/lib/recognize.d.ts +36 -0
- package/lib/recognize.d.ts.map +1 -0
- package/lib/recognize.js +390 -0
- package/lib/recognize.js.map +1 -0
- package/lib/records.d.ts +91 -0
- package/lib/records.d.ts.map +1 -0
- package/lib/records.js +130 -0
- package/lib/records.js.map +1 -0
- package/lib/render.d.ts +19 -0
- package/lib/render.d.ts.map +1 -0
- package/lib/render.js +45 -0
- package/lib/render.js.map +1 -0
- package/lib/sandbox.d.ts +54 -0
- package/lib/sandbox.d.ts.map +1 -0
- package/lib/sandbox.js +101 -0
- package/lib/sandbox.js.map +1 -0
- package/lib/types.d.ts +147 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +7 -0
- package/lib/types.js.map +1 -0
- package/lib/worker.d.ts +107 -0
- package/lib/worker.d.ts.map +1 -0
- package/lib/worker.js +143 -0
- package/lib/worker.js.map +1 -0
- package/package.json +98 -0
- package/python/README.md +125 -0
- package/python/assemble.py +358 -0
- package/python/clean.py +197 -0
- package/python/layout.py +403 -0
- package/python/ocr_worker.py +516 -0
- package/python/requirements.txt +16 -0
- package/python/source.py +182 -0
- package/scripts/setup.mjs +251 -0
- package/tsconfig.json +30 -0
- package/tsdown.config.ts +18 -0
package/lib/render.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model-facing text of one ocr call's result. Pure: it reads only the canonical
|
|
3
|
+
* value the call recorded, so a replayed session renders the same lines.
|
|
4
|
+
* @module @deepseek-ai/dsh-ab-ocr/render
|
|
5
|
+
*/
|
|
6
|
+
import type { OcrDocument, OcrResult } from './types.ts';
|
|
7
|
+
/**
|
|
8
|
+
* Describe one recognized document.
|
|
9
|
+
* @param document - the document's canonical value.
|
|
10
|
+
* @returns the document's result lines.
|
|
11
|
+
*/
|
|
12
|
+
export declare function renderDocument(document: OcrDocument): string;
|
|
13
|
+
/**
|
|
14
|
+
* Compose the model-facing text of one call's result.
|
|
15
|
+
* @param value - the canonical value the call recorded.
|
|
16
|
+
* @returns one block per document, then one per failure.
|
|
17
|
+
*/
|
|
18
|
+
export declare function renderOcr(value: OcrResult): string;
|
|
19
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAExD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,CAkB5D;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAOlD"}
|
package/lib/render.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model-facing text of one ocr call's result. Pure: it reads only the canonical
|
|
3
|
+
* value the call recorded, so a replayed session renders the same lines.
|
|
4
|
+
* @module @deepseek-ai/dsh-ab-ocr/render
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Describe one recognized document.
|
|
8
|
+
* @param document - the document's canonical value.
|
|
9
|
+
* @returns the document's result lines.
|
|
10
|
+
*/
|
|
11
|
+
export function renderDocument(document) {
|
|
12
|
+
const scope = document.pages === document.totalPages
|
|
13
|
+
? String(document.pages)
|
|
14
|
+
: document.pages + ' of ' + document.totalPages;
|
|
15
|
+
const lines = [
|
|
16
|
+
document.corrections > 0
|
|
17
|
+
? 'Corrected ' + document.corrections + ' heading level(s) in ' + document.input
|
|
18
|
+
: 'Recognized ' + document.input,
|
|
19
|
+
'Saved to ' + document.output,
|
|
20
|
+
'Pages: ' + scope + ' | lines: ' + document.lines + ' | headings: ' + document.headings
|
|
21
|
+
+ ' | characters: ' + document.chars,
|
|
22
|
+
'Removed ' + document.droppedPageNumbers + ' page numbers and '
|
|
23
|
+
+ document.droppedRunningHeads + ' running heads; joined '
|
|
24
|
+
+ document.joinedAcrossPages + ' paragraph(s) across a page break',
|
|
25
|
+
];
|
|
26
|
+
if (document.pageDir !== '')
|
|
27
|
+
lines.push('Per-page text: ' + document.pageDir);
|
|
28
|
+
lines.push('Outline: ' + document.outlinePath + (document.outlineTruncated ? ' (incomplete)' : ''));
|
|
29
|
+
return lines.join('\n');
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Compose the model-facing text of one call's result.
|
|
33
|
+
* @param value - the canonical value the call recorded.
|
|
34
|
+
* @returns one block per document, then one per failure.
|
|
35
|
+
*/
|
|
36
|
+
export function renderOcr(value) {
|
|
37
|
+
const blocks = value.documents.map(renderDocument);
|
|
38
|
+
for (const failure of value.failures) {
|
|
39
|
+
blocks.push('Failed ' + failure.input + '\n' + failure.error);
|
|
40
|
+
}
|
|
41
|
+
if (blocks.length === 0)
|
|
42
|
+
return 'Nothing was recognized.';
|
|
43
|
+
return blocks.join('\n\n---\n\n');
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,QAAqB;IAClD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,KAAK,QAAQ,CAAC,UAAU;QAClD,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QACxB,CAAC,CAAC,QAAQ,CAAC,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAA;IACjD,MAAM,KAAK,GAAG;QACZ,QAAQ,CAAC,WAAW,GAAG,CAAC;YACtB,CAAC,CAAC,YAAY,GAAG,QAAQ,CAAC,WAAW,GAAG,uBAAuB,GAAG,QAAQ,CAAC,KAAK;YAChF,CAAC,CAAC,aAAa,GAAG,QAAQ,CAAC,KAAK;QAClC,WAAW,GAAG,QAAQ,CAAC,MAAM;QAC7B,SAAS,GAAG,KAAK,GAAG,YAAY,GAAG,QAAQ,CAAC,KAAK,GAAG,eAAe,GAAG,QAAQ,CAAC,QAAQ;cACnF,iBAAiB,GAAG,QAAQ,CAAC,KAAK;QACtC,UAAU,GAAG,QAAQ,CAAC,kBAAkB,GAAG,oBAAoB;cAC3D,QAAQ,CAAC,mBAAmB,GAAG,yBAAyB;cACxD,QAAQ,CAAC,iBAAiB,GAAG,mCAAmC;KACrE,CAAA;IACD,IAAI,QAAQ,CAAC,OAAO,KAAK,EAAE;QAAE,KAAK,CAAC,IAAI,CAAC,iBAAiB,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC7E,KAAK,CAAC,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,GAAG,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IACnG,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,KAAgB;IACxC,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;IAClD,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;IAC/D,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,yBAAyB,CAAA;IACzD,OAAO,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;AACnC,CAAC"}
|
package/lib/sandbox.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-call file fence this plugin writes under, and the one place a write
|
|
3
|
+
* is refused.
|
|
4
|
+
*
|
|
5
|
+
* `@deepseek-ai/dsh-fs-sandbox` fences each mutation by a per-call policy, and
|
|
6
|
+
* that policy is the only thing naming the workspace the CALLING SESSION runs
|
|
7
|
+
* in: omitted, the backend falls back to the deployment's root — the directory
|
|
8
|
+
* the server was launched from — and a session working anywhere else has every
|
|
9
|
+
* artifact refused. The tool layer therefore resolves one policy per call and
|
|
10
|
+
* stamps it onto every write.
|
|
11
|
+
*
|
|
12
|
+
* The policy service is read with `ctx.get('sandboxPolicy')` rather than
|
|
13
|
+
* declared in `inject`, for the same reason `ctx.fs` is: a declared injection
|
|
14
|
+
* makes the service a provider requirement of this row. A composition that
|
|
15
|
+
* mounts the confining filesystem WITHOUT the policy service therefore composes
|
|
16
|
+
* cleanly and is refused at the first call, which is the earliest point where
|
|
17
|
+
* its real shape is knowable — see {@link callFence}.
|
|
18
|
+
* @module @deepseek-ai/dsh-ab-ocr/sandbox
|
|
19
|
+
*/
|
|
20
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
21
|
+
import type FileSystem from '@deepseek-ai/dsh-fs';
|
|
22
|
+
import type { FsTarget } from '@deepseek-ai/dsh-fs';
|
|
23
|
+
import { type SandboxExecutionPolicy } from '@deepseek-ai/dsh-sandbox';
|
|
24
|
+
import type { SandboxPolicyService } from '@deepseek-ai/dsh-sandbox-policy';
|
|
25
|
+
/**
|
|
26
|
+
* The part of a resolved policy a write is fenced by: the mode the backend
|
|
27
|
+
* judges and the workspace root a `workspace-write` mutation must land under.
|
|
28
|
+
* Every other field of a {@link SandboxExecutionPolicy} is about the session
|
|
29
|
+
* that asked, which no write here needs.
|
|
30
|
+
*/
|
|
31
|
+
export type CallFence = Pick<SandboxExecutionPolicy, 'mode' | 'workspaceRoot'>;
|
|
32
|
+
/**
|
|
33
|
+
* Resolve the policy one call writes under, refusing a composition that could
|
|
34
|
+
* only ever write to the wrong place.
|
|
35
|
+
* @param ctx - the registrant context, carrying the filesystem and the policy service.
|
|
36
|
+
* @param request - the calling session whose cwd is the workspace root, or `undefined` for an agentless call.
|
|
37
|
+
* @returns the fence to stamp onto this call's writes, or undefined when the mounted backend does not confine.
|
|
38
|
+
* @throws Error when a confining backend is mounted but no policy service can name the calling session's workspace.
|
|
39
|
+
*/
|
|
40
|
+
export declare function callFence(ctx: Context, request: Parameters<SandboxPolicyService['resolve']>[0]): CallFence | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Write one text artifact under the call's fence. Every text this plugin
|
|
43
|
+
* persists goes through here, so the fence is applied in one place and a
|
|
44
|
+
* refusal is restated with the path, the mode, and the workspace to move under
|
|
45
|
+
* — what the provider's own text leaves out and a caller needs.
|
|
46
|
+
* @param fs - the mounted filesystem capability every write goes through.
|
|
47
|
+
* @param target - the resolved target to write.
|
|
48
|
+
* @param content - the complete file content.
|
|
49
|
+
* @param fence - the per-call fence to stamp onto the write; absent on a bare backend.
|
|
50
|
+
* @param signal - caller cancellation, forwarded to the write.
|
|
51
|
+
* @throws Error as the backend raised it, or the same refusal restated with the remedy.
|
|
52
|
+
*/
|
|
53
|
+
export declare function saveText(fs: FileSystem, target: FsTarget, content: string, fence?: CallFence | undefined, signal?: AbortSignal): Promise<void>;
|
|
54
|
+
//# sourceMappingURL=sandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAuB,KAAK,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAC3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAE3E;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,sBAAsB,EAAE,MAAM,GAAG,eAAe,CAAC,CAAA;AAS9E;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,UAAU,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GACtD,SAAS,GAAG,SAAS,CAevB;AAYD;;;;;;;;;;;GAWG;AACH,wBAAsB,QAAQ,CAC5B,EAAE,EAAE,UAAU,EACd,MAAM,EAAE,QAAQ,EAChB,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,EAC7B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
package/lib/sandbox.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-call file fence this plugin writes under, and the one place a write
|
|
3
|
+
* is refused.
|
|
4
|
+
*
|
|
5
|
+
* `@deepseek-ai/dsh-fs-sandbox` fences each mutation by a per-call policy, and
|
|
6
|
+
* that policy is the only thing naming the workspace the CALLING SESSION runs
|
|
7
|
+
* in: omitted, the backend falls back to the deployment's root — the directory
|
|
8
|
+
* the server was launched from — and a session working anywhere else has every
|
|
9
|
+
* artifact refused. The tool layer therefore resolves one policy per call and
|
|
10
|
+
* stamps it onto every write.
|
|
11
|
+
*
|
|
12
|
+
* The policy service is read with `ctx.get('sandboxPolicy')` rather than
|
|
13
|
+
* declared in `inject`, for the same reason `ctx.fs` is: a declared injection
|
|
14
|
+
* makes the service a provider requirement of this row. A composition that
|
|
15
|
+
* mounts the confining filesystem WITHOUT the policy service therefore composes
|
|
16
|
+
* cleanly and is refused at the first call, which is the earliest point where
|
|
17
|
+
* its real shape is knowable — see {@link callFence}.
|
|
18
|
+
* @module @deepseek-ai/dsh-ab-ocr/sandbox
|
|
19
|
+
*/
|
|
20
|
+
import { sandboxDenialMarker } from '@deepseek-ai/dsh-sandbox';
|
|
21
|
+
/**
|
|
22
|
+
* The structured code a confining filesystem reports a refused mutation with.
|
|
23
|
+
* Matched structurally rather than by importing the error class, so a backend
|
|
24
|
+
* that throws its own equivalent is still recognized as a denial.
|
|
25
|
+
*/
|
|
26
|
+
const SANDBOX_DENIED = 'FS_SANDBOX_DENIED';
|
|
27
|
+
/**
|
|
28
|
+
* Resolve the policy one call writes under, refusing a composition that could
|
|
29
|
+
* only ever write to the wrong place.
|
|
30
|
+
* @param ctx - the registrant context, carrying the filesystem and the policy service.
|
|
31
|
+
* @param request - the calling session whose cwd is the workspace root, or `undefined` for an agentless call.
|
|
32
|
+
* @returns the fence to stamp onto this call's writes, or undefined when the mounted backend does not confine.
|
|
33
|
+
* @throws Error when a confining backend is mounted but no policy service can name the calling session's workspace.
|
|
34
|
+
*/
|
|
35
|
+
export function callFence(ctx, request) {
|
|
36
|
+
// A missing policy service is refused here rather than when the row loads,
|
|
37
|
+
// because it cannot be seen there: a confining backend declares
|
|
38
|
+
// `sandboxPolicy` as an injection, so in a composition that mounts one
|
|
39
|
+
// WITHOUT the service the backend is never constructed at all — `ctx.get('fs')`
|
|
40
|
+
// is undefined while this row applies, and the row mounts cleanly. The first
|
|
41
|
+
// call is the earliest point at which the composition's real shape is knowable.
|
|
42
|
+
const policy = ctx.get('sandboxPolicy');
|
|
43
|
+
const fs = ctx.get('fs');
|
|
44
|
+
if (fs?.sandboxMode === undefined)
|
|
45
|
+
return undefined;
|
|
46
|
+
if (policy === undefined) {
|
|
47
|
+
throw new Error('dsh-ab-ocr: the mounted filesystem confines but ctx.sandboxPolicy is missing'
|
|
48
|
+
+ ', so no workspace root can be resolved for this session and none of its artifacts could be written');
|
|
49
|
+
}
|
|
50
|
+
return policy.resolve(request ?? {});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Whether one thrown error is the file sandbox refusing a mutation, judged by
|
|
54
|
+
* the structured code the capability publishes rather than by its message text.
|
|
55
|
+
* @param error - the error a write threw.
|
|
56
|
+
* @returns true when a confining filesystem denied the write.
|
|
57
|
+
*/
|
|
58
|
+
function isSandboxDenial(error) {
|
|
59
|
+
return typeof error === 'object' && error !== null && error.code === SANDBOX_DENIED;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Write one text artifact under the call's fence. Every text this plugin
|
|
63
|
+
* persists goes through here, so the fence is applied in one place and a
|
|
64
|
+
* refusal is restated with the path, the mode, and the workspace to move under
|
|
65
|
+
* — what the provider's own text leaves out and a caller needs.
|
|
66
|
+
* @param fs - the mounted filesystem capability every write goes through.
|
|
67
|
+
* @param target - the resolved target to write.
|
|
68
|
+
* @param content - the complete file content.
|
|
69
|
+
* @param fence - the per-call fence to stamp onto the write; absent on a bare backend.
|
|
70
|
+
* @param signal - caller cancellation, forwarded to the write.
|
|
71
|
+
* @throws Error as the backend raised it, or the same refusal restated with the remedy.
|
|
72
|
+
*/
|
|
73
|
+
export async function saveText(fs, target, content, fence, signal) {
|
|
74
|
+
try {
|
|
75
|
+
await fs.writeText(target, content, undefined, signal, fence);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
if (fence === undefined || !isSandboxDenial(error))
|
|
79
|
+
throw error;
|
|
80
|
+
throw restated(fence, fs.processPath(target), error);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Restate one refused write as the path, the mode, and the workspace it has to
|
|
85
|
+
* move under.
|
|
86
|
+
* @param fence - the fence the refused write was stamped with.
|
|
87
|
+
* @param path - the target's path in the backend's execution world.
|
|
88
|
+
* @param cause - the refusal the backend raised.
|
|
89
|
+
* @returns the error to throw in its place, keeping the denial code a consumer keys off.
|
|
90
|
+
*/
|
|
91
|
+
function restated(fence, path, cause) {
|
|
92
|
+
const error = new Error(sandboxDenialMarker(fence.mode)
|
|
93
|
+
+ ': cannot write ' + path + '; this session\'s workspace is ' + fence.workspaceRoot
|
|
94
|
+
+ '. Name an `outputDir` inside it, or a source file inside it.', { cause });
|
|
95
|
+
// The structured code travels with the restated message: a caller that keys a
|
|
96
|
+
// retry or an observer off FS_SANDBOX_DENIED still sees the same denial.
|
|
97
|
+
const stamped = error;
|
|
98
|
+
stamped.code = SANDBOX_DENIED;
|
|
99
|
+
return stamped;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=sandbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,mBAAmB,EAA+B,MAAM,0BAA0B,CAAA;AAW3F;;;;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CAAA;IACtD,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,QAAQ,CAAC,KAAgB,EAAE,IAAY,EAAE,KAAc;IAC9D,MAAM,KAAK,GAAG,IAAI,KAAK,CACrB,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC;UAC7B,iBAAiB,GAAG,IAAI,GAAG,iCAAiC,GAAG,KAAK,CAAC,aAAa;UAClF,8DAA8D,EAChE,EAAE,KAAK,EAAE,CACV,CAAA;IACD,8EAA8E;IAC9E,yEAAyE;IACzE,MAAM,OAAO,GAAG,KAAkC,CAAA;IAClD,OAAO,CAAC,IAAI,GAAG,cAAc,CAAA;IAC7B,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Values the ocr tool accepts and returns. Kept out of the entry module so a
|
|
3
|
+
* browser consumer can share one declaration.
|
|
4
|
+
* @module @deepseek-ai/dsh-ab-ocr/types
|
|
5
|
+
*/
|
|
6
|
+
/** One recognized line, with the geometry the merge pass reads. */
|
|
7
|
+
export interface OcrGeometryLine {
|
|
8
|
+
/** The line's text. */
|
|
9
|
+
text: string;
|
|
10
|
+
/** Left edge of the line's box, in page units. */
|
|
11
|
+
x0: number;
|
|
12
|
+
/** Top edge of the line's box, in page units. */
|
|
13
|
+
y0: number;
|
|
14
|
+
/** Right edge of the line's box, in page units. */
|
|
15
|
+
x1: number;
|
|
16
|
+
/** Bottom edge of the line's box, in page units. */
|
|
17
|
+
y1: number;
|
|
18
|
+
/** Glyph height the line was set in. */
|
|
19
|
+
height: number;
|
|
20
|
+
}
|
|
21
|
+
/** One recognized page's geometry. */
|
|
22
|
+
export interface OcrPageGeometry {
|
|
23
|
+
/** The page's one-based number. */
|
|
24
|
+
index: number;
|
|
25
|
+
/** Page width in render units. */
|
|
26
|
+
width: number;
|
|
27
|
+
/** Page height in render units. */
|
|
28
|
+
height: number;
|
|
29
|
+
/** The page's lines, in reading order. */
|
|
30
|
+
lines: OcrGeometryLine[];
|
|
31
|
+
}
|
|
32
|
+
/** Every recognized page's geometry, in page order. */
|
|
33
|
+
export interface OcrGeometry {
|
|
34
|
+
/** The document's pages. */
|
|
35
|
+
pages: OcrPageGeometry[];
|
|
36
|
+
}
|
|
37
|
+
/** One heading candidate of the outline a recognition inferred. */
|
|
38
|
+
export interface OcrOutlineEntry {
|
|
39
|
+
/** Candidate id: `h1`, `h2`, … in document order. */
|
|
40
|
+
id: string;
|
|
41
|
+
/** The page the heading sits on. */
|
|
42
|
+
page: number;
|
|
43
|
+
/** The heading's text. */
|
|
44
|
+
text: string;
|
|
45
|
+
/** The level the merge inferred, or null when it inferred none. */
|
|
46
|
+
level: number | null;
|
|
47
|
+
/** Glyph height over the document's body height. */
|
|
48
|
+
ratio: number;
|
|
49
|
+
/** The section number the heading carries, or null. */
|
|
50
|
+
numbered: string | null;
|
|
51
|
+
/** The level the merge inferred for this line, before any correction was applied. */
|
|
52
|
+
inferred: number | null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Merge switches and thresholds one call sends, in the names the worker reads
|
|
56
|
+
* them under. They are part of the recognition's identity: two calls that
|
|
57
|
+
* differ here produce different Markdown from the same source.
|
|
58
|
+
*/
|
|
59
|
+
export interface MergeOptions {
|
|
60
|
+
/** Whether folios are removed from the merged document. */
|
|
61
|
+
removePageNumbers: boolean;
|
|
62
|
+
/** Whether lines that repeat in the edge bands of most pages are removed. */
|
|
63
|
+
removeRunningHeads: boolean;
|
|
64
|
+
/** Fraction of pages a repeated edge line must appear on to count as a running head. */
|
|
65
|
+
runningHeadRatio: number;
|
|
66
|
+
/** Fewest pages such a line must appear on, whatever the ratio. */
|
|
67
|
+
runningHeadMinPages: number;
|
|
68
|
+
/** Whether headings are inferred at all. */
|
|
69
|
+
detectHeadings: boolean;
|
|
70
|
+
/** How much taller than body text a line must be to be read as a heading by size. */
|
|
71
|
+
headingMinRatio: number;
|
|
72
|
+
/** Left-edge offset, in body glyph heights, that marks an indented first line. */
|
|
73
|
+
indentRatio: number;
|
|
74
|
+
/** Vertical gap, in body glyph heights, that separates two paragraphs. */
|
|
75
|
+
paragraphGapRatio: number;
|
|
76
|
+
/** Glyph height over body height above which a line becomes an outline candidate. */
|
|
77
|
+
outlineCandidateRatio: number;
|
|
78
|
+
/** Most outline candidates one document may offer. */
|
|
79
|
+
maxOutlineCandidates: number;
|
|
80
|
+
/** Candidate id to heading level corrections, applied over the inferred levels. */
|
|
81
|
+
levelOverrides?: Record<string, number>;
|
|
82
|
+
}
|
|
83
|
+
/** One recognized document in the tool's result. */
|
|
84
|
+
export interface OcrDocument {
|
|
85
|
+
/** The path the model asked to recognize, as it supplied it. */
|
|
86
|
+
input: string;
|
|
87
|
+
/** Absolute path of the Markdown file that was written. */
|
|
88
|
+
output: string;
|
|
89
|
+
/** Pages recognized in this call. */
|
|
90
|
+
pages: number;
|
|
91
|
+
/** Pages the source carries, which exceeds pages when a selection was given. */
|
|
92
|
+
totalPages: number;
|
|
93
|
+
/** Lines kept after page furniture was removed. */
|
|
94
|
+
lines: number;
|
|
95
|
+
/** Headings found in the outline. */
|
|
96
|
+
headings: number;
|
|
97
|
+
/** Characters the Markdown body carries. */
|
|
98
|
+
chars: number;
|
|
99
|
+
/** Folios removed. */
|
|
100
|
+
droppedPageNumbers: number;
|
|
101
|
+
/** Running heads and feet removed. */
|
|
102
|
+
droppedRunningHeads: number;
|
|
103
|
+
/** Paragraphs continued across a page break. */
|
|
104
|
+
joinedAcrossPages: number;
|
|
105
|
+
/** Directory holding the per-page text, or an empty string when they were removed. */
|
|
106
|
+
pageDir: string;
|
|
107
|
+
/** Wall-clock seconds the document took. */
|
|
108
|
+
seconds: number;
|
|
109
|
+
/** Content digest of this recognition, 12 hex characters. */
|
|
110
|
+
digest: string;
|
|
111
|
+
/** The explicit ascending pages this document's text came from. */
|
|
112
|
+
selection: number[];
|
|
113
|
+
/** Absolute path of the outline file, which names every heading candidate. */
|
|
114
|
+
outlinePath: string;
|
|
115
|
+
/** Whether the heading candidate ceiling cut the outline short. */
|
|
116
|
+
outlineTruncated: boolean;
|
|
117
|
+
/** Heading-level corrections this call applied; 0 for a recognition. */
|
|
118
|
+
corrections: number;
|
|
119
|
+
}
|
|
120
|
+
/** One document the call could not finish. */
|
|
121
|
+
export interface OcrFailure {
|
|
122
|
+
/** The path that failed. */
|
|
123
|
+
input: string;
|
|
124
|
+
/** What went wrong, in the terms the caller can act on. */
|
|
125
|
+
error: string;
|
|
126
|
+
}
|
|
127
|
+
/** The canonical value one call records. */
|
|
128
|
+
export interface OcrResult {
|
|
129
|
+
/** Documents recognized in this call, in request order. */
|
|
130
|
+
documents: OcrDocument[];
|
|
131
|
+
/** Documents that failed; the others are still saved. */
|
|
132
|
+
failures: OcrFailure[];
|
|
133
|
+
}
|
|
134
|
+
/** Arguments the model supplies to one call. */
|
|
135
|
+
export interface OcrArgs {
|
|
136
|
+
/** One document to recognize. */
|
|
137
|
+
path?: string;
|
|
138
|
+
/** Several documents to recognize in one call. */
|
|
139
|
+
paths?: string[];
|
|
140
|
+
/** Pages to recognize, counted from one, as single pages and inclusive ranges. */
|
|
141
|
+
pages?: string;
|
|
142
|
+
/** Directory for the Markdown files; relative values resolve against the working directory. */
|
|
143
|
+
outputDir?: string;
|
|
144
|
+
/** Heading-level corrections for a document an earlier call recognized, such as "h12=2,h15=1". */
|
|
145
|
+
levels?: string;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,mEAAmE;AACnE,MAAM,WAAW,eAAe;IAC9B,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,kDAAkD;IAClD,EAAE,EAAE,MAAM,CAAA;IACV,iDAAiD;IACjD,EAAE,EAAE,MAAM,CAAA;IACV,mDA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AAW,EAAE,CAAA;IACxB,yDAAyD;IACzD,QAAQ,EAAE,UAAU,EAAE,CAAA;CACvB;AAED,gDAAgD;AAChD,MAAM,WAAW,OAAO;IACtB,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,kFAAkF;IAClF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,+FAA+F;IAC/F,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,kGAAkG;IAClG,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
|
package/lib/types.js
ADDED
package/lib/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/lib/worker.d.ts
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transport to the OCR worker process. The worker speaks newline-delimited
|
|
3
|
+
* JSON: one event per line on stdout, diagnostics on stderr. This module owns
|
|
4
|
+
* the process lifetime, the spec handoff, the timeout, and the cancellation, so
|
|
5
|
+
* the tool's entry module only has to interpret events.
|
|
6
|
+
* @module @deepseek-ai/dsh-ab-ocr/worker
|
|
7
|
+
*/
|
|
8
|
+
import type { MergeOptions, OcrGeometry } from './types.ts';
|
|
9
|
+
/** One event line the worker wrote, already parsed. */
|
|
10
|
+
export interface WorkerEvent {
|
|
11
|
+
/** Event name: start, page, released, done, error, fatal, or end. */
|
|
12
|
+
event: string;
|
|
13
|
+
/** Event payload, whose fields depend on the name. */
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
/** Where the worker executable and its script live, and how long a run may take. */
|
|
17
|
+
export interface WorkerInvocation {
|
|
18
|
+
/** Python executable that carries the OCR dependencies. */
|
|
19
|
+
python: string;
|
|
20
|
+
/** Absolute path of the worker script. */
|
|
21
|
+
script: string;
|
|
22
|
+
/** Milliseconds one call may take; 0 disables the ceiling. */
|
|
23
|
+
timeoutMs: number;
|
|
24
|
+
}
|
|
25
|
+
/** One job in the spec the worker reads from stdin. */
|
|
26
|
+
export interface WorkerJob {
|
|
27
|
+
/** Whether the worker recognizes the document or assembles a stored record. */
|
|
28
|
+
mode: 'recognize' | 'assemble';
|
|
29
|
+
/** Caller-chosen identifier echoed on every event. */
|
|
30
|
+
id: string;
|
|
31
|
+
/** Absolute path of the document to recognize, in the worker's own execution world. */
|
|
32
|
+
input: string;
|
|
33
|
+
/** Pages to recognize in the caller's notation, or null for the whole document. */
|
|
34
|
+
pages?: string | null;
|
|
35
|
+
/** The merge switches and thresholds; an assembly job adds its level corrections here. */
|
|
36
|
+
merge: MergeOptions;
|
|
37
|
+
/** The stored page geometry an assembly job merges; absent from a recognition job. */
|
|
38
|
+
record?: OcrGeometry;
|
|
39
|
+
/** Everything else the worker needs: the render bounds and the recognition switches. */
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}
|
|
42
|
+
/** The spec one worker process reads from stdin. */
|
|
43
|
+
export interface WorkerSpec {
|
|
44
|
+
/** Whether the engine is rebuilt per document or shared across the batch. */
|
|
45
|
+
engineLifetime: 'perDocument' | 'shared';
|
|
46
|
+
/** Documents to process, in order. */
|
|
47
|
+
jobs: WorkerJob[];
|
|
48
|
+
}
|
|
49
|
+
/** Everything one worker process produced. */
|
|
50
|
+
export interface WorkerRun {
|
|
51
|
+
/** Events the worker wrote, in order. */
|
|
52
|
+
events: WorkerEvent[];
|
|
53
|
+
/** Tail of the worker's diagnostics. */
|
|
54
|
+
stderr: string;
|
|
55
|
+
/** Process exit code, or null when a signal ended it. */
|
|
56
|
+
exitCode: number | null;
|
|
57
|
+
/** Whether the run hit its time ceiling. */
|
|
58
|
+
timedOut: boolean;
|
|
59
|
+
/** Whether the run was cancelled. */
|
|
60
|
+
aborted: boolean;
|
|
61
|
+
}
|
|
62
|
+
/** What one environment check produced. */
|
|
63
|
+
export interface SelfTest {
|
|
64
|
+
/** The worker's report, or undefined when it never produced one. */
|
|
65
|
+
report: Record<string, unknown> | undefined;
|
|
66
|
+
/** Tail of the worker's diagnostics. */
|
|
67
|
+
stderr: string;
|
|
68
|
+
/** Process exit code, or null when a signal or a failed start ended it. */
|
|
69
|
+
exitCode: number | null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Split a run of text into whole lines, returning what is left of a partial one.
|
|
73
|
+
* @param buffered - text received so far, including any partial final line.
|
|
74
|
+
* @param chunk - newly received text.
|
|
75
|
+
* @returns the complete lines and the remaining partial line.
|
|
76
|
+
*/
|
|
77
|
+
export declare function splitLines(buffered: string, chunk: string): {
|
|
78
|
+
lines: string[];
|
|
79
|
+
rest: string;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Parse one event line, ignoring a line that is not a JSON object.
|
|
83
|
+
* @param line - one complete stdout line.
|
|
84
|
+
* @returns the parsed event, or undefined for a line that is not one.
|
|
85
|
+
*/
|
|
86
|
+
export declare function parseEvent(line: string): WorkerEvent | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Ask the worker to report its environment.
|
|
89
|
+
* @param invocation - executable, script, and the ceiling this check may take.
|
|
90
|
+
* @param signal - caller cancellation.
|
|
91
|
+
* @returns the report and the diagnostics, whether or not the worker started.
|
|
92
|
+
*/
|
|
93
|
+
export declare function runSelfTest(invocation: WorkerInvocation, signal?: AbortSignal): Promise<SelfTest>;
|
|
94
|
+
/**
|
|
95
|
+
* Run one batch of documents through the worker.
|
|
96
|
+
*
|
|
97
|
+
* The event callback sees each event as it is parsed, which is what lets the
|
|
98
|
+
* caller persist a finished page before the next one is recognized instead of
|
|
99
|
+
* holding the whole document until the process exits.
|
|
100
|
+
* @param invocation - executable, script, and time ceiling.
|
|
101
|
+
* @param spec - the documents and options to process.
|
|
102
|
+
* @param onEvent - called with each parsed event as it arrives.
|
|
103
|
+
* @param signal - caller cancellation.
|
|
104
|
+
* @returns the events, diagnostics, and exit state.
|
|
105
|
+
*/
|
|
106
|
+
export declare function runSpec(invocation: WorkerInvocation, spec: WorkerSpec, onEvent: (event: WorkerEvent) => void, signal?: AbortSignal): Promise<WorkerRun>;
|
|
107
|
+
//# sourceMappingURL=worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE3D,uDAAuD;AACvD,MAAM,WAAW,WAAW;IAC1B,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAA;IACb,sDAAsD;IACtD,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,oFAAoF;AACpF,MAAM,WAAW,gBAAgB;IAC/B,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAA;IACd,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAA;IACd,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,uDAAuD;AACvD,MAAM,WAAW,SAAS;IACxB,+EAA+E;IAC/E,IAAI,EAAE,WAAW,GAAG,UAAU,CAAA;IAC9B,sDAAsD;IACtD,EAAE,EAAE,MAAM,CAAA;IACV,uFAAuF;IACvF,KAAK,EAAE,MAAM,CAAA;IACb,mFAAmF;IACnF,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,0FAA0F;IAC1F,KAAK,EAAE,YAAY,CAAA;IACnB,sFAAsF;IACtF,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,wFAAwF;IACxF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,oDAAoD;AACpD,MAAM,WAAW,UAAU;IACzB,6EAA6E;IAC7E,cAAc,EAAE,aAAa,GAAG,QAAQ,CAAA;IACxC,sCAAsC;IACtC,IAAI,EAAE,SAAS,EAAE,CA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