qwen-audio-agent 1.0.0 → 1.1.1

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/PRIVACY.md CHANGED
@@ -9,9 +9,9 @@ qwen-audio-agent 是本地运行的语音前台,不包含内置遥测、广告
9
9
  DashScope 的 Qwen Audio Realtime 服务。若用户配置其他兼容服务,则数据发送到
10
10
  该服务。
11
11
  - 委派任务、必要的对话上下文和任务结果会发送给用户选择的后台 Agent,例如
12
- OpenCode、OpenClaw、Qoder、Hermes、CodeBuddy、Codex、Claude Code 或用户配置的
13
- 其他 ACP Agent。后台 Agent 还可能按照用户配置调用模型、工具、MCP 服务或访问
14
- 项目文件;这些服务各自的隐私政策同样适用。
12
+ OpenCode、OpenClaw、Qoder、Kimi Code、Hermes、CodeBuddy、Codex、Claude Code
13
+ 或用户配置的其他 ACP Agent。后台 Agent 还可能按照用户配置调用模型、工具、
14
+ MCP 服务或访问项目文件;这些服务各自的隐私政策同样适用。
15
15
  - Markdown 中的远程图片、音频和视频默认不会自动加载。用户点击加载或打开链接
16
16
  后,目标站点可能获知用户的 IP 地址和浏览器信息。
17
17
 
package/README.md CHANGED
@@ -9,19 +9,20 @@
9
9
 
10
10
  ## Agent,始终在场
11
11
 
12
- 真正的交流,不该在说完一句话后,就陷入漫长的等待。
12
+ 真正的交流,不该在说完一句话后,就陷入漫长的等待。也不该因为 Agent 正在查资料、调用工具或处理任务,整场对话就此暂停。
13
13
 
14
- 也不该因为 Agent 正在查资料、调用工具或处理任务,整场对话就此暂停。
14
+ 交流应该是连续的,Agent 也应该始终在场。
15
15
 
16
- 交流应该是连续的。
16
+ 所以,我们做了 **qwen-audio-agent**——让 Agent 持续交流、持续工作、持续在场的实时语音运行时。无论是聊天、思考,还是处理任务,Agent 都始终在这场对话里。它会倾听,会回应,也会在任务完成时自然地告诉你:
17
17
 
18
- Agent 也应该始终在场。
19
-
20
- 所以,我们做了 **qwen-audio-agent**——让 Agent 持续交流、持续工作、持续在场的实时语音运行时。
18
+ “已经好了。”
21
19
 
22
- 无论是聊天、思考,还是处理任务,Agent 都始终在这场对话里。它会倾听,会回应,也会在任务完成时自然地告诉你:
20
+ ## News
23
21
 
