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
|
@@ -351,7 +351,7 @@ Gateway 承载运行时与模型接入;客户端只负责输入输出与环境
|
|
|
351
351
|
| 语音控制 | 前台会话运行时 | 管理模型连接、回合、打断与播放;GCP 接入由独立传输层处理 |
|
|
352
352
|
| 任务账本 | TaskManager | 记录任务是否排队、运行、完成或取消 |
|
|
353
353
|
| 后台接入 | BackendPort / Adapter | 将 ACP、A2A 与自定义后台 Agent 归一为统一事件与状态 |
|
|
354
|
-
| 持续协调 | ACP Coordinator Session |
|
|
354
|
+
| 持续协调 | ACP Coordinator Session | 后台的持久协调上下文,不是编排运行时;分派独立工作、续接原 Session 并整理结果 |
|
|
355
355
|
| 结果播报 | AnnouncementManager | 等到合适时机,再让前台自然说出结果 |
|
|
356
356
|
|
|
357
357
|
**具体实现可以替换,职责边界必须保持稳定。**
|
|
@@ -432,6 +432,7 @@ export const frontendToolRegistry = new FrontendToolRegistry([
|
|
|
432
432
|
{ definition: memoryTool },
|
|
433
433
|
{ definition: notesTool },
|
|
434
434
|
{ definition: cancelAgentTaskTool },
|
|
435
|
+
{ definition: updateAgentTaskTool, policy: { repeatHandling: 'handler' } },
|
|
435
436
|
{ definition: getAgentTaskStatusTool },
|
|
436
437
|
// 能力或客户端动作存在时才提供相应工具
|
|
437
438
|
{ definition: webSearchTool, policy: { requiredCapabilities: […] } },
|
|
@@ -439,7 +440,6 @@ export const frontendToolRegistry = new FrontendToolRegistry([
|
|
|
439
440
|
{ definition: knowledgeTool, policy: { requiredCapabilities: […] } },
|
|
440
441
|
{ definition: recallTool, policy: { requiredCapabilities: […] } },
|
|
441
442
|
{ definition: respondPermissionTool, policy: { requiredCapabilities: […] } },
|
|
442
|
-
{ definition: respondAgentInputTool, policy: { requiredCapabilities: […] } },
|
|
443
443
|
{ definition: enterSleepTool, policy: { requiredClientActions: […] } },
|
|
444
444
|
])
|
|
445
445
|
```
|
|
@@ -510,7 +510,8 @@ spawn_thinking({ objective: "继续当前页面工作,修复登录失败问题
|
|
|
510
510
|
objective: "继续当前页面工作,…", ownerId: "personal", sessionId: "main", turnId: "…" }
|
|
511
511
|
|
|
512
512
|
③ 后台协调会话实际收到
|
|
513
|
-
objective 文本 +
|
|
513
|
+
objective 文本 + 有界的新增人机对话 + 原生附件(如有)
|
|
514
|
+
声明 coordinatorMcpInstructions 的后台通过 MCP instructions 接收稳定协调规则;其余后台逐轮附加。
|
|
514
515
|
```
|
|
515
516
|
|
|
516
517
|
> 协调信息**内化为 Gateway 的权威任务记录**;投递给后台的只是投影——前台人格、完整记忆与聊天历史不会被批量转发,稳定指令块同时承载 Project Session 的路由纪律。
|
|
@@ -580,49 +581,46 @@ queued → running ────────────────────
|
|
|
580
581
|
|
|
581
582
|
### 有界并发
|
|
582
583
|
|
|
583
|
-
|
|
584
|
+
运行时默认每个 owner 与全局各有 1 个任务准入名额,名额占用时后续工作排队;新任务不隐式取消已有工作。
|
|
584
585
|
|
|
585
586
|
</div>
|
|
586
587
|
|
|
587
588
|
<div>
|
|
588
589
|
|
|
589
|
-
###
|
|
590
|
+
### 会话内串行
|
|
590
591
|
|
|
591
|
-
|
|
592
|
+
ACP 始终使用一个持久协调 Session,顺序处理请求、调整和结果整理;调整绑定原工作。
|
|
592
593
|
|
|
593
594
|
</div>
|
|
594
595
|
|
|
595
596
|
<div>
|
|
596
597
|
|
|
597
|
-
###
|
|
598
|
+
### 委派让出名额
|
|
598
599
|
|
|
599
|
-
|
|
600
|
+
派出独立工作并结束协调轮次后,释放任务准入名额和协调租约;项目 Session 独立执行,结果再排队汇总。
|
|
600
601
|
|
|
601
602
|
</div>
|
|
602
603
|
|
|
603
604
|
</div>
|
|
604
605
|
|
|
605
|
-
> <strong>核心约束:</strong>
|
|
606
|
+
> <strong>核心约束:</strong> 协调轮次串行、独立工作并行、长任务不阻塞持续对话;任务准入上限不等于项目 Session 数量上限。
|
|
606
607
|
|
|
607
608
|
---
|
|
608
609
|
|
|
609
610
|
# 协调 Session 提供可持续续接的后台对话窗口
|
|
610
611
|
|
|
611
|
-
|
|
612
|
+
ACP Backend Adapter 用一个持久协调 Session,顺序承接当前用户的任务分派、原 Session 续接与结果整理。
|
|
612
613
|
|
|
613
|
-
-
|
|
614
|
-
-
|
|
615
|
-
-
|
|
616
|
-
-
|
|
617
|
-
-
|
|
614
|
+
- 新请求和结果整理共用协调队列,独立工作不占用协调租约。
|
|
615
|
+
- 调整绑定原执行目标;已完成的框架 ACP 委派也由原协调 Session 经 `session_send` 续接原项目,不新建替代 Session。
|
|
616
|
+
- 续接需新版持久上下文;旧上下文或没有可靠定向续接入口的原生委派明确报错,不猜测迁移。
|
|
617
|
+
- 每轮接收自然任务指令、最多 2,000 字符的新增人机对话,以及原生附件。
|
|
618
|
+
- 对话背景不复制工具调用、工具结果或后台原始输出,不是新的执行要求。
|
|
619
|
+
- 目标明确独立、适合持续独立执行的工作使用项目 Session,无需用户明确要求;简短操作、澄清和结果整理留在协调 Session,不支持委派的后台直接执行。
|
|
620
|
+
- 同一轮可派出多项工作;派出或续接后结束轮次,不等待、不轮询、不在本地重复执行。
|
|
621
|
+
- 全部独立工作结束后,排队整理最终表达。
|
|
618
622
|
|
|
619
|
-
|
|
620
|
-
return `${protocol}:${encodeURIComponent(
|
|
621
|
-
clean(ownerId) || 'personal'
|
|
622
|
-
)}:backend`
|
|
623
|
-
```
|
|
624
|
-
|
|
625
|
-
**协调会话负责持续理解;独立 Session 负责长任务执行。**
|
|
623
|
+
**会话上下文分开,不代表文件、工作目录或外部资源隔离。**
|
|
626
624
|
|
|
627
625
|
<!--
|
|
628
626
|
[Sources]
|
|
@@ -751,7 +749,7 @@ if (outcome?.completed) {
|
|
|
751
749
|
|
|
752
750
|
---
|
|
753
751
|
|
|
754
|
-
#
|
|
752
|
+
# 目标明确独立、适合持续执行的工作进入项目 Session
|
|
755
753
|
|
|
756
754
|
<div class="two-col">
|
|
757
755
|
|
|
@@ -759,10 +757,10 @@ if (outcome?.completed) {
|
|
|
759
757
|
|
|
760
758
|
## 进入独立执行层
|
|
761
759
|
|
|
762
|
-
-
|
|
763
|
-
-
|
|
764
|
-
-
|
|
765
|
-
-
|
|
760
|
+
- 工作有明确独立的目标,适合持续独立执行
|
|
761
|
+
- 用户无需明确要求单独的 Session
|
|
762
|
+
- 相关后续要求继续原项目 Session,不另建重复工作
|
|
763
|
+
- 派出后结束协调轮次,由运行时等待结果
|
|
766
764
|
|
|
767
765
|
</div>
|
|
768
766
|
|
|
@@ -770,16 +768,15 @@ if (outcome?.completed) {
|
|
|
770
768
|
|
|
771
769
|
## 留在协调 Session
|
|
772
770
|
|
|
773
|
-
-
|
|
774
|
-
-
|
|
775
|
-
-
|
|
776
|
-
- 结果可以直接进入交付
|
|
771
|
+
- 简短操作与查询
|
|
772
|
+
- 澄清和已验证结果整理
|
|
773
|
+
- 不支持委派的后台直接执行请求
|
|
777
774
|
|
|
778
775
|
</div>
|
|
779
776
|
|
|
780
777
|
</div>
|
|
781
778
|
|
|
782
|
-
|
|
779
|
+
**是否使用项目 Session 取决于目标独立性与持续独立执行的收益,不要求用户明确提出。**
|
|
783
780
|
|
|
784
781
|
---
|
|
785
782
|
|
|
@@ -820,11 +817,11 @@ MCP Session 工具不暴露给语音前台,仅作为协调会话管理独立
|
|
|
820
817
|
| ---: | --- | --- |
|
|
821
818
|
| 1 | 协调会话 | 调用 `session_start` 或 `session_send` |
|
|
822
819
|
| 2 | Adapter | 记录 delegation ID 与目标 Session |
|
|
823
|
-
| 3 | TaskManager |
|
|
820
|
+
| 3 | TaskManager / ACP Adapter | 进入 `delegated`,协调轮次结束后释放准入名额与租约 |
|
|
824
821
|
| 4 | 独立 Session | 使用文件、终端、搜索等能力长期执行 |
|
|
825
|
-
| 5 | Adapter |
|
|
826
|
-
| 6 |
|
|
827
|
-
| 7 | TaskManager
|
|
822
|
+
| 5 | Adapter | 等待该工作全部独立执行目标的结果 |
|
|
823
|
+
| 6 | 原协调会话 | 重新排队,校验并整理一次结果,不再次委派 |
|
|
824
|
+
| 7 | TaskManager / ACP Adapter | 记录任务终态;成功结果等待自然播报 |
|
|
828
825
|
|
|
829
826
|
> 取消、查询、权限和重启恢复,始终绑定同一项任务与目标 Session。
|
|
830
827
|
|
|
@@ -1017,7 +1014,7 @@ ConversationSync 是 Gateway 内的短期会话账本,记录用户说了什么
|
|
|
1017
1014
|
|
|
1018
1015
|
- receipt 不等待后台完成
|
|
1019
1016
|
- transcript 关联不阻塞回执
|
|
1020
|
-
-
|
|
1017
|
+
- ACP 委派结束协调轮次后让出名额,独立项目继续执行
|
|
1021
1018
|
- 结果等到自然窗口再播报
|
|
1022
1019
|
- 播放开始才确认交付
|
|
1023
1020
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Extending Realtime Providers
|
|
2
2
|
|
|
3
|
-
A Realtime Provider
|
|
3
|
+
A Realtime Provider in the runtime extension API is a protocol adapter; it is neither the client nor the Orchestration Runtime itself. The public provider identifies a service, such as `openai`; different models of that service can bind to different internal adapters. A product host can inject a custom provider without changing shared session or backend-work logic. The example below assembles it through the Gateway application entry point.
|
|
4
|
+
|
|
5
|
+
For another model using an existing provider, maintain its support in that provider's data file under `shared/realtime-models/` and add tests. Model definitions and adaptation parameters belong to framework code, not user configuration. Users [select from the supported models](../configuration/frontend.md#select-a-supported-model).
|
|
4
6
|
|
|
5
7
|
```js
|
|
6
8
|
import { createGatewayApplication } from 'qwen-audio-agent/gateway-application'
|
|
@@ -25,14 +27,24 @@ The extension boundary is:
|
|
|
25
27
|
- Each Provider is an independent adapter that owns its URL, authentication, model, session, and error-classification semantics. Product differences should not be carried by reshaping another Provider.
|
|
26
28
|
- `url()`, `headers()`, and `model()` can read the service URL, token, and model from host-owned configuration closures. The Gateway does not require product-specific environment variables.
|
|
27
29
|
- `createProtocol()` runs once for each Realtime connection, so connection IDs and mutable state remain isolated.
|
|
30
|
+
- `createProtocol({ emit, send })` also receives two hooks: `emit(event)` injects a synthetic provider event through `normalizeIncoming()`, for example to close a spoken segment once output goes quiet; `send(payload, options)` sends a wire event of the protocol's own through `encodeOutgoing()`, and `{ correlate: false }` keeps a `response.create` sent this way off the pending Gateway request.
|
|
31
|
+
- `concurrentVoicePlayback` declares a full-duplex service: voice output runs alongside backend work, and the model decides whether a turn gets a reply, so an unanswered turn is released without an error. Mark playback-only synthetic responses `__voicePlayback: true`, and the model's own speech also `__voiceAutomatic: true`; they gate no Gateway request, and only a playback response answers a request to speak. A user interruption calls the optional `interruptPlayback()`, with `{ speech: true }` when the user spoke, any other cancel calls it with `{ stop: true }`, and it may return a frame to send. Later user turns supersede earlier tool calls only for `respond_permission` and `update_agent_task`, and an earlier turn's `cancel_agent_task` never reaches work a later turn started; a permission or backend question is answered only by a turn that began after the Gateway asked it. Announcements are confirmed when their response completes. Default off.
|
|
32
|
+
- `interruptionPlaysOut` declares a model that finishes the speech it already generated when the user interrupts. A spoken barge-in, typed input, and `interrupt` clear no playback; `voice.ready` carries `interruptionPlaysOut: true`, so clients keep playing on `listening` and on their own interrupt. Default off.
|
|
33
|
+
- `pacedOutputAudio` declares output audio that arrives at playback speed, with no lead. `voice.ready` carries `pacedOutputAudio: true`, and clients play it from a reserve even from a local Gateway, as they do from a remote one. Default off.
|
|
34
|
+
- `inputMuteOnSleep` opts into protocol input mute during client sleep while retaining the connection. The runtime combines sleep, microphone mute, and input suspension, and restores mute before buffered audio on reconnect. The Provider owns mute acknowledgements and any synthetic audio clock. Default off; currently enabled only for Qwen Live.
|
|
35
|
+
- `toolOutputsBeforeResponse` declares a service that refuses `response.create` while a call has no output, and continues a response that made calls only on a later `response.create`. Outputs skip the response queue, Gateway requests wait until every open call has an output, and the runtime continues that response once, through the Gateway's follow-up or `continueToolResults()`. Outputs for calls the connection is not waiting on are not sent. Default off.
|
|
28
36
|
- Optional synchronous `validateSessionOptions({ sessionOptions })` runs before opening the
|
|
29
|
-
upstream connection.
|
|
37
|
+
upstream connection. Reject known-invalid service options; other service-specific values still need upstream validation. This does not bypass the catalog check for supported model IDs.
|
|
30
38
|
- `connectionMessages()` emits raw handshake frames after the WebSocket opens and before `session.update`.
|
|
31
39
|
- All later events pass through `encodeOutgoing()` and `normalizeIncoming()`, leaving Gateway tools, tasks, and client protocols unchanged.
|
|
32
40
|
- Protocols without transient response instructions can implement `responseInstructionsItem(response)`. Gateway creates and awaits that conversation item before calling `responseCreate(response)`, which strips unsupported wire parameters. Set `perResponseInstructions: false`; these instructions remain in history.
|
|
33
41
|
- `conversationItemCreate(item, { contextOnly })` distinguishes context delivery from interactive user input. For message items, `contextOnly: true` must write context without triggering a reply; it must not merely cache the text for a later `responseCreate`. Gateway passes `false` for interactive text/file input. Tool receipts keep the provider's native continuation semantics.
|
|
42
|
+
- `automaticUserResponses: true` means a real user item starts a native reply without `response.create` (Qwen Live). Default off. This does not turn context updates into user requests.
|
|
43
|
+
- `contextOnlyItems: false` forbids using user-message items to inject silent context when the service would treat them as new input. Default on. Qwen Live disables it and restores history through startup instructions instead.
|
|
44
|
+
- `nativeSessionContext: true` permits native task-state updates without a delegation ID. Default off; currently enabled only for GPT Live. Qwen Live keeps it off because unassociated text can become user input rather than task context.
|
|
34
45
|
- Set `automaticToolResponses: true` only when tool results natively resume generation (Doubao Seeduplex and Google Live). Runtime sends these receipts without waiting for response completion, and the tool-batch follow-up uses `ensureResponse(..., { afterToolResults: true })` without requesting a second reply. `sendFunctionOutput` acknowledges delivery with `{ delivered: true, automatic: true }`; this is not speech completion. `createResponse: false` cannot disable the service's native continuation, nor can per-response instructions control it. Other providers keep explicit response creation and completion tracking.
|
|
35
46
|
- Normalize events that only prove liveness to `response.activity` with a `response_id`, without forwarding thinking text.
|
|
47
|
+
- An `error` that carries a `response_id` settles only that response. Leave the id off when the failure belongs to the request waiting on the frontend, so it falls back to the sole waiter.
|
|
36
48
|
- Set `conversationItemIdEcho: false` when the service assigns new IDs to acknowledged conversation items. Gateway correlates the single pending item without delays or skipping acknowledgment.
|
|
37
49
|
- Set `imageRequiresAudioStart: true` only if the service requires audio before the first video frame. Gateway primes that timeline with 20 ms of PCM16 silence so camera input does not require opening the microphone.
|
|
38
50
|
- Set `acknowledgesConversationItems: false` when the service accepts input or tool-response messages without sending a conversation-item acknowledgment. Gateway resolves the send after writing the frame.
|
|
@@ -55,8 +67,14 @@ For [Google Live](https://ai.google.dev/api/live), context-only history uses `cl
|
|
|
55
67
|
|
|
56
68
|
## Desktop settings
|
|
57
69
|
|
|
58
|
-
Built-in frontend settings live in `shared/realtime-provider-definitions.mjs`, a browser-safe catalog without credentials or connection implementations.
|
|
70
|
+
Built-in frontend settings live in `shared/realtime-provider-definitions.mjs`, a browser-safe catalog without credentials or connection implementations. Each service explicitly declares its name, configurable slots (`fields`), required slot (`required`), and defaults. Required credentials and editable model/voice fields are not inferred from whether a model catalog exists. All providers share the active connection's `QWEN_AUDIO_REALTIME_*` environment fields; adding a provider does not require another set of credential, model, URL, and voice variables.
|
|
71
|
+
|
|
72
|
+
Provider-specific model and API data live in `shared/realtime-models/dashscope.mjs`, `stepfun.mjs`, `openai.mjs`, `google.mjs`, and `volcengine.mjs`; `shared/realtime-model-catalog.mjs` is their public facade. These code-owned records define model IDs, adapter/API bindings, default endpoints, capabilities, session defaults, and constraints. Aggregation and resolution contain no provider-specific configuration. When a service exposes model selection, the desktop dropdown uses its static supported-model list; it does not accept user-defined model records or infer support from a free-form model name.
|
|
73
|
+
|
|
74
|
+
For example, public provider `openai` supports `gpt-realtime-2.1` and `gpt-live-1`. Their model records bind to `openai-realtime` and `openai-live` respectively. The built-in registry selects the implementation from those bindings, while user configuration stays at provider + model. Adapter is not a configurable field. The custom registry injection contract above is unchanged.
|
|
75
|
+
|
|
76
|
+
Likewise, `google` models bind to `google-live`, and `volcengine` models bind to `doubao-seeduplex`. The `speech-to-speech` and `minicpm-o` entries identify services whose models are managed upstream; they do not expose a Gateway model selector or require a cloud-vendor credential by implication.
|
|
59
77
|
|
|
60
|
-
The form
|
|
78
|
+
The form displays Service URL, API Key, Model, and Voice, mapped to the `endpoint`, `credential`, `model`, and `voice` slots. Providers expose only configurable slots; upstream-owned model and voice controls remain disabled. Bearer tokens use the API Key field. Switching provider must clear or replace the previous connection's values rather than send its credential to another service. Switching models within the same provider keeps the key; changing protocol adapters clears URL and voice overrides. Legacy variable names are handled at the configuration-read boundary, not in adapters. A remote Gateway continues to own its frontend configuration.
|
|
61
79
|
|
|
62
80
|
Settings metadata is separate from runtime adapters. Host-injected custom Providers are not automatically registered in the desktop chooser.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# 扩展 Realtime Provider
|
|
2
2
|
|
|
3
|
-
Realtime Provider
|
|
3
|
+
运行时扩展 API 中的 Realtime Provider 是协议适配器,不是客户端,也不是编排运行时本身。用户配置中的 Provider 则标识服务,如 `openai`;同一服务的不同模型可以绑定不同的内部 Adapter。业务宿主可以注入自定义 Provider,而不必修改通用会话与后台工作逻辑。下面通过 Gateway 应用入口进行装配。
|
|
4
|
+
|
|
5
|
+
为已有供应商新增模型支持时,在 `shared/realtime-models/` 下对应的供应商数据文件中维护并补充测试。模型定义与适配参数属于框架代码,不是用户配置;用户只需[选择受支持模型](../configuration/frontend.zh.md#选择受支持模型)。
|
|
4
6
|
|
|
5
7
|
```js
|
|
6
8
|
import { createGatewayApplication } from 'qwen-audio-agent/gateway-application'
|
|
@@ -25,13 +27,23 @@ createGatewayApplication({
|
|
|
25
27
|
- 每个 Provider 都是独立适配器,完整拥有自己的 URL、认证、模型、Session 和错误分类语义;不要通过改造另一个 Provider 来承载业务差异。
|
|
26
28
|
- `url()`、`headers()`、`model()` 可从宿主配置闭包读取服务地址、令牌和模型;Gateway 不要求为业务 Provider 增加环境变量。
|
|
27
29
|
- `createProtocol()` 每条 Realtime 连接调用一次,适合生成连接级 ID 和隔离状态。
|
|
28
|
-
-
|
|
30
|
+
- `createProtocol({ emit, send })` 还会收到两个钩子:`emit(event)` 注入一条经 `normalizeIncoming()` 的合成服务端事件,例如在输出静默后收掉当前语音段;`send(payload, options)` 经 `encodeOutgoing()` 发出协议自己的事件,以 `{ correlate: false }` 发出的 `response.create` 不关联等待中的 Gateway 请求。
|
|
31
|
+
- `concurrentVoicePlayback` 声明全双工服务:语音输出与后端工作并行,是否回复某一轮由模型决定,没有得到回复的轮次会被释放,不报错。只代表播放的合成 response 标 `__voicePlayback: true`,模型自发的发言再标 `__voiceAutomatic: true`;它们不阻挡 Gateway 请求,要求说话的请求只由播放 response 回复。用户打断调用可选的 `interruptPlayback()`,用户是开口打断时带 `{ speech: true }`,其他取消以 `{ stop: true }` 调用它,它可以返回一帧由运行时发出。用户后续的轮次只对 `respond_permission` 与 `update_agent_task` 顶掉更早的工具调用,更早轮次的 `cancel_agent_task` 也取消不到后来轮次发起的工作;权限请求和后台追问只能由 Gateway 询问之后开始的轮次回答。播报在其 response 完成时确认送达。默认关闭。
|
|
32
|
+
- `interruptionPlaysOut` 声明模型在用户打断时把已经生成的语音说完。插话、文字输入和 `interrupt` 都不清空播放;`voice.ready` 带上 `interruptionPlaysOut: true`,客户端在 `listening` 和自己发起打断时继续播放。默认关闭。
|
|
33
|
+
- `pacedOutputAudio` 声明输出音频按播放速度到达、没有提前量。`voice.ready` 带上 `pacedOutputAudio: true`,客户端连本机 Gateway 时也先缓冲再播放,和连远程 Gateway 时一样。默认关闭。
|
|
34
|
+
- `inputMuteOnSleep` 允许客户端休眠时使用协议静音并保留连接。运行时合并休眠、麦克风静音和输入占用状态,重连时在缓冲音频之前恢复静音;静音回执及合成音频时钟由 Provider 管理。默认关闭,目前仅 Qwen Live 启用。
|
|
35
|
+
- `toolOutputsBeforeResponse` 声明服务在有调用未回传结果时拒绝 `response.create`,且发起调用的 response 只在之后的 `response.create` 上继续。函数结果不进响应队列,Gateway 请求等所有调用都有结果后才发出,运行时把这个 response 续上一次:由 Gateway 的后续请求,或由 `continueToolResults()`。当前连接并未在等的调用,其结果不发送。默认关闭。
|
|
36
|
+
- 可选的同步 `validateSessionOptions({ sessionOptions })` 在上游连接前执行;拒绝已确认无效的服务参数,其他服务特有参数仍需上游验证。这不绕过受支持模型 ID 的目录检查。
|
|
29
37
|
- `connectionMessages()` 在 WebSocket 打开后、`session.update` 之前发送原始握手帧。
|
|
30
38
|
- 其余事件通过 `encodeOutgoing()` 与 `normalizeIncoming()` 转换,Gateway 的工具调用、任务和客户端协议保持不变。
|
|
31
39
|
- 不支持临时回复指令的协议可实现 `responseInstructionsItem(response)`,将内部回复指令转为普通对话项。Gateway 等待确认后调用 `responseCreate(response)`,后者负责去掉上游不支持的参数。此时 `perResponseInstructions` 为 `false`,指令会进入会话历史。
|
|
32
40
|
- `conversationItemCreate(item, { contextOnly })` 区分上下文投递和用户交互输入。对于消息项,`contextOnly: true` 必须写入上下文且不触发回复,不能只缓存到下一次 `responseCreate`;用户主动发送文本或文件时,Gateway 传入 `false`。工具回执仍遵循供应商原生的续答语义。
|
|
41
|
+
- `automaticUserResponses: true` 表示真实用户消息项会触发原生回复,无需 `response.create`(Qwen Live),默认关闭;不意味着可以把上下文更新作为用户请求发送。
|
|
42
|
+
- `contextOnlyItems: false` 禁止把用户消息项当作静默上下文注入,避免服务将其视为新输入;默认开启。Qwen Live 关闭此能力,历史通过建连提示词恢复。
|
|
43
|
+
- `nativeSessionContext: true` 允许不关联委派 ID 的原生任务状态更新,默认关闭,目前仅 GPT Live 开启。Qwen Live 保持关闭,避免无关联文本被当成用户输入。
|
|
33
44
|
- 仅当工具结果会由服务原生续答时声明 `automaticToolResponses: true`(豆包 Seeduplex、Google Live)。运行时发送这类回执不等待当前响应结束;工具批次结束时通过 `ensureResponse(..., { afterToolResults: true })` 避免再次请求回复。`sendFunctionOutput` 返回 `{ delivered: true, automatic: true }` 只表示回执已投递,不表示播报完成。`createResponse: false` 不能禁止服务原生续答,单次回复指令也不能控制它。其他 Provider 保持显式请求回复和完成跟踪。
|
|
34
45
|
- 只表示响应仍在进行的事件可转换为带 `response_id` 的 `response.activity`,无需转发原始思考内容。
|
|
46
|
+
- 带 `response_id` 的 `error` 只结算它点名的那个回复;失败属于前端正在等待的请求时不要带 id,以回落到唯一等待者。
|
|
35
47
|
- 服务端确认对话项时会重分配 ID 的 Provider,应声明 `conversationItemIdEcho: false`;网关按唯一待确认项关联,无需增加延时或跳过确认。
|
|
36
48
|
- 仅当服务要求首帧视频之前必须先有音频时,声明 `imageRequiresAudioStart: true`;网关用 20 毫秒 PCM16 静音初始化时间线,视频输入无需开启麦克风。
|
|
37
49
|
- 服务接受输入或工具结果但不返回 conversation-item 确认事件时,应声明 `acknowledgesConversationItems: false`;Gateway 写出 frame 后即完成本次发送。
|
|
@@ -54,8 +66,14 @@ Provider 和 Protocol 会在注册与建连时校验;缺少方法或返回无
|
|
|
54
66
|
|
|
55
67
|
## 桌面设置
|
|
56
68
|
|
|
57
|
-
仓库内置前台的设置统一定义在 `shared/realtime-provider-definitions.mjs`,它不依赖 Node.js
|
|
69
|
+
仓库内置前台的设置统一定义在 `shared/realtime-provider-definitions.mjs`,它不依赖 Node.js,也不包含密钥值或连接实现。各服务显式声明名称、可编辑槽位 `fields`、必填槽位 `required` 和默认值,不再通过是否存在模型目录推断是否必填密钥或允许修改模型、音色。各供应商共用当前连接的 `QWEN_AUDIO_REALTIME_*` 环境变量,不需再新增一套 Key、模型、地址和音色变量。
|
|
70
|
+
|
|
71
|
+
供应商专属模型和 API 数据分别位于 `shared/realtime-models/dashscope.mjs`、`stepfun.mjs`、`openai.mjs`、`google.mjs`、`volcengine.mjs`,`shared/realtime-model-catalog.mjs` 是公共入口。这些代码数据定义模型 ID、Adapter/API 绑定、默认地址、能力、会话默认参数和接入约束,聚合与解析层不包含供应商具体配置。服务开放模型选择时,桌面下拉框使用其静态支持列表,不接受用户自定义模型记录,也不通过自由输入的模型名称推断支持情况。
|
|
72
|
+
|
|
73
|
+
例如,公开 Provider `openai` 支持 `gpt-realtime-2.1` 和 `gpt-live-1`,模型记录分别绑定 `openai-realtime`、`openai-live`。内置注册表依据绑定选择实现,用户仍只选择供应商和模型,不能配置 Adapter 字段。上面的自定义注册表注入契约保持不变。
|
|
74
|
+
|
|
75
|
+
同样,`google` 的模型绑定 `google-live`,`volcengine` 的模型绑定 `doubao-seeduplex`。`speech-to-speech` 和 `minicpm-o` 则标识由上游管理模型的服务,不在 Gateway 开放模型选择,也不会因此要求云厂商凭据。
|
|
58
76
|
|
|
59
|
-
|
|
77
|
+
界面显示“服务地址、API Key、模型、音色”四行,分别对应 `endpoint`、`credential`、`model`、`voice` 配置槽位。Provider 只暴露可配置槽位;由上游管理的模型、音色保持禁用。Bearer 令牌使用 API Key 字段。切换供应商时应清空或替换旧连接值,不能将旧凭据发送给另一家服务。同一供应商下换模型保留 Key;跨协议 Adapter 时清空地址和音色覆盖。旧变量别名只在配置读取边界处理,不进入 Adapter。连接远端 Gateway 时,仍由远端管理前台配置。
|
|
60
78
|
|
|
61
79
|
这份设置定义与运行时适配器分离;宿主注入的自定义 Provider 不会自动注册到桌面设置页。
|
|
@@ -10,21 +10,27 @@ Gemini Live's bidirectional stream into the shared Realtime runtime.
|
|
|
10
10
|
Edit the user configuration file shown by `qwenaudio config`:
|
|
11
11
|
|
|
12
12
|
```dotenv
|
|
13
|
-
QWEN_AUDIO_REALTIME_PROVIDER=google
|
|
14
|
-
|
|
13
|
+
QWEN_AUDIO_REALTIME_PROVIDER=google
|
|
14
|
+
QWEN_AUDIO_REALTIME_API_KEY=your-google-api-key
|
|
15
|
+
QWEN_AUDIO_REALTIME_MODEL=gemini-3.8-live
|
|
16
|
+
QWEN_AUDIO_REALTIME_URL=
|
|
17
|
+
QWEN_AUDIO_REALTIME_VOICE=
|
|
15
18
|
```
|
|
16
19
|
|
|
17
20
|
| Optional setting | Default | Description |
|
|
18
21
|
| --- | --- | --- |
|
|
19
|
-
| `
|
|
20
|
-
| `
|
|
21
|
-
| `
|
|
22
|
-
| `GEMINI_API_KEY` / `GOOGLE_LIVE_API_KEY` | Empty | Aliases for `GOOGLE_API_KEY` |
|
|
22
|
+
| `QWEN_AUDIO_REALTIME_URL` | `wss://generativelanguage.googleapis.com/ws/google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent` | WebSocket endpoint |
|
|
23
|
+
| `QWEN_AUDIO_REALTIME_MODEL` | `gemini-3.8-live` | Current built-in model profile |
|
|
24
|
+
| `QWEN_AUDIO_REALTIME_VOICE` | Empty | Service default, or a prebuilt Gemini Live voice name |
|
|
23
25
|
|
|
24
|
-
Desktop exposes the same fields under **Voice frontend
|
|
26
|
+
Desktop exposes the same fields under **Voice frontend → Google**, with **Gemini 3.8 Live** as the model.
|
|
25
27
|
Restart a terminal Gateway after editing the file; for an installed service,
|
|
26
28
|
run `qwenaudio gateway restart`.
|
|
27
29
|
|
|
30
|
+
`google` identifies the service; the model definition binds to the internal
|
|
31
|
+
`google-live` adapter. Older `google-live` configurations remain readable and
|
|
32
|
+
save as `google`, without changing the API, model, or credentials.
|
|
33
|
+
|
|
28
34
|
## Integration boundary
|
|
29
35
|
|
|
30
36
|
- The adapter uses Gemini Live's native WebSocket endpoint and adds the API key
|
|
@@ -51,6 +57,6 @@ Google's current Gemini Live API documentation.
|
|
|
51
57
|
|
|
52
58
|
## Read next
|
|
53
59
|
|
|
54
|
-
- [
|
|
60
|
+
- [OpenAI Realtime](openai-realtime.md)
|
|
55
61
|
- [Frontend configuration reference](../configuration/frontend.md)
|
|
56
62
|
- [Custom Provider](custom-provider.md)
|
|
@@ -9,20 +9,25 @@ Adapter 只把 Gemini Live 的双向流协议转换成项目内统一的 Realtim
|
|
|
9
9
|
编辑 `qwenaudio config` 显示的用户配置文件:
|
|
10
10
|
|
|
11
11
|
```dotenv
|
|
12
|
-
QWEN_AUDIO_REALTIME_PROVIDER=google
|
|
13
|
-
|
|
12
|
+
QWEN_AUDIO_REALTIME_PROVIDER=google
|
|
13
|
+
QWEN_AUDIO_REALTIME_API_KEY=your-google-api-key
|
|
14
|
+
QWEN_AUDIO_REALTIME_MODEL=gemini-3.8-live
|
|
15
|
+
QWEN_AUDIO_REALTIME_URL=
|
|
16
|
+
QWEN_AUDIO_REALTIME_VOICE=
|
|
14
17
|
```
|
|
15
18
|
|
|
16
19
|
| 可选配置 | 默认值 | 说明 |
|
|
17
20
|
| --- | --- | --- |
|
|
18
|
-
| `
|
|
19
|
-
| `
|
|
20
|
-
| `
|
|
21
|
-
| `GEMINI_API_KEY` / `GOOGLE_LIVE_API_KEY` | 空 | `GOOGLE_API_KEY` 的别名 |
|
|
21
|
+
| `QWEN_AUDIO_REALTIME_URL` | `wss://generativelanguage.googleapis.com/ws/google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent` | WebSocket 端点 |
|
|
22
|
+
| `QWEN_AUDIO_REALTIME_MODEL` | `gemini-3.8-live` | 当前内置模型档案 |
|
|
23
|
+
| `QWEN_AUDIO_REALTIME_VOICE` | 空 | 使用服务默认音色,或填写 Gemini Live 预置音色名 |
|
|
22
24
|
|
|
23
|
-
桌面端在 **语音前台
|
|
25
|
+
桌面端在 **语音前台 → Google** 下暴露同样字段,模型选择 **Gemini 3.8 Live**。终端 Gateway 修改文件后需重启;
|
|
24
26
|
若是已安装的后台服务,执行 `qwenaudio gateway restart`。
|
|
25
27
|
|
|
28
|
+
`google` 标识服务,模型定义绑定内部的 `google-live` Adapter。旧 `google-live`
|
|
29
|
+
配置仍可读取,保存后统一为 `google`,不改变 API、模型或凭据。
|
|
30
|
+
|
|
26
31
|
## 集成边界
|
|
27
32
|
|
|
28
33
|
- Adapter 使用 Gemini Live 原生 WebSocket 端点;若 URL 中没有 `key` 或
|
|
@@ -44,6 +49,6 @@ GOOGLE_API_KEY=your-google-api-key
|
|
|
44
49
|
|
|
45
50
|
## 继续阅读
|
|
46
51
|
|
|
47
|
-
- [
|
|
52
|
+
- [OpenAI Realtime](openai-realtime.zh.md)
|
|
48
53
|
- [前台配置参考](../configuration/frontend.zh.md)
|
|
49
54
|
- [自定义 Provider](custom-provider.zh.md)
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# GPT-Live 1 (OpenAI Live API)
|
|
2
|
+
|
|
3
|
+
GPT-Live 1 handles the full-duplex spoken conversation. This integration uses
|
|
4
|
+
**Client delegation**: Gateway sends delegated work to the configured backend
|
|
5
|
+
Agent and returns its progress, questions, and results to the Live session.
|
|
6
|
+
It does not use OpenAI-hosted Responses delegation.
|
|
7
|
+
|
|
8
|
+
## Configuration
|
|
9
|
+
|
|
10
|
+
Edit the user configuration file shown by `qwenaudio config`:
|
|
11
|
+
|
|
12
|
+
```dotenv
|
|
13
|
+
QWEN_AUDIO_REALTIME_PROVIDER=openai
|
|
14
|
+
QWEN_AUDIO_REALTIME_API_KEY=your-openai-key
|
|
15
|
+
QWEN_AUDIO_REALTIME_MODEL=gpt-live-1
|
|
16
|
+
QWEN_AUDIO_REALTIME_URL=
|
|
17
|
+
QWEN_AUDIO_REALTIME_VOICE=
|
|
18
|
+
|
|
19
|
+
# Example: select an installed and authenticated backend Agent.
|
|
20
|
+
AGENT_PROTOCOL=qoder
|
|
21
|
+
QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE=native
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Choose a [backend Agent](../backends/overview.md) and complete its own setup
|
|
25
|
+
first. Delegated work requires an available backend; `none` leaves only the
|
|
26
|
+
Live model's conversation capability, not a cloud execution fallback.
|
|
27
|
+
|
|
28
|
+
| Optional setting | Default | Description |
|
|
29
|
+
| --- | --- | --- |
|
|
30
|
+
| `QWEN_AUDIO_REALTIME_URL` | `wss://api.openai.com/v1/live/sessions` | Live API WebSocket endpoint |
|
|
31
|
+
| `QWEN_AUDIO_REALTIME_VOICE` | Empty | Use the service default or specify a supported voice |
|
|
32
|
+
|
|
33
|
+
Select `gpt-live-1` explicitly: the `openai` provider defaults to
|
|
34
|
+
`gpt-realtime-2.1`. The model definition selects the internal `openai-live`
|
|
35
|
+
adapter; users do not configure the protocol separately. When editing the
|
|
36
|
+
configuration file to switch from Realtime, clear or replace URL and voice
|
|
37
|
+
overrides. The former `GPT_LIVE_1_DELEGATION_MODEL` setting is no longer used.
|
|
38
|
+
|
|
39
|
+
Desktop exposes these settings under **Voice frontend → OpenAI → GPT-Live 1**.
|
|
40
|
+
Restart a terminal Gateway after editing the file; for an installed service,
|
|
41
|
+
run `qwenaudio gateway restart`.
|
|
42
|
+
|
|
43
|
+
### Optional timing settings
|
|
44
|
+
|
|
45
|
+
Live streams audio and transcript fragments rather than Realtime-style turn
|
|
46
|
+
boundaries. These settings affect local caption and playback grouping, not
|
|
47
|
+
backend task completion. Values are milliseconds, clamped to 100–10,000;
|
|
48
|
+
non-numeric values are ignored.
|
|
49
|
+
|
|
50
|
+
| Setting | Default | Description |
|
|
51
|
+
| --- | --- | --- |
|
|
52
|
+
| `GPT_LIVE_1_OUTPUT_IDLE_MS` | `1500` | Output quiet period that ends a displayed answer |
|
|
53
|
+
| `GPT_LIVE_1_WORD_GAP_MS` | `600` | Word gap that separates a new answer after an interruption |
|
|
54
|
+
| `GPT_LIVE_1_INPUT_SEGMENT_GAP_MS` | `1200` | Speech gap that separates user utterances |
|
|
55
|
+
| `GPT_LIVE_1_INPUT_IDLE_MS` | `2000` | Input quiet period that completes a user utterance |
|
|
56
|
+
|
|
57
|
+
## Execution and permissions
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
Spoken request → GPT-Live Client delegation
|
|
61
|
+
→ Gateway Task → configured backend Agent
|
|
62
|
+
← progress / permission request / result
|
|
63
|
+
→ Live context update or spoken response
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- **Native delegation replaces `spawn_thinking` for this model.** The cloud
|
|
67
|
+
delegation event carries an ID and a timeline position, not task text.
|
|
68
|
+
Gateway builds the backend request from the conversation context and
|
|
69
|
+
transcriptions. Missing or incomplete input must not authorize an action.
|
|
70
|
+
- **Gateway remains the task owner.** Task status, cancellation, permissions,
|
|
71
|
+
and durable results use the existing task system. A speech interruption does
|
|
72
|
+
not cancel backend work.
|
|
73
|
+
- **Permissions require explicit client controls.** Use the permission card
|
|
74
|
+
in Desktop or WebUI, or `/approve [permission_id]` and `/reject [permission_id]`
|
|
75
|
+
in TUI. With multiple pending requests, specify the displayed permission ID;
|
|
76
|
+
`/approve` grants only the selected task, not session-wide permission.
|
|
77
|
+
The decision goes directly to Gateway and the waiting backend, without
|
|
78
|
+
another model call. Saying or typing “yes” does not approve
|
|
79
|
+
a permission request in this version. Switching to GPT-Live does not enable
|
|
80
|
+
automatic approval or change the configured backend permission policy.
|
|
81
|
+
- **Waiting for an answer is not completion.** The desktop compact card shows
|
|
82
|
+
that input is required; choose **Answer question** to open the conversation
|
|
83
|
+
form. WebUI renders the form below the task. Use **Cancel task** to stop work;
|
|
84
|
+
a spoken request does not automatically cancel backend execution.
|
|
85
|
+
- **Frontend tools are not registered with GPT-Live.** The backend uses its
|
|
86
|
+
own tools and configured capabilities. Gateway's frontend-only search,
|
|
87
|
+
memory, reminder, MCP/OpenAPI, and client-action tools are not automatically
|
|
88
|
+
transferred to it. Use client controls for task management; this integration
|
|
89
|
+
does not promise voice control of those frontend-only features.
|
|
90
|
+
|
|
91
|
+
See [Work and Permissions](../guides/tasks.md) for task-card controls and
|
|
92
|
+
[Backend Permission Modes](../configuration/backend.md#backend-permission-modes)
|
|
93
|
+
for the existing backend policies.
|
|
94
|
+
|
|
95
|
+
## Prompt structure
|
|
96
|
+
|
|
97
|
+
Live's concise policy lives in `config/frontend-agent/LIVE_PROMPT.md`, separate
|
|
98
|
+
from the tool-based `PROMPT.md`. Both reuse the same assistant profile, supplied
|
|
99
|
+
memory context, and runtime context. Live does not include instructions to call
|
|
100
|
+
frontend tools that it cannot use. To customize it, place `LIVE_PROMPT.md` in
|
|
101
|
+
`QWEN_AUDIO_AGENT_FRONTEND_PROMPT_DIR`; if that file is absent, the packaged Live
|
|
102
|
+
policy is used. A present but empty or unreadable file is an error.
|
|
103
|
+
|
|
104
|
+
## Inputs and delivery
|
|
105
|
+
|
|
106
|
+
- **Voice:** the WebSocket uses Bearer authentication and mono PCM16 audio at
|
|
107
|
+
24 kHz in both directions. Recent text history is supplied at session startup.
|
|
108
|
+
- **Text and files:** typed requests go directly to the configured backend;
|
|
109
|
+
a short text summary is mirrored into Live's context. Submit the question
|
|
110
|
+
and its images or files together. Attachments follow the backend's supported
|
|
111
|
+
input capabilities, not a GPT-Live image input path. Later spoken references
|
|
112
|
+
to historical attachments are not supported by this integration; Gateway
|
|
113
|
+
does not attach all earlier files automatically.
|
|
114
|
+
- **Progress and results:** quiet progress uses `session.thinking.append`;
|
|
115
|
+
material to speak uses `session.commentary.append`. Updates for cloud-created
|
|
116
|
+
work retain its delegation ID. Locally initiated work uses a null delegation
|
|
117
|
+
ID. An append acknowledgment confirms context acceptance, not audible delivery.
|
|
118
|
+
Each append is conservatively shortened to respect the upstream limit; the full
|
|
119
|
+
result remains in the local task record.
|
|
120
|
+
- **Natural interruptions:** the Live model controls its continuous speech.
|
|
121
|
+
Already generated audio plays out; Gateway does not apply Realtime's
|
|
122
|
+
speech-start playback clearing. Text input and explicit stop actions can
|
|
123
|
+
request that the model stop speaking without cancelling the backend task.
|
|
124
|
+
|
|
125
|
+
## Limitations and validation
|
|
126
|
+
|
|
127
|
+
- Oral permission approval is not implemented. Use a client with permission
|
|
128
|
+
controls when the backend can request authorization.
|
|
129
|
+
- TUI does not yet provide structured backend-question forms. Answer those
|
|
130
|
+
requests through the Desktop or WebUI task card.
|
|
131
|
+
- GPT-Live receives no images directly, and this integration does not negotiate
|
|
132
|
+
live visual frames. Backend image understanding depends on the chosen Agent.
|
|
133
|
+
- Audio and transcript timing are service-dependent. The adapter's local turn
|
|
134
|
+
grouping is not a protocol guarantee that an answer was heard or an action
|
|
135
|
+
completed.
|
|
136
|
+
- An open Live connection can incur service charges even when the microphone
|
|
137
|
+
is muted. Backend usage is separate.
|
|
138
|
+
|
|
139
|
+
Local tests cover Client session setup, delegation and result events, task
|
|
140
|
+
isolation, explicit permission handling, and unaffected Realtime behavior.
|
|
141
|
+
They do not replace live validation of account access, model behavior, latency,
|
|
142
|
+
or voices. See OpenAI's [delegation guide](https://developers.openai.com/api/docs/guides/live-delegation)
|
|
143
|
+
for the upstream protocol.
|
|
144
|
+
|
|
145
|
+
## Read next
|
|
146
|
+
|
|
147
|
+
- [OpenAI Realtime](openai-realtime.md)
|
|
148
|
+
- [Frontend configuration reference](../configuration/frontend.md)
|
|
149
|
+
- [Custom Provider](custom-provider.md)
|