qwen-audio-agent 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +1 -0
- package/README.md +18 -20
- package/README_EN.md +23 -25
- package/cli/package.json +1 -1
- package/cli/src/arguments.mjs +39 -1
- package/cli/src/launcher.mjs +63 -2
- package/config/frontend-agent/PROMPT.md +17 -20
- package/docs/configuration.md +21 -0
- package/package.json +8 -3
- package/scripts/electron-smoke.mjs +39 -0
- package/scripts/release-check +1 -0
- package/server/package.json +1 -1
- package/server/src/agent/agent-client.mjs +19 -79
- package/server/src/agent/backends/claude.mjs +0 -12
- package/server/src/agent/backends/codebuddy.mjs +0 -11
- package/server/src/agent/backends/codex.mjs +0 -11
- package/server/src/agent/backends/generic-acp.mjs +0 -11
- package/server/src/agent/backends/hermes.mjs +0 -10
- package/server/src/agent/backends/kimi.mjs +0 -10
- package/server/src/agent/backends/openclaw.mjs +0 -10
- package/server/src/agent/backends/opencode.mjs +0 -8
- package/server/src/agent/backends/qoder.mjs +0 -10
- package/server/src/core/config.mjs +107 -99
- package/server/src/index.mjs +1 -1
- package/server/src/voice/announcement/announcement-manager.mjs +8 -7
- package/server/src/voice/frontend-tools.mjs +24 -1
- package/server/src/voice/providers/dashscope.mjs +2 -2
- package/server/src/voice/providers/s2s.mjs +2 -2
- package/server/src/voice/realtime-gateway.mjs +12 -0
- package/server/src/voice/realtime-provider.mjs +2 -0
- package/server/src/voice/tools/tool-call-handler.mjs +38 -47
- package/shared/backend-auth-status.mjs +157 -0
- package/shared/backend-install.mjs +350 -0
- package/shared/backend-lifecycle.mjs +134 -0
- package/shared/backend-setup.mjs +67 -1
- package/shared/gateway-instance-lock.mjs +8 -4
- package/shared/logger.mjs +65 -24
- package/shared/realtime-events.mjs +1 -0
- package/tui/package.json +1 -1
- package/web/dist/assets/index-CYkUfr6A.css +1 -0
- package/web/dist/assets/{index-D4cd8ZoW.js → index-DnfPPt23.js} +22 -22
- package/web/dist/index.html +2 -2
- package/web/dist/assets/index-Bbuq-hRH.css +0 -1
|
@@ -5,18 +5,6 @@ export const claudeBackendDriver = {
|
|
|
5
5
|
id: 'claude',
|
|
6
6
|
label: 'Claude Code',
|
|
7
7
|
|
|
8
|
-
resolveOptions(options) {
|
|
9
|
-
return {
|
|
10
|
-
baseUrl: '',
|
|
11
|
-
model: options.claudeModel,
|
|
12
|
-
directory: options.claudeDirectory,
|
|
13
|
-
cliPath: options.claudeCliPath,
|
|
14
|
-
claudeExecutable: options.claudeExecutable,
|
|
15
|
-
configDirectory: options.claudeConfigDirectory,
|
|
16
|
-
coordinatorAgent: options.coordinatorAgent,
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
|
|
20
8
|
createProfile({
|
|
21
9
|
root,
|
|
22
10
|
directory,
|
|
@@ -4,17 +4,6 @@ export const codeBuddyBackendDriver = {
|
|
|
4
4
|
id: 'codebuddy',
|
|
5
5
|
label: 'CodeBuddy',
|
|
6
6
|
|
|
7
|
-
resolveOptions(options) {
|
|
8
|
-
return {
|
|
9
|
-
baseUrl: '',
|
|
10
|
-
model: options.codeBuddyModel,
|
|
11
|
-
modelUrl: options.codeBuddyModelUrl,
|
|
12
|
-
directory: options.codeBuddyDirectory,
|
|
13
|
-
cliPath: options.codeBuddyCliPath,
|
|
14
|
-
coordinatorAgent: options.coordinatorAgent,
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
|
|
18
7
|
createProfile({
|
|
19
8
|
directory,
|
|
20
9
|
cliPath,
|
|
@@ -7,17 +7,6 @@ export const codexBackendDriver = {
|
|
|
7
7
|
id: 'codex',
|
|
8
8
|
label: 'Codex',
|
|
9
9
|
|
|
10
|
-
resolveOptions(options) {
|
|
11
|
-
return {
|
|
12
|
-
baseUrl: '',
|
|
13
|
-
model: options.codexModel,
|
|
14
|
-
modelUrl: options.codexModelUrl,
|
|
15
|
-
directory: options.codexDirectory,
|
|
16
|
-
cliPath: options.codexCliPath,
|
|
17
|
-
coordinatorAgent: options.coordinatorAgent,
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
|
|
21
10
|
createProfile({
|
|
22
11
|
root,
|
|
23
12
|
directory,
|
|
@@ -6,17 +6,6 @@ import {
|
|
|
6
6
|
export const genericAcpBackendDriver = {
|
|
7
7
|
id: 'acp',
|
|
8
8
|
label: 'ACP Agent',
|
|
9
|
-
resolveOptions(options) {
|
|
10
|
-
return {
|
|
11
|
-
baseUrl: '',
|
|
12
|
-
model: options.acpModel,
|
|
13
|
-
directory: options.acpDirectory,
|
|
14
|
-
cliPath: options.acpCommand,
|
|
15
|
-
args: options.acpArgs,
|
|
16
|
-
label: options.acpLabel,
|
|
17
|
-
coordinatorAgent: options.acpCoordinatorAgent,
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
9
|
|
|
21
10
|
createProfile({
|
|
22
11
|
directory,
|
|
@@ -4,16 +4,6 @@ export const hermesBackendDriver = {
|
|
|
4
4
|
id: 'hermes',
|
|
5
5
|
label: 'Hermes',
|
|
6
6
|
|
|
7
|
-
resolveOptions(options) {
|
|
8
|
-
return {
|
|
9
|
-
baseUrl: '',
|
|
10
|
-
model: options.hermesModel,
|
|
11
|
-
directory: options.hermesDirectory,
|
|
12
|
-
cliPath: options.hermesCliPath,
|
|
13
|
-
coordinatorAgent: options.coordinatorAgent,
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
|
|
17
7
|
createProfile({ directory, cliPath }) {
|
|
18
8
|
return {
|
|
19
9
|
label: this.label,
|
|
@@ -4,16 +4,6 @@ export const kimiBackendDriver = {
|
|
|
4
4
|
id: 'kimi',
|
|
5
5
|
label: 'Kimi Code',
|
|
6
6
|
|
|
7
|
-
resolveOptions(options) {
|
|
8
|
-
return {
|
|
9
|
-
baseUrl: '',
|
|
10
|
-
model: options.kimiModel,
|
|
11
|
-
directory: options.kimiDirectory,
|
|
12
|
-
cliPath: options.kimiCliPath,
|
|
13
|
-
coordinatorAgent: options.coordinatorAgent,
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
|
|
17
7
|
createProfile({
|
|
18
8
|
directory,
|
|
19
9
|
cliPath,
|
|
@@ -30,16 +30,6 @@ function promptRetryDelay({ error, attempt }) {
|
|
|
30
30
|
export const openClawBackendDriver = {
|
|
31
31
|
id: 'openclaw',
|
|
32
32
|
label: 'OpenClaw',
|
|
33
|
-
resolveOptions(options) {
|
|
34
|
-
return {
|
|
35
|
-
baseUrl: options.openClawBaseUrl,
|
|
36
|
-
model: options.model ?? options.openClawModel,
|
|
37
|
-
directory: options.openClawDirectory,
|
|
38
|
-
coordinatorAgent: options.openClawCoordinatorAgent,
|
|
39
|
-
token: options.openClawToken,
|
|
40
|
-
tokenFile: options.openClawTokenFile,
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
33
|
|
|
44
34
|
createProfile({
|
|
45
35
|
root,
|
|
@@ -28,14 +28,6 @@ function acceptsResumedSession({ session, role, coordinatorAgent }) {
|
|
|
28
28
|
export const openCodeBackendDriver = {
|
|
29
29
|
id: 'opencode',
|
|
30
30
|
label: 'OpenCode',
|
|
31
|
-
resolveOptions(options) {
|
|
32
|
-
return {
|
|
33
|
-
baseUrl: options.baseUrl,
|
|
34
|
-
model: options.model ?? options.openCodeModel,
|
|
35
|
-
directory: options.directory,
|
|
36
|
-
coordinatorAgent: options.coordinatorAgent,
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
31
|
|
|
40
32
|
createProfile({ root, directory }) {
|
|
41
33
|
return {
|
|
@@ -3,16 +3,6 @@ import { baseEnvironment } from './shared.mjs'
|
|
|
3
3
|
export const qoderBackendDriver = {
|
|
4
4
|
id: 'qoder',
|
|
5
5
|
label: 'Qoder',
|
|
6
|
-
resolveOptions(options) {
|
|
7
|
-
return {
|
|
8
|
-
baseUrl: '',
|
|
9
|
-
model: options.qoderModel,
|
|
10
|
-
directory: options.qoderDirectory,
|
|
11
|
-
configDirectory: options.qoderConfigDirectory,
|
|
12
|
-
cliPath: options.qoderCliPath,
|
|
13
|
-
coordinatorAgent: options.coordinatorAgent,
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
6
|
|
|
17
7
|
createProfile({
|
|
18
8
|
directory,
|
|
@@ -242,105 +242,113 @@ export const config = {
|
|
|
242
242
|
backendOwnership,
|
|
243
243
|
backendPermissionMode,
|
|
244
244
|
agentTimeoutMs: numberSetting(process.env.AGENT_TIMEOUT_MS, 300000, { min: 10000 }),
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
:
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
245
|
+
// Per-backend option namespaces keyed by driver id. AgentClient merges the
|
|
246
|
+
// selected namespace with optional overrides, so adding a backend only
|
|
247
|
+
// requires appending one entry here.
|
|
248
|
+
backends: {
|
|
249
|
+
opencode: {
|
|
250
|
+
baseUrl: (
|
|
251
|
+
process.env.OPENCODE_BASE_URL
|
|
252
|
+
|| 'http://127.0.0.1:4096'
|
|
253
|
+
).replace(/\/+$/, ''),
|
|
254
|
+
model: backendModels.openCode,
|
|
255
|
+
directory: resolveOpenCodeWorkspace(),
|
|
256
|
+
coordinatorAgent: resolveOpenCodeCoordinatorAgent(),
|
|
257
|
+
},
|
|
258
|
+
openclaw: {
|
|
259
|
+
baseUrl: (
|
|
260
|
+
process.env.OPENCLAW_BASE_URL
|
|
261
|
+
|| 'http://127.0.0.1:18789'
|
|
262
|
+
).replace(/\/+$/, ''),
|
|
263
|
+
token: (
|
|
264
|
+
process.env.OPENCLAW_GATEWAY_TOKEN
|
|
265
|
+
|| process.env.AGENT_API_KEY
|
|
266
|
+
|| (managedOpenClawBailian
|
|
267
|
+
? process.env.QWEN_AUDIO_AGENT_AUTH_SECRET
|
|
268
|
+
: '')
|
|
269
|
+
|| ''
|
|
270
|
+
),
|
|
271
|
+
tokenFile: (
|
|
272
|
+
process.env.OPENCLAW_GATEWAY_TOKEN_FILE
|
|
273
|
+
|| resolve(runtimeEnvironment.openClawStateDirectory, 'gateway-token')
|
|
274
|
+
),
|
|
275
|
+
model: backendModels.openClaw,
|
|
276
|
+
directory: resolveOpenClawWorkspace(),
|
|
277
|
+
coordinatorAgent: (
|
|
278
|
+
sharedBackendAgent
|
|
279
|
+
|| legacyBackendAgent(
|
|
280
|
+
process.env.OPENCLAW_COORDINATOR_AGENT,
|
|
281
|
+
'voice-coordinator',
|
|
282
|
+
)
|
|
283
|
+
|| (managedOpenClawBailian ? 'qwen-audio-agent-backend' : '')
|
|
284
|
+
),
|
|
285
|
+
},
|
|
286
|
+
qoder: {
|
|
287
|
+
model: String(backendModels.qoder).trim(),
|
|
288
|
+
directory: resolveQoderWorkspace(),
|
|
289
|
+
cliPath: String(
|
|
290
|
+
process.env.QODERCLI_PATH || process.env.QODER_CLI_PATH || '',
|
|
291
|
+
).trim(),
|
|
292
|
+
configDirectory: process.env.QODER_CONFIG_DIR
|
|
293
|
+
? resolve(process.env.QODER_CONFIG_DIR)
|
|
294
|
+
: '',
|
|
295
|
+
},
|
|
296
|
+
kimi: {
|
|
297
|
+
model: String(backendModels.kimi).trim(),
|
|
298
|
+
directory: resolveKimiWorkspace(),
|
|
299
|
+
cliPath: String(process.env.KIMI_CODE_BIN || '').trim(),
|
|
300
|
+
},
|
|
301
|
+
hermes: {
|
|
302
|
+
model: String(backendModels.hermes).trim(),
|
|
303
|
+
directory: resolveHermesWorkspace(),
|
|
304
|
+
cliPath: String(process.env.HERMES_BIN || '').trim(),
|
|
305
|
+
},
|
|
306
|
+
codebuddy: {
|
|
307
|
+
model: String(backendModels.codeBuddy).trim(),
|
|
308
|
+
modelUrl: (
|
|
309
|
+
process.env.CODEBUDDY_MODEL_URL
|
|
310
|
+
|| (backendModels.common ? (
|
|
311
|
+
process.env.DASHSCOPE_WORKSPACE_ID
|
|
312
|
+
? `https://${process.env.DASHSCOPE_WORKSPACE_ID}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1/chat/completions`
|
|
313
|
+
: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions'
|
|
314
|
+
) : '')
|
|
315
|
+
),
|
|
316
|
+
directory: resolveCodeBuddyWorkspace(),
|
|
317
|
+
cliPath: String(process.env.CODEBUDDY_BIN || '').trim(),
|
|
318
|
+
},
|
|
319
|
+
codex: {
|
|
320
|
+
model: String(backendModels.codex).trim(),
|
|
321
|
+
modelUrl: (
|
|
322
|
+
process.env.CODEX_BASE_URL
|
|
323
|
+
|| (backendModels.common ? (
|
|
324
|
+
process.env.DASHSCOPE_WORKSPACE_ID
|
|
325
|
+
? `https://${process.env.DASHSCOPE_WORKSPACE_ID}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1`
|
|
326
|
+
: 'https://dashscope.aliyuncs.com/compatible-mode/v1'
|
|
327
|
+
) : '')
|
|
328
|
+
).replace(/\/+$/, ''),
|
|
329
|
+
directory: resolveCodexWorkspace(),
|
|
330
|
+
cliPath: String(process.env.CODEX_ACP_BIN || '').trim(),
|
|
331
|
+
},
|
|
332
|
+
claude: {
|
|
333
|
+
model: String(backendModels.claude).trim(),
|
|
334
|
+
directory: resolveClaudeWorkspace(),
|
|
335
|
+
cliPath: String(process.env.CLAUDE_CODE_ACP_BIN || '').trim(),
|
|
336
|
+
claudeExecutable: String(
|
|
337
|
+
process.env.CLAUDE_CODE_EXECUTABLE || '',
|
|
338
|
+
).trim(),
|
|
339
|
+
configDirectory: process.env.CLAUDE_CONFIG_DIR
|
|
340
|
+
? resolve(process.env.CLAUDE_CONFIG_DIR)
|
|
341
|
+
: '',
|
|
342
|
+
},
|
|
343
|
+
acp: {
|
|
344
|
+
model: String(backendModels.acp).trim(),
|
|
345
|
+
directory: resolveAcpWorkspace(),
|
|
346
|
+
cliPath: String(process.env.ACP_COMMAND || '').trim(),
|
|
347
|
+
args: resolveAcpArgs(process.env.ACP_ARGS),
|
|
348
|
+
label: String(process.env.ACP_LABEL || 'ACP Agent').trim() || 'ACP Agent',
|
|
349
|
+
coordinatorAgent: String(process.env.ACP_COORDINATOR_AGENT || '').trim(),
|
|
350
|
+
},
|
|
351
|
+
},
|
|
344
352
|
announceIntoContext: (
|
|
345
353
|
String(process.env.QWEN_AUDIO_AGENT_ANNOUNCE_INTO_CONTEXT || 'true').toLowerCase()
|
|
346
354
|
=== 'true'
|
package/server/src/index.mjs
CHANGED
|
@@ -330,14 +330,15 @@ export class AnnouncementManager {
|
|
|
330
330
|
&& this.activeBatch === batch
|
|
331
331
|
) this.scheduleRetry()
|
|
332
332
|
} finally {
|
|
333
|
-
if (this.deliveryGeneration
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
333
|
+
if (this.deliveryGeneration === deliveryGeneration) {
|
|
334
|
+
this.delivering = false
|
|
335
|
+
this.finishAcknowledgedBatch()
|
|
336
|
+
if (this.activeBatch?.retryRequested) {
|
|
337
|
+
this.activeBatch.retryRequested = false
|
|
338
|
+
this.scheduleRetry()
|
|
339
|
+
}
|
|
340
|
+
if (!this.activeBatch && this.pending.size) this.scheduleDelivery(0)
|
|
339
341
|
}
|
|
340
|
-
if (!this.activeBatch && this.pending.size) this.scheduleDelivery(0)
|
|
341
342
|
}
|
|
342
343
|
}
|
|
343
344
|
|
|
@@ -12,6 +12,7 @@ export const GET_CURRENT_TIME_TOOL_NAME = 'get_current_time'
|
|
|
12
12
|
export const USER_MEMORY_TOOL_NAME = 'user_memory'
|
|
13
13
|
export const NOTES_TOOL_NAME = 'notes'
|
|
14
14
|
export const RESPOND_AGENT_PERMISSION_TOOL_NAME = 'respond_agent_permission'
|
|
15
|
+
export const ENTER_SLEEP_TOOL_NAME = 'enter_sleep'
|
|
15
16
|
|
|
16
17
|
const delegateTool = {
|
|
17
18
|
type: 'function',
|
|
@@ -89,7 +90,7 @@ const userMemoryTool = {
|
|
|
89
90
|
type: 'function',
|
|
90
91
|
function: {
|
|
91
92
|
name: USER_MEMORY_TOOL_NAME,
|
|
92
|
-
description: '管理千问Audio
|
|
93
|
+
description: '管理千问Audio前台持有的用户记忆与长期约定。用户明确要求记住、修改、遗忘某项信息,或询问你记得什么时必须调用,不要只口头回应。profile 用于称呼、时区、语言和稳定交互偏好;long_term 用于用户明确希望跨会话保留的个人事实、喜好、目标和约定;rules 用于用户亲自设定的长期约定——说话方式、称呼习惯、默认做法等“以后都……”类要求,设定后长期生效并优先于默认风格;不要保存项目执行历史或后台工作细节,也不要保存密码、密钥、验证码或令牌。使用 recall 回忆,remember 新增,replace 用新内容替换明确相关的旧记录,forget 遗忘。',
|
|
93
94
|
parameters: {
|
|
94
95
|
type: 'object',
|
|
95
96
|
properties: {
|
|
@@ -182,6 +183,19 @@ const respondAgentPermissionTool = {
|
|
|
182
183
|
},
|
|
183
184
|
}
|
|
184
185
|
|
|
186
|
+
const enterSleepTool = {
|
|
187
|
+
type: 'function',
|
|
188
|
+
function: {
|
|
189
|
+
name: ENTER_SLEEP_TOOL_NAME,
|
|
190
|
+
description: '让当前语音入口进入其支持的休眠状态。仅在此工具可用且用户明确要求当前语音入口退下、隐藏、收起、暂时休息或离开时,必须立即调用;不要只口头回应,也不要先确认。不得用于取消后台工作、静音、退出应用,或用户未明确表达休眠意图的情况。',
|
|
191
|
+
parameters: {
|
|
192
|
+
type: 'object',
|
|
193
|
+
properties: {},
|
|
194
|
+
additionalProperties: false,
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
}
|
|
198
|
+
|
|
185
199
|
export const TOOLS = [
|
|
186
200
|
delegateTool,
|
|
187
201
|
cancelAgentTaskTool,
|
|
@@ -192,6 +206,15 @@ export const TOOLS = [
|
|
|
192
206
|
respondAgentPermissionTool,
|
|
193
207
|
]
|
|
194
208
|
|
|
209
|
+
export function frontendTools(agentContext = {}) {
|
|
210
|
+
const states = Array.isArray(agentContext.client?.states)
|
|
211
|
+
? agentContext.client.states
|
|
212
|
+
: []
|
|
213
|
+
return states.includes('sleeping')
|
|
214
|
+
? [...TOOLS, enterSleepTool]
|
|
215
|
+
: TOOLS
|
|
216
|
+
}
|
|
217
|
+
|
|
195
218
|
export const resultResponseInstructions = [
|
|
196
219
|
'这是先前提交工作的最终结果,不是用户的新请求。',
|
|
197
220
|
'把 result 当作事实材料,结合当前对话自然回应;可以按语境概括、合并、承接或询问必要信息,避免重复已经表达过的内容。',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { config, realtimeUrl } from '../../core/config.mjs'
|
|
2
2
|
import {
|
|
3
|
-
TOOLS,
|
|
4
3
|
buildFrontendInstructions,
|
|
4
|
+
frontendTools,
|
|
5
5
|
resultResponseInstructions,
|
|
6
6
|
speakResponseInstructions,
|
|
7
7
|
permissionResponseInstructions,
|
|
@@ -45,7 +45,7 @@ export const dashscopeProvider = {
|
|
|
45
45
|
const textOnly = agentContext?.textOnly === true
|
|
46
46
|
const session = {
|
|
47
47
|
instructions: buildFrontendInstructions(agentContext),
|
|
48
|
-
tools:
|
|
48
|
+
tools: frontendTools(agentContext),
|
|
49
49
|
}
|
|
50
50
|
if (!configured) {
|
|
51
51
|
session.modalities = textOnly ? ['text'] : ['text', 'audio']
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { config } from '../../core/config.mjs'
|
|
2
2
|
import {
|
|
3
|
-
TOOLS,
|
|
4
3
|
buildFrontendInstructions,
|
|
4
|
+
frontendTools,
|
|
5
5
|
resultResponseInstructions,
|
|
6
6
|
speakResponseInstructions,
|
|
7
7
|
permissionResponseInstructions,
|
|
@@ -68,7 +68,7 @@ export const s2sProvider = {
|
|
|
68
68
|
type: 'realtime',
|
|
69
69
|
instructions: buildFrontendInstructions(agentContext),
|
|
70
70
|
// GA tools are flat objects rather than the beta { type, function } shape.
|
|
71
|
-
tools:
|
|
71
|
+
tools: frontendTools(agentContext).map(tool => ({
|
|
72
72
|
type: 'function',
|
|
73
73
|
name: tool.function.name,
|
|
74
74
|
description: tool.function.description,
|
|
@@ -352,6 +352,13 @@ export function attachRealtimeGateway(server, {
|
|
|
352
352
|
coordinatorAvailable,
|
|
353
353
|
respondPermission,
|
|
354
354
|
permissionPolicy,
|
|
355
|
+
requestClientState: state => {
|
|
356
|
+
if (!clientContext.states?.includes(state)) return
|
|
357
|
+
send(ws, {
|
|
358
|
+
type: GatewayServerEvent.CLIENT_STATE,
|
|
359
|
+
state,
|
|
360
|
+
})
|
|
361
|
+
},
|
|
355
362
|
})
|
|
356
363
|
const currentTurn = () => ({
|
|
357
364
|
turnId,
|
|
@@ -1463,6 +1470,11 @@ export function attachRealtimeGateway(server, {
|
|
|
1463
1470
|
locale: event.locale,
|
|
1464
1471
|
workingDirectory: event.workingDirectory,
|
|
1465
1472
|
})
|
|
1473
|
+
clientContext.states = (
|
|
1474
|
+
descriptor.type === 'desktop'
|
|
1475
|
+
&& Array.isArray(event.clientStates)
|
|
1476
|
+
&& event.clientStates.includes('sleeping')
|
|
1477
|
+
) ? ['sleeping'] : []
|
|
1466
1478
|
frontend?.updateAgentContext({
|
|
1467
1479
|
client: clientContext,
|
|
1468
1480
|
textOnly: textOnlySession,
|