- Главная
- Плагины
- Инструменты и функции
- dsh-docx-limited-editor
dsh-docx-limited-editor
yasaxiwind/dsh-docx-limited-editor
Restricted DOCX editor in the DSH right sidebar: edit paragraph and table-cell text; structural content is never rewritten; saves are version-guarded and atomic.
Установка
dsh plugin --profile web add github:yasaxiwind/dsh-docx-limited-editorREADME
dsh-docx-limited-editor
Restricted DOCX text editing inside the DeepSeek Harness right Sidebar.
Edit paragraph and table-cell text of a .docx without leaving the session;
everything structural stays untouched, and saving is version-guarded and atomic.
English | 中文
What it does
- Opens
.docxin the Sidebar's document preview through a dedicated DOCX restricted editor renderer; the renderer dropdown still offers the stock read-only Office preview for layout review. - Lists body paragraphs and table cells (including their Word style name) as editable blocks.
- Refuses, with a stated reason, every block whose text cannot be replaced safely: tracked changes, fields, images/objects, content controls, hyperlinks, mixed formatting inside one paragraph, line breaks or tabs, empty paragraphs, and vertically merged continuation cells.
- Saves with a content hash version guard: if the file changed on disk, the save reports a conflict instead of overwriting.
- Writes atomically (temporary file in the same directory, then
os.replace) and reports a locked file when Word/WPS keeps it open. - Shows a per-block before/after list of what the last save changed.
- UI text is localized through the Client locale service (Chinese and English dictionaries ship in the bundle); the rest of the UI keeps its own locale.
What it does not do
- No layout editing: styles, numbering, images, table structure, headers, footers, footnotes, comments and revision marks are never rewritten.
.docand.docmare refused.- Only body paragraphs and top-level table cells are covered; text boxes, nested tables, headers/footers, footnotes and comments are out of scope.
Requirements
- DSH
>= 0.2.2-rc.2with the Web GUI. - A Python interpreter with
python-docx. Resolution order:DSH_DOCX_EDITOR_PYTHON→$DSH_HOME/dsh-runtimes/dsh-primary-runtime/dependencies/python/python.exe→pythononPATH. Missing interpreter or missingpython-docxis reported in the panel.
Install
From the published package:
dsh plugin --profile <profile> add dsh-docx-limited-editor
From a packed tarball:
dsh plugin --profile <profile> add ./dsh-docx-limited-editor-0.1.0.tgz
From a local checkout, install the directory through Plugins → Add plugin
or dsh plugin add /absolute/path/to/dsh-docx-limited-editor.
Security boundary
- Host actions are admitted by DSH's own Connection service (Host/Origin fence
plus the browser session cookie); unauthenticated calls get
401. - Paths must stay inside the current session workspace; escapes get
403. - Request bodies are capped at 4 MiB, documents at 128 MiB, one save at 5000 edits.
Development
# a Python with pytest + python-docx
python -m pytest tests
The suite drives lib/docx_blocks.py through its CLI contract: block
classification, every refusal reason, style/run preservation, atomic save,
stale blocks, BOM input, and error codes.
Packaging
pnpm pack
The files list ships only the runtime half (index.js, client.js,
lib/, locale/, docs/, icon.svg, README.md, LICENSE); tests and the
development virtualenv are excluded.
中文
在 DSH 右侧边栏直接修改 .docx 的段落与表格文字:
- 预览下拉里选 DOCX 受限编辑(默认),对照版面可切回官方只读 Office 预览;
- 只改纯文本;含修订、域、图片、内容控件、超链接、段内混合格式、换行/制表符、 空段落、纵向合并单元格的块一律只读并说明原因;
- 保存带内容哈希版本守卫(磁盘被外部改动则报冲突)、原子写回(同目录临时文件 + 替换),文件被 Word/WPS 占用时明确报错;
- 保存后在底部列出本次逐块前后对照;
- 界面文案走 Client locale 服务,内置中文与英文词典。
不做排版编辑;.doc/.docm 拒绝;页眉页脚、脚注、批注、文本框、嵌套表格不在范围内。
依赖带 python-docx 的 Python:默认用 DSH 自带运行时,可用
DSH_DOCX_EDITOR_PYTHON 指定。
测试:python -m pytest tests;打包:pnpm pack。
Похожие плагины
archify (deepseek-harness)
tt-a1i/archify
WeKnora (dsh-weknora)
tencent/weknora
next-ai-draw-io (dsh-plugin)
dayuanjiang/next-ai-draw-io
AiToEarn (dsh-plugin-aitoearn)
yikart/aitoearn