dsh-context-compression-improved 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/.gitattributes +2 -1
  2. package/.githooks/pre-push +37 -0
  3. package/.github/workflows/ci.yml +8 -8
  4. package/CHANGELOG.ja.md +169 -39
  5. package/CHANGELOG.ko.md +167 -39
  6. package/CHANGELOG.md +212 -16
  7. package/CHANGELOG.zh.md +152 -39
  8. package/CONTRIBUTING.md +22 -22
  9. package/README.ja.md +85 -104
  10. package/README.ko.md +85 -103
  11. package/README.md +1 -19
  12. package/README.zh.md +85 -101
  13. package/THIRD_PARTY_NOTICES.md +14 -14
  14. package/docs/compat-0.1.5-report.md +77 -0
  15. package/docs/installation.ja.md +78 -76
  16. package/docs/installation.ko.md +78 -76
  17. package/docs/installation.md +103 -76
  18. package/docs/installation.zh.md +100 -76
  19. package/docs/repair-log.md +657 -582
  20. package/eslint.config.js +30 -30
  21. package/package.json +75 -54
  22. package/packages/selector/README.md +7 -12
  23. package/packages/selector/README.zh.md +6 -13
  24. package/packages/selector/THIRD_PARTY_NOTICES.md +32 -38
  25. package/packages/selector/cordis.patch.yml +27 -19
  26. package/packages/selector/dsh.plugin.json +16 -16
  27. package/packages/selector/lib/client.d.ts +97 -5
  28. package/packages/selector/lib/client.js +1884 -92
  29. package/packages/selector/lib/config.js +863 -6
  30. package/packages/selector/lib/index.d.ts +29 -21
  31. package/packages/selector/lib/index.js +424 -18
  32. package/packages/selector/lib/invariant.js +4 -4
  33. package/packages/selector/lib/pruner.d.ts +179 -4
  34. package/packages/selector/lib/pruner.js +1406 -371
  35. package/packages/selector/lib/style.css +42 -0
  36. package/packages/selector/lib/tail-trim.js +13 -4
  37. package/packages/selector/package.json +18 -27
  38. package/packages/selector/screenshots.json +3 -6
  39. package/packages/selector/src/client/CompressionProfileControls.tsx +293 -229
  40. package/packages/selector/src/client/CompressionProfileSelector.module.css +199 -170
  41. package/packages/selector/src/client/CompressionProfileSelector.tsx +85 -79
  42. package/packages/selector/src/client/EstimatorControls.tsx +277 -281
  43. package/packages/selector/src/client/decode.ts +57 -49
  44. package/packages/selector/src/client/index.ts +200 -62
  45. package/packages/selector/src/client/locales/de.ts +141 -0
  46. package/packages/selector/src/client/locales/es.ts +141 -0
  47. package/packages/selector/src/client/locales/fr.ts +141 -0
  48. package/packages/selector/src/client/locales/it.ts +141 -0
  49. package/packages/selector/src/client/locales/ja.ts +141 -0
  50. package/packages/selector/src/client/locales/ko.ts +141 -0
  51. package/packages/selector/src/client/locales/ru.ts +141 -0
  52. package/packages/selector/src/client/locales.ts +282 -198
  53. package/packages/selector/src/client/monitor-fab.ts +336 -0
  54. package/packages/selector/src/client/preset-options.ts +88 -70
  55. package/packages/selector/src/client/savings-card.tsx +150 -0
  56. package/packages/selector/src/client/settings-section.tsx +140 -126
  57. package/packages/selector/src/deepseek-v4-tokenizer.ts +205 -210
  58. package/packages/selector/src/index.ts +671 -327
  59. package/packages/selector/src/invariant.ts +113 -113
  60. package/packages/selector/src/profiles.ts +431 -342
  61. package/packages/selector/src/pruner/state.ts +57 -43
  62. package/packages/selector/src/pruner.ts +2736 -2154
  63. package/packages/selector/src/runtime/audit.ts +303 -231
  64. package/packages/selector/src/runtime/config.ts +756 -642
  65. package/packages/selector/src/runtime/measurement.ts +436 -432
  66. package/packages/selector/src/runtime/monitor.ts +235 -0
  67. package/packages/selector/src/runtime/retrieve.ts +479 -457
  68. package/packages/selector/src/runtime/savings.ts +337 -0
  69. package/packages/selector/src/runtime/session-events.ts +30 -17
  70. package/packages/selector/src/runtime/summary-command.ts +127 -0
  71. package/packages/selector/src/runtime/tail-trim.ts +166 -166
  72. package/packages/selector/src/runtime/tokenpilot/advisor-prompt.ts +233 -0
  73. package/packages/selector/src/runtime/tokenpilot/advisor-state.ts +204 -0
  74. package/packages/selector/src/runtime/tokenpilot/advisor.ts +419 -0
  75. package/packages/selector/src/runtime/tokenpilot/benefit.ts +200 -0
  76. package/packages/selector/src/runtime/tokenpilot/estimator.ts +151 -183
  77. package/packages/selector/src/runtime/tokenpilot/intent-fold.ts +53 -0
  78. package/packages/selector/src/runtime/tokenpilot/intent-gate.ts +65 -0
  79. package/packages/selector/src/runtime/tokenpilot/intent-input-mask.ts +125 -0
  80. package/packages/selector/src/runtime/tokenpilot/intent-range.ts +37 -0
  81. package/packages/selector/src/runtime/tokenpilot/sidechannel.ts +303 -275
  82. package/packages/selector/src/runtime/types.ts +365 -325
  83. package/packages/selector/tests/advisor-report.host.spec.ts +223 -0
  84. package/packages/selector/tests/auto-compact.client.spec.tsx +214 -226
  85. package/packages/selector/tests/built/client-artifact.spec.ts +59 -51
  86. package/packages/selector/tests/code-skeleton.client.spec.ts +91 -88
  87. package/packages/selector/tests/custom-contract.client.spec.ts +205 -202
  88. package/packages/selector/tests/estimator-channel.client.spec.tsx +253 -247
  89. package/packages/selector/tests/estimator-route-registration.host.spec.ts +194 -176
  90. package/packages/selector/tests/host-preset-overlay.host.spec.ts +206 -204
  91. package/packages/selector/tests/monitor-fab.client.spec.ts +138 -0
  92. package/packages/selector/tests/preset-options-write.client.spec.ts +207 -181
  93. package/packages/selector/tests/preset-overlay-loader.e2e.host.spec.ts +201 -196
  94. package/packages/selector/tests/preset-overlay.host.spec.ts +8 -18
  95. package/packages/selector/tests/profiles.client.spec.tsx +436 -434
  96. package/packages/selector/tests/public/package-contract.client.spec.ts +78 -33
  97. package/packages/selector/tests/runtime/advice-never-withholds.host.spec.ts +232 -0
  98. package/packages/selector/tests/runtime/advisor-invariant.spec.ts +272 -0
  99. package/packages/selector/tests/runtime/advisor.spec.ts +226 -0
  100. package/packages/selector/tests/runtime/audit.spec.ts +275 -172
  101. package/packages/selector/tests/runtime/deprecated-preset-options.spec.ts +96 -0
  102. package/packages/selector/tests/runtime/intent-gate.spec.ts +62 -0
  103. package/packages/selector/tests/runtime/intent-summary.spec.ts +156 -0
  104. package/packages/selector/tests/runtime/monitor.spec.ts +301 -0
  105. package/packages/selector/tests/runtime/public/public-runtime.spec.ts +2724 -2702
  106. package/packages/selector/tests/runtime/savings.spec.ts +120 -0
  107. package/packages/selector/tests/runtime/session-events.spec.ts +27 -27
  108. package/packages/selector/tests/runtime/summary-command.spec.ts +154 -0
  109. package/packages/selector/tests/runtime/tokenpilot/benefit.spec.ts +217 -0
  110. package/packages/selector/tests/runtime/tokenpilot/estimator.spec.ts +79 -56
  111. package/packages/selector/tests/runtime/tokenpilot/profile-baseline.spec.ts +116 -100
  112. package/packages/selector/tests/settings-seat.client.spec.ts +130 -0
  113. package/packages/selector/tests/standing-generation.host.spec.ts +142 -87
  114. package/packages/selector/tests/subagent-cache-reuse.host.spec.ts +253 -250
  115. package/pnpm-workspace.yaml +66 -19
  116. package/scripts/capture-profile-baseline.mjs +42 -0
  117. package/scripts/generate-tokenizer-fixtures.py +81 -81
  118. package/scripts/generate-vision-fixtures.py +208 -208
  119. package/scripts/{packed-components-smoke.ts → packed-components-smoke.mjs} +732 -713
  120. package/scripts/{packed-install-e2e.ts → packed-install-e2e.mjs} +1273 -1072
  121. package/scripts/toolclass-corpus-replay.mjs +281 -273
  122. package/scripts/{verify-release.ts → verify-release.mjs} +318 -300
  123. package/tests/TEST_INVENTORY.md +41 -42
  124. package/scripts/capture-profile-baseline.ts +0 -80
  125. package/tsconfig.scripts.json +0 -13
  126. /package/{packages/selector/assets/screenshots → docs/assets}/context-compression-selector-profiles.jpg +0 -0
  127. /package/{packages/selector/assets/screenshots → docs/assets}/context-compression-selector-settings.png +0 -0
