dsh-context-compression-improved 0.2.1 → 0.3.0

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 (80) hide show
  1. package/.gitattributes +1 -1
  2. package/.github/workflows/ci.yml +1 -7
  3. package/CHANGELOG.ja.md +18 -21
  4. package/CHANGELOG.ko.md +17 -21
  5. package/CHANGELOG.md +16 -17
  6. package/CHANGELOG.zh.md +15 -18
  7. package/CONTRIBUTING.md +1 -1
  8. package/README.ja.md +1 -20
  9. package/README.ko.md +12 -30
  10. package/README.md +1 -19
  11. package/README.zh.md +5 -21
  12. package/THIRD_PARTY_NOTICES.md +2 -2
  13. package/docs/compat-0.1.5-report.md +77 -0
  14. package/docs/installation.ja.md +6 -4
  15. package/docs/installation.ko.md +9 -7
  16. package/docs/installation.md +3 -1
  17. package/docs/installation.zh.md +3 -2
  18. package/docs/repair-log.md +54 -33
  19. package/eslint.config.js +2 -2
  20. package/package.json +56 -36
  21. package/packages/selector/README.md +7 -12
  22. package/packages/selector/README.zh.md +6 -13
  23. package/packages/selector/THIRD_PARTY_NOTICES.md +2 -8
  24. package/packages/selector/cordis.patch.yml +7 -5
  25. package/packages/selector/dsh.plugin.json +2 -2
  26. package/packages/selector/lib/client.d.ts +31 -5
  27. package/packages/selector/lib/client.js +100 -82
  28. package/packages/selector/lib/index.d.ts +8 -20
  29. package/packages/selector/lib/index.js +9 -14
  30. package/packages/selector/lib/invariant.js +4 -4
  31. package/packages/selector/lib/pruner.d.ts +13 -4
  32. package/packages/selector/lib/pruner.js +91 -46
  33. package/packages/selector/lib/tail-trim.js +13 -4
  34. package/packages/selector/package.json +23 -23
  35. package/packages/selector/screenshots.json +1 -4
  36. package/packages/selector/src/client/CompressionProfileControls.tsx +5 -8
  37. package/packages/selector/src/client/CompressionProfileSelector.tsx +9 -5
  38. package/packages/selector/src/client/EstimatorControls.tsx +28 -32
  39. package/packages/selector/src/client/index.ts +101 -63
  40. package/packages/selector/src/client/locales.ts +0 -2
  41. package/packages/selector/src/client/preset-options.ts +49 -35
  42. package/packages/selector/src/client/settings-section.tsx +4 -6
  43. package/packages/selector/src/deepseek-v4-tokenizer.ts +0 -5
  44. package/packages/selector/src/index.ts +41 -46
  45. package/packages/selector/src/invariant.ts +5 -5
  46. package/packages/selector/src/pruner.ts +67 -36
  47. package/packages/selector/src/runtime/measurement.ts +6 -2
  48. package/packages/selector/src/runtime/session-events.ts +14 -1
  49. package/packages/selector/src/runtime/tail-trim.ts +4 -4
  50. package/packages/selector/src/runtime/tokenpilot/estimator.ts +34 -3
  51. package/packages/selector/src/runtime/types.ts +1 -1
  52. package/packages/selector/tests/auto-compact.client.spec.tsx +0 -13
  53. package/packages/selector/tests/built/client-artifact.spec.ts +5 -1
  54. package/packages/selector/tests/code-skeleton.client.spec.ts +2 -1
  55. package/packages/selector/tests/custom-contract.client.spec.ts +2 -1
  56. package/packages/selector/tests/estimator-channel.client.spec.tsx +16 -11
  57. package/packages/selector/tests/estimator-route-registration.host.spec.ts +12 -0
  58. package/packages/selector/tests/host-preset-overlay.host.spec.ts +6 -4
  59. package/packages/selector/tests/preset-options-write.client.spec.ts +87 -79
  60. package/packages/selector/tests/preset-overlay-loader.e2e.host.spec.ts +17 -12
  61. package/packages/selector/tests/preset-overlay.host.spec.ts +5 -2
  62. package/packages/selector/tests/profiles.client.spec.tsx +3 -3
  63. package/packages/selector/tests/public/package-contract.client.spec.ts +27 -3
  64. package/packages/selector/tests/runtime/public/public-runtime.spec.ts +103 -81
  65. package/packages/selector/tests/runtime/session-events.spec.ts +1 -1
  66. package/packages/selector/tests/settings-seat.client.spec.ts +86 -0
  67. package/packages/selector/tests/standing-generation.host.spec.ts +88 -71
  68. package/packages/selector/tests/subagent-cache-reuse.host.spec.ts +24 -21
  69. package/pnpm-workspace.yaml +52 -5
  70. package/scripts/capture-profile-baseline.mjs +42 -0
  71. package/scripts/generate-tokenizer-fixtures.py +5 -5
  72. package/scripts/generate-vision-fixtures.py +2 -2
  73. package/scripts/{packed-components-smoke.ts → packed-components-smoke.mjs} +116 -119
  74. package/scripts/{packed-install-e2e.ts → packed-install-e2e.mjs} +188 -160
  75. package/scripts/{verify-release.ts → verify-release.mjs} +70 -94
  76. package/tests/TEST_INVENTORY.md +6 -7
  77. package/scripts/capture-profile-baseline.ts +0 -80
  78. package/tsconfig.scripts.json +0 -13
  79. /package/{packages/selector/assets/screenshots → docs/assets}/context-compression-selector-profiles.jpg +0 -0
  80. /package/{packages/selector/assets/screenshots → docs/assets}/context-compression-selector-settings.png +0 -0
