codemini-cli 0.3.1 → 0.3.3

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/OPERATIONS.md CHANGED
@@ -127,6 +127,10 @@ Use this when you want to separate:
127
127
  /retry
128
128
  ```
129
129
 
130
+ Note:
131
+ - The old manual `/tasks` board has been removed.
132
+ - For complex single-task work, the assistant now maintains an internal session todo checklist automatically and shows it in the TUI.
133
+
130
134
  Available sub-agent roles:
131
135
 
132
136
  ```text
package/README.md CHANGED
@@ -5,41 +5,72 @@
5
5
 
6
6
  ## English
7
7
 
8
- CodeMini CLI is a coding assistant CLI optimized for small-model workflows, with a strong focus on Windows and PowerShell.
8
+ CodeMini CLI is a terminal coding assistant built for teams that want a smaller, sharper, and more controllable agent experience.
9
9
 
10
- It is designed for teams that want a coding assistant that feels practical, controllable, and fast in real development environments, especially when smaller internal models are part of the workflow.
10
+ It is designed around a deliberate idea: most coding workflows do not need a huge default tool surface or unrestricted shell behavior. Instead, CodeMini starts with a compact core, loads advanced tools on demand, and keeps the agent grounded in structured code operations, session todos, lightweight project indexing, and shell-aware safety rules.
11
11
 
12
12
  ### Why CodeMini CLI
13
13
 
14
- - Optimized for small-model workflows rather than assuming frontier-scale reasoning
15
- - Built with Windows and PowerShell as first-class environments
16
- - Keeps the default tool surface intentionally small and easier to control
17
- - Uses shell-aware execution policy instead of exposing unrestricted system access
18
- - Supports sub-agent workflows without forcing full-history context sharing
19
-
20
- ### Highlights
21
-
22
- - Minimal default tools: `run`, `read`, `write`
23
- - Windows-aware shell profile with PowerShell-focused defaults
24
- - Safe mode enabled by default
25
- - Built-in lite skills for planning, execution, and collaboration
26
- - Configurable reply language through `ui.reply_language` (`zh` / `en`)
27
- - Richer slash completion with priority sorting, inline descriptions, and left/right paging
28
- - Structured code tools for small models: `grep`, `read`, `edit`
29
- - Tree-sitter AST tools for small models: `ast_query`, `read_ast_node`, node-scoped `edit`
30
- - More conservative `plan auto` acceptance checks with reviewer/tester goal checklists
31
- - Tone presets through `soul`, without changing plans or code behavior
32
- - Example soul presets include `professional`, `playful`, `anime`, `pirate`, `caveman`, and `ceo`
33
- - Sub-agents for planning, coding, review, and testing
14
+ - Built for practical coding workflows, especially when smaller or internal models are part of the stack
15
+ - Keeps the default tool list intentionally small, with additional tools discoverable through `tool_search`
16
+ - Treats Windows and PowerShell as first-class environments instead of Linux-only afterthoughts
17
+ - Prefers structured file and code tools over noisy shell fallbacks
18
+ - Supports planning, execution, todo tracking, and sub-agent workflows without forcing a bloated interface
19
+
20
+ ### What It Feels Like
21
+
22
+ - A coding CLI that is fast to steer
23
+ - A tool surface that is easier to audit and reason about
24
+ - A TUI that makes execution visible instead of hiding agent state
25
+ - A workflow that stays useful even when the model is not frontier-scale
26
+
27
+ ### Core Capabilities
28
+
29
+ - Compact default tools for daily work:
30
+ - `read`
31
+ - `grep`
32
+ - `list`
33
+ - `query_project_index`
34
+ - `edit`
35
+ - `write`
36
+ - `update_todos`
37
+ - `run`
38
+ - `tool_search`
39
+ - On-demand tools for advanced workflows:
40
+ - `glob`
41
+ - AST tools: `ast_query`, `read_ast_node`
42
+ - diff tools: `generate_diff`, `patch`
43
+ - background task management tools
44
+ - persistent memory tools
45
+ - Session-scoped todo tracking through `update_todos`, rendered directly in the TUI
46
+ - Unified shell execution model:
47
+ - one-shot commands through `run`
48
+ - long-running commands through `run` with `run_in_background=true`
49
+ - background task inspection through deferred tools when needed
50
+ - Lightweight project index in `.codemini-project/` for repository-aware prompting
51
+ - Tree-sitter-assisted structural editing for function/class/method scoped work
52
+ - Sub-agent support for planning, coding, review, and testing workflows
53
+ - Reply language control through `ui.reply_language`
54
+ - Tone presets through `soul`, without changing planning or code behavior
55
+
56
+ ### Workflow Highlights
57
+
58
+ - `update_todos` is used for complex single-task work and rendered as a native checklist in the TUI
59
+ - `plan auto` is oriented toward task decomposition and execution sequencing
60
+ - `task`-level execution tracking is separated from `plan` and handled through the internal todo checklist
61
+ - The shell workflow is unified: the assistant no longer has to switch mental models between one-shot commands and long-running service tools
62
+ - The prompt explicitly teaches the model that the visible default tools are not the full tool universe; it should use `tool_search` when it needs more capability
63
+ - Slash completion includes prioritization, paging, and inline descriptions
64
+ - Safe mode is enabled by default
34
65
 
