前言¶
DSH 可以通過插件擴展不同 profile。已有 dsh --profile headless 適合管道和無人值守流程;但當需要在終端裏直接操作會話、查看狀態、審批工具調用、切換權限、管理計劃與目標時,會需要一個更近的交互層。tomowang/dsh-tui 提供這個終端入口。
定位¶
- npm 包:
@tomowang/dsh-tui - 維護者:
tomowang - 許可證:
MIT - 目標:作爲 DeepSeek Harness(
dsh)的開源終端前端 - 包中
dsh.bundle.patch指向./cordis.patch.yml
核心能力¶
會話狀態¶
狀態欄顯示 session id、active LLM provider/model、current agent preset、live run state with spinner、queued-message count、logged event count。
統計行顯示 turn/step counts、LLM/tool wall time、TTFT and decode tok/s、cache-hit %、billed tokens、context-usage summary。
模型與預設¶
/model 可以切換 active model,並 add、edit、delete custom LLM providers。
--agent-preset 用於在新會話中指定 agent preset;/presets 用於瀏覽和切換 presets。
會話檢視¶
/trajectory、/context、/plugins 用於查看會話軌跡、上下文與插件信息。
工具調用與推理¶
運行中的工具調用顯示爲 live spinner;結束後收攏爲一行結果。
/tools 或 Ctrl+O 打開 Tool Cards overlay,可瀏覽 tool calls/results;Enter/Space 可將卡片收回標題。
Reasoning 在流式輸出時顯示動畫 thinking line,結束後收爲 one-line summary;完整文本可通過 /trajectory 查看。
Assistant text 若帶有明確 Markdown signal,會在終端中做 Markdown 渲染。
權限與審批¶
Shift+Tab 循環權限預設:read-only、workspace-write、danger-full-access、custom。
終端內可處理 approvals 和 questions:allow once/reject;ask_user_question 與 plan review 支持 multi-select 和 Other;支持時發送 OSC 9 desktop notification。
計劃與目標¶
/plan [message] 進入 plan mode,/plan off 離開;model-proposed plan 會進入 Approve/Keep-planning 審查。
/goal <objective> 設置目標;/goal clear|edit <objective>|pause|resume 管理目標;active and armed 時可自動進行 continuation rounds。
輸入與壓縮¶
/compact 用於 summarize and compact session history。
Prompt history 會跨進程和 /clear 保存,用 ↑/↓ 召回。
輸入支持 Readline 風格:word/line motion、kill/yank-style deletes、multi-line drafts;double Ctrl+C/Ctrl+D 退出。
本地命令與文件引用¶
空 prompt 下以 ! 開頭會把 Enter 切換爲 local shell command,prompt border 變黃,輸出進入 transcript。
輸入 @ 打開 repo files 的 fuzzy-filtered 下拉;Tab/Enter 插入選中路徑。
終端體驗¶
啓動時會 best-effort 檢查 npm registry,如果發佈更新版本,會顯示 upgrade command。
終端窗口/標題在 session title 存在時顯示 <session title> — dsh-tui,否則顯示 dsh-tui。
全屏幕 transcript 使用 alternate screen buffer,支持 mouse wheel/trackpad、PageUp/PageDown、auto-follow;退出時會 flatten last screenful 到 scrollback。
當 backing service 未掛載時,overlays 會退化爲 plain notices,而不是讓 TUI 直接失敗。
安裝與啓用¶
先確認環境滿足要求:Node ^22.19 || >=24,並設置 DEEPSEEK_API_KEY。
1、安裝 DSH launcher:
npm install -g @deepseek-ai/dsh
2、在 tui profile 中安裝 dsh-tui:
dsh plugin --profile tui add @tomowang/dsh-tui
3、啓動終端 profile:
dsh --profile tui
如果已有會話或想按 preset 開新會話,也可以用:
dsh --profile tui --resume <sessionId>
dsh --profile tui --agent-preset <presetId>
dsh --profile tui --dump-config
注意:stdin 和 stdout 都必須是真實 TTY。插件在管道中會直接報錯,而不是降級;管道場景繼續使用 dsh --profile headless。
典型用法¶
Ctrl+C取消當前運行中的 turn。Shift+Tab循環read-only/workspace-write/danger-full-access/custom。/tools或Ctrl+O打開 Tool Cards overlay;Enter/Space將卡片收回標題。esc跳過 terminal 內的 approval/question 選項列表。- 空 prompt 下輸入
!後,Enter 會執行 local shell command。 - 輸入
@打開文件引用補全,Tab/Enter插入路徑。 /plan [message]進入 plan mode,/plan off離開 plan mode。/goal <objective>設置目標;/goal clear|edit <objective>|pause|resume管理目標。/compact壓縮會話歷史。↑/↓召回歷史輸入。PageUp/PageDown滾動全屏幕 transcript。
適用場景與注意¶
適合需要把 DSH 會話放到終端裏操作的開發者:查看狀態、切換模型和權限、審批工具調用、管理計劃與目標、壓縮歷史、引用倉庫文件。
由於插件會運行在 DSH 宿主環境中,並可觸發工具調用、本地 shell、權限預設等能力,安裝前應檢查源碼、許可證和依賴。本文列出的許可證爲 MIT;插件目錄頁是獨立插件目錄鏈接,不等同於官方應用商店,與 DeepSeek/幻方沒有官方從屬關係。
鏈接¶
- 目錄頁:https://www.skillhub.cn/plugins/tomowang/dsh-tui
- GitHub:https://github.com/tomowang/dsh-tui