dsh-context-compression-improved 0.6.5 → 0.7.0-beta.1

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 (67) hide show
  1. package/CHANGELOG.ja.md +9 -0
  2. package/CHANGELOG.ko.md +9 -0
  3. package/CHANGELOG.md +26 -0
  4. package/CHANGELOG.zh.md +9 -0
  5. package/README.md +1 -0
  6. package/README.zh.md +1 -0
  7. package/eslint.config.js +76 -30
  8. package/package.json +18 -17
  9. package/packages/selector/dsh.plugin.json +1 -1
  10. package/packages/selector/lib/client.js +14 -3
  11. package/packages/selector/lib/index.js +92 -1
  12. package/packages/selector/lib/{advisor-state.js → intent-gate.js} +91 -3
  13. package/packages/selector/lib/profiles.d.ts +9 -0
  14. package/packages/selector/lib/pruner.d.ts +59 -0
  15. package/packages/selector/lib/pruner.js +410 -8
  16. package/packages/selector/lib/style.css +46 -46
  17. package/packages/selector/src/client/decode.ts +6 -2
  18. package/packages/selector/src/deepseek-v4-tokenizer.ts +1 -1
  19. package/packages/selector/src/index.ts +418 -411
  20. package/packages/selector/src/preset-overlay.ts +3 -0
  21. package/packages/selector/src/profiles.ts +30 -10
  22. package/packages/selector/src/pruner/content.ts +1 -1
  23. package/packages/selector/src/pruner/state.ts +7 -0
  24. package/packages/selector/src/pruner.ts +253 -9
  25. package/packages/selector/src/runtime/audit.ts +17 -0
  26. package/packages/selector/src/runtime/config.ts +36 -11
  27. package/packages/selector/src/runtime/reducers.ts +1 -1
  28. package/packages/selector/src/runtime/summary-command.ts +133 -0
  29. package/packages/selector/src/runtime/tokenpilot/advisor-prompt.ts +46 -1
  30. package/packages/selector/src/runtime/tokenpilot/advisor-state.ts +55 -0
  31. package/packages/selector/src/runtime/tokenpilot/intent-fold.ts +53 -0
  32. package/packages/selector/src/runtime/tokenpilot/intent-gate.ts +65 -0
  33. package/packages/selector/src/runtime/tokenpilot/intent-input-mask.ts +125 -0
  34. package/packages/selector/src/runtime/tokenpilot/intent-range.ts +37 -0
  35. package/packages/selector/src/runtime/tokenpilot/locator.ts +2 -2
  36. package/packages/selector/src/runtime/tokenpilot/sidechannel.ts +4 -1
  37. package/packages/selector/src/runtime/types.ts +12 -0
  38. package/packages/selector/tests/auto-compact.client.spec.tsx +214 -213
  39. package/packages/selector/tests/built/client-artifact.spec.ts +2 -0
  40. package/packages/selector/tests/code-skeleton.client.spec.ts +94 -93
  41. package/packages/selector/tests/custom-contract.client.spec.ts +223 -222
  42. package/packages/selector/tests/estimator-channel.client.spec.tsx +252 -252
  43. package/packages/selector/tests/helpers/legacy-settings/index.ts +15 -15
  44. package/packages/selector/tests/helpers/legacy-settings/legacy/provider.d.ts +41 -41
  45. package/packages/selector/tests/helpers/legacy-settings/legacy/provider.js +647 -647
  46. package/packages/selector/tests/helpers/legacy-settings/legacy/redact.js +78 -78
  47. package/packages/selector/tests/helpers/legacy-settings/legacy/util-values.js +234 -234
  48. package/packages/selector/tests/host-preset-overlay.host.spec.ts +203 -203
  49. package/packages/selector/tests/preset-options-write.client.spec.ts +188 -187
  50. package/packages/selector/tests/profiles.client.spec.tsx +436 -434
  51. package/packages/selector/tests/runtime/audit.spec.ts +275 -274
  52. package/packages/selector/tests/runtime/auto-compact-config.spec.ts +3 -3
  53. package/packages/selector/tests/runtime/deepseek-v4-tokenizer.spec.ts +4 -4
  54. package/packages/selector/tests/runtime/intent-gate.spec.ts +62 -0
  55. package/packages/selector/tests/runtime/intent-summary.spec.ts +156 -0
  56. package/packages/selector/tests/runtime/public/public-runtime.spec.ts +5 -0
  57. package/packages/selector/tests/runtime/summary-command.spec.ts +154 -0
  58. package/packages/selector/tests/standing-generation.host.spec.ts +15 -35
  59. package/scripts/packed-components-smoke.mjs +2 -0
  60. package/scripts/packed-install-e2e.mjs +1275 -1273
  61. package/scripts/verify-release.mjs +318 -317
  62. package/tsconfig.tests.json +3 -1
  63. package/vitest.config.ts +14 -0
  64. package/.agents-stash-064.patch +0 -39
  65. package/_dsh_devdeps.json +0 -50
  66. package/_verify064/package/package.json +0 -162
  67. package/_verify064/package/packages/selector/src/client/index.ts +0 -232