35
66
  ### Quick Start
36
67
 
37
68
  ```bash
38
69
  codemini config set gateway.base_url http://your-internal-gateway/v1
39
70
  codemini config set gateway.api_key your_token
71
+ codemini config set model.name your-30b-model
40
72
  codemini config set shell.default powershell
41
73
  codemini config set ui.reply_language zh
42
- codemini config set model.name your-30b-model
43
74
  codemini doctor
44
75
  codemini
45
76
  ```
@@ -50,7 +81,7 @@ For macOS or Linux:
50
81
  codemini config set shell.default bash
51
82
  ```
52
83
 
53
- ### Command Overview
84
+ ### Commands
54
85
 
55
86
  ```text
56
87
  codemini [prompt]
@@ -61,112 +92,139 @@ codemini doctor
61
92
  codemini skill list|install|enable|disable|inspect|reindex
62
93
  ```
63
94
 
64
- ### Notable Workflow Features
95
+ ### How The Tool Model Works
65
96
 
66
- - `ui.reply_language` controls the assistant reply language at the prompt layer and also nudges generated docs and code comments to match
67
- - Slash completion now prioritizes important commands and config keys, shows short descriptions, and supports `←/→` page switching
68
- - Ambiguous feature requests can pause for lightweight brainstorming first, and `/brainstorm <question>` gives an explicit way to compare options before coding
69
- - `plan auto` now turns the original goal into an acceptance checklist, uses a lighter chain only for truly tiny tasks, and treats unmet checklist items as failure signals
70
- - Structured code tools reduce shell-noise for small models by preferring `grep/read -> edit`
71
- - Tree-sitter-aware code tools support `grep/read -> ast_query/read_ast_node -> edit(ast_target)` for function/class-level edits with explicit node range limits
72
- - Current Tree-sitter language support includes JavaScript/JSX, TypeScript/TSX, Python, Go, C, C++, Bash, Java, Rust, C#, PHP, and Ruby
97
+ CodeMini CLI intentionally separates tools into two layers:
73
98
 
74
- ### Skill Loading
99
+ - Default tools:
100
+ always visible, optimized for the most common coding path
101
+ - Deferred tools:
102
+ loaded only when needed through `tool_search`
75
103
 
76
- CodeMini CLI loads skills from these locations:
104
+ This keeps the main interface smaller and makes the agent's first-choice behavior more predictable.
77
105
 
78
- - Bundled repo skills: `skills/<name>/SKILL.md`
79
- - Installed global skills: `<base-config-dir>/skills/<name>/SKILL.md`
80
- - Project-scoped skills: `.codemini/skills/<name>/SKILL.md`
106
+ Typical flow:
81
107
 
82
- The base config directory is resolved in this order:
83
-
84
- - `CODEMINI_GLOBAL_DIR`
85
- - Windows: `%APPDATA%\\codemini-global\\`
86
- - macOS: `~/Library/Preferences/codemini-global`
87
- - Linux/XDG: `$XDG_CONFIG_HOME/codemini-global`
88
- - Fallback in restricted environments: `.codemini-global/`
108
+ 1. `query_project_index` or `list` to orient
109
+ 2. `read` and `grep` to inspect
110
+ 3. `edit` or `write` to change code
111
+ 4. `run` to verify
112
+ 5. `update_todos` to keep complex work legible
113
+ 6. `tool_search` only when a more specialized capability is needed
89
114
 
90
- ### Brainstorming
91
-
92
- Use `/brainstorm <question>` when you want the assistant to stop before coding, compare 2-3 approaches, and choose one direction first.
93
-
94
- ```text
95
- /brainstorm Should login retry stay local or become a shared helper?
96
- ```
97
-
98
- ### Documentation
99
- ### Release Checklist
115
+ ### Project Index
100
116
 
101
- For information on how to perform a release, please see the [Release Checklist](RELEASE_CHECKLIST.md) document.
117
+ CodeMini CLI maintains a lightweight project index inside `.codemini-project/`:
102
118
 
119
+ - `project-map.json`
120
+ high-level repository facts such as languages, source roots, test roots, and entry candidates
121
+ - `file-index.json`
122
+ per-file structure such as imports, exports, functions, classes, and lightweight symbol hints
103
123
 
104
- - Operator guide and common command patterns: [OPERATIONS.md](/mnt/e/Git%20Projects/qurio-coder/OPERATIONS.md)
105
- - Packaging and deployment guide: [deployment.md](/mnt/e/Git%20Projects/qurio-coder/deployment.md)
124
+ The index is initialized when entering a project and refreshed incrementally after edits, writes, and patches. It is intended to be factual, compact, and cheap to keep current.
106
125
 
107
126
  ### Data Layout
108
127
 
109
- - Project-scoped workspace data: `.codemini/`
110
- - Global user data on Windows: `%APPDATA%\\codemini-global\\`
111
- - Restricted-environment fallback: `.codemini-global/`
128
+ - Session and project workspace state: `.codemini/`
129
+ - Lightweight project index: `.codemini-project/`
130
+ - Bundled repo skills: `skills/<name>/SKILL.md`
131
+ - Project-scoped skills: `.codemini/skills/<name>/SKILL.md`
132
+ - Global installed skills: `<base-config-dir>/skills/<name>/SKILL.md`
133
+
134
+ Base config directory resolution order:
112
135
 
113
- ### Project Index
136
+ - `CODEMINI_GLOBAL_DIR`
137
+ - Windows: `%APPDATA%\codemini-global\`
138
+ - macOS: `~/Library/Preferences/codemini-global`
139
+ - Linux / XDG: `$XDG_CONFIG_HOME/codemini-global`
140
+ - Restricted fallback: `.codemini-global/`
114
141
 
115
- CodeMini CLI now maintains a lightweight project index inside `.codemini-project/`:
142
+ ### Documentation
116
143
 
117
- - `project-map.json` for project skeleton metadata such as languages, important files, source roots, test roots, and entry candidates
118
- - `file-index.json` for per-file symbols, imports, exports, functions, classes, and basic call hints
144
+ - Operator guide and workflow notes: [OPERATIONS.md](/mnt/e/Git%20Projects/qurio-coder/OPERATIONS.md)
145
+ - Packaging and deployment: [deployment.md](/mnt/e/Git%20Projects/qurio-coder/deployment.md)
146
+ - Release process: [RELEASE_CHECKLIST.md](/mnt/e/Git%20Projects/qurio-coder/RELEASE_CHECKLIST.md)
119
147
 
120
- The index is initialized once when entering a project and refreshed incrementally after code edits, writes, and patches. Session data stays in `.codemini/`; project structure lives in `.codemini-project/`. The index is intentionally lightweight and fact-based rather than an LLM-generated project report.
121
- At request time, CodeMini injects a short project-context summary from this index into the model prompt instead of dumping the full index.
148
+ ### Good Fit
122
149
 
123
- ### Positioning
150
+ CodeMini CLI is a strong fit if you want:
124
151
 
125
- CodeMini CLI is a better fit if you want:
126
152
  - a coding CLI that behaves well with smaller models
127
- - a Windows and PowerShell-friendly workflow
128
- - a more controlled execution surface
129
- - multi-agent execution with stronger review and verification steps
153
+ - a controlled tool surface instead of an everything-is-exposed agent
154
+ - Windows and PowerShell support that feels intentional
155
+ - a TUI that shows plans, todos, tools, and progress clearly
156
+ - a code assistant that prefers structured operations over shell noise
130
157
 
131
158
  ---
132
159
 
133
160
  ## 简体中文
134
161
 
135
- CodeMini CLI 是一个为小模型工作流优化过的代码助手 CLI,重点针对 Windows 和 PowerShell 做了打磨。
136
-
137
- 它更适合那些希望代码助手在真实开发环境里更稳、更可控、更实用的团队,尤其是在内部小模型参与日常工作的场景下。
138
-
139
- ### 为什么做这个
140
-
141
- - 面向小模型工作流优化,而不是默认假设超大模型能力
142
- - Windows 和 PowerShell 当作一等公民
143
- - 默认工具面更小,更容易控制
144
- - 使用 shell-aware 的执行策略,而不是无边界暴露系统能力
145
- - 支持 sub-agent 协作,但不会强制共享整段上下文历史
146
-
147
- ### 主要特点
148
-
149
- - 默认工具极简:`run`、`read`、`write`
150
- - 面向 Windows 的 PowerShell 默认配置
162
+ CodeMini CLI 是一个面向真实开发环境的终端代码助手,目标不是“把所有能力都塞进默认界面”,而是做一个更克制、更清晰、更容易掌控的 coding agent CLI。
163
+
164
+ 它围绕一个很明确的原则来设计:默认工具面尽量小,常用路径尽量顺,复杂能力按需加载。这样既更适合小模型,也更适合团队在内部环境里做稳定、可控的日常开发协作。
165
+
166
+ ### 为什么是它
167
+
168
+ - 面向小模型和内部模型工作流优化,而不是默认假设超大模型能力
169
+ - 默认工具面刻意精简,需要更高级能力时再通过 `tool_search` 加载
170
+ - 把 Windows 和 PowerShell 当作一等公民来支持
171
+ - 优先走结构化代码工具,而不是让模型长期泡在嘈杂 shell 输出里
172
+ - 同时支持规划、执行、待办追踪和 sub-agent 协作,但不把界面做得臃肿
173
+
174
+ ### 使用体验
175
+
176
+ - 更容易 steer 的 coding CLI
177
+ - 更容易审计和理解的工具面
178
+ - 更强调执行可视化的 TUI
179
+ - 即使模型不是 frontier 级别,也依然能稳定工作
180
+
181
+ ### 核心能力
182
+
183
+ - 默认主工具保持在高频主路径:
184
+ - `read`
185
+ - `grep`
186
+ - `list`
187
+ - `query_project_index`
188
+ - `edit`
189
+ - `write`
190
+ - `update_todos`
191
+ - `run`
192
+ - `tool_search`
193
+ - 更专业的能力按需加载:
194
+ - `glob`
195
+ - AST 工具:`ast_query`、`read_ast_node`
196
+ - diff 工具:`generate_diff`、`patch`
197
+ - 后台任务管理工具
198
+ - 持久 memory 工具
199
+ - 通过 `update_todos` 维护复杂单任务的会话级待办清单,并直接渲染在 TUI 中
200
+ - 统一的 shell 执行模型:
201
+ - 一次性命令直接 `run`
202
+ - 长运行命令通过 `run` + `run_in_background=true`
203
+ - 需要时再加载后台任务管理工具
204
+ - 在 `.codemini-project/` 下维护轻量项目索引,帮助模型更快理解仓库
205
+ - 基于 Tree-sitter 的结构化编辑能力,适合函数级、类级、方法级改动
206
+ - 支持 planner、coder、reviewer、tester 等 sub-agent 协作
207
+ - 支持通过 `ui.reply_language` 控制回复语言
208
+ - `soul` 只影响语气和表达,不改变计划或代码行为
209
+
210
+ ### 工作流亮点
211
+
212
+ - 复杂单任务会使用 `update_todos`,并在 TUI 里以原生 checklist 方式展示
213
+ - `plan auto` 专注于任务拆解、顺序和执行编排
214
+ - 单任务内部的执行推进则由 todo checklist 负责,不和 `plan` 混在一起
215
+ - shell 模型已经统一,不再需要在“一次性命令”和“长运行服务工具”之间切换心智
216
+ - prompt 会明确告诉模型:默认看到的工具不是全部工具,缺能力时先 `tool_search`
217
+ - slash 补全支持优先级、分页和简短说明
151
218
  - safe mode 默认开启
152
- - 内置 lite skills,覆盖规划、执行和协作
153
- - 支持通过 `ui.reply_language` 配置回复语言,当前支持 `zh` / `en`
154
- - slash 补全支持优先级排序、右侧简短说明和左右分页
155
- - 为小模型补了结构化代码工具:`grep`、`read`、`edit`
156
- - 为小模型补了 Tree-sitter AST 工具:`ast_query`、`read_ast_node`,以及带 node 范围限制的 `edit`
157
- - `plan auto` 会基于原始目标生成验收清单,并更保守地处理 reviewer/tester 结果
158
- - `soul` 只影响语气,不影响计划和代码行为
159
- - 可用的 `soul` 示例包括 `professional`、`playful`、`anime`、`pirate`、`caveman`、`ceo`
160
- - 支持 planner、coder、reviewer、tester 多角色 sub-agent
161
219
 
162
220
  ### 快速开始
163
221
 
164
222
  ```bash
