快速了解
它能做什么
在 DSH Web 聊天旁预览、编辑和浏览会话工作区中的 Markdown 与文本文件。
本站提供的是中文说明,不代表该项目或 Plugin 自身提供中文界面;语言支持请以上游文档为准。
Web Profile
DSH 0.1.2-rc.1; Node ^22.19.0 || >=24.0.0
证据已验证
核对日期 2026/9/6 UTC 13:52
有代码证据的贡献
它为 DSH 增加什么
在 DSH 聊天旁新增停靠面板,用于预览、编辑和浏览会话工作区文档。
机制证据 ↗选择前先看
为 DSH Web GUI 添加右侧停靠的文档面板。可打开对话回合生成的 Markdown,渲染 GFM、代码、TeX 和 Mermaid,浏览会话工作区目录树,并在冲突提示保护下编辑允许的既有 Markdown 文件。
适合谁
希望在聊天中直接检查或修改对话产物的 DSH Web 配置用户。
常见任务
- 从对话回合的产出文件区域打开 Markdown 文档。
- 浏览并预览当前会话工作区中的 Markdown 或文本文件。
- 编辑允许的既有 Markdown 文件,并通过冲突检测保存。
- 使用大纲或查找面板浏览长文档。
权限与数据
处理当前会话工作区中的文档。
权限- 读取工作区文件以进行预览和浏览。
- 仅向配置的扩展名白名单内、且已存在的文件写入编辑内容。
- 默认单文件读取和写入上限为 1,048,576 字节。
- 工作区浏览器会显示会话工作区的路径和文件内容。
- 提供的证据未声明需要凭据。
局限
- 默认补丁仅允许编辑 .md 和 .markdown;预览配置还可包含 .txt。
- 超过 maxBytes、位于会话工作区之外、不存在或扩展名不受支持的文件会返回已记录错误。
- 无法预览上传的文档附件。
- 大纲只列出 ATX 标题。
- 正文中内联提及的 Markdown 文件仍使用宿主的桌面打开行为。
DSHub 已核对
- 已采集包清单、Cordis Bundle 补丁、不可变源码提交、registry 身份、许可证标识和 Node 引擎范围。
- 补丁已注册 md-preview,并设置 1 MiB 上限及 .md/.markdown 允许扩展名。
DSHub 未核对
- 本记录未实际执行安装、构建许可流程、运行时界面、工作区访问或兼容性测试。
- 未审计 registry 包的内容。
固定版本安装
安装 DSH Markdown Preview
这个Plugin Bundle没有 DSH Plugin 安装操作,请根据源码文档使用真实交付方式。
维护者原文
项目 README
@benz-ai-x/dsh-md-preview
DSH (DeepSeek Harness) Web GUI plugin — markdown preview, editing & workspace file browser beside the chat. Preview rendered markdown and plain-text files, edit with conflict-guarded saves, and browse the session workspace tree without leaving the conversation.
Features
- Markdown chips in the produced-files row of a turn open a right-docked preview panel rendering GFM, syntax-highlighted code, and TeX.
- A per-message "Preview documents" action lists that turn's markdown documents.
- Non-markdown deliverables keep the shipped open-on-desktop behavior.
- The panel is closable and draggable (320–1280 px, default 500); the dragged width persists for the app session.
- The panel renders nothing while no preview target is set.
- Editing — the panel's Edit action enters a CodeMirror editor (line numbers, GFM highlighting, Cmd/Ctrl-S save); Save writes back to the workspace, flashes a "Saved" toast, and returns to the rendered view; Cancel discards the draft. Only existing files edit. Non-conflict save failures show the failure code with a Retry action.
- Conflict guard — saving over a file that changed elsewhere (another session, the agent, an external editor) prompts "the file changed elsewhere": Reload or Overwrite; closing with unsaved edits asks first.
- Workspace browser — the panel header's Workspace action enters a directory tree of the session workspace (lazy expansion, loading/empty/failed states); single-click renders
.mdrich,.txtand other text monospace, other types a clear unsupported notice; the current document highlights and auto-reveals in the tree; full keyboard traversal (arrows/Enter); the header shows the path breadcrumb. Expanded directories silently revalidate on every re-entry (and from the tree's refresh button) — the agent keeps producing files mid-conversation, and a failed refresh never blanks what's on screen. - Outline — the header's outline popover lists the document's ATX headings (fenced code never counts); clicking scrolls the rendered heading in the view face and jumps the cursor to the source line in the edit face.
- Reading position — the outline popover highlights the entry owning your position (scroll in the view face, cursor line in the edit face) and keeps it in view; the header shows a dirty dot for unsaved drafts, folds the version into the crumbs tooltip, and annotates the find/save shortcuts; the find panel is localized and shows a match count (n/m).
- Editor find — the edit face carries a CodeMirror search panel (header button and Mod/Ctrl-F).
- Mermaid diagrams — fenced
```mermaidblocks render as diagrams after the document settles; the block banner stays (copy still reads the source), and any failure falls back to the plain code block. Mermaid is inlined into the client bundle but evaluated lazily (first diagram pays the parse cost; bundle ~3.9 MB minified / ~1.1 MB gzip).
Install
Requires DSH baseline 0.1.2-rc.1 (see peerDependencies) and a web profile.
dsh plugin --profile <name> add @benz-ai-x/dsh-md-preview
dsh --profile <name> --dump-config # expect the id: md-preview row
dsh --profile <name> # open the Web GUI; click a chip after a turn produces .md
dsh plugin --profile <name> remove @benz-ai-x/dsh-md-preview
Three install forms (per the DSH publish spec)
| Form | Command | Status |
|---|---|---|
| npm (recommended) | dsh plugin --profile <name> add @benz-ai-x/dsh-md-preview |
✅ prebuilt, works out of the box |
| tarball | dsh plugin --profile <name> add ./benz-ai-x-dsh-md-preview-<ver>.tgz (from pnpm pack:publishable) |
✅ prebuilt, no build approval needed |
| Git | dsh plugin --profile <name> add github:benz-ai-x/dsh-md-preview#<sha> |
✅ builds from source via the package's self-contained prepare (transpile-only; no type declarations ship on this form) — see below |
Git installs fetch source, and pnpm refuses to run a git dependency's prepare until the package is explicitly allowed. After the first add fails, copy the package key pnpm printed into the profile's pnpm-workspace.yaml:
allowBuilds:
'@benz-ai-x/dsh-md-preview': true
then re-run add. Allowing a build executes the package's code on your machine at install time — allow only sources you trust, and pin a commit (#<sha>) so a later push cannot silently change what runs.
Configuration
- id: md-preview
name: '@benz-ai-x/dsh-md-preview'
config:
maxBytes: 1048576 # per-file read/write cap in bytes
allowedExtensions: ['.md', '.markdown']
| Field | Type | Default | Notes |
|---|---|---|---|
maxBytes |
number | 1048576 |
per-file read/write cap; exceeded returns too-large |
allowedExtensions |
string[] | [".md", ".markdown"] |
extensions eligible for editing |
previewExtensions |
string[] | [".md", ".markdown", ".txt"] |
extensions eligible for preview (a superset of the editable set; plain-text members render read-only) |
Failure codes
The panel shows md-preview/<reason> on failure. All codes:
| Code | Meaning |
|---|---|
md-preview/bad-request |
path empty or unusable; or a save with neither fingerprint nor force |
md-preview/unknown-session |
session does not exist |
md-preview/no-workspace |
session has no working directory |
md-preview/unsupported-extension |
extension outside the allowlist |
md-preview/forbidden |
path escapes the session workspace |
md-preview/not-found |
file does not exist (editing targets existing files only) |
md-preview/too-large |
file (read) or content (write) exceeds maxBytes |
md-preview/conflict |
file changed since the read backing the save (no force) |
md-preview/unavailable |
IO error during read/write |
Known limits
- Inline prose mentions of
.mdfiles still open on the desktop (owned by ui-deliverables, not this plugin). - The panel floats above the details column; it does not replace the three-column grid.
- Uploaded document attachments are not previewable (no transcript surface today).
- The outline lists ATX headings only (setext forms render but stay out of the popover).
- Mermaid renders with its default theme; documents mixing indented code blocks with fenced ones skip the diagram pass entirely (order-parity safety check).
Development (source-linked)
pnpm install
pnpm verify # context:check:strict + typecheck + test + build + built:check
pnpm context:link # source-linked development: rewrite link: at the harness checkout (registry by default)
pnpm watch:client # client bundle watch build
Structure
| Part | Location | Notes |
|---|---|---|
| Host Remote | src/remote.ts |
mdPreview/read(sessionId, path, signal); workspace scoping, extension allowlists, byte caps |
| Remote contribution | src/typert/remote-client.ts |
hand-maintained browser-side descriptors (generator-equivalent) |
| Browser entry | src/client/index.ts |
mounts the Remote + registers three Slot contributions |
| Preview panel | src/client/PreviewOverlay.tsx |
shell.overlay (list, additive); rendering + geometry only |
| Session machine | src/client/preview-session.ts |
pure reducer for read/edit/save/prompts |
| Editor | src/client/editor.tsx |
CodeMirror 6 (curated extensions incl. the search panel, inlined at build) |
| Workspace tree | src/client/WorkspaceBrowser.tsx |
lazy tree with highlight/auto-reveal/keyboard and silent revalidation |
| Outline | src/client/outline.ts |
ATX heading scan + rendered-heading resolution |
| Diagram pass | src/client/diagrams.ts |
post-render mermaid enhancement, fail-soft to the code block |
| Chip row | src/client/MdChips.tsx |
conversation.chat.turnTail (chain; claims markdown-bearing turns) |
| Message action | src/client/PreviewAction.tsx |
conversation.chat.assistant-actions (list, additive) |
Real-profile verification (local checkout)
pnpm build
dsh plugin --profile <name> add ./dsh-md-preview
dsh --profile <name> --dump-config
dsh --profile <name> # open the Web GUI, produce a README.md and click the chip
dsh plugin --profile <name> remove @benz-ai-x/dsh-md-preview
Pack & publish
pnpm pack:publishable # registry-clean tarball + self-check (no devDeps, no link:/workspace:)
pnpm publish:registry # publish via the same cleaned-manifest flow
Source-linked verification proves compatibility with the pinned harness checkout (see dsh-reference.lock.json); the publish form is proven by the packed-tarball profile smoke.
License
MIT
有意识地管理
安装与管理
前置条件与目标 Profile
目标: Web Profile
交付方式: Git Bundle — benz-ai-x/dsh-md-preview#f6144b824e1f82c0b9ec2a7eddd0ec23a41a4f87。
验证、更新与移除
显示生命周期命令
dsh plugin --profile web list兼容性与访问范围
DSH web profile; DSH peer dependency 0.1.2-rc.1: DSH 0.1.2-rc.1; Node ^22.19.0 || >=24.0.0。
风险事实
证据与编辑审查Manifest、Bundle patch、分发与新鲜度
不可变证据
审查状态与源码活动
如需可审查的不可变安装路径,优先使用已固定提交的 Git 源码;授予构建许可前请评估 prepare 脚本。
AI 审查于 2026/9/10 UTC 11:36。GitHub 事实核对日期: 2026/9/10 UTC 11:36。
自当前证据基线以来,没有记录到重要源码变化。