deepccc 0.2.15 → 0.2.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,75 +1,75 @@
1
- # DeepCCC
2
-
3
- DeepCCC 是一个本地优先的开源 Coding Agent,同时提供浏览器多会话界面、终端 CLI 和适合自动化集成的 JSONL 流。它针对 DeepSeek 做了缓存和上下文优化,也支持任意 OpenAI-compatible 服务以及 Anthropic Messages 协议。
4
-
5
- - 项目主页:https://github.com/wzj998/deepccc-agent
6
- - npm 包:https://www.npmjs.com/package/deepccc
7
- - 运行要求:Node.js >= 20,以及一个兼容模型服务的 API Key
8
-
9
- ## 安装与快速开始
10
-
11
- 模型原生流未收到完成事件、返回错误结束原因或达到输出长度限制时,会报告异常并保留已经输出的内容,不将不完整回复判为成功。没有回复且没有工具执行的空结果也会明确报错。用户主动取消仍按中断处理。
12
-
13
- 全局安装:
1
+ # DeepCCC
2
+
3
+ DeepCCC 是一个本地优先的开源 Coding Agent,同时提供浏览器多会话界面、终端 CLI 和适合自动化集成的 JSONL 流。它针对 DeepSeek 做了缓存和上下文优化,也支持任意 OpenAI-compatible 服务以及 Anthropic Messages 协议。
4
+
5
+ - 项目主页:https://github.com/wzj998/deepccc-agent
6
+ - npm 包:https://www.npmjs.com/package/deepccc
7
+ - 运行要求:Node.js >= 20,以及一个兼容模型服务的 API Key
8
+
9
+ ## 安装与快速开始
10
+
11
+ 模型原生流未收到完成事件、返回错误结束原因或达到输出长度限制时,会报告异常并保留已经输出的内容,不将不完整回复判为成功。没有回复且没有工具执行的空结果也会明确报错。用户主动取消仍按中断处理。
12
+
13
+ 全局安装:
14
+
15
+ ```bash
16
+ npm install -g deepccc
17
+ ```
18
+
19
+ 配置 `~/.deepccc/config.json` 或 `DEEPCCC_*` 环境变量后,运行:
14
20
 
15
21
  ```bash
16
- npm install -g deepccc
17
- ```
18
-
19
- 配置 `~/.deepccc/config.json` 或 `DEEPCCC_*` 环境变量后,运行:
20
-
21
- ```bash
22
- deepccc
23
- ```
24
-
25
- 浏览器会自动打开 `http://127.0.0.1:28080/`。终端模式使用:
26
-
27
- ```bash
28
- deepccc-cli
29
- ```
30
-
31
- 从源码运行:
22
+ deepccc
23
+ ```
24
+
25
+ 浏览器会自动打开 `http://127.0.0.1:28080/`。终端模式使用:
26
+
27
+ ```bash
28
+ deepccc-cli
29
+ ```
30
+
31
+ 从源码运行:
32
32
 
33
33
  ```bash
34
34
  git clone https://github.com/wzj998/deepccc-agent.git
35
35
  cd deepccc-agent
36
- npm install
37
- npm run build
38
- npm run dev
39
- ```
40
-
41
- ## Web UI 预览
42
-
43
- 以下画面来自 DeepCCC 对本项目真实开发需求的 Agent 调用。截图仅将用户名、组织名、
44
- 内部域名和绝对路径替换为公开示例,任务内容、模型配置、Agent 回复和审批流程均来自
45
- 实际运行结果。
46
-
47
- 多会话可以并行处理不同任务,每个会话分别选择 model、subModel 和 effort。下图来自
48
- `deepccc-agent/` 工作目录中的真实提问“这个项目妙在哪?”:
49
-
50
- ![DeepCCC Web UI 图片附件与真实 Agent 回复](docs/deepccc-web-ui.png)
51
-
52
- 命中需要确认的命令时,审批卡会直接出现在当前会话时间线中,不打断到弹窗:
53
-
54
- ![DeepCCC 会话内操作审批](docs/deepccc-inline-approval.png)
55
-
56
- 单一 API 配置作为新会话默认值,模型与 effort 仍可在每个会话中单独覆盖:
57
-
58
- ![DeepCCC API 与 Web 设置](docs/deepccc-api-settings.png)
59
-
60
- ## 核心能力
61
-
62
- - Web-first:多会话、持久化历史、实时流式过程、停止和恢复
63
- - 工具时间线:ChatCCC 风格 emoji 摘要、参数/结果折叠、省略行展开和状态记忆
64
- - 会话配置:每个会话独立选择 model、subModel 和 effort
65
- - 图片附件:Web 支持选择、粘贴和拖拽 PNG/JPEG/WebP;Agent 可用 `present_file` 回传图片
66
- - 本地工具:代码搜索、文件读写、补丁、命令执行、Git、网页搜索和抓取
67
- - 权限审批:危险命令在会话时间线中暂停,支持拒绝、允许一次、会话允许和永久允许
68
- - 上下文管理:自动压缩、原始流日志和跨会话历史检索
69
- - 长会话校准:当前状态覆盖旧建议,摘要区分历史/事实/推断/局限;轮内工具结果有独立预算,避免多步调查持续膨胀
70
- - 项目约定:自动加载 AGENTS.md、CLAUDE.md、系统提示和目录式 Skills
71
- - 项目理解:可控搜索范围、按需本地项目地图、源文件变化即失效的证据笔记;不针对特定业务仓库,详见 [项目理解与搜索](docs/workspace-understanding.md)
72
- - 自动化:`deepccc-cli --stream-json` 提供稳定 JSONL 事件接口
36
+ npm install
37
+ npm run build
38
+ npm run dev
39
+ ```
40
+
41
+ ## Web UI 预览
42
+
43
+ 以下画面来自 DeepCCC 对本项目真实开发需求的 Agent 调用。截图仅将用户名、组织名、
44
+ 内部域名和绝对路径替换为公开示例,任务内容、模型配置、Agent 回复和审批流程均来自
45
+ 实际运行结果。
46
+
47
+ 多会话可以并行处理不同任务,每个会话分别选择 model、subModel 和 effort。下图来自
48
+ `deepccc-agent/` 工作目录中的真实提问“这个项目妙在哪?”:
49
+
50
+ ![DeepCCC Web UI 图片附件与真实 Agent 回复](docs/deepccc-web-ui.png)
51
+
52
+ 命中需要确认的命令时,审批卡会直接出现在当前会话时间线中,不打断到弹窗:
53
+
54
+ ![DeepCCC 会话内操作审批](docs/deepccc-inline-approval.png)
55
+
56
+ 单一 API 配置作为新会话默认值,模型与 effort 仍可在每个会话中单独覆盖:
57
+
58
+ ![DeepCCC API 与 Web 设置](docs/deepccc-api-settings.png)
59
+
60
+ ## 核心能力
61
+
62
+ - Web-first:多会话、持久化历史、实时流式过程、停止和恢复
63
+ - 工具时间线:ChatCCC 风格 emoji 摘要、参数/结果折叠、省略行展开和状态记忆
64
+ - 会话配置:每个会话独立选择 model、subModel 和 effort
65
+ - 图片附件:Web 支持选择、粘贴和拖拽 PNG/JPEG/WebP;Agent 可用 `present_file` 回传图片
66
+ - 本地工具:代码搜索、文件读写、补丁、命令执行、Git、网页搜索和抓取
67
+ - 权限审批:危险命令在会话时间线中暂停,支持拒绝、允许一次、会话允许和永久允许
68
+ - 上下文管理:自动压缩、原始流日志和跨会话历史检索
69
+ - 长会话校准:当前状态覆盖旧建议,摘要区分历史/事实/推断/局限;轮内工具结果有独立预算,避免多步调查持续膨胀
70
+ - 项目约定:自动加载 AGENTS.md、CLAUDE.md、系统提示和目录式 Skills
71
+ - 项目理解:可控搜索范围、按需本地项目地图、源文件变化即失效的证据笔记;不针对特定业务仓库,详见 [项目理解与搜索](docs/workspace-understanding.md)
72
+ - 自动化:`deepccc-cli --stream-json` 提供稳定 JSONL 事件接口
73
73
 
74
74
  ## 缓存命中率
75
75
 
@@ -86,10 +86,10 @@ deepccc 的本地缓存优化实测命中率 **96.7%**,有效降低重复请
86
86
  ```bash
