Zum Hauptinhalt springen
O

dsh-file-terminal

onblog/dsh-file-terminal

File manager with inline editing, an integrated terminal and read-only file links for DeepSeek Harness.

Installation

dsh plugin --profile web add github:onblog/dsh-file-terminal

README

dsh-file-terminal icon

dsh-file-terminal · 文件与终端

A file workbench inside DeepSeek Harness — browse, edit, run a shell, and hand out read-only links without opening a chat.

🇨🇳 中文 · 🇺🇸 English

dsh-file-terminal on npm · DSH >=0.2.0-rc.2 <0.3.0 · macOS / Linux / Windows · AGPL-3.0-only

FileTerminal workbench: a file manager above an integrated terminal

dsh-file-terminal adds a Files entry to the DSH sidebar. The panel is one screen: the file manager on top, an interactive shell below, and a draggable splitter between them. It is a normal DSH bundle — install it into a profile, restart, and it is there.

Features

  • Browse the home directory: folder tree, breadcrumbs, back/forward, in-folder search, hidden-file toggle, grid and list views, resizable sidebar, remembered last folder.
  • Edit text files: UTF-8 viewing and editing up to 2 MB, syntax highlighting, save conflict detection based on the read-time mtime, atomic replacement.
  • File operations: new folder, rename, delete with an in-app confirmation dialog, multi-file upload by drag and drop (20 MB per file, no overwrite), image preview (png / jpg / jpeg / gif / webp / bmp / ico / svg / avif).
  • Extract archives: zip, tar, tar.gz / tgz and single-file gz, into a sibling folder. Guards against path traversal, absolute paths and symlink entries; 5000 entries, 50 MB per file and 200 MB total; existing targets are never overwritten and partial output is removed on failure.
  • Built-in terminal: xterm.js front end over the host's PTY service. Multiple tabs, clear, expand/fold, draggable height. No native module is compiled at install time.
  • Switch without reloading: leave the panel for another sidebar page and come back — the folder, scroll position, open dialog and terminal session are exactly as you left them.
  • Read-only file links: dsh-file-terminal share <file> or the Link action returns a login-free URL that reads the live file, supports HEAD and single-range Range, and previews text, images, HTML, PDF, audio and video.
  • Agent hand-off: the CLI path, home directory and public base URL are registered in the host shell environment and system prompt, so the agent can produce a file link when asked.
  • Bilingual UI: the panel and both pages follow the host language (Chinese / English); the CLI help follows LANG.

Requirements

ItemRequirement
HostDSH >=0.2.0-rc.2 <0.3.0 (declared in engines.dsh and dsh.engines.dsh; tested on 0.2.0-rc.2, 0.2.1-rc.5 and 0.2.2-rc.5, later 0.2.x prereleases included)
Node.js>=20
Operating systemsmacOS, Linux, Windows (dsh.bundle.platforms: darwin, linux, win32)
TerminalUses the host subprocess service; the PTY implementation ships with DSH
Install-time build scriptsNone

Platform notes:

  • Shell: DSH_FILE_TERMINAL_SHELL first, then the host's login shell, then the platform default. POSIX-family shells start in login mode (-l); cmd.exe and PowerShell never receive -l.
  • Paths: every request is resolved to a real path and checked against the home directory. POSIX O_NOFOLLOW / O_NONBLOCK degrade gracefully on Windows; Windows reserved device names, illegal characters and NTFS alternate data streams are rejected.
  • Downloads: HEAD and Range work on all three platforms.

Install

dsh plugin --profile web add dsh-file-terminal
dsh --profile web --dump-config   # a dsh-file-terminal row means it is installed
dsh --profile web                 # restart, then open "Files" in the sidebar

From GitHub (pinned)

dsh plugin --profile web add "github:onblog/dsh-file-terminal#<commit>"

The repository ships runnable JavaScript, so a git install needs no prepare build.

From a local checkout

dsh plugin --profile web add ./dsh-file-terminal

Uninstall

dsh plugin --profile web remove dsh-file-terminal

Usage

  1. Open Files in the sidebar. The workbench starts in your home directory and returns to the last folder you visited.
  2. Select a file to reveal Rename / View / Edit / Delete / Link; folders only get Rename and Delete.
  3. Click Upload or drop files from Finder / Explorer onto the file area. Uploads are never overwritten and each file is limited to 20 MB.
  4. The terminal starts with the page in the home directory. Drag the splitter to resize it, or use the terminal's own expand/fold controls.
  5. Link opens the full read-only URL. Hidden paths, private keys and common credential file names are refused.

CLI

dsh-file-terminal share ~/workspace/report.html --json          # {"url":"https://example.com/dsh-file-terminal/raw/workspace/report.html"}
dsh-file-terminal share ~/workspace/report.pdf --base-url https://example.com/
node "$DSH_FILE_TERMINAL_CLI" share ~/workspace/report.md --json # use the plugin's current code from a host shell

The base URL comes from --base-url, then DSH_FILE_TERMINAL_BASE_URL, then the host's advertised URL. Nothing is persisted.

Environment variables

