better-dsh-pet 0.2.3 → 0.2.4

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.
Files changed (2) hide show
  1. package/lib/client.js +19 -4
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -276,10 +276,25 @@ window.__ModuleLoader__.load({
276
276
  }
277
277
 
278
278
  function apply(ctx) {
279
- ctx.slots.inject('settings.plugin.item', () => ctx.slots.register({
280
- name: 'settings.plugin.item', id: 'better-dsh-pet', order: 30,
281
- inject: () => ({}),
282
- }, PetSettingsCard))
279
+ ctx.slots.inject('settings.plugin.item', () => {
280
+ const kind = typeof ctx.slots.spec === 'function'
281
+ ? ctx.slots.spec('settings.plugin.item')?.kind
282
+ : undefined
283
+ // 不同 DSH 客户端版本对 settings.plugin.item 的槽位类型不同:
284
+ // 旧版是 list(用 id 标识卡片),新版可能是 keyed(用 key 标识)。
285
+ // 这里同时带上 id 和 key,两种声明都能兼容。
286
+ const options = {
287
+ name: 'settings.plugin.item',
288
+ id: 'better-dsh-pet',
289
+ key: 'better-dsh-pet',
290
+ order: 30,
291
+ inject: () => ({}),
292
+ }
293
+ // 若运行时的槽位规格明确是 keyed,则只保留 key(避免多余字段带来歧义);
294
+ // 其余情况(list / 未知)保留 id,保证旧版 DSH 也能正常加载。
295
+ if (kind === 'keyed') delete options.id
296
+ return ctx.slots.register(options, PetSettingsCard)
297
+ })
283
298
  }
284
299
 
285
300
  exports.name = 'better-dsh-pet-client'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-dsh-pet",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "A desktop-native pet bubble driven by DeepSeek Harness session events: transparent always-on-top Electron window, status-aware animations, balance, pomodoro, roast, and DSH settings card.",
5
5
  "keywords": [
6
6
  "dsh",