dsh-context-compression-improved 0.7.0-beta.1 → 0.8.0-beta.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.
- package/CHANGELOG.de.md +539 -0
- package/CHANGELOG.es.md +547 -0
- package/CHANGELOG.fr.md +534 -0
- package/CHANGELOG.it.md +536 -0
- package/CHANGELOG.ja.md +226 -220
- package/CHANGELOG.ko.md +220 -214
- package/CHANGELOG.md +372 -376
- package/CHANGELOG.ru.md +517 -0
- package/CHANGELOG.zh.md +204 -199
- package/README.de.md +98 -0
- package/README.es.md +98 -0
- package/README.fr.md +98 -0
- package/README.it.md +98 -0
- package/README.ja.md +85 -85
- package/README.ko.md +85 -85
- package/README.md +98 -97
- package/README.ru.md +98 -0
- package/README.zh.md +85 -86
- package/docs/installation.de.md +104 -0
- package/docs/installation.es.md +104 -0
- package/docs/installation.fr.md +104 -0
- package/docs/installation.it.md +104 -0
- package/docs/installation.ja.md +78 -78
- package/docs/installation.ko.md +78 -78
- package/docs/installation.md +103 -103
- package/docs/installation.ru.md +104 -0
- package/docs/installation.zh.md +100 -100
- package/eslint.config.js +30 -76
- package/package.json +69 -70
- package/packages/selector/dsh.plugin.json +2 -2
- package/packages/selector/lib/{intent-gate.js → advisor-state.js} +3 -91
- package/packages/selector/lib/client.js +736 -14
- package/packages/selector/lib/index.js +1 -92
- package/packages/selector/lib/profiles.d.ts +0 -9
- package/packages/selector/lib/pruner.d.ts +0 -59
- package/packages/selector/lib/pruner.js +7 -410
- package/packages/selector/lib/style.css +46 -46
- package/packages/selector/package.json +114 -114
- package/packages/selector/src/client/decode.ts +2 -6
- package/packages/selector/src/client/index.ts +244 -213
- package/packages/selector/src/client/locales/de.ts +98 -0
- package/packages/selector/src/client/locales/es.ts +98 -0
- package/packages/selector/src/client/locales/fr.ts +98 -0
- package/packages/selector/src/client/locales/it.ts +98 -0
- package/packages/selector/src/client/locales/ja.ts +98 -0
- package/packages/selector/src/client/locales/ko.ts +98 -0
- package/packages/selector/src/client/locales/ru.ts +98 -0
- package/packages/selector/src/deepseek-v4-tokenizer.ts +1 -1
- package/packages/selector/src/index.ts +411 -418
- package/packages/selector/src/preset-overlay.ts +0 -3
- package/packages/selector/src/profiles.ts +10 -30
- package/packages/selector/src/pruner/content.ts +1 -1
- package/packages/selector/src/pruner/state.ts +0 -7
- package/packages/selector/src/pruner.ts +9 -253
- package/packages/selector/src/runtime/audit.ts +0 -17
- package/packages/selector/src/runtime/config.ts +11 -36
- package/packages/selector/src/runtime/reducers.ts +1 -1
- package/packages/selector/src/runtime/tokenpilot/advisor-prompt.ts +1 -46
- package/packages/selector/src/runtime/tokenpilot/advisor-state.ts +0 -55
- package/packages/selector/src/runtime/tokenpilot/locator.ts +2 -2
- package/packages/selector/src/runtime/tokenpilot/sidechannel.ts +1 -4
- package/packages/selector/src/runtime/types.ts +0 -12
- package/packages/selector/tests/auto-compact.client.spec.tsx +213 -214
- package/packages/selector/tests/built/client-artifact.spec.ts +59 -61
- package/packages/selector/tests/code-skeleton.client.spec.ts +93 -94
- package/packages/selector/tests/custom-contract.client.spec.ts +222 -223
- package/packages/selector/tests/estimator-channel.client.spec.tsx +252 -252
- package/packages/selector/tests/host-preset-overlay.host.spec.ts +204 -204
- package/packages/selector/tests/preset-options-write.client.spec.ts +187 -188
- package/packages/selector/tests/preset-overlay-loader.e2e.host.spec.ts +200 -200
- package/packages/selector/tests/profiles.client.spec.tsx +434 -436
- package/packages/selector/tests/public/package-contract.client.spec.ts +78 -78
- package/packages/selector/tests/runtime/advice-never-withholds.host.spec.ts +230 -230
- package/packages/selector/tests/runtime/audit.spec.ts +274 -275
- package/packages/selector/tests/runtime/auto-compact-config.spec.ts +3 -3
- package/packages/selector/tests/runtime/deepseek-v4-tokenizer.spec.ts +4 -4
- package/packages/selector/tests/runtime/public/public-runtime.spec.ts +2731 -2736
- package/packages/selector/tests/standing-generation.host.spec.ts +724 -704
- package/pnpm-workspace.yaml +66 -66
- package/scripts/packed-components-smoke.mjs +0 -2
- package/scripts/packed-install-e2e.mjs +5 -7
- package/scripts/verify-release.mjs +2 -3
- package/tests/TEST_INVENTORY.md +41 -41
- package/tsconfig.tests.json +1 -3
- package/vitest.config.ts +0 -14
- package/packages/selector/src/runtime/summary-command.ts +0 -133
- package/packages/selector/src/runtime/tokenpilot/intent-fold.ts +0 -53
- package/packages/selector/src/runtime/tokenpilot/intent-gate.ts +0 -65
- package/packages/selector/src/runtime/tokenpilot/intent-input-mask.ts +0 -125
- package/packages/selector/src/runtime/tokenpilot/intent-range.ts +0 -37
- package/packages/selector/tests/runtime/intent-gate.spec.ts +0 -62
- package/packages/selector/tests/runtime/intent-summary.spec.ts +0 -156
- package/packages/selector/tests/runtime/summary-command.spec.ts +0 -154
package/README.ko.md
CHANGED
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
# dsh-context-compression-improved
|
|
2
|
-
|
|
3
|
-
> [dsh-context-compression-selector](https://github.com/WilliamShi666/dsh-context-compression-selector)의 개선 포크——DeepSeek Harness용 감사 가능한 도구 결과 컨텍스트 압축 셀렉터에, 직교하는 **코드 스켈레톤 압축 게이트*를추가했습니다.
|
|
4
|
-
|
|
5
|
-
[English](README.md) · [中文说明](README.zh.md) · [日本語](README.ja.md) · [변경 로그](CHANGELOG.ko.md) · [설치 가이드](docs/installation.ko.md)
|
|
6
|
-
|
|
7
|
-
> [!NOTE]
|
|
8
|
-
> **이 포크가 업스트림 0.1.0에 추가한것**
|
|
9
|
-
>
|
|
10
|
-
> - 직교하는 **코드 스켈레톤 압축 게이트**(`codeSkeleton.enabled`, 기본값 off): 매우 큰 소스코드 도구 결과가 처음 노출될때 일반 리듀서로 넘어가기 전에 임포트와 선언부의 스켈레톤을 보존할수있습니다(함수 본문은 생략, 에러 라인은 유지).
|
|
11
|
-
> - 동일한 셀렉터 설정 섹션에 모든 압축 프로파일과 독립적인 이 게이트의 토글을 추가.
|
|
12
|
-
> - CI에 통합된 ESLint 베이스라인, `test:watch` TDD 루프, 영어/중국어(간체)/일본어/한국어 문서.
|
|
13
|
-
|
|
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)를 참고하세요.
|
|
16
|
-
|
|
17
|
-
## 이것은 무엇인가
|
|
18
|
-
|
|
19
|
-
장시간 실행되는 에이전트 작업은 대량의 도구 출력을 축적합니다. 이커뮤니티 플러그인은 DeepSeek Harness 코어를 수정하지 않고, 선택 가능하고 감사 가능한 도구 결과 컨텍스트 압축 정책을 제공합니다:
|
|
20
|
-
|
|
21
|
-
- **Fresh**: 모델이 받기 전에 새로 커진 도구 결과 세그먼트를 사전 압축합니다.
|
|
22
|
-
- **Aggregate**: Fresh 압축 후에도 예산을 초과하면 다시 압축합니다.
|
|
23
|
-
- **History / micro-compact**: 최근 작업 컨텍스트를 보호하면서 대상이 되는 오래된 도구 결과를 교체합니다.
|
|
24
|
-
- **TailTrim**: Custom에서만 활성화할 수 있는 선택적 테일 축소 경로입니다.
|
|
25
|
-
- **Native**: Harness 방식의 head/중간/tail 트리밍을 하나의 명시적 프로파일로 유지합니다.
|
|
26
|
-
- **코드 스켈레톤(신규, 직교 게이트)**——아래 참고.
|
|
27
|
-
|
|
28
|
-
모든 결정은 기록됩니다: 단계, 리듀서, 트리거 이유, 건너뜀 이유, 그리고 가능한 경우 정확한 토큰 수.
|
|
29
|
-
|
|
30
|
-
## 코드 스켈레톤 게이트(신규)
|
|
31
|
-
|
|
32
|
-
게이트를 활성화하면 매우 큰 **소스코드 도구 결과**(예: 큰`read_file`)에 대해 먼저 스켈레톤 축소를 시도합니다: 임포트와 타입/함수/클래스 선언을 유지하고, 함수 본문은 마커와 함께 생략하며, 생략된 본문 안의 에러 라인은 보존합니다. 스켈레톤을 생성하거나 검증할 수 없으면 원래의 head 트리밍으로 폴백합니다——이 게이트가 컨텍스트를 악화시킬 수는 없습니다.
|
|
33
|
-
|
|
34
|
-
특성:
|
|
35
|
-
|
|
36
|
-
- **직교**: 선택된 프로파일(`balanced`, `savings`, `cache-strict`, `adaptive`, `custom`, `off`, `native`)과 독립적입니다. 모든 프로파일이이게이트를 받습니다.
|
|
37
|
-
- **기본값 off**: `codeSkeleton: { enabled: false }`이며, 직접 켜기 전까지는 동작하지 않습니다.
|
|
38
|
-
- **측정이 선행**: 정확한 DeepSeek 토크나이저가 필요하며, 사용할수없으면 fail-open합니다.
|
|
39
|
-
- **세션 고정**: 다른 셀렉터 설정과 마찬가지로 변경 사항은 새로 관찰된 세션에만 적용됩니다.
|
|
40
|
-
- **엄격한 파싱**: `codeSkeleton`은 정확히 `{ enabled: boolean }`이어야 합니다. 잘못된 값은 런타임 쪽에서 예외를 던지고, 브라우저 UI에서는 읽을 수 없음으로 표시됩니다.
|
|
41
|
-
|
|
42
|
-
## 설정 UI
|
|
43
|
-
|
|
44
|
-
동일한 설정 섹션에서 압축 프로파일 선택, Auto Compact 트리거 레벨 조정, 코드 스켈레톤 압축 토글을 모두 처리할수있습니다. 토글은 변경시즉시 저장되며, 다시 불러올때저장된 상태가 표시됩니다.
|
|
45
|
-
|
|
46
|
-