24
- “已经好了。”
22
+ - **2026-07-30 · [v1.0.0](https://github.com/QwenAudio/qwen-audio-agent/releases/tag/v1.0.0)**
23
+ 🚀 正式版发布,推出内置 Gateway 的 macOS 桌面版。
24
+ - **2026-07-28 · [v0.9.0](https://github.com/QwenAudio/qwen-audio-agent/releases/tag/v0.9.0)**
25
+ 🌍 项目正式开源,后台 Agent 统一接入 ACP 架构。
25
26
 
26
27
  ## 对话继续,任务也在继续
27
28
 
@@ -62,6 +63,7 @@ https://github.com/user-attachments/assets/42022655-36d1-46b2-9c26-ff0765284000
62
63
  | OpenCode | 原生 ACP | 支持自动安装和百炼配置 | ★★★★★ |
63
64
  | OpenClaw | 内置 ACP 桥接 | 支持自动安装和百炼配置 | ★★★★★ |
64
65
  | Qoder | 原生 ACP | 用户自行安装和配置 | ★★★★★ |
66
+ | Kimi Code | 原生 ACP | 用户自行安装和配置 | ★★★★★ |
65
67
  | Hermes | 原生 ACP | 用户自行安装和配置 | ★★★★☆ |
66
68
  | CodeBuddy | 原生 ACP | 用户自行安装和配置 | ★★★★☆ |
67
69
  | Codex | 外部 ACP 适配 | 用户自行安装和配置 | ★★★★☆ |
@@ -176,9 +178,9 @@ qwenaudio tui --audio-mode full
176
178
 
177
179
  ## macOS 桌面版
178
180
 
179
- 桌面版提供常驻桌面的语音悬浮球。使用前请先启动 Gateway;首次运行需要授予
180
- 麦克风权限。设置页可以切换 Gateway 地址和悬浮球外观,并显示当前使用的模型与
181
- 后台 Agent。
181
+ 桌面版提供常驻桌面的语音悬浮球,并内置和自动管理 Gateway,无需事先启动服务。
182
+ 首次运行时,应用会创建配置文件,并引导你在设置页填写 DashScope API Key、选择
183
+ 后台 Agent(也可以使用仅前台模式)。
182
184
 
183
185
  桌面版支持流光声波球和液态渐变球两种外观。下面分别展示它们在思考 / 呼吸状态
184
186
  下的原始动态效果:
@@ -248,11 +250,11 @@ AGENT_PROTOCOL=opencode
248
250
  AGENT_PROTOCOL=qoder
249
251
  ```
250
252
 
251
- Hermes、CodeBuddy、Codex 和 Claude Code 也可直接选择:
253
+ Kimi Code、Hermes、CodeBuddy、Codex 和 Claude Code 也可直接选择:
252
254
 
253
255
  ```dotenv
254
- AGENT_PROTOCOL=hermes
255
- # 或 codebuddy、codex、claude
256
+ AGENT_PROTOCOL=kimi
257
+ # 或 hermes、codebuddy、codex、claude
256
258
  ```
257
259
 
258
260
  以上其他后台暂时需要用户自行安装并完成原生配置;qwen-audio-agent 会复用其
package/README_EN.md CHANGED
@@ -9,24 +9,27 @@
9
9
 
10
10
  ## Agent Presence
11
11
 
12
- Real conversation should not leave you waiting after a single sentence.
13
-
14
- Nor should it grind to a halt just because the Agent is looking something up,
12
+ Real conversation should not leave you waiting after a single sentence, nor
13
+ should it grind to a halt just because the Agent is looking something up,
15
14
  calling a tool, or working on a task.
16
15
 
17
- Conversation should keep flowing.
18
-
19
- An Agent should always be present.
16
+ Conversation should keep flowing, and the Agent should always be present.
20
17
 
21
18
  That is why we built **qwen-audio-agent**—a realtime voice runtime that keeps
22
- Agents talking, working, and present.
23
-
24
- Whether chatting with you, thinking through a problem, or working on a task,
25
- your Agent remains in the conversation. It listens, responds, and when the
26
- task is complete, naturally tells you:
19
+ Agents talking, working, and present. Whether chatting with you, thinking
20
+ through a problem, or working on a task, your Agent remains in the
21
+ conversation. It listens, responds, and when the task is complete, naturally
22
+ tells you:
27
23
 
28
24
  “It’s ready.”
29
25
 
26
+ ## News
27
+
28
+ - **2026-07-30 · [v1.0.0](https://github.com/QwenAudio/qwen-audio-agent/releases/tag/v1.0.0)**
29
+ 🚀 First stable release with a macOS desktop app and integrated Gateway.
30
+ - **2026-07-28 · [v0.9.0](https://github.com/QwenAudio/qwen-audio-agent/releases/tag/v0.9.0)**
31
+ 🌍 The project became open source with a unified ACP backend architecture.
32
+
30
33
  ## Keep Talking While Tasks Keep Running
31
34
 
32
35
  Conversation continues while the Agent works in the background. When the task
@@ -74,6 +77,7 @@ module walkthrough.
74
77
  | OpenCode | Native ACP | Automatic installation and Bailian setup supported | ★★★★★ |
75
78
  | OpenClaw | Built-in ACP Bridge | Automatic installation and Bailian setup supported | ★★★★★ |
76
79
  | Qoder | Native ACP | User installation and configuration required | ★★★★★ |
80
+ | Kimi Code | Native ACP | User installation and configuration required | ★★★★★ |
77
81
  | Hermes | Native ACP | User installation and configuration required | ★★★★☆ |
78
82
  | CodeBuddy | Native ACP | User installation and configuration required | ★★★★☆ |
79
83
  | Codex | External ACP Adapter | User installation and configuration required | ★★★★☆ |
@@ -197,10 +201,10 @@ qwenaudio tui --audio-mode full
197
201
 
198
202
  ## macOS Desktop App
199
203
 
200
- The desktop app provides a persistent voice orb. Start the Gateway before using
201
- it and grant microphone permission on first launch. The settings page lets you
202
- switch the Gateway address and orb appearance, and shows the active model and
203
- backend Agent.
204
+ The desktop app provides a persistent voice orb and embeds and manages its own
205
+ Gateway, so no service needs to be started in advance. On first launch, the app
206
+ creates its configuration file and guides you to enter a DashScope API Key and
207
+ choose a backend Agent (or frontend-only mode) in Settings.
204
208
 
205
209
  The desktop app includes a streaming wave orb and a liquid gradient orb. Their
206
210
  original animated thinking / breathing states are shown below:
@@ -277,11 +281,12 @@ Use Qoder:
277
281
  AGENT_PROTOCOL=qoder
278
282
  ```
279
283
 
280
- Hermes, CodeBuddy, Codex, and Claude Code can also be selected directly:
284
+ Kimi Code, Hermes, CodeBuddy, Codex, and Claude Code can also be selected
285
+ directly:
281
286
 
282
287
  ```dotenv
283
- AGENT_PROTOCOL=hermes
284
- # Or codebuddy, codex, or claude
288
+ AGENT_PROTOCOL=kimi
289
+ # Or hermes, codebuddy, codex, or claude
285
290
  ```
286
291
 
287
292
  These other backends currently require the user to install and configure the
package/cli/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qwen-audio-agent/cli",
3
3
  "private": true,
4
- "version": "1.0.0",
4
+ "version": "1.1.1",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "qwenaudio": "./bin/qwenaudio.mjs"
@@ -208,7 +208,7 @@ export function helpText() {
208
208
  '',
209
209
  'Gateway 选项:',
210
210
  ' --url URL Gateway 地址(默认 http://127.0.0.1:3101)',
211
- ' --backend NAME 可选:openclaw、opencode、qoder、hermes、codebuddy、codex、claude、acp 或 none;不设置或使用 none 时仅前台聊天',
211
+ ' --backend NAME 可选:openclaw、opencode、qoder、kimi、hermes、codebuddy、codex、claude、acp 或 none;不设置或使用 none 时仅前台聊天',
212
212
  ' --backend-permission-mode MODE native(默认)或 full(最高权限)',
213
213
  ' --backend-url URL 后台 Server 地址',
214
214
  ' --backend-agent ID 指定协调 Agent',
@@ -0,0 +1,13 @@
1
+ # qwen-audio-agent Kimi Code Coordinator Workspace
2
+
3
+ This workspace belongs to the persistent qwen-audio-agent coordinator Session.
4
+
5
+ - Treat each qwen-audio-agent request envelope as the current voice request.
6
+ - Use the qwen_audio_agent Session tools to list, start, or continue native
7
+ project Sessions.
8
+ - Send natural user task text to project Sessions. Never copy transport
9
+ envelopes, work IDs, or internal routing instructions into project history.
10
+ - Preserve the requested action level and continue existing project Sessions
11
+ when the user refers to prior work.
12
+ - Only work in this coordinator workspace when no project Session is needed.
13
+ - Never expose Session IDs, delegation IDs, or internal routing metadata.
@@ -14,7 +14,8 @@ layers:
14
14
  requiring tools, current information, files, applications, code, or
15
15
  multi-step work.
16
16
 
17
- The backend may be OpenCode, OpenClaw, Qoder, or another ACP-compatible Agent.
17
+ The backend may be OpenCode, OpenClaw, Qoder, Kimi Code, or another
18
+ ACP-compatible Agent.
18
19
  It may internally use tools, skills, agents, or other Sessions. Those are
19
20
  backend-private implementation details and do not create additional
20
21
  qwen-audio-agent layers. All backends connect through one ACP client and one
@@ -249,14 +250,14 @@ after the asynchronous Session tool has already succeeded.
249
250
 
250
251
  ## 8. Backend-internal capabilities
251
252
 
252
- For OpenCode and Qoder, the Gateway injects the same five MCP tools into the
253
- coordinator through ACP: Session list, start, send, status, and cancel. OpenClaw
254
- ACP does not accept client-supplied MCP servers, so the same coordination
255
- contract maps to OpenClaw's native Session tools. `session_start` and
256
- `session_send` return an opaque delegation ID. After either succeeds, the
257
- backend Agent must not poll, repeat the work, or answer from its own context;
258
- the adapter owns waiting, cancellation, permission routing, and result
259
- correlation.
253
+ For ACP backends that accept client-supplied MCP servers, including OpenCode,
254
+ Qoder, and Kimi Code, the Gateway injects the same five tools into the
255
+ coordinator: Session list, start, send, status, and cancel. OpenClaw ACP does
256
+ not accept client-supplied MCP servers, so the same coordination contract maps
257
+ to OpenClaw's native Session tools. `session_start` and `session_send` return an
258
+ opaque delegation ID. After either succeeds, the backend Agent must not poll,
259
+ repeat the work, or answer from its own context; the adapter owns waiting,
260
+ cancellation, permission routing, and result correlation.
260
261
 
261
262
  `session_status` is observational only. If the query fails, the backend Agent
262
263
  must report the failure; it must not inspect the target directory with native
@@ -279,7 +280,8 @@ backend Agent envelope
279
280
  ↓
280
281
  Shared ACP adapter
281
282
  ↓
282
- OpenCode ACP, OpenClaw ACP bridge, or Qoder ACP
283
+ OpenCode ACP, OpenClaw ACP bridge, Qoder ACP,
284
+ Kimi Code ACP, or another ACP Agent
283
285
  ```
284
286
 
285
287
  Backend-specific API details belong only in `server/src/agent`. Realtime tools
@@ -297,8 +299,9 @@ own labels and interaction patterns.
297
299
  ## 10. Process ownership
298
300
 
299
301
  The Gateway is the only core product service. The shared adapter owns one ACP
300
- stdio child and stops it with the Gateway. OpenCode and Qoder run directly as
301
- ACP agents; OpenCode may additionally expose its native local Session UI.
302
+ stdio child and stops it with the Gateway. OpenCode, Qoder, and Kimi Code run
303
+ directly as ACP agents; OpenCode may additionally expose its native local
304
+ Session UI.
302
305
  OpenClaw uses a small ACP bridge. Its adapter always starts and owns a dedicated
303
306
  OpenClaw Gateway with isolated runtime and Session state. It may reuse the
304
307
  user's model and capability configuration, but it never attaches to or shares
@@ -156,6 +156,53 @@ QODER_CONFIG_DIR=
156
156
 
157
157
  Gateway 管理 Qoder ACP 子进程;Qoder 不接受 `--backend-url`。
158
158
 
159
+ ### Kimi Code
160
+
161
+ Kimi Code([MoonshotAI/kimi-code](https://github.com/MoonshotAI/kimi-code))
162
+ 通过官方原生 ACP 入口 `kimi acp` 接入。当前集成验证并要求 Kimi Code `0.31.0`
163
+ 或更高版本;`qwenaudio setup --backend kimi` 会同时检查可执行文件和版本,并拒绝
164
+ 低于兼容基线的旧实现。
165
+
166
+ 可使用官方安装脚本安装经过验证的版本:
167
+
168
+ ```bash
169
+ curl -fsSL https://code.kimi.com/kimi-code/install.sh | \
170
+ KIMI_VERSION=0.31.0 KIMI_INSTALL_DIR="$HOME/.local" \
171
+ KIMI_NO_MODIFY_PATH=1 bash
172
+ ```
173
+
174
+ 已经通过 Kimi Code 自身完成登录时,只需选择后台:
175
+
176
+ ```dotenv
177
+ AGENT_PROTOCOL=kimi
178
+ QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE=native
179
+ ```
180
+
181
+ 也可以使用 Kimi Code 官方的临时模型环境变量,在不改写
182
+ `~/.kimi-code/config.toml` 的情况下提供 Kimi Code API Key:
183
+
184
+ ```dotenv
185
+ AGENT_PROTOCOL=kimi
186
+ KIMI_MODEL_NAME=kimi-for-coding
187
+ KIMI_MODEL_API_KEY=your-kimi-code-key
188
+ KIMI_MODEL_BASE_URL=https://api.kimi.com/coding/v1
189
+ ```
190
+
191
+ `config.env` 由 qwen-audio-agent 创建为仅当前用户可读写的 `0600` 文件,禁止将
192
+ 实际 API Key 写入仓库。Kimi Code 的原生配置、OAuth 凭据和 Session 存储默认仍
193
+ 由 Kimi 自己管理;qwen-audio-agent 不修改这些文件。设置 `KIMI_CODE_HOME` 可以
194
+ 显式选择另一套 Kimi 数据目录,设置 `KIMI_WORKSPACE` 可以覆盖协调工作区。
195
+
196
+ 显式设置 `QWEN_AUDIO_AGENT_BACKEND_MODEL` 时,Gateway 会通过 ACP
197
+ `session/set_config_option` 覆盖 Kimi Session 模型并确认生效;留空则由 Kimi
198
+ 选择自身默认模型。高级配置:
199
+
200
+ ```dotenv
201
+ KIMI_CODE_BIN=
202
+ KIMI_WORKSPACE=
203
+ KIMI_CODE_HOME=
204
+ ```
205
+
159
206
  其他支持 ACP stdio 的 Agent 可使用通用入口:
160
207
 
161
208
  ```dotenv
@@ -271,8 +318,8 @@ CLAUDE_CONFIG_DIR=
271
318
  设置 `CLAUDE_CONFIG_DIR` 会改用独立配置目录,需要在该目录中单独完成认证。
272
319
  `CLAUDE_CODE_EXECUTABLE` 只用于覆盖适配器默认使用的 Claude Code 可执行文件。
273
320
 
274
- Hermes、CodeBuddy、Codex 和 Claude Code 均由 Gateway 直接管理 ACP 子进程,不接受
275
- `--backend-url`。
321
+ Kimi Code、Hermes、CodeBuddy、Codex 和 Claude Code 均由 Gateway 直接管理 ACP
322
+ 子进程,不接受 `--backend-url`。
276
323
 
277
324
  ## 后台权限模式
278
325
 
@@ -281,11 +328,13 @@ Hermes、CodeBuddy、Codex 和 Claude Code 均由 Gateway 直接管理 ACP 子
281
328
  - `native`(默认):权限由后台 Agent 自己判断和询问,Gateway 只负责原样转发。
282
329
  - `full`:启动时明确授予最高权限,后台可直接执行命令、读写文件,不再逐次确认。
283
330
 
284
- `full` 当前支持 OpenCode、Qoder、Hermes、CodeBuddy、Codex 和
285
- Claude Code。Gateway 会自动批准这些 ACP 后台发起的权限请求;此外 Qoder 和 CodeBuddy
286
- CLI 会使用 `--dangerously-skip-permissions`,OpenCode 会在受管进程的内联配置中为
287
- 协调 Agent 和任务 Agent 设置 `permission: "allow"`,Codex 会使用
288
- `agent-full-access` 模式。
331
+ `full` 当前支持 OpenCode、Qoder、Kimi Code、Hermes、CodeBuddy、Codex 和
332
+ Claude Code。Gateway 会自动批准这些 ACP 后台发起的权限请求;此外 Kimi Code
333
+ 会通过 ACP Session 配置切换到不会再提问的 Auto 模式,Qoder 和 CodeBuddy CLI
334
+ 会使用 `--dangerously-skip-permissions`,OpenCode 会在受管进程的内联配置中为协调
335
+ Agent 和任务 Agent 设置 `permission: "allow"`,Codex 会使用
336
+ `agent-full-access` 模式。Kimi Code 的 YOLO 模式仍可能向用户提问,因此这里不会
337
+ 用它映射 `full`。
289
338
 
290
339
  OpenClaw 的执行授权同时受 exec approvals、elevated 和执行 host 等配置约束,
291
340
  无法由一个统一开关安全、完整地表达;选择 `full` 时 Gateway 会明确拒绝启动,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qwen-audio-agent",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "A realtime voice frontend for mainstream AI agents.",
5
5
  "author": "qwen-audio-agent contributors",
6
6
  "license": "Apache-2.0",
@@ -20,6 +20,7 @@
20
20
  "opencode",
21
21
  "openclaw",
22
22
  "qoder",
23
+ "kimi-code",
23
24
  "claude-code"
24
25
  ],
25
26
  "type": "module",
@@ -41,6 +42,7 @@
41
42
  "config/acp/workspace/AGENTS.md",
42
43
  "config/opencode/workspace/AGENTS.md",
43
44
  "config/qoder/workspace/AGENTS.md",
45
+ "config/kimi/workspace/AGENTS.md",
44
46
  "docs/architecture.md",
45
47
  "docs/architecture-overview.png",
46
48
  "docs/architecture-overview-en.png",
@@ -48,6 +48,7 @@ const required = [
48
48
  'config/acp/workspace/AGENTS.md',
49
49
  'config/opencode/workspace/AGENTS.md',
50
50
  'config/qoder/workspace/AGENTS.md',
51
+ 'config/kimi/workspace/AGENTS.md',
51
52
  'CONTRIBUTING.md',
52
53
  'docs/architecture.md',
53
54
  'docs/architecture-overview.png',
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qwen-audio-agent/server",
3
3
  "private": true,
4
- "version": "1.0.0",
4
+ "version": "1.1.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "node --watch src/index.mjs",
@@ -177,6 +177,10 @@ export class AcpBackendAdapter {
177
177
  this.resolvedPermissions = new Map()
178
178
  this.coordinatorSessions = new Map()
179
179
  this.coordinatorSessionPromises = new Map()
180
+ // ACP agents may cache the first MCP connection for a Session. Keep its
181
+ // descriptor stable while serialized owner turns replace the run context.
182
+ this.coordinatorToolRegistrations = new Map()
183
+ this.coordinatorToolRegistrationPromises = new Map()
180
184
  this.sessionQueues = new Map()
181
185
  this.activeCoordinatorTurns = new Set()
182
186
  this.delegatedWorkRuns = new Map()
@@ -328,12 +332,38 @@ export class AcpBackendAdapter {
328
332
  return pending
329
333
  }
330
334
 
335
+ async ensureCoordinatorToolRegistration(ownerId, context) {
336
+ if (!this.profile.externalMcp) return null
337
+ const key = coordinatorKey(ownerId, this.protocol)
338
+ const current = this.coordinatorToolRegistrations.get(key)
339
+ if (current) {
340
+ current.update(context)
341
+ return current
342
+ }
343
+ const existingPromise = this.coordinatorToolRegistrationPromises.get(key)
344
+ if (existingPromise) {
345
+ const registration = await existingPromise
346
+ registration.update(context)
347
+ return registration
348
+ }
349
+ const pending = this.sessionToolServer.register(context).then(
350
+ registration => {
351
+ this.coordinatorToolRegistrations.set(key, registration)
352
+ return registration
353
+ },
354
+ ).finally(() => {
355
+ this.coordinatorToolRegistrationPromises.delete(key)
356
+ })
357
+ this.coordinatorToolRegistrationPromises.set(key, pending)
358
+ return pending
359
+ }
360
+
331
361
  coordinatorMeta(ownerId) {
332
362
  return this.profile.coordinatorMeta?.(ownerId) || null
333
363
  }
334
364
 
335
365
  async configureSession(session, role) {
336
- const options = Array.isArray(session?.response?.configOptions)
366
+ let options = Array.isArray(session?.response?.configOptions)
337
367
  ? session.response.configOptions
338
368
  : []
339
369
  if (role === 'coordinator' && this.coordinatorAgent) {
@@ -351,11 +381,64 @@ export class AcpBackendAdapter {
351
381
  option.currentValue = value
352
382
  }
353
383
  }
384
+ options = await this.applyProfileSessionConfig(session, options)
354
385
  if (this.model) {
355
386
  await this.forceSessionModel(session, options)
356
387
  }
357
388
  }
358
389
 
390
+ async applyProfileSessionConfig(session, initialOptions) {
391
+ let options = initialOptions
392
+ for (const setting of this.profile.sessionConfigOptions || []) {
393
+ const id = clean(setting?.id)
394
+ const desired = clean(setting?.value)
395
+ const option = options.find(item => clean(item?.id) === id)
396
+ const selected = option?.type === 'select'
397
+ ? matchingOptionValue(option.options, desired)
398
+ : desired
399
+ if (!option || !selected) {
400
+ throw new AgentError(
401
+ `${this.label} 没有通过 ACP 提供必要的 Session 配置 ${id}=${desired}`,
402
+ { status: 422, protocol: 'acp' },
403
+ )
404
+ }
405
+ if (modelKey(option.currentValue) === modelKey(selected)) continue
406
+ let response
407
+ try {
408
+ response = await this.client.setSessionConfigOption(
409
+ session.sessionId,
410
+ id,
411
+ selected,
412
+ )
413
+ } catch (error) {
414
+ throw new AgentError(
415
+ `${this.label} 无法设置 Session 配置 ${id}=${desired}:${
416
+ clean(error?.message) || '未知错误'
417
+ }`,
418
+ { status: error.status || 502, protocol: 'acp' },
419
+ )
420
+ }
421
+ const updatedOptions = Array.isArray(response?.configOptions)
422
+ ? response.configOptions
423
+ : null
424
+ const updated = updatedOptions?.find(item => clean(item?.id) === id)
425
+ if (modelKey(updated?.currentValue) !== modelKey(selected)) {
426
+ throw new AgentError(
427
+ `${this.label} 未确认 Session 配置生效:要求 ${id}=${desired},实际 ${
428
+ clean(updated?.currentValue) || '未知'
429
+ }`,
430
+ { status: 502, protocol: 'acp' },
431
+ )
432
+ }
433
+ options = updatedOptions
434
+ session.response = {
435
+ ...(session.response || {}),
436
+ configOptions: options,
437
+ }
438
+ }
439
+ return options
440
+ }
441
+
359
442
  async forceSessionModel(session, options) {
360
443
  const desired = this.model
361
444
  const option = modelConfigOption(options)
@@ -975,12 +1058,10 @@ export class AcpBackendAdapter {
975
1058
  message,
976
1059
  ].join('\n')
977
1060
  : message
978
- let registration = null
979
- if (this.profile.externalMcp) {
980
- registration = await this.sessionToolServer.register(
981
- this.toolContext(run),
982
- )
983
- }
1061
+ const registration = await this.ensureCoordinatorToolRegistration(
1062
+ ownerId,
1063
+ this.toolContext(run),
1064
+ )
984
1065
  const mcpServers = registration ? [registration.descriptor] : []
985
1066
  const session = await this.ensureCoordinatorSession(ownerId, mcpServers)
986
1067
  const permissionScopeId = `prompt_${randomUUID()}`
@@ -1034,7 +1115,6 @@ export class AcpBackendAdapter {
1034
1115
  }
1035
1116
  } finally {
1036
1117
  this.activeCoordinatorTurns.delete(session.sessionId)
1037
- registration?.release()
1038
1118
  this.cancelPermissionsForScope(permissionScopeId)
1039
1119
  if (session.permissionScopeId === permissionScopeId) {
1040
1120
  session.permissionScopeId = null
@@ -1410,6 +1490,14 @@ export class AcpBackendAdapter {
1410
1490
  record.pending.resolve({ outcome: { outcome: 'cancelled' } })
1411
1491
  }
1412
1492
  this.pendingPermissions.clear()
1493
+ await Promise.allSettled(
1494
+ [...this.coordinatorToolRegistrationPromises.values()],
1495
+ )
1496
+ const registrations = [...this.coordinatorToolRegistrations.values()]
1497
+ this.coordinatorToolRegistrations.clear()
1498
+ await Promise.allSettled(registrations.map(registration => (
1499
+ Promise.resolve().then(() => registration.release())
1500
+ )))
1413
1501
  await Promise.allSettled([
1414
1502
  this.sessionToolServer.close(),
1415
1503
  this.client.close(),
@@ -182,6 +182,7 @@ export class AcpSessionToolServer {
182
182
  await this.start()
183
183
  const token = randomUUID()
184
184
  this.contexts.set(token, context)
185
+ let released = false
185
186
  return {
186
187
  descriptor: {
187
188
  type: 'http',
@@ -192,7 +193,15 @@ export class AcpSessionToolServer {
192
193
  value: `Bearer ${token}`,
193
194
  }],
194
195
  },
195
- release: () => this.contexts.delete(token),
196
+ update: nextContext => {
197
+ if (released || !this.contexts.has(token)) return false
198
+ this.contexts.set(token, nextContext)
199
+ return true
200
+ },
201
+ release: () => {
202
+ released = true
203
+ return this.contexts.delete(token)
204
+ },
196
205
  }
197
206
  }
198
207
 
@@ -24,6 +24,9 @@ export class AgentClient {
24
24
  qoderDirectory = config.qoderDirectory,
25
25
  qoderConfigDirectory = config.qoderConfigDirectory,
26
26
  qoderCliPath = config.qoderCliPath,
27
+ kimiDirectory = config.kimiDirectory,
28
+ kimiCliPath = config.kimiCliPath,
29
+ kimiModel = config.kimiModel,
27
30
  hermesDirectory = config.hermesDirectory,
28
31
  hermesCliPath = config.hermesCliPath,
29
32
  hermesModel = config.hermesModel,
@@ -68,6 +71,9 @@ export class AgentClient {
68
71
  qoderDirectory,
69
72
  qoderConfigDirectory,
70
73
  qoderCliPath,
74
+ kimiDirectory,
75
+ kimiCliPath,
76
+ kimiModel,
71
77
  hermesDirectory,
72
78
  hermesCliPath,
73
79
  hermesModel,
@@ -0,0 +1,36 @@
1
+ import { baseEnvironment, clean } from './shared.mjs'
2
+
3
+ export const kimiBackendDriver = {
4
+ id: 'kimi',
5
+ label: 'Kimi Code',
6
+
7
+ resolveOptions(options) {
8
+ return {
9
+ baseUrl: '',
10
+ model: options.kimiModel,
11
+ directory: options.kimiDirectory,
12
+ cliPath: options.kimiCliPath,
13
+ coordinatorAgent: options.coordinatorAgent,
14
+ }
15
+ },
16
+
17
+ createProfile({
18
+ directory,
19
+ cliPath,
20
+ permissionMode,
21
+ }) {
22
+ return {
23
+ label: this.label,
24
+ command: clean(cliPath) || 'kimi',
25
+ args: ['acp'],
26
+ cwd: directory,
27
+ env: baseEnvironment(),
28
+ sessionConfigOptions: permissionMode === 'full'
29
+ ? [{ id: 'mode', value: 'auto' }]
30
+ : [],
31
+ externalMcp: true,
32
+ nativeDelegation: false,
33
+ backendUi: false,
34
+ }
35
+ },
36
+ }
@@ -3,6 +3,7 @@ import { claudeBackendDriver } from './claude.mjs'
3
3
  import { codexBackendDriver } from './codex.mjs'
4
4
  import { genericAcpBackendDriver } from './generic-acp.mjs'
5
5
  import { hermesBackendDriver } from './hermes.mjs'
6
+ import { kimiBackendDriver } from './kimi.mjs'
6
7
  import { openClawBackendDriver } from './openclaw.mjs'
7
8
  import { openCodeBackendDriver } from './opencode.mjs'
8
9
  import { qoderBackendDriver } from './qoder.mjs'
@@ -11,6 +12,7 @@ const drivers = new Map([
11
12
  openCodeBackendDriver,
12
13
  openClawBackendDriver,
13
14
  qoderBackendDriver,
15
+ kimiBackendDriver,
14
16
  hermesBackendDriver,
15
17
  codeBuddyBackendDriver,
16
18
  codexBackendDriver,
@@ -263,8 +263,7 @@ export class Coordinator {
263
263
  return {
264
264
  content: decision.presentation.speech,
265
265
  metadata: {
266
- ...(result.metadata || {}),
267
- decision,
266
+ presentation: decision.presentation,
268
267
  },
269
268
  }
270
269
  }
@@ -289,8 +288,7 @@ export class Coordinator {
289
288
  return {
290
289
  content: decision.presentation.speech,
291
290
  metadata: {
292
- ...(result.metadata || {}),
293
- decision,
291
+ presentation: decision.presentation,
294
292
  },
295
293
  }
296
294
  }
@@ -12,11 +12,14 @@ const sourceRoot = resolve(here, '../../..')
12
12
  const root = process.env.QWEN_AUDIO_AGENT_RUNTIME_ROOT || sourceRoot
13
13
  const runtimeEnvironment = loadRuntimeEnvironment({ root })
14
14
 
15
- function numberSetting(value, fallback, {
15
+ export function numberSetting(value, fallback, {
16
16
  min = Number.NEGATIVE_INFINITY,
17
17
  max = Number.POSITIVE_INFINITY,
18
18
  } = {}) {
19
- const parsed = Number(value)
19
+ if (value === null || value === undefined) return fallback
20
+ const source = typeof value === 'string' ? value.trim() : value
21
+ if (source === '') return fallback
22
+ const parsed = Number(source)
20
23
  if (!Number.isFinite(parsed)) return fallback
21
24
  return Math.min(max, Math.max(min, parsed))
22
25
  }
@@ -39,6 +42,15 @@ export function resolveQoderWorkspace(
39
42
  : resolve(configDirectory, 'workspaces/qoder')
40
43
  }
41
44
 
45
+ export function resolveKimiWorkspace(
46
+ env = process.env,
47
+ configDirectory = runtimeEnvironment.configDirectory,
48
+ ) {
49
+ return env.KIMI_WORKSPACE
50
+ ? resolve(root, env.KIMI_WORKSPACE)
51
+ : resolve(configDirectory, 'workspaces/kimi')
52
+ }
53
+
42
54
  export function resolveHermesWorkspace(
43
55
  env = process.env,
44
56
  configDirectory = runtimeEnvironment.configDirectory,
@@ -128,6 +140,7 @@ export function resolveBackendModels(env = process.env) {
128
140
  openCode: common ? `alibaba-cn/${name}` : '',
129
141
  openClaw: common ? `bailian/${name}` : '',
130
142
  qoder: name,
143
+ kimi: common,
131
144
  hermes: common,
132
145
  codeBuddy: name,
133
146
  codex: name,
@@ -265,6 +278,11 @@ export const config = {
265
278
  qoderModel: String(
266
279
  backendModels.qoder,
267
280
  ).trim(),
281
+ kimiDirectory: resolveKimiWorkspace(),
282
+ kimiCliPath: String(process.env.KIMI_CODE_BIN || '').trim(),
283
+ kimiModel: String(
284
+ backendModels.kimi,
285
+ ).trim(),
268
286
  hermesDirectory: resolveHermesWorkspace(),
269
287
  hermesCliPath: String(process.env.HERMES_BIN || '').trim(),
270
288
  hermesModel: String(
@@ -0,0 +1,15 @@
1
+ import { managedOnlyBackend } from './shared.mjs'
2
+
3
+ export const kimiRuntimeDriver = {
4
+ id: 'kimi',
5
+ separateManagedProcess: false,
6
+
7
+ resolve({ ownership, permissionMode }) {
8
+ return managedOnlyBackend({
9
+ id: this.id,
10
+ ownership,
11
+ permissionMode,
12
+ label: 'Kimi Code',
13
+ })
14
+ },
15
+ }
@@ -3,6 +3,7 @@ import { claudeRuntimeDriver } from './claude.mjs'
3
3
  import { codexRuntimeDriver } from './codex.mjs'
4
4
  import { genericAcpRuntimeDriver } from './generic-acp.mjs'
5
5
  import { hermesRuntimeDriver } from './hermes.mjs'
6
+ import { kimiRuntimeDriver } from './kimi.mjs'
6
7
  import { openClawRuntimeDriver } from './openclaw.mjs'
7
8
  import { openCodeRuntimeDriver } from './opencode.mjs'
8
9
  import { qoderRuntimeDriver } from './qoder.mjs'
@@ -11,6 +12,7 @@ const drivers = new Map([
11
12
  openCodeRuntimeDriver,
12
13
  openClawRuntimeDriver,
13
14
  qoderRuntimeDriver,
15
+ kimiRuntimeDriver,
14
16
  hermesRuntimeDriver,
15
17
  codeBuddyRuntimeDriver,
16
18
  codexRuntimeDriver,
@@ -13,6 +13,28 @@ const ACTIVE = new Set([
13
13
  const CANCELLABLE = new Set(['queued', 'running', 'delegated', 'finalizing'])
14
14
  const TERMINAL = new Set(['completed', 'failed', 'cancelled'])
15
15
 
16
+ function publicResultMetadata(metadata) {
17
+ if (!metadata || typeof metadata !== 'object') return null
18
+ const source = metadata.presentation || metadata.decision?.presentation
19
+ if (!source || typeof source !== 'object') return null
20
+ const inline = source.inline && typeof source.inline === 'object'
21
+ && typeof source.inline.content === 'string'
22
+ && source.inline.content.trim()
23
+ ? {
24
+ title: typeof source.inline.title === 'string'
25
+ ? source.inline.title.slice(0, 120)
26
+ : '',
27
+ format: ['markdown', 'code', 'link'].includes(source.inline.format)
28
+ ? source.inline.format
29
+ : 'markdown',
30
+ content: source.inline.content,
31
+ }
32
+ : null
33
+ const speech = typeof source.speech === 'string' ? source.speech : ''
34
+ if (!speech && !inline) return null
35
+ return { presentation: { speech, inline } }
36
+ }
37
+
16
38
  function publicTask(task) {
17
39
  const now = Date.now()
18
40
  return {
@@ -34,7 +56,7 @@ function publicTask(task) {
34
56
  : task.elapsedMs,
35
57
  result: task.result,
36
58
  error: task.error,
37
- resultMetadata: task.resultMetadata || null,
59
+ resultMetadata: publicResultMetadata(task.resultMetadata),
38
60
  activity: [...(task.activity || [])],
39
61
  delegation: task.delegation
40
62
  ? {
@@ -18,6 +18,11 @@ const definitions = new Map([
18
18
  label: 'Qoder',
19
19
  supportsFullPermission: true,
20
20
  }],
21
+ ['kimi', {
22
+ id: 'kimi',
23
+ label: 'Kimi Code',
24
+ supportsFullPermission: true,
25
+ }],
21
26
  ['hermes', {
22
27
  id: 'hermes',
23
28
  label: 'Hermes',
@@ -32,6 +32,12 @@ const SPECS = {
32
32
  executableEnvironment: ['QODERCLI_PATH', 'QODER_CLI_PATH'],
33
33
  integration: 'native',
34
34
  },
35
+ kimi: {
36
+ command: 'kimi',
37
+ executableEnvironment: 'KIMI_CODE_BIN',
38
+ integration: 'native',
39
+ minimumVersion: '0.31.0',
40
+ },
35
41
  hermes: {
36
42
  command: 'hermes',
37
43
  executableEnvironment: 'HERMES_BIN',
@@ -382,6 +388,17 @@ function inspectBackend(id, {
382
388
  }
383
389
  }
384
390
 
391
+ if (backend.ready && id === 'kimi') {
392
+ const version = readVersion(backend.path)
393
+ backend.version = version
394
+ if (!versionAtLeast(version, spec.minimumVersion)) {
395
+ backend.ready = false
396
+ backend.issue = version
397
+ ? `Kimi Code ${version} 低于最低版本 ${spec.minimumVersion}`
398
+ : '无法确认 Kimi Code 版本'
399
+ }
400
+ }
401
+
385
402
  const adapter = backend.ready
386
403
  ? inspectAdapter(spec, env, find)
387
404
  : { ready: spec.integration !== 'adapter', source: spec.integration }
@@ -21,13 +21,14 @@ const USER_CONFIG_TEMPLATE = [
21
21
  'QWEN_AUDIO_REALTIME_PROVIDER=dashscope',
22
22
  '',
23
23
  '# 可选:选择后台 Agent;留空时仅使用前台实时语音聊天',
24
- '# 可选 openclaw、opencode、qoder、hermes、codebuddy、codex、claude、acp 或 none',
24
+ '# 可选 openclaw、opencode、qoder、kimi、hermes、codebuddy、codex、claude、acp 或 none',
25
25
  'AGENT_PROTOCOL=',
26
26
  '# 权限模式:native(后台自行询问)或 full(最高权限;仅支持安全映射的后端)',
27
27
  '# QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE=native',
28
28
  '# 可选:显式覆盖后台模型;留空时使用 Agent 原有模型',
29
29
  '# QWEN_AUDIO_AGENT_BACKEND_MODEL=',
30
30
  '# 可选:QWEN_AUDIO_AGENT_BACKEND_AGENT=协调 Agent ID',
31
+ '# Kimi Code 可复用原生登录,或设置官方 KIMI_MODEL_* 临时模型变量',
31
32
  '# 通用 ACP:ACP_COMMAND=your-agent,ACP_ARGS=["--acp"]',
32
33
  '',
33
34
  ].join('\n')
@@ -329,6 +330,10 @@ export function loadRuntimeEnvironment({
329
330
  const qoderWorkspace = env.QODER_WORKSPACE
330
331
  ? resolve(root, env.QODER_WORKSPACE)
331
332
  : resolve(configDirectory, 'workspaces/qoder')
333
+ const defaultKimiWorkspace = !env.KIMI_WORKSPACE
334
+ const kimiWorkspace = env.KIMI_WORKSPACE
335
+ ? resolve(root, env.KIMI_WORKSPACE)
336
+ : resolve(configDirectory, 'workspaces/kimi')
332
337
  const defaultHermesWorkspace = !env.HERMES_WORKSPACE
333
338
  const hermesWorkspace = env.HERMES_WORKSPACE
334
339
  ? resolve(root, env.HERMES_WORKSPACE)
@@ -369,6 +374,12 @@ export function loadRuntimeEnvironment({
369
374
  resolve(root, 'config/qoder/workspace/AGENTS.md'),
370
375
  )
371
376
  }
377
+ if (defaultKimiWorkspace) {
378
+ ensureManagedWorkspace(
379
+ kimiWorkspace,
380
+ resolve(root, 'config/kimi/workspace/AGENTS.md'),
381
+ )
382
+ }
372
383
  if (defaultHermesWorkspace) {
373
384
  ensureManagedWorkspace(
374
385
  hermesWorkspace,
@@ -409,6 +420,7 @@ export function loadRuntimeEnvironment({
409
420
  env.QWEN_AUDIO_AGENT_OPENCLAW_WORKSPACE = openClawWorkspace
410
421
  env.QWEN_AUDIO_AGENT_OPENCLAW_STATE_DIR = openClawStateDirectory
411
422
  env.QODER_WORKSPACE = qoderWorkspace
423
+ env.KIMI_WORKSPACE = kimiWorkspace
412
424
  env.HERMES_WORKSPACE = hermesWorkspace
413
425
  env.CODEBUDDY_WORKSPACE = codeBuddyWorkspace
414
426
  env.CODEX_WORKSPACE = codexWorkspace
@@ -433,6 +445,7 @@ export function loadRuntimeEnvironment({
433
445
  openCodeWorkspace,
434
446
  openClawWorkspace,
435
447
  qoderWorkspace,
448
+ kimiWorkspace,
436
449
  hermesWorkspace,
437
450
  codeBuddyWorkspace,
438
451
  codexWorkspace,
package/tui/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qwen-audio-agent/tui",
3
3
  "private": true,
4
- "version": "1.0.0",
4
+ "version": "1.1.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "start": "node src/index.mjs",