qwen-audio-agent 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/README_EN.md +15 -2
- package/cli/package.json +1 -1
- package/cli/src/arguments.mjs +11 -25
- package/cli/src/launcher.mjs +5 -1
- package/cli/src/runtime.mjs +30 -23
- package/docs/architecture.md +5 -4
- package/docs/configuration.md +19 -25
- package/package.json +1 -1
- package/scripts/release-check +3 -2
- package/server/package.json +1 -1
- package/server/src/agent/acp-backend-adapter.mjs +6 -6
- package/server/src/agent/agent-client.mjs +2 -2
- package/server/src/core/config.mjs +16 -15
- 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 +2 -2
- package/server/src/process/backend-drivers/qoder.mjs +2 -2
- 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 +1 -7
- package/shared/runtime-environment.mjs +4 -3
- package/tui/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
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
|
## 我们不是这样和人交流的。
|
|
11
11
|
|
|
@@ -99,6 +99,15 @@ npm install -g qwen-audio-agent@latest
|
|
|
99
99
|
npm install -g git+https://github.com/QwenAudio/qwen-audio-agent.git
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
+
## 获取 DashScope API Key
|
|
103
|
+
|
|
104
|
+
1. 登录阿里云;如果尚未开通,请先按提示开通阿里云百炼。
|
|
105
|
+
2. 打开百炼控制台的 [API Key 页面](https://bailian.console.aliyun.com/?tab=model#/api-key),
|
|
106
|
+
单击**创建 API Key**。
|
|
107
|
+
3. 复制生成的 Key,稍后填入 `config.env`。请勿公开或提交 API Key。
|
|
108
|
+
|
|
109
|
+
详细说明见[百炼官方文档](https://help.aliyun.com/zh/model-studio/get-api-key)。
|
|
110
|
+
|
|
102
111
|
## 快速开始
|
|
103
112
|
|
|
104
113
|
1. 创建配置:
|
package/README_EN.md
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
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
|
## Say it. Don't prompt it.
|
|
11
11
|
|
|
@@ -113,6 +113,19 @@ Upgrade to the latest code from GitHub:
|
|
|
113
113
|
npm install -g git+https://github.com/QwenAudio/qwen-audio-agent.git
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
+
## Get a DashScope API Key
|
|
117
|
+
|
|
118
|
+
1. Sign in to Alibaba Cloud. If Model Studio is not yet activated, follow the
|
|
119
|
+
prompt to activate it.
|
|
120
|
+
2. Open the Model Studio
|
|
121
|
+
[API Key page](https://bailian.console.aliyun.com/?tab=model#/api-key),
|
|
122
|
+
then click **Create API Key**.
|
|
123
|
+
3. Copy the generated Key and add it to `config.env` later. Never publish or
|
|
124
|
+
commit your API Key.
|
|
125
|
+
|
|
126
|
+
See the [official API Key guide](https://help.aliyun.com/en/model-studio/get-api-key)
|
|
127
|
+
for details.
|
|
128
|
+
|
|
116
129
|
## Quick Start
|
|
117
130
|
|
|
118
131
|
1. Create your configuration:
|
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
|
|
@@ -226,10 +212,10 @@ export function helpText() {
|
|
|
226
212
|
'Gateway 选项:',
|
|
227
213
|
' --url URL Gateway 地址(默认 http://127.0.0.1:3101)',
|
|
228
214
|
' --backend NAME 必填:openclaw、opencode、qoder、hermes、codebuddy、codex 或 acp(也可在 config.env 设置 AGENT_PROTOCOL)',
|
|
229
|
-
' --
|
|
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
|
|
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
|
package/docs/configuration.md
CHANGED
|
@@ -30,7 +30,7 @@ DASHSCOPE_API_KEY=your-key
|
|
|
30
30
|
AGENT_PROTOCOL=openclaw
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Gateway 启动的后台 Agent 默认使用 `qwen3.7-max`。需要修改时只写一个公共配置:
|
|
34
34
|
|
|
35
35
|
```dotenv
|
|
36
36
|
QWEN_AUDIO_AGENT_BACKEND_MODEL=qwen3.7-max
|
|
@@ -81,12 +81,11 @@ OPENCLAW_BASE_URL=http://127.0.0.1:18789
|
|
|
81
81
|
OPENCLAW_GATEWAY_TOKEN=
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
OpenCode:Gateway 通过 `opencode acp`
|
|
85
|
-
|
|
84
|
+
OpenCode:Gateway 通过 `opencode acp` 与它交互,并管理用于打开原生 Session
|
|
85
|
+
界面的本地服务,用户不需要另行启动:
|
|
86
86
|
|
|
87
87
|
```dotenv
|
|
88
88
|
AGENT_PROTOCOL=opencode
|
|
89
|
-
QWEN_AUDIO_AGENT_BACKEND_MODE=managed
|
|
90
89
|
QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE=native
|
|
91
90
|
```
|
|
92
91
|
|
|
@@ -94,7 +93,6 @@ Qoder 使用本机 `qodercli --acp`,没有 HTTP 后台地址:
|
|
|
94
93
|
|
|
95
94
|
```dotenv
|
|
96
95
|
AGENT_PROTOCOL=qoder
|
|
97
|
-
QWEN_AUDIO_AGENT_BACKEND_MODE=managed
|
|
98
96
|
QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE=native
|
|
99
97
|
QODER_MODEL=auto
|
|
100
98
|
```
|
|
@@ -112,8 +110,7 @@ QODERCLI_PATH=
|
|
|
112
110
|
QODER_CONFIG_DIR=
|
|
113
111
|
```
|
|
114
112
|
|
|
115
|
-
Gateway 管理 Qoder ACP
|
|
116
|
-
`compatible`,也不接受 `--backend-url`。
|
|
113
|
+
Gateway 管理 Qoder ACP 子进程;Qoder 不接受 `--backend-url`。
|
|
117
114
|
|
|
118
115
|
其他支持 ACP stdio 的 Agent 可使用通用入口:
|
|
119
116
|
|
|
@@ -126,7 +123,7 @@ ACP_MODEL=auto
|
|
|
126
123
|
ACP_WORKSPACE=
|
|
127
124
|
```
|
|
128
125
|
|
|
129
|
-
通用入口由 Gateway 直接管理 ACP
|
|
126
|
+
通用入口由 Gateway 直接管理 ACP 子进程。`ACP_ARGS` 推荐写成
|
|
130
127
|
JSON 字符串数组,以便参数中包含空格时仍能准确解析。它使用标准 ACP Session 和
|
|
131
128
|
Gateway 提供的 Session MCP 工具,不假设某个 Agent 私有的启动、权限或 UI 能力。
|
|
132
129
|
|
|
@@ -137,7 +134,6 @@ Hermes Agent([nousresearch/hermes-agent](https://github.com/nousresearch/herme
|
|
|
137
134
|
|
|
138
135
|
```dotenv
|
|
139
136
|
AGENT_PROTOCOL=hermes
|
|
140
|
-
QWEN_AUDIO_AGENT_BACKEND_MODE=managed
|
|
141
137
|
QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE=native
|
|
142
138
|
```
|
|
143
139
|
|
|
@@ -162,7 +158,6 @@ CodeBuddy Code(腾讯 `@tencent-ai/codebuddy-code`)使用
|
|
|
162
158
|
|
|
163
159
|
```dotenv
|
|
164
160
|
AGENT_PROTOCOL=codebuddy
|
|
165
|
-
QWEN_AUDIO_AGENT_BACKEND_MODE=managed
|
|
166
161
|
QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE=native
|
|
167
162
|
```
|
|
168
163
|
|
|
@@ -189,7 +184,6 @@ Codex([openai/codex](https://github.com/openai/codex))通过 ACP 项目维
|
|
|
189
184
|
|
|
190
185
|
```dotenv
|
|
191
186
|
AGENT_PROTOCOL=codex
|
|
192
|
-
QWEN_AUDIO_AGENT_BACKEND_MODE=managed
|
|
193
187
|
QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE=native
|
|
194
188
|
```
|
|
195
189
|
|
|
@@ -204,8 +198,8 @@ CODEX_MODEL=qwen3.7-max
|
|
|
204
198
|
CODEX_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
|
|
205
199
|
```
|
|
206
200
|
|
|
207
|
-
Hermes、CodeBuddy 和 Codex 均由 Gateway 直接管理 ACP
|
|
208
|
-
|
|
201
|
+
Hermes、CodeBuddy 和 Codex 均由 Gateway 直接管理 ACP 子进程,不接受
|
|
202
|
+
`--backend-url`。
|
|
209
203
|
|
|
210
204
|
## 后台权限模式
|
|
211
205
|
|
|
@@ -214,30 +208,29 @@ Hermes、CodeBuddy 和 Codex 均由 Gateway 直接管理 ACP 子进程,只支
|
|
|
214
208
|
- `native`(默认):权限由后台 Agent 自己判断和询问,Gateway 只负责原样转发。
|
|
215
209
|
- `full`:启动时明确授予最高权限,后台可直接执行命令、读写文件,不再逐次确认。
|
|
216
210
|
|
|
217
|
-
`full` 当前支持
|
|
211
|
+
`full` 当前支持 OpenCode、Qoder、Hermes、CodeBuddy 和
|
|
218
212
|
Codex。Gateway 会自动批准这些 ACP 后台发起的权限请求;此外 Qoder 和 CodeBuddy
|
|
219
213
|
CLI 会使用 `--dangerously-skip-permissions`,OpenCode 会在受管进程的内联配置中为
|
|
220
214
|
协调 Agent 和任务 Agent 设置 `permission: "allow"`,Codex 会使用
|
|
221
|
-
`agent-full-access`
|
|
215
|
+
`agent-full-access` 模式。
|
|
222
216
|
|
|
223
217
|
OpenClaw 的执行授权同时受 exec approvals、elevated 和执行 host 等配置约束,
|
|
224
218
|
无法由一个统一开关安全、完整地表达;选择 `full` 时 Gateway 会明确拒绝启动,
|
|
225
219
|
需要按 OpenClaw 自身方式单独配置。最高权限会放大误操作风险,只应在可信项目和
|
|
226
220
|
可信提示词环境中启用。
|
|
227
221
|
|
|
228
|
-
连接用户现有的 OpenClaw Gateway
|
|
229
|
-
|
|
230
|
-
OpenCode 原生配置和 Session 存储;兼容模式中的现有服务只用于原生界面:
|
|
222
|
+
连接用户现有的 OpenClaw Gateway 时开启 `OPENCLAW_ATTACH_EXISTING`。
|
|
223
|
+
qwen-audio-agent 不会修改或重启该 Gateway,而是通过 `openclaw acp` 桥接:
|
|
231
224
|
|
|
232
225
|
```dotenv
|
|
233
|
-
|
|
226
|
+
OPENCLAW_ATTACH_EXISTING=true
|
|
234
227
|
# 可选;省略时自动发现默认 Agent
|
|
235
228
|
QWEN_AUDIO_AGENT_BACKEND_AGENT=
|
|
236
229
|
```
|
|
237
230
|
|
|
238
231
|
```bash
|
|
239
232
|
qwenaudio gateway --backend openclaw \
|
|
240
|
-
--
|
|
233
|
+
--attach-openclaw \
|
|
241
234
|
--backend-url http://127.0.0.1:18789
|
|
242
235
|
```
|
|
243
236
|
|
|
@@ -274,11 +267,11 @@ QWEN_AUDIO_AGENT_ALLOWED_ORIGINS=https://voice.example.com
|
|
|
274
267
|
|
|
275
268
|
## Gateway 运行方式
|
|
276
269
|
|
|
277
|
-
Gateway
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
270
|
+
Gateway 默认启动并管理所选 Agent 的 ACP 进程。若 OpenCode 或 OpenClaw 的本地
|
|
271
|
+
服务端口已被其他进程占用,会选择空闲端口,不会接管或关闭用户进程。只有明确设置
|
|
272
|
+
`OPENCLAW_ATTACH_EXISTING=true`(或 CLI 使用 `--attach-openclaw`)时,OpenClaw
|
|
273
|
+
Adapter 才会连接现有 Gateway;该地址不可用时会直接报错。OpenCode 的 ACP 进程
|
|
274
|
+
始终复用其原生配置和 Session 存储,原生界面不可用不影响 ACP 任务执行。
|
|
282
275
|
|
|
283
276
|
`qwenaudio`、`qwenaudio gateway` 和 `qwenaudio gateway run` 都在前台运行。
|
|
284
277
|
需要后台常驻时使用:
|
|
@@ -357,6 +350,7 @@ QWEN_AUDIO_AGENT_OPENCODE_ISOLATE_USER_CONFIG=true
|
|
|
357
350
|
| `QODER_WORKSPACE` | 用户配置目录下的 `workspaces/qoder` |
|
|
358
351
|
| `QWEN_AUDIO_AGENT_BACKEND_MODEL` | `qwen3.7-max` |
|
|
359
352
|
| `OPENCODE_MODEL` / `OPENCLAW_MODEL` | 由对应 Adapter 从公共模型推导 |
|
|
353
|
+
| `OPENCLAW_ATTACH_EXISTING` | `false`;由 Adapter 启动 OpenClaw Gateway |
|
|
360
354
|
| `QODER_MODEL` | `auto` |
|
|
361
355
|
| `QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE` | `native` |
|
|
362
356
|
| `QWEN_AUDIO_REALTIME_MODEL` | `qwen-audio-3.0-realtime-plus` |
|
package/package.json
CHANGED
package/scripts/release-check
CHANGED
|
@@ -29,10 +29,11 @@ for (const file of manifests) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
for (const file of ['README.md', 'README_EN.md']) {
|
|
32
|
+
const npmBadge = `img.shields.io/npm/v/${rootManifest.name}`
|
|
32
33
|
if (!readFileSync(file, 'utf8').includes(
|
|
33
|
-
|
|
34
|
+
npmBadge,
|
|
34
35
|
)) {
|
|
35
|
-
throw new Error(`${file}
|
|
36
|
+
throw new Error(`${file} does not use the dynamic npm package badge`)
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
|
package/server/package.json
CHANGED
|
@@ -48,7 +48,7 @@ export class AcpBackendAdapter {
|
|
|
48
48
|
constructor({
|
|
49
49
|
protocol = 'opencode',
|
|
50
50
|
root = process.cwd(),
|
|
51
|
-
|
|
51
|
+
ownership = 'owned',
|
|
52
52
|
permissionMode = 'native',
|
|
53
53
|
model = '',
|
|
54
54
|
timeoutMs = 300_000,
|
|
@@ -69,7 +69,7 @@ export class AcpBackendAdapter {
|
|
|
69
69
|
} = {}) {
|
|
70
70
|
this.protocol = protocol
|
|
71
71
|
this.root = root
|
|
72
|
-
this.
|
|
72
|
+
this.ownership = ownership === 'external' ? 'external' : 'owned'
|
|
73
73
|
this.permissionMode = permissionMode === 'full' ? 'full' : 'native'
|
|
74
74
|
this.model = clean(model)
|
|
75
75
|
this.timeoutMs = timeoutMs
|
|
@@ -126,7 +126,7 @@ export class AcpBackendAdapter {
|
|
|
126
126
|
uiPath: null,
|
|
127
127
|
model: this.model || null,
|
|
128
128
|
directory: this.directory,
|
|
129
|
-
|
|
129
|
+
ownership: this.ownership,
|
|
130
130
|
permissionMode: this.permissionMode,
|
|
131
131
|
transport: 'acp',
|
|
132
132
|
backendAgent: this.coordinatorAgent || 'qwen-audio-agent-backend',
|
|
@@ -152,7 +152,7 @@ export class AcpBackendAdapter {
|
|
|
152
152
|
return {
|
|
153
153
|
ok: false,
|
|
154
154
|
protocol: this.protocol,
|
|
155
|
-
|
|
155
|
+
ownership: this.ownership,
|
|
156
156
|
transport: 'acp',
|
|
157
157
|
error: this.profile.readinessMessage,
|
|
158
158
|
}
|
|
@@ -161,7 +161,7 @@ export class AcpBackendAdapter {
|
|
|
161
161
|
return {
|
|
162
162
|
ok: true,
|
|
163
163
|
protocol: this.protocol,
|
|
164
|
-
|
|
164
|
+
ownership: this.ownership,
|
|
165
165
|
transport: 'acp',
|
|
166
166
|
agentInfo: initialized.agentInfo || null,
|
|
167
167
|
capabilities: initialized.agentCapabilities || {},
|
|
@@ -170,7 +170,7 @@ export class AcpBackendAdapter {
|
|
|
170
170
|
return {
|
|
171
171
|
ok: false,
|
|
172
172
|
protocol: this.protocol,
|
|
173
|
-
|
|
173
|
+
ownership: this.ownership,
|
|
174
174
|
transport: 'acp',
|
|
175
175
|
error: `${error.message}${
|
|
176
176
|
clean(this.client.stderr) ? `:${clean(this.client.stderr)}` : ''
|
|
@@ -8,7 +8,7 @@ export { AgentError }
|
|
|
8
8
|
export class AgentClient {
|
|
9
9
|
constructor({
|
|
10
10
|
protocol = config.agentProtocol,
|
|
11
|
-
|
|
11
|
+
ownership = config.backendOwnership,
|
|
12
12
|
permissionMode = config.backendPermissionMode,
|
|
13
13
|
baseUrl = config.openCodeBaseUrl,
|
|
14
14
|
model,
|
|
@@ -88,7 +88,7 @@ export class AgentClient {
|
|
|
88
88
|
this.adapter = new AcpBackendAdapter({
|
|
89
89
|
protocol,
|
|
90
90
|
root: config.root,
|
|
91
|
-
|
|
91
|
+
ownership,
|
|
92
92
|
permissionMode,
|
|
93
93
|
timeoutMs,
|
|
94
94
|
...options,
|
|
@@ -125,12 +125,15 @@ export function resolveBackendModels(env = process.env) {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
128
|
+
const configuredAgentProtocol = String(
|
|
129
|
+
process.env.AGENT_PROTOCOL || '',
|
|
130
|
+
).toLowerCase()
|
|
131
|
+
const backendOwnership = (
|
|
132
|
+
configuredAgentProtocol === 'openclaw'
|
|
133
|
+
&& String(
|
|
134
|
+
process.env.OPENCLAW_ATTACH_EXISTING || '',
|
|
135
|
+
).toLowerCase() === 'true'
|
|
136
|
+
) ? 'external' : 'owned'
|
|
134
137
|
const backendModels = resolveBackendModels()
|
|
135
138
|
const backendPermissionMode = String(
|
|
136
139
|
process.env.QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE || 'native',
|
|
@@ -140,9 +143,7 @@ if (!['native', 'full'].includes(backendPermissionMode)) {
|
|
|
140
143
|
`不支持的后台权限模式:${backendPermissionMode}(可选 native、full)`,
|
|
141
144
|
)
|
|
142
145
|
}
|
|
143
|
-
const requestedAgentProtocol =
|
|
144
|
-
process.env.AGENT_PROTOCOL || '',
|
|
145
|
-
).toLowerCase()
|
|
146
|
+
const requestedAgentProtocol = configuredAgentProtocol
|
|
146
147
|
if (requestedAgentProtocol && !backendDefinition(requestedAgentProtocol)) {
|
|
147
148
|
throw new Error(
|
|
148
149
|
`不支持的后台 Agent:${requestedAgentProtocol}`
|
|
@@ -190,7 +191,7 @@ export const config = {
|
|
|
190
191
|
).toLowerCase() === 'browser' ? 'browser' : 'personal',
|
|
191
192
|
personalOwnerId: process.env.QWEN_AUDIO_AGENT_PERSONAL_OWNER_ID || 'user_personal',
|
|
192
193
|
agentProtocol: requestedAgentProtocol,
|
|
193
|
-
|
|
194
|
+
backendOwnership,
|
|
194
195
|
backendPermissionMode,
|
|
195
196
|
agentTimeoutMs: numberSetting(process.env.AGENT_TIMEOUT_MS, 300000, { min: 10000 }),
|
|
196
197
|
openClawBaseUrl: (
|
|
@@ -214,7 +215,7 @@ export const config = {
|
|
|
214
215
|
process.env.OPENCLAW_COORDINATOR_AGENT,
|
|
215
216
|
'voice-coordinator',
|
|
216
217
|
)
|
|
217
|
-
|| (
|
|
218
|
+
|| (backendOwnership === 'owned' ? 'qwen-audio-agent-backend' : '')
|
|
218
219
|
),
|
|
219
220
|
openCodeBaseUrl: (
|
|
220
221
|
process.env.OPENCODE_BASE_URL
|
|
@@ -265,20 +266,20 @@ export const config = {
|
|
|
265
266
|
acpCoordinatorAgent: String(process.env.ACP_COORDINATOR_AGENT || '').trim(),
|
|
266
267
|
openCodeModel: (
|
|
267
268
|
process.env.OPENCODE_MODEL
|
|
268
|
-
|| (
|
|
269
|
+
|| (backendOwnership === 'owned' ? backendModels.openCode : '')
|
|
269
270
|
),
|
|
270
271
|
openClawModel: (
|
|
271
272
|
process.env.OPENCLAW_MODEL
|
|
272
|
-
|| (
|
|
273
|
+
|| (backendOwnership === 'owned' ? backendModels.openClaw : '')
|
|
273
274
|
),
|
|
274
|
-
backendModel:
|
|
275
|
+
backendModel: backendOwnership === 'owned' ? backendModels.common : '',
|
|
275
276
|
openCodeCoordinatorAgent: (
|
|
276
277
|
sharedBackendAgent
|
|
277
278
|
|| legacyBackendAgent(
|
|
278
279
|
process.env.OPENCODE_COORDINATOR_AGENT,
|
|
279
280
|
'qwen-audio-agent-coordinator',
|
|
280
281
|
)
|
|
281
|
-
|| (
|
|
282
|
+
|| (backendOwnership === 'owned' ? 'qwen-audio-agent-backend' : '')
|
|
282
283
|
),
|
|
283
284
|
announceIntoContext: (
|
|
284
285
|
String(process.env.QWEN_AUDIO_AGENT_ANNOUNCE_INTO_CONTEXT || 'true').toLowerCase()
|
|
@@ -4,10 +4,10 @@ export const codeBuddyRuntimeDriver = {
|
|
|
4
4
|
id: 'codebuddy',
|
|
5
5
|
separateManagedProcess: false,
|
|
6
6
|
|
|
7
|
-
resolve({
|
|
7
|
+
resolve({ ownership, permissionMode }) {
|
|
8
8
|
return managedOnlyBackend({
|
|
9
9
|
id: this.id,
|
|
10
|
-
|
|
10
|
+
ownership,
|
|
11
11
|
permissionMode,
|
|
12
12
|
label: 'CodeBuddy',
|
|
13
13
|
})
|
|
@@ -4,10 +4,10 @@ export const codexRuntimeDriver = {
|
|
|
4
4
|
id: 'codex',
|
|
5
5
|
separateManagedProcess: false,
|
|
6
6
|
|
|
7
|
-
resolve({
|
|
7
|
+
resolve({ ownership, permissionMode }) {
|
|
8
8
|
return managedOnlyBackend({
|
|
9
9
|
id: this.id,
|
|
10
|
-
|
|
10
|
+
ownership,
|
|
11
11
|
permissionMode,
|
|
12
12
|
label: 'Codex',
|
|
13
13
|
})
|
|
@@ -4,13 +4,13 @@ export const genericAcpRuntimeDriver = {
|
|
|
4
4
|
id: 'acp',
|
|
5
5
|
separateManagedProcess: false,
|
|
6
6
|
|
|
7
|
-
resolve({
|
|
7
|
+
resolve({ ownership, permissionMode }) {
|
|
8
8
|
if (permissionMode === 'full') {
|
|
9
9
|
throw new Error('通用 ACP 后端无法安全地统一开启最高权限模式')
|
|
10
10
|
}
|
|
11
11
|
return managedOnlyBackend({
|
|
12
12
|
id: this.id,
|
|
13
|
-
|
|
13
|
+
ownership,
|
|
14
14
|
permissionMode,
|
|
15
15
|
label: 'ACP Agent',
|
|
16
16
|
})
|
|
@@ -4,10 +4,10 @@ export const hermesRuntimeDriver = {
|
|
|
4
4
|
id: 'hermes',
|
|
5
5
|
separateManagedProcess: false,
|
|
6
6
|
|
|
7
|
-
resolve({
|
|
7
|
+
resolve({ ownership, permissionMode }) {
|
|
8
8
|
return managedOnlyBackend({
|
|
9
9
|
id: this.id,
|
|
10
|
-
|
|
10
|
+
ownership,
|
|
11
11
|
permissionMode,
|
|
12
12
|
label: 'Hermes',
|
|
13
13
|
})
|
|
@@ -9,7 +9,7 @@ export const openClawRuntimeDriver = {
|
|
|
9
9
|
managedScript: 'openclaw-gateway',
|
|
10
10
|
managedNpmScript: 'openclaw',
|
|
11
11
|
|
|
12
|
-
resolve({ env,
|
|
12
|
+
resolve({ env, ownership, permissionMode }) {
|
|
13
13
|
if (permissionMode === 'full') {
|
|
14
14
|
throw new Error(
|
|
15
15
|
'OpenClaw 的最高权限需要单独配置 exec approvals、elevated 和 host,'
|
|
@@ -19,7 +19,7 @@ export const openClawRuntimeDriver = {
|
|
|
19
19
|
return localManagedBackend({
|
|
20
20
|
id: this.id,
|
|
21
21
|
env,
|
|
22
|
-
|
|
22
|
+
ownership,
|
|
23
23
|
permissionMode,
|
|
24
24
|
baseUrlEnvironment: 'OPENCLAW_BASE_URL',
|
|
25
25
|
defaultBaseUrl: 'http://127.0.0.1:18789',
|
|
@@ -23,11 +23,11 @@ export const openCodeRuntimeDriver = {
|
|
|
23
23
|
managedScript: 'opencode-server',
|
|
24
24
|
managedNpmScript: 'opencode',
|
|
25
25
|
|
|
26
|
-
resolve({ env,
|
|
26
|
+
resolve({ env, ownership, permissionMode }) {
|
|
27
27
|
return localManagedBackend({
|
|
28
28
|
id: this.id,
|
|
29
29
|
env,
|
|
30
|
-
|
|
30
|
+
ownership,
|
|
31
31
|
permissionMode,
|
|
32
32
|
baseUrlEnvironment: 'OPENCODE_BASE_URL',
|
|
33
33
|
defaultBaseUrl: 'http://127.0.0.1:4096',
|
|
@@ -4,10 +4,10 @@ export const qoderRuntimeDriver = {
|
|
|
4
4
|
id: 'qoder',
|
|
5
5
|
separateManagedProcess: false,
|
|
6
6
|
|
|
7
|
-
resolve({
|
|
7
|
+
resolve({ ownership, permissionMode }) {
|
|
8
8
|
return managedOnlyBackend({
|
|
9
9
|
id: this.id,
|
|
10
|
-
|
|
10
|
+
ownership,
|
|
11
11
|
permissionMode,
|
|
12
12
|
label: 'Qoder',
|
|
13
13
|
})
|
|
@@ -5,14 +5,14 @@ export function origin(value) {
|
|
|
5
5
|
export function localManagedBackend({
|
|
6
6
|
id,
|
|
7
7
|
env,
|
|
8
|
-
|
|
8
|
+
ownership,
|
|
9
9
|
permissionMode,
|
|
10
10
|
baseUrlEnvironment,
|
|
11
11
|
defaultBaseUrl,
|
|
12
12
|
}) {
|
|
13
13
|
return {
|
|
14
14
|
protocol: id,
|
|
15
|
-
|
|
15
|
+
ownership,
|
|
16
16
|
permissionMode,
|
|
17
17
|
baseUrl: origin(env[baseUrlEnvironment] || defaultBaseUrl),
|
|
18
18
|
}
|
|
@@ -20,16 +20,16 @@ export function localManagedBackend({
|
|
|
20
20
|
|
|
21
21
|
export function managedOnlyBackend({
|
|
22
22
|
id,
|
|
23
|
-
|
|
23
|
+
ownership,
|
|
24
24
|
permissionMode,
|
|
25
25
|
label,
|
|
26
26
|
}) {
|
|
27
|
-
if (
|
|
28
|
-
throw new Error(`${label}
|
|
27
|
+
if (ownership !== 'owned') {
|
|
28
|
+
throw new Error(`${label} 后台必须由 Gateway 启动`)
|
|
29
29
|
}
|
|
30
30
|
return {
|
|
31
31
|
protocol: id,
|
|
32
|
-
|
|
32
|
+
ownership,
|
|
33
33
|
permissionMode,
|
|
34
34
|
baseUrl: null,
|
|
35
35
|
}
|
|
@@ -23,27 +23,32 @@ export function resolveManagedBackend(env = process.env) {
|
|
|
23
23
|
)
|
|
24
24
|
}
|
|
25
25
|
const driver = backendRuntimeDriver(protocol)
|
|
26
|
-
const mode = String(
|
|
27
|
-
env.QWEN_AUDIO_AGENT_BACKEND_MODE || 'managed',
|
|
28
|
-
).toLowerCase()
|
|
29
26
|
const resolvedPermissionMode = permissionMode(env)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
const attachOpenClaw = (
|
|
28
|
+
protocol === 'openclaw'
|
|
29
|
+
&& String(env.OPENCLAW_ATTACH_EXISTING || '').toLowerCase() === 'true'
|
|
30
|
+
)
|
|
31
|
+
if (
|
|
32
|
+
String(env.OPENCLAW_ATTACH_EXISTING || '').toLowerCase() === 'true'
|
|
33
|
+
&& protocol !== 'openclaw'
|
|
34
|
+
) {
|
|
35
|
+
throw new Error('OPENCLAW_ATTACH_EXISTING 只适用于 OpenClaw')
|
|
36
|
+
}
|
|
37
|
+
const ownership = attachOpenClaw ? 'external' : 'owned'
|
|
38
|
+
if (resolvedPermissionMode === 'full' && ownership !== 'owned') {
|
|
39
|
+
throw new Error('最高权限模式只支持由 Gateway 启动的后台 Agent')
|
|
35
40
|
}
|
|
36
41
|
return driver.resolve({
|
|
37
42
|
env,
|
|
38
|
-
|
|
43
|
+
ownership,
|
|
39
44
|
permissionMode: resolvedPermissionMode,
|
|
40
45
|
})
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
export function applyBackendPermissionMode(env, backend) {
|
|
44
49
|
if (backend.permissionMode !== 'full') return env
|
|
45
|
-
if (backend.
|
|
46
|
-
throw new Error('最高权限模式只支持由 Gateway
|
|
50
|
+
if (backend.ownership !== 'owned') {
|
|
51
|
+
throw new Error('最高权限模式只支持由 Gateway 启动的后台 Agent')
|
|
47
52
|
}
|
|
48
53
|
return backendRuntimeDriver(backend.protocol)
|
|
49
54
|
.applyPermissionMode?.(env, backend)
|
|
@@ -166,14 +171,14 @@ export async function startManagedBackend({
|
|
|
166
171
|
if (!driver.separateManagedProcess) {
|
|
167
172
|
return new ManagedBackendRuntime(null, { platform })
|
|
168
173
|
}
|
|
169
|
-
if (backend.
|
|
174
|
+
if (backend.ownership === 'external') {
|
|
170
175
|
return new ManagedBackendRuntime(null, { platform })
|
|
171
176
|
}
|
|
172
|
-
if (backend.
|
|
173
|
-
throw new Error(
|
|
177
|
+
if (backend.ownership !== 'owned') {
|
|
178
|
+
throw new Error(`不支持的后台进程归属:${backend.ownership}`)
|
|
174
179
|
}
|
|
175
180
|
if (!isLocalBackend(backend.baseUrl)) {
|
|
176
|
-
throw new Error(
|
|
181
|
+
throw new Error(`Gateway 只能启动本机后台 Agent:${backend.baseUrl}`)
|
|
177
182
|
}
|
|
178
183
|
if (await isAddressInUse(backend.baseUrl)) {
|
|
179
184
|
backend.baseUrl = await findFreeAddress(backend.baseUrl)
|
|
@@ -312,8 +312,8 @@ export class AnnouncementManager {
|
|
|
312
312
|
if (outcome?.contextInjected) batch.contextInjected = true
|
|
313
313
|
if (outcome?.completed) {
|
|
314
314
|
// Realtime has generated the response, but the client may still have it
|
|
315
|
-
// queued behind earlier audio. Delivery is confirmed only
|
|
316
|
-
// client
|
|
315
|
+
// queued behind earlier audio. Delivery is confirmed only when the
|
|
316
|
+
// client reports that playback has actually started.
|
|
317
317
|
batch.responseCompleted = true
|
|
318
318
|
this.scheduleAcknowledgementTimeout()
|
|
319
319
|
} else if (this.activeBatch) {
|
|
@@ -53,6 +53,16 @@ export function rejectUnsupportedRealtimeUpgrade(socket, pathname) {
|
|
|
53
53
|
return true
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
export function confirmsTaskNotificationOnPlaybackStart(context) {
|
|
57
|
+
return Boolean(
|
|
58
|
+
context
|
|
59
|
+
&& (
|
|
60
|
+
context.origin === 'announcement'
|
|
61
|
+
|| context.consumesTaskNotification
|
|
62
|
+
),
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
56
66
|
function clientDescriptor(event = {}) {
|
|
57
67
|
const type = ['desktop', 'cli', 'web'].includes(event.clientType)
|
|
58
68
|
? event.clientType
|
|
@@ -496,6 +506,9 @@ export function attachRealtimeGateway(server, {
|
|
|
496
506
|
})
|
|
497
507
|
if (!context || context.playbackStarted) return
|
|
498
508
|
context.playbackStarted = true
|
|
509
|
+
if (confirmsTaskNotificationOnPlaybackStart(context)) {
|
|
510
|
+
announcements.confirmMany(contextTaskIds(context))
|
|
511
|
+
}
|
|
499
512
|
flushPendingTranscripts(id, context)
|
|
500
513
|
}
|
|
501
514
|
|
|
@@ -552,12 +565,6 @@ export function attachRealtimeGateway(server, {
|
|
|
552
565
|
playbackTurns.delete(id)
|
|
553
566
|
if (context) {
|
|
554
567
|
context.playbackEnded = true
|
|
555
|
-
if (
|
|
556
|
-
context.origin === 'announcement'
|
|
557
|
-
|| context.consumesTaskNotification
|
|
558
|
-
) {
|
|
559
|
-
announcements.confirmMany(contextTaskIds(context))
|
|
560
|
-
}
|
|
561
568
|
finishResponseContextIfComplete(id, context)
|
|
562
569
|
if (responseContexts.get(id) === context) {
|
|
563
570
|
scheduleResponseContextCleanup(id, context)
|
|
@@ -4,7 +4,6 @@ const definitions = new Map([
|
|
|
4
4
|
label: 'OpenCode',
|
|
5
5
|
baseUrlEnvironment: 'OPENCODE_BASE_URL',
|
|
6
6
|
defaultBaseUrl: 'http://127.0.0.1:4096',
|
|
7
|
-
supportsCompatible: true,
|
|
8
7
|
supportsFullPermission: true,
|
|
9
8
|
}],
|
|
10
9
|
['openclaw', {
|
|
@@ -12,37 +11,32 @@ const definitions = new Map([
|
|
|
12
11
|
label: 'OpenClaw',
|
|
13
12
|
baseUrlEnvironment: 'OPENCLAW_BASE_URL',
|
|
14
13
|
defaultBaseUrl: 'http://127.0.0.1:18789',
|
|
15
|
-
|
|
14
|
+
supportsExternalGateway: true,
|
|
16
15
|
supportsFullPermission: false,
|
|
17
16
|
}],
|
|
18
17
|
['qoder', {
|
|
19
18
|
id: 'qoder',
|
|
20
19
|
label: 'Qoder',
|
|
21
|
-
supportsCompatible: false,
|
|
22
20
|
supportsFullPermission: true,
|
|
23
21
|
}],
|
|
24
22
|
['hermes', {
|
|
25
23
|
id: 'hermes',
|
|
26
24
|
label: 'Hermes',
|
|
27
|
-
supportsCompatible: false,
|
|
28
25
|
supportsFullPermission: true,
|
|
29
26
|
}],
|
|
30
27
|
['codebuddy', {
|
|
31
28
|
id: 'codebuddy',
|
|
32
29
|
label: 'CodeBuddy',
|
|
33
|
-
supportsCompatible: false,
|
|
34
30
|
supportsFullPermission: true,
|
|
35
31
|
}],
|
|
36
32
|
['codex', {
|
|
37
33
|
id: 'codex',
|
|
38
34
|
label: 'Codex',
|
|
39
|
-
supportsCompatible: false,
|
|
40
35
|
supportsFullPermission: true,
|
|
41
36
|
}],
|
|
42
37
|
['acp', {
|
|
43
38
|
id: 'acp',
|
|
44
39
|
label: 'ACP Agent',
|
|
45
|
-
supportsCompatible: false,
|
|
46
40
|
supportsFullPermission: false,
|
|
47
41
|
}],
|
|
48
42
|
])
|
|
@@ -22,11 +22,12 @@ const USER_CONFIG_TEMPLATE = [
|
|
|
22
22
|
'',
|
|
23
23
|
'# 必填:选择后台 Agent(openclaw、opencode、qoder、hermes、codebuddy、codex 或 acp)',
|
|
24
24
|
'AGENT_PROTOCOL=',
|
|
25
|
-
'#
|
|
26
|
-
'#
|
|
25
|
+
'# OpenClaw 可选:连接用户已经启动的 Gateway',
|
|
26
|
+
'# OPENCLAW_ATTACH_EXISTING=true',
|
|
27
|
+
'# 权限模式:native(后台自行询问)或 full(最高权限;仅支持安全映射的后端)',
|
|
27
28
|
'# QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE=native',
|
|
28
29
|
'# QWEN_AUDIO_AGENT_BACKEND_MODEL=qwen3.7-max',
|
|
29
|
-
'#
|
|
30
|
+
'# 可选:QWEN_AUDIO_AGENT_BACKEND_AGENT=协调 Agent ID',
|
|
30
31
|
'# 通用 ACP:ACP_COMMAND=your-agent,ACP_ARGS=["--acp"]',
|
|
31
32
|
'',
|
|
32
33
|
].join('\n')
|