|
|
47
|
-
|
|
48
|
-
## 설치
|
|
49
|
-
|
|
50
|
-
소스에서 빌드하여 설치합니다 —— 이 포크는 npm에도 `dsh-context-compression-improved`로 게시되어 있습니다(0.
|
|
51
|
-
|
|
52
|
-
```sh
|
|
53
|
-
git clone https://github.com/drscrewdriver/dsh-context-compression-improved.git
|
|
54
|
-
cd dsh-context-compression-improved
|
|
55
|
-
pnpm install --frozen-lockfile
|
|
56
|
-
pnpm build
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
이후 셀렉터 패키지를 pack 해서 Harness 프로파일에 추가합니다——검증과 제거를 포함한 전체 절차는 [설치 가이드](docs/installation.ko.md)를 참고하세요.
|
|
60
|
-
|
|
61
|
-
## 개발
|
|
62
|
-
|
|
63
|
-
```sh
|
|
64
|
-
pnpm install --frozen-lockfile
|
|
65
|
-
pnpm lint # ESLint 베이스라인(CI에서도 강제)
|
|
66
|
-
pnpm typecheck # runtime + selector + tests tsc 및 bundle 단계
|
|
67
|
-
pnpm test # vitest 전체 스위트
|
|
68
|
-
pnpm test:watch # TDD 루프: 먼저 실패하는 회귀 테스트를 작성하고, 통과시킨다
|
|
69
|
-
pnpm build
|
|
70
|
-
pnpm verify:release
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
기여는 업스트림의 규율을 따릅니다: 먼저 실패하는 회귀 테스트를 추가하고, 모든 프로덕션 변경은 이 저장소 안에 유지하며, "트리거됨", "활성화되었지만 건너뜀", "fail-open"의 증거를 각각 따로 제시하세요. [CONTRIBUTING.md](CONTRIBUTING.md) 참고.
|
|
74
|
-
|
|
75
|
-
## 호환성
|
|
76
|
-
|
|
77
|
-
- 공식 DeepSeek Harness `dsh-v0.
|
|
78
|
-
- Node `^22.19.0 || >=24`와 pnpm `11.7.0`이 필요합니다.
|
|
79
|
-
- 플러그인은 Harness의 공개 확장 API만 사용하며 Harness 코어를 수정하지 않습니다. 비공식 커뮤니티 프로젝트이며 DeepSeek과 제휴하거나 승인받지 않았습니다.
|
|
80
|
-
|
|
81
|
-
## 크레딧과 라이선스
|
|
82
|
-
|
|
83
|
-
- 업스트림 프로젝트와 기존의 모든 작업: [WilliamShi666/dsh-context-compression-selector](https://github.com/WilliamShi666/dsh-context-compression-selector), 작성자 WilliamShi666(MIT).
|
|
84
|
-
- 포크에서 추가된것코드 스켈레톤 게이트, 툴체인, 다국어 문서): drscrewdriver.
|
|
85
|
-
- MIT——[LICENSE](LICENSE)(업스트림 저작권 표기 유지) 참고. 번들된 토크나이저의 출처는 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
|
1
|
+
# dsh-context-compression-improved
|
|
2
|
+
|
|
3
|
+
> [dsh-context-compression-selector](https://github.com/WilliamShi666/dsh-context-compression-selector)의 개선 포크——DeepSeek Harness용 감사 가능한 도구 결과 컨텍스트 압축 셀렉터에, 직교하는 **코드 스켈레톤 압축 게이트*를추가했습니다.
|
|
4
|
+
|
|
5
|
+
[English](README.md) · [中文说明](README.zh.md) · [日本語](README.ja.md) · [Français](README.fr.md) · [Deutsch](README.de.md) · [Italiano](README.it.md) · [Русский](README.ru.md) · [Español](README.es.md) · [변경 로그](CHANGELOG.ko.md) · [설치 가이드](docs/installation.ko.md)
|
|
6
|
+
|
|
7
|
+
> [!NOTE]
|
|
8
|
+
> **이 포크가 업스트림 0.1.0에 추가한것**
|
|
9
|
+
>
|
|
10
|
+
> - 직교하는 **코드 스켈레톤 압축 게이트**(`codeSkeleton.enabled`, 기본값 off): 매우 큰 소스코드 도구 결과가 처음 노출될때 일반 리듀서로 넘어가기 전에 임포트와 선언부의 스켈레톤을 보존할수있습니다(함수 본문은 생략, 에러 라인은 유지).
|
|
11
|
+
> - 동일한 셀렉터 설정 섹션에 모든 압축 프로파일과 독립적인 이 게이트의 토글을 추가.
|
|
12
|
+
> - CI에 통합된 ESLint 베이스라인, `test:watch` TDD 루프, 영어/중국어(간체)/일본어/한국어 문서.
|
|
13
|
+
|
|
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)를 참고하세요.
|
|
16
|
+
|
|
17
|
+
## 이것은 무엇인가
|
|
18
|
+
|
|
19
|
+
장시간 실행되는 에이전트 작업은 대량의 도구 출력을 축적합니다. 이커뮤니티 플러그인은 DeepSeek Harness 코어를 수정하지 않고, 선택 가능하고 감사 가능한 도구 결과 컨텍스트 압축 정책을 제공합니다:
|
|
20
|
+
|
|
21
|
+
- **Fresh**: 모델이 받기 전에 새로 커진 도구 결과 세그먼트를 사전 압축합니다.
|
|
22
|
+
- **Aggregate**: Fresh 압축 후에도 예산을 초과하면 다시 압축합니다.
|
|
23
|
+
- **History / micro-compact**: 최근 작업 컨텍스트를 보호하면서 대상이 되는 오래된 도구 결과를 교체합니다.
|
|
24
|
+
- **TailTrim**: Custom에서만 활성화할 수 있는 선택적 테일 축소 경로입니다.
|
|
25
|
+
- **Native**: Harness 방식의 head/중간/tail 트리밍을 하나의 명시적 프로파일로 유지합니다.
|
|
26
|
+
- **코드 스켈레톤(신규, 직교 게이트)**——아래 참고.
|
|
27
|
+
|
|
28
|
+
모든 결정은 기록됩니다: 단계, 리듀서, 트리거 이유, 건너뜀 이유, 그리고 가능한 경우 정확한 토큰 수.
|
|
29
|
+
|
|
30
|
+
## 코드 스켈레톤 게이트(신규)
|
|
31
|
+
|
|
32
|
+
게이트를 활성화하면 매우 큰 **소스코드 도구 결과**(예: 큰`read_file`)에 대해 먼저 스켈레톤 축소를 시도합니다: 임포트와 타입/함수/클래스 선언을 유지하고, 함수 본문은 마커와 함께 생략하며, 생략된 본문 안의 에러 라인은 보존합니다. 스켈레톤을 생성하거나 검증할 수 없으면 원래의 head 트리밍으로 폴백합니다——이 게이트가 컨텍스트를 악화시킬 수는 없습니다.
|
|
33
|
+
|
|
34
|
+
특성:
|
|
35
|
+
|
|
36
|
+
- **직교**: 선택된 프로파일(`balanced`, `savings`, `cache-strict`, `adaptive`, `custom`, `off`, `native`)과 독립적입니다. 모든 프로파일이이게이트를 받습니다.
|
|
37
|
+
- **기본값 off**: `codeSkeleton: { enabled: false }`이며, 직접 켜기 전까지는 동작하지 않습니다.
|
|
38
|
+
- **측정이 선행**: 정확한 DeepSeek 토크나이저가 필요하며, 사용할수없으면 fail-open합니다.
|
|
39
|
+
- **세션 고정**: 다른 셀렉터 설정과 마찬가지로 변경 사항은 새로 관찰된 세션에만 적용됩니다.
|
|
40
|
+
- **엄격한 파싱**: `codeSkeleton`은 정확히 `{ enabled: boolean }`이어야 합니다. 잘못된 값은 런타임 쪽에서 예외를 던지고, 브라우저 UI에서는 읽을 수 없음으로 표시됩니다.
|
|
41
|
+
|
|
42
|
+
## 설정 UI
|
|
43
|
+
|
|
44
|
+
동일한 설정 섹션에서 압축 프로파일 선택, Auto Compact 트리거 레벨 조정, 코드 스켈레톤 압축 토글을 모두 처리할수있습니다. 토글은 변경시즉시 저장되며, 다시 불러올때저장된 상태가 표시됩니다.
|
|
45
|
+
|
|
46
|
+

|
|
47
|
+
|
|
48
|
+
## 설치
|
|
49
|
+
|
|
50
|
+
소스에서 빌드하여 설치합니다 —— 이 포크는 npm에도 `dsh-context-compression-improved`로 게시되어 있습니다(0.2.0 라인은 dist-tag `dsh-0.2.0`, 0.1.7 라인은 `dsh-0.1.7`, 0.1.5 라인은 `dsh-0.1.5`). 내부 패키지 이름은 의도적으로 업스트림과 동일하게 유지됩니다:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
git clone https://github.com/drscrewdriver/dsh-context-compression-improved.git
|
|
54
|
+
cd dsh-context-compression-improved
|
|
55
|
+
pnpm install --frozen-lockfile
|
|
56
|
+
pnpm build
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
이후 셀렉터 패키지를 pack 해서 Harness 프로파일에 추가합니다——검증과 제거를 포함한 전체 절차는 [설치 가이드](docs/installation.ko.md)를 참고하세요.
|
|
60
|
+
|
|
61
|
+
## 개발
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
pnpm install --frozen-lockfile
|
|
65
|
+
pnpm lint # ESLint 베이스라인(CI에서도 강제)
|
|
66
|
+
pnpm typecheck # runtime + selector + tests tsc 및 bundle 단계
|
|
67
|
+
pnpm test # vitest 전체 스위트
|
|
68
|
+
pnpm test:watch # TDD 루프: 먼저 실패하는 회귀 테스트를 작성하고, 통과시킨다
|
|
69
|
+
pnpm build
|
|
70
|
+
pnpm verify:release
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
기여는 업스트림의 규율을 따릅니다: 먼저 실패하는 회귀 테스트를 추가하고, 모든 프로덕션 변경은 이 저장소 안에 유지하며, "트리거됨", "활성화되었지만 건너뜀", "fail-open"의 증거를 각각 따로 제시하세요. [CONTRIBUTING.md](CONTRIBUTING.md) 참고.
|
|
74
|
+
|
|
75
|
+
## 호환성
|
|
76
|
+
|
|
77
|
+
- 공식 DeepSeek Harness `dsh-v0.2.0-rc.1` 릴리스 기준으로 빌드·테스트되었습니다. peers는 `>=0.2.0-rc.1 <0.2.1-0`를 선언하며 공개된 플러그인 및 프로파일 API만 사용합니다. 이전 Harness 라인은 각자의 dist-tag(`dsh-0.1.7`, `dsh-0.1.5`, `dsh-0.1.2`)로 계속 제공됩니다.
|
|
78
|
+
- Node `^22.19.0 || >=24`와 pnpm `11.7.0`이 필요합니다.
|
|
79
|
+
- 플러그인은 Harness의 공개 확장 API만 사용하며 Harness 코어를 수정하지 않습니다. 비공식 커뮤니티 프로젝트이며 DeepSeek과 제휴하거나 승인받지 않았습니다.
|
|
80
|
+
|
|
81
|
+
## 크레딧과 라이선스
|
|
82
|
+
|
|
83
|
+
- 업스트림 프로젝트와 기존의 모든 작업: [WilliamShi666/dsh-context-compression-selector](https://github.com/WilliamShi666/dsh-context-compression-selector), 작성자 WilliamShi666(MIT).
|
|
84
|
+
- 포크에서 추가된것코드 스켈레톤 게이트, 툴체인, 다국어 문서): drscrewdriver.
|
|
85
|
+
- MIT——[LICENSE](LICENSE)(업스트림 저작권 표기 유지) 참고. 번들된 토크나이저의 출처는 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
package/README.md
CHANGED
|
@@ -1,97 +1,98 @@
|
|
|
1
|
-
# dsh-context-compression-improved
|
|
2
|
-
|
|
3
|
-
> An improved fork of [dsh-context-compression-selector](https://github.com/WilliamShi666/dsh-context-compression-selector) — an auditable tool-result context-compression selector for DeepSeek Harness — adding an orthogonal **code-skeleton compression gate**.
|
|
4
|
-
|
|
5
|
-
[中文说明](README.zh.md) · [日本語](README.ja.md) · [한국어](README.ko.md) · [Changelog](CHANGELOG.md) · [Installation guide](docs/installation.md)
|
|
6
|
-
|
|
7
|
-
> [!NOTE]
|
|
8
|
-
> **What this fork adds on top of upstream 0.1.0:**
|
|
9
|
-
>
|
|
10
|
-
> -
|
|
11
|
-
> -
|
|
12
|
-
> -
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
> [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- **
|
|
23
|
-
- **
|
|
24
|
-
- **
|
|
25
|
-
- **
|
|
26
|
-
- **
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
- **
|
|
38
|
-
- **
|
|
39
|
-
- **
|
|
40
|
-
- **
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
#
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
#
|
|
59
|
-
dsh --profile web
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
pnpm
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
pnpm
|
|
78
|
-
pnpm
|
|
79
|
-
pnpm
|
|
80
|
-
pnpm test
|
|
81
|
-
pnpm
|
|
82
|
-
pnpm
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
1
|
+
# dsh-context-compression-improved
|
|
2
|
+
|
|
3
|
+
> An improved fork of [dsh-context-compression-selector](https://github.com/WilliamShi666/dsh-context-compression-selector) — an auditable tool-result context-compression selector for DeepSeek Harness — adding an orthogonal **code-skeleton compression gate**.
|
|
4
|
+
|
|
5
|
+
[中文说明](README.zh.md) · [日本語](README.ja.md) · [한국어](README.ko.md) · [Français](README.fr.md) · [Deutsch](README.de.md) · [Italiano](README.it.md) · [Русский](README.ru.md) · [Español](README.es.md) · [Changelog](CHANGELOG.md) · [Installation guide](docs/installation.md)
|
|
6
|
+
|
|
7
|
+
> [!NOTE]
|
|
8
|
+
> **What this fork adds on top of upstream 0.1.0:**
|
|
9
|
+
>
|
|
10
|
+
> - An orthogonal **code-skeleton compression gate** (`codeSkeleton.enabled`, default off): the first exposure of an oversized fresh source-code tool result can keep a skeleton of imports and declarations — bodies elided, error lines kept — before the regular reducers run.
|
|
11
|
+
> - A settings toggle for that gate in the same selector settings section, independent of every compression profile.
|
|
12
|
+
> - An ESLint baseline wired into CI, a `test:watch` TDD loop, and documentation in English, Simplified Chinese, Japanese, and Korean.
|
|
13
|
+
|
|
14
|
+
> [!IMPORTANT]
|
|
15
|
+
> This project supports **DeepSeek models only**. Lossless measurement and lossy compression depend on the bundled official DeepSeek tokenizers (`deepseek-v4-flash`, `deepseek-v4-pro`, `deepseek-v4-flash-vision-exp`). Everything else fails open and keeps original tool results. See the [upstream README](https://github.com/WilliamShi666/dsh-context-compression-selector#model-support-and-safety) for the full safety model.
|
|
16
|
+
|
|
17
|
+
## What it is
|
|
18
|
+
|
|
19
|
+
Long-running agent tasks accumulate a large amount of tool output. This community plugin adds selectable, auditable policies for reducing that tool-result context without modifying DeepSeek Harness core:
|
|
20
|
+
|
|
21
|
+
- **Fresh** pre-compresses a newly oversized tool-result segment before the model receives it.
|
|
22
|
+
- **Aggregate** pre-compresses fresh material again when it still grows beyond its budget.
|
|
23
|
+
- **History / micro-compact** replaces eligible old tool results while preserving recent working context.
|
|
24
|
+
- **TailTrim** is an optional Custom-only tail reduction path.
|
|
25
|
+
- **Native** preserves the Harness-style head/middle/tail trimming as one explicit profile.
|
|
26
|
+
- **Code skeleton (new, orthogonal gate)** — see below.
|
|
27
|
+
|
|
28
|
+
Every decision is recorded: stage, reducer, trigger, skip reason, and exact token counts where available.
|
|
29
|
+
|
|
30
|
+
## Code skeleton gate (new)
|
|
31
|
+
|
|
32
|
+
When the gate is enabled, an oversized **fresh source-code tool result** (for example a large `read_file`) first tries a skeleton reduction: imports and type/function/class declarations are kept, function bodies are elided with a marker, and error lines inside elided bodies are preserved. If the skeleton cannot be produced or verified, the result falls back to the original head pruning — the gate can never make context worse.
|
|
33
|
+
|
|
34
|
+
Properties:
|
|
35
|
+
|
|
36
|
+
- **Orthogonal**: independent of the selected profile (`balanced`, `savings`, `cache-strict`, `adaptive`, `custom`, `off`, `native`). All profiles get the gate.
|
|
37
|
+
- **Off by default**: `codeSkeleton: { enabled: false }` until you turn it on.
|
|
38
|
+
- **Measurement-gated**: requires the exact DeepSeek tokenizer; without it the plugin fails open.
|
|
39
|
+
- **Session-frozen**: like all selector settings, changes affect newly observed sessions only.
|
|
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
|
+
|
|
42
|
+
## Settings UI
|
|
43
|
+
|
|
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.
|
|
45
|
+
|
|
46
|
+

|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
**Recommended: install from npm.** One dist-tag per Harness line — `dsh-0.2.0` for the 0.2.0 line (this branch), `dsh-0.1.7` for the 0.1.7 line, `dsh-0.1.5` for the 0.1.5 line, `dsh-0.1.2` for the 0.1.2 line.
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
dsh plugin --profile web add dsh-context-compression-improved@dsh-0.2.0
|
|
54
|
+
# DSH 0.1.7 line:
|
|
55
|
+
# dsh plugin --profile web add dsh-context-compression-improved@dsh-0.1.7
|
|
56
|
+
# DSH 0.1.5 line:
|
|
57
|
+
# dsh plugin --profile web add dsh-context-compression-improved@dsh-0.1.5
|
|
58
|
+
# DSH 0.1.2 line:
|
|
59
|
+
# dsh plugin --profile web add dsh-context-compression-improved@dsh-0.1.2
|
|
60
|
+
dsh --profile web --dump-config
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
From source (alternative — the internal package names intentionally stay upstream's):
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
git clone https://github.com/drscrewdriver/dsh-context-compression-improved.git
|
|
67
|
+
cd dsh-context-compression-improved
|
|
68
|
+
pnpm install --frozen-lockfile
|
|
69
|
+
pnpm build
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Then pack the selector package and add it to a Harness profile — the full walkthrough, including verification and uninstall steps, is in the [installation guide](docs/installation.md).
|
|
73
|
+
|
|
74
|
+
## Development
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
pnpm install --frozen-lockfile
|
|
78
|
+
pnpm lint # ESLint baseline (also enforced in CI)
|
|
79
|
+
pnpm typecheck # runtime + selector + tests tsc, plus the bundle step
|
|
80
|
+
pnpm test # full vitest suite
|
|
81
|
+
pnpm test:watch # TDD loop: write the failing regression first, then make it pass
|
|
82
|
+
pnpm build
|
|
83
|
+
pnpm verify:release
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Contributions follow the upstream discipline: add the failing regression first, keep every production change inside this repository, and explain “triggered”, “enabled but skipped”, and fail-open evidence separately. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
87
|
+
|
|
88
|
+
## Compatibility
|
|
89
|
+
|
|
90
|
+
- Built and tested against the official DeepSeek Harness `dsh-v0.2.0-rc.1` release; peers declare `>=0.2.0-rc.1 <0.2.1-0` and the plugin uses public plugin and profile APIs only. Earlier lines remain served from their own dist-tags (`dsh-0.1.7`, `dsh-0.1.5`, `dsh-0.1.2`).
|
|
91
|
+
- Requires Node `^22.19.0 || >=24` and pnpm `11.7.0`.
|
|
92
|
+
- The plugin uses only public Harness extension APIs and does not modify Harness core code. Unofficial community project, not affiliated with or endorsed by DeepSeek.
|
|
93
|
+
|
|
94
|
+
## Credits and license
|
|
95
|
+
|
|
96
|
+
- Upstream project and all prior work: [WilliamShi666/dsh-context-compression-selector](https://github.com/WilliamShi666/dsh-context-compression-selector) by WilliamShi666 (MIT).
|
|
97
|
+
- Fork additions (code-skeleton gate, tooling, localized docs): drscrewdriver.
|
|
98
|
+
- MIT — see [LICENSE](LICENSE) (upstream copyright notice retained) and [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) for bundled tokenizer provenance.
|
package/README.ru.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# dsh-context-compression-improved
|
|
2
|
+
|
|
3
|
+
> Улучшенный форк [dsh-context-compression-selector](https://github.com/WilliamShi666/dsh-context-compression-selector) — проверяемого селектора сжатия контекста результатов инструментов для DeepSeek Harness — с добавлением ортогонального **гейта сжатия скелетов кода**.
|
|
4
|
+
|
|
5
|
+
[English](README.md) · [中文说明](README.zh.md) · [日本語](README.ja.md) · [한국어](README.ko.md) · [Français](README.fr.md) · [Deutsch](README.de.md) · [Italiano](README.it.md) · [Español](README.es.md) · [Журнал изменений](CHANGELOG.ru.md) · [Руководство по установке](docs/installation.ru.md)
|
|
6
|
+
|
|
7
|
+
> [!NOTE]
|
|
8
|
+
> **Что этот форк добавляет к апстриму 0.1.0:**
|
|
9
|
+
>
|
|
10
|
+
> - Ортогональный **гейт сжатия скелетов кода** (`codeSkeleton.enabled`, по умолчанию выключен): при первом появлении чрезмерного свежего результата инструмента с исходным кодом можно сохранить скелет из импортов и объявлений — тела опускаются, строки с ошибками сохраняются — до того, как запустятся обычные редьюсеры.
|
|
11
|
+
> - Переключатель этого гейта в том же разделе настроек селектора, независимый от каждого профиля сжатия.
|
|
12
|
+
> - Базовую конфигурацию ESLint, подключённую к CI, цикл TDD `test:watch` и документацию на английском, упрощённом китайском, японском и корейском языках.
|
|
13
|
+
|
|
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).
|
|
16
|
+
|
|
17
|
+
## Что это такое
|
|
18
|
+
|
|
19
|
+
Долгоживущие задачи агентов накапливают большой объём вывода инструментов. Этот плагин сообщества добавляет выбираемые и проверяемые политики сокращения контекста результатов инструментов без изменения ядра DeepSeek Harness:
|
|
20
|
+
|
|
21
|
+
- **Fresh** предварительно сжимает новый ставший чрезмерным сегмент результата инструмента до того, как модель его получит.
|
|
22
|
+
- **Aggregate** повторно предварительно сжимает свежий материал, если тот продолжает выходить за свой бюджет.
|
|
23
|
+
- **History / micro-compact** заменяет подходящие старые результаты инструментов, сохраняя недавний рабочий контекст.
|
|
24
|
+
- **TailTrim** — необязательный путь сокращения хвоста, доступный только в режиме Custom.
|
|
25
|
+
- **Native** сохраняет характерное для Harness усечение начала/середины/хвоста как отдельный явный профиль.
|
|
26
|
+
- **Скелет кода (новый, ортогональный гейт)** — см. ниже.
|
|
27
|
+
|
|
28
|
+
Каждое решение фиксируется: этап, редьюсер, триггер, причина пропуска и точные количества токенов, где они доступны.
|
|
29
|
+
|
|
30
|
+
## Гейт скелетов кода (новый)
|
|
31
|
+
|
|
32
|
+
Когда гейт включён, чрезмерный **свежий результат инструмента с исходным кодом** (например, большой `read_file`) сначала пытается пройти редукцию до скелета: импорты и объявления типов/функций/классов сохраняются, тела функций опускаются с маркером, а строки с ошибками внутри опущенных тел сохраняются. Если скелет невозможно построить или проверить, результат откатывается к исходной обрезке начала — гейт никогда не может сделать контекст хуже.
|
|
33
|
+
|
|
34
|
+
Свойства:
|
|
35
|
+
|
|
36
|
+
- **Ортогональность**: независим от выбранного профиля (`balanced`, `savings`, `cache-strict`, `adaptive`, `custom`, `off`, `native`). Гейт получают все профили.
|
|
37
|
+
- **По умолчанию выключен**: `codeSkeleton: { enabled: false }`, пока вы его не включите.
|
|
38
|
+
- **Зависит от измерения**: требует точного токенизатора DeepSeek; без него плагин работает по принципу fail-open.
|
|
39
|
+
- **Заморозка на сессию**: как и все настройки селектора, изменения затрагивают только новые наблюдаемые сессии.
|
|
40
|
+
- **Строгий разбор**: `codeSkeleton` должен быть в точности `{ enabled: boolean }`; некорректные значения вызывают ошибку на стороне рантайма и отображаются в браузерном UI как нечитаемые.
|
|
41
|
+
|
|
42
|
+
## UI настроек
|
|
43
|
+
|
|
44
|
+
Выберите профиль сжатия, задайте уровень срабатывания Auto Compact и включите сжатие скелетов кода в том же разделе настроек. Переключатель сохраняет значение при изменении и показывает сохранённое состояние после перезагрузки.
|
|
45
|
+
|
|
46
|
+

|
|
47
|
+
|
|
48
|
+
## Установка
|
|
49
|
+
|
|
50
|
+
**Рекомендуется: установка из npm.** Один dist-tag на линейку Harness — `dsh-0.2.0` для линейки 0.2.0 (эта ветка), `dsh-0.1.7` для линейки 0.1.7, `dsh-0.1.5` для линейки 0.1.5, `dsh-0.1.2` для линейки 0.1.2.
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
dsh plugin --profile web add dsh-context-compression-improved@dsh-0.2.0
|
|
54
|
+
# DSH 0.1.7 line:
|
|
55
|
+
# dsh plugin --profile web add dsh-context-compression-improved@dsh-0.1.7
|
|
56
|
+
# DSH 0.1.5 line:
|
|
57
|
+
# dsh plugin --profile web add dsh-context-compression-improved@dsh-0.1.5
|
|
58
|
+
# DSH 0.1.2 line:
|
|
59
|
+
# dsh plugin --profile web add dsh-context-compression-improved@dsh-0.1.2
|
|
60
|
+
dsh --profile web --dump-config
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Из исходников (альтернатива — внутренние имена пакетов намеренно остаются апстримовскими):
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
git clone https://github.com/drscrewdriver/dsh-context-compression-improved.git
|
|
67
|
+
cd dsh-context-compression-improved
|
|
68
|
+
pnpm install --frozen-lockfile
|
|
69
|
+
pnpm build
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Затем упакуйте пакет селектора и добавьте его в профиль Harness — полное пошаговое руководство, включая проверку и удаление, приведено в [руководстве по установке](docs/installation.md).
|
|
73
|
+
|
|
74
|
+
## Разработка
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
pnpm install --frozen-lockfile
|
|
78
|
+
pnpm lint # ESLint baseline (also enforced in CI)
|
|
79
|
+
pnpm typecheck # runtime + selector + tests tsc, plus the bundle step
|
|
80
|
+
pnpm test # full vitest suite
|
|
81
|
+
pnpm test:watch # TDD loop: write the failing regression first, then make it pass
|
|
82
|
+
pnpm build
|
|
83
|
+
pnpm verify:release
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Вклад следует апстрим-дисциплине: сначала добавляется падающая регрессия, все производственные изменения остаются в этом репозитории, а свидетельства «triggered», «enabled but skipped» и fail-open объясняются раздельно. См. [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
87
|
+
|
|
88
|
+
## Совместимость
|
|
89
|
+
|
|
90
|
+
- Собрано и протестировано против официального релиза DeepSeek Harness `dsh-v0.2.0-rc.1`; peers объявляют `>=0.2.0-rc.1 <0.2.1-0`, и плагин использует только публичные API плагинов и профилей. Прежние линейки по-прежнему обслуживаются собственными dist-tag (`dsh-0.1.7`, `dsh-0.1.5`, `dsh-0.1.2`).
|
|
91
|
+
- Требуются Node `^22.19.0 || >=24` и pnpm `11.7.0`.
|
|
92
|
+
- Плагин использует только публичные API расширений Harness и не изменяет код ядра Harness. Неофициальный проект сообщества, не связан с DeepSeek и не одобрен им.
|
|
93
|
+
|
|
94
|
+
## Благодарности и лицензия
|
|
95
|
+
|
|
96
|
+
- Апстрим-проект и вся предшествующая работа: [WilliamShi666/dsh-context-compression-selector](https://github.com/WilliamShi666/dsh-context-compression-selector) от WilliamShi666 (MIT).
|
|
97
|
+
- Дополнения форка (гейт скелетов кода, инструментарий, локализованная документация): drscrewdriver.
|
|
98
|
+
- MIT — см. [LICENSE](LICENSE) (уведомление об авторских правах апстрима сохранено) и [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) о происхождении входящих в поставку токенизаторов.
|