87
87
  export DEEPCCC_API_KEY="sk-..."
88
88
  export DEEPCCC_BASE_URL="https://api.deepseek.com/v1"
89
- export DEEPCCC_MODEL="deepseek-v4-pro"
90
- export DEEPCCC_EFFORT="high"
91
- export DEEPCCC_MAX_OUTPUT_TOKENS="32768"
92
- export DEEPCCC_STREAMING="true"
89
+ export DEEPCCC_MODEL="deepseek-v4-pro"
90
+ export DEEPCCC_EFFORT="high"
91
+ export DEEPCCC_MAX_OUTPUT_TOKENS="32768"
92
+ export DEEPCCC_STREAMING="true"
93
93
  ```
94
94
 
95
95
  Windows PowerShell:
@@ -98,10 +98,10 @@ Windows PowerShell:
98
98
  $env:DEEPCCC_API_KEY="sk-..."
99
99
  $env:DEEPCCC_PROVIDER="openai"
100
100
  $env:DEEPCCC_BASE_URL="https://api.deepseek.com/v1"
101
- $env:DEEPCCC_MODEL="deepseek-v4-pro"
102
- $env:DEEPCCC_EFFORT="high"
103
- $env:DEEPCCC_MAX_OUTPUT_TOKENS="32768"
104
- $env:DEEPCCC_STREAMING="true"
101
+ $env:DEEPCCC_MODEL="deepseek-v4-pro"
102
+ $env:DEEPCCC_EFFORT="high"
103
+ $env:DEEPCCC_MAX_OUTPUT_TOKENS="32768"
104
+ $env:DEEPCCC_STREAMING="true"
105
105
  ```
106
106
 
107
107
  也兼容这些 DeepSeek 别名:
@@ -119,10 +119,10 @@ $env:DEEPCCC_STREAMING="true"
119
119
  "apiKey": "sk-...",
120
120
  "baseURL": "https://api.deepseek.com/v1",
121
121
  "model": "deepseek-v4-pro",
122
- "subModel": "",
123
- "effort": "",
124
- "maxOutputTokens": null,
125
- "streaming": true,
122
+ "subModel": "",
123
+ "effort": "",
124
+ "maxOutputTokens": null,
125
+ "streaming": true,
126
126
  "contextWindow": 1048576,
127
127
  "git": {
128
128
  "coAuthor": {
@@ -131,39 +131,39 @@ $env:DEEPCCC_STREAMING="true"
131
131
  "email": "20184052+wzj998@users.noreply.github.com"
132
132
  }
133
133
  },