package/eslint.config.js CHANGED
@@ -1,30 +1,30 @@
1
- import js from '@eslint/js'
2
- import globals from 'globals'
3
- import tseslint from 'typescript-eslint'
4
-
5
- export default tseslint.config(
6
- {
7
- ignores: ['**/node_modules/**', '**/lib/**', '**/dist/**', '**/scripts-dist/**', '**/coverage/**', 'docs/**'],
8
- },
9
- js.configs.recommended,
10
- ...tseslint.configs.recommended,
11
- {
12
- files: ['packages/**/*.{ts,tsx}', 'scripts/**/*.{js,mjs,ts}', 'eslint.config.js'],
13
- languageOptions: {
14
- globals: { ...globals.browser, ...globals.node },
15
- },
16
- rules: {
17
- '@typescript-eslint/no-unused-vars': ['error', {
18
- argsIgnorePattern: '^_',
19
- varsIgnorePattern: '^_',
20
- caughtErrorsIgnorePattern: '^_',
21
- destructuredArrayIgnorePattern: '^_',
22
- }],
23
- },
24
- },
25
- {
26
- // Terminal normalization intentionally matches ANSI/BEL control characters.
27
- files: ['packages/selector/src/runtime/reducers.ts'],
28
- rules: { 'no-control-regex': 'off' },
29
- },
30
- )
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import tseslint from 'typescript-eslint'
4
+
5
+ export default tseslint.config(
6
+ {
7
+ ignores: ['**/node_modules/**', '**/lib/**', '**/dist/**', '**/coverage/**', 'docs/**'],
8
+ },
9
+ js.configs.recommended,
10
+ ...tseslint.configs.recommended,
11
+ {
12
+ files: ['packages/**/*.{ts,tsx}', 'scripts/**/*.{js,mjs}', 'eslint.config.js'],
13
+ languageOptions: {
14
+ globals: { ...globals.browser, ...globals.node },
15
+ },
16
+ rules: {
17
+ '@typescript-eslint/no-unused-vars': ['error', {
18
+ argsIgnorePattern: '^_',
19
+ varsIgnorePattern: '^_',
20
+ caughtErrorsIgnorePattern: '^_',
21
+ destructuredArrayIgnorePattern: '^_',
22
+ }],
23
+ },
24
+ },
25
+ {
26
+ // Terminal normalization intentionally matches ANSI/BEL control characters.
27
+ files: ['packages/selector/src/runtime/reducers.ts'],
28
+ rules: { 'no-control-regex': 'off' },
29
+ },
30
+ )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-context-compression-improved",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public",
@@ -29,6 +29,7 @@
29
29
  "./package.json": "./package.json"
