Skip to content

Commit cff6d47

Browse files
Merge upstream/main into feat/atlascloud-provider
Resolve conflicts in packages/core settings.ts and index.ts: keep the upstream choose()-based source tracing and wire the Atlas Cloud default model/base URL and ATLASCLOUD_API_KEY fallback into it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: binyangzhu000-sudo <224954946+binyangzhu000-sudo@users.noreply.github.com>
2 parents 8b503e1 + 02cefcc commit cff6d47

243 files changed

Lines changed: 30150 additions & 3213 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.deepcode/AGENTS.md‎

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22

33
## Project Structure & Module Organization
44

5-
npm workspaces monorepo under `packages/`.
5+
npm workspaces monorepo under `packages/`:
66

7-
- `packages/core/src/` — `session.ts` (LLM loop, streaming, retry, compaction), `tools/` (10 handlers), `common/` (permissions, OpenAI client, model capabilities, file history), `mcp/`, `templates/`.
8-
- `packages/cli/src/` — Ink/React terminal UI (`cli.tsx`, `ui/views`, `ui/components`, `ui/core`, `ui/hooks`); `packages/vscode-ide-companion/` — VSCode companion.
9-
- `docs/` — user docs; `scripts/` — build/release tooling; `dist/` — bundled output (gitignored).
7+
- `packages/core/src/` — `session.ts` (LLM loop, retry, compaction), `tools/` (10 handlers), `common/` (permissions, OpenAI client, PLUS routing, sessions), `mcp/`, `templates/`.
8+
- `packages/cli/src/` — Ink/React TUI (`ui/`), `exec-runner.ts`, `doctor.ts`, `plus-setup.ts`.
9+
- `packages/vscode-ide-companion/` — VSCode extension. `docs/` — user docs; `scripts/` — build/release; `dist/` — gitignored output.
1010

1111
## Build, Test, and Development Commands
1212

13-
- `npm run check` — typecheck/lint/format check; `npm test` — all workspace tests.
14-
- `npm run build` — full build; `npm run bundle` — esbuild bundle + git info; `npm run start` — run the built CLI.
15-
- Single test: `node packages/core/src/tests/run-tests.mjs packages/core/src/tests/session.test.ts`.
13+
- `npm run check` — typecheck, lint, and Prettier check.
14+
- `npm test` — all workspace tests.
15+
- `npm run build` / `npm run build:vscode` — build the CLI / extension; `npm start` runs the bundle.
16+
- Single test: `node --import tsx --test packages/core/src/tests/session.test.ts`.
17+
- Release: `npm run release:version -- <bump>`, then `npm run prepare:package` / `npm run prepare:vscode` (`RELEASE.md`; v0.4.5).
1618

1719
## Coding Style & Naming Conventions
1820

@@ -22,27 +24,26 @@ npm workspaces monorepo under `packages/`.
2224

2325
## Testing Guidelines
2426

25-
- Node native test runner (`node:test`) via `tsx`; assertions with `node:assert/strict`.
26-
- Tests live in `packages/*/src/tests/`, named after the source module. Run `npm test` before PRs.
27+
- Node native test runner (`node:test`) via `tsx` with `node:assert/strict`, invoked by each package's `run-tests.mjs`.
28+
- Tests live in `packages/*/src/tests/`, named after the source module; run `npm test` before PRs. No coverage gate.
2729

2830
## Commit & Pull Request Guidelines
2931

3032
- Conventional commits: `feat:`, `fix:`, `chore:`, `refactor:`, `style:`, `test:`, `docs:`, `perf:`, `build:`.
31-
- PRs: clear description, linked issues, UI screenshots, passing `npm run check && npm test`, no unintended `dist/`/`package-lock.json` changes.
33+
- PRs: clear description, linked issues, screenshots for UI changes, passing `npm run check && npm test`, no unintended `dist/` or lockfile changes.
3234

3335
## Architecture Overview
3436

