better-dsh-pet 0.3.5 → 0.3.6

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
@@ -277,7 +277,7 @@ dsh plugin --profile web add better-dsh-pet
277
277
  > 如果刚发布新版本不到 24 小时,pnpm 11 的 `minimumReleaseAge` 安全策略可能不会自动选最新版,而是退回旧版。此时请指定精确版本安装:
278
278
  >
279
279
  > ```bash
280
- > dsh plugin --profile web add better-dsh-pet@0.3.5
280
+ > dsh plugin --profile web add better-dsh-pet@0.3.6
281
281
  > ```
282
282
  >
283
283
  > pnpm 会自动把该版本加入 `minimumReleaseAgeExclude` 并完成安装;也可以等待 24 小时后直接用上面的普通命令。
@@ -402,7 +402,7 @@ Remove-Item "C:\Users\Administrator\.dsh\voice" -Recurse -Force
402
402
  - **升级时提示 EPERM**:
403
403
  - 先完全退出 DSH / 桌宠,再执行:
404
404
  ```bash
405
- dsh plugin --profile web add better-dsh-pet@0.3.5
405
+ dsh plugin --profile web add better-dsh-pet@0.3.6
406
406
  ```
407
407
 
408
408
  ---
@@ -604,6 +604,19 @@ npm run download:sensevoice
604
604
  4. 首次启动需要自动下载 Electron,请稍等片刻
605
605
  5. 如果下载失败,可手动设置 `DSH_PET_ELECTRON_PATH` 指向 `electron.exe`
606
606
 
607
+ ### Q:DSH 升到 0.2.x 之后大肥鱼不见了?
608
+
609
+ 0.3.5 及更早版本会有两处不兼容,**升级到 0.3.6** 即可:
610
+
611
+ 1. peer 范围写在 `^0.1.0-rc.6`(只覆盖 0.1.x)。DSH 装配 profile 时会校验 `@deepseek-ai/dsh-*` 的 peer 范围与运行时版本,不匹配就**整个 bundle 被跳过**——插件不加载、设置页也没有卡片。0.3.6 起放宽为 `>=0.1.0-rc.6 <0.3.0`。
612
+ 2. DSH 0.2.0 桌面端把宿主跑在 `ELECTRON_RUN_AS_NODE=1` 下,该环境变量会继承给桌宠 Helper,使 `electron.exe` 退化为纯 Node 进程(`require('electron')` 报 `MODULE_NOT_FOUND`),窗口起不来、进程被反复重拉。0.3.6 起在 spawn Helper 前摘掉这个开关。
613
+
614
+ 升级命令:
615
+
616
+ ```bash
617
+ dsh plugin --profile web add better-dsh-pet@0.3.6
618
+ ```
619
+
607
620
  ### Q:为什么没有余额显示?
608
621
 
609
622
  - 需要 DSH 中配置了 `DEEPSEEK_API_KEY`
