dsh-context-compression-improved 0.11.1 → 0.11.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.
Files changed (311) hide show
  1. package/README.md +15 -110
  2. package/README.zh.md +14 -104
  3. package/THIRD_PARTY_NOTICES.md +25 -7
  4. package/{packages/selector/dsh.plugin.json → dsh.plugin.json} +1 -1
  5. package/{packages/selector/lib → lib}/index.js +101 -0
  6. package/package.json +125 -112
  7. package/screenshots.json +3 -6
  8. package/.agents/plans/improve/checklist.md +0 -32
  9. package/.agents/plans/improve/findings.md +0 -102
  10. package/.agents/plans/improve/spec.md +0 -53
  11. package/.agents/plans/improve/tasks.md +0 -70
  12. package/.gitattributes +0 -2
  13. package/.githooks/pre-push +0 -37
  14. package/.github/workflows/ci.yml +0 -47
  15. package/CHANGELOG.de.md +0 -580
  16. package/CHANGELOG.es.md +0 -588
  17. package/CHANGELOG.fr.md +0 -576
  18. package/CHANGELOG.it.md +0 -577
  19. package/CHANGELOG.ja.md +0 -261
  20. package/CHANGELOG.ko.md +0 -254
  21. package/CHANGELOG.md +0 -557
  22. package/CHANGELOG.ru.md +0 -554
  23. package/CHANGELOG.zh.md +0 -247
  24. package/CONTRIBUTING.md +0 -22
  25. package/README.de.md +0 -96
  26. package/README.es.md +0 -96
  27. package/README.fr.md +0 -96
  28. package/README.it.md +0 -96
  29. package/README.ja.md +0 -102
  30. package/README.ko.md +0 -102
  31. package/README.ru.md +0 -96
  32. package/SECURITY.md +0 -18
  33. package/assets/board.png +0 -0
  34. package/assets/context.png +0 -0
  35. package/assets/dshfind-card.svg +0 -33
  36. package/docs/assets/context-compression-selector-profiles.jpg +0 -0
  37. package/docs/assets/context-compression-selector-settings.png +0 -0
  38. package/docs/compat-0.1.5-report.md +0 -77
  39. package/docs/installation.de.md +0 -104
  40. package/docs/installation.es.md +0 -104
  41. package/docs/installation.fr.md +0 -104
  42. package/docs/installation.it.md +0 -104
  43. package/docs/installation.ja.md +0 -78
  44. package/docs/installation.ko.md +0 -78
  45. package/docs/installation.md +0 -103
  46. package/docs/installation.ru.md +0 -104
  47. package/docs/installation.zh.md +0 -100
  48. package/docs/repair-log.md +0 -657
  49. package/docs/shallow-teaching-preset-template.md +0 -46
  50. package/eslint.config.js +0 -30
  51. package/packages/selector/LICENSE +0 -21
  52. package/packages/selector/README.md +0 -26
  53. package/packages/selector/README.zh.md +0 -24
  54. package/packages/selector/THIRD_PARTY_NOTICES.md +0 -32
  55. package/packages/selector/docs/history-tool-call-working-set-spec.md +0 -112
  56. package/packages/selector/docs/native-tool-result-selector-spec.md +0 -34
  57. package/packages/selector/docs/subagent-cache-reuse-spec.md +0 -46
  58. package/packages/selector/lib/style.css +0 -350
  59. package/packages/selector/package.json +0 -178
  60. package/packages/selector/screenshots.json +0 -3
  61. package/packages/selector/src/client/CompressionProfileControls.tsx +0 -352
  62. package/packages/selector/src/client/CompressionProfileSelector.module.css +0 -199
  63. package/packages/selector/src/client/CompressionProfileSelector.tsx +0 -89
  64. package/packages/selector/src/client/CustomPolicyEditor.tsx +0 -216
  65. package/packages/selector/src/client/EstimatorControls.tsx +0 -277
  66. package/packages/selector/src/client/bridge-scope.ts +0 -125
  67. package/packages/selector/src/client/decode.ts +0 -68
  68. package/packages/selector/src/client/fab-pos.ts +0 -71
  69. package/packages/selector/src/client/index.ts +0 -438
  70. package/packages/selector/src/client/locales/de.ts +0 -167
  71. package/packages/selector/src/client/locales/es.ts +0 -167
  72. package/packages/selector/src/client/locales/fr.ts +0 -167
  73. package/packages/selector/src/client/locales/it.ts +0 -167
  74. package/packages/selector/src/client/locales/ja.ts +0 -167
  75. package/packages/selector/src/client/locales/ko.ts +0 -167
  76. package/packages/selector/src/client/locales/ru.ts +0 -167
  77. package/packages/selector/src/client/locales.ts +0 -334
  78. package/packages/selector/src/client/monitor-fab.ts +0 -445
  79. package/packages/selector/src/client/preset-options.ts +0 -88
  80. package/packages/selector/src/client/savings-card.tsx +0 -269
  81. package/packages/selector/src/client/scope-face.ts +0 -24
  82. package/packages/selector/src/client/settings-section.tsx +0 -156
  83. package/packages/selector/src/compat/host-generation.ts +0 -96
  84. package/packages/selector/src/compat/llm-messages.ts +0 -50
  85. package/packages/selector/src/compat/settings-lease.ts +0 -108
  86. package/packages/selector/src/compat/tool-result.ts +0 -91
  87. package/packages/selector/src/css-modules.d.ts +0 -6
  88. package/packages/selector/src/deepseek-v4-tokenizer.ts +0 -205
  89. package/packages/selector/src/estimator-catalog.ts +0 -104
  90. package/packages/selector/src/index.ts +0 -890
  91. package/packages/selector/src/invariant.ts +0 -113
  92. package/packages/selector/src/preset-overlay.ts +0 -749
  93. package/packages/selector/src/profiles.ts +0 -554
  94. package/packages/selector/src/pruner/content.ts +0 -199
  95. package/packages/selector/src/pruner/session.ts +0 -97
  96. package/packages/selector/src/pruner/state.ts +0 -61
  97. package/packages/selector/src/pruner/tuning.ts +0 -23
  98. package/packages/selector/src/pruner/types.ts +0 -78
  99. package/packages/selector/src/pruner.ts +0 -3222
  100. package/packages/selector/src/runtime/adaptive-cost.ts +0 -205
  101. package/packages/selector/src/runtime/audit.ts +0 -321
  102. package/packages/selector/src/runtime/config.ts +0 -887
  103. package/packages/selector/src/runtime/custom-policy.ts +0 -300
  104. package/packages/selector/src/runtime/deepseek-official-pricing.ts +0 -298
  105. package/packages/selector/src/runtime/deepseek-v4-vision-tokens.ts +0 -254
  106. package/packages/selector/src/runtime/display-prefs.ts +0 -98
  107. package/packages/selector/src/runtime/fold-router.ts +0 -143
  108. package/packages/selector/src/runtime/measurement.ts +0 -444
  109. package/packages/selector/src/runtime/monitor.ts +0 -341
  110. package/packages/selector/src/runtime/panel-command.ts +0 -213
  111. package/packages/selector/src/runtime/reducers.ts +0 -1755
  112. package/packages/selector/src/runtime/retrieve.ts +0 -505
  113. package/packages/selector/src/runtime/savings-integral.ts +0 -117
  114. package/packages/selector/src/runtime/savings-projection.ts +0 -229
  115. package/packages/selector/src/runtime/savings-verify.ts +0 -446
  116. package/packages/selector/src/runtime/savings.ts +0 -526
  117. package/packages/selector/src/runtime/sediment-card.ts +0 -126
  118. package/packages/selector/src/runtime/sediment-clock.ts +0 -87
  119. package/packages/selector/src/runtime/sediment-guard.ts +0 -136
  120. package/packages/selector/src/runtime/sediment-publish.ts +0 -144
  121. package/packages/selector/src/runtime/sediment-span.ts +0 -170
  122. package/packages/selector/src/runtime/sediment.ts +0 -209
  123. package/packages/selector/src/runtime/session-events.ts +0 -30
  124. package/packages/selector/src/runtime/session-file-decode.ts +0 -523
  125. package/packages/selector/src/runtime/shallow-tools.ts +0 -342
  126. package/packages/selector/src/runtime/stats-backfill.ts +0 -541
  127. package/packages/selector/src/runtime/stats-db.ts +0 -492
  128. package/packages/selector/src/runtime/stats-schema.ts +0 -123
  129. package/packages/selector/src/runtime/stats-sync.ts +0 -307
  130. package/packages/selector/src/runtime/summary-command.ts +0 -127
  131. package/packages/selector/src/runtime/tail-trim.ts +0 -177
  132. package/packages/selector/src/runtime/token-count.ts +0 -72
  133. package/packages/selector/src/runtime/tokenpilot/advisor-prompt.ts +0 -233
  134. package/packages/selector/src/runtime/tokenpilot/advisor-state.ts +0 -204
  135. package/packages/selector/src/runtime/tokenpilot/advisor.ts +0 -419
  136. package/packages/selector/src/runtime/tokenpilot/benefit.ts +0 -200
  137. package/packages/selector/src/runtime/tokenpilot/dedup.ts +0 -82
  138. package/packages/selector/src/runtime/tokenpilot/estimator.ts +0 -151
  139. package/packages/selector/src/runtime/tokenpilot/intent-fold.ts +0 -53
  140. package/packages/selector/src/runtime/tokenpilot/intent-gate.ts +0 -65
  141. package/packages/selector/src/runtime/tokenpilot/intent-input-mask.ts +0 -125
  142. package/packages/selector/src/runtime/tokenpilot/intent-range.ts +0 -37
  143. package/packages/selector/src/runtime/tokenpilot/locator.ts +0 -129
  144. package/packages/selector/src/runtime/tokenpilot/read-state.ts +0 -98
  145. package/packages/selector/src/runtime/tokenpilot/sidechannel.ts +0 -303
  146. package/packages/selector/src/runtime/tool-names.ts +0 -42
  147. package/packages/selector/src/runtime/toolclass.ts +0 -103
  148. package/packages/selector/src/runtime/triage/masks.ts +0 -128
  149. package/packages/selector/src/runtime/triage/shallow.ts +0 -132
  150. package/packages/selector/src/runtime/triage/signals.ts +0 -167
  151. package/packages/selector/src/runtime/triage/types.ts +0 -125
  152. package/packages/selector/src/runtime/types.ts +0 -396
  153. package/packages/selector/src/runtime/value.ts +0 -48
  154. package/packages/selector/src/settings-bridge.ts +0 -175
  155. package/packages/selector/tests/advisor-report.host.spec.ts +0 -223
  156. package/packages/selector/tests/auto-compact.client.spec.tsx +0 -214
  157. package/packages/selector/tests/built/client-artifact.spec.ts +0 -56
  158. package/packages/selector/tests/cache-prefix-audit.spec.ts +0 -123
  159. package/packages/selector/tests/code-skeleton.client.spec.ts +0 -98
  160. package/packages/selector/tests/compat/compat-narrow-waist.spec.ts +0 -150
  161. package/packages/selector/tests/custom-contract.client.spec.ts +0 -226
  162. package/packages/selector/tests/estimator-catalog.spec.ts +0 -70
  163. package/packages/selector/tests/estimator-channel.client.spec.tsx +0 -253
  164. package/packages/selector/tests/estimator-route-registration.host.spec.ts +0 -202
  165. package/packages/selector/tests/fab-pos.client.spec.ts +0 -47
  166. package/packages/selector/tests/fixtures/sediment-pool/52adc205-cloud-5.orig.txt +0 -231
  167. package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-cloud-25.orig.txt +0 -236
  168. package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-cloud-38.orig.txt +0 -220
  169. package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-cloud-42.orig.txt +0 -140
  170. package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-cloud-53.orig.txt +0 -117
  171. package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-local-10.orig.txt +0 -67
  172. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-45.orig.txt +0 -119
  173. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-49.orig.txt +0 -119
  174. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-63.orig.txt +0 -131
  175. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-75.orig.txt +0 -196
  176. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-76.orig.txt +0 -71
  177. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-85.orig.txt +0 -126
  178. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-86.orig.txt +0 -86
  179. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-87.orig.txt +0 -50
  180. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-96.orig.txt +0 -102
  181. package/packages/selector/tests/helpers/legacy-namespace.ts +0 -35
  182. package/packages/selector/tests/helpers/legacy-settings/index.ts +0 -15
  183. package/packages/selector/tests/helpers/legacy-settings/legacy/provider.d.ts +0 -41
  184. package/packages/selector/tests/helpers/legacy-settings/legacy/provider.js +0 -647
  185. package/packages/selector/tests/helpers/legacy-settings/legacy/redact.js +0 -78
  186. package/packages/selector/tests/helpers/legacy-settings/legacy/util-values.js +0 -234
  187. package/packages/selector/tests/host-preset-overlay.host.spec.ts +0 -204
  188. package/packages/selector/tests/monitor-fab.client.spec.ts +0 -240
  189. package/packages/selector/tests/preset-options-write.client.spec.ts +0 -192
  190. package/packages/selector/tests/preset-overlay-loader.e2e.host.spec.ts +0 -200
  191. package/packages/selector/tests/preset-overlay.host.spec.ts +0 -246
  192. package/packages/selector/tests/profiles.client.spec.tsx +0 -436
  193. package/packages/selector/tests/ptc-custom-write.client.spec.ts +0 -86
  194. package/packages/selector/tests/public/package-contract.client.spec.ts +0 -89
  195. package/packages/selector/tests/runtime/adaptive-cost.spec.ts +0 -167
  196. package/packages/selector/tests/runtime/advice-never-withholds.host.spec.ts +0 -230
  197. package/packages/selector/tests/runtime/advisor-invariant.spec.ts +0 -272
  198. package/packages/selector/tests/runtime/advisor.spec.ts +0 -226
  199. package/packages/selector/tests/runtime/audit.spec.ts +0 -275
  200. package/packages/selector/tests/runtime/auto-compact-config.spec.ts +0 -523
  201. package/packages/selector/tests/runtime/char-basis.spec.ts +0 -30
  202. package/packages/selector/tests/runtime/code-skeleton.spec.ts +0 -152
  203. package/packages/selector/tests/runtime/deepseek-official-pricing.spec.ts +0 -186
  204. package/packages/selector/tests/runtime/deepseek-v4-tokenizer.spec.ts +0 -122
  205. package/packages/selector/tests/runtime/deepseek-v4-vision-tokens.spec.ts +0 -122
  206. package/packages/selector/tests/runtime/deprecated-preset-options.spec.ts +0 -96
  207. package/packages/selector/tests/runtime/fixtures/profile-baseline.json +0 -273
  208. package/packages/selector/tests/runtime/fixtures/session-v4-dump.jsonl +0 -46
  209. package/packages/selector/tests/runtime/fixtures/tokenizer-golden.json +0 -106
  210. package/packages/selector/tests/runtime/fixtures/vision-golden.json +0 -459
  211. package/packages/selector/tests/runtime/fold-router.spec.ts +0 -140
  212. package/packages/selector/tests/runtime/frequency-longstrings.spec.ts +0 -74
  213. package/packages/selector/tests/runtime/fresh-gate.spec.ts +0 -43
  214. package/packages/selector/tests/runtime/html-reducer.spec.ts +0 -212
  215. package/packages/selector/tests/runtime/intent-gate.spec.ts +0 -62
  216. package/packages/selector/tests/runtime/intent-summary.spec.ts +0 -156
  217. package/packages/selector/tests/runtime/jsonl-reducer.spec.ts +0 -79
  218. package/packages/selector/tests/runtime/line-mapping.spec.ts +0 -153
  219. package/packages/selector/tests/runtime/monitor.spec.ts +0 -354
  220. package/packages/selector/tests/runtime/panel-command.spec.ts +0 -101
  221. package/packages/selector/tests/runtime/prose-reducers.spec.ts +0 -133
  222. package/packages/selector/tests/runtime/ptc-profile.spec.ts +0 -133
  223. package/packages/selector/tests/runtime/public/public-runtime.spec.ts +0 -2795
  224. package/packages/selector/tests/runtime/read-input-cap.spec.ts +0 -33
  225. package/packages/selector/tests/runtime/savings-accounting.spec.ts +0 -291
  226. package/packages/selector/tests/runtime/savings-integral.spec.ts +0 -169
  227. package/packages/selector/tests/runtime/savings-projection.spec.ts +0 -89
  228. package/packages/selector/tests/runtime/savings-verify.spec.ts +0 -226
  229. package/packages/selector/tests/runtime/savings.spec.ts +0 -139
  230. package/packages/selector/tests/runtime/search-reducer.spec.ts +0 -110
  231. package/packages/selector/tests/runtime/sediment-card.spec.ts +0 -111
  232. package/packages/selector/tests/runtime/sediment-config.spec.ts +0 -56
  233. package/packages/selector/tests/runtime/sediment-guard.spec.ts +0 -71
  234. package/packages/selector/tests/runtime/sediment-masks.spec.ts +0 -95
  235. package/packages/selector/tests/runtime/sediment-orchestrator.spec.ts +0 -166
  236. package/packages/selector/tests/runtime/sediment-pool-share.spec.ts +0 -65
  237. package/packages/selector/tests/runtime/sediment-publish.spec.ts +0 -142
  238. package/packages/selector/tests/runtime/sediment-real-shapes.spec.ts +0 -158
  239. package/packages/selector/tests/runtime/sediment-settings.spec.ts +0 -73
  240. package/packages/selector/tests/runtime/sediment-signals.spec.ts +0 -124
  241. package/packages/selector/tests/runtime/sediment-span.spec.ts +0 -92
  242. package/packages/selector/tests/runtime/session-events.spec.ts +0 -27
  243. package/packages/selector/tests/runtime/session-file-decode.spec.ts +0 -281
  244. package/packages/selector/tests/runtime/settings-unwrap.spec.ts +0 -58
  245. package/packages/selector/tests/runtime/shallow-primitives.spec.ts +0 -135
  246. package/packages/selector/tests/runtime/sidechannel.spec.ts +0 -241
  247. package/packages/selector/tests/runtime/stats-backfill-scheduler.spec.ts +0 -167
  248. package/packages/selector/tests/runtime/stats-backfill.spec.ts +0 -350
  249. package/packages/selector/tests/runtime/stats-db.spec.ts +0 -361
  250. package/packages/selector/tests/runtime/stats-privacy.spec.ts +0 -55
  251. package/packages/selector/tests/runtime/stats-sync.spec.ts +0 -278
  252. package/packages/selector/tests/runtime/summary-command.spec.ts +0 -154
  253. package/packages/selector/tests/runtime/toc-and-bundled.spec.ts +0 -159
  254. package/packages/selector/tests/runtime/tokenizer-golden.spec.ts +0 -53
  255. package/packages/selector/tests/runtime/tokenpilot/benefit.spec.ts +0 -217
  256. package/packages/selector/tests/runtime/tokenpilot/dedup.spec.ts +0 -52
  257. package/packages/selector/tests/runtime/tokenpilot/estimator.spec.ts +0 -79
  258. package/packages/selector/tests/runtime/tokenpilot/locator.spec.ts +0 -76
  259. package/packages/selector/tests/runtime/tokenpilot/profile-baseline.spec.ts +0 -121
  260. package/packages/selector/tests/runtime/tokenpilot/read-state.spec.ts +0 -82
  261. package/packages/selector/tests/runtime/toolclass.spec.ts +0 -156
  262. package/packages/selector/tests/runtime/value.spec.ts +0 -23
  263. package/packages/selector/tests/savings-sessions.client.spec.tsx +0 -140
  264. package/packages/selector/tests/settings-seat.client.spec.ts +0 -215
  265. package/packages/selector/tests/standing-generation.host.spec.ts +0 -724
  266. package/packages/selector/tests/subagent-cache-reuse.host.spec.ts +0 -269
  267. package/packages/selector/tests/support/cache-prefix-audit.ts +0 -105
  268. package/packages/selector/tests/support/mock-adapter.ts +0 -37
  269. package/packages/selector/tests/support/ui-primitives.tsx +0 -34
  270. package/packages/selector/tsconfig.json +0 -11
  271. package/packages/selector/tsdown.client.config.ts +0 -102
  272. package/packages/selector/tsdown.config.ts +0 -20
  273. package/pnpm-workspace.yaml +0 -76
  274. package/scripts/capture-profile-baseline.mjs +0 -42
  275. package/scripts/cell-browser-e2e.mjs +0 -354
  276. package/scripts/generate-tokenizer-fixtures.py +0 -81
  277. package/scripts/generate-vision-fixtures.py +0 -208
  278. package/scripts/hosts.d.mts +0 -3
  279. package/scripts/hosts.mjs +0 -81
  280. package/scripts/packed-components-smoke.mjs +0 -763
  281. package/scripts/packed-install-e2e.mjs +0 -1346
  282. package/scripts/sediment-latency-report.mjs +0 -63
  283. package/scripts/sync-hosts.mjs +0 -174
  284. package/scripts/toolclass-corpus-replay.mjs +0 -281
  285. package/scripts/verify-release.mjs +0 -343
  286. package/tests/TEST_INVENTORY.md +0 -41
  287. package/tsconfig.base.json +0 -18
  288. package/tsconfig.json +0 -7
  289. package/tsconfig.tests.json +0 -15
  290. package/vitest.built.config.ts +0 -9
  291. package/vitest.config.ts +0 -54
  292. /package/{packages/selector/assets → assets}/deepseek-v4/LICENSE.DeepSeek-V4-Pro.txt +0 -0
  293. /package/{packages/selector/assets → assets}/deepseek-v4/manifest.json +0 -0
  294. /package/{packages/selector/assets → assets}/deepseek-v4/tokenizer.json +0 -0
  295. /package/{packages/selector/assets → assets}/deepseek-v4/tokenizer_config.json +0 -0
  296. /package/{packages/selector/assets → assets}/deepseek-v4-vision-exp/LICENSE.DeepSeek-V4-Flash-Vision-Exp.txt +0 -0
  297. /package/{packages/selector/assets → assets}/deepseek-v4-vision-exp/manifest.json +0 -0
  298. /package/{packages/selector/assets → assets}/deepseek-v4-vision-exp/tokenizer.json +0 -0
  299. /package/{packages/selector/assets → assets}/deepseek-v4-vision-exp/tokenizer_config.json +0 -0
  300. /package/{packages/selector/cordis.patch.yml → cordis.patch.yml} +0 -0
  301. /package/{packages/selector/lib → lib}/client.d.ts +0 -0
  302. /package/{packages/selector/lib → lib}/client.js +0 -0
  303. /package/{packages/selector/lib → lib}/index.d.ts +0 -0
  304. /package/{packages/selector/lib → lib}/invariant.d.ts +0 -0
  305. /package/{packages/selector/lib → lib}/invariant.js +0 -0
  306. /package/{packages/selector/lib → lib}/profiles.d.ts +0 -0
  307. /package/{packages/selector/lib → lib}/pruner.d.ts +0 -0
  308. /package/{packages/selector/lib → lib}/pruner.js +0 -0
  309. /package/{packages/selector/lib → lib}/savings-integral.js +0 -0
  310. /package/{packages/selector/lib → lib}/tail-trim.js +0 -0
  311. /package/{packages/selector/lib → lib}/tool-result.js +0 -0
