dsh-context-compression-improved 0.10.2 → 0.10.4
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/dsh.plugin.json +2 -2
- package/lib/client.d.ts +4 -0
- package/lib/client.js +70 -5
- package/lib/invariant.js +1 -1
- package/lib/profiles.d.ts +3 -1
- package/lib/pruner.d.ts +4 -2
- package/lib/pruner.js +40 -37
- package/lib/savings-integral.js +83 -24
- package/lib/tail-trim.js +2 -2
- package/lib/tool-result.js +22 -1
- package/package.json +21 -21
package/dsh.plugin.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-external/dsh-context-compression-improved",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.4",
|
|
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.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4"
|
|
7
|
+
"dsh": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1"
|
|
8
8
|
},
|
|
9
9
|
"contributes": {
|
|
10
10
|
"tools": [],
|
package/lib/client.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ declare const zh: {
|
|
|
24
24
|
'profile.savings': string;
|
|
25
25
|
'profile.adaptive': string;
|
|
26
26
|
'profile.tokenpilot-inspired': string;
|
|
27
|
+
'profile.ptc': string;
|
|
28
|
+
'detail.ptc': string;
|
|
27
29
|
'estimator.title': string;
|
|
28
30
|
'estimator.description': string;
|
|
29
31
|
'estimator.mode': string;
|
|
@@ -202,6 +204,8 @@ interface CompressionSelectorInjected {
|
|
|
202
204
|
select: (profile: CompressionProfile) => Promise<void>;
|
|
203
205
|
saveCustom: (custom: CustomCompressionPolicy) => Promise<void>;
|
|
204
206
|
resetCustom: () => Promise<void>;
|
|
207
|
+
savePtcCustom: (custom: CustomCompressionPolicy) => Promise<void>;
|
|
208
|
+
resetPtcCustom: () => Promise<void>;
|
|
205
209
|
saveAutoCompact: (thresholdPercent: number) => Promise<void>;
|
|
206
210
|
saveCodeSkeleton: (enabled: boolean) => Promise<void>;
|
|
207
211
|
saveIntentSummary: (enabled: boolean) => Promise<void>;
|
package/lib/client.js
CHANGED
|
@@ -17,6 +17,7 @@ window.__ModuleLoader__.load({
|
|
|
17
17
|
"savings",
|
|
18
18
|
"adaptive",
|
|
19
19
|
"tokenpilot-inspired",
|
|
20
|
+
"ptc",
|
|
20
21
|
"custom"
|
|
21
22
|
];
|
|
22
23
|
/** Browser-safe mirror of the Host's Balanced-equivalent Custom default. */
|
|
@@ -46,6 +47,33 @@ window.__ModuleLoader__.load({
|
|
|
46
47
|
trigger: 7e5
|
|
47
48
|
}
|
|
48
49
|
};
|
|
50
|
+
/** Browser-safe mirror of the runtime PTC default policy (absolute, window-independent). */
|
|
51
|
+
const DEFAULT_PTC_COMPRESSION_POLICY = {
|
|
52
|
+
version: 3,
|
|
53
|
+
unit: "tokens",
|
|
54
|
+
fresh: {
|
|
55
|
+
enabled: true,
|
|
56
|
+
trigger: 4096,
|
|
57
|
+
target: 1536
|
|
58
|
+
},
|
|
59
|
+
aggregate: {
|
|
60
|
+
enabled: true,
|
|
61
|
+
trigger: 16384,
|
|
62
|
+
target: 4096
|
|
63
|
+
},
|
|
64
|
+
history: {
|
|
65
|
+
enabled: true,
|
|
66
|
+
trigger: 2e4,
|
|
67
|
+
keepRecentToolCalls: 8,
|
|
68
|
+
keepRecentTokens: 8e3,
|
|
69
|
+
minReclaim: 6e3
|
|
70
|
+
},
|
|
71
|
+
prefixPolicy: "pressure-break",
|
|
72
|
+
tailTrim: {
|
|
73
|
+
enabled: false,
|
|
74
|
+
trigger: 7e5
|
|
75
|
+
}
|
|
76
|
+
};
|
|
49
77
|
/**
|
|
50
78
|
* Decode the persisted codeSkeleton section with exactly the runtime schema's
|
|
51
79
|
* strictness: absent means the lossless off default; present values must be a
|
|
@@ -1420,16 +1448,21 @@ window.__ModuleLoader__.load({
|
|
|
1420
1448
|
function ContextCompressionSettingsSection(props) {
|
|
1421
1449
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingsCompressionProfileControls, { ...props });
|
|
1422
1450
|
}
|
|
1423
|
-
function SettingsCompressionProfileControls({ useCompression, select, saveCustom, resetCustom, saveAutoCompact, saveCodeSkeleton, saveIntentSummary, saveMonitorPanel, savePresetOptions, t }) {
|
|
1451
|
+
function SettingsCompressionProfileControls({ useCompression, select, saveCustom, resetCustom, savePtcCustom, resetPtcCustom, saveAutoCompact, saveCodeSkeleton, saveIntentSummary, saveMonitorPanel, savePresetOptions, t }) {
|
|
1424
1452
|
const state = useCompression((snapshot) => snapshot);
|
|
1425
1453
|
const [saving, setSaving] = (0, react.useState)(false);
|
|
1426
1454
|
const [saveError, setSaveError] = (0, react.useState)(null);
|
|
1427
1455
|
const [draft, setDraft] = (0, react.useState)(null);
|
|
1456
|
+
const [ptcDraft, setPtcDraft] = (0, react.useState)(null);
|
|
1428
1457
|
const current = state.value?.profile ?? "balanced";
|
|
1429
1458
|
(0, react.useEffect)(() => {
|
|
1430
1459
|
const custom = state.value?.custom;
|
|
1431
|
-
setDraft(current === "custom" && custom !== void 0 ? editableCustom(custom) : null);
|
|
1460
|
+
setDraft((current === "custom" || current === "tokenpilot-inspired") && custom !== void 0 ? editableCustom(custom) : null);
|
|
1432
1461
|
}, [current, state.value?.custom]);
|
|
1462
|
+
(0, react.useEffect)(() => {
|
|
1463
|
+
const ptcCustom = state.value?.ptcCustom;
|
|
1464
|
+
setPtcDraft(current === "ptc" && ptcCustom !== void 0 ? editableCustom(ptcCustom) : null);
|
|
1465
|
+
}, [current, state.value?.ptcCustom]);
|
|
1433
1466
|
if (state.status === "unavailable") return null;
|
|
1434
1467
|
const busy = state.status === "loading" || saving;
|
|
1435
1468
|
const selectProfile = (profile) => {
|
|
@@ -1536,7 +1569,7 @@ window.__ModuleLoader__.load({
|
|
|
1536
1569
|
className: _dsh_context_compression_css_466eb745356d_CompressionProfileSelector_module_css_default.pricing,
|
|
1537
1570
|
children: t("pricing.disclosure")
|
|
1538
1571
|
}),
|
|
1539
|
-
current !== "custom" || draft === null || false ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomPolicyEditor, {
|
|
1572
|
+
current !== "custom" && current !== "tokenpilot-inspired" || draft === null || false ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomPolicyEditor, {
|
|
1540
1573
|
value: draft,
|
|
1541
1574
|
disabled: busy || !state.writable,
|
|
1542
1575
|
setValue: setDraft,
|
|
@@ -1545,6 +1578,15 @@ window.__ModuleLoader__.load({
|
|
|
1545
1578
|
settle,
|
|
1546
1579
|
t
|
|
1547
1580
|
}),
|
|
1581
|
+
current !== "ptc" || ptcDraft === null || false ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomPolicyEditor, {
|
|
1582
|
+
value: ptcDraft,
|
|
1583
|
+
disabled: busy || !state.writable,
|
|
1584
|
+
setValue: setPtcDraft,
|
|
1585
|
+
save: () => savePtcCustom(structuredClone(ptcDraft)),
|
|
1586
|
+
reset: resetPtcCustom,
|
|
1587
|
+
settle,
|
|
1588
|
+
t
|
|
1589
|
+
}),
|
|
1548
1590
|
saveError === null ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1549
1591
|
className: _dsh_context_compression_css_466eb745356d_CompressionProfileSelector_module_css_default.error,
|
|
1550
1592
|
role: "alert",
|
|
@@ -1568,17 +1610,20 @@ window.__ModuleLoader__.load({
|
|
|
1568
1610
|
*/
|
|
1569
1611
|
function decodeSettings(value) {
|
|
1570
1612
|
if (!isPlainRecord(value)) return void 0;
|
|
1571
|
-
if (Object.keys(value).some((key) => key !== "profile" && key !== "custom" && key !== "autoCompact" && key !== "codeSkeleton" && key !== "intentSummary" && key !== "monitorPanel" && key !== "presetOptions")) return;
|
|
1613
|
+
if (Object.keys(value).some((key) => key !== "profile" && key !== "custom" && key !== "ptcCustom" && key !== "autoCompact" && key !== "codeSkeleton" && key !== "intentSummary" && key !== "monitorPanel" && key !== "presetOptions")) return;
|
|
1572
1614
|
const profile = value.profile;
|
|
1573
1615
|
const custom = value.custom;
|
|
1616
|
+
const ptcCustomRaw = value.ptcCustom;
|
|
1617
|
+
const ptcCustom = ptcCustomRaw === void 0 ? DEFAULT_PTC_COMPRESSION_POLICY : isCustomCompressionPolicy(ptcCustomRaw) ? canonicalizeCustomPolicy(ptcCustomRaw) : void 0;
|
|
1574
1618
|
const autoCompact = decodeAutoCompactSettings(value.autoCompact);
|
|
1575
1619
|
const codeSkeleton = decodeCodeSkeletonSettings(value.codeSkeleton);
|
|
1576
1620
|
const intentSummary = decodeIntentSummarySettings(value.intentSummary);
|
|
1577
1621
|
const monitorPanel = decodeMonitorPanelSettings(value.monitorPanel);
|
|
1578
1622
|
const presetOptions = decodePresetOptionsSettings(value.presetOptions);
|
|
1579
|
-
return typeof profile === "string" && COMPRESSION_PROFILES.includes(profile) && isCustomCompressionPolicy(custom) && autoCompact !== void 0 && codeSkeleton !== void 0 && intentSummary !== void 0 && monitorPanel !== void 0 ? {
|
|
1623
|
+
return typeof profile === "string" && COMPRESSION_PROFILES.includes(profile) && isCustomCompressionPolicy(custom) && ptcCustom !== void 0 && autoCompact !== void 0 && codeSkeleton !== void 0 && intentSummary !== void 0 && monitorPanel !== void 0 ? {
|
|
1580
1624
|
profile,
|
|
1581
1625
|
custom: canonicalizeCustomPolicy(custom),
|
|
1626
|
+
ptcCustom,
|
|
1582
1627
|
autoCompact,
|
|
1583
1628
|
codeSkeleton,
|
|
1584
1629
|
intentSummary,
|
|
@@ -1996,6 +2041,8 @@ window.__ModuleLoader__.load({
|
|
|
1996
2041
|
"profile.savings": "节省模式",
|
|
1997
2042
|
"profile.adaptive": "Adaptive(保守成本)",
|
|
1998
2043
|
"profile.tokenpilot-inspired": "TokenPilot 启发模式",
|
|
2044
|
+
"profile.ptc": "PTC 模式(绝对水位)",
|
|
2045
|
+
"detail.ptc": "为代码模式与大量小结果会话提供与窗口无关的绝对水位;存量越过阈值即触发历史老化,阈值可在设置中独立编辑",
|
|
1999
2046
|
"estimator.title": "估计器(可选)",
|
|
2000
2047
|
"estimator.description": "辅助小模型零样本判断旧文件读取是否仍有引用价值,仅建议性加速历史清理;未配置或失败时自动退回纯规则通道,不影响主流程。",
|
|
2001
2048
|
"estimator.mode": "通道",
|
|
@@ -2151,6 +2198,8 @@ window.__ModuleLoader__.load({
|
|
|
2151
2198
|
"profile.savings": "Savings",
|
|
2152
2199
|
"profile.adaptive": "Adaptive (conservative cost)",
|
|
2153
2200
|
"profile.tokenpilot-inspired": "TokenPilot-inspired",
|
|
2201
|
+
"profile.ptc": "PTC / Code-mode (absolute)",
|
|
2202
|
+
"detail.ptc": "Window-independent absolute watermarks for code-mode and many-small-result sessions; history aging starts once live results cross the threshold, and the thresholds stay independently editable",
|
|
2154
2203
|
"estimator.title": "Estimator (optional)",
|
|
2155
2204
|
"estimator.description": "A small auxiliary model zero-shots whether old file reads are still likely referenced, advisory-only for history aging; unconfigured or failing endpoints fall back to rule-only behavior.",
|
|
2156
2205
|
"estimator.mode": "Channel",
|
|
@@ -2308,6 +2357,8 @@ window.__ModuleLoader__.load({
|
|
|
2308
2357
|
"profile.savings": "Sparen",
|
|
2309
2358
|
"profile.adaptive": "Adaptiv (kostenbewusst)",
|
|
2310
2359
|
"profile.tokenpilot-inspired": "TokenPilot-inspiriert",
|
|
2360
|
+
"profile.ptc": "PTC / Codemodus (absolut)",
|
|
2361
|
+
"detail.ptc": "Fensterunabhängige absolute Wasserstände für den Codemodus und Sitzungen mit vielen kleinen Ergebnissen; die Historienalterung startet, sobald der Umfang die Schwelle überschreitet, Schwellen separat editierbar",
|
|
2311
2362
|
"estimator.title": "Schätzer (optional)",
|
|
2312
2363
|
"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.",
|
|
2313
2364
|
"estimator.mode": "Kanal",
|
|
@@ -2465,6 +2516,8 @@ window.__ModuleLoader__.load({
|
|
|
2465
2516
|
"profile.savings": "Ahorro",
|
|
2466
2517
|
"profile.adaptive": "Adaptativo (costo conservador)",
|
|
2467
2518
|
"profile.tokenpilot-inspired": "Inspirado en TokenPilot",
|
|
2519
|
+
"profile.ptc": "PTC / modo código (absoluto)",
|
|
2520
|
+
"detail.ptc": "Marcas de agua absolutas independientes de la ventana para el modo código y sesiones con muchos resultados pequeños; el envejecimiento del historial se activa al superar el umbral, umbrales editables por separado",
|
|
2468
2521
|
"estimator.title": "Estimador (opcional)",
|
|
2469
2522
|
"estimator.description": "Un pequeño modelo auxiliar estima sin ejemplos si las lecturas antiguas de archivos probablemente aún se referencian; solo consultivo para el envejecimiento del historial. Sin configuración o ante fallos, se vuelve al comportamiento basado solo en reglas.",
|
|
2470
2523
|
"estimator.mode": "Canal",
|
|
@@ -2622,6 +2675,8 @@ window.__ModuleLoader__.load({
|
|
|
2622
2675
|
"profile.savings": "Économies",
|
|
2623
2676
|
"profile.adaptive": "Adaptatif (coût prudent)",
|
|
2624
2677
|
"profile.tokenpilot-inspired": "Inspiré de TokenPilot",
|
|
2678
|
+
"profile.ptc": "PTC / mode code (absolu)",
|
|
2679
|
+
"detail.ptc": "Repères absolus indépendants de la fenêtre pour le mode code et les sessions à nombreux petits résultats ; l’ancienneté de l’historique démarre dès que le volume dépasse le seuil, seuils modifiables séparément",
|
|
2625
2680
|
"estimator.title": "Estimateur (optionnel)",
|
|
2626
2681
|
"estimator.description": "Un petit modèle auxiliaire estime sans exemples si les anciennes lectures de fichiers ont encore des chances d’être référencées ; indicatif seulement, pour le vieillissement de l’historique. Sans configuration ou en cas d’échec, retour aux règles seules.",
|
|
2627
2682
|
"estimator.mode": "Canal",
|
|
@@ -2779,6 +2834,8 @@ window.__ModuleLoader__.load({
|
|
|
2779
2834
|
"profile.savings": "Risparmio",
|
|
2780
2835
|
"profile.adaptive": "Adattivo (costo prudente)",
|
|
2781
2836
|
"profile.tokenpilot-inspired": "Ispirato a TokenPilot",
|
|
2837
|
+
"profile.ptc": "PTC / modalità codice (assoluto)",
|
|
2838
|
+
"detail.ptc": "Soglie assolute indipendenti dalla finestra per la modalità codice e sessioni con molti risultati piccoli; l’invecchiamento della cronologia parte al superamento della soglia, soglie modificabili separatamente",
|
|
2782
2839
|
"estimator.title": "Stimatore (opzionale)",
|
|
2783
2840
|
"estimator.description": "Un piccolo modello ausiliario stima senza esempi se le vecchie letture di file sono probabilmente ancora referenziate; solo consultivo per l’invecchiamento della cronologia. Senza configurazione o in caso di errore si ripiega sul solo comportamento a regole.",
|
|
2784
2841
|
"estimator.mode": "Canale",
|
|
@@ -2936,6 +2993,8 @@ window.__ModuleLoader__.load({
|
|
|
2936
2993
|
"profile.savings": "節約",
|
|
2937
2994
|
"profile.adaptive": "Adaptive(コスト重視)",
|
|
2938
2995
|
"profile.tokenpilot-inspired": "TokenPilot モード",
|
|
2996
|
+
"profile.ptc": "PTC / コードモード(絶対)",
|
|
2997
|
+
"detail.ptc": "コードモードや小さな結果が多いセッション向けの、ウィンドウ非依存の絶対水位。履歴の圧縮は存量がしきい値を超えると開始し、しきい値は個別に編集可能",
|
|
2939
2998
|
"estimator.title": "エスティメーター(任意)",
|
|
2940
2999
|
"estimator.description": "小規模な補助モデルが、古いファイル読み取りにまだ参照価値があるかをゼロショットで判定します。履歴エージングの補助 only で、未設定や障害時は自動的にルールのみの経路へ戻り、本流には影響しません。",
|
|
2941
3000
|
"estimator.mode": "チャネル",
|
|
@@ -3093,6 +3152,8 @@ window.__ModuleLoader__.load({
|
|
|
3093
3152
|
"profile.savings": "절약",
|
|
3094
3153
|
"profile.adaptive": "Adaptive(보수적 비용)",
|
|
3095
3154
|
"profile.tokenpilot-inspired": "TokenPilot 모드",
|
|
3155
|
+
"profile.ptc": "PTC / 코드 모드(절대)",
|
|
3156
|
+
"detail.ptc": "코드 모드와 작은 결과가 많은 세션을 위한 창 독립적 절대 워터마크. 실시간 결과가 임계값을 넘으면 기록 정리가 시작되며, 임계값은 개별 편집 가능",
|
|
3096
3157
|
"estimator.title": "추정기(선택 사항)",
|
|
3097
3158
|
"estimator.description": "소형 보조 모델이 오래된 파일 읽기에 아직 참조 가치가 있는지 제로샷으로 판단합니다. 이력 에이징을 돕는 자문 전용 채널이며, 미설정 또는 실패 시 자동으로 규칙 전용 경로로 되돌아가므로 본 흐름에 영향을 주지 않습니다.",
|
|
3098
3159
|
"estimator.mode": "채널",
|
|
@@ -3250,6 +3311,8 @@ window.__ModuleLoader__.load({
|
|
|
3250
3311
|
"profile.savings": "Экономия",
|
|
3251
3312
|
"profile.adaptive": "Адаптивный (консервативная цена)",
|
|
3252
3313
|
"profile.tokenpilot-inspired": "По мотивам TokenPilot",
|
|
3314
|
+
"profile.ptc": "PTC / режим кода (абсолютный)",
|
|
3315
|
+
"detail.ptc": "Абсолютные независящие от окна пороги для режима кода и сессий с множеством мелких результатов; старение истории начинается при превышении порога, пороги можно менять отдельно",
|
|
3253
3316
|
"estimator.title": "Оценщик (опционально)",
|
|
3254
3317
|
"estimator.description": "Небольшая вспомогательная модель без примеров оценивает, вероятно ли старое чтение файла всё ещё востребовано; только рекомендация для старения истории. Без настройки или при сбое — режим только правил.",
|
|
3255
3318
|
"estimator.mode": "Канал",
|
|
@@ -3778,6 +3841,8 @@ window.__ModuleLoader__.load({
|
|
|
3778
3841
|
select: (profile) => writeAndConfirm(() => scope.set("profile", profile), (settings) => settings.profile === profile),
|
|
3779
3842
|
saveCustom: (custom) => writeAndConfirm(() => scope.set("custom", custom), (settings) => isCustomCompressionPolicy(settings.custom) && sameCustomPolicy(settings.custom, custom)),
|
|
3780
3843
|
resetCustom: () => writeAndConfirm(() => scope.set("custom", structuredClone(DEFAULT_CUSTOM_COMPRESSION_POLICY)), (settings) => isCustomCompressionPolicy(settings.custom) && sameCustomPolicy(settings.custom, DEFAULT_CUSTOM_COMPRESSION_POLICY)),
|
|
3844
|
+
savePtcCustom: (custom) => writeAndConfirm(() => scope.set("ptcCustom", custom), (settings) => isCustomCompressionPolicy(settings.ptcCustom) && sameCustomPolicy(settings.ptcCustom, custom)),
|
|
3845
|
+
resetPtcCustom: () => writeAndConfirm(() => scope.set("ptcCustom", structuredClone(DEFAULT_PTC_COMPRESSION_POLICY)), (settings) => isCustomCompressionPolicy(settings.ptcCustom) && sameCustomPolicy(settings.ptcCustom, DEFAULT_PTC_COMPRESSION_POLICY)),
|
|
3781
3846
|
saveAutoCompact: (thresholdPercent) => writeAndConfirm(() => scope.set("autoCompact", { thresholdPercent }), (settings) => settings.autoCompact.thresholdPercent === thresholdPercent),
|
|
3782
3847
|
saveCodeSkeleton: (enabled) => writeAndConfirm(() => scope.set("codeSkeleton", { enabled }), (settings) => settings.codeSkeleton.enabled === enabled),
|
|
3783
3848
|
saveIntentSummary: (enabled) => writeAndConfirm(() => scope.set("intentSummary", { enabled }), (settings) => settings.intentSummary.enabled === enabled),
|
package/lib/invariant.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as sessionEvents } from "./tool-result.js";
|
|
2
2
|
import { a as validatePublishedTailTrim } from "./tail-trim.js";
|
|
3
3
|
//#region src/invariant.ts
|
|
4
4
|
const PACKAGE_NAME = "dsh-context-compression-improved-runtime";
|
package/lib/profiles.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/profiles.d.ts
|
|
2
2
|
/** Public context-compression choices shared by the Host schema and browser selector. */
|
|
3
|
-
declare const COMPRESSION_PROFILES: readonly ["off", "native", "balanced", "cache-strict", "savings", "adaptive", "tokenpilot-inspired", "custom"];
|
|
3
|
+
declare const COMPRESSION_PROFILES: readonly ["off", "native", "balanced", "cache-strict", "savings", "adaptive", "tokenpilot-inspired", "ptc", "custom"];
|
|
4
4
|
/** One supported context-compression profile. */
|
|
5
5
|
type CompressionProfile = typeof COMPRESSION_PROFILES[number];
|
|
6
6
|
/** Single canonical unit stored by a version-1 browser Custom document. */
|
|
@@ -105,6 +105,8 @@ interface ContextCompressionSettings {
|
|
|
105
105
|
profile: CompressionProfile;
|
|
106
106
|
/** Complete canonical policy captured with `profile` when the runtime first observes a Session. */
|
|
107
107
|
custom: CustomCompressionPolicy;
|
|
108
|
+
/** PTC profile's own editable policy, seeded from the ptc defaults; independent of `custom`. Optional like `monitorPanel`/`presetOptions`: schema-defaulted, always present after parse. */
|
|
109
|
+
ptcCustom?: CustomCompressionPolicy;
|
|
108
110
|
/** Auto Compact trigger captured with `profile` when the runtime first observes a Session. */
|
|
109
111
|
autoCompact: AutoCompactSettings;
|
|
110
112
|
/** Code-skeleton reducer gate captured independently of `profile`. */
|
package/lib/pruner.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ declare class DedupeTable {
|
|
|
28
28
|
//#endregion
|
|
29
29
|
//#region src/runtime/types.d.ts
|
|
30
30
|
/** User-facing mixed strategy profile. */
|
|
31
|
-
declare const COMPRESSION_PROFILES: readonly ["off", "native", "balanced", "cache-strict", "savings", "adaptive", "tokenpilot-inspired", "custom"];
|
|
31
|
+
declare const COMPRESSION_PROFILES: readonly ["off", "native", "balanced", "cache-strict", "savings", "adaptive", "tokenpilot-inspired", "ptc", "custom"];
|
|
32
32
|
/** Public compression strategy selected for one Session. */
|
|
33
33
|
type CompressionProfile = typeof COMPRESSION_PROFILES[number];
|
|
34
34
|
/** When historical tool results may be aged for one Session policy. */
|
|
@@ -182,6 +182,8 @@ interface ContextCompressionSettings {
|
|
|
182
182
|
profile: CompressionProfile;
|
|
183
183
|
/** Versioned Custom policy snapped with `profile` for a newly observed Session. */
|
|
184
184
|
custom: CustomCompressionPolicy;
|
|
185
|
+
/** PTC profile's own editable policy, seeded from the ptc defaults and independent of `custom`. Optional like `monitorPanel`/`presetOptions`: schema-defaulted, always present after parse. */
|
|
186
|
+
ptcCustom?: CustomCompressionPolicy;
|
|
185
187
|
/** Auto Compact trigger preference snapped with `profile` for a newly observed Session. */
|
|
186
188
|
autoCompact: AutoCompactSettings;
|
|
187
189
|
/** Code-skeleton reducer gate snapped independently of `profile`. */
|
|
@@ -691,7 +693,7 @@ declare function resolveConfig(config?: ToolResultPruneConfig): ResolvedConfig;
|
|
|
691
693
|
* to resolve context-percent Custom values and standard-profile linkage.
|
|
692
694
|
* @returns the effective deterministic compression policy.
|
|
693
695
|
*/
|
|
694
|
-
declare function resolvePolicy(config: ResolvedConfig, profile: CompressionProfile, custom?: CustomCompressionPolicy, options?: CustomPolicyResolutionOptions): CompressionPolicy;
|
|
696
|
+
declare function resolvePolicy(config: ResolvedConfig, profile: CompressionProfile, custom?: CustomCompressionPolicy, options?: CustomPolicyResolutionOptions, ptcCustom?: CustomCompressionPolicy): CompressionPolicy;
|
|
695
697
|
//#endregion
|
|
696
698
|
//#region src/runtime/reducers.d.ts
|
|
697
699
|
/** Deterministic, evidence-backed reducers for fresh tool results. */
|
package/lib/pruner.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $ as isValidAutoCompactThresholdPercent, A as officialRequestUsage, At as recordRecertified, B as unavailableCount, Ct as getAdvisorState, D as dedupePlaceholder, Dt as invalidateOnTaskChange, E as dedupeHash, Et as getSummaryOverride, F as onlyTextBlocks, Ft as priceOfficialDeepSeekUsage, G as ContextCompressionSettingsSchema, H as countOmittedLines, I as pressureCost, It as resolveOfficialDeepSeekPrice, J as PRUNE_MARKER, K as DEFAULTS, L as recoveryMarker, Lt as getSavingsLedger, M as emptyResult, N as nativePruneContent, Nt as DEEPSEEK_OFFICIAL_PRICE_CATALOG_VERSION, O as flattenPlainText, Ot as observeIntentEnabled, P as onlyTextBlock, Pt as decimalRateNanoUnits, Q as isCompressionProfile, R as sameProviderMeasurementKey, St as evaluateIntentGate, T as DedupeTable, U as AUTO_COMPACT_THRESHOLD_LIMITS, V as CAPACITY_PRESSURE_RATIO, W as CONTEXT_COMPRESSION_SETTINGS_NAMESPACE, X as charsToTokens, Y as charsForTokens, Z as codePointLength, _ as scheduleUsageFlush, at as resolveCustomPolicy, ct as COMPRESSION_PROFILES, d as claimFromLand, et as parseContextCompressionSettings, f as claimOffset, ft as deepSeekV4TokenizerForModel, g as reclaimFromTailTrim, it as DEFAULT_CUSTOM_COMPRESSION_POLICY, j as countToolContent, jt as recordScore, k as measureForCompaction, kt as recordIntentFold, lt as countExactCanonicalTextFields, m as flushUsageOnDispose, n as sampleIntegralBoundary, nt as resolvePolicy, o as kickStatsBackfillOnDispose, ot as assertNever, rt as CustomCompressionPolicySchema, st as deepFreeze, tt as resolveConfig, v as setStatsLivePathBusy, w as projectSessionSavings, yt as observeContextUsage, z as summarize } from "./savings-integral.js";
|
|
2
|
-
import { n as viewToolResult, o as
|
|
2
|
+
import { c as eventBySeq, l as sessionEvents, n as viewToolResult, o as PTC_BINDING_NOTE, s as RUNTIME_TOOL_NAMES, t as compressionMessageSource } from "./tool-result.js";
|
|
3
3
|
import { a as validatePublishedTailTrim, i as tailTrimStub, n as tailTrimMessage, o as createUserMessage, r as tailTrimRef, s as freezeMessage, t as parseTailTrimRef } from "./tail-trim.js";
|
|
4
4
|
import z from "@deepseek-ai/schemastery";
|
|
5
5
|
import * as dshSessionNamespace from "@deepseek-ai/dsh-session";
|
|
@@ -15,8 +15,8 @@ const MAX_LINES = 1e3;
|
|
|
15
15
|
const DEFAULT_MAX_CHARS = 12e3;
|
|
16
16
|
const DEFAULT_MAX_SCAN_CHARS = 25e4;
|
|
17
17
|
const DEFAULT_MAX_QUERY_CHARS = 256;
|
|
18
|
-
const TRUNCATION_MARKER =
|
|
19
|
-
const PROMPT =
|
|
18
|
+
const TRUNCATION_MARKER = `\n[${RUNTIME_TOOL_NAMES.RETRIEVE} output truncated; reported lines describe the selected source range]\n`;
|
|
19
|
+
const PROMPT = `When a compacted tool result contains a session://<session-id>/event/<seq> reference, or TailTrim contains a session://<session-id>/tailtrim/<seq> reference, use ${RUNTIME_TOOL_NAMES.RETRIEVE} with that exact ref and a narrow line range or query if the omitted evidence is necessary. Prefer a query or a tight start_line/max_lines over re-reading the whole result: every recovery re-enters the context and is charged against the savings, so a targeted slice keeps the rest of the reduction. The returned event content comes from the append-only session log, which is the source of truth. ` + PTC_BINDING_NOTE;
|
|
20
20
|
const OUTPUT = {
|
|
21
21
|
schema: { type: "string" },
|
|
22
22
|
render: (_args, value) => [{
|
|
@@ -40,8 +40,8 @@ function installContextCompressionRetrieve(ctx, config = {}) {
|
|
|
40
40
|
text: PROMPT
|
|
41
41
|
});
|
|
42
42
|
ctx.tools.register(defineTool({
|
|
43
|
-
name:
|
|
44
|
-
description:
|
|
43
|
+
name: RUNTIME_TOOL_NAMES.RETRIEVE,
|
|
44
|
+
description: `Recover exact content from one compacted tool result or TailTrim group using its current-session session:// reference. ${PTC_BINDING_NOTE}`,
|
|
45
45
|
parameters: {
|
|
46
46
|
ref: {
|
|
47
47
|
type: "string",
|
|
@@ -64,11 +64,11 @@ function installContextCompressionRetrieve(ctx, config = {}) {
|
|
|
64
64
|
output: OUTPUT,
|
|
65
65
|
isConcurrencySafe: () => true,
|
|
66
66
|
execute(args, exec) {
|
|
67
|
-
if (exec.agent === void 0) throw new Error(
|
|
67
|
+
if (exec.agent === void 0) throw new Error(`${RUNTIME_TOOL_NAMES.RETRIEVE} requires an agent session`);
|
|
68
68
|
const match = REF_PATTERN.exec(args.ref);
|
|
69
69
|
const tailTrimRef = parseTailTrimRef(args.ref);
|
|
70
|
-
if (match === null && tailTrimRef === null) throw new Error(
|
|
71
|
-
if ((match?.[1] ?? tailTrimRef?.sessionId) !== String(exec.agent.session.id)) throw new Error(
|
|
70
|
+
if (match === null && tailTrimRef === null) throw new Error(`${RUNTIME_TOOL_NAMES.RETRIEVE}: ref must be session://<session-id>/(event|tailtrim)/<seq>`);
|
|
71
|
+
if ((match?.[1] ?? tailTrimRef?.sessionId) !== String(exec.agent.session.id)) throw new Error(`${RUNTIME_TOOL_NAMES.RETRIEVE}: a compression reference may only read the caller's current session`);
|
|
72
72
|
if (tailTrimRef !== null) {
|
|
73
73
|
const sessionId = String(exec.agent.session.id);
|
|
74
74
|
return Promise.resolve(recoverTailTrim(exec.agent.session, args.ref, tailTrimRef.manifestSeq, args.query, args.start_line, args.max_lines, {
|
|
@@ -93,14 +93,14 @@ function installContextCompressionRetrieve(ctx, config = {}) {
|
|
|
93
93
|
}
|
|
94
94
|
const seq = Number(match?.[2]);
|
|
95
95
|
const event = sessionEvents(exec.agent.session)[seq];
|
|
96
|
-
if (event?.type !== "tool/result") throw new Error(
|
|
96
|
+
if (event?.type !== "tool/result") throw new Error(`${RUNTIME_TOOL_NAMES.RETRIEVE}: event ${String(seq)} is not a tool/result in the current session`);
|
|
97
97
|
const maxLines = resolveMaxLines(args.max_lines);
|
|
98
98
|
const resultView = viewToolResult(event.data.message);
|
|
99
99
|
const scan = scanBlocks(resultView.blocks, maxScanChars);
|
|
100
100
|
const scannedLines = splitScannedLines(scan);
|
|
101
101
|
const lines = scannedLines.lines;
|
|
102
102
|
const query = args.query;
|
|
103
|
-
if (query !== void 0 && exceedsCodePointLimit(query, maxQueryChars)) throw new Error(
|
|
103
|
+
if (query !== void 0 && exceedsCodePointLimit(query, maxQueryChars)) throw new Error(`${RUNTIME_TOOL_NAMES.RETRIEVE}: query must be at most ${String(maxQueryChars)} Unicode code points`);
|
|
104
104
|
const selected = query === void 0 || query === "" ? directSlice(lines, args.start_line ?? 1, maxLines, scan.complete, scannedLines.partialTail) : querySlice(lines, query, maxLines, scan.complete, scannedLines.partialTail);
|
|
105
105
|
const total = scan.complete ? String(lines.length) : `at least ${String(lines.length)}`;
|
|
106
106
|
const bounded = boundCodePoints(`${[
|
|
@@ -131,8 +131,8 @@ function installContextCompressionRetrieve(ctx, config = {}) {
|
|
|
131
131
|
}
|
|
132
132
|
function recoverTailTrim(session, ref, manifestSeq, query, startLine, requestedMaxLines, bounds) {
|
|
133
133
|
const published = validatePublishedTailTrim(session, manifestSeq);
|
|
134
|
-
if (published === null || published.ref !== ref) throw new Error(
|
|
135
|
-
if (query !== void 0 && exceedsCodePointLimit(query, bounds.maxQueryChars)) throw new Error(
|
|
134
|
+
if (published === null || published.ref !== ref) throw new Error(`${RUNTIME_TOOL_NAMES.RETRIEVE}: ref is not a valid published TailTrim group`);
|
|
135
|
+
if (query !== void 0 && exceedsCodePointLimit(query, bounds.maxQueryChars)) throw new Error(`${RUNTIME_TOOL_NAMES.RETRIEVE}: query must be at most ${String(bounds.maxQueryChars)} Unicode code points`);
|
|
136
136
|
const fixedHeader = [
|
|
137
137
|
`source: ${ref}`,
|
|
138
138
|
"kind: tailtrim-group",
|
|
@@ -158,7 +158,7 @@ function resolvePositiveInteger(name, value, fallback) {
|
|
|
158
158
|
}
|
|
159
159
|
function resolveMaxLines(value) {
|
|
160
160
|
const resolved = value ?? 200;
|
|
161
|
-
if (!Number.isSafeInteger(resolved) || resolved < 1 || resolved > MAX_LINES) throw new Error(
|
|
161
|
+
if (!Number.isSafeInteger(resolved) || resolved < 1 || resolved > MAX_LINES) throw new Error(`${RUNTIME_TOOL_NAMES.RETRIEVE}: max_lines must be an integer from 1 to ${String(MAX_LINES)}`);
|
|
162
162
|
return resolved;
|
|
163
163
|
}
|
|
164
164
|
function scanBlocks(blocks, maxChars) {
|
|
@@ -229,7 +229,7 @@ function* jsonTokens(value) {
|
|
|
229
229
|
yield "}";
|
|
230
230
|
return;
|
|
231
231
|
}
|
|
232
|
-
default: throw new TypeError(
|
|
232
|
+
default: throw new TypeError(`${RUNTIME_TOOL_NAMES.RETRIEVE}: source content is not JSON-serializable`);
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
function jsonScalar(value) {
|
|
@@ -262,8 +262,11 @@ function splitScannedLines(scan) {
|
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
264
|
function directSlice(lines, startLine, maxLines, scanComplete, partialTail) {
|
|
265
|
-
if (!Number.isSafeInteger(startLine) || startLine < 1) throw new Error(
|
|
266
|
-
if (startLine > lines.length)
|
|
265
|
+
if (!Number.isSafeInteger(startLine) || startLine < 1) throw new Error(`${RUNTIME_TOOL_NAMES.RETRIEVE}: start_line must be a positive safe integer`);
|
|
266
|
+
if (startLine > lines.length) {
|
|
267
|
+
const reason = scanComplete ? "outside the source line range" : "beyond the source scan limit";
|
|
268
|
+
throw new Error(`${RUNTIME_TOOL_NAMES.RETRIEVE}: start_line ${String(startLine)} is ${reason}`);
|
|
269
|
+
}
|
|
267
270
|
const startIndex = startLine - 1;
|
|
268
271
|
const selected = lines.slice(startIndex, startIndex + maxLines);
|
|
269
272
|
return {
|
|
@@ -499,7 +502,7 @@ function buildLocatorBlock(events, shadowedRange) {
|
|
|
499
502
|
`- seq range: ${String(shadowedRange.start)}-${String(shadowedRange.end)}`,
|
|
500
503
|
...[...spillFiles].map((path) => `- spill file: ${path}`),
|
|
501
504
|
...[...touchedFiles].map((path) => `- file touched: ${path}`),
|
|
502
|
-
|
|
505
|
+
`(Use \`read <spill file>\` or \`${RUNTIME_TOOL_NAMES.RETRIEVE}\` with a \`session://\` source — pass start_line/max_lines to window the text — to restore exact text.)`
|
|
503
506
|
].join("\n"),
|
|
504
507
|
spillFiles: spillFiles.size,
|
|
505
508
|
touchedFiles: touchedFiles.size
|
|
@@ -751,7 +754,7 @@ function historicalPlaceholder(input) {
|
|
|
751
754
|
const lastFolded = normalized.folded.at(-1);
|
|
752
755
|
const elidedLines = lastFolded === void 0 ? void 0 : lastFolded.originalLineEnd ?? lastFolded.originalLine;
|
|
753
756
|
const anchorLine = input.compact ? void 0 : (normalized.folded.find((line) => IMPORTANT_PATTERN.test(line.text)) ?? void 0)?.originalLine;
|
|
754
|
-
const retrieveHint = anchorLine === void 0 ? `retrieve:
|
|
757
|
+
const retrieveHint = anchorLine === void 0 ? `retrieve: ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}"})` : `retrieve: ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}","start_line":${String(anchorLine)},"max_lines":${String(RETRIEVE_HINT_MAX_LINES)}})`;
|
|
755
758
|
const lines = [
|
|
756
759
|
"[Old tool result content cleared from active context]",
|
|
757
760
|
`tool: ${input.toolName || "unknown"}`,
|
|
@@ -991,7 +994,7 @@ function reduceBundledJs(input) {
|
|
|
991
994
|
if (declarations.size === 0) return null;
|
|
992
995
|
const hasSourceMap = input.contentText.includes(SOURCEMAP_DIRECTIVE);
|
|
993
996
|
const entries = [...declarations.entries()].sort((a, b) => a[1] - b[1]);
|
|
994
|
-
const kept = [`[bundled/minified JS detected; ${String(entries.length)} declarations; minified symbols may be renamed — exports.*/module.exports traces are the reliable ones;${hasSourceMap ? " source map present, prefer reading the original source;" : ""} source: ${input.sourceRef}; retrieve with
|
|
997
|
+
const kept = [`[bundled/minified JS detected; ${String(entries.length)} declarations; minified symbols may be renamed — exports.*/module.exports traces are the reliable ones;${hasSourceMap ? " source map present, prefer reading the original source;" : ""} source: ${input.sourceRef}; retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}"}) (line-addressed: single-line bundles come back whole)]`, ...entries.slice(0, 400).map(([symbol, line]) => `${symbol} (line ${String(line)})`)];
|
|
995
998
|
const start = input.lines[0]?.originalLine ?? 1;
|
|
996
999
|
const end = originalEnd(input.lines, input.lines.length - 1);
|
|
997
1000
|
if (end > start) kept.push(elidedRangeMarker(start, end));
|
|
@@ -1219,7 +1222,7 @@ function reduceSearch(input, fileRanking) {
|
|
|
1219
1222
|
rows
|
|
1220
1223
|
})), fileRanking)) perFile.set(entry.id, [...entry.rows].sort((a, b) => a.important === b.important ? a.fileLine - b.fileLine : a.important ? -1 : 1));
|
|
1221
1224
|
const allLocators = [...perFile.keys()].map((path) => locatorFor(path, groups.get(path)));
|
|
1222
|
-
const headerFor = (l2Rows, omitted) => `[search results compressed; ${String(groups.size)} files, ${String(totalMatches)} matches; ${String(l2Rows)} content rows shown, ${String(omitted)} matches omitted; source: ${input.sourceRef}; retrieve with
|
|
1225
|
+
const headerFor = (l2Rows, omitted) => `[search results compressed; ${String(groups.size)} files, ${String(totalMatches)} matches; ${String(l2Rows)} content rows shown, ${String(omitted)} matches omitted; source: ${input.sourceRef}; retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}"})]`;
|
|
1223
1226
|
const fillL2 = (output, quotaChars) => {
|
|
1224
1227
|
let used = 0;
|
|
1225
1228
|
let shown = 0;
|
|
@@ -1306,7 +1309,7 @@ function reduceGit(input, command) {
|
|
|
1306
1309
|
}
|
|
1307
1310
|
if (keep.length === 0) return reduceSalient(input, reducer);
|
|
1308
1311
|
const text = fitLines([
|
|
1309
|
-
`[git output compressed; ${scannedTotals(input, keep.length)}; source: ${input.sourceRef}; scatter-masked: retrieve with
|
|
1312
|
+
`[git output compressed; ${scannedTotals(input, keep.length)}; source: ${input.sourceRef}; scatter-masked: retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}","query":"<keyword>"}) for missed rows]`,
|
|
1310
1313
|
...keep,
|
|
1311
1314
|
...lines.slice(-8).map((line) => line.text)
|
|
1312
1315
|
], input.budgetChars, input.sourceRef);
|
|
@@ -1320,7 +1323,7 @@ function reducePatternLog(input, reducer, pattern) {
|
|
|
1320
1323
|
const lines = input.lines;
|
|
1321
1324
|
const kept = lines.filter((line) => pattern.test(line.text) || IMPORTANT_PATTERN.test(line.text) || STATUS_PATTERN.test(line.text));
|
|
1322
1325
|
const text = fitLines([
|
|
1323
|
-
`[command output compressed by ${reducer}; ${scannedTotals(input, kept.length)}; source: ${input.sourceRef}; scatter-masked: retrieve with
|
|
1326
|
+
`[command output compressed by ${reducer}; ${scannedTotals(input, kept.length)}; source: ${input.sourceRef}; scatter-masked: retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}","query":"<keyword>"}) for missed rows]`,
|
|
1324
1327
|
...kept.map((line) => line.text),
|
|
1325
1328
|
...lines.slice(-20).map((line) => line.text)
|
|
1326
1329
|
], input.budgetChars, input.sourceRef);
|
|
@@ -1335,7 +1338,7 @@ function reduceShell(input) {
|
|
|
1335
1338
|
const important = lines.filter((line) => IMPORTANT_PATTERN.test(line.text));
|
|
1336
1339
|
if (important.length === 0) return reduceTail(input, "pi-tail");
|
|
1337
1340
|
const text = fitLines([
|
|
1338
|
-
`[shell/log output compressed; ${scannedTotals(input, important.length)}; source: ${input.sourceRef}; scatter-masked: retrieve with
|
|
1341
|
+
`[shell/log output compressed; ${scannedTotals(input, important.length)}; source: ${input.sourceRef}; scatter-masked: retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}","query":"<keyword>"}) for missed rows]`,
|
|
1339
1342
|
...important.map((line) => line.text),
|
|
1340
1343
|
"--- final output ---",
|
|
1341
1344
|
...lines.slice(-40).map((line) => line.text)
|
|
@@ -1524,7 +1527,7 @@ function reduceHtml(input) {
|
|
|
1524
1527
|
if (slim.length === 0) return null;
|
|
1525
1528
|
const buildHeader = (reducer, firstElided) => {
|
|
1526
1529
|
const startLine = firstElided === void 0 ? "" : `,"start_line":${String(firstElided.start)},"max_lines":${String(RETRIEVE_HINT_MAX_LINES)}`;
|
|
1527
|
-
return `[html compressed by ${reducer}; source: ${input.sourceRef}; retrieve with
|
|
1530
|
+
return `[html compressed by ${reducer}; source: ${input.sourceRef}; retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}"${startLine}})]`;
|
|
1528
1531
|
};
|
|
1529
1532
|
const foldedSlim = foldRepeatedHtmlBlocks(slim, (index) => input.lines[index]?.originalLine ?? 1);
|
|
1530
1533
|
if (foldedSlim.reduce((sum, line) => sum + codePointLength(line.text) + 1, 0) + 160 <= input.budgetChars) {
|
|
@@ -1679,7 +1682,7 @@ function reduceDocSkeleton(input, sectionRanking) {
|
|
|
1679
1682
|
kept.push(elidedRangeMarker(start, end));
|
|
1680
1683
|
}
|
|
1681
1684
|
const hint = firstElided === void 0 ? "" : `,"start_line":${String(firstElided)},"max_lines":${String(RETRIEVE_HINT_MAX_LINES)}`;
|
|
1682
|
-
kept.unshift(`[document compressed by doc-skeleton; source: ${input.sourceRef}; retrieve with
|
|
1685
|
+
kept.unshift(`[document compressed by doc-skeleton; source: ${input.sourceRef}; retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}"${hint}})]`);
|
|
1683
1686
|
return {
|
|
1684
1687
|
text: fitLines(kept, budget, input.sourceRef),
|
|
1685
1688
|
...firstElided === void 0 ? {} : { firstElided },
|
|
@@ -1750,7 +1753,7 @@ function reduceProseKeep(input) {
|
|
|
1750
1753
|
const last = lines[lines.length - 1];
|
|
1751
1754
|
const tailLine = last.originalLineEnd ?? last.originalLine;
|
|
1752
1755
|
const markerTemplate = elidedRangeMarker(first.originalLine, tailLine);
|
|
1753
|
-
const sourceNoteTemplate = `; source: ${input.sourceRef}; retrieve with
|
|
1756
|
+
const sourceNoteTemplate = `; source: ${input.sourceRef}; retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}"})`;
|
|
1754
1757
|
const reserved = codePointLength(markerTemplate) + codePointLength(sourceNoteTemplate) + 2;
|
|
1755
1758
|
const bodyBudget = input.budgetChars - reserved;
|
|
1756
1759
|
if (bodyBudget <= 0) return null;
|
|
@@ -1777,7 +1780,7 @@ function reduceProseKeep(input) {
|
|
|
1777
1780
|
const elidedStart = lines[headCount].originalLine;
|
|
1778
1781
|
const elidedEnd = originalEnd(lines, lines.length - tailCount - 1);
|
|
1779
1782
|
if (elidedEnd < elidedStart) return null;
|
|
1780
|
-
const sourceNote = `; source: ${input.sourceRef}; retrieve with
|
|
1783
|
+
const sourceNote = `; source: ${input.sourceRef}; retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}","start_line":${String(elidedStart)},"max_lines":${String(RETRIEVE_HINT_MAX_LINES)}})`;
|
|
1781
1784
|
return {
|
|
1782
1785
|
text: [
|
|
1783
1786
|
...lines.slice(0, headCount).map((line) => line.text),
|
|
@@ -1929,7 +1932,7 @@ function reduceCodeSkeleton(input) {
|
|
|
1929
1932
|
return finishSkeleton(kept, lines, input, firstElided, elidedTotal);
|
|
1930
1933
|
}
|
|
1931
1934
|
function finishSkeleton(kept, lines, input, firstElided, elidedLines) {
|
|
1932
|
-
const hint = firstElided === void 0 ? "" : `; retrieve with
|
|
1935
|
+
const hint = firstElided === void 0 ? "" : `; retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}","start_line":${String(firstElided.start)},"max_lines":${String(RETRIEVE_HINT_MAX_LINES)}})`;
|
|
1933
1936
|
const text = fitLines([
|
|
1934
1937
|
`[code output compressed by hypa-code-skeleton; source: ${input.sourceRef}${hint}]`,
|
|
1935
1938
|
...kept,
|
|
@@ -1986,7 +1989,7 @@ function looksLikeSourceCode(text) {
|
|
|
1986
1989
|
return false;
|
|
1987
1990
|
}
|
|
1988
1991
|
function omissionMarker(input, reducer) {
|
|
1989
|
-
return `[... ${reducer} omitted content; original_chars=${String(codePointLength(input.text))}; source=${input.sourceRef}; retrieve with
|
|
1992
|
+
return `[... ${reducer} omitted content; original_chars=${String(codePointLength(input.text))}; source=${input.sourceRef}; retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE} ...]`;
|
|
1990
1993
|
}
|
|
1991
1994
|
/**
|
|
1992
1995
|
* Continuous-mask marker (R9b): an original-event line range plus a pasteable
|
|
@@ -1994,7 +1997,7 @@ function omissionMarker(input, reducer) {
|
|
|
1994
1997
|
* at the RAW event because retrieve reads raw events (D8).
|
|
1995
1998
|
*/
|
|
1996
1999
|
function rangeOmissionMarker(input, reducer, elidedStart, elidedEnd) {
|
|
1997
|
-
return `[... lines ${String(elidedStart)}-${String(elidedEnd)} elided (${String(elidedEnd - elidedStart + 1)} lines); ${reducer}; original_chars=${String(codePointLength(input.text))}; source=${input.sourceRef}; retrieve with
|
|
2000
|
+
return `[... lines ${String(elidedStart)}-${String(elidedEnd)} elided (${String(elidedEnd - elidedStart + 1)} lines); ${reducer}; original_chars=${String(codePointLength(input.text))}; source=${input.sourceRef}; retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}","start_line":${String(elidedStart)},"max_lines":${String(RETRIEVE_HINT_MAX_LINES)}}) ...]`;
|
|
1998
2001
|
}
|
|
1999
2002
|
/** Scatter-mask note (R9b): totals instead of fragmented per-run ranges. */
|
|
2000
2003
|
function scannedTotals(input, kept) {
|
|
@@ -4040,7 +4043,7 @@ var ToolResultPruner = class extends Service {
|
|
|
4040
4043
|
}, settings.profile, settings.custom, {
|
|
4041
4044
|
...contextWindowTokens === void 0 ? {} : { contextWindowTokens },
|
|
4042
4045
|
autoCompactThresholdPercent: settings.autoCompact.thresholdPercent
|
|
4043
|
-
});
|
|
4046
|
+
}, settings.ptcCustom);
|
|
4044
4047
|
const route = routeAuditFact(session);
|
|
4045
4048
|
const auditKey = JSON.stringify({
|
|
4046
4049
|
policy,
|
|
@@ -4287,7 +4290,7 @@ var ToolResultPruner = class extends Service {
|
|
|
4287
4290
|
* recovery tool; the per-session set admits future recovery paths.
|
|
4288
4291
|
*/
|
|
4289
4292
|
isRecoveryExempt(session, candidate) {
|
|
4290
|
-
if (candidate.call.name ===
|
|
4293
|
+
if (candidate.call.name === RUNTIME_TOOL_NAMES.RETRIEVE) return true;
|
|
4291
4294
|
return this.state.recoveryExemptions.get(session)?.has(candidate.seq) ?? false;
|
|
4292
4295
|
}
|
|
4293
4296
|
/** Register a result seq as permanently exempt from further reduction. */
|
|
@@ -4335,7 +4338,7 @@ var ToolResultPruner = class extends Service {
|
|
|
4335
4338
|
const dedupeEnabled = policy.presetOptions?.dedupeToolResults === true;
|
|
4336
4339
|
const maxCandidateTokens = candidates.length === 0 ? void 0 : Math.max(...candidates.map((candidate) => candidate.count.kind === "exact-tokenizer" ? candidate.count.tokens : charsToTokens(candidate.characterPressure)));
|
|
4337
4340
|
if (policy.freshEnabled) {
|
|
4338
|
-
if (candidates.some((candidate) => candidate.call.name !==
|
|
4341
|
+
if (candidates.some((candidate) => candidate.call.name !== RUNTIME_TOOL_NAMES.RETRIEVE && candidate.count.kind !== "exact-tokenizer")) this.warnExactUnavailable(session, view, "fresh");
|
|
4339
4342
|
for (const candidate of candidates) {
|
|
4340
4343
|
if (this.isRecoveryExempt(session, candidate)) continue;
|
|
4341
4344
|
if (dedupeEnabled) {
|
|
@@ -4525,7 +4528,7 @@ var ToolResultPruner = class extends Service {
|
|
|
4525
4528
|
"[Tool result reduced to satisfy the completed-step aggregate budget]",
|
|
4526
4529
|
`tool: ${candidate.call.name}`,
|
|
4527
4530
|
`source: ${sourceRef$2}`,
|
|
4528
|
-
|
|
4531
|
+
`Retrieve a narrow slice via ${RUNTIME_TOOL_NAMES.RETRIEVE} if needed.`
|
|
4529
4532
|
].join("\n");
|
|
4530
4533
|
const plan = this.plan(candidate, [{
|
|
4531
4534
|
type: "text",
|
|
@@ -4747,7 +4750,7 @@ var ToolResultPruner = class extends Service {
|
|
|
4747
4750
|
const assistant = eventBySeq(events, assistantSeq);
|
|
4748
4751
|
if (assistant?.type !== "assistant/message" || assistant.data.interrupted === true || assistant.data.message.content.length === 0 || assistant.data.message.content.some((block) => block.type !== "tool-call") || assistant.data.turn === firstCompletedSurfaceTurn || !completedTurns.has(assistant.data.turn) || !completedSteps.has(`${String(assistant.data.turn)}:${String(assistant.data.step)}`)) continue;
|
|
4749
4752
|
const calls = assistant.data.message.content;
|
|
4750
|
-
if (calls.some((call) => call.name ===
|
|
4753
|
+
if (calls.some((call) => call.name === RUNTIME_TOOL_NAMES.RETRIEVE)) continue;
|
|
4751
4754
|
const callIds = calls.map((call) => String(call.id));
|
|
4752
4755
|
if (new Set(callIds).size !== callIds.length) continue;
|
|
4753
4756
|
const resultSeqs = nodes.slice(index + 1, index + 1 + calls.length);
|
|
@@ -5036,7 +5039,7 @@ var ToolResultPruner = class extends Service {
|
|
|
5036
5039
|
landAll(session, plans) {
|
|
5037
5040
|
if (plans.length === 0) return [];
|
|
5038
5041
|
if (!this.hasRecoveryTool(session)) {
|
|
5039
|
-
this.warnOnce(session, "missing-context-retrieve",
|
|
5042
|
+
this.warnOnce(session, "missing-context-retrieve", `context-compression kept original tool results because ${RUNTIME_TOOL_NAMES.RETRIEVE} is unavailable`);
|
|
5040
5043
|
return [];
|
|
5041
5044
|
}
|
|
5042
5045
|
if (!hasOpenTurn(session)) throw new Error("tool-result pruning cannot append a surface replacement outside any open turn");
|
|
@@ -5052,7 +5055,7 @@ var ToolResultPruner = class extends Service {
|
|
|
5052
5055
|
const tools = this.ctx.get("tools");
|
|
5053
5056
|
if (tools === void 0) return false;
|
|
5054
5057
|
const agent = this.ctx.get("agents")?.get(session.id);
|
|
5055
|
-
return tools.get(
|
|
5058
|
+
return tools.get(RUNTIME_TOOL_NAMES.RETRIEVE, agent) !== void 0;
|
|
5056
5059
|
}
|
|
5057
5060
|
auditHistoryEvaluation(session, policy, view, allowed, outcome) {
|
|
5058
5061
|
if (policy.historyMode === "disabled") {
|
package/lib/savings-integral.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as viewToolResult, s as
|
|
1
|
+
import { l as sessionEvents, n as viewToolResult, s as RUNTIME_TOOL_NAMES } from "./tool-result.js";
|
|
2
2
|
import z from "@deepseek-ai/schemastery";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
@@ -1778,6 +1778,7 @@ const COMPRESSION_PROFILES = [
|
|
|
1778
1778
|
"savings",
|
|
1779
1779
|
"adaptive",
|
|
1780
1780
|
"tokenpilot-inspired",
|
|
1781
|
+
"ptc",
|
|
1781
1782
|
"custom"
|
|
1782
1783
|
];
|
|
1783
1784
|
//#endregion
|
|
@@ -1921,6 +1922,38 @@ const DEFAULT_CUSTOM_COMPRESSION_POLICY = deepFreeze({
|
|
|
1921
1922
|
}
|
|
1922
1923
|
});
|
|
1923
1924
|
/**
|
|
1925
|
+
* PTC/code-mode default policy: window-independent absolute watermarks tuned
|
|
1926
|
+
* for many-small-result sessions. `ptc` seeds its own editable `ptcCustom`
|
|
1927
|
+
* document from this value, so editing `ptcCustom` never touches `custom` /
|
|
1928
|
+
* `tokenpilot-inspired`.
|
|
1929
|
+
*/
|
|
1930
|
+
const DEFAULT_PTC_COMPRESSION_POLICY = deepFreeze({
|
|
1931
|
+
version: 3,
|
|
1932
|
+
unit: "tokens",
|
|
1933
|
+
fresh: {
|
|
1934
|
+
enabled: true,
|
|
1935
|
+
trigger: 4096,
|
|
1936
|
+
target: 1536
|
|
1937
|
+
},
|
|
1938
|
+
aggregate: {
|
|
1939
|
+
enabled: true,
|
|
1940
|
+
trigger: 16384,
|
|
1941
|
+
target: 4096
|
|
1942
|
+
},
|
|
1943
|
+
history: {
|
|
1944
|
+
enabled: true,
|
|
1945
|
+
trigger: 2e4,
|
|
1946
|
+
keepRecentToolCalls: 8,
|
|
1947
|
+
keepRecentTokens: 8e3,
|
|
1948
|
+
minReclaim: 6e3
|
|
1949
|
+
},
|
|
1950
|
+
prefixPolicy: "pressure-break",
|
|
1951
|
+
tailTrim: {
|
|
1952
|
+
enabled: false,
|
|
1953
|
+
trigger: 7e5
|
|
1954
|
+
}
|
|
1955
|
+
});
|
|
1956
|
+
/**
|
|
1924
1957
|
* Resolve one validated Custom document to the same token policy used by public presets.
|
|
1925
1958
|
* @param value - untrusted or typed Custom settings value.
|
|
1926
1959
|
* @param options - routed model capacity for context-percent documents.
|
|
@@ -2257,7 +2290,8 @@ function parsePresetOptionsSettings(value) {
|
|
|
2257
2290
|
/** Settings schema used by the user-facing profile selector. */
|
|
2258
2291
|
const contextCompressionSettingsInputSchema = z.object({
|
|
2259
2292
|
profile: z.union([...COMPRESSION_PROFILES]).default("balanced"),
|
|
2260
|
-
custom: CustomCompressionPolicySchema.default(DEFAULT_CUSTOM_COMPRESSION_POLICY)
|
|
2293
|
+
custom: CustomCompressionPolicySchema.default(DEFAULT_CUSTOM_COMPRESSION_POLICY),
|
|
2294
|
+
ptcCustom: CustomCompressionPolicySchema.default(DEFAULT_PTC_COMPRESSION_POLICY)
|
|
2261
2295
|
});
|
|
2262
2296
|
/**
|
|
2263
2297
|
* Reject a section that is PRESENT but not a usable value. Schemastery
|
|
@@ -2275,6 +2309,7 @@ const isUsableCustomDocument = (value) => isPlainRecord(value);
|
|
|
2275
2309
|
const DEFAULT_CONTEXT_COMPRESSION_SETTINGS = {
|
|
2276
2310
|
profile: "balanced",
|
|
2277
2311
|
custom: structuredClone(DEFAULT_CUSTOM_COMPRESSION_POLICY),
|
|
2312
|
+
ptcCustom: structuredClone(DEFAULT_PTC_COMPRESSION_POLICY),
|
|
2278
2313
|
autoCompact: { thresholdPercent: AUTO_COMPACT_THRESHOLD_LIMITS.default },
|
|
2279
2314
|
codeSkeleton: { enabled: false },
|
|
2280
2315
|
intentSummary: { enabled: false },
|
|
@@ -2296,10 +2331,11 @@ const ContextCompressionSettingsSchema = z.transform(z.any().required(), (value)
|
|
|
2296
2331
|
if (!isPlainRecord(value)) throw new TypeError("Context-compression settings must be a plain object");
|
|
2297
2332
|
assertPlainDataTree(value);
|
|
2298
2333
|
const candidate = structuredClone(value);
|
|
2299
|
-
const unknown = Object.keys(candidate).find((key) => key !== "profile" && key !== "custom" && key !== "autoCompact" && key !== "codeSkeleton" && key !== "intentSummary" && key !== "monitorPanel" && key !== "presetOptions");
|
|
2334
|
+
const unknown = Object.keys(candidate).find((key) => key !== "profile" && key !== "custom" && key !== "ptcCustom" && key !== "autoCompact" && key !== "codeSkeleton" && key !== "intentSummary" && key !== "monitorPanel" && key !== "presetOptions");
|
|
2300
2335
|
if (unknown !== void 0) throw new TypeError(`Context-compression settings: unknown key "${unknown}"`);
|
|
2301
2336
|
assertPresentSection(candidate, "profile", isSupportedProfile);
|
|
2302
2337
|
assertPresentSection(candidate, "custom", isUsableCustomDocument);
|
|
2338
|
+
assertPresentSection(candidate, "ptcCustom", isUsableCustomDocument);
|
|
2303
2339
|
const autoCompact = parseAutoCompactSettings(candidate.autoCompact);
|
|
2304
2340
|
const codeSkeleton = parseCodeSkeletonSettings(candidate.codeSkeleton);
|
|
2305
2341
|
const intentSummary = parseIntentSummarySettings(candidate.intentSummary);
|
|
@@ -2546,8 +2582,48 @@ function resolveAutoCompactLinkage(profile, options) {
|
|
|
2546
2582
|
* to resolve context-percent Custom values and standard-profile linkage.
|
|
2547
2583
|
* @returns the effective deterministic compression policy.
|
|
2548
2584
|
*/
|
|
2549
|
-
function resolvePolicy(config, profile, custom = DEFAULT_CUSTOM_COMPRESSION_POLICY, options = {}) {
|
|
2585
|
+
function resolvePolicy(config, profile, custom = DEFAULT_CUSTOM_COMPRESSION_POLICY, options = {}, ptcCustom = DEFAULT_PTC_COMPRESSION_POLICY) {
|
|
2550
2586
|
if (profile === "custom") return resolveCustomPolicy(custom, options);
|
|
2587
|
+
if (profile === "ptc") {
|
|
2588
|
+
const resolved = resolveCustomPolicy(ptcCustom, options);
|
|
2589
|
+
const policy = {
|
|
2590
|
+
...resolved,
|
|
2591
|
+
profile: "ptc",
|
|
2592
|
+
freshTriggerTokens: config.freshTriggerTokens ?? resolved.freshTriggerTokens,
|
|
2593
|
+
freshTargetTokens: config.freshTargetTokens ?? resolved.freshTargetTokens,
|
|
2594
|
+
aggregateTriggerTokens: config.aggregateTriggerTokens ?? resolved.aggregateTriggerTokens,
|
|
2595
|
+
aggregateTargetTokens: config.aggregateTargetTokens ?? resolved.aggregateTargetTokens,
|
|
2596
|
+
historyTriggerTokens: config.historyTriggerTokens ?? resolved.historyTriggerTokens,
|
|
2597
|
+
historyKeepRecentToolCalls: config.historyKeepRecentToolCalls ?? resolved.historyKeepRecentToolCalls,
|
|
2598
|
+
historyKeepRecentTokens: config.historyKeepRecentTokens ?? resolved.historyKeepRecentTokens,
|
|
2599
|
+
historyMinReclaimTokens: config.historyMinReclaimTokens ?? resolved.historyMinReclaimTokens,
|
|
2600
|
+
...config.readInputCapChars === void 0 ? {} : { readInputCapChars: config.readInputCapChars }
|
|
2601
|
+
};
|
|
2602
|
+
if (policy.freshTargetTokens >= policy.freshTriggerTokens && policy.freshEnabled) throw new Error("context compression policy: fresh target must be below trigger");
|
|
2603
|
+
if (policy.aggregateTargetTokens >= policy.aggregateTriggerTokens && policy.aggregateEnabled) throw new Error("context compression policy: aggregate target must be below trigger");
|
|
2604
|
+
if (policy.readInputCapChars !== void 0 && policy.readInputCapChars <= policy.freshTriggerTokens * 4) throw new Error("context compression policy: read input cap would silence the fresh path");
|
|
2605
|
+
return deepFreeze(policy);
|
|
2606
|
+
}
|
|
2607
|
+
if (profile === "tokenpilot-inspired") {
|
|
2608
|
+
const resolved = resolveCustomPolicy(custom, options);
|
|
2609
|
+
const policy = {
|
|
2610
|
+
...resolved,
|
|
2611
|
+
profile: "tokenpilot-inspired",
|
|
2612
|
+
freshTriggerTokens: config.freshTriggerTokens ?? resolved.freshTriggerTokens,
|
|
2613
|
+
freshTargetTokens: config.freshTargetTokens ?? resolved.freshTargetTokens,
|
|
2614
|
+
aggregateTriggerTokens: config.aggregateTriggerTokens ?? resolved.aggregateTriggerTokens,
|
|
2615
|
+
aggregateTargetTokens: config.aggregateTargetTokens ?? resolved.aggregateTargetTokens,
|
|
2616
|
+
historyTriggerTokens: config.historyTriggerTokens ?? resolved.historyTriggerTokens,
|
|
2617
|
+
historyKeepRecentToolCalls: config.historyKeepRecentToolCalls ?? resolved.historyKeepRecentToolCalls,
|
|
2618
|
+
historyKeepRecentTokens: config.historyKeepRecentTokens ?? resolved.historyKeepRecentTokens,
|
|
2619
|
+
historyMinReclaimTokens: config.historyMinReclaimTokens ?? resolved.historyMinReclaimTokens,
|
|
2620
|
+
...config.readInputCapChars === void 0 ? {} : { readInputCapChars: config.readInputCapChars },
|
|
2621
|
+
presetOptions: mergePresetOptions(config.presetOptions)
|
|
2622
|
+
};
|
|
2623
|
+
if (policy.freshTargetTokens >= policy.freshTriggerTokens && policy.freshEnabled) throw new Error("context compression policy: fresh target must be below trigger");
|
|
2624
|
+
if (policy.aggregateTargetTokens >= policy.aggregateTriggerTokens && policy.aggregateEnabled) throw new Error("context compression policy: aggregate target must be below trigger");
|
|
2625
|
+
return deepFreeze(policy);
|
|
2626
|
+
}
|
|
2551
2627
|
const preset = {
|
|
2552
2628
|
off: {
|
|
2553
2629
|
nativeToolResultEnabled: false,
|
|
@@ -2644,22 +2720,6 @@ function resolvePolicy(config, profile, custom = DEFAULT_CUSTOM_COMPRESSION_POLI
|
|
|
2644
2720
|
historyKeepRecentToolCalls: 10,
|
|
2645
2721
|
historyKeepRecentTokens: 64e3,
|
|
2646
2722
|
historyMinReclaimTokens: 96e3
|
|
2647
|
-
},
|
|
2648
|
-
"tokenpilot-inspired": {
|
|
2649
|
-
nativeToolResultEnabled: false,
|
|
2650
|
-
freshEnabled: true,
|
|
2651
|
-
aggregateEnabled: true,
|
|
2652
|
-
historyMode: "routine",
|
|
2653
|
-
nativeTriggerTokens: Number.MAX_SAFE_INTEGER,
|
|
2654
|
-
nativeTargetTokens: Number.MAX_SAFE_INTEGER,
|
|
2655
|
-
freshTriggerTokens: 4096,
|
|
2656
|
-
freshTargetTokens: 1536,
|
|
2657
|
-
aggregateTriggerTokens: 32768,
|
|
2658
|
-
aggregateTargetTokens: 12288,
|
|
2659
|
-
historyTriggerTokens: 5e5,
|
|
2660
|
-
historyKeepRecentToolCalls: 10,
|
|
2661
|
-
historyKeepRecentTokens: 64e3,
|
|
2662
|
-
historyMinReclaimTokens: 96e3
|
|
2663
2723
|
}
|
|
2664
2724
|
}[profile];
|
|
2665
2725
|
const linkage = resolveAutoCompactLinkage(profile, options);
|
|
@@ -2680,8 +2740,7 @@ function resolvePolicy(config, profile, custom = DEFAULT_CUSTOM_COMPRESSION_POLI
|
|
|
2680
2740
|
...linkage === void 0 ? {} : {
|
|
2681
2741
|
autoCompactTokens: linkage.autoCompactTokens,
|
|
2682
2742
|
microDeadlineTokens: linkage.microDeadlineTokens
|
|
2683
|
-
}
|
|
2684
|
-
...profile === "tokenpilot-inspired" ? { presetOptions: mergePresetOptions(config.presetOptions) } : {}
|
|
2743
|
+
}
|
|
2685
2744
|
};
|
|
2686
2745
|
if (policy.nativeTargetTokens >= policy.nativeTriggerTokens && profile === "native") throw new Error("context compression policy: native target must be below trigger");
|
|
2687
2746
|
if (policy.freshTargetTokens >= policy.freshTriggerTokens && policy.freshEnabled) throw new Error("context compression policy: fresh target must be below trigger");
|
|
@@ -2729,7 +2788,7 @@ function unavailableCount(reason) {
|
|
|
2729
2788
|
});
|
|
2730
2789
|
}
|
|
2731
2790
|
function recoveryMarker(sourceRef, label, startLine) {
|
|
2732
|
-
return `\n\n[... ${label}; source=${sourceRef}; ${startLine === void 0 ?
|
|
2791
|
+
return `\n\n[... ${label}; source=${sourceRef}; ${startLine === void 0 ? `use ${RUNTIME_TOOL_NAMES.RETRIEVE} with a query or narrow start_line/max_lines if needed (avoid re-reading the whole result)` : `retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${sourceRef}","start_line":${String(startLine)},"max_lines":80})`} ...]\n\n`;
|
|
2733
2792
|
}
|
|
2734
2793
|
/**
|
|
2735
2794
|
* Measure text content in Unicode code points; non-text blocks cost zero.
|
|
@@ -3131,7 +3190,7 @@ function dedupePlaceholder(entry, originalChars) {
|
|
|
3131
3190
|
return [
|
|
3132
3191
|
`[... identical to the earlier ${entry.toolName} result; first seen at ${entry.sourceRef};`,
|
|
3133
3192
|
`original_chars=${String(originalChars)};`,
|
|
3134
|
-
|
|
3193
|
+
`retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${entry.sourceRef}","start_line":1}) if the omitted evidence is necessary.]`
|
|
3135
3194
|
].join(" ");
|
|
3136
3195
|
}
|
|
3137
3196
|
//#endregion
|
package/lib/tail-trim.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as viewToolResult, s as
|
|
1
|
+
import { l as sessionEvents, n as viewToolResult, s as RUNTIME_TOOL_NAMES, t as compressionMessageSource } from "./tool-result.js";
|
|
2
2
|
//#region src/compat/llm-messages.ts
|
|
3
3
|
/** Recursive `Object.freeze` over own enumerable properties (arrays included). */
|
|
4
4
|
function deepFreeze(value) {
|
|
@@ -50,7 +50,7 @@ function tailTrimStub(ref, toolNames, sourceEventSeqs) {
|
|
|
50
50
|
`ref: ${ref}`,
|
|
51
51
|
`tools: ${toolNames.join(", ")}`,
|
|
52
52
|
`source_event_seqs: ${sourceEventSeqs.join(", ")}`,
|
|
53
|
-
|
|
53
|
+
`use ${RUNTIME_TOOL_NAMES.RETRIEVE} with this TailTrim ref if needed`
|
|
54
54
|
].join("\n");
|
|
55
55
|
return Array.from(stub).length <= MAX_STUB_CODE_POINTS ? stub : null;
|
|
56
56
|
}
|
package/lib/tool-result.js
CHANGED
|
@@ -20,6 +20,27 @@ function eventBySeq(events, seq) {
|
|
|
20
20
|
return events[Number(seq)];
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
|
+
//#region src/runtime/tool-names.ts
|
|
24
|
+
/**
|
|
25
|
+
* Runtime tool names owned by this plugin, plus the code-mode calling-convention
|
|
26
|
+
* note. Every place that REGISTERS a tool and every place that JUDGES reachability
|
|
27
|
+
* or exemption must read the SAME constant. billion-context learned this the hard
|
|
28
|
+
* way (#3600 / #3884): a hard-coded omnibus / tool literal silently stopped
|
|
29
|
+
* matching after the host renamed its transport, which suppressed the whole
|
|
30
|
+
* compression surface without any error. Keeping one source prevents that class
|
|
31
|
+
* of silent split here.
|
|
32
|
+
*/
|
|
33
|
+
const RUNTIME_TOOL_NAMES = Object.freeze({ RETRIEVE: "context_compression_retrieve" });
|
|
34
|
+
/**
|
|
35
|
+
* Calling-convention note appended to the retrieval tool description. In a
|
|
36
|
+
* standard (direct tool-call) preset the model calls the tool directly; when the
|
|
37
|
+
* harness folds tool use into an omnibus program (run_code / code_run) the same
|
|
38
|
+
* tool is reached through the program's SDK. Naming both keeps one static
|
|
39
|
+
* description correct on every preset, since CCI registers a single tool and
|
|
40
|
+
* cannot branch its description per preset.
|
|
41
|
+
*/
|
|
42
|
+
const PTC_BINDING_NOTE = `Call it directly as a tool when the environment allows direct tool calls; if this environment routes all tool use through a program (${Object.freeze(["run_code", "code_run"]).join(" / ")}), call it from inside that program via the tool SDK instead of emitting a standalone call.`;
|
|
43
|
+
//#endregion
|
|
23
44
|
//#region src/compat/host-generation.ts
|
|
24
45
|
let cached;
|
|
25
46
|
/**
|
|
@@ -147,4 +168,4 @@ function compressionMessageSource(generation) {
|
|
|
147
168
|
return { kind: "dsh-context-compression" };
|
|
148
169
|
}
|
|
149
170
|
//#endregion
|
|
150
|
-
export { noteResolvedSettingsService as a, detectHostGeneration as i, viewToolResult as n,
|
|
171
|
+
export { noteResolvedSettingsService as a, eventBySeq as c, detectHostGeneration as i, sessionEvents as l, viewToolResult as n, PTC_BINDING_NOTE as o, compatLog as r, RUNTIME_TOOL_NAMES as s, compressionMessageSource as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-context-compression-improved",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.4",
|
|
4
4
|
"description": "One-install context-compression selector bundle for DeepSeek Harness",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"author": "WilliamShi666",
|
|
71
71
|
"engines": {
|
|
72
72
|
"node": "^22.19.0 || >=24.0.0",
|
|
73
|
-
"dsh": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4"
|
|
73
|
+
"dsh": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1"
|
|
74
74
|
},
|
|
75
75
|
"keywords": [
|
|
76
76
|
"deepseek",
|
|
@@ -95,25 +95,25 @@
|
|
|
95
95
|
"@deepseek-ai/cordis": ">=4.0.1 <5",
|
|
96
96
|
"@deepseek-ai/cordis-plugin-include": ">=1.0.6 <2",
|
|
97
97
|
"@deepseek-ai/cordis-plugin-loader": ">=1.0.2 <2",
|
|
98
|
-
"@deepseek-ai/dsh-agent": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
99
|
-
"@deepseek-ai/dsh-agent-presets": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
100
|
-
"@deepseek-ai/dsh-client-locale": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
101
|
-
"@deepseek-ai/dsh-client-store": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
102
|
-
"@deepseek-ai/dsh-client-ui-primitives": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
103
|
-
"@deepseek-ai/dsh-client-ui-session": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
104
|
-
"@deepseek-ai/dsh-client-ui-settings": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
105
|
-
"@deepseek-ai/dsh-client-ui-slots": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
106
|
-
"@deepseek-ai/dsh-client-ui-workspace": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
107
|
-
"@deepseek-ai/dsh-command-compact": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
108
|
-
"@deepseek-ai/dsh-compaction": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
109
|
-
"@deepseek-ai/dsh-compaction-basic": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
110
|
-
"@deepseek-ai/dsh-invariants": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
111
|
-
"@deepseek-ai/dsh-llm": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
112
|
-
"@deepseek-ai/dsh-session": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
113
|
-
"@deepseek-ai/dsh-settings": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
114
|
-
"@deepseek-ai/dsh-system-prompt": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
115
|
-
"@deepseek-ai/dsh-token-meter": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
116
|
-
"@deepseek-ai/dsh-tools": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4",
|
|
98
|
+
"@deepseek-ai/dsh-agent": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
99
|
+
"@deepseek-ai/dsh-agent-presets": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
100
|
+
"@deepseek-ai/dsh-client-locale": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
101
|
+
"@deepseek-ai/dsh-client-store": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
102
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
103
|
+
"@deepseek-ai/dsh-client-ui-session": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
104
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
105
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
106
|
+
"@deepseek-ai/dsh-client-ui-workspace": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
107
|
+
"@deepseek-ai/dsh-command-compact": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
108
|
+
"@deepseek-ai/dsh-compaction": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
109
|
+
"@deepseek-ai/dsh-compaction-basic": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
110
|
+
"@deepseek-ai/dsh-invariants": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
111
|
+
"@deepseek-ai/dsh-llm": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
112
|
+
"@deepseek-ai/dsh-session": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
113
|
+
"@deepseek-ai/dsh-settings": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
114
|
+
"@deepseek-ai/dsh-system-prompt": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
115
|
+
"@deepseek-ai/dsh-token-meter": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
116
|
+
"@deepseek-ai/dsh-tools": "0.1.0-rc.2 || 0.1.0-rc.3 || 0.1.0-rc.6 || 0.1.0-rc.7 || 0.1.0-rc.8 || 0.1.1-rc.1 || 0.1.1-rc.2 || 0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5 || 0.2.2-rc.1",
|
|
117
117
|
"react": ">=18 <19"
|
|
118
118
|
},
|
|
119
119
|
"peerDependenciesMeta": {
|