qwen-audio-agent 1.1.0 → 1.2.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/README.md +24 -9
- package/README_EN.md +32 -14
- package/cli/package.json +1 -1
- package/package.json +2 -1
- package/scripts/audit-dependencies.mjs +4 -10
- package/scripts/verify-package.mjs +167 -96
- package/server/package.json +1 -1
- package/server/src/agent/coordinator.mjs +2 -4
- package/server/src/core/config.mjs +5 -2
- package/server/src/task/task-manager.mjs +23 -1
- package/server/src/voice/frontend-tools.mjs +184 -0
- package/server/src/voice/providers/dashscope.mjs +91 -0
- package/server/src/voice/providers/openai-compatible-protocol.mjs +56 -0
- package/server/src/voice/providers/registry.mjs +87 -0
- package/server/src/voice/realtime-gateway.mjs +16 -18
- package/server/src/voice/realtime-provider.mjs +96 -339
- package/shared/backend-setup.mjs +17 -3
- package/tui/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,9 +33,10 @@ https://github.com/user-attachments/assets/42022655-36d1-46b2-9c26-ff0765284000
|
|
|
33
33
|
### 核心特色
|
|
34
34
|
|
|
35
35
|
- 全双工实时语音交互、自然打断和持续多轮对话
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
36
|
+
- 一键选择你喜欢的办事 Agent,复用已有的工具、MCP、Skill
|
|
37
|
+
- 前台对话与后台任务并驾齐驱,可随时追问任务进度或取消任务
|
|
38
|
+
- 支持创建多个独立任务,由后台 Agent 异步执行,并持续追踪任务状态
|
|
39
|
+
- 任务结果自动回到当前对话,支持继续追问和修改
|
|
39
40
|
- 支持 WebUI、终端 TUI 和 macOS 桌面悬浮球
|
|
40
41
|
- 支持本地用户档案与跨会话个人记忆
|
|
41
42
|
|
|
@@ -250,15 +251,18 @@ AGENT_PROTOCOL=opencode
|
|
|
250
251
|
AGENT_PROTOCOL=qoder
|
|
251
252
|
```
|
|
252
253
|
|
|
253
|
-
|
|
254
|
+
后台 Agent 需要用户自行安装并完成原生配置;qwen-audio-agent 会复用其
|
|
255
|
+
用户级模型、工具、MCP、Skill 和认证。
|
|
254
256
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
257
|
+
其中部分 Agent 通过外部 ACP 适配器接入,除本体外,还需要全局安装对应的适配器。
|
|
258
|
+
以 Codex 为例:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
npm install -g @agentclientprotocol/codex-acp
|
|
258
262
|
```
|
|
259
263
|
|
|
260
|
-
|
|
261
|
-
|
|
264
|
+
CLI 模式缺少适配器时会尝试通过 npx 按需启动;桌面版为保证启动可靠,仅使用已安装的
|
|
265
|
+
组件,请提前安装。
|
|
262
266
|
|
|
263
267
|
使用其他支持 ACP stdio 的 Agent:
|
|
264
268
|
|
|
@@ -317,6 +321,17 @@ npm run desktop # macOS 桌面悬浮球
|
|
|
317
321
|
|
|
318
322
|
更多构建、测试和发布说明见 [CONTRIBUTING.md](CONTRIBUTING.md)。
|
|
319
323
|
|
|
324
|
+
## 交流与分享
|
|
325
|
+
|
|
326
|
+
你可以直接在 [GitHub Issues](https://github.com/QwenAudio/qwen-audio-agent/issues) 发起讨论。
|
|
327
|
+
|
|
328
|
+
对中国用户,也可以扫描左侧二维码加入微信交流群;如果群二维码已满或过期,
|
|
329
|
+
扫描右侧任一维护者的个人二维码,维护者会邀请你进群。
|
|
330
|
+
|
|
331
|
+
| 微信交流群 | 个人微信 | 个人微信 |
|
|
332
|
+
| :---: | :---: | :---: |
|
|
333
|
+
| <img src="docs/wechat-group-qr.png" width="240" alt="微信交流群二维码"> | <img src="docs/wechat-contact-qr.png" width="240" alt="李旭个人微信二维码"> | <img src="docs/wechat-pigeon-dan-qr.png" width="240" alt="Pigeon.Dan 个人微信二维码"> |
|
|
334
|
+
|
|
320
335
|
## 参与贡献与安全
|
|
321
336
|
|
|
322
337
|
- 开发与提交说明:[CONTRIBUTING.md](CONTRIBUTING.md)
|
package/README_EN.md
CHANGED
|
@@ -41,12 +41,14 @@ https://github.com/user-attachments/assets/42022655-36d1-46b2-9c26-ff0765284000
|
|
|
41
41
|
|
|
42
42
|
- Full-duplex realtime voice interaction, natural interruption, and continuous
|
|
43
43
|
multi-turn conversation
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
and cancellation available at any time
|
|
48
|
-
-
|
|
49
|
-
|
|
44
|
+
- Choose your preferred Agent with one click, reusing its existing tools, MCP
|
|
45
|
+
servers, and Skills
|
|
46
|
+
- Foreground conversation and background tasks move forward in parallel, with
|
|
47
|
+
progress checks and cancellation available at any time
|
|
48
|
+
- Create multiple independent tasks for asynchronous execution by backend
|
|
49
|
+
Agents, with continuous status tracking
|
|
50
|
+
- Task results return automatically to the current conversation for follow-up
|
|
51
|
+
and revision
|
|
50
52
|
- WebUI, terminal TUI, and a macOS desktop orb
|
|
51
53
|
- Local user profile and personal memory across sessions
|
|
52
54
|
|
|
@@ -281,17 +283,20 @@ Use Qoder:
|
|
|
281
283
|
AGENT_PROTOCOL=qoder
|
|
282
284
|
```
|
|
283
285
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
+
Backend Agents require the user to install and configure the native Agent
|
|
287
|
+
first. qwen-audio-agent reuses its user-level model, tools, MCP servers,
|
|
288
|
+
Skills, and authentication.
|
|
286
289
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
+
Some Agents connect through external ACP adapters. Besides the Agent itself,
|
|
291
|
+
install the matching adapter globally. For example, for Codex:
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
npm install -g @agentclientprotocol/codex-acp
|
|
290
295
|
```
|
|
291
296
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
297
|
+
The CLI falls back to starting a missing adapter on demand with npx; the
|
|
298
|
+
desktop app only uses installed components for reliable startup, so install
|
|
299
|
+
the adapter up front.
|
|
295
300
|
|
|
296
301
|
Use another Agent that supports ACP over stdio:
|
|
297
302
|
|
|
@@ -363,6 +368,19 @@ npm run desktop # macOS desktop orb
|
|
|
363
368
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for more about building, testing, and
|
|
364
369
|
releasing.
|
|
365
370
|
|
|
371
|
+
## Discussion & Sharing
|
|
372
|
+
|
|
373
|
+
You can start a discussion directly in
|
|
374
|
+
[GitHub Issues](https://github.com/QwenAudio/qwen-audio-agent/issues).
|
|
375
|
+
|
|
376
|
+
For users in China, you can also scan the QR code on the left to join our
|
|
377
|
+
WeChat group. If the group code is full or expired, scan either maintainer's
|
|
378
|
+
personal QR code on the right and they will invite you to the group.
|
|
379
|
+
|
|
380
|
+
| WeChat Group | Personal WeChat | Personal WeChat |
|
|
381
|
+
| :---: | :---: | :---: |
|
|
382
|
+
| <img src="docs/wechat-group-qr.png" width="240" alt="WeChat group QR code"> | <img src="docs/wechat-contact-qr.png" width="240" alt="Li Xu's personal WeChat QR code"> | <img src="docs/wechat-pigeon-dan-qr.png" width="240" alt="Pigeon.Dan's personal WeChat QR code"> |
|
|
383
|
+
|
|
366
384
|
## Contributing and Security
|
|
367
385
|
|
|
368
386
|
- Development and contribution guide: [CONTRIBUTING.md](CONTRIBUTING.md)
|
package/cli/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qwen-audio-agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "A realtime voice frontend for mainstream AI agents.",
|
|
5
5
|
"author": "qwen-audio-agent contributors",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -113,6 +113,7 @@
|
|
|
113
113
|
"dependencies": {
|
|
114
114
|
"@agentclientprotocol/sdk": "1.3.0",
|
|
115
115
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
116
|
+
"electron-updater": "6.8.9",
|
|
116
117
|
"express": "^4.22.2",
|
|
117
118
|
"ws": "^8.21.1",
|
|
118
119
|
"zod": "^4.4.3"
|
|
@@ -2,16 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import { spawnSync } from 'node:child_process'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
id: 'GHSA-mh99-v99m-4gvg',
|
|
10
|
-
expires: '2026-08-15',
|
|
11
|
-
reason: 'electron-builder 的间接 glob 构建链尚无兼容的稳定版修复',
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
])
|
|
5
|
+
// 无当前生效的临时例外;新增例外时按 1124334(GHSA-mh99-v99m-4gvg)的
|
|
6
|
+
// 格式加入:source id -> { id, expires, reason }。已修复或不再出现的例外
|
|
7
|
+
// 必须及时删除,脚本会在例外失效时强制报错提醒。
|
|
8
|
+
const TEMPORARY_BUILD_ADVISORIES = new Map([])
|
|
15
9
|
|
|
16
10
|
function runAudit(args) {
|
|
17
11
|
const npmExecutable = process.env.npm_execpath
|
|
@@ -2,109 +2,180 @@
|
|
|
2
2
|
|
|
3
3
|
import { spawnSync } from 'node:child_process'
|
|
4
4
|
import { dirname, posix, resolve } from 'node:path'
|
|
5
|
-
import { fileURLToPath } from 'node:url'
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
6
6
|
import { readFileSync } from 'node:fs'
|
|
7
7
|
|
|
8
8
|
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
|
9
|
-
const npmExecutable = process.env.npm_execpath
|
|
10
|
-
const command = npmExecutable ? process.execPath : (
|
|
11
|
-
process.platform === 'win32' ? 'npm.cmd' : 'npm'
|
|
12
|
-
)
|
|
13
|
-
const args = [
|
|
14
|
-
...(npmExecutable ? [npmExecutable] : []),
|
|
15
|
-
'pack',
|
|
16
|
-
'--dry-run',
|
|
17
|
-
'--json',
|
|
18
|
-
'--ignore-scripts',
|
|
19
|
-
]
|
|
20
|
-
const result = spawnSync(command, args, {
|
|
21
|
-
cwd: root,
|
|
22
|
-
env: process.env,
|
|
23
|
-
encoding: 'utf8',
|
|
24
|
-
shell: !npmExecutable && process.platform === 'win32',
|
|
25
|
-
})
|
|
26
|
-
if (result.error) throw result.error
|
|
27
|
-
if (result.status !== 0) {
|
|
28
|
-
process.stderr.write(result.stderr)
|
|
29
|
-
throw new Error('npm pack 自检失败')
|
|
30
|
-
}
|
|
31
9
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
'scripts/check-desktop-release-env.mjs',
|
|
61
|
-
'scripts/codex-acp',
|
|
62
|
-
'scripts/claude-code-acp',
|
|
63
|
-
'scripts/install-global.mjs',
|
|
64
|
-
'scripts/opencode-acp',
|
|
65
|
-
'scripts/prepare-build.mjs',
|
|
66
|
-
'server/src/agent/acp-backend-adapter.mjs',
|
|
67
|
-
'server/src/agent/acp-process-client.mjs',
|
|
68
|
-
'server/src/agent/acp-session-registry.mjs',
|
|
69
|
-
'server/src/agent/acp-session-tools.mjs',
|
|
70
|
-
'server/src/core/package-version.mjs',
|
|
71
|
-
'server/src/index.mjs',
|
|
72
|
-
'shared/runtime-environment.mjs',
|
|
73
|
-
'tui/src/index.mjs',
|
|
74
|
-
'web/dist/index.html',
|
|
75
|
-
]
|
|
76
|
-
const missing = required.filter(file => !files.has(file))
|
|
77
|
-
if (missing.length) {
|
|
78
|
-
throw new Error(`npm 成品缺少必要文件:${missing.join(', ')}`)
|
|
79
|
-
}
|
|
80
|
-
const forbidden = [...files].filter(file => (
|
|
81
|
-
file.includes('/__pycache__/')
|
|
82
|
-
|| file.endsWith('.pyc')
|
|
83
|
-
|| file.includes('/node_modules/')
|
|
84
|
-
|| file.startsWith('desktop/src/')
|
|
85
|
-
))
|
|
86
|
-
if (forbidden.length) {
|
|
87
|
-
throw new Error(`npm 成品包含不应发布的文件:${forbidden.join(', ')}`)
|
|
10
|
+
/**
|
|
11
|
+
* Parse `npm pack --dry-run --json` stdout into a list of package entries.
|
|
12
|
+
*
|
|
13
|
+
* npm <=10 emits an array: [ { id, name, files, ... }, ... ]
|
|
14
|
+
* npm >=11 emits an object map: { "<pkgName>": { id, name, files, ... }, ... }
|
|
15
|
+
* Both shapes carry identical per-package fields, so we normalise to an array
|
|
16
|
+
* and let callers treat them uniformly.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} stdout Raw stdout from `npm pack --dry-run --json`.
|
|
19
|
+
* @returns {Array<object>} Package entries (one per packed package).
|
|
20
|
+
*/
|
|
21
|
+
export function parsePackOutput(stdout) {
|
|
22
|
+
const trimmed = stdout.trim()
|
|
23
|
+
if (!trimmed) {
|
|
24
|
+
throw new Error('npm pack 输出为空')
|
|
25
|
+
}
|
|
26
|
+
const jsonText = extractLastJsonBlock(trimmed)
|
|
27
|
+
if (!jsonText) {
|
|
28
|
+
throw new Error('无法解析 npm pack 输出的 JSON:未找到 JSON 块')
|
|
29
|
+
}
|
|
30
|
+
let parsed
|
|
31
|
+
try {
|
|
32
|
+
parsed = JSON.parse(jsonText)
|
|
33
|
+
} catch (error) {
|
|
34
|
+
throw new Error(`无法解析 npm pack 输出的 JSON:${error.message}`)
|
|
35
|
+
}
|
|
36
|
+
const entries = Array.isArray(parsed) ? parsed : Object.values(parsed)
|
|
37
|
+
return entries.filter(Boolean)
|
|
88
38
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
39
|
+
|
|
40
|
+
// npm 10 在 `npm pack` 时会触发 `prepare` 生命周期脚本,构建工具(vite 等)的
|
|
41
|
+
// 日志会混入 stdout,污染 pack 的 JSON 输出(`--ignore-scripts` 不阻止 prepare)。
|
|
42
|
+
// 这里从 stdout 末尾按括号配对提取最后一个 JSON 块,以兼容前导/尾部噪声,同时
|
|
43
|
+
// 兼容 npm <=10 的数组与 npm >=11 的对象两种结构。
|
|
44
|
+
function extractLastJsonBlock(text) {
|
|
45
|
+
let end = -1
|
|
46
|
+
let endChar = ''
|
|
47
|
+
for (let i = text.length - 1; i >= 0; i--) {
|
|
48
|
+
const char = text[i]
|
|
49
|
+
if (char === '}' || char === ']') {
|
|
50
|
+
end = i
|
|
51
|
+
endChar = char
|
|
52
|
+
break
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (end === -1) return null
|
|
56
|
+
const startChar = endChar === '}' ? '{' : '['
|
|
57
|
+
let depth = 1
|
|
58
|
+
let start = -1
|
|
59
|
+
for (let i = end - 1; i >= 0; i--) {
|
|
60
|
+
const char = text[i]
|
|
61
|
+
if (char === endChar) depth++
|
|
62
|
+
else if (char === startChar) {
|
|
63
|
+
depth--
|
|
64
|
+
if (depth === 0) {
|
|
65
|
+
start = i
|
|
66
|
+
break
|
|
67
|
+
}
|
|
99
68
|
}
|
|
100
69
|
}
|
|
70
|
+
if (start === -1) return null
|
|
71
|
+
return text.slice(start, end + 1)
|
|
101
72
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
73
|
+
|
|
74
|
+
const isMain = process.argv[1]
|
|
75
|
+
&& import.meta.url === pathToFileURL(process.argv[1]).href
|
|
76
|
+
|
|
77
|
+
if (isMain) {
|
|
78
|
+
const npmExecutable = process.env.npm_execpath
|
|
79
|
+
const command = npmExecutable ? process.execPath : (
|
|
80
|
+
process.platform === 'win32' ? 'npm.cmd' : 'npm'
|
|
105
81
|
)
|
|
106
|
-
|
|
82
|
+
const args = [
|
|
83
|
+
...(npmExecutable ? [npmExecutable] : []),
|
|
84
|
+
'pack',
|
|
85
|
+
'--dry-run',
|
|
86
|
+
'--json',
|
|
87
|
+
'--ignore-scripts',
|
|
88
|
+
]
|
|
89
|
+
const result = spawnSync(command, args, {
|
|
90
|
+
cwd: root,
|
|
91
|
+
env: process.env,
|
|
92
|
+
encoding: 'utf8',
|
|
93
|
+
shell: !npmExecutable && process.platform === 'win32',
|
|
94
|
+
})
|
|
95
|
+
if (result.error) throw result.error
|
|
96
|
+
if (result.status !== 0) {
|
|
97
|
+
process.stderr.write(result.stderr)
|
|
98
|
+
throw new Error('npm pack 自检失败')
|
|
99
|
+
}
|
|
107
100
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
)
|
|
101
|
+
let packages
|
|
102
|
+
try {
|
|
103
|
+
packages = parsePackOutput(result.stdout)
|
|
104
|
+
} catch (error) {
|
|
105
|
+
process.stderr.write(result.stdout)
|
|
106
|
+
throw error
|
|
107
|
+
}
|
|
108
|
+
if (packages.length !== 1) throw new Error('npm pack 返回了意外的包数量')
|
|
109
|
+
const files = new Set(packages[0].files.map(file => file.path))
|
|
110
|
+
const required = [
|
|
111
|
+
'cli/bin/qwenaudio.mjs',
|
|
112
|
+
'config/openclaw/workspace/AGENTS.md',
|
|
113
|
+
'config/hermes/workspace/AGENTS.md',
|
|
114
|
+
'config/codebuddy/workspace/AGENTS.md',
|
|
115
|
+
'config/codebuddy/workspace/.codebuddy/models.json',
|
|
116
|
+
'config/codex/workspace/AGENTS.md',
|
|
117
|
+
'config/claude/workspace/AGENTS.md',
|
|
118
|
+
'config/acp/workspace/AGENTS.md',
|
|
119
|
+
'config/opencode/workspace/AGENTS.md',
|
|
120
|
+
'config/qoder/workspace/AGENTS.md',
|
|
121
|
+
'config/kimi/workspace/AGENTS.md',
|
|
122
|
+
'CONTRIBUTING.md',
|
|
123
|
+
'docs/architecture.md',
|
|
124
|
+
'docs/architecture-overview.png',
|
|
125
|
+
'NOTICE',
|
|
126
|
+
'PRIVACY.md',
|
|
127
|
+
'SECURITY.md',
|
|
128
|
+
'THIRD_PARTY_NOTICES.md',
|
|
129
|
+
'scripts/audit-dependencies.mjs',
|
|
130
|
+
'scripts/check-desktop-release-env.mjs',
|
|
131
|
+
'scripts/codex-acp',
|
|
132
|
+
'scripts/claude-code-acp',
|
|
133
|
+
'scripts/install-global.mjs',
|
|
134
|
+
'scripts/opencode-acp',
|
|
135
|
+
'scripts/prepare-build.mjs',
|
|
136
|
+
'server/src/agent/acp-backend-adapter.mjs',
|
|
137
|
+
'server/src/agent/acp-process-client.mjs',
|
|
138
|
+
'server/src/agent/acp-session-registry.mjs',
|
|
139
|
+
'server/src/agent/acp-session-tools.mjs',
|
|
140
|
+
'server/src/core/package-version.mjs',
|
|
141
|
+
'server/src/index.mjs',
|
|
142
|
+
'shared/runtime-environment.mjs',
|
|
143
|
+
'tui/src/index.mjs',
|
|
144
|
+
'web/dist/index.html',
|
|
145
|
+
]
|
|
146
|
+
const missing = required.filter(file => !files.has(file))
|
|
147
|
+
if (missing.length) {
|
|
148
|
+
throw new Error(`npm 成品缺少必要文件:${missing.join(', ')}`)
|
|
149
|
+
}
|
|
150
|
+
const forbidden = [...files].filter(file => (
|
|
151
|
+
file.includes('/__pycache__/')
|
|
152
|
+
|| file.endsWith('.pyc')
|
|
153
|
+
|| file.includes('/node_modules/')
|
|
154
|
+
|| file.startsWith('desktop/src/')
|
|
155
|
+
))
|
|
156
|
+
if (forbidden.length) {
|
|
157
|
+
throw new Error(`npm 成品包含不应发布的文件:${forbidden.join(', ')}`)
|
|
158
|
+
}
|
|
159
|
+
const brokenMarkdownLinks = []
|
|
160
|
+
for (const file of files) {
|
|
161
|
+
if (!file.endsWith('.md')) continue
|
|
162
|
+
const content = readFileSync(resolve(root, file), 'utf8')
|
|
163
|
+
for (const match of content.matchAll(/\[[^\]]*\]\(([^)]+)\)/g)) {
|
|
164
|
+
const target = match[1].trim().replace(/^<|>$/g, '').split('#')[0]
|
|
165
|
+
if (!target || /^[a-z][a-z\d+.-]*:/i.test(target)) continue
|
|
166
|
+
const packagedTarget = posix.normalize(posix.join(posix.dirname(file), target))
|
|
167
|
+
if (!files.has(packagedTarget)) {
|
|
168
|
+
brokenMarkdownLinks.push(`${file} -> ${packagedTarget}`)
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (brokenMarkdownLinks.length) {
|
|
173
|
+
throw new Error(
|
|
174
|
+
`npm 成品包含失效的 Markdown 链接:${brokenMarkdownLinks.join(', ')}`,
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
process.stdout.write(
|
|
179
|
+
`npm 成品自检通过:${packages[0].filename},共 ${files.size} 个文件。\n`,
|
|
180
|
+
)
|
|
181
|
+
}
|
package/server/package.json
CHANGED
|
@@ -263,8 +263,7 @@ export class Coordinator {
|
|
|
263
263
|
return {
|
|
264
264
|
content: decision.presentation.speech,
|
|
265
265
|
metadata: {
|
|
266
|
-
|
|
267
|
-
decision,
|
|
266
|
+
presentation: decision.presentation,
|
|
268
267
|
},
|
|
269
268
|
}
|
|
270
269
|
}
|
|
@@ -289,8 +288,7 @@ export class Coordinator {
|
|
|
289
288
|
return {
|
|
290
289
|
content: decision.presentation.speech,
|
|
291
290
|
metadata: {
|
|
292
|
-
|
|
293
|
-
decision,
|
|
291
|
+
presentation: decision.presentation,
|
|
294
292
|
},
|
|
295
293
|
}
|
|
296
294
|
}
|
|
@@ -12,11 +12,14 @@ const sourceRoot = resolve(here, '../../..')
|
|
|
12
12
|
const root = process.env.QWEN_AUDIO_AGENT_RUNTIME_ROOT || sourceRoot
|
|
13
13
|
const runtimeEnvironment = loadRuntimeEnvironment({ root })
|
|
14
14
|
|
|
15
|
-
function numberSetting(value, fallback, {
|
|
15
|
+
export function numberSetting(value, fallback, {
|
|
16
16
|
min = Number.NEGATIVE_INFINITY,
|
|
17
17
|
max = Number.POSITIVE_INFINITY,
|
|
18
18
|
} = {}) {
|
|
19
|
-
|
|
19
|
+
if (value === null || value === undefined) return fallback
|
|
20
|
+
const source = typeof value === 'string' ? value.trim() : value
|
|
21
|
+
if (source === '') return fallback
|
|
22
|
+
const parsed = Number(source)
|
|
20
23
|
if (!Number.isFinite(parsed)) return fallback
|
|
21
24
|
return Math.min(max, Math.max(min, parsed))
|
|
22
25
|
}
|
|
@@ -13,6 +13,28 @@ const ACTIVE = new Set([
|
|
|
13
13
|
const CANCELLABLE = new Set(['queued', 'running', 'delegated', 'finalizing'])
|
|
14
14
|
const TERMINAL = new Set(['completed', 'failed', 'cancelled'])
|
|
15
15
|
|
|
16
|
+
function publicResultMetadata(metadata) {
|
|
17
|
+
if (!metadata || typeof metadata !== 'object') return null
|
|
18
|
+
const source = metadata.presentation || metadata.decision?.presentation
|
|
19
|
+
if (!source || typeof source !== 'object') return null
|
|
20
|
+
const inline = source.inline && typeof source.inline === 'object'
|
|
21
|
+
&& typeof source.inline.content === 'string'
|
|
22
|
+
&& source.inline.content.trim()
|
|
23
|
+
? {
|
|
24
|
+
title: typeof source.inline.title === 'string'
|
|
25
|
+
? source.inline.title.slice(0, 120)
|
|
26
|
+
: '',
|
|
27
|
+
format: ['markdown', 'code', 'link'].includes(source.inline.format)
|
|
28
|
+
? source.inline.format
|
|
29
|
+
: 'markdown',
|
|
30
|
+
content: source.inline.content,
|
|
31
|
+
}
|
|
32
|
+
: null
|
|
33
|
+
const speech = typeof source.speech === 'string' ? source.speech : ''
|
|
34
|
+
if (!speech && !inline) return null
|
|
35
|
+
return { presentation: { speech, inline } }
|
|
36
|
+
}
|
|
37
|
+
|
|
16
38
|
function publicTask(task) {
|
|
17
39
|
const now = Date.now()
|
|
18
40
|
return {
|
|
@@ -34,7 +56,7 @@ function publicTask(task) {
|
|
|
34
56
|
: task.elapsedMs,
|
|
35
57
|
result: task.result,
|
|
36
58
|
error: task.error,
|
|
37
|
-
resultMetadata: task.resultMetadata
|
|
59
|
+
resultMetadata: publicResultMetadata(task.resultMetadata),
|
|
38
60
|
activity: [...(task.activity || [])],
|
|
39
61
|
delegation: task.delegation
|
|
40
62
|
? {
|