165
223
  codemini config set gateway.base_url http://your-internal-gateway/v1
166
224
  codemini config set gateway.api_key your_token
225
+ codemini config set model.name your-30b-model
167
226
  codemini config set shell.default powershell
168
227
  codemini config set ui.reply_language zh
169
- codemini config set model.name your-30b-model
170
228
  codemini doctor
171
229
  codemini
172
230
  ```
@@ -188,57 +246,65 @@ codemini doctor
188
246
  codemini skill list|install|enable|disable|inspect|reindex
189
247
  ```
190
248
 
191
- ### 近期工作流增强
249
+ ### 工具模型怎么设计
250
+
251
+ CodeMini CLI 把工具分成两层:
252
+
253
+ - 默认工具
254
+ 永远可见,覆盖最常见的编码主路径
255
+ - 延迟工具
256
+ 只有在需要时才通过 `tool_search` 加载
257
+
258
+ 这样做的目标,是让主界面更小、更稳,也让模型在第一反应时更容易走对路径。
192
259
 
193
- - `ui.reply_language` 通过 prompt 层控制模型回复语言,也会尽量让生成文档和代码注释跟随该语言
194
- - slash 补全会优先展示更重要的命令和配置项,显示简短说明,并支持 `←/→` 翻页
195
- - 对于需求仍不明确的功能请求,CLI 会先偏向轻量 brainstorm;也可以显式使用 `/brainstorm <问题>` 先比较方案再决定是否编码
196
- - `plan auto` 会先把原始目标展开成验收清单;只有真正很小的任务才会走轻量链路;如果 reviewer 或 tester 标记了未满足或未验证的验收项,就不会按成功处理
197
- - 为了减少小模型被 shell 原始输出干扰,新增了 `grep/read -> edit` 这套结构化代码工具流
198
- - 现在也支持 `grep/read -> ast_query/read_ast_node -> edit(ast_target)` 这套 AST 工作流,适合函数级/类级精准编辑,并且能限制小模型只能修改显式选中的 node 范围
199
- - 当前内置的 Tree-sitter 语言支持包括 JavaScript/JSX、TypeScript/TSX、Python、Go、C、C++、Bash、Java、Rust、C#、PHP、Ruby
260
+ 典型流程通常是:
200
261
 
