Skip to content
kkl58Public

About

Unofficial ACP-based terminal front-end for DeepSeek Harness - built only from official components

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

dshr — an ACP-based terminal front-end for DeepSeek Harness

Unofficial. Not affiliated with, endorsed by, or supported by DeepSeek. It is built only from official components — dsh --profile acp (the official ACP v1 server) plus the official @agentclientprotocol/sdk. No dsh source code is modified.

Why this exists

DeepSeek Harness ships no interactive terminal UI. You get:

Surface What it is
dsh web / the desktop app The shipped human interface (browser / Electron)
dsh --profile headless "task" One unattended task, then exits — not an interactive TUI
dsh --profile acp / sdk JSON-RPC stdio protocols, meant for machine clients

The official TUI package was removed on 2026-08-04 (remove-tui-package.md), and that decision lists what re-entry would require: a named product or deployment, an explicit package boundary, a concrete interaction provider, and assembled lifecycle and transcript acceptance. Crucially it also records that the provider-neutral command, user-questions, approval, tool-presentation, PTY and session-projection capabilities remain available to other hosts.

This project exercises exactly those seams through ACP. It exists as a working data point that the seam set is sufficient in practice — and as a usable terminal front-end today.

What it gives you

  • One long-lived process. No per-turn restart (compare --profile headless at ~2.3 s/turn).
  • Streamed rendering of agent_thought_chunk, agent_message_chunk, tool_call and tool_call_update.
  • Interactive approval. Escalation and sensitive-tool requests arrive as ACP session/request_permission and are answered from your terminal. --profile headless has no approver at all, so such requests fail closed with "no approval channel is available".
  • Multi-turn continuity inside one persisted session.

Requirements

  • DeepSeek Harness dsh on PATH (developed and tested against 0.1.7-rc.2). The acp profile must exist.
  • Node.js 20+ (uses the global fetch and node:stream web interop).

Install

git clone <this repo> dshr && cd dshr
npm install          # only dependency: @agentclientprotocol/sdk

Then either run it directly:

node dsh-repl.mjs

…or wire up a launcher. On Windows, a .bat that forwards to the script is enough:

@echo off
node "<path-to-repo>\dsh-repl.mjs" %*

Usage

dshr                      # start a session in the current directory
dshr --cwd D:\proj        # explicit workspace
dshr --mode read-only     # sandbox mode: read-only | workspace-write | danger-full-access
dshr --full-access        # shorthand for --mode danger-full-access
dshr --dsh <path>         # point at a specific dsh executable
dshr --debug              # raw ACP events + upstream stderr

In-session: /exit, /help, /cwd.

Permission modes

dsh's sandbox mode is read from the DSH_PERMISSION_MODE environment variable, and this tool sets it for the child process. The three official modes are:

Mode Meaning Aliases
read-only no writes at all 只读, ro
workspace-write (default) writes only inside the workspace; anything beyond asks you first 手工, manual
danger-full-access no filesystem restriction, no prompts 自动, auto

Switch at runtime with /mode <name>; bare /mode lists them. Note that danger-full-access is not an "auto" in the Claude Code sense — dsh's classifier is not exposed over ACP, so here "auto" simply means everything is allowed.

Why switching restarts the process. ACP v1 does have session/set_mode, and this client implements the handler path. But dsh publishes no session modes over ACP (newSession returns modes: undefined), so there is nothing to set. Modes are therefore changed by respawning the agent with a different DSH_PERMISSION_MODE and continuing the same session via session/resume — the conversation carries on (the old transcript is not redrawn). The agent itself cannot self-escalate, which is the intended design.

⚠️ --full-access removes the filesystem sandbox

dshr --full-access sets DSH_PERMISSION_MODE=danger-full-access, which means the agent's commands are not restricted at all — it can write or delete anything your user account can. It exists because on some Windows setups the sandbox cannot initialise at all (see below), in which case every command would otherwise require manual approval.

Note the effective end state is the same as approving an escalation with allow_once; the difference is that you lose the per-command checkpoint. Use it deliberately, not by default.

Windows note: the ACL sandbox and non-system volumes

On Windows the ACL sandbox requires the workspace directory to grant your account WRITE_OWNER (the Low integrity label lives in the SACL). This is not the case on many data volumes, where the default ACL is:

