qwen-audio-agent 0.9.1 → 0.11.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 +10 -5
- package/PRIVACY.md +3 -3
- package/README.md +57 -23
- package/README_EN.md +70 -27
- package/THIRD_PARTY_NOTICES.md +1 -0
- package/cli/package.json +1 -1
- package/cli/src/arguments.mjs +23 -19
- package/cli/src/launcher.mjs +25 -8
- package/cli/src/runtime.mjs +9 -16
- package/config/claude/workspace/AGENTS.md +16 -0
- package/docs/architecture.md +5 -4
- package/docs/configuration.md +111 -67
- package/package.json +4 -3
- package/scripts/claude-code-acp +69 -0
- package/scripts/codex-acp +10 -1
- package/scripts/openclaw +80 -39
- package/scripts/opencode-server +24 -11
- package/scripts/prepare-openclaw-config.mjs +11 -0
- package/scripts/release-check +7 -2
- package/scripts/release-plan.mjs +108 -0
- package/scripts/sync-openclaw-gateway-token.mjs +9 -0
- package/scripts/verify-package.mjs +2 -2
- package/server/package.json +1 -1
- package/server/src/agent/acp-backend-adapter.mjs +310 -30
- package/server/src/agent/acp-backend-profile.mjs +2 -0
- package/server/src/agent/acp-backend-session-utils.mjs +36 -23
- package/server/src/agent/acp-process-client.mjs +55 -6
- package/server/src/agent/agent-client.mjs +12 -0
- package/server/src/agent/backends/claude.mjs +49 -0
- package/server/src/agent/backends/codex.mjs +2 -1
- package/server/src/agent/backends/hermes.mjs +1 -1
- package/server/src/agent/backends/openclaw.mjs +37 -2
- package/server/src/agent/backends/opencode.mjs +25 -0
- package/server/src/agent/backends/qoder.mjs +1 -8
- package/server/src/agent/backends/registry.mjs +2 -0
- package/server/src/agent/coordinator.mjs +6 -15
- package/server/src/agent/openclaw-adapter.mjs +40 -3
- package/server/src/core/config.mjs +76 -47
- package/server/src/index.mjs +9 -2
- package/server/src/process/backend-drivers/claude.mjs +15 -0
- package/server/src/process/backend-drivers/openclaw-auth.mjs +94 -0
- package/server/src/process/backend-drivers/opencode.mjs +13 -5
- package/server/src/process/backend-drivers/registry.mjs +2 -0
- package/server/src/process/managed-backend.mjs +22 -11
- package/server/src/voice/realtime-gateway.mjs +30 -5
- package/server/src/voice/tools/tool-call-handler.mjs +24 -23
- package/shared/backend-catalog.mjs +5 -1
- package/shared/backend-setup.mjs +479 -0
- package/shared/runtime-environment.mjs +57 -20
- package/tui/package.json +1 -1
- package/web/dist/assets/{index-BeamDvsE.js → index-DfCChshH.js} +28 -28
- package/web/dist/index.html +1 -1
- package/config/opencode/agents/qwen-audio-agent-backend.md +0 -65
package/CONTRIBUTING.md
CHANGED
|
@@ -51,8 +51,13 @@ npm run version:major # 0.5.0 → 1.0.0,不兼容或稳定版
|
|
|
51
51
|
npm run version:set -- 0.6.0-beta.1 # 指定预发布版本
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
更新版本后必须同步维护 `CHANGELOG.md` 并运行 `npm run release:check
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
更新版本后必须同步维护 `CHANGELOG.md` 并运行 `npm run release:check`。发布改动
|
|
55
|
+
应从专用分支提交,例如 `release/0.11.0` 或 `codex/release-0.11.0`。Release PR
|
|
56
|
+
合并到 `main` 后,工作流会确认版本确实发生变化、版本对应的 Changelog 存在且
|
|
57
|
+
完整检查通过,然后自动创建 `v0.11.0` 标签、以 npm provenance 发布公共包,
|
|
58
|
+
并创建 GitHub Release。启用 macOS 正式发布时,还会构建、签名、公证并上传 DMG。
|
|
59
|
+
|
|
60
|
+
普通 PR 合并或未改变版本号的 `main` 更新不会触发发布。若发布在创建标签、上传
|
|
61
|
+
npm 或生成 Release 之间中断,可从 GitHub Actions 手动运行 Release 工作流,并
|
|
62
|
+
输入当前 `package.json` 中的版本继续;已经完成的阶段会被安全复用。仓库维护者
|
|
63
|
+
需预先配置 `NPM_TOKEN`,以及可选的 Apple Developer 签名证书和公证凭据。
|
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
|
|
13
|
-
Agent。后台 Agent 还可能按照用户配置调用模型、工具、MCP
|
|
14
|
-
|
|
12
|
+
OpenCode、OpenClaw、Qoder、Hermes、CodeBuddy、Codex、Claude Code 或用户配置的
|
|
13
|
+
其他 ACP Agent。后台 Agent 还可能按照用户配置调用模型、工具、MCP 服务或访问
|
|
14
|
+
项目文件;这些服务各自的隐私政策同样适用。
|
|
15
15
|
- Markdown 中的远程图片、音频和视频默认不会自动加载。用户点击加载或打开链接
|
|
16
16
|
后,目标站点可能获知用户的 IP 地址和浏览器信息。
|
|
17
17
|
|
package/README.md
CHANGED
|
@@ -7,19 +7,21 @@
|
|
|
7
7
|
[](https://nodejs.org/)
|
|
8
8
|
[](LICENSE)
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Agent,始终在场
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
真正的交流,不该在说完一句话后,就陷入漫长的等待。
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
也不该因为 Agent 正在查资料、调用工具或处理任务,整场对话就此暂停。
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
交流应该是连续的。
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Agent 也应该始终在场。
|
|
19
19
|
|
|
20
|
-
所以,我们做了 **qwen-audio-agent
|
|
20
|
+
所以,我们做了 **qwen-audio-agent**——让 Agent 持续交流、持续工作、持续在场的实时语音运行时。
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
无论是聊天、思考,还是处理任务,Agent 都始终在这场对话里。它会倾听,会回应,也会在任务完成时自然地告诉你:
|
|
23
|
+
|
|
24
|
+
“已经好了。”
|
|
23
25
|
|
|
24
26
|
## 核心特色
|
|
25
27
|
|
|
@@ -37,7 +39,7 @@
|
|
|
37
39
|
能直接回答的问题会立即回答;需要工具或持续处理时,任务会交给后台 Agent。
|
|
38
40
|
整个过程中,用户面对的始终是同一个助理。
|
|
39
41
|
|
|
40
|
-
<details>
|
|
42
|
+
<details open>
|
|
41
43
|
<summary>查看详细架构</summary>
|
|
42
44
|
|
|
43
45
|

|
|
@@ -48,17 +50,18 @@
|
|
|
48
50
|
|
|
49
51
|
## Agent 支持
|
|
50
52
|
|
|
51
|
-
| 后台 Agent |
|
|
53
|
+
| 后台 Agent | 接入方式 | 接入准备 | 推荐指数 |
|
|
52
54
|
| --- | --- | --- | --- |
|
|
53
|
-
| OpenCode |
|
|
54
|
-
| OpenClaw |
|
|
55
|
-
| Qoder |
|
|
56
|
-
| Hermes |
|
|
57
|
-
| CodeBuddy |
|
|
58
|
-
| Codex |
|
|
55
|
+
| OpenCode | 原生 ACP | 支持自动安装和百炼配置 | ★★★★★ |
|
|
56
|
+
| OpenClaw | 内置 ACP 桥接 | 支持自动安装和百炼配置 | ★★★★★ |
|
|
57
|
+
| Qoder | 原生 ACP | 用户自行安装和配置 | ★★★★★ |
|
|
58
|
+
| Hermes | 原生 ACP | 用户自行安装和配置 | ★★★★☆ |
|
|
59
|
+
| CodeBuddy | 原生 ACP | 用户自行安装和配置 | ★★★★☆ |
|
|
60
|
+
| Codex | 外部 ACP 适配 | 用户自行安装和配置 | ★★★★☆ |
|
|
61
|
+
| Claude Code | 外部 ACP 适配 | 用户自行安装和配置 | ★★★★☆ |
|
|
59
62
|
|
|
60
63
|
推荐指数综合反映当前集成完整度、兼容性和实际验证程度:五星表示已经过充分测试的
|
|
61
|
-
|
|
64
|
+
推荐集成,四星表示正在开发或尚未完成同等范围验证。
|
|
62
65
|
详细配置和能力边界见[配置说明](docs/configuration.md)。
|
|
63
66
|
|
|
64
67
|
## 安装
|
|
@@ -101,6 +104,8 @@ npm install -g git+https://github.com/QwenAudio/qwen-audio-agent.git
|
|
|
101
104
|
|
|
102
105
|
## 获取 DashScope API Key
|
|
103
106
|
|
|
107
|
+
阿里云百炼为 Qwen Audio 3.0 Realtime 提供免费体验额度,创建 API Key 后即可免费开始使用 qwen-audio-agent。
|
|
108
|
+
|
|
104
109
|
1. 登录阿里云;如果尚未开通,请先按提示开通阿里云百炼。
|
|
105
110
|
2. 打开百炼控制台的 [API Key 页面](https://bailian.console.aliyun.com/?tab=model#/api-key),
|
|
106
111
|
单击**创建 API Key**。
|
|
@@ -121,15 +126,30 @@ qwenaudio config
|
|
|
121
126
|
```dotenv
|
|
122
127
|
DASHSCOPE_API_KEY=your-key
|
|
123
128
|
AGENT_PROTOCOL=openclaw
|
|
129
|
+
QWEN_AUDIO_AGENT_BACKEND_MODEL=qwen3.7-max
|
|
124
130
|
```
|
|
125
131
|
|
|
126
|
-
3.
|
|
132
|
+
3. 只读检查后台 Agent 是否已经准备好:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
qwenaudio setup
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
该命令不会安装 Agent、触发登录或修改配置。也可以只检查一个后台,或输出供
|
|
139
|
+
桌面版和脚本使用的结构化结果:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
qwenaudio setup --backend openclaw
|
|
143
|
+
qwenaudio setup --json
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
4. 在一个终端中启动 Gateway:
|
|
127
147
|
|
|
128
148
|
```bash
|
|
129
149
|
qwenaudio
|
|
130
150
|
```
|
|
131
151
|
|
|
132
|
-
|
|
152
|
+
5. 另开一个终端,启动 TUI:
|
|
133
153
|
|
|
134
154
|
```bash
|
|
135
155
|
qwenaudio tui
|
|
@@ -196,7 +216,10 @@ qwenaudio gateway uninstall
|
|
|
196
216
|
|
|
197
217
|
## 选择后台 Agent
|
|
198
218
|
|
|
199
|
-
通过 `AGENT_PROTOCOL` 选择后台 Agent
|
|
219
|
+
通过 `AGENT_PROTOCOL` 选择后台 Agent(必填,没有默认值)。OpenCode 和 OpenClaw
|
|
220
|
+
支持自动下载;配置 `DASHSCOPE_API_KEY` 和 `QWEN_AUDIO_AGENT_BACKEND_MODEL`
|
|
221
|
+
后即可自动接入百炼模型。未指定后台模型且用户已经安装并配置对应 Agent 时,则
|
|
222
|
+
完整复用用户环境。使用 OpenClaw:
|
|
200
223
|
|
|
201
224
|
```dotenv
|
|
202
225
|
AGENT_PROTOCOL=openclaw
|
|
@@ -212,16 +235,18 @@ AGENT_PROTOCOL=opencode
|
|
|
212
235
|
|
|
213
236
|
```dotenv
|
|
214
237
|
AGENT_PROTOCOL=qoder
|
|
215
|
-
QODER_MODEL=auto
|
|
216
238
|
```
|
|
217
239
|
|
|
218
|
-
Hermes、CodeBuddy 和
|
|
240
|
+
Hermes、CodeBuddy、Codex 和 Claude Code 也可直接选择:
|
|
219
241
|
|
|
220
242
|
```dotenv
|
|
221
243
|
AGENT_PROTOCOL=hermes
|
|
222
|
-
# 或 codebuddy、codex
|
|
244
|
+
# 或 codebuddy、codex、claude
|
|
223
245
|
```
|
|
224
246
|
|
|
247
|
+
以上其他后台暂时需要用户自行安装并完成原生配置;qwen-audio-agent 会复用其
|
|
248
|
+
用户级模型、工具、MCP、Skill 和认证。
|
|
249
|
+
|
|
225
250
|
使用其他支持 ACP stdio 的 Agent:
|
|
226
251
|
|
|
227
252
|
```dotenv
|
|
@@ -230,7 +255,16 @@ ACP_COMMAND=your-agent
|
|
|
230
255
|
ACP_ARGS=["--acp"]
|
|
231
256
|
```
|
|
232
257
|
|
|
233
|
-
通用 ACP 入口不需要修改 Gateway
|
|
258
|
+
通用 ACP 入口不需要修改 Gateway 代码。命令、参数、显示名称和工作目录可分别通过 `ACP_COMMAND`、`ACP_ARGS`、`ACP_LABEL` 和 `ACP_WORKSPACE` 配置。
|
|
259
|
+
|
|
260
|
+
后台模型遵循以下规则:
|
|
261
|
+
|
|
262
|
+
- 未指定模型:Gateway 不传模型、不调用 ACP 模型设置接口,也不猜测默认模型。
|
|
263
|
+
- 新建 Session:完全由所选 Agent 根据用户自己的配置选择模型。
|
|
264
|
+
- 恢复 Session:完全由所选 Agent 保留该 Session 原来的模型。
|
|
265
|
+
- 显式设置唯一的后台模型变量 `QWEN_AUDIO_AGENT_BACKEND_MODEL`:Gateway 才通过
|
|
266
|
+
ACP 强制覆盖 qwen-audio-agent 管理的 Session,并验证设置结果;不支持或无法
|
|
267
|
+
确认生效时会明确报错。
|
|
234
268
|
|
|
235
269
|
后台权限默认使用 `native`,由后台 Agent 在需要时询问。只有在可信项目中,并且
|
|
236
270
|
明确接受自动执行命令和修改文件时,才应启用:
|
package/README_EN.md
CHANGED
|
@@ -7,22 +7,25 @@
|
|
|
7
7
|
[](https://nodejs.org/)
|
|
8
8
|
[](LICENSE)
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Agent Presence
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Real conversation should not leave you waiting after a single sentence.
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
Nor should it grind to a halt just because the Agent is looking something up,
|
|
15
|
+
calling a tool, or working on a task.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Conversation should keep flowing.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
An Agent should always be present.
|
|
20
20
|
|
|
21
|
-
That is why we built **qwen-audio-agent
|
|
21
|
+
That is why we built **qwen-audio-agent**—a realtime voice runtime that keeps
|
|
22
|
+
Agents talking, working, and present.
|
|
22
23
|
|
|
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:
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
“It’s ready.”
|
|
26
29
|
|
|
27
30
|
## Core Features
|
|
28
31
|
|
|
@@ -46,7 +49,7 @@ that needs tools or sustained processing is delegated to a backend Agent.
|
|
|
46
49
|
Throughout the entire interaction, you are always talking to the same
|
|
47
50
|
assistant.
|
|
48
51
|
|
|
49
|
-
<details>
|
|
52
|
+
<details open>
|
|
50
53
|
<summary>View the detailed architecture</summary>
|
|
51
54
|
|
|
52
55
|

|
|
@@ -58,21 +61,22 @@ module walkthrough.
|
|
|
58
61
|
|
|
59
62
|
## Agent Support
|
|
60
63
|
|
|
61
|
-
| Backend Agent |
|
|
64
|
+
| Backend Agent | Integration | Setup | Rating |
|
|
62
65
|
| --- | --- | --- | --- |
|
|
63
|
-
| OpenCode |
|
|
64
|
-
| OpenClaw |
|
|
65
|
-
| Qoder |
|
|
66
|
-
| Hermes |
|
|
67
|
-
| CodeBuddy |
|
|
68
|
-
| Codex |
|
|
66
|
+
| OpenCode | Native ACP | Automatic installation and Bailian setup supported | ★★★★★ |
|
|
67
|
+
| OpenClaw | Built-in ACP Bridge | Automatic installation and Bailian setup supported | ★★★★★ |
|
|
68
|
+
| Qoder | Native ACP | User installation and configuration required | ★★★★★ |
|
|
69
|
+
| Hermes | Native ACP | User installation and configuration required | ★★★★☆ |
|
|
70
|
+
| CodeBuddy | Native ACP | User installation and configuration required | ★★★★☆ |
|
|
71
|
+
| Codex | External ACP Adapter | User installation and configuration required | ★★★★☆ |
|
|
72
|
+
| Claude Code | External ACP Adapter | User installation and configuration required | ★★★★☆ |
|
|
69
73
|
|
|
70
74
|
Ratings reflect the current integration completeness, compatibility, and
|
|
71
75
|
extent of real-world validation. Five stars identify recommended integrations
|
|
72
76
|
that have been thoroughly tested; four stars identify integrations still in
|
|
73
|
-
development or not yet validated to the same extent.
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
development or not yet validated to the same extent. See the
|
|
78
|
+
[configuration guide](docs/configuration.md) for detailed setup and capability
|
|
79
|
+
boundaries.
|
|
76
80
|
|
|
77
81
|
## Installation
|
|
78
82
|
|
|
@@ -115,6 +119,9 @@ npm install -g git+https://github.com/QwenAudio/qwen-audio-agent.git
|
|
|
115
119
|
|
|
116
120
|
## Get a DashScope API Key
|
|
117
121
|
|
|
122
|
+
Alibaba Cloud Model Studio offers free trial credits for Qwen Audio 3.0
|
|
123
|
+
Realtime. Create an API Key to start using qwen-audio-agent for free.
|
|
124
|
+
|
|
118
125
|
1. Sign in to Alibaba Cloud. If Model Studio is not yet activated, follow the
|
|
119
126
|
prompt to activate it.
|
|
120
127
|
2. Open the Model Studio
|
|
@@ -140,15 +147,31 @@ qwenaudio config
|
|
|
140
147
|
```dotenv
|
|
141
148
|
DASHSCOPE_API_KEY=your-key
|
|
142
149
|
AGENT_PROTOCOL=openclaw
|
|
150
|
+
QWEN_AUDIO_AGENT_BACKEND_MODEL=qwen3.7-max
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
3. Check that the backend Agent is ready without changing it:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
qwenaudio setup
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
This command does not install an Agent, start authentication, or modify
|
|
160
|
+
configuration. You can inspect one backend or produce structured output for
|
|
161
|
+
the desktop app and scripts:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
qwenaudio setup --backend openclaw
|
|
165
|
+
qwenaudio setup --json
|
|
143
166
|
```
|
|
144
167
|
|
|
145
|
-
|
|
168
|
+
4. Start the Gateway in one terminal:
|
|
146
169
|
|
|
147
170
|
```bash
|
|
148
171
|
qwenaudio
|
|
149
172
|
```
|
|
150
173
|
|
|
151
|
-
|
|
174
|
+
5. Open another terminal and start the TUI:
|
|
152
175
|
|
|
153
176
|
```bash
|
|
154
177
|
qwenaudio tui
|
|
@@ -221,7 +244,11 @@ qwenaudio gateway uninstall
|
|
|
221
244
|
## Choose a Backend Agent
|
|
222
245
|
|
|
223
246
|
Select the backend Agent with `AGENT_PROTOCOL` (required, no default value).
|
|
224
|
-
|
|
247
|
+
OpenCode and OpenClaw can be downloaded automatically. Configure
|
|
248
|
+
`DASHSCOPE_API_KEY` and `QWEN_AUDIO_AGENT_BACKEND_MODEL` to connect them to a
|
|
249
|
+
Bailian model automatically. When no backend model is specified and the Agent
|
|
250
|
+
is already installed and configured, qwen-audio-agent fully reuses the user's
|
|
251
|
+
existing environment. Use OpenClaw:
|
|
225
252
|
|
|
226
253
|
```dotenv
|
|
227
254
|
AGENT_PROTOCOL=openclaw
|
|
@@ -237,16 +264,19 @@ Use Qoder:
|
|
|
237
264
|
|
|
238
265
|
```dotenv
|
|
239
266
|
AGENT_PROTOCOL=qoder
|
|
240
|
-
QODER_MODEL=auto
|
|
241
267
|
```
|
|
242
268
|
|
|
243
|
-
Hermes, CodeBuddy, and
|
|
269
|
+
Hermes, CodeBuddy, Codex, and Claude Code can also be selected directly:
|
|
244
270
|
|
|
245
271
|
```dotenv
|
|
246
272
|
AGENT_PROTOCOL=hermes
|
|
247
|
-
# Or codebuddy or
|
|
273
|
+
# Or codebuddy, codex, or claude
|
|
248
274
|
```
|
|
249
275
|
|
|
276
|
+
These other backends currently require the user to install and configure the
|
|
277
|
+
native Agent first. qwen-audio-agent reuses its user-level model, tools, MCP
|
|
278
|
+
servers, Skills, and authentication.
|
|
279
|
+
|
|
250
280
|
Use another Agent that supports ACP over stdio:
|
|
251
281
|
|
|
252
282
|
```dotenv
|
|
@@ -255,7 +285,20 @@ ACP_COMMAND=your-agent
|
|
|
255
285
|
ACP_ARGS=["--acp"]
|
|
256
286
|
```
|
|
257
287
|
|
|
258
|
-
The generic ACP entry point requires no Gateway code changes. Configure its command, arguments, display label,
|
|
288
|
+
The generic ACP entry point requires no Gateway code changes. Configure its command, arguments, display label, and workspace with `ACP_COMMAND`, `ACP_ARGS`, `ACP_LABEL`, and `ACP_WORKSPACE`.
|
|
289
|
+
|
|
290
|
+
Backend model selection follows these rules:
|
|
291
|
+
|
|
292
|
+
- With no model configured, the Gateway sends no model, never calls the ACP
|
|
293
|
+
model-setting interface, and does not guess a default.
|
|
294
|
+
- For a new Session, the selected Agent chooses the model entirely from the
|
|
295
|
+
user's own configuration.
|
|
296
|
+
- For a resumed Session, the selected Agent preserves that Session's existing
|
|
297
|
+
model.
|
|
298
|
+
- Only the single backend model setting, `QWEN_AUDIO_AGENT_BACKEND_MODEL`,
|
|
299
|
+
makes the Gateway force the model for Sessions managed by qwen-audio-agent
|
|
300
|
+
and verify the result. A clear error is returned when the Agent does not
|
|
301
|
+
support the model or the override cannot be verified.
|
|
259
302
|
|
|
260
303
|
Backend permissions default to `native`, so the backend Agent asks when
|
|
261
304
|
permission is required. Enable the following option only in trusted projects
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -17,6 +17,7 @@ qwen-audio-agent 使用并分发若干开源组件。项目自身使用 Apache L
|
|
|
17
17
|
| electron-builder | MIT | https://github.com/electron-userland/electron-builder |
|
|
18
18
|
| Agent Client Protocol TypeScript SDK | Apache-2.0 | https://github.com/agentclientprotocol/typescript-sdk |
|
|
19
19
|
| Codex ACP adapter | Apache-2.0 | https://github.com/agentclientprotocol/codex-acp |
|
|
20
|
+
| Claude Code ACP adapter | Apache-2.0 | https://github.com/zed-industries/claude-code-acp |
|
|
20
21
|
| Model Context Protocol TypeScript SDK | MIT | https://github.com/modelcontextprotocol/typescript-sdk |
|
|
21
22
|
| Zod | MIT | https://github.com/colinhacks/zod |
|
|
22
23
|
| concurrently | MIT | https://github.com/open-cli-tools/concurrently |
|
package/cli/package.json
CHANGED
package/cli/src/arguments.mjs
CHANGED
|
@@ -4,7 +4,14 @@ import {
|
|
|
4
4
|
backendNames,
|
|
5
5
|
} from '../../shared/backend-catalog.mjs'
|
|
6
6
|
|
|
7
|
-
const COMMANDS = new Set([
|
|
7
|
+
const COMMANDS = new Set([
|
|
8
|
+
'gateway',
|
|
9
|
+
'tui',
|
|
10
|
+
'webui',
|
|
11
|
+
'status',
|
|
12
|
+
'config',
|
|
13
|
+
'setup',
|
|
14
|
+
])
|
|
8
15
|
const GATEWAY_ACTIONS = new Set([
|
|
9
16
|
'run',
|
|
10
17
|
'install',
|
|
@@ -63,9 +70,6 @@ export function parseArguments(argv, env = process.env) {
|
|
|
63
70
|
env.QWEN_AUDIO_AGENT_TUI_AUDIO_MODE || 'half',
|
|
64
71
|
).toLowerCase(),
|
|
65
72
|
backend: String(env.AGENT_PROTOCOL || '').toLowerCase(),
|
|
66
|
-
attachOpenClaw: String(
|
|
67
|
-
env.OPENCLAW_ATTACH_EXISTING || '',
|
|
68
|
-
).toLowerCase() === 'true',
|
|
69
73
|
backendPermissionMode: String(
|
|
70
74
|
env.QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE || 'native',
|
|
71
75
|
).toLowerCase(),
|
|
@@ -75,6 +79,8 @@ export function parseArguments(argv, env = process.env) {
|
|
|
75
79
|
backendUrl: '',
|
|
76
80
|
openBrowser: true,
|
|
77
81
|
takeover: false,
|
|
82
|
+
json: false,
|
|
83
|
+
backendSpecified: false,
|
|
78
84
|
gatewayConfigurationSpecified: false,
|
|
79
85
|
}
|
|
80
86
|
let audioModeSpecified = false
|
|
@@ -86,9 +92,7 @@ export function parseArguments(argv, env = process.env) {
|
|
|
86
92
|
options.gatewayConfigurationSpecified = true
|
|
87
93
|
} else if (argument === '--backend') {
|
|
88
94
|
options.backend = nextValue(args, index++, '--backend').toLowerCase()
|
|
89
|
-
options.
|
|
90
|
-
} else if (argument === '--attach-openclaw') {
|
|
91
|
-
options.attachOpenClaw = true
|
|
95
|
+
options.backendSpecified = true
|
|
92
96
|
options.gatewayConfigurationSpecified = true
|
|
93
97
|
} else if (argument === '--backend-agent') {
|
|
94
98
|
options.backendAgent = nextValue(args, index++, '--backend-agent').trim()
|
|
@@ -110,6 +114,7 @@ export function parseArguments(argv, env = process.env) {
|
|
|
110
114
|
audioModeSpecified = true
|
|
111
115
|
} else if (argument === '--no-open') options.openBrowser = false
|
|
112
116
|
else if (argument === '--takeover') options.takeover = true
|
|
117
|
+
else if (argument === '--json') options.json = true
|
|
113
118
|
else if (argument === '--help' || argument === '-h') options.help = true
|
|
114
119
|
else throw new Error(`未知参数:${argument}`)
|
|
115
120
|
}
|
|
@@ -134,6 +139,9 @@ export function parseArguments(argv, env = process.env) {
|
|
|
134
139
|
if (!['tui', 'webui'].includes(command) && options.takeover) {
|
|
135
140
|
throw new Error('--takeover 只适用于 tui 或 webui')
|
|
136
141
|
}
|
|
142
|
+
if (command !== 'setup' && options.json) {
|
|
143
|
+
throw new Error('--json 只适用于 setup')
|
|
144
|
+
}
|
|
137
145
|
if (command !== 'tui' && audioModeSpecified) {
|
|
138
146
|
throw new Error('--audio-mode 只适用于 tui')
|
|
139
147
|
}
|
|
@@ -159,17 +167,9 @@ export function parseArguments(argv, env = process.env) {
|
|
|
159
167
|
options.backendUrl = definition?.baseUrlEnvironment
|
|
160
168
|
? cleanOrigin(options.backendUrl || configuredBackendUrl, '后台地址')
|
|
161
169
|
: ''
|
|
162
|
-
if (options.attachOpenClaw && options.backend !== 'openclaw') {
|
|
163
|
-
throw new Error('--attach-openclaw 只适用于 OpenClaw')
|
|
164
|
-
}
|
|
165
170
|
if (
|
|
166
|
-
|
|
167
|
-
&&
|
|
168
|
-
) {
|
|
169
|
-
throw new Error('最高权限模式只支持由 Gateway 启动的后台 Agent')
|
|
170
|
-
}
|
|
171
|
-
if (
|
|
172
|
-
definition
|
|
171
|
+
command !== 'setup'
|
|
172
|
+
&& definition
|
|
173
173
|
&& options.backendPermissionMode === 'full'
|
|
174
174
|
&& !definition.supportsFullPermission
|
|
175
175
|
) {
|
|
@@ -208,15 +208,19 @@ export function helpText() {
|
|
|
208
208
|
' qwenaudio webui [选项] 打开现有 Gateway 的 WebUI',
|
|
209
209
|
' qwenaudio status [选项] gateway status 的兼容别名',
|
|
210
210
|
' qwenaudio config 显示用户配置文件位置',
|
|
211
|
+
' qwenaudio setup [选项] 只读检查后台 Agent 接入准备情况',
|
|
211
212
|
'',
|
|
212
213
|
'Gateway 选项:',
|
|
213
214
|
' --url URL Gateway 地址(默认 http://127.0.0.1:3101)',
|
|
214
|
-
' --backend NAME 必填:openclaw、opencode、qoder、hermes、codebuddy、codex 或 acp(也可在 config.env 设置 AGENT_PROTOCOL)',
|
|
215
|
-
' --attach-openclaw 连接用户已启动的 OpenClaw Gateway',
|
|
215
|
+
' --backend NAME 必填:openclaw、opencode、qoder、hermes、codebuddy、codex、claude 或 acp(也可在 config.env 设置 AGENT_PROTOCOL)',
|
|
216
216
|
' --backend-permission-mode MODE native(默认)或 full(最高权限)',
|
|
217
217
|
' --backend-url URL 后台 Server 地址',
|
|
218
218
|
' --backend-agent ID 指定协调 Agent',
|
|
219
219
|
'',
|
|
220
|
+
'Setup 选项:',
|
|
221
|
+
' --backend NAME 只检查指定后台;默认检查全部后台',
|
|
222
|
+
' --json 输出供桌面版或脚本使用的 JSON',
|
|
223
|
+
'',
|
|
220
224
|
'界面选项:',
|
|
221
225
|
' --session ID 复用指定语音会话',
|
|
222
226
|
' --audio-mode MODE Linux / Windows 使用 half(默认)或 full',
|
package/cli/src/launcher.mjs
CHANGED
|
@@ -2,6 +2,10 @@ import { dirname, resolve } from 'node:path'
|
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
3
3
|
import { loadRuntimeEnvironment } from '../../shared/runtime-environment.mjs'
|
|
4
4
|
import { backendDefinition } from '../../shared/backend-catalog.mjs'
|
|
5
|
+
import {
|
|
6
|
+
formatBackendSetup,
|
|
7
|
+
inspectBackendSetups,
|
|
8
|
+
} from '../../shared/backend-setup.mjs'
|
|
5
9
|
import { helpText, parseArguments } from './arguments.mjs'
|
|
6
10
|
import {
|
|
7
11
|
ensureRuntime,
|
|
@@ -29,18 +33,13 @@ async function runMinimal(options) {
|
|
|
29
33
|
|
|
30
34
|
function applyGatewayOptions(env, options) {
|
|
31
35
|
env.AGENT_PROTOCOL = options.backend
|
|
32
|
-
|
|
33
|
-
env.OPENCLAW_ATTACH_EXISTING = 'true'
|
|
34
|
-
} else {
|
|
35
|
-
delete env.OPENCLAW_ATTACH_EXISTING
|
|
36
|
-
}
|
|
36
|
+
const definition = backendDefinition(options.backend)
|
|
37
37
|
env.QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE = options.backendPermissionMode
|
|
38
38
|
if (options.backendAgent) {
|
|
39
39
|
env.QWEN_AUDIO_AGENT_BACKEND_AGENT = options.backendAgent
|
|
40
40
|
} else {
|
|
41
41
|
delete env.QWEN_AUDIO_AGENT_BACKEND_AGENT
|
|
42
42
|
}
|
|
43
|
-
const definition = backendDefinition(options.backend)
|
|
44
43
|
if (definition?.baseUrlEnvironment) {
|
|
45
44
|
env[definition.baseUrlEnvironment] = options.backendUrl
|
|
46
45
|
}
|
|
@@ -72,7 +71,15 @@ export async function main(argv, {
|
|
|
72
71
|
env = process.env,
|
|
73
72
|
stdout = process.stdout,
|
|
74
73
|
signalSource = process,
|
|
75
|
-
prepareEnvironment = () => loadRuntimeEnvironment({
|
|
74
|
+
prepareEnvironment = ({ readOnly = false } = {}) => loadRuntimeEnvironment({
|
|
75
|
+
root,
|
|
76
|
+
env,
|
|
77
|
+
readOnly,
|
|
78
|
+
}),
|
|
79
|
+
inspectSetups = options => inspectBackendSetups({
|
|
80
|
+
env,
|
|
81
|
+
backend: options.backendSpecified ? options.backend : '',
|
|
82
|
+
}),
|
|
76
83
|
runMinimalTui = runMinimal,
|
|
77
84
|
prepareRuntime = options => ensureRuntime(options, { root, env }),
|
|
78
85
|
inspectGateway = url => readGatewayHealth(url),
|
|
@@ -82,7 +89,8 @@ export async function main(argv, {
|
|
|
82
89
|
runWebUi = options => launchWebUi(options),
|
|
83
90
|
acquireInstance = directory => acquireCliInstance(directory),
|
|
84
91
|
} = {}) {
|
|
85
|
-
const
|
|
92
|
+
const setupCommand = argv[0] === 'setup'
|
|
93
|
+
const environment = prepareEnvironment({ readOnly: setupCommand })
|
|
86
94
|
const options = parseArguments(argv, env)
|
|
87
95
|
if (options.help) {
|
|
88
96
|
stdout.write(`${helpText()}\n`)
|
|
@@ -93,6 +101,15 @@ export async function main(argv, {
|
|
|
93
101
|
|| resolve(environment.configDirectory, 'config.env')}\n`)
|
|
94
102
|
return 0
|
|
95
103
|
}
|
|
104
|
+
if (options.command === 'setup') {
|
|
105
|
+
const report = inspectSetups(options)
|
|
106
|
+
stdout.write(options.json
|
|
107
|
+
? `${JSON.stringify(report, null, 2)}\n`
|
|
108
|
+
: `${formatBackendSetup(report)}\n`)
|
|
109
|
+
const selected = report.backends.find(item => item.selected)
|
|
110
|
+
|| (options.backendSpecified ? report.backends[0] : null)
|
|
111
|
+
return selected && !selected.ready ? 1 : 0
|
|
112
|
+
}
|
|
96
113
|
|
|
97
114
|
if (
|
|
98
115
|
(options.command === 'gateway' && options.gatewayAction !== 'run')
|
package/cli/src/runtime.mjs
CHANGED
|
@@ -38,14 +38,7 @@ export function resolveBackend(options = {}, env = process.env) {
|
|
|
38
38
|
if (!definition) throw new Error(
|
|
39
39
|
`不支持的后台 Agent:${protocol}(可选 ${backendNames().join('、')})`,
|
|
40
40
|
)
|
|
41
|
-
const
|
|
42
|
-
options.attachOpenClaw === true
|
|
43
|
-
|| String(env.OPENCLAW_ATTACH_EXISTING || '').toLowerCase() === 'true'
|
|
44
|
-
)
|
|
45
|
-
if (attachOpenClaw && protocol !== 'openclaw') {
|
|
46
|
-
throw new Error('连接已有 OpenClaw Gateway 只适用于 OpenClaw')
|
|
47
|
-
}
|
|
48
|
-
const ownership = attachOpenClaw ? 'external' : 'owned'
|
|
41
|
+
const ownership = 'owned'
|
|
49
42
|
const permissionMode = String(
|
|
50
43
|
options.backendPermissionMode
|
|
51
44
|
|| env.QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE
|
|
@@ -66,7 +59,6 @@ export function resolveBackend(options = {}, env = process.env) {
|
|
|
66
59
|
return {
|
|
67
60
|
protocol,
|
|
68
61
|
ownership,
|
|
69
|
-
attachOpenClaw,
|
|
70
62
|
permissionMode,
|
|
71
63
|
agentId: String(
|
|
72
64
|
options.backendAgent || env.QWEN_AUDIO_AGENT_BACKEND_AGENT || '',
|
|
@@ -177,18 +169,15 @@ function waitForReadiness(child, readiness, label) {
|
|
|
177
169
|
}
|
|
178
170
|
|
|
179
171
|
function backendEnvironment(env, backend) {
|
|
172
|
+
const definition = backendDefinition(backend.protocol)
|
|
180
173
|
const next = {
|
|
181
174
|
...env,
|
|
182
175
|
AGENT_PROTOCOL: backend.protocol,
|
|
183
|
-
...(backend.attachOpenClaw
|
|
184
|
-
? { OPENCLAW_ATTACH_EXISTING: 'true' }
|
|
185
|
-
: {}),
|
|
186
176
|
QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE: backend.permissionMode,
|
|
187
177
|
...(backend.agentId
|
|
188
178
|
? { QWEN_AUDIO_AGENT_BACKEND_AGENT: backend.agentId }
|
|
189
179
|
: {}),
|
|
190
180
|
}
|
|
191
|
-
const definition = backendDefinition(backend.protocol)
|
|
192
181
|
if (!definition?.baseUrlEnvironment) return next
|
|
193
182
|
const target = new URL(backend.baseUrl)
|
|
194
183
|
next[definition.baseUrlEnvironment] = backend.baseUrl
|
|
@@ -218,7 +207,9 @@ function gatewaySpawn(root, platform, env, target, options) {
|
|
|
218
207
|
PORT: String(options.listenPort || target.port || '80'),
|
|
219
208
|
},
|
|
220
209
|
detached: platform !== 'win32',
|
|
221
|
-
|
|
210
|
+
// Keep a private IPC channel so the Gateway can detect an npm/CLI
|
|
211
|
+
// launcher that disappears before its JavaScript signal handlers run.
|
|
212
|
+
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
|
|
222
213
|
},
|
|
223
214
|
}
|
|
224
215
|
}
|
|
@@ -243,7 +234,7 @@ export class ManagedRuntime {
|
|
|
243
234
|
if (this.platform !== 'win32' && Number.isInteger(child.pid)) {
|
|
244
235
|
try {
|
|
245
236
|
// Managed services are spawned as process-group leaders. Signalling
|
|
246
|
-
// the group also stops
|
|
237
|
+
// the group also stops package-manager and backend descendants.
|
|
247
238
|
this.killImpl(-child.pid, signal)
|
|
248
239
|
continue
|
|
249
240
|
} catch {
|
|
@@ -294,6 +285,8 @@ export async function ensureRuntime(options, {
|
|
|
294
285
|
const runtime = new ManagedRuntime([], { platform })
|
|
295
286
|
const local = isLocalGateway(options.url)
|
|
296
287
|
const backend = resolveBackend(options, env)
|
|
288
|
+
const backendLabel = backendDefinition(backend.protocol)?.label
|
|
289
|
+
|| backend.protocol
|
|
297
290
|
let health = await readGatewayHealth(options.url, fetchImpl)
|
|
298
291
|
const existingGateway = Boolean(health)
|
|
299
292
|
|
|
@@ -350,7 +343,7 @@ export async function ensureRuntime(options, {
|
|
|
350
343
|
if (health.backend?.ok !== true && options.waitForBackend !== false) {
|
|
351
344
|
throw new Error(
|
|
352
345
|
backend.ownership === 'external'
|
|
353
|
-
? `未连接到已有
|
|
346
|
+
? `未连接到已有 ${backendLabel} 后台服务,请先启动并检查 ${backend.baseUrl}`
|
|
354
347
|
: `Gateway 启动的后台 Agent 未就绪:${health.backend?.baseUrl || backend.baseUrl}`,
|
|
355
348
|
)
|
|
356
349
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# qwen-audio-agent Claude 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
|
+
Claude Code 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. An implementation, fix, or "continue
|
|
11
|
+
working" request must remain an execution request; do not turn it into a
|
|
12
|
+
read-only review or wait for confirmation unless the user asked for planning
|
|
13
|
+
or an indispensable choice is missing.
|
|
14
|
+
- Continue an existing Session when the user refers to prior Claude Code work.
|
|
15
|
+
- Only work in this coordinator workspace when no project Session is needed.
|
|
16
|
+
- Never expose Session IDs, delegation IDs, or internal routing metadata.
|