30
30
  },
31
31
  "dependencies": {
32
+ "@deepseek-ai/schemastery": "3.18.2",
32
33
  "@huggingface/tokenizers": "0.1.3",
33
34
  "js-yaml": "^4.3.2"
34
35
  },
@@ -36,9 +37,9 @@
36
37
  "client": {
37
38
  "inject": [
38
39
  "@deepseek-ai/dsh-client-locale",
39
- "@deepseek-ai/dsh-client-runtime",
40
- "@deepseek-ai/dsh-client-ui-settings",
41
- "@deepseek-ai/dsh-client-ui-workspace"
40
+ "@deepseek-ai/dsh-client-ui-primitives",
41
+ "@deepseek-ai/dsh-client-ui-slots",
42
+ "@deepseek-ai/dsh-client-ui-settings"
42
43
  ],
43
44
  "platform": "web"
44
45
  },
@@ -51,43 +52,27 @@
51
52
  "type": "git",
52
53
  "url": "git+https://github.com/drscrewdriver/dsh-context-compression-improved.git"
53
54
  },
54
- "packageManager": "pnpm@11.7.0",
55
55
  "engines": {
56
- "node": "^22.19.0 || >=24.0.0",
57
- "dsh": ">=0.1.2-rc.1 <0.1.3-0"
58
- },
59
- "scripts": {
60
- "build": "pnpm -r --if-present run bundle",
61
- "build:scripts": "tsc -p tsconfig.scripts.json",
62
- "typecheck": "pnpm --filter dsh-context-compression-improved run bundle && pnpm --filter dsh-context-compression-improved run typecheck && pnpm run typecheck:tests",
63
- "typecheck:tests": "tsc --noEmit -p tsconfig.tests.json",
64
- "lint": "eslint packages scripts eslint.config.js",
65
- "lint:fix": "eslint packages scripts eslint.config.js --fix",
66
- "test": "vitest run",
67
- "test:watch": "vitest",
68
- "test:built": "vitest run --config vitest.built.config.ts",
69
- "test:e2e:packed": "node scripts-dist/packed-install-e2e.js",
70
- "test:unit": "vitest run",
71
- "verify:release": "node scripts-dist/verify-release.js",
72
- "pack:dry-run": "pnpm -r --if-present run pack:dry-run"
56
+ "dsh": ">=0.1.2-rc.1 <0.1.3-0",
57
+ "node": "^22.19.0 || >=24.0.0"
73
58
  },
74
59
  "peerDependencies": {
75
60
  "@deepseek-ai/dsh-client-locale": ">=0.1.2-rc.1 <0.1.3-0",
76
- "@deepseek-ai/dsh-client-runtime": ">=0.1.2-rc.1 <0.1.3-0",
61
+ "@deepseek-ai/dsh-client-ui-primitives": ">=0.1.2-rc.1 <0.1.3-0",
77
62
  "@deepseek-ai/dsh-client-ui-settings": ">=0.1.2-rc.1 <0.1.3-0",
78
- "@deepseek-ai/dsh-client-ui-workspace": ">=0.1.2-rc.1 <0.1.3-0"
63
+ "@deepseek-ai/dsh-client-ui-slots": ">=0.1.2-rc.1 <0.1.3-0"
79
64
  },
