dsh-duet 0.3.2 → 0.3.3
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 +2 -0
- package/assets/avatar/desktop/companion.mjs +3 -3
- package/assets/avatar/desktop/manifest.json +1 -1
- package/desktop/bin/darwin-arm64/duet-avatar.app/Contents/MacOS/duet-avatar +0 -0
- package/desktop/bin/darwin-arm64/manifest.json +3 -3
- package/desktop/bin/win32-x64/duet-avatar.exe +0 -0
- package/desktop/bin/win32-x64/manifest.json +3 -3
- package/package.json +2 -2
- package/src/avatar/companion.mjs +5 -3
- package/src/client/agent-tasks.mjs +116 -18
- package/src/client/audio.mjs +1 -1
- package/src/client/avatar.mjs +15 -2
- package/src/client/browser.mjs +24 -24
- package/src/client/composer-bridge.mjs +1 -1
- package/src/client/connection-hint.mjs +1 -1
- package/src/client/entry.js +2 -2
- package/src/client/feedback.mjs +1 -1
- package/src/client/identity.mjs +1 -1
- package/src/client/interactions.mjs +5 -4
- package/src/client/notice.mjs +30 -9
- package/src/client/settings.html +5 -4
- package/src/client/sidebar-layout.mjs +26 -0
- package/src/client/tutorial-adapter.mjs +5 -5
- package/src/client/tutorial.mjs +1 -1
- package/src/client/work-mode.mjs +1 -1
- package/src/host/agent-connection.mjs +6 -1
- package/src/host/assets.mjs +1 -0
- package/src/host/auth.mjs +13 -0
- package/src/host/avatar.mjs +32 -13
- package/src/host/plugin.mjs +18 -15
- package/src/host/proxy.mjs +3 -2
- package/src/host/sync-feed.mjs +3 -2
- package/src/shared/state.mjs +29 -4
package/src/shared/state.mjs
CHANGED
|
@@ -1,8 +1,33 @@
|
|
|
1
1
|
/** Desired voice mode is independent of a temporarily suspended connection. */
|
|
2
|
-
export const PLUGIN_VERSION = '0.3.
|
|
2
|
+
export const PLUGIN_VERSION = '0.3.3'
|
|
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 : ''
|
|
6
|
+
const compareVersions = (a, b) => a.split('.').reduce((result, v, i) => result || Math.sign(Number(v) - Number(b.split('.')[i])), 0)
|
|
7
|
+
|
|
8
|
+
/** Display only upgrades the installed client has not received yet. */
|
|
9
|
+
export function updateDetails(info = {}, current = PLUGIN_VERSION) {
|
|
10
|
+
const target = safeVersion(info.recommended_client_version)
|
|
11
|
+
const entries = new Map()
|
|
12
|
+
if (safeVersion(current) && target && compareVersions(target, current) > 0) {
|
|
13
|
+
for (const row of (Array.isArray(info.release_history) ? info.release_history.slice(0, 64) : [])) {
|
|
14
|
+
if (!safeVersion(row?.version) || typeof row.notes !== 'string' || !row.notes.trim()) continue
|
|
15
|
+
if (compareVersions(row.version, current) > 0 && compareVersions(row.version, target) <= 0) {
|
|
16
|
+
entries.set(row.version, {version: row.version, notes: row.notes.slice(0, 1000).trim()})
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (!entries.has(target) && typeof info.recommended_release_notes === 'string' && info.recommended_release_notes.trim()) {
|
|
20
|
+
entries.set(target, {version: target, notes: info.recommended_release_notes.slice(0, 1000).trim()})
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
let remaining = 16000
|
|
24
|
+
const releases = [...entries.values()].sort((a, b) => compareVersions(b.version, a.version)).filter(row => {
|
|
25
|
+
remaining -= row.notes.length
|
|
26
|
+
return remaining >= 0
|
|
27
|
+
})
|
|
28
|
+
return {currentVersion: current, targetVersion: target, releases,
|
|
29
|
+
releaseNotes: info.recommended_release_notes}
|
|
30
|
+
}
|
|
6
31
|
export function compatibilityNotice(code, details = {}, mode = 'online') {
|
|
7
32
|
const key = mode === 'tts_only' ? 'tts_only' : 'online'
|
|
8
33
|
const info = details.compatibility || {}
|
|
@@ -85,11 +110,11 @@ export class DuetState {
|
|
|
85
110
|
if(event.reconnect_required===true&&this.mode!=='off')void this.replaceConnection({reason:'voice_policy_changed'})
|
|
86
111
|
} else if (event.type === 'compatibility') {
|
|
87
112
|
const recommended = safeVersion(event.compatibility?.recommended_client_version)
|
|
88
|
-
const newer = recommended && recommended
|
|
113
|
+
const newer = recommended && compareVersions(recommended, PLUGIN_VERSION) > 0
|
|
89
114
|
if (newer && this.recommendationShown !== recommended) {
|
|
90
115
|
this.recommendationShown = recommended
|
|
91
116
|
this.notice(`当前插件 ${PLUGIN_VERSION},推荐更新到 ${recommended}。当前连接可以继续使用。`, {
|
|
92
|
-
upgrade: true,
|
|
117
|
+
upgrade: true, ...updateDetails(event.compatibility),
|
|
93
118
|
})
|
|
94
119
|
}
|
|
95
120
|
} else if (event.type === 'ready') {
|
|
@@ -122,7 +147,7 @@ export class DuetState {
|
|
|
122
147
|
const compatibility = compatibilityNotice(code, details, this.mode)
|
|
123
148
|
if (compatibility) {
|
|
124
149
|
this.notice(compatibility, { upgrade: code !== 'client_version_unsupported',
|
|
125
|
-
|
|
150
|
+
...updateDetails({...details.policy, ...details.compatibility}) })
|
|
126
151
|
void this.setMode('off', {reason:'error',code})
|
|
127
152
|
return
|
|
128
153
|
}
|