qwen-audio-agent 2.1.0 → 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.
Files changed (110) hide show
  1. package/README.md +6 -3
  2. package/README_ZH.md +6 -3
  3. package/cli/package.json +1 -1
  4. package/cli/src/config-command.mjs +33 -2
  5. package/cli/src/gateway-service.mjs +7 -1
  6. package/config/frontend-agent/LIVE_PROMPT.md +64 -0
  7. package/desktop/src/i18n.mjs +1 -1
  8. package/desktop/src/settings-config.mjs +10 -24
  9. package/docs/configuration/frontend.md +29 -12
  10. package/docs/configuration/frontend.zh.md +28 -12
  11. package/docs/contract.md +2 -0
  12. package/docs/contract.zh.md +2 -0
  13. package/docs/extensions.md +14 -0
  14. package/docs/extensions.zh.md +11 -0
  15. package/docs/getting-started/install.md +3 -0
  16. package/docs/getting-started/install.zh.md +3 -0
  17. package/docs/getting-started/mobile.md +8 -2
  18. package/docs/getting-started/mobile.zh.md +5 -0
  19. package/docs/guides/web-search.md +17 -1
  20. package/docs/guides/web-search.zh.md +15 -1
  21. package/docs/operations/troubleshooting.md +30 -0
  22. package/docs/operations/troubleshooting.zh.md +26 -0
  23. package/docs/voice-frontends/custom-provider.md +18 -3
  24. package/docs/voice-frontends/custom-provider.zh.md +18 -3
  25. package/docs/voice-frontends/google-live.md +7 -3
  26. package/docs/voice-frontends/google-live.zh.md +6 -3
  27. package/docs/voice-frontends/gpt-live-1.md +149 -0
  28. package/docs/voice-frontends/gpt-live-1.zh.md +114 -0
  29. package/docs/voice-frontends/{gpt-live.md → openai-realtime.md} +12 -5
  30. package/docs/voice-frontends/{gpt-live.zh.md → openai-realtime.zh.md} +11 -5
  31. package/docs/voice-frontends/qwen-audio-live.md +164 -0
  32. package/docs/voice-frontends/qwen-audio-live.zh.md +122 -0
  33. package/docs/voice-frontends/qwen-audio-realtime.md +2 -1
  34. package/docs/voice-frontends/qwen-audio-realtime.zh.md +2 -1
  35. package/docs/voice-frontends/qwen-omni-realtime.md +1 -1
  36. package/docs/voice-frontends/qwen-omni-realtime.zh.md +1 -1
  37. package/package.json +13 -4
  38. package/scripts/patch-build-node-gyp.mjs +63 -0
  39. package/scripts/prepare-build.mjs +2 -0
  40. package/scripts/verify-package.mjs +3 -0
  41. package/server/package.json +2 -2
  42. package/server/src/conversation/frontend-agent-context.mjs +18 -5
  43. package/server/src/core/citation.mjs +8 -2
  44. package/server/src/core/config.mjs +16 -5
  45. package/server/src/core/request-security.mjs +7 -1
  46. package/server/src/frontend/frontend-tools.mjs +14 -1
  47. package/server/src/frontend/retrieval/providers/bing.mjs +23 -12
  48. package/server/src/frontend/retrieval/providers/factory.mjs +9 -1
  49. package/server/src/frontend/retrieval/providers/mcp.mjs +17 -9
  50. package/server/src/frontend/retrieval/providers/so360.mjs +23 -12
  51. package/server/src/frontend/tools/agent-task-runtime.mjs +22 -4
  52. package/server/src/frontend/tools/tool-call-handler.mjs +56 -20
  53. package/server/src/memory/providers/markdown/context-store.mjs +3 -1
  54. package/server/src/orchestration/session-task-coordinator.mjs +4 -1
  55. package/server/src/orchestration/task-operations.mjs +5 -3
  56. package/server/src/orchestration/task-updates.mjs +2 -1
  57. package/server/src/transport/gateway-client-transport.mjs +19 -0
  58. package/server/src/transport/webrtc/protocol.mjs +1 -1
  59. package/server/src/voice/audio-stream-diagnostics.mjs +139 -0
  60. package/server/src/voice/native-delegation-runtime.mjs +360 -0
  61. package/server/src/voice/providers/dashscope-live.mjs +93 -0
  62. package/server/src/voice/providers/dashscope.mjs +12 -4
  63. package/server/src/voice/providers/doubao-seeduplex-protocol.mjs +54 -0
  64. package/server/src/voice/providers/doubao-seeduplex.mjs +6 -5
  65. package/server/src/voice/providers/ga-protocol.mjs +7 -2
  66. package/server/src/voice/providers/google-live-protocol.mjs +124 -34
  67. package/server/src/voice/providers/google-live.mjs +6 -5
  68. package/server/src/voice/providers/gpt-live-1-protocol.mjs +597 -0
  69. package/server/src/voice/providers/gpt-live-1.mjs +3 -0
  70. package/server/src/voice/providers/gpt-live-client-context.mjs +182 -0
  71. package/server/src/voice/providers/openai-live.mjs +150 -0
  72. package/server/src/voice/providers/{gpt-live.mjs → openai-realtime.mjs} +15 -14
  73. package/server/src/voice/providers/provider-registry.mjs +11 -1
  74. package/server/src/voice/providers/qwen-live-protocol.mjs +399 -0
  75. package/server/src/voice/providers/registry.mjs +45 -10
  76. package/server/src/voice/providers/runtime-configuration.mjs +17 -6
  77. package/server/src/voice/providers/stepfun.mjs +1 -1
  78. package/server/src/voice/realtime-input-runtime.mjs +56 -20
  79. package/server/src/voice/realtime-presentation-runtime.mjs +21 -4
  80. package/server/src/voice/realtime-provider-session.mjs +59 -14
  81. package/server/src/voice/realtime-provider.mjs +332 -36
  82. package/server/src/voice/realtime-session-runtime.mjs +207 -16
  83. package/server/src/voice/realtime-task-presentation.mjs +6 -2
  84. package/server/src/voice/realtime-turn-state.mjs +33 -2
  85. package/shared/gateway/client-sdk.mjs +15 -5
  86. package/shared/gateway/websocket-auth.mjs +2 -1
  87. package/shared/protocol/gateway-events.mjs +31 -0
  88. package/shared/realtime-legacy-environment.mjs +37 -8
  89. package/shared/realtime-model-catalog.mjs +12 -10
  90. package/shared/realtime-models/README.md +10 -2
  91. package/shared/realtime-models/dashscope.mjs +11 -0
  92. package/shared/realtime-models/{google-live.mjs → google.mjs} +1 -1
  93. package/shared/realtime-models/openai.mjs +24 -0
  94. package/shared/realtime-models/profile.mjs +6 -3
  95. package/shared/realtime-models/{doubao-seeduplex.mjs → volcengine.mjs} +1 -1
  96. package/shared/realtime-provider-catalog.mjs +7 -6
  97. package/shared/realtime-provider-definitions.mjs +87 -22
  98. package/shared/runtime-environment.mjs +2 -2
  99. package/shared/web-search-configuration.mjs +14 -2
  100. package/tui/package.json +2 -2
  101. package/tui/src/index.mjs +14 -9
  102. package/tui/src/runtime-configuration.mjs +2 -0
  103. package/tui/src/terminal-commands.mjs +40 -0
  104. package/tui/src/text-cli.mjs +10 -1
  105. package/web/dist/assets/index-Bc2Q04J9.css +1 -0
  106. package/web/dist/assets/index-bY4DFXKT.js +96 -0
  107. package/web/dist/index.html +2 -2
  108. package/shared/realtime-models/gpt-live.mjs +0 -10
  109. package/web/dist/assets/index-8erKDCr2.css +0 -1
  110. package/web/dist/assets/index-Cs4hYWbS.js +0 -96