201
- ### Skill 加载位置
262
+ 1. `query_project_index` 或 `list` 做定位
263
+ 2. `read` 和 `grep` 做理解
264
+ 3. `edit` 或 `write` 做改动
265
+ 4. `run` 做验证
266
+ 5. `update_todos` 追踪复杂任务
267
+ 6. 真的需要专门能力时,再 `tool_search`
202
268
 
203
- CodeMini CLI 会从这些位置读取 skill:
269
+ ### 项目索引
270
+
271
+ CodeMini CLI 会在 `.codemini-project/` 下维护一份轻量项目索引:
272
+
273
+ - `project-map.json`
274
+ 记录仓库的高层结构事实,比如语言、源码目录、测试目录、入口候选
275
+ - `file-index.json`
276
+ 记录文件级结构信息,比如 imports、exports、functions、classes 和轻量 symbol 提示
277
+
278
+ 这份索引会在进入项目时初始化,在 `edit`、`write`、`patch` 后做增量刷新。它的目标是轻量、可靠、低噪声,而不是生成一份很长的 AI 报告。
279
+
280
+ ### 数据目录
204
281
 
282
+ - 会话和项目工作区状态:`.codemini/`
283
+ - 轻量项目索引:`.codemini-project/`
205
284
  - 仓库内置 skill:`skills/<name>/SKILL.md`
