@songtonyli/dsh-cli 0.1.58 → 0.1.60

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.
Files changed (139) hide show
  1. package/README.md +1 -1
  2. package/bin/dsh.mjs +1 -1
  3. package/node_modules/@deepseek-ai/dsh-agent-preset/skills/cordis-composition-reference/references/packages.md +1 -0
  4. package/node_modules/@deepseek-ai/dsh-api-session-controller/lib/client.js +1 -0
  5. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/package.json +1 -1
  6. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
  7. package/node_modules/@deepseek-ai/dsh-client-ui-slots/package.json +2 -2
  8. package/node_modules/@deepseek-ai/dsh-sandbox/lib/index.js +59 -4
  9. package/node_modules/@deepseek-ai/dsh-sandbox-apple-container/README.i18n.yaml +73 -0
  10. package/node_modules/@deepseek-ai/dsh-sandbox-apple-container/README.md +166 -0
  11. package/node_modules/@deepseek-ai/dsh-sandbox-apple-container/README.zh.md +166 -0
  12. package/node_modules/@deepseek-ai/dsh-sandbox-apple-container/lib/exec-shim.js +227 -0
  13. package/node_modules/@deepseek-ai/dsh-sandbox-apple-container/lib/index.js +704 -0
  14. package/node_modules/@deepseek-ai/dsh-sandbox-apple-container/package.json +62 -0
  15. package/node_modules/@deepseek-ai/dsh-sandbox-policy/README.i18n.yaml +2 -2
  16. package/node_modules/@deepseek-ai/dsh-sandbox-policy/README.md +1 -1
  17. package/node_modules/@deepseek-ai/dsh-sandbox-policy/README.zh.md +1 -1
  18. package/node_modules/@deepseek-ai/dsh-sandbox-policy/lib/index.js +23 -0
  19. package/node_modules/@deepseek-ai/dsh-session/lib/index.js +1 -0
  20. package/node_modules/@deepseek-ai/dsh-session/lib/types/known-event-types.js +1 -0
  21. package/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/lib/worker.cjs +1 -0
  22. package/node_modules/@deepseek-ai/dsh-system-prompt/lib/index.js +1 -0
  23. package/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/api-catalog.js +22 -0
  24. package/node_modules/@deepseek-ai/dsh-tool-fs/README.i18n.yaml +2 -2
  25. package/node_modules/@deepseek-ai/dsh-tool-fs/README.md +1 -1
  26. package/node_modules/@deepseek-ai/dsh-tool-fs/README.zh.md +1 -1
  27. package/node_modules/@deepseek-ai/dsh-tool-fs/lib/index.js +24 -0
  28. package/node_modules/@deepseek-ai/dsh-tool-fs-search/README.i18n.yaml +4 -4
  29. package/node_modules/@deepseek-ai/dsh-tool-fs-search/README.md +2 -2
  30. package/node_modules/@deepseek-ai/dsh-tool-fs-search/README.zh.md +2 -2
  31. package/node_modules/@deepseek-ai/dsh-tool-fs-search/lib/index.js +28 -3
  32. package/node_modules/@deepseek-ai/dsh-tool-fs-search/package.json +7 -2
  33. package/node_modules/@deepseek-ai/dsh-tool-str-replace-editor/README.i18n.yaml +2 -2
  34. package/node_modules/@deepseek-ai/dsh-tool-str-replace-editor/README.md +1 -1
  35. package/node_modules/@deepseek-ai/dsh-tool-str-replace-editor/README.zh.md +1 -1
  36. package/node_modules/@deepseek-ai/dsh-tool-str-replace-editor/lib/index.js +14 -6
  37. package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +8 -8
  38. package/node_modules/@deepseek-ai/dsh-tui-app/README.md +13 -7
  39. package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +13 -7
  40. package/node_modules/@deepseek-ai/dsh-tui-app/cordis.patch.yml +20 -0
  41. package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +2403 -2033
  42. package/node_modules/@deepseek-ai/dsh-tui-app/package.json +1 -0
  43. package/node_modules/@deepseek-ai/libreoffice-kit/README.md +20 -5
  44. package/node_modules/@deepseek-ai/libreoffice-kit/README.zh.md +21 -6
  45. package/node_modules/@deepseek-ai/libreoffice-kit/lib/cli.js +499 -253
  46. package/node_modules/@deepseek-ai/libreoffice-kit/lib/font-snapshot-worker.js +37 -26
  47. package/node_modules/@deepseek-ai/libreoffice-kit/lib/index.js +498 -252
  48. package/node_modules/@deepseek-ai/libreoffice-kit/lib/worker.js +39 -13
  49. package/node_modules/@deepseek-ai/libreoffice-kit/package.json +5 -3
  50. package/node_modules/@earendil-works/pi-ai/README.md +4 -3
  51. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +117 -18
  52. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +1 -0
  53. package/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js +19 -8
  54. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +1 -0
  55. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +1 -0
  56. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +1 -0
  57. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +2 -0
  58. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +5 -0
  59. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +24 -2
  60. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  61. package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
  62. package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
  63. package/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
  64. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cerebras.json +1 -1
  65. package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
  66. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
  67. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  68. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  69. package/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
  70. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  71. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +2 -1
  72. package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js +3 -2
  73. package/node_modules/@earendil-works/pi-ai/package.json +6 -2
  74. package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  75. package/node_modules/@shikijs/core/dist/index.mjs +15 -12
  76. package/node_modules/@shikijs/core/package.json +4 -4
  77. package/node_modules/@shikijs/engine-javascript/dist/engine-compile.mjs +2 -4
  78. package/node_modules/@shikijs/engine-javascript/dist/engine-raw.mjs +2 -4
  79. package/node_modules/@shikijs/engine-javascript/dist/index.mjs +1 -1
  80. package/node_modules/@shikijs/engine-javascript/dist/string-TLTPtCPs.mjs +115 -0
  81. package/node_modules/@shikijs/engine-javascript/package.json +3 -3
  82. package/node_modules/@shikijs/engine-oniguruma/package.json +3 -3
  83. package/node_modules/@shikijs/langs/dist/ada.mjs +1 -1
  84. package/node_modules/@shikijs/langs/dist/ahk.mjs +1 -1
  85. package/node_modules/@shikijs/langs/dist/beancount.mjs +1 -1
  86. package/node_modules/@shikijs/langs/dist/coq.mjs +1 -1
  87. package/node_modules/@shikijs/langs/dist/csharp.mjs +1 -1
  88. package/node_modules/@shikijs/langs/dist/css.mjs +1 -1
  89. package/node_modules/@shikijs/langs/dist/dart.mjs +1 -1
  90. package/node_modules/@shikijs/langs/dist/dotenv.mjs +1 -1
  91. package/node_modules/@shikijs/langs/dist/emacs-lisp.mjs +1 -1
  92. package/node_modules/@shikijs/langs/dist/gn.mjs +1 -1
  93. package/node_modules/@shikijs/langs/dist/handlebars.mjs +1 -1
  94. package/node_modules/@shikijs/langs/dist/julia.mjs +1 -1
  95. package/node_modules/@shikijs/langs/dist/latex.mjs +1 -1
  96. package/node_modules/@shikijs/langs/dist/luau.mjs +1 -1
  97. package/node_modules/@shikijs/langs/dist/marko.mjs +1 -1
  98. package/node_modules/@shikijs/langs/dist/moonbit.mjs +1 -1
  99. package/node_modules/@shikijs/langs/dist/nextflow-groovy.mjs +1 -1
  100. package/node_modules/@shikijs/langs/dist/nextflow.mjs +1 -1
  101. package/node_modules/@shikijs/langs/dist/nushell.mjs +1 -1
  102. package/node_modules/@shikijs/langs/dist/php.mjs +1 -1
  103. package/node_modules/@shikijs/langs/dist/powershell.mjs +1 -1
  104. package/node_modules/@shikijs/langs/dist/ruby.mjs +1 -1
  105. package/node_modules/@shikijs/langs/dist/rust.mjs +1 -1
  106. package/node_modules/@shikijs/langs/dist/sql.mjs +1 -1
  107. package/node_modules/@shikijs/langs/dist/svelte.mjs +1 -1
  108. package/node_modules/@shikijs/langs/dist/twig.mjs +3 -3
  109. package/node_modules/@shikijs/langs/dist/typespec.mjs +1 -1
  110. package/node_modules/@shikijs/langs/package.json +3 -3
  111. package/node_modules/@shikijs/primitive/dist/index.mjs +2 -1
  112. package/node_modules/@shikijs/primitive/package.json +3 -3
  113. package/node_modules/@shikijs/themes/dist/monokai.mjs +1 -1
  114. package/node_modules/@shikijs/themes/dist/one-dark-pro.mjs +1 -1
  115. package/node_modules/@shikijs/themes/dist/red.mjs +1 -1
  116. package/node_modules/@shikijs/themes/dist/solarized-dark.mjs +1 -1
  117. package/node_modules/@shikijs/themes/dist/solarized-light.mjs +1 -1
  118. package/node_modules/@shikijs/themes/package.json +3 -3
  119. package/node_modules/@shikijs/types/package.json +1 -1
  120. package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +33 -11
  121. package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +3 -0
  122. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/exceptions.js +33 -11
  123. package/node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js +3 -0
  124. package/node_modules/@smithy/core/package.json +1 -1
  125. package/node_modules/node-addon-native-custom-loader/lib/index.js +23 -10
  126. package/node_modules/node-addon-native-custom-loader/package.json +6 -1
  127. package/node_modules/node-addon-require-builtin/package.json +7 -2
  128. package/node_modules/powershell-utils/index.js +40 -19
  129. package/node_modules/powershell-utils/package.json +1 -1
  130. package/node_modules/powershell-utils/readme.md +69 -13
  131. package/node_modules/shiki/package.json +10 -10
  132. package/node_modules/wsl-utils/index.js +18 -37
  133. package/node_modules/wsl-utils/package.json +2 -2
  134. package/package.json +33 -29
  135. package/node_modules/@shikijs/engine-javascript/dist/scanner-DX8LRFGE.mjs +0 -77
  136. package/node_modules/open/node_modules/powershell-utils/index.js +0 -79
  137. package/node_modules/open/node_modules/powershell-utils/license +0 -9
  138. package/node_modules/open/node_modules/powershell-utils/package.json +0 -47
  139. package/node_modules/open/node_modules/powershell-utils/readme.md +0 -209
@@ -49,6 +49,7 @@
49
49
  "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
50
50
  "@deepseek-ai/dsh-native-command": "0.2.0-rc.2",
51
51
  "@deepseek-ai/dsh-plugin-manager": "0.2.0-rc.2",
52
+ "@deepseek-ai/dsh-sandbox-apple-container": "0.2.0-rc.2",
52
53
  "@deepseek-ai/dsh-session": "0.2.0-rc.2",
53
54
  "@deepseek-ai/dsh-session-log-export": "0.2.0-rc.2",
54
55
  "@deepseek-ai/dsh-session-reference": "0.2.0-rc.2",
@@ -6,14 +6,14 @@ Convert, recalculate, and directly render local Office documents with prebuilt L
6
6
 
7
7
  Binary `.doc`, `.xls`, and `.ppt` inputs must be OLE compound documents, such as Office 97–2003 files. Renamed RTF/HTML and `.wps` inputs are unsupported. `missingFonts` is empty for binary inputs because their font tables are interpreted by LibreOffice rather than the OOXML inspector.
8
8
 
9
- The Node API version is independent of its platform engine versions. Version 0.1.2 uses Windows engines 0.1.2 and retains macOS/WASM engines 0.1.1. `ENGINE_VERSION` and `discoverRuntime().version` identify the Node API; `ENGINE_VERSIONS` lists the exact compatible engine versions.
9
+ The Node API version is independent of its platform engine versions. Version 0.1.3 uses macOS, Windows and WASM engines 0.1.3. `ENGINE_VERSION` and `discoverRuntime().version` identify the Node API; `ENGINE_VERSIONS` lists the exact compatible engine versions.
10
10
 
11
11
  ## Installation and usage
12
12
 
13
13
  Install with Node.js 22.19.0 or newer:
14
14
 
15
15
  ```sh
16
- npm install @deepseek-ai/libreoffice-kit@0.1.2
16
+ npm install @deepseek-ai/libreoffice-kit@0.1.3
17
17
  ```
18
18
 
19
19
  npm installs the matching native engine on macOS/Windows ARM64 or x64, and the shared WASM engine on Linux. macOS and Windows require their native package; a missing or invalid package rejects `createConverter` with `unavailable`, without switching to WASM. Linux uses WASM unless a compatible development native package was installed explicitly. Conversion failures never switch engines.
@@ -41,10 +41,25 @@ Converters created through the compatibility `createConverter(options)` API tran
41
41
 
42
42
  For a long-lived service that wants one explicit lifecycle owner for concurrent conversion slots, create one `createConverterFactory(options)` and obtain converters through `factory.create()`. Those converters use a factory-private cache while retaining separate Workers, native helpers, profiles, and output ownership. Dispose the factory to stop and join every converter it created.
43
43
 
44
- `convert()` exports the format named by the output suffix, `recalculate()` refreshes spreadsheet formula results before saving, and `renderImages()` writes a fresh directory containing PNG tiles plus `manifest.json`. Office images are painted directly from one loaded model; PDF images use PDFium. The CLI exposes the same operations through `libreoffice-kit capabilities|convert|recalculate|render`.
44
+ `convert()` exports the format named by the output suffix, `recalculate()` refreshes spreadsheet formula results before saving, and `renderImages()` writes a fresh directory containing PNG tiles plus `manifest.json`. Office images are painted directly from one loaded model; PDF images use PDFium. The CLI exposes the same operations through `dsoffice capabilities|convert|recalculate|render`. Worksheet names are exact: a missing image-render selection rejects with `invalid-document`, and a missing CSV selection rejects with `failed`; neither leaves output behind. Recalculation applies to the entire workbook and rejects `--sheet`. A rejected selection leaves the converter available for subsequent operations.
45
+
46
+ ```sh
47
+ npm exec -- dsoffice render --input report.docx --output-dir report-pages --pages 1
48
+ npm exec -- dsoffice render --input budget.xlsx --output-dir budget-preview --sheet Summary --range A1:D20
49
+ npm exec -- dsoffice convert --input report.docx --output report.pdf
50
+ npm exec -- dsoffice recalculate --input budget.xlsx --output recalculated.xlsx
51
+ ```
52
+
53
+ Right-to-left worksheets produce readable PNG text with column A on the right. A1 ranges and manifest rectangles retain logical column coordinates; each split tile is independently oriented for display.
45
54
 
46
55
  Conversion workers run the package's shipped JavaScript with an empty `execArgv`; consumer launch flags such as `--input-type=module` are not inherited.
47
56
 
57
+ Windows native helpers use anonymous stdio pipes and inherit the caller's token and Job restrictions. Pipe polling does not occupy libuv worker threads while a helper waits for commands. Cancellation and rejected worksheet selections wait for process exit and pipe closure, including when the protocol reader has paused stdout; this transport does not grant additional filesystem or network access.
58
+
59
+ Native conversion and image-rendering helpers disable printer enumeration and default-printer lookup with `SAL_DISABLE_PRINTERLIST=1` and `SAL_DISABLE_DEFAULTPRINTER=1`. Document previews and exports do not need a physical printer; these child-process settings prevent printer-driver dialogs and network-printer connection waits without changing the system's printer settings.
60
+
61
+ On Windows, an engine executable or program path of 260 or more characters uses a temporary helper copy and a junction to the installed resources inside the private operation directory. Resources stay in their installation, and the junction remains until the helper closes. A renderer that exits before returning a protocol response rejects with its exit status and captured diagnostics.
62
+
48
63
  On Linux, the native child searches the selected engine's program directory before system paths for shared libraries. Caller-provided `LD_LIBRARY_PATH` and `LD_PRELOAD` are not inherited.
49
64
 
50
65
  The caller authorizes input access and owns private input/output directories; paths must be absolute and remain unchanged during conversion. Input files must be regular Office files within the configured byte limits. ZIP entry and uncompressed-size limits apply to OOXML; binary DOC/XLS/PPT files use OLE compound containers validated by the LibreOffice importer. Binary formats retain the same conversion deadline and input/output limits. Output creation uses exclusive mode and permissions `0600`; an existing output is never overwritten. Failed or cancelled renders remove newly created outputs. `maxOutputBytes` limits the returned PDF and its read buffer; native temporary disk files can grow until export completes, then oversized PDFs are rejected and deleted before Node reads them. The caller owns successful PDFs and may send their bytes to a browser PDF viewer.
@@ -53,7 +68,7 @@ The caller authorizes input access and owns private input/output directories; pa
53
68
 
54
69
  ## Engines, fonts, and runtime behavior
55
70
 
56
- The Node API and engine packages share the kit release version. `ENGINE_VERSION` pins both WASM and native optional dependencies to the exact engine version. npm installs prepared engines; installation and conversion never compile LibreOffice or download additional engine payloads. Each engine includes its matching source recipes, patches, build information, and third-party license notices under `sources/` and `licenses/`.
71
+ The Node API reports its release version through `ENGINE_VERSION`; `ENGINE_VERSIONS` pins each platform engine independently. npm installs prepared engines; installation and conversion never compile LibreOffice or download additional engine payloads. Each engine includes its matching source recipes, patches, build information, and third-party license notices under `sources/` and `licenses/`.
57
72
 
58
73
  Defaults and all options are documented in the shipped TypeScript declarations in `lib/types/index.d.ts`. Font directories use conventional system/user paths for the selected OS. Indexing skips missing or protected sources and propagates other filesystem errors. `fontkit` indexes original font files and selects installed faces and glyph coverage; it does not rewrite fonts. Each operation discovers font candidates again and revalidates cached file identities. It uses one ordered metadata snapshot; matching entries are invalidated when that snapshot changes. A detected font change during conversion rejects the operation and removes its output. Original font bytes and decoded glyph coverage remain conversion-local. `missingFonts` contains absent families declared in readable document XML, excluding unrelated engine defaults. Missing glyphs without a named missing family are not a complete document accessibility report.
59
74
 
@@ -66,7 +81,7 @@ Both `createConverter()` and `createConverterFactory()` accept:
66
81
  | `fontMetadataCacheDirectory` | User system cache directory | Absolute directory path, or `false` to disable disk caching. |
67
82
  | `maxFontMetadataCacheBytes` | 32 MiB | Positive safe integer limiting each cache file read/write and retained per-file metadata per shared configuration. |
68
83
 
69
- The default directory is `~/Library/Caches/libreoffice-kit` on macOS, `%LOCALAPPDATA%/libreoffice-kit/Cache` on Windows (falling back to the user's `AppData/Local`), and `$XDG_CACHE_HOME/libreoffice-kit` on Linux (falling back to `~/.cache`). The single `font-metadata.json` file contains canonical file paths, device/inode, size, modification/change times, and all face metadata, including empty parse results. It contains no font bytes, glyph coverage, parsed font objects, document text, or document matching entries. Keep this user-local file private.
84
+ The default directory is `~/Library/Caches/libreoffice-kit` on macOS, `%LOCALAPPDATA%/libreoffice-kit/Cache` on Windows (falling back to the user's `AppData/Local`), and `$XDG_CACHE_HOME/libreoffice-kit` on Linux (falling back to `~/.cache`). The single `font-metadata.json` file contains canonical file paths, exact decimal device/inode identifiers, size, modification/change times, and all face metadata, including empty parse results. It contains no font bytes, glyph coverage, parsed font objects, document text, or document matching entries. Keep this user-local file private.
70
85
 
71
86
  A first run without reusable metadata performs the full original font inspection. Later processes skip inspection only for discovered files with matching identities. Each operation re-enumerates sources, including supplemental Office sources, so additions, deletions, replacements, and directory changes do not require a restart. Candidate order, file budgets, Office filtering, fallback matching, glyph queries, and original font import remain unchanged. A corrupted, incompatible, oversized, or inaccessible cache falls back to source inspection; unreadable source files never reuse stale records. Format, extractor, and pinned fontkit versions must match.
72
87
 
@@ -6,17 +6,19 @@
6
6
 
7
7
  二进制 `.doc`、`.xls`、`.ppt` 输入必须是 OLE 复合文档,例如 Office 97–2003 文件。不支持改后缀的 RTF/HTML 和 `.wps`。二进制输入的 `missingFonts` 为空,因为其字体表由 LibreOffice 读取,而不是由 OOXML 检查器读取。
8
8
 
9
- Node API 与各平台引擎独立指定版本。0.1.2 使用 Windows 引擎 0.1.2,保留 macOS/WASM 引擎 0.1.1。`ENGINE_VERSION` 和 `discoverRuntime().version` 表示 Node API 版本;`ENGINE_VERSIONS` 列出各平台兼容的精确引擎版本。
9
+ Node API 与各平台引擎独立指定版本。0.1.3 使用 macOS、Windows 和 WASM 引擎 0.1.3。`ENGINE_VERSION` 和 `discoverRuntime().version` 表示 Node API 版本;`ENGINE_VERSIONS` 列出各平台兼容的精确引擎版本。
10
10
 
11
11
  ## 安装与使用
12
12
 
13
13
  使用 Node.js 22.19.0 或更新版本安装:
14
14
 
15
15
  ```sh
16
- npm install @deepseek-ai/libreoffice-kit@0.1.2
16
+ npm install @deepseek-ai/libreoffice-kit@0.1.3
17
17
  ```
18
18
 
19
- npm 在 macOS/Windows ARM64 或 x64 上安装匹配的原生引擎,在 Linux 上安装共享 WASM 引擎。macOS 和 Windows 必须具有对应原生包;包缺失或无效时,`createConverter` 以 `unavailable` 拒绝,不会切换到 WASM。Linux 使用 WASM,除非显式安装了兼容的原生开发包。转换失败不会切换引擎。
19
+ npm 在 macOS/Windows ARM64 或 x64 上安装匹配的原生引擎,Windows 上,引擎可执行文件或程序目录路径达到 260 个字符时,在私有操作目录中使用 helper 临时副本和指向已安装资源的 junction。资源保留在安装目录,junction 在 helper 关闭后清理。渲染器若在返回协议响应前退出,会携带退出状态和捕获的诊断信息拒绝操作。
20
+
21
+ 在 Linux 上安装共享 WASM 引擎。macOS 和 Windows 必须具有对应原生包;包缺失或无效时,`createConverter` 以 `unavailable` 拒绝,不会切换到 WASM。Linux 使用 WASM,除非显式安装了兼容的原生开发包。转换失败不会切换引擎。
20
22
 
21
23
  ```js
22
24
  import { createConverter } from '@deepseek-ai/libreoffice-kit';
@@ -41,10 +43,23 @@ try {
41
43
 
42
44
  长驻服务如果需要为多个并发转换槽提供一个显式生命周期所有者,可创建 `createConverterFactory(options)`,再通过 `factory.create()` 建立转换器。这些转换器使用 factory 私有缓存,同时仍分别拥有 Worker、原生 helper、配置目录和输出。释放 factory 会停止并等待它创建的全部转换器。
43
45
 
44
- `convert()` 按输出后缀导出格式,`recalculate()` 在保存前刷新电子表格公式结果,`renderImages()` 在全新目录中写入 PNG tile 和 `manifest.json`。Office 图像直接从一次加载的模型绘制,PDF 使用 PDFium。CLI 通过 `libreoffice-kit capabilities|convert|recalculate|render` 提供相同行为。
46
+ `convert()` 按输出后缀导出格式,`recalculate()` 在保存前刷新电子表格公式结果,`renderImages()` 在全新目录中写入 PNG tile 和 `manifest.json`。Office 图像直接从一次加载的模型绘制,PDF 使用 PDFium。CLI 通过 `dsoffice capabilities|convert|recalculate|render` 提供相同行为。工作表名称按精确名称匹配:图像渲染指定不存在的工作表时返回 `invalid-document`,CSV 导出返回 `failed`,两者均不保留输出。重算作用于整个工作簿并拒绝 `--sheet`。选择失败后仍可复用转换器。
47
+
48
+ ```sh
49
+ npm exec -- dsoffice render --input report.docx --output-dir report-pages --pages 1
50
+ npm exec -- dsoffice render --input budget.xlsx --output-dir budget-preview --sheet Summary --range A1:D20
51
+ npm exec -- dsoffice convert --input report.docx --output report.pdf
52
+ npm exec -- dsoffice recalculate --input budget.xlsx --output recalculated.xlsx
53
+ ```
54
+
55
+ 从右向左排列的工作表会生成文字可正常阅读、A 列位于右侧的 PNG。A1 范围和 manifest 中的矩形仍使用逻辑列坐标;拆分后的每张 tile 均独立调整像素方向。
45
56
 
46
57
  转换 worker 以空的 `execArgv` 运行包内发布的 JavaScript;`--input-type=module` 之类的调用方启动参数不会被继承。
47
58
 
59
+ Windows 原生 helper 使用匿名标准输入输出管道,继承调用方的令牌和 Job 限制。helper 等待命令时,管道轮询不会占用 libuv 工作线程。取消及工作表选择失败均会等待进程退出和管道关闭,包括协议读取器已暂停 stdout 的情况;此传输方式不授予额外的文件系统或网络权限。
60
+
61
+ 原生转换和图片渲染 helper 设置 `SAL_DISABLE_PRINTERLIST=1` 与 `SAL_DISABLE_DEFAULTPRINTER=1`,禁用打印机枚举和默认打印机查询。文档预览和导出不需要实体打印机;这些子进程设置可避免打印机驱动弹窗及网络打印机连接等待,不会修改系统打印机设置。
62
+
48
63
  在 Linux 上,原生子进程会先在所选引擎的 program 目录中查找共享库,然后才查找系统路径。调用方提供的 `LD_LIBRARY_PATH` 和 `LD_PRELOAD` 不会被继承。
49
64
 
50
65
  调用方负责授权输入访问并拥有私有输入/输出目录;路径必须是绝对路径,并在转换期间保持不变。输入文件必须是常规 Office 文件,且在配置的字节限制之内。ZIP 条目数和解压大小限制适用于 OOXML;二进制 DOC/XLS/PPT 使用 OLE 复合容器,内部结构由 LibreOffice 导入器验证。二进制格式仍遵守相同的转换超时和输入/输出限制。输出创建使用独占模式和 `0600` 权限;已存在的输出绝不会被覆盖。失败或取消的渲染会删除新建的输出。`maxOutputBytes` 限制返回的 PDF 及其读取缓冲区;原生临时磁盘文件在导出完成前可能继续增长,随后过大的 PDF 会在 Node 读取之前被拒绝并删除。成功的 PDF 归调用方所有,调用方可以将其字节发送给浏览器 PDF 阅读器。
@@ -53,7 +68,7 @@ try {
53
68
 
54
69
  ## 引擎、字体与运行行为
55
70
 
56
- Node API 与引擎包使用相同的 kit 发布版本。`ENGINE_VERSION` 将 WASM 和原生可选依赖固定到精确的引擎版本。npm 安装预编译引擎;安装和转换阶段均不会编译 LibreOffice 或额外下载引擎资源。每个引擎包的 `sources/` 和 `licenses/` 保留匹配的源码配方、补丁、构建信息和第三方许可声明。
71
+ Node API 通过 `ENGINE_VERSION` 报告其发布版本;`ENGINE_VERSIONS` 独立固定各平台的引擎版本。npm 安装预编译引擎;安装和转换阶段均不会编译 LibreOffice 或额外下载引擎资源。每个引擎包的 `sources/` 和 `licenses/` 保留匹配的源码配方、补丁、构建信息和第三方许可声明。
57
72
 
58
73
  默认值和所有选项记录在随包发布的 `lib/types/index.d.ts` 类型声明中。字体目录使用所选操作系统的常规系统/用户路径。索引会跳过缺失或受保护的来源,并传播其他文件系统错误。`fontkit` 索引原始字体文件并选择已安装的字面和字形覆盖;它不重写字体。每次操作都会重新发现字体候选并验证缓存中的文件身份。一次操作使用一份有序元数据快照;快照变化后字体匹配条目失效。检测到转换期间字体变化时,操作会失败并删除其输出。原始字体字节和解码后的字形覆盖都只在本次转换内有效。精确的 family 匹配优先于 `fontFallbacks`。`missingFonts` 包含可读文档 XML 中声明但缺失的 family,不包含无关的引擎默认值。未命名缺失 family 的缺字并不构成完整的文档可访问性报告。
59
74
 
@@ -66,7 +81,7 @@ Node API 与引擎包使用相同的 kit 发布版本。`ENGINE_VERSION` 将 WAS
66
81
  | `fontMetadataCacheDirectory` | 用户系统缓存目录 | 目录的绝对路径,或用 `false` 关闭磁盘缓存。 |
67
82
  | `maxFontMetadataCacheBytes` | 32 MiB | 正安全整数,限制单个缓存文件的读取、写入及每份共享配置保留的逐文件元数据。 |
68
83
 
69
- macOS 默认使用 `~/Library/Caches/libreoffice-kit`,Windows 使用 `%LOCALAPPDATA%/libreoffice-kit/Cache`(缺省时回退到用户的 `AppData/Local`),Linux 使用 `$XDG_CACHE_HOME/libreoffice-kit`(缺省时回退到 `~/.cache`)。单个 `font-metadata.json` 文件保存规范文件路径、设备/inode、大小、修改/变更时间及全部 face 元数据,包括解析结果为空的记录。它不保存字体字节、字形覆盖、解析对象、文档文本或文档匹配条目。请将此用户级文件保持私有。
84
+ macOS 默认使用 `~/Library/Caches/libreoffice-kit`,Windows 使用 `%LOCALAPPDATA%/libreoffice-kit/Cache`(缺省时回退到用户的 `AppData/Local`),Linux 使用 `$XDG_CACHE_HOME/libreoffice-kit`(缺省时回退到 `~/.cache`)。单个 `font-metadata.json` 文件保存规范文件路径、以十进制字符串精确保留的设备/inode 标识、大小、修改/变更时间及全部 face 元数据,包括解析结果为空的记录。它不保存字体字节、字形覆盖、解析对象、文档文本或文档匹配条目。请将此用户级文件保持私有。
70
85
 
71
86
  没有可复用元数据的首次运行仍执行原来的完整字体 inspect。后续进程只跳过已发现且文件身份完全匹配的字体。每次操作重新枚举来源,包括 Office 补充字体,因此新增、删除、替换和目录变化无需重启。候选顺序、文件预算、Office 过滤、fallback 匹配、字形查询和原字体导入保持原有行为。缓存损坏、版本不兼容、超限或不可访问时回退到字体源计算;不可读的源字体不会复用旧记录。缓存格式、提取逻辑和固定的 fontkit 版本均须匹配。
72
87