dsh-context-compression-improved 0.2.3 → 0.2.5

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 (149) hide show
  1. package/.gitattributes +2 -1
  2. package/.githooks/pre-push +37 -0
  3. package/.github/workflows/ci.yml +39 -39
  4. package/CHANGELOG.ja.md +169 -39
  5. package/CHANGELOG.ko.md +167 -39
  6. package/CHANGELOG.md +333 -135
  7. package/CHANGELOG.zh.md +152 -39
  8. package/CONTRIBUTING.md +22 -22
  9. package/README.ja.md +85 -104
  10. package/README.ko.md +85 -103
  11. package/README.md +94 -112
  12. package/README.zh.md +85 -101
  13. package/THIRD_PARTY_NOTICES.md +14 -14
  14. package/docs/compat-0.1.5-report.md +77 -0
  15. package/docs/installation.ja.md +78 -76
  16. package/docs/installation.ko.md +78 -76
  17. package/docs/installation.md +103 -76
  18. package/docs/installation.zh.md +100 -76
  19. package/docs/repair-log.md +657 -582
  20. package/eslint.config.js +30 -30
  21. package/package.json +163 -142
  22. package/packages/selector/README.md +26 -31
  23. package/packages/selector/README.zh.md +24 -31
  24. package/packages/selector/THIRD_PARTY_NOTICES.md +32 -38
  25. package/packages/selector/cordis.patch.yml +27 -19
  26. package/packages/selector/dsh.plugin.json +2 -2
  27. package/packages/selector/lib/client.d.ts +320 -228
  28. package/packages/selector/lib/client.js +3254 -1462
  29. package/packages/selector/lib/config.js +1713 -842
  30. package/packages/selector/lib/index.d.ts +46 -38
  31. package/packages/selector/lib/index.js +1099 -645
  32. package/packages/selector/lib/invariant.js +70 -70
  33. package/packages/selector/lib/pruner.d.ts +904 -684
  34. package/packages/selector/lib/pruner.js +5800 -3807
  35. package/packages/selector/lib/style.css +88 -46
  36. package/packages/selector/lib/tail-trim.js +145 -136
  37. package/packages/selector/package.json +18 -19
  38. package/packages/selector/screenshots.json +3 -6
  39. package/packages/selector/src/client/CompressionProfileControls.tsx +293 -229
  40. package/packages/selector/src/client/CompressionProfileSelector.module.css +199 -170
  41. package/packages/selector/src/client/CompressionProfileSelector.tsx +85 -79
  42. package/packages/selector/src/client/EstimatorControls.tsx +277 -281
  43. package/packages/selector/src/client/decode.ts +57 -49
  44. package/packages/selector/src/client/index.ts +249 -111
  45. package/packages/selector/src/client/locales/de.ts +141 -0
  46. package/packages/selector/src/client/locales/es.ts +141 -0
  47. package/packages/selector/src/client/locales/fr.ts +141 -0
  48. package/packages/selector/src/client/locales/it.ts +141 -0
  49. package/packages/selector/src/client/locales/ja.ts +141 -0
  50. package/packages/selector/src/client/locales/ko.ts +141 -0
  51. package/packages/selector/src/client/locales/ru.ts +141 -0
  52. package/packages/selector/src/client/locales.ts +282 -198
  53. package/packages/selector/src/client/monitor-fab.ts +336 -0
  54. package/packages/selector/src/client/preset-options.ts +88 -70
  55. package/packages/selector/src/client/savings-card.tsx +150 -0
  56. package/packages/selector/src/client/settings-section.tsx +140 -126
  57. package/packages/selector/src/deepseek-v4-tokenizer.ts +205 -210
  58. package/packages/selector/src/index.ts +671 -327
  59. package/packages/selector/src/invariant.ts +113 -113
  60. package/packages/selector/src/preset-overlay.ts +60 -1
  61. package/packages/selector/src/profiles.ts +431 -342
  62. package/packages/selector/src/pruner/content.ts +18 -5
  63. package/packages/selector/src/pruner/state.ts +57 -43
  64. package/packages/selector/src/pruner/types.ts +23 -5
  65. package/packages/selector/src/pruner.ts +2736 -2144
  66. package/packages/selector/src/runtime/adaptive-cost.ts +23 -12
  67. package/packages/selector/src/runtime/audit.ts +303 -215
  68. package/packages/selector/src/runtime/config.ts +756 -613
  69. package/packages/selector/src/runtime/measurement.ts +436 -403
  70. package/packages/selector/src/runtime/monitor.ts +235 -0
  71. package/packages/selector/src/runtime/reducers.ts +1115 -97
  72. package/packages/selector/src/runtime/retrieve.ts +479 -457
  73. package/packages/selector/src/runtime/savings.ts +337 -0
  74. package/packages/selector/src/runtime/session-events.ts +30 -17
  75. package/packages/selector/src/runtime/summary-command.ts +127 -0
  76. package/packages/selector/src/runtime/tail-trim.ts +166 -166
  77. package/packages/selector/src/runtime/tokenpilot/advisor-prompt.ts +233 -0
  78. package/packages/selector/src/runtime/tokenpilot/advisor-state.ts +204 -0
  79. package/packages/selector/src/runtime/tokenpilot/advisor.ts +419 -0
  80. package/packages/selector/src/runtime/tokenpilot/benefit.ts +200 -0
  81. package/packages/selector/src/runtime/tokenpilot/dedup.ts +1 -1
  82. package/packages/selector/src/runtime/tokenpilot/estimator.ts +151 -183
  83. package/packages/selector/src/runtime/tokenpilot/intent-fold.ts +53 -0
  84. package/packages/selector/src/runtime/tokenpilot/intent-gate.ts +65 -0
  85. package/packages/selector/src/runtime/tokenpilot/intent-input-mask.ts +125 -0
  86. package/packages/selector/src/runtime/tokenpilot/intent-range.ts +37 -0
  87. package/packages/selector/src/runtime/tokenpilot/locator.ts +1 -1
  88. package/packages/selector/src/runtime/tokenpilot/read-state.ts +23 -2
  89. package/packages/selector/src/runtime/tokenpilot/sidechannel.ts +303 -0
  90. package/packages/selector/src/runtime/toolclass.ts +103 -0
  91. package/packages/selector/src/runtime/types.ts +365 -309
  92. package/packages/selector/tests/advisor-report.host.spec.ts +223 -0
  93. package/packages/selector/tests/auto-compact.client.spec.tsx +214 -226
  94. package/packages/selector/tests/built/client-artifact.spec.ts +59 -51
  95. package/packages/selector/tests/code-skeleton.client.spec.ts +91 -88
  96. package/packages/selector/tests/custom-contract.client.spec.ts +205 -202
  97. package/packages/selector/tests/estimator-channel.client.spec.tsx +253 -247
  98. package/packages/selector/tests/estimator-route-registration.host.spec.ts +194 -176
  99. package/packages/selector/tests/host-preset-overlay.host.spec.ts +206 -204
  100. package/packages/selector/tests/monitor-fab.client.spec.ts +138 -0
  101. package/packages/selector/tests/preset-options-write.client.spec.ts +207 -181
  102. package/packages/selector/tests/preset-overlay-loader.e2e.host.spec.ts +201 -196
  103. package/packages/selector/tests/preset-overlay.host.spec.ts +246 -243
  104. package/packages/selector/tests/profiles.client.spec.tsx +436 -434
  105. package/packages/selector/tests/public/package-contract.client.spec.ts +78 -33
  106. package/packages/selector/tests/runtime/adaptive-cost.spec.ts +7 -7
  107. package/packages/selector/tests/runtime/advice-never-withholds.host.spec.ts +232 -0
  108. package/packages/selector/tests/runtime/advisor-invariant.spec.ts +272 -0
  109. package/packages/selector/tests/runtime/advisor.spec.ts +226 -0
  110. package/packages/selector/tests/runtime/audit.spec.ts +275 -129
  111. package/packages/selector/tests/runtime/char-basis.spec.ts +30 -0
  112. package/packages/selector/tests/runtime/code-skeleton.spec.ts +14 -3
  113. package/packages/selector/tests/runtime/deprecated-preset-options.spec.ts +96 -0
  114. package/packages/selector/tests/runtime/frequency-longstrings.spec.ts +74 -0
  115. package/packages/selector/tests/runtime/html-reducer.spec.ts +212 -0
  116. package/packages/selector/tests/runtime/intent-gate.spec.ts +62 -0
  117. package/packages/selector/tests/runtime/intent-summary.spec.ts +156 -0
  118. package/packages/selector/tests/runtime/line-mapping.spec.ts +153 -0
  119. package/packages/selector/tests/runtime/monitor.spec.ts +301 -0
  120. package/packages/selector/tests/runtime/prose-reducers.spec.ts +133 -0
  121. package/packages/selector/tests/runtime/public/public-runtime.spec.ts +2724 -2531
  122. package/packages/selector/tests/runtime/read-input-cap.spec.ts +33 -0
  123. package/packages/selector/tests/runtime/savings.spec.ts +120 -0
  124. package/packages/selector/tests/runtime/search-reducer.spec.ts +110 -0
  125. package/packages/selector/tests/runtime/session-events.spec.ts +27 -27
  126. package/packages/selector/tests/runtime/sidechannel.spec.ts +241 -0
  127. package/packages/selector/tests/runtime/summary-command.spec.ts +154 -0
  128. package/packages/selector/tests/runtime/toc-and-bundled.spec.ts +159 -0
  129. package/packages/selector/tests/runtime/tokenpilot/benefit.spec.ts +217 -0
  130. package/packages/selector/tests/runtime/tokenpilot/estimator.spec.ts +79 -56
  131. package/packages/selector/tests/runtime/tokenpilot/profile-baseline.spec.ts +116 -100
  132. package/packages/selector/tests/runtime/tokenpilot/read-state.spec.ts +24 -0
  133. package/packages/selector/tests/runtime/toolclass.spec.ts +156 -0
  134. package/packages/selector/tests/settings-seat.client.spec.ts +130 -0
  135. package/packages/selector/tests/standing-generation.host.spec.ts +697 -631
  136. package/packages/selector/tests/subagent-cache-reuse.host.spec.ts +253 -250
  137. package/pnpm-workspace.yaml +66 -19
  138. package/scripts/capture-profile-baseline.mjs +42 -0
  139. package/scripts/generate-tokenizer-fixtures.py +81 -81
  140. package/scripts/generate-vision-fixtures.py +208 -208
  141. package/scripts/{packed-components-smoke.ts → packed-components-smoke.mjs} +732 -713
  142. package/scripts/{packed-install-e2e.ts → packed-install-e2e.mjs} +1273 -1072
  143. package/scripts/toolclass-corpus-replay.mjs +281 -0
  144. package/scripts/{verify-release.ts → verify-release.mjs} +318 -300
  145. package/tests/TEST_INVENTORY.md +41 -42
  146. package/scripts/capture-profile-baseline.ts +0 -80
  147. package/tsconfig.scripts.json +0 -13
  148. /package/{packages/selector/assets/screenshots → docs/assets}/context-compression-selector-profiles.jpg +0 -0
  149. /package/{packages/selector/assets/screenshots → docs/assets}/context-compression-selector-settings.png +0 -0
