qwen-audio-agent 0.12.1 → 1.1.0

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/CONTRIBUTING.md CHANGED
@@ -55,9 +55,14 @@ npm run version:set -- 0.6.0-beta.1 # 指定预发布版本
55
55
  应从专用分支提交,例如 `release/0.11.0` 或 `codex/release-0.11.0`。Release PR
56
56
  合并到 `main` 后,工作流会确认版本确实发生变化、版本对应的 Changelog 存在且
57
57
  完整检查通过,然后自动创建 `v0.11.0` 标签、以 npm provenance 发布公共包,
58
- 并创建 GitHub Release。启用 macOS 正式发布时,还会构建、签名、公证并上传 DMG。
58
+ 构建 Universal macOS 桌面版,完成 Developer ID 签名和 Apple 公证,并将 DMG
59
+ 上传到 GitHub Release。
59
60
 
60
61
  普通 PR 合并或未改变版本号的 `main` 更新不会触发发布。若发布在创建标签、上传
61
62
  npm 或生成 Release 之间中断,可从 GitHub Actions 手动运行 Release 工作流,并
62
63
  输入当前 `package.json` 中的版本继续;已经完成的阶段会被安全复用。仓库维护者
63
- 需预先配置 `NPM_TOKEN`,以及可选的 Apple Developer 签名证书和公证凭据。
64
+ 需预先配置 `NPM_TOKEN`,以及以下 GitHub Actions Secrets:
65
+
66
+ - `CSC_LINK`:包含证书和私钥的加密 `.p12` 文件,以 Base64 编码保存。
67
+ - `CSC_KEY_PASSWORD`:导出 `.p12` 时设置的密码。
68
+ - `APPLE_ID`、`APPLE_APP_SPECIFIC_PASSWORD`、`APPLE_TEAM_ID`:Apple 公证凭据。
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 适配 | 用户自行安装和配置 | ★★★★☆ |
@@ -111,12 +113,13 @@ npm install -g git+https://github.com/QwenAudio/qwen-audio-agent.git
111
113
 
112
114
  ## 获取 DashScope API Key
113
115
 
