qwen-audio-agent 1.8.1 → 1.8.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/README.md CHANGED
@@ -26,6 +26,8 @@ tells you:
26
26
 
27
27
  ## News
28
28
 
29
+ - **2026-08-11 · [v1.8.2](https://github.com/QwenAudio/qwen-audio-agent/releases/tag/v1.8.2)**
30
+ 🖥️ Refreshed desktop settings with a more consistent visual experience; 🎙️ more reliable voice wake; ⏱️ long-running tasks now report progress automatically.
29
31
  - **2026-08-11 · [v1.8.1](https://github.com/QwenAudio/qwen-audio-agent/releases/tag/v1.8.1)**
30
32
  🧠 Cleaner persona and memory boundaries; 🔧 more reliable tasks and reminders.
31
33
  - **2026-08-09 · [v1.8.0](https://github.com/QwenAudio/qwen-audio-agent/releases/tag/v1.8.0)**
package/README_ZH.md CHANGED
@@ -20,6 +20,8 @@
20
20
 
21
21
  ## News
22
22
 
23
+ - **2026-08-11 · [v1.8.2](https://github.com/QwenAudio/qwen-audio-agent/releases/tag/v1.8.2)**
24
+ 🖥️ 桌面设置页焕新,布局与视觉风格更加统一;🎙️ 语音唤醒更可靠;⏱️ 长任务会主动汇报进度。
23
25
  - **2026-08-11 · [v1.8.1](https://github.com/QwenAudio/qwen-audio-agent/releases/tag/v1.8.1)**
24
26
  🧠 人设与记忆边界更清晰;🔧 任务与提醒更可靠。
25
27
  - **2026-08-09 · [v1.8.0](https://github.com/QwenAudio/qwen-audio-agent/releases/tag/v1.8.0)**
package/cli/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qwen-audio-agent/cli",
3
3
  "private": true,
4
- "version": "1.8.1",
4
+ "version": "1.8.2",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "qwenaudio": "./bin/qwenaudio.mjs"
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": "1.8.1",
4
+ "version": "1.8.2",
5
5
  "description": "A realtime voice frontend for mainstream AI agents.",
6
6
  "author": "qwen-audio-agent contributors",
7
7
  "license": "Apache-2.0",
@@ -66,6 +66,7 @@
66
66
  "tui/native/",
67
67
  "tui/src/index.mjs",
68
68
  "tui/src/macos-voice-io.mjs",
69
+ "tui/src/pcm-audio.mjs",
69
70
  "tui/src/portaudio-voice-io.mjs",
70
71
  "tui/package.json",
71
72
  "web/dist/",
@@ -132,6 +132,9 @@ if (isMain) {
132
132
  'server/src/index.mjs',
133
133
  'shared/runtime-environment.mjs',
134
134
  'tui/src/index.mjs',
135
+ 'tui/src/macos-voice-io.mjs',
136
+ 'tui/src/pcm-audio.mjs',
137
+ 'tui/src/portaudio-voice-io.mjs',
135
138
  'web/dist/index.html',
136
139
  ]
137
140
  const missing = required.filter(file => !files.has(file))
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qwen-audio-agent/server",
3
3
  "private": true,
4
- "version": "1.8.1",
4
+ "version": "1.8.2",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "node --watch src/index.mjs",
@@ -445,8 +445,9 @@ export const config = {
445
445
  1_800_000,
446
446
  { min: 60_000 },
447
447
  ),
448
- scheduledTaskProgressCheckMs: numberSetting(
449
- process.env.QWEN_AUDIO_AGENT_SCHEDULED_TASK_PROGRESS_CHECK_MS,
448
+ backgroundTaskProgressCheckMs: numberSetting(
449
+ process.env.QWEN_AUDIO_AGENT_BACKGROUND_TASK_PROGRESS_CHECK_MS
450
+ || process.env.QWEN_AUDIO_AGENT_SCHEDULED_TASK_PROGRESS_CHECK_MS,
450
451
  300_000,
451
452
  { min: 30_000 },
452
453
  ),
@@ -95,6 +95,7 @@ export class TaskManager {
95
95
  pendingNotificationTtlMs = 604_800_000,
96
96
  notificationClaimTtlMs = 60_000,
97
97
  maxTerminalTasksPerOwner = 100,
98
+ progressCheckMs = config.backgroundTaskProgressCheckMs,
98
99
  logger: taskLogger = null,
99
100
  } = {}) {
100
101
  this.runner = runner
@@ -107,6 +108,7 @@ export class TaskManager {
107
108
  this.pendingNotificationTtlMs = pendingNotificationTtlMs
108
109
  this.notificationClaimTtlMs = notificationClaimTtlMs
109
110
  this.maxTerminalTasksPerOwner = maxTerminalTasksPerOwner
111
+ this.progressCheckMs = Math.max(0, Number(progressCheckMs) || 0)
110
112
  this.logger = taskLogger
111
113
  this.tasks = new Map()
112
114
  this.listeners = new Set()
@@ -370,6 +372,9 @@ export class TaskManager {
370
372
  terminalHandled: false,
371
373
  abortController: null,
372
374
  schedulerHeld: false,
375
+ progressCheckMs: String(kind || 'work') === 'work'
376
+ ? this.progressCheckMs
377
+ : null,
373
378
  }
374
379
  task.promise = new Promise(resolve => {
375
380
  task.resolve = resolve
@@ -388,7 +393,6 @@ export class TaskManager {
388
393
  schedule: { at, recurrence = 'once' } = {},
389
394
  type = 'reminder',
390
395
  timeoutMs = null,
391
- progressCheckMs = null,
392
396
  runner = null,
393
397
  }) {
394
398
  const kind = type === 'task' ? 'scheduled_task' : 'reminder'
@@ -406,9 +410,7 @@ export class TaskManager {
406
410
  timeoutMs: type === 'task'
407
411
  ? Number(timeoutMs) || config.scheduledTaskTimeoutMs
408
412
  : null,
409
- progressCheckMs: type === 'task'
410
- ? Number(progressCheckMs) || config.scheduledTaskProgressCheckMs
411
- : null,
413
+ progressCheckMs: null,
412
414
  createdAt: Date.now(),
413
415
  startedAt: null,
414
416
  completedAt: null,
@@ -560,9 +562,9 @@ export class TaskManager {
560
562
  }, task.timeoutMs)
561
563
  task.timeoutTimer.unref?.()
562
564
  }
563
- // Progress check timer: periodically read real ACP activity data and
564
- // emit task.progress.check so the voice gateway can announce it.
565
- if (task.kind === 'scheduled_task' && task.progressCheckMs) {
565
+ // Interactive background work reports long-running progress. Scheduled
566
+ // work stays quiet until it completes, fails, or needs permission.
567
+ if (task.kind === 'work' && task.progressCheckMs) {
566
568
  task.progressCheckTimer = setInterval(() => {
567
569
  if (!ACTIVE.has(task.status)) {
568
570
  clearInterval(task.progressCheckTimer)
@@ -181,6 +181,7 @@ export function attachRealtimeGateway(server, {
181
181
  let realtimeBlockedError = ''
182
182
  let sleeping = false
183
183
  let waking = false
184
+ let explicitSleepRequested = false
184
185
  let wakeDetector = null
185
186
  let wakeDetectorPromise = null
186
187
  let sleepController
@@ -1555,7 +1556,7 @@ export function attachRealtimeGateway(server, {
1555
1556
  }
1556
1557
 
1557
1558
  const enterSleep = () => {
1558
- if (sleeping || !frontend?.ready) return
1559
+ if (sleeping) return
1559
1560
  sleeping = true
1560
1561
  waking = false
1561
1562
  pendingAudio = []
@@ -1624,6 +1625,26 @@ export function attachRealtimeGateway(server, {
1624
1625
  })
1625
1626
  }
1626
1627
 
1628
+ // The desktop window and the realtime provider must enter sleep as one
1629
+ // state transition. Waiting for the independent inactivity timer lets a
1630
+ // hidden, muted orb continue forwarding wake-word audio to the realtime
1631
+ // model, which can produce replies while no orb is visible.
1632
+ const requestExplicitSleep = () => {
1633
+ if (!config.wakeWordEnabled || textOnlySession) return false
1634
+ explicitSleepRequested = true
1635
+ inputEnabled = false
1636
+ pendingAudio = []
1637
+ prepareSleepMode()
1638
+ const finish = () => {
1639
+ if (!explicitSleepRequested || !wakeDetector) return false
1640
+ enterSleep()
1641
+ return sleeping
1642
+ }
1643
+ if (wakeDetector) return finish()
1644
+ wakeDetectorPromise?.then(finish).catch(() => {})
1645
+ return true
1646
+ }
1647
+
1627
1648
  const WAKE_CONNECT_MAX_ATTEMPTS = 3
1628
1649
  const WAKE_CONNECT_RETRY_BACKOFF_MS = 350
1629
1650
 
@@ -1670,6 +1691,7 @@ export function attachRealtimeGateway(server, {
1670
1691
 
1671
1692
  const wakeFromSleep = () => {
1672
1693
  if (!sleeping || waking) return
1694
+ explicitSleepRequested = false
1673
1695
  sleeping = false
1674
1696
  waking = true
1675
1697
  sleepController.wake()
@@ -1790,11 +1812,14 @@ export function attachRealtimeGateway(server, {
1790
1812
  waking = true
1791
1813
  sleepController.wake()
1792
1814
  }
1793
- if (inputEnabled || outputEnabled) {
1815
+ prepareSleepMode()
1816
+ if (event.wakeWordOnly === true) {
1817
+ requestExplicitSleep()
1818
+ } else if (inputEnabled || outputEnabled) {
1794
1819
  ensureFrontend().catch(reportFrontendError)
1795
1820
  }
1796
- prepareSleepMode()
1797
1821
  } else if (event.type === GatewayClientEvent.UNMUTE) {
1822
+ explicitSleepRequested = false
1798
1823
  if (textOnlySession) {
1799
1824
  inputEnabled = false
1800
1825
  outputEnabled = true
@@ -1811,6 +1836,7 @@ export function attachRealtimeGateway(server, {
1811
1836
  })
1812
1837
  .catch(reportFrontendError)
1813
1838
  } else if (event.type === GatewayClientEvent.INPUT_UNMUTE) {
1839
+ explicitSleepRequested = false
1814
1840
  if (textOnlySession) return
1815
1841
  if (activeVoiceClients.isActive(ownerId, voiceClient)) {
1816
1842
  inputEnabled = true
@@ -1918,6 +1944,7 @@ export function attachRealtimeGateway(server, {
1918
1944
  })
1919
1945
  }
1920
1946
  } else if (event.type === GatewayClientEvent.MUTE) {
1947
+ explicitSleepRequested = false
1921
1948
  releaseVoiceClient()
1922
1949
  sleeping = false
1923
1950
  waking = false
@@ -1931,9 +1958,12 @@ export function attachRealtimeGateway(server, {
1931
1958
  } else if (event.type === GatewayClientEvent.INPUT_MUTE) {
1932
1959
  inputEnabled = false
1933
1960
  pendingAudio = []
1961
+ } else if (event.type === GatewayClientEvent.SLEEP) {
1962
+ requestExplicitSleep()
1934
1963
  } else if (event.type === GatewayClientEvent.WAKE) {
1935
1964
  // 桌面快捷键/托盘唤起只恢复窗口可见性,休眠中的前台连接靠这个事件
1936
1965
  // 恢复,复用唤醒词检测之后同一套重连与退避路径。
1966
+ explicitSleepRequested = false
1937
1967
  if (sleeping) wakeFromSleep()
1938
1968
  else sleepController.recordActivity()
1939
1969
  }
@@ -7,6 +7,7 @@ export const GatewayClientEvent = Object.freeze({
7
7
  AUDIO_APPEND: 'audio.append',
8
8
  TEXT_MESSAGE: 'text.message',
9
9
  INTERRUPT: 'interrupt',
10
+ SLEEP: 'sleep',
10
11
  WAKE: 'wake',
11
12
  PLAYBACK_STARTED: 'playback.started',
12
13
  PLAYBACK_ENDED: 'playback.ended',
package/tui/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qwen-audio-agent/tui",
3
3
  "private": true,
4
- "version": "1.8.1",
4
+ "version": "1.8.2",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "start": "node src/index.mjs",
@@ -0,0 +1,38 @@
1
+ function validSampleRate(value) {
2
+ const rate = Number(value)
3
+ return Number.isFinite(rate) && rate > 0 ? rate : 0
4
+ }
5
+
6
+ /**
7
+ * Convert mono little-endian PCM16 to the playback device rate.
8
+ *
9
+ * Realtime providers negotiate a preferred output rate with the Gateway, but
10
+ * each audio event remains self-describing. Keeping this conversion in the
11
+ * TUI audio boundary lets every provider use the same playback path and also
12
+ * protects against a server that returns a different valid rate.
13
+ */
14
+ export function resamplePcm16(buffer, sourceRate, targetRate) {
15
+ const input = Buffer.from(buffer)
16
+ const fromRate = validSampleRate(sourceRate)
17
+ const toRate = validSampleRate(targetRate)
18
+ if (!fromRate || !toRate) throw new Error('音频采样率无效')
19
+ if (input.length % 2 !== 0) throw new Error('PCM16 音频长度必须为偶数')
20
+ if (!input.length || fromRate === toRate) return input
21
+
22
+ const inputFrames = input.length / 2
23
+ const outputFrames = Math.max(1, Math.round(inputFrames * toRate / fromRate))
24
+ const output = Buffer.allocUnsafe(outputFrames * 2)
25
+
26
+ for (let index = 0; index < outputFrames; index += 1) {
27
+ const position = index * fromRate / toRate
28
+ const left = Math.min(Math.floor(position), inputFrames - 1)
29
+ const right = Math.min(left + 1, inputFrames - 1)
30
+ const fraction = position - left
31
+ const leftSample = input.readInt16LE(left * 2)
32
+ const rightSample = input.readInt16LE(right * 2)
33
+ const sample = Math.round(leftSample + (rightSample - leftSample) * fraction)
34
+ output.writeInt16LE(sample, index * 2)
35
+ }
36
+
37
+ return output
38
+ }