80
65
  "peerDependenciesMeta": {
81
66
  "@deepseek-ai/dsh-client-locale": {
82
67
  "optional": true
83
68
  },
84
- "@deepseek-ai/dsh-client-runtime": {
69
+ "@deepseek-ai/dsh-client-ui-primitives": {
85
70
  "optional": true
86
71
  },
87
72
  "@deepseek-ai/dsh-client-ui-settings": {
88
73
  "optional": true
89
74
  },
90
- "@deepseek-ai/dsh-client-ui-workspace": {
75
+ "@deepseek-ai/dsh-client-ui-slots": {
91
76
  "optional": true
92
77
  }
93
78
  },
@@ -96,33 +81,55 @@
96
81
  "@deepseek-ai/cordis-plugin-group": "1.0.1",
97
82
  "@deepseek-ai/cordis-plugin-include": "1.0.6",
98
83
  "@deepseek-ai/cordis-plugin-loader": "1.0.2",
99
- "@deepseek-ai/dsh-agent": "0.1.1-rc.2",
100
- "@deepseek-ai/dsh-agent-loop": "0.1.1-rc.2",
101
- "@deepseek-ai/dsh-agent-loop-testkit": "0.1.1-rc.2",
102
- "@deepseek-ai/dsh-agent-presets": "0.1.1-rc.2",
103
- "@deepseek-ai/dsh-client-locale": "0.1.1-rc.2",
104
- "@deepseek-ai/dsh-client-runtime": "0.1.1-rc.2",
105
- "@deepseek-ai/dsh-client-ui-primitives": "0.1.1-rc.2",
106
- "@deepseek-ai/dsh-client-ui-settings": "0.1.1-rc.2",
107
- "@deepseek-ai/dsh-client-ui-slots": "0.1.1-rc.2",
108
- "@deepseek-ai/dsh-client-ui-workspace": "0.1.1-rc.2",
109
- "@deepseek-ai/dsh-command-compact": "0.1.1-rc.2",
110
- "@deepseek-ai/dsh-commands": "0.1.1-rc.2",
111
- "@deepseek-ai/dsh-compaction": "0.1.1-rc.2",
112
- "@deepseek-ai/dsh-compaction-basic": "0.1.1-rc.2",
113
- "@deepseek-ai/dsh-invariants": "0.1.1-rc.2",
114
- "@deepseek-ai/dsh-llm": "0.1.1-rc.2",
115
- "@deepseek-ai/dsh-llm-deepseek": "0.1.1-rc.2",
116
- "@deepseek-ai/dsh-scope": "0.1.1-rc.2",
117
- "@deepseek-ai/dsh-session": "0.1.1-rc.2",
118
- "@deepseek-ai/dsh-settings": "0.1.1-rc.2",
119
- "@deepseek-ai/dsh-subagent": "0.1.1-rc.2",
120
- "@deepseek-ai/dsh-subagent-fork-in-process": "0.1.1-rc.2",
121
- "@deepseek-ai/dsh-subagent-spawn-in-process": "0.1.1-rc.2",
122
- "@deepseek-ai/dsh-system-prompt": "0.1.1-rc.2",
123
- "@deepseek-ai/dsh-token-meter": "0.1.1-rc.2",
124
- "@deepseek-ai/dsh-tools": "0.1.1-rc.2",
125
- "@deepseek-ai/schemastery": "3.18.1",
84
+ "@deepseek-ai/dsh-agent": "0.1.2-rc.1",
85
+ "@deepseek-ai/dsh-agent-loop": "0.1.2-rc.1",
86
+ "@deepseek-ai/dsh-agent-loop-testkit": "0.1.2-rc.1",
87
+ "@deepseek-ai/dsh-agent-presets": "0.1.2-rc.1",
88
+ "@deepseek-ai/dsh-anonymous-user-id": "0.1.2-rc.1",
89
+ "@deepseek-ai/dsh-api-remotes": "0.1.2-rc.1",
90
+ "@deepseek-ai/dsh-api-session-controller": "0.1.2-rc.1",
91
+ "@deepseek-ai/dsh-atomic-write": "0.1.2-rc.1",
92
+ "@deepseek-ai/dsh-attachment": "0.1.2-rc.1",
93
+ "@deepseek-ai/dsh-client-locale": "0.1.2-rc.1",
94
+ "@deepseek-ai/dsh-client-store": "0.1.2-rc.1",
95
+ "@deepseek-ai/dsh-client-ui-primitives": "0.1.2-rc.1",
96
+ "@deepseek-ai/dsh-client-ui-session": "0.1.2-rc.1",
97
+ "@deepseek-ai/dsh-client-ui-settings": "0.1.2-rc.1",
98
+ "@deepseek-ai/dsh-client-ui-slots": "0.1.2-rc.1",
99
+ "@deepseek-ai/dsh-client-ui-workspace": "0.1.2-rc.1",
100
+ "@deepseek-ai/dsh-code-runtime": "0.1.2-rc.1",
101
+ "@deepseek-ai/dsh-command-compact": "0.1.2-rc.1",
102
+ "@deepseek-ai/dsh-commands": "0.1.2-rc.1",
103
+ "@deepseek-ai/dsh-compaction": "0.1.2-rc.1",
104
+ "@deepseek-ai/dsh-compaction-basic": "0.1.2-rc.1",
105
+ "@deepseek-ai/dsh-cordis-host-runner": "0.1.2-rc.1",
106
+ "@deepseek-ai/dsh-credentials": "0.1.2-rc.1",
107
+ "@deepseek-ai/dsh-goal": "0.1.2-rc.1",
108
+ "@deepseek-ai/dsh-home-paths": "0.1.2-rc.1",
109
+ "@deepseek-ai/dsh-host-plugin-inventory": "0.1.2-rc.1",
110
+ "@deepseek-ai/dsh-invariants": "0.1.2-rc.1",
111
+ "@deepseek-ai/dsh-jobs": "0.1.2-rc.1",
112
+ "@deepseek-ai/dsh-launch-environment": "0.1.2-rc.1",
113
+ "@deepseek-ai/dsh-llm": "0.1.2-rc.1",
114
+ "@deepseek-ai/dsh-llm-deepseek": "0.1.2-rc.1",
115
+ "@deepseek-ai/dsh-llm-retry": "0.1.2-rc.1",
116
+ "@deepseek-ai/dsh-message-feedback": "0.1.2-rc.1",
117
+ "@deepseek-ai/dsh-sandbox": "0.1.2-rc.1",
118
+ "@deepseek-ai/dsh-scope": "0.1.2-rc.1",
119
+ "@deepseek-ai/dsh-session": "0.1.2-rc.1",
120
+ "@deepseek-ai/dsh-session-persistence": "0.1.2-rc.1",
121
+ "@deepseek-ai/dsh-session-projection": "0.1.2-rc.1",
122
+ "@deepseek-ai/dsh-settings": "0.1.2-rc.1",
123
+ "@deepseek-ai/dsh-subagent": "0.1.2-rc.1",
124
+ "@deepseek-ai/dsh-subagent-fork-in-process": "0.1.2-rc.1",
125
+ "@deepseek-ai/dsh-subagent-in-process-driver": "0.1.2-rc.1",
126
+ "@deepseek-ai/dsh-subagent-spawn-in-process": "0.1.2-rc.1",
127
+ "@deepseek-ai/dsh-system-prompt": "0.1.2-rc.1",
128
+ "@deepseek-ai/dsh-token-meter": "0.1.2-rc.1",
129
+ "@deepseek-ai/dsh-tools": "0.1.2-rc.1",
130
+ "@deepseek-ai/dsh-user-approval": "0.1.2-rc.1",
131
+ "@deepseek-ai/dsh-user-questions": "0.1.2-rc.1",
132
+ "@deepseek-ai/schemastery": "3.18.2",
126
133
  "@eslint/js": "^10.0.1",
127
134
  "@testing-library/react": "^16.3.2",
128
135
  "@tsdown/css": "^0.22.14",
@@ -138,5 +145,19 @@
138
145
  "typescript": "^6.0.3",
139
146
  "typescript-eslint": "^8.69.0",
140
147
  "vitest": "^4.1.8"
148
+ },
149
+ "scripts": {
150
+ "build": "pnpm -r --if-present run bundle",
151
+ "typecheck": "pnpm --filter dsh-context-compression-improved run bundle && pnpm --filter dsh-context-compression-improved run typecheck && pnpm run typecheck:tests",
152
+ "typecheck:tests": "tsc --noEmit -p tsconfig.tests.json",
153
+ "lint": "eslint packages scripts eslint.config.js",
154
+ "lint:fix": "eslint packages scripts eslint.config.js --fix",
155
+ "test": "vitest run",
156
+ "test:watch": "vitest",
157
+ "test:built": "vitest run --config vitest.built.config.ts",
158
+ "test:e2e:packed": "node scripts/packed-install-e2e.mjs",
159
+ "test:unit": "vitest run",
160
+ "verify:release": "node scripts/verify-release.mjs",
161
+ "pack:dry-run": "pnpm -r --if-present run pack:dry-run"
141
162
  }
142
- }
163
+ }
@@ -14,18 +14,13 @@ dsh --profile web --dump-config
14
14
  dsh --profile web --dump-config
