dsh-context-compression-improved 0.10.5 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/CHANGELOG.zh.md +9 -0
  3. package/README.de.md +1 -1
  4. package/assets/dshfind-card.svg +33 -0
  5. package/docs/shallow-teaching-preset-template.md +46 -0
  6. package/package.json +6 -6
  7. package/packages/selector/dsh.plugin.json +2 -2
  8. package/packages/selector/lib/client.d.ts +8 -0
  9. package/packages/selector/lib/client.js +212 -3
  10. package/packages/selector/lib/index.js +1 -1
  11. package/packages/selector/lib/profiles.d.ts +34 -0
  12. package/packages/selector/lib/pruner.d.ts +55 -0
  13. package/packages/selector/lib/pruner.js +1925 -303
  14. package/packages/selector/lib/savings-integral.js +126 -3
  15. package/packages/selector/lib/tool-result.js +9 -1
  16. package/packages/selector/package.json +21 -21
  17. package/packages/selector/src/client/CompressionProfileControls.tsx +33 -0
  18. package/packages/selector/src/client/CompressionProfileSelector.tsx +2 -0
  19. package/packages/selector/src/client/decode.ts +5 -1
  20. package/packages/selector/src/client/index.ts +4 -0
  21. package/packages/selector/src/client/locales/de.ts +7 -0
  22. package/packages/selector/src/client/locales/es.ts +7 -0
  23. package/packages/selector/src/client/locales/fr.ts +7 -0
  24. package/packages/selector/src/client/locales/it.ts +7 -0
  25. package/packages/selector/src/client/locales/ja.ts +7 -0
  26. package/packages/selector/src/client/locales/ko.ts +7 -0
  27. package/packages/selector/src/client/locales/ru.ts +7 -0
  28. package/packages/selector/src/client/locales.ts +14 -0
  29. package/packages/selector/src/client/monitor-fab.ts +14 -0
  30. package/packages/selector/src/client/settings-section.tsx +9 -2
  31. package/packages/selector/src/profiles.ts +103 -0
  32. package/packages/selector/src/pruner.ts +310 -4
  33. package/packages/selector/src/runtime/audit.ts +1 -0
  34. package/packages/selector/src/runtime/config.ts +88 -1
  35. package/packages/selector/src/runtime/fold-router.ts +143 -0
  36. package/packages/selector/src/runtime/monitor.ts +31 -0
  37. package/packages/selector/src/runtime/reducers.ts +1 -1
  38. package/packages/selector/src/runtime/sediment-card.ts +126 -0
  39. package/packages/selector/src/runtime/sediment-clock.ts +87 -0
  40. package/packages/selector/src/runtime/sediment-guard.ts +136 -0
  41. package/packages/selector/src/runtime/sediment-publish.ts +144 -0
  42. package/packages/selector/src/runtime/sediment-span.ts +170 -0
  43. package/packages/selector/src/runtime/sediment.ts +209 -0
  44. package/packages/selector/src/runtime/shallow-tools.ts +342 -0
  45. package/packages/selector/src/runtime/tool-names.ts +6 -0
  46. package/packages/selector/src/runtime/triage/masks.ts +128 -0
  47. package/packages/selector/src/runtime/triage/shallow.ts +132 -0
  48. package/packages/selector/src/runtime/triage/signals.ts +167 -0
  49. package/packages/selector/src/runtime/triage/types.ts +125 -0
  50. package/packages/selector/src/runtime/types.ts +28 -0
  51. package/packages/selector/tests/fixtures/sediment-pool/52adc205-cloud-5.orig.txt +231 -0
  52. package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-cloud-25.orig.txt +236 -0
  53. package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-cloud-38.orig.txt +220 -0
  54. package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-cloud-42.orig.txt +140 -0
  55. package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-cloud-53.orig.txt +117 -0
  56. package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-local-10.orig.txt +67 -0
  57. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-45.orig.txt +119 -0
  58. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-49.orig.txt +119 -0
  59. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-63.orig.txt +131 -0
  60. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-75.orig.txt +196 -0
  61. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-76.orig.txt +71 -0
  62. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-85.orig.txt +126 -0
  63. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-86.orig.txt +86 -0
  64. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-87.orig.txt +50 -0
  65. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-96.orig.txt +102 -0
  66. package/packages/selector/tests/public/package-contract.client.spec.ts +7 -4
  67. package/packages/selector/tests/runtime/fold-router.spec.ts +140 -0
  68. package/packages/selector/tests/runtime/sediment-card.spec.ts +111 -0
  69. package/packages/selector/tests/runtime/sediment-config.spec.ts +56 -0
  70. package/packages/selector/tests/runtime/sediment-guard.spec.ts +71 -0
  71. package/packages/selector/tests/runtime/sediment-masks.spec.ts +95 -0
  72. package/packages/selector/tests/runtime/sediment-orchestrator.spec.ts +166 -0
  73. package/packages/selector/tests/runtime/sediment-pool-share.spec.ts +65 -0
  74. package/packages/selector/tests/runtime/sediment-publish.spec.ts +142 -0
  75. package/packages/selector/tests/runtime/sediment-real-shapes.spec.ts +158 -0
  76. package/packages/selector/tests/runtime/sediment-settings.spec.ts +73 -0
  77. package/packages/selector/tests/runtime/sediment-signals.spec.ts +124 -0
  78. package/packages/selector/tests/runtime/sediment-span.spec.ts +92 -0
  79. package/packages/selector/tests/runtime/shallow-primitives.spec.ts +135 -0
  80. package/packages/selector/tests/settings-seat.client.spec.ts +1 -1
  81. package/scripts/hosts.d.mts +3 -0
  82. package/scripts/hosts.mjs +3 -1
  83. package/scripts/sediment-latency-report.mjs +63 -0
  84. package/scripts/verify-release.mjs +7 -2
  85. package/$null +0 -1
@@ -74,6 +74,96 @@ window.__ModuleLoader__.load({
74
74
  trigger: 7e5
75
75
  }
76
76
  };
