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,30 @@
|
|
|
1
|
+
export class ReconnectBackoff {
|
|
2
|
+
constructor({
|
|
3
|
+
baseMs = 500,
|
|
4
|
+
maxMs = 10_000,
|
|
5
|
+
jitterRatio = 0.2,
|
|
6
|
+
random = Math.random,
|
|
7
|
+
} = {}) {
|
|
8
|
+
this.baseMs = baseMs
|
|
9
|
+
this.maxMs = maxMs
|
|
10
|
+
this.jitterRatio = jitterRatio
|
|
11
|
+
this.random = random
|
|
12
|
+
this.attempt = 0
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
next() {
|
|
16
|
+
const exponential = Math.min(
|
|
17
|
+
this.maxMs,
|
|
18
|
+
this.baseMs * (2 ** Math.min(this.attempt, 8)),
|
|
19
|
+
)
|
|
20
|
+
this.attempt += 1
|
|
21
|
+
const jitter = exponential * this.jitterRatio * (
|
|
22
|
+
(this.random() * 2) - 1
|
|
23
|
+
)
|
|
24
|
+
return Math.max(0, Math.round(exponential + jitter))
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
reset() {
|
|
28
|
+
this.attempt = 0
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
function pendingTranscripts(value) {
|
|
2
|
+
return Array.isArray(value) ? value : []
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function ensureResponseContext(contexts, id, fallback = {}) {
|
|
6
|
+
const existing = contexts.get(id)
|
|
7
|
+
if (existing) {
|
|
8
|
+
existing.pendingTranscripts = pendingTranscripts(existing.pendingTranscripts)
|
|
9
|
+
return existing
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const context = {
|
|
13
|
+
turnId: '',
|
|
14
|
+
taskId: null,
|
|
15
|
+
origin: 'model',
|
|
16
|
+
turnGeneration: -1,
|
|
17
|
+
playbackStarted: false,
|
|
18
|
+
playbackEnded: false,
|
|
19
|
+
responseDone: false,
|
|
20
|
+
transcriptDone: false,
|
|
21
|
+
...fallback,
|
|
22
|
+
pendingTranscripts: pendingTranscripts(fallback.pendingTranscripts),
|
|
23
|
+
}
|
|
24
|
+
contexts.set(id, context)
|
|
25
|
+
return context
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function mergeResponseContext(contexts, id, authoritative = {}) {
|
|
29
|
+
const existing = ensureResponseContext(contexts, id)
|
|
30
|
+
const context = {
|
|
31
|
+
...existing,
|
|
32
|
+
...authoritative,
|
|
33
|
+
playbackStarted: existing.playbackStarted,
|
|
34
|
+
playbackEnded: existing.playbackEnded,
|
|
35
|
+
responseDone: existing.responseDone,
|
|
36
|
+
transcriptDone: existing.transcriptDone,
|
|
37
|
+
pendingTranscripts: existing.pendingTranscripts,
|
|
38
|
+
}
|
|
39
|
+
contexts.set(id, context)
|
|
40
|
+
return context
|
|
41
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
function key(ownerId, sessionId) {
|
|
2
|
+
return `${String(ownerId || '')}\u0000${String(sessionId || 'main')}`
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export class SessionPermissionPolicy {
|
|
6
|
+
constructor({
|
|
7
|
+
maxSessions = 500,
|
|
8
|
+
ttlMs = 6 * 60 * 60 * 1000,
|
|
9
|
+
now = () => Date.now(),
|
|
10
|
+
} = {}) {
|
|
11
|
+
this.maxSessions = maxSessions
|
|
12
|
+
this.ttlMs = ttlMs
|
|
13
|
+
this.now = now
|
|
14
|
+
this.sessions = new Map()
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
prune() {
|
|
18
|
+
const now = this.now()
|
|
19
|
+
for (const [id, state] of this.sessions) {
|
|
20
|
+
if (now - state.updatedAt >= this.ttlMs) this.sessions.delete(id)
|
|
21
|
+
}
|
|
22
|
+
while (this.sessions.size > this.maxSessions) {
|
|
23
|
+
const oldest = [...this.sessions.entries()]
|
|
24
|
+
.sort((left, right) => left[1].updatedAt - right[1].updatedAt)[0]
|
|
25
|
+
if (!oldest) break
|
|
26
|
+
this.sessions.delete(oldest[0])
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
mode(ownerId, sessionId) {
|
|
31
|
+
this.prune()
|
|
32
|
+
return this.sessions.get(key(ownerId, sessionId))?.mode || 'ask'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
setMode(ownerId, sessionId, mode) {
|
|
36
|
+
const normalized = mode === 'auto_allow' ? 'auto_allow' : 'ask'
|
|
37
|
+
this.sessions.set(key(ownerId, sessionId), {
|
|
38
|
+
mode: normalized,
|
|
39
|
+
updatedAt: this.now(),
|
|
40
|
+
})
|
|
41
|
+
this.prune()
|
|
42
|
+
return normalized
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
applyDecision(ownerId, sessionId, decision) {
|
|
46
|
+
return this.setMode(
|
|
47
|
+
ownerId,
|
|
48
|
+
sessionId,
|
|
49
|
+
decision === 'always' ? 'auto_allow' : 'ask',
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
shouldAutoAllow(ownerId, sessionId) {
|
|
54
|
+
return this.mode(ownerId, sessionId) === 'auto_allow'
|
|
55
|
+
}
|
|
56
|
+
}
|