134
- "rawStreamLogs": {
134
+ "rawStreamLogs": {
135
135
  "enabled": true,
136
136
  "maxBytesPerTurn": 1048576,
137
137
  "retentionDays": 7,
138
- "keepCompleted": false
139
- },
140
- "web": {
141
- "port": 28080,
142
- "openOnStart": true
143
- }
144
- }
145
- ```
146
-
147
- ## Web UI
148
-
149
- 全局安装后可以直接启动本地网页版:
150
-
151
- ```bash
152
- deepccc
153
- ```
154
-
155
- 默认只监听 `http://127.0.0.1:28080/`,不会暴露到局域网。可在
156
- `~/.deepccc/config.json` 的 `web.port` 修改端口,`web.openOnStart` 控制启动时是否自动打开浏览器;也可以临时使用 `deepccc --port 28081 --no-open`。默认启动会安全替换经过实例身份验证的旧 DeepCCC Web;传入 `--reuse-existing` 时复用已有实例。`deepccc web` 保留为兼容别名。
157
-
158
- 从源码开发时,`npm run dev` 启动 Web Server 并打开页面(不启用 watch);`npm run dev:cli` 启动终端模式。
159
-
160
- Web UI 支持新建、恢复、重命名和删除多会话,多个会话可以同时运行,即使它们指向同一个工作目录。每个会话可独立选择 model、subModel 和 effort,并持续复用 CLI 已保存的历史。注意:当前版本不自动创建 Git worktree;同目录的多个运行中 Agent 直接修改同一组文件,页面会提示覆盖与冲突风险。
161
-
162
- 模型文本、reasoning 心跳和工具事件通过 SSE 实时更新。每轮消息按真实发生顺序持久化和回放,因此刷新后仍会保持“阶段说明 → 工具调用 → 后续结论”的交错时间线;旧版会话没有顺序数据时,会兼容显示为“工具调用 → 最终回答”。每次工具调用与对应结果合并成一张卡片,折叠态显示 emoji、工具名、状态和关键参数;展开后调用参数默认保留前 8/后 4 行,工具结果保留前 12/后 6 行,省略内容可继续展开。工具卡及省略行的展开状态保存在当前浏览器标签页的 `sessionStorage`,持续生成、切换会话和刷新页面均不会自动收起。消息正文支持标题、表格、列表、引用、链接和代码块等常用 Markdown。
163
-
164
- 图片始终按本地附件处理,不转换为 Provider 原生多模态消息。Web 支持文件选择、剪贴板粘贴和拖拽,每条消息最多 10 张 PNG/JPEG/WebP、单张最大 20 MB;附件复制到 `~/.deepccc/attachments/<session-id>/`,Agent 收到本地绝对路径后使用可用工具自行处理。Agent 可调用 `present_file` 把当前工作目录或会话附件目录中的图片直接展示在会话中;删除会话时对应附件一并清理。
165
-
166
- API 设置采用单一 Provider 配置,支持 OpenAI-compatible 与 Anthropic Messages。完整 API Key 只保存在本机 `~/.deepccc/config.json`,浏览器读取设置时仅返回掩码。危险命令会在会话中暂停并请求“拒绝、允许一次、本会话允许、永久允许”,浏览器断开或审批超时默认拒绝。
138
+ "keepCompleted": false
139
+ },
140
+ "web": {
141
+ "port": 28080,
142
+ "openOnStart": true
143
+ }
144
+ }
145
+ ```
146
+
147
+ ## Web UI
148
+
149
+ 全局安装后可以直接启动本地网页版:
150
+
151
+ ```bash
152
+ deepccc
153
+ ```
154
+
155
+ 默认只监听 `http://127.0.0.1:28080/`,不会暴露到局域网。可在
156
+ `~/.deepccc/config.json` 的 `web.port` 修改端口,`web.openOnStart` 控制启动时是否自动打开浏览器;也可以临时使用 `deepccc --port 28081 --no-open`。默认启动会安全替换经过实例身份验证的旧 DeepCCC Web;传入 `--reuse-existing` 时复用已有实例。`deepccc web` 保留为兼容别名。
157
+
158
+ 从源码开发时,`npm run dev` 启动 Web Server 并打开页面(不启用 watch);`npm run dev:cli` 启动终端模式。
159
+
160
+ Web UI 支持新建、恢复、重命名和删除多会话,多个会话可以同时运行,即使它们指向同一个工作目录。每个会话可独立选择 model、subModel 和 effort,并持续复用 CLI 已保存的历史。注意:当前版本不自动创建 Git worktree;同目录的多个运行中 Agent 直接修改同一组文件,页面会提示覆盖与冲突风险。
161
+
162
+ 模型文本、reasoning 心跳和工具事件通过 SSE 实时更新。每轮消息按真实发生顺序持久化和回放,因此刷新后仍会保持“阶段说明 → 工具调用 → 后续结论”的交错时间线;旧版会话没有顺序数据时,会兼容显示为“工具调用 → 最终回答”。每次工具调用与对应结果合并成一张卡片,折叠态显示 emoji、工具名、状态和关键参数;展开后调用参数默认保留前 8/后 4 行,工具结果保留前 12/后 6 行,省略内容可继续展开。工具卡及省略行的展开状态保存在当前浏览器标签页的 `sessionStorage`,持续生成、切换会话和刷新页面均不会自动收起。消息正文支持标题、表格、列表、引用、链接和代码块等常用 Markdown。
163
+
164
+ 图片始终按本地附件处理,不转换为 Provider 原生多模态消息。Web 支持文件选择、剪贴板粘贴和拖拽,每条消息最多 10 张 PNG/JPEG/WebP、单张最大 20 MB;附件复制到 `~/.deepccc/attachments/<session-id>/`,Agent 收到本地绝对路径后使用可用工具自行处理。Agent 可调用 `present_file` 把当前工作目录或会话附件目录中的图片直接展示在会话中;删除会话时对应附件一并清理。
165
+
166
+ API 设置采用单一 Provider 配置,支持 OpenAI-compatible 与 Anthropic Messages。完整 API Key 只保存在本机 `~/.deepccc/config.json`,浏览器读取设置时仅返回掩码。危险命令会在会话中暂停并请求“拒绝、允许一次、本会话允许、永久允许”,浏览器断开或审批超时默认拒绝。
167
167
 
168
168
  `git.coAuthor.enabled` 默认开启。DeepCCC 通过 `run_command` 创建 Git 提交时会保留用户为
169
169
  主 Author,并追加 `Co-authored-by: DeepCCC <20184052+wzj998@users.noreply.github.com>`。
@@ -174,19 +174,19 @@ API 设置采用单一 Provider 配置,支持 OpenAI-compatible 与 Anthropic
174
174
  `DEEPCCC_PROVIDER` 或命令行 `--provider` 覆盖:
175
175
 
176
176
  - `openai` 使用 OpenAI-compatible Chat Completions 协议,兼容 DeepSeek、OpenAI、LiteLLM、vLLM 等服务。
177
- - `anthropic` 使用 Anthropic Messages 协议。配置中的 `baseURL` **完全按填写值使用,不自动补 `/v1`**,请填写到完整版本化地址,例如 DeepSeek 官方 Anthropic 端点为 `https://api.deepseek.com/anthropic/v1`(官方 Anthropic SDK 使用的 `https://api.deepseek.com/anthropic` 基址会拼接为 `.../anthropic/v1/messages`)。`effort` 在 OpenAI-compatible 模式映射为 `reasoning_effort`,在 Anthropic 模式映射为 `output_config.effort`;目标服务不支持时应留空。
178
-
179
- `streaming` 控制主对话是否使用流式请求,默认 `true`;也可以通过
180
- `DEEPCCC_STREAMING=true|false` 覆盖。关闭后,终端会在整条模型响应完成后一次性显示结果。
181
-
182
- `maxOutputTokens` 限制主对话单次最大输出 token,默认不配置(`null`/缺失),此时不向
183
- Provider 发送 `max_tokens`,使用模型服务端默认值。可通过 `DEEPCCC_MAX_OUTPUT_TOKENS`
184
- 或命令行 `--max-output-tokens` 覆盖;只接受正整数。该限制会同时覆盖模型思考内容、
185
- 工具参数和最终回答,设置过小可能导致工具调用或长回复被截断。
186
-
187
- `contextWindow` 是模型上下文窗口(token),默认 `1048576`(1M,DeepSeek V4 Pro/Flash
188
- 原生规格);常规上下文压缩阈值自动 = `contextWindow × 0.8`。工具输入与结果另有独立预算:
189
- 默认取 `min(64000, 常规压缩阈值 × 25%)`,超过后会提前压缩,避免长会话积累大量低信号工具输出。
177
+ - `anthropic` 使用 Anthropic Messages 协议。配置中的 `baseURL` **完全按填写值使用,不自动补 `/v1`**,请填写到完整版本化地址,例如 DeepSeek 官方 Anthropic 端点为 `https://api.deepseek.com/anthropic/v1`(官方 Anthropic SDK 使用的 `https://api.deepseek.com/anthropic` 基址会拼接为 `.../anthropic/v1/messages`)。`effort` 在 OpenAI-compatible 模式映射为 `reasoning_effort`,在 Anthropic 模式映射为 `output_config.effort`;目标服务不支持时应留空。
178
+
179
+ `streaming` 控制主对话是否使用流式请求,默认 `true`;也可以通过
180
+ `DEEPCCC_STREAMING=true|false` 覆盖。关闭后,终端会在整条模型响应完成后一次性显示结果。
181
+
182
+ `maxOutputTokens` 限制主对话单次最大输出 token,默认不配置(`null`/缺失),此时不向
183
+ Provider 发送 `max_tokens`,使用模型服务端默认值。可通过 `DEEPCCC_MAX_OUTPUT_TOKENS`
184
+ 或命令行 `--max-output-tokens` 覆盖;只接受正整数。该限制会同时覆盖模型思考内容、
185
+ 工具参数和最终回答,设置过小可能导致工具调用或长回复被截断。
186
+
187
+ `contextWindow` 是模型上下文窗口(token),默认 `1048576`(1M,DeepSeek V4 Pro/Flash
188
+ 原生规格);常规上下文压缩阈值自动 = `contextWindow × 0.8`。工具输入与结果另有独立预算:
189
+ 默认取 `min(64000, 常规压缩阈值 × 25%)`,超过后会提前压缩,避免长会话积累大量低信号工具输出。
190
190
  可通过 `DEEPCCC_CONTEXT_WINDOW` 环境变量覆盖。⚠️ 超过模型/服务端实际上限时请求会被
