dsh-context-compression-improved 0.8.0-beta.1 → 0.8.0-beta.3

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 (51) hide show
  1. package/CHANGELOG.de.md +539 -0
  2. package/CHANGELOG.es.md +547 -0
  3. package/CHANGELOG.fr.md +534 -0
  4. package/CHANGELOG.it.md +536 -0
  5. package/CHANGELOG.md +15 -0
  6. package/CHANGELOG.ru.md +517 -0
  7. package/README.de.md +98 -0
  8. package/README.es.md +98 -0
  9. package/README.fr.md +98 -0
  10. package/README.it.md +98 -0
  11. package/README.ja.md +1 -1
  12. package/README.ko.md +1 -1
  13. package/README.md +1 -1
  14. package/README.ru.md +98 -0
  15. package/README.zh.md +1 -1
  16. package/docs/installation.de.md +104 -0
  17. package/docs/installation.es.md +104 -0
  18. package/docs/installation.fr.md +104 -0
  19. package/docs/installation.it.md +104 -0
  20. package/docs/installation.ja.md +78 -78
  21. package/docs/installation.ko.md +78 -78
  22. package/docs/installation.md +103 -103
  23. package/docs/installation.ru.md +104 -0
  24. package/docs/installation.zh.md +100 -100
  25. package/package.json +17 -16
  26. package/packages/selector/dsh.plugin.json +1 -1
  27. package/packages/selector/lib/advisor-state.js +503 -1
  28. package/packages/selector/lib/client.d.ts +14 -0
  29. package/packages/selector/lib/client.js +1053 -3
  30. package/packages/selector/lib/index.js +122 -2
  31. package/packages/selector/lib/pruner.js +87 -258
  32. package/packages/selector/lib/style.css +42 -0
  33. package/packages/selector/src/client/CompressionProfileSelector.module.css +199 -170
  34. package/packages/selector/src/client/index.ts +244 -213
  35. package/packages/selector/src/client/locales/de.ts +113 -0
  36. package/packages/selector/src/client/locales/es.ts +113 -0
  37. package/packages/selector/src/client/locales/fr.ts +113 -0
  38. package/packages/selector/src/client/locales/it.ts +113 -0
  39. package/packages/selector/src/client/locales/ja.ts +113 -0
  40. package/packages/selector/src/client/locales/ko.ts +113 -0
  41. package/packages/selector/src/client/locales/ru.ts +113 -0
  42. package/packages/selector/src/client/locales.ts +226 -196
  43. package/packages/selector/src/client/savings-card.tsx +150 -0
  44. package/packages/selector/src/client/settings-section.tsx +126 -124
  45. package/packages/selector/src/index.ts +547 -411
  46. package/packages/selector/src/pruner.ts +2505 -2421
  47. package/packages/selector/src/runtime/retrieve.ts +479 -457
  48. package/packages/selector/src/runtime/savings.ts +337 -0
  49. package/packages/selector/tests/estimator-route-registration.host.spec.ts +192 -188
  50. package/packages/selector/tests/runtime/savings.spec.ts +120 -0
  51. package/tests/TEST_INVENTORY.md +41 -41
