qwen-audio-agent 0.9.0 → 0.10.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 +34 -20
- package/README_EN.md +44 -24
- package/THIRD_PARTY_NOTICES.md +1 -0
- package/cli/package.json +1 -1
- package/cli/src/arguments.mjs +12 -26
- package/cli/src/launcher.mjs +5 -1
- package/cli/src/runtime.mjs +30 -23
- package/config/claude/workspace/AGENTS.md +16 -0
- package/docs/architecture.md +5 -4
- package/docs/configuration.md +50 -28
- package/package.json +4 -3
- package/scripts/claude-code-acp +59 -0
- package/scripts/opencode-server +1 -3
- package/scripts/release-check +8 -2
- package/scripts/release-plan.mjs +108 -0
- package/scripts/verify-package.mjs +2 -1
- package/server/package.json +1 -1
- package/server/src/agent/acp-backend-adapter.mjs +9 -7
- package/server/src/agent/acp-backend-profile.mjs +2 -0
- package/server/src/agent/agent-client.mjs +10 -2
- package/server/src/agent/backends/claude.mjs +46 -0
- package/server/src/agent/backends/registry.mjs +2 -0
- package/server/src/core/config.mjs +45 -22
- package/server/src/process/backend-drivers/claude.mjs +15 -0
- package/server/src/process/backend-drivers/codebuddy.mjs +2 -2
- package/server/src/process/backend-drivers/codex.mjs +2 -2
- package/server/src/process/backend-drivers/generic-acp.mjs +2 -2
- package/server/src/process/backend-drivers/hermes.mjs +2 -2
- package/server/src/process/backend-drivers/openclaw.mjs +2 -2
- package/server/src/process/backend-drivers/opencode.mjs +15 -7
- package/server/src/process/backend-drivers/qoder.mjs +2 -2
- package/server/src/process/backend-drivers/registry.mjs +2 -0
- package/server/src/process/backend-drivers/shared.mjs +6 -6
- package/server/src/process/managed-backend.mjs +20 -15
- package/server/src/voice/announcement/announcement-manager.mjs +2 -2
- package/server/src/voice/realtime-gateway.mjs +13 -6
- package/shared/backend-catalog.mjs +6 -7
- package/shared/runtime-environment.mjs +17 -4
- package/tui/package.json +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
|
@@ -3,23 +3,25 @@
|
|
|
3
3
|
[中文](README.md) | [English](README_EN.md)
|
|
4
4
|
|
|
5
5
|
[](https://github.com/QwenAudio/qwen-audio-agent/actions/workflows/ci.yml)
|
|
6
|
-
[](https://www.npmjs.com/package/qwen-audio-agent)
|
|
7
7
|
[](https://nodejs.org/)
|
|
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
|
## 安装
|
|
@@ -99,6 +102,17 @@ npm install -g qwen-audio-agent@latest
|
|
|
99
102
|
npm install -g git+https://github.com/QwenAudio/qwen-audio-agent.git
|
|
100
103
|
```
|
|
101
104
|
|
|
105
|
+
## 获取 DashScope API Key
|
|
106
|
+
|
|
107
|
+
阿里云百炼为 Qwen Audio 3.0 Realtime 提供免费体验额度,创建 API Key 后即可免费开始使用 qwen-audio-agent。
|
|
108
|
+
|
|
109
|
+
1. 登录阿里云;如果尚未开通,请先按提示开通阿里云百炼。
|
|
110
|
+
2. 打开百炼控制台的 [API Key 页面](https://bailian.console.aliyun.com/?tab=model#/api-key),
|
|
111
|
+
单击**创建 API Key**。
|
|
112
|
+
3. 复制生成的 Key,稍后填入 `config.env`。请勿公开或提交 API Key。
|
|
113
|
+
|
|
114
|
+
详细说明见[百炼官方文档](https://help.aliyun.com/zh/model-studio/get-api-key)。
|
|
115
|
+
|
|
102
116
|
## 快速开始
|
|
103
117
|
|
|
104
118
|
1. 创建配置:
|
|
@@ -206,11 +220,11 @@ AGENT_PROTOCOL=qoder
|
|
|
206
220
|
QODER_MODEL=auto
|
|
207
221
|
```
|
|
208
222
|
|
|
209
|
-
Hermes、CodeBuddy 和
|
|
223
|
+
Hermes、CodeBuddy、Codex 和 Claude Code 也可直接选择:
|
|
210
224
|
|
|
211
225
|
```dotenv
|
|
212
226
|
AGENT_PROTOCOL=hermes
|
|
213
|
-
# 或 codebuddy、codex
|
|
227
|
+
# 或 codebuddy、codex、claude
|
|
214
228
|
```
|
|
215
229
|
|
|
216
230
|
使用其他支持 ACP stdio 的 Agent:
|
package/README_EN.md
CHANGED
|
@@ -3,26 +3,29 @@
|
|
|
3
3
|
[中文](README.md) | [English](README_EN.md)
|
|
4
4
|
|
|
5
5
|
[](https://github.com/QwenAudio/qwen-audio-agent/actions/workflows/ci.yml)
|
|
6
|
-
[](https://www.npmjs.com/package/qwen-audio-agent)
|
|
7
7
|
[](https://nodejs.org/)
|
|
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 supported | ★★★★★ |
|
|
67
|
+
| OpenClaw | Built-in ACP Bridge | Automatic installation supported | ★★★★★ |
|
|
68
|
+
| Qoder | Native ACP | Requires user installation and authentication | ★★★★★ |
|
|
69
|
+
| Hermes | Native ACP | Requires user installation and model configuration | ★★★★☆ |
|
|
70
|
+
| CodeBuddy | Native ACP | Requires user installation and authentication | ★★★★☆ |
|
|
71
|
+
| Codex | External ACP Adapter | Automatic installation supported | ★★★★☆ |
|
|
72
|
+
| Claude Code | External ACP Adapter | Automatic installation supported; user authentication 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
|
|
|
@@ -113,6 +117,22 @@ Upgrade to the latest code from GitHub:
|
|
|
113
117
|
npm install -g git+https://github.com/QwenAudio/qwen-audio-agent.git
|
|
114
118
|
```
|
|
115
119
|
|
|
120
|
+
## Get a DashScope API Key
|
|
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
|
+
|
|
125
|
+
1. Sign in to Alibaba Cloud. If Model Studio is not yet activated, follow the
|
|
126
|
+
prompt to activate it.
|
|
127
|
+
2. Open the Model Studio
|
|
128
|
+
[API Key page](https://bailian.console.aliyun.com/?tab=model#/api-key),
|
|
129
|
+
then click **Create API Key**.
|
|
130
|
+
3. Copy the generated Key and add it to `config.env` later. Never publish or
|
|
131
|
+
commit your API Key.
|
|
132
|
+
|
|
133
|
+
See the [official API Key guide](https://help.aliyun.com/en/model-studio/get-api-key)
|
|
134
|
+
for details.
|
|
135
|
+
|
|
116
136
|
## Quick Start
|
|
117
137
|
|
|
118
138
|
1. Create your configuration:
|
|
@@ -227,11 +247,11 @@ AGENT_PROTOCOL=qoder
|
|
|
227
247
|
QODER_MODEL=auto
|
|
228
248
|
```
|
|
229
249
|
|
|
230
|
-
Hermes, CodeBuddy, and
|
|
250
|
+
Hermes, CodeBuddy, Codex, and Claude Code can also be selected directly:
|
|
231
251
|
|
|
232
252
|
```dotenv
|
|
233
253
|
AGENT_PROTOCOL=hermes
|
|
234
|
-
# Or codebuddy or
|
|
254
|
+
# Or codebuddy, codex, or claude
|
|
235
255
|
```
|
|
236
256
|
|
|
237
257
|
Use another Agent that supports ACP over stdio:
|
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
|
@@ -14,7 +14,6 @@ const GATEWAY_ACTIONS = new Set([
|
|
|
14
14
|
'status',
|
|
15
15
|
'uninstall',
|
|
16
16
|
])
|
|
17
|
-
const BACKEND_MODES = new Set(['managed', 'compatible'])
|
|
18
17
|
const BACKEND_PERMISSION_MODES = new Set(['native', 'full'])
|
|
19
18
|
const TUI_AUDIO_MODES = new Set(['half', 'full'])
|
|
20
19
|
|
|
@@ -64,9 +63,9 @@ export function parseArguments(argv, env = process.env) {
|
|
|
64
63
|
env.QWEN_AUDIO_AGENT_TUI_AUDIO_MODE || 'half',
|
|
65
64
|
).toLowerCase(),
|
|
66
65
|
backend: String(env.AGENT_PROTOCOL || '').toLowerCase(),
|
|
67
|
-
|
|
68
|
-
env.
|
|
69
|
-
).toLowerCase(),
|
|
66
|
+
attachOpenClaw: String(
|
|
67
|
+
env.OPENCLAW_ATTACH_EXISTING || '',
|
|
68
|
+
).toLowerCase() === 'true',
|
|
70
69
|
backendPermissionMode: String(
|
|
71
70
|
env.QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE || 'native',
|
|
72
71
|
).toLowerCase(),
|
|
@@ -88,12 +87,8 @@ export function parseArguments(argv, env = process.env) {
|
|
|
88
87
|
} else if (argument === '--backend') {
|
|
89
88
|
options.backend = nextValue(args, index++, '--backend').toLowerCase()
|
|
90
89
|
options.gatewayConfigurationSpecified = true
|
|
91
|
-
} else if (argument === '--
|
|
92
|
-
options.
|
|
93
|
-
args,
|
|
94
|
-
index++,
|
|
95
|
-
'--backend-mode',
|
|
96
|
-
).toLowerCase()
|
|
90
|
+
} else if (argument === '--attach-openclaw') {
|
|
91
|
+
options.attachOpenClaw = true
|
|
97
92
|
options.gatewayConfigurationSpecified = true
|
|
98
93
|
} else if (argument === '--backend-agent') {
|
|
99
94
|
options.backendAgent = nextValue(args, index++, '--backend-agent').trim()
|
|
@@ -127,11 +122,6 @@ export function parseArguments(argv, env = process.env) {
|
|
|
127
122
|
`不支持的后台:${options.backend}(可选 ${backendNames().join('、')})`,
|
|
128
123
|
)
|
|
129
124
|
}
|
|
130
|
-
if (!BACKEND_MODES.has(options.backendMode)) {
|
|
131
|
-
throw new Error(
|
|
132
|
-
`不支持的后台模式:${options.backendMode}(可选 managed、compatible)`,
|
|
133
|
-
)
|
|
134
|
-
}
|
|
135
125
|
if (!BACKEND_PERMISSION_MODES.has(options.backendPermissionMode)) {
|
|
136
126
|
throw new Error(
|
|
137
127
|
`不支持的后台权限模式:${options.backendPermissionMode}`
|
|
@@ -169,18 +159,14 @@ export function parseArguments(argv, env = process.env) {
|
|
|
169
159
|
options.backendUrl = definition?.baseUrlEnvironment
|
|
170
160
|
? cleanOrigin(options.backendUrl || configuredBackendUrl, '后台地址')
|
|
171
161
|
: ''
|
|
172
|
-
if (
|
|
173
|
-
|
|
174
|
-
&& !definition.supportsCompatible
|
|
175
|
-
&& options.backendMode !== 'managed'
|
|
176
|
-
) {
|
|
177
|
-
throw new Error(`${definition.label} 后台当前只支持 managed 模式`)
|
|
162
|
+
if (options.attachOpenClaw && options.backend !== 'openclaw') {
|
|
163
|
+
throw new Error('--attach-openclaw 只适用于 OpenClaw')
|
|
178
164
|
}
|
|
179
165
|
if (
|
|
180
166
|
options.backendPermissionMode === 'full'
|
|
181
|
-
&& options.
|
|
167
|
+
&& options.attachOpenClaw
|
|
182
168
|
) {
|
|
183
|
-
throw new Error('最高权限模式只支持由 Gateway
|
|
169
|
+
throw new Error('最高权限模式只支持由 Gateway 启动的后台 Agent')
|
|
184
170
|
}
|
|
185
171
|
if (
|
|
186
172
|
definition
|
|
@@ -225,11 +211,11 @@ export function helpText() {
|
|
|
225
211
|
'',
|
|
226
212
|
'Gateway 选项:',
|
|
227
213
|
' --url URL Gateway 地址(默认 http://127.0.0.1:3101)',
|
|
228
|
-
' --backend NAME 必填:openclaw、opencode、qoder、hermes、codebuddy、codex 或 acp(也可在 config.env 设置 AGENT_PROTOCOL)',
|
|
229
|
-
' --
|
|
214
|
+
' --backend NAME 必填:openclaw、opencode、qoder、hermes、codebuddy、codex、claude 或 acp(也可在 config.env 设置 AGENT_PROTOCOL)',
|
|
215
|
+
' --attach-openclaw 连接用户已启动的 OpenClaw Gateway',
|
|
230
216
|
' --backend-permission-mode MODE native(默认)或 full(最高权限)',
|
|
231
217
|
' --backend-url URL 后台 Server 地址',
|
|
232
|
-
' --backend-agent ID
|
|
218
|
+
' --backend-agent ID 指定协调 Agent',
|
|
233
219
|
'',
|
|
234
220
|
'界面选项:',
|
|
235
221
|
' --session ID 复用指定语音会话',
|
package/cli/src/launcher.mjs
CHANGED
|
@@ -29,7 +29,11 @@ async function runMinimal(options) {
|
|
|
29
29
|
|
|
30
30
|
function applyGatewayOptions(env, options) {
|
|
31
31
|
env.AGENT_PROTOCOL = options.backend
|
|
32
|
-
|
|
32
|
+
if (options.attachOpenClaw) {
|
|
33
|
+
env.OPENCLAW_ATTACH_EXISTING = 'true'
|
|
34
|
+
} else {
|
|
35
|
+
delete env.OPENCLAW_ATTACH_EXISTING
|
|
36
|
+
}
|
|
33
37
|
env.QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE = options.backendPermissionMode
|
|
34
38
|
if (options.backendAgent) {
|
|
35
39
|
env.QWEN_AUDIO_AGENT_BACKEND_AGENT = options.backendAgent
|
package/cli/src/runtime.mjs
CHANGED
|
@@ -38,15 +38,14 @@ 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.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (!definition.supportsCompatible && mode !== 'managed') {
|
|
48
|
-
throw new Error(`${definition.label} 后台当前只支持 managed 模式`)
|
|
41
|
+
const attachOpenClaw = (
|
|
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')
|
|
49
47
|
}
|
|
48
|
+
const ownership = attachOpenClaw ? 'external' : 'owned'
|
|
50
49
|
const permissionMode = String(
|
|
51
50
|
options.backendPermissionMode
|
|
52
51
|
|| env.QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE
|
|
@@ -55,8 +54,8 @@ export function resolveBackend(options = {}, env = process.env) {
|
|
|
55
54
|
if (!['native', 'full'].includes(permissionMode)) {
|
|
56
55
|
throw new Error(`不支持的后台权限模式:${permissionMode}`)
|
|
57
56
|
}
|
|
58
|
-
if (permissionMode === 'full' &&
|
|
59
|
-
throw new Error('最高权限模式只支持由 Gateway
|
|
57
|
+
if (permissionMode === 'full' && ownership !== 'owned') {
|
|
58
|
+
throw new Error('最高权限模式只支持由 Gateway 启动的后台 Agent')
|
|
60
59
|
}
|
|
61
60
|
if (permissionMode === 'full' && !definition.supportsFullPermission) {
|
|
62
61
|
throw new Error(`${definition.label} 不支持 Gateway 统一最高权限模式`)
|
|
@@ -66,7 +65,8 @@ export function resolveBackend(options = {}, env = process.env) {
|
|
|
66
65
|
: ''
|
|
67
66
|
return {
|
|
68
67
|
protocol,
|
|
69
|
-
|
|
68
|
+
ownership,
|
|
69
|
+
attachOpenClaw,
|
|
70
70
|
permissionMode,
|
|
71
71
|
agentId: String(
|
|
72
72
|
options.backendAgent || env.QWEN_AUDIO_AGENT_BACKEND_AGENT || '',
|
|
@@ -80,7 +80,8 @@ export function resolveBackend(options = {}, env = process.env) {
|
|
|
80
80
|
export function assertGatewayCompatibility(health, backend) {
|
|
81
81
|
const actualProtocol = health?.backend?.kind || health?.backend?.protocol
|
|
82
82
|
const actualBaseUrl = health?.backend?.baseUrl
|
|
83
|
-
const
|
|
83
|
+
const actualOwnership = health?.backend?.ownership
|
|
84
|
+
|| (health?.backend?.mode === 'compatible' ? 'external' : 'owned')
|
|
84
85
|
const actualPermissionMode = health?.backend?.permissionMode || 'native'
|
|
85
86
|
if (
|
|
86
87
|
!actualProtocol
|
|
@@ -96,7 +97,7 @@ export function assertGatewayCompatibility(health, backend) {
|
|
|
96
97
|
actualProtocol !== backend.protocol
|
|
97
98
|
|| (
|
|
98
99
|
backendDefinition(backend.protocol).baseUrlEnvironment
|
|
99
|
-
&& backend.
|
|
100
|
+
&& backend.ownership === 'external'
|
|
100
101
|
&& normalizedOrigin(actualBaseUrl) !== backend.baseUrl
|
|
101
102
|
)
|
|
102
103
|
) {
|
|
@@ -105,10 +106,14 @@ export function assertGatewayCompatibility(health, backend) {
|
|
|
105
106
|
+ `与当前配置 ${backend.protocol} (${backend.baseUrl}) 不一致`,
|
|
106
107
|
)
|
|
107
108
|
}
|
|
108
|
-
if (
|
|
109
|
+
if (
|
|
110
|
+
actualOwnership
|
|
111
|
+
&& backend.ownership
|
|
112
|
+
&& actualOwnership !== backend.ownership
|
|
113
|
+
) {
|
|
109
114
|
throw new Error(
|
|
110
|
-
`现有 Gateway
|
|
111
|
-
+ `与当前配置 ${backend.
|
|
115
|
+
`现有 Gateway 的后台进程归属为 ${actualOwnership},`
|
|
116
|
+
+ `与当前配置 ${backend.ownership} 不一致`,
|
|
112
117
|
)
|
|
113
118
|
}
|
|
114
119
|
if (actualPermissionMode !== backend.permissionMode) {
|
|
@@ -175,7 +180,9 @@ function backendEnvironment(env, backend) {
|
|
|
175
180
|
const next = {
|
|
176
181
|
...env,
|
|
177
182
|
AGENT_PROTOCOL: backend.protocol,
|
|
178
|
-
|
|
183
|
+
...(backend.attachOpenClaw
|
|
184
|
+
? { OPENCLAW_ATTACH_EXISTING: 'true' }
|
|
185
|
+
: {}),
|
|
179
186
|
QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE: backend.permissionMode,
|
|
180
187
|
...(backend.agentId
|
|
181
188
|
? { QWEN_AUDIO_AGENT_BACKEND_AGENT: backend.agentId }
|
|
@@ -318,9 +325,9 @@ export async function ensureRuntime(options, {
|
|
|
318
325
|
)
|
|
319
326
|
}
|
|
320
327
|
|
|
321
|
-
//
|
|
322
|
-
// Existing Gateways must still match the requested protocol and
|
|
323
|
-
if (existingGateway || backend.
|
|
328
|
+
// An owned Gateway may move its private backend to a free local port.
|
|
329
|
+
// Existing Gateways must still match the requested protocol and ownership.
|
|
330
|
+
if (existingGateway || backend.ownership === 'external') {
|
|
324
331
|
assertGatewayCompatibility(health, backend)
|
|
325
332
|
} else {
|
|
326
333
|
const actualProtocol = health?.backend?.kind || health?.backend?.protocol
|
|
@@ -342,9 +349,9 @@ export async function ensureRuntime(options, {
|
|
|
342
349
|
|
|
343
350
|
if (health.backend?.ok !== true && options.waitForBackend !== false) {
|
|
344
351
|
throw new Error(
|
|
345
|
-
backend.
|
|
346
|
-
?
|
|
347
|
-
: `Gateway
|
|
352
|
+
backend.ownership === 'external'
|
|
353
|
+
? `未连接到已有 OpenClaw Gateway,请先启动并检查 ${backend.baseUrl}`
|
|
354
|
+
: `Gateway 启动的后台 Agent 未就绪:${health.backend?.baseUrl || backend.baseUrl}`,
|
|
348
355
|
)
|
|
349
356
|
}
|
|
350
357
|
|
|
@@ -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.
|
package/docs/architecture.md
CHANGED
|
@@ -298,10 +298,11 @@ own labels and interaction patterns.
|
|
|
298
298
|
|
|
299
299
|
The Gateway is the only core product service. The shared adapter owns one ACP
|
|
300
300
|
stdio child and stops it with the Gateway. OpenCode and Qoder run directly as
|
|
301
|
-
ACP agents;
|
|
302
|
-
|
|
303
|
-
OpenClaw Gateway
|
|
304
|
-
already-running Gateway.
|
|
301
|
+
ACP agents; OpenCode may additionally expose its native local Session UI.
|
|
302
|
+
OpenClaw uses a small ACP bridge. By default its adapter also starts and owns
|
|
303
|
+
the OpenClaw Gateway; `OPENCLAW_ATTACH_EXISTING=true` attaches the bridge to an
|
|
304
|
+
already-running Gateway instead. This lifecycle choice belongs to the OpenClaw
|
|
305
|
+
adapter and is not a cross-backend operating mode.
|
|
305
306
|
|
|
306
307
|
Desktop, TUI and WebUI are replaceable Gateway clients. They must never spawn,
|
|
307
308
|
restart or stop the Gateway or a backend. Closing a UI therefore cannot affect
|