Deep Copilot
Deep Copilot 是一个 VS Code 扩展,在侧边栏提供基于大语言模型的对话式编程辅助。它通过 DeepSeek API(兼容 OpenAI 协议)与模型交互,支持文件读写、代码搜索、Shell 命令执行等工具调用,结果以流式方式实时渲染。扩展无运行时 npm 依赖,基于 VS Code Extension API 与 Node.js 内置模块实现,无需在宿主机额外部署任何服务。
Deep Copilot is a VS Code extension that provides LLM-based conversational coding assistance through the sidebar. It interacts with models via the DeepSeek API (OpenAI-compatible protocol), supporting tool calls for file read/write, code search, and shell command execution — all streamed in real time. The extension has no runtime npm dependencies and is built on the VS Code Extension API and Node.js built-ins; no additional service deployment is required.
🔑 API Keys Required · 需要配置的 API Key
开始使用前只需准备以下 Key(最少只需第一个):
You only need the following keys to get started — at minimum just the first one:
| # | API Key | 用途 · Purpose | 获取地址 · Get it here | 是否必须 · Required |
|---|---|---|---|---|
| 1 | DeepSeek API Key | 驱动 AI 对话与 Agent 工具调用 · Powers all AI chat & agent tool calls | platform.deepseek.com/api_keys | ✅ 必须 · Required |
| 2 | Tavily API Key | 启用联网搜索工具 web_search · Enables the web_search tool |
app.tavily.com | ⚙️ 可选 · Optional |
如何填入 · How to set them
中文:
- 安装扩展后,点击侧边栏活动栏的 🐋 图标打开 Deep Copilot 面板
- 点击面板右下角 🔑 按钮 → 粘贴 DeepSeek API Key → 保存
- 若需要联网搜索,在同一弹窗里继续填入 Tavily API Key
English:
- After installing, click the 🐋 icon in the activity bar to open the Deep Copilot panel
- Click the 🔑 button in the bottom-right of the panel → paste your DeepSeek API Key → save
- For web search, fill in your Tavily API Key in the same dialog
国内用户:若
api.deepseek.com连接不稳定,在 🔑 弹窗中将 Base URL 改为https://api.deepseeki.com。
China users: ifapi.deepseek.comis slow, set Base URL tohttps://api.deepseeki.comin the 🔑 dialog.
📑 Table of Contents · 目录
- API Keys · 需要配置的 Key
- Highlights · 亮点
- Quick Start · 快速开始
- Build from Source · 源码构建
- Configuration · 配置
- Keybindings · 快捷键
- Tools · 工具列表
- Architecture · 架构
- Project Structure · 项目结构
- Development · 开发
- Troubleshooting · 故障排查
- Changelog · 更新日志
- Star History
- License
✨ Highlights · 亮点
| English | 中文 |
|---|---|
| Agentic loop with multi-turn tool calling on DeepSeek V4 (Pro / Flash / Reasoner) | 与 DeepSeek V4(Pro / Flash / Reasoner)多轮tool-calling 循环 |
| File tools: read, write, str-replace, apply_patch, list dir, find files, ripgrep search | 文件工具:读 / 写 / 精准替换 / apply_patch / 列目录 / 查找 / 全文搜索 |
| Shell tool with configurable approval policy | 终端工具,按审批策略弹窗确认 |
| Web search via Tavily (optional API key) | 网络搜索(Tavily,可选 Key) |
| Plan & Todos panel — agent maintains a structured plan you can watch tick off | Plan & Todos 面板,Agent 自维护结构化任务并实时勾选 |
| Revert last turn — one-click rollback of all file edits in the current agent turn | 一键回滚当前 Agent 轮次对文件的所有修改 |
Pending edits panel — GH-Copilot-style review popover above the composer: per-file +N/-M, hover Keep/Discard, click row to open native diff editor; survives turn end |
待审编辑面板—输入框上方弹出 GH Copilot 风格的复检面板:逐文件 +N/-M、悬停保留/丢弃、点击行打开原生 Diff 编辑器;对话结束后仍可继续点击 |
User memory (~/.deepcopilot/memory.md) — cross-project preferences in every system prompt |
用户记忆(~/.deepcopilot/memory.md),跨项目偏好自动注入系统提示词 |
MCP client — connect any MCP-compatible tool server via deepseekAgent.mcp.servers |
MCP 客户端,通过 deepseekAgent.mcp.servers 连接任意 MCP 工具服务器 |
| Post-tool hooks — run scripts after any tool call; output injected into model context | 工具后置钩子,工具调用后自动执行脚本,输出注入模型上下文 |
| Post-edit LSP diagnostics appended to every edit so the model can self-verify | 每次编辑后自动附加LSP 诊断,模型可自行校验 |
| Per-workspace session history with search, rename, delete | 每工作区独立的会话历史,可搜索 / 重命名 / 删除 |
| Parallel sessions — switch away from a running task and start another; live replay on return | 多会话并行:任务跑着可以切走开新对话,回来自动回放进度 |
| Streaming output with reasoning expander, blinking cursor, top progress bar | 流式输出:思维链可展开、闪烁光标、顶部进度条 |
| HTML rendering — model responses render full Markdown + HTML; math via KaTeX | HTML 渲染:响应支持完整 Markdown + HTML + KaTeX 数学公式 |
| Account balance display in footer (click to refresh) | 账户余额实时显示在底栏(点击刷新) |
| Auto-grow input — textarea grows with content, GH Copilot style | 自适应输入框:随内容自动增高,对齐 GH Copilot 体验 |
| Approval modes: Manual / Auto-Edit / Autopilot / Read-Only | 审批模式:手动 / 自动编辑 / 全自动 / 只读 |
| Cost telemetry in CNY shown in the footer | 底栏显示token 数与人民币成本 |
Slash commands (/explain, /fix, /tests …), @ file refs and # context refs — pick #file, #selection, #editor, #problems, #changes, #terminal, #symbol:Foo, #fetch:URL from the input |
斜杠命令 + @ 文件引用 + # 上下文引用(在输入框键入 # 即可挑选文件 / 选区 / 编辑器 / 诊断 / Git 改动 / 终端 / 符号 / 抓取 URL) |
| Smart code-block actions: Run in terminal · Insert · Copy · Fold long blocks | 代码块操作:在终端运行 / 插入 / 复制 / 长代码折叠 |
| Bilingual UI + locale-aware fonts: auto follows VS Code locale (zh-cn / en) — Chinese font stack for CJK, Latin font stack for EN | 中英双语 UI + 语言感知字体:跟随 VS Code 语言自动切换界面文案与字体(中文环境使用微软雅黑/苹方,英文环境使用 Segoe UI/Inter) |
Skills system — define reusable SKILL.md packs in ~/.deepcopilot/skills (or ~/.claude/skills, ~/.copilot/skills); YAML frontmatter for workspace gating, invoke via /skill or the model's skill_invoke tool |
技能系统:在 ~/.deepcopilot/skills 等目录放置 SKILL.md 技能包,支持 YAML 元数据与工作区门控,/skill 命令或 skill_invoke 工具均可唤起 |
Inline FIM completions — DeepSeek ghost-text suggestions as you type; Tab to accept; off by default (deepCopilot.inlineCompletion.enable) |
行内 FIM 补全:基于 DeepSeek 的编辑器幽灵文字建议,Tab 接受;默认关闭,开关:deepCopilot.inlineCompletion.enable |
| Plan mode — read-only investigation mode; agent can read/search but never write or run shell commands | Plan 只读模式:仅允许读文件/搜索,拒绝任何写操作,适合调查代码结构时使用 |
Ecosystem AI-rule discovery — auto-injects DEEPCOPILOT.md, .github/copilot-instructions.md, AGENTS.md, .cursor/rules/*.mdc, CLAUDE.md |
项目规则自动发现:自动注入工作区下的主流 AI 规则文件(GitHub Copilot / Cursor / Claude 等),让模型了解项目约定 |
Context window management (new in 0.41.0) — structure-aware truncation, per-file dedup, rolling summary; /compact [focus] force-compacts, /context opens a token breakdown, /fork [name] branches a new session from any message |
上下文窗口管理 (0.41.0 新增):结构感知截断、同文件去重、滚动摘要;/compact [focus] 立即压缩,/context 查看 token 占用细分,/fork [name] 从任一消息派生新会话 |
Footer context ring (new in 0.41.0) — ring indicator next to the footer ramps green → yellow → orange → red across 60 / 85 / 100% thresholds; click to open the same breakdown as /context |
底部 Context Ring (0.41.0 新增):底栏环形进度指示,按 60% / 85% / 100% 阈值由绿渐变到红;点击展开与 /context 一致的占用细分 |
Archive = pure export (updated in 0.41.6) — "Archive" now writes a Markdown snapshot under .deep-copilot/archives/ and leaves the session alone; old soft-hidden sessions are auto-unarchived on first launch |
存档 = 纯导出 (0.41.6 调整):点「存档」只生成 .deep-copilot/archives/ 下的 Markdown 快照,不再隐藏会话;老版本被隐藏的会话升级后首次启动自动还原。 |
Watchdog turns stay on duty (new in 0.41.6) — when the agent monitors a long-running background job (training, build, dev server) via read_terminal, the turn refuses to end until the job finishes or the 4 h per-turn budget elapses |
值守任务不提前退出 (0.41.6 新增):模型用 read_terminal 盯住某个后台任务(训练 / 构建 / 开发服务)后,turn 不会在“我会持续盯”之后静默断开,直到任务结束或命中 4h 本轮预算 |
🚀 Quick Start · 快速开始
Option 1 — VS Code Marketplace · 从扩展商城安装(推荐)
- Open VS Code → Extensions (
Ctrl/Cmd+Shift+X) → Search Deep Copilot → Install. 打开 VS Code → 扩展面板(Ctrl/Cmd+Shift+X)→ 搜索 Deep Copilot → 安装。
Option 2 — Install the prebuilt VSIX · 安装预构建 VSIX
# 从 GitHub Releases 下载最新版 / Download from GitHub Releases:
# https://github.com/ZhouChaunge/DeepCopilot/releases
code --install-extension deep-copilot-0.41.6.vsix
Or in VS Code: Extensions view → ⋯ menu → Install from VSIX... and pick the file.
或在扩展面板右上角 ⋯ → Install from VSIX... 选择文件。
Step 2 — Set the API key · 配置 API Key
- Click the 🐋 Deep Copilot icon in the activity bar to open the chat panel.点击活动栏中的 🐋 Deep Copilot 图标,打开聊天面板。
- Click the 🔑 button at the bottom right of the panel, paste your DeepSeek API key.点击面板右下角 🔑 按钮,粘贴你的 DeepSeek API Key。
- Start chatting! 开始对话!
🛠 Build from Source · 源码构建
Prerequisites · 前置依赖
| Tool | Version | Note |
|---|---|---|
| Node.js | ≥ 18 | esbuild + vsce |
| npm | ≥ 9 | comes with Node |
| VS Code | ≥ 1.95 | extension host |
| Git | any | optional, to clone |
Steps · 构建步骤
# 1. Clone the repo · 克隆仓库
git clone https://github.com/ZhouChaunge/DeepCopilot.git
cd DeepCopilot
# 2. Install dependencies · 安装依赖
# (only devDependencies: esbuild + vsce + @types — runtime is pure VS Code API)
# (只有开发依赖;运行时仅用 VS Code API,无运行时 npm 依赖)
npm install
# 3. Build the bundle · 编译为单文件
npm run build
# -> outputs out/extension.js (~105 KB minified)
# -> 产出 out/extension.js(约 105 KB,已压缩)
# 4. Package as VSIX · 打包 VSIX
npm run package
# -> outputs deep-copilot-0.41.6.vsix
# -> 产出 deep-copilot-0.41.6.vsix
# 5. Install locally · 本地安装
code --install-extension deep-copilot-0.41.6.vsix --force
Watch mode · 监听模式(开发期)
npm run watch
# Rebuilds out/extension.js on every src/ change.
# 修改 src/ 任何文件即增量重建 out/extension.js。
# Then: F5 in VS Code (with the repo opened) launches the Extension Development Host.
# 然后在 VS Code 里按 F5 启动“扩展开发宿主”加载本地构建。
What gets built · 构建产物说明
| Path | Tracked? | Purpose |
|---|---|---|
src/ |
✅ yes | Source modules (entry:src/extension.js) · 源码(入口 src/extension.js) |
media/ |
✅ yes | Webview assets (chat.css / chat.js / icons) · Webview 静态资源 |
esbuild.config.js |
✅ yes | Bundler config · 打包配置 |
package.json |
✅ yes | Manifest + scripts · 清单与脚本 |
package-lock.json |
✅ yes | Locked dep versions · 锁定依赖版本 |
out/extension.js |
❌ ignored | Built bundle (regenerated by npm run build) · 构建产物 |
release/*.vsix |
❌ ignored | Packaged extension (regenerated by npm run package) · 打包后的 VSIX |
node_modules/ |
❌ ignored | npm cache · npm 依赖缓存 |
🇬🇧 Everything required to compile is in the repo.
out/and*.vsixare reproducible artifacts. 🇨🇳 编译所需文件全部在仓库里。out/和*.vsix是可重现的产物,已.gitignore。
⚙️ Configuration · 配置
All settings live under the deepseekAgent.* namespace in settings.json.
所有设置都在 settings.json 的 deepseekAgent.* 命名空间下。
| Setting | Default | EN | 中文 |
|---|---|---|---|
deepseekAgent.defaultModel |
deepseek-v4-pro |
Default model | 默认模型(deepseek-v4-pro / deepseek-v4-flash / deepseek-reasoner) |
deepseekAgent.apiBaseUrl |
(empty → api.deepseek.com) |
API endpoint | API 入口(国内可填 https://api.deepseeki.com) |
deepseekAgent.approvalMode |
manual |
Tool-call approval policy | 工具调用审批策略 |
deepseekAgent.interactionMode |
agent |
agent / ask |
交互模式(Agent 可调工具,Ask 纯聊天) |
deepseekAgent.autoApproveTools |
[] |
Tool names to always allow | 始终自动允许的工具名 |
deepseekAgent.denyTools |
[] |
Tool names to always deny | 始终拒绝的工具名 |
deepseekAgent.maxIterations |
15 |
Hard ceiling on tool-call rounds | 单次发送的工具调用迭代上限 |
deepseekAgent.compactBudgetTokens |
600000 |
Token budget before auto-compaction | 自动压缩历史前的 token 预算 |
deepseekAgent.postEditDiagnostics |
true |
Append LSP diagnostics after every file edit | 每次编辑后追加 LSP 诊断结果 |
deepseekAgent.mcp.servers |
[] |
MCP server list (see MCP section below) | MCP 工具服务器列表(见下方 MCP 小节) |
deepseekAgent.enableDebugLog |
true |
Log thought / tool / API events to .deep-copilot/logs/ |
写思维链 / 工具 / API 事件日志 |
Approval Modes · 审批模式
| Mode | EN behavior | 中文行为 |
|---|---|---|
| manual | Prompt every write_file / run_shell (safest, default) |
每次写文件或执行命令都弹窗(默认) |
| auto-edit | Auto-approve writes; still prompt for shell | 写文件自动通过;Shell 仍需确认 |
| autopilot | Auto-approve everything (trusted workspaces only) | 全部自动通过(仅适合受信任工作区) |
| readonly | Deny all writes & shell | 仅允许只读,禁止任何修改 |
Issue #89 · Autopilot 与危险命令:
autopilot模式下,命中危险命令正则(rm -rf、git reset --hard、git push --force…)的 shell 调用会静默放行,并写入SHELL_DANGER_AUTO_APPROVE审计日志,不再弹模态确认框;其他模式中,同一条命令在一次会话内被批准过一次后也会缓存,不会重复弹框。若把run_shell加入autoApproveTools,效果等同于显式承担 shell 风险,请仅在受信任工作区开启。
⌨️ Keybindings · 快捷键
| Key | EN | 中文 |
|---|---|---|
Ctrl/Cmd+Shift+D |
Open sidebar | 打开侧边栏 |
Ctrl/Cmd+Shift+L |
Open in tab | 在标签页中打开 |
Enter |
Send message | 发送消息 |
Shift+Enter |
Newline | 换行 |
Esc |
Stop generation | 停止生成 |
Ctrl/Cmd+K |
Clear current chat | 清空当前会话 |
↑ / ↓ (empty input) |
Recall prompt history | 召回历史 prompt |
↑ / ↓ (slash menu open) |
Navigate suggestions | 切换候选项 |
Tab / Enter (slash menu) |
Apply suggestion | 应用候选项 |
🧰 Tools · 工具列表
Deep Copilot exposes a small, deliberately-minimal tool set to the model: Deep Copilot 给模型暴露的工具集刻意保持精简:
| Tool | EN description | 中文说明 |
|---|---|---|
read_file |
Read part / all of a file with optional line range | 按行号区间读取文件 |
write_file |
Create or overwrite a file (gated by approval) | 新建 / 覆盖文件(受审批控制) |
str_replace_in_file |
Targeted in-place edit by exact string match | 通过字符串精确替换原地编辑 |
apply_patch |
Apply a unified-diff patch (multi-hunk, multi-file) | 应用统一格式补丁(多 hunk / 多文件) |
list_dir |
List directory entries (depth-limited) | 列出目录(限制深度) |
find_files |
Glob-pattern file search | Glob 模式文件搜索 |
grep_search |
Ripgrep-style regex search across the workspace | 工作区级正则搜索 |
run_shell |
Run a shell command (gated by approval) | 执行 Shell 命令(受审批控制) |
web_search |
Web search via Tavily (requires Tavily API key) | 网络搜索(需 Tavily Key) |
update_plan |
Push / update structured plan & todos to left panel | 更新左侧 Plan / Todos |
open_file_in_editor |
Reveal a file at a given line in the editor | 在编辑器中打开文件并跳到指定行 |
revert_last_turn |
Restore all files to their pre-turn state | 将本轮所有文件修改回滚到初始状态 |
mcp__<server>__<tool> |
Any tool exposed by a connected MCP server | 已连接 MCP 服务器暴露的任意工具 |
🇬🇧 Tool definitions live in
src/tools/schema.js; execution insrc/tools/exec.js.🇨🇳 工具定义见
src/tools/schema.js,执行实现见src/tools/exec.js。
🏗️ Architecture · 架构
┌──────────────────────────────────────────────────────────┐
│ VS Code Extension Host │
│ │
│ ┌────────────────────────────────────────────────────┐ │
│ │ src/extension.js (activate / commands) │ │
│ └────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌────────────────────────────────────────────────────┐ │
│ │ src/chat/provider.js (ChatViewProvider) │ │
│ │ • Webview ↔ Extension message bus │ │
│ │ • Per-session run map (parallel sessions) │ │
│ │ • Persisted history (globalState) │ │
│ │ • Plan / Todos state │ │
│ └────────────────────────────────────────────────────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌──────────────────┐ ┌────────────────────────┐ │
│ │ src/api/ │ │ src/tools/ │ │
│ │ deepseek.js │ │ schema.js (defs) │ │
│ │ • SSE streaming │ │ exec.js (runtime) │ │
│ │ • Tool calls │ │ • read/write/list │ │
│ │ • Reasoning │ │ • grep / shell │ │
│ └──────────────────┘ │ • approval gating │ │
│ └────────────────────────┘ │
│ │
│ ┌────────────────────────────────────────────────────┐ │
│ │ src/webview/html.js (HTML shell injected) │ │
│ │ media/chat.js + chat.css (UI runtime + styles) │ │
│ └────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────┘
│ HTTPS (SSE)
▼
┌────────────────────────┐
│ DeepSeek Platform │
│ api.deepseek.com │
│ (OpenAI-compatible) │
└────────────────────────┘
Key design points · 关键设计
- 🇬🇧 No backend. Everything runs inside the VS Code extension host. The single bundle
out/extension.jsis approx 94 KB. 🇨🇳 无后端。 全部跑在 VS Code 扩展主机里,单文件构建产物out/extension.js仅约94KB。 - 🇬🇧 Per-session run map.
provider._runs: Map<sessionId, Run>lets you switch sessions while a task is running; the run keeps producing events that get buffered and replayed when you return. 🇨🇳 按会话隔离的 run 表。provider._runs让你在任务跑着时切到别的会话,事件继续缓冲,切回来自动回放。 - 🇬🇧 Streaming via SSE.
src/api/deepseek.jsparsesdata:frames and forwardsdelta,reasoning,tool_calls,usageto the provider. 🇨🇳 SSE 流式。src/api/deepseek.js解析data:帧,把delta/reasoning/tool_calls/usage转发给 provider。 - 🇬🇧 Auto-compaction. Once estimated tokens exceed
compactBudgetTokens, older tool results are dropped before the next round. 🇨🇳 自动压缩。 估算 token 超过compactBudgetTokens时,下一轮前丢弃较老的工具结果。 - 🇬🇧 Approval is enforced server-side (in the extension), not just UI. A model-issued
write_filewill not execute unless the policy or user explicitly allows it. 🇨🇳 审批在扩展端强制执行(不仅是 UI 层):模型发出的write_file必须经策略或用户放行才会真的写盘。
📁 Project Structure · 项目结构
.
├── esbuild.config.js # esbuild bundler config · 打包配置
├── package.json # extension manifest + scripts · 清单与脚本
├── package-lock.json # locked deps · 锁定依赖
├── README.md # this file · 本文件
├── LICENSE # MIT
├── media/ # webview assets (loaded as static files)
│ ├── chat.css # ↳ all UI styles · 全部 UI 样式
│ └── chat.js # ↳ webview runtime (markdown, tool cards, streaming)
├── imgs/
│ ├── logo_black_bg.png # ↳ extension icon + webview logo
│ ├── logo_black_bg.svg # ↳ activity bar icon (vector)
│ ├── logo.png # ↳ marketplace icon (white background)
│ ├── logo_white_bg.svg # ↳ activity bar icon (white variant)
│ ├── logo_white_bg.png # ↳ logo (base)
│ └── screenshot.png # README screenshot · README 截图
└── src/ # extension source · 扩展源码
├── extension.js # ↳ activate() entry · 入口
├── errors.js # ↳ error → friendly bilingual card
├── logger.js # ↳ debug log writer (.deep-copilot/logs/)
├── pricing.js # ↳ token → CNY cost calculator
├── hooks.js # ↳ post-tool hooks runner (.deepcopilot/hooks.json)
├── mcp.js # ↳ MCP stdio client (McpClient + McpManager)
├── api/
│ └── deepseek.js # ↳ SSE chat client (OpenAI-compatible)
├── chat/
│ ├── provider.js # ↳ ChatViewProvider (the brain)
│ └── openFile.js # ↳ "open file at line" helper
├── prompts/
│ └── system.js # ↳ system prompt builder (+DEEPCOPILOT.md +user memory)
├── tools/
│ ├── schema.js # ↳ tool JSON-schema definitions
│ └── exec.js # ↳ tool runtime (file IO, ripgrep, shell)
├── utils/
│ ├── i18n.js # ↳ zh-cn / en strings + locale detection
│ └── paths.js # ↳ path safety / workspace root resolution
└── webview/
└── html.js # ↳ generates the webview HTML shell
🇨🇳 编译入口:
src/extension.js→ esbuild →out/extension.js(package.json 中main字段指向out/extension.js)。🇬🇧 Build entry:
src/extension.js→ esbuild →out/extension.js(referenced bymaininpackage.json).
💻 Development · 开发
Run the dev host · 启动扩展开发宿主
git clone https://github.com/ZhouChaunge/DeepCopilot.git
cd DeepCopilot
npm install
code .
# Press F5 inside VS Code → Extension Development Host opens
# 在 VS Code 里按 F5 → 弹出扩展开发宿主窗口
Live edit cycle · 改一改试一试
npm run watch # esbuild watch — rebuilds on save · 保存即重建
# In the dev host: Ctrl+R / Cmd+R reloads the window after a rebuild
# 在宿主窗口里按 Ctrl+R / Cmd+R 重载即可看到效果
Debug logs · 调试日志
- Output panel → Deep Copilot channel Output 面板 → 选择 Deep Copilot 频道
- Or open via command palette:
Deep Copilot: Open Debug Log或命令面板:Deep Copilot: Open Debug Log - Files:
<workspace>/.deep-copilot/logs/session-*.log日志文件:<工作区>/.deep-copilot/logs/session-*.log
Workspace-specific instructions · 工作区级提示词
Create a DEEPCOPILOT.md at the workspace root and Deep Copilot will inject its content into the system prompt for every request in this workspace — useful for project conventions, build commands, "do/don't" lists.
在工作区根目录新建 DEEPCOPILOT.md,其内容会自动并入系统提示词,用来声明项目约定、构建命令、do/don't 等。
User memory · 用户记忆
Create ~/.deepcopilot/memory.md for cross-project preferences that apply everywhere — preferred coding style, always/never rules, personal shortcuts. It is injected (capped at 4 KB) into every system prompt.
在家目录新建 ~/.deepcopilot/memory.md,写入跨项目的个人偏好(代码风格、禁忌事项等),Deep Copilot 会在每次对话时自动注入(最多 4KB)。
MCP servers · MCP 工具服务器
Add external tool servers via VS Code settings:
"deepseekAgent.mcp.servers": [
{ "name": "my-db", "command": "npx", "args": ["my-db-mcp-server"] }
]
Tools appear as mcp__my-db__<toolName> alongside built-in tools. Any MCP-compatible stdio server works.
通过 VS Code 设置连接外部 MCP 工具服务器,工具以 mcp__<server>__<toolName> 格式出现。任何兼容 MCP stdio 协议的服务器均可接入。
Post-tool hooks · 工具后置钩子
Create .deepcopilot/hooks.json in your workspace:
{ "hooks": [
{ "event": "after_tool", "tool": "write_file",
"run": "npm test", "on_failure": "inject_error", "timeout_ms": 30000 }
]}
The hook's stdout/stderr is appended to the tool result so the model can react — e.g., auto-fix test failures immediately after writing a file.
在工作区创建 .deepcopilot/hooks.json,每次写文件后自动跑 npm test,测试输出注入模型上下文让其自动修复。
Style & conventions · 代码风格
- Plain JavaScript (no TypeScript) — keep the bundle tiny. 纯 JavaScript(不用 TypeScript),保持产物极小。
- No runtime dependencies — only VS Code API + Node built-ins. 无运行时依赖,只用 VS Code API 与 Node 内置模块。
- Webview side communicates via
postMessage; never importsvscode. Webview 端通过postMessage通信,不引用vscode。
🔧 Troubleshooting · 故障排查
| Symptom · 症状 | English Fix | 中文解决 |
|---|---|---|
请先设置 API Key toast |
Click 🔑 in the bottom-right of the panel | 点面板右下角 🔑 粘贴 Key |
| 401 / 403 errors | Key invalid or revoked — regenerate at platform.deepseek.com | Key 失效,到 platform.deepseek.com 重新生成 |
| 402 errors | Account out of balance — top up | 账户余额不足,请充值 |
| 429 errors | Rate-limited; retry button is shown on the error card | 触发限流,点错误卡上的 🔄 重试 |
| Connection timeouts in mainland China | Switch base URL to https://api.deepseeki.com |
切到 https://api.deepseeki.com |
| UI still shows "思考中" | Old VSIX still installed — install the new one with --force |
装新版用 --force 覆盖旧版 |
| Tools not being called | You may be in Ask mode — switch to Agent in the header |
当前是 Ask 模式,切到 Agent |
| Hangs mid-task | Click ⏹ Stop or press Esc; check Debug Log |
点 ⏹ 或按 Esc 停止;查看调试日志 |
| Status bar "Deep Copilot" missing | Right-click the status bar → enable "Deep Copilot" | 右键状态栏 → 勾选 "Deep Copilot" |
📜 Changelog · 更新日志
v0.41.6 — Archive 纯导出 · 值守任务不提前退出
- 中文:①Issue #169:Archive 语义改为「纯导出」——点「存档」只会在
.deep-copilot/archives/下生成 Markdown 快照,会话本身保持原状(不再软隐藏、不会被切走、同一会话连点两次会生成两个 md);出错或取消保存不再错误地改动archived状态。另加一次性迁移_migrateArchivedFlagIfNeeded:由globalState['deepseekAgent.archiveSemanticsV2Migrated']守护,升级后首次启动自动把旧版本软隐藏的会话全部还原到侧边栏,失败走Logger.info('ARCHIVE_V2_MIGRATION_FAILED', ...),不阻塞激活。②值守任务不提前退出——在之前的状态下,如果后台任务(例如训练)是在更早的 turn 启动的,BG_WAIT_SKIPPED_MODEL_DONE守卫会在模型说完「我会持续监控」之后立刻结束会话。本版本新增run._monitoredBgJobs跟踪集:模型调用read_terminal(terminal: "deepseek-job-*")读取某个后台任务后,该 jobId 被记为「当前运行在主动监控」;agent-loop 的提前退出守卫同时检查该集合,只要被监控的 bg job 仍在跑,turn 就会继续等待、走快照,直到任务结束事件抵达或命中 4h 本轮预算。③迁移错误调用Logger(取代console.warn),为deepseekAgent.enableDebugLog下的 Deep Copilot Debug 输出面板补齐一致的错误上下文。④.vscodeignore补上.tmp-*.json/.txt/.md过滤,防止 PR 评论缓存等临时文件被打进 VSIX。 - English: ①Issue #169 — Archive becomes pure export: clicking "Archive" only writes a Markdown snapshot under
.deep-copilot/archives/and leaves the session completely untouched (no more soft-hide, no more current-session-swap, clicking twice on the same session simply produces two snapshots); failure paths and save-dialog cancellation no longer mutatearchivedstate. A one-shot idempotent migration_migrateArchivedFlagIfNeeded(guarded byglobalState['deepseekAgent.archiveSemanticsV2Migrated']) flips every legacyarchived: truesession back tofalseon first launch so previously-hidden sessions reappear in the sidebar. Failure routes throughLogger.info('ARCHIVE_V2_MIGRATION_FAILED', ...)instead of blocking activation. ②Watchdog turn stays on duty: when a background job (training, build, dev server) was started in an earlier turn,run._sessionStartedBgJobsis empty in the current turn, so theBG_WAIT_SKIPPED_MODEL_DONEguard used to terminate the conversation right after the model promised to keep monitoring. The agent now tracks everydeepseek-job-*terminal the model inspects viaread_terminalinrun._monitoredBgJobs; the agent-loop guard refuses to end the turn while any such monitored job is still alive, so the loop keeps polling and emitting 4-minute snapshots until the job finishes or the 4 h per-turn budget elapses. ③Routes migration failures throughLogger(replacingconsole.warn) so diagnostics respectdeepseekAgent.enableDebugLogand surface in the "Deep Copilot Debug" output channel. ④.vscodeignorenow filters.tmp-*.json/.txt/.md, preventing local PR-review scratch caches from accidentally leaking into the shipped VSIX.
v0.41.0 — Context Window 优化套件 · 会话切换闪屏修复
- 中文:①Issue #142:上下文窗口管理重构——结构感知截断(保留最新工具结果完整内容,旧轮次保留摘要骨架);同文件多次读取自动去重(仅保留最后一次完整内容,先前版本折叠为
<file path=... read-collapsed='true'/>占位);超阈值时启用滚动摘要(rolling summary)按需调用模型把更早的对话压缩成结构化摘要节点;MCP 工具支持 per-server 显式 opt-out;大文件读取附带 read-large-file hint 提醒模型按需 grep 而非整文件读入。②新增三个斜杠命令:/compact [focus]立即压缩当前会话历史(可附主题词偏置摘要方向,自动读取.deepcopilot/compact.md或CLAUDE.md作为项目级 compact 指令);/context弹出当前会话的 token 占用细分(system / messages / tools / files / hints);/fork [name]把当前会话从某条消息派生为新会话,保留上下文起点。③底部 Context Ring 指示器:替换原状态点(#foot .dot),在底部状态栏右下角新增环形进度(#ft-ctx),颜色随上下文占用阈值<60%绿 →<85%黄 → 橙 → 红渐变;点击展开 popover 显示与/context一致的细分;事件源ctxUsage来自 agent-loop 每轮回写。④Issue #143:会话切换闪屏 / 滚动条抖动修复——切走再切回正在运行的会话时,缓冲事件被同步重放,每个事件触发一次requestAnimationFrame滚动,导致明显闪烁。修复:_loadSession用setTimeout(..., 0)把事件重放推到下一个宏任务,并以replayStart/replayEnd信封包裹;webview 端新增_replaying标志,在重放期间ascroll()静默,结束时一次性滚到底。⑤Anthropic / OpenAI 客户端小幅清理;errors.js文案微调;file-read.js增加大文件提示输出;session-store.js适配 rolling summary 节点的持久化与回放。 - English: ①Issue #142 — context-window overhaul: structure-aware truncation (latest tool results kept verbatim, older turns collapsed to summary skeletons); per-file dedup (multiple reads of the same path keep only the latest payload; earlier ones become
<file path=... read-collapsed='true'/>placeholders); rolling-summary fallback that compresses older history into structured summary nodes when thresholds are crossed; MCP tools support per-server explicit opt-out; large-file reads now ship aread-large-filehint nudging the model to grep first. ②Three new slash commands:/compact [focus]force-compacts the active session (focus biases the summarisation; merges project-level.deepcopilot/compact.md/CLAUDE.mdhints);/contextopens a breakdown popover (system / messages / tools / files / hints);/fork [name]forks the current session from a message into a brand-new one with that context as origin. ③Footer context ring: replaces the legacy status dot with a ring indicator (#ft-ctx) whose colour ramps green → yellow → orange → red across 60/85/100% thresholds; click opens the same breakdown shown by/context. ④Issue #143 — session-switch flash / scrollbar jitter: switching away from and back to a running session previously replayed buffered events in a tight loop, each one scheduling its own RAF scroll-to-bottom. Fix:_loadSessiondefers replay viasetTimeout(..., 0)and wraps the burst withreplayStart/replayEndenvelopes; the webview adds a_replayingflag that silencesascroll()during the burst and performs a single final scroll onreplayEnd. ⑤Minor cleanups in the Anthropic / OpenAI clients,errors.jscopy tweaks,file-read.jslarge-file notice, andsession-store.jsadapts to persist / replay rolling-summary nodes correctly.
v0.40.4 — Pending Edits Panel · 待审编辑面板
- 中文:①新增「待审编辑」面板:参考 GitH
No comments yet
Be the first to share your take.