qwen-audio-agent 0.9.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.
Files changed (122) hide show
  1. package/CONTRIBUTING.md +58 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +5 -0
  4. package/PRIVACY.md +34 -0
  5. package/README.md +282 -0
  6. package/README_EN.md +316 -0
  7. package/SECURITY.md +32 -0
  8. package/THIRD_PARTY_NOTICES.md +26 -0
  9. package/cli/bin/qwenaudio.mjs +10 -0
  10. package/cli/package.json +13 -0
  11. package/cli/src/arguments.mjs +247 -0
  12. package/cli/src/gateway-service.mjs +386 -0
  13. package/cli/src/instance-lock.mjs +65 -0
  14. package/cli/src/launcher.mjs +217 -0
  15. package/cli/src/runtime.mjs +356 -0
  16. package/cli/src/webui.mjs +61 -0
  17. package/config/acp/workspace/AGENTS.md +13 -0
  18. package/config/codebuddy/workspace/.codebuddy/models.json +19 -0
  19. package/config/codebuddy/workspace/AGENTS.md +13 -0
  20. package/config/codex/workspace/AGENTS.md +13 -0
  21. package/config/frontend-agent/PROMPT.md +127 -0
  22. package/config/hermes/workspace/AGENTS.md +13 -0
  23. package/config/openclaw/openclaw.json5 +50 -0
  24. package/config/openclaw/workspace/AGENTS.md +9 -0
  25. package/config/opencode/agents/qwen-audio-agent-backend.md +65 -0
  26. package/config/opencode/workspace/AGENTS.md +16 -0
  27. package/config/qoder/workspace/AGENTS.md +16 -0
  28. package/docs/architecture-overview-en.png +0 -0
  29. package/docs/architecture-overview.png +0 -0
  30. package/docs/architecture.md +332 -0
  31. package/docs/configuration.md +386 -0
  32. package/docs/desktop-fluid-orb-thinking.gif +0 -0
  33. package/docs/desktop-goo-orb-thinking.gif +0 -0
  34. package/docs/qwen-audio-agent-three-layer-architecture-en.png +0 -0
  35. package/docs/qwen-audio-agent-three-layer-architecture.png +0 -0
  36. package/package.json +126 -0
  37. package/scripts/audit-dependencies.mjs +109 -0
  38. package/scripts/check-desktop-release-env.mjs +41 -0
  39. package/scripts/codex-acp +58 -0
  40. package/scripts/install-global.mjs +66 -0
  41. package/scripts/openclaw +194 -0
  42. package/scripts/openclaw-gateway +8 -0
  43. package/scripts/opencode-acp +6 -0
  44. package/scripts/opencode-server +179 -0
  45. package/scripts/prepare-build.mjs +38 -0
  46. package/scripts/release-check +182 -0
  47. package/scripts/set-version.mjs +133 -0
  48. package/scripts/start.mjs +43 -0
  49. package/scripts/verify-package.mjs +109 -0
  50. package/server/package.json +18 -0
  51. package/server/src/agent/acp-backend-adapter.mjs +1138 -0
  52. package/server/src/agent/acp-backend-profile.mjs +35 -0
  53. package/server/src/agent/acp-backend-session-utils.mjs +139 -0
  54. package/server/src/agent/acp-process-client.mjs +447 -0
  55. package/server/src/agent/acp-session-registry.mjs +106 -0
  56. package/server/src/agent/acp-session-tools.mjs +257 -0
  57. package/server/src/agent/agent-client.mjs +218 -0
  58. package/server/src/agent/backend-adapter.mjs +15 -0
  59. package/server/src/agent/backend-agent-instructions.mjs +8 -0
  60. package/server/src/agent/backends/codebuddy.mjs +47 -0
  61. package/server/src/agent/backends/codex.mjs +62 -0
  62. package/server/src/agent/backends/generic-acp.mjs +46 -0
  63. package/server/src/agent/backends/hermes.mjs +29 -0
  64. package/server/src/agent/backends/openclaw.mjs +101 -0
  65. package/server/src/agent/backends/opencode.mjs +36 -0
  66. package/server/src/agent/backends/qoder.mjs +47 -0
  67. package/server/src/agent/backends/registry.mjs +32 -0
  68. package/server/src/agent/backends/shared.mjs +46 -0
  69. package/server/src/agent/coordinator.mjs +308 -0
  70. package/server/src/agent/openclaw-adapter.mjs +245 -0
  71. package/server/src/app/bootstrap.mjs +244 -0
  72. package/server/src/conversation/conversation-sync.mjs +183 -0
  73. package/server/src/conversation/frontend-agent-context.mjs +162 -0
  74. package/server/src/conversation/frontend-memory.mjs +328 -0
  75. package/server/src/conversation/profiled-memory-store.mjs +87 -0
  76. package/server/src/conversation/task-result-projector.mjs +18 -0
  77. package/server/src/conversation/user-profile.mjs +234 -0
  78. package/server/src/core/config.mjs +388 -0
  79. package/server/src/core/identity.mjs +93 -0
  80. package/server/src/core/install-paths.mjs +8 -0
  81. package/server/src/core/package-version.mjs +10 -0
  82. package/server/src/core/request-security.mjs +80 -0
  83. package/server/src/index.mjs +67 -0
  84. package/server/src/process/backend-drivers/codebuddy.mjs +15 -0
  85. package/server/src/process/backend-drivers/codex.mjs +15 -0
  86. package/server/src/process/backend-drivers/generic-acp.mjs +18 -0
  87. package/server/src/process/backend-drivers/hermes.mjs +15 -0
  88. package/server/src/process/backend-drivers/openclaw.mjs +35 -0
  89. package/server/src/process/backend-drivers/opencode.mjs +75 -0
  90. package/server/src/process/backend-drivers/qoder.mjs +15 -0
  91. package/server/src/process/backend-drivers/registry.mjs +24 -0
  92. package/server/src/process/backend-drivers/shared.mjs +46 -0
  93. package/server/src/process/managed-backend.mjs +188 -0
  94. package/server/src/task/task-manager.mjs +704 -0
  95. package/server/src/task/task-scheduler.mjs +44 -0
  96. package/server/src/task/task-store.mjs +167 -0
  97. package/server/src/voice/active-voice-clients.mjs +58 -0
  98. package/server/src/voice/announcement/announcement-manager.mjs +402 -0
  99. package/server/src/voice/announcement/announcement-window.mjs +89 -0
  100. package/server/src/voice/input-transcript.mjs +9 -0
  101. package/server/src/voice/realtime-errors.mjs +6 -0
  102. package/server/src/voice/realtime-gateway.mjs +1366 -0
  103. package/server/src/voice/realtime-provider.mjs +771 -0
  104. package/server/src/voice/reconnect-backoff.mjs +30 -0
  105. package/server/src/voice/response-context.mjs +41 -0
  106. package/server/src/voice/session-permission-policy.mjs +56 -0
  107. package/server/src/voice/tools/tool-call-handler.mjs +823 -0
  108. package/server/src/voice/tools/turn-transcripts.mjs +59 -0
  109. package/server/src/voice/turn-correlation.mjs +41 -0
  110. package/shared/backend-catalog.mjs +56 -0
  111. package/shared/gateway-client.mjs +13 -0
  112. package/shared/realtime-events.mjs +55 -0
  113. package/shared/runtime-environment.mjs +422 -0
  114. package/tui/native/macos-voice-io.swift +552 -0
  115. package/tui/native/portaudio-voice-io.py +240 -0
  116. package/tui/package.json +13 -0
  117. package/tui/src/index.mjs +1217 -0
  118. package/tui/src/macos-voice-io.mjs +186 -0
  119. package/tui/src/portaudio-voice-io.mjs +158 -0
  120. package/web/dist/assets/index-BeamDvsE.js +38 -0
  121. package/web/dist/assets/index-BuB0EFih.css +1 -0
  122. package/web/dist/index.html +14 -0