206
- - 全局已安装 skill:`<base-config-dir>/skills/<name>/SKILL.md`
207
285
  - 项目级 skill:`.codemini/skills/<name>/SKILL.md`
286
+ - 全局已安装 skill:`<base-config-dir>/skills/<name>/SKILL.md`
208
287
 
209
- `base-config-dir` 的解析顺序是:
288
+ `base-config-dir` 的解析顺序:
210
289
 
211
290
  - `CODEMINI_GLOBAL_DIR`
212
- - Windows:`%APPDATA%\\codemini-global\\`
291
+ - Windows:`%APPDATA%\codemini-global\`
213
292
  - macOS:`~/Library/Preferences/codemini-global`
214
293
  - Linux / XDG:`$XDG_CONFIG_HOME/codemini-global`
215
294
  - 受限环境回退:`.codemini-global/`
216
295
 
217
- ### Brainstorm 用法
218
-
219
- 当你希望助手先收敛方向、不要立即写代码时,可以使用:
220
-
221
- ```text
222
- /brainstorm Should login retry stay local or become a shared helper?
223
- ```
224
-
225
296
  ### 文档入口
226
297
 
227
- - 操作手册与常见命令组合:[OPERATIONS.md](/mnt/e/Git%20Projects/qurio-coder/OPERATIONS.md)
228
- - 打包与部署手册:[deployment.md](/mnt/e/Git%20Projects/qurio-coder/deployment.md)
229
-
230
- ### 数据目录
231
-
232
- - 项目工作区数据:`.codemini/`
233
- - Windows 全局用户数据:`%APPDATA%\\codemini-global\\`
234
- - 受限环境回退目录:`.codemini-global/`
235
-
236
- ### 项目索引
298
+ - 操作手册与工作流说明:[OPERATIONS.md](/mnt/e/Git%20Projects/qurio-coder/OPERATIONS.md)
299
+ - 打包与部署文档:[deployment.md](/mnt/e/Git%20Projects/qurio-coder/deployment.md)
300
+ - 发布流程:[RELEASE_CHECKLIST.md](/mnt/e/Git%20Projects/qurio-coder/RELEASE_CHECKLIST.md)
237
301
 
238
- CodeMini CLI 现在会在 `.codemini-project/` 下维护一份轻量项目索引:
302
+ ### 适合谁
239
303
 
240
- - `project-map.json`:记录项目骨架信息,例如语言、关键文件、源码目录、测试目录、入口候选
241
- - `file-index.json`:记录文件级结构信息,例如 symbols、imports、exports、functions、classes、基础 calls
304
+ 如果你想要的是下面这种工具,CodeMini CLI 会很合适:
242
305
 
243
- 这份索引会在进入项目时初始化一次,在 `edit`、`write`、`patch` 后做增量刷新。`.codemini/` 继续保存会话态数据,`.codemini-project/` 保存项目结构索引。它是程序维护的轻量事实索引,不是模型生成的项目总结。
244
- 在真正请求模型时,CodeMini 会从这份索引里裁一小段项目摘要注入 prompt,而不是把整份索引直接塞进去。
306
+ - 能和小模型稳定协作的 coding CLI
307
+ - 更克制、更可控的工具暴露方式
308
+ - 真正重视 Windows / PowerShell 体验的终端工作流
309
+ - 能把计划、待办、工具调用和执行状态展示清楚的 TUI
310
+ - 更偏结构化操作、而不是大量 shell 噪声的代码助手
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codemini-cli",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Coding CLI optimized for small-model workflows and Windows PowerShell",
5
5
  "keywords": [
6
6
  "cli",
@@ -47,6 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@cursorless/tree-sitter-wasms": "^0.5.0",
50
+ "@anthropic-ai/sdk": "^0.82.0",
50
51
  "ink": "^6.3.1",
51
52
  "openai": "^6.33.0",
52
53
  "react": "^19.0.0",
@@ -98,6 +98,7 @@ export async function handleChat(args) {
98
98
  runtime,
99
99
  sessionId: session.id,
100
100
  model: parsed.model || config.model.name,
101
+ sdkProvider: config.sdk?.provider || 'openai-compatible',
101
102
  language: config.ui?.language || 'zh',
102
103
  shellName: config.shell?.default || 'powershell',
103
104
  safeMode: config.policy?.safe_mode !== false,
@@ -1,9 +1,10 @@
1
1
  import { loadConfig } from '../core/config-store.js';
2
2
  import { buildDefaultSystemPrompt } from '../core/default-system-prompt.js';
3
3
  import { runAgentLoop } from '../core/agent-loop.js';
4
- import { createChatCompletion } from '../core/provider/openai-compatible.js';
4
+ import { createChatCompletion } from '../core/provider/index.js';
5
5
  import { buildSystemPromptWithSoul } from '../core/soul.js';
6
6
  import { getBuiltinTools } from '../core/tools.js';
7
+ import { buildMemorySnapshot } from '../core/memory-prompt.js';
7
8
 
8
9
  function parseRunArgs(args) {
9
10
  const parsed = {
@@ -39,7 +40,9 @@ export async function handleRun(args) {
39
40
  workspaceRoot: process.cwd(),
40
41
  config
41
42
  });
42
- const systemPrompt = await buildSystemPromptWithSoul(buildDefaultSystemPrompt(config), config);
43
+ const soulPrompt = await buildSystemPromptWithSoul(buildDefaultSystemPrompt(config), config);
44
+ const memorySnapshot = await buildMemorySnapshot({ config, workspaceRoot: process.cwd() }).catch(() => '');
45
+ const systemPrompt = [soulPrompt, memorySnapshot].filter(Boolean).join('\n\n');
43
46
 
44
47
  const result = await runAgentLoop({
45
48
  systemPrompt,
@@ -52,6 +55,7 @@ export async function handleRun(args) {
52
55
  maxSteps: parsed.maxSteps,
53
56
  requestCompletion: async ({ messages, tools, model }) =>
54
57
  createChatCompletion({
58
+ sdkProvider: config.sdk?.provider,
55
59
  baseUrl: config.gateway.base_url,
56
60
  apiKey: config.gateway.api_key,
57
61
  model,
@@ -194,6 +194,9 @@ function compactToolResult(result, toolName, args, maxChars = 12000) {
194
194
  if ('tasks' in obj && Array.isArray(obj.tasks)) {
195
195
  return `${obj.tasks.length} task(s)`;
196
196
  }
197
+ if ('newTodos' in obj && Array.isArray(obj.newTodos)) {
198
+ return obj.newTodos.length > 0 ? `updated ${obj.newTodos.length} todo item(s)` : 'cleared todo list';
199
+ }
197
200
 
198
201
  // Fallback: clip with reduced limit
199
202
  return clipToolResult(obj, Math.min(maxChars, 4000));
@@ -305,7 +308,7 @@ export function checkReadDedup(filePath, startLine, endLine, mtimeMs) {
305
308
  const READ_ONLY_TOOLS = new Set([
306
309
  'read', 'grep', 'glob', 'list',
307
310
  'ast_query', 'read_ast_node', 'generate_diff',
308
- 'list_services', 'get_service_status', 'get_service_logs'
311
+ 'list_background_tasks', 'get_background_task'
309
312
  ]);
310
313
 
311
314
  // ─── Exported helpers ────────────────────────────────────────────────
@@ -370,19 +373,15 @@ export function summarizeToolResult(result) {
370
373
  const status = trimInline(obj.status || 'unknown', 32);
371
374
  const taskId = trimInline(obj.task_id || '', 24);
372
375
  const source = trimInline(obj.startup_source || '', 24);
373
- const logs = Array.isArray(obj.recent_logs) ? trimInline(obj.recent_logs.slice(-1)[0] || '', 96) : '';
374
- return `${taskId || 'service'} ${status}${source ? ` (${source})` : ''}${logs ? `\n${logs}` : ''}`;
376
+ const outputFile = trimInline(obj.output_file || '', 72);
377
+ const output = Array.isArray(obj.recent_output) ? trimInline(obj.recent_output.slice(-1)[0] || '', 96) : '';
378
+ return `${taskId || 'task'} ${status}${source ? ` (${source})` : ''}${outputFile ? ` -> ${outputFile}` : ''}${output ? `\n${output}` : ''}`;
375
379
  }
376
- if ('services' in obj && Array.isArray(obj.services)) {
377
- const count = obj.services.length;
378
- const first = obj.services[0];
380
+ if ('tasks' in obj && Array.isArray(obj.tasks)) {
381
+ const count = obj.tasks.length;
382
+ const first = obj.tasks[0];
379
383
  const lead = first?.task_id ? `${trimInline(first.task_id, 24)} ${trimInline(first.status || 'unknown', 24)}` : '';
380
- return `services(${count})${lead ? `\n${lead}` : ''}`;
381
- }
382
- if ('task_id' in obj && 'recent_logs' in obj) {
383
- const taskId = trimInline(obj.task_id || '', 24);
384
- const logs = Array.isArray(obj.recent_logs) ? trimInline(obj.recent_logs.slice(-1)[0] || '', 96) : '';
385
- return `${taskId || 'service logs'}${logs ? `\n${logs}` : ''}`;
384
+ return `tasks(${count})${lead ? `\n${lead}` : ''}`;
386
385
  }
387
386
  if ('files' in obj && Array.isArray(obj.files)) {
388
387
  return `patched ${obj.files.length} file(s)`;
@@ -397,6 +396,9 @@ export function summarizeToolResult(result) {
397
396
  if ('tasks' in obj && Array.isArray(obj.tasks)) {
398
397
  return `${obj.tasks.length} task(s)`;
399
398
  }
399
+ if ('newTodos' in obj && Array.isArray(obj.newTodos)) {
400
+ return obj.newTodos.length > 0 ? `updated ${obj.newTodos.length} todo item(s)` : 'cleared todo list';
401
+ }
400
402
  const keys = Object.keys(obj);
401
403
  return keys.length > 0 ? `keys: ${keys.slice(0, 5).join(',')}` : 'object';
402
404
  }
@@ -601,18 +603,17 @@ function formatToolDisplayName(name, args) {
601
603
  const target = trimInline(args?.path || args?.file || '.', 96) || '.';
602
604
  return `edit(${target})`;
603
605
  }
606
+ if (name === 'update_todos') {
607
+ return 'update_todos';
608
+ }
604
609
  if (name === 'patch') {
605
610
  const target = trimInline(args?.path || args?.file || args?.patch || '', 96) || '.';
606
611
  return `patch(${target})`;
607
612
  }
608
- if (name === 'start_service') {
609
- const command = trimInline(args?.command || args?.cmd || '', 96);
610
- return command ? `${name}(${command})` : name;
611
- }
612
- if (name === 'list_services') {
613
+ if (name === 'list_background_tasks') {
613
614
  return name;
614
615
  }
615
- if (name === 'get_service_status' || name === 'get_service_logs' || name === 'stop_service') {
616
+ if (name === 'get_background_task' || name === 'stop_background_task') {
616
617
  const taskId = trimInline(args?.task_id || args?.taskId || '', 96);
617
618
  return taskId ? `${name}(${taskId})` : name;
618
619
  }
@@ -691,7 +692,7 @@ export async function runAgentLoop({
691
692
  const assistantText = completion.text || '';
692
693
  lastAssistantText = assistantText || lastAssistantText;
693
694
 
694
- const assistantMessage = { role: 'assistant', content: assistantText };
695
+ const assistantMessage = { role: 'assistant', content: completion?.content ?? assistantText };
695
696
  if (toolCalls.length > 0) {
696
697
  assistantMessage.tool_calls = toolCalls.map((tc) => ({
697
698
  id: tc.id,