dsh-files-tab
文件与数据 活跃维护

dsh-files-tab

dzwalker/dsh-files-tab

作为对话场景的文件标签页插件,支持直接在聊天界面打开、阅读带目录的Markdown文件,还能通过Monaco编辑器直接编辑工作区文件,全程无需离开对话窗口。

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
TypeScript
主要语言
MIT
开源协议
109 KB
仓库大小
3 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:dzwalker/dsh-files-tab
git clone https://github.com/dzwalker/dsh-files-tab.git
git clone git@github.com:dzwalker/dsh-files-tab.git
README.md main

dsh-files-tab

A DeepSeek Harness (DSH) plugin that adds a Files tab to the conversation view — open, read and edit workspace files without leaving the chat.

中文文档见 README.zh.md。

Features

  • Files tab in the conversation view, with multi-document chips (open / switch / close, dirty marker). State is per session.
  • Open modes, chosen by file type:
    • Read — Markdown rendered with a collapsible table of contents. The TOC supports per-node expand/collapse and a 1 | 2 | 3 | a level bar (expand to a given depth, or all); clicks jump instantly. Inline images for relative paths (resolved against the Markdown file's directory) render from the sandbox.
    • Edit — Monaco with syntax highlighting; the default (and only mode) for code / other text files. Markdown can switch between Read and Edit.
    • Preview — unified viewer for binary / rich files (images, pdf, csv, video). Fully local: bytes are read through the session sandbox into a blob URL, nothing is uploaded. PDF uses the browser's native viewer with the pdf.js worker inlined for offline use.
  • External-change detection: if an open file changes on disk (e.g. edited by the conversation), the toolbar shows a hint with one-click Reload (conflict wording when you have unsaved edits); a badge marks changed background documents.
  • Toolbar: mode switch (segmented control), Save (Ctrl/Cmd+S) with a dirty indicator.
  • Open file dialog: browse the workspace as a lazy-loaded directory tree, or type to search by filename; type a path to open it directly.
  • Sandbox-aware: read / write / list / search / read-bytes resolve against the calling session's workspace cwd and honor its sandbox policy.
  • Theme-adaptive (light / dark, via DSH design tokens) and i18n (English / 简体中文, follows the DSH language setting).

Packages

Package Half Description
@dzwalker/dsh-host-files Host files service: readFile / readBytes / saveFile / listDir / searchFiles Remote.
@dzwalker/dsh-client-ui-files Client The browser Files tab UI.

Requirements

  • DeepSeek Harness ^0.1.0-rc.5 (the plugin builds against the DSH client/host packages of that line).
  • A DSH web profile (the tab registers into conversation.view).

Install

Install both packages into your DSH profile, then add them to the composition.

# from your DSH profile directory
pnpm add @dzwalker/dsh-host-files @dzwalker/dsh-client-ui-files

Add to your profile's cordis.patch.yml (or run dsh web --patch examples/cordis.yml):

- insert:
    - id: files-host
      name: '@dzwalker/dsh-host-files'
    - id: files
      name: '@dzwalker/dsh-client-ui-files'

Restart the web server. A Files tab appears next to Chat / Trajectory.

Usage

  • Open the Files tab → click Open file (or the + Open… chip) to browse or search the workspace.
  • Markdown opens in Read mode; use the toolbar to switch to Edit.
  • Edit, then Save (Ctrl/Cmd+S). The chip shows a dirty dot until saved.

Known limitations

  • Monaco runs without language workers: you get editing + syntax highlighting, but no IntelliSense / diagnostics. This keeps the single-file bundle self-contained.
  • The client bundle is large (~5 MB, Monaco inlined); it is served once and cached.
  • Saving uses the session sandbox policy; writing outside the allowed workspace is denied by DSH.
  • Opening a file by clicking a path in the conversation is not included in this release. It requires an extension point in the DSH conversation view that is not yet upstream. See Roadmap.

Roadmap

  • Click a file path / artifact name in the conversation to open it in the Files tab (pending an upstream openFile extension point in @deepseek-ai/dsh-client-ui-conversation).

Building from source

The published npm packages already ship prebuilt lib/ artifacts (including the
generated Typert Remote contracts and the bundled Monaco client.js). Consumers do
not need to build anything — just pnpm add the two packages (see Install).

Building from source has one caveat. The Host half generates its Typert Remote contracts
(typert.host.js / typert.remote-client.js) with @deepseek-ai/dsh-typert-generator,
which currently only resolves the @deepseek-ai/dsh-typert-protocol markers when it runs
inside the DSH monorepo workspace (where that package is a source project). Out of tree
the generator silently produces no Remote artifacts, so a standalone pnpm run build here
cannot yet emit a complete, self-consistent Host bundle.

Until DSH ships a dedicated out-of-tree plugin SDK, the release artifacts are produced by
adding these two packages to a DSH monorepo checkout as workspace packages and running the
monorepo's build:lib:host / build:lib:client, then publishing the resulting lib/ from
here. This repository is the source and release home; the monorepo is only the build host.

The build scripts here run tsdown per package (build:host / build:client), which is the
correct structure; the only missing piece out of tree is the generated Host Typert contracts.

Standalone type-checking works once the Host Typert contracts exist, because the Client
half imports @dzwalker/dsh-host-files/remote (lib/typert.remote-client.d.ts). So either:

pnpm install
pnpm run build:host   # emits lib/index.js (Typert contracts only emit inside the monorepo)
pnpm run typecheck    # passes once lib/typert.remote-client.d.ts is present

or drop the prebuilt Host lib/ (e.g. copied from a release) in place first, then
pnpm run typecheck.

License

MIT © dzwalker