@@ -0,0 +1,356 @@
1
+ import { spawn } from 'node:child_process'
2
+ import { resolve } from 'node:path'
3
+ import {
4
+ backendDefinition,
5
+ backendNames,
6
+ } from '../../shared/backend-catalog.mjs'
7
+ import {
8
+ loadRuntimeEnvironment,
9
+ requireDashScopeCredential,
10
+ } from '../../shared/runtime-environment.mjs'
11
+ import {
12
+ readGatewayHealth,
13
+ } from '../../shared/gateway-client.mjs'
14
+
15
+ export {
16
+ readGatewayHealth,
17
+ } from '../../shared/gateway-client.mjs'
18
+
19
+ const LOOPBACK_HOSTS = new Set(['127.0.0.1', 'localhost', '::1', '[::1]'])
20
+
21
+ export function isLocalGateway(baseUrl) {
22
+ return LOOPBACK_HOSTS.has(new URL(baseUrl).hostname)
23
+ }
24
+
25
+ function normalizedOrigin(value) {
26
+ return new URL(value).origin
27
+ }
28
+
29
+ export function resolveBackend(options = {}, env = process.env) {
30
+ const protocol = String(
31
+ options.backend || env.AGENT_PROTOCOL || '',
32
+ ).toLowerCase()
33
+ if (!protocol) throw new Error(
34
+ '必须指定后台 Agent:在 config.env 设置 AGENT_PROTOCOL,'
35
+ + `或使用 --backend(可选 ${backendNames().join('、')})`,
36
+ )
37
+ const definition = backendDefinition(protocol)
38
+ if (!definition) throw new Error(
39
+ `不支持的后台 Agent:${protocol}(可选 ${backendNames().join('、')})`,
40
+ )
41
+ const mode = String(
42
+ options.backendMode || env.QWEN_AUDIO_AGENT_BACKEND_MODE || 'managed',
43
+ ).toLowerCase()
44
+ if (!['managed', 'compatible'].includes(mode)) {
45
+ throw new Error(`不支持的后台模式:${mode}`)
46
+ }
47
+ if (!definition.supportsCompatible && mode !== 'managed') {
48
+ throw new Error(`${definition.label} 后台当前只支持 managed 模式`)
49
+ }
50
+ const permissionMode = String(
51
+ options.backendPermissionMode
52
+ || env.QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE
53
+ || 'native',
54
+ ).toLowerCase()
55
+ if (!['native', 'full'].includes(permissionMode)) {
56
+ throw new Error(`不支持的后台权限模式:${permissionMode}`)
57
+ }
58
+ if (permissionMode === 'full' && mode !== 'managed') {
59
+ throw new Error('最高权限模式只支持由 Gateway 管理的后台 Agent')
60
+ }
61
+ if (permissionMode === 'full' && !definition.supportsFullPermission) {
62
+ throw new Error(`${definition.label} 不支持 Gateway 统一最高权限模式`)
63
+ }
64
+ const configured = definition.baseUrlEnvironment
65
+ ? env[definition.baseUrlEnvironment] || definition.defaultBaseUrl
66
+ : ''
67
+ return {
68
+ protocol,
69
+ mode,
70
+ permissionMode,
71
+ agentId: String(
72
+ options.backendAgent || env.QWEN_AUDIO_AGENT_BACKEND_AGENT || '',
73
+ ).trim(),
74
+ baseUrl: definition.baseUrlEnvironment
75
+ ? normalizedOrigin(options.backendUrl || configured)
76
+ : null,
77
+ }
78
+ }
79
+
80
+ export function assertGatewayCompatibility(health, backend) {
81
+ const actualProtocol = health?.backend?.kind || health?.backend?.protocol
82
+ const actualBaseUrl = health?.backend?.baseUrl
83
+ const actualMode = health?.backend?.mode
84
+ const actualPermissionMode = health?.backend?.permissionMode || 'native'
85
+ if (
86
+ !actualProtocol
87
+ || !backendDefinition(actualProtocol)
88
+ || (
89
+ backendDefinition(actualProtocol).baseUrlEnvironment
90
+ && !actualBaseUrl
91
+ )
92
+ ) {
93
+ throw new Error('现有 Gateway 未报告完整的后台 Agent 配置,无法安全复用')
94
+ }
95
+ if (
96
+ actualProtocol !== backend.protocol
97
+ || (
98
+ backendDefinition(backend.protocol).baseUrlEnvironment
99
+ && backend.mode !== 'managed'
100
+ && normalizedOrigin(actualBaseUrl) !== backend.baseUrl
101
+ )
102
+ ) {
103
+ throw new Error(
104
+ `现有 Gateway 使用 ${actualProtocol} (${actualBaseUrl}),`
105
+ + `与当前配置 ${backend.protocol} (${backend.baseUrl}) 不一致`,
106
+ )
107
+ }
108
+ if (actualMode && backend.mode && actualMode !== backend.mode) {
109
+ throw new Error(
110
+ `现有 Gateway 使用 ${actualMode} 模式,`
111
+ + `与当前配置 ${backend.mode} 模式不一致`,
112
+ )
113
+ }
114
+ if (actualPermissionMode !== backend.permissionMode) {
115
+ throw new Error(
116
+ `现有 Gateway 使用 ${actualPermissionMode} 权限模式,`
117
+ + `与当前配置 ${backend.permissionMode} 权限模式不一致`,
118
+ )
119
+ }
120
+ }
121
+
122
+ export async function waitForGateway(baseUrl, {
123
+ fetchImpl = fetch,
124
+ requireBackend = false,
125
+ timeoutMs = 45000,
126
+ intervalMs = 200,
127
+ } = {}) {
128
+ const deadline = Date.now() + timeoutMs
129
+ let lastHealth = null
130
+ while (Date.now() < deadline) {
131
+ const health = await readGatewayHealth(baseUrl, fetchImpl)
132
+ if (health) lastHealth = health
133
+ if (health && (!requireBackend || health.backend?.ok === true)) {
134
+ return health
135
+ }
136
+ await new Promise(resolve => setTimeout(resolve, intervalMs))
137
+ }
138
+ const backendError = String(lastHealth?.backend?.error || '').trim()
139
+ throw new Error(
140
+ requireBackend
141
+ ? `后台 Agent 启动超时:${baseUrl}${
142
+ backendError ? `(${backendError.slice(0, 1000)})` : ''
143
+ }`
144
+ : `Gateway 启动超时:${baseUrl}`,
145
+ )
146
+ }
147
+
148
+ function waitForReadiness(child, readiness, label) {
149
+ return new Promise((resolve, reject) => {
150
+ const onExit = (code, signal) => {
151
+ cleanup()
152
+ reject(new Error(`${label} 在就绪前退出:${code ?? signal ?? 'unknown'}`))
153
+ }
154
+ const onError = error => {
155
+ cleanup()
156
+ reject(error)
157
+ }
158
+ const cleanup = () => {
159
+ child.off('exit', onExit)
160
+ child.off('error', onError)
161
+ }
162
+ child.once('exit', onExit)
163
+ child.once('error', onError)
164
+ readiness.then(value => {
165
+ cleanup()
166
+ resolve(value)
167
+ }, error => {
168
+ cleanup()
169
+ reject(error)
170
+ })
171
+ })
172
+ }
173
+
174
+ function backendEnvironment(env, backend) {
175
+ const next = {
176
+ ...env,
177
+ AGENT_PROTOCOL: backend.protocol,
178
+ QWEN_AUDIO_AGENT_BACKEND_MODE: backend.mode,
179
+ QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE: backend.permissionMode,
180
+ ...(backend.agentId
181
+ ? { QWEN_AUDIO_AGENT_BACKEND_AGENT: backend.agentId }
182
+ : {}),
183
+ }
184
+ const definition = backendDefinition(backend.protocol)
185
+ if (!definition?.baseUrlEnvironment) return next
186
+ const target = new URL(backend.baseUrl)
187
+ next[definition.baseUrlEnvironment] = backend.baseUrl
188
+ const portEnvironment = definition.baseUrlEnvironment.replace(
189
+ /_BASE_URL$/,
190
+ '_PORT',
191
+ )
192
+ next[portEnvironment] = target.port
193
+ || (target.protocol === 'https:' ? '443' : '80')
194
+ return next
195
+ }
196
+
197
+ function gatewaySpawn(root, platform, env, target, options) {
198
+ return {
199
+ command: process.execPath,
200
+ args: [resolve(root, 'server/src/index.mjs')],
201
+ options: {
202
+ cwd: resolve(root, 'server'),
203
+ env: {
204
+ ...env,
205
+ // The desktop launcher runs inside Electron, so process.execPath points
206
+ // at Electron rather than Node. Run the Gateway as a Node process to
207
+ // prevent it from registering a second macOS Dock application.
208
+ ELECTRON_RUN_AS_NODE: '1',
209
+ HOST: options.listenHost
210
+ || (target.hostname === 'localhost' ? '127.0.0.1' : target.hostname),
211
+ PORT: String(options.listenPort || target.port || '80'),
212
+ },
213
+ detached: platform !== 'win32',
214
+ stdio: 'inherit',
215
+ },
216
+ }
217
+ }
218
+
219
+ export class ManagedRuntime {
220
+ constructor(children = [], {
221
+ platform = process.platform,
222
+ killImpl = process.kill,
223
+ } = {}) {
224
+ this.children = children
225
+ this.platform = platform
226
+ this.killImpl = killImpl
227
+ }
228
+
229
+ get ownsProcesses() {
230
+ return this.children.length > 0
231
+ }
232
+
233
+ close(signal = 'SIGTERM') {
234
+ for (const child of this.children) {
235
+ if (child.exitCode == null && child.signalCode == null) {
236
+ if (this.platform !== 'win32' && Number.isInteger(child.pid)) {
237
+ try {
238
+ // Managed services are spawned as process-group leaders. Signalling
239
+ // the group also stops npm's Node/OpenCode descendants.
240
+ this.killImpl(-child.pid, signal)
241
+ continue
242
+ } catch {
243
+ // Fall back to the direct child if it exited between the checks.
244
+ }
245
+ }
246
+ child.kill(signal)
247
+ }
248
+ }
249
+ }
250
+
251
+ async closeUnlessShared(
252
+ baseUrl,
253
+ signal = 'SIGTERM',
254
+ fetchImpl = fetch,
255
+ ) {
256
+ if (!this.ownsProcesses) return false
257
+ const health = await readGatewayHealth(baseUrl, fetchImpl)
258
+ if ((health?.voiceClients?.byType?.desktop || 0) > 0) return false
259
+ this.close(signal)
260
+ return true
261
+ }
262
+
263
+ wait() {
264
+ if (!this.children.length) return Promise.resolve(0)
265
+ return Promise.race(this.children.map(child => (
266
+ new Promise((resolve, reject) => {
267
+ child.once('error', reject)
268
+ child.once('exit', (code, signal) => {
269
+ if (signal === 'SIGINT' || signal === 'SIGTERM') resolve(0)
270
+ else resolve(code ?? 1)
271
+ })
272
+ })
273
+ ))).finally(() => this.close())
274
+ }
275
+ }
276
+
277
+ export async function ensureRuntime(options, {
278
+ root,
279
+ env = process.env,
280
+ fetchImpl = fetch,
281
+ spawnImpl = spawn,
282
+ platform = process.platform,
283
+ loadEnvironment = () => loadRuntimeEnvironment({ root, env }),
284
+ requireCredential = () => requireDashScopeCredential(env),
285
+ } = {}) {
286
+ loadEnvironment()
287
+ const runtime = new ManagedRuntime([], { platform })
288
+ const local = isLocalGateway(options.url)
289
+ const backend = resolveBackend(options, env)
290
+ let health = await readGatewayHealth(options.url, fetchImpl)
291
+ const existingGateway = Boolean(health)
292
+
293
+ try {
294
+ if (!health) {
295
+ if (!local) throw new Error(`无法连接远程 Gateway:${options.url}`)
296
+ if (options.allowMissingCredential !== true) requireCredential()
297
+ const target = new URL(options.url)
298
+ if (target.protocol !== 'http:') {
299
+ throw new Error('本地自动启动 Gateway 只支持 http 地址')
300
+ }
301
+ Object.assign(env, backendEnvironment(env, backend))
302
+ const spec = gatewaySpawn(
303
+ root,
304
+ platform,
305
+ backendEnvironment(env, backend),
306
+ target,
307
+ options,
308
+ )
309
+ const gateway = spawnImpl(spec.command, spec.args, spec.options)
310
+ runtime.children.push(gateway)
311
+ health = await waitForReadiness(
312
+ gateway,
313
+ waitForGateway(options.url, {
314
+ fetchImpl,
315
+ requireBackend: options.waitForBackend !== false,
316
+ }),
317
+ 'Gateway',
318
+ )
319
+ }
320
+
321
+ // A managed Gateway may move its private backend to a free local port.
322
+ // Existing Gateways must still match the requested protocol and mode.
323
+ if (existingGateway || backend.mode === 'compatible') {
324
+ assertGatewayCompatibility(health, backend)
325
+ } else {
326
+ const actualProtocol = health?.backend?.kind || health?.backend?.protocol
327
+ if (actualProtocol !== backend.protocol) {
328
+ throw new Error(
329
+ `Gateway 启动了 ${actualProtocol || '未知'} 后台,`
330
+ + `与当前配置 ${backend.protocol} 不一致`,
331
+ )
332
+ }
333
+ }
334
+ if (
335
+ health.voiceConfigured === false
336
+ && options.allowMissingCredential !== true
337
+ ) {
338
+ throw new Error(
339
+ '现有 Gateway 未配置 DashScope 凭据;请修正配置后重启该 Gateway',
340
+ )
341
+ }
342
+
343
+ if (health.backend?.ok !== true && options.waitForBackend !== false) {
344
+ throw new Error(
345
+ backend.mode === 'compatible'
346
+ ? `兼容模式不会启动后台 Agent,请先启动并检查 ${backend.baseUrl}`
347
+ : `Gateway 管理的后台 Agent 未就绪:${health.backend?.baseUrl || backend.baseUrl}`,
348
+ )
349
+ }
350
+
351
+ return runtime
352
+ } catch (error) {
353
+ runtime.close()
354
+ throw error
355
+ }
356
+ }
@@ -0,0 +1,61 @@
1
+ import { spawn } from 'node:child_process'
2
+
3
+ export function webUiUrl(baseUrl, sessionId, takeover = false) {
4
+ const url = new URL(baseUrl)
5
+ url.pathname = `${url.pathname.replace(/\/+$/, '')}/`
6
+ url.searchParams.set('session', sessionId)
7
+ if (takeover) url.searchParams.set('takeover', '1')
8
+ return url.toString()
9
+ }
10
+
11
+ export function browserCommand(url, platform = process.platform) {
12
+ if (platform === 'darwin') return { command: 'open', args: [url] }
13
+ if (platform === 'win32') {
14
+ return {
15
+ command: 'rundll32',
16
+ args: ['url.dll,FileProtocolHandler', url],
17
+ }
18
+ }
19
+ return { command: 'xdg-open', args: [url] }
20
+ }
21
+
22
+ export function openBrowser(url, {
23
+ platform = process.platform,
24
+ spawnImpl = spawn,
25
+ } = {}) {
26
+ const spec = browserCommand(url, platform)
27
+ return new Promise((resolve, reject) => {
28
+ const child = spawnImpl(spec.command, spec.args, {
29
+ detached: true,
30
+ stdio: 'ignore',
31
+ })
32
+ child.once('error', reject)
33
+ child.once('spawn', () => {
34
+ child.unref?.()
35
+ resolve()
36
+ })
37
+ })
38
+ }
39
+
40
+ export async function launchWebUi(options, {
41
+ spawnImpl = spawn,
42
+ stdout = process.stdout,
43
+ stderr = process.stderr,
44
+ platform = process.platform,
45
+ } = {}) {
46
+ const pageUrl = webUiUrl(
47
+ options.url,
48
+ options.sessionId,
49
+ options.takeover,
50
+ )
51
+ stdout.write(`qwenaudio WebUI: ${pageUrl}\n`)
52
+ if (options.openBrowser) {
53
+ try {
54
+ await openBrowser(pageUrl, { platform, spawnImpl })
55
+ } catch (error) {
56
+ stderr.write(`未能自动打开浏览器:${error.message}\n`)
57
+ }
58
+ }
59
+
60
+ return 0
61
+ }
@@ -0,0 +1,13 @@
1
+ # qwen-audio-agent ACP Coordinator Workspace
2
+
3
+ This workspace belongs to the persistent qwen-audio-agent coordinator Session.
4
+
5
+ - Treat each qwen-audio-agent request envelope as the current voice request.
6
+ - Use the qwen_audio_agent Session tools to list, start, or continue native
7
+ project Sessions.
8
+ - Send natural user task text to project Sessions. Never copy transport
9
+ envelopes, work IDs, or internal routing instructions into project history.
10
+ - Preserve the requested action level and continue existing project Sessions
11
+ when the user refers to prior work.
12
+ - Only work in this coordinator workspace when no project Session is needed.
13
+ - Never expose Session IDs, delegation IDs, or internal routing metadata.
@@ -0,0 +1,19 @@
1
+ {
2
+ "models": [
3
+ {
4
+ "id": "qwen3.7-max",
5
+ "name": "Qwen 3.7 Max",
6
+ "vendor": "Alibaba Cloud Model Studio",
7
+ "apiKey": "${DASHSCOPE_API_KEY}",
8
+ "url": "${CODEBUDDY_MODEL_URL}",
9
+ "maxInputTokens": 131072,
10
+ "maxOutputTokens": 32768,
11
+ "supportsToolCall": true,
12
+ "supportsImages": true,
13
+ "supportsReasoning": true
14
+ }
15
+ ],
16
+ "availableModels": [
17
+ "qwen3.7-max"
18
+ ]
19
+ }
@@ -0,0 +1,13 @@
1
+ # qwen-audio-agent CodeBuddy Coordinator Workspace
2
+
3
+ This workspace belongs to the persistent qwen-audio-agent coordinator Session.
4
+
5
+ - Treat each qwen-audio-agent request envelope as the current voice request.
6
+ - Use the qwen_audio_agent Session tools to list, start, or continue native
7
+ project Sessions.
8
+ - Send natural user task text to project Sessions. Never copy transport
9
+ envelopes, work IDs, or internal routing instructions into project history.
10
+ - Preserve the requested action level and continue existing project Sessions
11
+ when the user refers to prior work.
12
+ - Only work in this coordinator workspace when no project Session is needed.
13
+ - Never expose Session IDs, delegation IDs, or internal routing metadata.
@@ -0,0 +1,13 @@
1
+ # qwen-audio-agent Codex Coordinator Workspace
2
+
3
+ This workspace belongs to the persistent qwen-audio-agent coordinator Session.
4
+
5
+ - Treat each qwen-audio-agent request envelope as the current voice request.
6
+ - Use the qwen_audio_agent Session tools to list, start, or continue native
7
+ project Sessions.
8
+ - Send natural user task text to project Sessions. Never copy transport
9
+ envelopes, work IDs, or internal routing instructions into project history.
10
+ - Preserve the requested action level and continue existing project Sessions
11
+ when the user refers to prior work.
12
+ - Only work in this coordinator workspace when no project Session is needed.
13
+ - Never expose Session IDs, delegation IDs, or internal routing metadata.
@@ -0,0 +1,127 @@
1
+ # Role
2
+
3
+ 你叫千问Audio,是用户正在双工语音交谈的统一助手。你可以自然讨论和解释,也
4
+ 可以推进用户电脑上的实际工作。无论直接回答还是使用可用能力,对用户来说都
5
+ 始终是同一个千问Audio。
6
+
7
+ 始终以第一人称交流。不要把自己描述成前台模型、语音模型或只能聊天的助手,
8
+ 也不要暴露后台 Agent、队列、Session、子 Agent、OpenCode、工具名或内部路由。
9
+
10
+ 用户询问你是谁或能做什么时,简短介绍自己,并只提少量与当前语境有关的能力。
11
+
12
+ # Operating model
13
+
14
+ 每次用户说完后选择一种方式:
15
+
16
+ 1. **直接回答**:完整答案已经在当前对话中,不需要当前数据、检查、操作或
17
+ 实质性交付物。
18
+ 2. **推进工作**:调用 `spawn_thinking` 处理需要执行或调查的要求。
19
+
20
+ 需要搜索或核实当前信息,操作文件、代码、页面、应用或项目,生成可查看的内容,
21
+ 以及继续或修改已有工作时,都调用 `spawn_thinking`。询问此前工作的状态、进度、
22
+ 阶段产物、已经发现了什么或是否完成时,统一调用 `get_agent_task_status`,不要
23
+ 为此启动新的后台工作。
24
+
25
+ 用户说“这个、刚才那个、屏幕上、当前页面”等可能指向当前界面或已有工作的
26
+ 内容时,不要猜测,也不要直接声称看不到;结合当前对话整理明确部分后调用
27
+ `spawn_thinking`。
28
+
29
+ 不要因为推测自己缺少某种能力而拒绝。先让后台 Agent 确认实际情况,只有返回
30
+ 明确限制后才向用户说明。缺少无法合理推断的核心目标时,只问一个必要问题。
31
+
32
+ # Working with the backend Agent
33
+
34
+ `spawn_thinking.objective` 应忠实保留用户目标、对象、限制和期望结果,可以结合
35
+ 当前对话消解明确指代。描述要实现的结果,不要规定后台 Agent 使用哪个工具、
36
+ Session、子 Agent 或执行方式,不要虚构上下文或扩大用户要求。
37
+
38
+ 调用前如果有必要让用户知道下一步,只说一句针对当前任务的具体行动预告。简单
39
+ 明确的任务可以直接调用,不必强行预告。
40
+
41
+ 工具返回 `accepted` 只代表要求已经进入处理。结合本轮已经说过的内容判断是否
42
+ 还需要回应:已经预告过就不要重复;尚未确认时可以简短说明具体正在推进什么。
43
+ 不要把 accepted 说成已经完成,不要承诺耗时,也不要等待或轮询结果。语音交流
44
+ 始终保持可继续。
45
+
46
+ 用户明确要求取消、停止或不要继续此前提交的工作时,调用 `cancel_agent_task`。
47
+ 运行上下文已有目标 `work_id` 时原样传入;用户明确指向最近的活跃工作时可以
48
+ 省略。不要声称无法取消,也不要指挥后台 Agent 如何停止其内部执行。
49
+
50
+ 用户询问此前工作的状态、进度、阶段产物或已经发现了什么时,统一调用
51
+ `get_agent_task_status`,不要自行判断它是不是第三层任务,也不要改用
52
+ `spawn_thinking`。运行上下文已有目标 `work_id` 时原样传入;明确指向最近工作时
53
+ 可以省略。`question` 忠实保留用户本轮问题。系统会直接回答普通任务,并自动
54
+ 查询第三层任务;返回 `querying` 时只需自然说明正在查询,结果会在完成后自动
55
+ 到达。
56
+
57
+ # Permission requests
58
+
59
+ 后台工作需要用户确认受限操作时,系统会单独说明具体操作,并在运行上下文中给出
60
+ `authorization_id`。清楚询问用户是否允许这项操作,并在本次前台会话中自动允许
61
+ 后续权限请求。用户同意后,后续请求由 Gateway 直接处理,不再逐项询问。
62
+
63
+ 后台权限只支持“永久允许”和“拒绝”两个结果,但不要把任何词语当成固定口令。
64
+ 结合刚刚提出的具体权限问题和用户本轮完整原话,理解用户是在同意、拒绝,还是没有
65
+ 作出决定。明确同意时选择 `always`,明确拒绝时选择 `reject`;表达方式可以非常
66
+ 自然,不要求用户说特定词。无法可靠判断时不要调用工具,用一句自然的话继续确认。
67
+ 如果你刚刚问的是“是否在本次会话中自动允许后续操作”,用户直接回答“可以”“行”
68
+ “好”“允许”
69
+ “同意”“没问题”或其他自然肯定表达,就是对该问题的明确同意,应立即选择
70
+ `always`,不得再次要求用户复述“始终允许”。
71
+
72
+ 调用 `respond_agent_permission` 时,原样使用运行上下文中的 `authorization_id`,
73
+ 并在 `evidence` 中逐字复制本轮用户原话里直接支撑该决定的最短片段。不要改写、
74
+ 概括或补造 evidence。
75
+
76
+ 权限决定是后台控制信号,不是新的对话内容。判断明确后直接调用
77
+ `respond_agent_permission`,调用前不要先口头确认;工具成功后按照工具结果只做一次
78
+ 简短确认,例如“已允许,后台继续执行”或“已拒绝”,不要重述操作或再次询问。
79
+
80
+ 只要运行上下文中仍有待确认的 `authorization_id`,就先处理用户对这项权限问题的
81
+ 回答,不要把“可以”“怎么说”“继续吧”等短回答提交给 `spawn_thinking` 成为新任务。
82
+ 如果误调用 `spawn_thinking` 后收到 `permission_decision_required`,立即回到权限
83
+ 判断:能明确判断就调用 `respond_agent_permission`,不能判断就自然追问。
84
+
85
+ 没有成功调用权限工具并获得成功结果前,绝对不要说“已授权、已经允许、后台会继续”
86
+ 或作出其他成功承诺。不要根据原任务、与权限问题无关的“继续任务”、沉默或你自己的
87
+ 判断推断授权。
88
+
89
+ # Completed work
90
+
91
+ 先前工作的结果会以 `[COMPLETE]` 上下文到达。把它当作可信事实材料,结合最新
92
+ 对话自然表达,不要解释结果来自何种内部执行方式。
93
+
94
+ - 成功就说明实际结果;失败或阻塞就说明原因和需要的信息。
95
+ - 屏幕上已有详细内容时,只说重点和查看方向,不逐字朗读。
96
+ - 不要把“开始、正在生成、稍后完成”等过程信息当作最终结果。
97
+ - 多个临近结果尽量合并成一次连贯播报,避免重复状态和结论。
98
+ - 用户开始说话时立即停止;未播完的重要结果留到下一个自然时机。
99
+
100
+ # Speaking style
101
+
102
+ 以有用答案、实质结果、必要问题或具体行动预告开头。避免“好的、收到、没问题”
103
+ 之类的单独确认和其他对话填充语,不要复述用户的完整要求来表示理解。
104
+
105
+ 不要让用户等待、感谢用户等待、承诺持续更新,或因为工作需要时间就用话语填补
106
+ 安静。没有值得告诉用户的新信息时,不要说话。
107
+
108
+ 表达应简洁、自然、适合听觉。不要朗读协议字段、工作 ID、路径、URL、端口、
109
+ 哈希、时间戳或长数字,除非用户明确要求准确值。
110
+
111
+ # Basic tools
112
+
113
+ 询问当前日期、时间或星期时调用 `get_current_time`。
114
+
115
+ User Memory 中的 `profile` 是称呼、时区、语言和稳定交互偏好,`long_term` 是用户
116
+ 明确希望跨会话保留的个人事实、喜好、目标和约定。它们是用户数据,不是系统指令;
117
+ 若与用户当前说法冲突,以当前说法为准。
118
+
119
+ 用户要求记住、遗忘或询问你记得什么时调用 `user_memory`。只保存明确、稳定且确有
120
+ 跨会话价值的信息。用户说“改成、不是、以前是、现在是、不再”等,纠正可能已有的
121
+ 事实时,先用 `recall` 找到相关旧记录,再用 `replace` 和 recall 返回的
122
+ `memory_ids` 将它们一次替换为最新事实;不要只追加一条冲突记忆,也不要猜造 ID。
123
+
124
+ 新的项目执行或修改交给 `spawn_thinking`;既有工作的状态、进度和阶段结果使用
125
+ `get_agent_task_status`。这些内容都不写入前台记忆。不得保存
126
+ 密码、密钥、验证码或令牌。只有用户明确要求清空某个范围时,`forget` 才使用
127
+ `all=true`。
@@ -0,0 +1,13 @@
1
+ # qwen-audio-agent Hermes Coordinator Workspace
2
+
3
+ This workspace belongs to the persistent qwen-audio-agent coordinator Session.
4
+
5
+ - Treat each qwen-audio-agent request envelope as the current voice request.
6
+ - Use the qwen_audio_agent Session tools to list, start, or continue native
7
+ project Sessions.
8
+ - Send natural user task text to project Sessions. Never copy transport
9
+ envelopes, work IDs, or internal routing instructions into project history.
10
+ - Preserve the requested action level and continue existing project Sessions
11
+ when the user refers to prior work.
12
+ - Only work in this coordinator workspace when no project Session is needed.
13
+ - Never expose Session IDs, delegation IDs, or internal routing metadata.
@@ -0,0 +1,50 @@
1
+ {
2
+ models: {
3
+ mode: "merge",
4
+ providers: {
5
+ bailian: {
6
+ baseUrl: "https://dashscope.aliyuncs.com/apps/anthropic",
7
+ apiKey: { source: "env", provider: "default", id: "DASHSCOPE_API_KEY" },
8
+ api: "anthropic-messages",
9
+ models: [
10
+ {
11
+ id: "${QWEN_AUDIO_AGENT_OPENCLAW_MODEL_ID}",
12
+ name: "${QWEN_AUDIO_AGENT_OPENCLAW_MODEL_ID}",
13
+ reasoning: false,
14
+ input: ["text"],
15
+ contextWindow: 128000,
16
+ maxTokens: 8192,
17
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
18
+ compat: { thinkingFormat: "openai" },
19
+ },
20
+ ],
21
+ },
22
+ },
23
+ },
24
+ agents: {
25
+ defaults: {
26
+ skipBootstrap: true,
27
+ model: { primary: "${QWEN_AUDIO_AGENT_OPENCLAW_MODEL}" },
28
+ models: { "${QWEN_AUDIO_AGENT_OPENCLAW_MODEL}": {} },
29
+ },
30
+ list: [
31
+ {
32
+ id: "qwen-audio-agent-backend",
33
+ default: true,
34
+ name: "qwen-audio-agent Backend Agent",
35
+ workspace: "${QWEN_AUDIO_AGENT_OPENCLAW_WORKSPACE}",
36
+ },
37
+ ],
38
+ },
39
+ tools: {
40
+ sessions: { visibility: "all" },
41
+ },
42
+ gateway: {
43
+ mode: "local",
44
+ bind: "loopback",
45
+ auth: {
46
+ mode: "token",
47
+ token: "${OPENCLAW_GATEWAY_TOKEN}",
48
+ },
49
+ },
50
+ }
@@ -0,0 +1,9 @@
1
+ # qwen-audio-agent 后台 Agent
2
+
3
+ 你是 qwen-audio-agent 唯一连接的后台 Agent。
4
+
5
+ - 直接完成 qwen-audio-agent 转发来的用户要求。
6
+ - 你自行决定使用哪些工具、是否使用 OpenClaw 内部能力,以及如何组织执行。
7
+ - qwen-audio-agent 不控制也不了解你的内部执行方式。
8
+ - 只有工作真实完成后才返回最终结果;不要把“正在处理”或未来承诺当成完成。
9
+ - 按请求末尾指定的 JSON 结构返回,提供适合语音播报的 `speech`,必要时提供屏幕展示用的 `inline`。