77
+ /** Off-defaults mirrored browser-safe from the runtime sediment section. */
78
+ const DEFAULT_SEDIMENT_SETTINGS = {
79
+ enabled: false,
80
+ granularity: "turn",
81
+ minClosingTokens: 120,
82
+ rewriteGuardRatio: 3,
83
+ maxTurnSpanTokens: 32e3
84
+ };
85
+ /**
86
+ * Browser-safe mirror of the runtime sediment section (absent inherits the off
87
+ * defaults). Strict like the other gates: unknown keys, wrong types, or an
88
+ * unparseable extra pattern invalidate the whole section — never coerced.
89
+ */
90
+ function decodeSedimentSettings(value) {
91
+ if (value === void 0) return { ...DEFAULT_SEDIMENT_SETTINGS };
92
+ if (!isPlainRecord(value)) return void 0;
93
+ const allowed = /* @__PURE__ */ new Set([
94
+ "enabled",
95
+ "granularity",
96
+ "minClosingTokens",
97
+ "rewriteGuardRatio",
98
+ "maxTurnSpanTokens",
99
+ "extraSignalPatterns",
100
+ "foldMode",
101
+ "foldBaseUrl",
102
+ "foldBaseUrlKey",
103
+ "foldStrataProvider",
104
+ "foldStrataModel",
105
+ "foldLocal35Provider",
106
+ "foldLocal35Model"
107
+ ]);
108
+ if (Object.keys(value).some((key) => !allowed.has(key))) return void 0;
109
+ if (value.enabled !== void 0 && typeof value.enabled !== "boolean") return void 0;
110
+ if (value.granularity !== void 0 && value.granularity !== "turn" && value.granularity !== "span") return void 0;
111
+ if (value.foldMode !== void 0 && value.foldMode !== "" && value.foldMode !== "host" && value.foldMode !== "direct") return void 0;
112
+ for (const key of [
113
+ "foldBaseUrl",
114
+ "foldBaseUrlKey",
115
+ "foldStrataProvider",
116
+ "foldStrataModel",
117
+ "foldLocal35Provider",
118
+ "foldLocal35Model"
119
+ ]) if (value[key] !== void 0 && typeof value[key] !== "string") return void 0;
120
+ const bounded = [
121
+ [
122
+ value.minClosingTokens,
123
+ 40,
124
+ 2e3
125
+ ],
126
+ [
127
+ value.rewriteGuardRatio,
128
+ 1,
129
+ 10
130
+ ],
131
+ [
132
+ value.maxTurnSpanTokens,
133
+ 4e3,
134
+ 64e3
135
+ ]
136
+ ];
137
+ for (const [entry, min, max] of bounded) if (entry !== void 0 && (typeof entry !== "number" || !Number.isSafeInteger(entry) || entry < min || entry > max)) return void 0;
138
+ if (value.extraSignalPatterns !== void 0) {
139
+ if (!Array.isArray(value.extraSignalPatterns) || value.extraSignalPatterns.some((entry) => typeof entry !== "string" || !isSafeSignalPattern(entry))) return void 0;
140
+ }
141
+ return {
142
+ enabled: value.enabled ?? DEFAULT_SEDIMENT_SETTINGS.enabled,
143
+ granularity: value.granularity ?? DEFAULT_SEDIMENT_SETTINGS.granularity,
144
+ minClosingTokens: value.minClosingTokens ?? DEFAULT_SEDIMENT_SETTINGS.minClosingTokens,
145
+ rewriteGuardRatio: value.rewriteGuardRatio ?? DEFAULT_SEDIMENT_SETTINGS.rewriteGuardRatio,
146
+ maxTurnSpanTokens: value.maxTurnSpanTokens ?? DEFAULT_SEDIMENT_SETTINGS.maxTurnSpanTokens,
147
+ ...value.extraSignalPatterns === void 0 ? {} : { extraSignalPatterns: [...value.extraSignalPatterns] },
148
+ ...value.foldMode === void 0 ? {} : { foldMode: value.foldMode },
149
+ ...value.foldBaseUrl === void 0 ? {} : { foldBaseUrl: value.foldBaseUrl },
150
+ ...value.foldBaseUrlKey === void 0 ? {} : { foldBaseUrlKey: value.foldBaseUrlKey },
151
+ ...value.foldStrataProvider === void 0 ? {} : { foldStrataProvider: value.foldStrataProvider },
152
+ ...value.foldStrataModel === void 0 ? {} : { foldStrataModel: value.foldStrataModel },
153
+ ...value.foldLocal35Provider === void 0 ? {} : { foldLocal35Provider: value.foldLocal35Provider },
154
+ ...value.foldLocal35Model === void 0 ? {} : { foldLocal35Model: value.foldLocal35Model }
155
+ };
156
+ }
157
+ /** Accept only parseable, length-bounded patterns; caps keep one scan linear. */
158
+ function isSafeSignalPattern(entry) {
159
+ if (entry.length === 0 || entry.length > 200) return false;
160
+ try {
161
+ new RegExp(entry);
162
+ return true;
163
+ } catch {
164
+ return false;
165
+ }
166
+ }
77
167
  /**
78
168
  * Decode the persisted codeSkeleton section with exactly the runtime schema's
79
169
  * strictness: absent means the lossless off default; present values must be a
@@ -873,6 +963,45 @@ window.__ModuleLoader__.load({
873
963
  ]
874
964
  });
875
965
  }
966
+ /**
967
+ * Turn-tail sedimentation gate (plan cci-sedimentation-triage T3.7): on/off
968
+ * select with the display-impact disclosure in its description (M13) —
969
+ * replaced spans leave the transcript view; originals stay in the log.
970
+ */
971
+ function SedimentControls({ value, disabled, save, settle, t }) {
972
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
973
+ className: _dsh_context_compression_css_466eb745356d_CompressionProfileSelector_module_css_default.autoCompact,
974
+ "aria-labelledby": "context-compression-sediment-title",
975
+ children: [
976
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
977
+ id: "context-compression-sediment-title",
978
+ className: _dsh_context_compression_css_466eb745356d_CompressionProfileSelector_module_css_default.autoCompactTitle,
979
+ children: t("sediment.title")
980
+ }),
981
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
982
+ className: _dsh_context_compression_css_466eb745356d_CompressionProfileSelector_module_css_default.customNote,
983
+ children: t("sediment.description")
984
+ }),
985
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
986
+ className: _dsh_context_compression_css_466eb745356d_CompressionProfileSelector_module_css_default.field,
987
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("sediment.enabled") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
988
+ value: value ? "on" : "off",
989
+ disabled,
990
+ onChange: (event) => {
991
+ settle(() => save(event.currentTarget.value === "on"));
992
+ },
993
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
994
+ value: "on",
995
+ children: t("sediment.enabled.on")
996
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
997
+ value: "off",
998
+ children: t("sediment.enabled.off")
999
+ })]
1000
+ })]
1001
+ })
1002
+ ]
1003
+ });
1004
+ }
876
1005
  //#endregion
877
1006
  //#region src/client/EstimatorControls.tsx
878
1007
  /**
@@ -1448,7 +1577,7 @@ window.__ModuleLoader__.load({
1448
1577
  function ContextCompressionSettingsSection(props) {
1449
1578
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingsCompressionProfileControls, { ...props });
1450
1579
  }
1451
- function SettingsCompressionProfileControls({ useCompression, select, saveCustom, resetCustom, savePtcCustom, resetPtcCustom, saveAutoCompact, saveCodeSkeleton, saveIntentSummary, saveMonitorPanel, savePresetOptions, t }) {
1580
+ function SettingsCompressionProfileControls({ useCompression, select, saveCustom, resetCustom, savePtcCustom, resetPtcCustom, saveAutoCompact, saveCodeSkeleton, saveSediment, saveIntentSummary, saveMonitorPanel, savePresetOptions, t }) {
1452
1581
  const state = useCompression((snapshot) => snapshot);
1453
1582
  const [saving, setSaving] = (0, react.useState)(false);
1454
1583
  const [saveError, setSaveError] = (0, react.useState)(null);
@@ -1540,6 +1669,13 @@ window.__ModuleLoader__.load({
1540
1669
  settle,
1541
1670
  t
1542
1671
  }),
1672
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SedimentControls, {
1673
+ value: state.value?.sediment?.enabled ?? false,
1674
+ disabled: busy || !state.writable || false,
1675
+ save: saveSediment,
1676
+ settle,
1677
+ t
1678
+ }),
1543
1679
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IntentSummaryControls, {
1544
1680
  value: state.value?.intentSummary?.enabled ?? false,
1545
1681
  disabled: busy || !state.writable || false,
@@ -1610,7 +1746,7 @@ window.__ModuleLoader__.load({
1610
1746
  */