191
191
  API 拒绝(context length exceeded),实际窗口以模型与所用服务端为准(如 litellm 的
192
192
  `max_input_tokens`)。
@@ -213,62 +213,62 @@ API 拒绝(context length exceeded),实际窗口以模型与所用服务
213
213
  在当前目录启动一个交互式 Agent:
214
214
 
215
215
  ```bash
216
- deepccc-cli
216
+ deepccc-cli
217
217
  ```
218
218
 
219
219
  指定其他模型或 OpenAI-compatible 接口:
220
220
 
221
221
  ```bash
222
- deepccc-cli --base-url https://api.openai.com/v1 --api-key "$OPENAI_API_KEY" --model gpt-4.1
222
+ deepccc-cli --base-url https://api.openai.com/v1 --api-key "$OPENAI_API_KEY" --model gpt-4.1
223
223
  ```
224
224
 
225
225
  使用 Anthropic Messages 协议(同样支持流式输出):
226
226
 
227
227
  ```bash
228
- deepccc-cli --provider anthropic --base-url https://api.example.com --api-key "$API_KEY" --model claude-sonnet-4-6
228
+ deepccc-cli --provider anthropic --base-url https://api.example.com --api-key "$API_KEY" --model claude-sonnet-4-6
229
229
  ```
230
230
 
231
- 指定工作目录:
231
+ 指定工作目录:
232
232
 
233
233
  ```bash
234
- deepccc-cli --cwd /path/to/project
235
- ```
236
-
237
- 附加一张或多张本地图片(可重复传入 `--image`,仍采用本地附件路径,不发送原生多模态内容):
238
-
239
- ```bash
240
- deepccc-cli --image ./error.png --image ./expected.webp
241
- ```
234
+ deepccc-cli --cwd /path/to/project
235
+ ```
236
+
237
+ 附加一张或多张本地图片(可重复传入 `--image`,仍采用本地附件路径,不发送原生多模态内容):
238
+
239
+ ```bash
240
+ deepccc-cli --image ./error.png --image ./expected.webp
241
+ ```
242
242
 
243
243
  恢复当前工作目录最近一次会话:
244
244
 
245
245
  ```bash
246
- deepccc-cli --resume
246
+ deepccc-cli --resume
247
247
  ```
248
248
 
249
249
  设置工具调用步数上限:
250
250
 
251
251
  ```bash
252
- deepccc-cli --max-steps 20
252
+ deepccc-cli --max-steps 20
253
253
  ```
254
254
 
255
- 默认情况下,`deepccc-cli` 不设置固定步数上限,会让模型自然完成工具循环。
255
+ 默认情况下,`deepccc-cli` 不设置固定步数上限,会让模型自然完成工具循环。
256
256
 
257
257
  设置推理强度(reasoning effort):
258
258
 
259
259
  ```bash
260
- deepccc-cli --effort high
260
+ deepccc-cli --effort high
261
261
  ```
262
262
 
263
- 可选值:`none` / `minimal` / `low` / `medium` / `high` / `xhigh` / `max`(留空则不传 `reasoning_effort` 请求字段)。
264
-
265
- 限制主对话最大输出 token:
266
-
267
- ```bash
268
- deepccc-cli --max-output-tokens 8192
269
- ```
270
-
271
- 不设置时使用 Provider 默认值。
263
+ 可选值:`none` / `minimal` / `low` / `medium` / `high` / `xhigh` / `max`(留空则不传 `reasoning_effort` 请求字段)。
264
+
265
+ 限制主对话最大输出 token:
266
+
267
+ ```bash
268
+ deepccc-cli --max-output-tokens 8192
269
+ ```
270
+
271
+ 不设置时使用 Provider 默认值。
272
272
 
273
273
  ## 权限机制
274
274
 
@@ -320,7 +320,7 @@ deepccc-cli --max-output-tokens 8192
320
320
  `--stream-json` 或程序化调用(无终端可交互)时,高危命令**安全默认拒绝**。需要全自动场景可显式传入:
321
321
 
322
322
  ```bash
