CodeWhale:基于终端的编码代理项目

Coding agent for DeepSeek models that runs in your terminal

分支84Tags140
文件最后提交记录最后更新时间
docs: align Rust MSRV references with workspace (#739)18 天前
feat(tools): github_close_pr, handle_read redirection, shell/sidebar polish - New github_close_pr tool distinct from github_close_issue; proper PR wording in tool output, audit records, and gh pr close (not issue close) - handle_read detects art_/call_/SHA refs and points to retrieve_tool_result with copy-pasteable hints; error messages show correct tool for each ref type - Shell delta tool results include the command field so the UI can resolve task_id-only exec cells when the completion metadata arrives - Sidebar background shell tasks show the actual command on the primary row instead of just the task ID; task ID stays available as dim detail - Tool routing falls back to task_id when exec_shell_wait has no command, then updates when the completion carries command metadata - Plan mode prompt explains update_plan as the handoff signal; model waits for user action instead of continuing to tool around - Base prompt clarifies handle_read scope (var_handles only) vs retrieve_tool_result (artifacts/tool-result refs) - New tests: close_pr_schema, close distinction wording, handle_read artifact detection, shell_wait task_id fallback, sidebar background task labels 5 小时前
docs(readme.zh-CN): add in-TUI guide for switching to Chinese locale Add a 切换为中文界面 subsection with two screenshots showing the /config → Edit locale → zh-Hans flow, so Chinese-speaking users landing on the README can switch the UI without digging into settings.toml or env vars first. The settings.toml / LC_ALL fallback is preserved as the alternative path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> 20 天前
fix(help): keep selected row visible while scrolling Account for the help modal border and padding when calculating the visible row window, so the selected command is not clipped after scrolling. Also wrap Up/Down navigation at the list edges and strengthen the selected row highlight for clearer focus. 2 小时前
chore(rebrand): update repository links for CodeWhale 8 小时前
feat(tools): github_close_pr, handle_read redirection, shell/sidebar polish - New github_close_pr tool distinct from github_close_issue; proper PR wording in tool output, audit records, and gh pr close (not issue close) - handle_read detects art_/call_/SHA refs and points to retrieve_tool_result with copy-pasteable hints; error messages show correct tool for each ref type - Shell delta tool results include the command field so the UI can resolve task_id-only exec cells when the completion metadata arrives - Sidebar background shell tasks show the actual command on the primary row instead of just the task ID; task ID stays available as dim detail - Tool routing falls back to task_id when exec_shell_wait has no command, then updates when the completion carries command metadata - Plan mode prompt explains update_plan as the handoff signal; model waits for user action instead of continuing to tool around - Base prompt clarifies handle_read scope (var_handles only) vs retrieve_tool_result (artifacts/tool-result refs) - New tests: close_pr_schema, close distinction wording, handle_read artifact detection, shell_wait task_id fallback, sidebar background task labels 5 小时前
chore(rebrand): finish codewhale release surfaces 8 小时前
chore(rebrand): update repository links for CodeWhale 8 小时前
chore(rebrand): update repository links for CodeWhale 8 小时前
chore(rebrand): update repository links for CodeWhale 8 小时前
v0.8.5: config test fixes + default_model session-apply bugfix (#381) * feat: add config UI support for TUI and web modes - Introduced a new `config_ui.rs` module to handle configuration UI for TUI and web. - Updated `TuiOptions` and `App` structures to include `config_path` and `config_profile`. - Implemented functions to build and apply configuration documents. - Added tests to ensure the new configuration UI behaves as expected. - Integrated web configuration session handling into the event loop. - Updated various modules to accommodate the new configuration options and UI. * refactor(tui): remove local path reference for schemaui dependency Remove the local file system path reference for schemaui in favor of using the published crate from the registry. This change updates the Cargo.toml to use only the version specification and adds the source and checksum information to Cargo.lock. * fix: add AGENTS.md guide and improve config error handling - Add comprehensive AGENTS.md file with project instructions for AI assistants, including build commands, dependencies, and GitHub operations guidance - Introduce is_error field to CommandResult struct for better error tracking - Refactor config application logic to properly handle errors using the new is_error flag - Add test utilities for WebConfigSession to support testing - Optimize web config event polling by extracting drain logic into separate function - Add unit tests for session-only config application and engine sync requirements * fix(security): add SSRF protection to fetch_url (#261) Block private, link-local, and cloud metadata IPs in fetch_url HTTP requests. Co-authored-by: JasonOA888 * test(portability): inject paths instead of mutating HOME (Windows fix) CI's `Test (windows-latest)` job failed because both my new tests (composer_history and the spawn_supervised crash-dump test) mutated HOME to redirect `dirs::home_dir()`. That works on macOS / Linux but not on Windows, where dirs::home_dir() reads USERPROFILE / queries SHGetKnownFolderPath rather than HOME. Fix: refactor both modules to expose path-injecting helpers so tests never need to touch the env var: - composer_history: split load_history / append_history into thin wrappers around load_history_from(&Path) / append_history_to(&Path). Tests use the *_to / *_from form with a tempdir path. - utils::write_panic_dump: same pattern — write_panic_dump_to(&Path) takes the crash dir directly. The spawn_supervised end-to-end test splits into two: one verifies panic-doesn't-propagate (no on-disk side effect needed), one verifies write_panic_dump_to writes the expected log format. Production callers continue to use the env-driven default (`HOME`/ `USERPROFILE` via `dirs::home_dir()`) so no behavior change. Tests work identically on every platform now. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(tui): clear chat area each frame so stale cells don't bleed into sidebar ChatWidget's render path was `Paragraph::new(lines).render(content_area, buf)` with no Block and no Clear — ratatui's Paragraph only writes cells that contain text, leaving any cell the current frame's paragraph doesn't touch holding the *previous* frame's contents. With wide tool output (`gh pr list`, `git log`) emitting ISO-8601 timestamps like `2026-05-02T07:29:24Z`, then a subsequent shorter-paragraph frame, the old timestamp tails (`:24Z`, `7:29:24Z`, etc.) persisted on the right edge of the chat area, visually colliding with the section headers in the sidebar (`Plan` rendering as `:24Zan`, `Agents` as `:24Zents`). Fix: render `Clear` over the full content_area before drawing the Paragraph. Cheap (one buffer-fill per frame) and guarantees stale cells can never persist into the next frame's render. Reported in v0.8.5 testing right after install. The other v0.8.5 bordered widgets (composer, sidebar sections, footer) already render into a Block with a solid background style, so they were never affected — only the chat area used a bare Paragraph. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(theme): vendor + theme schemaui to deepseek navy palette (config UI) The schemaui-0.12.0 crate the contributor brought in via #365 ships hardcoded Color::Gray / Color::DarkGray / Color::White / Color::Yellow references across its rendering components. Visually it clashed with the rest of deepseek-tui — the editor area read as gray-on-black on a TUI that's otherwise navy ink + sky accents. Two ship-day options weren't acceptable: defaulting back to the legacy modal lost the new editor's UX, and living with gray was off-brand. This commit forks schemaui at 0.12.0 into vendor/schemaui-0.12.0 and themes the rendering layer to match deepseek-tui's palette. The patch is wired in via a workspace-level [patch.crates-io] override so the deepseek-tui Cargo.toml continues to depend on `schemaui = "0.12.0"` and would automatically resolve back to crates.io if we ever drop the override (e.g. once upstream lands a ColorTheme API). Changes inside the vendored fork: - New `src/deepseek_palette.rs` with the brand RGB values: SURFACE_INK / SURFACE_RAISED for backgrounds, BORDER_DIM / BORDER_ACTIVE for chrome, TEXT_PRIMARY / TEXT_MUTED / TEXT_DIM, ACCENT_SKY / ACCENT_BLUE / ACCENT_PURPLE, and STATUS_OK / WARN / ERROR. Values mirror crates/tui/src/palette.rs in the workspace. - `src/lib.rs` exposes the palette module under `cfg(feature = "tui")`. - `src/tui/view/frame.rs::draw` paints a navy backdrop across the full frame area before any child widget renders, so any cell that doesn't get explicitly written reads as ink instead of the terminal default. - `tabstrip.rs`, `overlay.rs`, `popup.rs`, `body.rs`, `sections.rs`, `footer.rs`, `help.rs`, `fields.rs`: every Color::Gray / DarkGray / White / Yellow / Cyan / Blue / Magenta / Red / Green / LightBlue swapped out for a deepseek_palette token, plus explicit `bg(...)` fills on the top-level Block styles and Paragraph wrappers. - `Cargo.toml` adds an empty `[workspace]` so the vendored crate builds standalone (its dev-deps don't drift into ours). Workspace-level changes: - `Cargo.toml` adds `[patch.crates-io] schemaui = { path = "vendor/schemaui-0.12.0" }`. Production deepseek-tui builds pick up the themed fork transparently. - `.gitignore` excludes `vendor/.../web/ui/node_modules/` (15 MB of npm artefacts the Rust build doesn't need) and the vendored Cargo.lock (regenerated locally per build). Verification: - cargo build --workspace --all-features: clean - cargo clippy --workspace --all-targets --all-features --locked: clean - cargo test --workspace: 1777 passed, 0 failed - /config inside `deepseek` now opens a navy-themed editor matching the rest of the TUI; tabs, body panel, footer, popup, and help overlay all read on brand. Future work tracked separately: upstream a `with_theme(ColorTheme)` builder API to schemaui so we can drop the fork. Until then, sync the fork against new schemaui releases when we want their fixes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Revert "feat(theme): vendor + theme schemaui to deepseek navy palette" This reverts ed597ccc — vendoring 28,913 lines of schemaui to recolor a config editor was the wrong tradeoff. Maintenance cost for a cosmetic match wasn't worth it, and the recolor wasn't even fully working (terminal-default bg kept bleeding through Style::default() calls in the form fields). The simpler path: keep the schemaui-driven editor available as `/config tui` for users who want the form-style UX, but make bare `/config` open the legacy native modal that already matches the deepseek-tui navy chrome by inheritance. No fork, no vendored copy, no ongoing sync burden. Changes: - `git rm -r vendor/schemaui-0.12.0/` (28,913 lines gone) - Drop `[patch.crates-io]` from workspace Cargo.toml — schemaui resolves back to crates.io v0.12.0 unmodified. - Drop the corresponding `.gitignore` exclusions (no more vendor dir to filter). - `config_ui::parse_mode` default mode flipped from `Tui` to `Native`. Bare `/config` → legacy navy modal. Explicit `/config tui` → the contributor's schemaui editor (still available, gray-on-default chrome, but opt-in). `/config web` and `/config <key>` / `/config <key> <value>` unchanged. - Help text updated to list `[native|tui|web]` in that order. Verified: cargo build / clippy --workspace --all-features --locked with -D warnings: clean. The contributor's work (#365) ships and gets credit; users discover the alternate editor via the help text. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(tui): paint chat area with explicit navy ink instead of Clear The Clear-instead-of-fill in 0ae2cead reset cells to the terminal's default background, which read as a brown-gray on most user setups even though the rest of the TUI chrome is navy. Replace the Clear with an explicit Block fill at palette::DEEPSEEK_INK, and pass the same bg through to the Paragraph itself so streamed text cells inherit ink rather than bouncing back to terminal default. Net effect: the chat area visually unifies with the sidebar / composer / footer instead of showing as a contrasting brown-gray panel in the middle of an otherwise navy frame. Stale-cell guarantee from #372-followup is preserved — the Block fills every cell in the area on each frame, so wide tool output (`gh pr list` ISO timestamps, etc.) still can't bleed past the current frame's actual text. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(config): update tests for Native default + fix default_model override in session-only apply - Update test_show_config_defaults_to_native and execute_config_opens_config_view_action to expect OpenConfigView (Native) instead of OpenConfigEditor(Tui), matching the parse_mode default change from ce98f054. - Fix apply_document bug where default_model was processed in the main key-value loop after model, causing set_config_value('default_model') to overwrite the runtime model. default_model is now only applied when persist=true, preventing session-only edits from being silently reverted. * style: cargo fmt * chore: remove end-of-night report (session artifact) --------- Co-authored-by: unic <yuniqueunic@gmail.com> Co-authored-by: Jason <jason@aveoresearchlabs.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: YuniqueUnic <YuniqueUnic@users.noreply.github.com>21 天前
docs(web): document update path 9 天前
chore(rebrand): update repository links for CodeWhale 8 小时前
chore(release): prepare codewhale v0.8.41 test build 9 小时前
fix(docker): include changelog in image build context 11 天前
fix(cli): forward --yolo to TUI binary via DEEPSEEK_YOLO env The CLI dispatcher accepted --yolo but only passed it to Exec(TuiPassthroughArgs), not to the plain Run(RunArgs) path used for interactive sessions. Fix: pass DEEPSEEK_YOLO=true env var to the TUI binary. The TUI already reads this env var (matching DEEPSEEK_SANDBOX_MODE pattern) and sets allow_shell + start_in_agent_mode + yolo. Also adds yolo field to CliRuntimeOverrides and ResolvedRuntimeOptions so the flag propagates through the full resolve chain. 13 天前
docs: trim internal lighthouse setup notes 9 天前
chore: map github web committer 29 天前
chore(rebrand): update repository links for CodeWhale 8 小时前
chore(rebrand): update repository links for CodeWhale 8 小时前
docs: add CODE_OF_CONDUCT.md Add Contributor Covenant Code of Conduct v2.1 to establish community guidelines and set clear expectations for participant behavior.18 天前
feat(tools): github_close_pr, handle_read redirection, shell/sidebar polish - New github_close_pr tool distinct from github_close_issue; proper PR wording in tool output, audit records, and gh pr close (not issue close) - handle_read detects art_/call_/SHA refs and points to retrieve_tool_result with copy-pasteable hints; error messages show correct tool for each ref type - Shell delta tool results include the command field so the UI can resolve task_id-only exec cells when the completion metadata arrives - Sidebar background shell tasks show the actual command on the primary row instead of just the task ID; task ID stays available as dim detail - Tool routing falls back to task_id when exec_shell_wait has no command, then updates when the completion carries command metadata - Plan mode prompt explains update_plan as the handoff signal; model waits for user action instead of continuing to tool around - Base prompt clarifies handle_read scope (var_handles only) vs retrieve_tool_result (artifacts/tool-result refs) - New tests: close_pr_schema, close distinction wording, handle_read artifact detection, shell_wait task_id fallback, sidebar background task labels 5 小时前
chore(release): prepare codewhale v0.8.41 test build 9 小时前
chore(rebrand): update repository links for CodeWhale 8 小时前
chore(rebrand): update repository links for CodeWhale 8 小时前
Initial release v0.1.0 DeepSeek TUI - Unofficial terminal UI + CLI for DeepSeek models. Features: - Interactive TUI with multiple modes (Normal, Plan, Agent, YOLO, RLM, Duo) - Comprehensive tool access with approval gating - File operations, shell execution, task management - Sub-agent system for parallel work - MCP integration for external tool servers - Session management and skills system - Cross-platform support (macOS, Linux, Windows) 🤖 Generated with [Claude Code](https://claude.ai/code) 3 个月前
chore(rebrand): update repository links for CodeWhale 8 小时前
chore(rebrand): update repository links for CodeWhale 8 小时前
chore(rebrand): update repository links for CodeWhale 8 小时前
chore(rebrand): update repository links for CodeWhale 8 小时前
chore(rebrand): update repository links for CodeWhale 8 小时前
feat(package): add nix package 18 天前
chore(rebrand): finish codewhale release surfaces 8 小时前

CodeWhale

面向 DeepSeek V4 的终端原生编程智能体:100 万 token 上下文、思考模式流式推理、前缀缓存感知。自包含 Rust 二进制发布——开箱即带 MCP 客户端、沙箱和持久化任务队列。

English README 日本語 README

安装

codewhale 是自包含 Rust 二进制——运行时不依赖 Node.js 或 Python。 下面几种方式装出来的是同一套二进制,按你已有的工具链选一个即可:

# 1. npm —— 已装 Node 的最方便方式。npm 包只是一个下载器,
#    会从 GitHub Releases 拉取对应平台的预编译二进制,
#    并不会让 codewhale 本身依赖 Node 运行时。
npm install -g codewhale

# 2. Cargo —— 无需 Node。
cargo install codewhale-cli --locked   # `codewhale` 入口
cargo install codewhale-tui     --locked   # `codewhale-tui` TUI 二进制

# 3. Homebrew —— macOS 包管理器。
brew tap Hmbown/deepseek-tui
brew install deepseek-tui

# 4. 直接下载 —— 无需任何工具链。
#    https://github.com/Hmbown/CodeWhale/releases
#    覆盖 Linux x64/ARM64、macOS x64/ARM64、Windows x64

# 5. Docker —— 预构建发布镜像。
docker volume create codewhale-home
docker run --rm -it \
  -e DEEPSEEK_API_KEY="$DEEPSEEK_API_KEY" \
  -v codewhale-home:/home/codewhale/.deepseek \
  -v "$PWD:/workspace" \
  -w /workspace \
  ghcr.io/hmbown/codewhale:latest

中国大陆访问较慢时,npm 可加 --registry=https://registry.npmmirror.com, 或使用下方的 Cargo 镜像

下载安全:官方二进制只发布在 https://github.com/Hmbown/CodeWhale/releases。手动下载时请校验 SHA-256 manifest,并避免相似仓库名或搜索结果里的镜像站。详见 下载安全与校验

已经安装过?按你的安装方式更新:

codewhale update                         # release 二进制更新器
npm install -g codewhale@latest      # npm 包装器
brew update && brew upgrade deepseek-tui
cargo install codewhale-cli --locked --force
cargo install codewhale-tui     --locked --force

CI npm crates.io DeepWiki project index

codewhale 截图


这是什么?

codewhale 是一个完全运行在终端里的编程智能体。它让 DeepSeek 前沿模型直接访问你的工作区:读写文件、运行 shell 命令、搜索浏览网页、管理 git、调度子智能体——全部通过快速、键盘驱动的 TUI 完成。

它面向 DeepSeek V4deepseek-v4-pro / deepseek-v4-flash)构建,原生支持 100 万 token 上下文窗口和思考模式流式输出。

主要功能

  • Auto 模式 —— --model auto / /model auto 每轮自动选择模型和推理强度
  • 原生 RLMrlm_open/rlm_eval)—— 持久化 REPL 会话用于批量分析;使用带界面的辅助函数(peeksearchchunksub_query_batch)运行低成本 deepseek-v4-flash 子任务
  • 思考模式流式输出 —— 实时观察模型在解决问题时的思维链展开
  • 完整工具集 —— 文件操作、shell 执行、git、网页搜索/浏览、apply-patch、子智能体、MCP 服务器
  • 100 万 token 上下文 —— 上下文跟踪、手动或配置驱动的压缩,以及前缀缓存遥测
  • 前缀缓存稳定性跟踪 —— 可选 /statusline footer chip 显示最近轮次缓存前缀的稳定程度
  • 三种交互模式 —— Plan(只读探索)、Agent(带审批的默认交互)、YOLO(可信工作区自动批准)
  • 推理强度档位 —— 用 Shift+Taboff → high → max 之间切换
  • 会话保存和恢复 —— 长任务的断点续作
  • 工作区回滚 —— 通过 side-git 记录每轮前后快照,支持 /restorerevert_turn,不影响项目自己的 .git
  • 持久化任务队列 —— 后台任务在重启后仍然存在,支持计划任务和长时间运行的操作
  • HTTP/SSE 运行时 API —— codewhale serve --http 用于无界面智能体流程
  • MCP 协议 —— 连接 Model Context Protocol 服务器扩展工具,见 docs/MCP.md
  • LSP 诊断 —— 每次编辑后通过 rust-analyzer、pyright、typescript-language-server、gopls、clangd 提供内联错误/警告
  • 用户记忆 —— 可选的持久化笔记文件注入系统提示,实现跨会话偏好保持
  • 多语言 UI —— 支持 enjazh-Hanspt-BR,支持自动检测
  • 实时成本跟踪 —— 按轮次和会话统计 token 用量与成本估算,含缓存命中/未命中明细;简体中文 locale 下显示 CNY
  • 技能系统 —— 可通过 GitHub 安装的组合式指令包;首次启动自带 skill-creatormcp-builderdocumentspresentationsspreadsheetspdffeishu 等 starter skills
  • 终端原生通知 —— OSC 9、OSC 99、OSC 777,以及桌面通知兜底
  • 内置主题选择器 —— Catppuccin、Tokyo Night、Dracula、Gruvbox 和原有亮/暗色主题,可用 /theme 实时切换

架构说明

codewhale(调度器 CLI)→ codewhale-tui(伴随二进制)→ ratatui 界面 ↔ 异步引擎 ↔ OpenAI 兼容流式客户端。工具调用通过类型化注册表(shell、文件操作、git、web、子智能体、MCP、RLM)路由,结果流式返回对话记录。引擎管理会话状态、轮次追踪、持久化任务队列和 LSP 子系统——它在下一步推理前将编辑后诊断反馈到模型上下文中。

详见 docs/ARCHITECTURE.md

子智能体:并发后台执行

codewhale 可以同时调度多个子智能体并行运行——类似于并发任务队列:

  • 非阻塞启动。 agent_open 立即返回。子智能体获得独立的上下文和工具注册表,独立运行。父进程继续工作。
  • 后台执行。 子智能体并发运行(默认上限 10,可配置至 20)。引擎管理线程池——无需轮询循环。
  • 完成通知。 子智能体完成后,运行时发送结构化的 <codewhale:subagent.done> 事件,包含摘要、证据列表和执行指标。父模型读取 summary 字段并整合结果。
  • 按需读取结果。 大型对话记录暂存为 var_handle 引用。模型通过 handle_read 按切片、范围或 JSONPath 投影读取——保持父上下文精简。

详见 docs/SUBAGENTS.md


快速开始

npm install -g codewhale
codewhale --version
codewhale --model auto

预构建二进制覆盖 Linux x64Linux ARM64(v0.8.8 起)、macOS x64macOS ARM64Windows x64。其他目标平台(musl、riscv64、FreeBSD 等)请见下方的从源码安装docs/INSTALL.md

首次启动时会提示输入 DeepSeek API key。密钥保存到 ~/.deepseek/config.toml,在任意目录、IDE 终端和脚本中都能使用,不会触发系统密钥环弹窗。

也可以提前配置:

codewhale auth set --provider deepseek   # 保存到 ~/.deepseek/config.toml

codewhale auth status                    # 显示当前活跃的凭证来源
export DEEPSEEK_API_KEY="YOUR_KEY"      # 环境变量方式;需要在非交互式 shell 中使用请放入 ~/.zshenv
codewhale

codewhale doctor                          # 验证安装

轮换或移除密钥:codewhale auth clear --provider deepseek

腾讯云 / CNB 远程优先路径

如果你想要一个长期在线、可从手机控制的工作区,推荐使用腾讯云原生路径: CNB 镜像/源码,腾讯云 Lighthouse 香港实例,飞书/Lark 长连接桥接, 以及可选的 EdgeOne 公网 HTTPS 边缘。运行时 API 必须绑定在 localhost; 不要通过 EdgeOne 暴露 /v1/*

先看 docs/TENCENT_CLOUD_REMOTE_FIRST.md, 再按 docs/TENCENT_LIGHTHOUSE_HK.md 配置服务器。

Auto 模式

使用 codewhale --model auto/model auto 让 codewhale 自行决定每轮需要多少模型和推理能力。

Auto 模式同时控制两个设置:

  • 模型:deepseek-v4-flashdeepseek-v4-pro
  • 推理强度:offhighmax

在真实请求发出之前,应用会先用关闭推理的 deepseek-v4-flash 进行一次小型路由调用。路由器审视最新请求和最近的上下文,然后为真实请求选定具体的模型和推理强度。简短/简单的轮次保持在 Flash + 关闭推理;编码、调试、发布、架构、安全审查或模糊的多步骤任务可升级到 Pro 和/或更高推理强度。

auto 是 codewhale 本地行为。上游 API 永远不会收到 model: "auto",它只会收到为当前轮次选定的具体模型和推理强度设置。TUI 会显示选定的路由,成本跟踪按实际运行的模型计费。如果路由调用失败或返回无效答案,应用会回退到本地启发式规则。子智能体会继承 auto 模式,除非你为它们指定了显式模型。

需要可重复基准测试、严格控制成本上限或特定提供商/模型映射时,请使用固定模型或固定推理强度。

Linux ARM64(HarmonyOS 轻薄本、openEuler、Kylin、树莓派、Graviton 等)

从 v0.8.8 起,npm i -g codewhale 直接支持 glibc 系的 ARM64 Linux。你也可以从 Releases 页面 下载预编译二进制,放到 PATH 目录中。

中国大陆 / 镜像友好安装

如果在中国大陆访问 GitHub 或 npm 下载较慢,可以通过 Cargo 注册表镜像安装:

# ~/.cargo/config.toml
[source.crates-io]
replace-with = "tuna"

[source.tuna]
registry = "sparse+https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/"

然后安装两个二进制(调度器在运行时会调用 TUI):

cargo install codewhale-cli --locked   # 提供推荐入口 `codewhale`
cargo install codewhale-tui     --locked   # 提供交互式 TUI 伴随二进制
codewhale --version

也可以直接从 GitHub Releases 下载预编译二进制。DEEPSEEK_TUI_RELEASE_BASE_URL 可用于镜像后的 release 资产。

Windows (Scoop)

Scoop 是一个 Windows 软件包管理器。codewhale 已进入 Scoop main bucket,但该 manifest 独立更新,可能滞后于 GitHub/npm/Cargo release。先运行 scoop update,安装后用 codewhale --version 核对版本:

scoop update
scoop install deepseek-tui
codewhale --version

如果需要最新版本,请优先使用 npm 或直接下载 GitHub Release 资产。

从源码安装

适用于任何 Tier-1 Rust 目标,包括 musl、riscv64、FreeBSD 以及尚无预编译包的 ARM64 发行版。

# Linux 构建依赖(Debian/Ubuntu/RHEL):
#   sudo apt-get install -y build-essential pkg-config libdbus-1-dev
#   sudo dnf install -y gcc make pkgconf-pkg-config dbus-devel

git clone https://github.com/Hmbown/CodeWhale.git
cd CodeWhale

cargo install --path crates/cli --locked   # 需要 Rust 1.88+;提供 `codewhale`
cargo install --path crates/tui --locked   # 提供 `codewhale-tui`

两个二进制都需要安装。交叉编译和平台特定说明见 docs/INSTALL.md

其他模型提供方

# NVIDIA NIM
codewhale auth set --provider nvidia-nim --api-key "YOUR_NVIDIA_API_KEY"
codewhale --provider nvidia-nim

# AtlasCloud
codewhale auth set --provider atlascloud --api-key "YOUR_ATLASCLOUD_API_KEY"
codewhale --provider atlascloud

# Wanjie Ark
codewhale auth set --provider wanjie-ark --api-key "YOUR_WANJIE_API_KEY"
codewhale --provider wanjie-ark --model deepseek-reasoner

# OpenRouter
codewhale auth set --provider openrouter --api-key "YOUR_OPENROUTER_API_KEY"
codewhale --provider openrouter --model deepseek/deepseek-v4-pro

# Novita
codewhale auth set --provider novita --api-key "YOUR_NOVITA_API_KEY"
codewhale --provider novita --model deepseek/deepseek-v4-pro

# Fireworks
codewhale auth set --provider fireworks --api-key "YOUR_FIREWORKS_API_KEY"
codewhale --provider fireworks --model deepseek-v4-pro

# 通用 OpenAI 兼容端点
codewhale auth set --provider openai --api-key "YOUR_OPENAI_COMPATIBLE_API_KEY"
OPENAI_BASE_URL="https://openai-compatible.example/v4" codewhale --provider openai --model glm-5

# 自托管 SGLang
SGLANG_BASE_URL="http://localhost:30000/v1" codewhale --provider sglang --model deepseek-v4-flash

# 自托管 vLLM
VLLM_BASE_URL="http://localhost:8000/v1" codewhale --provider vllm --model deepseek-v4-flash

# 自托管 Ollama
ollama pull codewhale-coder:1.3b
codewhale --provider ollama --model codewhale-coder:1.3b

在 TUI 内,/provider 打开提供方选择器,/model 打开本地模型/思考模式 选择器。/provider openrouter/model <id> 可直接切换;/models 会在 当前提供方支持模型列表时显式请求并列出 API 返回的实时模型。


版本说明

每个版本的具体变更见 CHANGELOG.md。README 只保留当前 安装方式、核心工作流、模型提供方配置、运行时接口和扩展入口。


使用方式

codewhale                                       # 交互式 TUI
codewhale "explain this function"              # 一次性提示
codewhale exec --auto --output-format stream-json "fix this bug" # 面向后端集成的 NDJSON 流
codewhale exec --resume <SESSION_ID> "follow up" # 继续非交互会话
codewhale --model deepseek-v4-flash "summarize" # 指定模型
codewhale --model auto "fix this bug"          # 自动选择模型 + 推理强度
codewhale --yolo                                # 自动批准工具
codewhale auth set --provider deepseek         # 保存 API key
codewhale doctor                                # 检查配置和连接
codewhale doctor --json                         # 机器可读诊断
codewhale setup --status                        # 只读安装状态
codewhale setup --tools --plugins               # 创建本地工具和插件目录
codewhale models                                # 列出可用 API 模型
codewhale sessions                              # 列出已保存会话
codewhale resume --last                         # 恢复最近会话
codewhale resume <SESSION_ID>                   # 按 UUID 恢复指定会话
codewhale fork <SESSION_ID>                     # 将已保存会话分叉为兄弟路径
codewhale serve --http                          # HTTP/SSE API 服务
codewhale serve --acp                           # Zed/自定义智能体的 ACP stdio 适配器
codewhale run pr <N>                            # 获取 PR 并预填审查提示
codewhale mcp list                              # 列出已配置 MCP 服务器
codewhale mcp validate                          # 校验 MCP 配置和连接
codewhale mcp-server                            # 启动 dispatcher MCP stdio 服务器
codewhale update                                # 检查并应用二进制更新

Docker 镜像发布在 GHCR 上:

docker volume create codewhale-home

docker run --rm -it \
  -e DEEPSEEK_API_KEY="$DEEPSEEK_API_KEY" \
  -v codewhale-home:/home/codewhale/.deepseek \
  -v "$PWD:/workspace" \
  -w /workspace \
  ghcr.io/hmbown/codewhale:latest

固定 tag、本地构建、volume 权限和非交互管道用法见 docs/DOCKER.md

Zed / ACP

DeepSeek 可作为自定义 Agent Client Protocol 服务器运行,供 Zed 等编辑器通过 stdio 调用本地 ACP 智能体。在 Zed 中添加自定义智能体服务器:

{
  "agent_servers": {
    "DeepSeek": {
      "type": "custom",
      "command": "codewhale",
      "args": ["serve", "--acp"],
      "env": {}
    }
  }
}

首个 ACP 切片支持通过现有 DeepSeek 配置/API 密钥创建新会话和提示响应。工具支持的编辑和检查点回放尚未通过 ACP 暴露。

常用快捷键

按键 功能
Tab 补全 /@;运行中则把草稿排队;否则切换模式
Shift+Tab 切换推理强度:off → high → max
F1 可搜索帮助面板
Esc 返回 / 关闭
Ctrl+K 命令面板
Ctrl+R 恢复旧会话
Alt+R 搜索提示历史和恢复草稿
Ctrl+S 暂存当前草稿(/stash list/stash pop 恢复)
@path 在输入框中附加文件或目录上下文
(在输入框开头) 选择附件行进行移除

完整快捷键目录:docs/KEYBINDINGS.md


模式

模式 行为
Plan 🔍 只读调查;模型先探索并提出计划(update_plan + checklist_write),然后再做更改
Agent 🤖 默认交互模式;多步工具调用带审批门禁
YOLO 在可信工作区自动批准工具;仍会维护计划和清单以保持可见性

配置

用户配置:~/.deepseek/config.toml。项目覆盖:<workspace>/.deepseek/config.toml(以下密钥被拒绝:api_keybase_urlprovidermcp_config_path)。完整选项见 config.example.toml

常用环境变量:

变量 用途
DEEPSEEK_API_KEY DeepSeek API key
DEEPSEEK_BASE_URL API base URL
DEEPSEEK_HTTP_HEADERS 可选模型请求头,例如 X-Model-Provider-Id=your-model-provider
DEEPSEEK_MODEL 默认模型
DEEPSEEK_STREAM_IDLE_TIMEOUT_SECS 流式响应空闲超时秒数,默认 300,限制在 1..=3600
DEEPSEEK_PROVIDER codewhale(默认)、nvidia-nimopenaiatlascloudwanjie-arkopenrouternovitafireworkssglangvllmollama
DEEPSEEK_PROFILE 配置 profile 名称
DEEPSEEK_MEMORY 设为 on 启用用户记忆
DEEPSEEK_ALLOW_INSECURE_HTTP=1 在可信网络上允许非本机 http:// API base URL
NVIDIA_API_KEY / OPENAI_API_KEY / ATLASCLOUD_API_KEY / WANJIE_ARK_API_KEY / OPENROUTER_API_KEY / NOVITA_API_KEY / FIREWORKS_API_KEY / SGLANG_API_KEY / VLLM_API_KEY / OLLAMA_API_KEY 提供商认证
OPENAI_BASE_URL / OPENAI_MODEL 通用 OpenAI 兼容端点和模型 ID
ATLASCLOUD_BASE_URL / ATLASCLOUD_MODEL AtlasCloud 端点和模型覆盖
WANJIE_ARK_BASE_URL / WANJIE_ARK_MODEL Wanjie Ark 端点和模型覆盖
OPENROUTER_BASE_URL OpenRouter 端点覆盖
NOVITA_BASE_URL Novita 端点覆盖
FIREWORKS_BASE_URL Fireworks 端点覆盖
SGLANG_BASE_URL 自托管 SGLang 端点
SGLANG_MODEL 自托管 SGLang 模型 ID
VLLM_BASE_URL 自托管 vLLM 端点
VLLM_MODEL 自托管 vLLM 模型 ID
OLLAMA_BASE_URL 自托管 Ollama 端点
OLLAMA_MODEL 自托管 Ollama 模型标签
NO_ANIMATIONS=1 启动时强制无障碍模式
SSL_CERT_FILE 企业代理的自定义 CA 包

locale 会控制界面语言,并作为模型自然语言的兜底设置;最新用户消息的语言优先级更高。也就是说,即使系统 locale 是英文,用户用中文提问时,V4 的 reasoning_content 和最终回复也应该使用中文。可在 config.toml 中设置 locale、使用 /config locale zh-Hans、或依赖 LC_ALL/LANG。详见 docs/LOCALIZATION.mddocs/CONFIGURATION.md

切换为中文界面

如果界面是其他语言,可以在 TUI 内一键切换为简体中文:

  1. 在 Composer 里输入 /config,按 Tab 或 Enter 打开配置面板。
  2. 选择 Edit locale,在 New: 字段输入 zh-Hans,按 Enter 应用。

可选语言:auto | en | ja | zh-Hans | pt-BR

也可以在 ~/.deepseek/config.toml 里直接设置 locale = "zh-Hans",或通过 LC_ALL / LANG 环境变量自动选择:

# ~/.deepseek/config.toml
[tui]
locale = "zh-Hans"

或者通过环境变量(中文系统通常已自动生效):

LANG=zh_CN.UTF-8 codewhale run

模型和价格

模型 上下文 输入(缓存命中) 输入(缓存未命中) 输出
deepseek-v4-pro 1M $0.003625 / 1M $0.435 / 1M $0.87 / 1M
deepseek-v4-flash 1M $0.0028 / 1M $0.14 / 1M $0.28 / 1M

旧别名 deepseek-chat / deepseek-reasoner 映射到 deepseek-v4-flash。NVIDIA NIM 变体使用你的 NVIDIA 账号条款。

Note

上表的 V4 Pro 单价现已成为官方长期价格:DeepSeek 已宣布在 75% 限时折扣窗口于 2026 年 5 月 31 日 23:59(北京时间) 结束后,正式将原始价格调整为约四分之一。TUI 的成本估算已使用这些数值,因此无需任何代码改动。后续价格变动请参阅官方 DeepSeek 定价页面


创建和安装技能

codewhale 从工作区目录(.agents/skillsskills.opencode/skills.claude/skills)和全局 ~/.deepseek/skills 发现技能。每个技能是一个包含 SKILL.md 的目录:

~/.deepseek/skills/my-skill/
└── SKILL.md

需要 YAML frontmatter:

---
name: my-skill
description: 当 DeepSeek 需要遵循我的自定义工作流时使用这个技能。
---

# My Skill
这里写给智能体的指令。

常用命令:/skills(列出)、/skill <name>(激活)、/skill new(创建)、/skill install github:<owner>/<repo>(社区)、/skill update / uninstall / trust。社区技能直接从 GitHub 安装,无需后端服务。已安装技能在模型可见的会话上下文里列出;当任务匹配技能描述时,智能体可通过 load_skill 工具自动读取对应的 SKILL.md


文档

文档 主题
ARCHITECTURE.md 代码库内部结构
CONFIGURATION.md 完整配置参考
MODES.md Plan / Agent / YOLO 模式
MCP.md Model Context Protocol 集成
RUNTIME_API.md HTTP/SSE API 服务
INSTALL.md 各平台安装指南
DOCKER.md GHCR 镜像、volume 和 Docker 用法
CNB_MIRROR.md CNB 镜像和中国大陆友好安装说明
TENCENT_CLOUD_REMOTE_FIRST.md 腾讯云/CNB/Lighthouse/飞书远程优先路径
TENCENT_LIGHTHOUSE_HK.md 腾讯云 Lighthouse 香港实例配置
MEMORY.md 用户记忆功能指南
SUBAGENTS.md 子智能体角色分类与生命周期
KEYBINDINGS.md 完整快捷键目录
RELEASE_RUNBOOK.md 发布流程
LOCALIZATION.md UI 语言矩阵与切换
OPERATIONS_RUNBOOK.md 运维和恢复

完整更新历史:CHANGELOG.md


致谢

  • DeepSeek — 感谢 DeepSeek 提供模型与支持,让每一次交互成为可能。
  • DataWhale — 感谢 DataWhale 的支持,并欢迎我们加入“鲸兄弟”大家庭。
  • OpenWarp — 感谢 OpenWarp 优先支持 codewhale,并一起打磨更好的终端智能体体验。
  • Open Design — 感谢 Open Design 对面向设计的智能体工作流提供支持与协作。

本项目由不断壮大的贡献者社区共同打造:

  • merchloubna70-dot — 28 个 PR,涵盖功能、修复和 VS Code 扩展基础架构 (#645–#681)
  • WyxBUPT-22 — Markdown 表格、粗体/斜体和水平线渲染 (#579)
  • loongmiaow-pixel — Windows + 中国安装文档 (#578)
  • 20bytes — 用户记忆文档和帮助优化 (#569)
  • staryxchen — glibc 兼容性预检 (#556)
  • Vishnu1837 — glibc 兼容性改进 (#565)
  • shentoumengxin — Shell cwd 边界验证 (#524)
  • toi500 — Windows 粘贴修复报告
  • xsstomy — 终端启动重绘报告
  • melody0709 — 斜杠前缀回车激活报告
  • lloydzhoujeoor — 压缩成本报告;lloydzhou 还贡献了确定性的环境上下文注入 (#813, #922) 和 KV 前缀缓存稳定化 (#1080)
  • Agent-Skill-007 — README 清晰化改进 (#685)
  • woyxiang — Windows 安装文档 (#696)
  • wangfeng — 价格/折扣信息更新 (#692)
  • zichen0116 — CODE_OF_CONDUCT.md (#686)
  • dfwqdyl-ui — 模型 ID 大小写兼容性报告 (#729)
  • Oliver-ZPLiuworking... 卡死状态 Bug 报告和 Windows 剪贴板兜底修复 (#738, #850)
  • reidliu41 — 退出后的恢复提示、工作区信任持久化、Ollama provider 支持,以及思考块流式终结修复 (#863, #870, #921, #1078)
  • xieshutao — 纯 Markdown skill 兜底解析 (#869)
  • GK012 — npm wrapper 的 --version 兜底 (#885)
  • y0sif — 直接子智能体完成后唤醒父级 turn loop (#901)
  • mac119leo119codewhale update 命令文档 (#838, #917)
  • dumbjack / 浩淼的mac — shell 命令空字节安全加固 (#706, #918)
  • macworkers — fork 完成后显示新 session id (#600, #919)
  • zerozerx-lab — 通知条件配置和更完整的 OSC 9 通知正文 (#820, #920)
  • chnjames — @mention 补全缓存、配置恢复优化,以及 Windows UTF-8 shell 输出修复 (#849, #927, #982, #1018)
  • angziii — 配置安全、异步清理、Docker 加固和命令安全修复 (#822, #824, #827, #831, #833, #835, #837)
  • elowen53 — UTF-8 解码和确定性测试覆盖 (#825, #840)
  • wdw8276 — 用于自定义 session 标题的 /rename 命令 (#836)
  • banqii.cursor/skills 发现路径支持 (#817)
  • junskyeed — API 请求动态 max_tokens 计算 (#826)
  • Hafeez Pizofreudefetch_url 的 SSRF 保护和 Star History 图表
  • Unic (YuniqueUnic) — 基于 schema 的配置 UI(TUI + web)
  • Jason — SSRF 安全加固
  • axobase001 — 快照孤儿文件清理、npm 安装守卫、会话遥测修复、模型作用域缓存清理、符号链接技能支持,以及 npm 镜像逃生路径指引 (#975, #1032, #1047, #1049, #1052, #1019, #1051, #1056)
  • MengZ-super/theme 命令基础和 SSE gzip/brotli 解压支持 (#1057, #1061)
  • DI-HUO-MING-YI — Plan 模式只读沙箱安全修复 (#1077)
  • bevis-wong — 粘贴-回车自动提交问题的精确复现 (#1073)
  • DuducocoAlphaGogoo — 技能斜杠菜单和 /skills 覆盖范围修复 (#1068, #1083)
  • ArronAI007 — macOS Terminal.app 和 ConHost 窗口大小调整残留修复 (#993)
  • THINKER-ONLY — OpenRouter 和自定义端点模型 ID 保留 (#1066)
  • Jefskydeepseek-cn 官方端点默认值 (#1079, #1084)
  • wlon — NVIDIA NIM provider API key 优先级诊断 (#1081)

贡献

欢迎提交 pull request——请先查看 CONTRIBUTING.md 并留意开放 issue 中的好入门任务。

本项目与 DeepSeek Inc. 无隶属关系。

许可证

MIT

Star 历史

Star History Chart