@@ -1,46 +0,0 @@
1
- # Shallow/Discard 教学补丁行模板(preset-overlay 通道,T4.13)
2
-
3
- > 用途:Flash 精简类(PTC/code-mode)preset 的 author 把以下 section 行并入 preset 的
4
- > systemPrompt 组合,即可在**该 preset 内**启用弃对协议教学;非 PTC preset 不引用则零注入。
5
- > 插件侧的运行时兜底(对所有 preset 生效的最小指导)在
6
- > `packages/selector/src/runtime/shallow-tools.ts` 的 `systemPrompt.section`,
7
- > 本文是它的**按 preset 加强版**,不是替代品。
8
-
9
- ## 补丁行(YAML,进 preset 的 systemPrompt sections)
10
-
11
- ```yaml
12
- - id: context-compression-shallow-teaching
13
- section: tool:context-compression-shallow
14
- order: 115
15
- text: |
16
- Large-file reading protocol (code mode):
17
- 1. PROBE FIRST. Before reading a file larger than ~3K tokens, call
18
- context_compression_probe with its path; it returns the recommended
19
- shallow view in O(1) without opening the body.
20
- 2. MAP BEFORE BODY. Prefer context_compression_shallow to get the
21
- declaration/outline/key-map view plus its checkpoint line
22
- ([cci-checkpoint] path | coverage | ref | fingerprint). Decide the
23
- needed line window from the map, then read only that window.
24
- 3. PAIR AND RELEASE. A full read of a file that has a live shallow map
25
- carries a [cci-shallow-pair] footer. When the map is superseded, call
26
- context_compression_discard with both refs; the guard refuses when the
27
- covering read does not span the map. The checkpoint line always
28
- survives; retrieve by ref recovers any body on demand.
29
- 4. NEVER reconstitute withheld or discarded output from memory; the ref
30
- in the checkpoint/footer is the recovery path.
31
- ```
32
-
33
- ## 接线核对清单(preset author)
34
-
35
- - [ ] 目标 preset 是 PTC/code-mode 形态(wire 上只暴露 run_code / code_run)
36
- - [ ] section `order: 115` 不与宿主既有 tool section 冲突(114 为 retrieve)
37
- - [ ] preset 引用的 selector 模块版本 ≥ 本分支(含 shallow-tools 注册)
38
- - [ ] 非 PTC preset 保持不引用本 section(默认零教学噪声)
39
-
40
- ## 与运行时兜底的关系
41
-
42
- | 层 | 生效范围 | 内容 |
43
- |---|---|---|
44
- | 工具 description(静态) | 全部 | 一句话用途 + PTC_BINDING_NOTE |
45
- | `systemPrompt.section`(运行时注入) | 全部 | 最小三步指导(probe→shallow→discard 名称与用途) |
46
- | 本 preset 补丁行 | 仅引用的 preset | 完整四步协议 + 反补写纪律 |
package/eslint.config.js DELETED
@@ -1,30 +0,0 @@
1
- import js from '@eslint/js'
2
- import globals from 'globals'
3
- import tseslint from 'typescript-eslint'
4
-
5
- export default tseslint.config(
6
- {
7
- ignores: ['**/node_modules/**', '**/lib/**', '**/dist/**', '**/coverage/**', 'docs/**'],
8
- },
9
- js.configs.recommended,
10
- ...tseslint.configs.recommended,
11
- {
12
- files: ['packages/**/*.{ts,tsx}', 'scripts/**/*.{js,mjs}', 'eslint.config.js'],
13
- languageOptions: {
14
- globals: { ...globals.browser, ...globals.node },
15
- },
16
- rules: {
17
- '@typescript-eslint/no-unused-vars': ['error', {
18
- argsIgnorePattern: '^_',
19
- varsIgnorePattern: '^_',
20
- caughtErrorsIgnorePattern: '^_',
21
- destructuredArrayIgnorePattern: '^_',
22
- }],
23
- },
24
- },
25
- {
26
- // Terminal normalization intentionally matches ANSI/BEL control characters.
27
- files: ['packages/selector/src/runtime/reducers.ts'],
28
- rules: { 'no-control-regex': 'off' },
29
- },
30
- )
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 WilliamShi666
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,26 +0,0 @@
1
- # dsh-context-compression-improved
2
-
3
- The installable Product Bundle for the unofficial community DeepSeek Harness context-compression selector.
4
-
5
- **0.1.0 highlights:** DeepSeek V4 Flash Vision's official tokenizer is included; users can choose the model-driven Auto Compact threshold; standard profile watermarks and compression parameters follow that choice.
6
-
7
- ```sh
8
- ```sh
9
- dsh plugin --profile web add dsh-context-compression-improved@dsh-0.1.5
10
- # DSH 0.1.2 line:
11
- # dsh plugin --profile web add dsh-context-compression-improved@dsh-0.1.2
12
- dsh --profile web --dump-config
13
- ```
14
- dsh --profile web --dump-config
15
- ```
16
-
17
- This one command installs the single `dsh-context-compression-improved` package: the compression
18
- runtime, the Host settings, the Web UI and the reversible preset overlay all ship in it.
19
- The Bundle contributes Host settings, the Web UI, and a reversible preset overlay. All presets
20
- except the exact built-in `minimal` id receive the compression stack; switching non-Minimal
21
- presets preserves the saved selector settings. Minimal pauses plugin compression without
22
- deleting the setting.
23
-
24
- Verified compatibility: DeepSeek Harness `dsh-v0.1.1-rc.2` and `dsh-v0.1.2-alpha.5`, Node `^22.19.0 || >=24`. No Harness core patch is required.
25
-
26
- See the [full README](https://github.com/WilliamShi666/dsh-context-compression-improved#readme) for profiles, defaults, audit evidence, Adaptive/cache limitations, upgrade/removal, and security guidance. This package is not affiliated with or endorsed by DeepSeek.
@@ -1,24 +0,0 @@
1
- # dsh-context-compression-improved
2
-
3
- 这是可直接安装的非官方社区 DeepSeek Harness 上下文压缩选择器 Product Bundle。
4
-
5
- **0.1.0 更新:**已加入 DeepSeek V4 Flash 视觉模型的官方 tokenizer;用户可选择模型驱动 Auto Compact 的触发阈值;标准 Profile 的水位与压缩参数会随该选择联动。
6
-
7
- ```sh
8
- ```sh
9
- dsh plugin --profile web add dsh-context-compression-improved@dsh-0.1.5
10
- # DSH 0.1.2 line:
11
- # dsh plugin --profile web add dsh-context-compression-improved@dsh-0.1.2
12
- dsh --profile web --dump-config
13
- ```
14
- dsh --profile web --dump-config
15
- ```
16
-
17
- 这一条命令安装单一的 `dsh-context-compression-improved` 包:压缩运行时、Host 设置、Web UI
18
- 与可逆 preset overlay 全部包含在其中。除 id 精确等于内置 `minimal` 的 preset 外,
19
- 其他 preset 都会获得压缩能力;非 Minimal preset 之间切换时已保存设置保持不变。
20
- Minimal 只暂停插件压缩,不删除设置。
21
-
22
- 已验证兼容 DeepSeek Harness `dsh-v0.1.1-rc.2` 与 `dsh-v0.1.2-alpha.5`,Node `^22.19.0 || >=24`。不需要修改 Harness 核心。
23
-
24
- Profile、默认值、审计证据、Adaptive/cache 限制、升级/卸载与安全说明见[完整 README](https://github.com/WilliamShi666/dsh-context-compression-improved#readme)。本包与 DeepSeek 无隶属或背书关系。
@@ -1,32 +0,0 @@
1
- # Third-party notices
2
-
3
- Portions of this package are adapted from the MIT-licensed DeepSeek Harness, verified against `dsh-v0.1.1-rc.2` (`b150a551b8d465e31e418e1b2eaf5e79bbb7d28e`).
4
-
5
- ## DeepSeek Harness MIT notice
6
-
7
- Copyright (c) 2026 DeepSeek
8
-
9
- Permission is hereby granted, free of charge, to any person obtaining a copy
10
- of this software and associated documentation files (the "Software"), to deal
11
- in the Software without restriction, including without limitation the rights
12
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
- copies of the Software, and to permit persons to whom the Software is
14
- furnished to do so, subject to the following conditions:
15
-
16
- The above copyright notice and this permission notice shall be included in all
17
- copies or substantial portions of the Software.
18
-
19
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
- SOFTWARE.
26
-
27
- This package carries the official DeepSeek tokenizer assets, with their exact license and
28
- provenance manifests, under `assets/`.
29
-
30
- This package depends on `js-yaml` under MIT; its production dependency `argparse` is licensed under Python-2.0. Their NPM packages carry the dependency license texts.
31
-
32
- This is an unofficial community package and is not endorsed by DeepSeek.
@@ -1,112 +0,0 @@
1
- # History / microcompact:按 agent 工具调用保护近期工作集
2
-
3
- 状态:提案,尚未实现
4
-
5
- ## 目标与边界
6
-
7
- 将插件的 History / microcompact 从“保护最近若干个 Harness turn 加一个 token 尾窗”改为“超过该 Profile 的 History 触发阈值后,保护最近 10 次已完成的 agent 工具调用”。这是一项面向所有插件 Profile 的策略变更,不是只为 Balanced 调整。
8
-
9
- 所有实现只修改本仓库的 runtime、selector UI、配置、审计、测试和 npm Bundle。不得修改 DeepSeek Harness 核心、会话事件格式、内置压缩器、provider 或 DSH UI。插件继续只消费现有公开的 `tool/call`、`tool/result` 和 Session surface API。
10
-
11
- 此前发现的 `deepseek-official` tokenizer route alias 是独立的插件内兼容性修复:需回填到本仓库的 `measurement.ts` 并测试,但不属于本 History 策略改动。
12
-
13
- ## 现有问题
14
-
15
- 当前 History 用外层 `turn` 保护近期内容。一个 turn 通常是一次用户消息驱动的 agent 处理周期,不是一次工具调用:一次“探索代码库”的用户请求可以在同一 turn 内产生几十个 Bash、Read、Grep 或 Web 调用。这样它们会被整体保护,即使其中大部分已经很旧;反过来,连续输入几条没有工具输出的用户消息也会推进保护窗口。
16
-
17
- 用户消息不是 History 的可替换对象,保护它们的外层 turn 对 History 没有实际约束意义。现有的 `historyKeepRecentTokens` 也会让“近期保护”取决于个别结果的大小,而不是 agent 最近实际使用过的工具交互数量。
18
-
19
- ## 统一语义
20
-
21
- ### 触发条件不变
22
-
23
- 每个 Profile 仍使用自己的 History gate、`historyTriggerTokens` 和 `historyMinReclaimTokens`。当且仅当:
24
-
25
- 1. 运行到了插件的 `pressure` 阶段;
26
- 2. Profile 的 History gate 允许执行;
27
- 3. 所有活动工具结果的精确 token 总数严格大于该 Profile 的 `historyTriggerTokens`;
28
-
29
- History 才会规划 microcompact。Fresh、Aggregate、Native 和 TailTrim 的各自 trigger/reducer 不因这条规则而变。
30
-
31
- ### 两部分近期工作集
32
-
33
- 一条可计数记录是一个仍在活动 surface 中、能按 `callId` 与 agent 发出的 `tool/call` 配对的 `tool/result`。计数顺序使用该调用在活动会话 surface 中的原始发生顺序,不能使用外层 turn,也不能使用之后压缩替换事件的 seq。
34
-
35
- - 精确保护最新 10 条已完成调用;不足 10 条时全部保护。
36
- - 用户消息、assistant 文本、`turn/start`、`turn/end`、`step/start`、`step/end` 都不计数,也不因它们的数量改变选择结果。
37
- - 尚未产生 `tool/result` 的未完成调用不占槽位,也不是压缩候选。
38
- - `context_compression_retrieve` 也算一次 agent 工具调用并占一个槽位,以保证“最后十次调用完全不动”的字面语义;但它本身继续永远不可被 History 重写。
39
- - 已经是 History 占位符的结果继续占槽位,但不能再次被 History 重写。
40
-
41
- 在调用数量保护之外,保留一个 `64000` token 的工具结果尾窗。从最新活动 `tool/result` 向较早结果逐条累计精确 token;每一条先加入保护集、再判断累计值是否已达到或超过 `64000`。因此,刚好使累计值跨过 `64000` 的那一条也受保护。这个尾窗同样不包含用户消息或 assistant 文本。
42
-
43
- 最终保护集是“最近 10 次调用保护集”和“最近 `64000` token 工具结果尾窗”的并集。排除它后,History 由旧到新选择安全结果,沿用现有可恢复占位符/富结果 reducer。达到 `max(historyMinReclaimTokens, totalTokens - historyTriggerTokens)` 后停止;若最终无法达到最小回收量,则整个 History 批次不提交。精确 tokenizer 不可用、结果形态不安全或 recovery tool 缺失时继续 fail-open。
44
-
45
- 删除 `historyKeepRecentTurns`,保留并将标准 Profile 的 `historyKeepRecentTokens` 统一为 `64000`。近期工作集因此同时保证最近工具交互数量和最近工具结果的内容规模。
46
-
47
- ## 各 Profile 的计划与初始参数
48
-
49
- 首版只替换“保护集的计算方法”,保留现有各 Profile 的触发和回收数值。这样可以先验证工作集语义,而不把“何时触发”“保留什么”“一次回收多少”三个变量同时改变。下表中的“建议首版”是待实现值;“后续调参”只有在带真实工具输出的可重复测试证明需要时才进行。
50
-
51
- | Profile | 当前/建议 History gate | 首版 trigger / 最小回收 | 近期保护 | 后续调参方向 |
52
- | --- | --- | --- | --- | --- |
53
- | `off` | disabled | 不触发 | 10 次调用 + `64000` token;无运行效果 | 无;保持关闭。 |
54
- | `native` | disabled | 不触发;Native 头-中-尾裁剪仍独立 | 10 次调用 + `64000` token;无运行效果 | 无;不得把 History 偷偷加入 Native。 |
55
- | `balanced` | `routine` | `500000 / 96000` tokens,保持不变 | 最近 10 次调用 + `64000` token 尾窗 | 作为基线。若保护集导致频繁无法达到 96k 回收,再只评估提高 trigger 或降低 min-reclaim 之一。 |
56
- | `cache-strict` | `capacity-pressure` | `600000 / 128000` tokens,保持不变;路由上下文利用率至少 `70%` | 最近 10 次调用 + `64000` token 尾窗 | 不降低 trigger;它以稳定已发送前缀为优先。只在已确认容量压力时改写。 |
57
- | `savings` | `routine` | `400000 / 128000` tokens | 最近 10 次调用 + `64000` token 尾窗 | 将 trigger 从 `450000` 提前到 `400000`,以更早回收旧工具结果;首版保留 `128000` 最小回收量,避免用一次很小的前缀改写交换缓存损失。 |
58
- | `adaptive` | `adaptive`,容量压力可覆盖 | `500000 / 96000` tokens,保持不变 | 最近 10 次调用 + `64000` token 尾窗 | 先让现有成本判断评估新的候选批次;没有连续官方 usage/价格证据时不调低门槛。 |
59
- | `custom` | `enabled + prefixPolicy` 决定 routine 或 capacity-pressure | 保留用户的 trigger/min-reclaim | 默认 10 次调用 + `64000` token 尾窗 | Custom v3 允许用户显式改两个保护值;默认/重置值为 10 与 `64000`。 |
60
-
61
- TailTrim 不属于 History / microcompact,但它目前复用 History 的近期保护 helper。为避免同一 helper 同时拥有两套语义,TailTrim 也使用同一个“最近 N 次工具调用 + token 尾窗”保护集;它的独立 trigger、完整工具组条件和 reducer 不变。
62
-
63
- ## 参数与配置改动
64
-
65
- 近期保护参数为:
66
-
67
- ```ts
68
- historyKeepRecentToolCalls: number
69
- historyKeepRecentTokens: number
70
- ```
71
-
72
- 前者是非负安全整数;标准 Profile 都解析为 `10`,它不是 token 数,不受 `tokens` / `context-percent` 单位切换影响。后者保留现有 token 尾窗语义,标准 Profile 都解析为 `64000`。即使 `off`、`native` 的 History 被禁用,解析后的策略结构仍完整一致。
73
-
74
- Custom 升为版本 3:
75
-
76
- ```ts
77
- history: {
78
- enabled: boolean
79
- trigger: number
80
- keepRecentToolCalls: number
81
- keepRecentTokens: number
82
- minReclaim: number
83
- }
84
- ```
85
-
86
- Custom 编辑器显示“保护近期工具调用数”和“保护近期工具结果尾窗”,默认值分别为 10 与 `64000`。保留 Custom 的可编辑性:标准 Profile 固定这些默认值,只有明确选择 Custom 的用户可以改变它们。若产品决定“Custom 也必须固定为这些值”,可在实现前删去两个输入框;其余算法不受影响。
87
-
88
- 已有 Custom v1/v2 设置继续可读:插件将它们规范化为 v3,将 `keepRecentToolCalls` 设为 10,并将用户原有的 `keepRecent` 原样迁移为 `keepRecentTokens`。下一次用户保存 Custom 时写回 v3。部署配置中使用已删除的 `historyKeepRecentTurns` 则在插件加载时明确报错,提示改用 `historyKeepRecentToolCalls`;`historyKeepRecentTokens` 继续受支持。
89
-
90
- ## 审计与可观测性
91
-
92
- `policy-frozen` 和 `policy-resolved` 记录新字段。History rewrite 仍记录 `component: "history"`、`stage: "pressure"`、History mode、reducer、精确 token 前后值和回收量。
93
-
94
- 为解释选择器结果,History 审计增加有限元数据:配置的保护调用数、尾窗 token 预算、活动已完成调用总数、实际受保护结果数。不得记录工具文本、工具参数、用户消息、call id 或 prompt。无需新增 DSH Session event 或修改 DSH 核心审计 schema。
95
-
96
- ## 验证计划
97
-
98
- 每个 History-enabled Profile 至少覆盖一次独立测试;不得只用 Balanced 证明实现。
99
-
100
- 1. 一个用户 turn 内连续完成至少 16 次调用并越过 trigger:最近 10 次总计约 `30000` token,继续向前累计到 `64000` token 的第 11 至第 15 次也不变;第 16 次(从最新向旧数)成为可选候选。
101
- 2. 将同一批调用切分到任意多个用户 turn:受保护和可压缩集合完全相同;只添加用户消息的 turn 不改变结果。
102
- 3. 包含并行调用、错误结果、富结果、已替换占位符和 `context_compression_retrieve`,验证计数顺序与不可重写规则。
103
- 4. `off` 和 `native` 即使工具输出很大也不执行 History;Native 仍按自己的逻辑运行。
104
- 5. Balanced、Savings 的 routine gate 在各自 trigger 之上执行;Cache Strict 只有确认容量压力时执行;Adaptive 在成本证据不足时跳过、容量压力时仍可执行;Custom 同时覆盖 routine 与 capacity-pressure。
105
- 6. 十条或更少调用、未达到 `64000` token 尾窗但所有调用都仍在尾窗内、精确 tokenizer 不可用、无安全候选或达不到最小回收量时,History 只留下可解释的跳过审计,不产生部分重写。
106
- 7. Custom v1/v2 规范化、v3 校验、浏览器输入、中文/英文文案、运行时公共测试、packed smoke、构建和 clean-install 发布验证均使用新字段。
107
-
108
- ## 风险与取舍
109
-
110
- 最近十条结果或 `64000` token 尾窗可能很大,导致旧结果不足以回收最小 token 数;此时跳过是对工作集保证的正确结果,而不是压缩器失效。Savings 的更激进候选参数必须先用同一任务的 token、缓存和结果可用性数据验证。
111
-
112
- 这会改变旧 Custom 文档的实际保留行为。将其统一为 10 次调用是可预测的迁移,但不等价于任何旧 turn/token 数。发布说明必须明确指出 Custom v3 和该语义变化。
@@ -1,34 +0,0 @@
1
- # 原生工具结果压缩接管规格
2
-
3
- ## 范围
4
-
5
- 本规格只约束选择器 Bundle 的工具结果压缩。不得修改 DeepSeek Harness 核心、内置 pruner、会话事件格式或 DSH UI。
6
-
7
- ## 机制
8
-
9
- 适用的 Harness preset 在插件的可逆 overlay 中移除 `@deepseek-ai/dsh-compaction-tool-result-pruner`,并以选择器 runtime 的同名 `toolResultPruner` 服务替换它。Harness 的 compaction-basic 继续调用这个公开服务;选择器据冻结的 Profile 决定允许哪一种 reducer。因此同一 Session 不会同时运行核心头尾裁剪和选择器 reducer。
10
-
11
- ## Profile 规则
12
-
13
- | Profile | 选择器原生风格头—中间—尾 reducer | 其他选择器路径 |
14
- | --- | --- | --- |
15
- | `native` | 允许 | Fresh、Aggregate、History、TailTrim 均关闭 |
16
- | `balanced` | 禁止 | 按 Balanced policy 运行 |
17
- | `cache-strict` | 禁止 | 按 Cache Strict policy 运行 |
18
- | `savings` | 禁止 | 按 Savings policy 运行 |
19
- | `adaptive` | 禁止 | 按 Adaptive policy 运行 |
20
- | `custom` | 禁止 | 只运行 Custom 明确启用的路径 |
21
- | `off` | 禁止 | 不运行选择器工具结果压缩 |
22
-
23
- 这里的“禁止”同时排除两条路径:overlay 已移除核心 `@deepseek-ai/dsh-compaction-tool-result-pruner`,解析后的 `nativeToolResultEnabled` 也为 `false`。因此不会生成 `component: "native-tool-result"` 的选择器 rewrite。`native-auto-compact` 是 Harness/模型独立机制,不受本规格控制。
24
-
25
- ## 会话冻结
26
-
27
- 选择器首次观察 Session 时冻结 Profile 与 Custom 文档。之后修改全局设置只能影响新 Session,不能让已经采用 Balanced、Savings、Cache Strict、Adaptive 或 Custom 的 Session 在中途重新启用头—中间—尾裁剪。
28
-
29
- ## 验收
30
-
31
- 1. `resolvePolicy()` 对 `balanced`、`cache-strict`、`savings`、`adaptive`、`custom` 返回 `nativeToolResultEnabled: false`,对 `native` 返回 `true`。
32
- 2. 插件 runtime 的 pressure pass 仅在 `nativeToolResultEnabled` 为 `true` 时计划 `native-tool-result` rewrite。
33
- 3. preset overlay 测试证明生成 composition 中没有核心 pruner,只有选择器 runtime 的同名服务。
34
- 4. 所有源代码改动限定在本仓库;不修改 Harness worktree。
@@ -1,46 +0,0 @@
1
- # Parent and child agent cache-prefix audit
2
-
3
- ## Scope
4
-
5
- This reference characterizes when DeepSeek Harness parent and child requests can present an identical prompt prefix to DeepSeek's automatic context cache. It does not add an explicit cache key, cache breakpoint, cache identifier, or client-side KV cache.
6
-
7
- The selector plugin owns settings registration and UI only. It has no hook into agent request construction, subagent session creation, or LLM serialization, so this work must not add runtime request behavior to the plugin or modify Harness core.
8
-
9
- ## Three separate questions
10
-
11
- Context inheritance asks whether a child session receives parent session events. A fork copies the parent event prefix through the last completed turn; a spawn starts without parent messages. The child metadata records the parent session and, for a fork, the seed length.
12
-
13
- Harness cache control asks whether Harness supplies a DeepSeek cache key or breakpoint across requests or sessions. The DeepSeek adapter serializes ordinary Chat Completions input and reads official usage fields; it supplies no explicit cache control.
14
-
15
- Server cache reuse asks whether byte-identical request prefixes can hit DeepSeek's automatic context cache. This is best-effort server behavior and is confirmed only when official response usage reports a positive `prompt_cache_hit_tokens` value. Latency and price are not evidence.
16
-
17
- ## Reuse characterization
18
-
19
- The test-only audit representation is versioned and canonical. Object keys are sorted recursively, while arrays retain their model-visible order. A SHA-256 fingerprint is computed over UTF-8 JSON containing the provider, model, system prompt, tool schemas, and inherited messages.
20
-
21
- A child is reusable only when it is a fork, declares parent-context inheritance, and its provider, model, system prompt, tools, and inherited messages equal the parent's stable envelope. Spawn mode, a changed persona or system prompt, changed tool schema or order, changed provider or model route, and changed history are rejected. The audit never repairs or concatenates mismatched contexts.
22
-
23
- The characterization does not guarantee that two independently assembled HTTP bodies have the same byte prefix: JSON property order and the child-only continuation still belong to the DeepSeek adapter. The live test captures the actual immutable agent-loop request options and compares the stable inherited envelope before allowing a cache-reuse claim.
24
-
25
- ## Safe evidence record
26
-
27
- An evidence event may contain only the audit version, prefix fingerprint, estimated shared-prefix tokens, parent and child session identifiers, mode, eligibility or reason, cache-read tokens, cache-miss tokens, observed prompt tokens, and confirmation status. It must not contain prompts, messages, tool arguments or results, tool schemas, permissions, environment values, credentials, or secrets.
28
-
29
- Usage is internally consistent only when `cacheReadTokens + cacheMissTokens` equals the observed prompt-token total. A positive cache-read count confirms a natural cache hit for that request. Missing or zero cache-read usage yields `unconfirmed`, never a claimed miss caused by Harness.
30
-
31
- ## TDD acceptance criteria
32
-
33
- The RED test imports an absent test-support module and defines the required behavior before implementation. The GREEN implementation remains under `tests/support` and exports no product runtime API.
34
-
35
- - Fork accepts an identical completed-turn prefix and produces the same fingerprint for parent and child views.
36
- - Spawn is ineligible because it does not inherit parent messages.
37
- - Persona, tool schema or order, provider, model, and history mismatches are ineligible.
38
- - Safe evidence records contain only the allowlisted fields and never contain representative secret or tool-result content.
39
- - Usage projection accepts hit plus miss equaling the prompt total and rejects inconsistent totals.
40
- - The existing selector runtime source remains unchanged, so disabling or omitting the plugin cannot affect agent requests.
41
- - A key-gated host-side live DeepSeek E2E test uses an isolated in-memory context and task-local `DSH_HOME`; it reports only sanitized usage evidence.
42
- - Existing fork, spawn, request-reconstruction, DeepSeek usage-projection, selector-plugin tests, the full build, and `git diff --check` pass.
43
-
44
- ## Operational boundaries
45
-
46
- Tests do not connect to the active web profile, start or restart a Harness service, deploy code, or write session logs outside the isolated test environment. The test-only implementation adds no product runtime API and does not alter active profile settings or service state.