dsh-context-compression-improved 0.7.0-beta.1 → 0.7.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/.github/workflows/ci.yml +39 -39
- package/CHANGELOG.ja.md +217 -220
- package/CHANGELOG.ko.md +211 -214
- package/CHANGELOG.md +392 -376
- package/CHANGELOG.zh.md +196 -199
- package/README.md +97 -97
- package/README.zh.md +86 -86
- package/package.json +18 -17
- package/packages/selector/dsh.plugin.json +1 -1
- package/packages/selector/lib/client.js +733 -0
- package/packages/selector/lib/style.css +46 -46
- package/packages/selector/src/client/decode.ts +53 -53
- package/packages/selector/src/client/index.ts +30 -0
- 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 +205 -205
- package/packages/selector/src/preset-overlay.ts +629 -629
- package/packages/selector/src/profiles.ts +414 -414
- package/packages/selector/src/pruner/content.ts +198 -198
- package/packages/selector/src/pruner/state.ts +57 -57
- package/packages/selector/src/pruner.ts +2665 -2665
- package/packages/selector/src/runtime/audit.ts +303 -303
- package/packages/selector/src/runtime/config.ts +731 -731
- package/packages/selector/src/runtime/reducers.ts +1674 -1674
- package/packages/selector/src/runtime/summary-command.ts +133 -133
- package/packages/selector/src/runtime/tokenpilot/advisor-prompt.ts +233 -233
- package/packages/selector/src/runtime/tokenpilot/advisor-state.ts +204 -204
- package/packages/selector/src/runtime/tokenpilot/intent-fold.ts +53 -53
- package/packages/selector/src/runtime/tokenpilot/intent-gate.ts +65 -65
- package/packages/selector/src/runtime/tokenpilot/intent-input-mask.ts +125 -125
- package/packages/selector/src/runtime/tokenpilot/intent-range.ts +37 -37
- package/packages/selector/src/runtime/tokenpilot/locator.ts +128 -128
- package/packages/selector/src/runtime/tokenpilot/sidechannel.ts +306 -306
- package/packages/selector/src/runtime/types.ts +358 -358
- package/packages/selector/tests/built/client-artifact.spec.ts +61 -61
- package/packages/selector/tests/helpers/legacy-settings/index.ts +15 -15
- package/packages/selector/tests/helpers/legacy-settings/legacy/provider.d.ts +41 -41
- package/packages/selector/tests/helpers/legacy-settings/legacy/provider.js +647 -647
- package/packages/selector/tests/helpers/legacy-settings/legacy/redact.js +78 -78
- package/packages/selector/tests/helpers/legacy-settings/legacy/util-values.js +234 -234
- package/packages/selector/tests/host-preset-overlay.host.spec.ts +203 -203
- package/packages/selector/tests/runtime/auto-compact-config.spec.ts +523 -523
- package/packages/selector/tests/runtime/deepseek-v4-tokenizer.spec.ts +122 -122
- package/packages/selector/tests/runtime/intent-gate.spec.ts +62 -62
- package/packages/selector/tests/runtime/intent-summary.spec.ts +156 -156
- package/packages/selector/tests/runtime/summary-command.spec.ts +154 -154
- package/scripts/packed-components-smoke.mjs +734 -734
- package/tests/TEST_INVENTORY.md +41 -41
- package/tsconfig.tests.json +17 -17
- package/vitest.config.ts +57 -57
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.
|
|
1
|
+
.j7gVQa_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
|
-
.
|
|
9
|
+
.j7gVQa_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
|
-
.
|
|
17
|
+
.j7gVQa_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
|
-
.
|
|
24
|
+
.j7gVQa_root {
|
|
25
25
|
width: 100%;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.
|
|
28
|
+
.j7gVQa_profileGrid {
|
|
29
29
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
30
30
|
gap: 10px;
|
|
31
31
|
display: grid;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.
|
|
34
|
+
.j7gVQa_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
|
-
.
|
|
48
|
+
.j7gVQa_profileCard:hover:not(:disabled) {
|
|
49
49
|
background: var(--dsw-alias-interactive-bg-hover);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
.
|
|
52
|
+
.j7gVQa_profileCard[aria-pressed="true"] {
|
|
53
53
|
border-color: var(--dsw-alias-label-primary);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
.
|
|
56
|
+
.j7gVQa_profileCard:active:not(:disabled) {
|
|
57
57
|
transform: scale(.99);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
.
|
|
60
|
+
.j7gVQa_profileCard:disabled {
|
|
61
61
|
cursor: default;
|
|
62
62
|
opacity: .6;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
.
|
|
65
|
+
.j7gVQa_profileCard:focus-visible {
|
|
66
66
|
outline-offset: 2px;
|
|
67
67
|
outline: 2px solid;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
.
|
|
70
|
+
.j7gVQa_profileCardTop {
|
|
71
71
|
align-items: center;
|
|
72
72
|
gap: 8px;
|
|
73
73
|
display: flex;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
.
|
|
76
|
+
.j7gVQa_profileCardTitle {
|
|
77
77
|
font-size: 14px;
|
|
78
78
|
font-weight: 500;
|
|
79
79
|
line-height: 20px;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
.
|
|
82
|
+
.j7gVQa_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
|
-
.
|
|
91
|
+
.j7gVQa_profileCardDetail {
|
|
92
92
|
color: var(--dsw-alias-label-secondary);
|
|
93
93
|
font-size: 12px;
|
|
94
94
|
line-height: 18px;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
.
|
|
97
|
+
.j7gVQa_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
|
-
.
|
|
112
|
+
.j7gVQa_button:hover {
|
|
113
113
|
background: var(--dsw-alias-interactive-bg-hover);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
.
|
|
116
|
+
.j7gVQa_button:disabled {
|
|
117
117
|
cursor: default;
|
|
118
118
|
opacity: .6;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
.
|
|
121
|
+
.j7gVQa_copy {
|
|
122
122
|
flex: 1;
|
|
123
123
|
min-width: 0;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
.
|
|
126
|
+
.j7gVQa_label {
|
|
127
127
|
color: var(--dsw-alias-label-tertiary);
|
|
128
128
|
font-size: 11px;
|
|
129
129
|
line-height: 14px;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
.
|
|
132
|
+
.j7gVQa_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
|
-
.
|
|
140
|
+
.j7gVQa_chevron {
|
|
141
141
|
color: var(--dsw-alias-label-secondary);
|
|
142
142
|
flex: none;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
.
|
|
145
|
+
.j7gVQa_menuCopy {
|
|
146
146
|
flex-direction: column;
|
|
147
147
|
gap: 2px;
|
|
148
148
|
min-width: 220px;
|
|
149
149
|
display: flex;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
.
|
|
152
|
+
.j7gVQa_menuTitle {
|
|
153
153
|
font-size: 13px;
|
|
154
154
|
line-height: 17px;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
.
|
|
157
|
+
.j7gVQa_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
|
-
.
|
|
165
|
+
.j7gVQa_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
|
-
.
|
|
172
|
+
.j7gVQa_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
|
-
.
|
|
179
|
+
.j7gVQa_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
|
-
.
|
|
186
|
+
.j7gVQa_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
|
-
.
|
|
193
|
+
.j7gVQa_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
|
-
.
|
|
199
|
+
.j7gVQa_customTitle {
|
|
200
200
|
margin: 0 0 6px;
|
|
201
201
|
font-size: 13px;
|
|
202
202
|
line-height: 17px;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
.
|
|
205
|
+
.j7gVQa_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
|
-
.
|
|
212
|
+
.j7gVQa_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
|
-
.
|
|
219
|
+
.j7gVQa_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
|
-
.
|
|
227
|
+
.j7gVQa_fieldGrid {
|
|
228
228
|
grid-template-columns: 1fr;
|
|
229
229
|
gap: 8px;
|
|
230
230
|
display: grid;
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
.
|
|
233
|
+
.j7gVQa_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
|
-
.
|
|
244
|
+
.j7gVQa_field input, .j7gVQa_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
|
-
.
|
|
256
|
+
.j7gVQa_field input:focus-visible, .j7gVQa_field select:focus-visible, .j7gVQa_actions button:focus-visible {
|
|
257
257
|
outline-offset: 2px;
|
|
258
258
|
outline: 2px solid;
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
.
|
|
261
|
+
.j7gVQa_actions {
|
|
262
262
|
flex-wrap: wrap;
|
|
263
263
|
gap: 8px;
|
|
264
264
|
margin-top: 10px;
|
|
265
265
|
display: flex;
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
.
|
|
268
|
+
.j7gVQa_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
|
-
.
|
|
277
|
+
.j7gVQa_actions button:active:not(:disabled) {
|
|
278
278
|
transform: scale(.98);
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
.
|
|
281
|
+
.j7gVQa_actions button:disabled {
|
|
282
282
|
opacity: .6;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
@media (width <= 560px) {
|
|
286
|
-
.
|
|
286
|
+
.j7gVQa_profileGrid {
|
|
287
287
|
grid-template-columns: 1fr;
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
.
|
|
291
|
+
.j7gVQa_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
|
-
.
|
|
298
|
+
.j7gVQa_autoCompactTitle {
|
|
299
299
|
margin: 0 0 8px;
|
|
300
300
|
font-size: 15px;
|
|
301
301
|
font-weight: 600;
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
-
.
|
|
304
|
+
.j7gVQa_autoCompactRisk {
|
|
305
305
|
opacity: .9;
|
|
306
306
|
margin: 8px 0 0;
|
|
307
307
|
font-size: 12px;
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
/** Browser-safe settings decoding shared by the client entry and node tests. */
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
canonicalizeCustomPolicy,
|
|
5
|
-
COMPRESSION_PROFILES,
|
|
6
|
-
decodeAutoCompactSettings,
|
|
7
|
-
decodeCodeSkeletonSettings,
|
|
8
|
-
decodeIntentSummarySettings,
|
|
9
|
-
decodePresetOptionsSettings,
|
|
10
|
-
isCustomCompressionPolicy,
|
|
11
|
-
isPlainRecord,
|
|
12
|
-
type CompressionProfile,
|
|
13
|
-
type ContextCompressionSettings,
|
|
14
|
-
} from '../profiles.ts'
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Decode one stored context-compression settings document with exactly the
|
|
18
|
-
* runtime schema's strictness: a plain object with only `profile`, `custom`,
|
|
19
|
-
* `autoCompact`, `codeSkeleton`, and `intentSummary` keys, a supported profile, a valid Custom
|
|
20
|
-
* document canonicalized to v3 exactly as the runtime resolver would, a
|
|
21
|
-
* strictly-shaped autoCompact section (absent inherits the 80% default), and
|
|
22
|
-
* a strictly-shaped codeSkeleton gate (absent inherits off). Anything else
|
|
23
|
-
* decodes to `undefined` so the UI reports the document as unreadable instead
|
|
24
|
-
* of silently disagreeing with the runtime.
|
|
25
|
-
*/
|
|
26
|
-
export function decodeSettings(value: unknown): ContextCompressionSettings | undefined {
|
|
27
|
-
if (!isPlainRecord(value)) return undefined
|
|
28
|
-
const keys = Object.keys(value)
|
|
29
|
-
if (keys.some(key => key !== 'profile' && key !== 'custom' && key !== 'autoCompact' && key !== 'codeSkeleton' && key !== 'intentSummary' && key !== 'presetOptions')) {
|
|
30
|
-
return undefined
|
|
31
|
-
}
|
|
32
|
-
const profile = (value as { profile?: unknown }).profile
|
|
33
|
-
const custom = (value as { custom?: unknown }).custom
|
|
34
|
-
const autoCompact = decodeAutoCompactSettings((value as { autoCompact?: unknown }).autoCompact)
|
|
35
|
-
const codeSkeleton = decodeCodeSkeletonSettings((value as { codeSkeleton?: unknown }).codeSkeleton)
|
|
36
|
-
const intentSummary = decodeIntentSummarySettings((value as { intentSummary?: unknown }).intentSummary)
|
|
37
|
-
const presetOptions = decodePresetOptionsSettings((value as { presetOptions?: unknown }).presetOptions)
|
|
38
|
-
return typeof profile === 'string'
|
|
39
|
-
&& (COMPRESSION_PROFILES as readonly string[]).includes(profile)
|
|
40
|
-
&& isCustomCompressionPolicy(custom)
|
|
41
|
-
&& autoCompact !== undefined
|
|
42
|
-
&& codeSkeleton !== undefined
|
|
43
|
-
&& intentSummary !== undefined
|
|
44
|
-
? {
|
|
45
|
-
profile: profile as CompressionProfile,
|
|
46
|
-
custom: canonicalizeCustomPolicy(custom),
|
|
47
|
-
autoCompact,
|
|
48
|
-
codeSkeleton,
|
|
49
|
-
intentSummary,
|
|
50
|
-
...presetOptions === undefined ? {} : { presetOptions },
|
|
51
|
-
}
|
|
52
|
-
: undefined
|
|
53
|
-
}
|
|
1
|
+
/** Browser-safe settings decoding shared by the client entry and node tests. */
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
canonicalizeCustomPolicy,
|
|
5
|
+
COMPRESSION_PROFILES,
|
|
6
|
+
decodeAutoCompactSettings,
|
|
7
|
+
decodeCodeSkeletonSettings,
|
|
8
|
+
decodeIntentSummarySettings,
|
|
9
|
+
decodePresetOptionsSettings,
|
|
10
|
+
isCustomCompressionPolicy,
|
|
11
|
+
isPlainRecord,
|
|
12
|
+
type CompressionProfile,
|
|
13
|
+
type ContextCompressionSettings,
|
|
14
|
+
} from '../profiles.ts'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Decode one stored context-compression settings document with exactly the
|
|
18
|
+
* runtime schema's strictness: a plain object with only `profile`, `custom`,
|
|
19
|
+
* `autoCompact`, `codeSkeleton`, and `intentSummary` keys, a supported profile, a valid Custom
|
|
20
|
+
* document canonicalized to v3 exactly as the runtime resolver would, a
|
|
21
|
+
* strictly-shaped autoCompact section (absent inherits the 80% default), and
|
|
22
|
+
* a strictly-shaped codeSkeleton gate (absent inherits off). Anything else
|
|
23
|
+
* decodes to `undefined` so the UI reports the document as unreadable instead
|
|
24
|
+
* of silently disagreeing with the runtime.
|
|
25
|
+
*/
|
|
26
|
+
export function decodeSettings(value: unknown): ContextCompressionSettings | undefined {
|
|
27
|
+
if (!isPlainRecord(value)) return undefined
|
|
28
|
+
const keys = Object.keys(value)
|
|
29
|
+
if (keys.some(key => key !== 'profile' && key !== 'custom' && key !== 'autoCompact' && key !== 'codeSkeleton' && key !== 'intentSummary' && key !== 'presetOptions')) {
|
|
30
|
+
return undefined
|
|
31
|
+
}
|
|
32
|
+
const profile = (value as { profile?: unknown }).profile
|
|
33
|
+
const custom = (value as { custom?: unknown }).custom
|
|
34
|
+
const autoCompact = decodeAutoCompactSettings((value as { autoCompact?: unknown }).autoCompact)
|
|
35
|
+
const codeSkeleton = decodeCodeSkeletonSettings((value as { codeSkeleton?: unknown }).codeSkeleton)
|
|
36
|
+
const intentSummary = decodeIntentSummarySettings((value as { intentSummary?: unknown }).intentSummary)
|
|
37
|
+
const presetOptions = decodePresetOptionsSettings((value as { presetOptions?: unknown }).presetOptions)
|
|
38
|
+
return typeof profile === 'string'
|
|
39
|
+
&& (COMPRESSION_PROFILES as readonly string[]).includes(profile)
|
|
40
|
+
&& isCustomCompressionPolicy(custom)
|
|
41
|
+
&& autoCompact !== undefined
|
|
42
|
+
&& codeSkeleton !== undefined
|
|
43
|
+
&& intentSummary !== undefined
|
|
44
|
+
? {
|
|
45
|
+
profile: profile as CompressionProfile,
|
|
46
|
+
custom: canonicalizeCustomPolicy(custom),
|
|
47
|
+
autoCompact,
|
|
48
|
+
codeSkeleton,
|
|
49
|
+
intentSummary,
|
|
50
|
+
...presetOptions === undefined ? {} : { presetOptions },
|
|
51
|
+
}
|
|
52
|
+
: undefined
|
|
53
|
+
}
|
|
@@ -11,6 +11,13 @@ import {
|
|
|
11
11
|
import { DEFAULT_CUSTOM_COMPRESSION_POLICY } from '../profiles.ts'
|
|
12
12
|
import { decodeSettings } from './decode.ts'
|
|
13
13
|
import { en, zh } from './locales.ts'
|
|
14
|
+
import { de } from './locales/de.ts'
|
|
15
|
+
import { es } from './locales/es.ts'
|
|
16
|
+
import { fr } from './locales/fr.ts'
|
|
17
|
+
import { it } from './locales/it.ts'
|
|
18
|
+
import { ja } from './locales/ja.ts'
|
|
19
|
+
import { ko } from './locales/ko.ts'
|
|
20
|
+
import { ru } from './locales/ru.ts'
|
|
14
21
|
import { planPresetOptionsOps, presetOptionsOpsAccepted } from './preset-options.ts'
|
|
15
22
|
import type { ScopeSnapshot, SettingsScope } from './scope-face.ts'
|
|
16
23
|
|
|
@@ -69,6 +76,29 @@ function sameCustomPolicy(
|
|
|
69
76
|
|
|
70
77
|
export function apply(ctx: ClientContext): void {
|
|
71
78
|
ctx.locale.register(NS, { zh, en })
|
|
79
|
+
// de/es/fr/it/ja/ko/ru are not host built-ins (`BuiltInLocaleId` is zh|en), so
|
|
80
|
+
// their dictionaries ride the single-locale untyped register overload, and each
|
|
81
|
+
// needs an `addLanguage` definition to become selectable — the catalog owns
|
|
82
|
+
// setLocale and the Language settings row, and a definition's fallback chain
|
|
83
|
+
// must end at English. Labels are self-described in their own language. One
|
|
84
|
+
// occupied locale must not sink activation, hence the per-language guard.
|
|
85
|
+
const languages = [
|
|
86
|
+
{ id: 'de', label: 'Deutsch', dict: de },
|
|
87
|
+
{ id: 'es', label: 'Español', dict: es },
|
|
88
|
+
{ id: 'fr', label: 'Français', dict: fr },
|
|
89
|
+
{ id: 'it', label: 'Italiano', dict: it },
|
|
90
|
+
{ id: 'ja', label: '日本語', dict: ja },
|
|
91
|
+
{ id: 'ko', label: '한국어', dict: ko },
|
|
92
|
+
{ id: 'ru', label: 'Русский', dict: ru },
|
|
93
|
+
] as const
|
|
94
|
+
for (const language of languages) {
|
|
95
|
+
try {
|
|
96
|
+
ctx.locale.register(NS, language.id, language.dict)
|
|
97
|
+
ctx.locale.addLanguage({ id: language.id, label: language.label, fallback: 'en' })
|
|
98
|
+
} catch (error) {
|
|
99
|
+
console.warn(`[dsh-context-compression-improved] locale "${language.id}" registration failed:`, error)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
72
102
|
// Section label translator, captured EAGERLY: the settings shell evaluates
|
|
73
103
|
// `label()` during its own render; a lazy ctx.locale accessor inside the
|
|
74
104
|
// thunk would throw there if `locale` ever left this module's inject list
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { ContextCompressionLocaleKey } from '../locales.ts'
|
|
2
|
+
|
|
3
|
+
/** German copy matching every simplified Chinese selector key. */
|
|
4
|
+
export const de = {
|
|
5
|
+
'nav': 'Kontextkomprimierung wählen',
|
|
6
|
+
'settings.title': 'Kontextkomprimierung wählen',
|
|
7
|
+
'settings.description': 'Wählen Sie ein Komprimierungsprofil für die aktuelle Sitzung und konfigurieren Sie dessen Parameter.',
|
|
8
|
+
'label': 'Kontextkomprimierung',
|
|
9
|
+
'status.loading': 'Wird geladen',
|
|
10
|
+
'status.unavailable': 'Nicht verfügbar',
|
|
11
|
+
'status.presetUnavailable': 'Das Preset dieser Sitzung bietet keine Kontextkomprimierung, oder die Verfügbarkeit ist noch nicht bestätigt.',
|
|
12
|
+
'status.minimalUnavailable': 'Der Minimalmodus lädt für diese Sitzung keine Kontextkomprimierung. Die Auswahl ist aus und das native Harness-Verhalten gilt. Wechseln Sie zu Standard, PTC / Coding, Kreativ oder zu einem kompatiblen eigenen Preset, um sie zu konfigurieren.',
|
|
13
|
+
'status.saveFailed': 'Speichern fehlgeschlagen. Bitte erneut versuchen.',
|
|
14
|
+
'pricing.disclosure': 'Offizielle DeepSeek-Preise, geprüft am 2026-08-25. Spitzenzeiten Mo–Fr 09:00–12:00 und 14:00–18:00 (Asia/Shanghai), sonst Nebenzeiten. Anfragen über eine Grenze hinweg verwenden eine Kostenspanne.',
|
|
15
|
+
'profile.balanced': 'Ausbalanciert',
|
|
16
|
+
'profile.cache-strict': 'Cache Strict (Präfixschutz)',
|
|
17
|
+
'profile.savings': 'Sparen',
|
|
18
|
+
'profile.adaptive': 'Adaptiv (kostenbewusst)',
|
|
19
|
+
'profile.tokenpilot-inspired': 'TokenPilot-inspiriert',
|
|
20
|
+
'estimator.title': 'Schätzer (optional)',
|
|
21
|
+
'estimator.description': 'Ein kleines Hilfsmodell schätzt ohne Beispiele, ob alte Datei-Lesevorgänge wahrscheinlich noch referenziert werden; nur beratend für das Altern des Verlaufs. Ohne Konfiguration oder bei Fehlern greift reines Regelverhalten.',
|
|
22
|
+
'estimator.mode': 'Kanal',
|
|
23
|
+
'estimator.mode.off': 'Aus (nur Regeln)',
|
|
24
|
+
'estimator.mode.host': 'Host-Modell (nutzt konfigurierte Anbieter)',
|
|
25
|
+
'estimator.mode.direct': 'Direkter OpenAI-kompatibler Endpunkt',
|
|
26
|
+
'estimator.inactive': 'Der Schätzer gehört nur zum Profil „TokenPilot-inspiriert“: dessen Preset-Optionen (Deduplizierungszeiger, Zusammenfassungsanker, Lesestatus-Semantik und der Schätzer-Kanal) werden nie in ein anderes Profil übernommen, daher hat das aktuelle Profil „{profile}“ keinen Schätzer-Kanal. Wählen Sie „TokenPilot-inspiriert“, dann erhält dieser Bereich eine Kanalwahl — konfigurierte Anbieter nutzen (Host-Modell) oder ein direkter OpenAI-kompatibler Endpunkt.',
|
|
27
|
+
'estimator.provider': 'Anbieter',
|
|
28
|
+
'estimator.provider.placeholder': 'Leer folgt dem Standardmodell der Sitzung; aus der Liste wählen oder eigene ID eingeben',
|
|
29
|
+
'estimator.model.placeholder': 'Leer folgt dem Standardmodell der Sitzung; aus der Liste wählen oder eigene ID eingeben',
|
|
30
|
+
'estimator.hostReuse': 'Der Host-Kanal nutzt die in DSH bereits konfigurierten Anbieter und Zugangsdaten — kein API-Schlüssel nötig, und hier wird keiner akzeptiert.',
|
|
31
|
+
'estimator.hostRoute': 'Aktuelle Route: {route}.',
|
|
32
|
+
'estimator.hostUnresolved': 'noch unbestimmt (wählen Sie ein Standardmodell in den DSH-Einstellungen oder geben Sie hier Anbieter und Modell an)',
|
|
33
|
+
'estimator.baseUrl': 'Basis-URL des Endpunkts (/v1)',
|
|
34
|
+
'estimator.model': 'Modell',
|
|
35
|
+
'estimator.apiKey': 'API-Schlüssel (nur schreiben, nie angezeigt)',
|
|
36
|
+
'estimator.apiKey.placeholder': 'Endpunkt-Schlüssel eingeben; Speichern beim Verlassen des Felds',
|
|
37
|
+
'estimator.apiKey.set': 'Gesetzt · neuen Wert eingeben, um ihn zu überschreiben',
|
|
38
|
+
'estimator.apiKey.clear': 'Löschen',
|
|
39
|
+
'estimator.apiKey.overwrite': 'Ein Geheimnis ist gespeichert; neuen Wert eingeben und das Feld verlassen, um ihn zu überschreiben.',
|
|
40
|
+
'detail.tokenpilot-inspired': 'Auf Ausbalanciert aufsetzend: Deduplizierungszeiger, Wiederherstellungs-Freistellung, Zusammenfassungsanker, Präfixstabilisierung und Lesestatus-Semantik; der Schätzer braucht einen separat konfigurierten Endpunkt',
|
|
41
|
+
'profile.custom': 'Eigene / Experimentell',
|
|
42
|
+
'profile.native': 'Native Referenz',
|
|
43
|
+
'profile.off': 'Plugin aus',
|
|
44
|
+
'profile.current': 'Aktuelles Profil',
|
|
45
|
+
'detail.balanced': 'Reduziert frische Tool-Ergebnisse deterministisch; altert alte Ergebnisse bei hohem Füllstand',
|
|
46
|
+
'detail.cache-strict': 'Altert den gesendeten Verlauf nur bei bestätigter Kapazitätslast; Anbieter-Cache-Treffer bleiben Best-Effort',
|
|
47
|
+
'detail.savings': 'Nutzt kleinere Ziele und altert alte Tool-Ergebnisse früher; günstigere Anfragen sind nicht garantiert',
|
|
48
|
+
'detail.adaptive': 'Nutzt Fresh/Aggregate von Ausbalanciert; altert den Verlauf nur, wenn benachbarte offizielle Nutzung und aktuelle offizielle Preise eine klare Ersparnis belegen',
|
|
49
|
+
'detail.custom': 'Wählen Sie umgesetzte Stufen und gemessene Schwellenwerte für neue Sitzungen',
|
|
50
|
+
'detail.native': 'Nutzt nur die native Kopf-/Schwanz-Kürzung von Harness',
|
|
51
|
+
'detail.off': 'Deaktiviert die deterministische Auswahl; natives Auto-Compact bleibt separat konfiguriert',
|
|
52
|
+
'autoCompact.title': 'Auto-Compact-Auslöseschwelle',
|
|
53
|
+
'autoCompact.description': 'Das modellgetriebene Auto Compact löst aus, sobald die Anfrage-Auslastung diese Schwelle überschreitet. History-Auslöser des Standardprofils, Mindest-Freigabe und das neue Ende folgen der Schwelle; Änderungen wirken nur auf neue Sitzungen.',
|
|
54
|
+
'autoCompact.inputLabel': 'Auto-Compact-Schwelle (%)',
|
|
55
|
+
'autoCompact.sliderLabel': 'Schieberegler für die Auto-Compact-Schwelle',
|
|
56
|
+
'autoCompact.quick': 'Schnellwerte',
|
|
57
|
+
'autoCompact.riskLow': 'Unter dem empfohlenen Bereich: früheres Auslösen erhöht Zusammenfassungsaufrufe und Präfix-Neuaufbauten.',
|
|
58
|
+
'autoCompact.riskHigh': 'Über dem empfohlenen Bereich: die Kontextkapazität teilen sich Anfragen und Ausgabe, späteres Auslösen verkleinert den Spielraum für einzelne große Ausgaben, Reasoning und Tool-Schemata.',
|
|
59
|
+
'autoCompact.invalid': 'Die Auto-Compact-Schwelle muss eine ganze Zahl zwischen 50 und 90 sein.',
|
|
60
|
+
'autoCompact.save': 'Auto-Compact-Schwelle speichern',
|
|
61
|
+
'autoCompact.summaryHint': 'Auto-Compact-Schwelle: {percent} %. In den Einstellungen änderbar.',
|
|
62
|
+
'codeSkeleton.title': 'Code-Skelettkomprimierung (opt-in)',
|
|
63
|
+
'codeSkeleton.description': 'Unabhängiger Schalter, losgelöst von den Profilen oben. Aktiviert versucht ein überdimensioniertes frisches Quellcode-Tool-Ergebnis zuerst ein Skelett, das Imports und Deklarationen hält (Rümpfe ausgelassen, Fehlerzeilen behalten), und fällt bei Scheitern auf die ursprüngliche Kopf-Kürzung zurück. Erfordert den exakten Tokenizer; wirkt nur auf neue Sitzungen.',
|
|
64
|
+
'codeSkeleton.enabled': 'Code-Skelettkomprimierung',
|
|
65
|
+
'codeSkeleton.enabled.on': 'Ein',
|
|
66
|
+
'codeSkeleton.enabled.off': 'Aus (Standard)',
|
|
67
|
+
'custom.title': 'Eigene Strategie',
|
|
68
|
+
'custom.settingsHint': 'Detaillierte Parameter unter Einstellungen > Kontextkomprimierung wählen bearbeiten.',
|
|
69
|
+
'custom.sessionScope': 'Gespeicherte Änderungen greifen, wenn die aktuelle Compression-Runtime eine Sitzung zum ersten Mal beobachtet. Eine von dieser Runtime bereits beobachtete Sitzung behält ihre eingefrorene Strategie.',
|
|
70
|
+
'custom.measurement': 'Zuerst der exakte DeepSeek-Tokenizer; sonst Tokenizer-Schätzung mit Kalibrierung als Rückfallebene. Nie chars/4. Die Cache-Zuordnung bleibt unbekannt.',
|
|
71
|
+
'custom.unit': 'Kanonische Einheit',
|
|
72
|
+
'custom.unit.tokens': 'Token',
|
|
73
|
+
'custom.unit.contextPercent': 'Kontextprozent',
|
|
74
|
+
'custom.enabled': 'Aktiviert',
|
|
75
|
+
'custom.enabled.on': 'Ein',
|
|
76
|
+
'custom.enabled.off': 'Aus',
|
|
77
|
+
'custom.fresh.enabled': 'Fresh aktivieren',
|
|
78
|
+
'custom.fresh.trigger': 'Fresh-Auslöser',
|
|
79
|
+
'custom.fresh.target': 'Fresh-Ziel',
|
|
80
|
+
'custom.aggregate.enabled': 'Aggregate aktivieren',
|
|
81
|
+
'custom.aggregate.trigger': 'Aggregate-Auslöser',
|
|
82
|
+
'custom.aggregate.target': 'Aggregate-Ziel',
|
|
83
|
+
'custom.history.enabled': 'History aktivieren',
|
|
84
|
+
'custom.history.trigger': 'History-Auslöser',
|
|
85
|
+
'custom.history.keepRecentToolCalls': 'Geschützte letzte Tool-Aufrufe',
|
|
86
|
+
'custom.history.keepRecentTokens': 'Geschütztes neues Ende der Tool-Ergebnisse',
|
|
87
|
+
'custom.history.minReclaim': 'Mindest-Freigabe',
|
|
88
|
+
'custom.prefixPolicy': 'Richtlinie für gesendete Präfixe',
|
|
89
|
+
'custom.prefixPolicy.preserve': 'Bewahren bis Kapazitätsdruck',
|
|
90
|
+
'custom.prefixPolicy.pressureBreak': 'Reguläres Verlaufsaltern erlauben',
|
|
91
|
+
'custom.experimental': 'Experimentell: diese Regler gehören nur zum eigenen Profil und kommen nie in Standardprofile.',
|
|
92
|
+
'custom.tailTrim.enabled': 'TailTrim aktivieren (experimentell)',
|
|
93
|
+
'custom.tailTrim.trigger': 'TailTrim-Auslöser',
|
|
94
|
+
'custom.tailTrim.warning': 'TailTrim erfordert den exakten Tokenizer und ersetzt höchstens eine vollständige, abgeschlossene, fehlerfreie Gruppe nur aus Tools durch eine wiederherstellbare Referenz. Es teilt sich mit History die geschützten letzten Tool-Aufrufe, das geschützte neue Ende der Tool-Ergebnisse und die Mindest-Freigabe. Es schreibt ein gesendetes Präfix um und kann Cache-Treffer verringern.',
|
|
95
|
+
'custom.save': 'Eigene Strategie speichern',
|
|
96
|
+
'custom.reset': 'Eigene Strategie zurücksetzen',
|
|
97
|
+
'custom.invalid': 'Werte der eigenen Strategie sind ungültig.',
|
|
98
|
+
} satisfies Record<ContextCompressionLocaleKey, string>
|