package/.gitattributes CHANGED
@@ -1 +1 @@
1
- packages/selector/assets/** -text
1
+ packages/selector/assets/** -text
@@ -18,18 +18,12 @@ jobs:
18
18
  version: 11.7.0
19
19
  - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
20
20
  with:
21
- node-version: 22.19.0
21
+ node-version: 24.0.0
22
22
  cache: pnpm
23
23
  - run: pnpm install --frozen-lockfile
24
24
  - run: pnpm lint
25
25
  - run: pnpm typecheck
26
26
  - run: pnpm build
27
- # scripts/ is compiled to the gitignored scripts-dist/, and nothing above this
28
- # point builds it. Without this step verify:release and test:e2e:packed both
29
- # die with MODULE_NOT_FOUND on a clean checkout — which is what kept this
30
- # workflow red on every push to main while the same gates passed locally,
31
- # where scripts-dist/ had been built by hand once.
32
- - run: pnpm build:scripts
33
27
  - run: pnpm test
34
28
  - run: pnpm --filter dsh-context-compression-improved test
35
29
  - run: pnpm test:built
package/CHANGELOG.ja.md CHANGED
@@ -2,24 +2,27 @@
2
2
 
3
3
  > 完全な履歴(アップストリーム 0.1.0 以前を含む)は [CHANGELOG.md](CHANGELOG.md) を参照。このファイルはフォークの追加エントリーのみを翻訳したものです。 · [English](CHANGELOG.md) · [中文](CHANGELOG.zh.md) · [한국어](CHANGELOG.ko.md)
4
4
 
5
- ## 0.1.1
6
-
7
- ### 追加
8
-
9
- - `scripts/` の TypeScript ツールチェーン:`verify-release`、`packed-components-smoke`、`packed-install-e2e` が `.ts` ソースになり、`tsc` で `scripts-dist/` にコンパイルされます。リポジトリ内の最後の3つの非 TS ヽースファイルが排除されました。
10
-
11
- ### 変更
12
-
13
- - `package.json` スクリプト `test:e2e:packed` `verify:release` が `scripts-dist/` のコンパイル成果物を実行するようになりました。
14
- - エスティメーターカタログルート登録が硬化:`asWebServer` がサービス自体を返すように修正(D7 修正)、エステーター UI が非アクティブ時にセクション見出しを保持するように修正(U1 修正)。
15
- - フレームワークドキュメント修正:行レベル `inject: [webServer]` は負荷担うものではない(Y22);DSH 全パッケージに `isolate()` なし。
5
+ ## Unreleased(未リリース)
6
+ ### Changed(0.1.5 互換 / compat/0.1.5 ブランチ)
7
+
8
+ - runtime パッケージを selector パッケージへ統合しました。1 回のインストールでスタック全体が入り、
9
+ リポジトリのルートがインストール面になります(`name`、`main`、`types`、`./pruner`
10
+ `./invariant` を含む `exports`、`dependencies`、`dsh`)。ツールチェーン・スクリプト・CI も
11
+ 単一パッケージへ揃えました。実機で検証済みの estimator-catalog ルート登録(二重プレフィックス、
12
+ 保護された二経路の有効化、リクエスト毎のサービス解決、可観測なライフサイクルログ)を本ラインへ
13
+ 再適用し、ホスト側のガードを追加しました。`ab2175a` `z.any()` に落とされていた settings
14
+ スキーマを復元し、Custom の既定値が再び公開されます。
15
+ - ブランチ上で公式 DeepSeek Harness `v0.1.5-rc.2` に適応。`@deepseek-ai/dsh-*` 全開発依存と e2e 公式ホスト一覧を `0.1.1-rc.2` から `0.1.5-rc.2` へ更新(cordis `4.0.2`、schemastery `3.18.2`、新分割パッケージ群と `dsh-client-store` クライアントスタックを含む)。
16
+ - surface 置換は v3 の `startSeq`/`endSeq` 形状とブランド化 `SessionSeq` を使用。surface node のイベント解決は配列インデックスではなく seq 検索に変更。
17
+ - クライアントバンドルは削除された `@deepseek-ai/dsh-client-runtime` を参照しない。settings 型は `@deepseek-ai/dsh-client-ui-settings`、セッション hooks は `@deepseek-ai/dsh-client-ui-session` から取得。`engines.dsh >=0.1.5-alpha.1 <0.2.0-0` を宣言。
18
+ - Harness 0.1.5 はセッション `agentPreset` をブラウザへ公開しないため、クライアント側で Minimal セッションを検出できない。セレクターは選択可能なまま。
19
+ - テストを 0.1.5 のセマンティクスに更新(`.await()`、`SessionProjectionRegistry`、`stream: []`、文字列の settings 名前空間)。
16
20
 
17
21
  ### 修正
18
22
 
19
- - エスティメーターカタログルートは `asWebServer` `register` をサービスから切り離したため、最初から一度も登録されなかった(D7)。
20
- - TokenPilot プロファイル時にエステーターセクションが警告なしに非表示になっていた(U1)。
21
-
22
- ## Unreleased(未リリース)
23
+ - エスティメーターカードは Harness ホストチャネルで API キーを要求しなくなりました。ホストチャネルを選ぶと、ライブのプロバイダー/モデル ドロップダウンが表示され、実際に使われるルート(明示的な上書き、なければセッション既定モデル)を明示します。キー入力欄と 2 つ目の手入力モデル欄は表示されません — エンドポイント URL、モデルのテキスト欄、書き込み専用キーはダイレクト接続チャネルだけに属します。
24
+ - `presetOptions` の書き込みをパス指定方式に変更しました。従来はセクション全体を置き換えていたため、エスティメーターの 2 つ目のフィールド(プロバイダー、モデル、エンドポイント)に触れると `estimatorMode` と他のすべての上書きが削除され、パネルは保存成功と表示したままエスティメーターが静かにオフへ戻っていました。現在は各フィールドが自分のパスだけを書き込み、`undefined` は指定したフィールドだけを消去し、confirm-on-write はチャネル単独ではなく同じフィールド群を検証します。
25
+ - 回帰カバレッジを追加:`packages/selector/tests/preset-options-write.client.spec.ts`(パス単位の書き込み、兄弟フィールドの保持、明示的な消去、変更なし時の無書き込み、未コミット書き込みの報告)と `packages/selector/tests/estimator-channel.client.spec.tsx`(チャネル別フィールド、カタログのドロップダウン、手入力フォールバック)。
23
26
 
24
27
  ### 追加
25
28
 
@@ -31,9 +34,3 @@
31
34
 
32
35
  - ESLint フラット設定ベースライン(`pnpm lint`、CI でも強制)と `pnpm test:watch` による TDD ループを追加。デッドインポートを整理し、lint ベースラインで浮かび上がった 2 つのエラー経路を強化しました。
33
36
  - 本リポジトリは `WilliamShi666/dsh-context-compression-selector` の改良フォークとして管理されます。ドキュメントは英語・簡体字中国語・日本語・韓国語で提供されます。
34
-
35
- ### 修正
36
-
37
- - エスティメーターカードは Harness ホストチャネルで API キーを要求しなくなりました。ホストチャネルを選ぶと、ライブのプロバイダー/モデル ドロップダウンが表示され、実際に使われるルート(明示的な上書き、なければセッション既定モデル)を明示します。キー入力欄と 2 つ目の手入力モデル欄は表示されません — エンドポイント URL、モデルのテキスト欄、書き込み専用キーはダイレクト接続チャネルだけに属します。
38
- - `presetOptions` の書き込みが兄弟フィールドを保持するようになりました。`settingsScope.set('presetOptions', patch)` はセクション全体を置き換えるため、エスティメーターの 2 つ目のフィールド(プロバイダー、モデル、エンドポイント)に触れると `estimatorMode` と他のすべての上書きが削除され、パネルは保存成功と表示したままエスティメーターが静かにオフへ戻っていました。現在はパッチを保存済みセクションへマージし、`undefined` は指定したフィールドだけを消去し、変更なしのパッチは書き込まず、confirm-on-write はチャネル単独ではなく同じフィールド群を検証します。
39
- - 回帰カバレッジを追加:`packages/selector/tests/preset-options-write.client.spec.ts`(マージ書き込み、兄弟フィールドの保持、明示的な消去、変更なし時の無書き込み、未コミット書き込みの報告)と `packages/selector/tests/estimator-channel.client.spec.tsx`(チャネル別フィールド、カタログのドロップダウン、手入力フォールバック)。
package/CHANGELOG.ko.md CHANGED
@@ -2,24 +2,26 @@
2
2
 
3
3
  > 전체 히스토리(업스트림 0.1.0 이전 포함)는 [CHANGELOG.md](CHANGELOG.md)를 참고하세요. 이 파일은 포크의 추가 항목만 번역한 것입니다. · [English](CHANGELOG.md) · [中文](CHANGELOG.zh.md) · [日本語](CHANGELOG.ja.md)
4
4
 
5
- ## 0.1.1
6
-
7
- ### 추가
8
-
9
- - `scripts/`의 TypeScript 도구 체인: `verify-release`, `packed-components-smoke`, `packed-install-e2e`가 `.ts` 소스가 되어 `tsc`로 `scripts-dist/`에 컴파일됩니다. 저장소의 마지막 3개 비-TS 소스 파일이 제거되었습니다.
10
-
11
- ### 변경
12
-
13
- - `package.json` 스크립트 `test:e2e:packed`와 `verify:release`가 `scripts-dist/`의 컴파일 결과물을 실행합니다.
14
- - 추정기 카탈로그 라우트 등록이 강화됨: `asWebServer`가 서비스 자체를 반환하도록 수정(D7 수정), 추정기 UI가 비활성 섹션 제목을 유지하도록 수정(U1 수정).
15
- - 프레임워크 문서 정정: 수준 `inject: [webServer]`는 부담을 지지 않음(Y22); DSH 모든 패키지에 `isolate()` 없음.
5
+ ## Unreleased(미출시)
6
+ ### Changed(0.1.5 호환 / compat/0.1.5 브랜치)
7
+
8
+ - runtime 패키지를 selector 패키지로 통합했습니다. 한 번의 설치로 전체 스택이 들어오고,
9
+ 저장소 루트가 설치면이 됩니다(`name`, `main`, `types`, `./pruner`와 `./invariant`를 포함한
10
+ `exports`, `dependencies`, `dsh`). 툴체인, 스크립트, CI도 단일 패키지로 정리했습니다.
11
+ 실기에서 검증한 estimator-catalog 라우트 등록(이중 접두사, 보호된 이중 채널 활성화, 요청별
12
+ 서비스 해석, 관측 가능한 수명주기 로그)을 이 라인에 재적용하고 호스트 측 가드를 추가했습니다.
13
+ `ab2175a`에서 `z.any()`로 낮춰졌던 settings 스키마를 복원해 Custom 기본값이 다시 게시됩니다.
14
+ - 브랜치에서 공식 DeepSeek Harness `v0.1.5-rc.2`에 적응. 모든 `@deepseek-ai/dsh-*` 개발 의존성과 e2e 공식 호스트 목록을 `0.1.1-rc.2`에서 `0.1.5-rc.2`로 업데이트(cordis `4.0.2`, schemastery `3.18.2`, 분할 패키지들과 `dsh-client-store` 클라이언트 스택 포함).
15
+ - surface 치환은 v3의 `startSeq`/`endSeq` 형태와 브랜딩된 `SessionSeq` 사용. surface node의 이벤트 해석을 배열 인덱스에서 seq 조회로 변경.
16
+ - 클라이언트 번들은 제거된 `@deepseek-ai/dsh-client-runtime`을 참조하지 않음. settings 타입은 `@deepseek-ai/dsh-client-ui-settings`, 세션 hooks는 `@deepseek-ai/dsh-client-ui-session`에서 가져옴. `engines.dsh >=0.1.5-alpha.1 <0.2.0-0` 선언.
17
+ - Harness 0.1.5는 세션 `agentPreset`을 브라우저에 노출하지 않으므로 클라이언트에서 Minimal 세션을 감지할 수 없음. 셀렉터는 선택 가능한 상태 유지.
18
+ - 테스트를 0.1.5 시맨틱에 맞춰 업데이트(`.await()`, `SessionProjectionRegistry`, `stream: []`, 문자열 settings 네임스페이스).
16
19
 
17
20
  ### 수정
18
21
 
19
- - 추정기 카탈로그 라우트는 `asWebServer`가 `register`를 서비스에서 분리한导致로 처음부터 번도 등록되지 않았음(D7).
20
- - 비-TokenPilot 프로필에서 추정기 섹션이 경고 없이 사라졌음(U1).
21
-
22
- ## Unreleased(미출시)
22
+ - 추정기 카드가 Harness 호스트 채널에서 이상 API 키를 요구하지 않습니다. 호스트 채널을 선택하면 라이브 프로바이더/모델 드롭다운이 표시되고 실제로 사용될 라우트(명시적 재정의, 없으면 세션 기본 모델)를 알려줍니다. 키 입력란과 두 번째 수동 모델 입력란은 렌더링되지 않습니다 — 엔드포인트 URL, 모델 텍스트 필드, 쓰기 전용 키는 직접 연결 채널에만 속합니다.
23
+ - `presetOptions` 쓰기를 경로 지정 방식으로 변경했습니다. 기존에는 섹션 전체를 교체했기 때문에 추정기의 두 번째 필드(프로바이더, 모델, 엔드포인트)를 건드리면 `estimatorMode`와 다른 모든 재정의가 삭제되어, 패널은 저장 성공을 보고하는데도 추정기가 조용히 꺼졌습니다. 이제 각 필드는 자기 경로만 쓰고, `undefined`는 지목한 필드만 지우며, confirm-on-write는 채널 하나가 아니라 같은 필드 집합을 검증합니다.
24
+ - 회귀 커버리지 추가: `packages/selector/tests/preset-options-write.client.spec.ts`(경로 단위 쓰기, 형제 필드 보존, 명시적 삭제, 변경 없음 시 무쓰기, 미커밋 쓰기 보고)와 `packages/selector/tests/estimator-channel.client.spec.tsx`(채널별 필드, 카탈로그 드롭다운, 수동 폴백).
23
25
 
24
26
  ### 추가
25
27
 
@@ -31,9 +33,3 @@
31
33
 
32
34
  - ESLint 플랫 설정 베이스라인(`pnpm lint`, CI에서도 강제)과 `pnpm test:watch` TDD 루프를 추가. 죽은 임포트를 정리하고, lint 베이스라인에서 드러난 두 오류 경로를 보강했습니다.
33
35
  - 이 저장소는 이제 `WilliamShi666/dsh-context-compression-selector`의 개선 포크로 관리됩니다. 문서는 영어·중국어(간체)·일본어·한국어로 제공됩니다.
34
-
35
- ### 수정
36
-
37
- - 추정기 카드가 Harness 호스트 채널에서 더 이상 API 키를 요구하지 않습니다. 호스트 채널을 선택하면 라이브 프로바이더/모델 드롭다운이 표시되고 실제로 사용될 라우트(명시적 재정의, 없으면 세션 기본 모델)를 알려줍니다. 키 입력란과 두 번째 수동 모델 입력란은 렌더링되지 않습니다 — 엔드포인트 URL, 모델 텍스트 필드, 쓰기 전용 키는 직접 연결 채널에만 속합니다.
38
- - `presetOptions` 쓰기가 형제 필드를 보존합니다. `settingsScope.set('presetOptions', patch)`는 섹션 전체를 교체하므로 추정기의 두 번째 필드(프로바이더, 모델, 엔드포인트)를 건드리면 `estimatorMode`와 다른 모든 재정의가 삭제되어, 패널은 저장 성공을 보고하는데도 추정기가 조용히 꺼졌습니다. 이제 패치는 저장된 섹션 위에 병합되고, `undefined`는 지목한 필드만 지우며, 변경 없는 패치는 쓰지 않고, confirm-on-write는 채널 하나가 아니라 같은 필드 집합을 검증합니다.
39
- - 회귀 커버리지 추가: `packages/selector/tests/preset-options-write.client.spec.ts`(병합 쓰기, 형제 필드 보존, 명시적 삭제, 변경 없음 시 무쓰기, 미커밋 쓰기 보고)와 `packages/selector/tests/estimator-channel.client.spec.tsx`(채널별 필드, 카탈로그 드롭다운, 수동 폴백).
package/CHANGELOG.md CHANGED
@@ -2,24 +2,29 @@
2
2
 
3
3
  All notable changes use this file. The project follows semantic versioning after `0.1.0`.
4
4
 
5
- ## 0.1.1
6
-
7
- ### Added
8
-
9
- - TypeScript toolchain for `scripts/`: `verify-release`, `packed-components-smoke`, and `packed-install-e2e` are now `.ts` sources compiled to `scripts-dist/` via `tsc`, eliminating the last three non-TS source files in the repository.
5
+ ## Unreleased (compat/0.1.5)
10
6
 
11
7
  ### Changed
12
8
 
13
- - `package.json` scripts `test:e2e:packed` and `verify:release` now run compiled outputs from `scripts-dist/`.
14
- - Estimator catalog route registration hardened: `asWebServer` returns the service itself (D7 fix), and the estimator UI preserves its section heading when inactive instead of hiding behind an invisible gate (U1 fix).
15
- - Framework documentation corrected: row-level `inject: [webServer]` is not load-bearing (Y22); `isolate()` does not exist in any DSH package.
9
+ - The runtime package is merged into the selector package: one install brings the whole
10
+ stack, the repository root is the install surface (`name`, `main`, `types`, `exports` with
11
+ `./pruner` and `./invariant`, `dependencies`, `dsh`), and the toolchain, scripts and CI were
12
+ swept to the single package. The verified estimator-catalog registration (dual prefix, guarded
13
+ two-channel activation, per-request service resolution, visible lifecycle lines) was replayed
14
+ onto this line with a host-side guard; the settings schema that `ab2175a` had downgraded to
15
+ `z.any()` is restored, so the daily Custom defaults are published again.
16
+ - Adapt to the official DeepSeek Harness `v0.1.5-rc.2` on this branch. All `@deepseek-ai/dsh-*` dev dependencies and the pinned e2e host set move from `0.1.1-rc.2` to `0.1.5-rc.2` (cordis `4.0.2`, schemastery `3.18.2`), including the new split packages (`dsh-session-projection`, `dsh-session-persistence`, `dsh-atomic-write`, `dsh-home-paths`, `dsh-sandbox`, and related) and the `dsh-client-store` client stack.
17
+ - Surface replace operations now use the v3 `startSeq`/`endSeq` shape with branded `SessionSeq` values; `compaction/prune` manifests keep the durable `start`/`end` fields. Events are resolved from surface nodes by seq lookup instead of array indexing.
18
+ - The client bundle no longer imports the removed `@deepseek-ai/dsh-client-runtime`: settings types now come from `@deepseek-ai/dsh-client-ui-settings` and the session hooks merge from `@deepseek-ai/dsh-client-ui-session`. `engines.dsh >=0.1.5-alpha.1 <0.2.0-0` is declared in both package manifests and `dsh.plugin.json`.
19
+ - Harness 0.1.5 no longer exposes the session `agentPreset` to the browser, so the client can no longer detect Minimal-only sessions; the selector stays selectable and the old unavailable banner is unreachable.
20
+ - Test batteries updated for 0.1.5 semantics: cordis plugin starts require `.await()`, the Token Meter requires a mounted `SessionProjectionRegistry`, assistant events carry `stream: []`, and settings namespaces are plain strings.
16
21
 
17
22
  ### Fixed
18
23
 
19
- - The estimator catalog route was never registered since day one because `asWebServer` detached `register` from its service (D7).
20
- - The estimator section silently disappeared when a non-TokenPilot profile was active, with no hint about why or how to enable it (U1).
24
+ - The estimator card no longer demands an API key on the Harness host channel. Selecting the host channel shows the live provider/model dropdowns, names the route that would actually run (explicit override, else the session default), and renders neither a key field nor a second manual model input: the base URL, the model text field, and the write-only key belong to the direct endpoint channel alone.
25
+ - `presetOptions` writes are path-addressed. Writing the whole section replaced it, so touching any second estimator field (a provider, a model, an endpoint) deleted `estimatorMode` and every sibling override — silently switching the estimator back off while the panel still reported a successful save. Each field now writes only itself, `undefined` clears exactly the field it names, and the confirmation read validates the same field set instead of the mode alone.
26
+ - New coverage: `packages/selector/tests/preset-options-write.client.spec.ts` (path-scoped writes, sibling preservation, explicit clears, no-op patches, uncommitted-write reporting) and `packages/selector/tests/estimator-channel.client.spec.tsx` (per-channel fields, catalog dropdowns, manual fallback).
21
27
 
22
- ## Unreleased
23
28
 
24
29
  ### Added
25
30
 
@@ -42,12 +47,6 @@ All notable changes use this file. The project follows semantic versioning after
42
47
  - Added an ESLint flat-config baseline (`pnpm lint`, enforced in CI) and a `pnpm test:watch` TDD loop; removed dead imports and hardened two error paths surfaced by the lint baseline.
43
48
  - This repository is now maintained as an improved fork of `WilliamShi666/dsh-context-compression-selector`; documentation ships in English, Simplified Chinese, Japanese, and Korean.
44
49
 
45
- ### Fixed
46
-
47
- - The estimator card no longer demands an API key on the Harness host channel. Selecting the host channel shows the live provider/model dropdowns, names the route that would actually run (explicit override, else the session default), and renders neither a key field nor a second manual model input: the base URL, the model text field, and the write-only key belong to the direct endpoint channel alone.
48
- - `presetOptions` writes preserve their siblings. `settingsScope.set('presetOptions', patch)` replaces the whole section, so touching any second estimator field (a provider, a model, an endpoint) deleted `estimatorMode` and every other override — silently switching the estimator back off while the panel still reported a successful save. The patch is now merged over the stored section, `undefined` clears exactly the field it names, an unchanged patch writes nothing, and the confirmation read compares the same fields instead of the channel alone.
49
- - New coverage: `packages/selector/tests/preset-options-write.client.spec.ts` (merged writes, sibling preservation, explicit clears, no-op patches, uncommitted-write reporting) and `packages/selector/tests/estimator-channel.client.spec.tsx` (per-channel fields, catalog dropdowns, manual fallback).
50
-
51
50
  ## 0.1.0 - 2026-09-03
52
51
 
53
52
  ### Added
package/CHANGELOG.zh.md CHANGED
@@ -2,24 +2,27 @@
2
2
 
3
3
  > 完整历史(含上游 0.1.0 及更早版本)见 [CHANGELOG.md](CHANGELOG.md)。本文件只翻译本 fork 的新增条目。 · [English](CHANGELOG.md) · [日本語](CHANGELOG.ja.md) · [한국어](CHANGELOG.ko.md)
4
4
 
5
- ## 0.1.1
5
+ ## Unreleased(compat/0.1.5 分支)
6
6
 
7
- ### 新增
8
-
9
- - `scripts/` 的 TypeScript 工具链:`verify-release`、`packed-components-smoke` 和 `packed-install-e2e` 现为 `.ts` 源文件,通过 `tsc` 编译至 `scripts-dist/`,消除仓库中最后三个非 TS 源文件。
7
+ ### Changed
10
8
 
11
- ### 变更
12
-
13
- - `package.json` 脚本 `test:e2e:packed` 和 `verify:release` 现运行 `scripts-dist/` 中的编译产物。
14
- - 估计器目录路由注册加固:`asWebServer` 直接返回 service 本身(D7 修复),估计器 UI 在未激活时保留区块标题而非隐藏(U1 修复)。
15
- - 框架文档更正:行级 `inject: [webServer]` 非承载性(Y22);DSH 中无 `isolate()` 实例。
9
+ - runtime 包并入 selector 包:一次安装即可获得完整栈,仓库根目录即为安装面
10
+ (`name`、`main`、`types`、`exports`(含 `./pruner`、`./invariant`)、`dependencies`、`dsh`),
11
+ 工具链、脚本与 CI 一并收敛为单包。已真机验证的 estimator-catalog 路由注册(双前缀、受保护的
12
+ 双通道激活、按请求解析服务、可检索的生命周期日志)重放到本线,并新增宿主侧守门;`ab2175a`
13
+ 降级为 `z.any()` settings schema 已还原,每日 Custom 默认值重新下发。
14
+ - 在本分支适配官方 DeepSeek Harness `v0.1.5-rc.2`。全部 `@deepseek-ai/dsh-*` 开发依赖与 e2e 官方宿主清单从 `0.1.1-rc.2` 升至 `0.1.5-rc.2`(cordis `4.0.2`、schemastery `3.18.2`),含新的拆分包(`dsh-session-projection`、`dsh-session-persistence`、`dsh-atomic-write`、`dsh-home-paths`、`dsh-sandbox` 等)与 `dsh-client-store` 客户端栈。
15
+ - Surface 替换操作改用 v3 的 `startSeq`/`endSeq` 形状与品牌化 `SessionSeq`;`compaction/prune` 清单保留持久化的 `start`/`end` 字段。surface node 事件改为按 seq 查找而非数组下标。
16
+ - 客户端 bundle 不再引用已移除的 `@deepseek-ai/dsh-client-runtime`:settings 类型改自 `@deepseek-ai/dsh-client-ui-settings`,会话 hooks 合并自 `@deepseek-ai/dsh-client-ui-session`。两份 package manifest 与 `dsh.plugin.json` 声明 `engines.dsh >=0.1.5-alpha.1 <0.2.0-0`。
17
+ - Harness 0.1.5 不再向浏览器暴露会话 `agentPreset`,客户端无法再识别 Minimal 会话;选择器保持可选,旧的不可用横幅不再出现。
18
+ - 测试套件按 0.1.5 语义更新:cordis 插件启动需要 `.await()`,Token Meter 需要预先挂载 `SessionProjectionRegistry`,assistant 事件携带 `stream: []`,settings 命名空间为普通字符串。
16
19
 
17
20
  ### 修复
18
21
 
19
- - 估计器目录路由自始至终从未注册,因 `asWebServer` 使 `register` 脱离 service(D7)。
20
- - TokenPilot Profile 下估计器区块静默消失,无任何启用提示(U1)。
22
+ - 估计器卡片在 Harness 宿主通道上不再要求 API Key。选择宿主通道后只显示实时供应商/模型下拉框,并标出当前真正生效的路由(显式覆盖优先,否则跟随会话默认模型);既不显示密钥输入框,也不再有第二个手填模型输入——端点地址、模型文本框与只写密钥均只属于直连端点通道。
23
+ - `presetOptions` 改为按路径写入。此前整段写入会替换整个分节,导致再改动估计器的任何一个字段(供应商、模型、端点)都会删掉 `estimatorMode` 及其余全部覆盖值——估计器被静默关回关闭状态,而面板却报告保存成功。现在每个字段只写自己,`undefined` 只清除指名的那一个字段,且 confirm-on-write 校验的是同一组字段而非仅校验通道。
24
+ - 新增回归覆盖:`packages/selector/tests/preset-options-write.client.spec.ts`(按路径写入、保留同级字段、显式清除、空改动不写、未提交写入的报错)与 `packages/selector/tests/estimator-channel.client.spec.tsx`(各通道字段、目录下拉框、手填回退)。
21
25
 
22
- ## Unreleased(未发布)
23
26
 
24
27
  ### 新增
25
28
 
@@ -31,9 +34,3 @@
31
34
 
32
35
  - 新增 ESLint 平铺配置基线(`pnpm lint`,CI 同步强制)与 `pnpm test:watch` TDD 环路;清理死导入,并修复 lint 基线暴露的两处错误处理路径。
33
36
  - 本仓库现为 `WilliamShi666/dsh-context-compression-selector` 的改进版 fork;文档提供英、简中、日、韩四种语言。
34
-
35
- ### 修复
36
-
37
- - 估计器卡片在 Harness 宿主通道上不再要求 API Key。选择宿主通道后只显示实时供应商/模型下拉框,并标出当前真正生效的路由(显式覆盖优先,否则跟随会话默认模型);既不显示密钥输入框,也不再有第二个手填模型输入——端点地址、模型文本框与只写密钥均只属于直连端点通道。
38
- - `presetOptions` 写入改为保留同级字段。`settingsScope.set('presetOptions', patch)` 会替换整个分节,导致再改动估计器的任何一个字段(供应商、模型、端点)都会删掉 `estimatorMode` 及其余全部覆盖值——估计器被静默关回关闭状态,而面板却报告保存成功。现在补丁会合并到已存分节之上,`undefined` 只清除指名的那一个字段,空改动不写盘,且 confirm-on-write 校验同一组字段而非仅校验通道。
39
- - 新增回归覆盖:`packages/selector/tests/preset-options-write.client.spec.ts`(合并写入、保留同级字段、显式清除、空改动不写、未提交写入的报错)与 `packages/selector/tests/estimator-channel.client.spec.tsx`(各通道字段、目录下拉框、手填回退)。
package/CONTRIBUTING.md CHANGED
@@ -17,6 +17,6 @@ Thank you for helping improve this community plugin.
17
17
  ```
18
18
 
19
19
  5. Never commit API keys, `.env` files, real Session logs, prompts/tool results, user paths, generated tarballs, or NPM tokens.
20
- 6. Read [`docs/repair-log.md`](docs/repair-log.md) before starting a new branch or version. It is the cross-version ledger of install/boot defects; a class recorded there must be re-checked on every new line instead of being rediscovered. Note in particular that `lib/` is committed, so a built chunk an entry imports must be committed in the same change — `pnpm verify:release` enforces it.
20
+ 6. Read [`docs/repair-log.md`](docs/repair-log.md) before starting a new branch or version. It is the cross-version ledger of install/boot defects; a class recorded there must be re-checked on every new line instead of being rediscovered. Note in particular that `lib/` is committed, so a built chunk an entry imports must be committed in the same change — `pnpm verify:release` enforces it — and that the tokenizer assets are content-addressed, so a checkout that rewrites their line endings breaks every consumer (the release gate now fails on CR bytes).
21
21
 
22
22
  Pull requests should explain the evidence for “triggered”, “enabled but skipped”, and fail-open behavior separately. A code path existing is not runtime proof. Changes to tokenizer/model compatibility require an official source, pinned revision, license, byte length, SHA-256, and negative tests.
package/README.ja.md CHANGED
@@ -39,29 +39,11 @@
39
39
  - **セッション凍結**:他のセレクター設定と同様、変更は新しく観測されたセッションにのみ適用されます。
40
40
  - **厳格なパース**:`codeSkeleton` は正確に `{ enabled: boolean }` である必要があります。不正な値はランタイム側でスローされ、ブラウザー UI 側では読み取り不能として表示されます。
41
41
 
42
- ### 出典、そしてこの数値は誰のものか
43
-
44
- スケルトン化のアプローチは **[Headroom](https://github.com/headroomlabs-ai/headroom)**
45
- (Apache-2.0)から借用しています。AI エージェント向けのコンテキスト圧縮レイヤーで、JSON・
46
- ソースコード・散文をそれぞれ別の圧縮器に振り分け(JSON は `SmartCrusher`、コードは
47
- `CodeCompressor`)、スケルトン変換は
48
- `crates/headroom-core/src/transforms/live_zone.rs` と `smart_crusher/planning.rs` にあります。
49
-
50
- **削減率は Headroom のものであり、本プラグインのものではありません。** Headroom が公開している
51
- 公式な表現は次のとおりです。
52
-
53
- > 20% fewer tokens for coding agents, **60–95% fewer tokens for JSON**, same answers.
54
-
55
- **最大 95% 削減**という数字はこの一文によるもので、口径は JSON ペイロード、Headroom 自身の
56
- 圧縮器が Headroom 自身のベンチマークで測定した値です。本ゲートの機構はここに同源があります。
57
- 本リポジトリは**独自のベンチマークを一切持たない**ため、**独自の削減率を主張しません**。
58
- 数値が必要な場合は出典で確認してください。
59
-
60
42
  ## 設定 UI
61
43
 
62
44
  同じ設定セクションで、圧縮プロファイルの選択、Auto Compact トリガーレベルの調整、コードスケルトン圧縮のトグルが行えます。トグルは変更時に即保存され、再読み込み時には保存済みの状態が表示されます。
63
45
 
64
- ![Context Compression Selector 設定 UI](packages/selector/assets/screenshots/context-compression-selector-settings.png)
46
+ ![Context Compression Selector 設定 UI](docs/assets/context-compression-selector-settings.png)
65
47
 
66
48
  ## インストール
67
49
 
@@ -100,5 +82,4 @@ pnpm verify:release
100
82
 
101
83
  - アップストリームのプロジェクトと既存のすべての成果:[WilliamShi666/dsh-context-compression-selector](https://github.com/WilliamShi666/dsh-context-compression-selector)(作者 WilliamShi666、MIT)。
102
84
  - フォークによる追加(コードスケルトンゲート、ツールチェーン、多言語ドキュメント):drscrewdriver。
103
- - コードスケルトン機構の出典:[Headroom](https://github.com/headroomlabs-ai/headroom)(Apache-2.0)——上記「出典、そしてこの数値は誰のものか」を参照。
104
85
  - MIT——[LICENSE](LICENSE)(アップストリームの著作権表示を保持)を参照。同梱トークナイザーの出所は [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。
package/README.ko.md CHANGED
@@ -1,22 +1,22 @@
1
1
  # dsh-context-compression-improved
2
2
 
3
- > [dsh-context-compression-selector](https://github.com/WilliamShi666/dsh-context-compression-selector)의 개선 포크——DeepSeek Harness용 감사 가능한 도구 결과 컨텍스트 압축 셀렉터에, 직교하는 **코드 스켈레톤 압축 게이트**를 추가했습니다.
3
+ > [dsh-context-compression-selector](https://github.com/WilliamShi666/dsh-context-compression-selector)의 개선 포크——DeepSeek Harness용 감사 가능한 도구 결과 컨텍스트 압축 셀렉터에, 직교하는 **코드 스켈레톤 압축 게이트*를추가했습니다.
4
4
 
5
5
  [English](README.md) · [中文说明](README.zh.md) · [日本語](README.ja.md) · [변경 로그](CHANGELOG.ko.md) · [설치 가이드](docs/installation.ko.md)
6
6
 
7
7
  > [!NOTE]
8
- > **이 포크가 업스트림 0.1.0에 추가한 것:**
8
+ > **이 포크가 업스트림 0.1.0에 추가한것**
9
9
  >
10
- > - 직교하는 **코드 스켈레톤 압축 게이트**(`codeSkeleton.enabled`, 기본값 off): 매우 큰 소스코드 도구 결과가 처음 노출될 때, 일반 리듀서로 넘어가기 전에 임포트와 선언부의 스켈레톤을 보존할 수 있습니다(함수 본문은 생략, 에러 라인은 유지).
10
+ > - 직교하는 **코드 스켈레톤 압축 게이트**(`codeSkeleton.enabled`, 기본값 off): 매우 큰 소스코드 도구 결과가 처음 노출될때 일반 리듀서로 넘어가기 전에 임포트와 선언부의 스켈레톤을 보존할수있습니다(함수 본문은 생략, 에러 라인은 유지).
11
11
  > - 동일한 셀렉터 설정 섹션에 모든 압축 프로파일과 독립적인 이 게이트의 토글을 추가.
12
12
  > - CI에 통합된 ESLint 베이스라인, `test:watch` TDD 루프, 영어/중국어(간체)/일본어/한국어 문서.
13
13
 
14
14
  > [!IMPORTANT]
15
- > 이 프로젝트는 **DeepSeek 모델만** 지원합니다. 손실 없는 측정과 손실 압축은 번들된 DeepSeek 공식 토크나이저(`deepseek-v4-flash`, `deepseek-v4-pro`, `deepseek-v4-flash-vision-exp`)에 의존합니다. 외의 경우 fail-open으로 동작하며 원본 도구 결과를 유지합니다. 전체 안전 모델은 [업스트림 README](https://github.com/WilliamShi666/dsh-context-compression-selector#model-support-and-safety)를 참고하세요.
15
+ > 이 프로젝트는 **DeepSeek 모델만** 지원합니다. 손실 없는 측정과 손실 압축은 번들된 DeepSeek 공식 토크나이저(`deepseek-v4-flash`, `deepseek-v4-pro`, `deepseek-v4-flash-vision-exp`)에 의존합니다. 그외의 경우 fail-open으로 동작하며 원본 도구 결과를 유지합니다. 전체 안전 모델은 [업스트림 README](https://github.com/WilliamShi666/dsh-context-compression-selector#model-support-and-safety)를 참고하세요.
16
16
 
17
17
  ## 이것은 무엇인가
18
18
 
19
- 장시간 실행되는 에이전트 작업은 대량의 도구 출력을 축적합니다. 커뮤니티 플러그인은 DeepSeek Harness 코어를 수정하지 않고, 선택 가능하고 감사 가능한 도구 결과 컨텍스트 압축 정책을 제공합니다:
19
+ 장시간 실행되는 에이전트 작업은 대량의 도구 출력을 축적합니다. 이커뮤니티 플러그인은 DeepSeek Harness 코어를 수정하지 않고, 선택 가능하고 감사 가능한 도구 결과 컨텍스트 압축 정책을 제공합니다:
20
20
 
21
21
  - **Fresh**: 모델이 받기 전에 새로 커진 도구 결과 세그먼트를 사전 압축합니다.
22
22
  - **Aggregate**: Fresh 압축 후에도 예산을 초과하면 다시 압축합니다.
@@ -29,42 +29,25 @@
29
29
 
30
30
  ## 코드 스켈레톤 게이트(신규)
31
31
 
32
- 게이트를 활성화하면 매우 큰 **소스코드 도구 결과**(예: 큰 `read_file`)에 대해 먼저 스켈레톤 축소를 시도합니다: 임포트와 타입/함수/클래스 선언을 유지하고, 함수 본문은 마커와 함께 생략하며, 생략된 본문 안의 에러 라인은 보존합니다. 스켈레톤을 생성하거나 검증할 수 없으면 원래의 head 트리밍으로 폴백합니다——이 게이트가 컨텍스트를 악화시킬 수는 없습니다.
32
+ 게이트를 활성화하면 매우 큰 **소스코드 도구 결과**(예: 큰`read_file`)에 대해 먼저 스켈레톤 축소를 시도합니다: 임포트와 타입/함수/클래스 선언을 유지하고, 함수 본문은 마커와 함께 생략하며, 생략된 본문 안의 에러 라인은 보존합니다. 스켈레톤을 생성하거나 검증할 수 없으면 원래의 head 트리밍으로 폴백합니다——이 게이트가 컨텍스트를 악화시킬 수는 없습니다.
33
33
 
34
34
  특성:
35
35
 
36
- - **직교**: 선택된 프로파일(`balanced`, `savings`, `cache-strict`, `adaptive`, `custom`, `off`, `native`)과 독립적입니다. 모든 프로파일이 이 게이트를 받습니다.
36
+ - **직교**: 선택된 프로파일(`balanced`, `savings`, `cache-strict`, `adaptive`, `custom`, `off`, `native`)과 독립적입니다. 모든 프로파일이이게이트를 받습니다.
37
37
  - **기본값 off**: `codeSkeleton: { enabled: false }`이며, 직접 켜기 전까지는 동작하지 않습니다.
38
- - **측정이 선행**: 정확한 DeepSeek 토크나이저가 필요하며, 사용할 수 없으면 fail-open합니다.
38
+ - **측정이 선행**: 정확한 DeepSeek 토크나이저가 필요하며, 사용할수없으면 fail-open합니다.
39
39
  - **세션 고정**: 다른 셀렉터 설정과 마찬가지로 변경 사항은 새로 관찰된 세션에만 적용됩니다.
40
40
  - **엄격한 파싱**: `codeSkeleton`은 정확히 `{ enabled: boolean }`이어야 합니다. 잘못된 값은 런타임 쪽에서 예외를 던지고, 브라우저 UI에서는 읽을 수 없음으로 표시됩니다.
41
41
 
42
- ### 출처, 그리고 이 수치는 누구의 것인가
43
-
44
- 스켈레톤화 접근은 **[Headroom](https://github.com/headroomlabs-ai/headroom)**(Apache-2.0)에서
45
- 차용했습니다. AI 에이전트용 컨텍스트 압축 계층으로, JSON·소스 코드·산문을 각각 다른 압축기로
46
- 분기하며(JSON은 `SmartCrusher`, 코드는 `CodeCompressor`), 스켈레톤 변환은
47
- `crates/headroom-core/src/transforms/live_zone.rs`와 `smart_crusher/planning.rs`에 있습니다.
48
-
49
- **감축 수치는 Headroom의 것이며 이 플러그인의 것이 아닙니다.** Headroom이 공개한 공식 표현은
50
- 다음과 같습니다.
51
-
52
- > 20% fewer tokens for coding agents, **60–95% fewer tokens for JSON**, same answers.
53
-
54
- **최대 95% 감축**이라는 수치는 이 문장에서 나온 것이며, 기준은 JSON 페이로드이고 Headroom 자체
55
- 압축기가 Headroom 자체 벤치마크에서 측정한 값입니다. 이 게이트의 메커니즘은 여기에 동원(同源)을
56
- 둡니다. 이 저장소는 **자체 벤치마크가 전혀 없으므로 자체 감축률을 주장하지 않습니다.** 수치가
57
- 필요하면 출처에서 확인하십시오.
58
-
59
42
  ## 설정 UI
60
43
 
61
- 동일한 설정 섹션에서 압축 프로파일 선택, Auto Compact 트리거 레벨 조정, 코드 스켈레톤 압축 토글을 모두 처리할 수 있습니다. 토글은 변경 시 즉시 저장되며, 다시 불러올 때 저장된 상태가 표시됩니다.
44
+ 동일한 설정 섹션에서 압축 프로파일 선택, Auto Compact 트리거 레벨 조정, 코드 스켈레톤 압축 토글을 모두 처리할수있습니다. 토글은 변경시즉시 저장되며, 다시 불러올때저장된 상태가 표시됩니다.
62
45
 
63
- ![Context Compression Selector 설정 UI](packages/selector/assets/screenshots/context-compression-selector-settings.png)
46
+ ![Context Compression Selector 설정 UI](docs/assets/context-compression-selector-settings.png)
64
47
 
65
48
  ## 설치
66
49
 
67
- 소스에서 빌드하여 설치합니다(이 포크는 아직 npm에 게시되지 않았습니다. 내부 패키지 이름은 의도적으로 업스트림과 동일하게 유지됩니다):
50
+ 소스에서 빌드하여 설치합니다이포크는 아직 npm에 게시되지 않았습니다. 내부 패키지 이름은 의도적으로 업스트림과 동일하게 유지됩니다):
68
51
 
69
52
  ```sh
70
53
  git clone https://github.com/drscrewdriver/dsh-context-compression-improved.git
@@ -98,6 +81,5 @@ pnpm verify:release
98
81
  ## 크레딧과 라이선스
99
82
 
100
83
  - 업스트림 프로젝트와 기존의 모든 작업: [WilliamShi666/dsh-context-compression-selector](https://github.com/WilliamShi666/dsh-context-compression-selector), 작성자 WilliamShi666(MIT).
101
- - 포크에서 추가된 것(코드 스켈레톤 게이트, 툴체인, 다국어 문서): drscrewdriver.
102
- - 코드 스켈레톤 메커니즘 출처: [Headroom](https://github.com/headroomlabs-ai/headroom) (Apache-2.0) — 위의 "출처, 그리고 이 수치는 누구의 것인가"를 참조하십시오.
84
+ - 포크에서 추가된것코드 스켈레톤 게이트, 툴체인, 다국어 문서): drscrewdriver.
103
85
  - MIT——[LICENSE](LICENSE)(업스트림 저작권 표기 유지) 참고. 번들된 토크나이저의 출처는 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
package/README.md CHANGED
@@ -39,28 +39,11 @@ Properties:
39
39
  - **Session-frozen**: like all selector settings, changes affect newly observed sessions only.
40
40
  - **Strictly parsed**: `codeSkeleton` must be exactly `{ enabled: boolean }`; malformed values throw on the runtime side and show as unreadable in the browser UI.
41
41
 
42
- ### Provenance, and whose numbers these are
43
-
44
- The skeletonization approach is borrowed from **[Headroom](https://github.com/headroomlabs-ai/headroom)**
45
- (Apache-2.0) — a context-compression layer for AI agents that routes JSON, source code and prose
46
- through separate compressors (`SmartCrusher` for JSON, `CodeCompressor` for code), with its
47
- skeleton transform living in `crates/headroom-core/src/transforms/live_zone.rs` and
48
- `smart_crusher/planning.rs`.
49
-
50
- **The reduction figures are Headroom's, not this plugin's.** Headroom's published claim, verbatim:
51
-
52
- > 20% fewer tokens for coding agents, **60–95% fewer tokens for JSON**, same answers.
53
-
54
- The headline — **up to 95% fewer tokens** — comes from that sentence: JSON payloads, measured by
55
- Headroom's own compressors on Headroom's own benchmarks. That is the same source this gate draws
56
- its mechanism from. This repository ships **no benchmark of its own**, so it claims **no reduction
57
- percentage of its own**; read the measurements at the source.
58
-
59
42
  ## Settings UI
60
43
 
61
44
  Choose a compression profile, set the Auto Compact trigger level, and toggle code-skeleton compression in the same settings section. The toggle saves on change and shows the saved state on reload.
62
45
 
63
- ![Context Compression Selector settings UI](packages/selector/assets/screenshots/context-compression-selector-settings.png)
46
+ ![Context Compression Selector settings UI](docs/assets/context-compression-selector-settings.png)
64
47
 
65
48
  ## Install
66
49
 
@@ -99,5 +82,4 @@ Contributions follow the upstream discipline: add the failing regression first,
99
82
 
100
83
  - Upstream project and all prior work: [WilliamShi666/dsh-context-compression-selector](https://github.com/WilliamShi666/dsh-context-compression-selector) by WilliamShi666 (MIT).
101
84
  - Fork additions (code-skeleton gate, tooling, localized docs): drscrewdriver.
102
- - Code-skeleton mechanism: [Headroom](https://github.com/headroomlabs-ai/headroom) (Apache-2.0) — see "Provenance, and whose numbers these are" above.
103
85
  - MIT — see [LICENSE](LICENSE) (upstream copyright notice retained) and [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) for bundled tokenizer provenance.
package/README.zh.md CHANGED
@@ -1,15 +1,15 @@
1
1
  # dsh-context-compression-improved
2
2
 
3
- > [dsh-context-compression-selector](https://github.com/WilliamShi666/dsh-context-compression-selector) 的改进版 fork——面向 DeepSeek Harness 的可审计工具结果上下文压缩选择器,新增正交的**代码骨架压缩门**。
3
+ > [dsh-context-compression-selector](https://github.com/WilliamShi666/dsh-context-compression-selector) 的改进版 fork——面向 DeepSeek Harness 的可审计工具结果上下文压缩选择器,新增正交的**代码骨架压缩门*。
4
4
 
5
5
  [English](README.md) · [日本語](README.ja.md) · [한국어](README.ko.md) · [更新日志](CHANGELOG.zh.md) · [安装教程](docs/installation.zh.md)
6
6
 
7
7
  > [!NOTE]
8
- > **本 fork 在上游 0.1.0 之上新增:**
8
+ > **本fork 在上游 0.1.0 之上新增:*
9
9
  >
10
10
  > - 正交的**代码骨架压缩门**(`codeSkeleton.enabled`,默认关闭):超大源码类工具结果首次曝光时,可先保留导入与声明的骨架——省略函数体并保留错误行——再进入常规 reducer。
11
11
  > - 同一选择器设置区内新增该门的开关,独立于所有压缩 Profile。
12
- > - 接入 CI 的 ESLint 基线、`test:watch` TDD 环路,以及英/中/日/韩四语文档。
12
+ > - 接入 CI 的 ESLint 基线、`test:watch` TDD 环路,以及英/中日韩四语文档。
13
13
 
14
14
  > [!IMPORTANT]
15
15
  > 本项目仅支持 **DeepSeek 模型**。无损测量与有损压缩依赖内置的 DeepSeek 官方 tokenizer(`deepseek-v4-flash`、`deepseek-v4-pro`、`deepseek-v4-flash-vision-exp`)。其余模型一律 fail-open 并保留原始工具结果。完整安全模型见[上游 README](https://github.com/WilliamShi666/dsh-context-compression-selector#model-support-and-safety)。
@@ -22,7 +22,7 @@
22
22
  - **Aggregate**:当 Fresh 压缩后仍超出预算时再次预压缩。
23
23
  - **History / micro-compact**:在保护近期工作上下文的前提下替换符合条件的旧工具结果。
24
24
  - **TailTrim**:仅在 Custom 下可选的尾窗收缩路径。
25
- - **Native**:把 Harness 原生头/中/尾裁剪保留为一个显式 Profile。
25
+ - **Native**:把 Harness 原生头中尾裁剪保留为一个显式 Profile。
26
26
  - **代码骨架(新增,正交门)**——见下节。
27
27
 
28
28
  每个决策都会留痕:阶段、reducer、触发原因、跳过原因,以及可得时的精确 token 数。
@@ -39,26 +39,11 @@
39
39
  - **会话冻结**:与所有选择器设置一致,修改只影响新观察的会话。
40
40
  - **严格解析**:`codeSkeleton` 必须恰好是 `{ enabled: boolean }`;畸形输入在运行时侧抛错、浏览器侧显示不可读。
41
41
 
42
- ### 出处,以及这些数字是谁的
43
-
44
- 骨架化思路借鉴自 **[Headroom](https://github.com/headroomlabs-ai/headroom)**(Apache-2.0)——
45
- 一个面向 AI Agent 的上下文压缩层,把 JSON、源码与散文分别交给不同压缩器(JSON 走
46
- `SmartCrusher`,代码走 `CodeCompressor`),其骨架化变换位于
47
- `crates/headroom-core/src/transforms/live_zone.rs` 与 `smart_crusher/planning.rs`。
48
-
49
- **降幅数字是 Headroom 的,不是本插件的。** Headroom 公开的官方口径原文如下:
50
-
51
- > 20% fewer tokens for coding agents, **60–95% fewer tokens for JSON**, same answers.
52
-
53
- 其中 **最高降 95%** 即出自这一句:口径为 JSON 载荷,由 Headroom 自家压缩器在其自家基准上测得,
54
- 也正是本门机制的同源出处。本仓库**不含任何自己的 benchmark**,因此**不自称任何降幅百分比**;
55
- 要数字,请到源头读。
56
-
57
42
  ## 设置界面
58
43
 
59
44
  在同一设置区内选择压缩 Profile、调整 Auto Compact 触发水位,并开关代码骨架压缩。开关即改即存,刷新后显示已保存状态。
60
45
 
61
- ![Context Compression Selector 设置界面](packages/selector/assets/screenshots/context-compression-selector-settings.png)
46
+ ![Context Compression Selector 设置界面](docs/assets/context-compression-selector-settings.png)
62
47
 
63
48
  ## 安装
64
49
 
@@ -97,5 +82,4 @@ pnpm verify:release
97
82
 
98
83
  - 上游项目与全部既有工作:[WilliamShi666/dsh-context-compression-selector](https://github.com/WilliamShi666/dsh-context-compression-selector),作者 WilliamShi666(MIT)。
99
84
  - fork 新增内容(代码骨架门、工具链、多语文档):drscrewdriver。
100
- - 代码骨架机制来源:[Headroom](https://github.com/headroomlabs-ai/headroom)(Apache-2.0)——见上文「出处,以及这些数字是谁的」。
101
85
  - MIT——见 [LICENSE](LICENSE)(保留上游版权声明);内置 tokenizer 来源见 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。
@@ -4,8 +4,8 @@ This community project contains code adapted from the MIT-licensed [DeepSeek Har
4
4
 
5
5
  The runtime package distributes tokenizer assets from these pinned official repositories, both under the MIT license:
6
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.
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
9
 
10
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
11
 
@@ -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` 上界规范)