D:\  BUILTIN\Administrators:(F)
     NT AUTHORITY\SYSTEM:(F)
     Authenticated Users:(M)      <- Modify only; no WRITE_OWNER
     BUILTIN\Users:(RX)
     (no explicit ACE for the user)

Every shell call then fails with:

Error: SetNamedSecurityInfoW failed (Win32 5): grantWrite(<workspace>)

Win32 5 is ERROR_ACCESS_DENIED, and the backend is fail-closed, so commands do not run rather than degrading. The identical command succeeds when the workspace is under C:\Users\<you>\… (which carries an explicit (F) ACE).

This is a property of the machine, not of any front-end — it affects web, desktop and terminal alike. Your options, in the order I'd rank them:

  1. Keep the workspace on a volume where the sandbox works (e.g. under your user profile).
  2. dshr --full-access — no ACL changes, no approvals, but no write sandbox either.
  3. Grant the workspace WRITE_OWNER — icacls "<dir>" /grant "%USERDOMAIN%\%USERNAME%:(OI)(CI)F" — and be aware this is not free: once the sandbox runs there it applies a standing Low integrity label to that tree, which outlives dsh and relaxes it against other Low-integrity processes. See the official dsh-sandbox-windows-acl documentation before doing this to anything you care about.
  4. Approve each command — leave the mode at the default and answer the prompt. This is effectively "always ask" mode.

A second Windows precondition: the temp root must be outside the workspace

Independently of the ACL issue, the sandbox refuses to start when the environment temp root lies inside the workspace:

Error: Windows ACL temp root must be outside the workspace: workspace=…; temp=…

This bites when you run from your home directory: %TEMP% is C:\Users\<you>\AppData\Local\Temp, which is inside C:\Users\<you>. Every shell command fails, reads included — so the agent cannot even look at other drives.

dshr handles this: it picks a writable temp directory outside the workspace and passes it to the agent as TEMP/TMP. When the workspace is the home directory, the only writable location outside it on C: is C:\Users\Public\dshr-tmp, which is what it falls back to. If you would rather not use a public directory, run from a project subdirectory instead and the default ~/.dshr-tmp is used.

Reads themselves are not restricted by the sandbox — with a working sandbox the agent can read anywhere you can; only writes are confined to the workspace.

How it compares to other community front-ends

Several community TUIs exist for dsh (for example dsh-tianshu-tui, turtle-ui, and the @deepseek-harness-* npm packages). They generally have more features than this one — command palettes, model switchers, mode cycling.

This project deliberately aims at something narrower: no third-party library sits between you and the approval prompt. A terminal front-end for a coding agent receives every escalation request and answers it, so it holds a privileged position. Here, everything on that path is either a shipped dsh component or the official ACP SDK; the only third-party runtime dependency is the SDK itself (zod comes with it). That is the whole point of the project.

Known limitations

  • Mode switching restarts the agent. It works and the session is resumed, but there is a short pause and the previous transcript is not redrawn (see "Why switching restarts the process" above).
  • No Markdown rendering. Streamed text is written as-is (ANSI colours for structure only).
  • No session picker. Each run starts a fresh session; dsh's own session store still holds the history.
  • Windows launcher caveat: in Git Bash the .bat shim must be invoked as dshr.bat — MSYS does not append .bat when resolving commands.
  • Tested on Windows 11 with dsh 0.1.7-rc.2. The ACP surface is stable v1, but dsh is a developer preview and may change.

License

MIT — see LICENSE.


中文说明

非官方项目,与 DeepSeek 无隶属关系、未获其背书。它只使用官方组件构建: dsh --profile acp(官方 ACP v1 服务器)+ 官方 @agentclientprotocol/sdk, 未修改 dsh 任何一行代码。

为什么要做这个

DeepSeek Harness 没有交互式终端界面:官方的人类界面是 Web 与桌面端;headless 是 一次性任务入口(不是交互式 TUI);acp / sdk 是给机器客户端的协议。官方 TUI 包已于 2026-08-04 移除,而那份移除决定同时写明:command、user-questions、approval、 tool-presentation、PTY、session-projection 这些能力「仍可供其他宿主使用」。

本项目正是通过 ACP 使用这些缝(seams)—— 既是一份「这套缝在实践中够用」的可运行证据, 也是现在就能用的终端前端。

