@zhangzhian/dsh-devtools-files

中文文档
0.3.1发布于 2026/11/03MITTypeScriptES Module

dsh-devtools 的文件组件:文件树 + 对话区文件页签(预览/固定)+ 编辑器与预览

原始使用文档
文档目录7 节
  1. 安装
  2. 提供什么
  3. 要求
  4. English
  5. Install
  6. What it provides
  7. Requirements

English | 简体中文

@zhangzhian/dsh-devtools-files

dsh-devtools 的文件组件:右侧边栏的文件树,加上对话内容区里遵循 VSCode 预览编辑器语义的文件页签。

安装

dsh plugin add @zhangzhian/dsh-devtools

@zhangzhian/dsh-devtools 是清单包,装它会带齐所有组件(包括这个)。只想用文件 组件的话:

dsh plugin add @zhangzhian/dsh-devtools-files

提供什么

  • 文件树 —— 工作区目录树,带 Git 状态点、搜索、新建文件/目录、重命名、 删除、上传、下载。
  • 预览标签 —— 单击用预览标签打开(标题斜体),再点别的文件就替换它; 双击固定为新页签;在预览标签里一编辑就自动固定。空白会话(内容区还没有页签条) 时改走平台官方的资源导航,在右栏新开一个页签 —— 不盖住文件树。
  • 编辑器 —— CodeMirror 6,约 40 种语言的语法高亮、软换行、Mod-S 保存, 并且带版本守卫:并发改动会弹冲突对话框,而不是静默覆盖。
  • 预览 —— Markdown 走平台自己的渲染器(所以和 AI 回复的排版完全一致; 右上角那颗「大纲」按钮可以展开浮动目录,展开时正文让位、不会被压住)、 HTML 走沙箱 iframe,另有图片、音频、视频、PDF,以及超大文件的分页查看。
  • 表格与 Office —— .xlsx / .xlsm 用官方同款栈在浏览器里解析和渲染 (ExcelJS 解析 + FortuneSheet 画格子:选区、复制、公式栏、工作表标签、冻结都 是组件自带的行为),不经过 Office 转换;.docx / .pptx / .ppt / .doc / .xls 由平台本机的 LibreOffice 转成 PDF 后在内容区预览。表格的两个库放在懒加载分块里, 第一次打开表格才下载。两种都开在中间的内容区,不是右栏。

要求

  • DSH 0.2.0-rc.2 或更新。
  • 没有别的依赖。Git 状态点只在同时装了 @zhangzhian/dsh-devtools-git 时出现。
  • 表格预览依赖 @fortune-sheet/[email protected] + [email protected](和官方预览同版本)。 FortuneSheet 带一个只读补丁(patches/@[email protected],修 allowEdit:false 时公式栏的无限 setContext),pnpm install 会自动应用; 升级这个依赖时 pnpm 会提示补丁需要 rebase。

English

@zhangzhian/dsh-devtools-files

The file component of dsh-devtools: a file tree in the right sidebar, plus file tabs in the conversation area that follow VSCode's preview editor semantics.

Install

dsh plugin add @zhangzhian/dsh-devtools

@zhangzhian/dsh-devtools is the manifest package; installing it pulls in every component, including this one. To use only the files component:

dsh plugin add @zhangzhian/dsh-devtools-files

What it provides

  • File tree — the workspace tree with Git status dots, search, new file/folder, rename, delete, upload, and download.
  • Preview tabs — a single click opens a file in a preview tab (italic title); clicking another file replaces it. A double click pins it as a permanent tab, and editing a preview tab pins it automatically. In a blank session (no tab strip in the conversation area yet) a click goes through the platform's own resource navigation instead and opens a right-sidebar tab, so the file tree is never covered.
  • Editor — CodeMirror 6 with syntax highlighting for ~40 languages, soft wrap, Mod-S to save, and a version guard so concurrent edits raise a conflict dialog instead of silently overwriting.
  • Previews — Markdown rendered with the platform's own renderer (so it matches assistant replies exactly; the "大纲" button in the corner opens a floating outline, and the text reflows rather than being covered), HTML in a sandboxed iframe, images, audio, video, PDF, and paged viewing for files too large to edit.
  • Spreadsheets and Office — .xlsx / .xlsm use the same stack as the official preview in the browser (ExcelJS parses, FortuneSheet paints the grid: selection, copy, formula bar, worksheet tabs and frozen panes come from the component itself) with no Office conversion involved; .docx / .pptx / .ppt / .doc / .xls are converted to PDF by the host's local LibreOffice and shown in the content area. The two spreadsheet libraries live in a lazy chunk, downloaded the first time a sheet is opened. Both open in the middle, not in the right sidebar.

Requirements

  • DSH 0.2.0-rc.2 or newer.
  • Nothing else. Git status dots appear only when @zhangzhian/dsh-devtools-git is also installed.
  • Spreadsheet preview depends on @fortune-sheet/[email protected] + [email protected] (the same versions as the official preview). FortuneSheet carries a read-only patch (patches/@[email protected], fixing an endless setContext from the formula bar with allowEdit:false); pnpm install applies it automatically, and pnpm asks for a rebase when the dependency is upgraded.

版本与发布记录

@zhangzhian/dsh-devtools-files 共发布 6 个版本,首次发布于 2026/10/20;过去 12 个月发布了 6 个版本。

版本发布日期距今
0.3.1latest2026/11/03今天
0.3.02026/11/011 天前
0.2.22026/10/2113 天前
0.2.12026/10/2014 天前
0.2.02026/10/2014 天前
0.0.0-stage2026/10/2014 天前

关于 @zhangzhian/dsh-devtools-files 的常见问题

@zhangzhian/dsh-devtools-files 是什么?

dsh-devtools 的文件组件:文件树 + 对话区文件页签(预览/固定)+ 编辑器与预览

如何安装 @zhangzhian/dsh-devtools-files?

在项目目录运行 npm install @zhangzhian/dsh-devtools-files,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@deepseek-ai/cordis(~4.0.4)、@deepseek-ai/dsh-fs(^0.2.0-rc.2)、@deepseek-ai/dsh-sandbox(^0.2.0-rc.2)、@deepseek-ai/dsh-session(^0.2.0-rc.2)、@deepseek-ai/schemastery(~3.18.4)、@deepseek-ai/dsh-api-gateway(^0.2.0-rc.2)、@deepseek-ai/dsh-host-webserver(^0.2.0-rc.2)、@deepseek-ai/dsh-sandbox-policy(^0.2.0-rc.2)、@deepseek-ai/dsh-client-ui-slots(^0.2.0-rc.2)、@deepseek-ai/dsh-typert-protocol(^0.2.0-rc.2)、@deepseek-ai/dsh-api-workspace-files(^0.2.0-rc.2)、@deepseek-ai/dsh-client-ui-primitives(^0.2.0-rc.2)、@deepseek-ai/dsh-client-ui-conversation(^0.2.0-rc.2)、@deepseek-ai/dsh-client-ui-sidebar-files(^0.2.0-rc.2)、@deepseek-ai/dsh-client-ui-sidebar-right(^0.2.0-rc.2)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@zhangzhian/dsh-devtools-files 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@zhangzhian/dsh-devtools-files 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@zhangzhian/dsh-devtools-files 可以商用吗?

@zhangzhian/dsh-devtools-files 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@zhangzhian/dsh-devtools-files 还在维护吗?

最新版本 0.3.1 发布于 2026/11/03(今天);至今共发布 6 个版本,其中过去 12 个月发布了 6 个;首次发布于 2026/10/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。