15
15
  ```
16
16
 
17
- This one command installs the Bundle and its pinned `@huggingface/tokenizers` dependency; there is no separate runtime package. The Bundle contributes Host settings, the Web UI, and a reversible preset overlay. All presets except the exact built-in `minimal` id receive the compression stack; switching non-Minimal presets preserves the saved selector settings. Minimal pauses plugin compression without deleting the setting.
18
-
19
- ## What it provides
20
-
21
- It provides deterministic Fresh, Aggregate, History, Native tool-result, and Custom TailTrim compression; a plugin-owned `context_compression_retrieve` recovery tool; structured audit records; and a pinned offline DeepSeek V4 tokenizer. It uses only public DeepSeek Harness APIs and supports both `0.1.1-rc.2` and `0.1.2-alpha.5`; it does not patch Harness core.
22
-
23
- Lossy rewrites require exact same-revision counts before and after replacement. Verified model ids are `deepseek-v4-flash`, `deepseek-v4-pro`, and `deepseek-v4-flash-vision-exp`. Vision text counting uses the separately pinned `deepseek-ai/DeepSeek-V4-Flash-Vision-Exp` tokenizer. Vision images use the official image-processor arithmetic validated against official golden fixtures and are reported as `tokenizer-estimate`: the four alignment residues over valid intrinsic dimensions are collapsed to their midpoint, with 384 tokens retained as the per-image upper bound; malformed or unevaluable dimensions use a fixed 256-token fallback. The estimate is not exact because the absolute prompt position and the adapter's final image projection are not publicly observable. Image-bearing tool-result candidates remain exact-ineligible and intact; unknown models, unavailable tokenizer assets, unsafe tool groups, and incomplete text measurements still fail open.
24
-
25
- Audit log records use the prefix `context-compression audit ` and distinguish policy snapshots, skipped/disabled components, committed rewrites, fail-open errors, and observed core `compaction/summary` events. No audit record contains prompt or tool-result content.
26
-
27
- The first `policy-frozen` record carries the complete settings/deployment snapshot. It is emitted through the Harness logger, so its retention follows the configured log sink; standard prune/replacement Session events remain the durable proof of committed rewrites. This package does not hard-code a private path below `~/.dsh`.
17
+ This one command installs the single `dsh-context-compression-improved` package: the compression
18
+ runtime, the Host settings, the Web UI and the reversible preset overlay all ship in it.
19
+ The Bundle contributes Host settings, the Web UI, and a reversible preset overlay. All presets
20
+ except the exact built-in `minimal` id receive the compression stack; switching non-Minimal
21
+ presets preserves the saved selector settings. Minimal pauses plugin compression without
22
+ deleting the setting.
28
23
 
29
24
  Verified compatibility: DeepSeek Harness `dsh-v0.1.1-rc.2` and `dsh-v0.1.2-alpha.5`, Node `^22.19.0 || >=24`. No Harness core patch is required.
30
25
 
31
- See the [full README](https://github.com/WilliamShi666/dsh-context-compression-improved#readme) for profiles, defaults, audit evidence, Adaptive/cache limitations, upgrade/removal, and security guidance. Tokenizer provenance and checksums are in `assets/deepseek-v4/manifest.json` and `assets/deepseek-v4-vision-exp/manifest.json`, summarized in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). This package is not affiliated with or endorsed by DeepSeek.
26
+ See the [full README](https://github.com/WilliamShi666/dsh-context-compression-improved#readme) for profiles, defaults, audit evidence, Adaptive/cache limitations, upgrade/removal, and security guidance. This package is not affiliated with or endorsed by DeepSeek.
@@ -14,18 +14,11 @@ dsh --profile web --dump-config
14
14
  dsh --profile web --dump-config
15
15
  ```
16
16
 
17
- 这一条命令会安装 Bundle 及其固定版本的 `@huggingface/tokenizers` 依赖,不再需要单独的 runtime 包。Bundle 提供 Host 设置、Web UI 和可逆的 preset overlay。除 id 精确等于内置 `minimal` 的 preset 外,其他 preset 都会获得压缩能力;非 Minimal preset 之间切换时已保存设置保持不变。Minimal 只暂停插件压缩,不删除设置。
17
+ 这一条命令安装单一的 `dsh-context-compression-improved` 包:压缩运行时、Host 设置、Web UI
18
+ 与可逆 preset overlay 全部包含在其中。除 id 精确等于内置 `minimal` 的 preset 外,
19
+ 其他 preset 都会获得压缩能力;非 Minimal preset 之间切换时已保存设置保持不变。
20
+ Minimal 只暂停插件压缩,不删除设置。
18
21
 
19
- ## 本包能力
22
+ 已验证兼容 DeepSeek Harness `dsh-v0.1.1-rc.2` 与 `dsh-v0.1.2-alpha.5`,Node `^22.19.0 || >=24`。不需要修改 Harness 核心。
20
23
 