它给你什么

  • 常驻单进程(对比 headless 每轮约 2.3 秒的重启)
  • 逐条流式渲染:思考 / 正文 / 工具调用 / 工具调用状态
  • 交互式权限批准 —— 升权请求以 ACP session/request_permission 抵达,从终端作答。 (headless 没有应答者,这类请求会以 "no approval channel is available" 直接失败)
  • 多轮上下文连续性(同一持久会话)

用法

node dsh-repl.mjs                 # 在当前目录开会话
node dsh-repl.mjs --cwd D:\proj   # 指定工作区
node dsh-repl.mjs --mode read-only
node dsh-repl.mjs --full-access   # = danger-full-access
node dsh-repl.mjs --debug         # 看原始 ACP 事件

会话内命令:/help、/mode(查看/切换权限模式)、/cwd、/exit。

权限模式(/mode <名称>,支持中文别名):

模式 含义 别名
read-only 完全不能写 只读、ro
workspace-write(默认) 只能写工作区内,越权时弹批准框问你 手工、manual
danger-full-access 无文件系统限制、不弹批准 自动、auto

⚠️ 这里的「自动」不是 Claude Code 那种智能判断 —— dsh 的分类器不经 ACP 暴露,所以「自动」= 全部放行。

为什么切换要重启进程:ACP v1 本身有 session/set_mode,但 dsh 没有公布任何会话模式(newSession 返回 modes: undefined),所以没有东西可设。本工具改用「换 DSH_PERMISSION_MODE 重启 agent + session/resume 续接同一会话」来实现切换 —— 对话能接着聊,只是旧记录不会重绘。agent 自身无法自我提权,这是官方设计。

要求 dsh 在 PATH 上、Node.js 20+。

⚠️ --full-access 会关闭文件系统沙箱

它设 DSH_PERMISSION_MODE=danger-full-access,agent 的命令不再受任何文件系统限制。 它与「用 allow_once 逐条批准升权」的最终权限相同,区别只是少掉了每条命令的确认卡点。 请有意使用,别当默认值。

⚠️ Windows:ACL 沙箱与非系统盘

Windows 上 ACL 沙箱要求工作区目录对当前账号授予 WRITE_OWNER(Low 完整性标签位于 SACL), 而很多数据盘的默认 ACL 不具备这一点(Authenticated Users:(M) 只有 Modify)。此时每条 shell 命令都报 SetNamedSecurityInfoW failed (Win32 5),且沙箱 fail-closed → 命令完全无法执行。 同一命令在 C:\Users\<你>\… 下则正常。

这是机器的属性,不是任何前端的问题(Web、桌面端、终端一视同仁)。四种应对: 把工作区放在沙箱可用的卷上 / 用 --full-access / 给目录加 WRITE_OWNER(注意会留下常驻 Low 标签,先读官方 dsh-sandbox-windows-acl 文档)/ 保持默认模式逐条批准。

另一个独立的 Windows 前提:临时目录必须在工作区之外。 在家目录里运行就会踩到 (%TEMP% 在 C:\Users\<你> 里面),报 Windows ACL temp root must be outside the workspace, 所有 shell 命令全废,连读别的盘都做不到。本工具会自动挑一个「在工作区之外且真的可写」的 临时目录注入给 agent —— 工作区是家目录时,C 盘上唯一可写的外面就是 C:\Users\Public\dshr-tmp (不想用公共目录就从项目子目录运行,那样会用私有的 ~/.dshr-tmp)。

另注:读取本来就不受沙箱限制(只有写受限于工作区)—— 沙箱一旦能起来,agent 就能读你能读的任何地方。

与其他社区前端的区别

社区有不少功能更花哨的 TUI(命令面板、模型切换、模式循环等)。本项目刻意只做一件窄事: 你和批准提示之间不夹任何第三方库。终端前端会收到并回答每一次升权请求,位置敏感 —— 这条链路上的一切,要么是 dsh 自带组件,要么是官方 ACP SDK。

已知限制

  • 切换模式会重启 agent(会续接会话,但有短暂停顿,且旧记录不重绘)
  • 不渲染 Markdown / 没有会话选择器
  • Git Bash 里启动器要写全名 dshr.bat(MSYS 不自动补 .bat)
  • 在 Windows 11 + dsh 0.1.7-rc.2 上测试。dsh 是开发者预览版,协议可能变化

许可证

MIT

About

Unofficial ACP-based terminal front-end for DeepSeek Harness - built only from official components

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages