dsh-context-compression-improved 0.9.3 → 0.9.7

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 (66) hide show
  1. package/README.de.md +3 -3
  2. package/README.es.md +3 -3
  3. package/README.fr.md +3 -3
  4. package/README.it.md +3 -3
  5. package/README.ja.md +16 -3
  6. package/README.ko.md +16 -3
  7. package/README.md +16 -3
  8. package/README.ru.md +3 -3
  9. package/README.zh.md +16 -3
  10. package/assets/board.png +0 -0
  11. package/assets/context.png +0 -0
  12. package/docs/installation.de.md +2 -2
  13. package/docs/installation.es.md +2 -2
  14. package/docs/installation.fr.md +2 -2
  15. package/docs/installation.it.md +2 -2
  16. package/docs/installation.ja.md +2 -2
  17. package/docs/installation.ko.md +2 -2
  18. package/docs/installation.md +2 -2
  19. package/docs/installation.ru.md +2 -2
  20. package/docs/installation.zh.md +2 -2
  21. package/package.json +7 -6
  22. package/packages/selector/dsh.plugin.json +2 -2
  23. package/packages/selector/lib/client.d.ts +1 -0
  24. package/packages/selector/lib/client.js +63 -10
  25. package/packages/selector/lib/config.js +71 -7
  26. package/packages/selector/lib/index.js +145 -20
  27. package/packages/selector/lib/pruner.d.ts +158 -107
  28. package/packages/selector/lib/pruner.js +332 -22
  29. package/packages/selector/lib/tail-trim.js +25 -2
  30. package/packages/selector/package.json +22 -21
  31. package/packages/selector/src/client/index.ts +29 -2
  32. package/packages/selector/src/client/locales/de.ts +1 -0
  33. package/packages/selector/src/client/locales/es.ts +1 -0
  34. package/packages/selector/src/client/locales/fr.ts +1 -0
  35. package/packages/selector/src/client/locales/it.ts +1 -0
  36. package/packages/selector/src/client/locales/ja.ts +1 -0
  37. package/packages/selector/src/client/locales/ko.ts +1 -0
  38. package/packages/selector/src/client/locales/ru.ts +1 -0
  39. package/packages/selector/src/client/locales.ts +2 -0
  40. package/packages/selector/src/client/monitor-fab.ts +19 -4
  41. package/packages/selector/src/compat/llm-messages.ts +50 -0
  42. package/packages/selector/src/index.ts +27 -0
  43. package/packages/selector/src/preset-overlay.ts +145 -22
  44. package/packages/selector/src/pruner/content.ts +1 -1
  45. package/packages/selector/src/pruner/state.ts +4 -0
  46. package/packages/selector/src/pruner.ts +109 -16
  47. package/packages/selector/src/runtime/config.ts +1 -1
  48. package/packages/selector/src/runtime/reducers.ts +81 -1
  49. package/packages/selector/src/runtime/retrieve.ts +4 -3
  50. package/packages/selector/src/runtime/savings-projection.ts +226 -0
  51. package/packages/selector/src/runtime/savings.ts +83 -3
  52. package/packages/selector/src/runtime/tail-trim.ts +2 -1
  53. package/packages/selector/tests/public/package-contract.client.spec.ts +4 -4
  54. package/packages/selector/tests/runtime/fresh-gate.spec.ts +43 -0
  55. package/packages/selector/tests/runtime/jsonl-reducer.spec.ts +79 -0
  56. package/packages/selector/tests/runtime/public/public-runtime.spec.ts +48 -0
  57. package/packages/selector/tests/runtime/savings-projection.spec.ts +89 -0
  58. package/packages/selector/tests/runtime/savings.spec.ts +22 -3
  59. package/packages/selector/tests/runtime/settings-unwrap.spec.ts +58 -0
  60. package/packages/selector/tests/runtime/tokenpilot/profile-baseline.spec.ts +5 -2
  61. package/pnpm-workspace.yaml +6 -0
  62. package/screenshots.json +6 -0
  63. package/scripts/hosts.mjs +5 -2
  64. package/scripts/packed-install-e2e.mjs +19 -3
  65. package/scripts/sync-hosts.mjs +2 -2
  66. package/scripts/verify-release.mjs +6 -6
