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.
- package/CONTRIBUTING.md +58 -0
- package/LICENSE +201 -0
- package/NOTICE +5 -0
- package/PRIVACY.md +34 -0
- package/README.md +282 -0
- package/README_EN.md +316 -0
- package/SECURITY.md +32 -0
- package/THIRD_PARTY_NOTICES.md +26 -0
- package/cli/bin/qwenaudio.mjs +10 -0
- package/cli/package.json +13 -0
- package/cli/src/arguments.mjs +247 -0
- package/cli/src/gateway-service.mjs +386 -0
- package/cli/src/instance-lock.mjs +65 -0
- package/cli/src/launcher.mjs +217 -0
- package/cli/src/runtime.mjs +356 -0
- package/cli/src/webui.mjs +61 -0
- package/config/acp/workspace/AGENTS.md +13 -0
- package/config/codebuddy/workspace/.codebuddy/models.json +19 -0
- package/config/codebuddy/workspace/AGENTS.md +13 -0
- package/config/codex/workspace/AGENTS.md +13 -0
- package/config/frontend-agent/PROMPT.md +127 -0
- package/config/hermes/workspace/AGENTS.md +13 -0
- package/config/openclaw/openclaw.json5 +50 -0
- package/config/openclaw/workspace/AGENTS.md +9 -0
- package/config/opencode/agents/qwen-audio-agent-backend.md +65 -0
- package/config/opencode/workspace/AGENTS.md +16 -0
- package/config/qoder/workspace/AGENTS.md +16 -0
- package/docs/architecture-overview-en.png +0 -0
- package/docs/architecture-overview.png +0 -0
- package/docs/architecture.md +332 -0
- package/docs/configuration.md +386 -0
- package/docs/desktop-fluid-orb-thinking.gif +0 -0
- package/docs/desktop-goo-orb-thinking.gif +0 -0
- package/docs/qwen-audio-agent-three-layer-architecture-en.png +0 -0
- package/docs/qwen-audio-agent-three-layer-architecture.png +0 -0
- package/package.json +126 -0
- package/scripts/audit-dependencies.mjs +109 -0
- package/scripts/check-desktop-release-env.mjs +41 -0
- package/scripts/codex-acp +58 -0
- package/scripts/install-global.mjs +66 -0
- package/scripts/openclaw +194 -0
- package/scripts/openclaw-gateway +8 -0
- package/scripts/opencode-acp +6 -0
- package/scripts/opencode-server +179 -0
- package/scripts/prepare-build.mjs +38 -0
- package/scripts/release-check +182 -0
- package/scripts/set-version.mjs +133 -0
- package/scripts/start.mjs +43 -0
- package/scripts/verify-package.mjs +109 -0
- package/server/package.json +18 -0
- package/server/src/agent/acp-backend-adapter.mjs +1138 -0
- package/server/src/agent/acp-backend-profile.mjs +35 -0
- package/server/src/agent/acp-backend-session-utils.mjs +139 -0
- package/server/src/agent/acp-process-client.mjs +447 -0
- package/server/src/agent/acp-session-registry.mjs +106 -0
- package/server/src/agent/acp-session-tools.mjs +257 -0
- package/server/src/agent/agent-client.mjs +218 -0
- package/server/src/agent/backend-adapter.mjs +15 -0
- package/server/src/agent/backend-agent-instructions.mjs +8 -0
- package/server/src/agent/backends/codebuddy.mjs +47 -0
- package/server/src/agent/backends/codex.mjs +62 -0
- package/server/src/agent/backends/generic-acp.mjs +46 -0
- package/server/src/agent/backends/hermes.mjs +29 -0
- package/server/src/agent/backends/openclaw.mjs +101 -0
- package/server/src/agent/backends/opencode.mjs +36 -0
- package/server/src/agent/backends/qoder.mjs +47 -0
- package/server/src/agent/backends/registry.mjs +32 -0
- package/server/src/agent/backends/shared.mjs +46 -0
- package/server/src/agent/coordinator.mjs +308 -0
- package/server/src/agent/openclaw-adapter.mjs +245 -0
- package/server/src/app/bootstrap.mjs +244 -0
- package/server/src/conversation/conversation-sync.mjs +183 -0
- package/server/src/conversation/frontend-agent-context.mjs +162 -0
- package/server/src/conversation/frontend-memory.mjs +328 -0
- package/server/src/conversation/profiled-memory-store.mjs +87 -0
- package/server/src/conversation/task-result-projector.mjs +18 -0
- package/server/src/conversation/user-profile.mjs +234 -0
- package/server/src/core/config.mjs +388 -0
- package/server/src/core/identity.mjs +93 -0
- package/server/src/core/install-paths.mjs +8 -0
- package/server/src/core/package-version.mjs +10 -0
- package/server/src/core/request-security.mjs +80 -0
- package/server/src/index.mjs +67 -0
- package/server/src/process/backend-drivers/codebuddy.mjs +15 -0
- package/server/src/process/backend-drivers/codex.mjs +15 -0
- package/server/src/process/backend-drivers/generic-acp.mjs +18 -0
- package/server/src/process/backend-drivers/hermes.mjs +15 -0
- package/server/src/process/backend-drivers/openclaw.mjs +35 -0
- package/server/src/process/backend-drivers/opencode.mjs +75 -0
- package/server/src/process/backend-drivers/qoder.mjs +15 -0
- package/server/src/process/backend-drivers/registry.mjs +24 -0
- package/server/src/process/backend-drivers/shared.mjs +46 -0
- package/server/src/process/managed-backend.mjs +188 -0
- package/server/src/task/task-manager.mjs +704 -0
- package/server/src/task/task-scheduler.mjs +44 -0
- package/server/src/task/task-store.mjs +167 -0
- package/server/src/voice/active-voice-clients.mjs +58 -0
- package/server/src/voice/announcement/announcement-manager.mjs +402 -0
- package/server/src/voice/announcement/announcement-window.mjs +89 -0
- package/server/src/voice/input-transcript.mjs +9 -0
- package/server/src/voice/realtime-errors.mjs +6 -0
- package/server/src/voice/realtime-gateway.mjs +1366 -0
- package/server/src/voice/realtime-provider.mjs +771 -0
- package/server/src/voice/reconnect-backoff.mjs +30 -0
- package/server/src/voice/response-context.mjs +41 -0
- package/server/src/voice/session-permission-policy.mjs +56 -0
- package/server/src/voice/tools/tool-call-handler.mjs +823 -0
- package/server/src/voice/tools/turn-transcripts.mjs +59 -0
- package/server/src/voice/turn-correlation.mjs +41 -0
- package/shared/backend-catalog.mjs +56 -0
- package/shared/gateway-client.mjs +13 -0
- package/shared/realtime-events.mjs +55 -0
- package/shared/runtime-environment.mjs +422 -0
- package/tui/native/macos-voice-io.swift +552 -0
- package/tui/native/portaudio-voice-io.py +240 -0
- package/tui/package.json +13 -0
- package/tui/src/index.mjs +1217 -0
- package/tui/src/macos-voice-io.mjs +186 -0
- package/tui/src/portaudio-voice-io.mjs +158 -0
- package/web/dist/assets/index-BeamDvsE.js +38 -0
- package/web/dist/assets/index-BuB0EFih.css +1 -0
- package/web/dist/index.html +14 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
QWEN_AUDIO_AGENT_ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
5
|
+
cd "$QWEN_AUDIO_AGENT_ROOT"
|
|
6
|
+
|
|
7
|
+
node <<'NODE'
|
|
8
|
+
const { readFileSync } = require('node:fs')
|
|
9
|
+
const { execFileSync } = require('node:child_process')
|
|
10
|
+
|
|
11
|
+
const rootManifest = JSON.parse(readFileSync('package.json', 'utf8'))
|
|
12
|
+
const expected = rootManifest.version
|
|
13
|
+
if (!/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:0|[1-9]\d*|[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|[A-Za-z-][0-9A-Za-z-]*))*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.test(expected)) {
|
|
14
|
+
throw new Error(`package.json has invalid release version ${expected}`)
|
|
15
|
+
}
|
|
16
|
+
const manifests = [
|
|
17
|
+
'package.json',
|
|
18
|
+
'server/package.json',
|
|
19
|
+
'web/package.json',
|
|
20
|
+
'tui/package.json',
|
|
21
|
+
'desktop/package.json',
|
|
22
|
+
'cli/package.json',
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
for (const file of manifests) {
|
|
26
|
+
const manifest = JSON.parse(readFileSync(file, 'utf8'))
|
|
27
|
+
if (manifest.version !== expected) {
|
|
28
|
+
throw new Error(`${file} has version ${manifest.version}; expected ${expected}`)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
for (const file of ['README.md', 'README_EN.md']) {
|
|
32
|
+
if (!readFileSync(file, 'utf8').includes(
|
|
33
|
+
`img.shields.io/badge/npm-v${expected}-orange`,
|
|
34
|
+
)) {
|
|
35
|
+
throw new Error(`${file} npm badge does not match ${expected}`)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const lock = JSON.parse(readFileSync('package-lock.json', 'utf8'))
|
|
40
|
+
if (lock.version !== expected || lock.packages?.['']?.version !== expected) {
|
|
41
|
+
throw new Error('package-lock.json does not match the release version')
|
|
42
|
+
}
|
|
43
|
+
for (const workspace of [
|
|
44
|
+
'server',
|
|
45
|
+
'web',
|
|
46
|
+
'tui',
|
|
47
|
+
'desktop',
|
|
48
|
+
'cli',
|
|
49
|
+
]) {
|
|
50
|
+
if (lock.packages?.[workspace]?.version !== expected) {
|
|
51
|
+
throw new Error(`package-lock.json has the wrong version for ${workspace}`)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const manifest = JSON.parse(readFileSync('package.json', 'utf8'))
|
|
56
|
+
const publicRepository = 'git+https://github.com/QwenAudio/qwen-audio-agent.git'
|
|
57
|
+
const publicRegistry = 'https://registry.npmjs.org/'
|
|
58
|
+
if (manifest.repository?.url !== publicRepository) {
|
|
59
|
+
throw new Error('package.json does not point to the public GitHub repository')
|
|
60
|
+
}
|
|
61
|
+
if (manifest.publishConfig?.registry !== publicRegistry) {
|
|
62
|
+
throw new Error('package.json does not force publishing to the public npm registry')
|
|
63
|
+
}
|
|
64
|
+
if (manifest.publishConfig?.access !== 'public') {
|
|
65
|
+
throw new Error('package.json is not configured for public npm access')
|
|
66
|
+
}
|
|
67
|
+
if (readFileSync('.npmrc', 'utf8').trim() !== 'registry=https://registry.npmjs.org/') {
|
|
68
|
+
throw new Error('.npmrc does not select the public npm registry')
|
|
69
|
+
}
|
|
70
|
+
if (manifest.main !== undefined) {
|
|
71
|
+
throw new Error('CLI package must not expose the Electron process as its main entry')
|
|
72
|
+
}
|
|
73
|
+
if (readFileSync('.nvmrc', 'utf8').trim() !== '22.22.2') {
|
|
74
|
+
throw new Error('.nvmrc does not match the minimum supported Node release')
|
|
75
|
+
}
|
|
76
|
+
if (!readFileSync('scripts/opencode-server', 'utf8').includes('opencode-ai@1.18.5')) {
|
|
77
|
+
throw new Error('OpenCode fallback package is not pinned')
|
|
78
|
+
}
|
|
79
|
+
if (!readFileSync('scripts/openclaw', 'utf8').includes('openclaw@2026.6.33')) {
|
|
80
|
+
throw new Error('OpenClaw fallback package is not pinned')
|
|
81
|
+
}
|
|
82
|
+
if (!readFileSync('scripts/codex-acp', 'utf8').includes(
|
|
83
|
+
'@agentclientprotocol/codex-acp@1.1.7',
|
|
84
|
+
)) {
|
|
85
|
+
throw new Error('Codex ACP fallback package is not pinned')
|
|
86
|
+
}
|
|
87
|
+
if (
|
|
88
|
+
manifest.devDependencies?.['electron-builder'] !== '26.15.7'
|
|
89
|
+
|| manifest.overrides?.['@electron/asar'] !== '4.2.1'
|
|
90
|
+
|| manifest.overrides?.['@electron/universal'] !== '3.0.6'
|
|
91
|
+
) {
|
|
92
|
+
throw new Error('desktop build dependencies are not pinned to the reviewed versions')
|
|
93
|
+
}
|
|
94
|
+
if (
|
|
95
|
+
manifest.scripts?.prepare !== 'node scripts/prepare-build.mjs'
|
|
96
|
+
|| !manifest.scripts?.build?.includes('--no-global')
|
|
97
|
+
) {
|
|
98
|
+
throw new Error('npm and GitHub installation build lifecycle is not portable')
|
|
99
|
+
}
|
|
100
|
+
if (
|
|
101
|
+
manifest.scripts['desktop:build'].includes('hardenedRuntime=false')
|
|
102
|
+
|| !manifest.scripts['desktop:build:local'].includes('hardenedRuntime=false')
|
|
103
|
+
) {
|
|
104
|
+
throw new Error('signed and local-only desktop build commands are not separated')
|
|
105
|
+
}
|
|
106
|
+
const desktopBuildConfig = readFileSync('desktop/electron-builder.yml', 'utf8')
|
|
107
|
+
const appEntitlements = readFileSync(
|
|
108
|
+
'desktop/build/entitlements.mac.plist',
|
|
109
|
+
'utf8',
|
|
110
|
+
)
|
|
111
|
+
const inheritedEntitlements = readFileSync(
|
|
112
|
+
'desktop/build/entitlements.mac.inherit.plist',
|
|
113
|
+
'utf8',
|
|
114
|
+
)
|
|
115
|
+
if (
|
|
116
|
+
!desktopBuildConfig.includes(
|
|
117
|
+
'entitlementsInherit: desktop/build/entitlements.mac.inherit.plist',
|
|
118
|
+
)
|
|
119
|
+
|| !appEntitlements.includes('com.apple.security.cs.allow-jit')
|
|
120
|
+
|| !inheritedEntitlements.includes('com.apple.security.cs.allow-jit')
|
|
121
|
+
) {
|
|
122
|
+
throw new Error('signed Electron builds do not include the required JIT entitlements')
|
|
123
|
+
}
|
|
124
|
+
if (
|
|
125
|
+
!readFileSync('.github/workflows/release.yml', 'utf8')
|
|
126
|
+
.includes('GH_REPO: ${{ github.repository }}')
|
|
127
|
+
) {
|
|
128
|
+
throw new Error('GitHub release job does not explicitly select its repository')
|
|
129
|
+
}
|
|
130
|
+
for (const workflow of [
|
|
131
|
+
'.github/workflows/ci.yml',
|
|
132
|
+
'.github/workflows/release.yml',
|
|
133
|
+
]) {
|
|
134
|
+
const content = readFileSync(workflow, 'utf8')
|
|
135
|
+
const unpinnedAction = content.match(/uses:\s+[^#\s]+@(?![0-9a-f]{40}(?:\s|#|$))\S+/)
|
|
136
|
+
if (unpinnedAction) {
|
|
137
|
+
throw new Error(`${workflow} contains an unpinned action: ${unpinnedAction[0]}`)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const forbiddenFragments = [
|
|
142
|
+
['gitlab.alibaba', '-inc.com'].join(''),
|
|
143
|
+
['registry.anpm.alibaba', '-inc.com'].join(''),
|
|
144
|
+
['lx', '513821'].join(''),
|
|
145
|
+
['github.com/Qwen', 'LM/qwen-audio-agent'].join(''),
|
|
146
|
+
]
|
|
147
|
+
const trackedFiles = execFileSync('git', ['ls-files', '-z'])
|
|
148
|
+
.toString()
|
|
149
|
+
.split('\0')
|
|
150
|
+
.filter(Boolean)
|
|
151
|
+
for (const file of trackedFiles) {
|
|
152
|
+
let content
|
|
153
|
+
try {
|
|
154
|
+
content = readFileSync(file, 'utf8')
|
|
155
|
+
} catch {
|
|
156
|
+
continue
|
|
157
|
+
}
|
|
158
|
+
for (const fragment of forbiddenFragments) {
|
|
159
|
+
if (content.includes(fragment)) {
|
|
160
|
+
throw new Error(`${file} contains private repository metadata`)
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
NODE
|
|
166
|
+
|
|
167
|
+
sh -n scripts/opencode-server
|
|
168
|
+
sh -n scripts/openclaw
|
|
169
|
+
sh -n scripts/openclaw-gateway
|
|
170
|
+
node --check shared/runtime-environment.mjs
|
|
171
|
+
node --check cli/src/runtime.mjs
|
|
172
|
+
git diff --check
|
|
173
|
+
npm run audit:release
|
|
174
|
+
npm test
|
|
175
|
+
npm run build
|
|
176
|
+
node scripts/verify-package.mjs
|
|
177
|
+
|
|
178
|
+
QWEN_AUDIO_AGENT_RELEASE_VERSION=$(
|
|
179
|
+
node -p "require('./package.json').version"
|
|
180
|
+
)
|
|
181
|
+
printf '%s\n' \
|
|
182
|
+
"qwen-audio-agent ${QWEN_AUDIO_AGENT_RELEASE_VERSION} release checks passed."
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
existsSync,
|
|
5
|
+
readFileSync,
|
|
6
|
+
renameSync,
|
|
7
|
+
unlinkSync,
|
|
8
|
+
writeFileSync,
|
|
9
|
+
} from 'node:fs'
|
|
10
|
+
import { dirname, resolve } from 'node:path'
|
|
11
|
+
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
12
|
+
|
|
13
|
+
const SCRIPT_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
|
14
|
+
const WORKSPACES = ['server', 'web', 'tui', 'desktop', 'cli']
|
|
15
|
+
const MANIFESTS = [
|
|
16
|
+
'package.json',
|
|
17
|
+
...WORKSPACES.map(workspace => `${workspace}/package.json`),
|
|
18
|
+
]
|
|
19
|
+
const VERSION_PATTERN = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:0|[1-9]\d*|[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|[a-zA-Z-][0-9a-zA-Z-]*))*)?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/
|
|
20
|
+
|
|
21
|
+
export function isValidVersion(version) {
|
|
22
|
+
return VERSION_PATTERN.test(String(version))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function nextVersion(current, requested) {
|
|
26
|
+
if (isValidVersion(requested)) return requested
|
|
27
|
+
if (!['patch', 'minor', 'major'].includes(requested)) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
'请指定完整版本号或 patch、minor、major,例如:'
|
|
30
|
+
+ 'npm run version:set -- 0.5.1',
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
if (!isValidVersion(current)) {
|
|
34
|
+
throw new Error(`当前版本号无效:${current}`)
|
|
35
|
+
}
|
|
36
|
+
const [major, minor, patch] = current
|
|
37
|
+
.split('-', 1)[0]
|
|
38
|
+
.split('.')
|
|
39
|
+
.map(Number)
|
|
40
|
+
if (requested === 'major') return `${major + 1}.0.0`
|
|
41
|
+
if (requested === 'minor') return `${major}.${minor + 1}.0`
|
|
42
|
+
return `${major}.${minor}.${patch + 1}`
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function readJson(path) {
|
|
46
|
+
return JSON.parse(readFileSync(path, 'utf8'))
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function serializeJson(value) {
|
|
50
|
+
return `${JSON.stringify(value, null, 2)}\n`
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function writeAtomic(path, content) {
|
|
54
|
+
const temporaryPath = `${path}.${process.pid}.tmp`
|
|
55
|
+
try {
|
|
56
|
+
writeFileSync(temporaryPath, content)
|
|
57
|
+
renameSync(temporaryPath, path)
|
|
58
|
+
} catch (error) {
|
|
59
|
+
try {
|
|
60
|
+
unlinkSync(temporaryPath)
|
|
61
|
+
} catch {
|
|
62
|
+
// The temporary file may not have been created.
|
|
63
|
+
}
|
|
64
|
+
throw error
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function updateVersions(root, requested) {
|
|
69
|
+
const rootManifest = readJson(resolve(root, 'package.json'))
|
|
70
|
+
const version = nextVersion(rootManifest.version, requested)
|
|
71
|
+
const updates = MANIFESTS.map(relativePath => {
|
|
72
|
+
const path = resolve(root, relativePath)
|
|
73
|
+
const manifest = readJson(path)
|
|
74
|
+
if (!manifest.name) {
|
|
75
|
+
throw new Error(`${relativePath} 缺少 package name`)
|
|
76
|
+
}
|
|
77
|
+
manifest.version = version
|
|
78
|
+
return { path, content: serializeJson(manifest) }
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
const lockPath = resolve(root, 'package-lock.json')
|
|
82
|
+
const lock = readJson(lockPath)
|
|
83
|
+
if (!lock.packages?.['']) {
|
|
84
|
+
throw new Error('package-lock.json 缺少根包记录')
|
|
85
|
+
}
|
|
86
|
+
lock.version = version
|
|
87
|
+
lock.packages[''].version = version
|
|
88
|
+
for (const workspace of WORKSPACES) {
|
|
89
|
+
if (!lock.packages[workspace]) {
|
|
90
|
+
throw new Error(`package-lock.json 缺少 workspace:${workspace}`)
|
|
91
|
+
}
|
|
92
|
+
lock.packages[workspace].version = version
|
|
93
|
+
}
|
|
94
|
+
updates.push({ path: lockPath, content: serializeJson(lock) })
|
|
95
|
+
|
|
96
|
+
for (const relativePath of ['README.md', 'README_EN.md']) {
|
|
97
|
+
const path = resolve(root, relativePath)
|
|
98
|
+
if (!existsSync(path)) continue
|
|
99
|
+
const content = readFileSync(path, 'utf8')
|
|
100
|
+
const updated = content.replace(
|
|
101
|
+
/img\.shields\.io\/badge\/npm-v[^-)]+-orange/g,
|
|
102
|
+
`img.shields.io/badge/npm-v${version}-orange`,
|
|
103
|
+
)
|
|
104
|
+
updates.push({ path, content: updated })
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
for (const update of updates) writeAtomic(update.path, update.content)
|
|
108
|
+
return {
|
|
109
|
+
previousVersion: rootManifest.version,
|
|
110
|
+
version,
|
|
111
|
+
changed: rootManifest.version !== version,
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const isMain = process.argv[1]
|
|
116
|
+
&& import.meta.url === pathToFileURL(process.argv[1]).href
|
|
117
|
+
|
|
118
|
+
if (isMain) {
|
|
119
|
+
try {
|
|
120
|
+
const result = updateVersions(SCRIPT_ROOT, process.argv[2])
|
|
121
|
+
if (result.changed) {
|
|
122
|
+
process.stdout.write(
|
|
123
|
+
`版本已更新:${result.previousVersion} → ${result.version}\n`
|
|
124
|
+
+ `请更新 CHANGELOG.md,然后运行 npm run release:check。\n`,
|
|
125
|
+
)
|
|
126
|
+
} else {
|
|
127
|
+
process.stdout.write(`版本已经是 ${result.version}。\n`)
|
|
128
|
+
}
|
|
129
|
+
} catch (error) {
|
|
130
|
+
process.stderr.write(`版本更新失败:${error.message}\n`)
|
|
131
|
+
process.exitCode = 1
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { dirname, resolve } from 'node:path'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
5
|
+
import { loadRuntimeEnvironment } from '../shared/runtime-environment.mjs'
|
|
6
|
+
import { ensureRuntime } from '../cli/src/runtime.mjs'
|
|
7
|
+
|
|
8
|
+
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
|
9
|
+
loadRuntimeEnvironment({ root })
|
|
10
|
+
const listenHost = process.env.HOST || '127.0.0.1'
|
|
11
|
+
const port = process.env.PORT || '3101'
|
|
12
|
+
const probeHost = ['0.0.0.0', '::', '[::]'].includes(listenHost)
|
|
13
|
+
? '127.0.0.1'
|
|
14
|
+
: listenHost
|
|
15
|
+
const url = process.env.QWEN_AUDIO_AGENT_URL
|
|
16
|
+
|| `http://${probeHost}:${port}`
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
const runtime = await ensureRuntime({
|
|
20
|
+
url,
|
|
21
|
+
listenHost,
|
|
22
|
+
listenPort: port,
|
|
23
|
+
}, { root })
|
|
24
|
+
if (!runtime.ownsProcesses) {
|
|
25
|
+
process.stdout.write(`qwen-audio-agent 已在运行:${url}\n`)
|
|
26
|
+
} else {
|
|
27
|
+
process.stdout.write(`qwen-audio-agent 已就绪:${url}\n`)
|
|
28
|
+
const onSigint = () => runtime.close('SIGINT')
|
|
29
|
+
const onSigterm = () => runtime.close('SIGTERM')
|
|
30
|
+
process.once('SIGINT', onSigint)
|
|
31
|
+
process.once('SIGTERM', onSigterm)
|
|
32
|
+
try {
|
|
33
|
+
process.exitCode = await runtime.wait()
|
|
34
|
+
} finally {
|
|
35
|
+
process.off('SIGINT', onSigint)
|
|
36
|
+
process.off('SIGTERM', onSigterm)
|
|
37
|
+
runtime.close()
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
} catch (error) {
|
|
41
|
+
process.stderr.write(`qwen-audio-agent 启动失败:${error.message}\n`)
|
|
42
|
+
process.exitCode = 1
|
|
43
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawnSync } from 'node:child_process'
|
|
4
|
+
import { dirname, posix, resolve } from 'node:path'
|
|
5
|
+
import { fileURLToPath } from 'node:url'
|
|
6
|
+
import { readFileSync } from 'node:fs'
|
|
7
|
+
|
|
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
|
+
|
|
32
|
+
const jsonStart = result.stdout.lastIndexOf('[\n {\n "id":')
|
|
33
|
+
if (jsonStart < 0) {
|
|
34
|
+
process.stderr.write(result.stdout)
|
|
35
|
+
throw new Error('npm pack 输出中缺少成品 JSON')
|
|
36
|
+
}
|
|
37
|
+
const packages = JSON.parse(result.stdout.slice(jsonStart))
|
|
38
|
+
if (packages.length !== 1) throw new Error('npm pack 返回了意外的包数量')
|
|
39
|
+
const files = new Set(packages[0].files.map(file => file.path))
|
|
40
|
+
const required = [
|
|
41
|
+
'cli/bin/qwenaudio.mjs',
|
|
42
|
+
'config/openclaw/openclaw.json5',
|
|
43
|
+
'config/openclaw/workspace/AGENTS.md',
|
|
44
|
+
'config/hermes/workspace/AGENTS.md',
|
|
45
|
+
'config/codebuddy/workspace/AGENTS.md',
|
|
46
|
+
'config/codebuddy/workspace/.codebuddy/models.json',
|
|
47
|
+
'config/codex/workspace/AGENTS.md',
|
|
48
|
+
'config/acp/workspace/AGENTS.md',
|
|
49
|
+
'config/opencode/agents/qwen-audio-agent-backend.md',
|
|
50
|
+
'config/opencode/workspace/AGENTS.md',
|
|
51
|
+
'config/qoder/workspace/AGENTS.md',
|
|
52
|
+
'CONTRIBUTING.md',
|
|
53
|
+
'docs/architecture.md',
|
|
54
|
+
'docs/architecture-overview.png',
|
|
55
|
+
'NOTICE',
|
|
56
|
+
'PRIVACY.md',
|
|
57
|
+
'SECURITY.md',
|
|
58
|
+
'THIRD_PARTY_NOTICES.md',
|
|
59
|
+
'scripts/audit-dependencies.mjs',
|
|
60
|
+
'scripts/check-desktop-release-env.mjs',
|
|
61
|
+
'scripts/codex-acp',
|
|
62
|
+
'scripts/install-global.mjs',
|
|
63
|
+
'scripts/opencode-acp',
|
|
64
|
+
'scripts/prepare-build.mjs',
|
|
65
|
+
'server/src/agent/acp-backend-adapter.mjs',
|
|
66
|
+
'server/src/agent/acp-process-client.mjs',
|
|
67
|
+
'server/src/agent/acp-session-registry.mjs',
|
|
68
|
+
'server/src/agent/acp-session-tools.mjs',
|
|
69
|
+
'server/src/core/package-version.mjs',
|
|
70
|
+
'server/src/index.mjs',
|
|
71
|
+
'shared/runtime-environment.mjs',
|
|
72
|
+
'tui/src/index.mjs',
|
|
73
|
+
'web/dist/index.html',
|
|
74
|
+
]
|
|
75
|
+
const missing = required.filter(file => !files.has(file))
|
|
76
|
+
if (missing.length) {
|
|
77
|
+
throw new Error(`npm 成品缺少必要文件:${missing.join(', ')}`)
|
|
78
|
+
}
|
|
79
|
+
const forbidden = [...files].filter(file => (
|
|
80
|
+
file.includes('/__pycache__/')
|
|
81
|
+
|| file.endsWith('.pyc')
|
|
82
|
+
|| file.includes('/node_modules/')
|
|
83
|
+
|| file.startsWith('desktop/src/')
|
|
84
|
+
))
|
|
85
|
+
if (forbidden.length) {
|
|
86
|
+
throw new Error(`npm 成品包含不应发布的文件:${forbidden.join(', ')}`)
|
|
87
|
+
}
|
|
88
|
+
const brokenMarkdownLinks = []
|
|
89
|
+
for (const file of files) {
|
|
90
|
+
if (!file.endsWith('.md')) continue
|
|
91
|
+
const content = readFileSync(resolve(root, file), 'utf8')
|
|
92
|
+
for (const match of content.matchAll(/\[[^\]]*\]\(([^)]+)\)/g)) {
|
|
93
|
+
const target = match[1].trim().replace(/^<|>$/g, '').split('#')[0]
|
|
94
|
+
if (!target || /^[a-z][a-z\d+.-]*:/i.test(target)) continue
|
|
95
|
+
const packagedTarget = posix.normalize(posix.join(posix.dirname(file), target))
|
|
96
|
+
if (!files.has(packagedTarget)) {
|
|
97
|
+
brokenMarkdownLinks.push(`${file} -> ${packagedTarget}`)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (brokenMarkdownLinks.length) {
|
|
102
|
+
throw new Error(
|
|
103
|
+
`npm 成品包含失效的 Markdown 链接:${brokenMarkdownLinks.join(', ')}`,
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
process.stdout.write(
|
|
108
|
+
`npm 成品自检通过:${packages[0].filename},共 ${files.size} 个文件。\n`,
|
|
109
|
+
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@qwen-audio-agent/server",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.9.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "node --watch src/index.mjs",
|
|
8
|
+
"start": "node src/index.mjs",
|
|
9
|
+
"test": "node --test"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@agentclientprotocol/sdk": "1.3.0",
|
|
13
|
+
"@modelcontextprotocol/sdk": "1.29.0",
|
|
14
|
+
"express": "^4.22.2",
|
|
15
|
+
"ws": "^8.21.1",
|
|
16
|
+
"zod": "^4.4.3"
|
|
17
|
+
}
|
|
18
|
+
}
|