@@ -1,6 +1,6 @@
1
- # GPT-Live / OpenAI Realtime
1
+ # OpenAI Realtime
2
2
 
3
- qwen-audio-agent can connect to OpenAI's GPT-Live / Realtime WebSocket API as
3
+ qwen-audio-agent can connect to OpenAI's Realtime WebSocket API as
4
4
  a cloud voice frontend. Gateway still owns frontend tools, memory, reminders,
5
5
  task delegation, and backend-Agent orchestration; the provider adapter only
6
6
  translates the OpenAI GA Realtime wire shape into the shared runtime.
@@ -10,7 +10,7 @@ translates the OpenAI GA Realtime wire shape into the shared runtime.
10
10
  Edit the user configuration file shown by `qwenaudio config`:
11
11
 
12
12
  ```dotenv
13
- QWEN_AUDIO_REALTIME_PROVIDER=gpt-live
13
+ QWEN_AUDIO_REALTIME_PROVIDER=openai
14
14
  QWEN_AUDIO_REALTIME_API_KEY=your-openai-key
15
15
  QWEN_AUDIO_REALTIME_MODEL=gpt-realtime-2.1
16
16
  QWEN_AUDIO_REALTIME_URL=
@@ -23,7 +23,13 @@ QWEN_AUDIO_REALTIME_VOICE=
23
23
  | `QWEN_AUDIO_REALTIME_MODEL` | `gpt-realtime-2.1` | Current built-in model profile |
24
24
  | `QWEN_AUDIO_REALTIME_VOICE` | Empty | Service default, or a voice ID supported by the model |
25
25
 
26
- Desktop exposes the same fields under **Voice frontend → GPT-Live**. Restart a
26
+ OpenAI is one provider with multiple models. This model selects the internal
27
+ `openai-realtime` adapter; `gpt-live-1` selects `openai-live`. Users configure
28
+ the provider and model, not the adapter. Legacy provider values such as
29
+ `gpt-live` and `openai-realtime` retain the Realtime default and are saved as
30
+ `openai` with the corresponding model; see [older configuration](../configuration/frontend.md#older-configuration).
31
+
32
+ In Desktop, select **Voice frontend → OpenAI**, then **GPT Realtime 2.1**. Restart a
27
33
  terminal Gateway after editing the file; for an installed service, run
28
34
  `qwenaudio gateway restart`.
29
35
 
@@ -39,7 +45,7 @@ terminal Gateway after editing the file; for an installed service, run
39
45
  - Response metadata correlation is enabled, so Gateway-created replies can be
40
46
  distinguished from automatic server-side responses.
41
47
  - The current built-in model profile supports text/audio input and text/audio
42
- output. Live visual frames are not negotiated for this provider.
48
+ output. Live visual frames are not negotiated by this adapter.
43
49
 
44
50
  ## Validation boundary
45
51
 
@@ -50,6 +56,7 @@ are governed by OpenAI's current Realtime API documentation.
50
56
 
51
57
  ## Read next
52
58
 
59
+ - [GPT-Live 1 (Live API)](gpt-live-1.md)
53
60
  - [Google Gemini Live](google-live.md)
54
61
  - [Frontend configuration reference](../configuration/frontend.md)
55
62
  - [Custom Provider](custom-provider.md)
@@ -1,6 +1,6 @@
1
- # GPT-Live / OpenAI Realtime
1
+ # OpenAI Realtime
2
2
 
3
- qwen-audio-agent 可以把 OpenAI GPT-Live / Realtime WebSocket API 作为云端语音前台。
3
+ qwen-audio-agent 可以把 OpenAI Realtime WebSocket API 作为云端语音前台。
4
4
  Gateway 仍负责前台工具、记忆、提醒、任务委派和后台 Agent 编排;Provider Adapter
5
5
  只把 OpenAI GA Realtime 协议转换成项目内统一的运行时事件。
6
6
 
@@ -9,7 +9,7 @@ Gateway 仍负责前台工具、记忆、提醒、任务委派和后台 Agent
9
9
  编辑 `qwenaudio config` 显示的用户配置文件:
10
10
 
11
11
  ```dotenv
12
- QWEN_AUDIO_REALTIME_PROVIDER=gpt-live
12
+ QWEN_AUDIO_REALTIME_PROVIDER=openai
13
13
  QWEN_AUDIO_REALTIME_API_KEY=your-openai-key
