dsh-dafeiyu-emotion 0.2.7 → 0.2.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.
- package/CHANGELOG.md +5 -0
- package/README.md +3 -3
- package/docs/MARKETPLACE.md +1 -1
- package/docs/RELEASE-0.2.8.md +16 -0
- package/package.json +1 -1
- package/scripts/test-config-schema.mjs +27 -1
- package/src/index.js +26 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.8
|
|
4
|
+
|
|
5
|
+
- Fixed `backendRoot` showing as `[object Object]` on the settings page. DSH projects volatile `Config` fields as `{ get() }` refs; `readSettings()` and `resolveOptions()` now unwrap them before path/string/number handling.
|
|
6
|
+
- Added `plainConfig` regression coverage so a volatile ref can never be stringified into a fake path again.
|
|
7
|
+
|
|
3
8
|
## 0.2.7
|
|
4
9
|
|
|
5
10
|
- Fixed a host activation failure: `apply` read `ctx.settings` while the plugin only declared `webServer`. Cordis throws `cannot get property "settings" without inject`, so the whole host plugin failed to mount and `/plugins/dsh-dafeiyu-emotion/config` returned 404.
|
package/README.md
CHANGED
|
@@ -111,9 +111,9 @@ dsh plugin --profile desktop add github:LiDu-china/dsh-dafeiyu-emotion
|
|
|
111
111
|
### 通过 Release tarball
|
|
112
112
|
|
|
113
113
|
```bash
|
|
114
|
-
curl -L -o dsh-dafeiyu-emotion-0.2.
|
|
115
|
-
https://github.com/LiDu-china/dsh-dafeiyu-emotion/releases/download/v0.2.
|
|
116
|
-
dsh plugin --profile desktop add "D:/path/to/dsh-dafeiyu-emotion-0.2.
|
|
114
|
+
curl -L -o dsh-dafeiyu-emotion-0.2.8.tgz \
|
|
115
|
+
https://github.com/LiDu-china/dsh-dafeiyu-emotion/releases/download/v0.2.8/dsh-dafeiyu-emotion-0.2.8.tgz
|
|
116
|
+
dsh plugin --profile desktop add "D:/path/to/dsh-dafeiyu-emotion-0.2.8.tgz"
|
|
117
117
|
```
|
|
118
118
|
|
|
119
119
|
> DSH Desktop 的 profile 由 Electron 应用管理;命令行安装请使用桌面应用自带的 `dsh` 命令。
|
package/docs/MARKETPLACE.md
CHANGED
|
@@ -72,7 +72,7 @@ https://github.com/LiDu-china/dsh-dafeiyu-emotion/releases/download/v0.2.3/dsh-d
|
|
|
72
72
|
dsh plugin --profile desktop add dsh-dafeiyu-emotion
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
Published as `dsh-dafeiyu-emotion@0.2.
|
|
75
|
+
Published as `dsh-dafeiyu-emotion@0.2.8` on npm. The 1024Store entry refreshes its one-click install automatically. GitHub-source and Release-tarball installs remain available as fallbacks.
|
|
76
76
|
|
|
77
77
|
## Privacy
|
|
78
78
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
## 0.2.8
|
|
2
|
+
|
|
3
|
+
修复设置页把增强后端目录显示成 `[object Object]` 的问题。
|
|
4
|
+
|
|
5
|
+
- DSH 的 settings 服务会把 `Config` 的 volatile 字段投影成 `{ get() }` 引用。
|
|
6
|
+
- 0.2.7 直接对引用做 `String()`,得到 `[object Object]`,再被 `resolve()` 拼成 `C:\...\profiles\desktop\[object Object]`,于是状态卡显示“后端目录不存在”。
|
|
7
|
+
- 0.2.8 在 `readSettings()` 和 `resolveOptions()` 中统一用 `plainConfig()` 递归解包,再处理路径、语言和数字。
|
|
8
|
+
- 新增回归测试,确保 volatile ref 不会被字符串化成假路径。
|
|
9
|
+
|
|
10
|
+
## 安装
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
dsh plugin --profile desktop add dsh-dafeiyu-emotion
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
升级后请完全退出并重新启动 the agent harness,让 Host 重新读取 0.2.8。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from 'node:assert/strict'
|
|
2
2
|
|
|
3
|
-
import { Config } from '../src/index.js'
|
|
3
|
+
import { Config, plainConfig, resolveOptions } from '../src/index.js'
|
|
4
4
|
|
|
5
5
|
// The DSH settings service parses the schema with its defaults before a plugin
|
|
6
6
|
// row can become configurable. A default that violates its own step/min/max
|
|
@@ -50,4 +50,30 @@ assert.throws(
|
|
|
50
50
|
'unknown languages must be rejected by the schema',
|
|
51
51
|
)
|
|
52
52
|
|
|
53
|
+
// DSH projects volatile fields as { get() } refs. They must be unwrapped
|
|
54
|
+
// before path resolution; otherwise backendRoot becomes "[object Object]".
|
|
55
|
+
{
|
|
56
|
+
const ref = (value) => ({ get: () => value })
|
|
57
|
+
assert.deepEqual(
|
|
58
|
+
plainConfig({
|
|
59
|
+
backendRoot: ref('D:/voice-sense'),
|
|
60
|
+
nested: { language: ref('auto') },
|
|
61
|
+
}),
|
|
62
|
+
{
|
|
63
|
+
backendRoot: 'D:/voice-sense',
|
|
64
|
+
nested: { language: 'auto' },
|
|
65
|
+
},
|
|
66
|
+
)
|
|
67
|
+
const options = resolveOptions({
|
|
68
|
+
backendRoot: ref('D:/voice-sense'),
|
|
69
|
+
pythonPath: ref(''),
|
|
70
|
+
language: ref('auto'),
|
|
71
|
+
maxAudioBytes: ref(8 * 1024 * 1024),
|
|
72
|
+
})
|
|
73
|
+
assert.equal(options.backendRoot.includes('[object Object]'), false)
|
|
74
|
+
assert.ok(options.backendRoot.endsWith('voice-sense'))
|
|
75
|
+
assert.equal(options.language, 'auto')
|
|
76
|
+
assert.equal(options.maxAudioBytes, 8 * 1024 * 1024)
|
|
77
|
+
}
|
|
78
|
+
|
|
53
79
|
console.log('config schema tests passed')
|
package/src/index.js
CHANGED
|
@@ -137,17 +137,32 @@ function asNumber(value, fallback) {
|
|
|
137
137
|
return Number.isFinite(numeric) ? numeric : fallback
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
/**
|
|
141
|
+
* DSH settings projects volatile Config fields as live refs (`{ get() }`).
|
|
142
|
+
* Unwrap them before path/string/number handling, otherwise String(ref)
|
|
143
|
+
* becomes "[object Object]" and a path is resolved into the profile cwd.
|
|
144
|
+
*/
|
|
145
|
+
function plainConfig(value) {
|
|
146
|
+
if (value && typeof value.get === 'function') return plainConfig(value.get())
|
|
147
|
+
if (Array.isArray(value)) return value.map(plainConfig)
|
|
148
|
+
if (value && typeof value === 'object') {
|
|
149
|
+
return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, plainConfig(child)]))
|
|
150
|
+
}
|
|
151
|
+
return value
|
|
152
|
+
}
|
|
153
|
+
|
|
140
154
|
function resolveOptions(raw = {}) {
|
|
155
|
+
const value = plainConfig(raw)
|
|
141
156
|
return {
|
|
142
|
-
enabled:
|
|
143
|
-
backendRoot: String(
|
|
144
|
-
? resolve(String(
|
|
157
|
+
enabled: value.enabled !== false,
|
|
158
|
+
backendRoot: String(value.backendRoot || process.env.DSH_DAFEIYU_EMOTION_BACKEND || DEFAULTS.backendRoot).trim()
|
|
159
|
+
? resolve(String(value.backendRoot || process.env.DSH_DAFEIYU_EMOTION_BACKEND || DEFAULTS.backendRoot))
|
|
145
160
|
: '',
|
|
146
|
-
pythonPath: String(
|
|
147
|
-
language: ['zh', 'en', 'auto'].includes(
|
|
148
|
-
maxAudioBytes: Math.min(32 * 1024 * 1024, Math.max(256 * 1024, asNumber(
|
|
149
|
-
startupTimeoutMs: Math.min(600000, Math.max(10000, asNumber(
|
|
150
|
-
requestTimeoutMs: Math.min(600000, Math.max(10000, asNumber(
|
|
161
|
+
pythonPath: String(value.pythonPath || '').trim(),
|
|
162
|
+
language: ['zh', 'en', 'auto'].includes(value.language) ? value.language : DEFAULTS.language,
|
|
163
|
+
maxAudioBytes: Math.min(32 * 1024 * 1024, Math.max(256 * 1024, asNumber(value.maxAudioBytes, DEFAULTS.maxAudioBytes))),
|
|
164
|
+
startupTimeoutMs: Math.min(600000, Math.max(10000, asNumber(value.startupTimeoutMs, DEFAULTS.startupTimeoutMs))),
|
|
165
|
+
requestTimeoutMs: Math.min(600000, Math.max(10000, asNumber(value.requestTimeoutMs, DEFAULTS.requestTimeoutMs))),
|
|
151
166
|
}
|
|
152
167
|
}
|
|
153
168
|
|
|
@@ -209,7 +224,7 @@ function readSettings(service) {
|
|
|
209
224
|
try {
|
|
210
225
|
const entry = service.describe().find((row) => row?.ns === SETTINGS_NAMESPACE)
|
|
211
226
|
if (!entry) return null
|
|
212
|
-
return { ...(entry.value || {}), ...(entry.user || {}) }
|
|
227
|
+
return plainConfig({ ...(entry.value || {}), ...(entry.user || {}) })
|
|
213
228
|
} catch {
|
|
214
229
|
return null
|
|
215
230
|
}
|
|
@@ -1032,6 +1047,8 @@ export {
|
|
|
1032
1047
|
createConfigHandler,
|
|
1033
1048
|
decorateAnalysis,
|
|
1034
1049
|
normalizeConfigPatch,
|
|
1050
|
+
plainConfig,
|
|
1035
1051
|
publicConfig,
|
|
1052
|
+
resolveOptions,
|
|
1036
1053
|
transcribeWithSpeech,
|
|
1037
1054
|
}
|