21
- 本包提供确定性的 Fresh、Aggregate、History、Native 工具结果与 Custom TailTrim 压缩,插件自有的 `context_compression_retrieve` 恢复工具,结构化审计记录,以及固定版本的离线 DeepSeek V4 tokenizer。它只使用 DeepSeek Harness 的公开 API,兼容 `0.1.1-rc.2` 与 `0.1.2-alpha.5`,不修改 Harness 核心。
22
-
23
- 有损改写要求 replacement 前后取得同 revision 的 exact count。明确验证过的模型 id 为 `deepseek-v4-flash`、`deepseek-v4-pro` 与 `deepseek-v4-flash-vision-exp`。视觉模型的文本计数使用独立固定的 `deepseek-ai/DeepSeek-V4-Flash-Vision-Exp` tokenizer。图像 token 使用由官方 golden fixtures 逐项验证的官方图像处理算术,并以 `tokenizer-estimate` 上报:有效 intrinsic 尺寸的四种对齐位置取中值,每张图片保留 384 token 上限;尺寸畸形或无法计算时固定计为 256 token。由于绝对 prompt 位置与 adapter 最终图片投影不可公开观测,该数值不标记为 exact。含图片的工具结果候选仍不具备 exact 资格并保持原样;未知模型、tokenizer 资产不可用、不安全工具组或文本计量不完整时继续 fail-open。
24
-
25
- 审计日志以 `context-compression audit ` 开头,区分策略快照、组件关闭/跳过、已提交 rewrite、fail-open 错误和已观察到的核心 `compaction/summary`。审计记录不包含 prompt 或工具结果正文。
26
-
27
- 首次 `policy-frozen` 会携带完整 settings/deployment 快照。它通过 Harness logger 输出,因此保留期限由部署的日志 sink 决定;标准 prune/replacement Session event 仍是已提交 rewrite 的持久证据。本包不会在 `~/.dsh` 下硬编码私有路径。
28
-
29
- 已验证兼容:DeepSeek Harness `dsh-v0.1.1-rc.2` 与 `dsh-v0.1.2-alpha.5`,Node `^22.19.0 || >=24`。不需要修改 Harness 核心。
30
-
31
- Profile、默认值、审计证据、Adaptive/cache 限制、升级/卸载与安全说明见[完整 README](https://github.com/WilliamShi666/dsh-context-compression-improved#readme)。Tokenizer 来源与校验和在 `assets/deepseek-v4/manifest.json`、`assets/deepseek-v4-vision-exp/manifest.json`,并汇总于 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。本包与 DeepSeek 无隶属或背书关系。
24
+ Profile、默认值、审计证据、Adaptive/cache 限制、升级/卸载与安全说明见[完整 README](https://github.com/WilliamShi666/dsh-context-compression-improved#readme)。本包与 DeepSeek 无隶属或背书关系。
@@ -1,38 +1,32 @@
1
- # Third-party notices
2
-
3
- Portions of this package are adapted from the MIT-licensed DeepSeek Harness, verified against `dsh-v0.1.1-rc.2` (`b150a551b8d465e31e418e1b2eaf5e79bbb7d28e`).
4
-
5
- ## DeepSeek Harness MIT notice
6
-
7
- Copyright (c) 2026 DeepSeek
8
-
9
- Permission is hereby granted, free of charge, to any person obtaining a copy
10
- of this software and associated documentation files (the "Software"), to deal
11
- in the Software without restriction, including without limitation the rights
12
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
- copies of the Software, and to permit persons to whom the Software is
14
- furnished to do so, subject to the following conditions:
15
-
16
- The above copyright notice and this permission notice shall be included in all
17
- copies or substantial portions of the Software.
18
-
19
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
- SOFTWARE.
26
-
27
- This package also distributes `tokenizer.json` and `tokenizer_config.json` from these pinned official repositories, both under the MIT license:
28
-
29
- - `deepseek-ai/DeepSeek-V4-Pro` revision `0e1a0e5e52aea73055f50fef6f2423db370265b6` (serves `deepseek-v4-flash` and `deepseek-v4-pro`), in `assets/deepseek-v4/`.
30
- - `deepseek-ai/DeepSeek-V4-Flash-Vision-Exp` revision `6821d6ad3681a4b137b066b76094fa82ebd0a380` (serves `deepseek-v4-flash-vision-exp`), in `assets/deepseek-v4-vision-exp/`. This tokenizer is a distinct artifact, not an alias of the V4 Pro tokenizer.
31
-
32
- The exact provenance and SHA-256 values are in each directory's `manifest.json`; the upstream license text ships beside the assets. The vision image-token arithmetic is a port of the repository's `inference/image_processor.py` at the same pinned revision.
33
-
34
- This package depends on `@huggingface/tokenizers` 0.1.3 under Apache-2.0. Its NPM package carries the dependency license text.
35
-
36
- This package depends on `js-yaml` under MIT; its production dependency `argparse` is licensed under Python-2.0. Their NPM packages carry the dependency license texts.
37
-
38
- This is an unofficial community package and is not endorsed by DeepSeek.
1
+ # Third-party notices
2
+
3
+ Portions of this package are adapted from the MIT-licensed DeepSeek Harness, verified against `dsh-v0.1.1-rc.2` (`b150a551b8d465e31e418e1b2eaf5e79bbb7d28e`).
4
+
5
+ ## DeepSeek Harness MIT notice
6
+
7
+ Copyright (c) 2026 DeepSeek
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ This package carries the official DeepSeek tokenizer assets, with their exact license and
28
+ provenance manifests, under `assets/`.
29
+
30
+ This package depends on `js-yaml` under MIT; its production dependency `argparse` is licensed under Python-2.0. Their NPM packages carry the dependency license texts.
31
+
32
+ This is an unofficial community package and is not endorsed by DeepSeek.
@@ -1,19 +1,27 @@
1
- # Standalone Profile Bundle entry. The same package may already be present in a
2
- # Harness distribution; its Host implementation reference-counts the preset
3
- # decoration so the two rows never install two compression stacks.
4
- - insert:
5
- - id: context-compression-improved-bundle
6
- name: 'dsh-context-compression-improved'
7
- config:
8
- presetOverlay: true
9
- # The estimator catalog route rides its own row. Registering an HTTP route
10
- # authorizes against the calling fiber, so only a fiber that declares
11
- # `webServer` can reach it; a runtime probe cannot substitute. Keeping that
12
- # declaration off the main row leaves the compression stack loadable on
13
- # profiles that have no web server at all.
14
- - id: context-compression-improved-estimator-catalog
15
- name: 'dsh-context-compression-improved'
16
- inject:
17
- - webServer
18
- config:
19
- estimatorCatalogRoute: true
1
+ # Standalone Profile Bundle entry. The same package may already be present in a
2
+ # Harness distribution; its Host implementation reference-counts the preset
3
+ # decoration so the two rows never install two compression stacks.
4
+ - insert:
5
+ - id: context-compression-improved-bundle
6
+ name: 'dsh-context-compression-improved'
7
+ config:
8
+ presetOverlay: true
9
+ # The HTTP routes ride their own row so the compression stack stays loadable
10
+ # on profiles that have no host web server. Measured on the host source:
11
+ # `dsh-host-webserver.register` performs no authorization check and
12
+ # `ctx.get(name)` only asks whether the providing fiber is active, so this
13
+ # `inject` is belt-and-braces — the row is simply absent instead of
14
+ # announcing a pending route on a webServer-less profile. The two-channel
15
+ # registration inside the plugin covers both arrival orders on its own.
16
+ #
17
+ # `estimatorCatalogRoute` is the only flag this row sets. The retired
18
+ # review gate's `reviewQueueRoute` used to live here; that key no longer
19
+ # exists in the plugin's Config schema (a reduction must never block
20
+ # automatic processing), so setting it would advertise a route that can
21
+ # never register.
22
+ - id: context-compression-improved-estimator-catalog
23
+ name: 'dsh-context-compression-improved'
24
+ inject:
25
+ - webServer
26
+ config:
27
+ estimatorCatalogRoute: true
@@ -1,16 +1,16 @@
1
- {
2
- "id": "dsh-external/dsh-context-compression-improved",
3
- "version": "0.1.1",
4
- "main": "./lib/index.js",
5
- "description": "Auditable tool-result context-compression selector with code-skeleton gate for DeepSeek Harness",
6
- "engines": {
7
- "dsh": ">=0.1.2-rc.1 <0.2.0-0"
8
- },
9
- "contributes": {
10
- "tools": [],
11
- "skills": []
12
- },
13
- "client": {
14
- "main": "./lib/client.js"
15
- }
16
- }
1
+ {
2
+ "id": "dsh-external/dsh-context-compression-improved",
3
+ "version": "0.2.5",
4
+ "main": "./lib/index.js",
5
+ "description": "Auditable tool-result context-compression selector with code-skeleton gate for DeepSeek Harness",
6
+ "engines": {
7
+ "dsh": ">=0.1.2-rc.1 <0.1.3-0"
8
+ },
9
+ "contributes": {
10
+ "tools": [],
11
+ "skills": []
12
+ },
13
+ "client": {
14
+ "main": "./lib/client.js"
15
+ }
16
+ }
@@ -1,5 +1,7 @@
1
- import { ClientContext, SettingsScope } from "@deepseek-ai/dsh-client-runtime/client";
2
- import { InjectFace, PropsLocale, PropsRuntime } from "@deepseek-ai/dsh-client-ui-slots";
1
+ import { Context } from "@deepseek-ai/cordis";
2
+ import "@deepseek-ai/dsh-settings/types";
3
+ import { SettingsScope } from "@deepseek-ai/dsh-client-ui-settings/client";
4
+ import { InjectFace, PropsLocale } from "@deepseek-ai/dsh-client-ui-slots";
3
5
  //#region src/profiles.d.ts
4
6
  /** Public context-compression choices shared by the Host schema and browser selector. */
5
7
  declare const COMPRESSION_PROFILES: readonly ["off", "native", "balanced", "cache-strict", "savings", "adaptive", "tokenpilot-inspired", "custom"];
@@ -70,6 +72,17 @@ interface AutoCompactSettings {
70
72
  interface CodeSkeletonSettings {
71
73
  enabled: boolean;
72
74
  }
75
+ /**
76
+ * Orthogonal turn-tail intent-summary gate, mirrored browser-safe from the
77
+ * runtime: independent of every profile, default off.
78
+ */
79
+ interface IntentSummarySettings {
80
+ enabled: boolean;
81
+ }
82
+ /** Floating compression-monitor panel (FAB); visibility switch. */
83
+ interface MonitorPanelSettings {
84
+ enabled: boolean;
85
+ }
73
86
  /** Browser-safe mirror of the runtime presetOptions section. */
74
87
  interface PresetOptionsSettings {
75
88
  readonly dedupeToolResults?: boolean;
@@ -82,6 +95,13 @@ interface PresetOptionsSettings {
82
95
  readonly estimatorBaseUrl?: string;
83
96
  readonly estimatorApiKey?: string;
84
97
  readonly estimatorTimeoutMs?: number;
98
+ /** Advisory advisor channel; `''` (the default) keeps the advisor off. */
99
+ readonly advisorMode?: '' | 'host' | 'direct';
100
+ readonly advisorTimeoutMs?: number;
101
+ readonly advisorRefreshTurns?: number;
102
+ readonly advisorScoreThreshold?: number;
103
+ readonly advisorSampleLimit?: number;
104
+ readonly advisorMinTokens?: number;
85
105
  }
86
106
  /** Durable settings section owned by this package. */
87
107
  interface ContextCompressionSettings {
@@ -93,6 +113,10 @@ interface ContextCompressionSettings {
93
113
  autoCompact: AutoCompactSettings;
94
114
  /** Code-skeleton reducer gate captured independently of `profile`. */
95
115
  codeSkeleton: CodeSkeletonSettings;
116
+ /** Turn-tail intent-summary gate captured independently of `profile`. */
117
+ intentSummary: IntentSummarySettings;
118
+ /** Floating compression-monitor panel (FAB); absent inherits hidden. */
119
+ monitorPanel?: MonitorPanelSettings;
96
120
  /** Optional tokenpilot-inspired sub-capability overrides (presence-validated only). */
97
121
  presetOptions?: PresetOptionsSettings;
98
122
  }
@@ -123,7 +147,6 @@ declare const zh: {
123
147
  'estimator.description': string;
124
148
  'estimator.mode': string;
125
149
  'estimator.mode.off': string;
126
- 'estimator.followHost': string;
127
150
  'estimator.mode.host': string;
128
151
  'estimator.mode.direct': string;
129
152
  'estimator.inactive': string;
@@ -167,6 +190,34 @@ declare const zh: {
167
190
  'codeSkeleton.enabled': string;
168
191
  'codeSkeleton.enabled.on': string;
169
192
  'codeSkeleton.enabled.off': string;
193
+ 'intentSummary.title': string;
194
+ 'intentSummary.description': string;
195
+ 'intentSummary.enabled': string;
196
+ 'intentSummary.enabled.on': string;
197
+ 'intentSummary.enabled.off': string;
198
+ 'monitor.fab.title': string;
199
+ 'monitor.panel.title': string;
200
+ 'monitor.panel.net': string;
201
+ 'monitor.panel.gross': string;
202
+ 'monitor.panel.offsets': string;
203
+ 'monitor.panel.context': string;
204
+ 'monitor.panel.suggest': string;
205
+ 'monitor.panel.cacheHit': string;
206
+ 'monitor.panel.cost': string;
207
+ 'monitor.panel.intent': string;
208
+ 'monitor.panel.overrideHint': string;
209
+ 'monitor.panel.resume': string;
210
+ 'monitor.panel.disable': string;
211
+ 'monitor.panel.stateOn': string;
212
+ 'monitor.panel.stateOff': string;
213
+ 'monitor.panel.gateUnknown': string;
214
+ 'monitor.panel.lastFold': string;
215
+ 'monitor.panel.stale': string;
216
+ 'monitorPanel.title': string;
217
+ 'monitorPanel.description': string;
218
+ 'monitorPanel.enabled': string;
219
+ 'monitorPanel.enabled.on': string;
220
+ 'monitorPanel.enabled.off': string;
170
221
  'custom.title': string;
171
222
  'custom.settingsHint': string;
172
223
  'custom.sessionScope': string;
@@ -198,6 +249,20 @@ declare const zh: {
198
249
  'custom.save': string;
199
250
  'custom.reset': string;
200
251
  'custom.invalid': string;
252
+ 'savings.title': string;
253
+ 'savings.netExact': string;
254
+ 'savings.netEstimated': string;
255
+ 'savings.gross': string;
256
+ 'savings.offsets': string;
257
+ 'savings.empty': string;
258
+ 'savings.basisExact': string;
259
+ 'savings.basisEstimated': string;
260
+ 'savings.basisNote': string;
261
+ 'savings.requests': string;
262
+ 'savings.cacheHit': string;
263
+ 'savings.actualCost': string;
264
+ 'savings.savedMoney': string;
265
+ 'savings.perSession': string;
201
266
  };
202
267
  /** Locale keys that every context-compression selector dictionary must provide. */
203
268
  type ContextCompressionLocaleKey = keyof typeof zh;
@@ -212,10 +277,20 @@ interface CompressionSelectorInjected {
212
277
  resetCustom: () => Promise<void>;
213
278
  saveAutoCompact: (thresholdPercent: number) => Promise<void>;
214
279
  saveCodeSkeleton: (enabled: boolean) => Promise<void>;
280
+ saveIntentSummary: (enabled: boolean) => Promise<void>;
281
+ saveMonitorPanel: (enabled: boolean) => Promise<void>;
215
282
  /** Patch of `presetOptions` members; an explicit `undefined` clears that field. */
216
283
  savePresetOptions: (options: PresetOptionsPatch) => Promise<void>;
217
284
  }
218
- type CompressionProfileSelectorProps = PropsRuntime<'settings.section'> & PropsLocale<'context-compression'> & InjectFace<CompressionSelectorInjected>;
285
+ /**
286
+ * Owner-agnostic panel props: the same component registers under the 0.1.5
287
+ * `settings.plugins.tab` card (no owner props) and the legacy
288
+ * `settings.section` page (whose shell supplies `close`), so the section
289
+ * owner share stays optional.
290
+ */
291
+ type CompressionProfileSelectorProps = {
292
+ close?: () => void;
293
+ } & PropsLocale<'context-compression'> & InjectFace<CompressionSelectorInjected>;
219
294
  declare module '@deepseek-ai/dsh-client-ui-slots' {
220
295
  interface LocaleNamespaceMap {
221
296
  'context-compression': ContextCompressionLocaleKey;
@@ -223,7 +298,24 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
223
298
  }
224
299
  //#endregion
225
300
  //#region src/client/index.d.ts
301
+ /**
302
+ * Harness 0.1.5 mounts the web core's `slots` service on the client context
303
+ * but no longer ships a public type for it; declare the face this plugin
304
+ * consumes (same shape dsh-thinking-levels and dsh-prime-memory rely on).
305
+ * `inject` factories may be sync (return a disposer) or generator (yield the
306
+ * registration); slot options are validated at runtime per slot kind, which
307
+ * lets one entry supply both `id` (Desktop, list) and `key` (CLI, keyed).
308
+ */
309
+ interface SlotsService {
310
+ inject(slot: string, register: () => (() => void) | Generator<() => void>): () => void;
311
+ register(options: Record<string, unknown>, component: unknown): () => void;
312
+ }
313
+ declare module '@deepseek-ai/cordis' {
314
+ interface Context {
315
+ slots: SlotsService;
316
+ }
317
+ }
226
318
  declare const inject: string[];
227
- declare function apply(ctx: ClientContext): void;
319
+ declare function apply(ctx: Context): void;
228
320
  //#endregion
229
321
  export { type CompressionProfile, type CompressionProfileSelectorProps, type CompressionSelectorInjected, type ContextCompressionSettings, apply, inject };