qwen-audio-agent 2.0.1 → 2.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 +21 -10
- package/README_ZH.md +19 -10
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/cli/package.json +1 -1
- package/cli/src/arguments.mjs +4 -1
- package/cli/src/config-command.mjs +36 -6
- package/cli/src/gateway-service.mjs +7 -1
- package/cli/src/launcher.mjs +13 -0
- package/config/frontend-agent/LIVE_PROMPT.md +64 -0
- package/config/frontend-agent/PROMPT.md +29 -26
- package/desktop/src/i18n.mjs +6 -1
- package/desktop/src/settings-config.mjs +32 -40
- package/desktop/src/settings-store.mjs +19 -28
- package/docs/architecture/deep-dive.md +103 -66
- package/docs/architecture/deep-dive.zh.md +73 -50
- package/docs/backends/configuration.md +4 -4
- package/docs/backends/configuration.zh.md +4 -4
- package/docs/backends/overview.md +3 -0
- package/docs/backends/overview.zh.md +3 -0
- package/docs/configuration/backend.md +15 -1
- package/docs/configuration/backend.zh.md +15 -1
- package/docs/configuration/frontend.md +78 -28
- package/docs/configuration/frontend.zh.md +76 -28
- package/docs/configuration.md +1 -1
- package/docs/configuration.zh.md +1 -1
- package/docs/contract.md +24 -2
- package/docs/contract.zh.md +20 -2
- package/docs/extensions.md +14 -0
- package/docs/extensions.zh.md +11 -0
- package/docs/gateway-protocol.md +26 -0
- package/docs/gateway-protocol.zh.md +22 -0
- package/docs/gateway-webrtc-client.md +3 -3
- package/docs/gateway-webrtc-client.zh.md +3 -3
- package/docs/getting-started/install.md +4 -1
- package/docs/getting-started/install.zh.md +4 -1
- package/docs/getting-started/mobile.md +8 -2
- package/docs/getting-started/mobile.zh.md +5 -0
- package/docs/getting-started/quickstart.md +2 -2
- package/docs/getting-started/quickstart.zh.md +2 -2
- package/docs/getting-started/webui.md +2 -0
- package/docs/getting-started/webui.zh.md +2 -0
- package/docs/guides/knowledge.md +8 -5
- package/docs/guides/knowledge.zh.md +4 -3
- package/docs/guides/tasks.md +63 -2
- package/docs/guides/tasks.zh.md +45 -1
- package/docs/guides/web-search.md +32 -1
- package/docs/guides/web-search.zh.md +28 -1
- package/docs/operations/troubleshooting.md +30 -0
- package/docs/operations/troubleshooting.zh.md +26 -0
- package/docs/reference/backend-adapter-sdk.md +33 -2
- package/docs/reference/backend-adapter-sdk.zh.md +29 -2
- package/docs/reference/cli.md +3 -3
- package/docs/reference/cli.zh.md +3 -3
- package/docs/scenarios/lightrag.md +2 -2
- package/docs/scenarios/lightrag.zh.md +2 -2
- package/docs/scenarios/x-omni.md +5 -2
- package/docs/scenarios/x-omni.zh.md +5 -2
- package/docs/voice-agent-architecture-presentation.zh.md +34 -37
- package/docs/voice-frontends/custom-provider.md +22 -4
- package/docs/voice-frontends/custom-provider.zh.md +22 -4
- package/docs/voice-frontends/google-live.md +14 -8
- package/docs/voice-frontends/google-live.zh.md +13 -8
- package/docs/voice-frontends/gpt-live-1.md +149 -0
- package/docs/voice-frontends/gpt-live-1.zh.md +114 -0
- package/docs/voice-frontends/minicpm-o.md +8 -4
- package/docs/voice-frontends/minicpm-o.zh.md +7 -4
- package/docs/voice-frontends/{gpt-live.md → openai-realtime.md} +19 -10
- package/docs/voice-frontends/{gpt-live.zh.md → openai-realtime.zh.md} +18 -10
- package/docs/voice-frontends/qwen-audio-live.md +164 -0
- package/docs/voice-frontends/qwen-audio-live.zh.md +122 -0
- package/docs/voice-frontends/qwen-audio-realtime.md +41 -15
- package/docs/voice-frontends/qwen-audio-realtime.zh.md +34 -12
- package/docs/voice-frontends/qwen-omni-realtime.md +12 -9
- package/docs/voice-frontends/qwen-omni-realtime.zh.md +12 -9
- package/docs/voice-frontends/speech-to-speech.md +8 -4
- package/docs/voice-frontends/speech-to-speech.zh.md +7 -3
- package/docs/voice-frontends/stepfun.md +7 -4
- package/docs/voice-frontends/stepfun.zh.md +7 -4
- package/examples/webrtc/start.mjs +2 -1
- package/package.json +34 -16
- package/scripts/audit-dependencies.mjs +3 -25
- package/scripts/electron-smoke.mjs +5 -5
- package/scripts/patch-build-node-gyp.mjs +63 -0
- package/scripts/prepare-build.mjs +2 -0
- package/scripts/release-check +2 -2
- package/scripts/runtime/claude-code-acp.mjs +5 -5
- package/scripts/verify-package.mjs +3 -0
- package/server/package.json +5 -5
- package/server/src/app/gateway-application.mjs +3 -0
- package/server/src/app/gateway-http-routes.mjs +3 -0
- package/server/src/app/session-conversation-history.mjs +9 -1
- package/server/src/backend/adapters/a2a/backend-adapter.mjs +32 -26
- package/server/src/backend/adapters/acp/backend-adapter.mjs +703 -251
- package/server/src/backend/adapters/acp/coordinator-contract.mjs +2 -13
- package/server/src/backend/adapters/acp/coordinator-instructions.mjs +29 -8
- package/server/src/backend/adapters/acp/coordinator-queue.mjs +58 -0
- package/server/src/backend/adapters/acp/drivers/codex.mjs +1 -1
- package/server/src/backend/adapters/acp/drivers/openclaw.mjs +1 -2
- package/server/src/backend/adapters/acp/input-broker.mjs +2 -0
- package/server/src/backend/adapters/acp/process-client.mjs +111 -16
- package/server/src/backend/adapters/acp/session-configuration.mjs +2 -19
- package/server/src/backend/adapters/acp/session-registry.mjs +9 -0
- package/server/src/backend/adapters/acp/session-tools.mjs +1 -1
- package/server/src/backend/adapters/acp/turn-updates.mjs +188 -0
- package/server/src/backend/adapters/acp/work-continuation.mjs +48 -0
- package/server/src/backend/adapters/agent-client.mjs +24 -1
- package/server/src/backend/adapters/llm/backend-adapter.mjs +393 -0
- package/server/src/backend/adapters/muse/backend-adapter.mjs +2 -0
- package/server/src/backend/availability.mjs +12 -3
- package/server/src/backend/backend-adapter-sdk.mjs +3 -0
- package/server/src/backend/backend-port.mjs +13 -0
- package/server/src/backend/backend-work-runtime.mjs +23 -0
- package/server/src/client/client-command-runtime.mjs +14 -0
- package/server/src/conversation/conversation-sync.mjs +26 -2
- package/server/src/conversation/frontend-agent-context.mjs +18 -5
- package/server/src/conversation/frontend-notes.mjs +7 -5
- package/server/src/conversation/task-result-projector.mjs +1 -1
- package/server/src/core/backend-events.mjs +4 -0
- package/server/src/core/citation.mjs +8 -2
- package/server/src/core/config.mjs +46 -54
- package/server/src/core/gateway-protocol.mjs +4 -1
- package/server/src/core/request-security.mjs +7 -1
- package/server/src/core/work-conversation-context.mjs +138 -0
- package/server/src/core/work-input-request.mjs +1 -0
- package/server/src/frontend/frontend-tools.mjs +20 -7
- package/server/src/frontend/retrieval/providers/bing.mjs +23 -12
- package/server/src/frontend/retrieval/providers/factory.mjs +18 -1
- package/server/src/frontend/retrieval/providers/mcp.mjs +30 -11
- package/server/src/frontend/retrieval/providers/so360.mjs +23 -12
- package/server/src/frontend/tools/agent-task-runtime.mjs +119 -99
- package/server/src/frontend/tools/features/agent-task-tools.mjs +23 -42
- package/server/src/frontend/tools/frontend-tool-context.mjs +2 -2
- package/server/src/frontend/tools/spawn-thinking-tool.mjs +2 -2
- package/server/src/frontend/tools/tool-call-handler.mjs +166 -86
- package/server/src/knowledge/providers/local/library.mjs +26 -6
- package/server/src/knowledge/providers/local/provider.mjs +25 -6
- package/server/src/memory/providers/markdown/context-store.mjs +24 -11
- package/server/src/orchestration/session-task-coordinator.mjs +13 -3
- package/server/src/orchestration/task-operations.mjs +54 -12
- package/server/src/orchestration/task-updates.mjs +82 -0
- package/server/src/task/reminder-scheduler.mjs +5 -1
- package/server/src/task/task-manager.mjs +72 -15
- package/server/src/task/task-recovery.mjs +12 -2
- package/server/src/task/task-scheduler.mjs +5 -5
- package/server/src/task/task-state.mjs +13 -0
- package/server/src/transport/gateway-client-transport.mjs +35 -0
- package/server/src/transport/webrtc/protocol.mjs +1 -1
- package/server/src/voice/announcement/announcement-manager.mjs +3 -0
- package/server/src/voice/audio-stream-diagnostics.mjs +139 -0
- package/server/src/voice/native-delegation-runtime.mjs +360 -0
- package/server/src/voice/providers/dashscope-live.mjs +93 -0
- package/server/src/voice/providers/dashscope.mjs +45 -33
- package/server/src/voice/providers/doubao-seeduplex-protocol.mjs +54 -0
- package/server/src/voice/providers/doubao-seeduplex.mjs +16 -11
- package/server/src/voice/providers/ga-protocol.mjs +7 -2
- package/server/src/voice/providers/google-live-protocol.mjs +124 -34
- package/server/src/voice/providers/google-live.mjs +20 -14
- package/server/src/voice/providers/gpt-live-1-protocol.mjs +597 -0
- package/server/src/voice/providers/gpt-live-1.mjs +3 -0
- package/server/src/voice/providers/gpt-live-client-context.mjs +182 -0
- package/server/src/voice/providers/minicpm-o.mjs +9 -7
- package/server/src/voice/providers/openai-live.mjs +150 -0
- package/server/src/voice/providers/{gpt-live.mjs → openai-realtime.mjs} +23 -19
- package/server/src/voice/providers/provider-registry.mjs +11 -1
- package/server/src/voice/providers/qwen-live-protocol.mjs +399 -0
- package/server/src/voice/providers/registry.mjs +47 -12
- package/server/src/voice/providers/runtime-configuration.mjs +34 -0
- package/server/src/voice/providers/s2s.mjs +9 -7
- package/server/src/voice/providers/stepfun.mjs +14 -11
- package/server/src/voice/realtime-input-runtime.mjs +58 -20
- package/server/src/voice/realtime-presentation-runtime.mjs +111 -27
- package/server/src/voice/realtime-provider-session.mjs +59 -14
- package/server/src/voice/realtime-provider.mjs +358 -45
- package/server/src/voice/realtime-session-runtime.mjs +282 -35
- package/server/src/voice/realtime-task-presentation.mjs +8 -2
- package/server/src/voice/realtime-turn-state.mjs +33 -2
- package/shared/backend/catalog.mjs +26 -2
- package/shared/backend/install.mjs +3 -1
- package/shared/backend/setup.mjs +43 -0
- package/shared/gateway/client-sdk.mjs +21 -6
- package/shared/gateway/setup.mjs +13 -1
- package/shared/gateway/websocket-auth.mjs +2 -1
- package/shared/protocol/gateway-client-protocol.mjs +14 -0
- package/shared/protocol/gateway-events.mjs +39 -1
- package/shared/realtime-legacy-environment.mjs +81 -0
- package/shared/realtime-model-catalog.mjs +68 -194
- package/shared/realtime-models/README.md +33 -0
- package/shared/realtime-models/dashscope.mjs +57 -0
- package/shared/realtime-models/google.mjs +10 -0
- package/shared/realtime-models/openai.mjs +24 -0
- package/shared/realtime-models/profile.mjs +38 -0
- package/shared/realtime-models/stepfun.mjs +10 -0
- package/shared/realtime-models/volcengine.mjs +12 -0
- package/shared/realtime-provider-catalog.mjs +23 -11
- package/shared/realtime-provider-definitions.mjs +168 -235
- package/shared/runtime-environment.mjs +23 -30
- package/shared/skill-library.mjs +49 -13
- package/shared/web-search-configuration.mjs +25 -2
- package/tui/package.json +2 -2
- package/tui/src/index.mjs +14 -9
- package/tui/src/runtime-configuration.mjs +2 -0
- package/tui/src/terminal-commands.mjs +40 -0
- package/tui/src/text-cli.mjs +10 -1
- package/web/dist/assets/index-Bc2Q04J9.css +1 -0
- package/web/dist/assets/index-bY4DFXKT.js +96 -0
- package/web/dist/index.html +2 -2
- package/web/dist/assets/index-BRaiI-dW.js +0 -91
- package/web/dist/assets/index-D9k8R2JY.css +0 -1
|
@@ -9,15 +9,15 @@ import {
|
|
|
9
9
|
resolveOrbSkinId,
|
|
10
10
|
} from '../../shared/orb-skin-catalog.mjs'
|
|
11
11
|
import {
|
|
12
|
-
normalizeRealtimeProvider,
|
|
13
12
|
assertRealtimeFrontendModel,
|
|
14
13
|
resolveRealtimeFrontendConfiguration,
|
|
15
14
|
} from '../../shared/realtime-provider-catalog.mjs'
|
|
16
15
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
REALTIME_SETTING_FIELDS,
|
|
17
|
+
realtimeRuntimeEnvironment, realtimeSettingsValues, realtimeSettingsFromEnvironment, mergeRealtimeEnvironment, mergeRealtimeSettings,
|
|
19
18
|
} from '../../shared/realtime-provider-definitions.mjs'
|
|
20
19
|
import { normalizeDesktopLanguage } from './i18n.mjs'
|
|
20
|
+
import { BUILTIN_REALTIME_MODEL_CATALOGS } from '../../shared/realtime-model-catalog.mjs'
|
|
21
21
|
|
|
22
22
|
const DEFAULTS = {
|
|
23
23
|
gatewayUrl: 'http://127.0.0.1:3101',
|
|
@@ -162,34 +162,31 @@ function encoded(value) {
|
|
|
162
162
|
throw new TypeError('设置值包含无法保存的换行、控制字符或引号组合')
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
function parseRealtimeSettings(values, fallback
|
|
166
|
-
return realtimeSettingsFromEnvironment(
|
|
167
|
-
...mergeRealtimeEnvironment(fallback, values),
|
|
168
|
-
QWEN_AUDIO_REALTIME_PROVIDER: realtimeProvider,
|
|
169
|
-
}, drafts)
|
|
165
|
+
function parseRealtimeSettings(values, fallback) {
|
|
166
|
+
return realtimeSettingsFromEnvironment(mergeRealtimeEnvironment(fallback, values))
|
|
170
167
|
}
|
|
171
168
|
|
|
172
169
|
export function hasRealtimeSettingsPatch(settings) {
|
|
173
170
|
return REALTIME_SETTING_FIELDS.some(field => settings[field] !== undefined)
|
|
174
171
|
}
|
|
175
172
|
|
|
176
|
-
function normalizeRealtimeSettings(settings
|
|
173
|
+
function normalizeRealtimeSettings(settings) {
|
|
177
174
|
const values = realtimeSettingsValues(settings)
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
175
|
+
return { ...values, realtimeUrl: cleanRealtimeUrl(values.realtimeUrl, '') }
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Provider and model changes share the connection migration rules used by
|
|
179
|
+
// environment loading and the settings form.
|
|
180
|
+
export function mergeSettingsPatch(current = {}, patch = {}) {
|
|
181
|
+
return {
|
|
182
|
+
...current,
|
|
183
|
+
...patch,
|
|
184
|
+
...mergeRealtimeSettings(current, patch),
|
|
187
185
|
}
|
|
188
|
-
return { ...values, realtimeProvider }
|
|
189
186
|
}
|
|
190
187
|
|
|
191
|
-
export function parseSettings(content = '', fallback = {}
|
|
192
|
-
const values =
|
|
188
|
+
export function parseSettings(content = '', fallback = {}) {
|
|
189
|
+
const values = parseEnv(content)
|
|
193
190
|
const agentProtocol = cleanAgentProtocol(configured(
|
|
194
191
|
values,
|
|
195
192
|
'AGENT_PROTOCOL',
|
|
@@ -221,11 +218,6 @@ export function parseSettings(content = '', fallback = {}, realtimeDrafts = {})
|
|
|
221
218
|
fallback[credentialEnvironment] || '',
|
|
222
219
|
) || '').trim()
|
|
223
220
|
: ''
|
|
224
|
-
const realtimeProvider = normalizeRealtimeProvider(configured(
|
|
225
|
-
values,
|
|
226
|
-
'QWEN_AUDIO_REALTIME_PROVIDER',
|
|
227
|
-
fallback.QWEN_AUDIO_REALTIME_PROVIDER || realtimeDrafts.realtimeProvider || DEFAULTS.realtimeProvider,
|
|
228
|
-
))
|
|
229
221
|
const configuredOrbStyle = configured(
|
|
230
222
|
values,
|
|
231
223
|
'QWEN_AUDIO_ORB_STYLE',
|
|
@@ -273,7 +265,7 @@ export function parseSettings(content = '', fallback = {}, realtimeDrafts = {})
|
|
|
273
265
|
fallback.QWEN_AUDIO_WAKE_WORD_ENABLED || '',
|
|
274
266
|
),
|
|
275
267
|
).toLowerCase() === 'true',
|
|
276
|
-
...parseRealtimeSettings(values, fallback
|
|
268
|
+
...parseRealtimeSettings(values, fallback),
|
|
277
269
|
agentProtocol,
|
|
278
270
|
backendModel: String(configured(
|
|
279
271
|
values,
|
|
@@ -297,9 +289,6 @@ export function parseSettings(content = '', fallback = {}, realtimeDrafts = {})
|
|
|
297
289
|
}
|
|
298
290
|
|
|
299
291
|
export function normalizeSettings(settings = {}) {
|
|
300
|
-
const realtimeProvider = normalizeRealtimeProvider(
|
|
301
|
-
settings.realtimeProvider ?? DEFAULTS.realtimeProvider,
|
|
302
|
-
)
|
|
303
292
|
const agentProtocol = cleanAgentProtocol(
|
|
304
293
|
settings.agentProtocol ?? DEFAULTS.agentProtocol,
|
|
305
294
|
)
|
|
@@ -336,7 +325,7 @@ export function normalizeSettings(settings = {}) {
|
|
|
336
325
|
settings.wakeShortcut ?? DEFAULTS.wakeShortcut,
|
|
337
326
|
),
|
|
338
327
|
wakeWordEnabled: Boolean(settings.wakeWordEnabled),
|
|
339
|
-
...normalizeRealtimeSettings(settings
|
|
328
|
+
...normalizeRealtimeSettings(settings),
|
|
340
329
|
agentProtocol,
|
|
341
330
|
backendModel: String(
|
|
342
331
|
settings.backendModel ?? DEFAULTS.backendModel,
|
|
@@ -353,13 +342,13 @@ export function normalizeSettings(settings = {}) {
|
|
|
353
342
|
}
|
|
354
343
|
}
|
|
355
344
|
|
|
356
|
-
export function realtimeSettingsConfiguration(settings = {}) {
|
|
357
|
-
return resolveRealtimeFrontendConfiguration(realtimeRuntimeEnvironment(settings))
|
|
345
|
+
export function realtimeSettingsConfiguration(settings = {}, modelCatalogs = BUILTIN_REALTIME_MODEL_CATALOGS) {
|
|
346
|
+
return resolveRealtimeFrontendConfiguration(realtimeRuntimeEnvironment(settings), { modelCatalogs })
|
|
358
347
|
}
|
|
359
348
|
|
|
360
|
-
export function realtimeSettingsConfigured(settings = {}) {
|
|
349
|
+
export function realtimeSettingsConfigured(settings = {}, modelCatalogs) {
|
|
361
350
|
try {
|
|
362
|
-
const frontend = realtimeSettingsConfiguration(settings)
|
|
351
|
+
const frontend = realtimeSettingsConfiguration(settings, modelCatalogs)
|
|
363
352
|
assertRealtimeFrontendModel(frontend.active)
|
|
364
353
|
return frontend.active.configured && Boolean(cleanRealtimeUrl(frontend.active.endpoint, ''))
|
|
365
354
|
} catch {
|
|
@@ -367,6 +356,11 @@ export function realtimeSettingsConfigured(settings = {}) {
|
|
|
367
356
|
}
|
|
368
357
|
}
|
|
369
358
|
|
|
359
|
+
export function realtimeSettingsChanged(previous, next, modelCatalogs, runningSignature = '') {
|
|
360
|
+
const before = runningSignature || realtimeSettingsConfiguration(previous, modelCatalogs).active.signature
|
|
361
|
+
return before !== realtimeSettingsConfiguration(next, modelCatalogs).active.signature
|
|
362
|
+
}
|
|
363
|
+
|
|
370
364
|
// Applies a just-saved settings patch to a live environment, mirroring the
|
|
371
365
|
// key mapping of updateSettingsContent. Without this the desktop process
|
|
372
366
|
// keeps serving the values it loaded first — the config file is only read
|
|
@@ -374,7 +368,7 @@ export function realtimeSettingsConfigured(settings = {}) {
|
|
|
374
368
|
// would look ignored until the app itself restarts.
|
|
375
369
|
export function applySettingsEnvironment(settings = {}, env = process.env) {
|
|
376
370
|
const realtimeChanged = hasRealtimeSettingsPatch(settings)
|
|
377
|
-
const normalized = normalizeSettings(realtimeChanged ?
|
|
371
|
+
const normalized = normalizeSettings(realtimeChanged ? mergeSettingsPatch(parseSettings('', env), settings) : settings)
|
|
378
372
|
const backend = backendDefinition(normalized.agentProtocol)
|
|
379
373
|
const entries = Object.entries(SETTING_KEYS)
|
|
380
374
|
.filter(([field]) => settings[field] !== undefined)
|
|
@@ -394,7 +388,6 @@ export function applySettingsEnvironment(settings = {}, env = process.env) {
|
|
|
394
388
|
else env[key] = text
|
|
395
389
|
}
|
|
396
390
|
if (realtimeChanged) {
|
|
397
|
-
delete env.QWEN_AUDIO_REALTIME_API_KEY
|
|
398
391
|
delete env.QWEN_AUDIO_REALTIME_ENDPOINT
|
|
399
392
|
Object.assign(env, realtimeRuntimeEnvironment(normalized))
|
|
400
393
|
}
|
|
@@ -403,13 +396,13 @@ export function applySettingsEnvironment(settings = {}, env = process.env) {
|
|
|
403
396
|
|
|
404
397
|
// The form is unified; persistence is not. Gateway settings and client
|
|
405
398
|
// preferences use separate files without duplicating validation or schemas.
|
|
406
|
-
export function updateSettingsContent(content = '', settings = {}, { scope = 'all',
|
|
399
|
+
export function updateSettingsContent(content = '', settings = {}, { scope = 'all', effectiveSettings = {} } = {}) {
|
|
407
400
|
if (!['all', 'gateway', 'client'].includes(scope)) throw new TypeError('invalid settings scope')
|
|
408
401
|
const accepts = key => scope === 'all'
|
|
409
402
|
|| (scope === 'client') === CLIENT_ENVIRONMENT_KEYS.has(key)
|
|
410
403
|
const realtimeChanged = scope !== 'client' && hasRealtimeSettingsPatch(settings)
|
|
411
404
|
const normalized = normalizeSettings(realtimeChanged
|
|
412
|
-
? { ...parseSettings(content
|
|
405
|
+
? mergeSettingsPatch({ ...parseSettings(content), ...effectiveSettings }, settings)
|
|
413
406
|
: settings)
|
|
414
407
|
const values = Object.fromEntries(
|
|
415
408
|
Object.entries(SETTING_KEYS)
|
|
@@ -443,7 +436,6 @@ export function updateSettingsContent(content = '', settings = {}, { scope = 'al
|
|
|
443
436
|
'QWEN_AUDIO_DESKTOP_AUTO_SLEEP_SECONDS',
|
|
444
437
|
])
|
|
445
438
|
if (realtimeChanged) {
|
|
446
|
-
removed.add('QWEN_AUDIO_REALTIME_API_KEY')
|
|
447
439
|
removed.add('QWEN_AUDIO_REALTIME_ENDPOINT')
|
|
448
440
|
}
|
|
449
441
|
const seen = new Set()
|
|
@@ -19,17 +19,20 @@ import { gatewaySetupStatus } from '../../shared/gateway/setup.mjs'
|
|
|
19
19
|
import {
|
|
20
20
|
applySettingsEnvironment,
|
|
21
21
|
hasRealtimeSettingsPatch,
|
|
22
|
+
mergeSettingsPatch,
|
|
22
23
|
normalizeSettings,
|
|
23
24
|
parseSettings,
|
|
25
|
+
realtimeSettingsConfiguration,
|
|
24
26
|
updateSettingsContent,
|
|
25
27
|
} from './settings-config.mjs'
|
|
26
28
|
import { normalizeConversationSessionId } from '../../shared/conversation-session.mjs'
|
|
27
|
-
import {
|
|
29
|
+
import { BUILTIN_REALTIME_MODEL_CATALOGS } from '../../shared/realtime-model-catalog.mjs'
|
|
30
|
+
import { assertRealtimeFrontendModel } from '../../shared/realtime-provider-catalog.mjs'
|
|
31
|
+
import { mergeRealtimeEnvironment, realtimeSettingsValues } from '../../shared/realtime-provider-definitions.mjs'
|
|
28
32
|
|
|
29
33
|
export const SETTINGS_FILE = 'config.env'
|
|
30
34
|
export const CLIENT_SETTINGS_FILE = 'settings.env'
|
|
31
35
|
export const UI_STATE_FILE = 'ui-state.json'
|
|
32
|
-
export const REALTIME_PROFILES_FILE = 'realtime-profiles.json'
|
|
33
36
|
|
|
34
37
|
// Everything written here is user configuration, including credentials, so it
|
|
35
38
|
// stays readable by its owner alone.
|
|
@@ -84,6 +87,7 @@ function writePrivateFile(path, content) {
|
|
|
84
87
|
* @returns {{
|
|
85
88
|
* configDir: string, clientDir: string, path: string, clientSettingsPath: string, uiStatePath: string,
|
|
86
89
|
* load: () => object,
|
|
90
|
+
* modelCatalogs: () => object,
|
|
87
91
|
* save: (settings: object) => object,
|
|
88
92
|
* status: () => { ready: boolean, provider: string|null, missing: object[] },
|
|
89
93
|
* ready: () => boolean,
|
|
@@ -105,7 +109,6 @@ export function createSettingsStore({
|
|
|
105
109
|
const clientDirectory = resolve(clientDir)
|
|
106
110
|
const settingsPath = resolve(directory, SETTINGS_FILE)
|
|
107
111
|
const clientSettingsPath = resolve(clientDirectory, CLIENT_SETTINGS_FILE)
|
|
108
|
-
const realtimeProfilesPath = resolve(directory, REALTIME_PROFILES_FILE)
|
|
109
112
|
const uiStatePath = resolve(clientDirectory, UI_STATE_FILE)
|
|
110
113
|
|
|
111
114
|
// Reading must never create anything: the startup gate runs before a host
|
|
@@ -115,28 +118,18 @@ export function createSettingsStore({
|
|
|
115
118
|
updateSettingsContent(readTextFile(settingsPath), {}, { scope: 'gateway' })
|
|
116
119
|
+ updateSettingsContent(readTextFile(clientSettingsPath), {}, { scope: 'client' })
|
|
117
120
|
)
|
|
118
|
-
const load = () =>
|
|
119
|
-
const raw = readTextFile(realtimeProfilesPath)
|
|
120
|
-
let drafts = {}
|
|
121
|
-
if (raw) {
|
|
122
|
-
try {
|
|
123
|
-
const state = JSON.parse(raw)
|
|
124
|
-
if (!state || typeof state !== 'object' || !state.profiles || typeof state.profiles !== 'object') throw new Error()
|
|
125
|
-
drafts = realtimeSettingsFromProfileState(state)
|
|
126
|
-
} catch {
|
|
127
|
-
throw new Error('Invalid realtime-profiles.json; restore or correct the profile file before saving settings')
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return parseSettings(readContent(), env, drafts)
|
|
131
|
-
}
|
|
121
|
+
const load = () => parseSettings(readContent(), env)
|
|
132
122
|
|
|
133
123
|
// The same readiness the startup gate reads: stored values first, then the
|
|
134
124
|
// live environment for slots the file leaves unset — mirroring how the
|
|
135
125
|
// Gateway itself loads config.env.
|
|
136
|
-
const effectiveEnvironment = () => mergeRealtimeEnvironment(
|
|
126
|
+
const effectiveEnvironment = () => ({ ...mergeRealtimeEnvironment(
|
|
137
127
|
env,
|
|
138
|
-
|
|
139
|
-
)
|
|
128
|
+
parseEnv(readTextFile(settingsPath)),
|
|
129
|
+
), QWAUDIO_CONFIG_DIR: directory })
|
|
130
|
+
// Supported models ship with the application; local JSON cannot register
|
|
131
|
+
// models or change the protocol defaults used by this settings store.
|
|
132
|
+
const modelCatalogs = () => BUILTIN_REALTIME_MODEL_CATALOGS
|
|
140
133
|
|
|
141
134
|
const loadUiState = () => {
|
|
142
135
|
const content = readTextFile(uiStatePath)
|
|
@@ -166,15 +159,14 @@ export function createSettingsStore({
|
|
|
166
159
|
clientDir: clientDirectory,
|
|
167
160
|
path: settingsPath,
|
|
168
161
|
clientSettingsPath,
|
|
169
|
-
realtimeProfilesPath,
|
|
170
162
|
uiStatePath,
|
|
171
163
|
load,
|
|
172
|
-
|
|
164
|
+
modelCatalogs,
|
|
165
|
+
preview: settings => normalizeSettings(mergeSettingsPatch(load(), settings)),
|
|
173
166
|
|
|
174
167
|
save(settings) {
|
|
175
|
-
// Keep provider drafts separate from the five active runtime variables.
|
|
176
168
|
const realtimeChanged = hasRealtimeSettingsPatch(settings)
|
|
177
|
-
let nextSettings = normalizeSettings(
|
|
169
|
+
let nextSettings = normalizeSettings(mergeSettingsPatch(load(), settings))
|
|
178
170
|
for (const [path, root, scope] of [
|
|
179
171
|
[settingsPath, directory, 'gateway'],
|
|
180
172
|
[clientSettingsPath, clientDirectory, 'client'],
|
|
@@ -182,11 +174,10 @@ export function createSettingsStore({
|
|
|
182
174
|
withFileTransaction(path, () => {
|
|
183
175
|
const current = readTextFile(path)
|
|
184
176
|
if (scope === 'gateway' && realtimeChanged) {
|
|
185
|
-
nextSettings = normalizeSettings(
|
|
186
|
-
|
|
187
|
-
writePrivateFile(realtimeProfilesPath, JSON.stringify(realtimeSettingsProfileState(nextSettings), null, 2) + '\n')
|
|
177
|
+
nextSettings = normalizeSettings(mergeSettingsPatch(load(), settings))
|
|
178
|
+
assertRealtimeFrontendModel(realtimeSettingsConfiguration(nextSettings, modelCatalogs()).active)
|
|
188
179
|
}
|
|
189
|
-
const next = updateSettingsContent(current, settings, { scope,
|
|
180
|
+
const next = updateSettingsContent(current, settings, { scope, effectiveSettings: nextSettings })
|
|
190
181
|
if (next === current || (!current && !next.trim())) return
|
|
191
182
|
mkdirSync(root, { recursive: true, mode: PRIVATE_DIRECTORY_MODE })
|
|
192
183
|
writePrivateFile(path, next)
|
|
@@ -43,7 +43,7 @@ final ASR
|
|
|
43
43
|
Task accepted
|
|
44
44
|
│ response returns to Realtime immediately
|
|
45
45
|
▼
|
|
46
|
-
owner
|
|
46
|
+
bounded owner queue
|
|
47
47
|
│
|
|
48
48
|
▼
|
|
49
49
|
configured BackendPort
|
|
@@ -56,8 +56,13 @@ final ASR
|
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
`spawn_thinking` never waits for the requested work. The user can continue
|
|
59
|
-
speaking while
|
|
60
|
-
|
|
59
|
+
speaking while work runs. Task admission defaults to one active slot globally and one
|
|
60
|
+
per owner; later requests queue while those slots are occupied. A directly executed task
|
|
61
|
+
retains its slot while awaiting input or permission. After an ACP coordinating turn dispatches
|
|
62
|
+
independent work, it releases both its admission slot and coordinator lease while the child
|
|
63
|
+
Sessions run. Those Sessions are not counted against the task-admission limits. Replies and
|
|
64
|
+
targeted updates continue existing work; new work never implicitly cancels it. ACP uses one
|
|
65
|
+
coordinator Session regardless of the configured admission limits.
|
|
61
66
|
|
|
62
67
|
## 3. Realtime boundary
|
|
63
68
|
|
|
@@ -66,7 +71,7 @@ tool calls alone do not require backend execution. Tools have two prompt-ownersh
|
|
|
66
71
|
|
|
67
72
|
| Contract | Tools |
|
|
68
73
|
| --- | --- |
|
|
69
|
-
| Core contract | `spawn_thinking`, `get_agent_task_status`, `cancel_agent_task`, `respond_permission`, `
|
|
74
|
+
| Core contract | `spawn_thinking`, `update_agent_task`, `get_agent_task_status`, `cancel_agent_task`, `respond_permission`, `get_current_time` |
|
|
70
75
|
| Optional capabilities | `memory`, `web_search`, `fetch_url`, `knowledge`, `recall`, `notes`, `schedule_reminder`, `enter_sleep`; dynamic MCP tools are also configuration-dependent |
|
|
71
76
|
|
|
72
77
|
The fixed `config/frontend-agent/PROMPT.md` may name only core-contract tools.
|
|
@@ -85,15 +90,23 @@ Core versus optional is a prompt-maintenance convention, not a runtime classific
|
|
|
85
90
|
the core-tool allowlist lives only in boundary tests. The registry stores tool definitions
|
|
86
91
|
and optional, effective runtime policies such as capability requirements, result-size
|
|
87
92
|
limits, and repeat handling. Tools need no group or execution-mode label. An unconfigured
|
|
88
|
-
backend hides `spawn_thinking`;
|
|
89
|
-
requests. Even core-contract tools cannot be called
|
|
90
|
-
fixed prompt, tool references, and capability switches to keep new optional features
|
|
93
|
+
backend hides `spawn_thinking` and `update_agent_task`; `respond_permission` is exposed
|
|
94
|
+
only for real pending permission requests. Even core-contract tools cannot be called
|
|
95
|
+
when unavailable. Tests check the fixed prompt, tool references, and capability switches to keep new optional features
|
|
91
96
|
out of core rules.
|
|
92
97
|
|
|
93
98
|
The Gateway exposes `respond_permission` for pending backend permissions.
|
|
94
99
|
The model answers the permission request; the Gateway resolves the request
|
|
95
100
|
and its associated Task before forwarding the decision.
|
|
96
101
|
|
|
102
|
+
`update_agent_task` forwards a user's instruction to existing work. When an input
|
|
103
|
+
request is pending, the same tool answers it; an optional `input_request_id` binds
|
|
104
|
+
the exact request. Confirmation, refusal, and changed requirements remain natural
|
|
105
|
+
language in `instruction`; the backend interprets the reply in the original context.
|
|
106
|
+
The Gateway does not classify keywords or treat an omitted decision as approval.
|
|
107
|
+
Otherwise, updating work depends on the backend's steering support. `cancel_agent_task` stops the whole
|
|
108
|
+
task. The client Gateway protocol retains its separate `task.input.respond` command.
|
|
109
|
+
|
|
97
110
|
`memory` maintains two ordinary Markdown documents through one flat interface. Each call is one
|
|
98
111
|
atomic `read`, `append`, or `replace` operation. `replace` locates a unique source fragment, and
|
|
99
112
|
fails safely if that fragment is missing or ambiguous. Realtime may issue several calls
|
|
@@ -173,17 +186,18 @@ enable its associated tool, and is not persisted into conversation history.
|
|
|
173
186
|
The `objective` passed to `spawn_thinking` is a conservative interpretation of
|
|
174
187
|
the user's request, not an execution plan. It must resolve references such as
|
|
175
188
|
“continue that page” into one self-contained instruction before submission.
|
|
176
|
-
That instruction
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
189
|
+
That instruction remains the execution request; verbatim ASR is not appended as a
|
|
190
|
+
second task description. The runtime may supplement it with up to 2,000 characters of
|
|
191
|
+
new user/assistant dialogue. Delivered dialogue is tracked per coordinator Session so
|
|
192
|
+
later turns do not repeatedly append the same history. The dialogue is reference context,
|
|
193
|
+
not new work. Tool calls, tool results, raw backend output, frontend persona, and durable
|
|
194
|
+
memory are not copied into this context. No new frontend tool is introduced.
|
|
181
195
|
|
|
182
196
|
A backend turn may return a result or ask for information, a choice,
|
|
183
197
|
confirmation, or clarification required to continue. The frontend presents
|
|
184
|
-
that need naturally. When the user answers, it calls `
|
|
185
|
-
|
|
186
|
-
|
|
198
|
+
that need naturally. When the user answers, it calls `update_agent_task` with
|
|
199
|
+
the same task ID instead of predicting or simulating the next backend action.
|
|
200
|
+
This rule does not depend on the wording of a particular case.
|
|
187
201
|
|
|
188
202
|
The Gateway automatically carries current-turn attachments as native protocol
|
|
189
203
|
parts, never as a model-visible JSON manifest. Only work that explicitly
|
|
@@ -193,33 +207,45 @@ and routing remain structured Gateway/BackendPort data and are not placed in
|
|
|
193
207
|
the backend Agent's instruction. The working directory and user time zone are
|
|
194
208
|
not repeated in every prompt; protocol or backend runtime context owns them.
|
|
195
209
|
|
|
196
|
-
## 4.
|
|
210
|
+
## 4. Persistent Backend Agent Sessions
|
|
197
211
|
|
|
198
212
|
The coordination Session here belongs to the ACP backend integration, not the framework's Orchestration Runtime.
|
|
199
213
|
The runtime manages work through `BackendPort`; A2A and custom backends need not use the same Session structure.
|
|
200
214
|
|
|
201
|
-
The ACP adapter
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
`
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
215
|
+
The ACP adapter maintains one persistent coordinator Session per owner and backend.
|
|
216
|
+
A FIFO queue serializes its request, update, and result-summary turns. The lease covers
|
|
217
|
+
only the coordinator turn, not independent project execution. The Gateway records the
|
|
218
|
+
native ACP Session ID and restores it when needed; project Session continuations use their
|
|
219
|
+
recorded working directories. History remains owned by the backend.
|
|
220
|
+
|
|
221
|
+
Updates use recorded execution targets rather than whichever Session happens to be idle.
|
|
222
|
+
For independent work, every update goes through the coordinator, which selects the original
|
|
223
|
+
project Session via `session_send`; the adapter then steers or continues that Session.
|
|
224
|
+
Only a successful target submission confirms delivery, not the coordinator's reply text.
|
|
225
|
+
Directly executed work can continue after completion when its original context remains
|
|
226
|
+
available. Completed framework-owned ACP delegation can also continue: the runtime passes opaque
|
|
227
|
+
backend context, and the adapter restores the original coordinator and validates its project bindings
|
|
228
|
+
before side effects. ACP's private continuation contains `version: 1`, the original coordinator
|
|
229
|
+
`token`, and `projects` entries with `sessionId`, `directory`, and `title` (an empty array for direct
|
|
230
|
+
work). A delegated continuation turn allows `session_send` only to those bound projects, forbids
|
|
231
|
+
`session_start`, and must actually submit to a target to succeed. Durable project bindings are
|
|
232
|
+
separate from this turn's executions, so unchanged sibling projects are not rerun. Older ACP contexts
|
|
233
|
+
without this versioned binding fail explicitly, without guessing or migration; native delegations
|
|
234
|
+
without a reliable targeted continuation entry point provide no continuation context. A busy
|
|
235
|
+
coordinator queues the next turn instead of steering another task.
|
|
236
|
+
|
|
237
|
+
Task-admission limits do not create additional coordinator Sessions or cap the number of
|
|
238
|
+
independent project Sessions. Separate Sessions do not isolate working directories, files,
|
|
239
|
+
or external resources.
|
|
240
|
+
|
|
241
|
+
The persistent coordinator routes execution and synthesizes results. It uses a project Session for
|
|
242
|
+
work with a distinct goal that benefits from sustained, independent execution. Brief operations,
|
|
243
|
+
clarification, and result synthesis stay in the coordinator Session. Related follow-ups continue in
|
|
244
|
+
the original project Session rather than creating another; the user does not need to request a
|
|
245
|
+
separate Session. It may dispatch several independent tasks in one turn, then ends the turn without
|
|
246
|
+
waiting, polling, or repeating delegated work locally. Backends without delegation handle the request directly.
|
|
247
|
+
The backend receives natural instructions, bounded dialogue context, and native attachments;
|
|
248
|
+
it is not required to emit task-state JSON.
|
|
223
249
|
|
|
224
250
|
## 5. Task state
|
|
225
251
|
|
|
@@ -297,22 +323,24 @@ established only after the Session tool creates or continues the target work
|
|
|
297
323
|
and returns run and Session identifiers validated by the adapter. It is not
|
|
298
324
|
established by a model-authored field. ACP faithfully carries the tool call,
|
|
299
325
|
tool result, and turn termination; the adapter publishes the validated
|
|
300
|
-
correlation to the TaskManager, which moves the original Task to `delegated
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
326
|
+
correlation to the TaskManager, which moves the original Task to `delegated`.
|
|
327
|
+
Once the coordinating turn ends, the adapter releases its coordinator lease and marks
|
|
328
|
+
the delegation as yielding task admission. The TaskManager releases that admission slot
|
|
329
|
+
without completing the Task, allowing later requests to reach the same coordinator while
|
|
330
|
+
project Sessions run. Other adapters retain their normal admission behavior unless they
|
|
331
|
+
explicitly yield it.
|
|
332
|
+
|
|
333
|
+
After successful dispatch or continuation, the coordinator ends its ACP turn without waiting
|
|
334
|
+
for the delegated work. Its text neither controls task state nor acts as a completion signal.
|
|
307
335
|
Correlation IDs, the target Session, and lifecycle stay in the Gateway Task
|
|
308
336
|
registry and adapter runtime; the model never has to echo them.
|
|
309
337
|
|
|
310
338
|
The adapter independently keeps the Task lifecycle and event subscription
|
|
311
|
-
alive. Only
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
an unrelated Session update, or an older result cannot complete the Task.
|
|
339
|
+
alive. Only matching ACP target prompt completions correlated to recorded delegations
|
|
340
|
+
can advance the Task. With several targets, the adapter waits for all of them. Verified
|
|
341
|
+
results and native ContentBlocks then enter the same coordinator queue for one final
|
|
342
|
+
natural answer. That result-summary turn cannot dispatch or restart work. A busy target,
|
|
343
|
+
an empty result, an unrelated Session update, or an older result cannot complete the Task.
|
|
316
344
|
|
|
317
345
|
ACP Agent turns have no artificial wall-clock deadline. An initial coordinator
|
|
318
346
|
turn, a delegated target turn, and the final synthesis turn end only when ACP
|
|
@@ -343,21 +371,30 @@ Qoder, Qwen Code, MiniMax Code, and Kimi Code, the Gateway injects the same five
|
|
|
343
371
|
coordinator: Session list, start, send, status, and cancel. OpenClaw ACP does
|
|
344
372
|
not accept client-supplied MCP servers, so the same coordination contract maps
|
|
345
373
|
to OpenClaw's native Session tools. `session_start` and `session_send` return an
|
|
346
|
-
opaque delegation ID.
|
|
347
|
-
|
|
348
|
-
cancellation, permission routing, and result correlation.
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
374
|
+
opaque delegation ID. The coordinator can dispatch several independent Sessions, then
|
|
375
|
+
ends its turn without polling, repeating work, or claiming completion. The adapter owns
|
|
376
|
+
waiting, cancellation, permission routing, and result correlation.
|
|
377
|
+
|
|
378
|
+
All ACP coordinator Sessions prefix their prompts with the full stable instructions on
|
|
379
|
+
rounds 1, 21, 41, and so on; other rounds carry the dynamic task instruction without that
|
|
380
|
+
prefix. Accepted logical rounds are counted per Session and persisted across restarts.
|
|
381
|
+
Execution, update routing, and result synthesis count; internal tool iterations, steering
|
|
382
|
+
within a round, and restarts do not. Older Sessions without a count receive the prefix on
|
|
383
|
+
their next accepted round. The interval of 20 is a global internal constant, not a user
|
|
384
|
+
setting. Refreshes neither recreate Sessions nor change contract versions.
|
|
385
|
+
|
|
386
|
+
The common rules and backend-specific notes have one source, shared by the periodic
|
|
387
|
+
prefix and the optional MCP initialization response's `instructions` field. Backends
|
|
388
|
+
without delegation omit project-routing rules. MCP instructions are published only when
|
|
389
|
+
the driver declares `coordinatorMcpInstructions` and the payload fits the 2 KiB portability
|
|
390
|
+
budget; the capability is currently enabled for OpenCode, Qoder, Qwen Code, Claude Code,
|
|
391
|
+
and Codex. Other backends, or payloads exceeding that budget, use the same periodic prefix,
|
|
392
|
+
not a full per-round fallback. This flag does not control general MCP support or tool
|
|
393
|
+
availability. Project and isolated Sessions are unchanged and receive neither the
|
|
394
|
+
coordinator MCP server nor these refreshes.
|
|
395
|
+
|
|
396
|
+
This is a periodic reminder, not detection of backend context compaction or a guarantee
|
|
397
|
+
that rules survive it. Token savings have not been established.
|
|
361
398
|
|
|
362
399
|
`session_status` is observational only. If the query fails, the backend Agent
|
|
363
400
|
must report the failure; it must not inspect the target directory with native
|
|
@@ -572,5 +609,5 @@ Before merging a change, verify:
|
|
|
572
609
|
5. Is completion spoken only from a final backend Agent result?
|
|
573
610
|
6. Does the UI use host lifecycle APIs for its local Gateway, without bypassing it to manage backend processes directly?
|
|
574
611
|
7. Can interruption postpone speech without cancelling submitted Task?
|
|
575
|
-
8. Do tests cover
|
|
612
|
+
8. Do tests cover bounded concurrency, task-bound Session reuse, tool animation, and
|
|
576
613
|
delivery retry?
|