323
- deepccc-cli --dangerously-bypass-permissions
323
+ deepccc-cli --dangerously-bypass-permissions
324
324
  ```
325
325
 
326
326
  该参数与 `ChatSession` 的 `permissionMode: "bypass"` 等价,也是 chatccc 集成 deepccc 时使用的模式(对齐 chatccc 调用 Claude Code / Codex 的 bypass 方式)。
@@ -329,12 +329,12 @@ deepccc-cli --dangerously-bypass-permissions
329
329
 
330
330
  交互模式下,每轮回复渲染为固定"过程区块":状态行(压缩上下文中/生成回复中/完成/已停止/异常结束)+ 折叠工具行 + 原地更新正文,不滚屏刷 JSON。活动状态有心跳点号动画;完成/停止/异常后区块定型留在屏幕上。
331
331
 
332
- 持久化上下文达到常规 token 阈值或独立工具预算时,deepccc 会先按预算保留最近消息,再压缩较早内容;工具历史使用标准结构化 tool-call/tool-result 消息重放,不会把内部 `[工具记录]` 文本重复送回模型。若模型仍输出伪工具记录,系统会丢弃并重试一次;重复失败时安全终止,避免把未执行命令当成真实结果。超长历史消息、工具记录和压缩输入会被限长,一次压缩最多等待 5 分钟。
332
+ 持久化上下文达到常规 token 阈值或独立工具预算时,deepccc 会先按预算保留最近消息,再压缩较早内容;工具历史使用标准结构化 tool-call/tool-result 消息重放,不会把内部 `[工具记录]` 文本重复送回模型。若模型仍输出伪工具记录,系统会丢弃并重试一次;重复失败时安全终止,避免把未执行命令当成真实结果。超长历史消息、工具记录和压缩输入会被限长,一次压缩最多等待 5 分钟。
333
333
 
334
334
  如果终端渲染出现异常,可以强制回退为纯文本流式输出:
335
335
 
336
336
  ```bash
337
- deepccc-cli --plain
337
+ deepccc-cli --plain
338
338
  ```
339
339
 
340
340
  ## JSONL 流式输出
@@ -342,13 +342,13 @@ deepccc-cli --plain
342
342
  JSONL 模式适合脚本、服务端集成或其他上层系统调用:
343
343
 
344
344
  ```bash
345
- deepccc-cli --stream-json --prompt "检查这个仓库并总结测试命令"
345
+ deepccc-cli --stream-json --prompt "检查这个仓库并总结测试命令"
346
346
  ```
347
347
 
348
348
  也可以从 stdin 传入提示词:
349
349
 
350
350
  ```bash
