dsh-duet 0.1.6 → 0.1.8

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.
@@ -1,5 +1,5 @@
1
1
  /** Desired voice mode is independent of a temporarily suspended connection. */
2
- export const PLUGIN_VERSION = '0.1.6'
2
+ export const PLUGIN_VERSION = '0.1.8'
3
3
  export const IDLE_RELEASE_MS = 60_000
4
4
 
5
5
  const safeVersion = value => typeof value === 'string' && value.length <= 32 && /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(value) ? value : ''
@@ -48,7 +48,7 @@ export class DuetState {
48
48
  this.suspended = false
49
49
  this.idleSince = null
50
50
  if (mode === 'off') this.pending.clear()
51
- // Online result polling belongs to its existing server-side Harness client.
51
+ // Online notifications belong to the negotiated Harness stream (or legacy adapter).
52
52
  if (mode === 'online') this.pending.clear()
53
53
  await this.replaceConnection()
54
54
  }
@@ -89,10 +89,10 @@ export class DuetState {
89
89
  this.pending.delete(event.message_id)
90
90
  this.sent.delete(event.message_id)
91
91
  this.flush()
92
- } else if (event.type === 'error') {
92
+ } else if (event.type === 'error' || (event.type === 'warning' && event.warning?.code === 'malformed_dense_action')) {
93
93
  // A rejected model action is not a dead transport. Never execute/retry it,
94
94
  // but leave the user able to clarify instead of closing their microphone.
95
- if (event.code === 'malformed_dense_action') {
95
+ if ((event.code || event.warning?.code) === 'malformed_dense_action') {
96
96
  this.notice('这次操作指令格式有误,未执行。语音仍已连接,请重新说明。')
97
97
  } else this.fail(event.code, event)
98
98
  }