dsh-tool-docx 0.5.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 +53 -0
- package/README.i18n.yaml +7 -0
- package/README.md +202 -0
- package/README.ru.md +202 -0
- package/README.zh.md +202 -0
- package/cordis.patch.yml +18 -0
- package/lib/fs-binary-D0seEN6R.js +63 -0
- package/lib/fs-binary-local-n8Ls-bn_.js +155 -0
- package/lib/fs-binary-local-plugin.js +24 -0
- package/lib/fs-binary-local.js +2 -0
- package/lib/fs-binary-sandbox-BobaE5Hr.js +135 -0
- package/lib/fs-binary-sandbox-plugin.js +31 -0
- package/lib/fs-binary-sandbox.js +2 -0
- package/lib/index.js +1507 -0
- package/lib/invariant.js +23 -0
- package/lib/types/caps.d.ts +14 -0
- package/lib/types/docx/extract.d.ts +18 -0
- package/lib/types/docx/generate.d.ts +17 -0
- package/lib/types/docx/zip.d.ts +17 -0
- package/lib/types/error.d.ts +20 -0
- package/lib/types/fs-binary-local-plugin.d.ts +19 -0
- package/lib/types/fs-binary-local.d.ts +45 -0
- package/lib/types/fs-binary-sandbox-plugin.d.ts +22 -0
- package/lib/types/fs-binary-sandbox.d.ts +51 -0
- package/lib/types/fs-binary.d.ts +52 -0
- package/lib/types/fsio-bytes.d.ts +27 -0
- package/lib/types/index.d.ts +32 -0
- package/lib/types/invariant.d.ts +16 -0
- package/lib/types/markdown.d.ts +35 -0
- package/lib/types/path-contains.d.ts +21 -0
- package/lib/types/sandbox.d.ts +63 -0
- package/lib/types/tool-utils.d.ts +56 -0
- package/lib/types/tools/create.d.ts +19 -0
- package/lib/types/tools/edit.d.ts +19 -0
- package/lib/types/tools/read.d.ts +16 -0
- package/lib/types/types.d.ts +77 -0
- package/package.json +114 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared vocabulary for the docx tool suite: the structured block model a
|
|
3
|
+
* document is extracted into and regenerated from, the preserved document
|
|
4
|
+
* properties, and the full extraction result.
|
|
5
|
+
* @module dsh-tool-docx/types
|
|
6
|
+
*/
|
|
7
|
+
/** One structured content block. `image` blocks appear in read output only; the generator emits a warning instead of embedding bytes. */
|
|
8
|
+
export type DocxBlock = {
|
|
9
|
+
kind: 'heading';
|
|
10
|
+
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
11
|
+
text: string;
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'paragraph';
|
|
14
|
+
text: string;
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'list';
|
|
17
|
+
ordered: boolean;
|
|
18
|
+
items: Array<{
|
|
19
|
+
level: number;
|
|
20
|
+
text: string;
|
|
21
|
+
}>;
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'table';
|
|
24
|
+
header: string[] | null;
|
|
25
|
+
rows: string[][];
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'image';
|
|
28
|
+
alt: string;
|
|
29
|
+
};
|
|
30
|
+
/** Document properties preserved across a round-trip edit (from `docProps/core.xml`). */
|
|
31
|
+
export interface DocxProps {
|
|
32
|
+
/** `dc:title`, or null when absent. */
|
|
33
|
+
title: string | null;
|
|
34
|
+
/** `dc:creator`, or null when absent. */
|
|
35
|
+
author: string | null;
|
|
36
|
+
/** `dcterms:created` (ISO-8601), or null when absent. */
|
|
37
|
+
created: string | null;
|
|
38
|
+
}
|
|
39
|
+
/** The full result of extracting one `.docx` buffer. */
|
|
40
|
+
export interface ExtractedDocx {
|
|
41
|
+
props: DocxProps;
|
|
42
|
+
/** Markdown rendering of the document body. */
|
|
43
|
+
markdown: string;
|
|
44
|
+
/** Structured block rendering of the document body. */
|
|
45
|
+
blocks: DocxBlock[];
|
|
46
|
+
/** Number of embedded images encountered (emitted as placeholders). */
|
|
47
|
+
images: number;
|
|
48
|
+
/** Human-readable notes about approximations and unsupported constructs. */
|
|
49
|
+
warnings: string[];
|
|
50
|
+
}
|
|
51
|
+
/** DocProps + warnings, what the edit tool needs from the existing file. */
|
|
52
|
+
export interface ExtractedEditBasis {
|
|
53
|
+
props: DocxProps;
|
|
54
|
+
warnings: string[];
|
|
55
|
+
}
|
|
56
|
+
/** Canonical tool output for `docx_read`. */
|
|
57
|
+
export interface DocxReadValue {
|
|
58
|
+
path: string;
|
|
59
|
+
format: 'markdown' | 'json';
|
|
60
|
+
docProps: DocxProps;
|
|
61
|
+
charCount: number;
|
|
62
|
+
images: number;
|
|
63
|
+
warnings: string[];
|
|
64
|
+
markdown: string | null;
|
|
65
|
+
blocks: DocxBlock[] | null;
|
|
66
|
+
}
|
|
67
|
+
/** Canonical tool output for `docx_create` / `docx_edit`. */
|
|
68
|
+
export interface DocxWriteValue {
|
|
69
|
+
path: string;
|
|
70
|
+
operation: 'create' | 'update';
|
|
71
|
+
/** Byte size of the generated document. */
|
|
72
|
+
bytes: number;
|
|
73
|
+
warnings: string[];
|
|
74
|
+
/** Present only for an edit (the preserved properties). */
|
|
75
|
+
docProps?: DocxProps;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=types.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-tool-docx",
|
|
3
|
+
"description": "Model-facing MS Word (.docx) tools: read documents as Markdown or structured blocks, create documents from Markdown, and edit documents round-trip; ships binary fs providers (writeBytes, incl. a sandbox-preserving one) for hosts without it",
|
|
4
|
+
"version": "0.5.0",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/BroBFG/dsh-tool-docx.git"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"deepseek-harness",
|
|
14
|
+
"dsh",
|
|
15
|
+
"dsh-plugin",
|
|
16
|
+
"docx",
|
|
17
|
+
"word",
|
|
18
|
+
"markdown",
|
|
19
|
+
"microsoft-word"
|
|
20
|
+
],
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "lib/index.js",
|
|
23
|
+
"types": "lib/types/index.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./lib/types/index.d.ts",
|
|
27
|
+
"default": "./lib/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./fs-binary-local": {
|
|
30
|
+
"types": "./lib/types/fs-binary-local.d.ts",
|
|
31
|
+
"default": "./lib/fs-binary-local.js"
|
|
32
|
+
},
|
|
33
|
+
"./fs-binary-sandbox": {
|
|
34
|
+
"types": "./lib/types/fs-binary-sandbox.d.ts",
|
|
35
|
+
"default": "./lib/fs-binary-sandbox.js"
|
|
36
|
+
},
|
|
37
|
+
"./fs-binary-local-plugin": {
|
|
38
|
+
"types": "./lib/types/fs-binary-local-plugin.d.ts",
|
|
39
|
+
"default": "./lib/fs-binary-local-plugin.js"
|
|
40
|
+
},
|
|
41
|
+
"./fs-binary-sandbox-plugin": {
|
|
42
|
+
"types": "./lib/types/fs-binary-sandbox-plugin.d.ts",
|
|
43
|
+
"default": "./lib/fs-binary-sandbox-plugin.js"
|
|
44
|
+
},
|
|
45
|
+
"./invariant": {
|
|
46
|
+
"types": "./lib/types/invariant.d.ts",
|
|
47
|
+
"default": "./lib/invariant.js"
|
|
48
|
+
},
|
|
49
|
+
"./src/*": "./src/*",
|
|
50
|
+
"./package.json": "./package.json"
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"lib/*.js",
|
|
54
|
+
"lib/types/**/*.d.ts",
|
|
55
|
+
"cordis.patch.yml"
|
|
56
|
+
],
|
|
57
|
+
"dsh": {
|
|
58
|
+
"bundle": {
|
|
59
|
+
"patch": "./cordis.patch.yml"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"license": "MIT",
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
65
|
+
},
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"@deepseek-ai/schemastery": "^3.18.1",
|
|
68
|
+
"docx": "^9.7.1",
|
|
69
|
+
"fast-xml-parser": "^4.5.7",
|
|
70
|
+
"jszip": "^3.10.1",
|
|
71
|
+
"yauzl": "^2.10.0"
|
|
72
|
+
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"@deepseek-ai/dsh-fs": "^0.1.0-rc.7",
|
|
75
|
+
"@deepseek-ai/dsh-fs-local": "^0.1.0-rc.7",
|
|
76
|
+
"@deepseek-ai/dsh-fs-sandbox": "^0.1.0-rc.7",
|
|
77
|
+
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.7",
|
|
78
|
+
"@deepseek-ai/dsh-llm": "^0.1.0-rc.7",
|
|
79
|
+
"@deepseek-ai/dsh-sandbox": "^0.1.0-rc.7",
|
|
80
|
+
"@deepseek-ai/dsh-sandbox-policy": "^0.1.0-rc.7",
|
|
81
|
+
"@deepseek-ai/dsh-session": "^0.1.0-rc.7",
|
|
82
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.0-rc.7",
|
|
83
|
+
"@deepseek-ai/dsh-tools": "^0.1.0-rc.7",
|
|
84
|
+
"@deepseek-ai/dsh-user-approval": "^0.1.0-rc.7",
|
|
85
|
+
"@deepseek-ai/cordis": "^4.0.1"
|
|
86
|
+
},
|
|
87
|
+
"devDependencies": {
|
|
88
|
+
"@deepseek-ai/dsh-fs": "^0.1.0-rc.7",
|
|
89
|
+
"@deepseek-ai/dsh-fs-local": "^0.1.0-rc.7",
|
|
90
|
+
"@deepseek-ai/dsh-fs-sandbox": "^0.1.0-rc.7",
|
|
91
|
+
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.7",
|
|
92
|
+
"@deepseek-ai/dsh-llm": "^0.1.0-rc.7",
|
|
93
|
+
"@deepseek-ai/dsh-sandbox": "^0.1.0-rc.7",
|
|
94
|
+
"@deepseek-ai/dsh-sandbox-policy": "^0.1.0-rc.7",
|
|
95
|
+
"@deepseek-ai/dsh-scope": "^0.1.0-rc.7",
|
|
96
|
+
"@deepseek-ai/dsh-session": "^0.1.0-rc.7",
|
|
97
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.0-rc.7",
|
|
98
|
+
"@deepseek-ai/dsh-timeout": "^0.1.0-rc.7",
|
|
99
|
+
"@deepseek-ai/dsh-tools": "^0.1.0-rc.7",
|
|
100
|
+
"@deepseek-ai/dsh-user-approval": "^0.1.0-rc.7",
|
|
101
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
102
|
+
"@types/node": "^24.0.0",
|
|
103
|
+
"@types/yauzl": "^2.10.3",
|
|
104
|
+
"tsdown": "^0.22.2",
|
|
105
|
+
"typescript": "^6.0.3",
|
|
106
|
+
"vitest": "^4.1.8"
|
|
107
|
+
},
|
|
108
|
+
"scripts": {
|
|
109
|
+
"build": "tsc -p tsconfig.json && tsdown",
|
|
110
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
111
|
+
"test": "vitest run",
|
|
112
|
+
"verify:lib": "pnpm build && git diff --exit-code -- lib/"
|
|
113
|
+
}
|
|
114
|
+
}
|