@@ -1,78 +1,78 @@
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
+ # dsh-context-compression-improved 설치하기
2
+
3
+ > [English](installation.md) · [中文](installation.zh.md) · [日本語](installation.ja.md) · [한국어](installation.ko.md) · [Français](installation.fr.md) · [Deutsch](installation.de.md) · [Italiano](installation.it.md) · [Русский](installation.ru.md) · [Español](installation.es.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,103 +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 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.
1
+ # Installing dsh-context-compression-improved
2
+
3
+ > [English](installation.md) · [中文](installation.zh.md) · [日本語](installation.ja.md) · [한국어](installation.ko.md) · [Français](installation.fr.md) · [Deutsch](installation.de.md) · [Italiano](installation.it.md) · [Русский](installation.ru.md) · [Español](installation.es.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.
@@ -0,0 +1,104 @@
1
+ # Установка dsh-context-compression-improved
2
+
3
+ > [English](installation.md) · [中文](installation.zh.md) · [日本語](installation.ja.md) · [한국어](installation.ko.md) · [Français](installation.fr.md) · [Deutsch](installation.de.md) · [Italiano](installation.it.md) · [Русский](installation.ru.md) · [Español](installation.es.md)
4
+
5
+ Это руководство описывает установку форка из исходников. Форк также опубликован в npm как
6
+ `dsh-context-compression-improved` под dist-tag `dsh-0.1.5`; имя пакета намеренно совпадает
7
+ с апстримовским. Рантайм, который раньше был отдельным вторым пакетом, теперь входит в его
8
+ состав, поэтому одна установка приносит весь стек целиком.
9
+
10
+ ## Предварительные требования
11
+
12
+ - Node `^22.19.0 || >=24` и pnpm `11.7.0` (`corepack enable` берёт зафиксированную версию из поля `packageManager`).
13
+ - Установка DeepSeek Harness, совместимая с диапазоном peers `0.1.1-rc.2` (проверено против официального релиза `dsh-v0.1.2-alpha.5`).
14
+ - Маршрут модели DeepSeek. Сжатие с потерями — включая гейт скелетов кода — принимает решения на символьной основе, поэтому требование к маршруту со встроенным токенизатором больше не действует; если встроенный токенизатор есть, его точные подсчёты записываются как телеметрия, а остальные маршруты работают по принципу fail-open и сохраняют исходные результаты инструментов.
15
+ - Git.
16
+
17
+ ## 1. Сборка из исходников
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` бандлит обе библиотечные грани каждого пакета (`tsdown`). Если хотите прогнать полный набор тестов на своей машине до установки, сначала выполните `pnpm test`.
27
+
28
+ ## 2. Упаковка входного пакета Bundle
29
+
30
+ Пакет селектора — единственный вход Bundle; рантайм идёт с ним как зависимость точной версии:
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` прогоняет бандл через хук `prepack`, поэтому tarball всегда соответствует вашему checkout.
40
+
41
+ ## 3. Добавление в профиль Harness
42
+
43
+ Пакет селектора объявляет поле манифеста Bundle харнесса `dsh.bundle.patch`, поэтому `dsh plugin add` — это стандартный путь установки Bundle вне дерева:
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
+ После установки перезапустите выбранный профиль. В дампе конфигурации Bundle селектора должен значиться как активный. **Не** устанавливайте и не подключайте пакеты селектора и рантайма по отдельности — рантайм устанавливается автоматически.
51
+
52
+ ## 4. Включение гейта скелетов кода
53
+
54
+ Откройте настройки DeepSeek Harness → **Context compression selector**:
55
+
56
+ 1. Выберите профиль сжатия (гейт ортогонален всем).
57
+ 2. При необходимости отрегулируйте уровень срабатывания Auto Compact (50–90%, по умолчанию 80%).
58
+ 3. Установите **Code skeleton compression** в **On**. Переключатель сохраняет значение при каждом изменении.
59
+
60
+ Как и все настройки селектора, значение замораживается, когда сессия впервые его наблюдает, — гейт затрагивает только новые наблюдаемые сессии и никогда не меняет уже идущую задачу.
61
+
62
+ ## 5. Необязательно: рекомендательный advisor релевантности
63
+
64
+ Плагин может вести статистику того, насколько ещё релевантна история сессии, — только в качестве совета, он ничего не решает и ничего не блокирует. По умолчанию выключен; включается редактированием секции `presetOptions` в настройках сжатия контекста (настройки в JSON, карточки в UI на этом этапе нет):
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"` вызывает сервис `llm` харнесса; `"direct"` повторно использует endpoint
78
+ `estimatorBaseUrl` / `estimatorApiKey` / `estimatorModel` эстиматора. На каждой границе хода
79
+ advisor (1) резюмирует текущую задачу по последнему событию `todo/write`, (2) инкрементально
80
+ оценивает исторические результаты инструментов на релевантность «содержимое и комментарии» и
81
+ (3) записывает показатель префиксного затухания. Результаты появляются как записи аудита
82
+ `advisor-outcome`, а при включённом флаге развёртывания `advisorReportRoute: true` — ещё и
83
+ через доступную только для чтения HTTP-маршрут `GET .../advisor-report?sessionId=`. Ни на
84
+ какую редукцию, которая должна примениться, то, что сообщает advisor, повлиять не может:
85
+ не подавить её, не задержать и не переписать.
86
+
87
+ ## 6. Обновление или удаление
88
+
89
+ ```sh
90
+ # update: pull, rebuild, repack, and add the new tarball again
91
+ git pull && pnpm install --frozen-lockfile && pnpm build
92
+ cd packages/selector && pnpm pack && cd ../..
93
+ dsh plugin --profile web add packages/selector/dsh-context-compression-improved-0.1.0.tgz
94
+
95
+ # remove
96
+ dsh plugin --profile web remove dsh-context-compression-improved
97
+ ```
98
+
99
+ ## Устранение неполадок
100
+
101
+ - **Bundle не активен в дампе**: перезапустите профиль; убедитесь, что вы добавили входной пакет селектора (а не рантайм) и что версия Harness попадает в совместимый диапазон peers.
102
+ - **Результаты инструментов никогда не сжимаются до скелета**: гейт по умолчанию выключен; проверьте переключатель. Сжатие применяется только к свежим, чрезмерным результатам инструментов с исходным кодом (решения принимаются на символьной основе; требования к маршруту с точным токенизатором нет), и каждый пропуск фиксируется с указанием причины в журнале аудита.
103
+ - **Переключатель отображается как нечитаемый**: сохранённая секция `codeSkeleton` не прошла строгий браузерный декодер (она должна быть в точности `{ enabled: boolean }`). Удаление некорректной секции возвращает значения по умолчанию.
104
+ - **Обновление падает на шаге апгрейда**: плагин следует семантике npm-пакетов; если ваша сборка Harness отказывает в обновлении с tarball на tarball, сначала удалите старую версию.