Hmbown / DeepSeek-TUI

Hmbown / DeepSeek-TUI

DeepSeek TUI is a terminal-native coding agent built around DeepSeek V4’s 1M-token context and prefix cache. It is a single binary that requires no Node/Python runtime, shipping with an MCP client, sandbox, and durable task queue out of the box. DeepSeek TUI 是一个终端原生的编程智能体,基于 DeepSeek V4 的 100 万 token 上下文和前缀缓存构建。它是一个单一二进制文件,无需 Node 或 Python 运行时,开箱即用,内置了 MCP 客户端、沙箱和持久化任务队列。

What is it?

它是什么?

DeepSeek TUI is a coding agent that runs entirely in your terminal. It gives DeepSeek’s frontier models direct access to your workspace — reading and editing files, running shell commands, searching the web, managing git, and orchestrating sub-agents — all through a fast, keyboard-driven TUI. Built for DeepSeek V4 (deepseek-v4-pro / deepseek-v4-flash) with 1M-token context windows and native thinking-mode (chain-of-thought) streaming. See the model’s reasoning unfold in real time as it works through your tasks. DeepSeek TUI 是一个完全在终端中运行的编程智能体。它让 DeepSeek 的前沿模型能够直接访问你的工作区——读取和编辑文件、运行 Shell 命令、搜索网络、管理 Git 以及编排子智能体——所有操作都通过快速、键盘驱动的 TUI(终端用户界面)完成。它专为 DeepSeek V4(deepseek-v4-pro / deepseek-v4-flash)打造,支持 100 万 token 上下文窗口和原生思维模式(思维链)流式传输。你可以在模型处理任务时实时看到它的推理过程。

Key Features

核心功能

  • Native RLM (rlm_query tool) — fans out 1–16 cheap deepseek-v4-flash children in parallel against the existing DeepSeek client for batched analysis, decomposition, or parallel reasoning. 原生 RLM (rlm_query 工具) — 并行分发 1 到 16 个低成本的 deepseek-v4-flash 子任务,通过现有的 DeepSeek 客户端进行批量分析、任务拆解或并行推理。
  • Thinking-mode streaming — shows DeepSeek’s chain-of-thought as it reasons about your code. 思维模式流式传输 — 在模型对代码进行推理时,实时展示其思维链。
  • Full tool suite — file ops, shell execution, git, web search/browse, apply-patch, sub-agents, MCP servers. 全套工具集 — 支持文件操作、Shell 执行、Git、网络搜索/浏览、补丁应用、子智能体及 MCP 服务器。
  • 1M-token context — automatic intelligent compaction when context fills up. 100 万 token 上下文 — 当上下文填满时,自动进行智能压缩。
  • Three interaction modes — Plan (read-only explore), Agent (interactive with approval), YOLO (auto-approved). 三种交互模式 — Plan(只读探索)、Agent(交互式确认)、YOLO(自动批准)。
  • Decomposition-first system prompts — teach the model to checklist_write, update_plan, and spawn sub-agents before acting. 拆解优先的系统提示词 — 教导模型在行动前先进行清单编写、更新计划并生成子智能体。
  • Reasoning-effort tiers — cycle through off → high → max with Shift+Tab. 推理努力等级 — 使用 Shift+Tab 在“关闭”、“高”、“最大”之间切换。
  • Session save/resume — checkpoint and resume long sessions. 会话保存/恢复 — 支持对长会话进行检查点保存和恢复。
  • Workspace rollback — side-git pre/post-turn snapshots with /restore and revert_turn, without touching your repo’s .git. 工作区回滚 — 通过 /restore 和 revert_turn 进行会话前后的快照对比,且不会触动你仓库的 .git 目录。
  • HTTP/SSE runtime APIdeepseek serve --http for headless agent workflows. HTTP/SSE 运行时 API — 提供 deepseek serve --http 以支持无头(headless)智能体工作流。
  • MCP protocol — connect to Model Context Protocol servers for extended tooling. MCP 协议 — 连接到模型上下文协议(MCP)服务器以扩展工具能力。
  • Live cost tracking — per-turn and session-level token usage and cost estimates. 实时成本追踪 — 提供单轮和会话级别的 token 使用量及成本估算。
  • Dark theme — DeepSeek-blue palette. 深色主题 — 采用 DeepSeek 蓝配色方案。

How it’s wired

架构原理

DeepSeek TUI’s architecture follows a dispatcher → TUI → engine → tools pattern. The deepseek CLI binary is a lightweight dispatcher that parses subcommands and delegates to the deepseek-tui companion binary for interactive sessions. The TUI runs a ratatui-based interface that communicates with an async engine executing an agent loop: user input flows to the LLM via a streaming client (OpenAI-compatible Chat Completions), tool calls are extracted from the response and dispatched through a typed tool registry (shell, file ops, git, web, sub-agents, MCP), and results stream back into the transcript. DeepSeek TUI 的架构遵循“调度器 → TUI → 引擎 → 工具”的模式。deepseek CLI 二进制文件是一个轻量级调度器,负责解析子命令并将其委托给 deepseek-tui 配套二进制文件进行交互式会话。TUI 运行一个基于 ratatui 的界面,与执行智能体循环的异步引擎通信:用户输入通过流式客户端(兼容 OpenAI Chat Completions)发送给 LLM,工具调用从响应中提取并通过类型化的工具注册表(Shell、文件操作、Git、Web、子智能体、MCP)进行分发,结果则流式返回到对话记录中。

Behind the scenes, the engine manages session state, turn tracking, and a durable task queue. The LSP subsystem (crates/tui/src/lsp/) provides post-edit diagnostics by spawning language servers (rust-analyzer, pyright, etc.) and injecting errors into the model’s context before the next reasoning step. A recursive language model (RLM) subsystem gives the agent a sandboxed Python REPL for batch classification and sub-LLM orchestration. 在后台,引擎负责管理会话状态、轮次追踪和持久化任务队列。LSP 子系统 (crates/tui/src/lsp/) 通过启动语言服务器(如 rust-analyzer、pyright 等)提供编辑后的诊断,并在下一次推理步骤前将错误注入到模型的上下文中。递归语言模型 (RLM) 子系统为智能体提供了一个沙箱化的 Python REPL,用于批量分类和子 LLM 的编排。

Quickstart

快速开始

npm install -g deepseek-tui
deepseek

Prebuilt binaries are published for Linux x64, Linux ARM64 (v0.8.8+), macOS x64, macOS ARM64, and Windows x64. 预构建的二进制文件已发布,支持 Linux x64、Linux ARM64 (v0.8.8+)、macOS x64、macOS ARM64 和 Windows x64。

China / mirror-friendly install

中国大陆/镜像友好安装

If GitHub or npm downloads are slow from mainland China, install the Rust crates through a Cargo registry mirror: 如果在中国大陆从 GitHub 或 npm 下载速度较慢,可以通过 Cargo 注册表镜像安装 Rust crate:

# ~/.cargo/config.toml
[source.crates-io]
replace-with = "tuna"
[source.tuna]
registry = "sparse+https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/"

Then install the canonical deepseek dispatcher and the companion TUI binary: 然后安装标准的 deepseek 调度器和配套的 TUI 二进制文件:

cargo install deepseek-tui-cli --locked # 提供 `deepseek`
cargo install deepseek-tui --locked     # 提供 `deepseek-tui`
deepseek --version