dsh-instruction-memory 1.0.7 → 1.0.9

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
@@ -36,6 +36,7 @@ dsh plugin --profile web remove dsh-instruction-memory
36
36
  | `contract-test.mjs` | 契约测试:驱动真实路由,验证两半之间的响应格式 |
37
37
  | `verify.mjs` | 装载验证:按 DSH 的方式加载两半 |
38
38
  | `smoke-test.mjs` | 注入渲染逻辑的单元测试 |
39
+ | `host-range-test.mjs` | 宿主版本范围契约测试:固定矩阵 × 两种 semver 判定模式,锁死兼容性声明 |
39
40
  | `docs/demo.html` | 离线演示页:桩掉 DSH 外壳、加载真实 Client 半渲染设置页(不随 npm 包发布) |
40
41
 
41
42
  ## 生效方式
@@ -73,10 +74,10 @@ DSH 就会得到第二份空记忆,看起来像"记忆消失"。
73
74
 
74
75
  ## 兼容性
75
76
 
76
- `dsh.compatibility.dsh` 声明为:
77
+ `dsh.compatibility.dsh` 与 `dsh.engines.dsh` 声明为同一串:
77
78
 
78
79
  ```
79
- >=0.1.3-alpha.2 <0.1.4 || >=0.1.4-0 <0.1.5-0 || >=0.1.5-alpha.1
80
+ >=0.1.3-alpha.2 <0.1.4 || >=0.1.4-0 <0.1.5-0 || >=0.1.5-alpha.1 <0.1.6-0 || >=0.1.6-alpha.0 <0.1.7-0 || >=0.1.7-alpha.0 <0.2.0-0 || >=0.2.0-0
80
81
  ```
81
82
 