@@ -1,14 +1,14 @@
1
- # Third-party notices
2
-
3
- This community project contains code adapted from the MIT-licensed [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness), verified against tag `dsh-v0.1.1-rc.2`, commit `b150a551b8d465e31e418e1b2eaf5e79bbb7d28e`.
4
-
5
- The runtime package distributes tokenizer assets from these pinned official repositories, both under the MIT license:
6
-
7
- - [deepseek-ai/DeepSeek-V4-Pro](https://huggingface.co/deepseek-ai/DeepSeek-V4-Pro) at revision `0e1a0e5e52aea73055f50fef6f2423db370265b6`, recorded in `packages/runtime/assets/deepseek-v4/manifest.json`.
8
- - [deepseek-ai/DeepSeek-V4-Flash-Vision-Exp](https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash-Vision-Exp) at revision `6821d6ad3681a4b137b066b76094fa82ebd0a380`, recorded in `packages/runtime/assets/deepseek-v4-vision-exp/manifest.json`. The vision model is served by this distinct tokenizer, never as an alias of the text tokenizer.
9
-
10
- Exact file sizes and SHA-256 values are recorded in each directory's `manifest.json`; the upstream license text ships beside the assets.
11
-
12
- The install-time production dependency closure also contains `@huggingface/tokenizers` (Apache-2.0), `js-yaml` (MIT), and its `argparse` dependency (Python-2.0). Each dependency ships its own license text in its NPM package.
13
-
14
- The names DeepSeek and DeepSeek Harness identify upstream projects only. They do not imply affiliation or endorsement.
1
+ # Third-party notices
2
+
3
+ This community project contains code adapted from the MIT-licensed [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness), verified against tag `dsh-v0.1.1-rc.2`, commit `b150a551b8d465e31e418e1b2eaf5e79bbb7d28e`.
4
+
5
+ The runtime package distributes tokenizer assets from these pinned official repositories, both under the MIT license:
6
+
7
+ - [deepseek-ai/DeepSeek-V4-Pro](https://huggingface.co/deepseek-ai/DeepSeek-V4-Pro) at revision `0e1a0e5e52aea73055f50fef6f2423db370265b6`, recorded in `packages/selector/assets/deepseek-v4/manifest.json`.
8
+ - [deepseek-ai/DeepSeek-V4-Flash-Vision-Exp](https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash-Vision-Exp) at revision `6821d6ad3681a4b137b066b76094fa82ebd0a380`, recorded in `packages/selector/assets/deepseek-v4-vision-exp/manifest.json`. The vision model is served by this distinct tokenizer, never as an alias of the text tokenizer.
9
+
10
+ Exact file sizes and SHA-256 values are recorded in each directory's `manifest.json`; the upstream license text ships beside the assets.
11
+
12
+ The install-time production dependency closure also contains `@huggingface/tokenizers` (Apache-2.0), `js-yaml` (MIT), and its `argparse` dependency (Python-2.0). Each dependency ships its own license text in its NPM package.
13
+
14
+ The names DeepSeek and DeepSeek Harness identify upstream projects only. They do not imply affiliation or endorsement.
@@ -0,0 +1,77 @@
1
+ # dsh-context-compression-improved · DSH v0.1.5-rc.2 适配报告
2
+
3
+ > 分支:`compat/0.1.5`(基于 `feat/ctx-preset-v2`,2026-09-14 完成)
4
+ > 提交:`b5428cf`(依赖与代码适配)→ `4c11289`(测试与 CHANGELOG)→ `93e47c2`(e2e release-gate 适配)
5
+ > 参照:`dsh-docs-deliverables/plugin-framework`(v0.1.5-migration / compatibility-guide §二十 / upgrade-pitfalls §七 / distribution-strategy §1.1)
6
+
7
+ ## 一、结论
8
+
9
+ compaction 深度插件(直接依赖 tokenMeter / session surface 写路径)从 0.1.1-rc.2 适配到 0.1.5-rc.2 完成。typecheck 0 错误、lint 0、unit 338/341(2 个 Windows 环境抖动)、built ✅、verify:release ✅、packed-e2e dev 模式全绿(release 模式需发布 npm 前版后执行)。
10
+
11
+ 迁移指南逐章核对结果:Inbox / Permission Presets / Sidebar Slot / LLM Adapter 四个高危变更本插件均不涉及;实际工作量集中在 **客户端包重构、Session V3 surface 语义、cordis 启动语义、semver peer 规则** 四块——其中后两类是迁移指南未覆盖的实测新坑,已回填 framework 文档(pitfalls §7、compatibility-guide §二十)。
12
+
13
+ ## 二、适配清单
14
+
15
+ ### 2.1 依赖与清单
16
+ - 全部 `@deepseek-ai/dsh-*` devDependencies `0.1.1-rc.2` → `0.1.5-rc.2`(cordis `4.0.2`、schemastery `3.18.2`)。
17
+ - 新增 0.1.5 拆分包 devDeps(session-projection、session-persistence、atomic-write、home-paths、sandbox、user-approval、llm-retry 等 13 个),pnpm overrides 钉版本(注意 pnpm 11 的 overrides 要写在 `pnpm-workspace.yaml`,package.json 的 `pnpm` 字段无效)。
18
+ - peer 范围 `>=0.1.1-rc.2 <0.2.0` → `>=0.1.5-rc.2 <0.2.0-0`。**根因**:strict semver 下 `0.1.5-rc.2` 不满足旧范围(预发布只匹配同元组),与官方包 `^0.1.5-rc.2` 求交为空导致 consumer 安装失败。
19
+ - `engines.dsh >=0.1.5-alpha.1 <0.2.0-0` 写入两份 package.json 与 `dsh.plugin.json`。
20
+ - CI workflow:Node 22 → 24,旧 fork 包名更正。
21
+
22
+ ### 2.2 客户端(selector)
23
+ - `dsh-client-runtime`(已删除)→ `dsh-client-store`;inject/peer/import 三处迁移。
24
+ - 类型换位:`ClientContext` = cordis `Context`;`SettingsScope` 来自 `dsh-client-ui-settings/client`;`useSessions` 由 `dsh-client-ui-session` 模块扩充合并(type-only 引入 + inject 声明)。
25
+ - `ctx.slots` 无公开类型包,按官方模板自声明 `SlotsService`(`Pick<SlotCore,'register'>` + 手写 `inject`)。
26
+ - 行为降级:0.1.5 浏览器摘要不再带 `agentPreset`,Minimal 门控失效——选择器保持可选,横幅不可达,CHANGELOG 四语言记录。
27
+
28
+ ### 2.3 运行时(runtime)
29
+ - surface 替换 → `{ op: 'replace', startSeq, endSeq }` + `SessionSeq()` 品牌化;`compaction/prune` 数据字段名不变(`start/end`)——两处不对称。
30
+ - surface node → 事件由数组下标 `events[node.seq]` 改为按 seq 查找(新增 `eventBySeq` 帮助函数,measurement + index 四处调用点)。
31
+ - `CallId` → `ToolCallId`;`session.events` → `snapshotEvents()`(保留 rc.2 双路径层,仅限本分支)。
32
+ - **Native auto-compact 审计**:0.1.5 通过会话 seed-reopen 落盘,seed 不进 firehose → 新增快照扫描(`pruneSession` 入口 + pre-step `next()` 之后),按 manifest seq 去重补发 `native-auto-compact` 审计。这是本次唯一的行为级适配。
33
+
34
+ ### 2.4 测试与 e2e 基建
35
+ - 所有插件挂载 `.await()`;SessionProjectionRegistry 先于 TokenMeter(`mountAgentLoopTestDependencies` 已内置,勿重复)。
36
+ - assistant/message 事件补 `stream: []`;断言改 `startSeq/endSeq`、`firstLiveSeq`(数值 0 = 无 seed)。
37
+ - e2e:官方宿主清单从根 devDeps 动态生成(覆盖 0.1.5 peer 闭包);consumer 写独立 `pnpm-workspace.yaml` 阻断祖先工作区吸收;`spawn` Windows 兼容;`settingsNamespace()` → 字符串。
38
+ - `.gitattributes` 标记 tokenizer 资产 `-text`(autocrlf 曾静默损坏 SHA-256 字节校验)。
39
+
40
+ ## 三、验证结果
41
+
42
+ | 门禁 | 结果 |
43
+ |---|---|
44
+ | `pnpm typecheck` / `pnpm lint` | ✅ 0 错误 |
45
+ | `pnpm test:unit` | 338/341;2 个失败为 standing-stamp 窗口测试的 Windows mtime 抖动(基线同期同样失败,Linux CI 稳定) |
46
+ | `pnpm test:built` | ✅ |
47
+ | `pnpm verify:release` | ✅ OK |
48
+ | `pnpm test:e2e:packed`(dev) | ✅ EXIT=0;upgrade leg 与 official-clone leg 因 npm 前版未发布 / clone 不可达按设计跳过并输出标记 |
49
+
50
+ ### 三补、本机 0.1.5 静态装载核查(2026-09-17,实测)
51
+
52
+ 真机 0.1.5 宿主装载在本机**不可达**(本机宿主为 0.1.2-rc.1),故改为在源码层面取证:
53
+
54
+ | 检查项 | 结果 | 证据 |
55
+ |---|---|---|
56
+ | 提交的 `lib/**` 非陈旧 | ✅ | `pnpm run build` 后 `git status --porcelain` 为空;两次独立 `npm pack` 的 shasum 相同(`424bd137…`)→ 构建可复现 |
57
+ | `lib/*.js` 的依赖面 vs 0.1.5 提供的包 | ✅ 零缺失 | 实拉 0.1.5-rc.2 tarball 解包,从 `super(ctx,"…")` 提取服务名;插件注入/读取的 `settings`/`tokenMeter`/`invariants`/`sessions`/`tools`/`systemPrompt`/`llm`/`agentPresets`/`agents`/`webServer`/`settingsScope` 全部存在 |
58
+ | `dsh-client-runtime` 是否残留 | ✅ 0 次 | registry 上该包最新版止于 `0.1.1-rc.2`,0.1.5 确已移除 |
59
+ | `cordis.patch.yml` / `dsh.plugin.json` 引用的服务 | ✅ | `inject: [webServer]` 独立成行,`webServer` 缺席时只丢 HTTP 路由、压缩栈照常装载(刻意降级) |
60
+ | 全部 peer 区间在 registry 可解析 | ✅ | 19 个 `@deepseek-ai/dsh-*` 均解析到 `0.1.5-rc.2` |
61
+ | `pnpm test:built` | ✅ | `vitest.built.config.ts` 真正 `Function(code)()` 执行 `lib/client.js` |
62
+ | **真机 0.1.5 宿主装载** | **未验证** | 本机无 0.1.5 宿主 |
63
+
64
+ `pnpm test` 连跑 4 次:1 次全绿、3 次失败,**失败 100% 集中在 `standing-generation.host.spec.ts`**(`:333` 整秒 mtime 竞态、`:580`/`:595` 5s 超时、`EPERM rename`)——Windows 环境性竞态,非 0.1.5 适配引入。
65
+
66
+ ## 四、已知问题与后续项
67
+
68
+ 1. **release 模式 e2e**:official clone tag 与三连断言已改钉 `dsh-v0.1.5-rc.2`(commit `fb2c4b9e`、tree `bd7dd6d9`),客户端 peer 清单里的 `dsh-client-runtime` 已换成 `dsh-client-store`——此前这条腿**从未真正跑过**:它拿 `dsh-v0.1.1-rc.2` 宿主去验证一条声明只兼容 `>=0.1.5-rc.2` 的插件线,且 `proveBuiltClientPeersLoad()` 无条件解析已被移除的 `dsh-client-runtime`,必然抛错。仍需先发布一个前版(或调整脚本的前版基线)才能跑完 release 模式。
69
+ 2. **stamp 窗口测试抖动**:Windows mtime 精度所致,可考虑在测试内跳过 win32 或提高窗口粒度。
70
+ 3. **Minimal 门控降级**:待官方恢复浏览器侧 preset 暴露后恢复。
71
+ 4. 0.1.1-rc.2 兼容 shim(session-events 双路径)仅保留在本分支,合主线时按主线支持的宿主范围决定去留。
72
+
73
+ ## 五、经验回填
74
+
75
+ - `plugin-framework/upgrade-pitfalls.md` §七(7.1 cordis `.await()` 启动语义;7.2 firehose/seed-reopen;7.3 semver 预发布 peer 规则;7.4 autocrlf 资产损坏;7.5 workspace 向上吸收;7.6 Windows 环境差异;7.7 API 变更速查)
76
+ - `plugin-framework/compatibility-guide.md` §十二(客户端包迁移、类型换位、`ctx.slots` 自声明、`agentPreset` 降级、运行时 API 变更表、e2e 基建要点)
77
+ - `plugin-framework/distribution-strategy.md` §1.1/§1.2/§2.2(0.1.5 拆分闭包、本插件实证行、`-0` 上界规范)
@@ -1,76 +1,78 @@
1
- # dsh-context-compression-improved をインストールする
2
-
3
- > [English](installation.md) · [中文](installation.zh.md) · [日本語](installation.ja.md) · [한국어](installation.ko.md)
4
-
5
- このガイドでは、ソースからフォークをインストールします。このフォークはアップストリームに対して名前が変更されており(`dsh-context-compression-selector` → `dsh-context-compression-improved`)、まだ npm に公開されていません。ソースおよびセッションログに現れる `dsh-context-compression-improved-runtime` は凍結された来歴ラベルであり、パッケージ依存ではありません。実行時の依存は `@huggingface/tokenizers` と `js-yaml` のみです。
6
-
7
- ## 前提条件
8
-
9
- - Node `^22.19.0 || >=24` と pnpm `11.7.0`(`corepack enable` で `packageManager` の固定バージョンが使われます)。
10
- - `0.1.1-rc.2` peer 範囲に互換する DeepSeek Harness(公式 `dsh-v0.1.2-alpha.5` リリースに対して検証済み)。
11
- - DeepSeek V4 モデルルート(`deepseek-v4-flash`、`deepseek-v4-pro`、`deepseek-v4-flash-vision-exp`)。コードスケルトンゲートを含む非可逆圧縮には同梱の正確なトークナイザーが必要で、その他のルートは fail-open で元のツール結果を保持します。
12
- - Git。
13
-
14
- ## 1. ソースからビルド
15
-
16
- ```sh
17
- git clone https://github.com/drscrewdriver/dsh-context-compression-improved.git
18
- cd dsh-context-compression-improved
19
- pnpm install --frozen-lockfile
20
- pnpm build
21
- ```
22
-
23
- `pnpm build` はすべてのパッケージの両方のライブラリ成果物をバンドルします(`tsdown`)。インストール前にフルスイートを実行したい場合は `pnpm test` を実行してください。
24
-
25
- ## 2. Bundle エントリーパッケージを pack
26
-
27
- selector パッケージが唯一の Bundle エントリーで、ランタイムはその正確なバージョン依存として付いてきます:
28
-
29
- ```sh
30
- cd packages/selector
31
- pnpm pack
32
- # → dsh-context-compression-improved-0.1.0.tgz
33
- cd ../..
34
- ```
35
-
36
- `pnpm pack` は `prepack` フック経由でバンドルを実行するため、tarball は常にチェックアウト内容と一致します。
37
-
38
- ## 3. Harness プロファイルに追加
39
-
40
- selector パッケージは Harness Bundle マニフェストフィールド `dsh.bundle.patch` を宣言しているため、`dsh plugin add` が標準のアウトオブツリー Bundle インストール経路になります:
41
-
42
- ```sh
43
- dsh plugin --profile web add packages/selector/dsh-context-compression-improved-0.1.0.tgz
44
- dsh --profile web --dump-config
45
- ```
46
-
47
- インストール後、対象プロファイルを再起動してください。設定ダンプに selector Bundle が有効として表示されるはずです。selector と runtime の 2 パッケージを別々にインストール・接続**しないでください**——runtime は自動的にインストールされます。
48
-
49
- ## 4. コードスケルトンゲートを有効にする
50
-
51
- DeepSeek Harness の設定 → **Context compression selector** を開きます:
52
-
53
- 1. 圧縮プロファイルを選択します(ゲートはすべてのプロファイルに対して直交します)。
54
- 2. 必要に応じて Auto Compact トリガーレベルを調整します(50–90%、デフォルト 80%)。
55
- 3. **Code skeleton compression** を **On** にします。トグルは変更時に保存されます。
56
-
57
- 他のセレクター設定と同様、値はセッションが最初に観測した時点で凍結されます——ゲートは新しく観測されたセッションにのみ影響し、実行中のタスクには適用されません。
58
-
59
- ## 5. 更新と削除
60
-
61
- ```sh
62
- # 更新:pull、再ビルド、再 pack、新しい tarball を再追加
63
- git pull && pnpm install --frozen-lockfile && pnpm build
64
- cd packages/selector && pnpm pack && cd ../..
65
- dsh plugin --profile web add packages/selector/dsh-context-compression-improved-0.1.0.tgz
66
-
67
- # 削除
68
- dsh plugin --profile web remove dsh-context-compression-improved
69
- ```
70
-
71
- ## トラブルシューティング
72
-
73
- - **ダンプに Bundle が有効と表示されない**:プロファイルを再起動し、selector エントリーパッケージ(runtime ではなく)を追加したこと、Harness のバージョンが互換 peer 範囲内であることを確認してください。
74
- - **ツール結果が一切スケルトン圧縮されない**:ゲートはデフォルトでオフです。トグルを確認してください。圧縮は、正確なトークナイザーのモデルルート上の、新規かつ超大規模なソースコード系ツール結果にのみ適用され、すべてのスキップは理由付きで監査記録に残ります。
75
- - **トグルが読み取り不能と表示される**:保存済みの `codeSkeleton` セクションが厳格なブラウザーデコードに失敗しています(正確に `{ enabled: boolean }` である必要があります)。不正なセクションを削除すればデフォルトに戻ります。
76
- - **更新手順が失敗する**:プラグインは npm パッケージのセマンティクスに従います。お使いの Harness ビルドが tarball 間のアップグレードを拒否する場合は、まず古いバージョンを削除してください。
1
+ # dsh-context-compression-improved をインストールする
2
+
3
+ > [English](installation.md) · [中文](installation.zh.md) · [日本語](installation.ja.md) · [한국어](installation.ko.md)
4
+
5
+ このガイドではソースからフォークをインストールします。フォークは npm にも公開済みです(dist-tag
6
+ `dsh-0.1.5`)。パッケージ名は意図的に上流と同一です(`dsh-context-compression-improved` の単一パッケージで、
7
+ 以前は別パッケージだった runtime も同梱されます)。
8
+
9
+ ## 前提条件
10
+
11
+ - Node `^22.19.0 || >=24` と pnpm `11.7.0`(`corepack enable` で `packageManager` の固定バージョンが使われます)。
12
+ - `0.1.1-rc.2` peer 範囲に互換する DeepSeek Harness(公式 `dsh-v0.1.2-alpha.5` リリースに対して検証済み)。
13
+ - DeepSeek V4 モデルルート(`deepseek-v4-flash`、`deepseek-v4-pro`、`deepseek-v4-flash-vision-exp`)。コードスケルトンゲートを含む非可逆圧縮には同梱の正確なトークナイザーが必要で、その他のルートは fail-open で元のツール結果を保持します。
14
+ - Git。
15
+
16
+ ## 1. ソースからビルド
17
+
18
+ ```sh
19
+ git clone https://github.com/drscrewdriver/dsh-context-compression-improved.git
20
+ cd dsh-context-compression-improved
21
+ pnpm install --frozen-lockfile
22
+ pnpm build
23
+ ```
24
+
25
+ `pnpm build` はすべてのパッケージの両方のライブラリ成果物をバンドルします(`tsdown`)。インストール前にフルスイートを実行したい場合は `pnpm test` を実行してください。
26
+
27
+ ## 2. Bundle エントリーパッケージをpack
28
+
29
+ selector パッケージが唯一の Bundle エントリーで、ランタイムはその正確なバージョン依存として付いてきます:
30
+
31
+ ```sh
32
+ cd packages/selector
33
+ pnpm pack
34
+ # →dsh-context-compression-improved-0.1.0.tgz
35
+ cd ../..
36
+ ```
37
+
38
+ `pnpm pack` は `prepack` フック経由でバンドルを実行するため、tarball は常にチェックアウト内容と一致します。
39
+
40
+ ## 3. Harness プロファイルに追加
41
+
42
+ selector パッケージは Harness Bundle マニフェストフィールド `dsh.bundle.patch` を宣言しているため、`dsh plugin add` が標準のアウトオブツリー Bundle インストール経路になります:
43
+
44
+ ```sh
45
+ dsh plugin --profile web add packages/selector/dsh-context-compression-improved-0.1.0.tgz
46
+ dsh --profile web --dump-config
47
+ ```
48
+
49
+ インストール後、対象プロファイルを再起動してください。設定ダンプに selector Bundle が有効として表示されるはずです。selector と runtime の 2 パッケージを別々にインストール・接続**しないでください**——runtime は自動的にインストールされます。
50
+
51
+ ## 4. コードスケルトンゲートを有効にする
52
+
53
+ DeepSeek Harness の設定→**Context compression selector** を開きます:
54
+
55
+ 1. 圧縮プロファイルを選択します(ゲートはすべてのプロファイルに対して直交します)。
56
+ 2. 必要に応じて Auto Compact トリガーレベルを調整します(50–90%、デフォルト 80%)。
57
+ 3. **Code skeleton compression** を **On** にします。トグルは変更時に保存されます。
58
+
59
+ 他のセレクター設定と同様、値はセッションが最初に観測した時点で凍結されます——ゲートは新しく観測されたセッションにのみ影響し、実行中のタスクには適用されません。
60
+
61
+ ## 5. 更新と削除
62
+
63
+ ```sh
64
+ # 更新:pull、再ビルド、再 pack、新しい tarball を再追加
65
+ git pull && pnpm install --frozen-lockfile && pnpm build
66
+ cd packages/selector && pnpm pack && cd ../..
67
+ dsh plugin --profile web add packages/selector/dsh-context-compression-improved-0.1.0.tgz
68
+
69
+ # 削除
70
+ dsh plugin --profile web remove dsh-context-compression-improved
71
+ ```
72
+
73
+ ## トラブルシューティング
74
+
75
+ - **ダンプに Bundle が有効と表示されない**:プロファイルを再起動し、selector エントリーパッケージ(runtime ではなく)を追加したこと、Harness のバージョンが互換 peer 範囲内であることを確認してください。
76
+ - **ツール結果が一切スケルトン圧縮されない**:ゲートはデフォルトでオフです。トグルを確認してください。圧縮は、正確なトークナイザーのモデルルート上の、新規かつ超大規模なソースコード系ツール結果にのみ適用され、すべてのスキップは理由付きで監査記録に残ります。
77
+ - **トグルが読み取り不能と表示される**:保存済みの `codeSkeleton` セクションが厳格なブラウザーデコードに失敗しています(正確に `{ enabled: boolean }` である必要があります)。不正なセクションを削除すればデフォルトに戻ります。
78
+ - **更新手順が失敗する**:プラグインは npm パッケージのセマンティクスに従います。お使いの Harness ビルドが tarball 間のアップグレードを拒否する場合は、まず古いバージョンを削除してください。
@@ -1,76 +1,78 @@
1
- # dsh-context-compression-improved 설치하기
2
-
3
- > [English](installation.md) · [中文](installation.zh.md) · [日本語](installation.ja.md) · [한국어](installation.ko.md)
4
-
5
- 이 가이드는 포크를 소스에서 설치하는 방법을 다룹니다. 이 포크는 업스트림에 대해 이름이 변경되었으며(`dsh-context-compression-selector` → `dsh-context-compression-improved`), 아직 npm에 게시되지 않았습니다. 소스와 세션 로그에 나타나는 `dsh-context-compression-improved-runtime`은 동결된 프로버넌스 라벨이며 패키지 의존성이 아닙니다. 런타임 의존성은 `@huggingface/tokenizers`와 `js-yaml`뿐입니다.
6
-
7
- ## 사전 요구 사항
8
-
9
- - Node `^22.19.0 || >=24` 및 pnpm `11.7.0`(`corepack enable`은 `packageManager`의 고정 버전을 사용합니다).
10
- - `0.1.1-rc.2` peer 범위와 호환되는 DeepSeek Harness(공식 `dsh-v0.1.2-alpha.5` 릴리스에서 검증).
11
- - DeepSeek V4 모델 경로(`deepseek-v4-flash`, `deepseek-v4-pro`, `deepseek-v4-flash-vision-exp`). 코드 스켈레톤 게이트를 포함한 손실 압축은 번들된 정확한 토크나이저가 필요하며, 그 외의 경로는 fail-open으로 원본 도구 결과를 유지합니다.
12
- - Git.
13
-
14
- ## 1. 소스에서 빌드
15
-
16
- ```sh
17
- git clone https://github.com/drscrewdriver/dsh-context-compression-improved.git
18
- cd dsh-context-compression-improved
19
- pnpm install --frozen-lockfile
20
- pnpm build
21
- ```
22
-
23
- `pnpm build`는 모든 패키지의 두 라이브러리 산출물을 번들합니다(`tsdown`). 설치 전에 전체 테스트 스위트를 실행하려면 `pnpm test`를 먼저 실행하세요.
24
-
25
- ## 2. Bundle 엔트리 패키지를 pack
26
-
27
- 셀렉터 패키지가 유일한 Bundle 엔트리이며, 런타임은 정확한 버전 의존성으로 함께 따라옵니다:
28
-
29
- ```sh
30
- cd packages/selector
31
- pnpm pack
32
- # → dsh-context-compression-improved-0.1.0.tgz
33
- cd ../..
34
- ```
35
-
36
- `pnpm pack`은 `prepack` 훅을 통해 번들을 실행하므로, tarball은 항상 체크아웃 내용과 일치합니다.
37
-
38
- ## 3. Harness 프로파일에 추가
39
-
40
- 셀렉터 패키지는 Harness Bundle 매니페스트 필드 `dsh.bundle.patch`를 선언하므로, `dsh plugin add`가 표준적인 out-of-tree Bundle 설치 경로입니다:
41
-
42
- ```sh
43
- dsh plugin --profile web add packages/selector/dsh-context-compression-improved-0.1.0.tgz
44
- dsh --profile web --dump-config
45
- ```
46
-
47
- 설치 후 해당 프로파일을 재시작하세요. 설정 덤프에 셀렉터 Bundle이 활성 상태로 표시되어야 합니다. 셀렉터와 런타임 패키지를 따로 설치하거나 연결하지 **마세요** — 런타임은 자동으로 설치됩니다.
48
-
49
- ## 4. 코드 스켈레톤 게이트 켜기
50
-
51
- DeepSeek Harness 설정 → **Context compression selector**를 엽니다:
52
-
53
- 1. 압축 프로파일을 선택합니다(게이트는 모든 프로파일에 대해 직교합니다).
54
- 2. 필요하면 Auto Compact 트리거 레벨을 조정합니다(50–90%, 기본값 80%).
55
- 3. **Code skeleton compression**을 **On**으로 설정합니다. 토글은 변경 시 저장됩니다.
56
-
57
- 다른 셀렉터 설정과 마찬가지로 값은 세션이 처음 관찰하는 시점에 고정됩니다 — 게이트는 새로 관찰된 세션에만 적용되며, 실행 중인 작업에는 적용되지 않습니다.
58
-
59
- ## 5. 업데이트 및 제거
60
-
61
- ```sh
62
- # 업데이트: pull, 재빌드, 재 pack, 새 tarball을 다시 추가
63
- git pull && pnpm install --frozen-lockfile && pnpm build
64
- cd packages/selector && pnpm pack && cd ../..
65
- dsh plugin --profile web add packages/selector/dsh-context-compression-improved-0.1.0.tgz
66
-
67
- # 제거
68
- dsh plugin --profile web remove dsh-context-compression-improved
69
- ```
70
-
71
- ## 문제 해결
72
-
73
- - **덤프에 Bundle이 활성으로 표시되지 않음**: 프로파일을 재시작하고, 셀렉터 엔트리 패키지(런타임이 아닌)를 추가했는지, Harness 버전이 호환 peer 범위 내인지 확인하세요.
74
- - **도구 결과가 한 번도 스켈레톤 압축되지 않음**: 게이트는 기본값이 off입니다. 토글을 확인하세요. 압축은 정확한 토크나이저 모델 경로에서 새로 들어온 초대형 소스코드 도구 결과에만 적용되며, 모든 건너뜀은 사유와 함께 감사 기록에 남습니다.
75
- - **토글이 읽을 수 없음으로 표시됨**: 저장된 `codeSkeleton` 섹션이 엄격한 브라우저 디코드에 실패했습니다(정확히 `{ enabled: boolean }`이어야 함). 잘못된 섹션을 제거하면 기본값으로 돌아갑니다.
76
- - **업데이트 단계 실패**: 플러그인은 npm 패키지 의미론을 따릅니다. 사용 중인 Harness 빌드가 tarball 간 업그레이드를 거부하면 먼저 이전 버전을 제거하세요.
1
+ # dsh-context-compression-improved 설치하기
2
+
3
+ > [English](installation.md) · [中文](installation.zh.md) · [日本語](installation.ja.md) · [한국어](installation.ko.md)
4
+
5
+ 이 가이드는 소스에서 포크를 설치합니다. 포크는 npm에도 게시되어 있습니다(dist-tag
6
+ `dsh-0.1.5`). 패키지 이름은 의도적으로 업스트림과 동일합니다(`dsh-context-compression-improved` 단일 패키지이며,
7
+ 예전에 별도 패키지였던 runtime이 함께 포함됩니다).
8
+
9
+ ## 사전 요구 사항
10
+
11
+ - Node `^22.19.0 || >=24` 및 pnpm `11.7.0`(`corepack enable`은 `packageManager`의 고정 버전을 사용합니다).
12
+ - `0.1.1-rc.2` peer 범위와 호환되는 DeepSeek Harness(공식 `dsh-v0.1.2-alpha.5` 릴리스에서 검증).
13
+ - DeepSeek V4 모델 경로(`deepseek-v4-flash`, `deepseek-v4-pro`, `deepseek-v4-flash-vision-exp`). 코드 스켈레톤 게이트를 포함한 손실 압축은 번들된 정확한 토크나이저가 필요하며, 그 외의 경로는 fail-open으로 원본 도구 결과를 유지합니다.
14
+ - Git.
15
+
16
+ ## 1. 소스에서 빌드
17
+
18
+ ```sh
19
+ git clone https://github.com/drscrewdriver/dsh-context-compression-improved.git
20
+ cd dsh-context-compression-improved
21
+ pnpm install --frozen-lockfile
22
+ pnpm build
23
+ ```
24
+
25
+ `pnpm build`는 모든 패키지의두라이브러리 산출물을 번들합니다(`tsdown`). 설치 전에 전체 테스트 스위트를 실행하려면 `pnpm test`를 먼저 실행하세요.
26
+
27
+ ## 2. Bundle 엔트리 패키지를 pack
28
+
29
+ 셀렉터 패키지가 유일한 Bundle 엔트리이며, 런타임은 정확한 버전 의존성으로 함께 따라옵니다:
30
+
31
+ ```sh
32
+ cd packages/selector
33
+ pnpm pack
34
+ # → dsh-context-compression-improved-0.1.0.tgz
35
+ cd ../..
36
+ ```
37
+
38
+ `pnpm pack`은 `prepack` 훅을 통해 번들을 실행하므로, tarball은 항상 체크아웃 내용과 일치합니다.
39
+
40
+ ## 3. Harness 프로파일에 추가
41
+
42
+ 셀렉터 패키지는 Harness Bundle 매니페스트 필드 `dsh.bundle.patch`를 선언하므로, `dsh plugin add`가 표준적인 out-of-tree Bundle 설치 경로입니다:
43
+
44
+ ```sh
45
+ dsh plugin --profile web add packages/selector/dsh-context-compression-improved-0.1.0.tgz
46
+ dsh --profile web --dump-config
47
+ ```
48
+
49
+ 설치 후 해당 프로파일을 재시작하세요. 설정 덤프에 셀렉터 Bundle이 활성 상태로 표시되어야 합니다. 셀렉터와 런타임 패키지를 따로 설치하거나 연결하지 **마세요** — 런타임은 자동으로 설치됩니다.
50
+
51
+ ## 4. 코드 스켈레톤 게이트 켜기
52
+
53
+ DeepSeek Harness 설정 → **Context compression selector**를 엽니다:
54
+
55
+ 1. 압축 프로파일을 선택합니다(게이트는 모든 프로파일에 대해 직교합니다).
56
+ 2. 필요하면 Auto Compact 트리거 레벨을 조정합니다(50–90%, 기본값 80%).
57
+ 3. **Code skeleton compression**을 **On**으로 설정합니다. 토글은 변경시저장됩니다.
58
+
59
+ 다른 셀렉터 설정과 마찬가지로 값은 세션이 처음 관찰하는 시점에 고정됩니다—게이트는 새로 관찰된 세션에만 적용되며, 실행 중인 작업에는 적용되지 않습니다.
60
+
61
+ ## 5. 업데이트 및 제거
62
+
63
+ ```sh
64
+ # 업데이트: pull, 재빌드, 재pack, 새 tarball을 다시 추가
65
+ git pull && pnpm install --frozen-lockfile && pnpm build
66
+ cd packages/selector && pnpm pack && cd ../..
67
+ dsh plugin --profile web add packages/selector/dsh-context-compression-improved-0.1.0.tgz
68
+
69
+ # 제거
70
+ dsh plugin --profile web remove dsh-context-compression-improved
71
+ ```
72
+
73
+ ## 문제 해결
74
+
75
+ - **덤프에 Bundle이 활성으로 표시되지 않음**: 프로파일을 재시작하고, 셀렉터 엔트리 패키지(런타임이 아닌)를 추가했는지, Harness 버전이 호환 peer 범위 내인지 확인하세요.
76
+ - **도구 결과가 한 번도 스켈레톤 압축되지 않음**: 게이트는 기본값이 off입니다. 토글을 확인하세요 압축은 정확한 토크나이저 모델 경로에서 새로 들어온 초대형 소스코드 도구 결과에만 적용되며, 모든 건너뜀은 사유와 함께 감사 기록에 남습니다.
77
+ - **토글이 읽을 수 없음으로 표시됨**: 저장된 `codeSkeleton` 섹션이 엄격한 브라우저 디코드에 실패했습니다(정확히 `{ enabled: boolean }`이어야함. 잘못된 섹션을제거하면 기본값으로 돌아갑니다.
78
+ - **업데이트 단계 실패**: 플러그인은 npm 패키지 의미론을 따릅니다. 사용 중인 Harness 빌드가 tarball 간 업그레이드를 거부하면 먼저 이전 버전을 제거하세요.
@@ -1,76 +1,103 @@
1
- # Installing dsh-context-compression-improved
2
-
3
- > [English](installation.md) · [中文](installation.zh.md) · [日本語](installation.ja.md) · [한국어](installation.ko.md)
4
-
5
- This guide installs the fork from source. The fork is renamed relative to upstream (`dsh-context-compression-selector` → `dsh-context-compression-improved`) and is not yet published to npm. The literal `dsh-context-compression-improved-runtime` that appears in the source and in durable session logs is a frozen provenance label, not a package dependency — the runtime dependencies are `@huggingface/tokenizers` and `js-yaml`.
6
-
7
- ## Prerequisites
8
-
9
- - Node `^22.19.0 || >=24` and pnpm `11.7.0` (`corepack enable` picks the pinned version from `packageManager`).
10
- - A DeepSeek Harness installation compatible with the `0.1.1-rc.2` peer range (verified against the official `dsh-v0.1.2-alpha.5` release).
11
- - A DeepSeek V4 model route (`deepseek-v4-flash`, `deepseek-v4-pro`, or `deepseek-v4-flash-vision-exp`). Lossy compression — including the code-skeleton gate — requires the exact bundled tokenizer; other routes fail open and keep original tool results.
12
- - Git.
13
-
14
- ## 1. Build from source
15
-
16
- ```sh
17
- git clone https://github.com/drscrewdriver/dsh-context-compression-improved.git
18
- cd dsh-context-compression-improved
19
- pnpm install --frozen-lockfile
20
- pnpm build
21
- ```
22
-
23
- `pnpm build` bundles both library faces of every package (`tsdown`). Run `pnpm test` first if you want the full suite on your machine before installing.
24
-
25
- ## 2. Pack the Bundle entry package
26
-
27
- The selector package is the single Bundle entry; the runtime comes along as its exact-version dependency:
28
-
29
- ```sh
30
- cd packages/selector
31
- pnpm pack
32
- # → dsh-context-compression-improved-0.1.0.tgz
33
- cd ../..
34
- ```
35
-
36
- `pnpm pack` runs the bundle through the `prepack` hook, so the tarball always matches your checkout.
37
-
38
- ## 3. Add it to a Harness profile
39
-
40
- The selector package declares the Harness Bundle manifest field `dsh.bundle.patch`, so `dsh plugin add` is the standard out-of-tree Bundle installation path:
41
-
42
- ```sh
43
- dsh plugin --profile web add packages/selector/dsh-context-compression-improved-0.1.0.tgz
44
- dsh --profile web --dump-config
45
- ```
46
-
47
- Restart the selected profile after installation. The config dump should list the selector Bundle as active. Do **not** install or wire the selector and runtime packages separately — the runtime is installed automatically.
48
-
49
- ## 4. Turn on the code-skeleton gate
50
-
51
- Open DeepSeek Harness settings → **Context compression selector**:
52
-
53
- 1. Pick a compression profile (the gate is orthogonal to all of them).
54
- 2. Optionally adjust the Auto Compact trigger level (50–90%, default 80%).
55
- 3. Set **Code skeleton compression** to **On**. The toggle saves on change.
56
-
57
- Like all selector settings, the value is frozen when a session first observes it — the gate affects newly observed sessions, never a task that is already running.
58
-
59
- ## 5. Update or remove
60
-
61
- ```sh
62
- # update: pull, rebuild, repack, and add the new tarball again
63
- git pull && pnpm install --frozen-lockfile && pnpm build
64
- cd packages/selector && pnpm pack && cd ../..
65
- dsh plugin --profile web add packages/selector/dsh-context-compression-improved-0.1.0.tgz
66
-
67
- # remove
68
- dsh plugin --profile web remove dsh-context-compression-improved
69
- ```
70
-
71
- ## Troubleshooting
72
-
73
- - **Bundle not active in the dump**: restart the profile; confirm you added the selector entry package (not the runtime) and that the Harness version is in the compatible peer range.
74
- - **Tool results are never skeleton-compressed**: the gate is off by default; check the toggle. Compression only applies to fresh, oversized source-code tool results on exact-tokenizer model routes, and every skip is recorded with a reason in the audit trail.
75
- - **The toggle shows as unreadable**: the stored `codeSkeleton` section failed the strict browser decode (it must be exactly `{ enabled: boolean }`). Removing the malformed section restores defaults.
76
- - **Updating fails on the upgrade step**: the plugin follows npm package semantics; remove the old version first if a tarball-to-tarball upgrade is refused by your Harness build.
1
+ # Installing dsh-context-compression-improved
2
+
3
+ > [English](installation.md) · [中文](installation.zh.md) · [日本語](installation.ja.md) · [한국어](installation.ko.md)
4
+
5
+ This guide installs the fork from source. The fork is published to npm as
6
+ `dsh-context-compression-improved` under the `dsh-0.1.5` dist-tag; the package name
7
+ intentionally stays upstream's. The runtime that used to be a second package is now part of
8
+ it, so one install brings the whole stack.
9
+
10
+ ## Prerequisites
11
+
12
+ - Node `^22.19.0 || >=24` and pnpm `11.7.0` (`corepack enable` picks the pinned version from `packageManager`).
13
+ - A DeepSeek Harness installation compatible with the `0.1.1-rc.2` peer range (verified against the official `dsh-v0.1.2-alpha.5` release).
14
+ - A DeepSeek model route. Lossy compression — including the code-skeleton gate — decides on the character basis, so no bundled-tokenizer route requirement remains; when a bundled tokenizer exists its exact counts are recorded as telemetry, and other routes fail open and keep original tool results.
15
+ - Git.
16
+
17
+ ## 1. Build from source
18
+
19
+ ```sh
20
+ git clone https://github.com/drscrewdriver/dsh-context-compression-improved.git
21
+ cd dsh-context-compression-improved
22
+ pnpm install --frozen-lockfile
23
+ pnpm build
24
+ ```
25
+
26
+ `pnpm build` bundles both library faces of every package (`tsdown`). Run `pnpm test` first if you want the full suite on your machine before installing.
27
+
28
+ ## 2. Pack the Bundle entry package
29
+
30
+ The selector package is the single Bundle entry; the runtime comes along as its exact-version dependency:
31
+
32
+ ```sh
33
+ cd packages/selector
34
+ pnpm pack
35
+ # → dsh-context-compression-improved-0.1.0.tgz
36
+ cd ../..
37
+ ```
38
+
39
+ `pnpm pack` runs the bundle through the `prepack` hook, so the tarball always matches your checkout.
40
+
41
+ ## 3. Add it to a Harness profile
42
+
43
+ The selector package declares the Harness Bundle manifest field `dsh.bundle.patch`, so `dsh plugin add` is the standard out-of-tree Bundle installation path:
44
+
45
+ ```sh
46
+ dsh plugin --profile web add packages/selector/dsh-context-compression-improved-0.1.0.tgz
47
+ dsh --profile web --dump-config
48
+ ```
49
+
50
+ Restart the selected profile after installation. The config dump should list the selector Bundle as active. Do **not** install or wire the selector and runtime packages separately — the runtime is installed automatically.
51
+
52
+ ## 4. Turn on the code-skeleton gate
53
+
54
+ Open DeepSeek Harness settings → **Context compression selector**:
55
+
56
+ 1. Pick a compression profile (the gate is orthogonal to all of them).
57
+ 2. Optionally adjust the Auto Compact trigger level (50–90%, default 80%).
58
+ 3. Set **Code skeleton compression** to **On**. The toggle saves on change.
59
+
60
+ Like all selector settings, the value is frozen when a session first observes it — the gate affects newly observed sessions, never a task that is already running.
61
+
62
+ ## 5. Optional: the advisory relevance advisor
63
+
64
+ The plugin can keep statistics about how relevant the session's history still is — advisory only, it never decides or blocks anything. It is off by default; turn it on by editing the `presetOptions` section of the context-compression settings (settings JSON, no UI card this round):
65
+
66
+ ```json
67
+ "presetOptions": {
68
+ "advisorMode": "host",
69
+ "advisorRefreshTurns": 8,
70
+ "advisorScoreThreshold": 0.35,
71
+ "advisorSampleLimit": 16,
72
+ "advisorMinTokens": 250,
73
+ "advisorTimeoutMs": 8000
74
+ }
75
+ ```
76
+
77
+ `advisorMode: "host"` calls the harness `llm` service; `"direct"` reuses the estimator's
78
+ `estimatorBaseUrl` / `estimatorApiKey` / `estimatorModel` endpoint. At every turn boundary
79
+ the advisor (1) summarizes the current task from the most recent `todo/write` event,
80
+ (2) incrementally scores historical tool results for content-and-comment relevance, and
81
+ (3) records a prefix-decay figure. Results surface as `advisor-outcome` audit records and,
82
+ with the deployment flag `advisorReportRoute: true`, a read-only
83
+ `GET .../advisor-report?sessionId=` HTTP route. What the advisor reports can never
84
+ suppress, delay, or rewrite any reduction that would land.
85
+
86
+ ## 6. Update or remove
87
+
88
+ ```sh
89
+ # update: pull, rebuild, repack, and add the new tarball again
90
+ git pull && pnpm install --frozen-lockfile && pnpm build
91
+ cd packages/selector && pnpm pack && cd ../..
92
+ dsh plugin --profile web add packages/selector/dsh-context-compression-improved-0.1.0.tgz
93
+
94
+ # remove
95
+ dsh plugin --profile web remove dsh-context-compression-improved
96
+ ```
97
+
98
+ ## Troubleshooting
99
+
100
+ - **Bundle not active in the dump**: restart the profile; confirm you added the selector entry package (not the runtime) and that the Harness version is in the compatible peer range.
101
+ - **Tool results are never skeleton-compressed**: the gate is off by default; check the toggle. Compression only applies to fresh, oversized source-code tool results (decisions run on the character basis; no exact-tokenizer route requirement), and every skip is recorded with a reason in the audit trail.
102
+ - **The toggle shows as unreadable**: the stored `codeSkeleton` section failed the strict browser decode (it must be exactly `{ enabled: boolean }`). Removing the malformed section restores defaults.
103
+ - **Updating fails on the upgrade step**: the plugin follows npm package semantics; remove the old version first if a tarball-to-tarball upgrade is refused by your Harness build.