dsh-live-compact 1.1.10 → 1.1.12
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/CHANGELOG.md +24 -0
- package/README.md +8 -8
- package/client.js +32 -13
- package/cordis.patch.yml +1 -0
- package/gate.js +55 -5
- package/index.js +716 -204
- package/package.json +2 -2
- package/plan.js +8 -3
- package/raw.js +2 -2
- package/settings.js +2 -2
- package/shadow.js +220 -15
- package/shell.js +57 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# 版本变更
|
|
2
2
|
|
|
3
|
+
## 1.1.12
|
|
4
|
+
|
|
5
|
+
- **#62 Worker 启动与游标修复**:用 eval import 引导 shadow worker,保留宿主原生启动参数;`already-pruned` 结果标为不可恢复并推进 capture cursor,后续事件继续捕获。
|
|
6
|
+
- **维护活性修复**:pre-step 等待增加 3 秒截止;维护超时只 abort 当前 job 并放行 provider 请求,保留 owner/warming barrier 到旧 job settle,避免晚到 cleanup 清掉新 job;catch-up 跨下一轮或让位时不再永久留下 `warming/pendingMaintenance`。
|
|
7
|
+
- **#60 候选回退**:普通候选的 pointer、范围、扩展和失败工具出口都能回试长读候选,长读失败才回普通候选。
|
|
8
|
+
- **#50 catalog 加载**:优先用 ESM import 加载 pi-ai provider catalog,结果缓存,CJS 加载仅作兼容回退。
|
|
9
|
+
- **preset 选择与桌面 bundle 兼容**:`takeoverPresets` 支持 preset ID 白名单;根域替换只识别官方模块名,不误伤第三方同名条目;late bundle 重新挂载官方引擎时先释放旧 root service。
|
|
10
|
+
- **可观测性**:已有 shadow 目录会追加 `spine-decisions.jsonl`,记录 engine、让位/冷却、无合法切段、cut 成功/失败、官方摘要和 pre-step 超时原因。
|
|
11
|
+
- **跨会话维护与门禁**:pending capture flush 按当前 session 收敛,避免一个会话的补扫拖住另一个会话;`test:gate` 现在实际执行 `test/turn-end-bridge.mjs` 与 `test/v107.mjs`,并补充跨会话等待回归。
|
|
12
|
+
- **状态机与首轮路由加固**:复用中的 catch-up 合并维护请求;blocked/retry 超限先恢复可见 raw;turn-stopping 任务纳入维护 barrier,并跳过同一完成边界的第二次 turn/end;首次 provider catalog 未就绪前不会误判为 local。Windows Worker 空闲缓存延长到 60 秒,统计锁可恢复明确死亡 PID。
|
|
13
|
+
- **worker 与决策日志生命周期**:无 pending 写入时解除空闲 shadow worker 的事件循环引用;`spine-decisions.jsonl` 通过 shadow root 事务追加并计入容量快照,避免轮换竞态和快路径漏计。
|
|
14
|
+
- **维护 retry fencing**:turn-stopping owner 活跃时,blocked/retry catch-up 和暂时缺失完成边界都只排队到 owner 之后,不清掉 barrier、不覆盖 abort controller,也不启动重叠维护。
|
|
15
|
+
- **shadow 目标保护**:stats 锁创建后的写入/fsync 失败会清理本次锁;死 PID 恢复用 recovery lock 二次确认;决策日志拒绝 symlink、hardlink 和非普通文件目标。
|
|
16
|
+
- **worker 生命周期**:空闲 worker 解除引用,复用时先重新引用,保证 one-shot 宿主也能完成下一次 shadow 写入。
|
|
17
|
+
- **宿主注册与 preset 选择**:异步释放迟到的官方 stock service 时先安全脱离 root/fiber store,再构造 replacement;孤立 compaction group 继承外层 preset ID,数组 allowlist 可按文档生效;retry cleanup 只清理自己安装的 job/controller。
|
|
18
|
+
- **回归**:补充已剪游标推进、Worker 启动、维护状态、同轮去重、preset 白名单、长失败诊断、真实 #61 硬事实预算和决策日志测试。
|
|
19
|
+
|
|
20
|
+
## 1.1.11
|
|
21
|
+
|
|
22
|
+
- **Windows 桌面版小切修复(#62)**:shadow-save worker 过滤宿主继承的 `--input-type=module`,避免 DSH Tauri 的 `ERR_INPUT_TYPE_NOT_ALLOWED`;`already-pruned` 捕获结果保留 retryable,`captureBlocked` 会安排轮后维护重试并保持生命周期等待屏障。
|
|
23
|
+
- **候选回退修复(#60)**:普通候选的卡片校验失败后会回试长读候选,避免一条不可保留的决策行放弃整刀。
|
|
24
|
+
- **工具事实预算修复(#61)**:硬事实只放入工具前缀一次,不再在正文重复计入 `TOOL_BUDGET`。
|
|
25
|
+
- **回归门禁**:新增 #60/#61/#62 定向测试,并将 turn-end bridge 一并纳入完整 gate;发布前完整 gate 577/577、Cordis 4.1 兼容门禁 22/22 通过。
|
|
26
|
+
|
|
3
27
|
## 1.1.10
|
|
4
28
|
|
|
5
29
|
- **billion-context 兼容保持**:保留对方接管官方压缩时的让位边界。
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
完整数据、原始口径和限制见 [docs/benchmarks.md](docs/benchmarks.md),结构化数字见 [docs/benchmark-results.json](docs/benchmark-results.json)。
|
|
10
10
|
|
|
11
11
|
- **1.0.5 失忆对比**:同一真实 DeepSeek 会话,15 道回忆题两边都是 15/15;Live Compact 的日志中段细节两次都是 3/3,原版一次 1/3、一次 3/3。
|
|
12
|
-
- **历史 DSH 长链路**:早期 150 道短题和 20 道 WebUniverse 连续任务都保留了原版/Live Compact 对照表;它们是历史实测,不是 1.1.
|
|
12
|
+
- **历史 DSH 长链路**:早期 150 道短题和 20 道 WebUniverse 连续任务都保留了原版/Live Compact 对照表;它们是历史实测,不是 1.1.12 的新验收。
|
|
13
13
|
- **OpenCode 移植参考**:独立项目 [opencode-live-compact](https://github.com/Haoming9527/opencode-live-compact) 把插件移植到 OpenCode,和 OpenCode 自带的 autocompact 做了对照:在 OpenCode 2.2.6 + GPT-6 Luna 上跑 Aider 150 和 Web-Bench React 20,任务分别 150/150、20/20 且最终浏览器测试 59/59;估算费用分别低 14.3% 和 42.1%。这是 OpenCode 项目的结果,用来说明移植后的可复核测评方法,不冒充 DSH 运行结果。
|
|
14
14
|
|
|
15
15
|

|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
headless:
|
|
32
32
|
|
|
33
33
|
```sh
|
|
34
|
-
dsh plugin --profile headless add dsh-live-compact@1.1.
|
|
34
|
+
dsh plugin --profile headless add dsh-live-compact@1.1.12
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
网页端:
|
|
38
38
|
|
|
39
39
|
```sh
|
|
40
|
-
dsh plugin --profile web add dsh-live-compact@1.1.
|
|
40
|
+
dsh plugin --profile web add dsh-live-compact@1.1.12
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
想先装到本机看版本:
|
|
@@ -189,8 +189,8 @@ Windows 会重新设置备份访问权限,失败时停止写备份并保留原
|
|
|
189
189
|
从 npm 装。headless 和网页是两个 profile,要各装一次。桌面端是另一个 profile,普通 `dsh plugin --profile desktop` 会被拒绝。
|
|
190
190
|
|
|
191
191
|
```sh
|
|
192
|
-
dsh plugin --profile headless add dsh-live-compact@1.1.
|
|
193
|
-
dsh plugin --profile web add dsh-live-compact@1.1.
|
|
192
|
+
dsh plugin --profile headless add dsh-live-compact@1.1.12
|
|
193
|
+
dsh plugin --profile web add dsh-live-compact@1.1.12
|
|
194
194
|
```
|
|
195
195
|
|
|
196
196
|
想先装到本机看版本:
|
|
@@ -203,9 +203,9 @@ dsh-live-compact --version
|
|
|
203
203
|
上不了 npm 时的镜像安装命令:
|
|
204
204
|
|
|
205
205
|
```sh
|
|
206
|
-
dsh plugin --profile headless add https://download.merkyorlynn.com/downloads/plugins/dsh-live-compact-1.1.
|
|
207
|
-
dsh plugin --profile web add https://download.merkyorlynn.com/downloads/plugins/dsh-live-compact-1.1.
|
|
208
|
-
npm install -g --force "https://download.merkyorlynn.com/downloads/plugins/dsh-live-compact-1.1.
|
|
206
|
+
dsh plugin --profile headless add https://download.merkyorlynn.com/downloads/plugins/dsh-live-compact-1.1.12.tgz
|
|
207
|
+
dsh plugin --profile web add https://download.merkyorlynn.com/downloads/plugins/dsh-live-compact-1.1.12.tgz
|
|
208
|
+
npm install -g --force "https://download.merkyorlynn.com/downloads/plugins/dsh-live-compact-1.1.12.tgz"
|
|
209
209
|
dsh-live-compact --version
|
|
210
210
|
```
|
|
211
211
|
|
package/client.js
CHANGED
|
@@ -3,7 +3,7 @@ window.__ModuleLoader__.load({
|
|
|
3
3
|
factory(require) {
|
|
4
4
|
/** 全走宿主原生接口的设置界面。 */
|
|
5
5
|
const React = require("react");
|
|
6
|
-
const { SettingsFormModel, settingsNumberField, SettingsForm, SettingsValueField
|
|
6
|
+
const { SettingsFormModel, settingsNumberField, SettingsForm, SettingsValueField } = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
7
7
|
const h = React.createElement;
|
|
8
8
|
|
|
9
9
|
const NS = "compaction-spine";
|
|
@@ -20,8 +20,20 @@ window.__ModuleLoader__.load({
|
|
|
20
20
|
const KEYS = GROUPS.flatMap((group) => group.keys);
|
|
21
21
|
const PRESET_FIELD = {
|
|
22
22
|
field: "takeoverPresets",
|
|
23
|
-
format: (value) => String(value),
|
|
24
|
-
parse: (text) =>
|
|
23
|
+
format: (value) => Array.isArray(value) ? JSON.stringify(value) : String(value),
|
|
24
|
+
parse: (text) => {
|
|
25
|
+
const raw = String(text ?? "").trim();
|
|
26
|
+
if (raw === "true" || raw === "false") return { kind: "set", value: raw === "true" };
|
|
27
|
+
if (raw.startsWith("[")) {
|
|
28
|
+
try {
|
|
29
|
+
const value = JSON.parse(raw);
|
|
30
|
+
if (Array.isArray(value) && value.every((id) => typeof id === "string" && id.length > 0)) {
|
|
31
|
+
return { kind: "set", value };
|
|
32
|
+
}
|
|
33
|
+
} catch {}
|
|
34
|
+
}
|
|
35
|
+
return { kind: "set", value: raw };
|
|
36
|
+
},
|
|
25
37
|
};
|
|
26
38
|
const LABELS = {
|
|
27
39
|
minTokens: ["起切 token 数", "默认 20000"],
|
|
@@ -40,7 +52,8 @@ window.__ModuleLoader__.load({
|
|
|
40
52
|
|
|
41
53
|
const zh = {
|
|
42
54
|
takeoverPresets: "接管官方预设",
|
|
43
|
-
takeoverHint: "
|
|
55
|
+
takeoverHint: "填 true/false,或填 JSON 数组(例如 [\"standard\"])限制接管的预设。保存后仅影响新加载的预设;已有会话需重建。",
|
|
56
|
+
takeoverArrayHint: "JSON 数组:只接管列出的 preset ID;也可填 true 或 false。",
|
|
44
57
|
summary: "20000 起切、3 轮留原文、650000 停",
|
|
45
58
|
basic: "常用",
|
|
46
59
|
advanced: "高级设置",
|
|
@@ -55,7 +68,8 @@ window.__ModuleLoader__.load({
|
|
|
55
68
|
};
|
|
56
69
|
const en = {
|
|
57
70
|
takeoverPresets: "Take over official presets",
|
|
58
|
-
takeoverHint: "
|
|
71
|
+
takeoverHint: "Enter true/false, or a JSON array such as [\"standard\"] to limit takeover. Applies to newly loaded presets after saving; recreate existing sessions.",
|
|
72
|
+
takeoverArrayHint: "JSON array: only the listed preset IDs are taken over; true and false are also accepted.",
|
|
59
73
|
summary: "cuts at 20000, keeps 3 rounds, stops at 650000",
|
|
60
74
|
basic: "Common",
|
|
61
75
|
advanced: "Advanced",
|
|
@@ -103,14 +117,19 @@ window.__ModuleLoader__.load({
|
|
|
103
117
|
onDiscard: props.discard,
|
|
104
118
|
},
|
|
105
119
|
h("h4", null, t("basic")),
|
|
106
|
-
h(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
120
|
+
h(SettingsValueField, {
|
|
121
|
+
id: "live-compact-takeoverPresets",
|
|
122
|
+
label: t("takeoverPresets"),
|
|
123
|
+
hint: t("takeoverArrayHint"),
|
|
124
|
+
numeric: false,
|
|
125
|
+
disabled: !state.writable || state.saving,
|
|
126
|
+
overriddenLabel: t("overridden"),
|
|
127
|
+
resetLabel: t("reset"),
|
|
128
|
+
invalidLabel: t("invalid"),
|
|
129
|
+
...state.takeoverPresets,
|
|
130
|
+
onEdit: (text) => props.edit("takeoverPresets", text),
|
|
131
|
+
onReset: () => props.resetField("takeoverPresets"),
|
|
132
|
+
}),
|
|
114
133
|
h("p", null, t("takeoverHint")),
|
|
115
134
|
section(GROUPS[0]),
|
|
116
135
|
h("details", null,
|
package/cordis.patch.yml
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# The entry installs its preset listener before constructing the engine.
|
|
3
3
|
# takeoverPresets controls future preset loads, not existing session engines.
|
|
4
4
|
- id: compaction-basic
|
|
5
|
+
name: '@deepseek-ai/dsh-compaction-basic'
|
|
5
6
|
disabled: true
|
|
6
7
|
- insert:
|
|
7
8
|
- id: compaction-spine
|
package/gate.js
CHANGED
|
@@ -80,6 +80,52 @@ function isPreset(node) {
|
|
|
80
80
|
return Boolean(node.config && typeof node.config === "object" && !Array.isArray(node.config) && PRESET_IDS.has(node.config.id));
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
function takeoverSelected(config, entry, selector) {
|
|
84
|
+
if (typeof selector === "boolean") return selector;
|
|
85
|
+
if (!Array.isArray(selector)) return Boolean(selector);
|
|
86
|
+
const ids = [
|
|
87
|
+
config?.id,
|
|
88
|
+
config?.config?.id,
|
|
89
|
+
entry?.id,
|
|
90
|
+
entry?.presetId,
|
|
91
|
+
...(Array.isArray(entry?.presetIds) ? entry.presetIds : []),
|
|
92
|
+
entry?.options?.id,
|
|
93
|
+
].filter((id) => typeof id === "string");
|
|
94
|
+
return ids.some((id) => selector.includes(id));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function outerPresetIds(fiber) {
|
|
98
|
+
const seen = new Set();
|
|
99
|
+
const queue = [];
|
|
100
|
+
const found = [];
|
|
101
|
+
const push = (value) => {
|
|
102
|
+
if (value && (typeof value === "object" || typeof value === "function") && !seen.has(value)) queue.push(value);
|
|
103
|
+
};
|
|
104
|
+
try { push(fiber?.parent); } catch {}
|
|
105
|
+
try { push(fiber?.fiber?.parent); } catch {}
|
|
106
|
+
while (queue.length) {
|
|
107
|
+
const current = queue.shift();
|
|
108
|
+
if (seen.has(current)) continue;
|
|
109
|
+
seen.add(current);
|
|
110
|
+
let ids = [];
|
|
111
|
+
try {
|
|
112
|
+
ids = [
|
|
113
|
+
current?.entry?.options?.id,
|
|
114
|
+
current?.fiber?.entry?.options?.id,
|
|
115
|
+
current?.config?.id,
|
|
116
|
+
current?.id,
|
|
117
|
+
];
|
|
118
|
+
} catch {}
|
|
119
|
+
const candidate = ids.find((id) => typeof id === "string" && id.length > 0);
|
|
120
|
+
if (candidate && !found.includes(candidate)) found.push(candidate);
|
|
121
|
+
try { push(current.parent); } catch {}
|
|
122
|
+
try { push(current.fiber); } catch {}
|
|
123
|
+
try { push(current.parent?.fiber); } catch {}
|
|
124
|
+
try { push(current.fiber?.parent); } catch {}
|
|
125
|
+
}
|
|
126
|
+
return found;
|
|
127
|
+
}
|
|
128
|
+
|
|
83
129
|
function withEngineConfig(entry, rootConfig) {
|
|
84
130
|
const previous = entry.config && typeof entry.config === "object" && !Array.isArray(entry.config) ? configSnapshot(entry.config) : {};
|
|
85
131
|
const { takeoverPresets: _takeover, ...root } = configSnapshot(rootConfig);
|
|
@@ -114,9 +160,9 @@ function rewriteNode(node, loadable, rootConfig) {
|
|
|
114
160
|
return next;
|
|
115
161
|
}
|
|
116
162
|
|
|
117
|
-
export function rewritePresetConfig(config, loadable = packageLoadable(), rootConfig = {}, entry) {
|
|
163
|
+
export function rewritePresetConfig(config, loadable = packageLoadable(), rootConfig = {}, entry, selector = true) {
|
|
118
164
|
const group = Array.isArray(config) && entry?.group === true && entry.isolate?.compaction === true;
|
|
119
|
-
if (!isPreset(config) && !group) return config;
|
|
165
|
+
if (!takeoverSelected(config, entry, selector) || (!isPreset(config) && !group)) return config;
|
|
120
166
|
return rewriteNode(config, loadable, rootConfig);
|
|
121
167
|
}
|
|
122
168
|
|
|
@@ -160,7 +206,7 @@ export function installPresetGate(ctx, config = {}, { legacy = false } = {}) {
|
|
|
160
206
|
ctx.effect(() => () => { gate.active = false; });
|
|
161
207
|
const enabled = () => {
|
|
162
208
|
const value = config.takeoverPresets ?? true;
|
|
163
|
-
return typeof value === "boolean" ? value : value.get();
|
|
209
|
+
return typeof value === "boolean" || Array.isArray(value) ? value : value.get();
|
|
164
210
|
};
|
|
165
211
|
const seen = new Set();
|
|
166
212
|
gate.disposeListener = ctx.on("internal/config", function (fiber, next) {
|
|
@@ -169,10 +215,14 @@ export function installPresetGate(ctx, config = {}, { legacy = false } = {}) {
|
|
|
169
215
|
warnCompactionStandDown(ctx);
|
|
170
216
|
return resolved;
|
|
171
217
|
}
|
|
172
|
-
if (!gate.active
|
|
218
|
+
if (!gate.active) return resolved;
|
|
219
|
+
const selector = enabled();
|
|
220
|
+
if (!selector || (Array.isArray(selector) && selector.length === 0)) return resolved;
|
|
173
221
|
const loadable = packageLoadable();
|
|
174
222
|
const entry = fiber?.entry?.options;
|
|
175
|
-
const
|
|
223
|
+
const presetIds = outerPresetIds(fiber);
|
|
224
|
+
const selectedEntry = presetIds.length ? { ...entry, presetId: presetIds[0], presetIds } : entry;
|
|
225
|
+
const rewritten = rewritePresetConfig(resolved, loadable, config, selectedEntry, selector);
|
|
176
226
|
const id = rewritten?.id || rewritten?.config?.id || entry?.id;
|
|
177
227
|
if (rewritten !== resolved && id && !seen.has(String(id))) {
|
|
178
228
|
seen.add(String(id));
|