14
14
  QWEN_AUDIO_REALTIME_MODEL=gpt-realtime-2.1
15
15
  QWEN_AUDIO_REALTIME_URL=
@@ -22,7 +22,12 @@ QWEN_AUDIO_REALTIME_VOICE=
22
22
  | `QWEN_AUDIO_REALTIME_MODEL` | `gpt-realtime-2.1` | 当前内置模型档案 |
23
23
  | `QWEN_AUDIO_REALTIME_VOICE` | 空 | 使用服务默认音色,或填写模型支持的音色 ID |
24
24
 
25
- 桌面端在 **语音前台 -> GPT-Live** 下暴露同样字段。终端 Gateway 修改文件后需重启;
25
+ OpenAI 是同一个供应商,可选择不同模型。本模型绑定内部 `openai-realtime` Adapter,
26
+ `gpt-live-1` 则绑定 `openai-live`;用户只配置供应商和模型,不配置 Adapter。
27
+ 旧 Provider 值 `gpt-live`、`openai-realtime` 等保持 Realtime 默认模型,保存时统一为
28
+ `openai` 和对应模型,详见[旧配置排查](../configuration/frontend.zh.md#旧配置排查)。
29
+
30
+ 桌面端选择 **语音前台 → OpenAI**,再选择 **GPT Realtime 2.1**。终端 Gateway 修改文件后需重启;
26
31
  若是已安装的后台服务,执行 `qwenaudio gateway restart`。
27
32
 
28
33
  ## 集成边界
@@ -33,7 +38,7 @@ QWEN_AUDIO_REALTIME_VOICE=
33
38
  Client 重采样。
34
39
  - Gateway 会把自己的 function tools 注册给模型;本 Adapter 不启用 OpenAI 内置工具。
35
40
  - 已启用响应元数据关联,Gateway 主动创建的回复可以和服务端自动回复区分开。
36
- - 当前内置模型档案支持文本/音频输入和文本/音频输出;此 Provider 不协商实时视觉帧。
41
+ - 当前内置模型档案支持文本/音频输入和文本/音频输出;此 Adapter 不协商实时视觉帧。
37
42
 
38
43
  ## 验证边界
39
44
 
@@ -43,6 +48,7 @@ QWEN_AUDIO_REALTIME_VOICE=
43
48
 
44
49
  ## 继续阅读
45
50
 
51
+ - [GPT-Live 1(Live API)](gpt-live-1.zh.md)
46
52
  - [Google Gemini Live](google-live.zh.md)
47
53
  - [前台配置参考](../configuration/frontend.zh.md)
48
54
  - [自定义 Provider](custom-provider.zh.md)
@@ -0,0 +1,164 @@
1
+ # Qwen Audio 3.1 Live
2
+
3
+ Qwen Audio Live handles full-duplex spoken conversation and decides when to delegate
4
+ work. This integration uses **Client mode**: the Gateway executes delegated
5
+ work through the configured backend Agent and returns progress, questions, and
6
+ results. It does not use DashScope-hosted Responses execution.
7
+
8
+ ## Configuration
9
+
10
+ Edit the user configuration file shown by `qwenaudio config`:
11
+
12
+ ```dotenv
13
+ QWEN_AUDIO_REALTIME_PROVIDER=dashscope
14
+ QWEN_AUDIO_REALTIME_API_KEY=your-dashscope-key
15
+ QWEN_AUDIO_REALTIME_MODEL=qwen-audio-3.1-live
16
+ QWEN_AUDIO_REALTIME_URL=wss://<WorkspaceId>.cn-beijing.maas.aliyuncs.com/api-ws/v1/live?model=qwen-audio-3.1-live
17
+ QWEN_AUDIO_REALTIME_VOICE=
18
+
19
+ # Example: choose an installed and authenticated backend Agent.
20
+ AGENT_PROTOCOL=qoder
21
+ QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE=native
22
+ ```
23
+
24
+ Replace `<WorkspaceId>` with the Beijing workspace that has access to Live,
25
+ and use its corresponding API key. Live needs this workspace-specific endpoint;
26
+ the public DashScope `/realtime` URL is not a substitute. The existing
27
+ `DASHSCOPE_WORKSPACE_ID` compatibility setting can construct the Live endpoint
28
+ when no explicit `QWEN_AUDIO_REALTIME_URL` is configured.
29
+
30
+ In Desktop, choose **Voice frontend → DashScope → Qwen Audio 3.1 Live**, then
31
+ fill in the workspace URL. The provider stays `dashscope`; protocol selection
32
+ is internal. When switching from Realtime, replace the URL and clear any
33
+ incompatible voice override. A terminal Gateway must be restarted after editing
34
+ the file; for an installed service, run `qwenaudio gateway restart`.
35
+
36
+ | Setting | This integration |
37
+ | --- | --- |
38
+ | Model selection | `qwen-audio-3.1-live` |
39
+ | Default voice | `yunshu` |
40
+ | Turn detection | `duplex` |
41
+ | Audio transport | Mono PCM16, 16 kHz input / 24 kHz output |
42
+ | Execution | Client delegation to the configured backend |
43
+
44
+ The service route remains `qwen-audio-3.1-live`. Following the official duplex
45
+ configuration, the adapter uses `qwen-audio-4.0-realtime-preview` for
46
+ `session.model`, with `turn_detection.type=duplex`. These are fixed protocol
47
+ settings, not a second model selector. Clear a Realtime voice override such as
48
+ `longanqian_v3.1` when switching; this Live configuration defaults to `yunshu`.
49
+ The upstream configuration is described in the official
50
+ [client-event reference](https://help.aliyun.com/zh/model-studio/qwen-audio-live-client-events).
51
+
52
+ Choose and configure a [backend Agent](../backends/overview.md) before requesting
53
+ work. With backend `none`, Live can converse but there is no automatic hosted
54
+ backend fallback.
55
+
56
+ ## Tasks and permissions
57
+
58
+ ```text
59
+ Voice or text → Qwen Live → native delegation
60
+ → Gateway Task → backend Agent
61
+ ← progress / question / result
62
+ ← Qwen Live ← update for the same delegation
63
+ ```
64
+
65
+ - Native delegation replaces `spawn_thinking` for this model. Qwen supplies the
66
+ task summary, relevant context, and later supplements; the Gateway maps them
67
+ to existing tasks rather than creating a separate execution system.
68
+ - Task cards, cancellation, permissions, and persisted results remain managed
69
+ by the Gateway. Speech interruption does not cancel backend work.
70
+ - Approve or reject through Desktop/WebUI permission cards, or TUI
71
+ `/approve [permission_id]` and `/reject [permission_id]`. These actions reach
72
+ the waiting backend directly. Saying or typing “yes” is not permission consent.
73
+ Switching models does not enable automatic approval.
74
+ - Answer structured backend questions through the Desktop/WebUI task form.
75
+ Ordinary text questions do not create a form. TUI currently has no structured
76
+ question form; use another client when the backend requests one.
77
+ - This version does not register frontend tools with Qwen Live. This is an
78
+ integration choice, not a claim that the upstream API lacks function tools.
79
+ Frontend search, memory, reminder, MCP/OpenAPI, and client-action tools are
80
+ not automatically transferred to the backend. Use client controls to manage
81
+ tasks; the backend retains its own configured tools.
82
+
83
+ See [Work and Permissions](../guides/tasks.md) for controls and
84
+ [backend permission modes](../configuration/backend.md#backend-permission-modes)
85
+ for the existing authorization policies.
86
+
87
+ ## Inputs and result delivery
88
+
89
+ - **Text** goes to the Live frontend as a real user message. The Gateway does
90
+ not also start a local task for the same text: execution starts only when
91
+ Live delegates it.
92
+ - **Audio timeline:** text-only requests and returned results also need the
93
+ service's audio clock to advance. When no real audio frames arrive, the
94
+ unmuted Provider sends 100 ms frames of zero-valued PCM. This synthetic silence does
95
+ not open or read the microphone.
96
+ - **Microphone mute and sleep:** retain the Live connection and send
97
+ `session.input_audio.mute`. After the matching `session.input_audio.muted`
98
+ receipt, stop all audio uploads, including synthetic silence; the service
99
+ maintains silent input. Until confirmed, only synthetic silence continues,
100
+ never real microphone audio. Resume with `session.input_audio.unmute` when
101
+ the input gates allow it: waking does not override microphone mute or input
102
+ suspension. Reconnecting during sleep restores mute without replaying old
103
+ audio. Only Qwen Live opts into this sleep protocol; other Providers keep
104
+ their existing behavior. Mute does not guarantee immediate result narration.
105
+ - **Images and files** remain in the Gateway's input registry. Live receives
106
+ textual attachment metadata, not image or file bytes. A delegation must retain
107
+ those explicit references for the Gateway to resolve the original inputs for
108
+ the backend. It does not infer attachments from filenames or attach all history.
109
+ - **Progress and permission state** use `session.thinking.append`, including
110
+ pending permission requests and their approved, denied, or cancelled outcomes.
111
+ These are context updates, not guaranteed spoken announcements; use the client
112
+ permission controls to respond. **Final task results** still use
113
+ `session.commentary.append`. Structured questions temporarily retain their
114
+ existing commentary path. A permission notice does not authorize work or
115
+ complete a task; resolving it requires explicit client action. Each task update
116
+ uses a delegation ID issued on the current connection. An
117
+ upstream receipt means accepted, not played to the user. The official
118
+ [server-event reference](https://help.aliyun.com/zh/model-studio/qwen-audio-live-server-events)
119
+ describes delegation and receipt events.
120
+ - **Known limitation:** live service tests have rejected subsequent updates for
121
+ the same delegation with `CONFLICT: Unknown Client call or stale Agent connection`
122
+ after accepting an intermediate commentary notice. Permission notices no longer
123
+ use that path; continuation after structured questions still needs validation.
124
+ Accepted results are also not guaranteed to be narrated promptly or
125
+ accurately; use the client's task state and actual result as the source of truth.
126
+ A separate test with no progress or result feedback ended the delegation with
127
+ `RequestTimeOut` after about 120 seconds, even with continuous audio uploads;
128
+ subsequent results were rejected. A live connection does not guarantee an
129
+ active delegation. This observation is not a fixed protocol timeout contract.
130
+ - **Reconnects** restore recent conversation as read-only prompt context.
131
+ Gateway task records survive independently, but old delegation IDs and results
132
+ are not replayed into the replacement Live connection. This adapter does not
133
+ send GPT Live-style null-ID task snapshots or unassociated proactive speech.
134
+ - **Natural interruptions** remain under the Live service's control. The
135
+ Gateway does not apply Realtime's speech-start audio-buffer clearing to this
136
+ integration. This does not imply that an interrupted backend task has stopped.
137
+
138
+ ## Prompt and limits
139
+
140
+ The shared `config/frontend-agent/LIVE_PROMPT.md` supplies the Live policy;
141
+ assistant profile, supplied memory, and runtime context reuse the existing
142
+ composition. It does not inherit instructions to call unavailable frontend
143
+ tools. A custom `LIVE_PROMPT.md` in `QWEN_AUDIO_AGENT_FRONTEND_PROMPT_DIR`
144
+ overrides the packaged policy; a missing file falls back to the packaged one.
145
+
146
+ Session settings are sent when establishing the connection. The service rejects
147
+ instructions-only `session.update`, so this adapter declares `mutableSession: false`:
148
+ prompt, persona, and session-configuration changes take effect on a new Live
149
+ connection, not through an in-place refresh.
150
+
151
+ This adapter does not provide direct image/video input, oral authorization,
152
+ or hosted Responses mode. Backend attachment support depends on the chosen
153
+ Agent. The behavior described here reflects this integration's configuration;
154
+ account access, latency, speech behavior, and voices still require validation
155
+ against the selected workspace. Muting the microphone does not close the Live
156
+ connection or pause its billing; disconnect when finished. Backend usage is
157
+ separate.
158
+
159
+ ## Read next
160
+
161
+ - [Qwen Audio Realtime](qwen-audio-realtime.md)
162
+ - [GPT Live](gpt-live-1.md)
163
+ - [Frontend configuration](../configuration/frontend.md)
164
+ - [Custom Provider](custom-provider.md)
@@ -0,0 +1,122 @@
1
+ # Qwen Audio 3.1 Live
2
+
3
+ Qwen Audio Live 负责全双工语音交流,并判断何时委派工作。本集成采用 **Client 模式**:
4
+ Gateway 通过已配置的后台 Agent 执行委派任务,再回传进度、追问与结果,
5
+ 不使用百炼托管的 Responses 后台执行。
6
+
7
+ ## 配置
8
+
9
+ 编辑 `qwenaudio config` 显示的用户配置文件:
10
+
11
+ ```dotenv
12
+ QWEN_AUDIO_REALTIME_PROVIDER=dashscope
13
+ QWEN_AUDIO_REALTIME_API_KEY=your-dashscope-key
14
+ QWEN_AUDIO_REALTIME_MODEL=qwen-audio-3.1-live
15
+ QWEN_AUDIO_REALTIME_URL=wss://<WorkspaceId>.cn-beijing.maas.aliyuncs.com/api-ws/v1/live?model=qwen-audio-3.1-live
16
+ QWEN_AUDIO_REALTIME_VOICE=
17
+
18
+ # 示例:选择已经安装并完成登录的后台 Agent。
19
+ AGENT_PROTOCOL=qoder
20
+ QWEN_AUDIO_AGENT_BACKEND_PERMISSION_MODE=native
21
+ ```
22
+
23
+ 将 `<WorkspaceId>` 替换为已开通 Live 的北京业务空间 ID,并使用该空间对应的 API Key。
24
+ Live 必须使用业务空间专属地址,不能沿用 DashScope 公共 `/realtime` 地址。
25
+ 未显式配置 `QWEN_AUDIO_REALTIME_URL` 时,也可以沿用兼容配置
26
+ `DASHSCOPE_WORKSPACE_ID`,由框架生成 Live 地址。
27
+
28
+ 桌面端选择 **语音前台 → DashScope → Qwen Audio 3.1 Live**,然后填写业务空间地址。
29
+ 供应商仍为 `dashscope`,无需另选协议。从 Realtime 切换时,应替换地址并清除不兼容的音色覆盖。
30
+ 终端 Gateway 修改文件后需重启;已安装的后台服务执行 `qwenaudio gateway restart`。
31
+
32
+ | 配置 | 本集成使用值 |
33
+ | --- | --- |
34
+ | 模型选择 | `qwen-audio-3.1-live` |
35
+ | 默认音色 | `yunshu` |
36
+ | 话轮检测 | `duplex` |
37
+ | 音频传输 | 单声道 PCM16,16 kHz 输入 / 24 kHz 输出 |
38
+ | 执行方式 | Client 委派给已配置的后台 |
39
+
40
+ 服务路由仍为 `qwen-audio-3.1-live`。适配器采用官方双工配置:协议中的 `session.model`
41
+ 为 `qwen-audio-4.0-realtime-preview`,`turn_detection.type=duplex`。这些是固定的协议参数,
42
+ 不是第二套模型选择。切换时请清除 `longanqian_v3.1` 等 Realtime 音色覆盖,
43
+ 本 Live 配置默认使用 `yunshu`。上游配置见官方
44
+ [客户端事件说明](https://help.aliyun.com/zh/model-studio/qwen-audio-live-client-events)。
45
+
46
+ 请先选择并配置[后台 Agent](../backends/overview.zh.md)。后台设为 `none` 时,仅保留 Live
47
+ 自身的对话能力,不会自动切换到云端后台执行。
48
+
49
+ ## 任务与授权
50
+
51
+ ```text
52
+ 语音或文字 → Qwen Live → 原生委派
53
+ → Gateway 任务 → 后台 Agent
54
+ ← 进度 / 追问 / 结果
55
+ ← Qwen Live ← 同一委派的更新
56
+ ```
57
+
58
+ - 此模型通过原生委派替代 `spawn_thinking`。Qwen 提供任务摘要、相关上下文与后续补充,
59
+ Gateway 将其映射到现有任务,不另建一套执行系统。
60
+ - 任务卡片、取消、授权及持久化结果仍由 Gateway 管理。打断语音不等于取消后台工作。
61
+ - 在桌面端 / WebUI 权限卡片中授权或拒绝,或使用 TUI 的 `/approve [permission_id]`、
62
+ `/reject [permission_id]`。操作直接到达等待中的后台;说出或输入“同意”不构成授权。
63
+ 切换模型不会自动开启权限批准。
64
+ - 后台结构化追问在桌面端 / WebUI 任务表单中回答,普通文字问题不会生成表单。
65
+ TUI 暂无结构化追问表单,需要时请使用其他客户端。
66
+ - 本版不向 Qwen Live 注册前台工具,这是集成选择,不代表上游 API 不支持函数工具。
67
+ 前台搜索、记忆、提醒、MCP/OpenAPI 与客户端操作工具不会自动转移给后台。
68
+ 任务管理使用客户端控件,后台仍使用自身配置的工具。
69
+
70
+ 操作说明见[任务与权限](../guides/tasks.zh.md),现有权限策略见
71
+ [后台权限模式](../configuration/backend.zh.md#后台权限模式)。
72
+
73
+ ## 输入与结果回传
74
+
75
+ - **文字**作为真实用户消息发给 Live 前台,不同时在本地重复建任务;Live 发出委派后才开始执行。
76
+ - **音频时间线:**纯文字请求和结果回传也需要服务端音频时钟继续推进。没有真实音频帧时,
77
+ 未静音的 Provider 补充每帧 100 毫秒的全零 PCM 静音;这是合成数据,不会开启或读取麦克风。
78
+ - **麦克风静音与休眠:**保持 Live 连接,发送 `session.input_audio.mute`;收到匹配的
79
+ `session.input_audio.muted` 回执后,停止上传音频,包括合成静音帧,由服务端维持静音输入。
80
+ 未确认静音时仍保留合成静音帧,不发送真实录音。恢复输入时发送 `session.input_audio.unmute`;
81
+ 唤醒不会越过手动静音或输入占用限制。休眠期间意外重连仍恢复静音状态,不回放旧录音。
82
+ 该休眠协议目前仅由 Qwen Live 启用,其他 Provider 保持原行为。静音不保证任务结果立即播报。
83
+ - **图片与文件**保留在 Gateway 输入注册表中,Live 仅接收附件文字元数据,不接收原始内容。
84
+ 委派必须保留明确的附件引用,Gateway 才能向后台提供原始输入;不会根据文件名猜测附件,
85
+ 也不会自动附带全部历史文件。
86
+ - **进度与权限状态**通过 `session.thinking.append` 回传,包括权限申请以及批准、拒绝或取消的
87
+ 处理结果。这些是上下文状态更新,不保证主动语音播报;请通过客户端权限控件处理请求。
88
+ **最终任务结果**仍通过 `session.commentary.append` 回传。结构化追问暂时保留原有的
89
+ `commentary` 路径。发送权限通知不代表授权或任务完成,只有客户端的明确操作才会处理请求。
90
+ 每次任务更新都关联当前连接实际收到的委派 ID。
91
+ 上游回执只代表接收成功,不代表用户已经听到。委派及回执格式见官方
92
+ [服务端事件说明](https://help.aliyun.com/zh/model-studio/qwen-audio-live-server-events)。
93
+ - **已知限制:**当前服务实测中,使用 `commentary` 发送中间通知后,同一委派的后续更新可能返回
94
+ `CONFLICT: Unknown Client call or stale Agent connection`。权限通知不再使用该路径,
95
+ 结构化追问的续接仍需验证。已接收的结果也不保证立即、准确播报,请以客户端任务状态和实际结果为准。
96
+ 另一次实测中,未回传任何进度或结果的委派约 120 秒后被服务端以 `RequestTimeOut` 结束;
97
+ 持续上传音频也会发生,之后再回传结果被拒绝。连接存活不等于委派仍有效;该观察不代表固定的协议时限。
98
+ - **重新连接**时,近期对话作为只读提示词上下文恢复。Gateway 任务记录独立保留,
99
+ 但不会向新 Live 连接回放旧委派 ID 和旧结果;也不会发送 GPT Live 式的空 ID 任务快照,
100
+ 或无关联的主动播报。
101
+ - **自然插话**由 Live 服务控制,Gateway 不套用 Realtime 的语音起始清空音频缓存逻辑。
102
+ 这不表示被打断的后台任务已停止。
103
+
104
+ ## 提示词与限制
105
+
106
+ Live 规则复用 `config/frontend-agent/LIVE_PROMPT.md`;人设、已提供的记忆与运行环境上下文
107
+ 沿用现有组合方式,不混入调用不可用前台工具的指令。在 `QWEN_AUDIO_AGENT_FRONTEND_PROMPT_DIR`
108
+ 放置 `LIVE_PROMPT.md` 可覆盖内置规则;缺少文件时使用内置版本。
109
+
110
+ 会话设置在建连时发送。服务不接受仅更新指令的 `session.update`,因此适配器声明
111
+ `mutableSession: false`:提示词、人设和会话配置变更在新 Live 连接中生效,不做连接内热更新。
112
+
113
+ 本适配不提供直接图像 / 视频输入、口头授权或托管 Responses 模式。后台能否处理附件取决于
114
+ 所选 Agent。以上行为说明基于当前集成配置;账号权限、延迟、语音行为及音色仍需在对应业务空间验证。
115
+ 麦克风静音不会关闭 Live 连接,也不会暂停其计费;使用结束后请断开连接。后台用量另计。
116
+
117
+ ## 继续阅读
118
+
119
+ - [Qwen Audio Realtime](qwen-audio-realtime.zh.md)
120
+ - [GPT Live](gpt-live-1.zh.md)
121
+ - [前台配置](../configuration/frontend.zh.md)
122
+ - [自定义 Provider](custom-provider.zh.md)
@@ -96,7 +96,8 @@ the model level, see [Qwen Omni Realtime](qwen-omni-realtime.md).
96
96
 
97
97
  ## Read next
98
98
 
99
- - [GPT-Live / OpenAI Realtime](gpt-live.md) — OpenAI cloud realtime frontend
99
+ - [Qwen Audio Live](qwen-audio-live.md) — native Client delegation under the same DashScope provider
100
+ - [OpenAI Realtime](openai-realtime.md) — OpenAI cloud realtime frontend
100
101
  - [Google Gemini Live](google-live.md) — Google cloud realtime frontend
101
102
  - [Speech-to-Speech](speech-to-speech.md) — fully local frontend, no cloud key
102
103
  - [MiniCPM-o 4.5](minicpm-o.md) — local end-to-end realtime voice
@@ -84,7 +84,8 @@ WebUI 和 TUI 只展示当前生效模型,不单独覆盖。
84
84
 
85
85
  ## 继续阅读
86
86
 
87
- - [GPT-Live / OpenAI Realtime](gpt-live.zh.md)——OpenAI 云端实时语音前台
87
+ - [Qwen Audio Live](qwen-audio-live.zh.md)——同一 DashScope 供应商下的原生 Client 委派
88
+ - [OpenAI Realtime](openai-realtime.zh.md)——OpenAI 云端实时语音前台
88
89
  - [Google Gemini Live](google-live.zh.md)——Google 云端实时语音前台
89
90
  - [Speech-to-Speech](speech-to-speech.zh.md)——全本地前台,无需云端 Key
90
91
  - [MiniCPM-o 4.5](minicpm-o.zh.md)——本地端到端实时语音前台
@@ -87,6 +87,6 @@ visual frames in this release.
87
87
  ## Read next
88
88
 
89
89
  - [Qwen Audio Realtime](qwen-audio-realtime.md) — the default family
90
- - [GPT-Live / OpenAI Realtime](gpt-live.md) — OpenAI cloud realtime frontend
90
+ - [OpenAI Realtime](openai-realtime.md) — OpenAI cloud realtime frontend
91
91
  - [Google Gemini Live](google-live.md) — Google cloud realtime frontend
92
92
  - [Frontend configuration reference](../configuration/frontend.md)
@@ -79,6 +79,6 @@ WebUI 可以把摄像头画面采样为有界 JPEG 帧,并通过协商后的 G
79
79
  ## 继续阅读
80
80
 
81
81
  - [Qwen Audio Realtime](qwen-audio-realtime.zh.md)——默认系列
82
- - [GPT-Live / OpenAI Realtime](gpt-live.zh.md)——OpenAI 云端实时语音前台
82
+ - [OpenAI Realtime](openai-realtime.zh.md)——OpenAI 云端实时语音前台
83
83
  - [Google Gemini Live](google-live.zh.md)——Google 云端实时语音前台
84
84
  - [前台配置参考](../configuration/frontend.zh.md)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "qwen-audio-agent",
3
3
  "desktopName": "qwen-audio-agent.desktop",
4
- "version": "2.1.0",
4
+ "version": "2.2.0",
5
5
  "description": "A realtime voice runtime that keeps AI agents talking, working, and present.",
6
6
  "author": "qwen-audio-agent contributors",
7
7
  "license": "Apache-2.0",
@@ -180,8 +180,12 @@
180
180
  "docs/voice-frontends/qwen-audio-realtime.zh.md",
181
181
  "docs/voice-frontends/qwen-omni-realtime.md",
182
182
  "docs/voice-frontends/qwen-omni-realtime.zh.md",
183
- "docs/voice-frontends/gpt-live.md",
184
- "docs/voice-frontends/gpt-live.zh.md",
183
+ "docs/voice-frontends/openai-realtime.md",
184
+ "docs/voice-frontends/openai-realtime.zh.md",
185
+ "docs/voice-frontends/gpt-live-1.md",
186
+ "docs/voice-frontends/gpt-live-1.zh.md",
187
+ "docs/voice-frontends/qwen-audio-live.md",
188
+ "docs/voice-frontends/qwen-audio-live.zh.md",
185
189
  "docs/voice-frontends/google-live.md",
186
190
  "docs/voice-frontends/google-live.zh.md",
187
191
  "docs/scenarios/smart-cockpit.md",
@@ -280,6 +284,7 @@
280
284
  "test:desktop-smoke": "node scripts/electron-smoke.mjs",
281
285
  "test:desktop-package": "npm run build && node scripts/test/desktop-package-smoke.mjs",
282
286
  "test:web-browser": "node scripts/test/browser-webui-smoke.mjs",
287
+ "test:mobile-layout": "node scripts/test/mobile-layout-smoke.mjs",
283
288
  "desktop:build": "node scripts/check-desktop-release-env.mjs && npm run build && electron-builder --config desktop/electron-builder.yml --mac dmg zip",
284
289
  "desktop:build:local": "npm run build && electron-builder --config desktop/electron-builder.yml --config.mac.identity=- --config.mac.hardenedRuntime=false --config.mac.notarize=false --mac dmg",
285
290
  "desktop:build:linux": "npm run build && electron-builder --config desktop/electron-builder.yml --linux AppImage deb",
@@ -311,6 +316,8 @@
311
316
  "example:webrtc:install": "npm ci --prefix packages/webrtc --no-audit --no-fund",
312
317
  "example:webrtc": "node examples/webrtc/start.mjs",
313
318
  "example:webrtc:omni": "node examples/webrtc/start.mjs --omni",
319
+ "example:music-assistant": "node examples/music-assistant/start.mjs",
320
+ "example:music-assistant:verify": "node examples/music-assistant/verify.mjs",
314
321
  "lint": "eslint .",
315
322
  "docs:dev": "concurrently -n sync,site -c yellow,magenta \"node scripts/sync-docs-site.mjs --watch\" \"vitepress dev docs\"",
316
323
  "predocs:dev": "node scripts/sync-docs-site.mjs",
@@ -348,7 +355,7 @@
348
355
  "sherpa-onnx": "1.13.8",
349
356
  "tar-stream": "3.2.2",
350
357
  "unbzip2-stream": "1.4.3",
351
- "ws": "^8.21.3",
358
+ "ws": "^8.23.1",
352
359
  "yaml": "2.9.1",
353
360
  "zod": "^4.6.6"
354
361
  },
@@ -374,6 +381,8 @@
374
381
  "uuid": "11.1.1",
375
382
  "global-agent": "4.1.3",
376
383
  "shell-quote": "1.12.0",
384
+ "tar": "8.0.5",
385
+ "node-gyp": "12.4.0",
377
386
  "vitepress": {
378
387
  "vite": "6.4.4"
379
388
  }
@@ -0,0 +1,63 @@
1
+ // Temporary, development-only bridge until node-gyp adopts tar 8's input API.
2
+ // Keep the original pipeline (including its checksum transform) intact. Only
3
+ // its final sink changes from a Writable to an async consumer. No archive
4
+ // validation or download/checksum policy is disabled.
5
+ import { createHash } from 'node:crypto'
6
+ import { readFileSync, realpathSync, writeFileSync } from 'node:fs'
7
+ import { createRequire } from 'node:module'
8
+ import { dirname, join, relative, isAbsolute, sep } from 'node:path'
9
+
10
+ const ORIGINAL_SHA256 = 'f0a0017fec48692a8eb8922b6eaff8d12f4a4eb1af4e42f23efa3e8797dff2c3'
11
+ const digest = text => createHash('sha256').update(text).digest('hex')
12
+ const originalSink = ` tar.extract({
13
+ strip: 1,
14
+ cwd: tarExtractDir,
15
+ filter: isValid,
16
+ onwarn
17
+ })`
18
+ const patchedSink = ` async source => {
19
+ const iterator = source[Symbol.asyncIterator]()
20
+ // tar may stop at end-of-archive; hash the entire download.
21
+ await tar.extract({
22
+ input: { [Symbol.asyncIterator]: () => ({ next: () => iterator.next() }) },
23
+ strip: 1,
24
+ cwd: tarExtractDir,
25
+ filter: isValid,
26
+ onwarn
27
+ })
28
+ while (!(await iterator.next()).done) {}
29
+ }`
30
+
31
+ export function patchBuildNodeGyp(root) {
32
+ const require = createRequire(join(root, 'package.json'))
33
+ let builderPath
34
+ try { builderPath = require.resolve('app-builder-lib/package.json') } catch (error) {
35
+ // Published/production-only installs do not contain this build dependency.
36
+ if (error.code === 'MODULE_NOT_FOUND') return false
37
+ throw error
38
+ }
39
+ const builderRequire = createRequire(builderPath)
40
+ const rebuildRequire = createRequire(builderRequire.resolve('@electron/rebuild'))
41
+ const manifestPath = rebuildRequire.resolve('node-gyp/package.json')
42
+ const nodeGypRequire = createRequire(manifestPath)
43
+ const nodeGyp = nodeGypRequire('./package.json')
44
+ const tar = nodeGypRequire('tar/package.json')
45
+ if (nodeGyp.version !== '12.4.0' || tar.version !== '8.0.5') {
46
+ throw new Error('Build archive dependencies changed; review/remove the temporary node-gyp tar 8 patch before building.')
47
+ }
48
+ const path = realpathSync(join(dirname(manifestPath), 'lib/install.js'))
49
+ const within = relative(realpathSync(root), path)
50
+ if (within === '..' || within.startsWith(`..${sep}`) || isAbsolute(within)) {
51
+ throw new Error('Refusing to patch a build dependency outside this checkout.')
52
+ }
53
+ const source = readFileSync(path, 'utf8')
54
+ // Reverse only this exact patch to recognize an already prepared install.
55
+ if (source.includes(patchedSink) && digest(source.replace(patchedSink, originalSink)) === ORIGINAL_SHA256) return false
56
+ if (digest(source) !== ORIGINAL_SHA256) {
57
+ throw new Error('Unexpected node-gyp install.js; refusing to patch unreviewed source.')
58
+ }
59
+ const patched = source.replace(originalSink, patchedSink)
60
+ if (patched === source) throw new Error('Build archive patch verification failed.')
61
+ writeFileSync(path, patched)
62
+ return true
63
+ }
@@ -9,6 +9,7 @@ import { spawnSync } from 'node:child_process'
9
9
  import { existsSync } from 'node:fs'
10
10
  import { dirname, resolve } from 'node:path'
11
11
  import { fileURLToPath } from 'node:url'
12
+ import { patchBuildNodeGyp } from './patch-build-node-gyp.mjs'
12
13
 
13
14
  const root = resolve(dirname(fileURLToPath(import.meta.url)), '..')
14
15
 
@@ -35,4 +36,5 @@ function run(args) {
35
36
  if (!existsSync(resolve(root, 'node_modules/.bin/vite'))) {
36
37
  run(['install', '--no-save', '--no-audit', '--include=dev'])
37
38
  }
39
+ patchBuildNodeGyp(root)
38
40
  run(['run', 'build'])
@@ -192,6 +192,9 @@ if (isMain) {
192
192
  'server/src/backend/backend-adapter-sdk.mjs',
193
193
  'server/src/backend/backend-adapter-conformance.mjs',
194
194
  'server/src/core/package-version.mjs',
195
+ 'config/frontend-agent/PROMPT.md',
196
+ 'config/frontend-agent/LIVE_PROMPT.md',
197
+ 'config/frontend-agent/ASSISTANT.md',
195
198
  'server/src/index.mjs',
196
199
  'shared/runtime-environment.mjs',
197
200
  'tui/src/index.mjs',
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qwen-audio-agent/server",
3
3
  "private": true,
4
- "version": "2.1.0",
4
+ "version": "2.2.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "node --watch src/index.mjs",
@@ -13,7 +13,7 @@
13
13
  "@modelcontextprotocol/sdk": "1.32.1",
14
14
  "@qwen-code/open-computer-use": "^0.2.3",
15
15
  "express": "^4.22.2",
16
- "ws": "^8.21.3",
16
+ "ws": "^8.23.1",
17
17
  "yaml": "2.9.1",
18
18
  "zod": "^4.5.4"
19
19
  }
@@ -4,6 +4,7 @@ import { config } from '../core/config.mjs'
4
4
  import { recentConversationMessages } from '../../../shared/conversation-history.mjs'
5
5
 
6
6
  const PROMPT_FILE = 'PROMPT.md'
7
+ const LIVE_PROMPT_FILE = 'LIVE_PROMPT.md'
7
8
  const ASSISTANT_FILE = 'ASSISTANT.md'
8
9
  const MAX_PROMPT_CHARS = 16000
9
10
  const MAX_ASSISTANT_CHARS = 4000
@@ -62,14 +63,26 @@ export function currentTimeSnapshot({
62
63
  }
63
64
 
64
65
  export function loadFrontendPrompt() {
65
- const content = readFileSync(
66
- resolve(config.frontendPromptDir, PROMPT_FILE),
67
- 'utf8',
68
- ).trim()
69
- if (!content) throw new Error(`${PROMPT_FILE} must not be empty`)
66
+ return readPrompt(resolve(config.frontendPromptDir, PROMPT_FILE), PROMPT_FILE)
67
+ }
68
+
69
+ function readPrompt(path, filename) {
70
+ const content = readFileSync(path, 'utf8').trim()
71
+ if (!content) throw new Error(`${filename} must not be empty`)
70
72
  return [...content].slice(0, MAX_PROMPT_CHARS).join('')
71
73
  }
72
74
 
75
+ export function loadLiveFrontendPrompt() {
76
+ try {
77
+ return readPrompt(resolve(config.frontendPromptDir, LIVE_PROMPT_FILE), LIVE_PROMPT_FILE)
78
+ } catch (error) {
79
+ // Existing custom prompt directories may only contain the Realtime policy.
80
+ // Do not substitute that tool-specific policy for the Live policy.
81
+ if (error.code !== 'ENOENT') throw error
82
+ return readPrompt(resolve(config.root, 'config/frontend-agent', LIVE_PROMPT_FILE), LIVE_PROMPT_FILE)
83
+ }
84
+ }
85
+
73
86
  export function loadAssistantProfile() {
74
87
  const content = readFileSync(
75
88
  config.assistantProfilePath || resolve(config.frontendPromptDir, ASSISTANT_FILE),