dsh-context-compression-improved 0.2.3 → 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.
- package/.gitattributes +2 -1
- package/.githooks/pre-push +37 -0
- package/.github/workflows/ci.yml +39 -39
- package/CHANGELOG.ja.md +169 -39
- package/CHANGELOG.ko.md +167 -39
- package/CHANGELOG.md +333 -135
- package/CHANGELOG.zh.md +152 -39
- package/CONTRIBUTING.md +22 -22
- package/README.ja.md +85 -104
- package/README.ko.md +85 -103
- package/README.md +94 -112
- package/README.zh.md +85 -101
- package/THIRD_PARTY_NOTICES.md +14 -14
- package/docs/compat-0.1.5-report.md +77 -0
- package/docs/installation.ja.md +78 -76
- package/docs/installation.ko.md +78 -76
- package/docs/installation.md +103 -76
- package/docs/installation.zh.md +100 -76
- package/docs/repair-log.md +657 -582
- package/eslint.config.js +30 -30
- package/package.json +163 -142
- package/packages/selector/README.md +26 -31
- package/packages/selector/README.zh.md +24 -31
- package/packages/selector/THIRD_PARTY_NOTICES.md +32 -38
- package/packages/selector/cordis.patch.yml +27 -19
- package/packages/selector/dsh.plugin.json +2 -2
- package/packages/selector/lib/client.d.ts +320 -228
- package/packages/selector/lib/client.js +3254 -1462
- package/packages/selector/lib/config.js +1713 -842
- package/packages/selector/lib/index.d.ts +46 -38
- package/packages/selector/lib/index.js +1099 -645
- package/packages/selector/lib/invariant.js +70 -70
- package/packages/selector/lib/pruner.d.ts +904 -684
- package/packages/selector/lib/pruner.js +5800 -3807
- package/packages/selector/lib/style.css +88 -46
- package/packages/selector/lib/tail-trim.js +145 -136
- package/packages/selector/package.json +18 -19
- package/packages/selector/screenshots.json +3 -6
- package/packages/selector/src/client/CompressionProfileControls.tsx +293 -229
- package/packages/selector/src/client/CompressionProfileSelector.module.css +199 -170
- package/packages/selector/src/client/CompressionProfileSelector.tsx +85 -79
- package/packages/selector/src/client/EstimatorControls.tsx +277 -281
- package/packages/selector/src/client/decode.ts +57 -49
- package/packages/selector/src/client/index.ts +249 -111
- package/packages/selector/src/client/locales/de.ts +141 -0
- package/packages/selector/src/client/locales/es.ts +141 -0
- package/packages/selector/src/client/locales/fr.ts +141 -0
- package/packages/selector/src/client/locales/it.ts +141 -0
- package/packages/selector/src/client/locales/ja.ts +141 -0
- package/packages/selector/src/client/locales/ko.ts +141 -0
- package/packages/selector/src/client/locales/ru.ts +141 -0
- package/packages/selector/src/client/locales.ts +282 -198
- package/packages/selector/src/client/monitor-fab.ts +336 -0
- package/packages/selector/src/client/preset-options.ts +88 -70
- package/packages/selector/src/client/savings-card.tsx +150 -0
- package/packages/selector/src/client/settings-section.tsx +140 -126
- package/packages/selector/src/deepseek-v4-tokenizer.ts +205 -210
- package/packages/selector/src/index.ts +671 -327
- package/packages/selector/src/invariant.ts +113 -113
- package/packages/selector/src/preset-overlay.ts +60 -1
- package/packages/selector/src/profiles.ts +431 -342
- package/packages/selector/src/pruner/content.ts +18 -5
- package/packages/selector/src/pruner/state.ts +57 -43
- package/packages/selector/src/pruner/types.ts +23 -5
- package/packages/selector/src/pruner.ts +2736 -2144
- package/packages/selector/src/runtime/adaptive-cost.ts +23 -12
- package/packages/selector/src/runtime/audit.ts +303 -215
- package/packages/selector/src/runtime/config.ts +756 -613
- package/packages/selector/src/runtime/measurement.ts +436 -403
- package/packages/selector/src/runtime/monitor.ts +235 -0
- package/packages/selector/src/runtime/reducers.ts +1115 -97
- package/packages/selector/src/runtime/retrieve.ts +479 -457
- package/packages/selector/src/runtime/savings.ts +337 -0
- package/packages/selector/src/runtime/session-events.ts +30 -17
- package/packages/selector/src/runtime/summary-command.ts +127 -0
- package/packages/selector/src/runtime/tail-trim.ts +166 -166
- package/packages/selector/src/runtime/tokenpilot/advisor-prompt.ts +233 -0
- package/packages/selector/src/runtime/tokenpilot/advisor-state.ts +204 -0
- package/packages/selector/src/runtime/tokenpilot/advisor.ts +419 -0
- package/packages/selector/src/runtime/tokenpilot/benefit.ts +200 -0
- package/packages/selector/src/runtime/tokenpilot/dedup.ts +1 -1
- package/packages/selector/src/runtime/tokenpilot/estimator.ts +151 -183
- package/packages/selector/src/runtime/tokenpilot/intent-fold.ts +53 -0
- package/packages/selector/src/runtime/tokenpilot/intent-gate.ts +65 -0
- package/packages/selector/src/runtime/tokenpilot/intent-input-mask.ts +125 -0
- package/packages/selector/src/runtime/tokenpilot/intent-range.ts +37 -0
- package/packages/selector/src/runtime/tokenpilot/locator.ts +1 -1
- package/packages/selector/src/runtime/tokenpilot/read-state.ts +23 -2
- package/packages/selector/src/runtime/tokenpilot/sidechannel.ts +303 -0
- package/packages/selector/src/runtime/toolclass.ts +103 -0
- package/packages/selector/src/runtime/types.ts +365 -309
- package/packages/selector/tests/advisor-report.host.spec.ts +223 -0
- package/packages/selector/tests/auto-compact.client.spec.tsx +214 -226
- package/packages/selector/tests/built/client-artifact.spec.ts +59 -51
- package/packages/selector/tests/code-skeleton.client.spec.ts +91 -88
- package/packages/selector/tests/custom-contract.client.spec.ts +205 -202
- package/packages/selector/tests/estimator-channel.client.spec.tsx +253 -247
- package/packages/selector/tests/estimator-route-registration.host.spec.ts +194 -176
- package/packages/selector/tests/host-preset-overlay.host.spec.ts +206 -204
- package/packages/selector/tests/monitor-fab.client.spec.ts +138 -0
- package/packages/selector/tests/preset-options-write.client.spec.ts +207 -181
- package/packages/selector/tests/preset-overlay-loader.e2e.host.spec.ts +201 -196
- package/packages/selector/tests/preset-overlay.host.spec.ts +246 -243
- package/packages/selector/tests/profiles.client.spec.tsx +436 -434
- package/packages/selector/tests/public/package-contract.client.spec.ts +78 -33
- package/packages/selector/tests/runtime/adaptive-cost.spec.ts +7 -7
- package/packages/selector/tests/runtime/advice-never-withholds.host.spec.ts +232 -0
- package/packages/selector/tests/runtime/advisor-invariant.spec.ts +272 -0
- package/packages/selector/tests/runtime/advisor.spec.ts +226 -0
- package/packages/selector/tests/runtime/audit.spec.ts +275 -129
- package/packages/selector/tests/runtime/char-basis.spec.ts +30 -0
- package/packages/selector/tests/runtime/code-skeleton.spec.ts +14 -3
- package/packages/selector/tests/runtime/deprecated-preset-options.spec.ts +96 -0
- package/packages/selector/tests/runtime/frequency-longstrings.spec.ts +74 -0
- package/packages/selector/tests/runtime/html-reducer.spec.ts +212 -0
- package/packages/selector/tests/runtime/intent-gate.spec.ts +62 -0
- package/packages/selector/tests/runtime/intent-summary.spec.ts +156 -0
- package/packages/selector/tests/runtime/line-mapping.spec.ts +153 -0
- package/packages/selector/tests/runtime/monitor.spec.ts +301 -0
- package/packages/selector/tests/runtime/prose-reducers.spec.ts +133 -0
- package/packages/selector/tests/runtime/public/public-runtime.spec.ts +2724 -2531
- package/packages/selector/tests/runtime/read-input-cap.spec.ts +33 -0
- package/packages/selector/tests/runtime/savings.spec.ts +120 -0
- package/packages/selector/tests/runtime/search-reducer.spec.ts +110 -0
- package/packages/selector/tests/runtime/session-events.spec.ts +27 -27
- package/packages/selector/tests/runtime/sidechannel.spec.ts +241 -0
- package/packages/selector/tests/runtime/summary-command.spec.ts +154 -0
- package/packages/selector/tests/runtime/toc-and-bundled.spec.ts +159 -0
- package/packages/selector/tests/runtime/tokenpilot/benefit.spec.ts +217 -0
- package/packages/selector/tests/runtime/tokenpilot/estimator.spec.ts +79 -56
- package/packages/selector/tests/runtime/tokenpilot/profile-baseline.spec.ts +116 -100
- package/packages/selector/tests/runtime/tokenpilot/read-state.spec.ts +24 -0
- package/packages/selector/tests/runtime/toolclass.spec.ts +156 -0
- package/packages/selector/tests/settings-seat.client.spec.ts +130 -0
- package/packages/selector/tests/standing-generation.host.spec.ts +697 -631
- package/packages/selector/tests/subagent-cache-reuse.host.spec.ts +253 -250
- package/pnpm-workspace.yaml +66 -19
- package/scripts/capture-profile-baseline.mjs +42 -0
- package/scripts/generate-tokenizer-fixtures.py +81 -81
- package/scripts/generate-vision-fixtures.py +208 -208
- package/scripts/{packed-components-smoke.ts → packed-components-smoke.mjs} +732 -713
- package/scripts/{packed-install-e2e.ts → packed-install-e2e.mjs} +1273 -1072
- package/scripts/toolclass-corpus-replay.mjs +281 -0
- package/scripts/{verify-release.ts → verify-release.mjs} +318 -300
- package/tests/TEST_INVENTORY.md +41 -42
- package/scripts/capture-profile-baseline.ts +0 -80
- package/tsconfig.scripts.json +0 -13
- /package/{packages/selector/assets/screenshots → docs/assets}/context-compression-selector-profiles.jpg +0 -0
- /package/{packages/selector/assets/screenshots → docs/assets}/context-compression-selector-settings.png +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-external/dsh-context-compression-improved",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"description": "Auditable tool-result context-compression selector with code-skeleton gate for DeepSeek Harness",
|
|
6
6
|
"engines": {
|
|
7
|
-
"dsh": ">=0.1.2-rc.1 <0.
|
|
7
|
+
"dsh": ">=0.1.2-rc.1 <0.1.3-0"
|
|
8
8
|
},
|
|
9
9
|
"contributes": {
|
|
10
10
|
"tools": [],
|
|
@@ -1,229 +1,321 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
type
|
|
10
|
-
/**
|
|
11
|
-
type
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
interface
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
'
|
|
133
|
-
'
|
|
134
|
-
|
|
135
|
-
'
|
|
136
|
-
'
|
|
137
|
-
'
|
|
138
|
-
'
|
|
139
|
-
'
|
|
140
|
-
'
|
|
141
|
-
'
|
|
142
|
-
'
|
|
143
|
-
'
|
|
144
|
-
'profile.
|
|
145
|
-
'profile.
|
|
146
|
-
'
|
|
147
|
-
'
|
|
148
|
-
'
|
|
149
|
-
'
|
|
150
|
-
'
|
|
151
|
-
'
|
|
152
|
-
'
|
|
153
|
-
'
|
|
154
|
-
'
|
|
155
|
-
'
|
|
156
|
-
'
|
|
157
|
-
'
|
|
158
|
-
'
|
|
159
|
-
'
|
|
160
|
-
'
|
|
161
|
-
'
|
|
162
|
-
'
|
|
163
|
-
'
|
|
164
|
-
'
|
|
165
|
-
'
|
|
166
|
-
'
|
|
167
|
-
'
|
|
168
|
-
'
|
|
169
|
-
'
|
|
170
|
-
'
|
|
171
|
-
'
|
|
172
|
-
'
|
|
173
|
-
'
|
|
174
|
-
'
|
|
175
|
-
'custom
|
|
176
|
-
'
|
|
177
|
-
'
|
|
178
|
-
'
|
|
179
|
-
'
|
|
180
|
-
'
|
|
181
|
-
'
|
|
182
|
-
'
|
|
183
|
-
'
|
|
184
|
-
'
|
|
185
|
-
'
|
|
186
|
-
'
|
|
187
|
-
'
|
|
188
|
-
'
|
|
189
|
-
'
|
|
190
|
-
'
|
|
191
|
-
'
|
|
192
|
-
'
|
|
193
|
-
'
|
|
194
|
-
'
|
|
195
|
-
'
|
|
196
|
-
'
|
|
197
|
-
'
|
|
198
|
-
'
|
|
199
|
-
'
|
|
200
|
-
'
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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";
|
|
5
|
+
//#region src/profiles.d.ts
|
|
6
|
+
/** Public context-compression choices shared by the Host schema and browser selector. */
|
|
7
|
+
declare const COMPRESSION_PROFILES: readonly ["off", "native", "balanced", "cache-strict", "savings", "adaptive", "tokenpilot-inspired", "custom"];
|
|
8
|
+
/** One supported context-compression profile. */
|
|
9
|
+
type CompressionProfile = typeof COMPRESSION_PROFILES[number];
|
|
10
|
+
/** Single canonical unit stored by a version-1 browser Custom document. */
|
|
11
|
+
type CustomCompressionUnit = 'tokens' | 'context-percent';
|
|
12
|
+
/** Whether Custom History may routinely rewrite an already-sent prefix. */
|
|
13
|
+
type CustomPrefixPolicy = 'preserve' | 'pressure-break';
|
|
14
|
+
/** Browser representation of one independently enabled Fresh or Aggregate budget. */
|
|
15
|
+
interface CustomCompressionBudget {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
trigger: number;
|
|
18
|
+
target: number;
|
|
19
|
+
}
|
|
20
|
+
/** Legacy browser representation of the Custom History working set. */
|
|
21
|
+
interface LegacyCustomHistoryPolicy {
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
trigger: number;
|
|
24
|
+
keepRecentTurns: number;
|
|
25
|
+
keepRecent: number;
|
|
26
|
+
minReclaim: number;
|
|
27
|
+
}
|
|
28
|
+
/** Browser representation of Custom History tool-call and token-tail protection. */
|
|
29
|
+
interface CustomHistoryPolicy {
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
trigger: number;
|
|
32
|
+
keepRecentToolCalls: number;
|
|
33
|
+
keepRecentTokens: number;
|
|
34
|
+
minReclaim: number;
|
|
35
|
+
}
|
|
36
|
+
/** Browser representation of the Custom-only Experimental TailTrim gate. */
|
|
37
|
+
interface CustomTailTrimPolicy {
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
trigger: number;
|
|
40
|
+
}
|
|
41
|
+
interface CustomCompressionPolicyCommon<HistoryPolicy> {
|
|
42
|
+
unit: CustomCompressionUnit;
|
|
43
|
+
fresh: CustomCompressionBudget;
|
|
44
|
+
aggregate: CustomCompressionBudget;
|
|
45
|
+
history: HistoryPolicy;
|
|
46
|
+
prefixPolicy: CustomPrefixPolicy;
|
|
47
|
+
}
|
|
48
|
+
/** Legacy public Custom document; accepted and normalized before editing. */
|
|
49
|
+
interface CustomCompressionPolicyV1 extends CustomCompressionPolicyCommon<LegacyCustomHistoryPolicy> {
|
|
50
|
+
version: 1;
|
|
51
|
+
}
|
|
52
|
+
/** Legacy Custom document with a default-disabled TailTrim stage. */
|
|
53
|
+
interface CustomCompressionPolicyV2 extends CustomCompressionPolicyCommon<LegacyCustomHistoryPolicy> {
|
|
54
|
+
version: 2;
|
|
55
|
+
tailTrim: CustomTailTrimPolicy;
|
|
56
|
+
}
|
|
57
|
+
/** Public Custom document with tool-call working-set protection. */
|
|
58
|
+
interface CustomCompressionPolicyV3 extends CustomCompressionPolicyCommon<CustomHistoryPolicy> {
|
|
59
|
+
version: 3;
|
|
60
|
+
tailTrim: CustomTailTrimPolicy;
|
|
61
|
+
}
|
|
62
|
+
/** Exact public Custom document accepted by the Host and browser boundary. */
|
|
63
|
+
type CustomCompressionPolicy = CustomCompressionPolicyV1 | CustomCompressionPolicyV2 | CustomCompressionPolicyV3;
|
|
64
|
+
/** User-tunable Auto Compact coordination preferences. */
|
|
65
|
+
interface AutoCompactSettings {
|
|
66
|
+
thresholdPercent: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Orthogonal code-skeleton reducer gate, mirrored browser-safe from the
|
|
70
|
+
* runtime: independent of every profile, default off.
|
|
71
|
+
*/
|
|
72
|
+
interface CodeSkeletonSettings {
|
|
73
|
+
enabled: boolean;
|
|
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
|
+
}
|
|
86
|
+
/** Browser-safe mirror of the runtime presetOptions section. */
|
|
87
|
+
interface PresetOptionsSettings {
|
|
88
|
+
readonly dedupeToolResults?: boolean;
|
|
89
|
+
readonly summaryLocator?: boolean;
|
|
90
|
+
readonly prefixStabilizer?: boolean;
|
|
91
|
+
readonly readState?: boolean;
|
|
92
|
+
readonly estimatorMode?: '' | 'host' | 'direct';
|
|
93
|
+
readonly estimatorProvider?: string;
|
|
94
|
+
readonly estimatorModel?: string;
|
|
95
|
+
readonly estimatorBaseUrl?: string;
|
|
96
|
+
readonly estimatorApiKey?: string;
|
|
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;
|
|
105
|
+
}
|
|
106
|
+
/** Durable settings section owned by this package. */
|
|
107
|
+
interface ContextCompressionSettings {
|
|
108
|
+
/** Default profile captured when each Session first reaches the pruner. */
|
|
109
|
+
profile: CompressionProfile;
|
|
110
|
+
/** Complete canonical policy captured with `profile` when the runtime first observes a Session. */
|
|
111
|
+
custom: CustomCompressionPolicy;
|
|
112
|
+
/** Auto Compact trigger captured with `profile` when the runtime first observes a Session. */
|
|
113
|
+
autoCompact: AutoCompactSettings;
|
|
114
|
+
/** Code-skeleton reducer gate captured independently of `profile`. */
|
|
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;
|
|
120
|
+
/** Optional tokenpilot-inspired sub-capability overrides (presence-validated only). */
|
|
121
|
+
presetOptions?: PresetOptionsSettings;
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/client/preset-options.d.ts
|
|
125
|
+
/** One partial edit of `presetOptions`; `undefined` clears the named field. */
|
|
126
|
+
type PresetOptionsPatch = { readonly [K in keyof PresetOptionsSettings]?: PresetOptionsSettings[K] | undefined; };
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/client/locales.d.ts
|
|
129
|
+
/** Simplified Chinese copy for the context-compression selector. */
|
|
130
|
+
declare const zh: {
|
|
131
|
+
nav: string;
|
|
132
|
+
'settings.title': string;
|
|
133
|
+
'settings.description': string;
|
|
134
|
+
label: string;
|
|
135
|
+
'status.loading': string;
|
|
136
|
+
'status.unavailable': string;
|
|
137
|
+
'status.presetUnavailable': string;
|
|
138
|
+
'status.minimalUnavailable': string;
|
|
139
|
+
'status.saveFailed': string;
|
|
140
|
+
'pricing.disclosure': string;
|
|
141
|
+
'profile.balanced': string;
|
|
142
|
+
'profile.cache-strict': string;
|
|
143
|
+
'profile.savings': string;
|
|
144
|
+
'profile.adaptive': string;
|
|
145
|
+
'profile.tokenpilot-inspired': string;
|
|
146
|
+
'estimator.title': string;
|
|
147
|
+
'estimator.description': string;
|
|
148
|
+
'estimator.mode': string;
|
|
149
|
+
'estimator.mode.off': string;
|
|
150
|
+
'estimator.mode.host': string;
|
|
151
|
+
'estimator.mode.direct': string;
|
|
152
|
+
'estimator.inactive': string;
|
|
153
|
+
'estimator.provider': string;
|
|
154
|
+
'estimator.provider.placeholder': string;
|
|
155
|
+
'estimator.model.placeholder': string;
|
|
156
|
+
'estimator.hostReuse': string;
|
|
157
|
+
'estimator.hostRoute': string;
|
|
158
|
+
'estimator.hostUnresolved': string;
|
|
159
|
+
'estimator.baseUrl': string;
|
|
160
|
+
'estimator.model': string;
|
|
161
|
+
'estimator.apiKey': string;
|
|
162
|
+
'estimator.apiKey.placeholder': string;
|
|
163
|
+
'estimator.apiKey.set': string;
|
|
164
|
+
'estimator.apiKey.clear': string;
|
|
165
|
+
'estimator.apiKey.overwrite': string;
|
|
166
|
+
'detail.tokenpilot-inspired': string;
|
|
167
|
+
'profile.custom': string;
|
|
168
|
+
'profile.native': string;
|
|
169
|
+
'profile.off': string;
|
|
170
|
+
'profile.current': string;
|
|
171
|
+
'detail.balanced': string;
|
|
172
|
+
'detail.cache-strict': string;
|
|
173
|
+
'detail.savings': string;
|
|
174
|
+
'detail.adaptive': string;
|
|
175
|
+
'detail.custom': string;
|
|
176
|
+
'detail.native': string;
|
|
177
|
+
'detail.off': string;
|
|
178
|
+
'autoCompact.title': string;
|
|
179
|
+
'autoCompact.description': string;
|
|
180
|
+
'autoCompact.inputLabel': string;
|
|
181
|
+
'autoCompact.sliderLabel': string;
|
|
182
|
+
'autoCompact.quick': string;
|
|
183
|
+
'autoCompact.riskLow': string;
|
|
184
|
+
'autoCompact.riskHigh': string;
|
|
185
|
+
'autoCompact.invalid': string;
|
|
186
|
+
'autoCompact.save': string;
|
|
187
|
+
'autoCompact.summaryHint': string;
|
|
188
|
+
'codeSkeleton.title': string;
|
|
189
|
+
'codeSkeleton.description': string;
|
|
190
|
+
'codeSkeleton.enabled': string;
|
|
191
|
+
'codeSkeleton.enabled.on': string;
|
|
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;
|
|
221
|
+
'custom.title': string;
|
|
222
|
+
'custom.settingsHint': string;
|
|
223
|
+
'custom.sessionScope': string;
|
|
224
|
+
'custom.measurement': string;
|
|
225
|
+
'custom.unit': string;
|
|
226
|
+
'custom.unit.tokens': string;
|
|
227
|
+
'custom.unit.contextPercent': string;
|
|
228
|
+
'custom.enabled': string;
|
|
229
|
+
'custom.enabled.on': string;
|
|
230
|
+
'custom.enabled.off': string;
|
|
231
|
+
'custom.fresh.enabled': string;
|
|
232
|
+
'custom.fresh.trigger': string;
|
|
233
|
+
'custom.fresh.target': string;
|
|
234
|
+
'custom.aggregate.enabled': string;
|
|
235
|
+
'custom.aggregate.trigger': string;
|
|
236
|
+
'custom.aggregate.target': string;
|
|
237
|
+
'custom.history.enabled': string;
|
|
238
|
+
'custom.history.trigger': string;
|
|
239
|
+
'custom.history.keepRecentToolCalls': string;
|
|
240
|
+
'custom.history.keepRecentTokens': string;
|
|
241
|
+
'custom.history.minReclaim': string;
|
|
242
|
+
'custom.prefixPolicy': string;
|
|
243
|
+
'custom.prefixPolicy.preserve': string;
|
|
244
|
+
'custom.prefixPolicy.pressureBreak': string;
|
|
245
|
+
'custom.experimental': string;
|
|
246
|
+
'custom.tailTrim.enabled': string;
|
|
247
|
+
'custom.tailTrim.trigger': string;
|
|
248
|
+
'custom.tailTrim.warning': string;
|
|
249
|
+
'custom.save': string;
|
|
250
|
+
'custom.reset': string;
|
|
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;
|
|
266
|
+
};
|
|
267
|
+
/** Locale keys that every context-compression selector dictionary must provide. */
|
|
268
|
+
type ContextCompressionLocaleKey = keyof typeof zh;
|
|
269
|
+
//#endregion
|
|
270
|
+
//#region src/client/CompressionProfileSelector.d.ts
|
|
271
|
+
interface CompressionSelectorInjected {
|
|
272
|
+
hooks: {
|
|
273
|
+
compression: SettingsScope<ContextCompressionSettings>;
|
|
274
|
+
};
|
|
275
|
+
select: (profile: CompressionProfile) => Promise<void>;
|
|
276
|
+
saveCustom: (custom: CustomCompressionPolicy) => Promise<void>;
|
|
277
|
+
resetCustom: () => Promise<void>;
|
|
278
|
+
saveAutoCompact: (thresholdPercent: number) => Promise<void>;
|
|
279
|
+
saveCodeSkeleton: (enabled: boolean) => Promise<void>;
|
|
280
|
+
saveIntentSummary: (enabled: boolean) => Promise<void>;
|
|
281
|
+
saveMonitorPanel: (enabled: boolean) => Promise<void>;
|
|
282
|
+
/** Patch of `presetOptions` members; an explicit `undefined` clears that field. */
|
|
283
|
+
savePresetOptions: (options: PresetOptionsPatch) => Promise<void>;
|
|
284
|
+
}
|
|
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>;
|
|
294
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
295
|
+
interface LocaleNamespaceMap {
|
|
296
|
+
'context-compression': ContextCompressionLocaleKey;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
//#endregion
|
|
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
|
+
}
|
|
318
|
+
declare const inject: string[];
|
|
319
|
+
declare function apply(ctx: Context): void;
|
|
320
|
+
//#endregion
|
|
229
321
|
export { type CompressionProfile, type CompressionProfileSelectorProps, type CompressionSelectorInjected, type ContextCompressionSettings, apply, inject };
|