@@ -98,9 +98,16 @@ export class HelperProcess {
98
98
  const command = launch.command
99
99
  const args = this.options.args || launch.args
100
100
 
101
+ const childEnv = { ...process.env, ...this.options.env }
102
+ // DSH 0.2.0 桌面端把宿主跑在 ELECTRON_RUN_AS_NODE=1 下(用自带 Electron 二进制充当
103
+ // Node),该变量会随 process.env 继承给桌宠 Helper,使它退化为纯 Node 进程:
104
+ // require('electron') 直接 MODULE_NOT_FOUND → 窗口起不来,Helper 秒退后被看门狗
105
+ // 每 750ms 重拉(表现为大肥鱼一直不出现)。独立 Electron 窗口必须摘掉这个开关。
106
+ delete childEnv.ELECTRON_RUN_AS_NODE
107
+ delete childEnv.ELECTRON_NO_ATTACH_CONSOLE
101
108
  const child = spawn(command, args, {
102
109
  cwd: this.options.cwd || packageRoot,
103
- env: { ...process.env, ...this.options.env },
110
+ env: childEnv,
104
111
  stdio: ['ignore', 'pipe', 'pipe'],
105
112
  windowsHide: true,
106
113
  })
@@ -46,8 +46,9 @@ export interface Config {
46
46
  voiceAutoSend?: boolean;
47
47
  voiceAutoRecord?: boolean;
48
48
  holidayEnabled?: boolean;
49
- wakeWord?: string;
50
- taskCwd?: string;
49
+ wakeWord?: string;
50
+ taskCwd?: string;
51
+ weatherCity?: string;
51
52
  }
52
53
 
53
54
  /**
@@ -74,10 +74,12 @@ export interface Config {
74
74
  voiceAutoRecord?: boolean;
75
75
  /** 启用节日祝福识别(阳历与农历)。默认 false。 */
76
76
  holidayEnabled?: boolean;
77
- /** 语音唤醒词。默认“大肥鱼”。 */
78
- wakeWord?: string;
79
- /** 复杂任务工作目录(留空=用户主目录)。 */
80
- taskCwd?: string;
77
+ /** 语音唤醒词。默认“大肥鱼”。 */
78
+ wakeWord?: string;
79
+ /** 复杂任务工作目录(留空=用户主目录)。 */
80
+ taskCwd?: string;
81
+ /** 查天气默认城市(留空=自动定位)。 */
82
+ weatherCity?: string;
81
83
  /** 旧版 /pet 路由的 full 资源根目录。 */
82
84
  fullRoot?: string;
83
85
  /** Helper 进程选项。 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-dsh-pet",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "A desktop-native pet bubble driven by DeepSeek Harness session events: transparent always-on-top Electron window, status-aware animations, voice chat/wake, real DSH task execution, emotion, festival, balance, pomodoro, roast, and DSH settings card.",
5
5
  "keywords": [
6
6
  "dsh",
@@ -37,6 +37,7 @@
37
37
  "scripts.encode:thumbs —— 转码管线(step03 母版 → assets/thumb 360×360)",
38
38
  "scripts.prepack —— 发布前自动健康检查",
39
39
  "peerDependencies —— 运行时由宿主(DSH)提供的模块,本包不打包它们",
40
+ "peerDependencies 范围(0.3.6 起):DSH 在装配 profile 时会用 semver 校验 @deepseek-ai/dsh-* 的 peer 范围与运行时版本,范围不含运行时版本会导致整个 bundle 被跳过(插件完全不加载、设置页也没有卡片)。原 ^0.1.0-rc.6 只覆盖 0.1.x,在 0.2.x 上必被跳过,故放宽为 >=0.1.0-rc.6 <0.3.0。",
40
41
  "================================================"
41
42
  ],
42
43
  "type": "module",
@@ -86,10 +87,10 @@
86
87
  },
87
88
  "peerDependencies": {
88
89
  "@deepseek-ai/cordis": "^4.0.1",
89
- "@deepseek-ai/dsh-home-paths": "^0.1.0-rc.6",
90
- "@deepseek-ai/dsh-host-webserver": "^0.1.0-rc.6",
91
- "@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.6",
92
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6",
90
+ "@deepseek-ai/dsh-home-paths": ">=0.1.0-rc.6 <0.3.0",
91
+ "@deepseek-ai/dsh-host-webserver": ">=0.1.0-rc.6 <0.3.0",
92
+ "@deepseek-ai/dsh-client-runtime": ">=0.1.0-rc.6 <0.3.0",
93
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.1.0-rc.6 <0.3.0",
93
94
  "react": "^18.2.0"
94
95
  }
95
96
  }
@@ -35,9 +35,9 @@ const DEFAULT_MODEL_URL = 'https://github.com/k2-fsa/sherpa-onnx/releases/downlo
35
35
  const MODEL_URLS = [
36
36
  process.env.DSH_VOICE_MODEL_URL,
37
37
  DEFAULT_MODEL_URL,
38
- `https://ghproxy.net/${DEFAULT_MODEL_URL}`,
39
- `https://ghfast.top/${DEFAULT_MODEL_URL}`,
40
38
  `https://gh-proxy.com/${DEFAULT_MODEL_URL}`,
39
+ `https://ghfast.top/${DEFAULT_MODEL_URL}`,
40
+ `https://gh.llkk.cc/${DEFAULT_MODEL_URL}`,
41
41
  ].filter((url, index, arr) => typeof url === 'string' && url.trim() !== '' && arr.indexOf(url) === index)
42
42
  const REQUIRED = ['model.int8.onnx', 'tokens.txt']
43
43
  const LOG_FILE = join(DSH_HOME, 'logs', 'better-dsh-pet-sensevoice.log')
@@ -70,8 +70,8 @@ async function download(url, dest, label = 'download') {
70
70
  let connected = false
71
71
  let lastChunkAt = Date.now()
72
72
  const connectTimer = setTimeout(() => {
73
- if (!connected) controller.abort(new Error('连接超时(30秒未响应)'))
74
- }, 30000)
73
+ if (!connected) controller.abort(new Error('连接超时(15秒未响应)'))
74
+ }, 15000)
75
75
  let stallTimer
76
76
  try {
77
77
  log(`[${label}] 等待响应...`)
@@ -85,10 +85,10 @@ async function download(url, dest, label = 'download') {
85
85
  let lastPercent = -1
86
86
  lastChunkAt = Date.now()
87
87
  stallTimer = setInterval(() => {
88
- if (Date.now() - lastChunkAt > 30000) {
89
- controller.abort(new Error('下载停滞(30秒无数据)'))
88
+ if (Date.now() - lastChunkAt > 10000) {
89
+ controller.abort(new Error('下载停滞(10秒无数据)'))
90
90
  }
91
- }, 5000)
91
+ }, 3000)
92
92
  const progress = new Transform({
93
93
  transform(chunk, _encoding, callback) {
94
94
  received += chunk.length