@magic6/dsh-compaction-policy-engine 0.5.13 → 0.5.14
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.en.md +17 -2
- package/README.md +31 -3
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -55,8 +55,11 @@ A model can override `threshold` while still inheriting `retain`, `maxTokens`,
|
|
|
55
55
|
window; `thresholdTokens` / `retainTokens` are absolute budgets. The plugin converts
|
|
56
56
|
exactly back into the parent engine's ratio (`(tokens + 0.5) / window`) and **refuses to
|
|
57
57
|
guess** when a route declares no window, naming the route in the error.
|
|
58
|
-
- **Live reload.** The engine polls `settings.yaml` and the
|
|
59
|
-
row every second; a policy edit applies to the next
|
|
58
|
+
- **Live reload (configuration, not code).** The engine polls `settings.yaml` and the
|
|
59
|
+
`compaction-control-settings` row every second; a **policy edit** applies to the next
|
|
60
|
+
compaction without restarting DSH. This covers configuration only: **upgrading the plugin
|
|
61
|
+
itself always requires a restart**, because loaded modules are never replaced
|
|
62
|
+
(see [Live reload scope](#live-reload-scope)).
|
|
60
63
|
The panel writes the same document. The engine mount row's own `config:` is read at load
|
|
61
64
|
(see [Install and mount](#install-and-mount)).
|
|
62
65
|
- **Partial settings document.** The `compaction-control:` section in `settings.yaml` is
|
|
@@ -86,6 +89,18 @@ Requirements: DSH `0.2.1-rc.x` / `0.2.2-rc.x`, Node.js 20+.
|
|
|
86
89
|
dsh plugin --profile web add @magic6/dsh-compaction-policy-engine
|
|
87
90
|
```
|
|
88
91
|
|
|
92
|
+
> ⚠️ **Restart DSH after installing or upgrading.**
|
|
93
|
+
>
|
|
94
|
+
> `dsh plugin add` only writes the package to disk; a running process does not reload modules
|
|
95
|
+
> (`dsh-app-boot`: *"Package contents and loaded modules are not reloaded."*). Until you
|
|
96
|
+
> restart, the settings panel already reports the new version while the old code is still
|
|
97
|
+
> executing — **the version string does not prove the plugin is live**. Upgrading from
|
|
98
|
+
> `< 0.5.10` is the worst case: that bundle shipped its engine `disabled: true`, so without a
|
|
99
|
+
> restart there is no compaction at all and the trigger stays at the official 80% default.
|
|
100
|
+
>
|
|
101
|
+
> Verify after restarting: with `DSH_COMPACT_DEBUG=1` the log should show `[compact-debug]`
|
|
102
|
+
> lines, and a successful compaction logs `[compaction] FIRED`.
|
|
103
|
+
|
|
89
104
|
The npm package includes `examples/standard-with-policy` for reference; the preset override
|
|
90
105
|
rules below still apply. The `$PWD` commands in the web section assume a source checkout.
|
|
91
106
|
|
package/README.md
CHANGED
|
@@ -49,9 +49,9 @@ models[] → providers{} → default
|
|
|
49
49
|
`thresholdTokens` / `retainTokens` 是绝对预算。换算写回父类时使用
|
|
50
50
|
`(tokens + 0.5) / window`,保证精确回到声明的数;路由没有声明窗口时**拒绝猜**,
|
|
51
51
|
在真正需要策略的那一步报错并点名路由。
|
|
52
|
-
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
- **热加载(配置,不含代码)。** 引擎每秒轮询 `settings.yaml` 与 `compaction-control-settings`
|
|
53
|
+
行;**策略修改**在下一次压缩生效,不需要重启。但这只覆盖配置:**升级插件版本必须重启
|
|
54
|
+
DSH**,已加载的模块不会被替换(见[热加载范围](#热加载范围))。
|
|
55
55
|
- **部分文档合并。** `settings.yaml` 的 `compaction-control:` 段与挂载行 `config:` **逐字段**
|
|
56
56
|
合并(映射递归、数组整体替换),面板保存不会悄悄抹掉 profile 里的 `models[]` 层。
|
|
57
57
|
- **设置面板。** 编辑全局层或某个供应商层,切换单位时不留下两个键,空隙过小时给出红字提示;
|
|
@@ -75,6 +75,17 @@ models[] → providers{} → default
|
|
|
75
75
|
dsh plugin --profile web add @magic6/dsh-compaction-policy-engine
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
+
> ⚠️ **装完 / 升级完,必须重启 DSH 才会生效。**
|
|
79
|
+
>
|
|
80
|
+
> `dsh plugin add` 只把包写到磁盘;正在运行的进程不会重新加载模块
|
|
81
|
+
> (`dsh-app-boot`:*"Package contents and loaded modules are not reloaded."*)。
|
|
82
|
+
> 重启之前,设置页显示的版本号已经是新的,但跑的仍是旧代码——**版本号不能用来判断是否生效**。
|
|
83
|
+
> 从 `< 0.5.10` 升级尤其明显:旧 bundle 的引擎是 `disabled: true`,不重启就等于没有压缩,
|
|
84
|
+
> 触发点还停在官方默认的 80%。
|
|
85
|
+
>
|
|
86
|
+
> 重启后确认:`DSH_COMPACT_DEBUG=1` 下日志里应出现 `[compact-debug]` 行,压缩成功时出现
|
|
87
|
+
> `[compaction] FIRED`。
|
|
88
|
+
|
|
78
89
|
npm 包里包含 `examples/standard-with-policy` 供参考;下面的 preset 覆盖规则仍然适用。
|
|
79
90
|
web 小节里的 `$PWD` 命令假设使用源码检出。
|
|
80
91
|
|
|
@@ -175,6 +186,23 @@ dsh plugin --profile web add "$PWD/examples/standard-with-policy"
|
|
|
175
186
|
行,所以面板修改和这一行的修改会在下一次压缩生效,不需要重启。**引擎挂载行**
|
|
176
187
|
(`compaction-control`)的 `config:` 在插件加载时读取,改它需要重启。
|
|
177
188
|
|
|
189
|
+
> ⚠️ **升级插件本身必须重启 DSH。**
|
|
190
|
+
>
|
|
191
|
+
> 热加载只覆盖配置文档,**不覆盖代码**。DSH 的加载器把已安装的模块留在进程里:
|
|
192
|
+
> `dsh-app-boot` 的 `refresh()` 原文是 *"Package contents and loaded modules are not
|
|
193
|
+
> reloaded."*,设置豁免的路径也写着 *"Existing plugin instances are not reloaded by
|
|
194
|
+
> this operation."*。所以 `dsh plugin add <包>@<新版本>` 之后:
|
|
195
|
+
>
|
|
196
|
+
> - 磁盘上的版本号已经是新的(设置页、`package.json` 都会显示新版本),
|
|
197
|
+
> - 但**正在运行的进程里仍是旧代码**,压缩走的是旧逻辑。
|
|
198
|
+
>
|
|
199
|
+
> 这种错配特别难看出来,因为版本号是对的。判断依据只能是行为:重启后看日志里有没有
|
|
200
|
+
> `[compact-debug]` 行(需要 `DSH_COMPACT_DEBUG=1`)与 `[compaction] FIRED`。
|
|
201
|
+
>
|
|
202
|
+
> 具体到本插件,`< 0.5.10` 的 bundle 带着 `disabled: true`,升级后不重启会**继续没有
|
|
203
|
+
> 压缩**,而且触发的仍是官方引擎的 80% 默认值——看起来像"新版本没生效",实际是旧代码
|
|
204
|
+
> 还在跑。
|
|
205
|
+
|
|
178
206
|
### 阈值语义
|
|
179
207
|
|
|
180
208
|
官方引擎的触发点是
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magic6/dsh-compaction-policy-engine",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.14",
|
|
4
4
|
"description": "Layered, live-reloading context compaction policy for DeepSeek Harness: provider-level rules, field-by-field inheritance, ratio/token units and a settings panel on top of the official engine.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/companion.js",
|