VariableMeaning
DSH_FILE_TERMINAL_CLIAbsolute path of the CLI entry, registered into the host shell environment
DSH_FILE_TERMINAL_HOMEHome directory that may be browsed and shared
DSH_FILE_TERMINAL_BASE_URLPublic base URL used to build share links
DSH_FILE_TERMINAL_SHELLOverride the terminal shell (for example PowerShell or Git Bash on Windows)

Plugin configuration

The bundle row accepts an optional home value when you need a root other than the OS home directory:

- id: dsh-file-terminal
  name: dsh-file-terminal
  config:
    home: /srv/workspace

HTTP API

All routes live on the host's port. /dsh-file-terminal/api/* and the terminal WebSocket require the host session; /dsh-file-terminal/raw/* is intentionally login-free.

Method and pathPurpose
GET /dsh-file-terminalWorkbench page
GET /dsh-file-terminal/terminalTerminal page
GET /dsh-file-terminal/api/homeAbsolute home directory
GET /dsh-file-terminal/api/tree?path=List a directory: { home, path, entries }
GET /dsh-file-terminal/api/read?path=Read a UTF-8 text file: { content, size, mtimeMs }
GET /dsh-file-terminal/api/preview?path=Read-only image preview (login required)
GET /dsh-file-terminal/api/link?path=Create a read-only link: { url }
POST /dsh-file-terminal/api/write{ path, content, expectedMtime }
POST /dsh-file-terminal/api/mkdir{ path, name }
POST /dsh-file-terminal/api/rename{ path, name }
POST /dsh-file-terminal/api/remove{ path }
POST /dsh-file-terminal/api/upload{ path, name, data }, base64
POST /dsh-file-terminal/api/extract{ path }
GET /dsh-file-terminal/raw/<relative path>Read-only link, HEAD and single-range Range
WS /dsh-file-terminal/terminal/wsTerminal I/O, messages `{type:"input"

path is always relative to the home directory; an empty string means the home directory itself.

Security model

  • File API and terminal WebSocket reuse the host's connection.requestRejection login check. Callers cannot choose another root.
  • Every path is resolved with realpath and re-checked against the home directory. Writes use a temporary file plus atomic rename; reads and shares use O_NOFOLLOW where the platform supports it.
  • Share links reject hidden paths, private keys and common credential names. The rule is name-based: review a file before sharing it.
  • HTML and SVG shares run under a sandbox allow-scripts CSP, so scripts cannot reach the host origin.
  • A share link needs no login. Anyone who can reach the instance and has the URL can read that file. Use it on trusted networks or add access control at the reverse proxy. Because of this, dsh-file-terminal is best run on 127.0.0.1 or behind an authenticated proxy.

Project layout

lib/
  index.js     Plugin entry: routes, pages, terminal and share integration
  api.js       HTTP layer for file operations
  files.js     Home-directory file service, path checks, name rules, bounded listing
  share.js     Read-only links: sensitive-path rules, MIME, Range, CSP, open flags
  archive.js   Archive extraction: format detection, path checks, size limits
  shell.js     Cross-platform shell selection
  terminal.js  WebSocket bridge to the host subprocess service, xterm assets
  client.js    Sidebar entry and split panel (iframes, splitter, language sync)
  cli.js       dsh-file-terminal share command
public/        Workbench and terminal pages, page dictionaries
locale/        Plugin metadata (title, description, detail file)
detail/        Plugin detail document (English / Chinese)
test/          Unit tests (no native modules)
scripts/
  verify.mjs   Pre-publish consistency check

The plugin only uses public host extension points: webServer.register / registerUpgrade, connection.requestRejection, slots, shellEnv, systemPrompt and subprocess.

Development

npm install        # pure-JavaScript dependencies
npm test           # node --test: path escapes, symlinks, share rules, routes, platform branches
npm run verify     # manifest / locale / detail / icon consistency
npm run check      # both of the above
dsh plugin --profile dev add .

CI runs the suite on Ubuntu, macOS and Windows with Node 20 and 22, then checks the packed file list.

If you change the package name, update three places together: name in package.json, the id in the __ModuleLoader__.load call in lib/client.js (it must equal the package name), and the name in cordis.patch.yml.

Not included

  • Streaming or chunked uploads (single request, base64, 20 MB per file).
  • Virtual scrolling for very large directories (listing uses bounded concurrency).
  • Multi-select, drag-to-move and cross-directory copy.
  • Persistent terminal sessions across page reloads.
  • Translated server-side error strings (the client falls back to a status-code message outside Chinese).

Third-party components

ComponentLicenseUse
xterm.jsMITTerminal rendering
@xterm/addon-fitMITTerminal sizing
highlight.jsBSD-3-ClauseSyntax highlighting
wsMITWebSocket server
adm-zipMITzip extraction
node-tarISCtar / tar.gz extraction

These packages are installed from npm, are not vendored, and keep their own copyrights and licenses.

License

Copyright (C) 2026 Martin.

dsh-file-terminal is released under the GNU Affero General Public License v3.0 only (AGPL-3.0-only). You may use, modify and redistribute it, but a modified version offered over a network must also offer its source under the same license, and there is no warranty.

For uses that cannot comply with the AGPL — closed-source redistribution, or hosting a modified version without publishing its source — a separate commercial license is available. Contact the maintainer through GitHub to discuss terms.

Ähnliche Plugins