@dsh-plus/lifeboat 0.1.0 → 0.1.2

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/lib/index.js CHANGED
@@ -287,12 +287,14 @@ async function readRawSection(settingsFile, ns) {
287
287
  if (typeof section !== "object" || section === null) return void 0;
288
288
  return section;
289
289
  }
290
- /** 写 settings 带一次冲突重试(用户同时改配置时不抢,放弃并告警)。 */
290
+ /** 写 settings 带一次冲突重试(用户同时改配置时不抢,放弃并告警)。
291
+ * 冲突判定双条件:instanceof 覆盖同版本副本;error.code 覆盖跨版本副本
292
+ * (插件自带 rc.7 依赖与 host rc.8 抛错时 instanceof 为 false)。 */
291
293
  async function writeWithRetry(write) {
292
294
  try {
293
295
  await write();
294
296
  } catch (error) {
295
- if (!(error instanceof SettingsConflictError)) throw error;
297
+ if (!(error instanceof SettingsConflictError || typeof error === "object" && error !== null && error.code === "SETTINGS_CONFLICT")) throw error;
296
298
  await write();
297
299
  }
298
300
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-plus/lifeboat",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "dsh-plus service plugin: 故障救生艇——兄弟插件崩溃时自动隔离(写用户 patch 层禁用),llm-pi 缺席时把其配置临时翻译为官方 llm-pi-ai 路由,恢复后自动还原",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -27,15 +27,22 @@
27
27
  }
28
28
  },
29
29
  "dependencies": {
30
- "@deepseek-ai/cordis": "4.0.1",
31
- "@deepseek-ai/dsh-home-paths": "0.1.0-rc.7",
32
- "@deepseek-ai/dsh-llm": "0.1.0-rc.7",
33
- "@deepseek-ai/dsh-settings": "0.1.0-rc.7",
34
- "@deepseek-ai/schemastery": "3.18.1",
35
30
  "yaml": "^2.6.0"
36
31
  },
32
+ "peerDependencies": {
33
+ "@deepseek-ai/cordis": "^4.0.1",
34
+ "@deepseek-ai/dsh-home-paths": "^0.1.0-rc.8",
35
+ "@deepseek-ai/dsh-llm": "^0.1.0-rc.8",
36
+ "@deepseek-ai/dsh-settings": "^0.1.0-rc.8",
37
+ "@deepseek-ai/schemastery": "^3.18.1"
38
+ },
37
39
  "devDependencies": {
38
- "@deepseek-ai/dsh-host-webserver": "0.1.0-rc.7"
40
+ "@deepseek-ai/cordis": "4.0.1",
41
+ "@deepseek-ai/dsh-home-paths": "0.1.0-rc.8",
42
+ "@deepseek-ai/dsh-host-webserver": "0.1.0-rc.8",
43
+ "@deepseek-ai/dsh-llm": "0.1.0-rc.8",
44
+ "@deepseek-ai/dsh-settings": "0.1.0-rc.8",
45
+ "@deepseek-ai/schemastery": "3.18.1"
39
46
  },
40
47
  "publishConfig": {
41
48
  "access": "public"
@@ -159,12 +159,17 @@ interface SettingsWrite {
159
159
  mutate(ns: ReturnType<typeof settingsNamespace>, ops: readonly { op: 'set' | 'unset'; path: readonly string[]; value?: unknown }[]): Promise<void>
160
160
  }
161
161
 
162
- /** 写 settings 带一次冲突重试(用户同时改配置时不抢,放弃并告警)。 */
162
+ /** 写 settings 带一次冲突重试(用户同时改配置时不抢,放弃并告警)。
163
+ * 冲突判定双条件:instanceof 覆盖同版本副本;error.code 覆盖跨版本副本
164
+ * (插件自带 rc.7 依赖与 host rc.8 抛错时 instanceof 为 false)。 */
163
165
  async function writeWithRetry(write: () => Promise<void>): Promise<void> {
164
166
  try {
165
167
  await write()
166
168
  } catch (error) {
167
- if (!(error instanceof SettingsConflictError)) throw error
169
+ const conflict =
170
+ error instanceof SettingsConflictError ||
171
+ (typeof error === 'object' && error !== null && (error as { code?: unknown }).code === 'SETTINGS_CONFLICT')
172
+ if (!conflict) throw error
168
173
  await write()
169
174
  }
170
175
  }