82
83
  **实测范围**:以下 5 个宿主版本已在 **Windows / Node 22** 上逐个真实启动验证(每个版本都确认了
@@ -84,14 +85,34 @@ DSH 就会得到第二份空记忆,看起来像"记忆消失"。
84
85
 
85
86
  `0.1.3-alpha.2` · `0.1.5-alpha.1` · `0.1.5-alpha.2` · `0.1.5-rc.1` · `0.1.5-rc.2`
86
87
 
88
+ 此外 `0.1.6-alpha.2` 与 `0.1.7-rc.2` 完成了完整的装载与兼容性判定核验(`host-range-test.mjs`
89
+ 的固定矩阵覆盖它们,且该脚本会**读取本机实际安装的宿主版本**做实时断言)。
90
+
87
91
  **为什么写成分段形式**:node-semver 规定"候选版本带预发布标签时,区间里必须存在同一个
88
- major.minor.patch 且自身带预发布标签的比较符"。因此看起来很宽的写法——例如 `>=0.1.3-alpha.2`
89
- 甚至 `>=0.1.3-alpha.2 <0.2.0-0`——**反而匹配不到** `0.1.5-rc.1` / `0.1.5-rc.2` 这些预发布版本
90
- (已用 node-semver 7.8.5 与插件市场自带的版本判定实现逐一实测确认)。分段写法在两者下都能覆盖上面 5 个版本。
92
+ major.minor.patch 且自身带预发布标签的比较符"。这条规则是**集合级**的——一个 `||` 分支最多
93
+ 覆盖**一个** minor 的预发布版本。由此产生两个必须遵守的约束:
94
+
95
+ - **宽写法接不住预发布**:`>=0.1.3-alpha.2`、`>=0.1.3-alpha.2 <0.2.0-0` 都**匹配不到**
96
+ `0.1.4-0` / `0.1.5-rc.1` / `0.1.6-alpha.2`——因为 `0.1.3` 与 `0.2.0` 的 tuple 都不等于
97
+ 它们各自的 tuple(已用 node-semver 7.8.5 实测确认)。
98
+ - **每段的上界不能省**:省略会被上一段的比较符"续接"。例如单写 `>=0.1.5-alpha.1`(不封顶),
99
+ 在把 `0.1.3` 当 token 时会放行 `0.1.3-alpha.0/1`。
100
+
101
+ ⚠️ **一个必须知道的上限**:**未声明的未来 minor 的预发布版本,无法被任何范围覆盖。**
102
+ `0.1.8-rc.1` 这类版本 tuple 与所有比较符都不同,在 npm 语义下**永远匹配不到**——与
103
+ `^0.1.0` 无法匹配 `0.1.8-rc.1` 是同一个限制。正式版(`0.1.8`、`0.2.0`、`1.0.0` 等)不受影响。
104
+ DSH 发布新的预发布 minor 时需追加一段,例如 `|| >=0.1.8-alpha.0 <0.2.0-0`;
105
+ `host-range-test.mjs` 的**实时守卫**会把这类缺口暴露出来(它直接读本机安装的宿主版本)。
106
+
107
+ **历史修复说明**(同一个 bug 出现过两次,值得记下来):
108
+
109
+ - 1.0.7 及以前,范围末段是 `>=0.1.5-alpha.1`,使宿主 `0.1.6-alpha.2` 在 npm **默认**语义下
110
+ 被判为**不兼容**(预发布门禁要求 tuple 相同:`0.1.5 ≠ 0.1.6`,`>=` 的大小比较根本走不到)。
111
+ - 1.0.8 改为逐段枚举,但只枚举到 `0.1.6`。DSH 随后发布 `0.1.7-rc.2`,**同一个假阴性再次出现**:
112
+ 范围里最后一个预发布 tuple 是 `0.1.6`,而 `0.1.7 ≠ 0.1.6`。1.0.9 补上 `0.1.7` 段。
91
113
 
92
- **为什么没有上限**:不设上限,未来 DSH 发布新的预发布版本时不会被判为"超出上限"而拒绝升级。
93
- 代价是 `0.2.0` / `1.0.0` 这类未来版本在 node-semver 下也会被判为满足;若你希望严格封顶,
94
- 在末尾追加 `<0.2.0-0` 即可(注意那会让下一版 0.1.6+ 被市场判为超限)。
114
+ 两次都因为插件市场传入 `includePrerelease: true` 而侥幸放行,但任何标准 semver 判定
115
+ (`npm` / `pnpm` 的依赖解析)都会拒绝。现在 `host-range-test.mjs` 同时具备固定矩阵与实时守卫。
95
116
 
96
117
  **未验证范围**:macOS / Linux、`headless` 与 `tui` profile、以及上表之外的其他 DSH 版本均未实测。
97
118
 
@@ -99,6 +120,7 @@ major.minor.patch 且自身带预发布标签的比较符"。因此看起来很
99
120
  市场只读 `engines.dsh` / `dsh.engines.dsh` 以及 `@deepseek-ai/dsh*` 的 `peerDependencies`,并不读 `dsh.compatibility.dsh`。
100
121
  从 1.0.4 起宿主要求会真实出现在市场卡片上,并生效于安装前的校验:**范围之外的宿主上,市场会把本插件从列表中隐藏并拒绝安装/更新**
101
122
  (市场只隐藏"确认不兼容"的条目;"未声明"或"无法确认"的条目照常显示)。范围之外的宿主仍可自行用 `dsh plugin add` 安装,只是不再被市场担保。
123
+ `host-range-test.mjs` 会断言这两处字段逐字节一致。
102
124
 
103
125
  ## 发布(维护者)
104
126
 
package/lib/client.js CHANGED
@@ -541,7 +541,15 @@ window.__ModuleLoader__.load({
541
541
  })
542
542
 
543
543
  ctx.effect(() => slots.inject('settings.section', () => slots.register(
544
- { name: 'settings.section', id: 'instruction-memory', order: 26, label: '指令记忆' },
544
+ // `order` 1200 deliberately sits far above every official section
545
+ // (general 0, models 10, plugins 15, agent-presets 20, archived-
546
+ // sessions 25) and above the third-party ones in the wild (mnemon 20,
547
+ // pet 30, market 40, prompt-optimizer 90, better-sidebar 100,
548
+ // version-update 140). `settings.section` is a `list` slot, so a
549
+ // duplicate order does not throw — it silently makes the render order
550
+ // depend on registration timing. The previous value was 26, one above
551
+ // the official tail: a single new official section would have collided.
552
+ { name: 'settings.section', id: 'instruction-memory', order: 1200, label: '指令记忆' },
545
553
  () => h(InstructionPanel, null),
546
554
  )))
547
555
  }
package/lib/index.js CHANGED
@@ -36,7 +36,28 @@ const STORE_FILE_NAME = 'memory.json'
36
36
  /** Pre-release location, kept only so existing installs can migrate off it. */