@@ -1,4 +1,4 @@
1
- .j7gVQa_settingsSection {
1
+ .WcpPCW_settingsSection {
2
2
  max-width: 720px;
3
3
  color: var(--dsw-alias-label-primary);
4
4
  flex-direction: column;
@@ -6,7 +6,7 @@
6
6
  display: flex;
7
7
  }
8
8
 
9
- .j7gVQa_settingsTitle {
9
+ .WcpPCW_settingsTitle {
10
10
  color: var(--dsw-alias-label-primary);
11
11
  margin: 0;
12
12
  font-size: 16px;
@@ -14,24 +14,24 @@
14
14
  line-height: 24px;
15
15
  }
16
16
 
17
- .j7gVQa_settingsDescription {
17
+ .WcpPCW_settingsDescription {
18
18
  color: var(--dsw-alias-label-tertiary);
19
19
  margin: 0;
20
20
  font-size: 14px;
21
21
  line-height: 22px;
22
22
  }
23
23
 
24
- .j7gVQa_root {
24
+ .WcpPCW_root {
25
25
  width: 100%;
26
26
  }
27
27
 
28
- .j7gVQa_profileGrid {
28
+ .WcpPCW_profileGrid {
29
29
  grid-template-columns: repeat(2, minmax(0, 1fr));
30
30
  gap: 10px;
31
31
  display: grid;
32
32
  }
33
33
 
34
- .j7gVQa_profileCard {
34
+ .WcpPCW_profileCard {
35
35
  border: 1px solid var(--dsw-alias-border-l2);
36
36
  min-height: 112px;
37
37
  color: var(--dsw-alias-label-primary);
@@ -45,41 +45,41 @@
45
45
  display: flex;
46
46
  }
47
47
 
48
- .j7gVQa_profileCard:hover:not(:disabled) {
48
+ .WcpPCW_profileCard:hover:not(:disabled) {
49
49
  background: var(--dsw-alias-interactive-bg-hover);
50
50
  }
51
51
 
52
- .j7gVQa_profileCard[aria-pressed="true"] {
52
+ .WcpPCW_profileCard[aria-pressed="true"] {
53
53
  border-color: var(--dsw-alias-label-primary);
54
54
  }
55
55
 
56
- .j7gVQa_profileCard:active:not(:disabled) {
56
+ .WcpPCW_profileCard:active:not(:disabled) {
57
57
  transform: scale(.99);
58
58
  }
59
59
 
60
- .j7gVQa_profileCard:disabled {
60
+ .WcpPCW_profileCard:disabled {
61
61
  cursor: default;
62
62
  opacity: .6;
63
63
  }
64
64
 
65
- .j7gVQa_profileCard:focus-visible {
65
+ .WcpPCW_profileCard:focus-visible {
66
66
  outline-offset: 2px;
67
67
  outline: 2px solid;
68
68
  }
69
69
 
70
- .j7gVQa_profileCardTop {
70
+ .WcpPCW_profileCardTop {
71
71
  align-items: center;
72
72
  gap: 8px;
73
73
  display: flex;
74
74
  }
75
75
 
76
- .j7gVQa_profileCardTitle {
76
+ .WcpPCW_profileCardTitle {
77
77
  font-size: 14px;
78
78
  font-weight: 500;
79
79
  line-height: 20px;
80
80
  }
81
81
 
82
- .j7gVQa_profileCurrent {
82
+ .WcpPCW_profileCurrent {
83
83
  background: var(--dsw-alias-label-primary);
84
84
  color: var(--dsw-alias-bg-base);
85
85
  border-radius: 999px;
@@ -88,13 +88,13 @@
88
88
  line-height: 14px;
89
89
  }
90
90
 
91
- .j7gVQa_profileCardDetail {
91
+ .WcpPCW_profileCardDetail {
92
92
  color: var(--dsw-alias-label-secondary);
93
93
  font-size: 12px;
94
94
  line-height: 18px;
95
95
  }
96
96
 
97
- .j7gVQa_button {
97
+ .WcpPCW_button {
98
98
  border: 1px solid var(--dsw-alias-border-l2);
99
99
  width: 100%;
100
100
  min-height: 34px;
@@ -109,27 +109,27 @@
109
109
  display: flex;
110
110
  }
111
111
 
112
- .j7gVQa_button:hover {
112
+ .WcpPCW_button:hover {
113
113
  background: var(--dsw-alias-interactive-bg-hover);
114
114
  }
115
115
 
116
- .j7gVQa_button:disabled {
116
+ .WcpPCW_button:disabled {
117
117
  cursor: default;
118
118
  opacity: .6;
119
119
  }
120
120
 
121
- .j7gVQa_copy {
121
+ .WcpPCW_copy {
122
122
  flex: 1;
123
123
  min-width: 0;
124
124
  }
125
125
 
126
- .j7gVQa_label {
126
+ .WcpPCW_label {
127
127
  color: var(--dsw-alias-label-tertiary);
128
128
  font-size: 11px;
129
129
  line-height: 14px;
130
130
  }
131
131
 
132
- .j7gVQa_value {
132
+ .WcpPCW_value {
133
133
  text-overflow: ellipsis;
134
134
  white-space: nowrap;
135
135
  font-size: 13px;
@@ -137,24 +137,24 @@
137
137
  overflow: hidden;
138
138
  }
139
139
 
140
- .j7gVQa_chevron {
140
+ .WcpPCW_chevron {
141
141
  color: var(--dsw-alias-label-secondary);
142
142
  flex: none;
143
143
  }
144
144
 
145
- .j7gVQa_menuCopy {
145
+ .WcpPCW_menuCopy {
146
146
  flex-direction: column;
147
147
  gap: 2px;
148
148
  min-width: 220px;
149
149
  display: flex;
150
150
  }
151
151
 
152
- .j7gVQa_menuTitle {
152
+ .WcpPCW_menuTitle {
153
153
  font-size: 13px;
154
154
  line-height: 17px;
155
155
  }
156
156
 
157
- .j7gVQa_menuDetail {
157
+ .WcpPCW_menuDetail {
158
158
  white-space: normal;
159
159
  max-width: 290px;
160
160
  color: var(--dsw-alias-label-tertiary);
@@ -162,61 +162,61 @@
162
162
  line-height: 15px;
163
163
  }
164
164
 
165
- .j7gVQa_error {
165
+ .WcpPCW_error {
166
166
  color: var(--dsw-alias-state-error-primary);
167
167
  padding: 4px 8px 0;
168
168
  font-size: 11px;
169
169
  line-height: 15px;
170
170
  }
171
171
 
172
- .j7gVQa_unavailable {
172
+ .WcpPCW_unavailable {
173
173
  color: var(--dsw-alias-label-tertiary);
174
174
  padding: 4px 8px 0;
175
175
  font-size: 11px;
176
176
  line-height: 15px;
177
177
  }
178
178
 
179
- .j7gVQa_settingsHint {
179
+ .WcpPCW_settingsHint {
180
180
  color: var(--dsw-alias-label-secondary);
181
181
  padding: 4px 8px 0;
182
182
  font-size: 11px;
183
183
  line-height: 15px;
184
184
  }
185
185
 
186
- .j7gVQa_pricing {
186
+ .WcpPCW_pricing {
187
187
  color: var(--dsw-alias-label-tertiary);
188
188
  padding: 4px 8px 0;
189
189
  font-size: 11px;
190
190
  line-height: 15px;
191
191
  }
192
192
 
193
- .j7gVQa_custom {
193
+ .WcpPCW_custom {
194
194
  border-top: 1px solid var(--dsw-alias-border-l2);
195
195
  margin-top: 16px;
196
196
  padding: 16px 0 0;
197
197
  }
198
198
 
199
- .j7gVQa_customTitle {
199
+ .WcpPCW_customTitle {
200
200
  margin: 0 0 6px;
201
201
  font-size: 13px;
202
202
  line-height: 17px;
203
203
  }
204
204
 
205
- .j7gVQa_customNote {
205
+ .WcpPCW_customNote {
206
206
  color: var(--dsw-alias-label-tertiary);
207
207
  margin: 4px 0;
208
208
  font-size: 11px;
209
209
  line-height: 15px;
210
210
  }
211
211
 
212
- .j7gVQa_stage {
212
+ .WcpPCW_stage {
213
213
  border: 0;
214
214
  border-top: 1px solid var(--dsw-alias-border-l2);
215
215
  margin: 12px 0 0;
216
216
  padding: 12px 0 0;
217
217
  }
218
218
 
219
- .j7gVQa_stageToggle {
219
+ .WcpPCW_stageToggle {
220
220
  align-items: center;
221
221
  gap: 6px;
222
222
  font-size: 12px;
@@ -224,13 +224,13 @@
224
224
  display: inline-flex;
225
225
  }
226
226
 
227
- .j7gVQa_fieldGrid {
227
+ .WcpPCW_fieldGrid {
228
228
  grid-template-columns: 1fr;
229
229
  gap: 8px;
230
230
  display: grid;
231
231
  }
232
232
 
233
- .j7gVQa_field {
233
+ .WcpPCW_field {
234
234
  min-width: 0;
235
235
  color: var(--dsw-alias-label-secondary);
236
236
  flex-direction: column;
@@ -241,7 +241,7 @@
241
241
  display: flex;
242
242
  }
243
243
 
244
- .j7gVQa_field input, .j7gVQa_field select {
244
+ .WcpPCW_field input, .WcpPCW_field select {
245
245
  box-sizing: border-box;
246
246
  border: 1px solid var(--dsw-alias-border-l2);
247
247
  background: var(--dsw-alias-bg-base);
@@ -253,19 +253,19 @@
253
253
  padding: 4px 6px;
254
254
  }
255
255
 
256
- .j7gVQa_field input:focus-visible, .j7gVQa_field select:focus-visible, .j7gVQa_actions button:focus-visible {
256
+ .WcpPCW_field input:focus-visible, .WcpPCW_field select:focus-visible, .WcpPCW_actions button:focus-visible {
257
257
  outline-offset: 2px;
258
258
  outline: 2px solid;
259
259
  }
260
260
 
261
- .j7gVQa_actions {
261
+ .WcpPCW_actions {
262
262
  flex-wrap: wrap;
263
263
  gap: 8px;
264
264
  margin-top: 10px;
265
265
  display: flex;
266
266
  }
267
267
 
268
- .j7gVQa_actions button {
268
+ .WcpPCW_actions button {
269
269
  border: 1px solid var(--dsw-alias-border-l2);
270
270
  min-height: 30px;
271
271
  color: var(--dsw-alias-label-primary);
@@ -274,34 +274,34 @@
274
274
  padding: 4px 8px;
275
275
  }
276
276
 
277
- .j7gVQa_actions button:active:not(:disabled) {
277
+ .WcpPCW_actions button:active:not(:disabled) {
278
278
  transform: scale(.98);
279
279
  }
280
280
 
281
- .j7gVQa_actions button:disabled {
281
+ .WcpPCW_actions button:disabled {
282
282
  opacity: .6;
283
283
  }
284
284
 
285
285
  @media (width <= 560px) {
286
- .j7gVQa_profileGrid {
286
+ .WcpPCW_profileGrid {
287
287
  grid-template-columns: 1fr;
288
288
  }
289
289
  }
290
290
 
291
- .j7gVQa_autoCompact {
291
+ .WcpPCW_autoCompact {
292
292
  border: 1px solid #80808059;
293
293
  border-radius: 8px;
294
294
  margin-top: 24px;
295
295
  padding: 16px;
296
296
  }
297
297
 
298
- .j7gVQa_autoCompactTitle {
298
+ .WcpPCW_autoCompactTitle {
299
299
  margin: 0 0 8px;
300
300
  font-size: 15px;
301
301
  font-weight: 600;
302
302
  }
303
303
 
304
- .j7gVQa_autoCompactRisk {
304
+ .WcpPCW_autoCompactRisk {
305
305
  opacity: .9;
306
306
  margin: 8px 0 0;
307
307
  font-size: 12px;
@@ -5,6 +5,7 @@ import {
5
5
  COMPRESSION_PROFILES,
6
6
  decodeAutoCompactSettings,
7
7
  decodeCodeSkeletonSettings,
8
+ decodeIntentSummarySettings,
8
9
  decodePresetOptionsSettings,
9
10
  isCustomCompressionPolicy,
10
11
  isPlainRecord,
@@ -15,7 +16,7 @@ import {
15
16
  /**
16
17
  * Decode one stored context-compression settings document with exactly the
17
18
  * runtime schema's strictness: a plain object with only `profile`, `custom`,
18
- * `autoCompact`, and `codeSkeleton` keys, a supported profile, a valid Custom
19
+ * `autoCompact`, `codeSkeleton`, and `intentSummary` keys, a supported profile, a valid Custom
19
20
  * document canonicalized to v3 exactly as the runtime resolver would, a
20
21
  * strictly-shaped autoCompact section (absent inherits the 80% default), and
21
22
  * a strictly-shaped codeSkeleton gate (absent inherits off). Anything else
@@ -25,24 +26,27 @@ import {
25
26
  export function decodeSettings(value: unknown): ContextCompressionSettings | undefined {
26
27
  if (!isPlainRecord(value)) return undefined
27
28
  const keys = Object.keys(value)
28
- if (keys.some(key => key !== 'profile' && key !== 'custom' && key !== 'autoCompact' && key !== 'codeSkeleton' && key !== 'presetOptions')) {
29
+ if (keys.some(key => key !== 'profile' && key !== 'custom' && key !== 'autoCompact' && key !== 'codeSkeleton' && key !== 'intentSummary' && key !== 'presetOptions')) {
29
30
  return undefined
30
31
  }
31
32
  const profile = (value as { profile?: unknown }).profile
32
33
  const custom = (value as { custom?: unknown }).custom
33
34
  const autoCompact = decodeAutoCompactSettings((value as { autoCompact?: unknown }).autoCompact)
34
35
  const codeSkeleton = decodeCodeSkeletonSettings((value as { codeSkeleton?: unknown }).codeSkeleton)
36
+ const intentSummary = decodeIntentSummarySettings((value as { intentSummary?: unknown }).intentSummary)
35
37
  const presetOptions = decodePresetOptionsSettings((value as { presetOptions?: unknown }).presetOptions)
36
38
  return typeof profile === 'string'
37
39
  && (COMPRESSION_PROFILES as readonly string[]).includes(profile)
38
40
  && isCustomCompressionPolicy(custom)
39
41
  && autoCompact !== undefined
40
42
  && codeSkeleton !== undefined
43
+ && intentSummary !== undefined
41
44
  ? {
42
45
  profile: profile as CompressionProfile,
43
46
  custom: canonicalizeCustomPolicy(custom),
44
47
  autoCompact,
45
48
  codeSkeleton,
49
+ intentSummary,
46
50
  ...presetOptions === undefined ? {} : { presetOptions },
47
51
  }
48
52
  : undefined
@@ -109,7 +109,7 @@ interface ArtifactCacheEntry {
109
109
  const registryCache = new Map<DeepSeekTokenizerArtifactOrigin, ArtifactCacheEntry>()
110
110
 
111
111
  function artifactForModel(modelId: string): TokenizerArtifact | undefined {
112
- return ARTIFACTS.find(artifact => (artifact.origin.modelIds as readonly string[]).includes(modelId))
112
+ return ARTIFACTS.find(artifact => (artifact.origin.modelIds).includes(modelId))
113
113
  }
114
114
 
115
115
  /**