1611
1747
  function decodeSettings(value) {
1612
1748
  if (!isPlainRecord(value)) return void 0;
1613
- if (Object.keys(value).some((key) => key !== "profile" && key !== "custom" && key !== "ptcCustom" && key !== "autoCompact" && key !== "codeSkeleton" && key !== "intentSummary" && key !== "monitorPanel" && key !== "presetOptions")) return;
1749
+ if (Object.keys(value).some((key) => key !== "profile" && key !== "custom" && key !== "ptcCustom" && key !== "autoCompact" && key !== "codeSkeleton" && key !== "intentSummary" && key !== "monitorPanel" && key !== "sediment" && key !== "presetOptions")) return;
1614
1750
  const profile = value.profile;
1615
1751
  const custom = value.custom;
1616
1752
  const ptcCustomRaw = value.ptcCustom;
@@ -1619,8 +1755,9 @@ window.__ModuleLoader__.load({
1619
1755
  const codeSkeleton = decodeCodeSkeletonSettings(value.codeSkeleton);
1620
1756
  const intentSummary = decodeIntentSummarySettings(value.intentSummary);
1621
1757
  const monitorPanel = decodeMonitorPanelSettings(value.monitorPanel);
1758
+ const sediment = decodeSedimentSettings(value.sediment);
1622
1759
  const presetOptions = decodePresetOptionsSettings(value.presetOptions);
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 ? {
1760
+ 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 && sediment !== void 0 ? {
1624
1761
  profile,
1625
1762
  custom: canonicalizeCustomPolicy(custom),
1626
1763
  ptcCustom,
@@ -1628,6 +1765,7 @@ window.__ModuleLoader__.load({
1628
1765
  codeSkeleton,
1629
1766
  intentSummary,
1630
1767
  ...monitorPanel === void 0 ? {} : { monitorPanel },
1768
+ sediment,
1631
1769
  ...presetOptions === void 0 ? {} : { presetOptions }
1632
1770
  } : void 0;
1633
1771
  }
@@ -1771,6 +1909,7 @@ window.__ModuleLoader__.load({
1771
1909
  <button data-overon>${t("monitor.panel.resume")}</button>
1772
1910
  <button data-overoff class="ghost">${t("monitor.panel.disable")}</button></div>
1773
1911
  <div class="row muted" data-fold style="display:none"></div>
1912
+ <div class="row muted" data-sediment style="display:none"></div>
1774
1913
  <div class="stale" data-stale>${t("monitor.panel.stale")}</div>
1775
1914
  <div data-compwrap style="display:none">
1776
1915
  <div class="row"><span class="label">${t("monitor.panel.composition")}</span></div>
@@ -1967,6 +2106,12 @@ window.__ModuleLoader__.load({
1967
2106
  foldEl.style.display = "";
1968
2107
  foldEl.textContent = `${t("monitor.panel.lastFold")} turn ${String(fold.turn ?? "–")}, seq ${String(fold.startSeq ?? "–")}..${String(fold.endSeq ?? "–")}`;
1969
2108
  } else foldEl.style.display = "none";
2109
+ const sediment = snap.sediment;
2110
+ const sedimentEl = panel.querySelector("[data-sediment]");
2111
+ if (sediment !== void 0 && sediment !== null && typeof sediment === "object") {
2112
+ sedimentEl.style.display = "";
2113
+ sedimentEl.textContent = sediment.conservative === true ? `${t("monitor.panel.sedimentConservative")} (${String(sediment.reason ?? "–")})` : `${t("monitor.panel.sedimentCuts")} ${String(sediment.cuts ?? 0)}`;
2114
+ } else sedimentEl.style.display = "none";
1970
2115
  const recent = Array.isArray(snap.recentOffsets) ? snap.recentOffsets.slice(0, 3) : [];
1971
2116
  const recentEl = panel.querySelector("[data-recent]");
1972
2117
  recentEl.style.display = recent.length === 0 ? "none" : "";
@@ -2090,6 +2235,11 @@ window.__ModuleLoader__.load({
2090
2235
  "codeSkeleton.enabled": "代码骨架压缩",
2091
2236
  "codeSkeleton.enabled.on": "开",
2092
2237
  "codeSkeleton.enabled.off": "关(默认)",
2238
+ "sediment.title": "轮尾沉降(实验)",
2239
+ "sediment.description": "开启后,每个正常收尾的回合结束时,该轮的工具调用区间会被一张沉降卡(错误原文逐字摘录 + 文件清单/代码骨架 + 省略统计)持久替换,压低窗口占用、推迟官方大压缩。注意:被替换的原消息将从对话视图撤出(原文仍在会话日志,可按卡片里的序号用回捞工具找回);仅对新观察会话生效。",
2240
+ "sediment.enabled": "轮尾沉降",
2241
+ "sediment.enabled.on": "开",
2242
+ "sediment.enabled.off": "关(默认)",
2093
2243
  "intentSummary.title": "回合末意图摘要(转向尾部压缩)",
2094
2244
  "intentSummary.description": "开启后,回合收尾阶段把本次消费的增量按语义角色折叠为意图摘要块:读类工具结果压成单行目标/规模记录,写类保留骨架头与逐字错误行,于下一次压力回合经既有折叠管线落地;仅当增长门控通过(活跃表面 >45% 且距上次折叠增长 >50K token)才触发。修改只影响新会话;当前会话可用 /ctx-summary off|on|status 临时覆盖。",
2095
2245
  "intentSummary.enabled": "回合末意图摘要",
@@ -2121,6 +2271,8 @@ window.__ModuleLoader__.load({
2121
2271
  "monitor.panel.stateOff": "关",
2122
2272
  "monitor.panel.gateUnknown": "未评估",
2123
2273
  "monitor.panel.lastFold": "最近折叠",
2274
+ "monitor.panel.sedimentCuts": "沉降刀数",
2275
+ "monitor.panel.sedimentConservative": "沉降:保守模式(净节省负反馈)",
2124
2276
  "monitor.panel.stale": "快照不可达——显示上次数据",
2125
2277
  "monitorPanel.title": "压缩监控悬浮面板",
2126
2278
  "monitorPanel.description": "开启后,输入区旁出现可拖拽的悬浮球,点开即监控当前压缩状态:净节省(精确口径)、缓存命中率、成本估算、回合末意图摘要门控与最近抵消;面板内可临时覆盖当前会话的意图摘要开关。统计经 SQLite 持久化,跨宿主重启保留。",
@@ -2247,6 +2399,11 @@ window.__ModuleLoader__.load({
2247
2399
  "codeSkeleton.enabled": "Code skeleton compression",
2248
2400
  "codeSkeleton.enabled.on": "On",
2249
2401
  "codeSkeleton.enabled.off": "Off (default)",
2402
+ "sediment.title": "Turn-tail sedimentation (experimental)",
2403
+ "sediment.description": "When on, each completed turn replaces its tool-call span with one durable sediment card (verbatim error lines + file manifests / code skeletons + omission stats), shrinking the live window and deferring the official compaction. Note: replaced messages leave the transcript view (originals stay in the session log and can be retrieved by the card's sequence numbers); applies to newly observed sessions only.",
2404
+ "sediment.enabled": "Turn-tail sedimentation",
2405
+ "sediment.enabled.on": "On",
2406
+ "sediment.enabled.off": "Off (default)",
2250
2407
  "intentSummary.title": "Turn-tail intent summary",
2251
2408
  "intentSummary.description": "When on, the turn-boundary postflight folds the consumed increment into intent-summary blocks by semantic role: read-class tool results become one-line target/scale records and write-class keep skeleton heads plus verbatim error lines, landing on the next pressure round through the ordinary fold pipeline. Only fires when the growth gate passes (live surface >45% and >50K tokens grown since the last fold). Applies to new sessions; override the current one with /ctx-summary off|on|status.",
2252
2409
  "intentSummary.enabled": "Turn-tail intent summary",
@@ -2278,6 +2435,8 @@ window.__ModuleLoader__.load({
2278
2435
  "monitor.panel.stateOff": "off",
2279
2436
  "monitor.panel.gateUnknown": "not evaluated yet",
2280
2437
  "monitor.panel.lastFold": "Last fold",
2438
+ "monitor.panel.sedimentCuts": "Sediment cuts",
2439
+ "monitor.panel.sedimentConservative": "Sediment: conservative mode (net-savings feedback)",
2281
2440
  "monitor.panel.stale": "Snapshot unreachable — showing last data",
2282
2441
  "monitorPanel.title": "Compression monitor panel",
2283
2442
  "monitorPanel.description": "When on, a draggable floating bubble appears next to the input area — open it to watch live compression state: net savings (exact basis), cache hit rate, cost estimate, the turn-tail intent-summary gate and recent offsets. The panel can temporarily override the current session's intent-summary switch. Stats persist in SQLite and survive host restarts.",
@@ -2406,6 +2565,11 @@ window.__ModuleLoader__.load({
2406
2565
  "codeSkeleton.enabled": "Code-Skelettkomprimierung",
2407
2566
  "codeSkeleton.enabled.on": "Ein",
2408
2567
  "codeSkeleton.enabled.off": "Aus (Standard)",
2568
+ "sediment.title": "Wendelsenkung (experimentell)",
2569
+ "sediment.description": "Wenn aktiv, ersetzt jeder abgeschlossene Turn sein Tool-Call-Fenster durch eine dauerhafte Sedimentkarte (Fehlerzeilen wörtlich + Dateilisten/Code-Skelette + Auslassungsstatistik), verkleinert das Fenstervolumen und verschiebt die offizielle Komprimierung. Hinweis: ersetzte Meldungen verschwinden aus der Transkript-Ansicht (Originale bleiben im Sitzungsprotokoll und sind über die Sequenznummern der Karte wiederholbar); gilt nur für neu beobachtete Sitzungen.",
2570
+ "sediment.enabled": "Wendelsenkung",
2571
+ "sediment.enabled.on": "Ein",
2572
+ "sediment.enabled.off": "Aus (Standard)",
2409
2573
  "intentSummary.title": "Abschluss-Zusammenfassung (Turn-Tail)",
2410
2574
  "intentSummary.description": "Aktiviert faltet der Turn-Abschluss den verbrauchten Zuwachs nach semantischen Rollen zu Intent-Zusammenfassungsblöcken: Lese-Tool-Ergebnisse werden zu Einzeilern mit Ziel/Umfang, die Schreibklasse behält Skelettköpfe plus wörtliche Fehlerzeilen; die Landung erfolgt in der nächsten Druckrunde über die gewöhnliche Falt-Pipeline. Zündet nur, wenn die Wachstumsschwelle passiert ist (live Oberfläche >45 % und >50K Token seit der letzten Faltung). Gilt für neue Sitzungen; die aktuelle lässt sich mit /ctx-summary off|on|status übersteuern.",
2411
2575
  "intentSummary.enabled": "Abschluss-Zusammenfassung",
@@ -2437,6 +2601,8 @@ window.__ModuleLoader__.load({
2437
2601
  "monitor.panel.stateOff": "aus",
2438
2602
  "monitor.panel.gateUnknown": "noch nicht bewertet",
2439
2603
  "monitor.panel.lastFold": "Letzte Faltung",
2604
+ "monitor.panel.sedimentCuts": "Sediment-Schnitte",
2605
+ "monitor.panel.sedimentConservative": "Sediment: konservativer Modus (Netto-Spar-Rückkopplung)",
2440
2606
  "monitor.panel.stale": "Snapshot nicht erreichbar — letzte Daten",
2441
2607
  "monitorPanel.title": "Komprimierungs-Monitorpanel",
2442
2608
  "monitorPanel.description": "Aktiviert erscheint neben dem Eingabebereich eine ziehbare Schwebekugel — öffne sie, um den Live-Komprimierungszustand zu beobachten: Nettoeinsparung (exakte Basis), Cache-Trefferquote, Kostenschätzung, das Turn-Tail-Gate und letzte Ausgleiche. Das Panel kann den Intent-Zusammenfassungsschalter der aktuellen Sitzung temporär übersteuern. Statistiken werden in SQLite persistiert und überstehen Host-Neustarts.",
@@ -2565,6 +2731,11 @@ window.__ModuleLoader__.load({
2565
2731
  "codeSkeleton.enabled": "Compresión de esqueleto del código",
2566
2732
  "codeSkeleton.enabled.on": "Activado",
2567
2733
  "codeSkeleton.enabled.off": "Desactivado (predeterminado)",
2734
+ "sediment.title": "Sedimentación de fin de turno (experimental)",
2735
+ "sediment.description": "Si se activa, cada turno completado sustituye su rango de llamadas a herramientas por una tarjeta de sedimentación persistente (líneas de error literales + listas de archivos/esqueletos de código + estadísticas de omisión), reduciendo la ventana y posponiendo la compactación oficial. Nota: los mensajes sustituidos salen de la vista del transcript (los originales quedan en el registro de sesión y se recuperan por los números de secuencia de la tarjeta); solo afecta a sesiones nuevas.",
2736
+ "sediment.enabled": "Sedimentación de fin de turno",
2737
+ "sediment.enabled.on": "Activado",
2738
+ "sediment.enabled.off": "Desactivado (predeterminado)",
2568
2739
  "intentSummary.title": "Resumen de intención al cierre del turno",
2569
2740
  "intentSummary.description": "Al activarlo, el postflight de cierre de turno pliega el incremento consumido en bloques de resumen de intención por rol semántico: los resultados de herramientas de lectura se convierten en registros de una línea con objetivo/escala y los de escritura conservan la cabecera de esqueleto más las líneas de error textuales; aterriza en la siguiente ronda de presión por el conducto de plegado normal. Solo se dispara si se supera la puerta de crecimiento (superficie activa >45 % y >50K tokens desde el último plegado). Aplica a sesiones nuevas; la actual se gobierna con /ctx-summary off|on|status.",
2570
2741
  "intentSummary.enabled": "Resumen de intención al cierre",
@@ -2596,6 +2767,8 @@ window.__ModuleLoader__.load({
2596
2767
  "monitor.panel.stateOff": "no",
2597
2768
  "monitor.panel.gateUnknown": "aún sin evaluar",
2598
2769
  "monitor.panel.lastFold": "Último plegado",
2770
+ "monitor.panel.sedimentCuts": "Cortes de sedimento",
2771
+ "monitor.panel.sedimentConservative": "Sedimento: modo conservador (retroalimentación de ahorro neto)",
2599
2772
  "monitor.panel.stale": "Instantánea inalcanzable — se muestran los últimos datos",
2600
2773
  "monitorPanel.title": "Panel de monitor de compresión",
2601
2774
  "monitorPanel.description": "Al activarlo, junto al área de entrada aparece una burbuja flotante arrastrable — ábrela para observar el estado de compresión en vivo: ahorro neto (base exacta), tasa de acierto de caché, estimación de coste, la puerta de resumen de intención del turno y compensaciones recientes. El panel puede invalidar temporalmente el interruptor de resumen de intención de la sesión actual. Las estadísticas se persisten en SQLite y sobreviven al reinicio del host.",
@@ -2724,6 +2897,11 @@ window.__ModuleLoader__.load({
2724
2897
  "codeSkeleton.enabled": "Compression du code en squelette",
2725
2898
  "codeSkeleton.enabled.on": "Activé",
2726
2899
  "codeSkeleton.enabled.off": "Désactivé (par défaut)",
2900
+ "sediment.title": "Sédimentation de fin de tour (expérimental)",
2901
+ "sediment.description": "Si activé, chaque tour terminé remplace sa plage d'appels d'outils par une carte de sédimentation durable (lignes d'erreur littérales + listes de fichiers/squelettes de code + statistiques d'omission), réduisant la fenêtre et repoussant la compaction officielle. Note : les messages remplacés quittent la vue du transcript (les originaux restent dans le journal de session et sont récupérables via les numéros de séquence de la carte) ; ne s'applique qu'aux nouvelles sessions.",
2902
+ "sediment.enabled": "Sédimentation de fin de tour",
2903
+ "sediment.enabled.on": "Activé",
2904
+ "sediment.enabled.off": "Désactivé (par défaut)",
2727
2905
  "intentSummary.title": "Résumé d'intention en fin de tour",
2728
2906
  "intentSummary.description": "Activé, le postflight de fin de tour plie l'incrément consommé en blocs de résumé d'intention par rôle sémantique : les résultats d'outils de lecture deviennent des enregistrements une-ligne objectif/échelle, les écrits gardent la tête de squelette plus les lignes d'erreur verbatim ; l'atterrissage se fait au prochain tour de pression via le pipeline de pliage habituel. Ne se déclenche que si la porte de croissance passe (surface active >45 % et >50K tokens depuis le dernier pliage). S'applique aux nouvelles sessions ; la session courante se pilote avec /ctx-summary off|on|status.",
2729
2907
  "intentSummary.enabled": "Résumé d'intention en fin de tour",
@@ -2755,6 +2933,8 @@ window.__ModuleLoader__.load({
2755
2933
  "monitor.panel.stateOff": "désactivé",
2756
2934
  "monitor.panel.gateUnknown": "pas encore évalué",
2757
2935
  "monitor.panel.lastFold": "Dernier pliage",
2936
+ "monitor.panel.sedimentCuts": "Coupes de sédimentation",
2937
+ "monitor.panel.sedimentConservative": "Sédimentation : mode conservateur (rétroaction sur économie nette)",
2758
2938
  "monitor.panel.stale": "Instantané injoignable — dernières données",
2759
2939
  "monitorPanel.title": "Panneau de monitorage de compression",
2760
2940
  "monitorPanel.description": "Activé, une bulle flottante déplaçable apparaît près de la zone de saisie — ouvrez-la pour observer l'état de compression en direct : économie nette (base exacte), taux de réussite du cache, estimation de coût, la porte de résumé d'intention du tour et les compensations récentes. Le panneau peut contourner temporairement l'interrupteur de résumé d'intention de la session courante. Les statistiques sont persistées en SQLite et survivent au redémarrage de l'hôte.",
@@ -2883,6 +3063,11 @@ window.__ModuleLoader__.load({
2883
3063
  "codeSkeleton.enabled": "Compressione a scheletro del codice",
2884
3064
  "codeSkeleton.enabled.on": "Attivato",
2885
3065
  "codeSkeleton.enabled.off": "Disattivato (predefinito)",
3066
+ "sediment.title": "Sedimentazione di fine turno (sperimentale)",
3067
+ "sediment.description": "Se attiva, ogni turno completato sostituisce il suo intervallo di chiamate tool con una carta di sedimentazione durevole (righe di errore letterali + elenchi file/scheletri di codice + statistiche di omissione), riducendo la finestra e rinviando la compattazione ufficiale. Nota: i messaggi sostituiti escono dalla vista del transcript (gli originali restano nel log di sessione e sono recuperabili tramite i numeri di sequenza della carta); vale solo per le nuove sessioni.",
3068
+ "sediment.enabled": "Sedimentazione di fine turno",
3069
+ "sediment.enabled.on": "Attiva",
3070
+ "sediment.enabled.off": "Disattiva (predefinito)",
2886
3071
  "intentSummary.title": "Riepilogo di intento a fine turno",
2887
3072
  "intentSummary.description": "Quando attivo, il postflight di fine turno piega l'incremento consumato in blocchi di riepilogo di intento per ruolo semantico: i risultati degli strumenti di lettura diventano record a riga singola obiettivo/scala, quelli di scrittura mantengono la testa dello scheletro più le righe di errore testuali; atterra al prossimo round di pressione tramite la pipeline di piegatura ordinaria. Si attiva solo se la soglia di crescita passa (superficie attiva >45% e >50K token dall'ultima piegatura). Vale per le nuove sessioni; quella corrente si governa con /ctx-summary off|on|status.",
2888
3073
  "intentSummary.enabled": "Riepilogo di intento a fine turno",
@@ -2914,6 +3099,8 @@ window.__ModuleLoader__.load({
2914
3099
  "monitor.panel.stateOff": "off",
2915
3100
  "monitor.panel.gateUnknown": "non ancora valutato",
2916
3101
  "monitor.panel.lastFold": "Ultima piegatura",
3102
+ "monitor.panel.sedimentCuts": "Tagli di sedimentazione",
3103
+ "monitor.panel.sedimentConservative": "Sedimentazione: modalità conservativa (feedback su risparmio netto)",
2917
3104
  "monitor.panel.stale": "Snapshot non raggiungibile — ultimi dati",
2918
3105
  "monitorPanel.title": "Pannello di monitoraggio compressione",
2919
3106
  "monitorPanel.description": "Quando attivo, accanto all'area di input appare una bolla flottante trascinabile — aprila per osservare lo stato di compressione in tempo reale: risparmio netto (base esatta), tasso di hit della cache, stima dei costi, la soglia del riepilogo di intento del turno e le compensazioni recenti. Il pannello può ignorare temporaneamente l'interruttore del riepilogo di intento della sessione corrente. Le statistiche sono persistite in SQLite e sopravvivono al riavvio dell'host.",
@@ -3042,6 +3229,11 @@ window.__ModuleLoader__.load({
3042
3229
  "codeSkeleton.enabled": "コードスケルトン圧縮",
3043
3230
  "codeSkeleton.enabled.on": "オン",
3044
3231
  "codeSkeleton.enabled.off": "オフ(既定)",
3232
+ "sediment.title": "ターン末尾沈降(実験的)",
3233
+ "sediment.description": "有効にすると、正常終了した各ターンでそのツール呼び出し区間が永続的な沈降カード(エラー原文の逐語引用 + ファイル一覧/コードスケルトン + 省略統計)に置き換わり、ウィンドウ占有を抑え公式圧縮を遅らせます。注意:置き換えられた元メッセージは会話ビューから消えます(原文はセッションログに残り、カード内の番号でリトリーバルツールにより復元可能)。新規セッションのみに適用。",
3234
+ "sediment.enabled": "ターン末尾沈降",
3235
+ "sediment.enabled.on": "オン",
3236
+ "sediment.enabled.off": "オフ(デフォルト)",
3045
3237
  "intentSummary.title": "ターン末尾インテント要約",
3046
3238
  "intentSummary.description": "有効にすると、ターン境界のポストフライトが消費済み増分を意味役割ごとにインテント要約ブロックへ折り畳みます。読み系ツール結果は目標/規模の 1 行レコードに、書き系は骨格ヘッダーと逐語エラー行を保持し、次の圧力ラウンドで通常の折り畳みパイプラインを通じて着地します。成長ゲート(ライブ表面 >45%、前回の折り畳みから >50K トークン増)を通過したときだけ発火します。変更は新セッションに適用され、現セッションは /ctx-summary off|on|status で上書きできます。",
3047
3239
  "intentSummary.enabled": "ターン末尾インテント要約",
@@ -3073,6 +3265,8 @@ window.__ModuleLoader__.load({
3073
3265
  "monitor.panel.stateOff": "オフ",
3074
3266
  "monitor.panel.gateUnknown": "未評価",
3075
3267
  "monitor.panel.lastFold": "最後の折り畳み",
3268
+ "monitor.panel.sedimentCuts": "沈降カット数",
3269
+ "monitor.panel.sedimentConservative": "沈降:保守モード(正味節約の負帰還)",
3076
3270
  "monitor.panel.stale": "スナップショット到達不能——前回データを表示",
3077
3271
  "monitorPanel.title": "圧縮モニター パネル",
3078
3272
  "monitorPanel.description": "有効にすると、入力欄のそばにドラッグできるフローティング バブルが現れます。開くとライブの圧縮状態を監視できます。正味節約(正確 basis)、キャッシュ ヒット率、コスト概算、ターン末尾インテント要約ゲート、最近の相殺。パネルから現セッションのインテント要約スイッチを一時的に上書きできます。統計は SQLite に永続化され、ホスト再起動後も保持されます。",
@@ -3201,6 +3395,11 @@ window.__ModuleLoader__.load({
3201
3395
  "codeSkeleton.enabled": "코드 스켈레톤 압축",
3202
3396
  "codeSkeleton.enabled.on": "켬",
3203
3397
  "codeSkeleton.enabled.off": "끔(기본값)",
3398
+ "sediment.title": "턴 끝 침전(실험)",
3399
+ "sediment.description": "켜면 완료된 각 턴에서 도구 호출 구간이 영구 침전 카드(오류 원문 그대로 + 파일 목록/코드 골격 + 생략 통계)로 교체되어 창 사용을 줄이고 공식 압축을 미룹니다. 주의: 교체된 원본 메시지는 대화 뷰에서 사라집니다(원문은 세션 로그에 남으며 카드의 순번으로 리트리브 도구로 복원 가능). 새로 관찰되는 세션에만 적용됩니다.",
3400
+ "sediment.enabled": "턴 끝 침전",
3401
+ "sediment.enabled.on": "켜기",
3402
+ "sediment.enabled.off": "끄기(기본)",
3204
3403
  "intentSummary.title": "턴 말머리 인텐트 요약",
3205
3404
  "intentSummary.description": "켜면 턴 경계 포스트플라이트가 소비된 증분을 의미 역할별 인텐트 요약 블록으로 접습니다. 읽기 도구 결과는 목표/규모 한 줄 레코드가 되고 쓰기는 골격 헤더와 원문 오류 줄을 유지하며, 다음 압력 라운드에서 기존 접기 파이프라인을 통해 착지합니다. 성장 게이트(라이브 표면 >45%, 마지막 접기 이후 >50K 토큰 증가)를 통과할 때만 발동합니다. 새 세션에 적용되며, 현재 세션은 /ctx-summary off|on|status 로 임시 전환할 수 있습니다.",
3206
3405
  "intentSummary.enabled": "턴 말머리 인텐트 요약",
@@ -3232,6 +3431,8 @@ window.__ModuleLoader__.load({
3232
3431
  "monitor.panel.stateOff": "끔",
3233
3432
  "monitor.panel.gateUnknown": "아직 평가 안 됨",
3234
3433
  "monitor.panel.lastFold": "마지막 접기",
3434
+ "monitor.panel.sedimentCuts": "침전 컷 수",
3435
+ "monitor.panel.sedimentConservative": "침전: 보수 모드(순 절약 피드백)",
3235
3436
  "monitor.panel.stale": "스냅샷 도달 불가——이전 데이터 표시",
3236
3437
  "monitorPanel.title": "압축 모니터 패널",
3237
3438
  "monitorPanel.description": "켜면 입력 영역 옆에 드래그 가능한 플로팅 버블이 나타납니다. 열면 라이브 압축 상태를 볼 수 있습니다. 순 절감(정확 기준), 캐시 적중률, 비용 추정, 턴 말머리 인텐트 요약 게이트, 최근 상쇄. 패널에서 현재 세션의 인텐트 요약 스위치를 임시로 전환할 수 있습니다. 통계는 SQLite에 영속화되어 호스트 재시작 후에도 유지됩니다.",
@@ -3360,6 +3561,11 @@ window.__ModuleLoader__.load({
3360
3561
  "codeSkeleton.enabled": "Скелетное сжатие кода",
3361
3562
  "codeSkeleton.enabled.on": "Вкл",
3362
3563
  "codeSkeleton.enabled.off": "Выкл (по умолчанию)",
3564
+ "sediment.title": "Оседание конца хода (экспериментально)",
3565
+ "sediment.description": "Если включено, каждый завершённый ход заменяет свой интервал вызовов инструментов устойчивой карточкой оседания (дословные строки ошибок + списки файлов/скелеты кода + статистика пропусков), уменьшая окно и откладывая официальную компактацию. Примечание: заменённые сообщения исчезают из представления транскрипта (оригиналы остаются в журнале сессии и восстанавливаются по номерам последовательности карточки); действует только на новые сессии.",
3566
+ "sediment.enabled": "Оседание конца хода",
3567
+ "sediment.enabled.on": "Вкл",
3568
+ "sediment.enabled.off": "Выкл (по умолчанию)",
3363
3569
  "intentSummary.title": "Итог намерения в конце хода",
3364
3570
  "intentSummary.description": "При включении постфлайт на границе хода сворачивает потреблённый прирост в блоки итогов намерения по семантическим ролям: результаты читающих инструментов становятся однострочными записями цель/масштаб, пишущие сохраняют заголовок скелета и дословные строки ошибок; приземляется в следующем раунде давления через обычный конвейер свёртки. Срабатывает только при прохождении шлюза роста (активная поверхность >45% и >50K токенов с последней свёртки). Действует на новые сессии; текущую можно переключить командой /ctx-summary off|on|status.",
3365
3571
  "intentSummary.enabled": "Итог намерения в конце хода",
@@ -3391,6 +3597,8 @@ window.__ModuleLoader__.load({
3391
3597
  "monitor.panel.stateOff": "выкл",
3392
3598
  "monitor.panel.gateUnknown": "ещё не оценено",
3393
3599
  "monitor.panel.lastFold": "Последняя свёртка",
3600
+ "monitor.panel.sedimentCuts": "Осадочных вырезов",
3601
+ "monitor.panel.sedimentConservative": "Оседание: консервативный режим (обратная связь по чистой экономии)",
3394
3602
  "monitor.panel.stale": "Снимок недоступен — показаны последние данные",
3395
3603
  "monitorPanel.title": "Панель мониторинга сжатия",
3396
3604
  "monitorPanel.description": "При включении рядом с областью ввода появляется перетаскиваемый плавающий шарик — откройте его, чтобы следить за состоянием сжатия в реальном времени: чистая экономия (точная база), процент попаданий кэша, оценка стоимости, шлюз итогов намерения хода и последние компенсации. Панель может временно переключить тумблер итогов намерения текущей сессии. Статистика персистентна в SQLite и переживает перезапуск хоста.",
@@ -3845,6 +4053,7 @@ window.__ModuleLoader__.load({
3845
4053
  resetPtcCustom: () => writeAndConfirm(() => scope.set("ptcCustom", structuredClone(DEFAULT_PTC_COMPRESSION_POLICY)), (settings) => isCustomCompressionPolicy(settings.ptcCustom) && sameCustomPolicy(settings.ptcCustom, DEFAULT_PTC_COMPRESSION_POLICY)),
3846
4054
  saveAutoCompact: (thresholdPercent) => writeAndConfirm(() => scope.set("autoCompact", { thresholdPercent }), (settings) => settings.autoCompact.thresholdPercent === thresholdPercent),
3847
4055
  saveCodeSkeleton: (enabled) => writeAndConfirm(() => scope.set("codeSkeleton", { enabled }), (settings) => settings.codeSkeleton.enabled === enabled),
4056
+ saveSediment: (enabled) => writeAndConfirm(() => scope.set("sediment", { enabled }), (settings) => settings.sediment?.enabled === enabled),
3848
4057
  saveIntentSummary: (enabled) => writeAndConfirm(() => scope.set("intentSummary", { enabled }), (settings) => settings.intentSummary.enabled === enabled),
3849
4058
  saveMonitorPanel: (enabled) => writeAndConfirm(() => scope.set("monitorPanel", { enabled }), (settings) => settings.monitorPanel?.enabled === enabled),
3850
4059
  savePresetOptions: (options) => {
@@ -1,4 +1,4 @@
1
- import { C as resolveStatsDshHome, Ct as getAdvisorState, Et as getSummaryOverride, G as ContextCompressionSettingsSchema, It as resolveOfficialDeepSeekPrice, Lt as getSavingsLedger, Mt as setSummaryOverride, S as statsPersistenceState, Tt as getObservedIntentEnabled, W as CONTEXT_COMPRESSION_SETTINGS_NAMESPACE, _t as isSessionOverrideAction, a as getStatsBackfillStatus, b as ensureStatsStore, bt as INTENT_GATE_FLOOR_FRACTION, c as pauseStatsBackfill, dt as decodeSessionLogBytes, ft as deepSeekV4TokenizerForModel, gt as estimateSavingsPricing, h as getStatsActiveSessionId, ht as drsTotalsFragment, i as discoverBackfillSessionLogs, l as resumeStatsBackfill, mt as buildMonitorSnapshot, p as flushPendingUsageNow, pt as applySessionOverride, q as DEFAULT_CONTEXT_COMPRESSION_SETTINGS, r as configureStatsBackfillTrigger, s as kickStatsBackfillOnRouteHit, t as estimateIntegralMoney, u as cancelPendingUsageFlushes, ut as unavailableTokenCount, vt as mergeCompositionByComponent, wt as getLastIntentFold, x as getStatsStore, xt as INTENT_GATE_GROWTH_TOKENS, y as closeStatsStore } from "./savings-integral.js";
1
+ import { C as resolveStatsDshHome, Dt as getSummaryOverride, Et as getObservedIntentEnabled, G as ContextCompressionSettingsSchema, Lt as resolveOfficialDeepSeekPrice, Nt as setSummaryOverride, Rt as getSavingsLedger, S as statsPersistenceState, St as INTENT_GATE_GROWTH_TOKENS, Tt as getLastIntentFold, W as CONTEXT_COMPRESSION_SETTINGS_NAMESPACE, _t as isSessionOverrideAction, a as getStatsBackfillStatus, b as ensureStatsStore, c as pauseStatsBackfill, dt as decodeSessionLogBytes, ft as deepSeekV4TokenizerForModel, gt as estimateSavingsPricing, h as getStatsActiveSessionId, ht as drsTotalsFragment, i as discoverBackfillSessionLogs, l as resumeStatsBackfill, mt as buildMonitorSnapshot, p as flushPendingUsageNow, pt as applySessionOverride, q as DEFAULT_CONTEXT_COMPRESSION_SETTINGS, r as configureStatsBackfillTrigger, s as kickStatsBackfillOnRouteHit, t as estimateIntegralMoney, u as cancelPendingUsageFlushes, ut as unavailableTokenCount, vt as mergeCompositionByComponent, wt as getAdvisorState, x as getStatsStore, xt as INTENT_GATE_FLOOR_FRACTION, y as closeStatsStore } from "./savings-integral.js";
2
2
  import { a as noteResolvedSettingsService, i as detectHostGeneration, r as compatLog } from "./tool-result.js";
3
3
  import z from "@deepseek-ai/schemastery";
4
4
  import { createHash } from "node:crypto";
@@ -79,6 +79,38 @@ interface IntentSummarySettings {
79
79
  interface MonitorPanelSettings {
80
80
  enabled: boolean;
81
81
  }
82
+ /**
83
+ * Orthogonal turn-tail sedimentation gate (plan cci-sedimentation-triage,
84
+ * R1/R13): whole-turn atomic replacement primary, span as the oversized-turn
85
+ * split and cache-strict fallback granularity. Default OFF; absent inherits
86
+ * the off defaults exactly like `monitorPanel`. Session-frozen like every
87
+ * selector setting: edits affect newly observed sessions only.
88
+ */
89
+ interface SedimentSettings {
90
+ enabled: boolean;
91
+ /** Replacement granularity; `span` also serves as the cache-strict fallback. */
92
+ granularity: 'turn' | 'span';
93
+ /** Closing-summary qualification floor (tokens); below it the three-tier narrative fallback engages (R13). */
94
+ minClosingTokens: number;
95
+ /** Rewrite guard: a cut must save at least tail-rewrite × ratio (community 1:15 evidence, findings F2). */
96
+ rewriteGuardRatio: number;
97
+ /** Upper bound for one whole-turn replacement span before it splits (oversized turns). */
98
+ maxTurnSpanTokens: number;
99
+ /**
100
+ * Append-only extra failure-signal patterns (R2 extension slot). Merging
101
+ * NEVER replaces the built-in base set; invalid regex entries reject the
102
+ * whole section (never silently dropped).
103
+ */
104
+ extraSignalPatterns?: string[];
105
+ /** Fold narrative channel (Phase 4); '' keeps narrative tier 2 inert. */
106
+ foldMode?: '' | 'host' | 'direct';
107
+ foldBaseUrl?: string;
108
+ foldBaseUrlKey?: string;
109
+ foldStrataProvider?: string;
110
+ foldStrataModel?: string;
111
+ foldLocal35Provider?: string;
112
+ foldLocal35Model?: string;
113
+ }
82
114
  /** Browser-safe mirror of the runtime presetOptions section. */
83
115
  interface PresetOptionsSettings {
84
116
  readonly dedupeToolResults?: boolean;
@@ -115,6 +147,8 @@ interface ContextCompressionSettings {
115
147
  intentSummary: IntentSummarySettings;
116
148
  /** Floating compression-monitor panel (FAB); absent inherits hidden. */
117
149
  monitorPanel?: MonitorPanelSettings;
150
+ /** Turn-tail sedimentation gate (plan cci-sedimentation-triage); absent inherits the off defaults. */
151
+ sediment?: SedimentSettings;
118
152
  /** Optional tokenpilot-inspired sub-capability overrides (presence-validated only). */
119
153
  presetOptions?: PresetOptionsSettings;
120
154
  }
@@ -147,6 +147,31 @@ interface IntentSummarySettings {
147
147
  interface MonitorPanelSettings {
148
148
  enabled: boolean;
149
149
  }
150
+ /**
151
+ * Turn-tail sedimentation gate (plan cci-sedimentation-triage). Whole-turn
152
+ * atomic replacement primary, span as oversized-turn split and cache-strict
153
+ * fallback. Default off; mirrored browser-side in profiles.ts.
154
+ */
155
+ interface SedimentSettings {
156
+ enabled: boolean;
157
+ granularity: 'turn' | 'span';
158
+ minClosingTokens: number;
159
+ rewriteGuardRatio: number;
160
+ maxTurnSpanTokens: number;
161
+ /** Append-only extra failure-signal patterns; never replaces the base set. */
162
+ extraSignalPatterns?: string[];
163
+ /** Fold narrative channel (Phase 4): '' keeps tier 2 inert. */
164
+ foldMode?: '' | 'host' | 'direct';
165
+ /** LAN fold endpoints share one OpenAI-compatible base URL (direct mode). */
166
+ foldBaseUrl?: string;
167
+ foldBaseUrlKey?: string;
168
+ /** Tier-1 endpoint (≤2K input): high hot-decode throughput. */
169
+ foldStrataProvider?: string;
170
+ foldStrataModel?: string;
171
+ /** Tier-2 endpoint (2~8K input): stable cold-prefill profile. */
172
+ foldLocal35Provider?: string;
173
+ foldLocal35Model?: string;
174
+ }
150
175
  /**
151
176
  * Persisted sub-capability overrides for the `tokenpilot-inspired` preset.
152
177
  * Absent fields inherit the preset defaults; the section is only meaningful
@@ -188,6 +213,8 @@ interface ContextCompressionSettings {
188
213
  autoCompact: AutoCompactSettings;
189
214
  /** Code-skeleton reducer gate snapped independently of `profile`. */
190
215
  codeSkeleton: CodeSkeletonSettings;
216
+ /** Turn-tail sedimentation gate; absent inherits the off defaults (optional section like `monitorPanel`). */
217
+ sediment?: SedimentSettings;
191
218
  /** Turn-tail intent-summary gate snapped independently of `profile`. */
192
219
  intentSummary: IntentSummarySettings;
193
220
  /** Floating compression-monitor panel (FAB); absent inherits hidden. */
@@ -831,6 +858,34 @@ declare class ToolResultPruner extends Service {
831
858
  */
832
859
  pruneSession(session: Session, options?: PruneSessionOptions): PruneResult;
833
860
  private activeSettings;
861
+ private readonly sedimentOrchestrators;
862
+ private readonly sedimentWatchers;
863
+ private readonly sedimentCuts;
864
+ private readonly ptcAgingMemo;
865
+ /**
866
+ * PTC aging short-circuit (T3.10): when an omnibus runner is registered and
867
+ * no direct write-family tool call is observed in the session, the regex
868
+ * superseded predicate is blind (writes fold into run_code bodies) — the
869
+ * rule-based aging branch is disabled for that session. Active only while
870
+ * the sediment gate is on: with default-off settings the existing readState
871
+ * behavior is byte-identical.
872
+ */
873
+ private ptcAgingBlocked;
874
+ /**
875
+ * Sedimentation entry (plan cci-sedimentation-triage T3.6): whole-turn
876
+ * replacement decided at `turn/end`, inside the quiet seam before the next
877
+ * request derives. Disabled sessions exit at the settings gate with zero
878
+ * downstream work; committed cards flush like any other surface write.
879
+ */
880
+ private sedimentTurnEnd;
881
+ private sedimentOrchestratorFor;
882
+ /**
883
+ * T4.8 pairing footer: when a read-class result supersedes a live shallow
884
+ * map of the same file, the reduced text carries the data-shaped reminder
885
+ * (sibling ref + discard hint). Non-read calls, unparseable arguments, and
886
+ * sessions without a live map all return undefined — zero side effects.
887
+ */
888
+ private shallowPairFooter;
834
889
  /**
835
890
  * TokenPilot-inspired A2: replace the compaction summary checkpoint node
836
891
  * with the same summary plus an Exact Sources locator block. Fails open: