dsh-context-compression-improved 0.10.3 → 0.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/$null +1 -0
  2. package/.github/workflows/ci.yml +10 -2
  3. package/README.de.md +1 -1
  4. package/README.es.md +1 -1
  5. package/README.fr.md +1 -1
  6. package/README.it.md +1 -1
  7. package/README.ja.md +1 -1
  8. package/README.ko.md +1 -1
  9. package/README.md +1 -1
  10. package/README.ru.md +1 -1
  11. package/README.zh.md +1 -1
  12. package/package.json +6 -6
  13. package/packages/selector/dsh.plugin.json +2 -2
  14. package/packages/selector/lib/client.d.ts +4 -0
  15. package/packages/selector/lib/client.js +70 -5
  16. package/packages/selector/lib/invariant.js +1 -1
  17. package/packages/selector/lib/profiles.d.ts +3 -1
  18. package/packages/selector/lib/pruner.d.ts +4 -2
  19. package/packages/selector/lib/pruner.js +40 -37
  20. package/packages/selector/lib/savings-integral.js +83 -24
  21. package/packages/selector/lib/tail-trim.js +2 -2
  22. package/packages/selector/lib/tool-result.js +22 -1
  23. package/packages/selector/package.json +21 -21
  24. package/packages/selector/src/client/CompressionProfileControls.tsx +30 -4
  25. package/packages/selector/src/client/CompressionProfileSelector.tsx +2 -0
  26. package/packages/selector/src/client/decode.ts +8 -1
  27. package/packages/selector/src/client/index.ts +11 -1
  28. package/packages/selector/src/client/locales/de.ts +2 -0
  29. package/packages/selector/src/client/locales/es.ts +2 -0
  30. package/packages/selector/src/client/locales/fr.ts +2 -0
  31. package/packages/selector/src/client/locales/it.ts +2 -0
  32. package/packages/selector/src/client/locales/ja.ts +2 -0
  33. package/packages/selector/src/client/locales/ko.ts +2 -0
  34. package/packages/selector/src/client/locales/ru.ts +2 -0
  35. package/packages/selector/src/client/locales.ts +4 -0
  36. package/packages/selector/src/client/settings-section.tsx +12 -3
  37. package/packages/selector/src/profiles.ts +20 -0
  38. package/packages/selector/src/pruner/content.ts +3 -2
  39. package/packages/selector/src/pruner.ts +8 -6
  40. package/packages/selector/src/runtime/config.ts +58 -14
  41. package/packages/selector/src/runtime/custom-policy.ts +22 -0
  42. package/packages/selector/src/runtime/reducers.ts +15 -14
  43. package/packages/selector/src/runtime/retrieve.ts +18 -16
  44. package/packages/selector/src/runtime/tail-trim.ts +2 -1
  45. package/packages/selector/src/runtime/tokenpilot/dedup.ts +2 -1
  46. package/packages/selector/src/runtime/tokenpilot/locator.ts +2 -1
  47. package/packages/selector/src/runtime/tool-names.ts +36 -0
  48. package/packages/selector/src/runtime/types.ts +3 -0
  49. package/packages/selector/tests/profiles.client.spec.tsx +4 -4
  50. package/packages/selector/tests/ptc-custom-write.client.spec.ts +86 -0
  51. package/packages/selector/tests/runtime/ptc-profile.spec.ts +133 -0
  52. package/packages/selector/tests/runtime/public/public-runtime.spec.ts +15 -1
  53. package/packages/selector/tests/runtime/stats-backfill.spec.ts +3 -1
  54. package/packages/selector/tests/runtime/tokenpilot/profile-baseline.spec.ts +14 -12
  55. package/packages/selector/tests/settings-seat.client.spec.ts +1 -1
  56. package/scripts/hosts.mjs +1 -0
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { codePointLength } from './config.ts'
4
4
  import { classifyToolSource } from './toolclass.ts'
5
+ import { RUNTIME_TOOL_NAMES } from './tool-names.ts'
5
6
 
6
7
  /** Input shared by every fresh-result reducer. */
7
8
  export interface ReducerInput {
@@ -287,8 +288,8 @@ export function historicalPlaceholder(input: {
287
288
  .find(line => IMPORTANT_PATTERN.test(line.text))
288
289
  ?? undefined)?.originalLine
289
290
  const retrieveHint = anchorLine === undefined
290
- ? `retrieve: context_compression_retrieve({"ref":"${input.sourceRef}"})`
291
- : `retrieve: context_compression_retrieve({"ref":"${input.sourceRef}","start_line":${String(anchorLine)},"max_lines":${String(RETRIEVE_HINT_MAX_LINES)}})`
291
+ ? `retrieve: ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}"})`
292
+ : `retrieve: ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}","start_line":${String(anchorLine)},"max_lines":${String(RETRIEVE_HINT_MAX_LINES)}})`
292
293
  const lines = [
293
294
  '[Old tool result content cleared from active context]',
294
295
  `tool: ${input.toolName || 'unknown'}`,
@@ -581,7 +582,7 @@ function reduceBundledJs(input: PreparedInput): ReducerOutput | null {
581
582
  if (declarations.size === 0) return null
582
583
  const hasSourceMap = input.contentText.includes(SOURCEMAP_DIRECTIVE)
583
584
  const entries = [...declarations.entries()].sort((a, b) => a[1] - b[1])
584
- const header = `[bundled/minified JS detected; ${String(entries.length)} declarations; minified symbols may be renamed — exports.*/module.exports traces are the reliable ones;${hasSourceMap ? ' source map present, prefer reading the original source;' : ''} source: ${input.sourceRef}; retrieve with context_compression_retrieve({"ref":"${input.sourceRef}"}) (line-addressed: single-line bundles come back whole)]`
585
+ const header = `[bundled/minified JS detected; ${String(entries.length)} declarations; minified symbols may be renamed — exports.*/module.exports traces are the reliable ones;${hasSourceMap ? ' source map present, prefer reading the original source;' : ''} source: ${input.sourceRef}; retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}"}) (line-addressed: single-line bundles come back whole)]`
585
586
  const kept = [header, ...entries.slice(0, 400).map(([symbol, line]) => `${symbol} (line ${String(line)})`)]
586
587
  const start = input.lines[0]?.originalLine ?? 1
587
588
  const end = originalEnd(input.lines, input.lines.length - 1)
@@ -806,7 +807,7 @@ function reduceSearch(input: PreparedInput, fileRanking?: readonly string[]): Re
806
807
  const allLocators = [...perFile.keys()].map(path => locatorFor(path, groups.get(path)!))
807
808
 
808
809
  const headerFor = (l2Rows: number, omitted: number): string =>
809
- `[search results compressed; ${String(groups.size)} files, ${String(totalMatches)} matches; ${String(l2Rows)} content rows shown, ${String(omitted)} matches omitted; source: ${input.sourceRef}; retrieve with context_compression_retrieve({"ref":"${input.sourceRef}"})]`
810
+ `[search results compressed; ${String(groups.size)} files, ${String(totalMatches)} matches; ${String(l2Rows)} content rows shown, ${String(omitted)} matches omitted; source: ${input.sourceRef}; retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}"})]`
810
811
 
811
812
  // L2 water-filling: one unchosen row per file per round, so no file
812
813
  // disappears and no file outpaces another by more than one round. Important
@@ -902,7 +903,7 @@ function reduceGit(input: PreparedInput, command: string): ReducerOutput | null
902
903
  || IMPORTANT_PATTERN.test(line))
903
904
  }
904
905
  if (keep.length === 0) return reduceSalient(input, reducer)
905
- const header = `[git output compressed; ${scannedTotals(input, keep.length)}; source: ${input.sourceRef}; scatter-masked: retrieve with context_compression_retrieve({"ref":"${input.sourceRef}","query":"<keyword>"}) for missed rows]`
906
+ const header = `[git output compressed; ${scannedTotals(input, keep.length)}; source: ${input.sourceRef}; scatter-masked: retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}","query":"<keyword>"}) for missed rows]`
906
907
  const text = fitLines([header, ...keep, ...lines.slice(-8).map(line => line.text)], input.budgetChars, input.sourceRef)
907
908
  return text === null ? null : { text, reducer, lossy: true }
908
909
  }
@@ -910,7 +911,7 @@ function reduceGit(input: PreparedInput, command: string): ReducerOutput | null
910
911
  function reducePatternLog(input: PreparedInput, reducer: string, pattern: RegExp): ReducerOutput | null {
911
912
  const lines = input.lines
912
913
  const kept = lines.filter(line => pattern.test(line.text) || IMPORTANT_PATTERN.test(line.text) || STATUS_PATTERN.test(line.text))
913
- const header = `[command output compressed by ${reducer}; ${scannedTotals(input, kept.length)}; source: ${input.sourceRef}; scatter-masked: retrieve with context_compression_retrieve({"ref":"${input.sourceRef}","query":"<keyword>"}) for missed rows]`
914
+ const header = `[command output compressed by ${reducer}; ${scannedTotals(input, kept.length)}; source: ${input.sourceRef}; scatter-masked: retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}","query":"<keyword>"}) for missed rows]`
914
915
  const text = fitLines([header, ...kept.map(line => line.text), ...lines.slice(-20).map(line => line.text)], input.budgetChars, input.sourceRef)
915
916
  return text === null ? null : { text, reducer, lossy: true }
916
917
  }
@@ -919,7 +920,7 @@ function reduceShell(input: PreparedInput): ReducerOutput | null {
919
920
  const lines = input.lines
920
921
  const important = lines.filter(line => IMPORTANT_PATTERN.test(line.text))
921
922
  if (important.length === 0) return reduceTail(input, 'pi-tail')
922
- const header = `[shell/log output compressed; ${scannedTotals(input, important.length)}; source: ${input.sourceRef}; scatter-masked: retrieve with context_compression_retrieve({"ref":"${input.sourceRef}","query":"<keyword>"}) for missed rows]`
923
+ const header = `[shell/log output compressed; ${scannedTotals(input, important.length)}; source: ${input.sourceRef}; scatter-masked: retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}","query":"<keyword>"}) for missed rows]`
923
924
  const text = fitLines([header, ...important.map(line => line.text), '--- final output ---', ...lines.slice(-40).map(line => line.text)], input.budgetChars, input.sourceRef)
924
925
  return text === null ? null : { text, reducer: 'shell-salience-tail', lossy: true }
925
926
  }
@@ -1109,7 +1110,7 @@ function reduceHtml(input: PreparedInput): ReducerOutput | null {
1109
1110
 
1110
1111
  const buildHeader = (reducer: string, firstElided?: { readonly start: number }): string => {
1111
1112
  const startLine = firstElided === undefined ? '' : `,"start_line":${String(firstElided.start)},"max_lines":${String(RETRIEVE_HINT_MAX_LINES)}`
1112
- return `[html compressed by ${reducer}; source: ${input.sourceRef}; retrieve with context_compression_retrieve({"ref":"${input.sourceRef}"${startLine}})]`
1113
+ return `[html compressed by ${reducer}; source: ${input.sourceRef}; retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}"${startLine}})]`
1113
1114
  }
1114
1115
 
1115
1116
  // Third level (R4): deterministic repeated-block folding. Nav/footer/
@@ -1277,7 +1278,7 @@ function reduceDocSkeleton(input: PreparedInput, sectionRanking?: readonly strin
1277
1278
  const hint = firstElided === undefined
1278
1279
  ? ''
1279
1280
  : `,"start_line":${String(firstElided)},"max_lines":${String(RETRIEVE_HINT_MAX_LINES)}`
1280
- kept.unshift(`[document compressed by doc-skeleton; source: ${input.sourceRef}; retrieve with context_compression_retrieve({"ref":"${input.sourceRef}"${hint}})]`)
1281
+ kept.unshift(`[document compressed by doc-skeleton; source: ${input.sourceRef}; retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}"${hint}})]`)
1281
1282
  const text = fitLines(kept, budget, input.sourceRef)
1282
1283
  return { text, ...(firstElided === undefined ? {} : { firstElided }), elidedLines }
1283
1284
  }
@@ -1358,7 +1359,7 @@ function reduceProseKeep(input: PreparedInput): ReducerOutput | null {
1358
1359
  const last = lines[lines.length - 1]!
1359
1360
  const tailLine = last.originalLineEnd ?? last.originalLine
1360
1361
  const markerTemplate = elidedRangeMarker(first.originalLine, tailLine)
1361
- const sourceNoteTemplate = `; source: ${input.sourceRef}; retrieve with context_compression_retrieve({"ref":"${input.sourceRef}"})`
1362
+ const sourceNoteTemplate = `; source: ${input.sourceRef}; retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}"})`
1362
1363
  const reserved = codePointLength(markerTemplate) + codePointLength(sourceNoteTemplate) + 2
1363
1364
  const bodyBudget = input.budgetChars - reserved
1364
1365
  if (bodyBudget <= 0) return null
@@ -1385,7 +1386,7 @@ function reduceProseKeep(input: PreparedInput): ReducerOutput | null {
1385
1386
  const elidedStart = lines[headCount]!.originalLine
1386
1387
  const elidedEnd = originalEnd(lines, lines.length - tailCount - 1)
1387
1388
  if (elidedEnd < elidedStart) return null
1388
- const sourceNote = `; source: ${input.sourceRef}; retrieve with context_compression_retrieve({"ref":"${input.sourceRef}","start_line":${String(elidedStart)},"max_lines":${String(RETRIEVE_HINT_MAX_LINES)}})`
1389
+ const sourceNote = `; source: ${input.sourceRef}; retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}","start_line":${String(elidedStart)},"max_lines":${String(RETRIEVE_HINT_MAX_LINES)}})`
1389
1390
  const text = [
1390
1391
  ...lines.slice(0, headCount).map(line => line.text),
1391
1392
  elidedRangeMarker(elidedStart, elidedEnd) + sourceNote,
@@ -1552,7 +1553,7 @@ function finishSkeleton(
1552
1553
  ): ReducerOutput | null {
1553
1554
  const hint = firstElided === undefined
1554
1555
  ? ''
1555
- : `; retrieve with context_compression_retrieve({"ref":"${input.sourceRef}","start_line":${String(firstElided.start)},"max_lines":${String(RETRIEVE_HINT_MAX_LINES)}})`
1556
+ : `; retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}","start_line":${String(firstElided.start)},"max_lines":${String(RETRIEVE_HINT_MAX_LINES)}})`
1556
1557
  const header = `[code output compressed by hypa-code-skeleton; source: ${input.sourceRef}${hint}]`
1557
1558
  const text = fitLines([header, ...kept, ...lines.slice(-4)], input.budgetChars, input.sourceRef)
1558
1559
  return text === null ? null : { text, reducer: 'hypa-code-skeleton', lossy: true, elidedLines }
@@ -1608,7 +1609,7 @@ function looksLikeSourceCode(text: string): boolean {
1608
1609
  }
1609
1610
 
1610
1611
  function omissionMarker(input: PreparedInput, reducer: string): string {
1611
- return `[... ${reducer} omitted content; original_chars=${String(codePointLength(input.text))}; source=${input.sourceRef}; retrieve with context_compression_retrieve ...]`
1612
+ return `[... ${reducer} omitted content; original_chars=${String(codePointLength(input.text))}; source=${input.sourceRef}; retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE} ...]`
1612
1613
  }
1613
1614
 
1614
1615
  /**
@@ -1622,7 +1623,7 @@ function rangeOmissionMarker(
1622
1623
  elidedStart: number,
1623
1624
  elidedEnd: number,
1624
1625
  ): string {
1625
- return `[... lines ${String(elidedStart)}-${String(elidedEnd)} elided (${String(elidedEnd - elidedStart + 1)} lines); ${reducer}; original_chars=${String(codePointLength(input.text))}; source=${input.sourceRef}; retrieve with context_compression_retrieve({"ref":"${input.sourceRef}","start_line":${String(elidedStart)},"max_lines":${String(RETRIEVE_HINT_MAX_LINES)}}) ...]`
1626
+ return `[... lines ${String(elidedStart)}-${String(elidedEnd)} elided (${String(elidedEnd - elidedStart + 1)} lines); ${reducer}; original_chars=${String(codePointLength(input.text))}; source=${input.sourceRef}; retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${input.sourceRef}","start_line":${String(elidedStart)},"max_lines":${String(RETRIEVE_HINT_MAX_LINES)}}) ...]`
1626
1627
  }
1627
1628
 
1628
1629
  /** Scatter-mask note (R9b): totals instead of fragmented per-run ranges. */
@@ -22,6 +22,7 @@ import { sessionEvents } from './session-events.ts'
22
22
  import { getSavingsLedger } from './savings.ts'
23
23
  import { claimOffset } from './stats-sync.ts'
24
24
  import { viewToolResult } from '../compat/tool-result.ts'
25
+ import { PTC_BINDING_NOTE, RUNTIME_TOOL_NAMES } from './tool-names.ts'
25
26
 
26
27
  export const name = 'context-compression-retrieve'
27
28
  export const inject = ['tools', 'systemPrompt']
@@ -48,12 +49,13 @@ const MAX_LINES = 1_000
48
49
  const DEFAULT_MAX_CHARS = 12_000
49
50
  const DEFAULT_MAX_SCAN_CHARS = 250_000
50
51
  const DEFAULT_MAX_QUERY_CHARS = 256
51
- const TRUNCATION_MARKER = '\n[context_compression_retrieve output truncated; reported lines describe the selected source range]\n'
52
+ const TRUNCATION_MARKER = `\n[${RUNTIME_TOOL_NAMES.RETRIEVE} output truncated; reported lines describe the selected source range]\n`
52
53
  const PROMPT = 'When a compacted tool result contains a session://<session-id>/event/<seq> reference, '
53
- + 'or TailTrim contains a session://<session-id>/tailtrim/<seq> reference, use context_compression_retrieve with that exact ref '
54
+ + `or TailTrim contains a session://<session-id>/tailtrim/<seq> reference, use ${RUNTIME_TOOL_NAMES.RETRIEVE} with that exact ref `
54
55
  + 'and a narrow line range or query if the omitted evidence is necessary. '
55
56
  + '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. '
56
- + 'The returned event content comes from the append-only session log, which is the source of truth.'
57
+ + 'The returned event content comes from the append-only session log, which is the source of truth. '
58
+ + PTC_BINDING_NOTE
57
59
 
58
60
  const OUTPUT = {
59
61
  schema: { type: 'string' as const },
@@ -76,8 +78,8 @@ export function installContextCompressionRetrieve(ctx: Context, config: Config =
76
78
  )
77
79
  ctx.systemPrompt.section({ name: 'tool:context-compression-retrieve', order: 114, text: PROMPT })
78
80
  ctx.tools.register(defineTool({
79
- name: 'context_compression_retrieve',
80
- description: 'Recover exact content from one compacted tool result or TailTrim group using its current-session session:// reference.',
81
+ name: RUNTIME_TOOL_NAMES.RETRIEVE,
82
+ description: `Recover exact content from one compacted tool result or TailTrim group using its current-session session:// reference. ${PTC_BINDING_NOTE}`,
81
83
  parameters: {
82
84
  ref: { type: 'string', required: true, description: 'Exact session://<current-session-id>/event/<seq> or /tailtrim/<seq> reference from a placeholder.' },
83
85
  query: { type: 'string', description: 'Optional case-insensitive text to search for inside the original result.' },
@@ -87,17 +89,17 @@ export function installContextCompressionRetrieve(ctx: Context, config: Config =
87
89
  output: OUTPUT,
88
90
  isConcurrencySafe: () => true,
89
91
  execute(args, exec) {
90
- if (exec.agent === undefined) throw new Error('context_compression_retrieve requires an agent session')
92
+ if (exec.agent === undefined) throw new Error(`${RUNTIME_TOOL_NAMES.RETRIEVE} requires an agent session`)
91
93
  const match = REF_PATTERN.exec(args.ref)
92
94
  const tailTrimRef = parseTailTrimRef(args.ref)
93
95
  if (match === null && tailTrimRef === null) {
94
- throw new Error('context_compression_retrieve: ref must be session://<session-id>/(event|tailtrim)/<seq>')
96
+ throw new Error(`${RUNTIME_TOOL_NAMES.RETRIEVE}: ref must be session://<session-id>/(event|tailtrim)/<seq>`)
95
97
  }
96
98
  const sessionId = match?.[1] ?? tailTrimRef?.sessionId
97
99
  // 身份键一律用 session.id(与 pruner 落账/占位符 sourceRef 同键);旧版这里
98
100
  // 用 exec.agent.id,两键不一致时抵消会记到另一本账上。
99
101
  if (sessionId !== String(exec.agent.session.id)) {
100
- throw new Error('context_compression_retrieve: a compression reference may only read the caller\'s current session')
102
+ throw new Error(`${RUNTIME_TOOL_NAMES.RETRIEVE}: a compression reference may only read the caller's current session`)
101
103
  }
102
104
  if (tailTrimRef !== null) {
103
105
  const sessionId = String(exec.agent.session.id)
@@ -133,7 +135,7 @@ export function installContextCompressionRetrieve(ctx: Context, config: Config =
133
135
  const seq = Number(match?.[2])
134
136
  const event = sessionEvents(exec.agent.session)[seq]
135
137
  if (event?.type !== 'tool/result') {
136
- throw new Error(`context_compression_retrieve: event ${String(seq)} is not a tool/result in the current session`)
138
+ throw new Error(`${RUNTIME_TOOL_NAMES.RETRIEVE}: event ${String(seq)} is not a tool/result in the current session`)
137
139
  }
138
140
  const maxLines = resolveMaxLines(args.max_lines)
139
141
  // Generation-gated triple view: content blocks / error flag / call id
@@ -145,7 +147,7 @@ export function installContextCompressionRetrieve(ctx: Context, config: Config =
145
147
  const query = args.query
146
148
  if (query !== undefined && exceedsCodePointLimit(query, maxQueryChars)) {
147
149
  throw new Error(
148
- `context_compression_retrieve: query must be at most ${String(maxQueryChars)} Unicode code points`,
150
+ `${RUNTIME_TOOL_NAMES.RETRIEVE}: query must be at most ${String(maxQueryChars)} Unicode code points`,
149
151
  )
150
152
  }
151
153
  const selected = query === undefined || query === ''
@@ -202,11 +204,11 @@ function recoverTailTrim(
202
204
  ): string {
203
205
  const published = validatePublishedTailTrim(session, manifestSeq)
204
206
  if (published === null || published.ref !== ref) {
205
- throw new Error('context_compression_retrieve: ref is not a valid published TailTrim group')
207
+ throw new Error(`${RUNTIME_TOOL_NAMES.RETRIEVE}: ref is not a valid published TailTrim group`)
206
208
  }
207
209
  if (query !== undefined && exceedsCodePointLimit(query, bounds.maxQueryChars)) {
208
210
  throw new Error(
209
- `context_compression_retrieve: query must be at most ${String(bounds.maxQueryChars)} Unicode code points`,
211
+ `${RUNTIME_TOOL_NAMES.RETRIEVE}: query must be at most ${String(bounds.maxQueryChars)} Unicode code points`,
210
212
  )
211
213
  }
212
214
  const fixedHeader = [
@@ -272,7 +274,7 @@ function resolvePositiveInteger(name: string, value: number | undefined, fallbac
272
274
  function resolveMaxLines(value: number | undefined): number {
273
275
  const resolved = value ?? 200
274
276
  if (!Number.isSafeInteger(resolved) || resolved < 1 || resolved > MAX_LINES) {
275
- throw new Error(`context_compression_retrieve: max_lines must be an integer from 1 to ${String(MAX_LINES)}`)
277
+ throw new Error(`${RUNTIME_TOOL_NAMES.RETRIEVE}: max_lines must be an integer from 1 to ${String(MAX_LINES)}`)
276
278
  }
277
279
  return resolved
278
280
  }
@@ -352,7 +354,7 @@ function* jsonTokens(value: unknown): Generator<string> {
352
354
  return
353
355
  }
354
356
  default:
355
- throw new TypeError('context_compression_retrieve: source content is not JSON-serializable')
357
+ throw new TypeError(`${RUNTIME_TOOL_NAMES.RETRIEVE}: source content is not JSON-serializable`)
356
358
  }
357
359
  }
358
360
 
@@ -387,11 +389,11 @@ function directSlice(
387
389
  partialTail: boolean,
388
390
  ): Selection {
389
391
  if (!Number.isSafeInteger(startLine) || startLine < 1) {
390
- throw new Error('context_compression_retrieve: start_line must be a positive safe integer')
392
+ throw new Error(`${RUNTIME_TOOL_NAMES.RETRIEVE}: start_line must be a positive safe integer`)
391
393
  }
392
394
  if (startLine > lines.length) {
393
395
  const reason = scanComplete ? 'outside the source line range' : 'beyond the source scan limit'
394
- throw new Error(`context_compression_retrieve: start_line ${String(startLine)} is ${reason}`)
396
+ throw new Error(`${RUNTIME_TOOL_NAMES.RETRIEVE}: start_line ${String(startLine)} is ${reason}`)
395
397
  }
396
398
  const startIndex = startLine - 1
397
399
  const selected = lines.slice(startIndex, startIndex + maxLines)
@@ -6,6 +6,7 @@ import type { ContentBlock, UserMessage } from '@deepseek-ai/dsh-llm'
6
6
  import type { Session, SessionEvent } from '@deepseek-ai/dsh-session'
7
7
  import { sessionEvents } from './session-events.ts'
8
8
  import { compressionMessageSource, viewToolResult } from '../compat/tool-result.ts'
9
+ import { RUNTIME_TOOL_NAMES } from './tool-names.ts'
9
10
 
10
11
  const TAIL_TRIM_REF_PATTERN = /^session:\/\/([^/]+)\/tailtrim\/(\d+)$/
11
12
  const MAX_ROOTS = 64
@@ -48,7 +49,7 @@ export function tailTrimStub(
48
49
  `ref: ${ref}`,
49
50
  `tools: ${toolNames.join(', ')}`,
50
51
  `source_event_seqs: ${sourceEventSeqs.join(', ')}`,
51
- 'use context_compression_retrieve with this TailTrim ref if needed',
52
+ `use ${RUNTIME_TOOL_NAMES.RETRIEVE} with this TailTrim ref if needed`,
52
53
  ].join('\n')
53
54
  return Array.from(stub).length <= MAX_STUB_CODE_POINTS ? stub : null
54
55
  }
@@ -9,6 +9,7 @@
9
9
  */
10
10
  import { createHash } from 'node:crypto'
11
11
  import type { ContentBlock } from '@deepseek-ai/dsh-llm'
12
+ import { RUNTIME_TOOL_NAMES } from '../tool-names.ts'
12
13
 
13
14
  /** Canonicalization modes for content hashing. */
14
15
  export type DedupeNormalization = 'trim-eol' | 'exact'
@@ -76,6 +77,6 @@ export function dedupePlaceholder(entry: DedupeTableEntry, originalChars: number
76
77
  return [
77
78
  `[... identical to the earlier ${entry.toolName} result; first seen at ${entry.sourceRef};`,
78
79
  `original_chars=${String(originalChars)};`,
79
- 'retrieve with context_compression_retrieve({"ref":"' + entry.sourceRef + '","start_line":1}) if the omitted evidence is necessary.]',
80
+ `retrieve with ${RUNTIME_TOOL_NAMES.RETRIEVE}({"ref":"${entry.sourceRef}","start_line":1}) if the omitted evidence is necessary.]`,
80
81
  ].join(' ')
81
82
  }
@@ -10,6 +10,7 @@
10
10
  * skipped entirely when it would locate nothing concrete.
11
11
  */
12
12
  import type { SessionEvent } from '@deepseek-ai/dsh-session'
13
+ import { RUNTIME_TOOL_NAMES } from '../tool-names.ts'
13
14
 
14
15
  /** One resolved compaction transaction to annotate. */
15
16
  export interface CompactionTrace {
@@ -118,7 +119,7 @@ export function buildLocatorBlock(
118
119
  `- seq range: ${String(shadowedRange.start)}-${String(shadowedRange.end)}`,
119
120
  ...[...spillFiles].map(path => `- spill file: ${path}`),
120
121
  ...[...touchedFiles].map(path => `- file touched: ${path}`),
121
- '(Use `read <spill file>` or `context_compression_retrieve` with a `session://` source — pass start_line/max_lines to window the text — to restore exact text.)',
122
+ `(Use \`read <spill file>\` or \`${RUNTIME_TOOL_NAMES.RETRIEVE}\` with a \`session://\` source — pass start_line/max_lines to window the text — to restore exact text.)`,
122
123
  ]
123
124
  return {
124
125
  text: lines.join('\n'),
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Runtime tool names owned by this plugin, plus the code-mode calling-convention
3
+ * note. Every place that REGISTERS a tool and every place that JUDGES reachability
4
+ * or exemption must read the SAME constant. billion-context learned this the hard
5
+ * way (#3600 / #3884): a hard-coded omnibus / tool literal silently stopped
6
+ * matching after the host renamed its transport, which suppressed the whole
7
+ * compression surface without any error. Keeping one source prevents that class
8
+ * of silent split here.
9
+ */
10
+ export const RUNTIME_TOOL_NAMES = Object.freeze({
11
+ RETRIEVE: 'context_compression_retrieve',
12
+ } as const)
13
+
14
+ /** Every runtime tool this plugin registers and later judges against. */
15
+ export type RuntimeToolName = typeof RUNTIME_TOOL_NAMES[keyof typeof RUNTIME_TOOL_NAMES]
16
+
17
+ /**
18
+ * Code-mode "omnibus" tools a host may fold every tool use into. DOCUMENTATION
19
+ * ONLY: reachability is decided from the tool registry (`tools.get(name)`), which
20
+ * is the truth — these names exist solely so the retrieval guidance can mention
21
+ * the common omnibus tools without re-hard-coding them at the prompt site.
22
+ */
23
+ export const CODE_MODE_OMNIBUS_TOOL_NAMES = Object.freeze(['run_code', 'code_run'] as const)
24
+
25
+ /**
26
+ * Calling-convention note appended to the retrieval tool description. In a
27
+ * standard (direct tool-call) preset the model calls the tool directly; when the
28
+ * harness folds tool use into an omnibus program (run_code / code_run) the same
29
+ * tool is reached through the program's SDK. Naming both keeps one static
30
+ * description correct on every preset, since CCI registers a single tool and
31
+ * cannot branch its description per preset.
32
+ */
33
+ export const PTC_BINDING_NOTE =
34
+ `Call it directly as a tool when the environment allows direct tool calls; `
35
+ + `if this environment routes all tool use through a program (${CODE_MODE_OMNIBUS_TOOL_NAMES.join(' / ')}), `
36
+ + `call it from inside that program via the tool SDK instead of emitting a standalone call.`
@@ -9,6 +9,7 @@ export const COMPRESSION_PROFILES = [
9
9
  'savings',
10
10
  'adaptive',
11
11
  'tokenpilot-inspired',
12
+ 'ptc',
12
13
  'custom',
13
14
  ] as const
14
15
 
@@ -182,6 +183,8 @@ export interface ContextCompressionSettings {
182
183
  profile: CompressionProfile
183
184
  /** Versioned Custom policy snapped with `profile` for a newly observed Session. */
184
185
  custom: CustomCompressionPolicy
186
+ /** PTC profile's own editable policy, seeded from the ptc defaults and independent of `custom`. Optional like `monitorPanel`/`presetOptions`: schema-defaulted, always present after parse. */
187
+ ptcCustom?: CustomCompressionPolicy
185
188
  /** Auto Compact trigger preference snapped with `profile` for a newly observed Session. */
186
189
  autoCompact: AutoCompactSettings
187
190
  /** Code-skeleton reducer gate snapped independently of `profile`. */
@@ -197,7 +197,7 @@ function chooseOff(): void {
197
197
  describe('context compression profiles', () => {
198
198
  it('exposes Custom after the established profiles', () => {
199
199
  expect(COMPRESSION_PROFILES).toEqual([
200
- 'off', 'native', 'balanced', 'cache-strict', 'savings', 'adaptive', 'tokenpilot-inspired', 'custom',
200
+ 'off', 'native', 'balanced', 'cache-strict', 'savings', 'adaptive', 'tokenpilot-inspired', 'ptc', 'custom',
201
201
  ])
202
202
  })
203
203
 
@@ -231,7 +231,7 @@ describe('context compression profiles', () => {
231
231
  const button = screen.getByRole('button', { name: /Context compression/ })
232
232
  expect((button as HTMLButtonElement).disabled).toBe(false)
233
233
  fireEvent.click(button)
234
- expect(screen.getAllByRole('menuitem')).toHaveLength(8)
234
+ expect(screen.getAllByRole('menuitem')).toHaveLength(9)
235
235
  })
236
236
 
237
237
  it.each([false, undefined])(
@@ -272,14 +272,14 @@ describe('context compression profiles', () => {
272
272
  it('does not require a preset switch when capability refresh is delayed', async () => {
273
273
  const { sessions } = mount(vi.fn(() => Promise.resolve()), true)
274
274
  fireEvent.click(screen.getByRole('button', { name: /Context compression/ }))
275
- expect(screen.getAllByRole('menuitem')).toHaveLength(8)
275
+ expect(screen.getAllByRole('menuitem')).toHaveLength(9)
276
276
 
277
277
  sessions.update((draft) => {
278
278
  const current = draft.byId.s1
279
279
  if (current !== undefined) current.contextCompressionAvailable = false
280
280
  })
281
281
 
282
- await waitFor(() => { expect(screen.getAllByRole('menuitem')).toHaveLength(8) })
282
+ await waitFor(() => { expect(screen.getAllByRole('menuitem')).toHaveLength(9) })
283
283
  expect(screen.getByRole<HTMLButtonElement>('button', { name: /Context compression/ }).disabled).toBe(false)
284
284
  })
285
285
 
@@ -0,0 +1,86 @@
1
+ // @vitest-environment jsdom
2
+
3
+ import { describe, expect, it, vi } from 'vitest'
4
+ import {
5
+ DEFAULT_CUSTOM_COMPRESSION_POLICY,
6
+ DEFAULT_PTC_COMPRESSION_POLICY,
7
+ type ContextCompressionSettings,
8
+ } from '../src/profiles.ts'
9
+ import { apply } from '../src/client/index.ts'
10
+ import type { CompressionSelectorInjected } from '../src/client/CompressionProfileSelector.tsx'
11
+
12
+ /**
13
+ * PTC writes only touch `ptcCustom`: the scope commits the whole settings
14
+ * document with the single field replaced, so `custom` / `tokenpilot-inspired`
15
+ * policies are never collateral damage.
16
+ */
17
+ describe('ptcCustom write isolation', () => {
18
+ it('writes only ptcCustom and leaves custom untouched', async () => {
19
+ const originalCustom = structuredClone(DEFAULT_CUSTOM_COMPRESSION_POLICY)
20
+ const originalPtc = structuredClone(DEFAULT_PTC_COMPRESSION_POLICY)
21
+ let revision = 1
22
+ let value: ContextCompressionSettings = {
23
+ profile: 'ptc',
24
+ custom: originalCustom,
25
+ ptcCustom: originalPtc,
26
+ autoCompact: { thresholdPercent: 80 },
27
+ codeSkeleton: { enabled: false },
28
+ intentSummary: { enabled: false },
29
+ }
30
+ const form = {
31
+ getSnapshot: () => ({
32
+ status: 'ready' as const,
33
+ value: { settings: value },
34
+ base: undefined,
35
+ user: undefined,
36
+ revision,
37
+ writable: true,
38
+ mode: 'host' as const,
39
+ }),
40
+ subscribe: () => () => {},
41
+ set: vi.fn(async (_field: string, next: unknown) => {
42
+ revision += 1
43
+ value = structuredClone(next) as ContextCompressionSettings
44
+ return true
45
+ }),
46
+ unset: vi.fn(async () => false),
47
+ }
48
+ let injected: (() => CompressionSelectorInjected) | undefined
49
+ const ctx = {
50
+ effect: (install: () => unknown) => { install() },
51
+ locale: { register: vi.fn(() => () => {}) },
52
+ configForms: { get: vi.fn(() => form) },
53
+ inject: (services: string[], cb: (service: unknown) => void) => {
54
+ if (services.includes('configForms')) cb(ctx.configForms)
55
+ },
56
+ slots: {
57
+ inject: (_slot: string, install: () => unknown) => { install() },
58
+ register: (registration: { name?: string, inject?: () => CompressionSelectorInjected }) => {
59
+ if (registration.name === 'settings.section' && typeof registration.inject === 'function') injected = registration.inject
60
+ return () => {}
61
+ },
62
+ },
63
+ } as unknown as Parameters<typeof apply>[0]
64
+
65
+ apply(ctx)
66
+ const actions = injected?.()
67
+ expect(actions).toBeDefined()
68
+ if (actions === undefined) throw new Error('selector injection was not registered')
69
+
70
+ const editedPtc = {
71
+ ...structuredClone(DEFAULT_PTC_COMPRESSION_POLICY),
72
+ history: { ...structuredClone(DEFAULT_PTC_COMPRESSION_POLICY).history, trigger: 18_000 },
73
+ }
74
+ await expect(actions.savePtcCustom(editedPtc)).resolves.toBeUndefined()
75
+ expect(form.set).toHaveBeenLastCalledWith('settings', expect.objectContaining({
76
+ ptcCustom: expect.objectContaining({ history: expect.objectContaining({ trigger: 18_000 }) }),
77
+ }))
78
+ expect(value.ptcCustom?.history.trigger).toBe(18_000)
79
+ // custom must be byte-identical to its pre-write value.
80
+ expect(value.custom).toEqual(originalCustom)
81
+
82
+ await expect(actions.resetPtcCustom()).resolves.toBeUndefined()
83
+ expect(value.ptcCustom).toEqual(DEFAULT_PTC_COMPRESSION_POLICY)
84
+ expect(value.custom).toEqual(originalCustom)
85
+ })
86
+ })
@@ -0,0 +1,133 @@
1
+ /** PTC profile: absolute watermarks, independent `ptcCustom`, and isolation. */
2
+
3
+ import { describe, expect, it } from 'vitest'
4
+ import {
5
+ DEFAULT_CUSTOM_COMPRESSION_POLICY,
6
+ parseContextCompressionSettings,
7
+ resolveConfig,
8
+ resolvePolicy,
9
+ } from '../../src/pruner.ts'
10
+ import { DEFAULT_PTC_COMPRESSION_POLICY } from '../../src/runtime/custom-policy.ts'
11
+ import { decodeSettings as browserDecodeSettings } from '../../src/client/decode.ts'
12
+
13
+ const OPTIONS = { contextWindowTokens: 1_000_000, autoCompactThresholdPercent: 80 } as const
14
+
15
+ describe('ptc profile resolution', () => {
16
+ it('resolves the absolute PTC watermarks with no window linkage', () => {
17
+ const policy = resolvePolicy(resolveConfig(), 'ptc', undefined, OPTIONS)
18
+ expect(policy.profile).toBe('ptc')
19
+ expect(policy.historyMode).toBe('routine')
20
+ expect(policy.freshTriggerTokens).toBe(4_096)
21
+ expect(policy.freshTargetTokens).toBe(1_536)
22
+ expect(policy.aggregateTriggerTokens).toBe(16_384)
23
+ expect(policy.aggregateTargetTokens).toBe(4_096)
24
+ expect(policy.historyTriggerTokens).toBe(20_000)
25
+ expect(policy.historyKeepRecentToolCalls).toBe(8)
26
+ expect(policy.historyKeepRecentTokens).toBe(8_000)
27
+ expect(policy.historyMinReclaimTokens).toBe(6_000)
28
+ expect(policy.autoCompactTokens).toBeUndefined()
29
+ expect(policy.microDeadlineTokens).toBeUndefined()
30
+ })
31
+
32
+ it('keeps the same absolute watermarks across context windows', () => {
33
+ for (const contextWindowTokens of [200_000, 1_000_000, 8_000_000]) {
34
+ const policy = resolvePolicy(resolveConfig(), 'ptc', undefined, {
35
+ contextWindowTokens,
36
+ autoCompactThresholdPercent: 80,
37
+ })
38
+ expect(policy.historyTriggerTokens, String(contextWindowTokens)).toBe(20_000)
39
+ expect(policy.historyKeepRecentTokens, String(contextWindowTokens)).toBe(8_000)
40
+ expect(policy.autoCompactTokens).toBeUndefined()
41
+ }
42
+ })
43
+
44
+ it('falls back to the PTC default when the fifth argument is omitted', () => {
45
+ expect(resolvePolicy(resolveConfig(), 'ptc').historyTriggerTokens).toBe(20_000)
46
+ })
47
+
48
+ it('uses an explicit ptcCustom document', () => {
49
+ const ptcCustom = {
50
+ ...structuredClone(DEFAULT_PTC_COMPRESSION_POLICY),
51
+ history: { ...structuredClone(DEFAULT_PTC_COMPRESSION_POLICY).history, trigger: 12_345 },
52
+ }
53
+ const policy = resolvePolicy(resolveConfig(), 'ptc', undefined, OPTIONS, ptcCustom)
54
+ expect(policy.historyTriggerTokens).toBe(12_345)
55
+ })
56
+
57
+ it('keeps deployment-config overrides ahead of the ptcCustom document', () => {
58
+ const config = resolveConfig({ historyTriggerTokens: 9_999, freshTriggerTokens: 2_048, freshTargetTokens: 1_024 })
59
+ const policy = resolvePolicy(config, 'ptc', undefined, OPTIONS)
60
+ expect(policy.historyTriggerTokens).toBe(9_999)
61
+ expect(policy.freshTriggerTokens).toBe(2_048)
62
+ })
63
+
64
+ it('rejects a read input cap that would silence the fresh path', () => {
65
+ const config = resolveConfig({ readInputCapChars: 10_000 })
66
+ expect(() => resolvePolicy(config, 'ptc', undefined, OPTIONS))
67
+ .toThrow(/read input cap/u)
68
+ })
69
+ })
70
+
71
+ describe('ptc isolation from custom and tokenpilot', () => {
72
+ it('does not change the custom or tokenpilot policies', () => {
73
+ const custom = resolvePolicy(resolveConfig(), 'custom', structuredClone(DEFAULT_CUSTOM_COMPRESSION_POLICY), OPTIONS)
74
+ expect(custom.historyTriggerTokens).toBe(500_000)
75
+ const tokenpilot = resolvePolicy(resolveConfig(), 'tokenpilot-inspired', structuredClone(DEFAULT_CUSTOM_COMPRESSION_POLICY), OPTIONS)
76
+ expect(tokenpilot.historyTriggerTokens).toBe(500_000)
77
+ const ptc = resolvePolicy(resolveConfig(), 'ptc', structuredClone(DEFAULT_CUSTOM_COMPRESSION_POLICY), OPTIONS)
78
+ expect(ptc.historyTriggerTokens).toBe(20_000)
79
+ })
80
+
81
+ it('derives ptc from ptcCustom, never from the shared custom document', () => {
82
+ const editedCustom = {
83
+ ...structuredClone(DEFAULT_CUSTOM_COMPRESSION_POLICY),
84
+ history: { ...structuredClone(DEFAULT_CUSTOM_COMPRESSION_POLICY).history, trigger: 777_777 },
85
+ }
86
+ // Editing `custom` alone must not move ptc's defaults.
87
+ const ptcDefault = resolvePolicy(resolveConfig(), 'ptc', editedCustom, OPTIONS)
88
+ expect(ptcDefault.historyTriggerTokens).toBe(20_000)
89
+ // Editing `ptcCustom` alone must not move custom.
90
+ const editedPtc = {
91
+ ...structuredClone(DEFAULT_PTC_COMPRESSION_POLICY),
92
+ history: { ...structuredClone(DEFAULT_PTC_COMPRESSION_POLICY).history, trigger: 31_337 },
93
+ }
94
+ const customStillDefault = resolvePolicy(resolveConfig(), 'custom', editedCustom, OPTIONS)
95
+ expect(customStillDefault.historyTriggerTokens).toBe(777_777)
96
+ expect(resolvePolicy(resolveConfig(), 'ptc', undefined, OPTIONS, editedPtc).historyTriggerTokens).toBe(31_337)
97
+ })
98
+ })
99
+
100
+ describe('ptc settings document', () => {
101
+ it('defaults ptcCustom when absent and preserves it when present', () => {
102
+ const legacy = parseContextCompressionSettings({
103
+ profile: 'ptc',
104
+ custom: structuredClone(DEFAULT_CUSTOM_COMPRESSION_POLICY),
105
+ })
106
+ expect(legacy.ptcCustom).toEqual(DEFAULT_PTC_COMPRESSION_POLICY)
107
+
108
+ const explicit = {
109
+ ...structuredClone(DEFAULT_PTC_COMPRESSION_POLICY),
110
+ history: { ...structuredClone(DEFAULT_PTC_COMPRESSION_POLICY).history, trigger: 18_000 },
111
+ }
112
+ const parsed = parseContextCompressionSettings({
113
+ profile: 'ptc',
114
+ custom: structuredClone(DEFAULT_CUSTOM_COMPRESSION_POLICY),
115
+ ptcCustom: explicit,
116
+ })
117
+ expect(parsed.ptcCustom?.history.trigger).toBe(18_000)
118
+ })
119
+
120
+ it('keeps browser/runtime parity with and without ptcCustom', () => {
121
+ for (const document of [
122
+ { profile: 'ptc', custom: structuredClone(DEFAULT_CUSTOM_COMPRESSION_POLICY) },
123
+ {
124
+ profile: 'ptc',
125
+ custom: structuredClone(DEFAULT_CUSTOM_COMPRESSION_POLICY),
126
+ ptcCustom: structuredClone(DEFAULT_PTC_COMPRESSION_POLICY),
127
+ },
128
+ ]) {
129
+ expect(browserDecodeSettings(structuredClone(document)))
130
+ .toEqual(parseContextCompressionSettings(structuredClone(document)))
131
+ }
132
+ })
133
+ })
@@ -444,7 +444,7 @@ describe('standalone runtime on published Harness APIs', () => {
444
444
  it('tokenpilot-inspired lands a fresh replace on an UNAVAILABLE-tokenizer route (local Qwen)', async () => {
445
445
  const ctx = await runtimeContext()
446
446
  const audit = captureAudit(ctx)
447
- await ctx.plugin(ToolResultPruner, { profile: 'tokenpilot-inspired' }).await()
447
+ await ctx.plugin(ToolResultPruner, { profile: 'tokenpilot-inspired', freshTriggerTokens: 4_096, freshTargetTokens: 1_536 }).await()
448
448
  const session = Session.create(SessionId('public-tokenpilot-qwen-fresh'))
449
449
  // A ~40KB JSONL result — the exact shape the desktop test feeds. local-35 has
450
450
  // no bundled tokenizer, so every node count is 'unavailable' and the fresh
@@ -632,6 +632,20 @@ describe('standalone runtime on published Harness APIs', () => {
632
632
  expect(record?.tokensAfter).toBeLessThan(record?.tokensBefore ?? 0)
633
633
  })
634
634
 
635
+ it('lands PTC absolute-window history aging without per-session threshold overrides', async () => {
636
+ const ctx = await runtimeContext()
637
+ const session = Session.create(SessionId('public-ptc-absolute-history'))
638
+ for (let turn = 1; turn <= 10; turn += 1) {
639
+ appendToolTurn(session, turn, `ptc absolute evidence ${String(turn)} `.repeat(1_000), true)
640
+ }
641
+ session.append('turn/start', { turn: 11 })
642
+ await ctx.plugin(ToolResultPruner, { profile: 'ptc' }).await()
643
+ const result = ctx.toolResultPruner.pruneSession(session, { stage: 'pressure' })
644
+ expect(result.pruned.length).toBeGreaterThanOrEqual(1)
645
+ expect(result.pruned.every(entry => entry.stage === 'pressure')).toBe(true)
646
+ expect(result.tokensRemoved).toBeGreaterThan(0)
647
+ })
648
+
635
649
  it('moves the capacity-pressure gate with the frozen Auto Compact threshold', async () => {
636
650
  const ctx = await runtimeContext()
637
651
  await ctx.plugin(TestSettings).await()