351
- echo "运行测试并解释失败原因" | deepccc-cli --stream-json
351
+ echo "运行测试并解释失败原因" | deepccc-cli --stream-json
352
352
  ```
353
353
 
354
354
  输出是逐行 JSON:
@@ -381,6 +381,8 @@ ChatCCC 是一个把 Claude Code / Codex / Cursor / CCC Agent 聚合到飞书/
381
381
 
382
382
  这种方式适合已经在 ChatCCC 里协作的场景:ChatCCC 负责会话入口和消息通道,`deepccc` 负责本地编程 Agent 能力,包括读取项目提示词、运行命令、编辑文件和输出流式结果。
383
383
 
384
+ deepccc 内核支持**协作式让位**:任务运行期间用户继续发消息,ChatCCC 会把消息排入注入队列(深度 50),内核在每个模型步骤边界(`prepareStep`)吸收进当前 turn——不打断正在执行的工具步骤、不新开一轮对话,已完成的中间态持久化保留,收到插话后继续调整方向。`/stop` 打断当前 turn,`/cancel` 清空注入队列。该能力通过 `chat()` 的 `drainInput` 回调对外暴露,运行期新消息以 `input_injected` 事件反馈到调用方;仅流式(`streaming: true`)模式生效,non-streaming 下退化为整轮结束后消费。
385
+
384
386
  deepccc 的内核主战场在 ChatCCC 仓库的 `deepccc-agent/` 子目录;本仓库(deepccc-agent)是发布镜像,由 ChatCCC 仓库的 `sync-deepccc.mjs` 目录级同步(多的删、少的补、不同的改),之后 `npm run build && npm publish` 发布独立 `deepccc` 包。
385
387
 
386
388
  ## 项目提示词自动注入
@@ -76,6 +76,39 @@ export interface RunCommandOutput {
76
76
  timedOut: boolean;
77
77
  truncated: boolean;
78
78
  durationMs: number;
79
+ /**
80
+ * 为把当前 step 让给用户新消息而转入后台时为 true。此时 exitCode 为 null,
81
+ * stdout/stderr 是让位瞬间的快照;命令仍在后台运行,用 command_output /
82
+ * command_kill 继续跟踪。
83
+ */
84
+ backgrounded?: boolean;
85
+ /** 后台命令句柄(backgrounded 为 true 时提供)。 */
86
+ taskId?: string;
87
+ }
88
+ export interface CommandOutputInput {
89
+ taskId: string;
90
+ /** 可选等待毫秒数;0(默认)立即返回当前状态。 */
91
+ waitMs?: number;
92
+ }
93
+ export interface CommandOutputResult {
94
+ taskId: string;
95
+ command: string;
96
+ cwd: string;
97
+ running: boolean;
98
+ exitCode: number | null;
99
+ signal: string | null;
100
+ stdout: string;
101
+ stderr: string;
102
+ timedOut: boolean;
103
+ truncated: boolean;
104
+ durationMs: number;
105
+ }
106
+ export interface CommandKillInput {
107
+ taskId: string;
108
+ }
109
+ export interface CommandKillResult {
110
+ taskId: string;
111
+ killed: boolean;
79
112
  }
80
113
  export interface GitCoAuthorOptions {
81
114
  enabled: boolean;
@@ -168,7 +201,13 @@ export declare function presentFileForTool(cwd: string, input: PresentFileInput)
168
201
  export declare function readFileForTool(cwd: string, input: ReadFileInput): Promise<ReadFileOutput>;
169
202
  export declare function listDirForTool(cwd: string, input?: ListDirInput): Promise<ListDirOutput>;
170
203
  export declare function searchCodeForTool(cwd: string, input: SearchCodeInput, signal?: AbortSignal, runtimeOptions?: SearchCodeRuntimeOptions): Promise<SearchCodeOutput>;
171
- export declare function runCommandForTool(cwd: string, input: RunCommandInput, abortSignal?: AbortSignal, coAuthor?: GitCoAuthorOptions): Promise<RunCommandOutput>;
204
+ export declare function runCommandForTool(cwd: string, input: RunCommandInput, abortSignal?: AbortSignal, coAuthor?: GitCoAuthorOptions, shouldYield?: () => boolean): Promise<RunCommandOutput>;
205
+ /** 读取后台命令的最新输出;waitMs > 0 时最多等待该时长(等待期间仍可让位)。 */
206
+ export declare function commandOutputForTool(taskId: string, input?: CommandOutputInput, shouldYield?: () => boolean): Promise<CommandOutputResult>;
207
+ /** 终止一个仍在运行的后台命令。 */
208
+ export declare function commandKillForTool(taskId: string): Promise<CommandKillResult>;
209
+ /** 终止并清空全部后台命令句柄(进程退出与测试收尾),避免留下孤儿进程。 */
210
+ export declare function killAllBackgroundCommands(): void;
172
211
  export declare function editFileForTool(cwd: string, input: EditFileInput): Promise<EditFileOutput>;
173
212
  export declare function createFileForTool(cwd: string, input: CreateFileInput): Promise<FileWriteOutput>;
174
213
  export declare function deleteFileForTool(cwd: string, input: DeleteFileInput): Promise<DeleteFileOutput>;
@@ -189,6 +228,12 @@ export interface BuiltinFileToolsOptions {
189
228
  * 未提供时 task 工具不可用(抛出明确错误),主会话之外的工具集不会意外开启子代理。
190
229
  */
191
230
  runTask?: TaskRunner;
231
+ /**
232
+ * 让位注入判定:返回 true 表示会话有待注入的用户消息,在途 run_command 应立即
233
+ * 转入后台并返回句柄,让当前 step 尽快结束以便在下一个 step 边界注入。
234
+ * 未提供时 run_command 保持原有阻塞语义(独立 CLI 等场景不受影响)。
235
+ */
236
+ shouldYieldToInjection?: () => boolean;
192
237
  }
193
238
  export interface TaskRunnerInput {
194
239
  /** 子任务描述:包含目标、约束与交付物,子代理将以此作为唯一指令。 */
@@ -25,6 +25,12 @@ const SEARCH_TIMEOUT_MS = 15_000;
25
25
  const MAX_COMMAND_OUTPUT_BYTES = 256 * 1024;
26
26
  const DEFAULT_COMMAND_TIMEOUT_MS = 120_000;
27
27
  const MAX_COMMAND_TIMEOUT_MS = 900_000;
28
+ /** 让位注入的轮询间隔:run_command 执行期以此频率检查是否有待注入的用户消息 */
29
+ const YIELD_POLL_INTERVAL_MS = 250;
30
+ /** command_output 单次等待上限,避免代理用等待把 step 又堵死 */
31
+ const MAX_COMMAND_OUTPUT_WAIT_MS = 30_000;
32
+ /** 后台命令句柄上限;超出时优先回收已结束的句柄 */
33
+ const MAX_BACKGROUND_COMMANDS = 32;
28
34
  /** task 子代理工具:子任务结果回传主会话前的最大字符数(防止子代理长输出撑爆主上下文) */
29
35
  export const MAX_TASK_OUTPUT_CHARS = 32_000;
30
36
  const requireFromHere = createRequire(import.meta.url);
@@ -722,7 +728,41 @@ export async function searchCodeForTool(cwd, input, signal, runtimeOptions = {})
722
728
  : fallback.truncated,
723
729
  };
724
730
  }
725
- export async function runCommandForTool(cwd, input, abortSignal, coAuthor) {
731
+ const backgroundCommands = new Map();
732
+ let backgroundCommandSeq = 0;
733
+ function normalizeCommandOutputWaitMs(value) {
734
+ if (typeof value !== "number" || !Number.isFinite(value) || value <= 0)
735
+ return 0;
736
+ return Math.min(Math.trunc(value), MAX_COMMAND_OUTPUT_WAIT_MS);
737
+ }
738
+ function snapshotBackgroundCommand(entry) {
739
+ return {
740
+ taskId: entry.taskId,
741
+ command: entry.command,
742
+ cwd: entry.cwd,
743
+ running: !entry.done,
744
+ exitCode: entry.exitCode,
745
+ signal: entry.signal,
746
+ stdout: entry.stdout.chunks.join(""),
747
+ stderr: entry.stderr.chunks.join(""),
748
+ timedOut: entry.timedOut,
749
+ truncated: entry.stdout.truncated || entry.stderr.truncated,
750
+ durationMs: Date.now() - entry.startedAt,
751
+ };
752
+ }
753
+ /** 句柄超限时优先回收已结束的条目(运行中的条目保留,避免破坏 agent 的跟踪)。 */
754
+ function pruneBackgroundCommands() {
755
+ if (backgroundCommands.size <= MAX_BACKGROUND_COMMANDS)
756
+ return;
757
+ for (const [id, entry] of backgroundCommands) {
758
+ if (!entry.done)
759
+ continue;
760
+ backgroundCommands.delete(id);
761
+ if (backgroundCommands.size <= MAX_BACKGROUND_COMMANDS)
762
+ return;
763
+ }
764
+ }
765
+ export async function runCommandForTool(cwd, input, abortSignal, coAuthor, shouldYield) {
726
766
  const command = withGitCoAuthor(input.command?.trim(), coAuthor);
727
767
  if (!command)
728
768
  throw new Error("command is required");
@@ -740,6 +780,8 @@ export async function runCommandForTool(cwd, input, abortSignal, coAuthor) {
740
780
  let timedOut = false;
741
781
  let timeout;
742
782
  let fallbackTimer;
783
+ let yieldPoll;
784
+ let backgroundEntry;
743
785
  const child = spawn(command, {
744
786
  cwd: commandCwd,
745
787
  shell: true,
@@ -751,6 +793,8 @@ export async function runCommandForTool(cwd, input, abortSignal, coAuthor) {
751
793
  clearTimeout(timeout);
752
794
  if (fallbackTimer)
753
795
  clearTimeout(fallbackTimer);
796
+ if (yieldPoll)
797
+ clearInterval(yieldPoll);
754
798
  abortSignal?.removeEventListener("abort", abort);
755
799
  };
756
800
  const finish = (exitCode, signal) => {
@@ -770,12 +814,32 @@ export async function runCommandForTool(cwd, input, abortSignal, coAuthor) {
770
814
  durationMs: Date.now() - startedAt,
771
815
  });
772
816
  };
817
+ /**
818
+ * 统一收敛点:已转入后台则更新句柄并唤醒等待方,否则按前台语义 resolve。
819
+ * 让位后 timeout 与 abort 的既有定时器/监听继续生效,因此后台任务仍受
820
+ * timeoutMs 约束,也仍能被 /stop 终止。
821
+ */
822
+ const settle = (exitCode, signal) => {
823
+ if (!backgroundEntry) {
824
+ finish(exitCode, signal);
825
+ return;
826
+ }
827
+ backgroundEntry.done = true;
828
+ backgroundEntry.exitCode = exitCode;
829
+ backgroundEntry.signal = signal;
830
+ backgroundEntry.timedOut = timedOut;
831
+ cleanup();
832
+ const waiters = backgroundEntry.waiters;
833
+ backgroundEntry.waiters = [];
834
+ for (const wake of waiters)
835
+ wake();
836
+ };
773
837
  const requestKill = (reason) => {
774
838
  void killProcessTree(child.pid);
775
839
  fallbackTimer = setTimeout(() => {
776
840
  child.stdout?.destroy();
777
841
  child.stderr?.destroy();
778
- finish(null, reason === "timeout" ? "SIGTERM" : reason);
842
+ settle(null, reason === "timeout" ? "SIGTERM" : reason);
779
843
  }, 5_000);
780
844
  fallbackTimer.unref?.();
781
845
  };
@@ -787,6 +851,70 @@ export async function runCommandForTool(cwd, input, abortSignal, coAuthor) {
787
851
  requestKill("abort");
788
852
  };
789
853
  abortSignal?.addEventListener("abort", abort, { once: true });
854
+ /**
855
+ * 让位:命令既不杀也不等,转为后台句柄后立即返回。这样当前 step 尽快结束,
856
+ * 下一个 prepareStep 边界即可调用 drainInput 把用户新消息注入当前 turn。
857
+ */
858
+ const detachToBackground = () => {
859
+ if (settled || backgroundEntry)
860
+ return;
861
+ // close/error 重新挂到 settle:settle 会按 backgroundEntry 分流到后台句柄
862
+ child.removeAllListeners("close");
863
+ child.removeAllListeners("error");
864
+ child.once("close", (code, signal) => settle(code, signal));
865
+ child.once("error", () => settle(null, "error"));
866
+ const taskId = `cmd-${++backgroundCommandSeq}-${Math.random().toString(36).slice(2, 6)}`;
867
+ backgroundEntry = {
868
+ taskId,
869
+ command,
870
+ cwd: commandCwd,
871
+ startedAt,
872
+ child,
873
+ stdout,
874
+ stderr,
875
+ done: false,
876
+ exitCode: null,
877
+ signal: null,
878
+ timedOut: false,
879
+ waiters: [],
880
+ };
881
+ backgroundCommands.set(taskId, backgroundEntry);
882
+ pruneBackgroundCommands();
883
+ if (yieldPoll)
884
+ clearInterval(yieldPoll);
885
+ yieldPoll = undefined;
886
+ // 刻意不调 cleanup:超时定时器与 abort 监听继续为后台任务服务
887
+ settled = true;
888
+ resolvePromise({
889
+ command,
890
+ cwd: commandCwd,
891
+ exitCode: null,
892
+ signal: null,
893
+ stdout: stdout.chunks.join(""),
894
+ stderr: stderr.chunks.join(""),
895
+ timedOut: false,
896
+ truncated: stdout.truncated || stderr.truncated,
897
+ durationMs: Date.now() - startedAt,
898
+ backgrounded: true,
899
+ taskId,
900
+ });
901
+ };
902
+ if (shouldYield) {
903
+ yieldPoll = setInterval(() => {
904
+ if (settled || backgroundEntry)
905
+ return;
906
+ let yieldNow = false;
907
+ try {
908
+ yieldNow = shouldYield() === true;
909
+ }
910
+ catch {
911
+ yieldNow = false;
912
+ }
913
+ if (yieldNow)
914
+ detachToBackground();
915
+ }, YIELD_POLL_INTERVAL_MS);
916
+ yieldPoll.unref?.();
917
+ }
790
918
  child.stdout?.on("data", (chunk) => {
791
919
  appendLimitedOutput(stdout, chunk);
792
920
  });
@@ -794,6 +922,10 @@ export async function runCommandForTool(cwd, input, abortSignal, coAuthor) {
794
922
  appendLimitedOutput(stderr, chunk);
795
923
  });
796
924
  child.once("error", (err) => {
925
+ if (backgroundEntry) {
926
+ settle(null, "error");
927
+ return;
928
+ }
797
929
  if (settled)
798
930
  return;
799
931
  settled = true;
@@ -801,10 +933,75 @@ export async function runCommandForTool(cwd, input, abortSignal, coAuthor) {
801
933
  reject(err);
802
934
  });
803
935
  child.once("close", (code, signal) => {
804
- finish(code, signal);
936
+ settle(code, signal);
805
937
  });
806
938
  });
807
939
  }
940
+ /** 读取后台命令的最新输出;waitMs > 0 时最多等待该时长(等待期间仍可让位)。 */
941
+ export async function commandOutputForTool(taskId, input, shouldYield) {
942
+ const entry = backgroundCommands.get(taskId);
943
+ if (!entry)
944
+ throw new Error(`未知的后台任务:${taskId}`);
945
+ const waitMs = normalizeCommandOutputWaitMs(input?.waitMs);
946
+ if (waitMs > 0 && !entry.done) {
947
+ await waitForBackgroundCommand(entry, waitMs, shouldYield);
948
+ }
949
+ return snapshotBackgroundCommand(entry);
950
+ }
951
+ /** 等待后台命令结束(或等待预算耗尽、或让位信号到来)。 */
952
+ function waitForBackgroundCommand(entry, waitMs, shouldYield) {
953
+ return new Promise((resolve) => {
954
+ let finished = false;
955
+ let poll;
956
+ const wake = () => {
957
+ if (finished)
958
+ return;
959
+ finished = true;
960
+ clearTimeout(timer);
961
+ if (poll)
962
+ clearInterval(poll);
963
+ const index = entry.waiters.indexOf(wake);
964
+ if (index >= 0)
965
+ entry.waiters.splice(index, 1);
966
+ resolve();
967
+ };
968
+ const timer = setTimeout(wake, waitMs);
969
+ timer.unref?.();
970
+ entry.waiters.push(wake);
971
+ if (shouldYield) {
972
+ poll = setInterval(() => {
973
+ let yieldNow = false;
974
+ try {
975
+ yieldNow = shouldYield() === true;
976
+ }
977
+ catch {
978
+ yieldNow = false;
979
+ }
980
+ if (yieldNow)
981
+ wake();
982
+ }, YIELD_POLL_INTERVAL_MS);
983
+ poll.unref?.();
984
+ }
985
+ });
986
+ }
987
+ /** 终止一个仍在运行的后台命令。 */
988
+ export async function commandKillForTool(taskId) {
989
+ const entry = backgroundCommands.get(taskId);
990
+ if (!entry)
991
+ throw new Error(`未知的后台任务:${taskId}`);
992
+ if (entry.done)
993
+ return { taskId, killed: false };
994
+ await killProcessTree(entry.child.pid);
995
+ return { taskId, killed: true };
996
+ }
997
+ /** 终止并清空全部后台命令句柄(进程退出与测试收尾),避免留下孤儿进程。 */
998
+ export function killAllBackgroundCommands() {
999
+ for (const entry of backgroundCommands.values()) {
1000
+ if (!entry.done)
1001
+ void killProcessTree(entry.child.pid);
1002
+ }
1003
+ backgroundCommands.clear();
1004
+ }
808
1005
  export async function editFileForTool(cwd, input) {
809
1006
  if (!Array.isArray(input.edits) || input.edits.length === 0) {
810
1007
  throw new Error("edits must contain at least one replacement");
@@ -1090,7 +1287,7 @@ export function createBuiltinFileTools(cwd, options = {}) {
1090
1287
  execute: (input) => presentFileForTool(cwd, input),
1091
1288
  }),
1092
1289
  run_command: tool({
1093
- description: "在本地工作区运行非交互式 shell 命令。用于测试、git 和包脚本。返回 stdout/stderr 和 exitCode;非零退出码不是工具错误。",
1290
+ description: "在本地工作区运行非交互式 shell 命令。用于测试、git 和包脚本。返回 stdout/stderr 和 exitCode;非零退出码不是工具错误。命令运行期间若用户发来新消息,会立即转入后台并返回 taskId(backgrounded:true),命令继续运行,用 command_output 取后续输出。",
1094
1291
  inputSchema: jsonSchema({
1095
1292
  type: "object",
1096
1293
  additionalProperties: false,
@@ -1108,9 +1305,34 @@ export function createBuiltinFileTools(cwd, options = {}) {
1108
1305
  reason: isDangerousCommand(input.command) ? "high-risk" : "rule",
1109
1306
  detail: `运行命令: ${input.command}`,
1110
1307
  });
1111
- return runCommandForTool(cwd, input, execOptions.abortSignal, options.gitCoAuthor);
1308
+ return runCommandForTool(cwd, input, execOptions.abortSignal, options.gitCoAuthor, options.shouldYieldToInjection);
1112
1309
  },
1113
1310
  }),
1311
+ command_output: tool({
1312
+ description: "读取被让位到后台的命令的最新输出。立即返回当前状态;waitMs 可最多等待 30 秒。任务结束后可反复读取完整 stdout/stderr。",
1313
+ inputSchema: jsonSchema({
1314
+ type: "object",
1315
+ additionalProperties: false,
1316
+ properties: {
1317
+ taskId: { type: "string", description: "run_command 返回的 taskId(backgrounded:true 时)。" },
1318
+ waitMs: { type: "number", description: `可选等待毫秒数;0 或省略立即返回,上限 ${MAX_COMMAND_OUTPUT_WAIT_MS}。` },
1319
+ },
1320
+ required: ["taskId"],
1321
+ }),
1322
+ execute: (input) => commandOutputForTool(input.taskId, input, options.shouldYieldToInjection),
1323
+ }),
1324
+ command_kill: tool({
1325
+ description: "终止一个仍在后台运行的命令(run_command 让位后转入后台的)。",
1326
+ inputSchema: jsonSchema({
1327
+ type: "object",
1328
+ additionalProperties: false,
1329
+ properties: {
1330
+ taskId: { type: "string", description: "run_command 返回的 taskId。" },
1331
+ },
1332
+ required: ["taskId"],
1333
+ }),
1334
+ execute: (input) => commandKillForTool(input.taskId),
1335
+ }),
1114
1336
  task: tool({
1115
1337
  description: "把独立子任务委派给子代理执行:子代理使用子模型、拥有独立上下文,不污染主对话上下文。适合边界清晰、可独立交付的调研/代码生成子任务(如扫描整个仓库、阅读长文档、生成独立模块)。子代理不能再次委派任务(禁止嵌套),结果会截断回传。",
1116
1338
  inputSchema: jsonSchema({
package/dist/index.d.ts CHANGED
@@ -68,6 +68,12 @@ export interface ChatSessionOptions {
68
68
  compactionTimeoutMs?: number;
69
69
  /** Optional tool-step limit. Leave unset for no step limit. */
70
70
  maxSteps?: number;
71
+ /**
72
+ * 让位注入判定:返回 true 表示会话有待注入的用户消息,在途 run_command 应立即
73
+ * 转入后台并返回句柄,好让当前 step 尽快结束以便在下一个 step 边界注入。
74
+ * 未提供时 run_command 保持原有阻塞语义(独立 CLI 等场景不受影响)。
75
+ */
76
+ shouldYieldToInjection?: () => boolean;
71
77
  /**
72
78
  * Custom skill directories (<dir>/<name>/SKILL.md). When set, these are
73
79
  * scanned with the highest priority (deepccc source). Defaults to the
@@ -146,6 +152,8 @@ export declare class ChatSession {
146
152
  private context;
147
153
  private compactionTimeoutMs;
148
154
  private maxSteps?;
155
+ /** 透传给 run_command 的让位注入判定(见 ChatSessionOptions.shouldYieldToInjection)。 */
156
+ private shouldYieldToInjection?;
149
157
  private effort;
150
158
  private maxOutputTokens?;
151
159
  private streaming;
package/dist/index.js CHANGED
@@ -270,6 +270,8 @@ export class ChatSession {
270
270
  context;
271
271
  compactionTimeoutMs;
272
272
  maxSteps;
273
+ /** 透传给 run_command 的让位注入判定(见 ChatSessionOptions.shouldYieldToInjection)。 */
274
+ shouldYieldToInjection;
273
275
  effort;
274
276
  maxOutputTokens;
275
277
  streaming;
@@ -359,6 +361,7 @@ export class ChatSession {
359
361
  this.subModel = this.subModelId ? provider(this.subModelId) : this.model;
360
362
  this.cwd = options.cwd ?? process.cwd();
361
363
  this.maxSteps = normalizeMaxSteps(options.maxSteps);
364
+ this.shouldYieldToInjection = options.shouldYieldToInjection;
362
365
  this.compactionTimeoutMs = Math.max(1, options.compactionTimeoutMs ?? DEFAULT_COMPACTION_TIMEOUT_MS);
363
366
  this.customSystemPrompt = options.systemPrompt ?? "";
364
367
  this.permissionMode = options.permissionMode ?? "ask";
@@ -493,6 +496,7 @@ export class ChatSession {
493
496
  tools: createBuiltinFileTools(this.cwd, {
494
497
  permissionGate: this.permissionGate,
495
498
  runTask: this.runTask,
499
+ shouldYieldToInjection: this.shouldYieldToInjection,
496
500
  gitCoAuthor: {
497
501
  ...appConfig.git.coAuthor,
498
502
  enabled: this.gitCoAuthorEnabled,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepccc",
3
- "version": "0.2.15",
3
+ "version": "0.2.17",
4
4
  "description": "A lightweight coding agent with OpenAI-compatible and Anthropic Messages API support.",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [