diff --git a/.agents/notes/implemented/architecture/2026-10-26-cross-deployment-office-kit.i18n.yaml b/.agents/notes/implemented/architecture/2026-10-26-cross-deployment-office-kit.i18n.yaml index af61aa5c77..2d2e39897c 100644 --- a/.agents/notes/implemented/architecture/2026-10-26-cross-deployment-office-kit.i18n.yaml +++ b/.agents/notes/implemented/architecture/2026-10-26-cross-deployment-office-kit.i18n.yaml @@ -9,8 +9,8 @@ en: 129d30508926bbc5 zh: 15feff44556fc9b7 /agent-note-office-skills-in-every-deployment-with-one-office-kit-package/decision: - en: 7d70a22025ab858e - zh: cc37cb9932e78787 + en: e8f7468f6d6a9379 + zh: 69a5dc67ad2195b8 /agent-note-office-skills-in-every-deployment-with-one-office-kit-package/alternatives-considered: en: 167c52da0171028f zh: 9c87c2370d0719df diff --git a/.agents/notes/implemented/architecture/2026-10-26-cross-deployment-office-kit.md b/.agents/notes/implemented/architecture/2026-10-26-cross-deployment-office-kit.md index 5cf444a5b1..4edadf8728 100644 --- a/.agents/notes/implemented/architecture/2026-10-26-cross-deployment-office-kit.md +++ b/.agents/notes/implemented/architecture/2026-10-26-cross-deployment-office-kit.md @@ -18,9 +18,9 @@ The bundled Python environment ([`tool-workspace-dependencies`](../../../../pack [`@deepseek-ai/dsh-office-kit`](../../../../packages/document/office-kit/README.md) owns Kit location and the shared conversion service. Kit location is an internal implementation of the provider and is not exported: the provider passes its own `import.meta.resolve` lookup, and native engine paths use ASAR-unpacked mapping. Location reads no environment variables. The [on-demand Office tools](2026-10-31-native-office-tool.md) run Kit operations inside the Host, so no deployment publishes Kit CLI paths or Office executable variables. -An absent Kit degrades instead of failing a load. The conversion service registers and rejects conversions with code `unavailable`, retaining only a successful Kit import and reporting each distinct failure once; the `office_render`, `office_convert`, and `office_recalculate` tools stay registered and return that message when called. +An absent Kit degrades instead of failing a load. The conversion service registers and rejects conversions with code `unavailable`, retaining only a successful Kit import and reporting each distinct failure once; the `document_render`, `document_convert`, and `document_recalculate` tools stay registered and return that message when called. -`office-to-pdf` became `office-kit` so that later Kit consumers, such as native rendering (PR #5374) and the `tool-office` package, take Kit from one package. LibreOffice Kit dependencies declare one exact version in every manifest, so the converter and packaged engine come from the same Kit release. +`office-to-pdf` became `office-kit` so that later Kit consumers, such as native rendering (PR #5374) and the `tool-document` package, take Kit from one package. LibreOffice Kit dependencies declare one exact version in every manifest, so the converter and packaged engine come from the same Kit release. ## Alternatives considered diff --git a/.agents/notes/implemented/architecture/2026-10-26-cross-deployment-office-kit.zh.md b/.agents/notes/implemented/architecture/2026-10-26-cross-deployment-office-kit.zh.md index 4f8dd8192d..fdcf1f57a6 100644 --- a/.agents/notes/implemented/architecture/2026-10-26-cross-deployment-office-kit.zh.md +++ b/.agents/notes/implemented/architecture/2026-10-26-cross-deployment-office-kit.zh.md @@ -18,9 +18,9 @@ Status: implemented [`@deepseek-ai/dsh-office-kit`](../../../../packages/document/office-kit/README.zh.md) 负责 Kit 定位和共享转换服务。Kit 定位是提供方的内部实现,不对外导出:提供方传入自己的 `import.meta.resolve` 查找函数,原生引擎路径使用 ASAR 解包映射。定位不读取环境变量。[按需激活的 Office 工具](2026-10-31-native-office-tool.zh.md)在 Host 内执行 Kit 操作,因此任何部署都不发布 Kit CLI 路径或 Office 可执行文件变量。 -Kit 缺失时降级,而不是加载失败。转换服务照常注册,以代码 `unavailable` 拒绝转换,只保留成功的 Kit 导入,并对每种不同的失败只报告一次;`office_render`、`office_convert` 和 `office_recalculate` 工具保持注册并在调用时返回该消息。 +Kit 缺失时降级,而不是加载失败。转换服务照常注册,以代码 `unavailable` 拒绝转换,只保留成功的 Kit 导入,并对每种不同的失败只报告一次;`document_render`、`document_convert` 和 `document_recalculate` 工具保持注册并在调用时返回该消息。 -`office-to-pdf` 改为 `office-kit`,使后续的 Kit 消费方(例如原生渲染(PR #5374)和 `tool-office` 包)从同一个包获取 Kit。LibreOffice Kit 依赖在每个清单中声明同一个精确版本,因此转换器和打包的引擎来自同一个 Kit 发行版。 +`office-to-pdf` 改为 `office-kit`,使后续的 Kit 消费方(例如原生渲染(PR #5374)和 `tool-document` 包)从同一个包获取 Kit。LibreOffice Kit 依赖在每个清单中声明同一个精确版本,因此转换器和打包的引擎来自同一个 Kit 发行版。 ## 考虑过的替代方案 diff --git a/.agents/notes/implemented/architecture/2026-10-31-native-office-tool.i18n.yaml b/.agents/notes/implemented/architecture/2026-10-31-native-office-tool.i18n.yaml index bec0ce1d02..8988514f2b 100644 --- a/.agents/notes/implemented/architecture/2026-10-31-native-office-tool.i18n.yaml +++ b/.agents/notes/implemented/architecture/2026-10-31-native-office-tool.i18n.yaml @@ -9,11 +9,11 @@ en: 5b23962ecc835664 zh: c96ea8720ebc9419 /agent-note-on-demand-office-tools-for-rendering-conversion-and-recalculation/decision: - en: d0a6efef0765d006 - zh: 9f864c782c463d05 + en: eef4bd1704c4c8f8 + zh: e6ed5f99b3423416 /agent-note-on-demand-office-tools-for-rendering-conversion-and-recalculation/alternatives-considered: en: f36e8534958e5a46 zh: 96a3876a26a9d9ac /agent-note-on-demand-office-tools-for-rendering-conversion-and-recalculation/consequences: - en: 2a3be6598d22b452 - zh: 6c50422a975b7f80 + en: 25b82d83da6673ab + zh: 286a91608e196644 diff --git a/.agents/notes/implemented/architecture/2026-10-31-native-office-tool.md b/.agents/notes/implemented/architecture/2026-10-31-native-office-tool.md index 29124b7838..d0c4926949 100644 --- a/.agents/notes/implemented/architecture/2026-10-31-native-office-tool.md +++ b/.agents/notes/implemented/architecture/2026-10-31-native-office-tool.md @@ -10,13 +10,13 @@ Office operation skills ran the LibreOffice Kit CLI through ordinary shell comma ## Decision -The [`tool-office` package](../../../../packages/document/tool-office/README.md) exposes `office_render`, `office_convert`, and `office_recalculate` as three on-demand Host tools. Each tool states its parameter rules in its own JSON Schema: `office_render` accepts document paths, page or slide `pages`, worksheet `sheet` and `range` selection, `dpi`, and an optional `renderer` ([Poppler PDF renderer](2026-11-23-poppler-pdf-renderer.md)); `office_convert` accepts all nine output formats (`pdf`, `docx`, `odt`, and `txt` for Word; `pdf`, `xlsx`, `ods`, and `csv` for Excel; `pdf`, `pptx`, and `odp` for PowerPoint) plus `sheet` for CSV output (required when the workbook has several sheets); and `office_recalculate` accepts `xlsx` and `ods`. Together the three declarations total ~1,988 characters, paid only in Sessions that load an Office skill. They call the [Office kit](../../../../packages/document/office-kit/README.md) service, which loads Kit in the Host process through its `src/locate.ts` resolver and runs every operation through the queue, concurrency limits, byte reservations, and cache that Office previews use. Tool requests use `foreground` priority, the class of an open preview, so background prewarming cannot starve them. The SDK composition mounts `tool-office` beside `office-kit`, and the Web bundle's standard and PTC agent presets mount it while its minimal preset keeps its fixed roster; when Kit is missing the tools still register and every call returns the service's `unavailable` message. Each tool reads the service at each call instead of injecting it, so a composition that omits or disables `office-kit` still creates Sessions with the tools and each call fails as `unavailable`; a service loaded later serves the next call. Standard and PTC modes reach the same registrations; nested PTC calls re-enter the ordinary execution pipeline. +The [`tool-document` package](../../../../packages/document/tool-document/README.md) exposes `document_render`, `document_convert`, and `document_recalculate` as three on-demand Host tools. Each tool states its parameter rules in its own JSON Schema: `document_render` accepts document paths, page or slide `pages`, worksheet `sheet` and `range` selection, `dpi`, and an optional `renderer` ([Poppler PDF renderer](2026-11-23-poppler-pdf-renderer.md)); `document_convert` accepts all nine output formats (`pdf`, `docx`, `odt`, and `txt` for Word; `pdf`, `xlsx`, `ods`, and `csv` for Excel; `pdf`, `pptx`, and `odp` for PowerPoint) plus `sheet` for CSV output (required when the workbook has several sheets); and `document_recalculate` accepts `xlsx` and `ods`. Together the three declarations total ~1,988 characters, paid only in Sessions that load an Office skill. They call the [Office kit](../../../../packages/document/office-kit/README.md) service, which loads Kit in the Host process through its `src/locate.ts` resolver and runs every operation through the queue, concurrency limits, byte reservations, and cache that Office previews use. Tool requests use `foreground` priority, the class of an open preview, so background prewarming cannot starve them. The SDK composition mounts `tool-document` beside `office-kit`, and the Web bundle's standard and PTC agent presets mount it while its minimal preset keeps its fixed roster; when Kit is missing the tools still register and every call returns the service's `unavailable` message. Each tool reads the service at each call instead of injecting it, so a composition that omits or disables `office-kit` still creates Sessions with the tools and each call fails as `unavailable`; a service loaded later serves the next call. Standard and PTC modes reach the same registrations; nested PTC calls re-enter the ordinary execution pipeline. -`office_render` returns PNG images in the tool result; the Web Client's Office row shows only the result's text blocks and does not display the images. The tool commits the images through the attachment store before the result is logged, so the model-visible images are reconstructable from the Session log, resume and fork restore them, and image offload applies to them. The complete result is bounded by image count, per-image pixels and dimensions, and total PNG bytes, each the lower of the tool configuration and the attachment store's limits; an over-limit selection fails instead of being truncated. A route without image input is refused before rendering. +`document_render` returns PNG images in the tool result; the Web Client's Office row shows only the result's text blocks and does not display the images. The tool commits the images through the attachment store before the result is logged, so the model-visible images are reconstructable from the Session log, resume and fork restore them, and image offload applies to them. The complete result is bounded by image count, per-image pixels and dimensions, and total PNG bytes, each the lower of the tool configuration and the attachment store's limits; an over-limit selection fails instead of being truncated. A route without image input is refused before rendering. -`office_convert` and `office_recalculate` do not write into the workspace. The filesystem service intentionally provides only binary reads, and binary files in the workspace come only from the shell, whose sandbox and approvals already govern writes. The Office kit saves each output in an owner-only directory under its configurable `outputDirectory` (`$DSH_HOME/office-kit/outputs` by default), grouped by the root Session of the caller's subagent tree, and deletes it after `outputRetentionMs`, when `maxOutputStoreBytes` needs room for newer outputs, when that root Session is disposed, or when the provider unloads. A subagent's output therefore outlives the subagent, so the delegating agent can still copy it. Each tool returns the absolute temporary path, format, size, and the page count the converter reports, with the instruction to copy the file with the shell now, because it may be deleted after a retention period or to free space, and is deleted when the conversation ends. A filesystem backend that cannot read Host paths, such as an SSH workspace, refuses these two tools before converting, because a remote shell cannot read the Host output store. Shell sandboxes allow reads of the Harness home on macOS Seatbelt, Linux bubblewrap, and Linux Landlock, so a confined shell can copy the file into the workspace. +`document_convert` and `document_recalculate` do not write into the workspace. The filesystem service intentionally provides only binary reads, and binary files in the workspace come only from the shell, whose sandbox and approvals already govern writes. The Office kit saves each output in an owner-only directory under its configurable `outputDirectory` (`$DSH_HOME/office-kit/outputs` by default), grouped by the root Session of the caller's subagent tree, and deletes it after `outputRetentionMs`, when `maxOutputStoreBytes` needs room for newer outputs, when that root Session is disposed, or when the provider unloads. A subagent's output therefore outlives the subagent, so the delegating agent can still copy it. Each tool returns the absolute temporary path, format, size, and the page count the converter reports, with the instruction to copy the file with the shell now, because it may be deleted after a retention period or to free space, and is deleted when the conversation ends. A filesystem backend that cannot read Host paths, such as an SSH workspace, refuses these two tools before converting, because a remote shell cannot read the Host output store. Shell sandboxes allow reads of the Harness home on macOS Seatbelt, Linux bubblewrap, and Linux Landlock, so a confined shell can copy the file into the workspace. -The three tools share one `when(agent)` predicate instead of staying resident in every request. An `Agent` activates them when `marked.has(agent)` is true or when `agent.session.requestHeader()?.tools` already lists `office_render`, `office_convert`, or `office_recalculate`; `agent/disposed` clears the `WeakSet` mark. `tool-office` marks the `Agent` on a non-error `skill` tool result (`tools/result` with `!result.isError`, including a nested `skill` call inside `run_code`) or a direct user skill invocation (`session/event` where `event.type === 'user/message'` and `event.data.source.kind === 'skill-invocation'`) whose skill name is in `activationSkills` (`office` by default). The declarations appear on the step after the skill loads and stay active for the rest of the Session; calling an `office_*` tool before activation fails as `UNKNOWN_TOOL`. When mid-session activation adds the tools, the agent loop records a `developer/message` (`source: { kind: 'tool-registry' }`) with `tool-addition` items: models that declare `toolUpdate` (`in-history` or `addition-only`) keep their existing request prefix, whereas models without `toolUpdate` start a new request series once. Because standard-mode request headers are already persisted in the Session log, checking `requestHeader()` preserves activation across resume, fork, and compaction without a Session projection. In PTC mode, the recorded request header declares only `run_code`, so a resumed or forked PTC Session (or a process crash between loading a skill and recording the next native request header) does not retain `office_*` bindings until an Office skill loads again; the [`office` skill](../../../../packages/skill/skill-office/README.md) instructs the model to load `office` again when `office_render`, `office_convert`, or `office_recalculate` is not in the tool list. No skill wraps a single operation, and a standalone render, recalculation, or conversion loads only `office`. The skills carry no executable paths, so `skill-office` has no Node, CLI, or Kit location configuration, `office-kit`'s `src/locate.ts` resolves no CLI, Desktop and the bundles publish no Office executable variables, and the Python sidecar's standalone Node remains only for the Python `deepseek_harness.office` module. +The three tools share one `when(agent)` predicate instead of staying resident in every request. An `Agent` activates them when `marked.has(agent)` is true or when `agent.session.requestHeader()?.tools` already lists `document_render`, `document_convert`, or `document_recalculate`, or one of their earlier names `office_render`, `office_convert`, and `office_recalculate` that Sessions recorded before the rename; `agent/disposed` clears the `WeakSet` mark. `tool-document` marks the `Agent` on a non-error `skill` tool result (`tools/result` with `!result.isError`, including a nested `skill` call inside `run_code`) or a direct user skill invocation (`session/event` where `event.type === 'user/message'` and `event.data.source.kind === 'skill-invocation'`) whose skill name is in `activationSkills` (`office` by default). The declarations appear on the step after the skill loads and stay active for the rest of the Session; calling an `office_*` tool before activation fails as `UNKNOWN_TOOL`. When mid-session activation adds the tools, the agent loop records a `developer/message` (`source: { kind: 'tool-registry' }`) with `tool-addition` items: models that declare `toolUpdate` (`in-history` or `addition-only`) keep their existing request prefix, whereas models without `toolUpdate` start a new request series once. Because standard-mode request headers are already persisted in the Session log, checking `requestHeader()` preserves activation across resume, fork, and compaction without a Session projection. In PTC mode, the recorded request header declares only `run_code`, so a resumed or forked PTC Session (or a process crash between loading a skill and recording the next native request header) does not retain `office_*` bindings until an Office skill loads again; the [`office` skill](../../../../packages/skill/skill-office/README.md) instructs the model to load `office` again when `document_render`, `document_convert`, or `document_recalculate` is not in the tool list. No skill wraps a single operation, and a standalone render, recalculation, or conversion loads only `office`. The skills carry no executable paths, so `skill-office` has no Node, CLI, or Kit location configuration, `office-kit`'s `src/locate.ts` resolves no CLI, Desktop and the bundles publish no Office executable variables, and the Python sidecar's standalone Node remains only for the Python `deepseek_harness.office` module. This decision partially supersedes [progressive Office skills](2026-09-27-progressive-office-skills.md): its operation skills, ordinary-shell execution, and rejection of a dedicated renderer tool are replaced here, and its four-skill catalog is replaced by the `office` skill with concise inline guidance under the [single Office skill](2026-11-06-single-office-skill.md) decision. @@ -40,8 +40,8 @@ This decision partially supersedes [progressive Office skills](2026-09-27-progre ## Consequences -Visual inspection takes one `office_render` call after loading an Office skill and needs no cleanup, and its images follow the Session's attachment, offload, and replay rules. Sessions that do not load an Office skill pay zero Office tool-declaration tokens; Sessions that load one activate ~1,988 characters of operation-specific schemas, keeping the existing request prefix on models with `toolUpdate` and starting one new request series on models without it. Standard-mode resume, fork, and compaction retain the tools through the recorded request header, while PTC resume or fork and crashes before the next recorded header recover by loading `office` again. Office operations behave the same in standard and PTC modes and across deployments once activated, and the deployment-specific Node, CLI, and containment code is gone. +Visual inspection takes one `document_render` call after loading an Office skill and needs no cleanup, and its images follow the Session's attachment, offload, and replay rules. Sessions that do not load an Office skill pay zero Office tool-declaration tokens; Sessions that load one activate ~1,988 characters of operation-specific schemas, keeping the existing request prefix on models with `toolUpdate` and starting one new request series on models without it. Standard-mode resume, fork, and compaction retain the tools through the recorded request header, while PTC resume or fork and crashes before the next recorded header recover by loading `office` again. Office operations behave the same in standard and PTC modes and across deployments once activated, and the deployment-specific Node, CLI, and containment code is gone. Converted files need a shell copy; compositions without a shell tool can render but cannot deliver converted files, and remote workspaces cannot convert at all. Temporary outputs disappear after retention or root Session disposal, so a resumed Session must convert again. Saving page images as files is not offered. -Verification covers the three tools' schemas, results, argument rules, limits, failures, cancellation, PTC dispatch, and disposal in `tool-office.spec.ts`, and skill-driven activation, custom `activationSkills`, failed skill calls, direct `/office` invocation, `requestHeader()` persistence across resume and fork, and PTC reactivation in `activation.spec.ts`; the output store's retention, eviction, release, and sweeping in Office kit tests; Loader compositions that return the `unavailable` message with Kit absent and with the `office-kit` row absent, then reach the service once the row loads; packaged Desktop smoke checks that render, convert, and recalculate real DOCX, XLSX, and PPTX files through the service; and recorded headless sessions that omit `office_*` before an Office skill loads and declare `office_render`, `office_convert`, and `office_recalculate` on the step after loading one, including a render that `office_render` refuses for a route without image input. +Verification covers the three tools' schemas, results, argument rules, limits, failures, cancellation, PTC dispatch, and disposal in `tool-document.spec.ts`, and skill-driven activation, custom `activationSkills`, failed skill calls, direct `/office` invocation, `requestHeader()` persistence across resume and fork, and PTC reactivation in `activation.spec.ts`; the output store's retention, eviction, release, and sweeping in Office kit tests; Loader compositions that return the `unavailable` message with Kit absent and with the `office-kit` row absent, then reach the service once the row loads; packaged Desktop smoke checks that render, convert, and recalculate real DOCX, XLSX, and PPTX files through the service; and recorded headless sessions that omit `office_*` before an Office skill loads and declare `document_render`, `document_convert`, and `document_recalculate` on the step after loading one, including a render that `document_render` refuses for a route without image input. diff --git a/.agents/notes/implemented/architecture/2026-10-31-native-office-tool.zh.md b/.agents/notes/implemented/architecture/2026-10-31-native-office-tool.zh.md index bdcee7c943..2d7375b3eb 100644 --- a/.agents/notes/implemented/architecture/2026-10-31-native-office-tool.zh.md +++ b/.agents/notes/implemented/architecture/2026-10-31-native-office-tool.zh.md @@ -10,13 +10,13 @@ Status: implemented ## 决策 -[`tool-office` 包](../../../../packages/document/tool-office/README.zh.md)提供三个按需激活的 Host 工具:`office_render`、`office_convert` 和 `office_recalculate`。每个工具在各自的 JSON Schema 中直接声明参数规则:`office_render` 接受文档路径、页码或幻灯片 `pages`、工作表 `sheet` 与 `range` 选择、`dpi` 以及可选的 `renderer`([Poppler PDF 渲染后端](2026-11-23-poppler-pdf-renderer.zh.md));`office_convert` 保留全部九种输出格式(Word 支持 `pdf`、`docx`、`odt`、`txt`,Excel 支持 `pdf`、`xlsx`、`ods`、`csv`,PowerPoint 支持 `pdf`、`pptx`、`odp`)以及仅用于 CSV 输出的 `sheet`(工作簿含多个工作表时必填);`office_recalculate` 接受 `xlsx` 和 `ods`。三个工具声明共约 1,988 个字符,仅在加载了 Office 技能的 Session 中付出。它们调用 [Office 套件](../../../../packages/document/office-kit/README.zh.md)服务;该服务通过 `src/locate.ts` 在 Host 进程中加载 Kit,并让每个操作经过 Office 预览所用的队列、并发上限、字节预留和缓存。工具请求使用 `foreground` 优先级,即打开的预览所属的类别,因此后台预热不会饿死它们。SDK 组合在 `office-kit` 旁挂载 `tool-office`,Web bundle 的标准和 PTC Agent 预设挂载它,minimal 预设保持其固定工具列表;Kit 缺失时三个工具仍然注册,每次调用都返回服务的 `unavailable` 消息。每个工具在每次调用时读取该服务而不是注入它,因此省略或禁用 `office-kit` 的组合仍能带着这些工具创建 Session,每次调用以 `unavailable` 失败;之后加载的服务会处理下一次调用。标准模式与 PTC 模式使用同一组注册;PTC 嵌套调用重新进入普通执行管线。 +[`tool-document` 包](../../../../packages/document/tool-document/README.zh.md)提供三个按需激活的 Host 工具:`document_render`、`document_convert` 和 `document_recalculate`。每个工具在各自的 JSON Schema 中直接声明参数规则:`document_render` 接受文档路径、页码或幻灯片 `pages`、工作表 `sheet` 与 `range` 选择、`dpi` 以及可选的 `renderer`([Poppler PDF 渲染后端](2026-11-23-poppler-pdf-renderer.zh.md));`document_convert` 保留全部九种输出格式(Word 支持 `pdf`、`docx`、`odt`、`txt`,Excel 支持 `pdf`、`xlsx`、`ods`、`csv`,PowerPoint 支持 `pdf`、`pptx`、`odp`)以及仅用于 CSV 输出的 `sheet`(工作簿含多个工作表时必填);`document_recalculate` 接受 `xlsx` 和 `ods`。三个工具声明共约 1,988 个字符,仅在加载了 Office 技能的 Session 中付出。它们调用 [Office 套件](../../../../packages/document/office-kit/README.zh.md)服务;该服务通过 `src/locate.ts` 在 Host 进程中加载 Kit,并让每个操作经过 Office 预览所用的队列、并发上限、字节预留和缓存。工具请求使用 `foreground` 优先级,即打开的预览所属的类别,因此后台预热不会饿死它们。SDK 组合在 `office-kit` 旁挂载 `tool-document`,Web bundle 的标准和 PTC Agent 预设挂载它,minimal 预设保持其固定工具列表;Kit 缺失时三个工具仍然注册,每次调用都返回服务的 `unavailable` 消息。每个工具在每次调用时读取该服务而不是注入它,因此省略或禁用 `office-kit` 的组合仍能带着这些工具创建 Session,每次调用以 `unavailable` 失败;之后加载的服务会处理下一次调用。标准模式与 PTC 模式使用同一组注册;PTC 嵌套调用重新进入普通执行管线。 -`office_render` 在工具结果中返回 PNG 图片;Web Client 的 Office 行只显示结果的文本块,不显示这些图片。工具在结果写入日志之前通过附件存储提交图片,因此模型可见的图片可以从 Session 日志还原,恢复和分叉会还原它们,图片卸载也适用于它们。完整结果受图片数量、单图像素与尺寸以及 PNG 总字节数约束,每项取工具配置与附件存储上限中的较小值;超出上限的选择直接失败,不会被截断。不支持图片输入的路由在渲染前即被拒绝。 +`document_render` 在工具结果中返回 PNG 图片;Web Client 的 Office 行只显示结果的文本块,不显示这些图片。工具在结果写入日志之前通过附件存储提交图片,因此模型可见的图片可以从 Session 日志还原,恢复和分叉会还原它们,图片卸载也适用于它们。完整结果受图片数量、单图像素与尺寸以及 PNG 总字节数约束,每项取工具配置与附件存储上限中的较小值;超出上限的选择直接失败,不会被截断。不支持图片输入的路由在渲染前即被拒绝。 -`office_convert` 和 `office_recalculate` 不写入工作区。文件系统服务有意只提供二进制读取,工作区中的二进制文件只由 shell 产生,而 shell 的沙箱和审批已经管理写入。Office 套件把每个输出保存在可配置的 `outputDirectory`(默认 `$DSH_HOME/office-kit/outputs`)下仅属主可访问的目录中,按调用方 subagent 树的根 Session 分组;输出在 `outputRetentionMs` 到期、`maxOutputStoreBytes` 需要为较新的输出腾出空间、该根 Session 卸载或提供方卸载时删除。因此 subagent 的输出在 subagent 结束后仍然保留,委派它的 agent 仍可复制。工具返回临时文件的绝对路径、格式、大小和转换器报告的页数,并指示立即用 shell 复制该文件,因为文件可能在保留期到期或需要腾出空间时被删除,且对话结束后会被删除。无法读取 Host 路径的文件系统后端(例如 SSH 工作区)会在转换前拒绝这两个工具,因为远程 shell 读不到 Host 的输出存储。macOS Seatbelt、Linux bubblewrap 和 Linux Landlock 的 shell 沙箱都允许读取 Harness 主目录,因此受限的 shell 可以把文件复制进工作区。 +`document_convert` 和 `document_recalculate` 不写入工作区。文件系统服务有意只提供二进制读取,工作区中的二进制文件只由 shell 产生,而 shell 的沙箱和审批已经管理写入。Office 套件把每个输出保存在可配置的 `outputDirectory`(默认 `$DSH_HOME/office-kit/outputs`)下仅属主可访问的目录中,按调用方 subagent 树的根 Session 分组;输出在 `outputRetentionMs` 到期、`maxOutputStoreBytes` 需要为较新的输出腾出空间、该根 Session 卸载或提供方卸载时删除。因此 subagent 的输出在 subagent 结束后仍然保留,委派它的 agent 仍可复制。工具返回临时文件的绝对路径、格式、大小和转换器报告的页数,并指示立即用 shell 复制该文件,因为文件可能在保留期到期或需要腾出空间时被删除,且对话结束后会被删除。无法读取 Host 路径的文件系统后端(例如 SSH 工作区)会在转换前拒绝这两个工具,因为远程 shell 读不到 Host 的输出存储。macOS Seatbelt、Linux bubblewrap 和 Linux Landlock 的 shell 沙箱都允许读取 Harness 主目录,因此受限的 shell 可以把文件复制进工作区。 -三个工具共享同一个 `when(agent)` 谓词,而不是在每次请求中常驻。当 `marked.has(agent)` 为真,或 `agent.session.requestHeader()?.tools` 已包含 `office_render`、`office_convert` 或 `office_recalculate` 时,`Agent` 激活它们;`agent/disposed` 会清除 `WeakSet` 标记。当非错误的 `skill` 工具结果(`tools/result` 且 `!result.isError`,包括 `run_code` 内嵌套的 `skill` 调用)或直接的用户技能调用(`session/event` 中 `event.type === 'user/message'` 且 `event.data.source.kind === 'skill-invocation'`)加载了 `activationSkills`(默认为 `office`)中的技能时,`tool-office` 标记该 `Agent`。工具声明在加载技能后的下一步出现,并在该 Session 剩余时间内保持激活;激活前调用 `office_*` 工具会以 `UNKNOWN_TOOL` 失败。会话中途激活新增这些工具时,agent loop 会记录一条带 `tool-addition` 项的 `developer/message`(`source: { kind: 'tool-registry' }`):声明了 `toolUpdate`(`in-history` 或 `addition-only`)的模型保留现有请求前缀,未声明 `toolUpdate` 的模型则开启一次新的请求序列。由于标准模式的请求头本就持久化在 Session 日志中,检查 `requestHeader()` 即可在恢复、分叉和压缩后保留激活状态,无需新增 Session projection。PTC 模式下记录的请求头只声明 `run_code`,因此恢复或分叉的 PTC Session(或加载技能后、下一条原生请求头记录前发生进程崩溃)不会保留 `office_*` 绑定,直到再次加载 Office 技能;[`office` 技能](../../../../packages/skill/skill-office/README.zh.md)指示模型在 `office_render`、`office_convert` 或 `office_recalculate` 不在工具列表中时调用 `skill` 重新加载 `office`。没有技能只包装单个操作,单独的渲染、重算或转换只需加载 `office`。技能不再携带可执行文件路径,因此 `skill-office` 没有 Node、CLI 或 Kit 位置配置,`office-kit` 的 `src/locate.ts` 没有 CLI 解析器,Desktop 和各 bundle 不发布 Office 可执行文件变量,Python sidecar 的独立 Node 只保留给 Python `deepseek_harness.office` 模块使用。 +三个工具共享同一个 `when(agent)` 谓词,而不是在每次请求中常驻。当 `marked.has(agent)` 为真,或 `agent.session.requestHeader()?.tools` 已包含 `document_render`、`document_convert` 或 `document_recalculate`,或改名前记录的 Session 中的旧名 `office_render`、`office_convert`、`office_recalculate` 之一时,`Agent` 激活它们;`agent/disposed` 会清除 `WeakSet` 标记。当非错误的 `skill` 工具结果(`tools/result` 且 `!result.isError`,包括 `run_code` 内嵌套的 `skill` 调用)或直接的用户技能调用(`session/event` 中 `event.type === 'user/message'` 且 `event.data.source.kind === 'skill-invocation'`)加载了 `activationSkills`(默认为 `office`)中的技能时,`tool-document` 标记该 `Agent`。工具声明在加载技能后的下一步出现,并在该 Session 剩余时间内保持激活;激活前调用 `office_*` 工具会以 `UNKNOWN_TOOL` 失败。会话中途激活新增这些工具时,agent loop 会记录一条带 `tool-addition` 项的 `developer/message`(`source: { kind: 'tool-registry' }`):声明了 `toolUpdate`(`in-history` 或 `addition-only`)的模型保留现有请求前缀,未声明 `toolUpdate` 的模型则开启一次新的请求序列。由于标准模式的请求头本就持久化在 Session 日志中,检查 `requestHeader()` 即可在恢复、分叉和压缩后保留激活状态,无需新增 Session projection。PTC 模式下记录的请求头只声明 `run_code`,因此恢复或分叉的 PTC Session(或加载技能后、下一条原生请求头记录前发生进程崩溃)不会保留 `office_*` 绑定,直到再次加载 Office 技能;[`office` 技能](../../../../packages/skill/skill-office/README.zh.md)指示模型在 `document_render`、`document_convert` 或 `document_recalculate` 不在工具列表中时调用 `skill` 重新加载 `office`。没有技能只包装单个操作,单独的渲染、重算或转换只需加载 `office`。技能不再携带可执行文件路径,因此 `skill-office` 没有 Node、CLI 或 Kit 位置配置,`office-kit` 的 `src/locate.ts` 没有 CLI 解析器,Desktop 和各 bundle 不发布 Office 可执行文件变量,Python sidecar 的独立 Node 只保留给 Python `deepseek_harness.office` 模块使用。 此决定部分取代[渐进式 Office 技能](2026-09-27-progressive-office-skills.zh.md):其操作技能、普通 shell 执行方式以及否决专用渲染工具的决定由本文取代;按照[单个 Office 技能](2026-11-06-single-office-skill.zh.md)决策,其四技能目录已由携带精简内联指导的 `office` 技能取代。 @@ -40,8 +40,8 @@ Status: implemented ## 影响 -加载 Office 技能后,视觉检查只需一次 `office_render` 调用且无需清理,图片遵循 Session 的附件、卸载和回放规则。未加载 Office 技能的 Session 不消耗任何 Office 工具声明 token;加载了 Office 技能的 Session 激活约 1,988 个字符的专用 schema,支持 `toolUpdate` 的模型保留现有请求前缀,不支持 `toolUpdate` 的模型只开启一次新的请求序列。标准模式的恢复、分叉和压缩通过已记录的请求头保留工具声明,PTC 恢复或分叉以及在记录下一条请求头前崩溃的场景则通过再次加载 `office` 恢复。激活后,Office 操作在标准模式与 PTC 模式之间、在不同部署之间行为一致,各部署专用的 Node、CLI 和约束代码已经删除。 +加载 Office 技能后,视觉检查只需一次 `document_render` 调用且无需清理,图片遵循 Session 的附件、卸载和回放规则。未加载 Office 技能的 Session 不消耗任何 Office 工具声明 token;加载了 Office 技能的 Session 激活约 1,988 个字符的专用 schema,支持 `toolUpdate` 的模型保留现有请求前缀,不支持 `toolUpdate` 的模型只开启一次新的请求序列。标准模式的恢复、分叉和压缩通过已记录的请求头保留工具声明,PTC 恢复或分叉以及在记录下一条请求头前崩溃的场景则通过再次加载 `office` 恢复。激活后,Office 操作在标准模式与 PTC 模式之间、在不同部署之间行为一致,各部署专用的 Node、CLI 和约束代码已经删除。 转换后的文件需要 shell 复制;没有 shell 工具的组合可以渲染,但无法交付转换后的文件,远程工作区则完全不能转换。临时输出在保留期满或根 Session 卸载后消失,恢复的 Session 需要重新转换。不提供把页面图片保存为文件。 -验证包括:`tool-office.spec.ts` 覆盖三个工具的 schema、结果、参数规则、上限、失败、取消、PTC 分发和卸载,`activation.spec.ts` 覆盖技能触发激活、自定义 `activationSkills`、失败的技能调用、直接 `/office` 调用、跨恢复与分叉的 `requestHeader()` 持久化以及 PTC 重新激活;Office 套件测试覆盖输出存储的保留、淘汰、释放和清扫;Loader 组合测试在 Kit 缺失时以及 `office-kit` 条目缺失时返回 `unavailable` 消息,并在该条目加载后调用到服务;Desktop 打包 smoke 通过服务对真实 DOCX、XLSX 和 PPTX 文件执行渲染、转换和重算;录制的 headless Session 在加载 Office 技能前不声明 `office_*`,在加载后的下一步声明 `office_render`、`office_convert` 和 `office_recalculate`,其中包括一次因路由不接受图片输入而被 `office_render` 拒绝的渲染。 +验证包括:`tool-document.spec.ts` 覆盖三个工具的 schema、结果、参数规则、上限、失败、取消、PTC 分发和卸载,`activation.spec.ts` 覆盖技能触发激活、自定义 `activationSkills`、失败的技能调用、直接 `/office` 调用、跨恢复与分叉的 `requestHeader()` 持久化以及 PTC 重新激活;Office 套件测试覆盖输出存储的保留、淘汰、释放和清扫;Loader 组合测试在 Kit 缺失时以及 `office-kit` 条目缺失时返回 `unavailable` 消息,并在该条目加载后调用到服务;Desktop 打包 smoke 通过服务对真实 DOCX、XLSX 和 PPTX 文件执行渲染、转换和重算;录制的 headless Session 在加载 Office 技能前不声明 `office_*`,在加载后的下一步声明 `document_render`、`document_convert` 和 `document_recalculate`,其中包括一次因路由不接受图片输入而被 `document_render` 拒绝的渲染。 diff --git a/.agents/notes/implemented/architecture/2026-11-06-single-office-skill.i18n.yaml b/.agents/notes/implemented/architecture/2026-11-06-single-office-skill.i18n.yaml index d9403319db..b6bb6264df 100644 --- a/.agents/notes/implemented/architecture/2026-11-06-single-office-skill.i18n.yaml +++ b/.agents/notes/implemented/architecture/2026-11-06-single-office-skill.i18n.yaml @@ -9,8 +9,8 @@ en: 51614d95431e9cb6 zh: 6b7d21db5afc93bd /agent-note-one-office-skill-with-concise-inline-guidance/decision: - en: 0aa578d6f76479e5 - zh: 132c389f52861b58 + en: 0dc51d25023b29b8 + zh: e9da09b03ae2394b /agent-note-one-office-skill-with-concise-inline-guidance/alternatives-considered: en: 9230a1d8d322cbc9 zh: 4797f419635c23b4 diff --git a/.agents/notes/implemented/architecture/2026-11-06-single-office-skill.md b/.agents/notes/implemented/architecture/2026-11-06-single-office-skill.md index 299077bb4a..4badf7e904 100644 --- a/.agents/notes/implemented/architecture/2026-11-06-single-office-skill.md +++ b/.agents/notes/implemented/architecture/2026-11-06-single-office-skill.md @@ -10,9 +10,9 @@ The [Office provider](../../../../packages/skill/skill-office/README.md) listed ## Decision -`@deepseek-ai/dsh-skill-office` registers only `office`. The `office` body states that `office_render`, `office_convert`, and `office_recalculate` become available on the next step, notes bundled `pypdf` for existing PDFs and `office_convert` for legacy `.doc`, `.ppt`, and `.xls` files, records concise Word, PowerPoint, and Excel pitfalls that can silently drop formatting, East Asian fonts, layout fit, formula results, or sheets, and appends the configured Python environment section once. No separate format files are bundled or read. This supersedes the catalog and authoring bodies of [progressive Office skills](2026-09-27-progressive-office-skills.md) while keeping the activation design of the [on-demand Office tools](2026-10-31-native-office-tool.md) with `['office']` as the default `activationSkills`. +`@deepseek-ai/dsh-skill-office` registers only `office`. The `office` body states that `document_render`, `document_convert`, and `document_recalculate` become available on the next step, notes bundled `pypdf` for existing PDFs and `document_convert` for legacy `.doc`, `.ppt`, and `.xls` files, records concise Word, PowerPoint, and Excel pitfalls that can silently drop formatting, East Asian fonts, layout fit, formula results, or sheets, and appends the configured Python environment section once. No separate format files are bundled or read. This supersedes the catalog and authoring bodies of [progressive Office skills](2026-09-27-progressive-office-skills.md) while keeping the activation design of the [on-demand Office tools](2026-10-31-native-office-tool.md) with `['office']` as the default `activationSkills`. -The [Office tools](../../../../packages/document/tool-office/README.md) default `activationSkills` to `['office']`. During catalog discovery and loading, the provider reads `office/SKILL.md`; a missing file or invalid metadata omits `office` from the catalog with a warning, and other read errors leave discovery incomplete so that the registry retries it. +The [Office tools](../../../../packages/document/tool-document/README.md) default `activationSkills` to `['office']`. During catalog discovery and loading, the provider reads `office/SKILL.md`; a missing file or invalid metadata omits `office` from the catalog with a warning, and other read errors leave discovery incomplete so that the registry retries it. Because the entire guidance travels in the `skill` tool result, no second `read` call is needed and the guidance is identical in local, Desktop (`app.asar`), and remote or SSH workspaces. diff --git a/.agents/notes/implemented/architecture/2026-11-06-single-office-skill.zh.md b/.agents/notes/implemented/architecture/2026-11-06-single-office-skill.zh.md index b4bfbe436f..855d606719 100644 --- a/.agents/notes/implemented/architecture/2026-11-06-single-office-skill.zh.md +++ b/.agents/notes/implemented/architecture/2026-11-06-single-office-skill.zh.md @@ -10,9 +10,9 @@ Status: implemented ## Decision -`@deepseek-ai/dsh-skill-office` 只注册 `office`。`office` 正文说明 `office_render`、`office_convert` 和 `office_recalculate` 会在下一步可用,指出内置 `pypdf` 用于读取现有 PDF、旧版 `.doc`/`.ppt`/`.xls` 需先用 `office_convert` 转换,内联列出 Word、PowerPoint 和 Excel 中会静默丢失格式、东亚字体、版面适配、公式计算值或工作表的精简易错点,并在末尾追加一次配置的 Python 环境说明。不再内置或读取单独的格式文件。本文取代[渐进式 Office 技能](2026-09-27-progressive-office-skills.zh.md)的目录与创作正文设计,同时保留[按需激活的 Office 工具](2026-10-31-native-office-tool.zh.md)的激活设计(`activationSkills` 默认为 `['office']`)。 +`@deepseek-ai/dsh-skill-office` 只注册 `office`。`office` 正文说明 `document_render`、`document_convert` 和 `document_recalculate` 会在下一步可用,指出内置 `pypdf` 用于读取现有 PDF、旧版 `.doc`/`.ppt`/`.xls` 需先用 `document_convert` 转换,内联列出 Word、PowerPoint 和 Excel 中会静默丢失格式、东亚字体、版面适配、公式计算值或工作表的精简易错点,并在末尾追加一次配置的 Python 环境说明。不再内置或读取单独的格式文件。本文取代[渐进式 Office 技能](2026-09-27-progressive-office-skills.zh.md)的目录与创作正文设计,同时保留[按需激活的 Office 工具](2026-10-31-native-office-tool.zh.md)的激活设计(`activationSkills` 默认为 `['office']`)。 -[Office 工具](../../../../packages/document/tool-office/README.zh.md)的 `activationSkills` 默认为 `['office']`。目录发现和加载时,提供者读取 `office/SKILL.md`;文件缺失或元数据无效时,`office` 从目录中省略并记录警告,其他读取错误使本次发现不完整,由注册表重试。 +[Office 工具](../../../../packages/document/tool-document/README.zh.md)的 `activationSkills` 默认为 `['office']`。目录发现和加载时,提供者读取 `office/SKILL.md`;文件缺失或元数据无效时,`office` 从目录中省略并记录警告,其他读取错误使本次发现不完整,由注册表重试。 由于全部指导都随 `skill` 工具结果返回,无需第二次 `read` 调用,且在本地、Desktop(`app.asar`)以及远程或 SSH 工作区中都能获得完全一致的指导。 diff --git a/.agents/notes/implemented/architecture/2026-11-23-poppler-pdf-renderer.i18n.yaml b/.agents/notes/implemented/architecture/2026-11-23-poppler-pdf-renderer.i18n.yaml index 8e09362dd2..92cfb70c3c 100644 --- a/.agents/notes/implemented/architecture/2026-11-23-poppler-pdf-renderer.i18n.yaml +++ b/.agents/notes/implemented/architecture/2026-11-23-poppler-pdf-renderer.i18n.yaml @@ -6,17 +6,17 @@ en: 6b6a28cbe2843fda zh: edf8a8d2bfca2eda /agent-note-poppler-pdf-rendering-with-per-type-renderer-order/problem: - en: af2fbee9906e7c66 - zh: 79c0548e5cced650 + en: ce2f303448e1274d + zh: 5acf91ededefbbd0 /agent-note-poppler-pdf-rendering-with-per-type-renderer-order/decision: - en: bc8fc6e992caaa80 - zh: 092e8086fdcb3126 + en: 53541217602ed475 + zh: 52d6cff1298d5895 /agent-note-poppler-pdf-rendering-with-per-type-renderer-order/alternatives-considered: en: 070a5c29bb4b5ce7 zh: f627978ecaa56c6c /agent-note-poppler-pdf-rendering-with-per-type-renderer-order/consequences: - en: 3b0c793e5a230ead - zh: c90db1f1a7d5c7b2 + en: b8d08ac9aed0926e + zh: 48fbec9e277774e8 /agent-note-poppler-pdf-rendering-with-per-type-renderer-order/related: en: 80a851824d3a9aaa zh: 423cdb42471e7c7d diff --git a/.agents/notes/implemented/architecture/2026-11-23-poppler-pdf-renderer.md b/.agents/notes/implemented/architecture/2026-11-23-poppler-pdf-renderer.md index 21be8e4dbc..7ab503c5f3 100644 --- a/.agents/notes/implemented/architecture/2026-11-23-poppler-pdf-renderer.md +++ b/.agents/notes/implemented/architecture/2026-11-23-poppler-pdf-renderer.md @@ -6,15 +6,15 @@ English | [中文](2026-11-23-poppler-pdf-renderer.zh.md) ## Problem -`office_render` rasterized every input, including PDF, in the Office kit's LibreOffice converter. That converter is a resident process of roughly 600 to 900 MiB per instance. Rendering a scanned PDF of more than 280 pages in a Linux x64 container limited to 2 GiB ran out of memory. PDF rasterization does not need an Office engine, and Hosts often have Poppler's `pdftoppm` and `pdfinfo` installed. +`document_render` rasterized every input, including PDF, in the Office kit's LibreOffice converter. That converter is a resident process of roughly 600 to 900 MiB per instance. Rendering a scanned PDF of more than 280 pages in a Linux x64 container limited to 2 GiB ran out of memory. PDF rasterization does not need an Office engine, and Hosts often have Poppler's `pdftoppm` and `pdfinfo` installed. ## Decision The [Office kit](../../../../packages/document/office-kit/README.md) has two image rendering backends, `libreoffice` and `poppler`. `OfficeImagesRequest.renderer` selects one exclusively; `poppler` accepts only PDF, and an unavailable requested backend fails with `unavailable`. Without `renderer`, the provider takes the first available backend from its `renderers` configuration for the input type, by default `office: [libreoffice]` and `pdf: [poppler, libreoffice]`, and uses the last entry without an availability check. Only unavailability moves selection to the next entry. LibreOffice is available when Kit imports; Poppler is available when the `subprocess` service exists and resolves both configured executables. The backend is resolved before queue admission and recorded in the operation, so the result names it and cached renderings never cross backends. -Poppler runs as short-lived subprocesses through `ctx.subprocess` with argv only and no LibreOffice converter slot, while sharing the queue's admission, concurrency, and source-byte reservations. No file passes between the provider and a process: each process reads the PDF from stdin, written with backpressure, and `pdftoppm` writes its PNG images to stdout one after another. The Poppler path therefore works in whatever execution world the subprocess provider runs processes, including an SSH host, and needs no filesystem provider. Each process runs in the directory of its resolved executable, which exists in that world. `pdfinfo` reports the page count and the crop-box size and rotation of each selected page, and the provider rejects an oversized or out-of-range selection with the LibreOffice error codes before rendering. `pdftoppm -cropbox` renders each run of consecutive pages once; the provider splits its stdout at PNG chunk boundaries as bytes arrive, terminates it once the bytes exceed the remaining budget, requires one image per page, and checks each image's header dimensions again. One `timeoutMs` deadline covers all processes of a rendering; cancellation, the deadline, and provider disposal terminate the running process, and each call settles only after the process exits. +Poppler runs as short-lived subprocesses through `ctx.subprocess` with argv only and no LibreOffice converter slot, while sharing the queue's admission, concurrency, and source-byte reservations. No file passes between the provider and a process: each process reads the PDF from stdin, written with backpressure, and `pdftoppm` writes its PNG images to stdout one after another. The Poppler path therefore works in whatever execution world the subprocess provider runs processes, including an SSH host, and needs no filesystem provider. Each process runs in the directory of its resolved executable, which exists in that world. One `pdfinfo` reports the page count, read from its last `Pages:` line because document properties such as the title print earlier and can contain forged lines; a second reports the crop-box size and rotation of every page from the first to the last selected page, and the provider rejects an oversized or out-of-range selection with the LibreOffice error codes before rendering. `pdftoppm -cropbox` renders each run of consecutive pages once; the provider splits its stdout at PNG chunk boundaries as bytes arrive, terminates it once the bytes exceed the remaining budget, requires one image per page, and checks each image's header dimensions again. One `timeoutMs` deadline covers all processes of a rendering; cancellation, the deadline, and provider disposal terminate the running process, and each call settles only after the process exits. -[`office_render`](../../../../packages/document/tool-office/README.md) exposes `renderer` to the model, refuses `poppler` for non-PDF input before reading it, and reports the backend in its result text. An unavailable explicit `poppler` request tells the model to omit `renderer` or choose `libreoffice`. +[`document_render`](../../../../packages/document/tool-document/README.md) exposes `renderer` to the model, refuses `poppler` for non-PDF input before reading it, and reports the backend in its result text. An unavailable explicit `poppler` request tells the model to omit `renderer` or choose `libreoffice`. ## Alternatives considered @@ -32,9 +32,9 @@ Poppler runs as short-lived subprocesses through `ctx.subprocess` with argv only ## Consequences -PDF rendering no longer starts a LibreOffice converter where Poppler is installed, and its memory ends with each process. Poppler processes run outside the DSH sandbox with no memory limit other than the operating system's, only `timeoutMs` bounds them, and the provider neither installs Poppler nor checks its version. With SSH providers, Poppler must be installed on the SSH host, and the PDF crosses the connection once per process. Each rendering starts one `pdfinfo` for the page count and one `pdfinfo` and one `pdftoppm` per run of consecutive pages, each receiving the complete PDF. Poppler and LibreOffice rasterize pages differently, so the same request can produce different images depending on whether Poppler is available; the result's `renderer` field and text make the difference visible. +PDF rendering no longer starts a LibreOffice converter where Poppler is installed, and its memory ends with each process. Poppler processes run outside the DSH sandbox with no memory limit other than the operating system's, only `timeoutMs` bounds them, and the provider neither installs Poppler nor checks its version. With SSH providers, Poppler must be installed on the SSH host, and the PDF crosses the connection once per process. Each rendering starts two `pdfinfo` processes, one for the page count and one for the sizes from the first to the last selected page, and one `pdftoppm` per run of consecutive pages, each receiving the complete PDF. Poppler and LibreOffice rasterize pages differently, so the same request can produce different images depending on whether Poppler is available; the result's `renderer` field and text make the difference visible. -Office kit tests drive a scripted subprocess provider with stdin and stdout streams through backend order and fallback, explicit and unavailable requests, run splitting, PNG splitting across reads, image-count mismatches, malformed and truncated PNG streams, pixel and dimension prechecks, count and byte limits at and above their bounds, slow and failing stdin, exit-code mapping, deadline, cancellation, and disposal termination, per-backend caching, and configuration validation. A further spec renders a generated PDF with real Poppler through `node:child_process` pipes when both executables are on PATH. Tool tests cover the `renderer` argument, its refusal for non-PDF input, the result text, and the unavailable hint. +Office kit tests drive a scripted subprocess provider with stdin and stdout streams through backend order and fallback, explicit and unavailable requests, run splitting, document properties that forge earlier `Pages:` and size lines, PNG splitting across reads, image-count mismatches, malformed and truncated PNG streams, pixel and dimension prechecks, count and byte limits at and above their bounds, slow and failing stdin, exit-code mapping, deadline, cancellation, and disposal termination, per-backend caching, and configuration validation. A further spec renders generated PDFs, including one whose title forges a smaller page count, with real Poppler through the local subprocess provider when it resolves both executables. Tool tests cover the `renderer` argument, its refusal for non-PDF input, the result text, and the unavailable hint. ## Related diff --git a/.agents/notes/implemented/architecture/2026-11-23-poppler-pdf-renderer.zh.md b/.agents/notes/implemented/architecture/2026-11-23-poppler-pdf-renderer.zh.md index b0226a210f..d6560bb0cd 100644 --- a/.agents/notes/implemented/architecture/2026-11-23-poppler-pdf-renderer.zh.md +++ b/.agents/notes/implemented/architecture/2026-11-23-poppler-pdf-renderer.zh.md @@ -6,15 +6,15 @@ Status: implemented ## 问题 -`office_render` 过去在 Office 套件的 LibreOffice 转换器中栅格化所有输入,包括 PDF。该转换器是常驻进程,单个实例约占 600 到 900 MiB。在内存上限 2 GiB 的 Linux x64 容器中渲染 280 多页的扫描 PDF 会内存耗尽。栅格化 PDF 并不需要 Office 引擎,而 Host 上常常已经装有 Poppler 的 `pdftoppm` 和 `pdfinfo`。 +`document_render` 过去在 Office 套件的 LibreOffice 转换器中栅格化所有输入,包括 PDF。该转换器是常驻进程,单个实例约占 600 到 900 MiB。在内存上限 2 GiB 的 Linux x64 容器中渲染 280 多页的扫描 PDF 会内存耗尽。栅格化 PDF 并不需要 Office 引擎,而 Host 上常常已经装有 Poppler 的 `pdftoppm` 和 `pdfinfo`。 ## 决策 [Office 套件](../../../../packages/document/office-kit/README.zh.md)有两个图片渲染后端:`libreoffice` 和 `poppler`。`OfficeImagesRequest.renderer` 指定只使用其中一个;`poppler` 只接受 PDF,指定的后端不可用时以 `unavailable` 失败。未指定 `renderer` 时,提供方按 `renderers` 配置中该输入类型的顺序取第一个可用后端,默认为 `office: [libreoffice]` 和 `pdf: [poppler, libreoffice]`,最后一项不预先检查,直接使用。只有「不可用」才会换下一项。Kit 能导入时 LibreOffice 可用;`subprocess` 服务存在且能找到两个已配置的可执行文件时 Poppler 可用。后端在队列准入前确定并写入 operation,因此结果注明所用后端,缓存的渲染结果不会跨后端复用。 -Poppler 通过 `ctx.subprocess` 以 argv 启动短生命周期子进程,不占用 LibreOffice 转换器槽位,但共用队列的准入、并发和源字节预留。提供方与进程之间不传递文件:每个进程从 stdin 读取 PDF(写入时处理背压),`pdftoppm` 把 PNG 图片首尾相接写到 stdout。因此 subprocess 提供方在哪个执行环境中运行进程(包括 SSH 主机),Poppler 路径都能工作,也不需要文件系统提供方。每个进程的工作目录是解析出的可执行文件所在目录,该目录在那个执行环境中一定存在。`pdfinfo` 报告页数及每个所选页面的裁剪框尺寸和旋转,提供方在渲染前以 LibreOffice 路径的错误码拒绝过大或越界的选择。`pdftoppm -cropbox` 对每段连续页码各渲染一次;提供方在数据到达时按 PNG chunk 边界切分其 stdout,字节数超过剩余预算时终止它,要求每页恰好一张图片,并再次核对每张图片头部的尺寸。一个 `timeoutMs` 期限覆盖一次渲染的全部进程;取消、超过期限和提供方卸载都会终止正在运行的进程,每次调用都等进程退出后才结束。 +Poppler 通过 `ctx.subprocess` 以 argv 启动短生命周期子进程,不占用 LibreOffice 转换器槽位,但共用队列的准入、并发和源字节预留。提供方与进程之间不传递文件:每个进程从 stdin 读取 PDF(写入时处理背压),`pdftoppm` 把 PNG 图片首尾相接写到 stdout。因此 subprocess 提供方在哪个执行环境中运行进程(包括 SSH 主机),Poppler 路径都能工作,也不需要文件系统提供方。每个进程的工作目录是解析出的可执行文件所在目录,该目录在那个执行环境中一定存在。第一个 `pdfinfo` 报告页数,取其最后一行 `Pages:`,因为标题等文档属性先输出,其中可能包含伪造的行;第二个报告从第一个到最后一个所选页面中每页的裁剪框尺寸和旋转,提供方在渲染前以 LibreOffice 路径的错误码拒绝过大或越界的选择。`pdftoppm -cropbox` 对每段连续页码各渲染一次;提供方在数据到达时按 PNG chunk 边界切分其 stdout,字节数超过剩余预算时终止它,要求每页恰好一张图片,并再次核对每张图片头部的尺寸。一个 `timeoutMs` 期限覆盖一次渲染的全部进程;取消、超过期限和提供方卸载都会终止正在运行的进程,每次调用都等进程退出后才结束。 -[`office_render`](../../../../packages/document/tool-office/README.zh.md) 向模型提供 `renderer` 参数,对非 PDF 输入在读取前拒绝 `poppler`,并在结果文本中注明所用后端。显式请求的 `poppler` 不可用时,提示模型省略 `renderer` 或改用 `libreoffice`。 +[`document_render`](../../../../packages/document/tool-document/README.zh.md) 向模型提供 `renderer` 参数,对非 PDF 输入在读取前拒绝 `poppler`,并在结果文本中注明所用后端。显式请求的 `poppler` 不可用时,提示模型省略 `renderer` 或改用 `libreoffice`。 ## 考虑过的替代方案 @@ -32,9 +32,9 @@ Poppler 通过 `ctx.subprocess` 以 argv 启动短生命周期子进程,不占 ## 后果 -在装有 Poppler 的环境中,PDF 渲染不再启动 LibreOffice 转换器,内存随每个进程结束而释放。Poppler 进程在 DSH 沙箱之外运行,除操作系统外没有内存上限,只有 `timeoutMs` 约束它们;提供方既不安装 Poppler,也不检查其版本。使用 SSH 提供方时,Poppler 必须装在 SSH 主机上,PDF 每启动一个进程就经过连接传输一次。每次渲染启动一个读取页数的 `pdfinfo`,并为每段连续页码各启动一个 `pdfinfo` 和一个 `pdftoppm`,每个进程都接收完整的 PDF。Poppler 与 LibreOffice 的栅格化方式不同,因此同一请求的图片取决于 Poppler 是否可用;结果中的 `renderer` 字段和文本让这种差异可见。 +在装有 Poppler 的环境中,PDF 渲染不再启动 LibreOffice 转换器,内存随每个进程结束而释放。Poppler 进程在 DSH 沙箱之外运行,除操作系统外没有内存上限,只有 `timeoutMs` 约束它们;提供方既不安装 Poppler,也不检查其版本。使用 SSH 提供方时,Poppler 必须装在 SSH 主机上,PDF 每启动一个进程就经过连接传输一次。每次渲染启动两个 `pdfinfo`(一个读取页数,一个读取从第一个到最后一个所选页面的尺寸),并为每段连续页码各启动一个 `pdftoppm`,每个进程都接收完整的 PDF。Poppler 与 LibreOffice 的栅格化方式不同,因此同一请求的图片取决于 Poppler 是否可用;结果中的 `renderer` 字段和文本让这种差异可见。 -Office 套件的测试用带 stdin 和 stdout 流的脚本化子进程提供方覆盖后端顺序与退回、显式请求与不可用请求、连续页段拆分、跨多次读取的 PNG 切分、图片数不符、格式错误或被截断的 PNG 流、像素和尺寸预检、数量和字节上限(等于与超出)、读取缓慢和写入失败的 stdin、退出码映射、超时、取消和卸载时的终止、按后端缓存,以及配置校验。另有一个测试在两个可执行文件都在 PATH 上时,通过 `node:child_process` 管道用真实 Poppler 渲染生成的 PDF。工具测试覆盖 `renderer` 参数、对非 PDF 输入的拒绝、结果文本和不可用提示。 +Office 套件的测试用带 stdin 和 stdout 流的脚本化子进程提供方覆盖后端顺序与退回、显式请求与不可用请求、连续页段拆分、文档属性伪造的 `Pages:` 与尺寸行、跨多次读取的 PNG 切分、图片数不符、格式错误或被截断的 PNG 流、像素和尺寸预检、数量和字节上限(等于与超出)、读取缓慢和写入失败的 stdin、退出码映射、超时、取消和卸载时的终止、按后端缓存,以及配置校验。另有一个测试在本机 subprocess 提供方能找到两个可执行文件时,通过它用真实 Poppler 渲染生成的 PDF,其中一个的标题伪造了更小的页数。工具测试覆盖 `renderer` 参数、对非 PDF 输入的拒绝、结果文本和不可用提示。 ## 相关记录 diff --git a/apps/cli/tests/profiles/sdk/keyless-smoke.e2e.ts b/apps/cli/tests/profiles/sdk/keyless-smoke.e2e.ts index b5bdcc1cd0..7af52d54d4 100644 --- a/apps/cli/tests/profiles/sdk/keyless-smoke.e2e.ts +++ b/apps/cli/tests/profiles/sdk/keyless-smoke.e2e.ts @@ -680,7 +680,7 @@ it.each(['unset', 'empty', 'full', 'python-only', 'python-only-patched', 'wrong- const names = (requests[0]!.tools as { name: string }[]).map(value => value.name) expect(names.includes('load_workspace_dependencies')).toBe(enabled) expect(JSON.stringify(requests[0]!.messages)).toContain('`office`') - const officeTools = ['office_convert', 'office_recalculate', 'office_render'] + const officeTools = ['document_convert', 'document_recalculate', 'document_render'] expect(names.filter(name => name.startsWith('office'))).toEqual([]) const lastNames = (requests.at(-1)!.tools as { name: string }[]).map(value => value.name) // Loading an Office skill declares the Office tools from the following request. diff --git a/apps/cli/tests/profiles/sdk/office-cli.e2e.ts b/apps/cli/tests/profiles/sdk/office-cli.e2e.ts index 5d494d00ce..74c462dd48 100644 --- a/apps/cli/tests/profiles/sdk/office-cli.e2e.ts +++ b/apps/cli/tests/profiles/sdk/office-cli.e2e.ts @@ -1,5 +1,5 @@ /** - * PDF export through the shipped SDK profile: the agent loads an Office skill, converts with `office_convert`, and + * PDF export through the shipped SDK profile: the agent loads an Office skill, converts with `document_convert`, and * copies the temporary PDF into the workspace with the shell, with no Node on PATH. * Defaults to built Node packages. DSH_OFFICE_TEST_EXECUTABLE/ENTRY select a relocated Node or Electron carrier; * CARRIER=sdk selects the standalone executable. API=openai-completions selects a development gateway instead of the @@ -31,7 +31,7 @@ function callArguments(call: ToolCall): Record { return JSON.parse(call.arguments) as Record } -it.skipIf(!process.env.DEEPSEEK_API_KEY || process.platform === 'win32')(`agent exports a PDF with office_convert in the ${carrier} carrier without Node on PATH`, async () => { +it.skipIf(!process.env.DEEPSEEK_API_KEY || process.platform === 'win32')(`agent exports a PDF with document_convert in the ${carrier} carrier without Node on PATH`, async () => { const root = await mkdtemp(join(tmpdir(), 'dsh office export ')) try { const source = zipSync({ @@ -105,7 +105,7 @@ it.skipIf(!process.env.DEEPSEEK_API_KEY || process.platform === 'win32')(`agent return params?.event?.type === 'tool/call' ? [params.event.data] : [] }) const skill = calls.findIndex(call => call.name === 'skill') - const convert = calls.findIndex(call => call.name === 'office_convert' && callArguments(call).format === 'pdf') + const convert = calls.findIndex(call => call.name === 'document_convert' && callArguments(call).format === 'pdf') const copy = calls.findIndex(call => call.name === 'bash' && /\bcp\b/u.test(String(callArguments(call).command))) expect(skill, diagnostic).toBeGreaterThanOrEqual(0) expect(convert, diagnostic).toBeGreaterThan(skill) diff --git a/apps/cli/tests/web-agent-presets.e2e.ts b/apps/cli/tests/web-agent-presets.e2e.ts index 473a89be4a..a2c615d918 100644 --- a/apps/cli/tests/web-agent-presets.e2e.ts +++ b/apps/cli/tests/web-agent-presets.e2e.ts @@ -352,7 +352,7 @@ describe('the shipped Web composition', () => { // depend on ripgrep being present on the machine. expect(toolNames(ctx, handle.agent).filter(name => name !== 'glob' && name !== 'grep')).toEqual([ 'apply_patch', 'ask_user_question', 'bash', 'cordis_inspect', 'create_goal', 'edit', 'exit_plan_mode', - 'get_goal', 'job_kill', 'job_list', 'job_output', 'list_agents', 'list_subagent_models', 'office_convert', 'office_recalculate', 'office_render', 'plugin_manager', 'present', 'read', 'read_image', + 'get_goal', 'job_kill', 'job_list', 'job_output', 'list_agents', 'list_subagent_models', 'document_convert', 'document_recalculate', 'document_render', 'plugin_manager', 'present', 'read', 'read_image', 'schedule_create', 'schedule_edit', 'schedule_list', 'schedule_view', 'send_message', 'skill', 'subagent', 'subagent_fork', 'team_task_create', 'team_task_get', 'team_task_list', 'team_task_update', 'todo_write', 'update_goal', 'wait_agent', 'web_fetch', 'web_search', diff --git a/apps/desktop/packaging/README.i18n.yaml b/apps/desktop/packaging/README.i18n.yaml index 228f07da88..48e230626e 100644 --- a/apps/desktop/packaging/README.i18n.yaml +++ b/apps/desktop/packaging/README.i18n.yaml @@ -45,8 +45,8 @@ en: b42f103358d0dfd7 zh: a534164ad9eb00da /desktop-packaging/runtime-file-selection-and-installation-checks: - en: 1d153e4ba7528414 - zh: cdf15fb80099ce17 + en: 41cf2ae206d127d2 + zh: ad30381fdcb0d872 /desktop-packaging/desktop-runtime-preparation: en: 84be38ab3136fff7 zh: bb4ed12ee0e1dfa0 diff --git a/apps/desktop/packaging/README.md b/apps/desktop/packaging/README.md index d8aa7714ee..eb83188b2c 100644 --- a/apps/desktop/packaging/README.md +++ b/apps/desktop/packaging/README.md @@ -252,7 +252,7 @@ Desktop packs workspace packages locally and installs external dependencies thro The [Electron shell file list](../scripts/electron-builder-config.mjs) excludes recognized JavaScript/CSS/TypeScript source maps and TypeScript build caches from the separate `resources/app.asar/node_modules` dependency collection. These exclusions preserve runtime code, native modules, WASM, data files (including ordinary `.map` assets), licenses, and notices; [shell archive tests](../tests/shell-file-selection.spec.ts) check retained bytes and exclusions. -The [Office conversion provider](../../../packages/document/office-kit/README.md) is a Host service mounted by web-app, so every application that loads web-app, including `dsh web` and Desktop, provides it together with the [Office tools](../../../packages/document/tool-office/README.md). The provider [resolves the Kit's engine itself](../../../packages/document/office-kit/README.md#understand-the-implementation), including the mapping of native engine manifests to unpacked physical directories. Desktop packaging only carries and unpacks the engine: it carries the target’s declared native engine, or WASM when the kit declares no matching native target, and preparation rejects a missing target engine before packaging. The complete Office dependencies, including the JavaScript libraries and the selected engine’s executables, data, licenses, and notices, are unpacked under `resources/app.asar.unpacked/dsh/node_modules/`. The Desktop shell passes the primary runtime location to the Host in [main.ts](../src/main.ts), and the Host sets it as `DSH_PRIMARY_RUNTIME`; neither passes a Kit location. Office skills are available in every application that loads web-app, and Desktop reads them from the skill package inside `resources/app.asar`; only Desktop mounts the bundled Python environment (`workspace-dependencies`). On macOS, the native helper receives the JIT entitlement required by [LibreOffice’s UNO bridge](https://github.com/LibreOffice/core/blob/master/sysui/desktop/macosx/hardened_runtime.xcent.in). The Computer Use helper applications under `@deepseek-ai/dsh-cua-macos/native/bin` are also unpacked whole under `resources/app.asar.unpacked/dsh/node_modules/`, and the provider opens that copy. +The [Office conversion provider](../../../packages/document/office-kit/README.md) is a Host service mounted by web-app, so every application that loads web-app, including `dsh web` and Desktop, provides it together with the [Office tools](../../../packages/document/tool-document/README.md). The provider [resolves the Kit's engine itself](../../../packages/document/office-kit/README.md#understand-the-implementation), including the mapping of native engine manifests to unpacked physical directories. Desktop packaging only carries and unpacks the engine: it carries the target’s declared native engine, or WASM when the kit declares no matching native target, and preparation rejects a missing target engine before packaging. The complete Office dependencies, including the JavaScript libraries and the selected engine’s executables, data, licenses, and notices, are unpacked under `resources/app.asar.unpacked/dsh/node_modules/`. The Desktop shell passes the primary runtime location to the Host in [main.ts](../src/main.ts), and the Host sets it as `DSH_PRIMARY_RUNTIME`; neither passes a Kit location. Office skills are available in every application that loads web-app, and Desktop reads them from the skill package inside `resources/app.asar`; only Desktop mounts the bundled Python environment (`workspace-dependencies`). On macOS, the native helper receives the JIT entitlement required by [LibreOffice’s UNO bridge](https://github.com/LibreOffice/core/blob/master/sysui/desktop/macosx/hardened_runtime.xcent.in). The Computer Use helper applications under `@deepseek-ai/dsh-cua-macos/native/bin` are also unpacked whole under `resources/app.asar.unpacked/dsh/node_modules/`, and the provider opens that copy. The packaged application runs compiled JavaScript and pre-generated Typert metadata; it does not compile TypeScript plugins. Source-level debugger navigation and editor declarations remain available in development packages. [Copy-policy tests](../tests/runtime-file-policy.spec.ts) cover exclusions and retained assets; The [payload smoke](../tests/fixtures/runtime-payload-smoke.mjs) runs under Electron RunAsNode before the Host smoke and final inventory verification. The payload smoke resolves the search tool’s ripgrep executable and verifies text search and file enumeration. Signed Windows builds run these checks after dependency signing; other builds run them during `prepare:dsh`. The [Host smoke](../scripts/smoke-runtime.ts) creates DOCX, XLSX, and PPTX inputs with bundled Python and runs each through the real Office provider: PDF conversion, PNG rendering, conversion to the matching OpenDocument format, and, for XLSX, recalculation, checking each output's signature. Every assembled application, including directory and unsigned builds, repeats the payload and Host checks against ASAR. Archive integrity checks compare the complete archived descriptor with preparation, file bytes and membership in both archive and unpacked trees, recorded executable flags for archived files, and physical permissions for unpacked files. Conversion failures stop packaging before a release record is written; macOS DMG/ZIP builds run these checks before notarization. diff --git a/apps/desktop/packaging/README.zh.md b/apps/desktop/packaging/README.zh.md index bdffd46c99..aa57f0c9a8 100644 --- a/apps/desktop/packaging/README.zh.md +++ b/apps/desktop/packaging/README.zh.md @@ -252,7 +252,7 @@ Desktop 在本地打包工作区包,并通过目标捆绑的 Node 和 pnpm 安 [Electron 外壳文件清单](../scripts/electron-builder-config.mjs)从单独收集的 `resources/app.asar/node_modules` 依赖中排除已识别的 JavaScript/CSS/TypeScript source map 和 TypeScript 构建缓存。这些排除规则保留运行时代码、原生模块、WASM、数据文件(包括普通 `.map` 资源)、许可证和 notices;[外壳归档测试](../tests/shell-file-selection.spec.ts)检查保留文件的字节和排除项。 -[Office 转换提供方](../../../packages/document/office-kit/README.zh.md)是 web-app 挂载的 Host 服务,因此所有加载 web-app 的应用(包括 `dsh web` 和 Desktop)都提供它以及 [Office 工具](../../../packages/document/tool-office/README.zh.md)。该提供方[自行解析 Kit 的引擎](../../../packages/document/office-kit/README.zh.md#understand-the-implementation),包括把原生引擎清单映射到解包后的实体目录。Desktop 打包只负责携带和解包引擎:携带目标声明的原生引擎;kit 未声明匹配的原生目标时携带 WASM;目标引擎缺失时,准备阶段在打包前拒绝。完整的 Office 依赖(包括 JavaScript 库以及所选引擎的可执行文件、数据、许可证和声明)解包到 `resources/app.asar.unpacked/dsh/node_modules/` 下。Desktop 壳在 [main.ts](../src/main.ts) 中把主运行时位置传给 Host,由 Host 设为 `DSH_PRIMARY_RUNTIME`;两者都不传 Kit 位置。所有加载 web-app 的应用都提供 Office 技能,Desktop 从 `resources/app.asar` 内的技能包读取它们;只有 Desktop 挂载内置 Python 环境(`workspace-dependencies`)。在 macOS 上,原生 helper 获得 [LibreOffice UNO 桥](https://github.com/LibreOffice/core/blob/master/sysui/desktop/macosx/hardened_runtime.xcent.in)所需的 JIT 权限。`@deepseek-ai/dsh-cua-macos/native/bin` 下的 Computer Use helper 应用也整体解包到 `resources/app.asar.unpacked/dsh/node_modules/` 下,提供方打开该副本。 +[Office 转换提供方](../../../packages/document/office-kit/README.zh.md)是 web-app 挂载的 Host 服务,因此所有加载 web-app 的应用(包括 `dsh web` 和 Desktop)都提供它以及 [Office 工具](../../../packages/document/tool-document/README.zh.md)。该提供方[自行解析 Kit 的引擎](../../../packages/document/office-kit/README.zh.md#understand-the-implementation),包括把原生引擎清单映射到解包后的实体目录。Desktop 打包只负责携带和解包引擎:携带目标声明的原生引擎;kit 未声明匹配的原生目标时携带 WASM;目标引擎缺失时,准备阶段在打包前拒绝。完整的 Office 依赖(包括 JavaScript 库以及所选引擎的可执行文件、数据、许可证和声明)解包到 `resources/app.asar.unpacked/dsh/node_modules/` 下。Desktop 壳在 [main.ts](../src/main.ts) 中把主运行时位置传给 Host,由 Host 设为 `DSH_PRIMARY_RUNTIME`;两者都不传 Kit 位置。所有加载 web-app 的应用都提供 Office 技能,Desktop 从 `resources/app.asar` 内的技能包读取它们;只有 Desktop 挂载内置 Python 环境(`workspace-dependencies`)。在 macOS 上,原生 helper 获得 [LibreOffice UNO 桥](https://github.com/LibreOffice/core/blob/master/sysui/desktop/macosx/hardened_runtime.xcent.in)所需的 JIT 权限。`@deepseek-ai/dsh-cua-macos/native/bin` 下的 Computer Use helper 应用也整体解包到 `resources/app.asar.unpacked/dsh/node_modules/` 下,提供方打开该副本。 打包应用运行编译后的 JavaScript 和预生成的 Typert 元数据,不编译 TypeScript 插件。源码级调试导航和编辑器声明仍可从开发包中获取。[复制规则测试](../tests/runtime-file-policy.spec.ts)覆盖排除项和保留资源;[产物 smoke](../tests/fixtures/runtime-payload-smoke.mjs) 在 Host smoke 和最终清单验证之前,使用 Electron RunAsNode 执行。产物 smoke 解析搜索工具使用的 ripgrep 可执行文件,并验证文本搜索和文件枚举。Windows 签名构建在依赖签名后运行这些检查;其他构建在 `prepare:dsh` 中运行。[Host smoke](../scripts/smoke-runtime.ts) 使用捆绑的 Python 创建 DOCX、XLSX 和 PPTX 输入,并通过真实 Office 提供方逐一执行:PDF 转换、PNG 渲染、转换为对应的 OpenDocument 格式,以及针对 XLSX 的重算,检查每个输出的签名。每个组装后的应用(包括目录包和未签名构建)都会针对 ASAR 重复产物和 Host 检查。归档完整性检查将归档内完整描述符与准备结果比对,并核对归档和解包目录中的文件内容与清单、归档内文件记录的执行标志,以及解包文件的物理权限。转换失败会在写入发布记录前终止打包;macOS DMG/ZIP 构建在公证前执行这些检查。 diff --git a/apps/desktop/tests/office-resources.e2e.ts b/apps/desktop/tests/office-resources.e2e.ts index acc45fbee1..0d6de5a7db 100644 --- a/apps/desktop/tests/office-resources.e2e.ts +++ b/apps/desktop/tests/office-resources.e2e.ts @@ -35,7 +35,7 @@ export function apply(ctx) { const office = await ctx.skills.get('office') const content = { office: office?.content ?? null } const resources = office?.resourceBase?.kind === 'directory' ? await readdir(office.resourceBase.path) : null - response.end(JSON.stringify({ names, content, resources, loaded, officeKit: ctx.get('officeKit') !== undefined, tools: ctx.tools.schemas().map(tool => tool.name).filter(name => name.startsWith('office_')) })) + response.end(JSON.stringify({ names, content, resources, loaded, officeKit: ctx.get('officeKit') !== undefined, tools: ctx.tools.schemas().map(tool => tool.name).filter(name => name.startsWith('document_')) })) } catch (error) { response.statusCode = 500 response.end(String(error?.stack ?? error)) @@ -94,7 +94,7 @@ describe.skipIf(!existsSync(builtHost))('built Desktop Host Office resources', ( // The advertised resource directory holds only the skill file. expect(skills.resources).toEqual(['SKILL.md']) expect(skills.content.office).toContain('# Office tasks') - expect(skills.content.office).toContain('`office_render`') + expect(skills.content.office).toContain('`document_render`') expect(failures).toEqual([]) } finally { await host?.stop() diff --git a/apps/web/tests/shipped-composition.e2e.ts b/apps/web/tests/shipped-composition.e2e.ts index 23d350bef3..e428e909d0 100644 --- a/apps/web/tests/shipped-composition.e2e.ts +++ b/apps/web/tests/shipped-composition.e2e.ts @@ -482,9 +482,9 @@ const EXPECTED_TOOLS = [ 'job_output', 'list_agents', 'list_subagent_models', - 'office_convert', - 'office_recalculate', - 'office_render', + 'document_convert', + 'document_recalculate', + 'document_render', 'plugin_manager', 'present', 'read', diff --git a/docs/capability-seams.i18n.yaml b/docs/capability-seams.i18n.yaml index f42871e232..2a57016d2a 100644 --- a/docs/capability-seams.i18n.yaml +++ b/docs/capability-seams.i18n.yaml @@ -6,5 +6,5 @@ en: 41d772192075e133 zh: 5ef3da69b4de1d8a /capability-seams-and-core-services: - en: dcaf72b03e9838d2 - zh: 75c5389916deacac + en: f643f9b59aa6ba46 + zh: 8a6cc4c6306983a9 diff --git a/docs/capability-seams.md b/docs/capability-seams.md index c1a4f5acc6..3f99e6bec1 100644 --- a/docs/capability-seams.md +++ b/docs/capability-seams.md @@ -94,7 +94,7 @@ flowchart LR pkg_office_kit["office-kit"] svc_officeKit["ctx.officeKit
Office rendering, conversion, and recalculation"] pkg_client_ui_sidebar_documentpreview["client-ui-sidebar-documentpreview"] - pkg_tool_office["tool-office"] + pkg_tool_document["tool-document"] pkg_attachment["attachment"] svc_attachments["ctx.attachments
Durable binary attachment storage"] pkg_attachment_local["attachment-local"] @@ -590,7 +590,7 @@ flowchart LR svc_mcpClientHost --> pkg_mcp_manager svc_mcpResources --> pkg_mcp_resources svc_officeKit --> pkg_client_ui_sidebar_documentpreview - svc_officeKit --> pkg_tool_office + svc_officeKit --> pkg_tool_document svc_otel --> pkg_host_product_telemetry_otel svc_otel --> pkg_session_telemetry_otel svc_pluginManager --> pkg_plugin_manager @@ -738,7 +738,7 @@ flowchart LR | `ctx.computerUse` | `seam` | [`computer-use`](../packages/computer-use/computer-use) | [`experimental-computer-use-cua-driver-mcp`](../packages/experimental/computer-use-cua-driver-mcp), [`experimental-computer-use-cua-driver-native`](../packages/experimental/computer-use-cua-driver-native) | [`experimental-computer-use-cua-driver-mcp`](../packages/experimental/computer-use-cua-driver-mcp), [`experimental-computer-use-cua-driver-native`](../packages/experimental/computer-use-cua-driver-native) | - | One provider-owned name per service instance. Each provider also owns its model tools; the service has no common action API, runtime selection, or Session workflow lock. | | `ctx.cuaAccess` | `core` | [`cua`](../packages/experimental/cua) | - | [`cua`](../packages/experimental/cua) | - | The native provider owns application consent and cancellation; the optional Client page queries and changes those decisions through its Remote. | | `ctx.cuaPrograms` | `core` | [`cua`](../packages/experimental/cua) | - | [`cua-mcp`](../packages/experimental/cua-mcp) | - | The provider owns the retained cua_run_code runtime; a host without a model releases one Agent's environment and reads the configured screenshot request target through it. | -| `ctx.officeKit` | `core` | [`office-kit`](../packages/document/office-kit) | - | [`client-ui-sidebar-documentpreview`](../packages/client/ui-sidebar-documentpreview), [`tool-office`](../packages/document/tool-office) | - | Authorized Office bytes are rendered as PDFs or images, converted, or recalculated on the Host using the declared native target engine, or Node WASM when no native target is declared. | +| `ctx.officeKit` | `core` | [`office-kit`](../packages/document/office-kit) | - | [`client-ui-sidebar-documentpreview`](../packages/client/ui-sidebar-documentpreview), [`tool-document`](../packages/document/tool-document) | - | Authorized Office bytes are rendered as PDFs or images, converted, or recalculated on the Host using the declared native target engine, or Node WASM when no native target is declared. | | `ctx.attachments` | `seam` | [`attachment`](../packages/attachment/attachment) | [`attachment-local`](../packages/attachment/attachment-local) | [`api-session-controller`](../packages/api/session-controller), [`tool-fs`](../packages/fs/tool-fs), [`llm-pi-ai`](../packages/llm/llm-pi-ai), [`llm-deepseek`](../packages/llm/llm-deepseek) | - | The host commits accepted images before session events; provider adapters resolve authorized durable references into provider-native content. | | `ctx.fileUploads` | `core` | [`client-file-upload`](../packages/client/file-upload) | - | [`api-session-controller`](../packages/api/session-controller) | - | Owns streaming intake, durable storage, and staged receipt lifetime; the Session controller binds receipts to accepted submissions. | | `ctx.llm` | `seam` | [`llm`](../packages/llm/llm) | [`llm-deepseek`](../packages/llm/llm-deepseek), [`llm-pi-ai`](../packages/llm/llm-pi-ai), [`llm-replay`](../packages/test-support/llm-replay) | [`agent-loop`](../packages/core/agent-loop), [`compaction-basic`](../packages/compaction/compaction-basic) | - | Adapters register provider implementations; the loop and compaction call the provider-neutral stream service. | diff --git a/docs/capability-seams.zh.md b/docs/capability-seams.zh.md index 548f8e21dc..5f7cbc9cfc 100644 --- a/docs/capability-seams.zh.md +++ b/docs/capability-seams.zh.md @@ -96,7 +96,7 @@ flowchart LR pkg_office_kit["office-kit"] svc_officeKit["ctx.officeKit
Office rendering, conversion, and recalculation"] pkg_client_ui_sidebar_documentpreview["client-ui-sidebar-documentpreview"] - pkg_tool_office["tool-office"] + pkg_tool_document["tool-document"] pkg_attachment["attachment"] svc_attachments["ctx.attachments
Durable binary attachment storage"] pkg_attachment_local["attachment-local"] @@ -592,7 +592,7 @@ flowchart LR svc_mcpClientHost --> pkg_mcp_manager svc_mcpResources --> pkg_mcp_resources svc_officeKit --> pkg_client_ui_sidebar_documentpreview - svc_officeKit --> pkg_tool_office + svc_officeKit --> pkg_tool_document svc_otel --> pkg_host_product_telemetry_otel svc_otel --> pkg_session_telemetry_otel svc_pluginManager --> pkg_plugin_manager @@ -740,7 +740,7 @@ flowchart LR | `ctx.computerUse` | `seam` | [`computer-use`](../packages/computer-use/computer-use) | [`experimental-computer-use-cua-driver-mcp`](../packages/experimental/computer-use-cua-driver-mcp), [`experimental-computer-use-cua-driver-native`](../packages/experimental/computer-use-cua-driver-native) | [`experimental-computer-use-cua-driver-mcp`](../packages/experimental/computer-use-cua-driver-mcp), [`experimental-computer-use-cua-driver-native`](../packages/experimental/computer-use-cua-driver-native) | - | 每个服务实例只注册一个提供方自定的名称。各提供方也拥有自己的模型工具;服务不提供通用操作 API、运行时选择或 Session 流程锁。 | | `ctx.cuaAccess` | `core` | [`cua`](../packages/experimental/cua) | - | [`cua`](../packages/experimental/cua) | - | 原生 provider 负责应用授权和取消操作;可选的 Client 权限页面通过 Remote 查询和修改授权。 | | `ctx.cuaPrograms` | `core` | [`cua`](../packages/experimental/cua) | - | [`cua-mcp`](../packages/experimental/cua-mcp) | - | 提供方持有保留的 cua_run_code 运行时;没有模型的宿主通过它释放单个 Agent 的环境,并读取已配置的截图请求目标。 | -| `ctx.officeKit` | `core` | [`office-kit`](../packages/document/office-kit) | - | [`client-ui-sidebar-documentpreview`](../packages/client/ui-sidebar-documentpreview), [`tool-office`](../packages/document/tool-office) | - | 已授权的 Office 字节在宿主上使用已声明的原生目标引擎渲染为 PDF 或图片、转换或重算;未声明原生目标时使用 Node WASM。 | +| `ctx.officeKit` | `core` | [`office-kit`](../packages/document/office-kit) | - | [`client-ui-sidebar-documentpreview`](../packages/client/ui-sidebar-documentpreview), [`tool-document`](../packages/document/tool-document) | - | 已授权的 Office 字节在宿主上使用已声明的原生目标引擎渲染为 PDF 或图片、转换或重算;未声明原生目标时使用 Node WASM。 | | `ctx.attachments` | `seam` | [`attachment`](../packages/attachment/attachment) | [`attachment-local`](../packages/attachment/attachment-local) | [`api-session-controller`](../packages/api/session-controller), [`tool-fs`](../packages/fs/tool-fs), [`llm-pi-ai`](../packages/llm/llm-pi-ai), [`llm-deepseek`](../packages/llm/llm-deepseek) | - | 宿主会在会话事件之前提交已接受的图片;提供方适配器将已授权的持久引用解析为提供方原生内容。 | | `ctx.fileUploads` | `core` | [`client-file-upload`](../packages/client/file-upload) | - | [`api-session-controller`](../packages/api/session-controller) | - | 负责流式接收、持久存储和暂存回执生命周期;Session Controller 将回执绑定到已接受的提交。 | | `ctx.llm` | `seam` | [`llm`](../packages/llm/llm) | [`llm-deepseek`](../packages/llm/llm-deepseek), [`llm-pi-ai`](../packages/llm/llm-pi-ai), [`llm-replay`](../packages/test-support/llm-replay) | [`agent-loop`](../packages/core/agent-loop), [`compaction-basic`](../packages/compaction/compaction-basic) | - | 适配器注册提供方实现;agent loop(智能体循环)与压缩功能调用提供方无关的流服务。 | diff --git a/docs/config-catalog.md b/docs/config-catalog.md index 8b0b82d555..79bcb6168c 100644 --- a/docs/config-catalog.md +++ b/docs/config-catalog.md @@ -3195,9 +3195,9 @@ export interface Config { */ renderers: { /** Order for every input except PDF; excludes `poppler`, which renders only PDF. */ - office: OfficeRenderer[] + office: DocumentRenderer[] /** Order for PDF input. */ - pdf: OfficeRenderer[] + pdf: DocumentRenderer[] } /** Poppler executables used by the `poppler` renderer. */ poppler: { @@ -3212,7 +3212,7 @@ export interface Config { * Image rendering backend: `libreoffice` renders every image input in the provider's LibreOffice Kit converter; * `poppler` renders PDF only, through short-lived `pdfinfo` and `pdftoppm` subprocesses. */ -export type OfficeRenderer = 'libreoffice' | 'poppler' +export type DocumentRenderer = 'libreoffice' | 'poppler' ``` @@ -4963,6 +4963,31 @@ export interface Config { ``` + + + +## `@deepseek-ai/dsh-tool-document` + +- `inject`: `tools` · `fs` · `workingDirectory` · `agents` +- `source`: [`packages/document/tool-document/src/index.ts:43`](../packages/document/tool-document/src/index.ts) + +```ts config-catalog +/** Activation skills and render bounds; lower deployment attachment limits take precedence. */ +export interface Config { + /** Skill names whose successful loading admits all three tools from the following step. */ + activationSkills: string[] + /** Maximum images one render returns, including worksheet fragments. */ + maxImages: number + /** Maximum pixels of each image. */ + maxImagePixels: number + /** Maximum width and height of each image in pixels. */ + maxImageDimension: number + /** Maximum PNG bytes across all images of one render. */ + maxImageBytes: number +} +``` + + @@ -5133,31 +5158,6 @@ export interface Config { ``` - - - -## `@deepseek-ai/dsh-tool-office` - -- `inject`: `tools` · `fs` · `workingDirectory` · `agents` -- `source`: [`packages/document/tool-office/src/index.ts:43`](../packages/document/tool-office/src/index.ts) - -```ts config-catalog -/** Activation skills and render bounds; lower deployment attachment limits take precedence. */ -export interface Config { - /** Skill names whose successful loading admits all three tools from the following step. */ - activationSkills: string[] - /** Maximum images one render returns, including worksheet fragments. */ - maxImages: number - /** Maximum pixels of each image. */ - maxImagePixels: number - /** Maximum width and height of each image in pixels. */ - maxImageDimension: number - /** Maximum PNG bytes across all images of one render. */ - maxImageBytes: number -} -``` - - diff --git a/docs/config-catalog.zh.md b/docs/config-catalog.zh.md index ba9dfbeb86..140a61ee9d 100644 --- a/docs/config-catalog.zh.md +++ b/docs/config-catalog.zh.md @@ -3197,9 +3197,9 @@ export interface Config { */ renderers: { /** Order for every input except PDF; excludes `poppler`, which renders only PDF. */ - office: OfficeRenderer[] + office: DocumentRenderer[] /** Order for PDF input. */ - pdf: OfficeRenderer[] + pdf: DocumentRenderer[] } /** Poppler executables used by the `poppler` renderer. */ poppler: { @@ -3214,7 +3214,7 @@ export interface Config { * Image rendering backend: `libreoffice` renders every image input in the provider's LibreOffice Kit converter; * `poppler` renders PDF only, through short-lived `pdfinfo` and `pdftoppm` subprocesses. */ -export type OfficeRenderer = 'libreoffice' | 'poppler' +export type DocumentRenderer = 'libreoffice' | 'poppler' ``` @@ -4965,6 +4965,31 @@ export interface Config { ``` + + + +## `@deepseek-ai/dsh-tool-document` + +- `inject`: `tools` · `fs` · `workingDirectory` · `agents` +- `source`: [`packages/document/tool-document/src/index.ts:43`](../packages/document/tool-document/src/index.ts) + +```ts config-catalog +/** Activation skills and render bounds; lower deployment attachment limits take precedence. */ +export interface Config { + /** Skill names whose successful loading admits all three tools from the following step. */ + activationSkills: string[] + /** Maximum images one render returns, including worksheet fragments. */ + maxImages: number + /** Maximum pixels of each image. */ + maxImagePixels: number + /** Maximum width and height of each image in pixels. */ + maxImageDimension: number + /** Maximum PNG bytes across all images of one render. */ + maxImageBytes: number +} +``` + + @@ -5135,31 +5160,6 @@ export interface Config { ``` - - - -## `@deepseek-ai/dsh-tool-office` - -- `inject`: `tools` · `fs` · `workingDirectory` · `agents` -- `source`: [`packages/document/tool-office/src/index.ts:43`](../packages/document/tool-office/src/index.ts) - -```ts config-catalog -/** Activation skills and render bounds; lower deployment attachment limits take precedence. */ -export interface Config { - /** Skill names whose successful loading admits all three tools from the following step. */ - activationSkills: string[] - /** Maximum images one render returns, including worksheet fragments. */ - maxImages: number - /** Maximum pixels of each image. */ - maxImagePixels: number - /** Maximum width and height of each image in pixels. */ - maxImageDimension: number - /** Maximum PNG bytes across all images of one render. */ - maxImageBytes: number -} -``` - - diff --git a/docs/event-producer-consumer.md b/docs/event-producer-consumer.md index c31a6124ae..f7bc3c80b0 100644 --- a/docs/event-producer-consumer.md +++ b/docs/event-producer-consumer.md @@ -12,16 +12,16 @@ Application listeners are outside this package matrix. Desktop Host subscribes t | --- | --- | --- | --- | --- | | `agent-loop/config-start-failed` | `emit` | [`packages/core/agent-loop/src/index.ts:198`](../packages/core/agent-loop/src/index.ts) | [`agent-loop`](../packages/core/agent-loop) (`events.dispatch`) | - | | `agent-preset/selected` | `emit` | [`packages/preset/agent-preset-registry/src/types.ts:92`](../packages/preset/agent-preset-registry/src/types.ts) | [`agent-preset-registry`](../packages/preset/agent-preset-registry) (`emit`) | [`cua`](../packages/experimental/cua), `remotes` | -| `agent/assistant-stream` | `emit` | [`packages/core/agent/src/runtime-types.ts:400`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`headless`](../packages/bundle/headless), [`im`](../packages/experimental/im), `session-controller` | +| `agent/assistant-stream` | `emit` | [`packages/core/agent/src/runtime-types.ts:400`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`headless`](../packages/bundle/headless), `session-controller` | | `agent/created` | `serial` | [`packages/core/agent/src/runtime-types.ts:291`](../packages/core/agent/src/runtime-types.ts) | [`agent`](../packages/core/agent) (`serial`) | [`agent-team`](../packages/team/agent-team), `browser-use-runtime`, `claude-code-mods`, [`creation-recommendations`](../packages/extensions/creation-recommendations), [`cua`](../packages/experimental/cua), [`file-reference-local`](../packages/context/file-reference-local), [`goal`](../packages/goal/goal), [`goal-round-driver`](../packages/goal/goal-round-driver), [`hooks-claude-code`](../packages/experimental/hooks-claude-code), [`hooks-codex`](../packages/experimental/hooks-codex), `liveshare`, [`loader-smoke`](../packages/test-support/loader-smoke), [`permission-presets`](../packages/interaction/permission-presets), [`sandbox-policy-git`](../packages/experimental/sandbox-policy-git), `session-controller`, [`timeline`](../packages/experimental/timeline) | -| `agent/disposed` | `emit` | [`packages/core/agent/src/runtime-types.ts:300`](../packages/core/agent/src/runtime-types.ts) | [`agent`](../packages/core/agent) (`events.dispatch`) | [`agent-loop`](../packages/core/agent-loop), `claude-code-mods`, [`creation-recommendations`](../packages/extensions/creation-recommendations), [`file-reference-local`](../packages/context/file-reference-local), [`goal-round-driver`](../packages/goal/goal-round-driver), [`im`](../packages/experimental/im), [`mcp-client`](../packages/mcp/mcp-client), [`sandbox-policy-git`](../packages/experimental/sandbox-policy-git), `server`, `session-controller`, [`subagent`](../packages/subagent/subagent), [`timeline`](../packages/experimental/timeline), [`tool-office`](../packages/document/tool-office), [`tool-subagent-control`](../packages/subagent/tool-subagent-control) | -| `agent/error` | `emit` | [`packages/core/agent/src/runtime-types.ts:430`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`), [`cua`](../packages/experimental/cua) (`emitAgentEvent`) | [`acp`](../packages/acp/acp), [`goal-round-driver`](../packages/goal/goal-round-driver), [`headless`](../packages/bundle/headless), [`im`](../packages/experimental/im), [`llm-deepseek-account`](../packages/llm/llm-deepseek-account), `server`, `session-controller`, [`session-telemetry`](../packages/session/session-telemetry), [`subagent`](../packages/subagent/subagent) | +| `agent/disposed` | `emit` | [`packages/core/agent/src/runtime-types.ts:300`](../packages/core/agent/src/runtime-types.ts) | [`agent`](../packages/core/agent) (`events.dispatch`) | [`agent-loop`](../packages/core/agent-loop), `claude-code-mods`, [`creation-recommendations`](../packages/extensions/creation-recommendations), [`file-reference-local`](../packages/context/file-reference-local), [`goal-round-driver`](../packages/goal/goal-round-driver), [`mcp-client`](../packages/mcp/mcp-client), [`sandbox-policy-git`](../packages/experimental/sandbox-policy-git), `server`, `session-controller`, [`subagent`](../packages/subagent/subagent), [`timeline`](../packages/experimental/timeline), [`tool-document`](../packages/document/tool-document), [`tool-subagent-control`](../packages/subagent/tool-subagent-control) | +| `agent/error` | `emit` | [`packages/core/agent/src/runtime-types.ts:430`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`), [`cua`](../packages/experimental/cua) (`emitAgentEvent`) | [`acp`](../packages/acp/acp), [`goal-round-driver`](../packages/goal/goal-round-driver), [`headless`](../packages/bundle/headless), [`llm-deepseek-account`](../packages/llm/llm-deepseek-account), `server`, `session-controller`, [`session-telemetry`](../packages/session/session-telemetry), [`subagent`](../packages/subagent/subagent) | | `agent/inbox/claimed` | `emit` | [`packages/core/agent/src/runtime-types.ts:329`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`acp`](../packages/acp/acp), [`goal-round-driver`](../packages/goal/goal-round-driver), [`subagent`](../packages/subagent/subagent), [`tool-jobs`](../packages/jobs/tool-jobs), [`user-questions`](../packages/interaction/user-questions) | | `agent/inbox/discarded` | `emit` | [`packages/core/agent/src/runtime-types.ts:337`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`goal-round-driver`](../packages/goal/goal-round-driver), [`subagent`](../packages/subagent/subagent), [`user-questions`](../packages/interaction/user-questions) | | `agent/inbox/inserted` | `emit` | [`packages/core/agent/src/runtime-types.ts:318`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | `client-ui-forge`, [`cua`](../packages/experimental/cua), [`goal-round-driver`](../packages/goal/goal-round-driver), [`subagent`](../packages/subagent/subagent), [`tool-jobs`](../packages/jobs/tool-jobs), [`tool-subagent-control`](../packages/subagent/tool-subagent-control) | | `agent/pre-step` | `waterfall` | [`packages/core/agent/src/runtime-types.ts:351`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`waterfall`) | [`action-cards`](../packages/interaction/action-cards), [`agent`](../packages/core/agent), [`agent-instructions`](../packages/context/agent-instructions), `claude-code-mods`, `client-ui-forge`, [`compaction-basic`](../packages/compaction/compaction-basic), [`cua`](../packages/experimental/cua), [`cua-macos`](../packages/experimental/cua-macos), [`goal-round-driver`](../packages/goal/goal-round-driver), [`hooks-claude-code`](../packages/experimental/hooks-claude-code), [`hooks-codex`](../packages/experimental/hooks-codex), `liveshare`, [`plan-mode`](../packages/plan/plan-mode), [`repeat-tool-reminder`](../packages/guard/repeat-tool-reminder), [`session-checkpoint-policy`](../packages/session/session-checkpoint-policy), `session-controller`, [`session-reference`](../packages/context/session-reference), [`subagent`](../packages/subagent/subagent), [`time-context`](../packages/context/time-context), [`tmux-context`](../packages/context/tmux-context), [`tool-skill`](../packages/skill/tool-skill) | | `agent/request-error` | `waterfall` | [`packages/core/agent/src/runtime-types.ts:390`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`waterfall`) | [`compaction-basic`](../packages/compaction/compaction-basic), [`compaction-image-offload`](../packages/compaction/compaction-image-offload), [`llm-retry`](../packages/llm/llm-retry) | -| `agent/status` | `emit` | [`packages/core/agent/src/runtime-types.ts:310`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`acp`](../packages/acp/acp), [`compaction-basic`](../packages/compaction/compaction-basic), [`goal-round-driver`](../packages/goal/goal-round-driver), [`im`](../packages/experimental/im), `server`, `session-controller`, [`timeline`](../packages/experimental/timeline) | +| `agent/status` | `emit` | [`packages/core/agent/src/runtime-types.ts:310`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`acp`](../packages/acp/acp), [`compaction-basic`](../packages/compaction/compaction-basic), [`goal-round-driver`](../packages/goal/goal-round-driver), `server`, `session-controller`, [`timeline`](../packages/experimental/timeline) | | `agent/turn-stopping` | `serial` | [`packages/core/agent/src/runtime-types.ts:418`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`serial`) | [`hooks-claude-code`](../packages/experimental/hooks-claude-code), [`hooks-codex`](../packages/experimental/hooks-codex), [`workspace-changes`](../packages/deliverables/workspace-changes) | | `api-session/activity` | `emit` | [`packages/api/session-controller/src/types.ts:697`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` | | `api-session/added` | `emit` | [`packages/api/session-controller/src/types.ts:677`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` | @@ -49,24 +49,14 @@ Application listeners are outside this package matrix. Desktop Host subscribes t | `feedback/committed` | `parallel` | [`packages/feedback/message-feedback/src/index.ts:58`](../packages/feedback/message-feedback/src/index.ts) | [`message-feedback`](../packages/feedback/message-feedback) (`parallel`) | [`session-telemetry-otel`](../packages/session/session-telemetry-otel) | | `forge/providers-changed` | `parallel` | [`packages/experimental/forge/src/index.ts:35`](../packages/experimental/forge/src/index.ts) | `forge` (`parallel`) | `client-ui-forge`, `forge-session` | | `forge/review-changed` | `parallel` | [`packages/experimental/forge/src/index.ts:44`](../packages/experimental/forge/src/index.ts) | `forge` (`parallel`) | `client-ui-forge` | -| `fs/delete-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:86`](../packages/fs/fs/src/index.ts) | [`tool-fs`](../packages/fs/tool-fs) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) | -| `fs/edit-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:78`](../packages/fs/fs/src/index.ts) | `liveshare` (`waterfall`), [`tool-fs`](../packages/fs/tool-fs) (`waterfall`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) | -| `fs/observed` | `emit` | [`packages/fs/fs/src/index.ts:96`](../packages/fs/fs/src/index.ts) | `liveshare` (`emit`), [`tool-fs`](../packages/fs/tool-fs) (`emit`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`emit`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`skill-filesystem`](../packages/skill/skill-filesystem), `workspace-files` | -| `fs/write-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:70`](../packages/fs/fs/src/index.ts) | `liveshare` (`waterfall`), [`tool-fs`](../packages/fs/tool-fs) (`waterfall`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) | +| `fs/delete-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:83`](../packages/fs/fs/src/index.ts) | [`tool-fs`](../packages/fs/tool-fs) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) | +| `fs/edit-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:75`](../packages/fs/fs/src/index.ts) | `liveshare` (`waterfall`), [`tool-fs`](../packages/fs/tool-fs) (`waterfall`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) | +| `fs/observed` | `emit` | [`packages/fs/fs/src/index.ts:93`](../packages/fs/fs/src/index.ts) | `liveshare` (`emit`), [`tool-fs`](../packages/fs/tool-fs) (`emit`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`emit`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`skill-filesystem`](../packages/skill/skill-filesystem), `workspace-files` | +| `fs/write-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:67`](../packages/fs/fs/src/index.ts) | `liveshare` (`waterfall`), [`tool-fs`](../packages/fs/tool-fs) (`waterfall`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) | | `goal/activation-changed` | `emit` | [`packages/goal/goal/src/types.ts:147`](../packages/goal/goal/src/types.ts) | [`goal`](../packages/goal/goal) (`emit`) | `remotes`, `server` | | `goal/changed` | `emit` | [`packages/goal/goal/src/domain.ts:115`](../packages/goal/goal/src/domain.ts) | [`goal`](../packages/goal/goal) (`emit`) | [`goal-round-driver`](../packages/goal/goal-round-driver) | | `hmr/change` | `emit` | [`packages/boot/hmr/src/index.ts:35`](../packages/boot/hmr/src/index.ts) | [`hmr`](../packages/boot/hmr) (`emit`) | - | | `hmr/reload` | `emit` | [`packages/boot/hmr/src/index.ts:40`](../packages/boot/hmr/src/index.ts) | [`hmr`](../packages/boot/hmr) (`emit`) | - | -| `im/activity` | `emit` | [`packages/experimental/im/src/api.ts:271`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`emit`) | [`im`](../packages/experimental/im) | -| `im/before-send` | `waterfall` | [`packages/experimental/im/src/api.ts:240`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`waterfall`) | - | -| `im/button` | `emit` | [`packages/experimental/im/src/api.ts:246`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`emit`) | - | -| `im/check` | `emit` | [`packages/experimental/im/src/api.ts:258`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`emit`) | - | -| `im/message` | `waterfall` | [`packages/experimental/im/src/api.ts:226`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`waterfall`) | [`im-session-commands`](../packages/experimental/im-session-commands) | -| `im/reaction` | `emit` | [`packages/experimental/im/src/api.ts:264`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`emit`) | - | -| `im/select` | `emit` | [`packages/experimental/im/src/api.ts:252`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`emit`) | - | -| `im/session/created` | `emit` | [`packages/experimental/im/src/api.ts:277`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`emit`) | - | -| `im/session/reset` | `emit` | [`packages/experimental/im/src/api.ts:284`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`emit`) | - | -| `im/stored` | `emit` | [`packages/experimental/im/src/api.ts:232`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`emit`) | - | | `llm-pi-ai/request-headers` | `waterfall` | [`packages/llm/llm-pi-ai/src/index.ts:115`](../packages/llm/llm-pi-ai/src/index.ts) | [`llm-pi-ai`](../packages/llm/llm-pi-ai) (`waterfall`) | - | | `llm/adapters-updated` | `emit` | [`packages/llm/llm/src/types.ts:24`](../packages/llm/llm/src/types.ts) | [`llm`](../packages/llm/llm) (`events.dispatch`) | [`acp`](../packages/acp/acp), `remotes` | | `llm/models-updated` | `emit` | [`packages/llm/llm/src/types.ts:30`](../packages/llm/llm/src/types.ts) | [`llm-deepseek`](../packages/llm/llm-deepseek) (`emit`) | `remotes` | @@ -84,7 +74,7 @@ Application listeners are outside this package matrix. Desktop Host subscribes t | `session-telemetry/record` | `waterfall` | [`packages/session/session-telemetry/src/index.ts:44`](../packages/session/session-telemetry/src/index.ts) | [`session-telemetry`](../packages/session/session-telemetry) (`waterfall`) | - | | `session/created` | `emit` | [`packages/core/session/src/index.ts:62`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | `server`, `session-controller`, [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-telemetry`](../packages/session/session-telemetry) | | `session/disposed` | `emit` | [`packages/core/session/src/index.ts:71`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`agent-loop`](../packages/core/agent-loop), `client-ui-forge`, `file-upload`, `forge-session`, [`office-kit`](../packages/document/office-kit), `session-controller`, [`session-persistence-jsonl`](../packages/session/session-persistence-jsonl), [`session-persistence-sqlite`](../packages/session/session-persistence-sqlite), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-telemetry`](../packages/session/session-telemetry), [`session-telemetry-otel`](../packages/session/session-telemetry-otel), [`session-title`](../packages/session/session-title), `ui-trajectory`, [`workspace-changes`](../packages/deliverables/workspace-changes) | -| `session/event` | `emit` | [`packages/core/session/src/index.ts:85`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`acp`](../packages/acp/acp), [`agent-instructions`](../packages/context/agent-instructions), [`agent-loop`](../packages/core/agent-loop), [`agent-preset-registry`](../packages/preset/agent-preset-registry), `claude-code-mods`, `client-ui-forge`, [`compaction-basic`](../packages/compaction/compaction-basic), [`cua`](../packages/experimental/cua), [`cua-macos`](../packages/experimental/cua-macos), [`file-reference-local`](../packages/context/file-reference-local), `file-upload`, `forge-session`, [`goal`](../packages/goal/goal), [`goal-round-driver`](../packages/goal/goal-round-driver), [`headless`](../packages/bundle/headless), [`im`](../packages/experimental/im), [`loader-smoke`](../packages/test-support/loader-smoke), `product-analytics`, [`ptc-runtime-node`](../packages/ptc-runtime/ptc-runtime-node), [`sandbox-policy-git`](../packages/experimental/sandbox-policy-git), `server`, `session-controller`, [`session-persistence-jsonl`](../packages/session/session-persistence-jsonl), [`session-persistence-sqlite`](../packages/session/session-persistence-sqlite), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-telemetry`](../packages/session/session-telemetry), [`session-telemetry-otel`](../packages/session/session-telemetry-otel), [`session-title`](../packages/session/session-title), [`subagent`](../packages/subagent/subagent), [`timeline`](../packages/experimental/timeline), [`token-meter`](../packages/llm/token-meter), [`tool-executor-ptc`](../packages/core/tool-executor-ptc), [`tool-jobs`](../packages/jobs/tool-jobs), [`tool-office`](../packages/document/tool-office), `ui-session-status`, `ui-trajectory`, [`user-questions`](../packages/interaction/user-questions), [`workspace-changes`](../packages/deliverables/workspace-changes) | +| `session/event` | `emit` | [`packages/core/session/src/index.ts:85`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`acp`](../packages/acp/acp), [`agent-instructions`](../packages/context/agent-instructions), [`agent-loop`](../packages/core/agent-loop), [`agent-preset-registry`](../packages/preset/agent-preset-registry), `claude-code-mods`, `client-ui-forge`, [`compaction-basic`](../packages/compaction/compaction-basic), [`cua`](../packages/experimental/cua), [`cua-macos`](../packages/experimental/cua-macos), [`file-reference-local`](../packages/context/file-reference-local), `file-upload`, `forge-session`, [`goal`](../packages/goal/goal), [`goal-round-driver`](../packages/goal/goal-round-driver), [`headless`](../packages/bundle/headless), [`loader-smoke`](../packages/test-support/loader-smoke), `product-analytics`, [`ptc-runtime-node`](../packages/ptc-runtime/ptc-runtime-node), [`sandbox-policy-git`](../packages/experimental/sandbox-policy-git), `server`, `session-controller`, [`session-persistence-jsonl`](../packages/session/session-persistence-jsonl), [`session-persistence-sqlite`](../packages/session/session-persistence-sqlite), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-telemetry`](../packages/session/session-telemetry), [`session-telemetry-otel`](../packages/session/session-telemetry-otel), [`session-title`](../packages/session/session-title), [`subagent`](../packages/subagent/subagent), [`timeline`](../packages/experimental/timeline), [`token-meter`](../packages/llm/token-meter), [`tool-document`](../packages/document/tool-document), [`tool-executor-ptc`](../packages/core/tool-executor-ptc), [`tool-jobs`](../packages/jobs/tool-jobs), `ui-session-status`, `ui-trajectory`, [`user-questions`](../packages/interaction/user-questions), [`workspace-changes`](../packages/deliverables/workspace-changes) | | `session/flush` | `parallel` | [`packages/core/session/src/index.ts:93`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`session-persistence-jsonl`](../packages/session/session-persistence-jsonl), [`session-persistence-sqlite`](../packages/session/session-persistence-sqlite), [`session-telemetry`](../packages/session/session-telemetry) | | `settings/document-updated` | `emit` | [`packages/settings/settings/src/types.ts:75`](../packages/settings/settings/src/types.ts) | [`settings`](../packages/settings/settings) (`emit`) | `remotes` | | `skills/change` | `emit` | [`packages/skill/skill/src/index.ts:299`](../packages/skill/skill/src/index.ts) | [`skill`](../packages/skill/skill) (`events.dispatch`) | - | @@ -100,7 +90,7 @@ Application listeners are outside this package matrix. Desktop Host subscribes t | `tools/post-execute` | `waterfall` | [`packages/core/tools/src/events.ts:41`](../packages/core/tools/src/events.ts) | [`tools`](../packages/core/tools) (`waterfall`) | `claude-code-mods`, [`hooks-claude-code`](../packages/experimental/hooks-claude-code), [`hooks-codex`](../packages/experimental/hooks-codex), [`repeat-tool-reminder`](../packages/guard/repeat-tool-reminder), [`spill-policy`](../packages/spill/spill-policy), [`tool-fs-search`](../packages/fs/tool-fs-search) | | `tools/pre-execute` | `waterfall` | [`packages/core/tools/src/events.ts:18`](../packages/core/tools/src/events.ts) | [`tools`](../packages/core/tools) (`waterfall`) | `auto-review`, [`hooks-claude-code`](../packages/experimental/hooks-claude-code), [`hooks-codex`](../packages/experimental/hooks-codex), `liveshare`, [`tool-jobs`](../packages/jobs/tool-jobs), [`workspace-changes`](../packages/deliverables/workspace-changes) | | `tools/ptc-dispatch-log` | `waterfall` | [`packages/core/tool-executor-ptc/src/runtime-types.ts:46`](../packages/core/tool-executor-ptc/src/runtime-types.ts) | [`tool-executor-ptc`](../packages/core/tool-executor-ptc) (`waterfall`) | [`spill-policy`](../packages/spill/spill-policy) | -| `tools/result` | `emit` | [`packages/core/tools/src/events.ts:49`](../packages/core/tools/src/events.ts) | [`tools`](../packages/core/tools) (`events.dispatch`) | [`agent-instructions`](../packages/context/agent-instructions), `claude-code-mods`, [`cua`](../packages/experimental/cua), `forge-session`, `liveshare`, [`subagent`](../packages/subagent/subagent), [`timeline`](../packages/experimental/timeline), [`tool-office`](../packages/document/tool-office), [`tool-present`](../packages/deliverables/tool-present), `ui-trajectory` | +| `tools/result` | `emit` | [`packages/core/tools/src/events.ts:49`](../packages/core/tools/src/events.ts) | [`tools`](../packages/core/tools) (`events.dispatch`) | [`agent-instructions`](../packages/context/agent-instructions), `claude-code-mods`, [`cua`](../packages/experimental/cua), `forge-session`, `liveshare`, [`subagent`](../packages/subagent/subagent), [`timeline`](../packages/experimental/timeline), [`tool-document`](../packages/document/tool-document), [`tool-present`](../packages/deliverables/tool-present), `ui-trajectory` | | `user-questions/request` | `waterfall` | [`packages/interaction/user-questions/src/types.ts:174`](../packages/interaction/user-questions/src/types.ts) | [`user-questions`](../packages/interaction/user-questions) (`waterfall`) | [`cua-mcp`](../packages/experimental/cua-mcp), `remotes`, `server` | | `web/providers-changed` | `emit` | [`packages/web/web/src/types.ts:21`](../packages/web/web/src/types.ts) | [`web`](../packages/web/web) (`events.dispatch`) | `remotes` | | `webserver/authorize` | `bail` | [`packages/host/webserver/src/index.ts:60`](../packages/host/webserver/src/index.ts) | `remote-connection` (`bail`), `webserver` (`bail`) | `connection` | @@ -129,9 +119,6 @@ Application listeners are outside this package matrix. Desktop Host subscribes t | --- | --- | --- | | `agent/request` | [`agent-loop`](../packages/core/agent-loop) (`waterfall`) | [`compaction-basic`](../packages/compaction/compaction-basic), [`timeline`](../packages/experimental/timeline) | | `connection/reset` | `gateway` (`emit`) | `terminal-controller`, `ui-settings` | -| `interaction/button` | - | [`im`](../packages/experimental/im) | -| `interaction/check` | - | [`im`](../packages/experimental/im) | -| `interaction/select` | - | [`im`](../packages/experimental/im) | | `internal/config` | - | [`llm-pi-ai`](../packages/llm/llm-pi-ai), [`mcp-manager`](../packages/mcp/mcp-manager), `modules` | | `internal/dispatch` | - | [`terminal-bash`](../packages/terminal/terminal-bash) | | `internal/plugin` | - | `computer-use-cua-driver-native`, `inspector`, `loader`, [`lsp-stdio`](../packages/lsp/lsp-stdio), [`mcp-client`](../packages/mcp/mcp-client), [`mcp-manager`](../packages/mcp/mcp-manager), `modules` | @@ -139,10 +126,6 @@ Application listeners are outside this package matrix. Desktop Host subscribes t | `internal/status` | - | [`agent`](../packages/core/agent), `claude-code-mods`, `inspector`, `modules`, `server`, `translator`, [`web`](../packages/web/web) | | `loader/volatile-update` | - | [`action-cards`](../packages/interaction/action-cards), `forge-github`, [`forge-gitlab`](../packages/experimental/forge-gitlab), [`llm-deepseek`](../packages/llm/llm-deepseek), [`llm-deepseek-api-key`](../packages/llm/llm-deepseek-api-key), [`llm-pi-ai`](../packages/llm/llm-pi-ai), [`mcp-manager`](../packages/mcp/mcp-manager), `modules`, [`plugin-market`](../packages/boot/plugin-market), `product-analytics`, `speech-to-text`, [`timeline`](../packages/experimental/timeline) | | `locale/change` | `locale` (`emit`) | `locale` | -| `reaction-added` | - | [`im`](../packages/experimental/im) | -| `reaction-removed` | - | [`im`](../packages/experimental/im) | -| `satori/receive` | - | [`im`](../packages/experimental/im) | -| `send` | - | [`im`](../packages/experimental/im) | | `slots/changed` | `ui-renderer` (`emit`) | - | | `theme/change` | `ui-theme` (`emit`) | `ui-layout`, `ui-theme` | diff --git a/docs/event-producer-consumer.zh.md b/docs/event-producer-consumer.zh.md index 259e3084ef..0aaf9d682e 100644 --- a/docs/event-producer-consumer.zh.md +++ b/docs/event-producer-consumer.zh.md @@ -14,16 +14,16 @@ | --- | --- | --- | --- | --- | | `agent-loop/config-start-failed` | `emit` | [`packages/core/agent-loop/src/index.ts:198`](../packages/core/agent-loop/src/index.ts) | [`agent-loop`](../packages/core/agent-loop) (`events.dispatch`) | - | | `agent-preset/selected` | `emit` | [`packages/preset/agent-preset-registry/src/types.ts:92`](../packages/preset/agent-preset-registry/src/types.ts) | [`agent-preset-registry`](../packages/preset/agent-preset-registry) (`emit`) | [`cua`](../packages/experimental/cua), `remotes` | -| `agent/assistant-stream` | `emit` | [`packages/core/agent/src/runtime-types.ts:400`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`headless`](../packages/bundle/headless), [`im`](../packages/experimental/im), `session-controller` | +| `agent/assistant-stream` | `emit` | [`packages/core/agent/src/runtime-types.ts:400`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`headless`](../packages/bundle/headless), `session-controller` | | `agent/created` | `serial` | [`packages/core/agent/src/runtime-types.ts:291`](../packages/core/agent/src/runtime-types.ts) | [`agent`](../packages/core/agent) (`serial`) | [`agent-team`](../packages/team/agent-team), `browser-use-runtime`, `claude-code-mods`, [`creation-recommendations`](../packages/extensions/creation-recommendations), [`cua`](../packages/experimental/cua), [`file-reference-local`](../packages/context/file-reference-local), [`goal`](../packages/goal/goal), [`goal-round-driver`](../packages/goal/goal-round-driver), [`hooks-claude-code`](../packages/experimental/hooks-claude-code), [`hooks-codex`](../packages/experimental/hooks-codex), `liveshare`, [`loader-smoke`](../packages/test-support/loader-smoke), [`permission-presets`](../packages/interaction/permission-presets), [`sandbox-policy-git`](../packages/experimental/sandbox-policy-git), `session-controller`, [`timeline`](../packages/experimental/timeline) | -| `agent/disposed` | `emit` | [`packages/core/agent/src/runtime-types.ts:300`](../packages/core/agent/src/runtime-types.ts) | [`agent`](../packages/core/agent) (`events.dispatch`) | [`agent-loop`](../packages/core/agent-loop), `claude-code-mods`, [`creation-recommendations`](../packages/extensions/creation-recommendations), [`file-reference-local`](../packages/context/file-reference-local), [`goal-round-driver`](../packages/goal/goal-round-driver), [`im`](../packages/experimental/im), [`mcp-client`](../packages/mcp/mcp-client), [`sandbox-policy-git`](../packages/experimental/sandbox-policy-git), `server`, `session-controller`, [`subagent`](../packages/subagent/subagent), [`timeline`](../packages/experimental/timeline), [`tool-office`](../packages/document/tool-office), [`tool-subagent-control`](../packages/subagent/tool-subagent-control) | -| `agent/error` | `emit` | [`packages/core/agent/src/runtime-types.ts:430`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`), [`cua`](../packages/experimental/cua) (`emitAgentEvent`) | [`acp`](../packages/acp/acp), [`goal-round-driver`](../packages/goal/goal-round-driver), [`headless`](../packages/bundle/headless), [`im`](../packages/experimental/im), [`llm-deepseek-account`](../packages/llm/llm-deepseek-account), `server`, `session-controller`, [`session-telemetry`](../packages/session/session-telemetry), [`subagent`](../packages/subagent/subagent) | +| `agent/disposed` | `emit` | [`packages/core/agent/src/runtime-types.ts:300`](../packages/core/agent/src/runtime-types.ts) | [`agent`](../packages/core/agent) (`events.dispatch`) | [`agent-loop`](../packages/core/agent-loop), `claude-code-mods`, [`creation-recommendations`](../packages/extensions/creation-recommendations), [`file-reference-local`](../packages/context/file-reference-local), [`goal-round-driver`](../packages/goal/goal-round-driver), [`mcp-client`](../packages/mcp/mcp-client), [`sandbox-policy-git`](../packages/experimental/sandbox-policy-git), `server`, `session-controller`, [`subagent`](../packages/subagent/subagent), [`timeline`](../packages/experimental/timeline), [`tool-document`](../packages/document/tool-document), [`tool-subagent-control`](../packages/subagent/tool-subagent-control) | +| `agent/error` | `emit` | [`packages/core/agent/src/runtime-types.ts:430`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`), [`cua`](../packages/experimental/cua) (`emitAgentEvent`) | [`acp`](../packages/acp/acp), [`goal-round-driver`](../packages/goal/goal-round-driver), [`headless`](../packages/bundle/headless), [`llm-deepseek-account`](../packages/llm/llm-deepseek-account), `server`, `session-controller`, [`session-telemetry`](../packages/session/session-telemetry), [`subagent`](../packages/subagent/subagent) | | `agent/inbox/claimed` | `emit` | [`packages/core/agent/src/runtime-types.ts:329`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`acp`](../packages/acp/acp), [`goal-round-driver`](../packages/goal/goal-round-driver), [`subagent`](../packages/subagent/subagent), [`tool-jobs`](../packages/jobs/tool-jobs), [`user-questions`](../packages/interaction/user-questions) | | `agent/inbox/discarded` | `emit` | [`packages/core/agent/src/runtime-types.ts:337`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`goal-round-driver`](../packages/goal/goal-round-driver), [`subagent`](../packages/subagent/subagent), [`user-questions`](../packages/interaction/user-questions) | | `agent/inbox/inserted` | `emit` | [`packages/core/agent/src/runtime-types.ts:318`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | `client-ui-forge`, [`cua`](../packages/experimental/cua), [`goal-round-driver`](../packages/goal/goal-round-driver), [`subagent`](../packages/subagent/subagent), [`tool-jobs`](../packages/jobs/tool-jobs), [`tool-subagent-control`](../packages/subagent/tool-subagent-control) | | `agent/pre-step` | `waterfall` | [`packages/core/agent/src/runtime-types.ts:351`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`waterfall`) | [`action-cards`](../packages/interaction/action-cards), [`agent`](../packages/core/agent), [`agent-instructions`](../packages/context/agent-instructions), `claude-code-mods`, `client-ui-forge`, [`compaction-basic`](../packages/compaction/compaction-basic), [`cua`](../packages/experimental/cua), [`cua-macos`](../packages/experimental/cua-macos), [`goal-round-driver`](../packages/goal/goal-round-driver), [`hooks-claude-code`](../packages/experimental/hooks-claude-code), [`hooks-codex`](../packages/experimental/hooks-codex), `liveshare`, [`plan-mode`](../packages/plan/plan-mode), [`repeat-tool-reminder`](../packages/guard/repeat-tool-reminder), [`session-checkpoint-policy`](../packages/session/session-checkpoint-policy), `session-controller`, [`session-reference`](../packages/context/session-reference), [`subagent`](../packages/subagent/subagent), [`time-context`](../packages/context/time-context), [`tmux-context`](../packages/context/tmux-context), [`tool-skill`](../packages/skill/tool-skill) | | `agent/request-error` | `waterfall` | [`packages/core/agent/src/runtime-types.ts:390`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`waterfall`) | [`compaction-basic`](../packages/compaction/compaction-basic), [`compaction-image-offload`](../packages/compaction/compaction-image-offload), [`llm-retry`](../packages/llm/llm-retry) | -| `agent/status` | `emit` | [`packages/core/agent/src/runtime-types.ts:310`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`acp`](../packages/acp/acp), [`compaction-basic`](../packages/compaction/compaction-basic), [`goal-round-driver`](../packages/goal/goal-round-driver), [`im`](../packages/experimental/im), `server`, `session-controller`, [`timeline`](../packages/experimental/timeline) | +| `agent/status` | `emit` | [`packages/core/agent/src/runtime-types.ts:310`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`emit`) | [`acp`](../packages/acp/acp), [`compaction-basic`](../packages/compaction/compaction-basic), [`goal-round-driver`](../packages/goal/goal-round-driver), `server`, `session-controller`, [`timeline`](../packages/experimental/timeline) | | `agent/turn-stopping` | `serial` | [`packages/core/agent/src/runtime-types.ts:418`](../packages/core/agent/src/runtime-types.ts) | [`agent-loop`](../packages/core/agent-loop) (`serial`) | [`hooks-claude-code`](../packages/experimental/hooks-claude-code), [`hooks-codex`](../packages/experimental/hooks-codex), [`workspace-changes`](../packages/deliverables/workspace-changes) | | `api-session/activity` | `emit` | [`packages/api/session-controller/src/types.ts:697`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` | | `api-session/added` | `emit` | [`packages/api/session-controller/src/types.ts:677`](../packages/api/session-controller/src/types.ts) | `session-controller` (`emit`) | `remotes` | @@ -51,24 +51,14 @@ | `feedback/committed` | `parallel` | [`packages/feedback/message-feedback/src/index.ts:58`](../packages/feedback/message-feedback/src/index.ts) | [`message-feedback`](../packages/feedback/message-feedback) (`parallel`) | [`session-telemetry-otel`](../packages/session/session-telemetry-otel) | | `forge/providers-changed` | `parallel` | [`packages/experimental/forge/src/index.ts:35`](../packages/experimental/forge/src/index.ts) | `forge` (`parallel`) | `client-ui-forge`, `forge-session` | | `forge/review-changed` | `parallel` | [`packages/experimental/forge/src/index.ts:44`](../packages/experimental/forge/src/index.ts) | `forge` (`parallel`) | `client-ui-forge` | -| `fs/delete-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:86`](../packages/fs/fs/src/index.ts) | [`tool-fs`](../packages/fs/tool-fs) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) | -| `fs/edit-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:78`](../packages/fs/fs/src/index.ts) | `liveshare` (`waterfall`), [`tool-fs`](../packages/fs/tool-fs) (`waterfall`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) | -| `fs/observed` | `emit` | [`packages/fs/fs/src/index.ts:96`](../packages/fs/fs/src/index.ts) | `liveshare` (`emit`), [`tool-fs`](../packages/fs/tool-fs) (`emit`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`emit`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`skill-filesystem`](../packages/skill/skill-filesystem), `workspace-files` | -| `fs/write-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:70`](../packages/fs/fs/src/index.ts) | `liveshare` (`waterfall`), [`tool-fs`](../packages/fs/tool-fs) (`waterfall`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) | +| `fs/delete-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:83`](../packages/fs/fs/src/index.ts) | [`tool-fs`](../packages/fs/tool-fs) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) | +| `fs/edit-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:75`](../packages/fs/fs/src/index.ts) | `liveshare` (`waterfall`), [`tool-fs`](../packages/fs/tool-fs) (`waterfall`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) | +| `fs/observed` | `emit` | [`packages/fs/fs/src/index.ts:93`](../packages/fs/fs/src/index.ts) | `liveshare` (`emit`), [`tool-fs`](../packages/fs/tool-fs) (`emit`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`emit`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`skill-filesystem`](../packages/skill/skill-filesystem), `workspace-files` | +| `fs/write-intent` | `waterfall` | [`packages/fs/fs/src/index.ts:67`](../packages/fs/fs/src/index.ts) | `liveshare` (`waterfall`), [`tool-fs`](../packages/fs/tool-fs) (`waterfall`), [`tool-str-replace-editor`](../packages/fs/tool-str-replace-editor) (`waterfall`) | [`fs-observation-policy`](../packages/fs/fs-observation-policy), [`workspace-changes`](../packages/deliverables/workspace-changes) | | `goal/activation-changed` | `emit` | [`packages/goal/goal/src/types.ts:147`](../packages/goal/goal/src/types.ts) | [`goal`](../packages/goal/goal) (`emit`) | `remotes`, `server` | | `goal/changed` | `emit` | [`packages/goal/goal/src/domain.ts:115`](../packages/goal/goal/src/domain.ts) | [`goal`](../packages/goal/goal) (`emit`) | [`goal-round-driver`](../packages/goal/goal-round-driver) | | `hmr/change` | `emit` | [`packages/boot/hmr/src/index.ts:35`](../packages/boot/hmr/src/index.ts) | [`hmr`](../packages/boot/hmr) (`emit`) | - | | `hmr/reload` | `emit` | [`packages/boot/hmr/src/index.ts:40`](../packages/boot/hmr/src/index.ts) | [`hmr`](../packages/boot/hmr) (`emit`) | - | -| `im/activity` | `emit` | [`packages/experimental/im/src/api.ts:271`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`emit`) | [`im`](../packages/experimental/im) | -| `im/before-send` | `waterfall` | [`packages/experimental/im/src/api.ts:240`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`waterfall`) | - | -| `im/button` | `emit` | [`packages/experimental/im/src/api.ts:246`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`emit`) | - | -| `im/check` | `emit` | [`packages/experimental/im/src/api.ts:258`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`emit`) | - | -| `im/message` | `waterfall` | [`packages/experimental/im/src/api.ts:226`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`waterfall`) | [`im-session-commands`](../packages/experimental/im-session-commands) | -| `im/reaction` | `emit` | [`packages/experimental/im/src/api.ts:264`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`emit`) | - | -| `im/select` | `emit` | [`packages/experimental/im/src/api.ts:252`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`emit`) | - | -| `im/session/created` | `emit` | [`packages/experimental/im/src/api.ts:277`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`emit`) | - | -| `im/session/reset` | `emit` | [`packages/experimental/im/src/api.ts:284`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`emit`) | - | -| `im/stored` | `emit` | [`packages/experimental/im/src/api.ts:232`](../packages/experimental/im/src/api.ts) | [`im`](../packages/experimental/im) (`emit`) | - | | `llm-pi-ai/request-headers` | `waterfall` | [`packages/llm/llm-pi-ai/src/index.ts:115`](../packages/llm/llm-pi-ai/src/index.ts) | [`llm-pi-ai`](../packages/llm/llm-pi-ai) (`waterfall`) | - | | `llm/adapters-updated` | `emit` | [`packages/llm/llm/src/types.ts:24`](../packages/llm/llm/src/types.ts) | [`llm`](../packages/llm/llm) (`events.dispatch`) | [`acp`](../packages/acp/acp), `remotes` | | `llm/models-updated` | `emit` | [`packages/llm/llm/src/types.ts:30`](../packages/llm/llm/src/types.ts) | [`llm-deepseek`](../packages/llm/llm-deepseek) (`emit`) | `remotes` | @@ -86,7 +76,7 @@ | `session-telemetry/record` | `waterfall` | [`packages/session/session-telemetry/src/index.ts:44`](../packages/session/session-telemetry/src/index.ts) | [`session-telemetry`](../packages/session/session-telemetry) (`waterfall`) | - | | `session/created` | `emit` | [`packages/core/session/src/index.ts:62`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | `server`, `session-controller`, [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-telemetry`](../packages/session/session-telemetry) | | `session/disposed` | `emit` | [`packages/core/session/src/index.ts:71`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`agent-loop`](../packages/core/agent-loop), `client-ui-forge`, `file-upload`, `forge-session`, [`office-kit`](../packages/document/office-kit), `session-controller`, [`session-persistence-jsonl`](../packages/session/session-persistence-jsonl), [`session-persistence-sqlite`](../packages/session/session-persistence-sqlite), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-telemetry`](../packages/session/session-telemetry), [`session-telemetry-otel`](../packages/session/session-telemetry-otel), [`session-title`](../packages/session/session-title), `ui-trajectory`, [`workspace-changes`](../packages/deliverables/workspace-changes) | -| `session/event` | `emit` | [`packages/core/session/src/index.ts:85`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`acp`](../packages/acp/acp), [`agent-instructions`](../packages/context/agent-instructions), [`agent-loop`](../packages/core/agent-loop), [`agent-preset-registry`](../packages/preset/agent-preset-registry), `claude-code-mods`, `client-ui-forge`, [`compaction-basic`](../packages/compaction/compaction-basic), [`cua`](../packages/experimental/cua), [`cua-macos`](../packages/experimental/cua-macos), [`file-reference-local`](../packages/context/file-reference-local), `file-upload`, `forge-session`, [`goal`](../packages/goal/goal), [`goal-round-driver`](../packages/goal/goal-round-driver), [`headless`](../packages/bundle/headless), [`im`](../packages/experimental/im), [`loader-smoke`](../packages/test-support/loader-smoke), `product-analytics`, [`ptc-runtime-node`](../packages/ptc-runtime/ptc-runtime-node), [`sandbox-policy-git`](../packages/experimental/sandbox-policy-git), `server`, `session-controller`, [`session-persistence-jsonl`](../packages/session/session-persistence-jsonl), [`session-persistence-sqlite`](../packages/session/session-persistence-sqlite), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-telemetry`](../packages/session/session-telemetry), [`session-telemetry-otel`](../packages/session/session-telemetry-otel), [`session-title`](../packages/session/session-title), [`subagent`](../packages/subagent/subagent), [`timeline`](../packages/experimental/timeline), [`token-meter`](../packages/llm/token-meter), [`tool-executor-ptc`](../packages/core/tool-executor-ptc), [`tool-jobs`](../packages/jobs/tool-jobs), [`tool-office`](../packages/document/tool-office), `ui-session-status`, `ui-trajectory`, [`user-questions`](../packages/interaction/user-questions), [`workspace-changes`](../packages/deliverables/workspace-changes) | +| `session/event` | `emit` | [`packages/core/session/src/index.ts:85`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`acp`](../packages/acp/acp), [`agent-instructions`](../packages/context/agent-instructions), [`agent-loop`](../packages/core/agent-loop), [`agent-preset-registry`](../packages/preset/agent-preset-registry), `claude-code-mods`, `client-ui-forge`, [`compaction-basic`](../packages/compaction/compaction-basic), [`cua`](../packages/experimental/cua), [`cua-macos`](../packages/experimental/cua-macos), [`file-reference-local`](../packages/context/file-reference-local), `file-upload`, `forge-session`, [`goal`](../packages/goal/goal), [`goal-round-driver`](../packages/goal/goal-round-driver), [`headless`](../packages/bundle/headless), [`loader-smoke`](../packages/test-support/loader-smoke), `product-analytics`, [`ptc-runtime-node`](../packages/ptc-runtime/ptc-runtime-node), [`sandbox-policy-git`](../packages/experimental/sandbox-policy-git), `server`, `session-controller`, [`session-persistence-jsonl`](../packages/session/session-persistence-jsonl), [`session-persistence-sqlite`](../packages/session/session-persistence-sqlite), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-telemetry`](../packages/session/session-telemetry), [`session-telemetry-otel`](../packages/session/session-telemetry-otel), [`session-title`](../packages/session/session-title), [`subagent`](../packages/subagent/subagent), [`timeline`](../packages/experimental/timeline), [`token-meter`](../packages/llm/token-meter), [`tool-document`](../packages/document/tool-document), [`tool-executor-ptc`](../packages/core/tool-executor-ptc), [`tool-jobs`](../packages/jobs/tool-jobs), `ui-session-status`, `ui-trajectory`, [`user-questions`](../packages/interaction/user-questions), [`workspace-changes`](../packages/deliverables/workspace-changes) | | `session/flush` | `parallel` | [`packages/core/session/src/index.ts:93`](../packages/core/session/src/index.ts) | [`session`](../packages/core/session) (`events.dispatch`) | [`session-persistence-jsonl`](../packages/session/session-persistence-jsonl), [`session-persistence-sqlite`](../packages/session/session-persistence-sqlite), [`session-telemetry`](../packages/session/session-telemetry) | | `settings/document-updated` | `emit` | [`packages/settings/settings/src/types.ts:75`](../packages/settings/settings/src/types.ts) | [`settings`](../packages/settings/settings) (`emit`) | `remotes` | | `skills/change` | `emit` | [`packages/skill/skill/src/index.ts:299`](../packages/skill/skill/src/index.ts) | [`skill`](../packages/skill/skill) (`events.dispatch`) | - | @@ -102,7 +92,7 @@ | `tools/post-execute` | `waterfall` | [`packages/core/tools/src/events.ts:41`](../packages/core/tools/src/events.ts) | [`tools`](../packages/core/tools) (`waterfall`) | `claude-code-mods`, [`hooks-claude-code`](../packages/experimental/hooks-claude-code), [`hooks-codex`](../packages/experimental/hooks-codex), [`repeat-tool-reminder`](../packages/guard/repeat-tool-reminder), [`spill-policy`](../packages/spill/spill-policy), [`tool-fs-search`](../packages/fs/tool-fs-search) | | `tools/pre-execute` | `waterfall` | [`packages/core/tools/src/events.ts:18`](../packages/core/tools/src/events.ts) | [`tools`](../packages/core/tools) (`waterfall`) | `auto-review`, [`hooks-claude-code`](../packages/experimental/hooks-claude-code), [`hooks-codex`](../packages/experimental/hooks-codex), `liveshare`, [`tool-jobs`](../packages/jobs/tool-jobs), [`workspace-changes`](../packages/deliverables/workspace-changes) | | `tools/ptc-dispatch-log` | `waterfall` | [`packages/core/tool-executor-ptc/src/runtime-types.ts:46`](../packages/core/tool-executor-ptc/src/runtime-types.ts) | [`tool-executor-ptc`](../packages/core/tool-executor-ptc) (`waterfall`) | [`spill-policy`](../packages/spill/spill-policy) | -| `tools/result` | `emit` | [`packages/core/tools/src/events.ts:49`](../packages/core/tools/src/events.ts) | [`tools`](../packages/core/tools) (`events.dispatch`) | [`agent-instructions`](../packages/context/agent-instructions), `claude-code-mods`, [`cua`](../packages/experimental/cua), `forge-session`, `liveshare`, [`subagent`](../packages/subagent/subagent), [`timeline`](../packages/experimental/timeline), [`tool-office`](../packages/document/tool-office), [`tool-present`](../packages/deliverables/tool-present), `ui-trajectory` | +| `tools/result` | `emit` | [`packages/core/tools/src/events.ts:49`](../packages/core/tools/src/events.ts) | [`tools`](../packages/core/tools) (`events.dispatch`) | [`agent-instructions`](../packages/context/agent-instructions), `claude-code-mods`, [`cua`](../packages/experimental/cua), `forge-session`, `liveshare`, [`subagent`](../packages/subagent/subagent), [`timeline`](../packages/experimental/timeline), [`tool-document`](../packages/document/tool-document), [`tool-present`](../packages/deliverables/tool-present), `ui-trajectory` | | `user-questions/request` | `waterfall` | [`packages/interaction/user-questions/src/types.ts:174`](../packages/interaction/user-questions/src/types.ts) | [`user-questions`](../packages/interaction/user-questions) (`waterfall`) | [`cua-mcp`](../packages/experimental/cua-mcp), `remotes`, `server` | | `web/providers-changed` | `emit` | [`packages/web/web/src/types.ts:21`](../packages/web/web/src/types.ts) | [`web`](../packages/web/web) (`events.dispatch`) | `remotes` | | `webserver/authorize` | `bail` | [`packages/host/webserver/src/index.ts:60`](../packages/host/webserver/src/index.ts) | `remote-connection` (`bail`), `webserver` (`bail`) | `connection` | @@ -131,9 +121,6 @@ | --- | --- | --- | | `agent/request` | [`agent-loop`](../packages/core/agent-loop) (`waterfall`) | [`compaction-basic`](../packages/compaction/compaction-basic), [`timeline`](../packages/experimental/timeline) | | `connection/reset` | `gateway` (`emit`) | `terminal-controller`, `ui-settings` | -| `interaction/button` | - | [`im`](../packages/experimental/im) | -| `interaction/check` | - | [`im`](../packages/experimental/im) | -| `interaction/select` | - | [`im`](../packages/experimental/im) | | `internal/config` | - | [`llm-pi-ai`](../packages/llm/llm-pi-ai), [`mcp-manager`](../packages/mcp/mcp-manager), `modules` | | `internal/dispatch` | - | [`terminal-bash`](../packages/terminal/terminal-bash) | | `internal/plugin` | - | `computer-use-cua-driver-native`, `inspector`, `loader`, [`lsp-stdio`](../packages/lsp/lsp-stdio), [`mcp-client`](../packages/mcp/mcp-client), [`mcp-manager`](../packages/mcp/mcp-manager), `modules` | @@ -141,10 +128,6 @@ | `internal/status` | - | [`agent`](../packages/core/agent), `claude-code-mods`, `inspector`, `modules`, `server`, `translator`, [`web`](../packages/web/web) | | `loader/volatile-update` | - | [`action-cards`](../packages/interaction/action-cards), `forge-github`, [`forge-gitlab`](../packages/experimental/forge-gitlab), [`llm-deepseek`](../packages/llm/llm-deepseek), [`llm-deepseek-api-key`](../packages/llm/llm-deepseek-api-key), [`llm-pi-ai`](../packages/llm/llm-pi-ai), [`mcp-manager`](../packages/mcp/mcp-manager), `modules`, [`plugin-market`](../packages/boot/plugin-market), `product-analytics`, `speech-to-text`, [`timeline`](../packages/experimental/timeline) | | `locale/change` | `locale` (`emit`) | `locale` | -| `reaction-added` | - | [`im`](../packages/experimental/im) | -| `reaction-removed` | - | [`im`](../packages/experimental/im) | -| `satori/receive` | - | [`im`](../packages/experimental/im) | -| `send` | - | [`im`](../packages/experimental/im) | | `slots/changed` | `ui-renderer` (`emit`) | - | | `theme/change` | `ui-theme` (`emit`) | `ui-layout`, `ui-theme` | diff --git a/docs/module-graph.md b/docs/module-graph.md index e07cec6a89..c51e7a9a90 100644 --- a/docs/module-graph.md +++ b/docs/module-graph.md @@ -278,7 +278,7 @@ flowchart TD end subgraph group_document["packages/document"] pkg_office_kit["office-kit"] - pkg_tool_office["tool-office"] + pkg_tool_document["tool-document"] end subgraph group_experimental["packages/experimental"] pkg_client_ui_connectors["client-ui-connectors"] @@ -1518,16 +1518,16 @@ flowchart TD pkg_session_reference --> pkg_subagent pkg_session_reference --> pkg_system_prompt pkg_session_reference --> pkg_typert_protocol - pkg_tool_office --> pkg_agent - pkg_tool_office --> pkg_attachment - pkg_tool_office --> pkg_error - pkg_tool_office --> pkg_fs - pkg_tool_office --> pkg_llm - pkg_tool_office --> pkg_office_kit - pkg_tool_office --> pkg_skill - pkg_tool_office --> pkg_subagent - pkg_tool_office --> pkg_tools - pkg_tool_office --> pkg_working_directory + pkg_tool_document --> pkg_agent + pkg_tool_document --> pkg_attachment + pkg_tool_document --> pkg_error + pkg_tool_document --> pkg_fs + pkg_tool_document --> pkg_llm + pkg_tool_document --> pkg_office_kit + pkg_tool_document --> pkg_skill + pkg_tool_document --> pkg_subagent + pkg_tool_document --> pkg_tools + pkg_tool_document --> pkg_working_directory pkg_experimental_client_ui_forge --> pkg_experimental_forge pkg_experimental_client_ui_forge --> pkg_experimental_worktree pkg_experimental_client_ui_forge --> pkg_fs @@ -2059,7 +2059,7 @@ flowchart TD | [`headless`](../packages/bundle/headless) | `bundle` | [`agent`](../packages/core/agent), [`agent-default-model`](../packages/core/agent-default-model), [`fs`](../packages/fs/fs), [`llm`](../packages/llm/llm), [`permission-presets`](../packages/interaction/permission-presets), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`session`](../packages/core/session), [`session-query`](../packages/session-query/session-query), [`subagent`](../packages/subagent/subagent), [`user-approval`](../packages/interaction/user-approval) | | [`compaction-basic`](../packages/compaction/compaction-basic) | `compaction` | [`agent`](../packages/core/agent), [`commands`](../packages/interaction/commands), [`compaction`](../packages/compaction/compaction), [`compaction-tool-result-pruner`](../packages/compaction/compaction-tool-result-pruner), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`token-meter`](../packages/llm/token-meter) | | [`session-reference`](../packages/context/session-reference) | `context` | [`agent`](../packages/core/agent), [`compaction`](../packages/compaction/compaction), [`llm`](../packages/llm/llm), [`output-retention`](../packages/util/output-retention), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-query`](../packages/session-query/session-query), [`session-title`](../packages/session/session-title), [`spill`](../packages/spill/spill), [`subagent`](../packages/subagent/subagent), [`system-prompt`](../packages/core/system-prompt), [`typert-protocol`](../packages/typert/protocol) | -| [`tool-office`](../packages/document/tool-office) | `document` | [`agent`](../packages/core/agent), [`attachment`](../packages/attachment/attachment), [`error`](../packages/util/error), [`fs`](../packages/fs/fs), [`llm`](../packages/llm/llm), [`office-kit`](../packages/document/office-kit), [`skill`](../packages/skill/skill), [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools), [`working-directory`](../packages/session/working-directory) | +| [`tool-document`](../packages/document/tool-document) | `document` | [`agent`](../packages/core/agent), [`attachment`](../packages/attachment/attachment), [`error`](../packages/util/error), [`fs`](../packages/fs/fs), [`llm`](../packages/llm/llm), [`office-kit`](../packages/document/office-kit), [`skill`](../packages/skill/skill), [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools), [`working-directory`](../packages/session/working-directory) | | [`experimental-client-ui-forge`](../packages/experimental/client-ui-forge) | `experimental` | [`experimental-forge`](../packages/experimental/forge), [`experimental-worktree`](../packages/experimental/worktree), [`fs`](../packages/fs/fs), [`session`](../packages/core/session), [`timeout`](../packages/util/timeout) | | [`experimental-subagent-oar`](../packages/experimental/subagent-oar) | `experimental` | [`error`](../packages/util/error), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`subprocess`](../packages/subprocess/subprocess) | | [`experimental-tool-subagent-oar`](../packages/experimental/tool-subagent-oar) | `experimental` | [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools) | diff --git a/docs/module-graph.zh.md b/docs/module-graph.zh.md index b208e81a70..9708c548b1 100644 --- a/docs/module-graph.zh.md +++ b/docs/module-graph.zh.md @@ -280,7 +280,7 @@ flowchart TD end subgraph group_document["packages/document"] pkg_office_kit["office-kit"] - pkg_tool_office["tool-office"] + pkg_tool_document["tool-document"] end subgraph group_experimental["packages/experimental"] pkg_client_ui_connectors["client-ui-connectors"] @@ -1520,16 +1520,16 @@ flowchart TD pkg_session_reference --> pkg_subagent pkg_session_reference --> pkg_system_prompt pkg_session_reference --> pkg_typert_protocol - pkg_tool_office --> pkg_agent - pkg_tool_office --> pkg_attachment - pkg_tool_office --> pkg_error - pkg_tool_office --> pkg_fs - pkg_tool_office --> pkg_llm - pkg_tool_office --> pkg_office_kit - pkg_tool_office --> pkg_skill - pkg_tool_office --> pkg_subagent - pkg_tool_office --> pkg_tools - pkg_tool_office --> pkg_working_directory + pkg_tool_document --> pkg_agent + pkg_tool_document --> pkg_attachment + pkg_tool_document --> pkg_error + pkg_tool_document --> pkg_fs + pkg_tool_document --> pkg_llm + pkg_tool_document --> pkg_office_kit + pkg_tool_document --> pkg_skill + pkg_tool_document --> pkg_subagent + pkg_tool_document --> pkg_tools + pkg_tool_document --> pkg_working_directory pkg_experimental_client_ui_forge --> pkg_experimental_forge pkg_experimental_client_ui_forge --> pkg_experimental_worktree pkg_experimental_client_ui_forge --> pkg_fs @@ -2061,7 +2061,7 @@ flowchart TD | [`headless`](../packages/bundle/headless) | `bundle` | [`agent`](../packages/core/agent), [`agent-default-model`](../packages/core/agent-default-model), [`fs`](../packages/fs/fs), [`llm`](../packages/llm/llm), [`permission-presets`](../packages/interaction/permission-presets), [`sandbox-policy`](../packages/sandbox/sandbox-policy), [`session`](../packages/core/session), [`session-query`](../packages/session-query/session-query), [`subagent`](../packages/subagent/subagent), [`user-approval`](../packages/interaction/user-approval) | | [`compaction-basic`](../packages/compaction/compaction-basic) | `compaction` | [`agent`](../packages/core/agent), [`commands`](../packages/interaction/commands), [`compaction`](../packages/compaction/compaction), [`compaction-tool-result-pruner`](../packages/compaction/compaction-tool-result-pruner), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`token-meter`](../packages/llm/token-meter) | | [`session-reference`](../packages/context/session-reference) | `context` | [`agent`](../packages/core/agent), [`compaction`](../packages/compaction/compaction), [`llm`](../packages/llm/llm), [`output-retention`](../packages/util/output-retention), [`session`](../packages/core/session), [`session-projection`](../packages/session/session-projection), [`session-projection-cache`](../packages/session/session-projection-cache), [`session-query`](../packages/session-query/session-query), [`session-title`](../packages/session/session-title), [`spill`](../packages/spill/spill), [`subagent`](../packages/subagent/subagent), [`system-prompt`](../packages/core/system-prompt), [`typert-protocol`](../packages/typert/protocol) | -| [`tool-office`](../packages/document/tool-office) | `document` | [`agent`](../packages/core/agent), [`attachment`](../packages/attachment/attachment), [`error`](../packages/util/error), [`fs`](../packages/fs/fs), [`llm`](../packages/llm/llm), [`office-kit`](../packages/document/office-kit), [`skill`](../packages/skill/skill), [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools), [`working-directory`](../packages/session/working-directory) | +| [`tool-document`](../packages/document/tool-document) | `document` | [`agent`](../packages/core/agent), [`attachment`](../packages/attachment/attachment), [`error`](../packages/util/error), [`fs`](../packages/fs/fs), [`llm`](../packages/llm/llm), [`office-kit`](../packages/document/office-kit), [`skill`](../packages/skill/skill), [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools), [`working-directory`](../packages/session/working-directory) | | [`experimental-client-ui-forge`](../packages/experimental/client-ui-forge) | `experimental` | [`experimental-forge`](../packages/experimental/forge), [`experimental-worktree`](../packages/experimental/worktree), [`fs`](../packages/fs/fs), [`session`](../packages/core/session), [`timeout`](../packages/util/timeout) | | [`experimental-subagent-oar`](../packages/experimental/subagent-oar) | `experimental` | [`error`](../packages/util/error), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`subprocess`](../packages/subprocess/subprocess) | | [`experimental-tool-subagent-oar`](../packages/experimental/tool-subagent-oar) | `experimental` | [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools) | diff --git a/docs/subsystems/office-kit.i18n.yaml b/docs/subsystems/office-kit.i18n.yaml index 21e91a8958..657875b3cb 100644 --- a/docs/subsystems/office-kit.i18n.yaml +++ b/docs/subsystems/office-kit.i18n.yaml @@ -3,11 +3,11 @@ # After editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write docs/subsystems/office-kit.md /office-kit: - en: ba1e27aece3a68c3 - zh: 50ca71dd6c6a5438 + en: e805574b8ccb67b8 + zh: 1a6b34e61cb72900 /office-kit/ownership: - en: bb3cd09180d5d9b6 - zh: 7fdf73ec697ac549 + en: febb7019a4427757 + zh: 3a0471c0a68007e9 /office-kit/requests-and-results: en: 9704c5db7c21d948 zh: 7a6ba8c234c02b6e diff --git a/docs/subsystems/office-kit.md b/docs/subsystems/office-kit.md index ff38ba9d43..1955482dd8 100644 --- a/docs/subsystems/office-kit.md +++ b/docs/subsystems/office-kit.md @@ -2,15 +2,15 @@ English | [中文](office-kit.zh.md) -The [document package family](../../packages/document/README.md) renders, converts, and recalculates Office files on the Node Host. Consumers authorize source reads and own presentation; the shared provider owns the engine, bounded admission, transient output reuse, and the private output store. The [`office_render`, `office_convert`, and `office_recalculate` tools](../../packages/document/tool-office/README.md) are the model-facing consumers; the provider itself creates no Session event. +The [document package family](../../packages/document/README.md) renders, converts, and recalculates Office files on the Node Host. Consumers authorize source reads and own presentation; the shared provider owns the engine, bounded admission, transient output reuse, and the private output store. The [`document_render`, `document_convert`, and `document_recalculate` tools](../../packages/document/tool-document/README.md) are the model-facing consumers; the provider itself creates no Session event. ## Ownership | Owner | Responsibility | |---|---| | [office-kit](../../packages/document/office-kit/README.md) | `ctx.officeKit`: shared LibreOffice rendering, conversion, and recalculation, Poppler PDF rendering, bounded admission, output caching, and the per-Session output store; resolution of the provider's own Kit entry, engine manifests from that installation, and native paths mapped to ASAR unpacked directories | -| [tool-office](../../packages/document/tool-office/README.md) | The on-demand `office_render`, `office_convert`, and `office_recalculate` tools: rendered images in tool results and converted or recalculated files returned for a shell copy | -| [Web bundle](../../packages/bundle/web-app/README.md) and [SDK bundle](../../packages/bundle/sdk-app/README.md) | One configurable provider and `tool-office` shared by Host consumers | +| [tool-document](../../packages/document/tool-document/README.md) | The on-demand `document_render`, `document_convert`, and `document_recalculate` tools: rendered images in tool results and converted or recalculated files returned for a shell copy | +| [Web bundle](../../packages/bundle/web-app/README.md) and [SDK bundle](../../packages/bundle/sdk-app/README.md) | One configurable provider and `tool-document` shared by Host consumers | | [Office preview Client](../../packages/client/ui-sidebar-documentpreview/README.md#office-preview) | Office extension selection, PDF reuse, and missing-font notices | ## Requests and results diff --git a/docs/subsystems/office-kit.zh.md b/docs/subsystems/office-kit.zh.md index 05826e4955..46521dcba5 100644 --- a/docs/subsystems/office-kit.zh.md +++ b/docs/subsystems/office-kit.zh.md @@ -2,15 +2,15 @@ [English](office-kit.md) | 中文 -[document 包族](../../packages/document/README.zh.md) 在 Node 宿主上渲染、转换 Office 文件并重算工作簿。消费者负责源文件读取授权与展示;共享提供方负责引擎、有界准入、临时输出复用和私有输出存储。[`office_render`、`office_convert` 和 `office_recalculate` 工具](../../packages/document/tool-office/README.zh.md)是面向模型的消费者;提供方本身不创建 Session 事件。 +[document 包族](../../packages/document/README.zh.md) 在 Node 宿主上渲染、转换 Office 文件并重算工作簿。消费者负责源文件读取授权与展示;共享提供方负责引擎、有界准入、临时输出复用和私有输出存储。[`document_render`、`document_convert` 和 `document_recalculate` 工具](../../packages/document/tool-document/README.zh.md)是面向模型的消费者;提供方本身不创建 Session 事件。 ## 所有权 | 所有者 | 职责 | |---|---| | [office-kit](../../packages/document/office-kit/README.zh.md) | `ctx.officeKit`:共享 LibreOffice 渲染、转换与重算,Poppler PDF 渲染,有界准入、输出缓存和按 Session 划分的输出存储;解析提供方自身的 Kit 入口、从该安装定位的引擎清单,以及映射到 ASAR 解包目录的原生路径 | -| [tool-office](../../packages/document/tool-office/README.zh.md) | 按需激活的 `office_render`、`office_convert` 和 `office_recalculate` 工具:工具结果中的渲染图片,以及供 shell 复制的转换或重算文件 | -| [Web bundle](../../packages/bundle/web-app/README.zh.md)与 [SDK bundle](../../packages/bundle/sdk-app/README.zh.md) | 由宿主消费者共享的单个可配置提供方及 `tool-office` | +| [tool-document](../../packages/document/tool-document/README.zh.md) | 按需激活的 `document_render`、`document_convert` 和 `document_recalculate` 工具:工具结果中的渲染图片,以及供 shell 复制的转换或重算文件 | +| [Web bundle](../../packages/bundle/web-app/README.zh.md)与 [SDK bundle](../../packages/bundle/sdk-app/README.zh.md) | 由宿主消费者共享的单个可配置提供方及 `tool-document` | | [Office 预览 Client](../../packages/client/ui-sidebar-documentpreview/README.zh.md#office-preview) | Office 扩展名选择、PDF 复用和缺失字体提示 | ## 请求和结果 diff --git a/docs/tool-catalog.i18n.yaml b/docs/tool-catalog.i18n.yaml index 2f4f64fb69..0c29ea166a 100644 --- a/docs/tool-catalog.i18n.yaml +++ b/docs/tool-catalog.i18n.yaml @@ -9,35 +9,8 @@ en: 6cc2cd9ced70bb09 zh: 1c0e6cb4ba2ed637 /tool-schema-catalog/tool-package-map: - en: b2317acc3fb0e92d - zh: 8a1efa6959b25f54 -/tool-schema-catalog/deepseek-ai-dsh-im: - en: 707c35f0d3451baa - zh: 707c35f0d3451baa -/tool-schema-catalog/deepseek-ai-dsh-im/im-history: - en: 6c1227a2696fab49 - zh: 6c1227a2696fab49 -/tool-schema-catalog/deepseek-ai-dsh-im/im-members: - en: 14319a20e2afa545 - zh: 14319a20e2afa545 -/tool-schema-catalog/deepseek-ai-dsh-im/im-read: - en: 7f4765144673fc36 - zh: 7f4765144673fc36 -/tool-schema-catalog/deepseek-ai-dsh-im/im-read-file: - en: 1259abf38f3e6f73 - zh: 1259abf38f3e6f73 -/tool-schema-catalog/deepseek-ai-dsh-im/im-read-image: - en: 8b705d054087e6f8 - zh: 8b705d054087e6f8 -/tool-schema-catalog/deepseek-ai-dsh-im/im-reply: - en: a3a892b3dee1d1f0 - zh: a3a892b3dee1d1f0 -/tool-schema-catalog/deepseek-ai-dsh-im/im-send: - en: 2869b8da22139254 - zh: 2869b8da22139254 -/tool-schema-catalog/deepseek-ai-dsh-im/im-send-file: - en: 94201ef458696c1b - zh: 08383250c6a69f8c + en: c1a6b7b02ce5f99f + zh: 02977c433d5ab3bc /tool-schema-catalog/deepseek-ai-dsh-tool-session-control: en: 79ab575ea6da86e2 zh: 79ab575ea6da86e2 @@ -111,20 +84,20 @@ en: 408ff0a5189bd7ec zh: 408ff0a5189bd7ec /tool-schema-catalog/deepseek-ai-dsh-tool-bash/bash: - en: bd3559b76dead1ea - zh: 7ec2604f73b23a31 -/tool-schema-catalog/deepseek-ai-dsh-tool-office: - en: 8b0373f31520efe7 - zh: 8b0373f31520efe7 -/tool-schema-catalog/deepseek-ai-dsh-tool-office/office-convert: - en: e63dea0f631fbb15 - zh: c564452c0ae91632 -/tool-schema-catalog/deepseek-ai-dsh-tool-office/office-recalculate: - en: 27a0ac973b1b9387 - zh: 29b4dd44a3a6b1ef -/tool-schema-catalog/deepseek-ai-dsh-tool-office/office-render: - en: b5e52a86c0a3c122 - zh: 636810250e6a0aaf + en: e06cdcaf38406fcb + zh: 491d708f0d55fce4 +/tool-schema-catalog/deepseek-ai-dsh-tool-document: + en: aa478f8af83beda6 + zh: aa478f8af83beda6 +/tool-schema-catalog/deepseek-ai-dsh-tool-document/document-convert: + en: 5151990d020481ad + zh: 9080944bb0b34dc1 +/tool-schema-catalog/deepseek-ai-dsh-tool-document/document-recalculate: + en: ef9a10084bff2772 + zh: 44fca9e64208a120 +/tool-schema-catalog/deepseek-ai-dsh-tool-document/document-render: + en: 277fa2f93bc161c9 + zh: c295989ef693bf80 /tool-schema-catalog/deepseek-ai-dsh-tool-present: en: f656575e6df094f6 zh: f656575e6df094f6 diff --git a/docs/tool-catalog.md b/docs/tool-catalog.md index 730484eb4b..62c2db4243 100644 --- a/docs/tool-catalog.md +++ b/docs/tool-catalog.md @@ -25,7 +25,7 @@ This table connects model-visible tool names to the plugin package and service s | `@deepseek-ai/dsh-tool-executor-ptc` | `run_code` | `ctx.workingDirectory (Agent executions)`, `ctx.tools`, `ctx.ptcRuntime`, `ctx.systemPrompt` | `tool/call`, `one tool/ptc-dispatch-start + tool/ptc-dispatch pair per bridged sub-call`, `tool/result` | - | The PTC executor exposes only run_code to the model and declares other visible capabilities in a generated TypeScript SDK. Program bindings enter the shared guarded tool pipeline in submission order; concurrency-safe bodies overlap up to maxParallelSubCalls, and nested results remain linked to the outer program. The resolved timeout and maxSubCallsPerMinute set the total call allowance; exceeding it terminates the program. | | `@deepseek-ai/dsh-plan-mode` | `exit_plan_mode` | `ctx.tools`, `ctx.systemPrompt`, `ctx.agents`, `ctx.userQuestions (execution time, opportunistic)` | `tool/call`, `plan/mode inactive on an approved review`, `tool/result` | - | exit_plan_mode stays in the model-facing schema while planning is inactive so transitions add no tool-catalog churn on top of the plan-policy change. Its execute path rejects calls outside plan mode; in plan mode it presents the plan over the user-questions seam (approve / keep planning with feedback), and approval logs plan mode inactive at the step boundary. | | `@deepseek-ai/dsh-tool-bash` | `bash` | `ctx.workingDirectory`, `ctx.tools`, `ctx.shell`, `ctx.systemPrompt`, `ctx.shellEnv`, `ctx.jobs for run_in_background and the job-backed foreground path` | `tool/call`, `tool/result` | - | The bash tool is the model-facing consumer of the bash executor seam. With a job registry composed every call registers with the generic `ctx.jobs` runtime as it starts, collected/stopped through the `job_*` tools from `@deepseek-ai/dsh-tool-jobs`; without one, or with `enableRunInBackground: false`, the tool registers a foreground-only schema without the `run_in_background` parameter. | -| `@deepseek-ai/dsh-tool-office` | `office_convert`, `office_recalculate`, `office_render` | `ctx.workingDirectory`, `ctx.tools`, `ctx.fs`, `ctx.agents`, `ctx.officeKit`, `ctx.attachments and ctx.llm for office_render` | `tool/call`, `tool/result with rendered image attachments`, `temporary converted files in the Office kit output store` | - | Declared to an Agent from the step after it successfully loads an Office skill, and kept while the previous request header declares an Office tool. Admitted calls fail with the Office service's unavailable error when LibreOffice Kit is not installed. | +| `@deepseek-ai/dsh-tool-document` | `document_convert`, `document_recalculate`, `document_render` | `ctx.workingDirectory`, `ctx.tools`, `ctx.fs`, `ctx.agents`, `ctx.officeKit`, `ctx.attachments and ctx.llm for document_render` | `tool/call`, `tool/result with rendered image attachments`, `temporary converted files in the Office kit output store` | - | Declared to an Agent from the step after it successfully loads an Office skill, and kept while the previous request header declares an Office tool. Admitted calls fail with the Office service's unavailable error when LibreOffice Kit is not installed. | | `@deepseek-ai/dsh-tool-present` | `present` | `ctx.workingDirectory`, `ctx.tools`, `ctx.fs`, `ctx.agents` | `tool/call`, `deliverables/presented after a successful final result`, `tool/result` | - | Deliveries belong to the calling Session; Web ui-deliverables supplies source-file opening and cards. | | `@deepseek-ai/dsh-tool-pwsh` | `pwsh` | `ctx.workingDirectory`, `ctx.tools`, `ctx.shell`, `ctx.systemPrompt`, `ctx.shellEnv`, `ctx.jobs for run_in_background and the job-backed foreground path` | `tool/call`, `tool/result` | - | The pwsh tool is the PowerShell-dialect consumer of the bash executor seam for Windows compositions (a PowerShell executor such as `@deepseek-ai/dsh-pwsh-local` backs `ctx.shell`); it mirrors the bash tool call-for-call minus sandbox controls — `run_in_background` runs register with the generic `ctx.jobs` runtime and are collected/stopped through the `job_*` tools, and the managed `DSH_*` environment comes from `@deepseek-ai/dsh-shell-env`. Each call runs in a fresh process (no persistent PTY session), with native `C:\...` paths and `$env:NAME` variables. | | `@deepseek-ai/dsh-tool-cordis` | `cordis_inspect` | `ctx.tools`, `ctx.cordisInspect` | `tool/call`, `tool/result` | - | The Desktop Standard and Creator modes and the SDK profile provide one read-only runtime inspection tool. Omit query for the provider directory; pass query to inspect a declared method. The Cordis host runner supplies the inspection registry; Client queries require a connected page. Author persistent changes as bundles and install them with plugin_manager. | @@ -951,11 +951,11 @@ Source: [`packages/shell/tool-bash/src/index.ts`](../packages/shell/tool-bash/sr The bash tool is the model-facing consumer of the bash executor seam. With a job registry composed every call registers with the generic `ctx.jobs` runtime as it starts, collected/stopped through the `job_*` tools from `@deepseek-ai/dsh-tool-jobs`; without one, or with `enableRunInBackground: false`, the tool registers a foreground-only schema without the `run_in_background` parameter. - + -## `@deepseek-ai/dsh-tool-office` +## `@deepseek-ai/dsh-tool-document` -### `office_convert` +### `document_convert` Convert a document to another format. Return a temporary file to copy to its destination with the shell. @@ -994,9 +994,9 @@ Convert a document to another format. Return a temporary file to copy to its des } ``` -Source: [`packages/document/tool-office/src/index.ts`](../packages/document/tool-office/src/index.ts) +Source: [`packages/document/tool-document/src/index.ts`](../packages/document/tool-document/src/index.ts) -### `office_recalculate` +### `document_recalculate` Recalculate spreadsheet formulas. Return a temporary workbook to copy to its destination with the shell. @@ -1024,9 +1024,9 @@ Recalculate spreadsheet formulas. Return a temporary workbook to copy to its des } ``` -Source: [`packages/document/tool-office/src/index.ts`](../packages/document/tool-office/src/index.ts) +Source: [`packages/document/tool-document/src/index.ts`](../packages/document/tool-document/src/index.ts) -### `office_render` +### `document_render` Render document pages, slides, or worksheet areas as images you can view. @@ -1072,7 +1072,7 @@ Render document pages, slides, or worksheet areas as images you can view. } ``` -Source: [`packages/document/tool-office/src/index.ts`](../packages/document/tool-office/src/index.ts) +Source: [`packages/document/tool-document/src/index.ts`](../packages/document/tool-document/src/index.ts) Declared to an Agent from the step after it successfully loads an Office skill, and kept while the previous request header declares an Office tool. Admitted calls fail with the Office service's unavailable error when LibreOffice Kit is not installed. diff --git a/docs/tool-catalog.zh.md b/docs/tool-catalog.zh.md index 7f36dcee80..e3d74d558c 100644 --- a/docs/tool-catalog.zh.md +++ b/docs/tool-catalog.zh.md @@ -29,7 +29,7 @@ | `@deepseek-ai/dsh-tool-executor-ptc` | `run_code` | `ctx.workingDirectory (Agent executions)`、`ctx.tools`、`ctx.ptcRuntime`、`ctx.systemPrompt` | `tool/call`、`one tool/ptc-dispatch-start + tool/ptc-dispatch pair per bridged sub-call`、`tool/result` | - | PTC 执行器只向模型公开 run_code,并在生成的 TypeScript SDK 中声明其他可见能力。程序绑定按提交顺序进入共享的受守卫工具流水线;并行安全的函数体最多重叠 maxParallelSubCalls 个,嵌套结果保持与外层程序关联。最终超时时间与 maxSubCallsPerMinute 决定调用总额度;超限会终止程序。 | | `@deepseek-ai/dsh-plan-mode` | `exit_plan_mode` | `ctx.tools`、`ctx.systemPrompt`、`ctx.agents`、`ctx.userQuestions (execution time, opportunistic)` | `tool/call`、`plan/mode inactive on an approved review`、`tool/result` | - | 规划未激活时,exit_plan_mode 仍保留在面向模型的 schema 中,这样状态转换不会在规划策略变更之外额外造成工具目录变动。其执行路径会拒绝规划模式之外的调用;在规划模式下,它通过用户交互 seam 提交计划(批准/根据反馈继续规划),批准后会在步骤边界记录规划模式已停用。 | | `@deepseek-ai/dsh-tool-bash` | `bash` | `ctx.workingDirectory`、`ctx.tools`、`ctx.shell`、`ctx.systemPrompt`、`ctx.shellEnv`、`ctx.jobs for run_in_background and the job-backed foreground path` | `tool/call`、`tool/result` | - | bash 工具是 bash 执行器 seam 面向模型的消费方。组合中有 job 注册表时,每次调用一启动就注册到通用 `ctx.jobs` 运行时,并通过 `job_*` 工具(来自 `@deepseek-ai/dsh-tool-jobs`)收集/停止;没有注册表或 `enableRunInBackground: false` 时,工具注册不带 `run_in_background` 参数的纯前台 schema。 | -| `@deepseek-ai/dsh-tool-office` | `office_convert`、`office_recalculate`、`office_render` | `ctx.workingDirectory`、`ctx.tools`、`ctx.fs`、`ctx.agents`、`ctx.officeKit`、`ctx.attachments and ctx.llm for office_render` | `tool/call`、`tool/result with rendered image attachments`、`temporary converted files in the Office kit output store` | - | Agent 成功加载 Office 技能后,从下一步起向其声明这些工具;上一次请求头已声明 Office 工具时继续保留。未安装 LibreOffice Kit 时,已声明工具的调用以 Office 服务的 unavailable 错误失败。 | +| `@deepseek-ai/dsh-tool-document` | `document_convert`、`document_recalculate`、`document_render` | `ctx.workingDirectory`、`ctx.tools`、`ctx.fs`、`ctx.agents`、`ctx.officeKit`、`ctx.attachments and ctx.llm for document_render` | `tool/call`、`tool/result with rendered image attachments`、`temporary converted files in the Office kit output store` | - | Agent 成功加载 Office 技能后,从下一步起向其声明这些工具;上一次请求头已声明 Office 工具时继续保留。未安装 LibreOffice Kit 时,已声明工具的调用以 Office 服务的 unavailable 错误失败。 | | `@deepseek-ai/dsh-tool-present` | `present` | `ctx.workingDirectory`、`ctx.tools`, `ctx.fs`, `ctx.agents` | `tool/call`, `deliverables/presented 在成功的最终结果之后`, `tool/result` | - | 交付归调用方 Session 所有;Web ui-deliverables 提供源文件打开与卡片。 | | `@deepseek-ai/dsh-tool-pwsh` | `pwsh` | `ctx.workingDirectory`、`ctx.tools`、`ctx.shell`、`ctx.systemPrompt`、`ctx.shellEnv`、`ctx.jobs for run_in_background and the job-backed foreground path` | `tool/call`、`tool/result` | - | pwsh 工具是 Windows 组合中 bash 执行器 seam 的 PowerShell 方言消费方(由 `@deepseek-ai/dsh-pwsh-local` 等 PowerShell 执行器为 `ctx.shell` 提供后端);除沙箱接口外,它逐项对应 bash 工具调用。使用 `run_in_background` 的运行会注册到通用 `ctx.jobs` 运行时,并通过 `job_*` 工具收集/停止;托管的 `DSH_*` 环境来自 `@deepseek-ai/dsh-shell-env`。每次调用都在新进程中运行,不使用持久 PTY 会话。路径采用原生 `C:\...` 形式,变量采用 `$env:NAME`。 | | `@deepseek-ai/dsh-tool-cordis` | `cordis_inspect` | `ctx.tools`, `ctx.cordisInspect` | `tool/call`, `tool/result` | - | Desktop 标准模式、创造模式和 SDK profile 提供一个只读运行时检查工具。省略 query 获取 provider 目录;传入 query 查询已声明的方法。Cordis host runner 提供检查注册表;Client 查询需要已连接页面。持久化变更编写为组合包,再通过 plugin_manager 安装。 | @@ -955,11 +955,11 @@ PTC 执行器只向模型公开 run_code,并在生成的 TypeScript SDK 中声 bash 工具是 bash 执行器 seam 面向模型的消费方。组合中有 job 注册表时,每次调用一启动就注册到通用 `ctx.jobs` 运行时,并通过 `job_*` 工具(来自 `@deepseek-ai/dsh-tool-jobs`)收集/停止;没有注册表或 `enableRunInBackground: false` 时,工具注册不带 `run_in_background` 参数的纯前台 schema。 - + -## `@deepseek-ai/dsh-tool-office` +## `@deepseek-ai/dsh-tool-document` -### `office_convert` +### `document_convert` 将文档转换为另一种格式。返回一个临时文件,用 shell 将其复制到目标位置。 @@ -998,9 +998,9 @@ bash 工具是 bash 执行器 seam 面向模型的消费方。组合中有 job } ``` -来源: [`packages/document/tool-office/src/index.ts`](../packages/document/tool-office/src/index.ts) +来源: [`packages/document/tool-document/src/index.ts`](../packages/document/tool-document/src/index.ts) -### `office_recalculate` +### `document_recalculate` 重算电子表格公式。返回一个临时工作簿,用 shell 将其复制到目标位置。 @@ -1028,9 +1028,9 @@ bash 工具是 bash 执行器 seam 面向模型的消费方。组合中有 job } ``` -来源: [`packages/document/tool-office/src/index.ts`](../packages/document/tool-office/src/index.ts) +来源: [`packages/document/tool-document/src/index.ts`](../packages/document/tool-document/src/index.ts) -### `office_render` +### `document_render` 将文档页面、幻灯片或工作表区域渲染为你可以查看的图片。 @@ -1076,7 +1076,7 @@ bash 工具是 bash 执行器 seam 面向模型的消费方。组合中有 job } ``` -来源: [`packages/document/tool-office/src/index.ts`](../packages/document/tool-office/src/index.ts) +来源: [`packages/document/tool-document/src/index.ts`](../packages/document/tool-document/src/index.ts) Agent 成功加载 Office 技能后,从下一步起向其声明这些工具;上一次请求头已声明 Office 工具时继续保留。未安装 LibreOffice Kit 时,已声明工具的调用以 Office 服务的 unavailable 错误失败。 diff --git a/docs/upgrade-guide/v0.2.2-alpha.3/office-operation-tools/guide.i18n.yaml b/docs/upgrade-guide/v0.2.2-alpha.3/office-operation-tools/guide.i18n.yaml index 917ca71205..76a3a1cde3 100644 --- a/docs/upgrade-guide/v0.2.2-alpha.3/office-operation-tools/guide.i18n.yaml +++ b/docs/upgrade-guide/v0.2.2-alpha.3/office-operation-tools/guide.i18n.yaml @@ -9,8 +9,8 @@ en: 6c5aaef399e15878 zh: 92c4ae1a8d812790 /office-operation-skills-are-replaced-by-office-tools/change: - en: 1d12b14e002bcf3b - zh: ac844c2aeb9f9053 + en: c1200ab4e55f12ff + zh: b6a6b04b0ab0d352 /office-operation-skills-are-replaced-by-office-tools/migration: en: 9646620e0c4636c3 zh: be896458a90937ba diff --git a/docs/upgrade-guide/v0.2.2-alpha.3/office-operation-tools/guide.md b/docs/upgrade-guide/v0.2.2-alpha.3/office-operation-tools/guide.md index ec051d8535..caac979f31 100644 --- a/docs/upgrade-guide/v0.2.2-alpha.3/office-operation-tools/guide.md +++ b/docs/upgrade-guide/v0.2.2-alpha.3/office-operation-tools/guide.md @@ -9,7 +9,7 @@ English | [中文](guide.zh.md) ## Change -`@deepseek-ai/dsh-skill-office` no longer registers the `office-render`, `office-recalculate`, and `office-export-pdf` skills; it registers the `office` router and the `office-docx`, `office-pptx`, and `office-xlsx` authoring skills. After an Office skill loads, the model calls [`office_render`, `office_convert`, and `office_recalculate`](../../../../packages/document/tool-office/README.md) from the following step. +`@deepseek-ai/dsh-skill-office` no longer registers the `office-render`, `office-recalculate`, and `office-export-pdf` skills; it registers the `office` router and the `office-docx`, `office-pptx`, and `office-xlsx` authoring skills. After an Office skill loads, the model calls [`office_render`, `office_convert`, and `office_recalculate`](../../../../packages/document/tool-document/README.md) from the following step. Configuration changes: diff --git a/docs/upgrade-guide/v0.2.2-alpha.3/office-operation-tools/guide.zh.md b/docs/upgrade-guide/v0.2.2-alpha.3/office-operation-tools/guide.zh.md index 5fc9a4c495..17bb8848d3 100644 --- a/docs/upgrade-guide/v0.2.2-alpha.3/office-operation-tools/guide.zh.md +++ b/docs/upgrade-guide/v0.2.2-alpha.3/office-operation-tools/guide.zh.md @@ -9,7 +9,7 @@ description: "删除 `office-render`、`office-recalculate` 和 `office-export-p ## 变更 -`@deepseek-ai/dsh-skill-office` 不再注册 `office-render`、`office-recalculate` 和 `office-export-pdf` 技能,只注册 `office` 路由技能,以及 `office-docx`、`office-pptx` 和 `office-xlsx` 编写技能。加载 Office 技能后,模型从下一步起调用 [`office_render`、`office_convert` 和 `office_recalculate`](../../../../packages/document/tool-office/README.zh.md)。 +`@deepseek-ai/dsh-skill-office` 不再注册 `office-render`、`office-recalculate` 和 `office-export-pdf` 技能,只注册 `office` 路由技能,以及 `office-docx`、`office-pptx` 和 `office-xlsx` 编写技能。加载 Office 技能后,模型从下一步起调用 [`office_render`、`office_convert` 和 `office_recalculate`](../../../../packages/document/tool-document/README.zh.md)。 配置变化: diff --git a/docs/upgrade-guide/v0.2.2-rc.5/office-single-skill/guide.i18n.yaml b/docs/upgrade-guide/v0.2.2-rc.5/office-single-skill/guide.i18n.yaml index 681f3e5757..2ac6fec23b 100644 --- a/docs/upgrade-guide/v0.2.2-rc.5/office-single-skill/guide.i18n.yaml +++ b/docs/upgrade-guide/v0.2.2-rc.5/office-single-skill/guide.i18n.yaml @@ -9,8 +9,8 @@ en: 8191b30b9455ad3c zh: 85983139af027483 /one-bundled-office-skill-replaces-the-office-format-skills/change: - en: 73c9ebacd1f5e133 - zh: 4fd8085aba17e86c + en: 69f996f9854c126f + zh: 3b33bd119d094e88 /one-bundled-office-skill-replaces-the-office-format-skills/migration: en: f0af39354077fc2c zh: 6b2f84cea517c22c diff --git a/docs/upgrade-guide/v0.2.2-rc.5/office-single-skill/guide.md b/docs/upgrade-guide/v0.2.2-rc.5/office-single-skill/guide.md index 21fa38a139..c3a0009a30 100644 --- a/docs/upgrade-guide/v0.2.2-rc.5/office-single-skill/guide.md +++ b/docs/upgrade-guide/v0.2.2-rc.5/office-single-skill/guide.md @@ -16,7 +16,7 @@ This affects: - users who typed `/office-docx`, `/office-pptx`, or `/office-xlsx`: those commands no longer exist; - users who defined a skill named `office-docx`, `office-pptx`, or `office-xlsx`, for example under `~/.dsh/skills/`, to override the bundled guidance: the bundled `office` skill no longer loads those names, so the definition becomes an ordinary separate skill and no longer replaces any bundled content; - custom `assetRoot` directories, which now need only `office/SKILL.md`; -- compositions that rely on the default `activationSkills` of [`@deepseek-ai/dsh-tool-office`](../../../../packages/document/tool-office/README.md): the default changed from `[office, office-docx, office-xlsx, office-pptx]` to `[office]`, so loading a skill named `office-docx` no longer activates `office_render`, `office_convert`, and `office_recalculate`. +- compositions that rely on the default `activationSkills` of [`@deepseek-ai/dsh-tool-office`](../../../../packages/document/tool-document/README.md): the default changed from `[office, office-docx, office-xlsx, office-pptx]` to `[office]`, so loading a skill named `office-docx` no longer activates `office_render`, `office_convert`, and `office_recalculate`. ## Migration diff --git a/docs/upgrade-guide/v0.2.2-rc.5/office-single-skill/guide.zh.md b/docs/upgrade-guide/v0.2.2-rc.5/office-single-skill/guide.zh.md index f2f2ef4fba..ddc514db50 100644 --- a/docs/upgrade-guide/v0.2.2-rc.5/office-single-skill/guide.zh.md +++ b/docs/upgrade-guide/v0.2.2-rc.5/office-single-skill/guide.zh.md @@ -16,7 +16,7 @@ description: "内置的 office-docx、office-pptx 和 office-xlsx 技能已移 - 输入过 `/office-docx`、`/office-pptx` 或 `/office-xlsx` 的用户:这些命令已不存在; - 定义了名为 `office-docx`、`office-pptx` 或 `office-xlsx` 的技能(例如位于 `~/.dsh/skills/` 下)以覆盖内置指导的用户:内置 `office` 技能不再加载这些名字,因此这类定义成为普通的独立技能,不再替换任何内置内容; - 自定义的 `assetRoot` 目录:现在只需包含 `office/SKILL.md`; -- 依赖 [`@deepseek-ai/dsh-tool-office`](../../../../packages/document/tool-office/README.zh.md) 默认 `activationSkills` 的组合:默认值由 `[office, office-docx, office-xlsx, office-pptx]` 改为 `[office]`,因此加载名为 `office-docx` 的技能不再激活 `office_render`、`office_convert` 和 `office_recalculate`。 +- 依赖 [`@deepseek-ai/dsh-tool-office`](../../../../packages/document/tool-document/README.zh.md) 默认 `activationSkills` 的组合:默认值由 `[office, office-docx, office-xlsx, office-pptx]` 改为 `[office]`,因此加载名为 `office-docx` 的技能不再激活 `office_render`、`office_convert` 和 `office_recalculate`。 ## 迁移 diff --git a/docs/upgrade-guide/v0.2.3-alpha.2/office-tools-renamed-document/guide.i18n.yaml b/docs/upgrade-guide/v0.2.3-alpha.2/office-tools-renamed-document/guide.i18n.yaml new file mode 100644 index 0000000000..c630f74bd7 --- /dev/null +++ b/docs/upgrade-guide/v0.2.3-alpha.2/office-tools-renamed-document/guide.i18n.yaml @@ -0,0 +1,16 @@ +# Bilingual-pair consistency record for guide.md (docs/i18n/README.md): per heading +# section, a hash of its English and Chinese blocks outside code blocks and generated regions. +# After editing either side, bring the other along and re-record with: +# pnpm run verify-translation-pairing --write docs/upgrade-guide/v0.2.3-alpha.2/office-tools-renamed-document/guide.md +/: + en: e4dc42b8eaeb8ba4 + zh: 7754a24fde73bb24 +/dsh-tool-office-becomes-dsh-tool-document-with-document-tools: + en: 2f035ba61a470c44 + zh: cc9d078574f1ee60 +/dsh-tool-office-becomes-dsh-tool-document-with-document-tools/change: + en: 0ffd06a2084ac7a0 + zh: b6c33cdb732e0af2 +/dsh-tool-office-becomes-dsh-tool-document-with-document-tools/migration: + en: 325f3cf957017d20 + zh: 871e8ab52b6fdb0c diff --git a/docs/upgrade-guide/v0.2.3-alpha.2/office-tools-renamed-document/guide.md b/docs/upgrade-guide/v0.2.3-alpha.2/office-tools-renamed-document/guide.md new file mode 100644 index 0000000000..9fcf399585 --- /dev/null +++ b/docs/upgrade-guide/v0.2.3-alpha.2/office-tools-renamed-document/guide.md @@ -0,0 +1,21 @@ +--- +kind: upgrade-guide +description: "The dsh-tool-office package and its office_render, office_convert, and office_recalculate tools are renamed to dsh-tool-document and document_render, document_convert, and document_recalculate." +--- + +# `dsh-tool-office` becomes `dsh-tool-document` with `document_*` tools + +English | [中文](guide.zh.md) + +## Change + +In 0.2.3-alpha.2, the Office tools came from `@deepseek-ai/dsh-tool-office`, mounted as row `tool-office`, and the model called `office_render`, `office_convert`, and `office_recalculate`. The package is now [`@deepseek-ai/dsh-tool-document`](../../../../packages/document/tool-document/README.md), the shipped rows use the id `tool-document`, and the tools are `document_render`, `document_convert`, and `document_recalculate`. Parameters, results, error codes, and the `office` activation skill are unchanged. + +Affected: `cordis.yml`, profile patches, overlays, and saved or custom agent presets that name `@deepseek-ai/dsh-tool-office` or patch the row `tool-office`, which no longer resolve; and tool allowlists, guard or approval rules, hooks, and scripts that match the `office_*` tool names, which no longer match. Sessions recorded before the upgrade still resume: a request header that declares an `office_*` tool keeps the renamed tools active, and the Web transcript shows earlier `office_*` calls as Office rows. + +## Migration + +1. Replace `@deepseek-ai/dsh-tool-office` with `@deepseek-ai/dsh-tool-document` in every `cordis.yml`, `cordis.patch.yml`, overlay, `package.json`, and import, including `$DSH_HOME/profiles//cordis.patch.yml`. +2. Change patch rows that target `id: tool-office`, such as `- {id: tool-office, config: {activationSkills: [office]}}`, to `id: tool-document`. For a Web or Desktop preset edited in the Agent presets settings page, open the preset and confirm that its Office tools row names `@deepseek-ai/dsh-tool-document`. +3. Rename `office_render`, `office_convert`, and `office_recalculate` to `document_render`, `document_convert`, and `document_recalculate` in tool allowlists, preset tool lists, guard and approval rules, hooks, and scripts that inspect tool calls. +4. Confirm with `dsh --profile --dump-config` that a `tool-document` row appears and no row names `@deepseek-ai/dsh-tool-office`, then load the `office` skill in a new Session and check that the next request declares the three `document_*` tools. diff --git a/docs/upgrade-guide/v0.2.3-alpha.2/office-tools-renamed-document/guide.zh.md b/docs/upgrade-guide/v0.2.3-alpha.2/office-tools-renamed-document/guide.zh.md new file mode 100644 index 0000000000..8f8642ae91 --- /dev/null +++ b/docs/upgrade-guide/v0.2.3-alpha.2/office-tools-renamed-document/guide.zh.md @@ -0,0 +1,21 @@ +--- +kind: upgrade-guide +description: "dsh-tool-office 包及其 office_render、office_convert、office_recalculate 工具改名为 dsh-tool-document 和 document_render、document_convert、document_recalculate。" +--- + +# `dsh-tool-office` 改为 `dsh-tool-document`,工具改为 `document_*` + +[English](guide.md) | 中文 + +## 变更 + +在 0.2.3-alpha.2 中,Office 工具来自 `@deepseek-ai/dsh-tool-office`,以 `tool-office` 行挂载,模型调用 `office_render`、`office_convert` 和 `office_recalculate`。现在包名为 [`@deepseek-ai/dsh-tool-document`](../../../../packages/document/tool-document/README.zh.md),内置行的 id 为 `tool-document`,工具为 `document_render`、`document_convert` 和 `document_recalculate`。参数、结果、错误码和用于激活的 `office` 技能都不变。 + +受影响的有:引用 `@deepseek-ai/dsh-tool-office` 或给 `tool-office` 行打补丁的 `cordis.yml`、profile patch、overlay,以及已保存或自定义的 Agent 预设,它们将无法解析;按 `office_*` 工具名匹配的工具白名单、guard 或审批规则、hooks 和脚本,它们将不再匹配。升级前记录的 Session 仍可恢复:请求头中声明了 `office_*` 工具时,改名后的工具仍会激活,Web 对话记录也仍把之前的 `office_*` 调用显示为 Office 行。 + +## 迁移 + +1. 在每个 `cordis.yml`、`cordis.patch.yml`、overlay、`package.json` 和 import 中,把 `@deepseek-ai/dsh-tool-office` 换成 `@deepseek-ai/dsh-tool-document`,包括 `$DSH_HOME/profiles//cordis.patch.yml`。 +2. 把以 `id: tool-office` 为目标的补丁行(例如 `- {id: tool-office, config: {activationSkills: [office]}}`)改为 `id: tool-document`。在 Agent 预设设置页编辑过的 Web 或 Desktop 预设,打开该预设并确认其 Office 工具行引用的是 `@deepseek-ai/dsh-tool-document`。 +3. 在工具白名单、预设工具列表、guard 与审批规则、hooks 以及检查工具调用的脚本中,把 `office_render`、`office_convert`、`office_recalculate` 改为 `document_render`、`document_convert`、`document_recalculate`。 +4. 用 `dsh --profile --dump-config` 确认出现 `tool-document` 行且没有行引用 `@deepseek-ai/dsh-tool-office`,然后在新 Session 中加载 `office` 技能,检查下一次请求声明了三个 `document_*` 工具。 diff --git a/packages/bundle/sdk-app/README.i18n.yaml b/packages/bundle/sdk-app/README.i18n.yaml index 6ad2106d24..fa43bfc480 100644 --- a/packages/bundle/sdk-app/README.i18n.yaml +++ b/packages/bundle/sdk-app/README.i18n.yaml @@ -15,8 +15,8 @@ en: 4e53164159b5ce41 zh: 89582dc0294d0776 /deepseek-ai-dsh-sdk-app/use-this-package: - en: e944356b31ce1a3a - zh: 7267591b38991c30 + en: 543347685eda663a + zh: aa9798b71036ab09 /deepseek-ai-dsh-sdk-app/model-experience: en: 215e7ba838619b7b zh: a311da3843709f90 diff --git a/packages/bundle/sdk-app/README.md b/packages/bundle/sdk-app/README.md index 5d2c7bba94..36349077d1 100644 --- a/packages/bundle/sdk-app/README.md +++ b/packages/bundle/sdk-app/README.md @@ -37,7 +37,7 @@ The SDK uses the base `read`, `write`, and `edit` defaults. To add `str_replace_ The model can use [`plugin_manager`](../../boot/plugin-manager/README.md) in native and PTC modes. Every action, including listing, requires full access or approval for that call. The default workspace-write/ask policy needs a client approval responder: enable `approvalRequests` and handle `approval/request` through `harness.client.onRequest()`, or supply an approver in the composition. Without one, the operation is refused as unavailable. For Python package installation/removal, explicitly prepare Node and pnpm with `download_primary_runtime()` before starting the runtime; the packaged launcher then supplies them to plugin management without requiring system pnpm. Without a selected payload, package operations need `pnpm` on `PATH` or an explicit `plugin-manager.pnpmCommand`. See the [interactive approval example](../../../python/sdk/examples/manage_plugins.py). Saved profile changes report `restart-required` with `no-hmr`; the current runtime and its sessions retain their tools until the caller closes and starts the runtime again. Set `tool-plugin-manager.disabled: true` through a profile patch to hide this tool. The standalone `sdk-minimal` profile does not include it. -The Python runtime exposes explicitly downloaded authoring resources and Office sidecars to this profile. `DSH_PRIMARY_RUNTIME` overrides the authoring payload; an empty value disables its query. Office skills, the Office kit, and the [Office tools](../../document/tool-office/README.md) always load. The skills use their packaged assets; with an authoring payload they direct the model to its bundled Python environment, and without one to the user's existing Python. The tool reports an unavailable LibreOffice Kit until an Office sidecar is downloaded or selected. Profile patches can disable `skill-office` or replace its `assetRoot` independently of `workspace-dependencies`; filesystem skills with the same name take precedence. See the [runtime package](../../../python/sdk-runtime/README.md) for downloads and configuration. +The Python runtime exposes explicitly downloaded authoring resources and Office sidecars to this profile. `DSH_PRIMARY_RUNTIME` overrides the authoring payload; an empty value disables its query. Office skills, the Office kit, and the [Office tools](../../document/tool-document/README.md) always load. The skills use their packaged assets; with an authoring payload they direct the model to its bundled Python environment, and without one to the user's existing Python. The tool reports an unavailable LibreOffice Kit until an Office sidecar is downloaded or selected. Profile patches can disable `skill-office` or replace its `assetRoot` independently of `workspace-dependencies`; filesystem skills with the same name take precedence. See the [runtime package](../../../python/sdk-runtime/README.md) for downloads and configuration. The standard SDK profile lists `official-plugins` and `personalized-pages` by default. A proposal reaches the caller as a fenced `action-card` block in the final response. For training, pass a YAML patch containing `- {id: action-cards, config: {enabled: false}}` to omit both skills from the catalog and prevent loading them by name. diff --git a/packages/bundle/sdk-app/README.zh.md b/packages/bundle/sdk-app/README.zh.md index 57e10dd052..50a35890fe 100644 --- a/packages/bundle/sdk-app/README.zh.md +++ b/packages/bundle/sdk-app/README.zh.md @@ -37,7 +37,7 @@ SDK 使用 base 默认提供的 `read`、`write` 和 `edit`。要添加 `str_rep 模型可以在 native 和 PTC 模式下使用 [`plugin_manager`](../../boot/plugin-manager/README.zh.md)。每个操作(包括列举)都要求完整权限或本次调用的批准。默认 workspace-write/ask 策略需要客户端审批应答方:启用 `approvalRequests`,并通过 `harness.client.onRequest()` 处理 `approval/request`,或在组合中提供审批器。没有应答方时,操作因 unavailable 被拒绝。Python 安装/移除包时,先显式调用 `download_primary_runtime()` 准备 Node 和 pnpm,再启动运行时;打包启动器会将它们提供给插件管理,无需系统 pnpm。未选择载荷时,包操作仍要求 `PATH` 中有 `pnpm`,或显式配置 `plugin-manager.pnpmCommand`。可运行的接入方式见[交互审批示例](../../../python/sdk/examples/manage_plugins.py)。保存的 profile 变更返回 `restart-required` 和 `no-hmr`;当前运行时及其会话保留原有工具,直到调用方关闭并重新启动运行时。通过 profile patch 设置 `tool-plugin-manager.disabled: true` 可隐藏此工具。独立的 `sdk-minimal` profile 不包含它。 -Python 运行时向本 profile 提供显式下载的创作资源和 Office sidecar。`DSH_PRIMARY_RUNTIME` 覆盖创作载荷;空值禁用其查询。Office skills、Office 套件和 [Office 工具](../../document/tool-office/README.zh.md)总是加载。skills 使用包内 assets;有创作载荷时指引模型使用其内置 Python 环境,没有时指引模型使用用户已有的 Python。下载或选择 Office sidecar 之前,工具报告 LibreOffice Kit 不可用。Profile patch 可独立于 `workspace-dependencies` 禁用 `skill-office` 或替换其 `assetRoot`;同名文件系统 skills 优先。下载与配置见[运行时包](../../../python/sdk-runtime/README.zh.md)。 +Python 运行时向本 profile 提供显式下载的创作资源和 Office sidecar。`DSH_PRIMARY_RUNTIME` 覆盖创作载荷;空值禁用其查询。Office skills、Office 套件和 [Office 工具](../../document/tool-document/README.zh.md)总是加载。skills 使用包内 assets;有创作载荷时指引模型使用其内置 Python 环境,没有时指引模型使用用户已有的 Python。下载或选择 Office sidecar 之前,工具报告 LibreOffice Kit 不可用。Profile patch 可独立于 `workspace-dependencies` 禁用 `skill-office` 或替换其 `assetRoot`;同名文件系统 skills 优先。下载与配置见[运行时包](../../../python/sdk-runtime/README.zh.md)。 标准 SDK profile 默认列出 `official-plugins` 和 `personalized-pages`。调用方在最终回答中收到 `action-card` 围栏代码块。训练时可传入含有 `- {id: action-cards, config: {enabled: false}}` 的 YAML patch,同时从目录移除这两个 Skill 并关闭按名加载。 diff --git a/packages/bundle/sdk-app/cordis.patch.yml b/packages/bundle/sdk-app/cordis.patch.yml index 536e5e90de..1ea71d83c8 100644 --- a/packages/bundle/sdk-app/cordis.patch.yml +++ b/packages/bundle/sdk-app/cordis.patch.yml @@ -49,8 +49,8 @@ outputDirectory: !!js dshHomePath('office-kit', 'outputs') # The Office tools stay registered without Kit; calls report the service's unavailable error. - - id: tool-office - name: '@deepseek-ai/dsh-tool-office' + - id: tool-document + name: '@deepseek-ai/dsh-tool-document' - id: workspace-dependencies name: '@deepseek-ai/dsh-tool-workspace-dependencies' diff --git a/packages/bundle/sdk-app/package.json b/packages/bundle/sdk-app/package.json index 4134267165..9b173ffbe2 100644 --- a/packages/bundle/sdk-app/package.json +++ b/packages/bundle/sdk-app/package.json @@ -46,7 +46,7 @@ "@deepseek-ai/dsh-office-kit": "workspace:*", "@deepseek-ai/dsh-plugin-recommendations": "workspace:*", "@deepseek-ai/dsh-sdk-jsonrpc-server": "workspace:*", - "@deepseek-ai/dsh-tool-office": "workspace:*", + "@deepseek-ai/dsh-tool-document": "workspace:*", "@deepseek-ai/schemastery": "workspace:~", "commander": "^15.0.0", "@deepseek-ai/dsh-skill-office": "workspace:*", diff --git a/packages/bundle/web-app/README.i18n.yaml b/packages/bundle/web-app/README.i18n.yaml index 107bc6915e..577e50f818 100644 --- a/packages/bundle/web-app/README.i18n.yaml +++ b/packages/bundle/web-app/README.i18n.yaml @@ -33,8 +33,8 @@ en: 99557925a59aee67 zh: e2160750bd65505a /deepseek-ai-dsh-web-app/understand-the-implementation: - en: 567cf3afa68e6b68 - zh: f065cdb56c28d4e6 + en: ab8b8cac14e02a7e + zh: 6435120e7d479e15 /deepseek-ai-dsh-web-app/understand-the-implementation/patch-semantics: en: a6d126f30b1594d7 zh: 7f0ccc8a55d6f743 diff --git a/packages/bundle/web-app/README.md b/packages/bundle/web-app/README.md index 29fc22b25d..0084c5e70e 100644 --- a/packages/bundle/web-app/README.md +++ b/packages/bundle/web-app/README.md @@ -110,7 +110,7 @@ The packaged skill uses the custom skill root: a same-named project skill overri
Implementation internals — click to expand -The bundle is one patch layer of five files plus one runtime glue plugin: `cordis.patch.yml` carries the host rows and the preset registry, and each `presets/.patch.yml` inserts one shipped preset declaration, applied in the order `dsh.bundle.patch` lists them. The storage stack and projection cache come from `dsh-base`; the web overlay's workspace and message-feedback rows consume that shared `storageDomain` service. The patch restates the surface-specific values the base deliberately omits, inserts the web-only host rows and browser roster, then moves the agent plane behind presets. The glue plugin owns dist serving, the advertised application URL, the plain-HTTP exposure warning, and the bash variable. WebApp owns startup URL publication and browser handoff; the [Token authentication plugin](../../host/authentication-token/README.md) contributes its signed entry URL. The `office-kit` row mounts one lazy [Office conversion provider](../../document/office-kit/README.md) for Host consumers, including Desktop compositions using this bundle, and keeps converted files under `$DSH_HOME/office-kit/outputs`. The `standard` and `ptc` presets mount the [Office tools](../../document/tool-office/README.md) in every profile, whether or not Kit is installed, and declare them after an Office skill loads; the `minimal` preset omits them. The conversion service's Remote methods authorize preview reads, while Document Preview owns the Office viewer and Client cache. +The bundle is one patch layer of five files plus one runtime glue plugin: `cordis.patch.yml` carries the host rows and the preset registry, and each `presets/.patch.yml` inserts one shipped preset declaration, applied in the order `dsh.bundle.patch` lists them. The storage stack and projection cache come from `dsh-base`; the web overlay's workspace and message-feedback rows consume that shared `storageDomain` service. The patch restates the surface-specific values the base deliberately omits, inserts the web-only host rows and browser roster, then moves the agent plane behind presets. The glue plugin owns dist serving, the advertised application URL, the plain-HTTP exposure warning, and the bash variable. WebApp owns startup URL publication and browser handoff; the [Token authentication plugin](../../host/authentication-token/README.md) contributes its signed entry URL. The `office-kit` row mounts one lazy [Office conversion provider](../../document/office-kit/README.md) for Host consumers, including Desktop compositions using this bundle, and keeps converted files under `$DSH_HOME/office-kit/outputs`. The `standard` and `ptc` presets mount the [Office tools](../../document/tool-document/README.md) in every profile, whether or not Kit is installed, and declare them after an Office skill loads; the `minimal` preset omits them. The conversion service's Remote methods authorize preview reads, while Document Preview owns the Office viewer and Client cache. The `skill-office` row mounts the [Office skills](../../skill/skill-office/README.md) from their packaged assets in every profile. Desktop with a nonempty `DSH_PRIMARY_RUNTIME` also mounts the bundled dependency-query row and selects `pythonEnvironment: 'workspace-dependencies'`; other profiles, and Desktop without a primary runtime, select `pythonEnvironment: 'user'` and leave the dependency-query row disabled. The [Desktop application](../../../apps/desktop/README.md#bundled-workspace-dependencies) owns resource packaging. diff --git a/packages/bundle/web-app/README.zh.md b/packages/bundle/web-app/README.zh.md index 37c7376e31..8aaa08c0d6 100644 --- a/packages/bundle/web-app/README.zh.md +++ b/packages/bundle/web-app/README.zh.md @@ -110,7 +110,7 @@ dsh --profile web --no-open --host "$(hostname -i | awk '{print $1}')" --public-
实现细节——点击展开 -此 bundle 由一层五个文件的补丁和一个运行时胶水插件组成:`cordis.patch.yml` 承载宿主行和 preset 注册表,每个 `presets/.patch.yml` 插入一条随发行版交付的 preset 声明,按 `dsh.bundle.patch` 列出的顺序应用。存储栈与投影缓存来自 `dsh-base`;Web 叠加层的工作区和消息反馈条目消费共享的 `storageDomain` 服务。补丁重述 base 有意省略的界面专用值,插入 Web 专用宿主条目和浏览器插件列表,再将 Agent 层移到预设后面。胶水插件负责 dist 服务、公告应用 URL、明文 HTTP 暴露警告和 bash 变量。WebApp 负责启动 URL 发布与浏览器交接;[Token 认证插件](../../host/authentication-token/README.zh.md)贡献带签名的入口 URL。`office-kit` 条目为宿主消费者挂载一个延迟创建引擎的 [Office 转换提供方](../../document/office-kit/README.zh.md),使用此 bundle 的 Desktop 组合也共享该提供方,转换后的文件保存在 `$DSH_HOME/office-kit/outputs`。`standard` 和 `ptc` 预设在所有 profile 中挂载 [Office 工具](../../document/tool-office/README.zh.md),无论是否安装 Kit,并在加载 Office 技能后声明它们;`minimal` 预设不挂载它们。转换服务的 Remote 方法负责预览读取授权,Document Preview 负责 Office 查看器和客户端缓存。 +此 bundle 由一层五个文件的补丁和一个运行时胶水插件组成:`cordis.patch.yml` 承载宿主行和 preset 注册表,每个 `presets/.patch.yml` 插入一条随发行版交付的 preset 声明,按 `dsh.bundle.patch` 列出的顺序应用。存储栈与投影缓存来自 `dsh-base`;Web 叠加层的工作区和消息反馈条目消费共享的 `storageDomain` 服务。补丁重述 base 有意省略的界面专用值,插入 Web 专用宿主条目和浏览器插件列表,再将 Agent 层移到预设后面。胶水插件负责 dist 服务、公告应用 URL、明文 HTTP 暴露警告和 bash 变量。WebApp 负责启动 URL 发布与浏览器交接;[Token 认证插件](../../host/authentication-token/README.zh.md)贡献带签名的入口 URL。`office-kit` 条目为宿主消费者挂载一个延迟创建引擎的 [Office 转换提供方](../../document/office-kit/README.zh.md),使用此 bundle 的 Desktop 组合也共享该提供方,转换后的文件保存在 `$DSH_HOME/office-kit/outputs`。`standard` 和 `ptc` 预设在所有 profile 中挂载 [Office 工具](../../document/tool-document/README.zh.md),无论是否安装 Kit,并在加载 Office 技能后声明它们;`minimal` 预设不挂载它们。转换服务的 Remote 方法负责预览读取授权,Document Preview 负责 Office 查看器和客户端缓存。 `skill-office` 行在所有 profile 中从包内 assets 挂载 [Office 技能](../../skill/skill-office/README.zh.md)。`DSH_PRIMARY_RUNTIME` 非空的 Desktop 还挂载内置依赖查询行,并选择 `pythonEnvironment: 'workspace-dependencies'`;其他 profile 以及没有主运行时的 Desktop 选择 `pythonEnvironment: 'user'`,并禁用依赖查询行。资源打包由 [Desktop 应用](../../../apps/desktop/README.zh.md#bundled-workspace-dependencies)负责。 diff --git a/packages/bundle/web-app/package.json b/packages/bundle/web-app/package.json index af6f965b14..4d10d0b39d 100644 --- a/packages/bundle/web-app/package.json +++ b/packages/bundle/web-app/package.json @@ -182,12 +182,12 @@ "@deepseek-ai/dsh-tool-bash": "workspace:*", "@deepseek-ai/dsh-tool-bash-persistent": "workspace:*", "@deepseek-ai/dsh-tool-cordis": "workspace:*", + "@deepseek-ai/dsh-tool-document": "workspace:*", "@deepseek-ai/dsh-tool-executor-ptc": "workspace:*", "@deepseek-ai/dsh-tool-fs": "workspace:*", "@deepseek-ai/dsh-tool-fs-search": "workspace:*", "@deepseek-ai/dsh-tool-goal": "workspace:*", "@deepseek-ai/dsh-tool-jobs": "workspace:*", - "@deepseek-ai/dsh-tool-office": "workspace:*", "@deepseek-ai/dsh-tool-present": "workspace:*", "@deepseek-ai/dsh-tool-pwsh": "workspace:*", "@deepseek-ai/dsh-tool-pwsh-persistent": "workspace:*", diff --git a/packages/bundle/web-app/presets/ptc.patch.yml b/packages/bundle/web-app/presets/ptc.patch.yml index 03a42a825f..87e23b61fa 100644 --- a/packages/bundle/web-app/presets/ptc.patch.yml +++ b/packages/bundle/web-app/presets/ptc.patch.yml @@ -128,8 +128,8 @@ name: '@deepseek-ai/dsh-tool-executor-ptc' - id: present name: '@deepseek-ai/dsh-tool-present' - - id: tool-office - name: '@deepseek-ai/dsh-tool-office' + - id: tool-document + name: '@deepseek-ai/dsh-tool-document' - id: tool-plugin-manager name: '@deepseek-ai/dsh-plugin-manager/tools' disabled: !!js "!ctx.get('profileContext')" diff --git a/packages/bundle/web-app/presets/standard.patch.yml b/packages/bundle/web-app/presets/standard.patch.yml index 25bfb3639c..dbd99f89c2 100644 --- a/packages/bundle/web-app/presets/standard.patch.yml +++ b/packages/bundle/web-app/presets/standard.patch.yml @@ -126,8 +126,8 @@ name: '@deepseek-ai/dsh-tool-cordis' - id: present name: '@deepseek-ai/dsh-tool-present' - - id: tool-office - name: '@deepseek-ai/dsh-tool-office' + - id: tool-document + name: '@deepseek-ai/dsh-tool-document' - id: tool-plugin-manager name: '@deepseek-ai/dsh-plugin-manager/tools' disabled: !!js "!ctx.get('profileContext')" diff --git a/packages/bundle/web-app/tests/desktop-office.spec.ts b/packages/bundle/web-app/tests/desktop-office.spec.ts index dc31a84841..1bd8b567ce 100644 --- a/packages/bundle/web-app/tests/desktop-office.spec.ts +++ b/packages/bundle/web-app/tests/desktop-office.spec.ts @@ -21,7 +21,7 @@ import SkillRegistry from '@deepseek-ai/dsh-skill' import * as SkillOffice from '@deepseek-ai/dsh-skill-office' import SystemPrompt from '@deepseek-ai/dsh-system-prompt' import * as NativeToolExecutor from '@deepseek-ai/dsh-tool-executor-native' -import * as ToolOffice from '@deepseek-ai/dsh-tool-office' +import * as ToolDocument from '@deepseek-ai/dsh-tool-document' import { executeToolFixture } from '@deepseek-ai/dsh-tool-testkit' import ToolRuntime from '@deepseek-ai/dsh-tools' import * as WorkspaceDependencies from '@deepseek-ai/dsh-tool-workspace-dependencies' @@ -35,8 +35,8 @@ vi.mock('@deepseek-ai/dsh-office-kit/src/locate.ts', async (original) => { const assets = fileURLToPath(new URL('../../../skill/skill-office/assets/', import.meta.url)) const names = ['office'] -const ROWS = ['office-kit', 'tool-office', 'workspace-dependencies', 'skill-office'] -const OFFICE_TOOLS = ['office_convert', 'office_recalculate', 'office_render'] +const ROWS = ['office-kit', 'tool-document', 'workspace-dependencies', 'skill-office'] +const OFFICE_TOOLS = ['document_convert', 'document_recalculate', 'document_render'] afterEach(() => { vi.unstubAllEnvs() }) @@ -48,13 +48,13 @@ function presetPlugins(preset: string): { id: string; name: string }[] { } it('mounts the Office tools in the standard and PTC presets and omits it from the minimal preset', () => { - const office = (preset: string) => presetPlugins(preset).filter(row => row.id === 'tool-office').map(row => row.name) - expect(office('standard')).toEqual(['@deepseek-ai/dsh-tool-office']) - expect(office('ptc')).toEqual(['@deepseek-ai/dsh-tool-office']) + const office = (preset: string) => presetPlugins(preset).filter(row => row.id === 'tool-document').map(row => row.name) + expect(office('standard')).toEqual(['@deepseek-ai/dsh-tool-document']) + expect(office('ptc')).toEqual(['@deepseek-ai/dsh-tool-document']) expect(office('minimal')).toEqual([]) const host = loadOverlayPatches('desktop-office', fileURLToPath(new URL('../cordis.patch.yml', import.meta.url))) .flatMap(patch => patch.insert ?? []).map(row => row.id) - expect(host).not.toContain('tool-office') + expect(host).not.toContain('tool-document') }) async function boot(profile: string, primaryRuntime: (root: string) => string | undefined, mounted: readonly string[] = ROWS) { @@ -87,13 +87,13 @@ async function boot(profile: string, primaryRuntime: (root: string) => string | ctx.loader.builtins.dependencies = WorkspaceDependencies ctx.loader.builtins.office = SkillOffice ctx.loader.builtins.officeKit = OfficeKit - ctx.loader.builtins.toolOffice = ToolOffice + ctx.loader.builtins.toolOffice = ToolDocument const builtin: Record = { - 'office-kit': 'cordis:officeKit', 'tool-office': 'cordis:toolOffice', 'workspace-dependencies': 'cordis:dependencies', 'skill-office': 'cordis:office', + 'office-kit': 'cordis:officeKit', 'tool-document': 'cordis:toolOffice', 'workspace-dependencies': 'cordis:dependencies', 'skill-office': 'cordis:office', } const hostRows = loadOverlayPatches('desktop-office', fileURLToPath(new URL('../cordis.patch.yml', import.meta.url))) .flatMap(patch => patch.insert ?? []).filter(row => ROWS.includes(row.id)) - const rows = [...hostRows.slice(0, 1), presetPlugins('standard').find(row => row.id === 'tool-office')!, ...hostRows.slice(1)] + const rows = [...hostRows.slice(0, 1), presetPlugins('standard').find(row => row.id === 'tool-document')!, ...hostRows.slice(1)] expect(rows.map(row => row.id)).toEqual(ROWS) const entries = rows.map(row => ({ ...row, name: builtin[row.id]! })) await ctx.loader.root.update(entries.filter(row => mounted.includes(row.id))) @@ -101,7 +101,7 @@ async function boot(profile: string, primaryRuntime: (root: string) => string | return { ctx, root, workspace, entries } } -/** Convert through `office_convert` as an Agent whose previous request declared the Office tools. */ +/** Convert through `document_convert` as an Agent whose previous request declared the Office tools. */ async function convertReport(ctx: Context, workspace: string, callId: string) { const id = brandString(callId) const session = Session.create(id, [], { version: SESSION_FORMAT_VERSION, id, createdAt: 0, cwd: workspace, isSeeded: false }) @@ -111,7 +111,7 @@ async function convertReport(ctx: Context, workspace: string, callId: string) { const toolSet = await ctx.tools.resolve({ agent, modelSelection: { provider: 'fixture', model: 'fixture' }, signal }) try { return await executeToolFixture(ctx, { - signal, callId: brandString(callId), name: 'office_convert', agent, toolSet, arguments: { input: 'report.docx', format: 'pdf' }, + signal, callId: brandString(callId), name: 'document_convert', agent, toolSet, arguments: { input: 'report.docx', format: 'pdf' }, }) } finally { toolSet.dispose() } } @@ -124,11 +124,11 @@ it('mounts packaged Desktop skills with the primary runtime Python beside the Of }) expect((await ctx.skills.list()).map(skill => skill.name)).toEqual(names) expect((await ctx.skills.get('office'))?.resourceBase).toEqual({ kind: 'directory', path: join(assets, 'office').split(sep).join('/') }) - expect(ctx.tools.schemas().map(tool => tool.name).sort()).toEqual(['load_workspace_dependencies', ...OFFICE_TOOLS]) + expect(ctx.tools.schemas().map(tool => tool.name).sort()).toEqual([...OFFICE_TOOLS, 'load_workspace_dependencies']) expect(ctx.officeKit.outputDirectory).toBe(join(root, 'home', 'office-kit', 'outputs')) const office = (await ctx.skills.get('office'))?.content expect(office).toMatch(/## Python environment\n\n.*`load_workspace_dependencies`/u) - expect(office).toContain('`office_convert`') + expect(office).toContain('`document_convert`') }) it('keeps the Office tools and returns the unavailable Kit error to the model when Kit is absent', async () => { @@ -149,7 +149,7 @@ it('mounts the preset Office tools without the Office kit row and reaches the se const { ctx, workspace, entries } = await boot('web', () => undefined, ROWS.filter(id => id !== 'office-kit')) vi.mocked(resolveKitModule).mockClear() await writeFile(join(workspace, 'report.docx'), 'docx bytes') - await ctx.loader.resolve('tool-office').fiber!.await() + await ctx.loader.resolve('tool-document').fiber!.await() expect(ctx.tools.schemas().map(tool => tool.name).sort()).toEqual(OFFICE_TOOLS) const convert = () => convertReport(ctx, workspace, 'office-without-service') expect((await convert()).content).toEqual([{ type: 'text', text: 'Error: cannot convert "report.docx": The document converter is unavailable.' @@ -208,6 +208,6 @@ it('fails only the dependency-query row when the carrier supplies an unusable pr it('removes the Office tools when their row is disposed', async () => { const { ctx } = await boot('web', () => undefined) for (const name of OFFICE_TOOLS) expect(ctx.tools.get(name)).toBeDefined() - await ctx.loader.resolve('tool-office').fiber!.dispose() + await ctx.loader.resolve('tool-document').fiber!.dispose() for (const name of OFFICE_TOOLS) expect(ctx.tools.get(name)).toBeUndefined() }) diff --git a/packages/client/ui-tool/README.i18n.yaml b/packages/client/ui-tool/README.i18n.yaml index dc35d89cbb..2ef9c34e7c 100644 --- a/packages/client/ui-tool/README.i18n.yaml +++ b/packages/client/ui-tool/README.i18n.yaml @@ -21,8 +21,8 @@ en: 3dd6bd71dfc5527d zh: 9fe3c2135014bb7b /deepseek-ai-dsh-client-ui-tool/use-this-package/built-in-views: - en: 33f41ad70d0728f7 - zh: b7c65108c5921134 + en: da6840308057ef0a + zh: 1dd6aef05c7aa21e /deepseek-ai-dsh-client-ui-tool/understand-the-implementation: en: e5529d3c0f8e0c08 zh: 2356087b23f6ea1a diff --git a/packages/client/ui-tool/README.md b/packages/client/ui-tool/README.md index 8a3f259383..fab5dfb768 100644 --- a/packages/client/ui-tool/README.md +++ b/packages/client/ui-tool/README.md @@ -55,7 +55,7 @@ Every registered view receives the explicit `preparing`, `start`, and `result` p File-tool rows prefer a complete `file_path`; other generic rows, including search and unregistered tools, prefer a non-empty `description` before their variant-specific argument fallback. Read `args` during rendering or view construction: a preparing reader grows in place, and only previously observed answer changes trigger subsequent block publication. -This package owns the generic fallback and the built-in shell/pwsh, read, read_image, write/edit, `apply_patch`, running `str_replace_editor` `create`/`str_replace`, grep/glob, web, todo, question, Office (`office_render`, `office_convert`, `office_recalculate`), and PTC dispatch presentations. Office rows open the input file from their path summary and, when expanded, show only the result's text blocks without rendered images; a result without text blocks uses the flattened generic output. The `apply_patch` row shares the write/edit component and the Edit title. Once `input` completes, its summary lists the files that `dsh-fs-patch` `parsePatch` reads from the patch, with a move as `source → destination`; a malformed patch has no summary. A lone added or updated file is one openable path. After a successful result, several files or a move render one link per added, updated, or moved-to file, while move sources and deleted files stay plain text; running and failed rows show the plain list. The row derives no diff while running, shows the applied hunks from settled `meta.diffs`, and a result whose metadata is marked stopped renders as an error with its failure text beside the known diffs. Structured cards derive directly from first-party raw event fields; Host `presentCall` and `presentResult` values never enter the Client. Running atomic rows share one left-to-right highlight across their titles, separators, summaries, and suffixes, while settled rows stay static. Running and settled foreground standard `bash`/`pwsh` and `terminal_send` calls use terminal cards at the root and in PTC dispatch children, subject to the same argument, result, and error checks. Persistent `bash`/`pwsh` calls use terminal cards only while running. Shell output ending in a recognized spill-policy notice uses expandable generic output in shell rows and generic output in Details; a displaced or omitted exit marker cannot establish success. Settled persistent-shell results stay generic because reset and partial-output diagnostics do not always describe one process exit status; root persistent results are expandable. Valid explicit background `bash`/`pwsh` calls use the terminal Start presentation; a successful launch acknowledgement retains the command and cwd in a static command-only card without output or execution status. Launch failures retain generic arguments and errors, while background `terminal_send` stays generic. Inspect preserves the original arguments and acknowledgement; later job output is not attached to this card ([decision](../../../.agents/notes/implemented/bug-fix/2026-10-10-background-shell-command-display.md)). Expanded terminal commands and background inputs wrap to the available width while preserving authored line breaks and selectable text; terminal output keeps its column-preserving layout. Only horizontal overflow adds a named keyboard focus target. Inspect is available when provided. The acknowledgement does not report the job's exit status. A native or PTC dispatch failure carrying `AUTO_REVIEW_DENIED` shows the Auto review verdict in its collapsed row and one normalized not-executed reason when expanded; a missing or whitespace-only reason uses localized fallback text. `ui-skill` demonstrates a business-owned registration for `skill`. +This package owns the generic fallback and the built-in shell/pwsh, read, read_image, write/edit, `apply_patch`, running `str_replace_editor` `create`/`str_replace`, grep/glob, web, todo, question, Office (`document_render`, `document_convert`, `document_recalculate`, and their earlier names `office_render`, `office_convert`, `office_recalculate` in older Sessions), and PTC dispatch presentations. Office rows open the input file from their path summary and, when expanded, show only the result's text blocks without rendered images; a result without text blocks uses the flattened generic output. The `apply_patch` row shares the write/edit component and the Edit title. Once `input` completes, its summary lists the files that `dsh-fs-patch` `parsePatch` reads from the patch, with a move as `source → destination`; a malformed patch has no summary. A lone added or updated file is one openable path. After a successful result, several files or a move render one link per added, updated, or moved-to file, while move sources and deleted files stay plain text; running and failed rows show the plain list. The row derives no diff while running, shows the applied hunks from settled `meta.diffs`, and a result whose metadata is marked stopped renders as an error with its failure text beside the known diffs. Structured cards derive directly from first-party raw event fields; Host `presentCall` and `presentResult` values never enter the Client. Running atomic rows share one left-to-right highlight across their titles, separators, summaries, and suffixes, while settled rows stay static. Running and settled foreground standard `bash`/`pwsh` and `terminal_send` calls use terminal cards at the root and in PTC dispatch children, subject to the same argument, result, and error checks. Persistent `bash`/`pwsh` calls use terminal cards only while running. Shell output ending in a recognized spill-policy notice uses expandable generic output in shell rows and generic output in Details; a displaced or omitted exit marker cannot establish success. Settled persistent-shell results stay generic because reset and partial-output diagnostics do not always describe one process exit status; root persistent results are expandable. Valid explicit background `bash`/`pwsh` calls use the terminal Start presentation; a successful launch acknowledgement retains the command and cwd in a static command-only card without output or execution status. Launch failures retain generic arguments and errors, while background `terminal_send` stays generic. Inspect preserves the original arguments and acknowledgement; later job output is not attached to this card ([decision](../../../.agents/notes/implemented/bug-fix/2026-10-10-background-shell-command-display.md)). Expanded terminal commands and background inputs wrap to the available width while preserving authored line breaks and selectable text; terminal output keeps its column-preserving layout. Only horizontal overflow adds a named keyboard focus target. Inspect is available when provided. The acknowledgement does not report the job's exit status. A native or PTC dispatch failure carrying `AUTO_REVIEW_DENIED` shows the Auto review verdict in its collapsed row and one normalized not-executed reason when expanded; a missing or whitespace-only reason uses localized fallback text. `ui-skill` demonstrates a business-owned registration for `skill`. Question rows pair answers with questions by id, using the tool result or the `userQuestions` projection for late replies. An answerable call has a button to reopen its panel. Once a late reply is in the agent Inbox, the row shows its submitted answers; “View answers” expands its read-only transcript while admission is pending. A settled call with answers opens the panel read-only. Closed calls without answers and invalid records offer no button. Cancelled and interrupted rows show their verdict without inventing answers. If no panel provider accepts the button action, it expands the row. Unsupported or ambiguous input falls back to flattened Tool text. diff --git a/packages/client/ui-tool/README.zh.md b/packages/client/ui-tool/README.zh.md index 6899a89107..c9c2797ff2 100644 --- a/packages/client/ui-tool/README.zh.md +++ b/packages/client/ui-tool/README.zh.md @@ -55,7 +55,7 @@ owner 载荷为 `ToolCallOwnerProps`:`callId`、`toolName`、`phase` 判别字 文件工具行优先使用完整的 `file_path`;其他通用行(包括搜索和未注册的工具)优先使用非空 `description`,再回退到各自类别的参数摘要。应在渲染或构造视图时读取 `args`:准备态读器原地增长,后续仅在已观察答案变化时重新发布块。 -本包拥有 generic fallback,以及 shell/pwsh、read、read_image、write/edit、`apply_patch`、运行中的 `str_replace_editor` `create`/`str_replace`、grep/glob、web、todo、question、Office(`office_render`、`office_convert`、`office_recalculate`)与 PTC dispatch 的内置展示。Office 行点击路径摘要打开输入文件,展开后只显示结果的文本块,不显示渲染图片;没有文本块的结果使用压平的通用输出。`apply_patch` 行复用 write/edit 组件与“编辑”标题。`input` 完整到达后,摘要列出 `dsh-fs-patch` 的 `parsePatch` 从补丁读出的文件,移动显示为 `源 → 目标`;格式不合法的补丁没有摘要。单个新增或修改的文件是一个可打开路径。成功结果中有多个文件或含移动时,每个新增、修改或移动目标文件各是一个链接,移动源与被删除文件保持纯文本;运行中与失败的行显示纯文本列表。该行运行态不推导 diff,完成态展示 `meta.diffs` 中已应用的 hunk,元数据标记为停止的结果按错误呈现,并在已知 diff 旁保留失败文本。结构化卡片直接从第一方原始 event 字段派生;Host `presentCall` 与 `presentResult` 值不会进入 Client。运行中的原子工具行以同一道高光从左到右扫过标题、分隔符、摘要与后缀;已完成行保持静态。运行中与已完成的前台标准 `bash`/`pwsh` 和 `terminal_send` 调用,无论位于根还是 PTC dispatch 子调用中,都在通过相同的参数、结果和错误检查后使用 terminal 卡片。持久 `bash`/`pwsh` 调用仅在运行中使用 terminal 卡片。以已识别的 spill 策略提示结尾的 shell 输出,在 shell 行中使用可展开的 generic 输出,在 Details 中使用 generic 输出;位置被改变或被省略的退出标记无法证明成功。已完成的持久 shell 结果保持 generic 展示,因为 reset 与部分输出诊断不一定描述单个进程的退出状态;根调用的持久 shell 结果可展开。合法的主动后台 `bash`/`pwsh` 调用使用 terminal Start 展示;成功启动回执后,静态仅命令卡片保留 command 和 cwd,不显示输出或执行状态。启动失败保留通用参数与错误展示,后台 `terminal_send` 仍为 generic。Inspect 保留原始参数及回执,后续 job 输出不接回此卡片([决定](../../../.agents/notes/implemented/bug-fix/2026-10-10-background-shell-command-display.zh.md))。展开的终端命令与后台输入按可用宽度自动折行,保留原有换行和可选文本;终端输出保持按列对齐的排版。仅横向溢出时添加具名的键盘聚焦目标。提供 Inspect 时也可使用。回执不表示后台任务的退出状态。带有 `AUTO_REVIEW_DENIED` 的原生或 PTC dispatch 失败会在折叠行显示 Auto review 裁决,展开时显示一行归一化后的“未执行”原因;原因缺失或只有空白时使用本地化 fallback 文案。`ui-skill` 展示了业务包自行拥有的 `skill` 注册项。 +本包拥有 generic fallback,以及 shell/pwsh、read、read_image、write/edit、`apply_patch`、运行中的 `str_replace_editor` `create`/`str_replace`、grep/glob、web、todo、question、Office(`document_render`、`document_convert`、`document_recalculate`,以及旧 Session 中的旧名 `office_render`、`office_convert`、`office_recalculate`)与 PTC dispatch 的内置展示。Office 行点击路径摘要打开输入文件,展开后只显示结果的文本块,不显示渲染图片;没有文本块的结果使用压平的通用输出。`apply_patch` 行复用 write/edit 组件与“编辑”标题。`input` 完整到达后,摘要列出 `dsh-fs-patch` 的 `parsePatch` 从补丁读出的文件,移动显示为 `源 → 目标`;格式不合法的补丁没有摘要。单个新增或修改的文件是一个可打开路径。成功结果中有多个文件或含移动时,每个新增、修改或移动目标文件各是一个链接,移动源与被删除文件保持纯文本;运行中与失败的行显示纯文本列表。该行运行态不推导 diff,完成态展示 `meta.diffs` 中已应用的 hunk,元数据标记为停止的结果按错误呈现,并在已知 diff 旁保留失败文本。结构化卡片直接从第一方原始 event 字段派生;Host `presentCall` 与 `presentResult` 值不会进入 Client。运行中的原子工具行以同一道高光从左到右扫过标题、分隔符、摘要与后缀;已完成行保持静态。运行中与已完成的前台标准 `bash`/`pwsh` 和 `terminal_send` 调用,无论位于根还是 PTC dispatch 子调用中,都在通过相同的参数、结果和错误检查后使用 terminal 卡片。持久 `bash`/`pwsh` 调用仅在运行中使用 terminal 卡片。以已识别的 spill 策略提示结尾的 shell 输出,在 shell 行中使用可展开的 generic 输出,在 Details 中使用 generic 输出;位置被改变或被省略的退出标记无法证明成功。已完成的持久 shell 结果保持 generic 展示,因为 reset 与部分输出诊断不一定描述单个进程的退出状态;根调用的持久 shell 结果可展开。合法的主动后台 `bash`/`pwsh` 调用使用 terminal Start 展示;成功启动回执后,静态仅命令卡片保留 command 和 cwd,不显示输出或执行状态。启动失败保留通用参数与错误展示,后台 `terminal_send` 仍为 generic。Inspect 保留原始参数及回执,后续 job 输出不接回此卡片([决定](../../../.agents/notes/implemented/bug-fix/2026-10-10-background-shell-command-display.zh.md))。展开的终端命令与后台输入按可用宽度自动折行,保留原有换行和可选文本;终端输出保持按列对齐的排版。仅横向溢出时添加具名的键盘聚焦目标。提供 Inspect 时也可使用。回执不表示后台任务的退出状态。带有 `AUTO_REVIEW_DENIED` 的原生或 PTC dispatch 失败会在折叠行显示 Auto review 裁决,展开时显示一行归一化后的“未执行”原因;原因缺失或只有空白时使用本地化 fallback 文案。`ui-skill` 展示了业务包自行拥有的 `skill` 注册项。 问题行按 id 配对问题与答案;答案来自工具结果,迟到回答则来自 `userQuestions` 投影。可回答的调用提供按钮以重新打开面板。迟到回复进入 agent Inbox 后,问题行显示已提交的答案;等待准入期间,「查看回答」展开只读的行内记录。带有答案的已结算调用则以只读方式打开面板。没有答案的已关闭调用和无效记录不提供按钮。已取消和已中断的行显示裁决,不虚构答案。若面板提供方不接受按钮操作,点击会展开该行。不受支持或含糊的输入回退为压平的工具文本。 diff --git a/packages/client/ui-tool/src/client/tool/models/office-card-model.ts b/packages/client/ui-tool/src/client/tool/models/office-card-model.ts index b4a7d94b87..df200b164c 100644 --- a/packages/client/ui-tool/src/client/tool/models/office-card-model.ts +++ b/packages/client/ui-tool/src/client/tool/models/office-card-model.ts @@ -7,7 +7,11 @@ import type { ToolCallBlock } from './tool-call-model.ts' type OfficeTitleKey = Extract, 'tool.title.officeRender' | 'tool.title.officeConvert' | 'tool.title.officeRecalculate' | 'tool.title.generic'> +/** Office tool names; the `office_*` entries are the earlier names, kept so calls in older Sessions keep their titles. */ const TITLE_KEYS: Readonly> = { + document_render: 'tool.title.officeRender', + document_convert: 'tool.title.officeConvert', + document_recalculate: 'tool.title.officeRecalculate', office_render: 'tool.title.officeRender', office_convert: 'tool.title.officeConvert', office_recalculate: 'tool.title.officeRecalculate', @@ -39,7 +43,7 @@ function completeText(block: ToolCallBlock, key: string): string | undefined { export function officeRowModel(toolName: string, block: ToolCallBlock, cwd?: string, home?: string): OfficeRowModel { const titleKey = TITLE_KEYS[toolName] ?? 'tool.title.generic' const input = completeText(block, 'input') - const format = toolName === 'office_render' ? undefined : completeText(block, 'format') + const format = TITLE_KEYS[toolName] === 'tool.title.officeRender' ? undefined : completeText(block, 'format') const short = (path: string): string => abbreviateHomePath(relativizeToCwd(path, cwd), home) const summary = input === undefined ? '' : format === undefined ? short(input) : `${short(input)} → ${format}` const recorded = 'kind' in block ? recordedAbsolutePath(block.meta, 'path') : undefined diff --git a/packages/client/ui-tool/src/client/tool/toolviews/office-row.tsx b/packages/client/ui-tool/src/client/tool/toolviews/office-row.tsx index c3e14750fe..9a09029a22 100644 --- a/packages/client/ui-tool/src/client/tool/toolviews/office-row.tsx +++ b/packages/client/ui-tool/src/client/tool/toolviews/office-row.tsx @@ -53,7 +53,12 @@ export function OfficeRow({ ) } -/** Registers the three Office toolviews. */ +/** Office tool names; the `office_*` names are the earlier names, kept so calls in older Sessions keep the Office row. */ +const OFFICE_TOOL_NAMES = [ + 'document_render', 'document_convert', 'document_recalculate', 'office_render', 'office_convert', 'office_recalculate', +] as const + +/** Registers the Office toolviews under the current and earlier tool names. */ export const officeToolview = { name: 'office-toolview', inject: ['slots', 'sessions'], @@ -63,9 +68,9 @@ export const officeToolview = { */ apply(ctx: Context): void { ctx.slots.inject('tool.call.toolview', function* () { - yield ctx.slots.register({ name: 'tool.call.toolview', key: 'office_render', locale: NS, inject: toolFileInject(ctx) }, OfficeRow) - yield ctx.slots.register({ name: 'tool.call.toolview', key: 'office_convert', locale: NS, inject: toolFileInject(ctx) }, OfficeRow) - yield ctx.slots.register({ name: 'tool.call.toolview', key: 'office_recalculate', locale: NS, inject: toolFileInject(ctx) }, OfficeRow) + for (const key of OFFICE_TOOL_NAMES) { + yield ctx.slots.register({ name: 'tool.call.toolview', key, locale: NS, inject: toolFileInject(ctx) }, OfficeRow) + } }) }, } diff --git a/packages/client/ui-tool/tests/office-card.client.spec.tsx b/packages/client/ui-tool/tests/office-card.client.spec.tsx index 1274c0fa86..344c5164a2 100644 --- a/packages/client/ui-tool/tests/office-card.client.spec.tsx +++ b/packages/client/ui-tool/tests/office-card.client.spec.tsx @@ -29,12 +29,12 @@ const image: ImageAttachmentRef = { } const SUMMARY = 'Rendered 1 image of /w/app/docs/deck.pptx (3 in the document) at 144 DPI.' -const running = (argsRaw = RENDER_ARGS, name = 'office_render'): StartedToolCall => ({ +const running = (argsRaw = RENDER_ARGS, name = 'document_render'): StartedToolCall => ({ phase: 'start', args: PartialArguments.fromText(argsRaw), callId: 'c1', name, argsRaw, turn: 1, step: 1, time: 1_000, subCalls: [], }) -const settled = (over: Partial = {}, argsRaw = RENDER_ARGS, name = 'office_render'): ToolResultNode => ({ +const settled = (over: Partial = {}, argsRaw = RENDER_ARGS, name = 'document_render'): ToolResultNode => ({ kind: 'tool-result', seq: 10, time: 2_000, callId: 'c1', name, args: PartialArguments.fromText(argsRaw), call: { name, argsRaw }, callTime: 1_000, content: [{ type: 'text', text: SUMMARY }, { type: 'text', text: 'Page 2: 800x600 px' }, { type: 'image', attachment: image }], @@ -43,23 +43,25 @@ const settled = (over: Partial = {}, argsRaw = RENDER_ARGS, name describe('officeRowModel', () => { it('derives a render row from the recorded input path', () => { - expect(officeRowModel('office_render', settled(), '/w/app')).toEqual({ + expect(officeRowModel('document_render', settled(), '/w/app')).toEqual({ titleKey: 'tool.title.officeRender', summary: 'docs/deck.pptx', filePath: '/w/app/docs/deck.pptx', }) }) it('titles each tool and summarizes written outputs without an operation argument', () => { const convert = '{"input":"/w/app/deck.pptx","format":"pdf"}' - expect(officeRowModel('office_convert', running(convert, 'office_convert'), '/w/app')).toEqual({ + expect(officeRowModel('document_convert', running(convert, 'document_convert'), '/w/app')).toEqual({ titleKey: 'tool.title.officeConvert', summary: 'deck.pptx → pdf', filePath: '/w/app/deck.pptx', }) - expect(officeRowModel('office_recalculate', running('{"input":"book.xlsx"}', 'office_recalculate'))).toMatchObject({ + expect(officeRowModel('document_recalculate', running('{"input":"book.xlsx"}', 'document_recalculate'))).toMatchObject({ titleKey: 'tool.title.officeRecalculate', summary: 'book.xlsx', filePath: undefined, }) expect(officeRowModel('other', running('{"input":"unfinished'))).toMatchObject({ titleKey: 'tool.title.generic', summary: '' }) }) it.each([ + ['document_render', 'tool.title.officeRender'], ['document_convert', 'tool.title.officeConvert'], + ['document_recalculate', 'tool.title.officeRecalculate'], ['office_render', 'tool.title.officeRender'], ['office_convert', 'tool.title.officeConvert'], ['office_recalculate', 'tool.title.officeRecalculate'], ])('selects %s from its wire name even when operation metadata conflicts', (name, titleKey) => { @@ -68,8 +70,15 @@ describe('officeRowModel', () => { expect(officeRowModel(name, block).titleKey).toBe(titleKey) }) + it('summarizes calls recorded under the earlier office_* names like current calls', () => { + expect(officeRowModel('office_render', settled(), '/w/app')).toEqual(officeRowModel('document_render', settled(), '/w/app')) + const convert = '{"input":"/w/app/deck.pptx","format":"pdf"}' + expect(officeRowModel('office_convert', running(convert, 'office_convert'), '/w/app')) + .toEqual({ titleKey: 'tool.title.officeConvert', summary: 'deck.pptx → pdf', filePath: '/w/app/deck.pptx' }) + }) + it('ignores a relative recorded path', () => { - expect(officeRowModel('office_render', settled({ meta: { path: 'relative.pptx' } })).filePath).toBeUndefined() + expect(officeRowModel('document_render', settled({ meta: { path: 'relative.pptx' } })).filePath).toBeUndefined() }) }) @@ -108,8 +117,8 @@ describe('OfficeRow', () => { }) it.each([ - ['office_convert', 'pdf', '转换文档', 'Converted', ', 3 pages'], - ['office_recalculate', 'xlsx', '重算工作簿', 'Recalculated', ''], + ['document_convert', 'pdf', '转换文档', 'Converted', ', 3 pages'], + ['document_recalculate', 'xlsx', '重算工作簿', 'Recalculated', ''], ])('keeps the %s result text and output path while its title link opens the input', (name, format, title, verb, pages) => { const input = '/w/app/input.xlsx' const file = `/tmp/office/output.${format}` @@ -128,7 +137,7 @@ describe('OfficeRow', () => { expect(view.container.textContent).toContain(`${output}\n${warning}`) }) - it('registers all three wire names and removes them on disposal', async () => { + it('registers the current and earlier wire names and removes them on disposal', async () => { const runtime = await SlotTestRuntime.create() onTestFinished(() => runtime.dispose()) const locale = new LocaleRuntime(runtime.ctx) @@ -139,6 +148,7 @@ describe('OfficeRow', () => { expect(runtime.slots.entries('tool.call.toolview')).toHaveLength(0) await runtime.root.declare({ 'tool.call.toolview': { kind: 'keyed', scope: 'session' } }, () => null) expect(runtime.slots.entries('tool.call.toolview').map(entry => [entry.options.key, entry.component])).toEqual([ + ['document_render', OfficeRow], ['document_convert', OfficeRow], ['document_recalculate', OfficeRow], ['office_render', OfficeRow], ['office_convert', OfficeRow], ['office_recalculate', OfficeRow], ]) await fiber.dispose() diff --git a/packages/client/ui-tool/tests/toolview-slot.client.spec.tsx b/packages/client/ui-tool/tests/toolview-slot.client.spec.tsx index 3ec72ce665..ef96abb5fc 100644 --- a/packages/client/ui-tool/tests/toolview-slot.client.spec.tsx +++ b/packages/client/ui-tool/tests/toolview-slot.client.spec.tsx @@ -173,12 +173,14 @@ describe('keyed toolview hole through the real machinery', () => { }) it.each([ + ['document_render', 'Render document'], + ['document_convert', 'Convert document'], + ['document_recalculate', 'Recalculate workbook'], ['office_render', 'Render document'], ['office_convert', 'Convert document'], - ['office_recalculate', 'Recalculate workbook'], ])('dispatches %s to its Office row through the real call tree', async (name, title) => { const output = `${name} result` - const args = { input: 'input.xlsx', ...name === 'office_render' ? {} : { format: 'xlsx' } } + const args = { input: 'input.xlsx', ...name.endsWith('_render') ? {} : { format: 'xlsx' } } const b = await bench([ toolResult(3, 'office-call', name, JSON.stringify(args), { meta: { path: '/w/input.xlsx' }, content: [{ type: 'text', text: output }], @@ -188,7 +190,7 @@ describe('keyed toolview hole through the real machinery', () => { const view = b.runtime.renderRoot() expect(view.getByText(title)).toBeTruthy() expect(view.queryByText('Tool call')).toBeNull() - expect(view.getByRole('button', { name: name === 'office_render' ? 'input.xlsx' : 'input.xlsx → xlsx' })).toBeTruthy() + expect(view.getByRole('button', { name: name.endsWith('_render') ? 'input.xlsx' : 'input.xlsx → xlsx' })).toBeTruthy() fireEvent.click(view.container.querySelector('[data-expandable]')!) expect(view.getByText(output)).toBeTruthy() } finally { await b.runtime.dispose() } diff --git a/packages/core/tools/tests/gen-tool-catalog.spec.ts b/packages/core/tools/tests/gen-tool-catalog.spec.ts index a31b74c4dd..7f9a06fc04 100644 --- a/packages/core/tools/tests/gen-tool-catalog.spec.ts +++ b/packages/core/tools/tests/gen-tool-catalog.spec.ts @@ -28,11 +28,10 @@ describe('gen-tool-catalog collectToolCatalog', () => { const names = catalog.flatMap(entry => entry.schemas.map(s => s.name)).sort() expect(names).toEqual([ 'apply_patch', 'ask_user_question', 'bash', 'bash', 'cordis_inspect', - 'create_goal', 'edit', 'enter_worktree', 'exit_plan_mode', 'exit_worktree', 'get_goal', 'glob', 'grep', - 'im_history', 'im_members', 'im_read', 'im_read_file', 'im_read_image', 'im_reply', 'im_send', 'im_send_file', + 'create_goal', 'document_convert', 'document_recalculate', 'document_render', 'edit', 'enter_worktree', 'exit_plan_mode', 'exit_worktree', 'get_goal', 'glob', 'grep', 'interrupt_agent', 'job_kill', 'job_list', 'job_output', 'list_agents', 'list_mcp_resource_templates', 'list_mcp_resources', 'list_session', - 'list_subagent_models', 'list_workspace', 'load_workspace_dependencies', 'lsp', 'office_convert', 'office_recalculate', 'office_render', 'plugin_manager', 'plugin_market', 'present', 'pwsh', 'pwsh', 'ralph', + 'list_subagent_models', 'list_workspace', 'load_workspace_dependencies', 'lsp', 'plugin_manager', 'plugin_market', 'present', 'pwsh', 'pwsh', 'ralph', 'read', 'read_image', 'read_mcp_resource', 'run_code', 'schedule_create', 'schedule_edit', 'schedule_list', 'schedule_view', 'send_message', 'session_event_read', 'session_event_search', 'session_event_trace', 'session_search', 'session_send_message', 'session_trace', 'skill', diff --git a/packages/document/README.i18n.yaml b/packages/document/README.i18n.yaml index 0f3aa8ae43..55ad34f7af 100644 --- a/packages/document/README.i18n.yaml +++ b/packages/document/README.i18n.yaml @@ -15,8 +15,8 @@ en: 1eb35b015a6c423f zh: a8a3dceee2c9e943 /document-office-documents/packages: - en: 225177a571e9754d - zh: 466ffd3d6b89f95d + en: 2e1b6a554c907753 + zh: b23cbe29c55a6a5c /document-office-documents/related-documentation: en: b9691c6ee2c4db99 zh: 133970f11bfb85ee diff --git a/packages/document/README.md b/packages/document/README.md index 842485d538..c727b28293 100644 --- a/packages/document/README.md +++ b/packages/document/README.md @@ -27,7 +27,7 @@ Each package owns its configuration and lifetime rules; the subsystem reference | Package | Role | ctx key | |---|---|---| | [office-kit](office-kit/README.md) | Authorized Office bytes to complete PDFs, PNG images, converted files, and recalculated workbooks with bounded queues and caching; the provider resolves its own Kit entry, engine manifests, and ASAR-unpacked engine paths | `ctx.officeKit` | -| [tool-office](tool-office/README.md) | `office_render`, `office_convert`, and `office_recalculate`, declared after an Office skill loads: render pages as images in the tool result, convert documents, and recalculate workbooks | — | +| [tool-document](tool-document/README.md) | `document_render`, `document_convert`, and `document_recalculate`, declared after an Office skill loads: render pages as images in the tool result, convert documents, and recalculate workbooks | — | ----- diff --git a/packages/document/README.zh.md b/packages/document/README.zh.md index 19cabc08b6..83d461e362 100644 --- a/packages/document/README.zh.md +++ b/packages/document/README.zh.md @@ -27,7 +27,7 @@ kind: "package-group" | 包 | 职责 | ctx 键 | |---|---|---| | [office-kit](office-kit/README.zh.md) | 将已授权 Office 字节转换为完整 PDF、PNG 图片、转换后的文件和重算后的工作簿,并提供有界队列和缓存;提供方自行解析 Kit 入口、引擎清单和 ASAR 解包后的引擎路径 | `ctx.officeKit` | -| [tool-office](tool-office/README.zh.md) | 加载 Office 技能后声明的 `office_render`、`office_convert` 和 `office_recalculate`:在工具结果中把页面渲染为图片、转换文档、重算工作簿 | — | +| [tool-document](tool-document/README.zh.md) | 加载 Office 技能后声明的 `document_render`、`document_convert` 和 `document_recalculate`:在工具结果中把页面渲染为图片、转换文档、重算工作簿 | — | ----- diff --git a/packages/document/office-kit/README.i18n.yaml b/packages/document/office-kit/README.i18n.yaml index feec2c8d7f..987c77f001 100644 --- a/packages/document/office-kit/README.i18n.yaml +++ b/packages/document/office-kit/README.i18n.yaml @@ -15,23 +15,23 @@ en: d152484eb41ac6b4 zh: a134331a31395608 /deepseek-ai-dsh-office-kit/use-this-package: - en: 9d262838f2b8bc72 - zh: ea680aabfdbb55ba + en: 345499cdf2c25974 + zh: e9165dd6deb91e93 /deepseek-ai-dsh-office-kit/understand-the-implementation: en: ae535a0a276f6622 zh: 23e1bc19e9985df8 /deepseek-ai-dsh-office-kit/further-exploration: - en: 9c62c26d46625e8b - zh: 9d0b734d70fdf948 + en: 899b172c6aa3f98e + zh: a05945a28e172f5d /deepseek-ai-dsh-office-kit/model-experience: - en: 5b001842f3d350a1 - zh: 244c53b867fff8d0 + en: a416fcd599de7097 + zh: 784881503b170fcf /deepseek-ai-dsh-office-kit/model-experience/kv-cache-effect: en: cd1110fd1b70aaa0 zh: 623d77245348d129 /deepseek-ai-dsh-office-kit/known-limitations-and-deferred-work: - en: 47ab6f2d2b0faaf7 - zh: 310516d7be75fb7a + en: db8042f2f4ee7335 + zh: deeed482188cb994 /deepseek-ai-dsh-office-kit/known-limitations-and-deferred-work/dev-note: en: e67f633dc6fe7773 zh: 8ec3e73528ddb1a6 diff --git a/packages/document/office-kit/README.md b/packages/document/office-kit/README.md index da1ad080d2..160b1c17a9 100644 --- a/packages/document/office-kit/README.md +++ b/packages/document/office-kit/README.md @@ -25,9 +25,9 @@ Render Office documents as PDFs or PNG images, convert them between formats, and ## Use this package -The [Web bundle](../../bundle/web-app/README.md) and the [SDK bundle](../../bundle/sdk-app/README.md) mount this provider as `office-kit`; the [Office tools](../tool-office/README.md) are its model-facing consumers. Independent compositions mount `@deepseek-ai/dsh-office-kit` as a `cordis.yml` row. +The [Web bundle](../../bundle/web-app/README.md) and the [SDK bundle](../../bundle/sdk-app/README.md) mount this provider as `office-kit`; the [Office tools](../tool-document/README.md) are its model-facing consumers. Independent compositions mount `@deepseek-ai/dsh-office-kit` as a `cordis.yml` row. -Callers submit authorized source identity, version, optional byte size, a deferred bounded read, and input extension; PDF conversions also name a scheduling priority, and image rendering, format conversion, and recalculation run at foreground priority. A changed source version rejects the operation. Cancellation rejects with its reason; failures use `OfficeKitError`, whose lowercase `code` is also the `document-render/failed` reason; [`dsh-tool-office`](../tool-office/README.md#use-this-package) maps it to `OfficeToolError` codes for tool results. Every result carries the missing fonts; PDF results also carry the conversion generation, which changes on configuration replacement. +Callers submit authorized source identity, version, optional byte size, a deferred bounded read, and input extension; PDF conversions also name a scheduling priority, and image rendering, format conversion, and recalculation run at foreground priority. A changed source version rejects the operation. Cancellation rejects with its reason; failures use `OfficeKitError`, whose lowercase `code` is also the `document-render/failed` reason; [`dsh-tool-document`](../tool-document/README.md#use-this-package) maps it to `OfficeToolError` codes for tool results. Every result carries the missing fonts; PDF results also carry the conversion generation, which changes on configuration replacement. | Method | Operation | Result | |---|---|---| @@ -36,11 +36,11 @@ Callers submit authorized source identity, version, optional byte size, a deferr | `convertTo()` | conversion to the format of `format`; CSV takes a `sheet` | the saved file's Host path, size, and PDF page count | | `recalculate()` | XLS, XLSX, or ODS recalculation to XLSX or ODS | the saved workbook's Host path and size | -`renderImages()` requires `maxImages`, `maxPixels`, `maxDimension`, and `maxBytes`. The engine rejects a selection with more images than `maxImages` or an image above the pixel or dimension limit; the provider rejects images whose total PNG bytes exceed `maxBytes` with `output-too-large`, before and while reading them. A page, sheet, range, resolution, or format selection the engine rejects fails with `invalid-request` and the engine's description. Converted and recalculated files obey `maxOutputBytes`. The provider never writes into a workspace: it saves each output in its own owner-only directory under `outputDirectory`, grouped by the request's `output.owner` (`office_convert` and `office_recalculate` pass the root Session of the caller's subagent tree), and returns the absolute Host path. A file is deleted after `outputRetentionMs`, when newer outputs need room within `maxOutputStoreBytes` (oldest first), when the Session whose id equals the owner is disposed, or when the provider unloads; a file larger than `maxOutputStoreBytes` fails with `output-too-large`. A file counts toward `maxOutputStoreBytes` until its deletion succeeds; a failed deletion is logged and retried by later eviction, release, and unload, and a save that cannot free enough room fails with `unavailable`. Unload waits for deletions in progress. Startup also removes expired output directories of earlier processes, considering only real directories, not links or junctions, with the names the provider generates: `session-` and 24 lowercase hexadecimal digits directly under `outputDirectory`, each holding lowercase UUID v4 output directories. Other entries are left untouched. `outputDirectory` is exposed on the service so consumers can check that their execution world reads it. +`renderImages()` requires `maxImages`, `maxPixels`, `maxDimension`, and `maxBytes`. The engine rejects a selection with more images than `maxImages` or an image above the pixel or dimension limit; the provider rejects images whose total PNG bytes exceed `maxBytes` with `output-too-large`, before and while reading them. A page, sheet, range, resolution, or format selection the engine rejects fails with `invalid-request` and the engine's description. Converted and recalculated files obey `maxOutputBytes`. The provider never writes into a workspace: it saves each output in its own owner-only directory under `outputDirectory`, grouped by the request's `output.owner` (`document_convert` and `document_recalculate` pass the root Session of the caller's subagent tree), and returns the absolute Host path. A file is deleted after `outputRetentionMs`, when newer outputs need room within `maxOutputStoreBytes` (oldest first), when the Session whose id equals the owner is disposed, or when the provider unloads; a file larger than `maxOutputStoreBytes` fails with `output-too-large`. A file counts toward `maxOutputStoreBytes` until its deletion succeeds; a failed deletion is logged and retried by later eviction, release, and unload, and a save that cannot free enough room fails with `unavailable`. Unload waits for deletions in progress. Startup also removes expired output directories of earlier processes, considering only real directories, not links or junctions, with the names the provider generates: `session-` and 24 lowercase hexadecimal digits directly under `outputDirectory`, each holding lowercase UUID v4 output directories. Other entries are left untouched. `outputDirectory` is exposed on the service so consumers can check that their execution world reads it. `renderImages()` selects its renderer before admission. A request's `renderer` is used exclusively: `poppler` with non-PDF input fails with `unsupported-format`, and an unavailable renderer fails with `unavailable`. Without `renderer`, the provider takes the first available entry of `renderers.pdf` for PDF input or `renderers.office` otherwise, and uses the last entry without checking it. Only unavailability moves selection to the next entry; a selected renderer that fails, times out, or produces invalid output rejects the request. LibreOffice is available when Kit imports. Poppler is available when the `subprocess` service exists and resolves both configured executables in its execution world, which is the SSH host when SSH providers are composed. The result names the renderer, and cached renderings are kept per renderer. -Poppler renders PDF pages without a LibreOffice converter slot and still shares queue admission, concurrency, and source-byte reservations. Each process reads the PDF from stdin, so no file passes between the provider and the process. `pdfinfo` reports the page count and each selected page's crop-box size and rotation, and the provider rejects the selection before rendering with the LibreOffice codes: more pages than `maxImages` or a page above `maxPixels` or `maxDimension` at the requested DPI (default 144) is `output-too-large`, and a page outside the document is `invalid-request`. `pdftoppm` then renders each run of consecutive pages once and writes the PNG images to stdout one after another. The provider splits them at PNG chunk boundaries as they arrive, terminates `pdftoppm` with `output-too-large` once the bytes exceed the remaining `maxBytes`, requires one image per page of the run, checks each image's header dimensions against the limits again, and returns an empty `missingFonts` list. Exit code 1 maps to `invalid-document`, the `timeoutMs` deadline to `timeout`, and other failures to `failed`. +Poppler renders PDF pages without a LibreOffice converter slot and still shares queue admission, concurrency, and source-byte reservations. Each process reads the PDF from stdin, so no file passes between the provider and the process. One `pdfinfo` reports the page count, taken from its last `Pages:` line because document properties such as the title print earlier; a second reports the crop-box size and rotation of every page from the first to the last selected page, and the provider rejects the selection before rendering with the LibreOffice codes: more pages than `maxImages` or a page above `maxPixels` or `maxDimension` at the requested DPI (default 144) is `output-too-large`, and a page outside the document is `invalid-request`. `pdftoppm` then renders each run of consecutive pages once and writes the PNG images to stdout one after another. The provider splits them at PNG chunk boundaries as they arrive, terminates `pdftoppm` with `output-too-large` once the bytes exceed the remaining `maxBytes`, requires one image per page of the run, checks each image's header dimensions against the limits again, and returns an empty `missingFonts` list. Exit code 1 maps to `invalid-document`, the `timeoutMs` deadline to `timeout`, and other failures to `failed`. The provider depends on the independently published [`@deepseek-ai/libreoffice-kit`](https://github.com/deepseek-ai/dsh-libreoffice-kit) npm API at kit version `0.2.3`. Application packaging selects the matching native package declared in the kit’s `optionalDependencies`, or WASM when no native package is declared for that target. A missing declared native engine rejects packaging without selecting WASM. The [release ownership decision](../../../.agents/notes/implemented/architecture/2026-09-14-independent-libreoffice-kit.md) defines the independent kit and Harness responsibilities. @@ -102,7 +102,7 @@ Poppler processes receive argv through the `subprocess` service, never a shell c ## Further Exploration - [Office Kit](../../../docs/subsystems/office-kit.md) — composition and input/result ownership. -- [Office tool](../tool-office/README.md) — the model-facing render, convert, and recalculate tool. +- [Office tool](../tool-document/README.md) — the model-facing render, convert, and recalculate tool. - [Workspace Files](../../api/workspace-files/README.md) — Session file authorization and bounded reads. ----- @@ -110,7 +110,7 @@ Poppler processes receive argv through the `subprocess` service, never a shell c ## Model Experience -Indirectly, through [the Office tools](../tool-office/README.md#model-experience), which return rendered images and converted files from this service. +Indirectly, through [the Office tools](../tool-document/README.md#model-experience), which return rendered images and converted files from this service. #### KV Cache effect @@ -126,7 +126,7 @@ None; this service does not construct or modify model requests. - Rendered images are returned as bytes. Converted and recalculated files are stored in the provider's output directory, not in the workspace; the caller copies each file to its destination. - Mapping a native path does not verify that the unpacked copy exists. Kit rejects missing manifests or assets instead of treating them as an absent native package. - Poppler runs as an ordinary process of the subprocess provider, outside the DSH sandbox and without a memory limit; only `timeoutMs` bounds it. The provider neither installs Poppler nor checks its version. -- Each Poppler process receives the complete PDF on stdin, so a rendering of several page runs sends the source once per `pdfinfo` and `pdftoppm` process; with SSH providers each copy crosses the SSH connection. +- Each Poppler process receives the complete PDF on stdin, so a rendering sends the source to two `pdfinfo` processes and to one `pdftoppm` process per run of consecutive pages; with SSH providers each copy crosses the SSH connection. - Poppler and LibreOffice rasterize PDF pages differently, so images of the same page can differ between renderers. diff --git a/packages/document/office-kit/README.zh.md b/packages/document/office-kit/README.zh.md index 7fdb823339..ccbb72ffb7 100644 --- a/packages/document/office-kit/README.zh.md +++ b/packages/document/office-kit/README.zh.md @@ -25,9 +25,9 @@ kind: "package-reference" ## 使用此包 -[Web bundle](../../bundle/web-app/README.zh.md)和 [SDK bundle](../../bundle/sdk-app/README.zh.md)以 `office-kit` 条目挂载此提供方;[Office 工具](../tool-office/README.zh.md)是其面向模型的消费方。独立组合通过 `cordis.yml` 条目挂载 `@deepseek-ai/dsh-office-kit`。 +[Web bundle](../../bundle/web-app/README.zh.md)和 [SDK bundle](../../bundle/sdk-app/README.zh.md)以 `office-kit` 条目挂载此提供方;[Office 工具](../tool-document/README.zh.md)是其面向模型的消费方。独立组合通过 `cordis.yml` 条目挂载 `@deepseek-ai/dsh-office-kit`。 -调用方提交已授权源的标识、版本、可选字节数、延迟的有界读取、输入扩展名;PDF 转换还指定调度优先级,图片渲染、格式转换和重算以前台优先级运行。源版本变化会拒绝操作。取消以原因为拒绝值,失败使用 `OfficeKitError`,其小写 `code` 也是 `document-render/failed` 的原因;[`dsh-tool-office`](../tool-office/README.zh.md#use-this-package) 在工具结果中把它映射为 `OfficeToolError` 的代码。每个结果都携带缺失字体;PDF 结果还携带转换 generation(配置替换后随之改变)。 +调用方提交已授权源的标识、版本、可选字节数、延迟的有界读取、输入扩展名;PDF 转换还指定调度优先级,图片渲染、格式转换和重算以前台优先级运行。源版本变化会拒绝操作。取消以原因为拒绝值,失败使用 `OfficeKitError`,其小写 `code` 也是 `document-render/failed` 的原因;[`dsh-tool-document`](../tool-document/README.zh.md#use-this-package) 在工具结果中把它映射为 `OfficeToolError` 的代码。每个结果都携带缺失字体;PDF 结果还携带转换 generation(配置替换后随之改变)。 | 方法 | 操作 | 结果 | |---|---|---| @@ -36,11 +36,11 @@ kind: "package-reference" | `convertTo()` | 转换为 `format` 指定的格式;CSV 需要 `sheet` | 已保存文件的 Host 路径、大小和 PDF 页数 | | `recalculate()` | 把 XLS、XLSX 或 ODS 重算为 XLSX 或 ODS | 已保存工作簿的 Host 路径和大小 | -`renderImages()` 要求提供 `maxImages`、`maxPixels`、`maxDimension` 和 `maxBytes`。图片数超过 `maxImages`,或单张图片超过像素或尺寸上限时,引擎拒绝该选择;图片 PNG 总字节数超过 `maxBytes` 时,提供方在读取前和读取过程中以 `output-too-large` 拒绝。引擎拒绝的页、工作表、区域、分辨率或格式选择以 `invalid-request` 失败,并附带引擎的说明。转换和重算的文件受 `maxOutputBytes` 限制。提供方从不写入工作区:它把每个输出保存在 `outputDirectory` 下各自仅属主可访问的目录中,按请求的 `output.owner`(`office_convert` 和 `office_recalculate` 传入调用方 subagent 树的根 Session)分组,并返回绝对 Host 路径。文件在 `outputRetentionMs` 到期、较新的输出需要 `maxOutputStoreBytes` 内的空间(最旧的先删)、id 等于 owner 的 Session 卸载或提供方卸载时删除;单个文件超过 `maxOutputStoreBytes` 时以 `output-too-large` 失败。文件在删除成功之前一直计入 `maxOutputStoreBytes`;删除失败时记录日志,并在之后的淘汰、释放和卸载时重试,腾不出足够空间的保存以 `unavailable` 失败。卸载会等待进行中的删除结束。启动时还会删除之前进程留下的、超过保留期的输出目录,但只处理名字符合提供方生成格式的真实目录,不处理链接或 junction:`outputDirectory` 下一级为 `session-` 加 24 位小写十六进制数字,其下为小写 UUID v4 的输出目录。其他条目保持不动。服务公开 `outputDirectory`,供消费方检查其执行环境能否读取。 +`renderImages()` 要求提供 `maxImages`、`maxPixels`、`maxDimension` 和 `maxBytes`。图片数超过 `maxImages`,或单张图片超过像素或尺寸上限时,引擎拒绝该选择;图片 PNG 总字节数超过 `maxBytes` 时,提供方在读取前和读取过程中以 `output-too-large` 拒绝。引擎拒绝的页、工作表、区域、分辨率或格式选择以 `invalid-request` 失败,并附带引擎的说明。转换和重算的文件受 `maxOutputBytes` 限制。提供方从不写入工作区:它把每个输出保存在 `outputDirectory` 下各自仅属主可访问的目录中,按请求的 `output.owner`(`document_convert` 和 `document_recalculate` 传入调用方 subagent 树的根 Session)分组,并返回绝对 Host 路径。文件在 `outputRetentionMs` 到期、较新的输出需要 `maxOutputStoreBytes` 内的空间(最旧的先删)、id 等于 owner 的 Session 卸载或提供方卸载时删除;单个文件超过 `maxOutputStoreBytes` 时以 `output-too-large` 失败。文件在删除成功之前一直计入 `maxOutputStoreBytes`;删除失败时记录日志,并在之后的淘汰、释放和卸载时重试,腾不出足够空间的保存以 `unavailable` 失败。卸载会等待进行中的删除结束。启动时还会删除之前进程留下的、超过保留期的输出目录,但只处理名字符合提供方生成格式的真实目录,不处理链接或 junction:`outputDirectory` 下一级为 `session-` 加 24 位小写十六进制数字,其下为小写 UUID v4 的输出目录。其他条目保持不动。服务公开 `outputDirectory`,供消费方检查其执行环境能否读取。 `renderImages()` 在准入前选定渲染后端。请求的 `renderer` 只使用该后端:`poppler` 用于非 PDF 输入时以 `unsupported-format` 失败,后端不可用时以 `unavailable` 失败。未指定 `renderer` 时,PDF 输入取 `renderers.pdf`、其他输入取 `renderers.office` 中第一个可用的后端,最后一项不预先检查,直接使用。只有「不可用」才会换下一项;选中的后端运行失败、超时或输出无效时直接拒绝请求。Kit 能导入时 LibreOffice 可用。`subprocess` 服务存在,且能在其执行环境中找到两个已配置的可执行文件时,Poppler 可用;组合了 SSH 提供方时,该执行环境是 SSH 主机。结果注明所用后端,缓存的渲染结果按后端分别保存。 -Poppler 渲染 PDF 页面时不占用 LibreOffice 转换器槽位,但仍共用队列准入、并发和源字节预留。每个进程从 stdin 读取 PDF,提供方与进程之间不传递任何文件。`pdfinfo` 报告页数及每个所选页面的裁剪框尺寸和旋转,提供方在渲染前按 LibreOffice 路径的错误码拒绝选择:页数超过 `maxImages`,或某页在所请求的 DPI(默认 144)下超过 `maxPixels` 或 `maxDimension`,为 `output-too-large`;页码超出文档为 `invalid-request`。随后 `pdftoppm` 对每段连续页码各渲染一次,把 PNG 图片首尾相接写到 stdout。提供方在数据到达时按 PNG chunk 边界切分,字节数超过剩余的 `maxBytes` 时终止 `pdftoppm` 并报 `output-too-large`,要求该段每页恰好一张图片,按每张图片头部的尺寸再次核对上限,并返回空的 `missingFonts` 列表。退出码 1 映射为 `invalid-document`,超过 `timeoutMs` 期限映射为 `timeout`,其他失败映射为 `failed`。 +Poppler 渲染 PDF 页面时不占用 LibreOffice 转换器槽位,但仍共用队列准入、并发和源字节预留。每个进程从 stdin 读取 PDF,提供方与进程之间不传递任何文件。第一个 `pdfinfo` 报告页数,取其最后一行 `Pages:`,因为标题等文档属性先输出;第二个报告从第一个到最后一个所选页面中每页的裁剪框尺寸和旋转,提供方在渲染前按 LibreOffice 路径的错误码拒绝选择:页数超过 `maxImages`,或某页在所请求的 DPI(默认 144)下超过 `maxPixels` 或 `maxDimension`,为 `output-too-large`;页码超出文档为 `invalid-request`。随后 `pdftoppm` 对每段连续页码各渲染一次,把 PNG 图片首尾相接写到 stdout。提供方在数据到达时按 PNG chunk 边界切分,字节数超过剩余的 `maxBytes` 时终止 `pdftoppm` 并报 `output-too-large`,要求该段每页恰好一张图片,按每张图片头部的尺寸再次核对上限,并返回空的 `missingFonts` 列表。退出码 1 映射为 `invalid-document`,超过 `timeoutMs` 期限映射为 `timeout`,其他失败映射为 `failed`。 此 provider 依赖独立发布的 [`@deepseek-ai/libreoffice-kit`](https://github.com/deepseek-ai/dsh-libreoffice-kit) npm API,kit 版本为 `0.2.3`。应用打包选择 kit 的 `optionalDependencies` 中声明的匹配原生包;目标没有声明原生包时选择 WASM。已声明的原生引擎缺失时拒绝打包,不会选择 WASM。[发布归属决策](../../../.agents/notes/implemented/architecture/2026-09-14-independent-libreoffice-kit.zh.md)定义独立 kit 与 Harness 各自的职责。 @@ -102,7 +102,7 @@ Poppler 进程通过 `subprocess` 服务以 argv 启动,从不经过 shell 命 ## 延伸阅读 - [Office Kit](../../../docs/subsystems/office-kit.zh.md) — 组合与输入、结果所有权。 -- [Office 工具](../tool-office/README.zh.md) — 面向模型的渲染、转换和重算工具。 +- [Office 工具](../tool-document/README.zh.md) — 面向模型的渲染、转换和重算工具。 - [工作区文件](../../api/workspace-files/README.zh.md) — Session 文件授权与有界读取。 ----- @@ -110,7 +110,7 @@ Poppler 进程通过 `subprocess` 服务以 argv 启动,从不经过 shell 命 ## 模型体验 -间接地,通过 [Office 工具](../tool-office/README.zh.md#model-experience),这些工具返回此服务渲染的图片和转换的文件。 +间接地,通过 [Office 工具](../tool-document/README.zh.md#model-experience),这些工具返回此服务渲染的图片和转换的文件。 #### KV Cache effect @@ -126,7 +126,7 @@ Poppler 进程通过 `subprocess` 服务以 argv 启动,从不经过 shell 命 - 渲染的图片以字节返回。转换和重算后的文件存放在提供方的输出目录中,不写入工作区;由调用方把每个文件复制到目标位置。 - 映射原生路径时不验证解包副本是否存在。Kit 会拒绝缺失的清单或资源,而不会将其视为原生包缺失。 - Poppler 作为 subprocess 提供方的普通进程运行,不受 DSH 沙箱约束,也没有内存上限;只有 `timeoutMs` 约束它。提供方既不安装 Poppler,也不检查其版本。 -- 每个 Poppler 进程都从 stdin 接收完整的 PDF,因此包含多段页码的渲染会为每个 `pdfinfo` 和 `pdftoppm` 进程各发送一次源文件;使用 SSH 提供方时,每份副本都经过 SSH 连接。 +- 每个 Poppler 进程都从 stdin 接收完整的 PDF,因此一次渲染会把源文件发给两个 `pdfinfo` 进程,并为每段连续页码发给一个 `pdftoppm` 进程;使用 SSH 提供方时,每份副本都经过 SSH 连接。 - Poppler 与 LibreOffice 光栅化 PDF 页面的方式不同,同一页由不同后端渲染的图片可能有差异。 diff --git a/packages/document/office-kit/package.json b/packages/document/office-kit/package.json index e8fb0e9cb6..478f90b1d4 100644 --- a/packages/document/office-kit/package.json +++ b/packages/document/office-kit/package.json @@ -58,7 +58,8 @@ "@deepseek-ai/cordis-plugin-include": "workspace:~", "@deepseek-ai/dsh-api-workspace-files": "workspace:*", "@deepseek-ai/dsh-fs": "workspace:*", - "@deepseek-ai/dsh-session": "workspace:*" + "@deepseek-ai/dsh-session": "workspace:*", + "@deepseek-ai/dsh-subprocess-local": "workspace:*" }, "dependencies": { "@deepseek-ai/libreoffice-kit": "0.2.3", diff --git a/packages/document/office-kit/src/index.ts b/packages/document/office-kit/src/index.ts index d1fbf6131d..51e3cf93a2 100644 --- a/packages/document/office-kit/src/index.ts +++ b/packages/document/office-kit/src/index.ts @@ -20,7 +20,7 @@ import { OfficeKitError } from './errors.ts' import type { OfficeKitGeneration, OfficeSourceKey } from './identity.ts' import type { OfficeConversionRequest, OfficeFileResult, OfficeImageInputExtension, OfficeImagesRequest, OfficeImagesResult, - OfficeKitRequest, OfficeKitResult, OfficeKitPriority, OfficeOutputTarget, OfficeRecalculationRequest, OfficeRenderer, + OfficeKitRequest, OfficeKitResult, OfficeKitPriority, OfficeOutputTarget, OfficeRecalculationRequest, DocumentRenderer, RenderedDocumentBytes, } from './types.ts' import { readOutput, readPdf, readPng } from './output.ts' @@ -91,9 +91,9 @@ export interface Config { */ renderers: { /** Order for every input except PDF; excludes `poppler`, which renders only PDF. */ - office: OfficeRenderer[] + office: DocumentRenderer[] /** Order for PDF input. */ - pdf: OfficeRenderer[] + pdf: DocumentRenderer[] } /** Poppler executables used by the `poppler` renderer. */ poppler: { @@ -254,8 +254,8 @@ export class OfficeKit extends TypertRemoteService { /** Select the rendering backend for one request; see {@link renderImages}. */ private async resolveRenderer( - extension: OfficeImageInputExtension, requested: OfficeRenderer | undefined, signal: AbortSignal | undefined, - ): Promise { + extension: OfficeImageInputExtension, requested: DocumentRenderer | undefined, signal: AbortSignal | undefined, + ): Promise { signal?.throwIfAborted() if (requested !== undefined) { if (requested === 'poppler' && extension !== 'pdf') { @@ -270,19 +270,19 @@ export class OfficeKit extends TypertRemoteService { if (await this.unavailableRenderer(candidate, signal) === undefined) return candidate } // Validated configuration lists are nonempty. - return candidates[candidates.length - 1] as OfficeRenderer + return candidates[candidates.length - 1] as DocumentRenderer } /** * Check whether `renderer` can start on this Host. * @returns undefined when it can, otherwise the `unavailable` failure; cancellation rejects with its reason. */ - private async unavailableRenderer(renderer: OfficeRenderer, signal: AbortSignal | undefined): Promise { + private async unavailableRenderer(renderer: DocumentRenderer, signal: AbortSignal | undefined): Promise { try { switch (renderer) { case 'libreoffice': await this.loadKit(); return undefined case 'poppler': await locatePoppler(this.ctx, this.config.poppler, signal); return undefined - /* v8 ignore next -- OfficeRenderer is a closed union */ + /* v8 ignore next -- DocumentRenderer is a closed union */ default: throw new Error(`Unexpected Office renderer: ${JSON.stringify(renderer satisfies never)}`) } } catch (error) { diff --git a/packages/document/office-kit/src/poppler.ts b/packages/document/office-kit/src/poppler.ts index 5f9ffe3a60..21b6143511 100644 --- a/packages/document/office-kit/src/poppler.ts +++ b/packages/document/office-kit/src/poppler.ts @@ -88,12 +88,13 @@ export async function renderPdf( const run = AbortSignal.any([signal, deadline.signal]) try { const pageCount = parsePageCount(await runTool(tools, 'pdfinfo', ['-'], pdf, run, PDFINFO_STDOUT_BYTES)) - const runs = contiguousRuns(selectPages(operation, pageCount)) - for (const [first, last] of runs) { - const sizes = await runTool(tools, 'pdfinfo', ['-f', String(first), '-l', String(last), '-'], pdf, run, - PDFINFO_STDOUT_BYTES + (last - first + 1) * PDFINFO_PAGE_BYTES) - checkPageSizes(sizes, first, last, dpi, operation) - } + const pages = selectPages(operation, pageCount) + const runs = contiguousRuns(pages) + const spanFirst = Math.min(...pages) + const spanLast = Math.max(...pages) + const sizes = await runTool(tools, 'pdfinfo', ['-f', String(spanFirst), '-l', String(spanLast), '-'], pdf, run, + PDFINFO_STDOUT_BYTES + (spanLast - spanFirst + 1) * PDFINFO_PAGE_BYTES) + for (const [first, last] of runs) checkPageSizes(sizes, first, last, dpi, operation) const images: OfficeImage[] = [] let remaining = operation.maxBytes for (const [first, last] of runs) { @@ -159,14 +160,19 @@ function contiguousRuns(pages: readonly number[]): [number, number][] { return runs } +/** + * Read the page count from the last `Pages:` line. pdfinfo prints document properties such as Title before it, and a + * property value containing a newline can forge an earlier `Pages:` line; only fixed-format fields follow the real one. + */ function parsePageCount(stdout: string): number { - const match = /^Pages:\s+(\d+)\s*$/mu.exec(stdout) - if (match === null) throw new OfficeKitError('invalid-output', 'pdfinfo did not report the page count.') + const match = [...stdout.matchAll(/^Pages:\s+(\d+)\s*$/gmu)].at(-1) + if (match === undefined) throw new OfficeKitError('invalid-output', 'pdfinfo did not report the page count.') return Number(match[1]) } /** Refuse pages whose crop box at `dpi` exceeds the pixel or dimension limit. */ function checkPageSizes(stdout: string, first: number, last: number, dpi: number, operation: ImagesOperation): void { + // pdfinfo prints the real page lines after the document properties, so they overwrite any line a property value forges. const sizes = new Map() const rotations = new Map() for (const match of stdout.matchAll(/^Page\s+(\d+)\s+size:\s+([\d.]+)\s+x\s+([\d.]+)\s+pts/gmu)) { @@ -282,18 +288,18 @@ class PngSplitter { * reports the outcome. */ async function feed(stdin: Writable, bytes: Uint8Array): Promise { - let stopped = false + const state = { stopped: false } const stop = new Promise((resolve) => { - const end = (): void => { stopped = true; resolve() } + const end = (): void => { state.stopped = true; resolve() } stdin.on('error', end) stdin.once('close', end) }) - for (let offset = 0; offset < bytes.byteLength && !stopped; offset += STDIN_CHUNK_BYTES) { + for (let offset = 0; offset < bytes.byteLength && !state.stopped; offset += STDIN_CHUNK_BYTES) { if (!stdin.write(bytes.subarray(offset, offset + STDIN_CHUNK_BYTES))) { await Promise.race([new Promise((resolve) => { stdin.once('drain', resolve) }), stop]) } } - if (!stopped) stdin.end() + if (!state.stopped) stdin.end() } /** diff --git a/packages/document/office-kit/src/queue.ts b/packages/document/office-kit/src/queue.ts index 2f48bf13a3..c5bd5a177e 100644 --- a/packages/document/office-kit/src/queue.ts +++ b/packages/document/office-kit/src/queue.ts @@ -4,7 +4,7 @@ import { OfficeKitError } from './errors.ts' import { brandString } from '@deepseek-ai/dsh-brand' import type { OfficeKitKey, OfficeKitGeneration } from './identity.ts' import type { - OfficeConversionFormat, OfficeImage, OfficeKitPriority, OfficeKitSource, OfficeRecalculationFormat, OfficeRenderer, + OfficeConversionFormat, OfficeImage, OfficeKitPriority, OfficeKitSource, OfficeRecalculationFormat, DocumentRenderer, } from './types.ts' import type { Config } from './index.ts' @@ -14,7 +14,7 @@ export type OfficeOperation = | { readonly kind: 'images' /** Backend resolved before admission, so cached renderings never cross backends. */ - readonly renderer: OfficeRenderer + readonly renderer: DocumentRenderer readonly pages?: readonly number[] readonly sheet?: string readonly range?: string diff --git a/packages/document/office-kit/src/types.ts b/packages/document/office-kit/src/types.ts index 11a4ba74b0..75abf1eee6 100644 --- a/packages/document/office-kit/src/types.ts +++ b/packages/document/office-kit/src/types.ts @@ -51,7 +51,7 @@ export type OfficeRecalculationFormat = 'xlsx' | 'ods' * Image rendering backend: `libreoffice` renders every image input in the provider's LibreOffice Kit converter; * `poppler` renders PDF only, through short-lived `pdfinfo` and `pdftoppm` subprocesses. */ -export type OfficeRenderer = 'libreoffice' | 'poppler' +export type DocumentRenderer = 'libreoffice' | 'poppler' /** * Render selected pages, slides, or worksheet areas of one document as PNG images. @@ -64,7 +64,7 @@ export interface OfficeImagesRequest { * Backend to use exclusively; omission selects the first available backend of the provider's `renderers` order * for this input. `poppler` accepts only `pdf`. */ - readonly renderer?: OfficeRenderer + readonly renderer?: DocumentRenderer /** Distinct one-based pages or slides; omission renders every page. */ readonly pages?: readonly number[] /** Exact worksheet name; omission renders each visible worksheet's data area. */ @@ -108,7 +108,7 @@ export interface OfficeImagesResult { /** Requested OOXML font families unavailable to this rendering. */ readonly missingFonts: string[] /** Backend that rendered the images. */ - readonly renderer: OfficeRenderer + readonly renderer: DocumentRenderer } /** Owner and file name of a converted or recalculated output saved in the provider's output store. */ diff --git a/packages/document/office-kit/tests/poppler-real.spec.ts b/packages/document/office-kit/tests/poppler-real.spec.ts index ca7e44736e..230875ab8e 100644 --- a/packages/document/office-kit/tests/poppler-real.spec.ts +++ b/packages/document/office-kit/tests/poppler-real.spec.ts @@ -1,72 +1,41 @@ -/** Real Poppler executables render a generated PDF through stdin and stdout; skipped when pdftoppm or pdfinfo is not on PATH. */ -import { spawn as spawnChild } from 'node:child_process' -import { existsSync, statSync } from 'node:fs' +/** + * Real Poppler executables render a generated PDF through the local subprocess provider; skipped when that provider + * cannot resolve pdftoppm or pdfinfo. + */ import { mkdtemp, rm } from 'node:fs/promises' import { tmpdir } from 'node:os' -import { delimiter, join } from 'node:path' +import { join } from 'node:path' import { Context } from '@deepseek-ai/cordis' import { afterEach, beforeEach, expect, it, onTestFinished } from 'vitest' import { brandString } from '@deepseek-ai/dsh-brand' -import { - SubprocessExecutableNotFoundError, SubprocessRuntime, type SubprocessHandle, type SubprocessOutcome, - type SubprocessSpawnSpec, -} from '@deepseek-ai/dsh-subprocess' +import LocalSubprocessRuntime from '@deepseek-ai/dsh-subprocess-local' import OfficeKit, { type OfficeImagesRequest, type OfficeSourceKey } from '../src/index.ts' -/** First executable named `command` on PATH, honoring PATHEXT on Windows. */ -function onPath(command: string): string | undefined { - const extensions = process.platform === 'win32' ? (process.env.PATHEXT ?? '.EXE').split(';') : [''] - for (const directory of (process.env.PATH ?? '').split(delimiter)) { - for (const extension of extensions) { - const candidate = join(directory, command + extension) - if (directory !== '' && existsSync(candidate) && statSync(candidate).isFile()) return candidate - } - } - return undefined +/** Whether the local subprocess provider resolves both Poppler executables on this Host. */ +async function popplerAvailable(): Promise { + const probe = new Context() + try { + await probe.plugin(LocalSubprocessRuntime) + await Promise.all(['pdftoppm', 'pdfinfo'].map(command => probe.subprocess.resolveExecutable(command))) + return true + } catch (_notFound) { + // An executable the provider cannot resolve means Poppler is not installed for these tests. + return false + } finally { await probe.fiber.dispose() } } -const available = onPath('pdftoppm') !== undefined && onPath('pdfinfo') !== undefined +const available = await popplerAvailable() /** - * Host subprocess provider over `node:child_process` with the piped and collected stdio Poppler rendering requests; the - * product provider's sandboxing and process-range management are outside this test's scope. + * A two-page PDF: a 200x100 pt page and the same page rotated by 90 degrees. + * @param title - literal string of the Info dictionary's Title, in PDF syntax. */ -class ChildProcessRuntime extends SubprocessRuntime { - async terminalEnvironment() { return { platform: process.platform === 'win32' ? 'windows' as const : 'posix' as const } } - override spawnTerminal(): Promise { throw new Error('Poppler never spawns terminals') } - override async resolveExecutable(command: string): Promise { - const path = onPath(command) - if (path === undefined) throw new SubprocessExecutableNotFoundError(`${command} is not on PATH`) - return path - } - - override spawn(spec: SubprocessSpawnSpec): SubprocessHandle { - const child = spawnChild(spec.argv[0]!, spec.argv.slice(1), { cwd: spec.cwd, stdio: 'pipe', signal: spec.signal }) - const pipedStdout = spec.stdio.stdout === 'pipe' - const text = { stdout: '', stderr: '' } - if (!pipedStdout) child.stdout.on('data', (chunk: Buffer) => { text.stdout += chunk.toString('utf8') }) - child.stderr.on('data', (chunk: Buffer) => { text.stderr += chunk.toString('utf8') }) - const done = new Promise((resolve) => { - child.on('error', (_aborted: unknown) => undefined) - child.on('close', (exitCode, signal) => { resolve({ exitCode, signal }) }) - }) - const reader = (stream: 'stdout' | 'stderr') => ({ readFrom: () => ({ text: text[stream], nextOffset: 0, lossy: false }) }) - return { - stdin: child.stdin, stdout: pipedStdout ? child.stdout : undefined, stderr: undefined, control: undefined, - collected: { ...pipedStdout ? {} : { stdout: reader('stdout') }, stderr: reader('stderr') }, - done, - terminate: () => { child.kill() }, - waitForExit: async () => { await done; return true }, - } - } -} - -/** A two-page PDF: a 200x100 pt page and the same page rotated by 90 degrees. */ -function twoPagePdf(): Buffer { +function twoPagePdf(title?: string): Buffer { const objects = [ '<< /Type /Catalog /Pages 2 0 R >>', '<< /Type /Pages /Kids [3 0 R 4 0 R] /Count 2 >>', '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 200 100] /Resources << >> >>', '<< /Type /Page /Parent 2 0 R /MediaBox [0 0 200 100] /Rotate 90 /Resources << >> >>', + ...title === undefined ? [] : [`<< /Title (${title}) >>`], ] let body = '%PDF-1.4\n' const offsets: number[] = [] @@ -77,7 +46,8 @@ function twoPagePdf(): Buffer { const xref = Buffer.byteLength(body) body += `xref\n0 ${objects.length + 1}\n0000000000 65535 f \n` for (const offset of offsets) body += `${String(offset).padStart(10, '0')} 00000 n \n` - body += `trailer\n<< /Size ${objects.length + 1} /Root 1 0 R >>\nstartxref\n${xref}\n%%EOF\n` + const info = title === undefined ? '' : ' /Info 5 0 R' + body += `trailer\n<< /Size ${objects.length + 1} /Root 1 0 R${info} >>\nstartxref\n${xref}\n%%EOF\n` return Buffer.from(body, 'latin1') } @@ -86,7 +56,7 @@ beforeEach(() => { ctx = new Context() }) afterEach(async () => { await ctx.fiber.dispose() }) async function mount(): Promise { - await ctx.plugin(ChildProcessRuntime) + await ctx.plugin(LocalSubprocessRuntime) const outputDirectory = await mkdtemp(join(tmpdir(), 'dsh-office-kit-outputs-')) onTestFinished(() => rm(outputDirectory, { recursive: true, force: true })) await ctx.plugin(OfficeKit, { outputDirectory }) @@ -113,6 +83,13 @@ it.skipIf(!available)('renders every page of a PDF at the page size and rotation expect((await provider.renderImages(request(twoPagePdf(), { pages: [2] }))).images.map(image => image.page)).toEqual([2]) }) +it.skipIf(!available)('renders every page when a document title forges a smaller page count', async () => { + const provider = await mount() + const result = await provider.renderImages(request(twoPagePdf('Forged\\nPages: 1\\n'))) + expect(result.pageCount).toBe(2) + expect(result.images.map(image => image.page)).toEqual([1, 2]) +}) + it.skipIf(!available)('reports a file Poppler cannot open as an invalid document', async () => { const provider = await mount() await expect(provider.renderImages(request(Buffer.from('not a pdf at all')))) diff --git a/packages/document/office-kit/tests/poppler.spec.ts b/packages/document/office-kit/tests/poppler.spec.ts index df45138a30..c04624658c 100644 --- a/packages/document/office-kit/tests/poppler.spec.ts +++ b/packages/document/office-kit/tests/poppler.spec.ts @@ -174,7 +174,7 @@ async function defaultRun(spec: SubprocessSpawnSpec, input: Promise): Pr for (let page = span[0]; page <= span[1]; page++) { const { width, height, rotate } = pages[page - 1]! lines.push(`Page ${String(page).padStart(4)} size: ${width} x ${height} pts`) - if (rotate !== undefined) lines.push(`Page ${String(page).padStart(4)} rot: ${rotate}`) + lines.push(`Page ${String(page).padStart(4)} rot: ${rotate ?? 0}`) } return { stdout: `${lines.join('\n')}\nFile size: 42 bytes\n` } } @@ -337,10 +337,34 @@ describe('Poppler processes', () => { const provider = await mount() const result = await provider.renderImages(pdfRequest({ pages: [10, 1, 2, 4, 5, 12], dpi: 72 })) expect(result.images.map(image => [image.page, image.width])).toEqual([[1, 72], [2, 73], [4, 75], [5, 76], [10, 81], [12, 83]]) - expect(spawned('pdfinfo').map(handle => range(handle.spec.argv))).toEqual([undefined, [1, 2], [4, 5], [10, 10], [12, 12]]) + expect(spawned('pdfinfo').map(handle => range(handle.spec.argv))).toEqual([undefined, [1, 12]]) + expect(spawned('pdfinfo')[1]!.spec.stdio.stdout).toEqual({ maxBytes: 65536 + 12 * 256 }) expect(spawned('pdftoppm').map(handle => range(handle.spec.argv))).toEqual([[1, 2], [4, 5], [10, 10], [12, 12]]) }) + it('reads the page count and page sizes after document properties that forge earlier lines', async () => { + FakeSubprocess.pages = [{ width: 72, height: 144 }, { width: 72, height: 144 }] + const forged = 'Title: Forged\nPages: 1\nPage 1 size: 99999 x 99999 pts\n' + scriptOnly('pdfinfo', async (spec, input) => { + const run = await defaultRun(spec, input) + return { stdout: `${forged}${run.stdout!}` } + }) + const provider = await mount() + const result = await provider.renderImages(pdfRequest({ maxDimension: 288 })) + expect(result.pageCount).toBe(2) + expect(result.images.map(image => image.page)).toEqual([1, 2]) + }) + + it('treats a page without a rot line as unrotated', async () => { + scriptOnly('pdfinfo', async (spec, input) => { + const run = await defaultRun(spec, input) + return { stdout: run.stdout!.replace(/^Page\s+\d+\s+rot:.*$/gmu, '') } + }) + const provider = await mount() + await expect(provider.renderImages(pdfRequest({ maxDimension: 287 }))) + .rejects.toMatchObject({ code: 'output-too-large', message: expect.stringContaining('Page 1 renders at 144x288 px') as string }) + }) + it.each([1, 3, 7, 13])('splits PNG streams whose headers and chunks span reads of %i bytes', async (size) => { FakeSubprocess.readBytes = size const provider = await mount() diff --git a/packages/document/tool-document/README.i18n.yaml b/packages/document/tool-document/README.i18n.yaml new file mode 100644 index 0000000000..e982df200c --- /dev/null +++ b/packages/document/tool-document/README.i18n.yaml @@ -0,0 +1,46 @@ +# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading +# section, a hash of its English and Chinese blocks outside code blocks and generated regions. +# After editing either side, bring the other along and re-record with: +# pnpm run verify-translation-pairing --write packages/document/tool-document/README.md +/: + en: 2ec7e66cd18356df + zh: 4862555b5a4c9f51 +/deepseek-ai-dsh-tool-document: + en: 12d5699f4b0698fa + zh: 0cc349aeecf450bc +/deepseek-ai-dsh-tool-document/summary: + en: 56c2057de58e9055 + zh: 6ca7b2e9e3b1c45d +/deepseek-ai-dsh-tool-document/table-of-contents: + en: d152484eb41ac6b4 + zh: 09388d293f9be9cb +/deepseek-ai-dsh-tool-document/use-this-package: + en: 8691bc7c5561d20a + zh: 53d7cf43184ab0bd +/deepseek-ai-dsh-tool-document/understand-the-implementation: + en: e7f0c4f5c5507a5e + zh: 91a853a25f80309e +/deepseek-ai-dsh-tool-document/further-exploration: + en: 5d20d2318d1957cf + zh: 8b8111099ab8bb46 +/deepseek-ai-dsh-tool-document/model-experience: + en: 215e7ba838619b7b + zh: a311da3843709f90 +/deepseek-ai-dsh-tool-document/model-experience/document-render-document-convert-document-recalculate: + en: 669fa1ec3c132775 + zh: 669fa1ec3c132775 +/deepseek-ai-dsh-tool-document/model-experience/document-render-document-convert-document-recalculate/what-the-model-sees: + en: 11c4f182e9fefe16 + zh: bd297441cf62228d +/deepseek-ai-dsh-tool-document/model-experience/document-render-document-convert-document-recalculate/token-effect: + en: b8d5d8c33c7563d4 + zh: 5b6cb183b690bdba +/deepseek-ai-dsh-tool-document/model-experience/document-render-document-convert-document-recalculate/kv-cache-effect: + en: c4e3595dab58a800 + zh: 65f7fcf46b1e3130 +/deepseek-ai-dsh-tool-document/known-limitations-and-deferred-work: + en: 2f9cadab78ede778 + zh: 8e62d25a68f7a613 +/deepseek-ai-dsh-tool-document/known-limitations-and-deferred-work/dev-note: + en: e67f633dc6fe7773 + zh: e88aeb617ffb74ea diff --git a/packages/document/tool-office/README.md b/packages/document/tool-document/README.md similarity index 86% rename from packages/document/tool-office/README.md rename to packages/document/tool-document/README.md index 29145a6780..3ec9a75e00 100644 --- a/packages/document/tool-office/README.md +++ b/packages/document/tool-document/README.md @@ -3,13 +3,13 @@ description: "Skill-activated Office tools for viewing document pages, convertin kind: "package-reference" --- -# @deepseek-ai/dsh-tool-office +# @deepseek-ai/dsh-tool-document English | [中文](README.zh.md) ## Summary -After an Office skill loads, the model gains three tools. `office_render` returns document pages, slides, or worksheet areas as images for layout inspection, without temporary image files or a separate image read. `office_convert` produces a document in another format; `office_recalculate` refreshes workbook formulas. Both return a temporary file to copy to its destination with the shell. The tools do not modify inputs or write workspace files, and work in standard and PTC modes alike. +After an Office skill loads, the model gains three tools. `document_render` returns document pages, slides, or worksheet areas as images for layout inspection, without temporary image files or a separate image read. `document_convert` produces a document in another format; `document_recalculate` refreshes workbook formulas. Both return a temporary file to copy to its destination with the shell. The tools do not modify inputs or write workspace files, and work in standard and PTC modes alike. ## Table of Contents @@ -33,7 +33,7 @@ The tools read the Office kit service at each call. When Kit is missing, calls f ```yaml - name: '@deepseek-ai/dsh-office-kit' -- name: '@deepseek-ai/dsh-tool-office' +- name: '@deepseek-ai/dsh-tool-document' config: maxImages: 20 ``` @@ -48,7 +48,7 @@ The tools read the Office kit service at each call. When Kit is missing, calls f A render applies the lower of each field and the attachment store's corresponding image limit (`maxImagesPerMessage`, `maxImagePixels`, `maxImageDimension`, `maxMessageImageBytes`), and refuses any single image above `maxImageBytes` of the store. A selection beyond a bound fails instead of being truncated. Rendering requires an attachment store and a calling model route that declares image input. The tool reads that route from the latest model request of the Session, or from the agent options before the first request, and refuses a model whose input modalities omit images or are not declared before any rendering work starts. -Inputs resolve against the Session working directory and use the filesystem backend's read authority, as `read` and Office previews do, so files outside the workspace are readable. The input extension selects the document family. `office_convert` accepts Word, Excel, and PowerPoint documents: Word exports to pdf, docx, odt, or txt; Excel to pdf, xlsx, ods, or csv; PowerPoint to pdf, pptx, or odp. CSV export requires a worksheet name for a workbook with several sheets. `office_recalculate` accepts xls, xlsx, and ods workbooks and requires xlsx or ods output. `office_render` also accepts PDF. Its optional `renderer` selects `libreoffice` or `poppler` exclusively; `poppler` renders PDF only, so the tool refuses it for other inputs with `INVALID_ARGS` before any filesystem access. Without `renderer`, the Office kit uses the first available renderer of its [`renderers`](../office-kit/README.md#use-this-package) order for the input type, by default Poppler and then LibreOffice for PDF. The result records the renderer used. +Inputs resolve against the Session working directory and use the filesystem backend's read authority, as `read` and Office previews do, so files outside the workspace are readable. The input extension selects the document family. `document_convert` accepts Word, Excel, and PowerPoint documents: Word exports to pdf, docx, odt, or txt; Excel to pdf, xlsx, ods, or csv; PowerPoint to pdf, pptx, or odp. CSV export requires a worksheet name for a workbook with several sheets. `document_recalculate` accepts xls, xlsx, and ods workbooks and requires xlsx or ods output. `document_render` also accepts PDF. Its optional `renderer` selects `libreoffice` or `poppler` exclusively; `poppler` renders PDF only, so the tool refuses it for other inputs with `INVALID_ARGS` before any filesystem access. Without `renderer`, the Office kit uses the first available renderer of its [`renderers`](../office-kit/README.md#use-this-package) order for the input type, by default Poppler and then LibreOffice for PDF. The result records the renderer used. Conversion and recalculation results name a file in the Office kit's private [output store](../office-kit/README.md#use-this-package) under the Harness home; the model copies it with the shell, so the shell's sandbox and approvals govern where it lands. When the filesystem backend cannot read Host files, such as an SSH workspace, these two tools fail before converting; rendering still works. @@ -68,7 +68,7 @@ Argument checks, including input-dependent conversion formats, and the Office ki Each tool declares its own parameters and result schema. The supported schema subset cannot express page uniqueness, numeric bounds, or cross-parameter rules, so those render selections and input-dependent conversion formats are checked at runtime. Office kit errors are reported as `cannot "": `, where `` is the resolved input path, or the path as given when the service is absent, with a hint for `unavailable` to tell the user or, when the cause may be temporary, to retry later without substituting another converter, a retry hint for `busy`, and a selection hint for oversized renders. Nested PTC calls re-enter the same execution pipeline, so policy and logging apply to them; a nested render's images are attached after the program run. -Successful `tools/result` notifications mark the calling Agent in a plugin-owned WeakSet. The post-commit `session/event` feed also marks direct user skill invocations, without depending on pre-step listener order. `agent/disposed` clears the mark. The three tools share one `when`: the Agent is marked, or the Session's latest public `requestHeader()` lists any Office tool. No additional projection or Session event is registered. +Successful `tools/result` notifications mark the calling Agent in a plugin-owned WeakSet. The post-commit `session/event` feed also marks direct user skill invocations, without depending on pre-step listener order. `agent/disposed` clears the mark. The three tools share one `when`: the Agent is marked, or the Session's latest public `requestHeader()` lists any Office tool, including the earlier names `office_render`, `office_convert`, and `office_recalculate` recorded by Sessions created before the rename. No additional projection or Session event is registered. Native request headers retain Office declarations across resume and fork, including the first request after restoration; compaction replaces conversation content without removing request headers. PTC records only `run_code` in its request header, so a resumed or forked PTC Agent must load an Office skill again. Losing an Agent's memory before a native Office declaration is recorded also loses activation; calling `skill` again restores it on the following step. @@ -86,7 +86,7 @@ Native request headers retain Office declarations across resume and fork, includ ## Model Experience -### office_render, office_convert, office_recalculate +### document_render, document_convert, document_recalculate #### What the model sees @@ -106,8 +106,8 @@ In native mode, activation during a conversation appends one `developer/message` - **Converted files need a shell copy** — the filesystem service creates no binary files, so the model copies each temporary file with the shell. Deployments without a shell tool cannot deliver converted files, and the temporary file is deleted after the Office kit's retention or when the root Session of the caller's subagent tree is disposed; a file a subagent produced stays after that subagent ends. - **No conversion on remote workspaces** — the Office kit runs on the Host, and a remote shell cannot read its output store. -- **Render saves no image file** — `office_render` returns images only for the model to view and writes no PNG or other image file. A user who needs the pages as a file gets a PDF through `office_convert` with `format: "pdf"`. -- **Web GUI does not display rendered images** — the [ui-tool](../../client/ui-tool/README.md) Office row shows the text blocks of an `office_render` result and omits its images, so the user does not see the pages the model inspected. The model still receives every image. +- **Render saves no image file** — `document_render` returns images only for the model to view and writes no PNG or other image file. A user who needs the pages as a file gets a PDF through `document_convert` with `format: "pdf"`. +- **Web GUI does not display rendered images** — the [ui-tool](../../client/ui-tool/README.md) Office row shows the text blocks of an `document_render` result and omits its images, so the user does not see the pages the model inspected. The model still receives every image. - **Native engine in the Host process** — rendering, conversion, and recalculation that the model starts run the native LibreOffice Kit engine inside the Host process, and Poppler renders PDF in subprocesses of the subprocess provider, through `ctx.officeKit`, so the shell sandbox and PTC permissions do not confine them. Inputs remain subject to the filesystem backend's read authority. The native parser processes an untrusted document with the Host user's permissions. - **PTC activation does not survive resume or fork** — the PTC request header records only `run_code`, so a resumed or forked PTC Agent offers no Office bindings until the model loads an Office skill again; the removal and the re-addition each rewrite the system prompt, with the cache effect described under KV Cache effect. - **Plugin reload clears activation** — hot reload, or disabling and re-enabling the plugin, clears the in-memory marks. If a step runs in the meantime, its request header omits the three tools, and the model must load an Office skill again to restore them. diff --git a/packages/document/tool-office/README.zh.md b/packages/document/tool-document/README.zh.md similarity index 86% rename from packages/document/tool-office/README.zh.md rename to packages/document/tool-document/README.zh.md index 586693cc82..05d7761622 100644 --- a/packages/document/tool-office/README.zh.md +++ b/packages/document/tool-document/README.zh.md @@ -3,13 +3,13 @@ description: "由技能激活的 Office 工具,用于查看文档页面、转 kind: "package-reference" --- -# @deepseek-ai/dsh-tool-office +# @deepseek-ai/dsh-tool-document [English](README.md) | 中文 ## 概述 -加载 Office 技能后,模型获得三个工具。`office_render` 将文档页面、幻灯片或工作表区域作为图片返回,用于检查版式,无需临时图片文件或单独读取图片。`office_convert` 生成另一种格式的文档;`office_recalculate` 刷新工作簿公式。二者都返回临时文件,由模型用 shell 复制到目标位置。工具不修改输入,也不写工作区文件,标准模式与 PTC 模式行为相同。 +加载 Office 技能后,模型获得三个工具。`document_render` 将文档页面、幻灯片或工作表区域作为图片返回,用于检查版式,无需临时图片文件或单独读取图片。`document_convert` 生成另一种格式的文档;`document_recalculate` 刷新工作簿公式。二者都返回临时文件,由模型用 shell 复制到目标位置。工具不修改输入,也不写工作区文件,标准模式与 PTC 模式行为相同。 ## 目录 @@ -33,7 +33,7 @@ kind: "package-reference" ```yaml - name: '@deepseek-ai/dsh-office-kit' -- name: '@deepseek-ai/dsh-tool-office' +- name: '@deepseek-ai/dsh-tool-document' config: maxImages: 20 ``` @@ -48,7 +48,7 @@ kind: "package-reference" 渲染对每个字段取其与附件存储对应图片上限(`maxImagesPerMessage`、`maxImagePixels`、`maxImageDimension`、`maxMessageImageBytes`)中的较小值,并拒绝超过存储 `maxImageBytes` 的单张图片。超出上限的选择直接失败,不会被截断。渲染要求挂载附件存储,且调用方模型路由声明支持图片输入。工具从会话最近一次模型请求读取该路由,首次请求之前则读取 agent 选项;模型的输入模态不含图片或未声明时,在开始任何渲染工作之前就会被拒绝。 -输入相对 Session 工作目录解析,并沿用文件系统后端的读取权限,与 `read` 和 Office 预览一致,因此可以读取工作区外的文件。输入扩展名决定文档类别。`office_convert` 接受 Word、Excel 和 PowerPoint 文档:Word 可导出 pdf、docx、odt 或 txt;Excel 可导出 pdf、xlsx、ods 或 csv;PowerPoint 可导出 pdf、pptx 或 odp。多工作表工作簿导出 CSV 时必须指定工作表名。`office_recalculate` 接受 xls、xlsx 和 ods 工作簿,输出必须为 xlsx 或 ods。`office_render` 还接受 PDF。其可选参数 `renderer` 指定只使用 `libreoffice` 或 `poppler`;`poppler` 只渲染 PDF,因此工具对其他输入在访问文件系统前即以 `INVALID_ARGS` 拒绝。未指定 `renderer` 时,Office 套件按其 [`renderers`](../office-kit/README.zh.md#use-this-package) 中该输入类型的顺序使用第一个可用的后端,PDF 默认先用 Poppler,再用 LibreOffice。结果记录实际使用的后端。 +输入相对 Session 工作目录解析,并沿用文件系统后端的读取权限,与 `read` 和 Office 预览一致,因此可以读取工作区外的文件。输入扩展名决定文档类别。`document_convert` 接受 Word、Excel 和 PowerPoint 文档:Word 可导出 pdf、docx、odt 或 txt;Excel 可导出 pdf、xlsx、ods 或 csv;PowerPoint 可导出 pdf、pptx 或 odp。多工作表工作簿导出 CSV 时必须指定工作表名。`document_recalculate` 接受 xls、xlsx 和 ods 工作簿,输出必须为 xlsx 或 ods。`document_render` 还接受 PDF。其可选参数 `renderer` 指定只使用 `libreoffice` 或 `poppler`;`poppler` 只渲染 PDF,因此工具对其他输入在访问文件系统前即以 `INVALID_ARGS` 拒绝。未指定 `renderer` 时,Office 套件按其 [`renderers`](../office-kit/README.zh.md#use-this-package) 中该输入类型的顺序使用第一个可用的后端,PDF 默认先用 Poppler,再用 LibreOffice。结果记录实际使用的后端。 转换和重算结果给出 Office 套件私有[输出存储](../office-kit/README.zh.md#use-this-package)中位于 Harness 主目录下的一个文件;模型用 shell 复制它,因此文件落在哪里由 shell 的沙箱和审批决定。文件系统后端无法读取 Host 文件时(例如 SSH 工作区),这两个工具在转换前即失败;渲染不受影响。 @@ -68,7 +68,7 @@ kind: "package-reference" 每个工具分别声明参数和结果 schema。受支持的 schema 子集无法表达页码唯一性、数值范围和跨参数规则,因此这些渲染选择以及依赖输入类型的转换格式在运行时检查。Office 套件的错误报告为 `cannot "": `,其中 `` 为解析后的输入路径,服务缺失时为调用给出的路径;`unavailable` 附带告知用户、或在其原因可能是暂时的时候稍后重试且不改用其他转换器的提示,`busy` 附带重试提示,渲染过大时附带缩小选择的提示。PTC 嵌套调用重新进入同一执行管线,因此策略和日志同样适用;嵌套渲染的图片在程序运行结束后附加。 -成功的 `tools/result` 通知将调用方 Agent 记入插件拥有的 WeakSet。提交后的 `session/event` 事件流也会标记用户直接调用的技能,不依赖 pre-step 监听器顺序。`agent/disposed` 清除标记。三个工具共用一个 `when`:Agent 已被标记,或 Session 最新的公开 `requestHeader()` 中列出了任一 Office 工具。不注册额外的 projection 或 Session 事件。 +成功的 `tools/result` 通知将调用方 Agent 记入插件拥有的 WeakSet。提交后的 `session/event` 事件流也会标记用户直接调用的技能,不依赖 pre-step 监听器顺序。`agent/disposed` 清除标记。三个工具共用一个 `when`:Agent 已被标记,或 Session 最新的公开 `requestHeader()` 中列出了任一 Office 工具,包括改名前创建的 Session 记录的旧名 `office_render`、`office_convert` 和 `office_recalculate`。不注册额外的 projection 或 Session 事件。 原生请求头在恢复和分叉后保留 Office 声明,包括还原后的首次请求;压缩只替换对话内容,不删除请求头。PTC 的请求头只记录 `run_code`,因此恢复或分叉后的 PTC Agent 必须重新加载 Office 技能。如果 Agent 在原生 Office 声明落盘前丢失内存,激活状态也会丢失;再次调用 `skill` 即可在下一步恢复。 @@ -86,7 +86,7 @@ kind: "package-reference" ## 模型体验 -### office_render, office_convert, office_recalculate +### document_render, document_convert, document_recalculate #### 模型看到的内容 @@ -106,8 +106,8 @@ kind: "package-reference" - **转换后的文件需要 shell 复制** — 文件系统服务不创建二进制文件,因此模型用 shell 复制每个临时文件。没有 shell 工具的部署无法交付转换后的文件;临时文件在 Office 套件的保留期满或调用方 subagent 树的根 Session 卸载后删除;subagent 产出的文件在该 subagent 结束后仍然保留。 - **远程工作区不支持转换** — Office 套件运行在 Host 上,远程 shell 读不到其输出存储。 -- **渲染不保存图片文件** — `office_render` 只返回供模型查看的图片,不写出 PNG 或其他图片文件。需要以文件形式获得页面的用户,通过 `office_convert` 并设置 `format: "pdf"` 获得 PDF。 -- **Web GUI 不显示渲染图片** — [ui-tool](../../client/ui-tool/README.zh.md) 的 Office 行显示 `office_render` 结果的文本块并略去其中的图片,因此用户看不到模型检查过的页面。模型仍会收到每张图片。 +- **渲染不保存图片文件** — `document_render` 只返回供模型查看的图片,不写出 PNG 或其他图片文件。需要以文件形式获得页面的用户,通过 `document_convert` 并设置 `format: "pdf"` 获得 PDF。 +- **Web GUI 不显示渲染图片** — [ui-tool](../../client/ui-tool/README.zh.md) 的 Office 行显示 `document_render` 结果的文本块并略去其中的图片,因此用户看不到模型检查过的页面。模型仍会收到每张图片。 - **原生引擎在 Host 进程内运行** — 由模型发起的渲染、转换和重算通过 `ctx.officeKit` 在 Host 进程内运行原生 LibreOffice Kit 引擎,Poppler 则在 subprocess 提供方的子进程中渲染 PDF,因此不受 shell 沙箱和 PTC 权限约束。输入仍受文件系统后端读取权限的约束。原生解析器以 Host 用户的权限处理不可信的文档。 - **PTC 激活状态不跨恢复和分叉保留** — PTC 请求头只记录 `run_code`,因此恢复或分叉后的 PTC Agent 在模型重新加载 Office 技能前不提供 Office 绑定;移除和重新加入各重写一次系统提示,缓存影响见 KV Cache 影响一节。 - **插件重载会清除激活状态** — 热重载、或停用后再启用插件,会清空内存中的标记。如果期间运行过一步,该步的请求头不再包含这三个工具,模型须重新加载 Office 技能才能恢复。 diff --git a/packages/document/tool-office/locale/de.json b/packages/document/tool-document/locale/de.json similarity index 100% rename from packages/document/tool-office/locale/de.json rename to packages/document/tool-document/locale/de.json diff --git a/packages/document/tool-office/locale/en.json b/packages/document/tool-document/locale/en.json similarity index 100% rename from packages/document/tool-office/locale/en.json rename to packages/document/tool-document/locale/en.json diff --git a/packages/document/tool-office/locale/es.json b/packages/document/tool-document/locale/es.json similarity index 100% rename from packages/document/tool-office/locale/es.json rename to packages/document/tool-document/locale/es.json diff --git a/packages/document/tool-office/locale/fr.json b/packages/document/tool-document/locale/fr.json similarity index 100% rename from packages/document/tool-office/locale/fr.json rename to packages/document/tool-document/locale/fr.json diff --git a/packages/document/tool-office/locale/ja.json b/packages/document/tool-document/locale/ja.json similarity index 100% rename from packages/document/tool-office/locale/ja.json rename to packages/document/tool-document/locale/ja.json diff --git a/packages/document/tool-office/locale/pt.json b/packages/document/tool-document/locale/pt.json similarity index 100% rename from packages/document/tool-office/locale/pt.json rename to packages/document/tool-document/locale/pt.json diff --git a/packages/document/tool-office/locale/ru.json b/packages/document/tool-document/locale/ru.json similarity index 100% rename from packages/document/tool-office/locale/ru.json rename to packages/document/tool-document/locale/ru.json diff --git a/packages/document/tool-office/locale/zh.json b/packages/document/tool-document/locale/zh.json similarity index 100% rename from packages/document/tool-office/locale/zh.json rename to packages/document/tool-document/locale/zh.json diff --git a/packages/document/tool-office/package.json b/packages/document/tool-document/package.json similarity index 96% rename from packages/document/tool-office/package.json rename to packages/document/tool-document/package.json index 9e9538cf2f..afbf39bb9e 100644 --- a/packages/document/tool-office/package.json +++ b/packages/document/tool-document/package.json @@ -1,5 +1,5 @@ { - "name": "@deepseek-ai/dsh-tool-office", + "name": "@deepseek-ai/dsh-tool-document", "description": "Model-facing Office tools for rendering, converting, and recalculating documents", "version": "0.2.3-alpha.2", "publishConfig": { @@ -8,7 +8,7 @@ "repository": { "type": "git", "url": "git+https://github.com/deepseek-ai/deepseek-harness.git", - "directory": "packages/document/tool-office" + "directory": "packages/document/tool-document" }, "type": "module", "main": "lib/index.js", diff --git a/packages/document/tool-office/src/content.ts b/packages/document/tool-document/src/content.ts similarity index 97% rename from packages/document/tool-office/src/content.ts rename to packages/document/tool-document/src/content.ts index 3c6a0663a4..73032dd64c 100644 --- a/packages/document/tool-office/src/content.ts +++ b/packages/document/tool-document/src/content.ts @@ -1,12 +1,12 @@ /** * Canonical Office tool results and their model-facing content. - * @module @deepseek-ai/dsh-tool-office/content + * @module @deepseek-ai/dsh-tool-document/content */ import type { ContentBlock } from '@deepseek-ai/dsh-llm' import type { AttachmentId, ImageAttachmentRef, ImageMediaType } from '@deepseek-ai/dsh-attachment/types' import { brandString } from '@deepseek-ai/dsh-brand' -import type { OfficeConversionFormat, OfficeRecalculationFormat, OfficeRenderer } from '@deepseek-ai/dsh-office-kit' +import type { OfficeConversionFormat, OfficeRecalculationFormat, DocumentRenderer } from '@deepseek-ai/dsh-office-kit' /** * One rendered image and the document location it shows. The attachment fields are those of the stored reference; @@ -35,7 +35,7 @@ export interface OfficeRenderValue { /** Requested font families that were substituted. */ missingFonts: string[] /** Backend that rendered the images. */ - renderer: OfficeRenderer + renderer: DocumentRenderer } /** Output format of each file-producing operation. */ diff --git a/packages/document/tool-office/src/error.ts b/packages/document/tool-document/src/error.ts similarity index 93% rename from packages/document/tool-office/src/error.ts rename to packages/document/tool-document/src/error.ts index fdeded07ba..4b806ab22e 100644 --- a/packages/document/tool-office/src/error.ts +++ b/packages/document/tool-document/src/error.ts @@ -1,4 +1,4 @@ -/** Typed Office tool failures. @module @deepseek-ai/dsh-tool-office/src/error */ +/** Typed Office tool failures. @module @deepseek-ai/dsh-tool-document/src/error */ import { HarnessError } from '@deepseek-ai/dsh-error' import type { OfficeKitErrorCode } from '@deepseek-ai/dsh-office-kit' @@ -18,9 +18,9 @@ import type { OfficeKitErrorCode } from '@deepseek-ai/dsh-office-kit' * - `OFFICE_TIMEOUT`: the conversion exceeded its deadline. * - `OFFICE_SOURCE_CHANGED`: the source changed after its read was authorized; retry on the current file. * - `OFFICE_CONVERSION_FAILED`: the engine failed without a more specific class. - * - `OFFICE_UNSUPPORTED_REMOTE_WORKSPACE`: `office_convert` and `office_recalculate` cannot return a file the + * - `OFFICE_UNSUPPORTED_REMOTE_WORKSPACE`: `document_convert` and `document_recalculate` cannot return a file the * execution world reads, because the workspace is on a remote host. - * - `MODEL_DOES_NOT_SUPPORT_IMAGES`: the calling model route does not declare image input, so `office_render` cannot + * - `MODEL_DOES_NOT_SUPPORT_IMAGES`: the calling model route does not declare image input, so `document_render` cannot * return images; switch to an image-capable model. The value matches the attachment refusal reason of the same * name. */ diff --git a/packages/document/tool-office/src/formats.ts b/packages/document/tool-document/src/formats.ts similarity index 96% rename from packages/document/tool-office/src/formats.ts rename to packages/document/tool-document/src/formats.ts index acb897a2e6..e06db69c94 100644 --- a/packages/document/tool-office/src/formats.ts +++ b/packages/document/tool-document/src/formats.ts @@ -1,9 +1,9 @@ /** * Office document families, accepted formats, and input-dependent argument rules. - * @module @deepseek-ai/dsh-tool-office/formats + * @module @deepseek-ai/dsh-tool-document/formats */ -import type { OfficeConversionFormat, OfficeRecalculationFormat, OfficeRenderer } from '@deepseek-ai/dsh-office-kit' +import type { OfficeConversionFormat, OfficeRecalculationFormat, DocumentRenderer } from '@deepseek-ai/dsh-office-kit' import { ToolArgsError } from '@deepseek-ai/dsh-tools' /** Operation requested by one Office tool call. */ @@ -40,7 +40,7 @@ export interface OfficeRenderArgs { range?: string dpi?: number /** Backend to use exclusively; omission lets the Office service choose. */ - renderer?: OfficeRenderer + renderer?: DocumentRenderer } /** Arguments for converting a document. */ @@ -57,7 +57,7 @@ export interface OfficeRecalculateArgs { } /** Model-facing Office tool name. */ -export type OfficeToolName = 'office_render' | 'office_convert' | 'office_recalculate' +export type OfficeToolName = 'document_render' | 'document_convert' | 'document_recalculate' /** * Refuse argument keys the called tool does not declare, because the open parameter object would otherwise ignore diff --git a/packages/document/tool-office/src/index.ts b/packages/document/tool-document/src/index.ts similarity index 95% rename from packages/document/tool-office/src/index.ts rename to packages/document/tool-document/src/index.ts index 9b154ba78d..dac617ac8c 100644 --- a/packages/document/tool-office/src/index.ts +++ b/packages/document/tool-document/src/index.ts @@ -5,7 +5,7 @@ * one source byte before the service runs, so a cached result never answers a call that cannot read the source. * Converted files stay in the Office kit's private output store; the model copies them into the workspace with the * shell, so these tools write no workspace file. - * @module @deepseek-ai/dsh-tool-office + * @module @deepseek-ai/dsh-tool-document */ import { basename } from 'node:path' @@ -20,7 +20,7 @@ import type {} from '@deepseek-ai/dsh-skill' import { brandString } from '@deepseek-ai/dsh-brand' import type { OfficeSourceKey } from '@deepseek-ai/dsh-office-kit/types' import { OfficeKitError, type OfficeDocumentExtension, type OfficeImageInputExtension, type OfficeKit, - type OfficeKitSource, type OfficeRenderer, type OfficeWorkbookExtension } from '@deepseek-ai/dsh-office-kit' + type OfficeKitSource, type DocumentRenderer, type OfficeWorkbookExtension } from '@deepseek-ai/dsh-office-kit' import { defineTool, ToolContextUnavailableError, type ToolActivationContext, type ToolExecution } from '@deepseek-ai/dsh-tools' import type {} from '@deepseek-ai/dsh-working-directory' import { checkParameterNames, checkRenderArguments, checkConversionArguments, extensionOf, inputFamily, OUTPUT_FORMATS, @@ -34,7 +34,7 @@ import { OFFICE_KIT_FAILURE_CODES, OfficeToolError } from './error.ts' export type { OfficeToolErrorCode } from './error.ts' /** Cordis plugin name used by Loader diagnostics. */ -export const name = 'tool-office' +export const name = 'tool-document' /** Required services; `officeKit` is read at each call, and `attachments` and `llm` are checked when rendering. */ export const inject = ['tools', 'fs', 'workingDirectory', 'agents'] @@ -86,8 +86,14 @@ const IMAGE_SCHEMA = { } as const const MISSING_FONTS_SCHEMA = { type: 'array', required: true, items: { type: 'string' } } as const -const RENDERERS = ['libreoffice', 'poppler'] as const satisfies readonly OfficeRenderer[] -const OFFICE_TOOL_NAMES: readonly string[] = ['office_render', 'office_convert', 'office_recalculate'] +const RENDERERS = ['libreoffice', 'poppler'] as const satisfies readonly DocumentRenderer[] +/** + * Tool names whose declaration in a Session's request header keeps the tools active. The `office_*` names are the + * earlier names of these tools; they let Sessions recorded before the rename activate the tools after resume or fork. + */ +const OFFICE_TOOL_NAMES: readonly string[] = [ + 'document_render', 'document_convert', 'document_recalculate', 'office_render', 'office_convert', 'office_recalculate', +] const RENDER_PARAMETERS = { input: { type: 'string', required: true, description: 'Path to doc, docx, odt, xls, xlsx, ods, ppt, pptx, odp, or pdf; not modified.' }, @@ -122,9 +128,9 @@ const RECALCULATE_PARAMETERS = { } as const const PARAMETER_NAMES: Readonly> = { - office_render: Object.keys(RENDER_PARAMETERS), - office_convert: Object.keys(CONVERT_PARAMETERS), - office_recalculate: Object.keys(RECALCULATE_PARAMETERS), + document_render: Object.keys(RENDER_PARAMETERS), + document_convert: Object.keys(CONVERT_PARAMETERS), + document_recalculate: Object.keys(RECALCULATE_PARAMETERS), } /** Output definition of a file-producing `operation` whose `format` is one of `formats`. */ @@ -170,7 +176,7 @@ export function apply(ctx: Context, config: Config): void { const when = ({ agent }: ToolActivationContext): boolean => marked.has(agent) || agent.session.requestHeader()?.tools?.some(tool => OFFICE_TOOL_NAMES.includes(tool.name)) === true ctx.tools.register(defineTool({ - name: 'office_render', + name: 'document_render', description: 'Render document pages, slides, or worksheet areas as images you can view.', parameters: RENDER_PARAMETERS, output: { @@ -191,7 +197,7 @@ export function apply(ctx: Context, config: Config): void { }, isConcurrencySafe: () => true, async execute(args, exec): Promise { - checkParameterNames('office_render', args, PARAMETER_NAMES) + checkParameterNames('document_render', args, PARAMETER_NAMES) checkRenderArguments(args, inputFamily('render', args.input)) const { agent, kit, target, source } = await prepareInput(ctx, exec, 'render', args.input) return render(ctx, kit, config, agent, exec.signal, args, target, source) @@ -199,13 +205,13 @@ export function apply(ctx: Context, config: Config): void { presentCall: args => ({ card: 'generic', title: `Render ${args.input}`, kind: 'read', locations: [{ path: args.input }] }), }), { when }) ctx.tools.register(defineTool({ - name: 'office_convert', + name: 'document_convert', description: 'Convert a document to another format. Return a temporary file to copy to its destination with the shell.', parameters: CONVERT_PARAMETERS, output: fileOutput('convert', OUTPUT_FORMATS), isConcurrencySafe: () => false, async execute(args, exec): Promise> { - checkParameterNames('office_convert', args, PARAMETER_NAMES) + checkParameterNames('document_convert', args, PARAMETER_NAMES) // `inputFamily` rejects PDF for convert and recalculate. checkConversionArguments(args, inputFamily('convert', args.input) as Exclude) const { agent, kit, target, source } = await prepareInput(ctx, exec, 'convert', args.input) @@ -214,13 +220,13 @@ export function apply(ctx: Context, config: Config): void { presentCall: args => ({ card: 'generic', title: `Convert ${args.input} to ${args.format}`, kind: 'other', locations: [{ path: args.input }] }), }), { when }) ctx.tools.register(defineTool({ - name: 'office_recalculate', + name: 'document_recalculate', description: 'Recalculate spreadsheet formulas. Return a temporary workbook to copy to its destination with the shell.', parameters: RECALCULATE_PARAMETERS, output: fileOutput('recalculate', RECALCULATION_FORMATS), isConcurrencySafe: () => false, async execute(args, exec): Promise> { - checkParameterNames('office_recalculate', args, PARAMETER_NAMES) + checkParameterNames('document_recalculate', args, PARAMETER_NAMES) inputFamily('recalculate', args.input) const { agent, kit, target, source } = await prepareInput(ctx, exec, 'recalculate', args.input) return convertFile(ctx, kit, agent, exec.signal, 'recalculate', args, target, source) @@ -302,7 +308,7 @@ function codeOf(error: unknown): unknown { * service error as `cause`; other failures pass through unchanged. An unavailable explicitly requested `poppler` * renderer points to the other renderer instead of reporting the operation unavailable. */ -function officeFailure(verb: string, path: string, error: unknown, renderer?: OfficeRenderer): unknown { +function officeFailure(verb: string, path: string, error: unknown, renderer?: DocumentRenderer): unknown { if (!(error instanceof OfficeKitError)) return error const hint = error.code === 'unavailable' ? renderer === 'poppler' ? ' Omit renderer, or choose libreoffice.' @@ -433,7 +439,7 @@ async function convertFile( }, signal) : await kit.recalculate({ extension: extension as OfficeWorkbookExtension, - // The office_recalculate schema admitted only recalculation formats. + // The document_recalculate schema admitted only recalculation formats. format: format as OfficeRecalculateArgs['format'], source, output, }, signal) diff --git a/packages/document/tool-office/tests/activation.spec.ts b/packages/document/tool-document/tests/activation.spec.ts similarity index 92% rename from packages/document/tool-office/tests/activation.spec.ts rename to packages/document/tool-document/tests/activation.spec.ts index c3519a1259..22530c0a27 100644 --- a/packages/document/tool-office/tests/activation.spec.ts +++ b/packages/document/tool-document/tests/activation.spec.ts @@ -15,9 +15,9 @@ import * as JsonlPersistence from '@deepseek-ai/dsh-session-persistence-jsonl' import SkillRegistry from '@deepseek-ai/dsh-skill' import * as ToolSkill from '@deepseek-ai/dsh-tool-skill' import { executeToolFixture } from '@deepseek-ai/dsh-tool-testkit' -import * as ToolOffice from '../src/index.ts' +import * as ToolDocument from '../src/index.ts' -const NAMES = ['office_convert', 'office_recalculate', 'office_render'] +const NAMES = ['document_convert', 'document_recalculate', 'document_render'] const SKILLS = ['office'] const signal = new AbortController().signal @@ -77,7 +77,7 @@ async function harness(script: StreamChunk[][] = [], options: { await ctx.plugin(SkillRegistry) for (const name of [...SKILLS, 'office-docx', 'other', 'custom-office']) ctx.skills.register({ name, source: 'runtime', description: name, content: `${name} instructions` }) if (!options.officeFirst) await ctx.plugin(ToolSkill) - const fiber = await ctx.plugin(ToolOffice, options.skills === undefined ? {} : { activationSkills: options.skills }) + const fiber = await ctx.plugin(ToolDocument, options.skills === undefined ? {} : { activationSkills: options.skills }) if (options.officeFirst) await ctx.plugin(ToolSkill) const adapter = new ScriptedAdapter(script) ctx.llm.registerAdapter(['fixture'], adapter) @@ -118,8 +118,8 @@ describe('Office skill admission', () => { await turn(agent) expect(nested).toEqual([true]) expect(adapter.requests).toHaveLength(2) - expect(adapter.requests[0]?.messages.some(message => JSON.stringify(message.content).includes('office_render'))).toBe(false) - expect(adapter.requests[1]?.messages.some(message => JSON.stringify(message.content).includes('office_render'))).toBe(true) + expect(adapter.requests[0]?.messages.some(message => JSON.stringify(message.content).includes('document_render'))).toBe(false) + expect(adapter.requests[1]?.messages.some(message => JSON.stringify(message.content).includes('document_render'))).toBe(true) expect(agent.session.requestHeader()?.tools?.map(tool => tool.name)).toEqual(['run_code']) }) @@ -195,8 +195,17 @@ describe('Office skill admission', () => { expect(await admitted(ctx, agent)).toEqual(NAMES) }) + it.each(['office_convert', 'office_recalculate', 'office_render'])('activates the renamed tools for an earlier Session whose header declares only %s', async (name) => { + const { ctx, agent } = await harness() + const [schema] = ctx.tools.schemas().filter(tool => tool.name === name.replace('office_', 'document_')) + agent.session.append('request/header', { reason: 'initial', header: { + config: { provider: 'fixture', model: 'fixture' }, tools: [{ ...schema!, name }], + } }) + expect(await admitted(ctx, agent)).toEqual(NAMES) + }) + it('validates the configured skill set and activates only its names', async () => { - for (const activationSkills of [[], [''], ['Office'], ['has space'], [1]]) expect(() => ToolOffice.Config({ activationSkills } as never)).toThrow() + for (const activationSkills of [[], [''], ['Office'], ['has space'], [1]]) expect(() => ToolDocument.Config({ activationSkills } as never)).toThrow() const { ctx, agent } = await harness([response(), response()], { skills: ['custom-office'] }) await turn(agent, '/office') expect(await admitted(ctx, agent)).toEqual([]) @@ -253,7 +262,7 @@ describe('Office skill admission', () => { expect(await admitted(ctx, agent)).toEqual(NAMES) await fiber.dispose() expect(await admitted(ctx, agent)).toEqual([]) - await ctx.plugin(ToolOffice) + await ctx.plugin(ToolDocument) expect(await admitted(ctx, agent)).toEqual([]) }) }) diff --git a/packages/document/tool-office/tests/fixtures/fake-kit.ts b/packages/document/tool-document/tests/fixtures/fake-kit.ts similarity index 100% rename from packages/document/tool-office/tests/fixtures/fake-kit.ts rename to packages/document/tool-document/tests/fixtures/fake-kit.ts diff --git a/packages/document/tool-office/tests/tool-office.spec.ts b/packages/document/tool-document/tests/tool-document.spec.ts similarity index 95% rename from packages/document/tool-office/tests/tool-office.spec.ts rename to packages/document/tool-document/tests/tool-document.spec.ts index b0f18f9f23..80ce30901c 100644 --- a/packages/document/tool-office/tests/tool-office.spec.ts +++ b/packages/document/tool-document/tests/tool-document.spec.ts @@ -26,7 +26,7 @@ import SessionProjectionRegistry from '@deepseek-ai/dsh-session-projection' import OfficeKit, { OfficeKitError, type OfficeKitErrorCode, type OfficeImagesRequest, type OfficeImagesResult, type OfficeKitSource } from '@deepseek-ai/dsh-office-kit' import { SESSION_FORMAT_VERSION, Session, type SessionId } from '@deepseek-ai/dsh-session' import { SubagentError } from '@deepseek-ai/dsh-subagent' -import * as ToolOffice from '../src/index.ts' +import * as ToolDocument from '../src/index.ts' import { renderImagesContent } from '../src/content.ts' vi.mock('../../office-kit/src/locate.ts', async original => ({ @@ -120,8 +120,8 @@ function fakeOfficeKit() { let dir: string let home: string beforeEach(async () => { - dir = await realpath(await mkdtemp(join(tmpdir(), 'dsh-tool-office-'))) - home = await mkdtemp(join(tmpdir(), 'dsh-tool-office-home-')) + dir = await realpath(await mkdtemp(join(tmpdir(), 'dsh-tool-document-'))) + home = await mkdtemp(join(tmpdir(), 'dsh-tool-document-home-')) await writeFile(join(dir, 'deck.pptx'), 'pptx bytes') await writeFile(join(dir, 'book.xlsx'), 'xlsx bytes') await writeFile(join(dir, 'report.docx'), 'docx bytes') @@ -136,7 +136,7 @@ interface SetupOptions { attachments?: boolean | { normalizedImageMaxPixels: number } llm?: boolean kit?: boolean - config?: Partial + config?: Partial } async function setup(options: SetupOptions = {}) { @@ -159,7 +159,7 @@ async function setup(options: SetupOptions = {}) { } const kit = fakeOfficeKit() if (options.kit !== false) ctx.provide('officeKit', kit as never) - const fiber = await ctx.plugin(ToolOffice, options.config ?? {}) + const fiber = await ctx.plugin(ToolDocument, options.config ?? {}) return { ctx, kit, fiber } } @@ -190,7 +190,7 @@ async function office(ctx: Context, args: Record, agent: object modelSelection: { provider: 'visual', model: 'vision' }, signal: callSignal }) try { return await executeToolFixture(ctx, { - signal: callSignal, callId: brandString(`office-${++calls}`), name: `office_${String(operation)}`, arguments: parameters, + signal: callSignal, callId: brandString(`office-${++calls}`), name: `document_${String(operation)}`, arguments: parameters, ...agent === null ? {} : { agent: agent as never }, ...toolSet === undefined ? {} : { toolSet }, }) } finally { toolSet?.dispose() } @@ -215,7 +215,7 @@ describe('office schema', () => { it('declares the model-facing description and parameters', async () => { const { ctx } = await setup() const schemas = ctx.tools.schemas() - expect(schemas.map(schema => schema.name)).toEqual(['office_render', 'office_convert', 'office_recalculate']) + expect(schemas.map(schema => schema.name)).toEqual(['document_render', 'document_convert', 'document_recalculate']) expect(schemas.map(schema => Object.keys(schema.parameters.properties ?? {}))).toEqual([ ['input', 'pages', 'sheet', 'range', 'dpi', 'renderer'], ['input', 'format', 'sheet'], ['input', 'format'], ]) @@ -231,7 +231,7 @@ describe('office schema', () => { expect(outputs[1]).toMatchObject({ properties: { format: { enum: ['pdf', 'docx', 'odt', 'txt', 'xlsx', 'ods', 'csv', 'pptx', 'odp'] } } }) expect(outputs[2]).toMatchObject({ properties: { format: { enum: ['xlsx', 'ods'] } } }) for (const definition of ctx.tools.definitions()) { - expect(definition.output.schema).toMatchObject({ type: 'object', properties: { operation: { const: definition.name.replace('office_', '') } } }) + expect(definition.output.schema).toMatchObject({ type: 'object', properties: { operation: { const: definition.name.replace('document_', '') } } }) expect(definition.output.schema).not.toHaveProperty('oneOf') } }) @@ -244,9 +244,9 @@ describe('office schema', () => { }) it.each([ - ['office_render', { input: 'deck.pptx' }], - ['office_convert', { input: 'book.xlsx', format: 'csv' }], - ['office_recalculate', { input: 'book.xlsx', format: 'xlsx' }], + ['document_render', { input: 'deck.pptx' }], + ['document_convert', { input: 'book.xlsx', format: 'csv' }], + ['document_recalculate', { input: 'book.xlsx', format: 'xlsx' }], ])('refuses a direct %s body call without an Agent', async (name, args) => { const { ctx, kit } = await setup() const definition = ctx.tools.get(name)! @@ -260,9 +260,9 @@ describe('office schema', () => { it('presents pending calls with their files', async () => { const { ctx } = await setup() - const render = ctx.tools.get('office_render')! - const convert = ctx.tools.get('office_convert')! - const recalculate = ctx.tools.get('office_recalculate')! + const render = ctx.tools.get('document_render')! + const convert = ctx.tools.get('document_convert')! + const recalculate = ctx.tools.get('document_recalculate')! expect(render.presentCall?.({ input: 'deck.pptx' })) .toEqual({ card: 'generic', title: 'Render deck.pptx', kind: 'read', locations: [{ path: 'deck.pptx' }] }) expect(convert.presentCall?.({ input: 'deck.pptx', format: 'pdf' })) @@ -374,7 +374,7 @@ describe('render', () => { it('projects written files and their presentation metadata', async () => { const { ctx } = await setup() - const output = ctx.tools.get('office_recalculate')!.output + const output = ctx.tools.get('document_recalculate')!.output const value = { operation: 'recalculate', path: '/w/book.xlsx', file: '/h/out/book.xlsx', format: 'xlsx', bytes: 9, missingFonts: ['Aptos'] } expect(output.render({}, value)).toEqual([{ type: 'text', text: 'Recalculated /w/book.xlsx to xlsx (9 bytes): /h/out/book.xlsx\n' + 'Copy this temporary file to its destination with the shell now; it may be deleted after a retention period or to free space, and is deleted when this conversation ends.\nFonts not installed and substituted: Aptos.' }]) @@ -463,7 +463,7 @@ describe('Office service failures', () => { it('stays registered without the Office service, fails each call as unavailable, and uses the service once it is provided', async () => { const { ctx, kit } = await setup({ kit: false }) - expect(ctx.tools.schemas().map(tool => tool.name)).toEqual(['office_render', 'office_convert', 'office_recalculate']) + expect(ctx.tools.schemas().map(tool => tool.name)).toEqual(['document_render', 'document_convert', 'document_recalculate']) for (const [args, verb] of [ [{ operation: 'render', input: 'deck.pptx' }, 'render'], [{ operation: 'convert', input: 'deck.pptx', format: 'pdf' }, 'convert'], @@ -474,8 +474,8 @@ describe('Office service failures', () => { expect(text(result)).toBe(`Error: cannot ${verb} "${args.input}": The document converter is unavailable.${unavailableHint}`) expect(errorInfo(result)).toEqual(officeToolError('OFFICE_UNAVAILABLE')) } - const definition = ctx.tools.get('office_render')! - const call = { signal, callId: brandString('missing-service'), name: 'office_render', agent: agentOn('vision'), deferContext: vi.fn(), concludeTurn: vi.fn() } + const definition = ctx.tools.get('document_render')! + const call = { signal, callId: brandString('missing-service'), name: 'document_render', agent: agentOn('vision'), deferContext: vi.fn(), concludeTurn: vi.fn() } await expect(definition.execute({ input: 'deck.pptx' }, call as never)).rejects.toMatchObject({ ...officeToolError('OFFICE_UNAVAILABLE'), cause: expect.objectContaining({ name: 'OfficeKitError', code: 'unavailable', message: 'The document converter is unavailable.' }) as Error, @@ -528,11 +528,11 @@ describe('Office service failures', () => { const { ctx, kit } = await setup() const cause = officeError(code, 'Conversion stopped.') kit.convertTo.mockRejectedValueOnce(cause) - const definition = ctx.tools.get('office_convert')! + const definition = ctx.tools.get('document_convert')! const result = await office(ctx, { operation: 'convert', input: 'deck.pptx', format: 'pdf' }) expect(errorInfo(result)).toEqual(officeToolError(toolCode)) kit.convertTo.mockRejectedValueOnce(cause) - const call = { signal, callId: brandString(`cause-${code}`), name: 'office_convert', agent: agentOn('vision'), deferContext: vi.fn(), concludeTurn: vi.fn() } + const call = { signal, callId: brandString(`cause-${code}`), name: 'document_convert', agent: agentOn('vision'), deferContext: vi.fn(), concludeTurn: vi.fn() } await expect(definition.execute({ input: 'deck.pptx', format: 'pdf' }, call as never)).rejects.toMatchObject({ cause }) }) @@ -637,13 +637,13 @@ describe('arguments and paths', () => { [{ operation: 'recalculate', input: 'book.xlsx' }, 'format'], [{ operation: 'convert', input: 'book.xlsx', format: 'pdf', sheet: 'A' }, 'sheet applies only to CSV conversion'], [{ operation: 'convert', input: 'book.xlsx', format: 'csv', sheet: ' ' }, 'sheet must be an exact worksheet name'], - [{ operation: 'render', input: 'deck.pptx', format: 'pdf' }, 'format applies only to office_convert or office_recalculate'], - [{ operation: 'convert', input: 'deck.pptx', format: 'pdf', pages: [1] }, 'pages applies only to office_render'], - [{ operation: 'convert', input: 'book.xlsx', format: 'pdf', range: 'A1:B2' }, 'range applies only to office_render'], - [{ operation: 'convert', input: 'deck.pptx', format: 'pdf', dpi: 96 }, 'dpi applies only to office_render'], - [{ operation: 'recalculate', input: 'book.xlsx', format: 'xlsx', sheet: 'Data' }, 'sheet applies only to office_render or office_convert'], - [{ operation: 'recalculate', input: 'book.xlsx', format: 'xlsx', pages: [1] }, 'pages applies only to office_render'], - [{ operation: 'render', input: 'deck.pptx', output: 'deck.pdf' }, 'office_render does not accept output'], + [{ operation: 'render', input: 'deck.pptx', format: 'pdf' }, 'format applies only to document_convert or document_recalculate'], + [{ operation: 'convert', input: 'deck.pptx', format: 'pdf', pages: [1] }, 'pages applies only to document_render'], + [{ operation: 'convert', input: 'book.xlsx', format: 'pdf', range: 'A1:B2' }, 'range applies only to document_render'], + [{ operation: 'convert', input: 'deck.pptx', format: 'pdf', dpi: 96 }, 'dpi applies only to document_render'], + [{ operation: 'recalculate', input: 'book.xlsx', format: 'xlsx', sheet: 'Data' }, 'sheet applies only to document_render or document_convert'], + [{ operation: 'recalculate', input: 'book.xlsx', format: 'xlsx', pages: [1] }, 'pages applies only to document_render'], + [{ operation: 'render', input: 'deck.pptx', output: 'deck.pdf' }, 'document_render does not accept output'], [{ operation: 'render', input: 'book.xlsx', pages: [1] }, 'pages does not apply to spreadsheets'], [{ operation: 'render', input: 'deck.pptx', pages: [] }, 'pages must list distinct one-based page numbers'], [{ operation: 'render', input: 'deck.pptx', pages: [0] }, 'pages must list distinct one-based page numbers'], @@ -662,7 +662,7 @@ describe('arguments and paths', () => { it('prefixes argument refusals with the argument error label', async () => { const { ctx } = await setup() expect(text(await office(ctx, { operation: 'render', input: 'deck.pptx', output: 'deck.pdf' }))) - .toBe('Error: invalid arguments: office_render does not accept output') + .toBe('Error: invalid arguments: document_render does not accept output') expect(text(await office(ctx, { operation: 'render', input: 'deck.pptx', dpi: 23 }))) .toBe('Error: invalid arguments: dpi must be an integer from 24 to 600') }) @@ -695,7 +695,7 @@ describe('arguments and paths', () => { }) it('reads an input outside the workspace as the read tool does', async () => { - const outside = await realpath(await mkdtemp(join(tmpdir(), 'dsh-tool-office-outside-'))) + const outside = await realpath(await mkdtemp(join(tmpdir(), 'dsh-tool-document-outside-'))) onTestFinished(() => rm(outside, { recursive: true, force: true })) await writeFile(join(outside, 'shared.docx'), 'docx bytes') const { ctx, kit } = await setup() @@ -759,7 +759,7 @@ describe('PTC dispatch', () => { const { ctx } = await setup({ ptc: true }) const runtime = ctx.ptcRuntime as FakeRuntime runtime.behavior = async (request) => { - await request.bindings[0]!.functions.office_render!({ input: 'deck.pptx' }) + await request.bindings[0]!.functions.document_render!({ input: 'deck.pptx' }) return { output: [] } } const agent = { ...agentOn('vision'), ctx } @@ -770,7 +770,7 @@ describe('PTC dispatch', () => { signal, callId: brandString(`run-${++calls}`), name: RUN_CODE_NAME, arguments: args, agent: agent as never, toolSet, }) - const result = await run({ code: 'await tools.office_render({ input: "deck.pptx" })', description: 'Render' }) + const result = await run({ code: 'await tools.document_render({ input: "deck.pptx" })', description: 'Render' }) expect(result.isError).toBe(false) const dispatch = agent.session.snapshotEvents().find(event => event.type === 'tool/ptc-dispatch') expect(dispatch?.data.content.some(block => block.type === 'image')).toBe(true) @@ -782,12 +782,12 @@ describe('PTC dispatch', () => { const denied: string[] = [] ctx.on('tools/pre-execute', (exec, next) => { - if (exec.name !== 'office_render') return next() + if (exec.name !== 'document_render') return next() denied.push(exec.name) return Promise.resolve({ kind: 'deny' as const, reason: 'office denied by policy' }) }, { prepend: true }) - const refused = await run({ code: 'await tools.office_render({ input: "deck.pptx" })', description: 'Render' }) - expect(denied).toEqual(['office_render']) + const refused = await run({ code: 'await tools.document_render({ input: "deck.pptx" })', description: 'Render' }) + expect(denied).toEqual(['document_render']) expect(text(refused)).toContain('office denied by policy') }) }) diff --git a/packages/document/tool-office/tsconfig.json b/packages/document/tool-document/tsconfig.json similarity index 100% rename from packages/document/tool-office/tsconfig.json rename to packages/document/tool-document/tsconfig.json diff --git a/packages/document/tool-office/README.i18n.yaml b/packages/document/tool-office/README.i18n.yaml deleted file mode 100644 index 88b451c516..0000000000 --- a/packages/document/tool-office/README.i18n.yaml +++ /dev/null @@ -1,46 +0,0 @@ -# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading -# section, a hash of its English and Chinese blocks outside code blocks and generated regions. -# After editing either side, bring the other along and re-record with: -# pnpm run verify-translation-pairing --write packages/document/tool-office/README.md -/: - en: 2ec7e66cd18356df - zh: 4862555b5a4c9f51 -/deepseek-ai-dsh-tool-office: - en: e9153903d819e2a7 - zh: 3f50cf3c768a1af5 -/deepseek-ai-dsh-tool-office/summary: - en: e74f50cd7e13fad9 - zh: f234831ae934f60a -/deepseek-ai-dsh-tool-office/table-of-contents: - en: d152484eb41ac6b4 - zh: 09388d293f9be9cb -/deepseek-ai-dsh-tool-office/use-this-package: - en: a871c5b10d802bd0 - zh: 238c7cf833344c06 -/deepseek-ai-dsh-tool-office/understand-the-implementation: - en: 05a32b4fde4d8c21 - zh: f6ce05a11f5ccb6d -/deepseek-ai-dsh-tool-office/further-exploration: - en: 5d20d2318d1957cf - zh: 8b8111099ab8bb46 -/deepseek-ai-dsh-tool-office/model-experience: - en: 215e7ba838619b7b - zh: a311da3843709f90 -/deepseek-ai-dsh-tool-office/model-experience/office-render-office-convert-office-recalculate: - en: 3bc9eb9e036e6224 - zh: 3bc9eb9e036e6224 -/deepseek-ai-dsh-tool-office/model-experience/office-render-office-convert-office-recalculate/what-the-model-sees: - en: 11c4f182e9fefe16 - zh: bd297441cf62228d -/deepseek-ai-dsh-tool-office/model-experience/office-render-office-convert-office-recalculate/token-effect: - en: b8d5d8c33c7563d4 - zh: 5b6cb183b690bdba -/deepseek-ai-dsh-tool-office/model-experience/office-render-office-convert-office-recalculate/kv-cache-effect: - en: c4e3595dab58a800 - zh: 65f7fcf46b1e3130 -/deepseek-ai-dsh-tool-office/known-limitations-and-deferred-work: - en: c655c767e0cf218c - zh: 9b5a20e8b3bcd7fc -/deepseek-ai-dsh-tool-office/known-limitations-and-deferred-work/dev-note: - en: e67f633dc6fe7773 - zh: e88aeb617ffb74ea diff --git a/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts b/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts index 4f3f2f8bda..a93e91e597 100644 --- a/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts +++ b/packages/extensions/cordis-client-runner/src/client/slot-catalog.ts @@ -6474,7 +6474,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ 'useAccess: (action: RemoteEndpoint) => boolean', 'useTrajectory: UseTrajectory', ], - keyDomain: 'open: any string the owner dispatches (no compile-time key set), already taken: apply_patch, ask_user_question, bash, cordis_define, cordis_inspect, cordis_inspect_list, cordis_inspect_query, cordis_inspect_self, cordis_run, cordis_stop, cordis_undefine, create_goal, edit, get_goal, glob, grep, interrupt_agent, job_kill, job_list, job_output, list_agents, list_subagent_models, lsp, office_convert, office_recalculate, office_render, present, ralph, read, read_image, schedule_create, schedule_delete, schedule_edit, schedule_list, schedule_update, schedule_view, send_message, session_event_read, session_event_search, session_event_trace, session_search, session_send_message, session_trace, skill, spawn_teammate, subagent, subagent_fork, team_task_create, team_task_get, team_task_list, team_task_update, terminal_close, terminal_list, terminal_open, terminal_read, terminal_signal, timeline_tasks, todo_write, update_goal, wait_agent, web_fetch, web_search, workflow, write', + keyDomain: 'open: any string the owner dispatches (no compile-time key set), already taken: apply_patch, ask_user_question, bash, cordis_define, cordis_inspect, cordis_inspect_list, cordis_inspect_query, cordis_inspect_self, cordis_run, cordis_stop, cordis_undefine, create_goal, edit, get_goal, glob, grep, interrupt_agent, job_kill, job_list, job_output, list_agents, list_subagent_models, lsp, present, ralph, read, read_image, schedule_create, schedule_delete, schedule_edit, schedule_list, schedule_update, schedule_view, send_message, session_event_read, session_event_search, session_event_trace, session_search, session_send_message, session_trace, skill, spawn_teammate, subagent, subagent_fork, team_task_create, team_task_get, team_task_list, team_task_update, terminal_close, terminal_list, terminal_open, terminal_read, terminal_signal, timeline_tasks, todo_write, update_goal, wait_agent, web_fetch, web_search, workflow, write', hookContext: '', slotInject: '', declaredBy: 'an entry in \'conversation.chat.node\' (client-ui-tool), so it exists while that entry is mounted', @@ -6528,9 +6528,7 @@ export const CLIENT_SLOT_API: readonly ClientSlotEntry[] = [ 'client-ui-tool FileMutationRow key \'apply_patch\'', 'client-ui-tool FileMutationRow key \'edit\'', 'client-ui-tool FileMutationRow key \'write\'', - 'client-ui-tool OfficeRow key \'office_render\'', - 'client-ui-tool OfficeRow key \'office_convert\'', - 'client-ui-tool OfficeRow key \'office_recalculate\'', + 'client-ui-tool OfficeRow', 'client-ui-tool ReadImageRow key \'read_image\'', 'client-ui-tool ReadRow key \'read\'', 'client-ui-tool SearchRow key \'grep\'', diff --git a/packages/extensions/cordis-host-runner/src/api-catalog.ts b/packages/extensions/cordis-host-runner/src/api-catalog.ts index df6cf442b2..bf9e759bfa 100644 --- a/packages/extensions/cordis-host-runner/src/api-catalog.ts +++ b/packages/extensions/cordis-host-runner/src/api-catalog.ts @@ -7681,6 +7681,10 @@ export const TYPE_API: readonly TypeApiEntry[] = [ name: 'DirectoryRegistrationHandle', declaration: 'export interface DirectoryRegistrationHandle {\n (): void;\n replace(entries: readonly LlmConfigurableProvider[]): void;\n}', }, + { + name: 'DocumentRenderer', + declaration: 'export type DocumentRenderer = \'libreoffice\' | \'poppler\';', + }, { name: 'Domain', declaration: 'export interface Domain {\n readonly name: string;\n readonly global: DomainGlobalHandleOf;\n table(name: N): KvTable, TableValueOf>;\n close(): Promise;\n}', @@ -9339,11 +9343,11 @@ export const TYPE_API: readonly TypeApiEntry[] = [ }, { name: 'OfficeImagesRequest', - declaration: 'export interface OfficeImagesRequest {\n readonly extension: OfficeImageInputExtension;\n readonly source: OfficeKitSource;\n readonly renderer?: OfficeRenderer;\n readonly pages?: readonly number[];\n readonly sheet?: string;\n readonly range?: string;\n readonly dpi?: number;\n readonly maxImages: number;\n readonly maxPixels: number;\n readonly maxDimension: number;\n readonly maxBytes: number;\n}', + declaration: 'export interface OfficeImagesRequest {\n readonly extension: OfficeImageInputExtension;\n readonly source: OfficeKitSource;\n readonly renderer?: DocumentRenderer;\n readonly pages?: readonly number[];\n readonly sheet?: string;\n readonly range?: string;\n readonly dpi?: number;\n readonly maxImages: number;\n readonly maxPixels: number;\n readonly maxDimension: number;\n readonly maxBytes: number;\n}', }, { name: 'OfficeImagesResult', - declaration: 'export interface OfficeImagesResult {\n readonly images: readonly OfficeImage[];\n readonly pageCount: number;\n readonly dpi: number;\n readonly missingFonts: string[];\n readonly renderer: OfficeRenderer;\n}', + declaration: 'export interface OfficeImagesResult {\n readonly images: readonly OfficeImage[];\n readonly pageCount: number;\n readonly dpi: number;\n readonly missingFonts: string[];\n readonly renderer: DocumentRenderer;\n}', }, { name: 'OfficeKitGeneration', @@ -9381,10 +9385,6 @@ export const TYPE_API: readonly TypeApiEntry[] = [ name: 'OfficeRecalculationRequest', declaration: 'export interface OfficeRecalculationRequest {\n readonly extension: OfficeWorkbookExtension;\n readonly format: OfficeRecalculationFormat;\n readonly source: OfficeKitSource;\n readonly output: OfficeOutputTarget;\n}', }, - { - name: 'OfficeRenderer', - declaration: 'export type OfficeRenderer = \'libreoffice\' | \'poppler\';', - }, { name: 'OfficeSourceKey', declaration: 'export type OfficeSourceKey = Branded<\'OfficeSourceKey\'>;', diff --git a/packages/preset/agent-preset/skills/dsh-doc/references/packages.md b/packages/preset/agent-preset/skills/dsh-doc/references/packages.md index d182ad0d9b..8a95724252 100644 --- a/packages/preset/agent-preset/skills/dsh-doc/references/packages.md +++ b/packages/preset/agent-preset/skills/dsh-doc/references/packages.md @@ -214,7 +214,7 @@ Every package below exports a Cordis plugin that a bundle patch can name in a Lo | Package | Config | Description | |---|---|---| | `@deepseek-ai/dsh-office-kit` | yes | Shared Office rendering, conversion, and recalculation with bounded queues and caching | -| `@deepseek-ai/dsh-tool-office` | yes | Model-facing Office tools for rendering, converting, and recalculating documents | +| `@deepseek-ai/dsh-tool-document` | yes | Model-facing Office tools for rendering, converting, and recalculating documents | ## experimental diff --git a/packages/skill/skill-office/README.i18n.yaml b/packages/skill/skill-office/README.i18n.yaml index 131b71e470..29cc06fc99 100644 --- a/packages/skill/skill-office/README.i18n.yaml +++ b/packages/skill/skill-office/README.i18n.yaml @@ -9,29 +9,29 @@ en: f855ac5e12b4e604 zh: b2e875d31d56cb2e /deepseek-ai-dsh-skill-office/summary: - en: 9a20a17b66195a51 - zh: 1b0340894afe18c1 + en: fc47ac546b465a69 + zh: 43d0d6152bfad167 /deepseek-ai-dsh-skill-office/table-of-contents: en: c361195a73cf5755 zh: 745b04e7be0be369 /deepseek-ai-dsh-skill-office/use-this-package: - en: 6fde559534be8170 - zh: c2b5a1759d5cf531 + en: 58b50d6fc6181c24 + zh: 8c69c5a32b1a8c64 /deepseek-ai-dsh-skill-office/use-this-package/progressive-loading: - en: 09ccaf951ecdd395 - zh: 6222ef0173787258 + en: 88392f696485836d + zh: 6e941a96895cd10b /deepseek-ai-dsh-skill-office/understand-the-implementation: en: 75e5b453026b9819 zh: a05352cc3822b8e0 /deepseek-ai-dsh-skill-office/further-exploration: - en: cb17bbc5eb08d58d - zh: 8f935802afe86b12 + en: cae566489ae62547 + zh: bb7f70aef828bbe2 /deepseek-ai-dsh-skill-office/model-experience: en: 646ee91c9e00c0de zh: 6cfacb48ef02bd7c /deepseek-ai-dsh-skill-office/model-experience/kv-cache-effect: - en: 95c11ef025386d33 - zh: 89610030d0488cfd + en: e23a87cc4b2d96c5 + zh: ff57cfc7e53e4b51 /deepseek-ai-dsh-skill-office/known-limitations-and-deferred-work: en: bb8d082768d817f7 zh: 3e583aeab6213e69 diff --git a/packages/skill/skill-office/README.md b/packages/skill/skill-office/README.md index 7c30e6861e..b016e4a2f4 100644 --- a/packages/skill/skill-office/README.md +++ b/packages/skill/skill-office/README.md @@ -9,7 +9,7 @@ English | [中文](README.zh.md) ## Summary -The catalog lists one `office` skill. Its instructions load on demand, cover Word, PowerPoint, and Excel pitfalls alongside [`office_render`, `office_convert`, and `office_recalculate`](../../document/tool-office/README.md), and end with the configured Python environment. The Web application and SDK profiles mount the provider; only Desktop, or an SDK with a primary runtime, also mounts the bundled dependency query. +The catalog lists one `office` skill. Its instructions load on demand, cover Word, PowerPoint, and Excel pitfalls alongside [`document_render`, `document_convert`, and `document_recalculate`](../../document/tool-document/README.md), and end with the configured Python environment. The Web application and SDK profiles mount the provider; only Desktop, or an SDK with a primary runtime, also mounts the bundled dependency query. ## Table of Contents @@ -26,7 +26,7 @@ The catalog lists one `office` skill. Its instructions load on demand, cover Wor ## Use this package -Mount the skill provider beside the skill registry and `dsh-tool-skill`. The provider supplies the `office` instructions and appends a Python environment section. The instructions direct operations to `office_render`, `office_convert`, and `office_recalculate`, so compose [`tool-office`](../../document/tool-office/README.md) beside this provider. +Mount the skill provider beside the skill registry and `dsh-tool-skill`. The provider supplies the `office` instructions and appends a Python environment section. The instructions direct operations to `document_render`, `document_convert`, and `document_recalculate`, so compose [`tool-document`](../../document/tool-document/README.md) beside this provider. ```yaml - name: '@deepseek-ai/dsh-skill-office' @@ -45,7 +45,7 @@ A relative `assetRoot` rejects registration. Catalog discovery and loading read ### Progressive loading -The model chooses skills from the task; the host does not inject complete instructions based on file extensions. With complete resources, the `office` skill is listed and loadable through `skill` or explicit user invocation as `/office`. Loading `office` delivers concise inline guidance for Word, PowerPoint, and Excel pitfalls, names `pypdf` in the bundled Python for existing PDFs, and makes the three Office tools available from the next step; when they are not in the tool list, such as after a PTC resume or fork, the instructions direct the model to load `office` again. Legacy `.doc`, `.xls`, and `.ppt` files, which python-docx, openpyxl, and python-pptx cannot open, are converted with `office_convert` first. +The model chooses skills from the task; the host does not inject complete instructions based on file extensions. With complete resources, the `office` skill is listed and loadable through `skill` or explicit user invocation as `/office`. Loading `office` delivers concise inline guidance for Word, PowerPoint, and Excel pitfalls, names `pypdf` in the bundled Python for existing PDFs, and makes the three Office tools available from the next step; when they are not in the tool list, such as after a PTC resume or fork, the instructions direct the model to load `office` again. Legacy `.doc`, `.xls`, and `.ppt` files, which python-docx, openpyxl, and python-pptx cannot open, are converted with `document_convert` first. ```mermaid flowchart TD @@ -56,21 +56,21 @@ flowchart TD B -->|Create or edit| D["Author and validate content, structure and data"] D -->|No additional operation needed| F["Deliver"] - B -->|Render or inspect| R["office_render: images in the tool result"] + B -->|Render or inspect| R["document_render: images in the tool result"] D -->|Changed slides or visual inspection| R R --> V["Inspect rendered images"] V --> F - B -->|Formula recalculation| X["office_recalculate, shell copy"] + B -->|Formula recalculation| X["document_recalculate, shell copy"] D -->|Formula recalculation| X X --> F - B -->|Format conversion or PDF export| P["office_convert, shell copy"] + B -->|Format conversion or PDF export| P["document_convert, shell copy"] D -->|Format conversion or PDF export| P P --> F ``` -The inline instructions state the silent data-loss pitfalls across formats: Word text edits change text inside runs because assigning `paragraph.text` drops run formatting, and CJK text needs a `w:eastAsia` font alongside `run.font.name`; PowerPoint edits render changed slides because python-pptx cannot measure whether text fits its box; Excel edits use `office_recalculate` when formula results must show because openpyxl writes formulas without calculated values, and avoid writing a pandas DataFrame over an existing workbook because that drops other sheets, formulas, and formatting; and the original file is kept unless the user asks to replace it. Preview images arrive in the `office_render` result, and converted and recalculated files arrive as temporary paths that the model copies into the workspace with `cp` or `Copy-Item`. Loaded instructions remain in session history after an operation finishes. The diagram describes ordinary presets across supported clients; it does not change the shell-only definition of minimal or sdk-minimal. +The inline instructions state the silent data-loss pitfalls across formats: Word text edits change text inside runs because assigning `paragraph.text` drops run formatting, and CJK text needs a `w:eastAsia` font alongside `run.font.name`; PowerPoint edits render changed slides because python-pptx cannot measure whether text fits its box; Excel edits use `document_recalculate` when formula results must show because openpyxl writes formulas without calculated values, and avoid writing a pandas DataFrame over an existing workbook because that drops other sheets, formulas, and formatting; and the original file is kept unless the user asks to replace it. Preview images arrive in the `document_render` result, and converted and recalculated files arrive as temporary paths that the model copies into the workspace with `cp` or `Copy-Item`. Loaded instructions remain in session history after an operation finishes. The diagram describes ordinary presets across supported clients; it does not change the shell-only definition of minimal or sdk-minimal. ----- @@ -100,7 +100,7 @@ The provider registers no tools or activation projection. Loaded skill results r - [Skill registry](../skill/README.md) — discovery and precedence. - [Skill tool](../tool-skill/README.md) — model catalogs and loaded bodies. - [File delivery](../../deliverables/tool-present/README.md) — current source-path delivery. -- [Office tools](../../document/tool-office/README.md) — rendering, conversion, and recalculation. +- [Office tools](../../document/tool-document/README.md) — rendering, conversion, and recalculation. ----- @@ -111,7 +111,7 @@ Indirectly, through `dsh-tool-skill`, which renders the one-line `office` summar #### KV Cache effect -Skill results append to history, and loaded text or images remain after an operation finishes. With `tool-office` mounted, the first successful `office` load enables the three tool declarations on the next step. A skill omitted or removed for an unreadable skill file changes the catalog, which a later step publishes as a catalog update. Character estimates use `ceil(characters / 4)`: the summary is at most 50 tokens, the body without the Python environment section is 232 tokens, and the complete `office` body with the Python environment section is at most 350 tokens (344 for `'workspace-dependencies'` and 346 for `'user'`). The appended Python environment section stays fixed while the configuration stays unchanged, and counts toward the `office` body. Skill wrappers, the generic catalog, shell and Office tool declarations, and `load_workspace_dependencies` are separate costs, and these estimates are not server usage. +Skill results append to history, and loaded text or images remain after an operation finishes. With `tool-document` mounted, the first successful `office` load enables the three tool declarations on the next step. A skill omitted or removed for an unreadable skill file changes the catalog, which a later step publishes as a catalog update. Character estimates use `ceil(characters / 4)`: the summary is at most 50 tokens, the body without the Python environment section is 235 tokens, and the complete `office` body with the Python environment section is at most 350 tokens (346 for `'workspace-dependencies'` and 348 for `'user'`). The appended Python environment section stays fixed while the configuration stays unchanged, and counts toward the `office` body. Skill wrappers, the generic catalog, shell and Office tool declarations, and `load_workspace_dependencies` are separate costs, and these estimates are not server usage. ## Known Limitations and Deferred Work diff --git a/packages/skill/skill-office/README.zh.md b/packages/skill/skill-office/README.zh.md index 9f6c632d81..c81e00d14d 100644 --- a/packages/skill/skill-office/README.zh.md +++ b/packages/skill/skill-office/README.zh.md @@ -9,7 +9,7 @@ kind: "package-reference" ## 概述 -目录只列出一个 `office` 技能。其说明按需加载,内联涵盖 Word、PowerPoint 和 Excel 的易错点以及 [`office_render`、`office_convert` 和 `office_recalculate`](../../document/tool-office/README.zh.md),并在末尾附上配置的 Python 环境说明。Web 应用和 SDK profile 挂载该提供者;只有 Desktop 或带主运行时的 SDK 还挂载内置依赖查询。 +目录只列出一个 `office` 技能。其说明按需加载,内联涵盖 Word、PowerPoint 和 Excel 的易错点以及 [`document_render`、`document_convert` 和 `document_recalculate`](../../document/tool-document/README.zh.md),并在末尾附上配置的 Python 环境说明。Web 应用和 SDK profile 挂载该提供者;只有 Desktop 或带主运行时的 SDK 还挂载内置依赖查询。 ## 目录 @@ -26,7 +26,7 @@ kind: "package-reference" ## 使用本包 -在技能注册表和 `dsh-tool-skill` 旁挂载技能提供者。提供者负责 `office` 说明,并追加 Python 环境说明。说明把操作交给 `office_render`、`office_convert` 和 `office_recalculate`,因此需在本提供者旁组合 [`tool-office`](../../document/tool-office/README.zh.md)。 +在技能注册表和 `dsh-tool-skill` 旁挂载技能提供者。提供者负责 `office` 说明,并追加 Python 环境说明。说明把操作交给 `document_render`、`document_convert` 和 `document_recalculate`,因此需在本提供者旁组合 [`tool-document`](../../document/tool-document/README.zh.md)。 ```yaml - name: '@deepseek-ai/dsh-skill-office' @@ -45,7 +45,7 @@ kind: "package-reference" ### 渐进加载 -模型依据任务选择技能;宿主不会根据文件扩展名注入完整说明。资源完整时,`office` 技能列入目录,可通过 `skill` 加载或由用户以 `/office` 显式调用。加载 `office` 会返回 Word、PowerPoint 和 Excel 易错点的精简内联说明,指出内置 Python 提供 `pypdf` 用于读取现有 PDF,并使三个 Office 工具从下一步开始可用;工具不在列表中时(例如 PTC 模式 resume 或 fork 之后),说明会指示模型重新加载 `office`。python-docx、openpyxl 和 python-pptx 无法打开的旧格式 `.doc`、`.xls`、`.ppt` 文件,先用 `office_convert` 转换。 +模型依据任务选择技能;宿主不会根据文件扩展名注入完整说明。资源完整时,`office` 技能列入目录,可通过 `skill` 加载或由用户以 `/office` 显式调用。加载 `office` 会返回 Word、PowerPoint 和 Excel 易错点的精简内联说明,指出内置 Python 提供 `pypdf` 用于读取现有 PDF,并使三个 Office 工具从下一步开始可用;工具不在列表中时(例如 PTC 模式 resume 或 fork 之后),说明会指示模型重新加载 `office`。python-docx、openpyxl 和 python-pptx 无法打开的旧格式 `.doc`、`.xls`、`.ppt` 文件,先用 `document_convert` 转换。 ```mermaid flowchart TD @@ -56,21 +56,21 @@ flowchart TD B -->|Create or edit| D["Author and validate content, structure and data"] D -->|No additional operation needed| F["Deliver"] - B -->|Render or inspect| R["office_render: images in the tool result"] + B -->|Render or inspect| R["document_render: images in the tool result"] D -->|Changed slides or visual inspection| R R --> V["Inspect rendered images"] V --> F - B -->|Formula recalculation| X["office_recalculate, shell copy"] + B -->|Formula recalculation| X["document_recalculate, shell copy"] D -->|Formula recalculation| X X --> F - B -->|Format conversion or PDF export| P["office_convert, shell copy"] + B -->|Format conversion or PDF export| P["document_convert, shell copy"] D -->|Format conversion or PDF export| P P --> F ``` -内联说明列出了各格式容易导致静默数据丢失的要点:Word 文本编辑在 run 内部修改文字,因为直接给 `paragraph.text` 赋值会丢弃段落内 run 的格式,且中日韩文字除设置 `run.font.name` 外还需设置 `w:eastAsia` 字体;PowerPoint 编辑后渲染修改过的幻灯片,因为 python-pptx 无法测量文字是否超出文本框;Excel 编辑在需要显示公式结果时调用 `office_recalculate`,因为 openpyxl 写入公式时不计算结果,且不要将 pandas DataFrame 直接覆盖写入已有工作簿,否则会丢失其他工作表、公式和格式;除非用户要求覆盖,否则保留原文件。预览图片直接出现在 `office_render` 结果中,转换和重算的文件以临时路径返回,由模型用 `cp` 或 `Copy-Item` 复制进工作区。操作结束后,已加载的说明仍属于会话历史。图中描述各端常规预设,不改变 minimal 或 sdk-minimal 的纯 shell 定义。 +内联说明列出了各格式容易导致静默数据丢失的要点:Word 文本编辑在 run 内部修改文字,因为直接给 `paragraph.text` 赋值会丢弃段落内 run 的格式,且中日韩文字除设置 `run.font.name` 外还需设置 `w:eastAsia` 字体;PowerPoint 编辑后渲染修改过的幻灯片,因为 python-pptx 无法测量文字是否超出文本框;Excel 编辑在需要显示公式结果时调用 `document_recalculate`,因为 openpyxl 写入公式时不计算结果,且不要将 pandas DataFrame 直接覆盖写入已有工作簿,否则会丢失其他工作表、公式和格式;除非用户要求覆盖,否则保留原文件。预览图片直接出现在 `document_render` 结果中,转换和重算的文件以临时路径返回,由模型用 `cp` 或 `Copy-Item` 复制进工作区。操作结束后,已加载的说明仍属于会话历史。图中描述各端常规预设,不改变 minimal 或 sdk-minimal 的纯 shell 定义。 ----- @@ -100,7 +100,7 @@ flowchart TD - [技能注册表](../skill/README.zh.md) — 发现和优先级。 - [技能工具](../tool-skill/README.zh.md) — 模型目录和加载正文。 - [文件交付](../../deliverables/tool-present/README.zh.md) — 当前源文件路径交付。 -- [Office 工具](../../document/tool-office/README.zh.md) — 渲染、转换和重算。 +- [Office 工具](../../document/tool-document/README.zh.md) — 渲染、转换和重算。 ----- @@ -111,7 +111,7 @@ flowchart TD #### KV Cache 影响 -技能结果追加到历史中,操作完成后已加载文本或图片仍保留在历史中。挂载 `tool-office` 时,首次成功加载 `office` 会在下一步启用三个工具声明。因技能文件不可读而省略或移除的技能会改变目录,后续步骤会将其作为目录更新发布。字符估算采用 `ceil(字符数 / 4)`:摘要最多 50 token,不含 Python 环境说明的正文为 232 token,含 Python 环境说明的完整 `office` 正文最多 350 token(`'workspace-dependencies'` 为 344 token,`'user'` 为 346 token)。配置不变时,追加的 Python 环境说明保持不变,并计入 `office` 正文。技能包装、通用目录、shell 与 Office 工具声明和 `load_workspace_dependencies` 单独计费;这些估算不等同于服务端 usage。 +技能结果追加到历史中,操作完成后已加载文本或图片仍保留在历史中。挂载 `tool-document` 时,首次成功加载 `office` 会在下一步启用三个工具声明。因技能文件不可读而省略或移除的技能会改变目录,后续步骤会将其作为目录更新发布。字符估算采用 `ceil(字符数 / 4)`:摘要最多 50 token,不含 Python 环境说明的正文为 235 token,含 Python 环境说明的完整 `office` 正文最多 350 token(`'workspace-dependencies'` 为 346 token,`'user'` 为 348 token)。配置不变时,追加的 Python 环境说明保持不变,并计入 `office` 正文。技能包装、通用目录、shell 与 Office 工具声明和 `load_workspace_dependencies` 单独计费;这些估算不等同于服务端 usage。 ## 已知限制与后续工作 diff --git a/packages/skill/skill-office/assets/office/SKILL.md b/packages/skill/skill-office/assets/office/SKILL.md index 0d2cdc7f0e..258fc64808 100644 --- a/packages/skill/skill-office/assets/office/SKILL.md +++ b/packages/skill/skill-office/assets/office/SKILL.md @@ -1,15 +1,15 @@ --- name: office -description: Create, read, edit, and validate Word, PowerPoint, and Excel files; render Office files and PDFs; convert or recalculate. Load first to enable office_render, office_convert, and office_recalculate. +description: Create, read, edit, and validate Word, PowerPoint, and Excel files; render Office files and PDFs; convert or recalculate. Load first to enable document_render, document_convert, document_recalculate. --- # Office tasks -`office_render`, `office_convert`, and `office_recalculate` become available on the next step; if one is missing later, load `office` again. Bundled Python includes `pypdf` for existing PDFs. +`document_render`, `document_convert`, and `document_recalculate` become available on the next step; if one is missing later, load `office` again. Bundled Python includes `pypdf` for existing PDFs. -- python-docx, python-pptx, and openpyxl cannot open legacy `.doc`, `.ppt`, or `.xls` files; convert them with `office_convert` first. +- python-docx, python-pptx, and openpyxl cannot open legacy `.doc`, `.ppt`, or `.xls` files; convert them with `document_convert` first. - Word: change text inside runs; assigning `paragraph.text` drops the paragraph's run formatting. Chinese, Japanese, and Korean text needs a `w:eastAsia` font in addition to `run.font.name`. - PowerPoint: python-pptx cannot measure whether text fits its box; render changed slides to check overflow and overlap. -- Excel: openpyxl writes formulas without calculated values; use `office_recalculate` when results must show. Writing a pandas DataFrame over an existing workbook drops its other sheets, formulas, and formatting. +- Excel: openpyxl writes formulas without calculated values; use `document_recalculate` when results must show. Writing a pandas DataFrame over an existing workbook drops its other sheets, formulas, and formatting. Keep the original file unless the user asks to replace it. diff --git a/packages/skill/skill-office/tests/fixtures/real-office.ts b/packages/skill/skill-office/tests/fixtures/real-office.ts index b11dd32a33..bfbd82e5b4 100644 --- a/packages/skill/skill-office/tests/fixtures/real-office.ts +++ b/packages/skill/skill-office/tests/fixtures/real-office.ts @@ -27,14 +27,14 @@ export function officeModelPatches() { export function officeToolPatches() { return [{ insert: [ { id: 'office-kit', name: '@deepseek-ai/dsh-office-kit' }, - { id: 'tool-office', name: '@deepseek-ai/dsh-tool-office' }, + { id: 'tool-document', name: '@deepseek-ai/dsh-tool-document' }, ] }] } /** One Office call from a native tool call or a PTC dispatch. */ export interface OfficeCall { readonly callId: string - readonly name: 'office_render' | 'office_convert' | 'office_recalculate' + readonly name: 'document_render' | 'document_convert' | 'document_recalculate' readonly args: { readonly input?: string; readonly format?: string; readonly pages?: number[] } } @@ -47,7 +47,7 @@ export function officeCalls(events: readonly SessionEvent[]): OfficeCall[] { return events.flatMap((event): OfficeCall[] => { if (event.type !== 'tool/call' && event.type !== 'tool/ptc-dispatch') return [] const { name } = event.data - if (name !== 'office_render' && name !== 'office_convert' && name !== 'office_recalculate') return [] + if (name !== 'document_render' && name !== 'document_convert' && name !== 'document_recalculate') return [] return event.type === 'tool/call' ? [{ callId: event.data.callId, name, args: JSON.parse(event.data.arguments) as OfficeCall['args'] }] : [{ callId: event.data.subCallId, name, args: event.data.arguments as OfficeCall['args'] }] @@ -100,7 +100,7 @@ export function convertedPdfFiles(events: readonly SessionEvent[]): ConvertedPdf */ export function expectNoRenderContext(events: readonly SessionEvent[]): void { const calls = officeCalls(events) - expect(calls.filter(call => call.name === 'office_render'), JSON.stringify(calls)).toEqual([]) + expect(calls.filter(call => call.name === 'document_render'), JSON.stringify(calls)).toEqual([]) const messages = Session.create(brandString('office-context'), events).deriveMessages() expect(JSON.stringify(messages)).not.toMatch(/Render the saved deliverable/) } diff --git a/packages/skill/skill-office/tests/fixtures/visual-intent.ts b/packages/skill/skill-office/tests/fixtures/visual-intent.ts index c30bb848e0..aa31bbfd26 100644 --- a/packages/skill/skill-office/tests/fixtures/visual-intent.ts +++ b/packages/skill/skill-office/tests/fixtures/visual-intent.ts @@ -106,7 +106,7 @@ export function registerVisualIntentCases(selected: readonly DocumentFormat[]): const events = parseSessionLog(bytes.toString('utf8')) const calls = events.filter(event => event.type === 'tool/call').map(event => event.data) const loaded = calls.filter(call => call.name === 'skill').map(call => (JSON.parse(call.arguments) as { name: string }).name) - const renderCalls = officeCalls(events).filter(call => call.name === 'office_render') + const renderCalls = officeCalls(events).filter(call => call.name === 'document_render') const rendered = events.filter(event => event.type === 'tool/result' && renderCalls.some(call => call.callId === event.data.message.toolCallId) && !event.data.message.isError && event.data.message.content.some(block => block.type === 'image')).length const shellCommands = calls.filter(call => call.name === 'bash' || call.name === 'pwsh') diff --git a/packages/skill/skill-office/tests/progressive-loading.spec.ts b/packages/skill/skill-office/tests/progressive-loading.spec.ts index 7937895e1d..5f69bcdc67 100644 --- a/packages/skill/skill-office/tests/progressive-loading.spec.ts +++ b/packages/skill/skill-office/tests/progressive-loading.spec.ts @@ -80,7 +80,7 @@ it.each(['native', 'ptc'] as const)('loads the office skill in %s; resume and fo expect(requests[1]).toContain(resourceBase) if (mode === 'native') expect(requests[1]).toContain('Base directory for this skill:') expect(requests[1]).toContain('python-docx') - expect(requests[1]).toContain('`office_render`') + expect(requests[1]).toContain('`document_render`') if (mode === 'ptc') { expect(agent.session.snapshotEvents().filter(event => event.type === 'user/message' && event.data.source.kind === 'skill-invocation')).toEqual([]) } @@ -93,7 +93,7 @@ it.each(['native', 'ptc'] as const)('loads the office skill in %s; resume and fo for (const request of adapter.requests.slice(2)) { const text = JSON.stringify(request) expect(text).toContain('python-docx') - expect(text).toContain('`office_render`') + expect(text).toContain('`document_render`') expect(text).not.toMatch(/dsoffice|fragment rectangles/u) } expect(agent.session.snapshotEvents()).toEqual(seed) @@ -104,7 +104,7 @@ it('routes standalone operations to dedicated Office tools', async () => { await send(agent) const loaded = JSON.stringify(adapter.requests.at(-1)) expect(loaded).toContain('# Office tasks') - for (const name of ['office_render', 'office_recalculate', 'office_convert']) expect(loaded).toContain(`\`${name}\``) + for (const name of ['document_render', 'document_recalculate', 'document_convert']) expect(loaded).toContain(`\`${name}\``) expect(loaded).not.toContain('operation:') }) diff --git a/packages/skill/skill-office/tests/render-context.spec.ts b/packages/skill/skill-office/tests/render-context.spec.ts index 4291cb468e..47d7634208 100644 --- a/packages/skill/skill-office/tests/render-context.spec.ts +++ b/packages/skill/skill-office/tests/render-context.spec.ts @@ -14,7 +14,7 @@ it('collects displayed images from native results, inspect output and PTC additi } } session.append('tool/ptc-dispatch', { rootCallId: brandString('program'), parentCallId: brandString('program'), subCallId: brandString('program:1'), - name: 'office_render', arguments: {}, isError: false, content: [image], + name: 'document_render', arguments: {}, isError: false, content: [image], }) session.append('user/message', createUserMessage({ content: [image], source: { kind: 'user' } }), { surfaceOp: 'append' }) session.append('tool/result', { turn: 1, step: 1, @@ -34,11 +34,11 @@ it('collects displayed images from native results, inspect output and PTC additi it.each([undefined, 2])('rejects a native render with JSON indentation %s', (indent) => { const session = Session.create(brandString('native-render')) session.append('tool/call', { - turn: 1, step: 1, callId: brandString('render'), name: 'office_render', + turn: 1, step: 1, callId: brandString('render'), name: 'document_render', arguments: JSON.stringify({ input: 'input.docx' }, null, indent), }) expect(officeCalls(session.snapshotEvents())).toEqual([ - { callId: 'render', name: 'office_render', args: { input: 'input.docx' } }, + { callId: 'render', name: 'document_render', args: { input: 'input.docx' } }, ]) expect(() => { expectNoRenderContext(session.snapshotEvents()) }).toThrow() }) @@ -47,19 +47,19 @@ it('rejects a PTC render even without a model-visible PTC result', () => { const session = Session.create(brandString('ptc-render')) session.append('tool/ptc-dispatch', { rootCallId: brandString('program'), parentCallId: brandString('program'), subCallId: brandString('program:1'), - name: 'office_render', arguments: { input: 'input.docx' }, isError: false, content: [], + name: 'document_render', arguments: { input: 'input.docx' }, isError: false, content: [], }) expect(session.deriveMessages()).toEqual([]) expect(officeCalls(session.snapshotEvents())).toEqual([ - { callId: 'program:1', name: 'office_render', args: { input: 'input.docx' } }, + { callId: 'program:1', name: 'document_render', args: { input: 'input.docx' } }, ]) expect(() => { expectNoRenderContext(session.snapshotEvents()) }).toThrow() }) -it.each(['office_convert', 'office_recalculate'])('accepts %s and quoted render instructions without a render call', (name) => { +it.each(['document_convert', 'document_recalculate'])('accepts %s and quoted render instructions without a render call', (name) => { const session = Session.create(brandString('pdf-conversion')) session.append('user/message', createUserMessage({ - content: [{ type: 'text', text: 'For visual inspection use office_render.' }], source: { kind: 'user' }, + content: [{ type: 'text', text: 'For visual inspection use document_render.' }], source: { kind: 'user' }, }), { surfaceOp: 'append' }) session.append('tool/call', { turn: 1, step: 1, callId: brandString('output'), name, diff --git a/packages/skill/skill-office/tests/render-tools.e2e.ts b/packages/skill/skill-office/tests/render-tools.e2e.ts index c3b7f39bfd..6188142ed8 100644 --- a/packages/skill/skill-office/tests/render-tools.e2e.ts +++ b/packages/skill/skill-office/tests/render-tools.e2e.ts @@ -38,7 +38,7 @@ async function sessionEvents(cwd: string) { return events } -it.skipIf(!process.env.DEEPSEEK_API_KEY || !runtime).each([{ format: 'docx', mode: 'native' }, { format: 'pdf', mode: 'native' }, { format: 'docx', mode: 'ptc' }])('renders $format with office_render in $mode mode', async ({ format, mode }) => { +it.skipIf(!process.env.DEEPSEEK_API_KEY || !runtime).each([{ format: 'docx', mode: 'native' }, { format: 'pdf', mode: 'native' }, { format: 'docx', mode: 'ptc' }])('renders $format with document_render in $mode mode', async ({ format, mode }) => { let original: Buffer | undefined await runLoaderSmoke({ label: 'Office rendering', tempDirPrefix: 'dsh-office-render-', @@ -62,7 +62,7 @@ it.skipIf(!process.env.DEEPSEEK_API_KEY || !runtime).each([{ format: 'docx', mod if (event.type === 'tool/ptc-dispatch') return [{ name: event.data.name, arguments: JSON.stringify(event.data.arguments) }] return [] }) - const renders = officeCalls(events).filter(call => call.name === 'office_render') + const renders = officeCalls(events).filter(call => call.name === 'document_render') expect(renders.length, JSON.stringify(calls)).toBeGreaterThan(0) expect(officeImages(events).length, JSON.stringify(calls)).toBeGreaterThan(0) }, @@ -87,7 +87,7 @@ it.skipIf(!process.env.DEEPSEEK_API_KEY || !runtime)('keeps Office skills and th }) }) -it.skipIf(!process.env.DEEPSEEK_API_KEY || !runtime)('exports PDF with office_convert and preserves the source', async () => { +it.skipIf(!process.env.DEEPSEEK_API_KEY || !runtime)('exports PDF with document_convert and preserves the source', async () => { let original: Buffer | undefined await runLoaderSmoke({ ...launch, @@ -110,9 +110,9 @@ it.skipIf(!process.env.DEEPSEEK_API_KEY || !runtime)('exports PDF with office_co const converted = convertedPdfFiles(events) const diagnostic = JSON.stringify({ calls: calls.map(call => call.name), skills, commands, office: office.map(call => ({ name: call.name, input: call.args.input, format: call.args.format })), converted }) - expect(office.some(call => call.name === 'office_convert' && call.args.format === 'pdf'), diagnostic).toBe(true) + expect(office.some(call => call.name === 'document_convert' && call.args.format === 'pdf'), diagnostic).toBe(true) // The conversion reports the temporary output's byte count and that file is released when the conversation - // ends, so a matching size is what ties result.pdf to office_convert. Extra steps such as pdfinfo, a format + // ends, so a matching size is what ties result.pdf to document_convert. Extra steps such as pdfinfo, a format // skill, or a render of the result are model choices and do not change the deliverable. const delivered = await readFile(join(cwd, 'result.pdf')) expect(converted.some(conversion => conversion.bytes === delivered.length), diagnostic).toBe(true) diff --git a/packages/skill/skill-office/tests/skill-office.spec.ts b/packages/skill/skill-office/tests/skill-office.spec.ts index d34bfc661e..1a1b92b6ef 100644 --- a/packages/skill/skill-office/tests/skill-office.spec.ts +++ b/packages/skill/skill-office/tests/skill-office.spec.ts @@ -27,7 +27,7 @@ describe('bundled Office skills', () => { await ctx.plugin(SkillOffice) expect((await ctx.skills.list()).map(skill => skill.name)).toEqual(names) const route = (await ctx.skills.get('office'))! - expect(route.description).toBe('Create, read, edit, and validate Word, PowerPoint, and Excel files; render Office files and PDFs; convert or recalculate. Load first to enable office_render, office_convert, and office_recalculate.') + expect(route.description).toBe('Create, read, edit, and validate Word, PowerPoint, and Excel files; render Office files and PDFs; convert or recalculate. Load first to enable document_render, document_convert, document_recalculate.') expect(Math.ceil(route.description.length / 4)).toBeLessThanOrEqual(50) } finally { await ctx.fiber.dispose() } for (const pythonEnvironment of ['workspace-dependencies', 'user'] as const) { @@ -312,10 +312,10 @@ it('directs Office operations to dedicated tools without executable paths', asyn await ctx.plugin(SkillRegistry) await ctx.plugin(SkillOffice) const route = (await ctx.skills.get('office'))!.content - expect(route).toContain('`office_render`, `office_convert`, and `office_recalculate` become available on the next step; if one is missing later, load `office` again.') + expect(route).toContain('`document_render`, `document_convert`, and `document_recalculate` become available on the next step; if one is missing later, load `office` again.') expect(route).toContain('Bundled Python includes `pypdf` for existing PDFs.') - expect(route).toContain('python-docx, python-pptx, and openpyxl cannot open legacy `.doc`, `.ppt`, or `.xls` files; convert them with `office_convert` first.') - expect(route).toContain('openpyxl writes formulas without calculated values; use `office_recalculate` when results must show.') + expect(route).toContain('python-docx, python-pptx, and openpyxl cannot open legacy `.doc`, `.ppt`, or `.xls` files; convert them with `document_convert` first.') + expect(route).toContain('openpyxl writes formulas without calculated values; use `document_recalculate` when results must show.') expect(route).not.toMatch( /operation:|`office` tool|office-render|office-recalculate|office-export-pdf|LibreOffice Kit CLI|--output-dir|""|`[a-z]+\.md`/u, ) diff --git a/packages/skill/skill-office/tests/xlsx-validation.e2e.ts b/packages/skill/skill-office/tests/xlsx-validation.e2e.ts index 829fc2ba42..fd1aa23fc9 100644 --- a/packages/skill/skill-office/tests/xlsx-validation.e2e.ts +++ b/packages/skill/skill-office/tests/xlsx-validation.e2e.ts @@ -127,7 +127,7 @@ else: assert load_workbook('result.xlsx', data_only=True)['Revenue']['B4'].value == 38 `], { cwd }) expect(verified.exitCode).toBe(0) - if (kind === 'formula') expect(officeCalls(events).some(call => call.name === 'office_recalculate')).toBe(true) + if (kind === 'formula') expect(officeCalls(events).some(call => call.name === 'document_recalculate')).toBe(true) }, }) const calls = events.flatMap(event => event.type === 'tool/call' ? [event.data] : event.type === 'tool/ptc-dispatch' ? [{ name: event.data.name, arguments: JSON.stringify(event.data.arguments), callId: event.data.rootCallId }] : []) @@ -142,8 +142,8 @@ else: expect(calls.some(call => call.name === 'load_workspace_dependencies'), diagnostic).toBe(true) if (kind === 'layout') { const office = officeCalls(events) - expect(office.some(call => call.name === 'office_render' && 'sheet' in call.args && 'range' in call.args), diagnostic).toBe(true) - expect(office.some(call => call.name === 'office_convert'), diagnostic).toBe(false) + expect(office.some(call => call.name === 'document_render' && 'sheet' in call.args && 'range' in call.args), diagnostic).toBe(true) + expect(office.some(call => call.name === 'document_convert'), diagnostic).toBe(false) } }) }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8e0455da90..9516419e4d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3027,9 +3027,9 @@ importers: '@deepseek-ai/dsh-tool-cordis': specifier: workspace:* version: link:../../extensions/tool-cordis - '@deepseek-ai/dsh-tool-office': + '@deepseek-ai/dsh-tool-document': specifier: workspace:* - version: link:../../document/tool-office + version: link:../../document/tool-document '@deepseek-ai/dsh-tool-present': specifier: workspace:* version: link:../../deliverables/tool-present @@ -3566,6 +3566,9 @@ importers: '@deepseek-ai/dsh-tool-cordis': specifier: workspace:* version: link:../../extensions/tool-cordis + '@deepseek-ai/dsh-tool-document': + specifier: workspace:* + version: link:../../document/tool-document '@deepseek-ai/dsh-tool-executor-ptc': specifier: workspace:* version: link:../../core/tool-executor-ptc @@ -3581,9 +3584,6 @@ importers: '@deepseek-ai/dsh-tool-jobs': specifier: workspace:* version: link:../../jobs/tool-jobs - '@deepseek-ai/dsh-tool-office': - specifier: workspace:* - version: link:../../document/tool-office '@deepseek-ai/dsh-tool-present': specifier: workspace:* version: link:../../deliverables/tool-present @@ -9649,8 +9649,11 @@ importers: '@deepseek-ai/dsh-session': specifier: workspace:* version: link:../../core/session + '@deepseek-ai/dsh-subprocess-local': + specifier: workspace:* + version: link:../../subprocess/subprocess-local - packages/document/tool-office: + packages/document/tool-document: dependencies: '@deepseek-ai/dsh-brand': specifier: workspace:* @@ -21318,6 +21321,9 @@ importers: '@deepseek-ai/dsh-tool-cordis': specifier: workspace:* version: link:../../packages/extensions/tool-cordis + '@deepseek-ai/dsh-tool-document': + specifier: workspace:* + version: link:../../packages/document/tool-document '@deepseek-ai/dsh-tool-executor-ptc': specifier: workspace:* version: link:../../packages/core/tool-executor-ptc @@ -21333,9 +21339,6 @@ importers: '@deepseek-ai/dsh-tool-jobs': specifier: workspace:* version: link:../../packages/jobs/tool-jobs - '@deepseek-ai/dsh-tool-office': - specifier: workspace:* - version: link:../../packages/document/tool-office '@deepseek-ai/dsh-tool-present': specifier: workspace:* version: link:../../packages/deliverables/tool-present diff --git a/python/sdk-runtime/README.i18n.yaml b/python/sdk-runtime/README.i18n.yaml index 71f98affa8..4ee92635ed 100644 --- a/python/sdk-runtime/README.i18n.yaml +++ b/python/sdk-runtime/README.i18n.yaml @@ -6,8 +6,8 @@ en: 1ea1d8e6d2c14b02 zh: 8e0b9903158667a1 /deepseek-harness-runtime-bin/installed-commands-and-artifacts: - en: 0cb99098488b2287 - zh: 0ad6e418502a1e2d + en: 563f5f522d3b6240 + zh: fbaf5fab6dfb68ac /deepseek-harness-runtime-bin/python-module-api: en: 78a200e328d96637 zh: f3b7a0b69b7a39e0 diff --git a/python/sdk-runtime/README.md b/python/sdk-runtime/README.md index b793749761..1eae806507 100644 --- a/python/sdk-runtime/README.md +++ b/python/sdk-runtime/README.md @@ -34,7 +34,7 @@ Skill selection is independent of delivery: project, custom-directory, and user disabled: true ``` -Office skills direct rendering, conversion, and recalculation to the [Office tools](../../packages/document/tool-office/README.md), which load the sidecar's Kit inside the SDK process. See the [Office provider](../../packages/skill/skill-office/README.md#use-this-package) for replacing the skill collection. Configuration patches apply at process startup; changing skills does not require rebuilding the runtime wheel or Python environment. +Office skills direct rendering, conversion, and recalculation to the [Office tools](../../packages/document/tool-document/README.md), which load the sidecar's Kit inside the SDK process. See the [Office provider](../../packages/skill/skill-office/README.md#use-this-package) for replacing the skill collection. Configuration patches apply at process startup; changing skills does not require rebuilding the runtime wheel or Python environment. Repository builds also materialize a dev-only `runtime/node/` carrier. It runs `node runtime/node/runtime-bootstrap.mjs` on system Node 24.22.3 or a newer 24.x release, or Node 26.13.1 or newer. It is never selected automatically and is excluded from wheels and sdists. diff --git a/python/sdk-runtime/README.zh.md b/python/sdk-runtime/README.zh.md index 5f78455238..fb89beb45d 100644 --- a/python/sdk-runtime/README.zh.md +++ b/python/sdk-runtime/README.zh.md @@ -34,7 +34,7 @@ primary_runtime = download_primary_runtime() disabled: true ``` -Office 技能把渲染、转换和重算交给 [Office 工具](../../packages/document/tool-office/README.zh.md),它们在 SDK 进程内加载 sidecar 中的 Kit。替换技能集合的方式见 [Office 提供方](../../packages/skill/skill-office/README.zh.md#use-this-package)。配置 patch 在进程启动时生效;切换技能无需重建 runtime wheel 或 Python 环境。 +Office 技能把渲染、转换和重算交给 [Office 工具](../../packages/document/tool-document/README.zh.md),它们在 SDK 进程内加载 sidecar 中的 Kit。替换技能集合的方式见 [Office 提供方](../../packages/skill/skill-office/README.zh.md#use-this-package)。配置 patch 在进程启动时生效;切换技能无需重建 runtime wheel 或 Python 环境。 仓库构建还会物化仅限开发的 `runtime/node/` 载体。它在系统 Node 24.22.3 或更高的 24.x 版本,或 Node 26.13.1 或更高版本上运行 `node runtime/node/runtime-bootstrap.mjs`。系统不会自动选择它,而且 wheel 包与 sdist 均不包含它。 diff --git a/python/sdk-runtime/package.json b/python/sdk-runtime/package.json index 766ff3c72c..6de4471a6b 100644 --- a/python/sdk-runtime/package.json +++ b/python/sdk-runtime/package.json @@ -130,12 +130,12 @@ "@deepseek-ai/dsh-tool-bash-persistent": "workspace:*", "@deepseek-ai/dsh-tool-call-timeout-policy": "workspace:*", "@deepseek-ai/dsh-tool-cordis": "workspace:*", + "@deepseek-ai/dsh-tool-document": "workspace:*", "@deepseek-ai/dsh-tool-executor-ptc": "workspace:*", "@deepseek-ai/dsh-tool-fs": "workspace:*", "@deepseek-ai/dsh-tool-fs-search": "workspace:*", "@deepseek-ai/dsh-tool-goal": "workspace:*", "@deepseek-ai/dsh-tool-jobs": "workspace:*", - "@deepseek-ai/dsh-tool-office": "workspace:*", "@deepseek-ai/dsh-tool-present": "workspace:*", "@deepseek-ai/dsh-tool-pwsh": "workspace:*", "@deepseek-ai/dsh-tool-pwsh-persistent": "workspace:*", diff --git a/scripts/gen-doc-graphs.ts b/scripts/gen-doc-graphs.ts index 8b894f99b5..c99047f5a6 100644 --- a/scripts/gen-doc-graphs.ts +++ b/scripts/gen-doc-graphs.ts @@ -320,7 +320,7 @@ const SERVICE_ROLES: ServiceRole[] = [ }, { key: 'officeKit', pkg: 'office-kit', title: 'Office rendering, conversion, and recalculation', - mode: 'core', consumers: ['client-ui-sidebar-documentpreview', 'tool-office'], + mode: 'core', consumers: ['client-ui-sidebar-documentpreview', 'tool-document'], note: 'Authorized Office bytes are rendered as PDFs or images, converted, or recalculated on the Host using the declared native target engine, or Node WASM when no native target is declared.', }, { diff --git a/scripts/gen-tool-catalog.ts b/scripts/gen-tool-catalog.ts index 4b87673ad7..2c2c487762 100644 --- a/scripts/gen-tool-catalog.ts +++ b/scripts/gen-tool-catalog.ts @@ -56,7 +56,7 @@ import * as ToolPwshPersistent from '@deepseek-ai/dsh-tool-pwsh-persistent' import CordisHostRunner from '@deepseek-ai/dsh-cordis-host-runner' import * as ToolCordis from '@deepseek-ai/dsh-tool-cordis' import * as ToolPresent from '@deepseek-ai/dsh-tool-present' -import * as ToolOffice from '@deepseek-ai/dsh-tool-office' +import * as ToolDocument from '@deepseek-ai/dsh-tool-document' import * as ToolFs from '@deepseek-ai/dsh-tool-fs' import * as ToolFsSearch from '@deepseek-ai/dsh-tool-fs-search' import * as ToolStrReplaceEditor from '@deepseek-ai/dsh-tool-str-replace-editor' @@ -360,16 +360,16 @@ const TOOL_PACKAGES: ToolPackage[] = [ 'The bash tool is the model-facing consumer of the bash executor seam. With a job registry composed every call registers with the generic `ctx.jobs` runtime as it starts, collected/stopped through the `job_*` tools from `@deepseek-ai/dsh-tool-jobs`; without one, or with `enableRunInBackground: false`, the tool registers a foreground-only schema without the `run_in_background` parameter.', }, { - pkg: '@deepseek-ai/dsh-tool-office', - dir: 'tool-office', - source: 'packages/document/tool-office/src/index.ts', - requires: ['ctx.workingDirectory', 'ctx.tools', 'ctx.fs', 'ctx.agents', 'ctx.officeKit', 'ctx.attachments and ctx.llm for office_render'], + pkg: '@deepseek-ai/dsh-tool-document', + dir: 'tool-document', + source: 'packages/document/tool-document/src/index.ts', + requires: ['ctx.workingDirectory', 'ctx.tools', 'ctx.fs', 'ctx.agents', 'ctx.officeKit', 'ctx.attachments and ctx.llm for document_render'], writes: ['tool/call', 'tool/result with rendered image attachments', 'temporary converted files in the Office kit output store'], async mount(ctx) { // Schema harvest never renders or converts a document. ctx.provide('officeKit', {} as OfficeKit) await ctx.plugin(AgentRegistry) - await ctx.plugin(ToolOffice) + await ctx.plugin(ToolDocument) }, note: 'Declared to an Agent from the step after it successfully loads an Office skill, and kept while the previous request header declares an Office tool. Admitted calls fail with the Office service\'s unavailable error when LibreOffice Kit is not installed.', }, diff --git a/scripts/smoke-python-runtime.py b/scripts/smoke-python-runtime.py index 9c7277bd29..0eea7048f8 100644 --- a/scripts/smoke-python-runtime.py +++ b/scripts/smoke-python-runtime.py @@ -93,7 +93,7 @@ LEGACY_CUSTOM_DISABLED_ROWS = ( "tool-fs", "tool-fs-search", "tool-goal", - "tool-office", + "tool-document", "tool-plugin-manager", "tool-schedule", "tool-skill", diff --git a/scripts/snapshots/python-sdk-single-exe/authoring/model-visible.json b/scripts/snapshots/python-sdk-single-exe/authoring/model-visible.json index b6f04f86c1..317b66596b 100644 --- a/scripts/snapshots/python-sdk-single-exe/authoring/model-visible.json +++ b/scripts/snapshots/python-sdk-single-exe/authoring/model-visible.json @@ -8,7 +8,7 @@ } }, "catalogs": [ - "Query the packaged Python environment for Office authoring.\nThe following information describes your current session:\n\nCurrent working directory: \"{{cwd}}\".\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).\n\nYou are the root agent. Your name is \"lead\".\n\nTo message other agents, use send_message({ agent: \"\", message: \"...\" }).\nUse list_agents({}) to find your collaborator agents and their names.\n\nA skill is a reusable set of task-specific instructions. The following skills are available in this session:\n\n\n- `dsh-doc`: Use when a task needs facts about DeepSeek Harness (DSH) itself, such as how a feature, setting, plugin, agent preset, tool, or Cordis API of the running installation works; when the user asks to design, review, build, install, enable, or debug a DSH plugin, bundle, MCP connection, agent preset, plugin icon or detail page, or a DSH tool definition or skill; and when upgrading a plugin or profile to a newer DSH release. Loading it grants no permission to change files or the profile.\n- `office`: Create, read, edit, and validate Word, PowerPoint, and Excel files; render Office files and PDFs; convert or recalculate. Load first to enable office_render, office_convert, and office_recalculate.\n- `official-plugins`: Check DSH’s optional plugins when the user asks how to do or use something in this app, whether it can, or says a capability is missing or should change: tools, input, thinking or title display, session search, terminals, worktrees, agent teams, desktop control, automation, access, approvals, badges or signatures, plugins or plugin sources. Not a request to develop DSH, even in its own repository: load before reading files or source. Not for ordinary tasks, quoted wishes or declined offers.\n- `personalized-pages`: Plan an optional page or small tool when the user asks for a page, tab, panel, tool or interface in this app (even for one-off use), wants something to keep, revisit or update later, will keep changing data in your answer, or wants a live view of this app’s own data (Sessions, tasks, logs, workspace). Load this before reading any files or source; it says how to submit the proposal. Not for requested files or code, ordinary answers, existing-feature questions, quoted wishes or declined offers.\n\n\nIf the user names a skill, or the task clearly matches a skill's description, call the `skill` tool with the exact skill name before taking task actions. Load all applicable skills, then follow their full instructions. This catalog contains summaries only; do not infer or follow a skill's instructions until it has been loaded.\nA user may also invoke a skill directly; its block then appears in this conversation. Follow it, and do not call the `skill` tool again for that skill.\n\nTime sampled while preparing turn 1, step 1: 2026-10-16T00:00:00+00:00[UTC]\nBrowser time zone for this request: UTC. Interpret otherwise-unqualified dates and times in this zone.\nElapsed since the preceding model-visible message: unavailable.\n" + "Query the packaged Python environment for Office authoring.\nThe following information describes your current session:\n\nCurrent working directory: \"{{cwd}}\".\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).\n\nYou are the root agent. Your name is \"lead\".\n\nTo message other agents, use send_message({ agent: \"\", message: \"...\" }).\nUse list_agents({}) to find your collaborator agents and their names.\n\nA skill is a reusable set of task-specific instructions. The following skills are available in this session:\n\n\n- `dsh-doc`: Use when a task needs facts about DeepSeek Harness (DSH) itself, such as how a feature, setting, plugin, agent preset, tool, or Cordis API of the running installation works; when the user asks to design, review, build, install, enable, or debug a DSH plugin, bundle, MCP connection, agent preset, plugin icon or detail page, or a DSH tool definition or skill; and when upgrading a plugin or profile to a newer DSH release. Loading it grants no permission to change files or the profile.\n- `office`: Create, read, edit, and validate Word, PowerPoint, and Excel files; render Office files and PDFs; convert or recalculate. Load first to enable document_render, document_convert, and document_recalculate.\n- `official-plugins`: Check DSH’s optional plugins when the user asks how to do or use something in this app, whether it can, or says a capability is missing or should change: tools, input, thinking or title display, session search, terminals, worktrees, agent teams, desktop control, automation, access, approvals, badges or signatures, plugins or plugin sources. Not a request to develop DSH, even in its own repository: load before reading files or source. Not for ordinary tasks, quoted wishes or declined offers.\n- `personalized-pages`: Plan an optional page or small tool when the user asks for a page, tab, panel, tool or interface in this app (even for one-off use), wants something to keep, revisit or update later, will keep changing data in your answer, or wants a live view of this app’s own data (Sessions, tasks, logs, workspace). Load this before reading any files or source; it says how to submit the proposal. Not for requested files or code, ordinary answers, existing-feature questions, quoted wishes or declined offers.\n\n\nIf the user names a skill, or the task clearly matches a skill's description, call the `skill` tool with the exact skill name before taking task actions. Load all applicable skills, then follow their full instructions. This catalog contains summaries only; do not infer or follow a skill's instructions until it has been loaded.\nA user may also invoke a skill directly; its block then appears in this conversation. Follow it, and do not call the `skill` tool again for that skill.\n\nTime sampled while preparing turn 1, step 1: 2026-10-16T00:00:00+00:00[UTC]\nBrowser time zone for this request: UTC. Interpret otherwise-unqualified dates and times in this zone.\nElapsed since the preceding model-visible message: unavailable.\n" ], "result": { "python": "{{python}}", diff --git a/scripts/snapshots/python-sdk-single-exe/authoring/win-x64/model-visible.json b/scripts/snapshots/python-sdk-single-exe/authoring/win-x64/model-visible.json index c3fb8032cb..c563655f3b 100644 --- a/scripts/snapshots/python-sdk-single-exe/authoring/win-x64/model-visible.json +++ b/scripts/snapshots/python-sdk-single-exe/authoring/win-x64/model-visible.json @@ -8,7 +8,7 @@ } }, "catalogs": [ - "Query the packaged Python environment for Office authoring.\nThe following information describes your current session:\n\nCurrent working directory: \"{{cwd}}\".\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).\n\nYou are the root agent. Your name is \"lead\".\n\nTo message other agents, use send_message({ agent: \"\", message: \"...\" }).\nUse list_agents({}) to find your collaborator agents and their names.\n\nA skill is a reusable set of task-specific instructions. The following skills are available in this session:\n\n\n- `diagnose-windows-sandbox-acl`: Use on Windows for unexpected DSH sandbox access denials: workspace writes or listing fail, or an ordinarily readable path cannot be read. One bundled command inspects the path and every ancestor and repairs the ACL problems it proves in that same run. Expected confinement denials need no ACL repair.\n- `dsh-doc`: Use when a task needs facts about DeepSeek Harness (DSH) itself, such as how a feature, setting, plugin, agent preset, tool, or Cordis API of the running installation works; when the user asks to design, review, build, install, enable, or debug a DSH plugin, bundle, MCP connection, agent preset, plugin icon or detail page, or a DSH tool definition or skill; and when upgrading a plugin or profile to a newer DSH release. Loading it grants no permission to change files or the profile.\n- `office`: Create, read, edit, and validate Word, PowerPoint, and Excel files; render Office files and PDFs; convert or recalculate. Load first to enable office_render, office_convert, and office_recalculate.\n- `official-plugins`: Check DSH’s optional plugins when the user asks how to do or use something in this app, whether it can, or says a capability is missing or should change: tools, input, thinking or title display, session search, terminals, worktrees, agent teams, desktop control, automation, access, approvals, badges or signatures, plugins or plugin sources. Not a request to develop DSH, even in its own repository: load before reading files or source. Not for ordinary tasks, quoted wishes or declined offers.\n- `personalized-pages`: Plan an optional page or small tool when the user asks for a page, tab, panel, tool or interface in this app (even for one-off use), wants something to keep, revisit or update later, will keep changing data in your answer, or wants a live view of this app’s own data (Sessions, tasks, logs, workspace). Load this before reading any files or source; it says how to submit the proposal. Not for requested files or code, ordinary answers, existing-feature questions, quoted wishes or declined offers.\n\n\nIf the user names a skill, or the task clearly matches a skill's description, call the `skill` tool with the exact skill name before taking task actions. Load all applicable skills, then follow their full instructions. This catalog contains summaries only; do not infer or follow a skill's instructions until it has been loaded.\nA user may also invoke a skill directly; its block then appears in this conversation. Follow it, and do not call the `skill` tool again for that skill.\n\nTime sampled while preparing turn 1, step 1: 2026-10-16T00:00:00+00:00[UTC]\nBrowser time zone for this request: UTC. Interpret otherwise-unqualified dates and times in this zone.\nElapsed since the preceding model-visible message: unavailable.\n" + "Query the packaged Python environment for Office authoring.\nThe following information describes your current session:\n\nCurrent working directory: \"{{cwd}}\".\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).\n\nYou are the root agent. Your name is \"lead\".\n\nTo message other agents, use send_message({ agent: \"\", message: \"...\" }).\nUse list_agents({}) to find your collaborator agents and their names.\n\nA skill is a reusable set of task-specific instructions. The following skills are available in this session:\n\n\n- `diagnose-windows-sandbox-acl`: Use on Windows for unexpected DSH sandbox access denials: workspace writes or listing fail, or an ordinarily readable path cannot be read. One bundled command inspects the path and every ancestor and repairs the ACL problems it proves in that same run. Expected confinement denials need no ACL repair.\n- `dsh-doc`: Use when a task needs facts about DeepSeek Harness (DSH) itself, such as how a feature, setting, plugin, agent preset, tool, or Cordis API of the running installation works; when the user asks to design, review, build, install, enable, or debug a DSH plugin, bundle, MCP connection, agent preset, plugin icon or detail page, or a DSH tool definition or skill; and when upgrading a plugin or profile to a newer DSH release. Loading it grants no permission to change files or the profile.\n- `office`: Create, read, edit, and validate Word, PowerPoint, and Excel files; render Office files and PDFs; convert or recalculate. Load first to enable document_render, document_convert, and document_recalculate.\n- `official-plugins`: Check DSH’s optional plugins when the user asks how to do or use something in this app, whether it can, or says a capability is missing or should change: tools, input, thinking or title display, session search, terminals, worktrees, agent teams, desktop control, automation, access, approvals, badges or signatures, plugins or plugin sources. Not a request to develop DSH, even in its own repository: load before reading files or source. Not for ordinary tasks, quoted wishes or declined offers.\n- `personalized-pages`: Plan an optional page or small tool when the user asks for a page, tab, panel, tool or interface in this app (even for one-off use), wants something to keep, revisit or update later, will keep changing data in your answer, or wants a live view of this app’s own data (Sessions, tasks, logs, workspace). Load this before reading any files or source; it says how to submit the proposal. Not for requested files or code, ordinary answers, existing-feature questions, quoted wishes or declined offers.\n\n\nIf the user names a skill, or the task clearly matches a skill's description, call the `skill` tool with the exact skill name before taking task actions. Load all applicable skills, then follow their full instructions. This catalog contains summaries only; do not infer or follow a skill's instructions until it has been loaded.\nA user may also invoke a skill directly; its block then appears in this conversation. Follow it, and do not call the `skill` tool again for that skill.\n\nTime sampled while preparing turn 1, step 1: 2026-10-16T00:00:00+00:00[UTC]\nBrowser time zone for this request: UTC. Interpret otherwise-unqualified dates and times in this zone.\nElapsed since the preceding model-visible message: unavailable.\n" ], "result": { "python": "{{python}}", diff --git a/tsconfig.base.json b/tsconfig.base.json index a70b13ef4b..5677c2dfe0 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -669,6 +669,7 @@ "@deepseek-ai/dsh-tool-bash": ["./packages/shell/tool-bash/src"], "@deepseek-ai/dsh-tool-bash-persistent": ["./packages/shell/tool-bash-persistent/src"], "@deepseek-ai/dsh-tool-cordis": ["./packages/extensions/tool-cordis/src"], + "@deepseek-ai/dsh-tool-document": ["./packages/document/tool-document/src"], "@deepseek-ai/dsh-tool-executor-native": ["./packages/core/tool-executor-native/src"], "@deepseek-ai/dsh-tool-executor-ptc": ["./packages/core/tool-executor-ptc/src"], "@deepseek-ai/dsh-tool-fs": ["./packages/fs/tool-fs/src"], @@ -676,7 +677,6 @@ "@deepseek-ai/dsh-tool-goal": ["./packages/goal/tool-goal/src"], "@deepseek-ai/dsh-tool-jobs": ["./packages/jobs/tool-jobs/src"], "@deepseek-ai/dsh-tool-lsp": ["./packages/lsp/tool-lsp/src"], - "@deepseek-ai/dsh-tool-office": ["./packages/document/tool-office/src"], "@deepseek-ai/dsh-tool-present": ["./packages/deliverables/tool-present/src"], "@deepseek-ai/dsh-tool-pwsh-persistent": ["./packages/shell/tool-pwsh-persistent/src"], "@deepseek-ai/dsh-tool-ralph": ["./packages/experimental/tool-ralph/src"], diff --git a/tsconfig.host.json b/tsconfig.host.json index 3078221d07..f2fc242b83 100644 --- a/tsconfig.host.json +++ b/tsconfig.host.json @@ -391,7 +391,7 @@ { "path": "./packages/client/ui-sidebar-browser/tsconfig.host.json" }, { "path": "./packages/client/ui-settings-general/tsconfig.host.json" }, { "path": "./packages/document/office-kit" }, - { "path": "./packages/document/tool-office" }, + { "path": "./packages/document/tool-document" }, { "path": "./packages/account/deepseek-account" }, { "path": "./packages/account/deepseek-auth" },