37
37
  const LEGACY_FILE_NAME = '.dsh-instruction-memory.json'
38
38
  const SECTION_NAME = 'instruction-memory'
39
- const SECTION_ORDER = 900
39
+ /**
40
+ * Placement of the injected instruction block among the system prompt's
41
+ * ordered sections. Sections are concatenated ascending; equal orders fall
42
+ * back to code-unit name order, which is not something a plugin can reason
43
+ * about — so this value must not collide with a reserved slot.
44
+ *
45
+ * `@deepseek-ai/dsh-system-prompt` owns a central `SECTION_ORDERS` table
46
+ * (0.1.7-rc.2): HARNESS_IDENTITY -1000, DEPLOYMENT_PERSONA_PREFIX 0,
47
+ * PLAN_POLICY 500, TEAM_POLICY 600, PTC_ONLY 800, FILE_REFERENCE **900**,
48
+ * TOOL_BASH 1000, … STRUCTURED_OUTPUT 9900, HARNESS_SOURCE 10000,
49
+ * WEB_SURFACE 10100, DEPLOYMENT_PERSONA_SUFFIX 10200.
50
+ *
51
+ * This was 900 through 1.0.8 — an exact tie with FILE_REFERENCE. It never
52
+ * threw (a tie only degrades to dictionary order), and it happened to sort
53
+ * the way we wanted: `instruction-memory` > `file-reference` on code units
54
+ * ('i' 105 > 'f' 102), so the block landed just after the file references.
55
+ * That is an accident of the name, not a decision, and renaming the section
56
+ * would silently move it. 950 states the intent outright: in the gap between
57
+ * FILE_REFERENCE (900) and TOOL_BASH (1000) — after the file-reference block,
58
+ * before the tool descriptions, clear of every reserved value.
59
+ */
60
+ const SECTION_ORDER = 950
40
61
  const API_PREFIX = '/instruction-memory/api'
41
62
  /** Request body ceiling for the settings-page route; anything larger is rejected. */
42
63
  const MAX_BODY_CHARS = 1_000_000
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-instruction-memory",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "User-only instruction memory for DSH: long-term instructions maintained in the settings UI and auto-injected into every conversation — the model has no write access. 指令记忆:只由用户在设置页维护的长期指令,自动注入此后每轮对话;模型没有任何写入口。",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "author": "huangpeiyan",
54
54
  "scripts": {
55
- "test": "node smoke-test.mjs && node contract-test.mjs && node verify.mjs",
55
+ "test": "node host-range-test.mjs && node smoke-test.mjs && node contract-test.mjs && node verify.mjs",
56
56
  "prepublishOnly": "node check-metadata.mjs"
57
57
  },
58
58
  "dsh": {
@@ -61,16 +61,16 @@
61
61
  },
62
62
  "client": {
63
63
  "inject": [
64
- "@deepseek-ai/dsh-client-runtime",
65
- "@deepseek-ai/dsh-client-ui-slots"
64
+ "@deepseek-ai/dsh-client-ui-renderer",
65
+ "@deepseek-ai/dsh-client-ui-settings"
66
66
  ],
67
67
  "platform": "web"
68
68
  },
69
69
  "engines": {
70
- "dsh": ">=0.1.3-alpha.2 <0.1.4 || >=0.1.4-0 <0.1.5-0 || >=0.1.5-alpha.1"
70
+ "dsh": ">=0.1.3-alpha.2 <0.1.4 || >=0.1.4-0 <0.1.5-0 || >=0.1.5-alpha.1 <0.1.6-0 || >=0.1.6-alpha.0 <0.1.7-0 || >=0.1.7-alpha.0 <0.2.0-0 || >=0.2.0-0"
71
71
  },
72
72
  "compatibility": {
73
- "dsh": ">=0.1.3-alpha.2 <0.1.4 || >=0.1.4-0 <0.1.5-0 || >=0.1.5-alpha.1"
73
+ "dsh": ">=0.1.3-alpha.2 <0.1.4 || >=0.1.4-0 <0.1.5-0 || >=0.1.5-alpha.1 <0.1.6-0 || >=0.1.6-alpha.0 <0.1.7-0 || >=0.1.7-alpha.0 <0.2.0-0 || >=0.2.0-0"
74
74
  }
75
75
  }
76
76
  }