114
- 阿里云百炼为 Qwen Audio 3.0 Realtime 提供免费体验额度,创建 API Key 后即可免费开始使用 qwen-audio-agent。
116
+ 阿里云百炼为 Qwen Audio 3.0 Realtime 提供
117
+ [新人免费额度](https://help.aliyun.com/zh/model-studio/new-free-quota),创建 API Key 后
118
+ 即可免费开始使用 qwen-audio-agent。
115
119
 
116
- 1. 登录阿里云;如果尚未开通,请先按提示开通阿里云百炼。
117
- 2. 打开百炼控制台的 [API Key 页面](https://bailian.console.aliyun.com/?tab=model#/api-key),
118
- 单击**创建 API Key**。
119
- 3. 复制生成的 Key,稍后填入 `config.env`。请勿公开或提交 API Key。
120
+ 1. 打开百炼控制台的 [API Key 页面](https://bailian.console.aliyun.com/?tab=model#/api-key),
121
+ 登录账号,单击**创建 API Key**。
122
+ 2. 复制生成的 Key,稍后填入 `config.env`。请勿公开或提交 API Key。
120
123
 
121
124
  详细说明见[百炼官方文档](https://help.aliyun.com/zh/model-studio/get-api-key)。
122
125
 
@@ -175,9 +178,9 @@ qwenaudio tui --audio-mode full
175
178
 
176
179
  ## macOS 桌面版
177
180
 
178
- 桌面版提供常驻桌面的语音悬浮球。使用前请先启动 Gateway;首次运行需要授予
179
- 麦克风权限。设置页可以切换 Gateway 地址和悬浮球外观,并显示当前使用的模型与
180
- 后台 Agent。
181
+ 桌面版提供常驻桌面的语音悬浮球,并内置和自动管理 Gateway,无需事先启动服务。
182
+ 首次运行时,应用会创建配置文件,并引导你在设置页填写 DashScope API Key、选择
183
+ 后台 Agent(也可以使用仅前台模式)。
181
184
 
182
185
  桌面版支持流光声波球和液态渐变球两种外观。下面分别展示它们在思考 / 呼吸状态
183
186
  下的原始动态效果:
@@ -247,11 +250,11 @@ AGENT_PROTOCOL=opencode
247
250
  AGENT_PROTOCOL=qoder
248
251
  ```
249
252
 
250
- Hermes、CodeBuddy、Codex 和 Claude Code 也可直接选择:
253
+ Kimi Code、Hermes、CodeBuddy、Codex 和 Claude Code 也可直接选择:
251
254
 
252
255
  ```dotenv
253
- AGENT_PROTOCOL=hermes
254
- # 或 codebuddy、codex、claude
256
+ AGENT_PROTOCOL=kimi
257
+ # 或 hermes、codebuddy、codex、claude
255
258
  ```
256
259
 
257
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 | ★★★★☆ |
@@ -127,15 +131,14 @@ npm install -g git+https://github.com/QwenAudio/qwen-audio-agent.git
127
131
 
128
132
  ## Get a DashScope API Key
129
133
 
130
- Alibaba Cloud Model Studio offers free trial credits for Qwen Audio 3.0
131
- Realtime. Create an API Key to start using qwen-audio-agent for free.
134
+ Alibaba Cloud Model Studio includes Qwen Audio 3.0 Realtime in its
135
+ [free quota for new users](https://help.aliyun.com/en/model-studio/new-free-quota).
136
+ Create an API Key to start using qwen-audio-agent for free.
132
137
 
133
- 1. Sign in to Alibaba Cloud. If Model Studio is not yet activated, follow the
134
- prompt to activate it.
135
- 2. Open the Model Studio
136
- [API Key page](https://bailian.console.aliyun.com/?tab=model#/api-key),
137
- then click **Create API Key**.
138
- 3. Copy the generated Key and add it to `config.env` later. Never publish or
138
+ 1. Open the Model Studio
139
+ [API Key page](https://bailian.console.aliyun.com/?tab=model#/api-key), sign
140
+ in, and click **Create API Key**.
141
+ 2. Copy the generated Key and add it to `config.env` later. Never publish or
139
142
  commit your API Key.
140
143
 
141
144
  See the [official API Key guide](https://help.aliyun.com/en/model-studio/get-api-key)
@@ -198,10 +201,10 @@ qwenaudio tui --audio-mode full
198
201
 
199
202
  ## macOS Desktop App
200
203
 
201
- The desktop app provides a persistent voice orb. Start the Gateway before using
202
- it and grant microphone permission on first launch. The settings page lets you
203
- switch the Gateway address and orb appearance, and shows the active model and
204
- 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.
205
208
 
206
209
  The desktop app includes a streaming wave orb and a liquid gradient orb. Their
207
210
  original animated thinking / breathing states are shown below:
@@ -278,11 +281,12 @@ Use Qoder:
278
281
  AGENT_PROTOCOL=qoder
279
282
  ```
280
283
 
281
- 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:
282
286
 
283
287
  ```dotenv
284
- AGENT_PROTOCOL=hermes
285
- # Or codebuddy, codex, or claude
288
+ AGENT_PROTOCOL=kimi
289
+ # Or hermes, codebuddy, codex, or claude
286
290
  ```
287
291
 
288
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": "0.12.1",
4
+ "version": "1.1.0",
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": "0.12.1",
3
+ "version": "1.1.0",
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",
@@ -37,6 +37,10 @@ run_binary() {
37
37
  }
38
38
 
39
39
  run_package() {
40
+ if [ "${QWEN_AUDIO_AGENT_DESKTOP_INSTALLED_ONLY:-}" = "1" ]; then
41
+ echo "claude-code-acp is not installed. Install the ACP adapter before selecting Claude Code in the desktop app." >&2
42
+ exit 1
43
+ fi
40
44
  if ! command -v npx >/dev/null 2>&1; then
41
45
  echo "claude-code-acp package mode requires npx." >&2
42
46
  exit 1
package/scripts/codex-acp CHANGED
@@ -35,6 +35,10 @@ run_binary() {
35
35
  }
36
36
 
37
37
  run_package() {
38
+ if [ "${QWEN_AUDIO_AGENT_DESKTOP_INSTALLED_ONLY:-}" = "1" ]; then
39
+ echo "codex-acp is not installed. Install the ACP adapter before selecting Codex in the desktop app." >&2
40
+ exit 1
41
+ fi
38
42
  if ! command -v npx >/dev/null 2>&1; then
39
43
  echo "codex-acp package mode requires npx." >&2
40
44
  exit 1
package/scripts/openclaw CHANGED
@@ -3,6 +3,38 @@ set -eu
3
3
 
4
4
  QWEN_AUDIO_AGENT_ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
5
5
  export QWEN_AUDIO_AGENT_ROOT
6
+ QWEN_AUDIO_AGENT_SOURCE_ROOT=${QWEN_AUDIO_AGENT_SOURCE_ROOT:-"$QWEN_AUDIO_AGENT_ROOT"}
7
+
8
+ run_qwenaudio_node() {
9
+ if [ "${QWEN_AUDIO_AGENT_DESKTOP:-}" = "1" ]; then
10
+ ELECTRON_RUN_AS_NODE=1 "${QWEN_AUDIO_AGENT_NODE:-node}" "$@"
11
+ return
12
+ fi
13
+ "${QWEN_AUDIO_AGENT_NODE:-node}" "$@"
14
+ }
15
+
16
+ run_openclaw_helper() {
17
+ if [ "$QWEN_AUDIO_AGENT_SOURCE_ROOT" != "$QWEN_AUDIO_AGENT_ROOT" ]; then
18
+ run_qwenaudio_node \
19
+ "$QWEN_AUDIO_AGENT_SOURCE_ROOT/server/src/process/openclaw-desktop-helper.mjs" \
20
+ "$@"
21
+ return
22
+ fi
23
+ case "$1" in
24
+ prepare)
25
+ shift
26
+ run_qwenaudio_node \
27
+ "$QWEN_AUDIO_AGENT_ROOT/scripts/prepare-openclaw-config.mjs" \
28
+ "$@"
29
+ ;;
30
+ sync-token)
31
+ shift
32
+ run_qwenaudio_node \
33
+ "$QWEN_AUDIO_AGENT_ROOT/scripts/sync-openclaw-gateway-token.mjs" \
34
+ "$@"
35
+ ;;
36
+ esac
37
+ }
6
38
 
7
39
  if [ "${QWEN_AUDIO_AGENT_ENV_LOADED:-}" != "1" ]; then
8
40
  if [ -f "$QWEN_AUDIO_AGENT_ROOT/.env.local" ]; then
@@ -71,8 +103,7 @@ if [ "${1:-}" = "gateway" ]; then
71
103
  OPENCLAW_USER_CONFIG_PATH=$OPENCLAW_CONFIG_PATH
72
104
  OPENCLAW_USER_STATE_DIR=$(dirname -- "$OPENCLAW_USER_CONFIG_PATH")
73
105
  OPENCLAW_RUNTIME_CONFIG_PATH="$OPENCLAW_RUNTIME_STATE_DIR/openclaw.json"
74
- "${QWEN_AUDIO_AGENT_NODE:-node}" \
75
- "$QWEN_AUDIO_AGENT_ROOT/scripts/prepare-openclaw-config.mjs" \
106
+ run_openclaw_helper prepare \
76
107
  "$OPENCLAW_USER_CONFIG_PATH" \
77
108
  "$OPENCLAW_RUNTIME_CONFIG_PATH"
78
109
  export OPENCLAW_CONFIG_PATH="$OPENCLAW_RUNTIME_CONFIG_PATH"
@@ -104,8 +135,7 @@ if [ -n "$OPENCLAW_GATEWAY_TOKEN" ]; then
104
135
  chmod 600 "$OPENCLAW_GATEWAY_TOKEN_TMP"
105
136
  mv -f "$OPENCLAW_GATEWAY_TOKEN_TMP" "$OPENCLAW_GATEWAY_TOKEN_FILE"
106
137
  elif [ "${1:-}" = "gateway" ]; then
107
- "${QWEN_AUDIO_AGENT_NODE:-node}" \
108
- "$QWEN_AUDIO_AGENT_ROOT/scripts/sync-openclaw-gateway-token.mjs" \
138
+ run_openclaw_helper sync-token \
109
139
  "$OPENCLAW_GATEWAY_TOKEN_FILE"
110
140
  fi
111
141
  export OPENCLAW_GATEWAY_TOKEN_FILE
@@ -148,6 +178,10 @@ run_source() {
148
178
  }
149
179
 
150
180
  run_package() {
181
+ if [ "${QWEN_AUDIO_AGENT_DESKTOP_INSTALLED_ONLY:-}" = "1" ]; then
182
+ echo "OpenClaw is not installed. Install OpenClaw before selecting it in the desktop app." >&2
183
+ exit 1
184
+ fi
151
185
  if ! command -v npx >/dev/null 2>&1; then
152
186
  echo "OpenClaw package mode requires npx." >&2
153
187
  exit 1
@@ -9,6 +9,14 @@ OPENCODE_MIN_VERSION=${OPENCODE_MIN_VERSION:-1.18.0}
9
9
  OPENCODE_COMMAND=${OPENCODE_COMMAND:-serve}
10
10
  QWEN_AUDIO_AGENT_NODE=${QWEN_AUDIO_AGENT_NODE:-node}
11
11
 
12
+ run_qwenaudio_node() {
13
+ if [ "${QWEN_AUDIO_AGENT_DESKTOP:-}" = "1" ]; then
14
+ ELECTRON_RUN_AS_NODE=1 "$QWEN_AUDIO_AGENT_NODE" "$@"
15
+ return
16
+ fi
17
+ "$QWEN_AUDIO_AGENT_NODE" "$@"
18
+ }
19
+
12
20
  if [ "${QWEN_AUDIO_AGENT_ENV_LOADED:-}" != "1" ]; then
13
21
  if [ -f "$QWEN_AUDIO_AGENT_ROOT/.env.local" ]; then
14
22
  set -a
@@ -84,6 +92,10 @@ run_source() {
84
92
  }
85
93
 
86
94
  run_package() {
95
+ if [ "${QWEN_AUDIO_AGENT_DESKTOP_INSTALLED_ONLY:-}" = "1" ]; then
96
+ echo "OpenCode is not installed. Install OpenCode before selecting it in the desktop app." >&2
97
+ exit 1
98
+ fi
87
99
  if ! command -v npx >/dev/null 2>&1; then
88
100
  echo "OpenCode package mode requires npx." >&2
89
101
  exit 1
@@ -115,7 +127,7 @@ installed_version() {
115
127
  }
116
128
 
117
129
  version_supported() {
118
- "$QWEN_AUDIO_AGENT_NODE" -e '
130
+ run_qwenaudio_node -e '
119
131
  const parse = value => {
120
132
  const match = String(value).match(/(\d+)\.(\d+)\.(\d+)/)
121
133
  return match ? match.slice(1).map(Number) : null
@@ -186,6 +198,10 @@ if command -v opencode >/dev/null 2>&1; then
186
198
  fi
187
199
  exec opencode "$OPENCODE_COMMAND" "$@"
188
200
  fi
201
+ if [ "${QWEN_AUDIO_AGENT_DESKTOP_INSTALLED_ONLY:-}" = "1" ]; then
202
+ echo "Installed OpenCode $VERSION is older than the supported minimum $OPENCODE_MIN_VERSION." >&2
203
+ exit 1
204
+ fi
189
205
  echo "Installed OpenCode $VERSION is older than the supported minimum; using $OPENCODE_PACKAGE." >&2
190
206
  fi
191
207
 
@@ -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": "0.12.1",
4
+ "version": "1.1.0",
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,
@@ -229,6 +229,7 @@ app.use(express.static(webDist))
229
229
  app.get('*', (req, res) => res.sendFile(resolve(webDist, 'index.html')))
230
230
 
231
231
  const server = createServer(app)
232
+ export { server }
232
233
  realtimeGateway = attachRealtimeGateway(server, {
233
234
  identityManager,
234
235
  memoryStore: frontendMemory,
@@ -243,5 +244,14 @@ realtimeGateway = attachRealtimeGateway(server, {
243
244
  permissionPolicy,
244
245
  })
245
246
  server.listen(config.port, config.host, () => {
246
- console.log(`qwen-audio-agent running at http://${config.host}:${config.port}`)
247
+ const address = server.address()
248
+ const port = address && typeof address === 'object' ? address.port : config.port
249
+ const origin = `http://${config.host}:${port}`
250
+ if (process.parentPort) {
251
+ process.parentPort.postMessage({
252
+ type: 'qwen-audio-agent:gateway-ready',
253
+ origin,
254
+ })
255
+ }
256
+ console.log(`qwen-audio-agent running at ${origin}`)
247
257
  })
@@ -8,7 +8,8 @@ import {
8
8
  } from '../../../shared/backend-catalog.mjs'
9
9
 
10
10
  const here = dirname(fileURLToPath(import.meta.url))
11
- const root = resolve(here, '../../..')
11
+ const sourceRoot = resolve(here, '../../..')
12
+ const root = process.env.QWEN_AUDIO_AGENT_RUNTIME_ROOT || sourceRoot
12
13
  const runtimeEnvironment = loadRuntimeEnvironment({ root })
13
14
 
14
15
  function numberSetting(value, fallback, {
@@ -38,6 +39,15 @@ export function resolveQoderWorkspace(
38
39
  : resolve(configDirectory, 'workspaces/qoder')
39
40
  }
40
41
 
42
+ export function resolveKimiWorkspace(
43
+ env = process.env,
44
+ configDirectory = runtimeEnvironment.configDirectory,
45
+ ) {
46
+ return env.KIMI_WORKSPACE
47
+ ? resolve(root, env.KIMI_WORKSPACE)
48
+ : resolve(configDirectory, 'workspaces/kimi')
49
+ }
50
+
41
51
  export function resolveHermesWorkspace(
42
52
  env = process.env,
43
53
  configDirectory = runtimeEnvironment.configDirectory,
@@ -127,6 +137,7 @@ export function resolveBackendModels(env = process.env) {
127
137
  openCode: common ? `alibaba-cn/${name}` : '',
128
138
  openClaw: common ? `bailian/${name}` : '',
129
139
  qoder: name,
140
+ kimi: common,
130
141
  hermes: common,
131
142
  codeBuddy: name,
132
143
  codex: name,
@@ -187,7 +198,11 @@ export function resolveOpenCodeCoordinatorAgent(env = process.env) {
187
198
  export const config = {
188
199
  root,
189
200
  host: process.env.HOST || '127.0.0.1',
190
- port: numberSetting(process.env.PORT, 3101, { min: 1, max: 65535 }),
201
+ // PORT=0 lets an embedded host (e.g. the desktop app) fall back to a
202
+ // random loopback port and learn it from the child process report.
203
+ port: String(process.env.PORT || '').trim() === '0'
204
+ ? 0
205
+ : numberSetting(process.env.PORT, 3101, { min: 1, max: 65535 }),
191
206
  audioProvider: String(
192
207
  process.env.QWEN_AUDIO_REALTIME_PROVIDER || 'dashscope',
193
208
  ).trim().toLowerCase(),
@@ -260,6 +275,11 @@ export const config = {
260
275
  qoderModel: String(
261
276
  backendModels.qoder,
262
277
  ).trim(),
278
+ kimiDirectory: resolveKimiWorkspace(),
279
+ kimiCliPath: String(process.env.KIMI_CODE_BIN || '').trim(),
280
+ kimiModel: String(
281
+ backendModels.kimi,
282
+ ).trim(),
263
283
  hermesDirectory: resolveHermesWorkspace(),
264
284
  hermesCliPath: String(process.env.HERMES_BIN || '').trim(),
265
285
  hermesModel: String(
@@ -3,7 +3,8 @@ import { fileURLToPath } from 'node:url'
3
3
  import { loadRuntimeEnvironment } from '../../shared/runtime-environment.mjs'
4
4
  import { startManagedBackend } from './process/managed-backend.mjs'
5
5
 
6
- const root = resolve(dirname(fileURLToPath(import.meta.url)), '../..')
6
+ const sourceRoot = resolve(dirname(fileURLToPath(import.meta.url)), '../..')
7
+ const root = process.env.QWEN_AUDIO_AGENT_RUNTIME_ROOT || sourceRoot
7
8
  loadRuntimeEnvironment({ root })
8
9
 
9
10
  let backendRuntime
@@ -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,
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+
3
+ import {
4
+ syncOpenClawGatewayTokenFile,
5
+ writeIsolatedOpenClawConfig,
6
+ } from './backend-drivers/openclaw-auth.mjs'
7
+
8
+ const [, , command, ...args] = process.argv
9
+
10
+ if (command === 'prepare') {
11
+ const [sourcePath, targetPath] = args
12
+ if (!writeIsolatedOpenClawConfig({ sourcePath, targetPath })) {
13
+ process.stderr.write('Unable to prepare isolated OpenClaw configuration.\n')
14
+ process.exitCode = 1
15
+ }
16
+ } else if (command === 'sync-token') {
17
+ syncOpenClawGatewayTokenFile({ targetPath: args[0] })
18
+ } else {
19
+ process.stderr.write(`Unknown OpenClaw desktop helper command: ${command || '(empty)'}\n`)
20
+ process.exitCode = 1
21
+ }
@@ -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": "0.12.1",
4
+ "version": "1.1.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "start": "node src/index.mjs",