35-
- `@vegamo/deepcode-cli` (Ink TUI) uses `SessionManager` (`@vegamo/deepcode-core`) to drive the LLM loop: prompts, streaming preview, tools, retry, compaction.
36-
- Connectivity: `createOpenAIClient()` (180s keep-alive) with DeepCode Plus fallback; `describeLlmError()` normalizes errors.
37-
- Tools: 10 built-ins — `bash`, `read`, `write`, `edit`, `skill`, `AskUserQuestion`, `UpdatePlan`, `WebSearch`, `ReadImage`, `UnderstandImage`; `read` returns a `snippet_id` for `edit`.
38-
- Images: `supportsMultimodal()` + `multimodal` choose `ReadImage` vs `UnderstandImage`; `filesApiEnabled` uploads via the DeepSeek Files API.
39-
- Permissions: 12 scopes incl. `read-in-tmp`/`write-in-tmp`; `addWorkingDirs` extends the workspace; `file-history.ts` provides undo.
40-
- Models: default `deepseek-flash` (V4.1 Flash); `/model` offers `deepseek-flash`, `deepseek-v4-pro`, `deepseek-v4-flash`, `deepseek-v4-flash-vision-exp` with thinking effort `low`/`high`/`max`.
41-
- Slash commands: `/skills`, `/model`, `/plan`, `/new`, `/init`, `/resume`, `/fork`, `/continue`, `/undo`, `/mcp`, `/raw`, `/exit`, plus dynamic `/skill-name`. Plan Mode gates writes behind `<proposed_plan>` approval.
42-
- CLI flags: `-p`, `-x`, `-r`, `-f`, `-l`, `-v`, `-h`.
37+
- `@vegamo/deepcode-cli` (Ink TUI) drives the LLM loop via `SessionManager` (`@vegamo/deepcode-core`) over a 180s keep-alive `createOpenAIClientFactory()`.
38+
- Built-in tools (10): `bash`, `read`, `write`, `edit`, `skill`, `AskUserQuestion`, `UpdatePlan`, `WebSearch`, `ReadImage`, `UnderstandImage`. `read`/`write` return a `snippet_id`; `edit` requires it, and edit/write results include diff previews. `bash` bounds output; `run_in_background` detaches work; new files follow Git `eol`.
39+
- 12 permission scopes with session-only grants; `/permissions` edits settings, and model dialogs choose user/project scope. `addWorkingDirs` extends the workspace; file history enables undo.
40+
- Default model `deepseek-flash`; `/model` offers `deepseek-v4-pro`, `deepseek-v4-flash`, `deepseek-v4-flash-vision-exp` with thinking effort `max`/`high`/`low`/off.
41+
- PLUS (`common/plus-subscription.ts`): `~/.deepcode-plus/settings.json` stores `subscriptionPlan` (`default`/`on`/`off`) and `env.PLUS_API_KEY` (`sk-` + 24/26 chars). 24-char keys use `deepcode.vegamo.cn`, 26-char use `www.deepcodeplus.com` (LLM `chat.deepcodeplus.com`); shared by web search, image understanding, and telemetry. Configure via `--plus`.
42+
- Sessions persist as JSONL with auto-generated titles mirrored in the terminal title. Compaction uses `autoCompactWindow`, `retainRatio` (default 0.16) or `retainTokens`; `/compact` runs it.
43+
- New CLI options: `--doctor`, `-s/--settings`, `--session-id`, `--json` (with `-x`); new commands: `/permissions`, `/compact`; Plan Mode gates writes behind `<proposed_plan>`.
4344

4445
## Agent-Specific Instructions
4546