@@ -1,9 +1,8 @@
1
- import { B as decimalRateNanoUnits, F as recordIntentFold, H as resolveOfficialDeepSeekPrice, I as recordRecertified, L as recordScore, M as getSummaryOverride, N as invalidateOnTaskChange, O as evaluateIntentGate, P as observeIntentEnabled, T as observeContextUsage, U as getSavingsLedger, V as priceOfficialDeepSeekUsage, _ as resolveCustomPolicy, b as COMPRESSION_PROFILES, c as charsToTokens, d as isValidAutoCompactThresholdPercent, f as parseContextCompressionSettings, g as DEFAULT_CUSTOM_COMPRESSION_POLICY, h as CustomCompressionPolicySchema, i as DEFAULTS, k as getAdvisorState, l as codePointLength, m as resolvePolicy, n as CONTEXT_COMPRESSION_SETTINGS_NAMESPACE, o as PRUNE_MARKER, p as resolveConfig, r as ContextCompressionSettingsSchema, s as charsForTokens, t as AUTO_COMPACT_THRESHOLD_LIMITS, u as isCompressionProfile, v as assertNever, y as deepFreeze, z as DEEPSEEK_OFFICIAL_PRICE_CATALOG_VERSION } from "./config.js";
2
- import { a as validatePublishedTailTrim, c as eventBySeq, i as tailTrimStub, l as sessionEvents, n as tailTrimMessage, o as compressionMessageSource, r as tailTrimRef, s as viewToolResult, t as parseTailTrimRef } from "./tail-trim.js";
1
+ import { B as decimalRateNanoUnits, F as recordIntentFold, H as resolveOfficialDeepSeekPrice, I as recordRecertified, L as recordScore, M as getSummaryOverride, N as invalidateOnTaskChange, O as evaluateIntentGate, P as observeIntentEnabled, T as observeContextUsage, U as getSavingsLedger, V as priceOfficialDeepSeekUsage, W as savingsHash, _ as resolveCustomPolicy, b as COMPRESSION_PROFILES, c as charsToTokens, d as isValidAutoCompactThresholdPercent, f as parseContextCompressionSettings, g as DEFAULT_CUSTOM_COMPRESSION_POLICY, h as CustomCompressionPolicySchema, i as DEFAULTS, k as getAdvisorState, l as codePointLength, m as resolvePolicy, n as CONTEXT_COMPRESSION_SETTINGS_NAMESPACE, o as PRUNE_MARKER, p as resolveConfig, r as ContextCompressionSettingsSchema, s as charsForTokens, t as AUTO_COMPACT_THRESHOLD_LIMITS, u as isCompressionProfile, v as assertNever, y as deepFreeze, z as DEEPSEEK_OFFICIAL_PRICE_CATALOG_VERSION } from "./config.js";
2
+ import { a as validatePublishedTailTrim, c as eventBySeq, d as freezeMessage, i as tailTrimStub, l as sessionEvents, n as tailTrimMessage, o as compressionMessageSource, r as tailTrimRef, s as viewToolResult, t as parseTailTrimRef, u as createUserMessage } from "./tail-trim.js";
3
3
  import z from "@deepseek-ai/schemastery";
4
4
  import { createHash } from "node:crypto";
5
5
  import { Service } from "@deepseek-ai/cordis";
6
- import { createUserMessage, freezeMessage } from "@deepseek-ai/dsh-llm";
7
6
  import * as dshSessionNamespace from "@deepseek-ai/dsh-session";
8
7
  import { readFileSync } from "node:fs";
9
8
  import { Tokenizer } from "@huggingface/tokenizers";
@@ -385,7 +384,7 @@ function unavailableCount(reason) {
385
384
  });
386
385
  }
387
386
  function recoveryMarker(sourceRef, label, startLine) {
388
- return `\n\n[... ${label}; source=${sourceRef}; ${startLine === void 0 ? "use context_compression_retrieve if needed" : `retrieve with context_compression_retrieve({"ref":"${sourceRef}","start_line":${String(startLine)},"max_lines":80})`} ...]\n\n`;
387
+ return `\n\n[... ${label}; source=${sourceRef}; ${startLine === void 0 ? "use context_compression_retrieve with a query or narrow start_line/max_lines if needed (avoid re-reading the whole result)" : `retrieve with context_compression_retrieve({"ref":"${sourceRef}","start_line":${String(startLine)},"max_lines":80})`} ...]\n\n`;
389
388
  }
390
389
  /**
391
390
  * Measure text content in Unicode code points; non-text blocks cost zero.
@@ -732,17 +731,17 @@ function countSurfaceCounts(counts, subject) {
732
731
  });
733
732
  }
734
733
  z.object({
735
- maxChars: z.number().step(1).min(1).default(5e4),
734
+ maxChars: z.number().step(1).min(1).default(12e3),
736
735
  maxScanChars: z.number().step(1).min(1).default(25e4),
737
736
  maxQueryChars: z.number().step(1).min(1).default(256)
738
737
  });
739
738
  const REF_PATTERN = /^session:\/\/([^/]+)\/event\/(\d+)$/;
740
739
  const MAX_LINES = 1e3;
741
- const DEFAULT_MAX_CHARS = 5e4;
740
+ const DEFAULT_MAX_CHARS = 12e3;
742
741
  const DEFAULT_MAX_SCAN_CHARS = 25e4;
743
742
  const DEFAULT_MAX_QUERY_CHARS = 256;
744
743
  const TRUNCATION_MARKER = "\n[context_compression_retrieve output truncated; reported lines describe the selected source range]\n";
745
- 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 context_compression_retrieve with that exact ref and a narrow line range or query if the omitted evidence is necessary. The returned event content comes from the append-only session log, which is the source of truth.";
744
+ 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 context_compression_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.";
746
745
  const OUTPUT = {
747
746
  schema: { type: "string" },
748
747
  render: (_args, value) => [{
@@ -1370,6 +1369,11 @@ const ADJACENT_REPEAT_MARKER = "[previous line repeated";
1370
1369
  const NON_ADJACENT_FOLD_THRESHOLD = 3;
1371
1370
  /** Read-output line-number gutter added unconditionally by the host's `formatReadOutput`. */
1372
1371
  const READ_GUTTER_PATTERN = /^(\d+): ?/;
1372
+ /** JSONL/NDJSON preview: records kept from the head and tail of the stream. */
1373
+ const JSONL_HEAD_RECORDS = 3;
1374
+ const JSONL_TAIL_RECORDS = 2;
1375
+ /** JSONL detection validates a bounded prefix so a multi-MB stream stays cheap. */
1376
+ const JSONL_DETECT_SCAN = 512;
1373
1377
  /**
1374
1378
  * Block-level read-gutter detection (GF-1). The host prefixes read output with
1375
1379
  * `N: ` line numbers unconditionally and cannot be configured off. The gutter
@@ -1428,7 +1432,8 @@ function reduceFreshToolResult(input, ranking) {
1428
1432
  const toolClass = classifyToolSource(input.toolName, command, normalized.contentText);
1429
1433
  const readTocFirst = toolClass === "read" && codePointLength(normalized.contentText) >= READ_TOC_MIN_CHARS;
1430
1434
  const candidates = [];
1431
- if (looksLikeJson(normalized.contentText)) candidates.push(() => reduceJson(prepared));
1435
+ if (looksLikeJsonl(normalized.contentText)) candidates.push(() => reduceJsonl(prepared));
1436
+ else if (looksLikeJson(normalized.contentText)) candidates.push(() => reduceJson(prepared));
1432
1437
  if (looksLikeMinified(normalized.contentText)) candidates.push(() => reduceBundledJs(prepared));
1433
1438
  if (toolClass === "search") candidates.push(() => reduceSearch(prepared, ranking?.files));
1434
1439
  if (isGitCommand(name, command)) candidates.push(() => reduceGit(prepared, command));
@@ -1791,6 +1796,76 @@ function reduceJson(input) {
1791
1796
  };
1792
1797
  return null;
1793
1798
  }
1799
+ /**
1800
+ * Reduce line-delimited JSON (JSONL/NDJSON): keep a head and tail sample of
1801
+ * records — each run through the same `shrinkJson` as the single-value branch —
1802
+ * and collapse the middle into an omitted-record count. Reads the gutter-
1803
+ * stripped content view so a host read listing (`N: ` prefix) still resolves.
1804
+ * Returns null when the sampled envelope cannot fit the budget (or when there
1805
+ * are too few records to omit anything), letting head/tail take over.
1806
+ */
1807
+ function reduceJsonl(input) {
1808
+ const recordLines = [];
1809
+ for (const line of input.contentText.split("\n")) {
1810
+ const trimmed = line.trim();
1811
+ if (trimmed !== "" && (trimmed.startsWith("{") || trimmed.startsWith("["))) recordLines.push(trimmed);
1812
+ }
1813
+ const total = recordLines.length;
1814
+ if (total < 2) return null;
1815
+ const parseRecord = (text) => {
1816
+ try {
1817
+ return JSON.parse(text);
1818
+ } catch {
1819
+ return text;
1820
+ }
1821
+ };
1822
+ const headCount = Math.min(JSONL_HEAD_RECORDS, total);
1823
+ const tailCount = total > headCount ? Math.min(JSONL_TAIL_RECORDS, total - headCount) : 0;
1824
+ const head = recordLines.slice(0, headCount).map((entry) => shrinkJson(parseRecord(entry), 0));
1825
+ const tail = tailCount > 0 ? recordLines.slice(total - tailCount).map((entry) => shrinkJson(parseRecord(entry), 0)) : [];
1826
+ const omitted = total - headCount - tailCount;
1827
+ const envelope = {
1828
+ $dsh_compression: {
1829
+ kind: "jsonl-preview",
1830
+ source: input.sourceRef,
1831
+ original_chars: codePointLength(input.text),
1832
+ records: total
1833
+ },
1834
+ head
1835
+ };
1836
+ if (omitted > 0) envelope.$dsh_omitted_records = omitted;
1837
+ if (tail.length > 0) envelope.tail = tail;
1838
+ const text = JSON.stringify(envelope, null, 2);
1839
+ if (codePointLength(text) >= codePointLength(input.text) || codePointLength(text) > input.budgetChars) return null;
1840
+ return {
1841
+ text,
1842
+ reducer: "jsonl-structure-preview",
1843
+ lossy: true
1844
+ };
1845
+ }
1846
+ /**
1847
+ * Detect JSONL/NDJSON: at least two non-empty lines, each of which parses on
1848
+ * its own as a JSON object or array. A pretty-printed single JSON fails this
1849
+ * (its interior lines are not standalone values), so the two forms never
1850
+ * collide. Only a bounded prefix is validated to keep multi-MB streams cheap.
1851
+ */
1852
+ function looksLikeJsonl(text) {
1853
+ let records = 0;
1854
+ for (const line of text.split("\n")) {
1855
+ const trimmed = line.trim();
1856
+ if (trimmed === "") continue;
1857
+ if (!(trimmed.startsWith("{") || trimmed.startsWith("["))) return false;
1858
+ try {
1859
+ const parsed = JSON.parse(trimmed);
1860
+ if (typeof parsed !== "object" || parsed === null) return false;
1861
+ records += 1;
1862
+ } catch {
1863
+ return false;
1864
+ }
1865
+ if (records >= JSONL_DETECT_SCAN) break;
1866
+ }
1867
+ return records >= 2;
1868
+ }
1794
1869
  function shrinkJson(value, depth) {
1795
1870
  if (depth >= 5) {
1796
1871
  if (Array.isArray(value)) return `[array length=${String(value.length)} omitted]`;
@@ -3826,6 +3901,177 @@ function dedupePlaceholder(entry, originalChars) {
3826
3901
  ].join(" ");
3827
3902
  }
3828
3903
  //#endregion
3904
+ //#region src/runtime/savings-projection.ts
3905
+ const EMPTY = Object.freeze({
3906
+ savings: [],
3907
+ offsets: [],
3908
+ registry: []
3909
+ });
3910
+ function blocksOf(event) {
3911
+ if (event.type !== "tool/result") return void 0;
3912
+ return viewToolResult(event.data.message).blocks;
3913
+ }
3914
+ function textOf(event) {
3915
+ const blocks = blocksOf(event);
3916
+ return blocks === void 0 ? void 0 : flattenPlainText(blocks);
3917
+ }
3918
+ /** 与 pruner 的 `plan()` 同口径定价:全文本块可精确,否则字符口径。 */
3919
+ function priceEvent(event, countText) {
3920
+ const blocks = blocksOf(event);
3921
+ if (blocks === void 0) return void 0;
3922
+ const chars = pressureCost(blocks);
3923
+ if (chars <= 0) return void 0;
3924
+ const texts = blocks.map((block) => block.type === "text" ? block.text : void 0);
3925
+ if (texts.every((text) => text !== void 0)) {
3926
+ const count = countExactCanonicalTextFields(texts, countText, "savings projection");
3927
+ if (count.kind === "exact-tokenizer") return {
3928
+ tokens: count.tokens,
3929
+ basis: "exact-tokenizer",
3930
+ chars
3931
+ };
3932
+ }
3933
+ return {
3934
+ tokens: Math.max(1, charsToTokens(chars)),
3935
+ basis: "characters",
3936
+ chars
3937
+ };
3938
+ }
3939
+ /** 替换事件的被替换 span;非替换节点(或畸形 op)返回 undefined。 */
3940
+ function replacedSpan(event) {
3941
+ const op = event.surfaceOp;
3942
+ if (typeof op !== "object" || op === null || op.op !== "replace") return void 0;
3943
+ const start = Number(op.startSeq);
3944
+ const end = Number(op.endSeq);
3945
+ if (!Number.isFinite(start) || !Number.isFinite(end) || end < start) return void 0;
3946
+ return {
3947
+ start,
3948
+ end
3949
+ };
3950
+ }
3951
+ function originalText(bySeq, span) {
3952
+ const parts = [];
3953
+ for (let seq = span.start; seq <= span.end; seq++) {
3954
+ const event = bySeq.get(seq);
3955
+ const text = event === void 0 ? void 0 : textOf(event);
3956
+ if (text !== void 0 && text.length > 0) parts.push(text);
3957
+ }
3958
+ return parts.join("\n");
3959
+ }
3960
+ /**
3961
+ * 一个替换节点"压掉了多少"(与实时 `plan()` 同口径:差额>0 才算)。
3962
+ * 原始价 = span 内原始事件之和;替换价 = 替换事件。
3963
+ */
3964
+ function computeDelta(bySeq, replacement, span, counter) {
3965
+ const after = priceEvent(replacement, counter);
3966
+ if (after === void 0) return void 0;
3967
+ let beforeChars = 0;
3968
+ let beforeExactTokens = 0;
3969
+ let beforeExact = true;
3970
+ let any = false;
3971
+ for (let seq = span.start; seq <= span.end; seq++) {
3972
+ const original = bySeq.get(seq);
3973
+ const priced = original === void 0 ? void 0 : priceEvent(original, counter);
3974
+ if (priced === void 0) continue;
3975
+ any = true;
3976
+ beforeChars += priced.chars;
3977
+ beforeExactTokens += priced.tokens;
3978
+ if (priced.basis !== "exact-tokenizer") beforeExact = false;
3979
+ }
3980
+ if (!any) return void 0;
3981
+ const exact = after.basis === "exact-tokenizer" && beforeExact;
3982
+ const basis = exact ? "exact-tokenizer" : "characters";
3983
+ const delta = (exact ? beforeExactTokens : charsToTokens(beforeChars)) - (exact ? after.tokens : charsToTokens(after.chars));
3984
+ if (delta <= 0) return void 0;
3985
+ return {
3986
+ tokens: delta,
3987
+ basis
3988
+ };
3989
+ }
3990
+ /**
3991
+ * 纯核心:给定事件流、当前 surface 节点与计价计数器,重算节省投影。
3992
+ * @param input - events/surfaceNodes/counter,均为实时路径的只读快照。
3993
+ * @returns savings(当前生效毛节省)/ offsets(每次重读惩罚)/ registry(原文配对键)。
3994
+ */
3995
+ function projectSavingsCore(input) {
3996
+ const { events, surfaceNodes, counter } = input;
3997
+ if (events.length === 0) return EMPTY;
3998
+ const bySeq = /* @__PURE__ */ new Map();
3999
+ for (const event of events) bySeq.set(Number(event.seq), event);
4000
+ const savings = [];
4001
+ for (const rawSeq of surfaceNodes) {
4002
+ const seq = Number(rawSeq);
4003
+ const replacement = bySeq.get(seq);
4004
+ if (replacement === void 0) continue;
4005
+ const span = replacedSpan(replacement);
4006
+ if (span === void 0) continue;
4007
+ const delta = computeDelta(bySeq, replacement, span, counter);
4008
+ if (delta === void 0) continue;
4009
+ savings.push({
4010
+ component: "projection",
4011
+ tokens: delta.tokens,
4012
+ basis: delta.basis,
4013
+ at: Number(replacement.time) || 0,
4014
+ replacementSeq: seq
4015
+ });
4016
+ }
4017
+ const offsets = [];
4018
+ const registry = [];
4019
+ const owned = /* @__PURE__ */ new Map();
4020
+ for (const event of events) {
4021
+ if (event.type !== "tool/result") continue;
4022
+ const span = replacedSpan(event);
4023
+ if (span !== void 0) {
4024
+ const groupText = originalText(bySeq, span);
4025
+ if (groupText.length === 0) continue;
4026
+ const delta = computeDelta(bySeq, event, span, counter);
4027
+ if (delta === void 0) continue;
4028
+ const hash = savingsHash(groupText);
4029
+ owned.set(hash, {
4030
+ claimedTokens: delta.tokens,
4031
+ basis: delta.basis,
4032
+ sourceSeq: span.start
4033
+ });
4034
+ registry.push({
4035
+ hash,
4036
+ claimedTokens: delta.tokens,
4037
+ basis: delta.basis,
4038
+ sourceSeq: span.start
4039
+ });
4040
+ continue;
4041
+ }
4042
+ const text = textOf(event);
4043
+ if (text === void 0 || text.length === 0) continue;
4044
+ const hit = owned.get(savingsHash(text));
4045
+ if (hit === void 0) continue;
4046
+ const priced = priceEvent(event, counter);
4047
+ if (priced === void 0) continue;
4048
+ offsets.push({
4049
+ component: "full-read",
4050
+ tokens: priced.tokens,
4051
+ basis: priced.basis,
4052
+ at: Number(event.time) || 0,
4053
+ note: `#${hit.sourceSeq} 的原文被全文重读(投影重建)`
4054
+ });
4055
+ }
4056
+ return {
4057
+ savings,
4058
+ offsets,
4059
+ registry
4060
+ };
4061
+ }
4062
+ /**
4063
+ * 从会话快照投影节省账。`measureForCompaction` 提供与实时同口径的 tokenizer
4064
+ * 计数器;失败时向上抛,由调用方 fail-open。
4065
+ */
4066
+ function projectSessionSavings(ctx, session) {
4067
+ const view = measureForCompaction(ctx, session);
4068
+ return projectSavingsCore({
4069
+ events: sessionEvents(session),
4070
+ surfaceNodes: session.surface.nodes,
4071
+ counter: (candidate) => view.countCanonicalText(candidate)
4072
+ });
4073
+ }
4074
+ //#endregion
3829
4075
  //#region src/runtime/adaptive-cost.ts
3830
4076
  /**
3831
4077
  * Bound Adaptive's benefit and cache-loss exposure without attributing the
@@ -3973,6 +4219,35 @@ const SessionSeq = dshSessionSoft.SessionSeq ?? dshSessionSoft.default?.SessionS
3973
4219
  function originalTextForSavings(candidate) {
3974
4220
  return flattenPlainText(viewToolResult(candidate.event.data.message).blocks);
3975
4221
  }
4222
+ /**
4223
+ * Cross-generation adaptation (0.2.0): the host `settings` service hands back
4224
+ * the WHOLE entry config `{ settings: <subtree> }` instead of the settings
4225
+ * subtree directly (older lines surfaced the subtree at the top level). The
4226
+ * parser requires `profile`+`custom` at the root, so the wrapped shape threw
4227
+ * "missing its complete shape" → the session failed open to `profile:'off'`,
4228
+ * silently disabling fresh/aggregate on the desktop. Descend exactly one
4229
+ * `{settings:<obj>}` wrapper ONLY when the root has no `profile`; every other
4230
+ * shape is passed through untouched so the "exotic Host value must fail open
4231
+ * to off" safety contract still holds.
4232
+ */
4233
+ function unwrapSettingsEntry(value) {
4234
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return value;
4235
+ const record = value;
4236
+ if ("profile" in record) return value;
4237
+ const inner = record.settings;
4238
+ if (inner !== null && typeof inner === "object" && !Array.isArray(inner)) return inner;
4239
+ return value;
4240
+ }
4241
+ /**
4242
+ * Whether a fresh candidate is BELOW the fresh trigger. Uses the real token
4243
+ * count when an exact tokenizer is available (DeepSeek routes), and otherwise
4244
+ * falls back to the 4.0 chars/token estimate — byte-for-byte the pre-existing
4245
+ * behavior on routes without a bundled tokenizer (e.g. local Qwen).
4246
+ */
4247
+ function freshBelowTrigger(candidate, policy) {
4248
+ if (candidate.count.kind === "exact-tokenizer") return candidate.count.tokens <= policy.freshTriggerTokens;
4249
+ return candidate.characterPressure <= charsForTokens(policy.freshTriggerTokens);
4250
+ }
3976
4251
  /** Mixed deterministic selector behind the existing `ctx.toolResultPruner` seam. */
3977
4252
  var ToolResultPruner = class extends Service {
3978
4253
  static inject = ["tokenMeter"];
@@ -4017,6 +4292,8 @@ var ToolResultPruner = class extends Service {
4017
4292
  turnClocks: /* @__PURE__ */ new WeakMap(),
4018
4293
  estimatorRemainingTurns: /* @__PURE__ */ new WeakMap(),
4019
4294
  advisorChannels: /* @__PURE__ */ new WeakMap(),
4295
+ intentChannels: /* @__PURE__ */ new WeakMap(),
4296
+ projectedSavings: /* @__PURE__ */ new WeakSet(),
4020
4297
  pendingIntentFolds: /* @__PURE__ */ new WeakMap(),
4021
4298
  intentFoldedSeqs: /* @__PURE__ */ new WeakMap(),
4022
4299
  intentBaselines: /* @__PURE__ */ new WeakMap()
@@ -4072,6 +4349,10 @@ var ToolResultPruner = class extends Service {
4072
4349
  try {
4073
4350
  observeContextUsage(String(agent.session.id), measureForCompaction(this.ctx, agent.session).totalTokens, this.contextWindowForRequest(agent.session));
4074
4351
  } catch {}
4352
+ this.ensureSavingsProjection(agent.session);
4353
+ try {
4354
+ getSavingsLedger().observeActive(String(agent.session.id), new Set([...agent.session.surface.nodes].map(Number)));
4355
+ } catch {}
4075
4356
  this.postflightEstimatorPass(agent.session, signal).catch(() => void 0);
4076
4357
  this.postflightAdvisorPass(agent.session, turn, signal).catch(() => void 0);
4077
4358
  this.postflightIntentFoldPass(agent.session, turn, signal).catch(() => void 0);
@@ -4160,12 +4441,13 @@ var ToolResultPruner = class extends Service {
4160
4441
  if (frozen !== void 0) return frozen;
4161
4442
  const settingsHost = this.ctx.get("settings");
4162
4443
  const settings = settingsHost?.describe?.().find((d) => String(d.ns) === "context-compression-improved-bundle")?.value ?? settingsHost?.get?.("context-compression");
4444
+ const unwrapped = unwrapSettingsEntry(settings);
4163
4445
  let resolved;
4164
4446
  let settingsSource = settings === void 0 ? "plugin-config-fallback" : "host-settings";
4165
4447
  let autoCompactThresholdSource = settings === void 0 ? "schema-default" : "host-settings";
4166
4448
  let settingsInvalidFallback;
4167
4449
  try {
4168
- resolved = settings === void 0 ? ContextCompressionSettingsSchema({ profile: this.state.config.profile }) : parseContextCompressionSettings(settings);
4450
+ resolved = settings === void 0 ? ContextCompressionSettingsSchema({ profile: this.state.config.profile }) : parseContextCompressionSettings(unwrapped);
4169
4451
  } catch (error) {
4170
4452
  const reason = error instanceof Error ? error.message : String(error);
4171
4453
  this.auditFailure(session, "pressure", "policy-resolution", error);
@@ -4275,7 +4557,7 @@ var ToolResultPruner = class extends Service {
4275
4557
  for (const candidate of this.snapshot(session, measureForCompaction(this.ctx, session))) {
4276
4558
  if (samples.length >= 3) break;
4277
4559
  if (candidate.event.data.turn === void 0) continue;
4278
- if (candidate.characterPressure <= charsForTokens(policy.freshTriggerTokens)) continue;
4560
+ if (freshBelowTrigger(candidate, policy)) continue;
4279
4561
  const path = toolCallPath(candidate.call.arguments);
4280
4562
  if (path === void 0) continue;
4281
4563
  if (isSupersededRead(events, candidate.seq, path)) continue;
@@ -4406,6 +4688,20 @@ var ToolResultPruner = class extends Service {
4406
4688
  else if (outcome !== void 0) advisorState.failures = void 0;
4407
4689
  }
4408
4690
  /**
4691
+ * 重进/重启会话的懒重建:首次观测某会话时,若账本尚无该会话条目,则按会话
4692
+ * 日志投影播种(当前生效毛节省 + 每次重读惩罚 + 原文配对键)。只做一次,
4693
+ * fail-open;同一进程内的实时增量随后在同一条目集合上继续。
4694
+ */
4695
+ ensureSavingsProjection(session) {
4696
+ if (this.state.projectedSavings.has(session)) return;
4697
+ this.state.projectedSavings.add(session);
4698
+ const ledger = getSavingsLedger();
4699
+ if (ledger.hasSession(String(session.id))) return;
4700
+ try {
4701
+ ledger.seedProjected(String(session.id), projectSessionSavings(this.ctx, session));
4702
+ } catch {}
4703
+ }
4704
+ /**
4409
4705
  * Fire-and-forget postflight: evaluate the growth gate, and only when it
4410
4706
  * passes, select the consumed increment OUTSIDE the protected working set,
4411
4707
  * mask it to semantic-role records, and spend ONE summary-writer call. The
@@ -4438,7 +4734,20 @@ var ToolResultPruner = class extends Service {
4438
4734
  }).decision) return;
4439
4735
  const settingsPreset = settings.presetOptions;
4440
4736
  if (settingsPreset === void 0) return;
4441
- if (settingsPreset.estimatorBaseUrl === void 0 || settingsPreset.estimatorBaseUrl.length === 0 || settingsPreset.estimatorModel === void 0 || settingsPreset.estimatorModel.length === 0) {
4737
+ const estimatorMode = settingsPreset.estimatorMode ?? "";
4738
+ if (estimatorMode !== "host" && estimatorMode !== "direct") {
4739
+ emitCompressionAudit(this.ctx.logger, {
4740
+ schemaVersion: 1,
4741
+ kind: "intent-summary-outcome",
4742
+ sessionId,
4743
+ ok: false,
4744
+ reason: "no-estimator-channel",
4745
+ turnIndex: turn,
4746
+ latencyMs: Date.now() - started
4747
+ });
4748
+ return;
4749
+ }
4750
+ if (estimatorMode === "direct" && (settingsPreset.estimatorBaseUrl === void 0 || settingsPreset.estimatorBaseUrl.length === 0 || settingsPreset.estimatorModel === void 0 || settingsPreset.estimatorModel.length === 0)) {
4442
4751
  emitCompressionAudit(this.ctx.logger, {
4443
4752
  schemaVersion: 1,
4444
4753
  kind: "intent-summary-outcome",
@@ -4477,14 +4786,14 @@ var ToolResultPruner = class extends Service {
4477
4786
  if (records.length === 0) return;
4478
4787
  const events = sessionEvents(session);
4479
4788
  const task = collectTaskSemantics(events);
4480
- let channel = this.state.advisorChannels.get(session);
4789
+ let channel = this.state.intentChannels.get(session);
4481
4790
  if (channel === void 0) {
4482
4791
  channel = new SideChannel(this.ctx, settingsPreset, {
4483
- mode: "direct",
4792
+ mode: estimatorMode,
4484
4793
  timeoutMs: 3e4,
4485
4794
  maxTokens: 512
4486
4795
  });
4487
- this.state.advisorChannels.set(session, channel);
4796
+ this.state.intentChannels.set(session, channel);
4488
4797
  }
4489
4798
  const answer = await channel.ask({
4490
4799
  system: buildIntentSummarySystemPrompt(),
@@ -4948,8 +5257,7 @@ var ToolResultPruner = class extends Service {
4948
5257
  const plans = /* @__PURE__ */ new Map();
4949
5258
  let freshPlanned = 0;
4950
5259
  const dedupeEnabled = policy.presetOptions?.dedupeToolResults === true;
4951
- const candidateChars = candidates.map((candidate) => candidate.characterPressure);
4952
- const maxCandidateChars = candidateChars.length === 0 ? void 0 : Math.max(...candidateChars);
5260
+ const maxCandidateTokens = candidates.length === 0 ? void 0 : Math.max(...candidates.map((candidate) => candidate.count.kind === "exact-tokenizer" ? candidate.count.tokens : charsToTokens(candidate.characterPressure)));
4953
5261
  if (policy.freshEnabled) {
4954
5262
  if (candidates.some((candidate) => candidate.call.name !== "context_compression_retrieve" && candidate.count.kind !== "exact-tokenizer")) this.warnExactUnavailable(session, view, "fresh");
4955
5263
  for (const candidate of candidates) {
@@ -4992,9 +5300,9 @@ var ToolResultPruner = class extends Service {
4992
5300
  const landed = this.landAll(session, this.adviseReplacements(session, policy, freshCandidates, "fresh"));
4993
5301
  const freshLanded = landed.some((entry) => entry.stage === "fresh" && plans.get(entry.originalSeq)?.component === "fresh");
4994
5302
  const aggregateLanded = landed.some((entry) => entry.stage === "fresh" && plans.get(entry.originalSeq)?.component === "aggregate");
4995
- if (!freshLanded) this.auditComponent(session, policy, "fresh", "fresh", policy.freshEnabled ? "skipped" : "disabled", !policy.freshEnabled ? "profile-policy" : (maxCandidateChars ?? 0) <= charsForTokens(policy.freshTriggerTokens) ? "at-or-below-trigger" : freshPlanned > 0 && aggregatePlanned > 0 ? "superseded-by-aggregate" : freshPlanned === 0 ? "no-valid-reduction" : "recovery-tool-unavailable", {
5303
+ if (!freshLanded) this.auditComponent(session, policy, "fresh", "fresh", policy.freshEnabled ? "skipped" : "disabled", !policy.freshEnabled ? "profile-policy" : (maxCandidateTokens ?? 0) <= policy.freshTriggerTokens ? "at-or-below-trigger" : freshPlanned > 0 && aggregatePlanned > 0 ? "superseded-by-aggregate" : freshPlanned === 0 ? "no-valid-reduction" : "recovery-tool-unavailable", {
4996
5304
  measurementKind: "characters",
4997
- ...maxCandidateChars === void 0 ? {} : { currentTokens: charsToTokens(maxCandidateChars) },
5305
+ ...maxCandidateTokens === void 0 ? {} : { currentTokens: maxCandidateTokens },
4998
5306
  triggerTokens: policy.freshTriggerTokens,
4999
5307
  targetTokens: policy.freshTargetTokens
5000
5308
  });
@@ -5069,7 +5377,7 @@ var ToolResultPruner = class extends Service {
5069
5377
  if (typeof candidate.event.surfaceOp === "object") return null;
5070
5378
  const text = flattenPlainText(viewToolResult(candidate.event.data.message).blocks);
5071
5379
  if (text === void 0) return null;
5072
- if (candidate.characterPressure <= charsForTokens(policy.freshTriggerTokens)) return null;
5380
+ if (freshBelowTrigger(candidate, policy)) return null;
5073
5381
  let table = this.state.dedupeTables.get(session);
5074
5382
  if (table === void 0) {
5075
5383
  table = new DedupeTable();
@@ -5097,7 +5405,7 @@ var ToolResultPruner = class extends Service {
5097
5405
  planFresh(candidate, session, policy, view) {
5098
5406
  if (typeof candidate.event.surfaceOp === "object") return null;
5099
5407
  const resultView = viewToolResult(candidate.event.data.message);
5100
- if (candidate.characterPressure <= charsForTokens(policy.freshTriggerTokens)) return null;
5408
+ if (freshBelowTrigger(candidate, policy)) return null;
5101
5409
  const sourceSeq = candidate.seq;
5102
5410
  const sourceRef$1 = sourceRef(session, sourceSeq);
5103
5411
  const textBlock = onlyTextBlock(resultView.blocks);
@@ -5140,7 +5448,7 @@ var ToolResultPruner = class extends Service {
5140
5448
  "[Tool result reduced to satisfy the completed-step aggregate budget]",
5141
5449
  `tool: ${candidate.call.name}`,
5142
5450
  `source: ${sourceRef$2}`,
5143
- "Use context_compression_retrieve with this source if the omitted evidence is necessary."
5451
+ "Retrieve a narrow slice via context_compression_retrieve if needed."
5144
5452
  ].join("\n");
5145
5453
  const plan = this.plan(candidate, [{
5146
5454
  type: "text",
@@ -5473,6 +5781,7 @@ var ToolResultPruner = class extends Service {
5473
5781
  tokensAfter,
5474
5782
  basis: exact ? "exact-tokenizer" : "characters",
5475
5783
  sourceSeq: manifestSeq,
5784
+ replacementSeq: Number(replacement.seq),
5476
5785
  originalText: groupText
5477
5786
  });
5478
5787
  return;
@@ -5614,6 +5923,7 @@ var ToolResultPruner = class extends Service {
5614
5923
  tokensAfter: plan.tokensAfter,
5615
5924
  basis: plan.measurementBasis,
5616
5925
  sourceSeq: plan.sourceSeq,
5926
+ replacementSeq: Number(replacement.seq),
5617
5927
  ...pairedOriginal === void 0 ? {} : { originalText: pairedOriginal }
5618
5928
  });
5619
5929
  return {
@@ -5786,4 +6096,4 @@ var ToolResultPruner = class extends Service {
5786
6096
  }
5787
6097
  };
5788
6098
  //#endregion
5789
- export { AUTO_COMPACT_THRESHOLD_LIMITS, COMPRESSION_PROFILES, CONTEXT_COMPRESSION_SETTINGS_NAMESPACE, ContextCompressionSettingsSchema, CustomCompressionPolicySchema, DEFAULTS, DEFAULT_CUSTOM_COMPRESSION_POLICY, PRUNE_MARKER, ToolResultPruner, ToolResultPruner as default, codePointLength, historicalPlaceholder, isCompressionProfile, isValidAutoCompactThresholdPercent, measureForCompaction, normalizeTerminalText, parseContextCompressionSettings, reduceFreshToolResult, resolveConfig, resolveCustomPolicy, resolvePolicy, verifyReduction };
6099
+ export { AUTO_COMPACT_THRESHOLD_LIMITS, COMPRESSION_PROFILES, CONTEXT_COMPRESSION_SETTINGS_NAMESPACE, ContextCompressionSettingsSchema, CustomCompressionPolicySchema, DEFAULTS, DEFAULT_CUSTOM_COMPRESSION_POLICY, PRUNE_MARKER, ToolResultPruner, ToolResultPruner as default, codePointLength, freshBelowTrigger, historicalPlaceholder, isCompressionProfile, isValidAutoCompactThresholdPercent, measureForCompaction, normalizeTerminalText, parseContextCompressionSettings, reduceFreshToolResult, resolveConfig, resolveCustomPolicy, resolvePolicy, unwrapSettingsEntry, verifyReduction };
@@ -1,5 +1,28 @@
1
1
  import { r as hostGenerationSnapshot } from "./host-generation.js";
2
- import { createUserMessage } from "@deepseek-ai/dsh-llm";
2
+ //#region src/compat/llm-messages.ts
3
+ /** Recursive `Object.freeze` over own enumerable properties (arrays included). */
4
+ function deepFreeze(value) {
5
+ if (value !== null && typeof value === "object" && !Object.isFrozen(value)) {
6
+ Object.freeze(value);
7
+ for (const nested of Object.values(value)) deepFreeze(nested);
8
+ }
9
+ return value;
10
+ }
11
+ /**
12
+ * Detach and deep-freeze a message whose identity already exists — the host
13
+ * factory is `deepFreeze(structuredClone(message))`, byte-for-byte.
14
+ */
15
+ function freezeMessage(message) {
16
+ return deepFreeze(structuredClone(message));
17
+ }
18
+ function createUserMessage(input) {
19
+ return deepFreeze(structuredClone({
20
+ ...input,
21
+ role: "user",
22
+ id: crypto.randomUUID()
23
+ }));
24
+ }
25
+ //#endregion
3
26
  //#region src/runtime/session-events.ts
4
27
  /**
5
28
  * Read one immutable Session event snapshot.
@@ -208,4 +231,4 @@ function sameNumbers(left, right) {
208
231
  return left !== void 0 && left.length === right.length && left.every((value, index) => value === right[index]);
209
232
  }
210
233
  //#endregion
211
- export { validatePublishedTailTrim as a, eventBySeq as c, tailTrimStub as i, sessionEvents as l, tailTrimMessage as n, compressionMessageSource as o, tailTrimRef as r, viewToolResult as s, parseTailTrimRef as t };
234
+ export { validatePublishedTailTrim as a, eventBySeq as c, freezeMessage as d, tailTrimStub as i, sessionEvents as l, tailTrimMessage as n, compressionMessageSource as o, tailTrimRef as r, viewToolResult as s, parseTailTrimRef as t, createUserMessage as u };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-context-compression-improved",
3
- "version": "0.9.3",
3
+ "version": "0.9.7",
4
4
  "description": "One-install context-compression selector bundle for DeepSeek Harness",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -67,7 +67,7 @@
67
67
  "author": "WilliamShi666",
68
68
  "engines": {
69
69
  "node": "^22.19.0 || >=24.0.0",
70
- "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"
70
+ "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"
71
71
  },
72
72
  "keywords": [
73
73
  "deepseek",
@@ -79,6 +79,7 @@
79
79
  "license": "MIT",
80
80
  "publishConfig": {
81
81
  "access": "public",
82
+ "registry": "https://registry.npmjs.org",
82
83
  "tag": "latest"
83
84
  },
84
85
  "dependencies": {
@@ -90,25 +91,25 @@
90
91
  "@deepseek-ai/cordis": ">=4.0.1 <5",
91
92
  "@deepseek-ai/cordis-plugin-include": ">=1.0.6 <2",
92
93
  "@deepseek-ai/cordis-plugin-loader": ">=1.0.2 <2",
93
- "@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",
94
- "@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",
95
- "@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",
96
- "@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",
97
- "@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",
98
- "@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",
99
- "@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",
100
- "@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",
101
- "@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",
102
- "@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",
103
- "@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",
104
- "@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",
105
- "@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",
106
- "@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",
107
- "@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",
108
- "@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",
109
- "@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",
110
- "@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",
111
- "@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",
94
+ "@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",
95
+ "@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",
96
+ "@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",
97
+ "@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",
98
+ "@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",
99
+ "@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",
100
+ "@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",
101
+ "@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",
102
+ "@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",
103
+ "@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",
104
+ "@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",
105
+ "@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",
106
+ "@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",
107
+ "@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",
108
+ "@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",
109
+ "@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",
110
+ "@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",
111
+ "@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",
112
+ "@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",
112
113
  "react": ">=18 <19"
113
114
  },
114
115
  "peerDependenciesMeta": {