46-
- AGENTS.md loads from `./.deepcode/AGENTS.md`, `./AGENTS.md`, then `~/.deepcode/AGENTS.md` (first found wins).
47-
- Skills load from `./.deepcode/skills`, `./.agents/skills`, or `~` equivalents; call the `skill` tool. Bundled: `deepcode-self-refer`, `image-generator`, `video-generator`, `skill-digester`, `skill-writer`.
47+
- AGENTS.md loads from `./.deepcode/AGENTS.md`, `./AGENTS.md`, then `~/.deepcode/AGENTS.md` (first wins).
48+
- Skills load from `./.deepcode/skills`, `./.agents/skills`, or `~` equivalents via the `skill` tool. Bundled: `deepcode-self-refer`, `image-generator`, `video-generator` (+`references/`, `scripts/`), `skill-digester`, `skill-writer`.
4849
- File references: `@path/to/file`.

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
build-and-test:
1010
name: Node ${{ matrix.node-version }} / ${{ matrix.os }}
1111
runs-on: ${{ matrix.os }}
12+
timeout-minutes: 20
1213

1314
strategy:
1415
fail-fast: false

‎README-en.md‎

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Create `~/.deepcode/settings.json`:
3636
```json
3737
{
3838
"env": {
39-
"MODEL": "deepseek-v4-pro",
39+
"MODEL": "deepseek-flash",
4040
"BASE_URL": "https://api.deepseek.com",
4141
"API_KEY": "sk-..."
4242
},
@@ -77,7 +77,11 @@ Skills are discovered from these locations, in priority order:
7777
| `/resume` | Choose a previous conversation to continue |
7878
| `/fork` | Fork the current conversation |
7979
| `/continue` | Continue the active conversation or pick one to resume |
80+
| `/compact` | Manually compact the current conversation context |
81+
| `/copy` | Copy the last assistant response's text to the clipboard |
8082
| `/model` | Switch model, thinking mode, and reasoning effort |
83+
| `/experimental` | Configure experimental features, such as reasoning summaries |
84+
| `/permissions` | Configure tool permissions |
8185
| `/raw` | Toggle display mode (Normal / Lite / Raw scrollback) |
8286
| `/init` | Initialize an AGENTS.md file (LLM project instructions) |
8387
| `/skills` | List available skills |
@@ -89,13 +93,15 @@ Skills are discovered from these locations, in priority order:
8993
|------------------|----------------------------------------------------------|
9094
| `Enter` | Send the prompt |
9195
| `Shift+Enter` | Insert a newline (also `Ctrl+J`) |
92-
| `Ctrl+V` | Paste an image from the clipboard |
96+
| `Ctrl+V` | Paste an image from the clipboard (`Alt+V` on Windows) |
97+
| `Ctrl+Y` | Copy input text to clipboard |
98+
| `Ctrl+R` | Search user input in the current and previous sessions |
9399
| `Esc` | Interrupt the current model turn |
94100
| `Ctrl+D` twice | Quit Deep Code |
95101

96102
## Supported Models
97103

98-
- `deepseek-flash` (Recommended)
104+
- `deepseek-flash` (V4.1 Flash, recommended)
99105
- `deepseek-v4-pro`
100106
- `deepseek-v4-flash`
101107
- `deepseek-v4-flash-vision-exp`
@@ -117,33 +123,25 @@ Yes. Deep Code offers a full-featured VSCode extension, available on the [VSCode
117123

118124
### Does Deep Code support understanding images?
119125

120-
Yes. The `deepseek-flash` model can read local images directly, or you can paste images from the clipboard with `Ctrl+V`, so the model can see the image content directly.
126+
Yes. The `deepseek-flash` model can read local images directly, or you can paste images from the clipboard with `Ctrl+V` (`Alt+V` on Windows), so the model can see the image content directly.
121127

122128
Non-multimodal models such as `deepseek-v4-pro` and `deepseek-v4-flash` continue to use the `UnderstandImage` image-understanding tool. Deep Code detects model capabilities automatically; you can also override the detection with the `multimodal` setting.
123129

124130
By default, images are sent inline as base64. With `filesApiEnabled`, Deep Code uploads images through the DeepSeek Files API and reuses the `file_id` in subsequent requests. See [docs/configuration_en.md](docs/configuration_en.md#deepseek-files-api).
125131

126-
### How to automatically send a Slack message after a task completes?
127-
128-
Write a shell notification script that calls a Slack webhook, then set the `notify` field in `~/.deepcode/settings.json` to the full path of the script. For detailed steps, see [docs/notify_en.md](docs/notify_en.md).
129-
130132
### How do I enable web search?
131133

132-
Deep Code now supports native web search through the [DeepSeek Responses API](https://api-docs.deepseek.com/guides/responses_api/#tools). If you prefer to use a custom script for web search, set the `webSearchTool` field in `~/.deepcode/settings.json` to the full path of your script. For detailed steps, refer to: https://github.com/qorzj/web_search_cli
134+
Deep Code supports the [official DeepSeek web search](https://api-docs.deepseek.com/guides/search) — set `deepseekSearchApiEnabled` to `true` in `~/.deepcode/settings.json` to enable it. If you prefer to use a custom script for web search, set the `webSearchTool` field in `~/.deepcode/settings.json` to the full path of your script. For detailed steps, refer to: https://github.com/qorzj/web_search_cli
133135

134136
### Does it support Coding Plan?
135137

136-
Yes. Just set `env.BASE_URL` in `~/.deepcode/settings.json` to an OpenAI-compatible API endpoint. Take Volcano Ark's Coding Plan as an example:
138+
Yes. Just set `env.BASE_URL` in `~/.deepcode/settings.json` to an OpenAI-compatible API endpoint.
137139

138-
```json
139-
{
140-
"env": {
141-
"MODEL": "ark-code-latest",
142-
"BASE_URL": "https://ark.cn-beijing.volces.com/api/coding/v3",
143-
"API_KEY": "**************"
144-
},
145-
"thinkingEnabled": true
146-
}
140+
If you have a [DeepCode Plus subscription](https://www.deepcodeplus.com/plus/plan), run `deepcode --plus`, paste your API Key and press Enter. The CLI will save the configuration automatically:
141+
142+
```bash
143+
$ deepcode --plus
144+
DeepCode Plus API Key: sk-··· (paste and press Enter)
147145
```
148146

149147
### How do I configure MCP?
@@ -154,14 +152,20 @@ For detailed setup instructions, see: [docs/mcp.md](docs/mcp.md)
154152

155153
### How to configure Deep Code to send notifications after a task completes?
156154

157-
When the AI assistant completes a task, Deep Code can automatically execute a notification script to send the task results to the specified channel (e.g., Slack, system notifications, etc.).
155+
Set the `notify` field in `~/.deepcode/settings.json` to the full path of an executable notification script. After the AI assistant completes a task, Deep Code runs the script to send a message to a channel such as Slack or display a system notification.
158156

159157
For detailed configuration instructions, see: [docs/notify_en.md](docs/notify_en.md)
160158

161159
### Does Deep Code only support YOLO mode?
162160

163161
No. Deep Code has a built-in fine-grained permission control mechanism that lets you confirm operations before the AI assistant executes shell commands, reads/writes files, accesses the network, and more. You can configure each permission scope's policy — always allow, always ask, or deny — via the `permissions` field in `settings.json`. See [docs/permission.md](docs/permission.md) for details.
164162

163+
## DeepCode Plus
164+
165+
DeepCode Plus aims to provide an all-in-one experience for AI coding and creative work. It offers DeepSeek model subscription plans and additional capabilities such as image understanding, web search, image generation, and video generation. It is entirely optional: you do not need a Plus subscription to use Deep Code.
166+
167+
Homepage: https://www.deepcodeplus.com · https://deepcode.vegamo.cn (Chinese)
168+
165169
## Contributing
166170

167171
Contributions are welcome! Here's how to get started:
@@ -174,14 +178,18 @@ cd deepcode-cli
174178
# Install dependencies
175179
npm install
176180

177-
# Local development (typecheck + lint + format check + bundle)
178-
npm run build
179-
180181
# Run tests
181182
npm test
182183

183-
# Link globally (local global install)
184+
# Local CLI development (typecheck + lint + format check + bundle)
185+
npm run build
186+
187+
# Link the CLI globally (local global install)
184188
npm link
189+
190+
# Local VSCode extension development
191+
npm run build:vscode
192+
185193
```
186194

187195
- Make sure `npm run check` passes before submitting a PR (typecheck + lint + format check)

‎README-zh_CN.md‎

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ npm install -g @vegamo/deepcode-cli
3535
```json
3636
{
3737
"env": {
38-
"MODEL": "deepseek-v4-pro",
38+
"MODEL": "deepseek-flash",
3939
"BASE_URL": "https://api.deepseek.com",
4040
"API_KEY": "sk-..."
4141
},
@@ -76,7 +76,11 @@ Skills 会按以下优先级扫描:
7676
| `/resume` | 选择历史对话继续 |
7777
| `/fork` | 从当前对话创建独立的新会话 |
7878
| `/continue` | 继续当前对话,或选择历史对话恢复 |
79+
| `/compact` | 手动压缩当前对话上下文 |
80+
| `/copy` | 将最近一条助手回复的文本复制到剪贴板 |
7981
| `/model` | 切换模型、思考模式和推理强度 |
82+
| `/experimental` | 配置实验功能,如思维链摘要 |
83+
| `/permissions` | 配置工具权限 |
8084
| `/raw` | 切换显示模式(Normal / Lite / Raw 滚动回溯) |
8185
| `/init` | 初始化 AGENTS.md 文件 |
8286
| `/skills` | 列出可用 skills |
@@ -88,13 +92,15 @@ Skills 会按以下优先级扫描:
8892
|---------------|--------------------|
8993
| `Enter` | 发送消息 |
9094
| `Shift+Enter` | 插入换行(也可用 `Ctrl+J`) |
91-
| `Ctrl+V` | 从剪贴板粘贴图片 |
95+
| `Ctrl+V` | 从剪贴板粘贴图片(Windows系统是`Alt+V`) |
96+
| `Ctrl+Y` | 将输入框中的文本复制到剪贴板 |
97+
| `Ctrl+R` | 搜索当前及历史会话中的用户输入 |
9298
| `Esc` | 中断当前模型回复 |
9399
| 连续 `Ctrl+D` | 退出 |
94100

95101
## 支持的模型
96102

97-
- `deepseek-flash`(推荐使用)
103+
- `deepseek-flash`(即 V4.1 Flash,推荐使用)
98104
- `deepseek-v4-pro`
99105
- `deepseek-v4-flash`
100106
- `deepseek-v4-flash-vision-exp`
@@ -116,19 +122,15 @@ Deep Code 的收益来自于工具约束、上下文管理、Agent Skills 和权
116122

117123
### Deep Code 是否支持理解图片?
118124

119-
支持。`deepseek-flash` 模型支持直接读取本地图片或使用`ctrl+v`从剪贴板粘贴图片,让模型直接看到图片内容。
125+
支持。`deepseek-flash` 模型支持直接读取本地图片或使用`ctrl+v`(Windows系统是`alt+v`)从剪贴板粘贴图片,让模型直接看到图片内容。
120126

121127
`deepseek-v4-pro`、`deepseek-v4-flash` 等非多模态模型仍会使用 `UnderstandImage` 识图工具。Deep Code 会自动判断模型能力,也可通过 `multimodal` 配置项手动覆盖。
122128

123129
默认情况下,图片会以 base64 内联发送给模型。启用 `filesApiEnabled` 后,Deep Code 会使用 DeepSeek Files API 上传图片并在请求中复用 `file_id`。详见 [docs/configuration.md](docs/configuration.md#deepseek-files-api)。
124130

125-
### 怎样在任务完成后自动给 Slack 发消息?
126-
127-
编写一个调用 Slack webhook 的 Shell 通知脚本,然后在 `~/.deepcode/settings.json` 中将 `notify` 字段设为该脚本的完整路径即可。详细步骤请参考 [docs/notify.md](docs/notify.md)。
128-
129131
### 怎样启用联网搜索功能?
130132

131-
Deep Code 已支持 [DeepSeek Responses API](https://api-docs.deepseek.com/zh-cn/guides/responses_api/#tools) 的原生联网搜索能力。如果你希望使用自定义脚本进行联网搜索,可以在 `~/.deepcode/settings.json` 中将 `webSearchTool` 设为脚本的完整路径即可。详细步骤可参考:https://github.com/qorzj/web_search_cli
133+
Deep Code 已支持 [DeepSeek 官方网页搜索](https://api-docs.deepseek.com/zh-cn/guides/search),在 `~/.deepcode/settings.json` 中将 `deepseekSearchApiEnabled` 设为 `true` 即可启用。如果你希望使用自定义脚本进行联网搜索,可以在 `~/.deepcode/settings.json` 中将 `webSearchTool` 设为脚本的完整路径即可。详细步骤可参考:https://github.com/qorzj/web_search_cli
132134

133135
### 如何配置 MCP?
134136

@@ -138,7 +140,7 @@ Deep Code 支持 MCP(Model Context Protocol),可以连接 GitHub、浏览
138140

139141
### 如何配置 Deep Code 任务完成后发送通知?
140142

141-
当 AI 助手完成一轮任务后,Deep Code 可以自动执行一个通知脚本,将任务结果发送到你指定的渠道(如 Slack、系统通知等)。
143+
在 `~/.deepcode/settings.json` 中,将 `notify` 字段设为可执行通知脚本的完整路径。AI 助手完成一轮任务后,Deep Code 会自动执行该脚本,向 Slack 等渠道发送消息或弹出系统通知。
142144

143145
详细配置指南:[docs/notify.md](docs/notify.md)
144146

@@ -148,19 +150,22 @@ Deep Code 支持 MCP(Model Context Protocol),可以连接 GitHub、浏览
148150

149151
### 是否支持 Coding Plan?
150152

151-
支持。只要把 `~/.deepcode/settings.json` 的 `env.BASE_URL` 配置为 OpenAI 兼容的接口地址就行。以火山方舟的 Coding Plan 为例:
153+
支持。只要把 `~/.deepcode/settings.json` 的 `env.BASE_URL` 配置为 OpenAI 兼容的接口地址就行。
152154

153-
```json
154-
{
155-
"env": {
156-
"MODEL": "ark-code-latest",
157-
"BASE_URL": "https://ark.cn-beijing.volces.com/api/coding/v3",
158-
"API_KEY": "**************"
159-
},
160-
"thinkingEnabled": true
161-
}
155+
如果使用 [DeepCode Plus 订阅套餐](https://deepcode.vegamo.cn/plus/plan),可直接运行`deepcode --plus`,在提示后粘贴你的 API Key 并回车,CLI 会自动写入配置,无需手动编辑文件:
156+
157+
```bash
158+
$ deepcode --plus
159+
DeepCode Plus API Key: sk-···(粘贴后回车)
162160
```
163161

162+
## DeepCode Plus
163+
164+
DeepCode Plus 旨在提供一站式的 AI 编程与创作体验。它提供 DeepSeek 模型订阅套餐,并支持图片理解、联网搜索、图片生成和视频生成等增强功能。它完全可选,使用 Deep Code 并不需要订阅 Plus。
165+
166+
- 中文版: https://deepcode.vegamo.cn
167+
- 国际版: https://www.deepcodeplus.com
168+
164169
## 贡献
165170

166171
欢迎贡献代码!以下是参与方式:
@@ -173,14 +178,18 @@ cd deepcode-cli
173178
# 安装依赖
174179
npm install
175180

176-
# 本地开发(类型检查 + lint + 格式检查 + 构建)
177-
npm run build
178-
179181
# 运行测试
180182
npm test
181183

182-
# 链接到全局(即本地全局安装)
184+
# CLI本地开发(类型检查 + lint + 格式检查 + 构建)
185+
npm run build
186+
187+
# CLI链接到全局(即本地全局安装)
183188
npm link
189+
190+
# VSCode插件本地开发
191+
npm run build:vscode
192+
184193
```
185194

186195
- 提交 PR 前请确保 `npm run check` 通过(类型检查 + lint + 格式检查)

0 commit comments

Comments
 (0)