gsd-pi 2.80.0-dev.0d763dc29 → 2.80.0-dev.2be7caf18

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 (119) hide show
  1. package/README.md +3 -2
  2. package/dist/resources/.managed-resources-content-hash +1 -1
  3. package/dist/resources/extensions/gsd/auto-prompts.js +13 -1
  4. package/dist/resources/extensions/gsd/auto.js +7 -2
  5. package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +27 -20
  6. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +21 -0
  7. package/dist/resources/extensions/gsd/prompts/parallel-research-slices.md +1 -1
  8. package/dist/resources/extensions/gsd/prompts/quick-task.md +1 -5
  9. package/dist/resources/extensions/gsd/prompts/validate-milestone.md +2 -2
  10. package/dist/resources/extensions/gsd/quick.js +34 -2
  11. package/dist/resources/extensions/gsd/tools/context-mode-tool-result.js +15 -0
  12. package/dist/resources/extensions/gsd/tools/exec-search-tool.js +5 -0
  13. package/dist/resources/extensions/gsd/tools/exec-tool.js +3 -15
  14. package/dist/resources/extensions/gsd/tools/resume-tool.js +5 -0
  15. package/dist/resources/extensions/gsd/unit-context-composer.js +12 -3
  16. package/dist/tsconfig.extensions.tsbuildinfo +1 -1
  17. package/dist/web/standalone/.next/BUILD_ID +1 -1
  18. package/dist/web/standalone/.next/app-path-routes-manifest.json +12 -12
  19. package/dist/web/standalone/.next/build-manifest.json +2 -2
  20. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  21. package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
  22. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  23. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  24. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  25. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  26. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  27. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  28. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  29. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  30. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  31. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  32. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  33. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  34. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  35. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  36. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  37. package/dist/web/standalone/.next/server/app/index.html +1 -1
  38. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  39. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  40. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  41. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  42. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  43. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  44. package/dist/web/standalone/.next/server/app-paths-manifest.json +12 -12
  45. package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
  46. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  47. package/dist/web/standalone/.next/server/pages/500.html +1 -1
  48. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  49. package/package.json +1 -1
  50. package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
  51. package/packages/mcp-server/dist/workflow-tools.js +22 -17
  52. package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
  53. package/packages/mcp-server/src/workflow-tools.test.ts +66 -0
  54. package/packages/mcp-server/src/workflow-tools.ts +30 -16
  55. package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
  56. package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  57. package/packages/pi-coding-agent/dist/core/agent-session.js +3 -0
  58. package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  59. package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts +11 -0
  60. package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
  61. package/packages/pi-coding-agent/dist/core/compaction/compaction.js +9 -0
  62. package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
  63. package/packages/pi-coding-agent/dist/core/compaction-threshold.test.d.ts +2 -0
  64. package/packages/pi-coding-agent/dist/core/compaction-threshold.test.d.ts.map +1 -0
  65. package/packages/pi-coding-agent/dist/core/compaction-threshold.test.js +103 -0
  66. package/packages/pi-coding-agent/dist/core/compaction-threshold.test.js.map +1 -0
  67. package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +1 -0
  68. package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
  69. package/packages/pi-coding-agent/dist/core/extensions/runner.js +3 -0
  70. package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
  71. package/packages/pi-coding-agent/dist/core/extensions/runner.test.js +2 -0
  72. package/packages/pi-coding-agent/dist/core/extensions/runner.test.js.map +1 -1
  73. package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +7 -0
  74. package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
  75. package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
  76. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +20 -0
  77. package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
  78. package/packages/pi-coding-agent/dist/core/settings-manager.js +25 -0
  79. package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
  80. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  81. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +3 -0
  82. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  83. package/packages/pi-coding-agent/src/core/agent-session.ts +3 -0
  84. package/packages/pi-coding-agent/src/core/compaction/compaction.ts +18 -0
  85. package/packages/pi-coding-agent/src/core/compaction-threshold.test.ts +121 -0
  86. package/packages/pi-coding-agent/src/core/extensions/runner.test.ts +2 -0
  87. package/packages/pi-coding-agent/src/core/extensions/runner.ts +3 -0
  88. package/packages/pi-coding-agent/src/core/extensions/types.ts +7 -0
  89. package/packages/pi-coding-agent/src/core/settings-manager.ts +39 -1
  90. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +3 -0
  91. package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
  92. package/packages/pi-tui/dist/tui.js +1 -1
  93. package/packages/pi-tui/dist/tui.js.map +1 -1
  94. package/packages/pi-tui/src/tui.ts +1 -1
  95. package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
  96. package/src/resources/extensions/gsd/auto-prompts.ts +17 -1
  97. package/src/resources/extensions/gsd/auto.ts +11 -2
  98. package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +27 -19
  99. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +22 -0
  100. package/src/resources/extensions/gsd/preferences-types.ts +1 -1
  101. package/src/resources/extensions/gsd/prompts/parallel-research-slices.md +1 -1
  102. package/src/resources/extensions/gsd/prompts/quick-task.md +1 -5
  103. package/src/resources/extensions/gsd/prompts/validate-milestone.md +2 -2
  104. package/src/resources/extensions/gsd/quick.ts +37 -2
  105. package/src/resources/extensions/gsd/tests/compaction-snapshot.test.ts +11 -0
  106. package/src/resources/extensions/gsd/tests/exec-history.test.ts +15 -0
  107. package/src/resources/extensions/gsd/tests/exec-sandbox.test.ts +65 -0
  108. package/src/resources/extensions/gsd/tests/prompt-path-audit.test.ts +40 -0
  109. package/src/resources/extensions/gsd/tests/quick-external-gsd.test.ts +40 -0
  110. package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +17 -0
  111. package/src/resources/extensions/gsd/tests/status-db-open.test.ts +9 -0
  112. package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +136 -4
  113. package/src/resources/extensions/gsd/tools/context-mode-tool-result.ts +25 -0
  114. package/src/resources/extensions/gsd/tools/exec-search-tool.ts +7 -7
  115. package/src/resources/extensions/gsd/tools/exec-tool.ts +4 -23
  116. package/src/resources/extensions/gsd/tools/resume-tool.ts +7 -7
  117. package/src/resources/extensions/gsd/unit-context-composer.ts +19 -4
  118. /package/dist/web/standalone/.next/static/{1J8mL3ANp9jqY3SU5BbVW → 3EDDd9ULaybSupPoA_vf-}/_buildManifest.js +0 -0
  119. /package/dist/web/standalone/.next/static/{1J8mL3ANp9jqY3SU5BbVW → 3EDDd9ULaybSupPoA_vf-}/_ssgManifest.js +0 -0
@@ -2211,6 +2211,9 @@ export class AgentSession {
2211
2211
  })();
2212
2212
  },
2213
2213
  getSystemPrompt: () => this.systemPrompt,
2214
+ setCompactionThresholdOverride: (percent) => {
2215
+ this.settingsManager.setCompactionThresholdOverride(percent);
2216
+ },
2214
2217
  },
2215
2218
  );
2216
2219
  }
@@ -86,6 +86,13 @@ export interface CompactionSettings {
86
86
  enabled: boolean;
87
87
  reserveTokens: number;
88
88
  keepRecentTokens: number;
89
+ /**
90
+ * Optional percent-of-context-window threshold (0 < value < 1). When set,
91
+ * `shouldCompact()` fires once `contextTokens > contextWindow * thresholdPercent`,
92
+ * overriding the absolute `reserveTokens` calculation. Lets host integrations
93
+ * (e.g. GSD) express compaction policy as a fraction independent of model size.
94
+ */
95
+ thresholdPercent?: number;
89
96
  }
90
97
 
91
98
  export const DEFAULT_COMPACTION_SETTINGS: CompactionSettings = {
@@ -185,9 +192,20 @@ export function estimateContextTokens(messages: AgentMessage[]): ContextUsageEst
185
192
 
186
193
  /**
187
194
  * Check if compaction should trigger based on context usage.
195
+ *
196
+ * When `thresholdPercent` is set (and within (0, 1)), it overrides the absolute
197
+ * `reserveTokens` calculation: compaction fires at `contextWindow * thresholdPercent`.
198
+ * Otherwise the legacy `contextWindow - reserveTokens` headroom is used.
188
199
  */
189
200
  export function shouldCompact(contextTokens: number, contextWindow: number, settings: CompactionSettings): boolean {
190
201
  if (!settings.enabled) return false;
202
+ if (
203
+ settings.thresholdPercent !== undefined &&
204
+ settings.thresholdPercent > 0 &&
205
+ settings.thresholdPercent < 1
206
+ ) {
207
+ return contextTokens > contextWindow * settings.thresholdPercent;
208
+ }
191
209
  return contextTokens > contextWindow - settings.reserveTokens;
192
210
  }
193
211
 
@@ -0,0 +1,121 @@
1
+ // pi-coding-agent / Regression tests for compaction threshold percent (#5475)
2
+
3
+ import assert from "node:assert/strict";
4
+ import { describe, it } from "node:test";
5
+
6
+ import { shouldCompact, type CompactionSettings } from "./compaction/compaction.js";
7
+ import { SettingsManager } from "./settings-manager.js";
8
+
9
+ const REGISTRY_DEFAULTS: CompactionSettings = {
10
+ enabled: true,
11
+ reserveTokens: 16_384,
12
+ keepRecentTokens: 20_000,
13
+ };
14
+
15
+ describe("shouldCompact — thresholdPercent (#5475)", () => {
16
+ it("uses absolute reserveTokens when thresholdPercent is unset (legacy behavior)", () => {
17
+ // 200K window, 16384 reserve → fires at 183_617 tokens
18
+ assert.equal(shouldCompact(183_616, 200_000, REGISTRY_DEFAULTS), false);
19
+ assert.equal(shouldCompact(183_617, 200_000, REGISTRY_DEFAULTS), true);
20
+ });
21
+
22
+ it("uses thresholdPercent when set, ignoring reserveTokens", () => {
23
+ const settings: CompactionSettings = { ...REGISTRY_DEFAULTS, thresholdPercent: 0.7 };
24
+ // 200K * 0.7 = 140_000 → fires above that
25
+ assert.equal(shouldCompact(140_000, 200_000, settings), false);
26
+ assert.equal(shouldCompact(140_001, 200_000, settings), true);
27
+ // reserveTokens-based math would have said false at 183_616 — the percent override changes that
28
+ assert.equal(shouldCompact(150_000, 200_000, settings), true);
29
+ });
30
+
31
+ it("falls back to reserveTokens when thresholdPercent is out of range", () => {
32
+ // Defense in depth: reject 0, 1, negative, NaN, Infinity
33
+ for (const bad of [0, 1, -0.1, 1.5, Number.NaN, Number.POSITIVE_INFINITY]) {
34
+ const settings: CompactionSettings = { ...REGISTRY_DEFAULTS, thresholdPercent: bad };
35
+ assert.equal(
36
+ shouldCompact(183_616, 200_000, settings),
37
+ false,
38
+ `bad=${bad} should fall back to reserveTokens math`,
39
+ );
40
+ assert.equal(shouldCompact(183_617, 200_000, settings), true, `bad=${bad}`);
41
+ }
42
+ });
43
+
44
+ it("respects enabled=false regardless of thresholdPercent", () => {
45
+ const settings: CompactionSettings = {
46
+ ...REGISTRY_DEFAULTS,
47
+ enabled: false,
48
+ thresholdPercent: 0.5,
49
+ };
50
+ assert.equal(shouldCompact(199_999, 200_000, settings), false);
51
+ });
52
+
53
+ it("scales with contextWindow — same percent, different windows", () => {
54
+ const settings: CompactionSettings = { ...REGISTRY_DEFAULTS, thresholdPercent: 0.8 };
55
+ // 100K window: fires above 80_000
56
+ assert.equal(shouldCompact(80_000, 100_000, settings), false);
57
+ assert.equal(shouldCompact(80_001, 100_000, settings), true);
58
+ // 1M window: fires above 800_000
59
+ assert.equal(shouldCompact(800_000, 1_000_000, settings), false);
60
+ assert.equal(shouldCompact(800_001, 1_000_000, settings), true);
61
+ });
62
+ });
63
+
64
+ describe("SettingsManager — compaction threshold override (#5475)", () => {
65
+ it("getCompactionThresholdPercent returns undefined by default", () => {
66
+ const sm = SettingsManager.inMemory({});
67
+ assert.equal(sm.getCompactionThresholdPercent(), undefined);
68
+ assert.equal(sm.getCompactionSettings().thresholdPercent, undefined);
69
+ });
70
+
71
+ it("setCompactionThresholdOverride applies in-memory and is exposed via getCompactionSettings", () => {
72
+ const sm = SettingsManager.inMemory({});
73
+ sm.setCompactionThresholdOverride(0.7);
74
+ assert.equal(sm.getCompactionThresholdPercent(), 0.7);
75
+ assert.equal(sm.getCompactionSettings().thresholdPercent, 0.7);
76
+ });
77
+
78
+ it("setCompactionThresholdOverride(undefined) clears a prior override", () => {
79
+ const sm = SettingsManager.inMemory({});
80
+ sm.setCompactionThresholdOverride(0.7);
81
+ sm.setCompactionThresholdOverride(undefined);
82
+ assert.equal(sm.getCompactionThresholdPercent(), undefined);
83
+ assert.equal(sm.getCompactionSettings().thresholdPercent, undefined);
84
+ });
85
+
86
+ it("setCompactionThresholdOverride preserves other compaction fields (enabled, reserveTokens)", () => {
87
+ const sm = SettingsManager.inMemory({
88
+ compaction: { enabled: true, reserveTokens: 30_000, keepRecentTokens: 25_000 },
89
+ });
90
+ sm.setCompactionThresholdOverride(0.6);
91
+ const settings = sm.getCompactionSettings();
92
+ assert.equal(settings.enabled, true);
93
+ assert.equal(settings.reserveTokens, 30_000);
94
+ assert.equal(settings.keepRecentTokens, 25_000);
95
+ assert.equal(settings.thresholdPercent, 0.6);
96
+ });
97
+
98
+ it("setCompactionThresholdOverride works when no compaction config exists yet", () => {
99
+ const sm = SettingsManager.inMemory({});
100
+ sm.setCompactionThresholdOverride(0.85);
101
+ assert.equal(sm.getCompactionThresholdPercent(), 0.85);
102
+ // Other compaction fields fall back to their defaults
103
+ const settings = sm.getCompactionSettings();
104
+ assert.equal(settings.enabled, true);
105
+ assert.equal(typeof settings.reserveTokens, "number");
106
+ assert.equal(typeof settings.keepRecentTokens, "number");
107
+ });
108
+ });
109
+
110
+ describe("end-to-end — getCompactionSettings + shouldCompact (#5475)", () => {
111
+ it("70% threshold on a 200K window fires at the documented bug-report value (140_001 not 183_617)", () => {
112
+ const sm = SettingsManager.inMemory({});
113
+ sm.setCompactionThresholdOverride(0.7);
114
+ const settings = sm.getCompactionSettings();
115
+
116
+ assert.equal(shouldCompact(140_000, 200_000, settings), false);
117
+ assert.equal(shouldCompact(140_001, 200_000, settings), true);
118
+ // Pre-fix behavior would have required 183_617 — verify we no longer wait that long
119
+ assert.equal(shouldCompact(150_000, 200_000, settings), true);
120
+ });
121
+ });
@@ -141,6 +141,7 @@ describe("ExtensionRunner.emitToolCall", () => {
141
141
  getContextUsage: () => undefined,
142
142
  compact: () => {},
143
143
  getSystemPrompt: () => "",
144
+ setCompactionThresholdOverride: () => {},
144
145
  });
145
146
 
146
147
  const errors: any[] = [];
@@ -220,6 +221,7 @@ describe("ExtensionRunner.createContext", () => {
220
221
  getContextUsage: () => undefined,
221
222
  compact: () => {},
222
223
  getSystemPrompt: () => "",
224
+ setCompactionThresholdOverride: () => {},
223
225
  });
224
226
 
225
227
  const errors: any[] = [];
@@ -235,6 +235,7 @@ export class ExtensionRunner {
235
235
  private getContextUsageFn: () => ContextUsage | undefined = () => undefined;
236
236
  private compactFn: (options?: CompactOptions) => void = () => {};
237
237
  private getSystemPromptFn: () => string = () => "";
238
+ private setCompactionThresholdOverrideFn: (percent: number | undefined) => void = () => {};
238
239
  private newSessionHandler: NewSessionHandler = async () => {
239
240
  throw new Error("Command context not yet bound: newSession is unavailable during early lifecycle");
240
241
  };
@@ -428,6 +429,7 @@ export class ExtensionRunner {
428
429
  this.getContextUsageFn = contextActions.getContextUsage;
429
430
  this.compactFn = contextActions.compact;
430
431
  this.getSystemPromptFn = contextActions.getSystemPrompt;
432
+ this.setCompactionThresholdOverrideFn = contextActions.setCompactionThresholdOverride;
431
433
 
432
434
  // Flush provider registrations queued during extension loading
433
435
  for (const { name, config } of this.runtime.pendingProviderRegistrations) {
@@ -714,6 +716,7 @@ export class ExtensionRunner {
714
716
  getContextUsage: () => this.getContextUsageFn(),
715
717
  compact: (options) => this.compactFn(options),
716
718
  getSystemPrompt: () => this.getSystemPromptFn(),
719
+ setCompactionThresholdOverride: (percent) => this.setCompactionThresholdOverrideFn(percent),
717
720
  };
718
721
  }
719
722
 
@@ -289,6 +289,12 @@ export interface ExtensionContext {
289
289
  compact(options?: CompactOptions): void;
290
290
  /** Get the current effective system prompt. */
291
291
  getSystemPrompt(): string;
292
+ /**
293
+ * Set or clear an in-memory compaction threshold-percent override (0 < value < 1).
294
+ * Pass `undefined` to clear. The override is not persisted; host integrations
295
+ * are expected to re-apply on each session_start.
296
+ */
297
+ setCompactionThresholdOverride(percent: number | undefined): void;
292
298
  }
293
299
 
294
300
  /**
@@ -1741,6 +1747,7 @@ export interface ExtensionContextActions {
1741
1747
  getContextUsage: () => ContextUsage | undefined;
1742
1748
  compact: (options?: CompactOptions) => void;
1743
1749
  getSystemPrompt: () => string;
1750
+ setCompactionThresholdOverride: (percent: number | undefined) => void;
1744
1751
  }
1745
1752
 
1746
1753
  /**
@@ -15,6 +15,13 @@ export interface CompactionSettings {
15
15
  enabled?: boolean; // default: true
16
16
  reserveTokens?: number; // default: 16384
17
17
  keepRecentTokens?: number; // default: 20000
18
+ /**
19
+ * Optional percent-of-context-window trigger (0 < value < 1). When set,
20
+ * compaction fires at `contextWindow * thresholdPercent` and overrides
21
+ * `reserveTokens`. Typically set as a runtime override by host integrations
22
+ * (see `setCompactionThresholdOverride`) and not persisted by users directly.
23
+ */
24
+ thresholdPercent?: number;
18
25
  }
19
26
 
20
27
  export interface BranchSummarySettings {
@@ -812,11 +819,42 @@ export class SettingsManager {
812
819
  return this.settings.compaction?.keepRecentTokens ?? COMPACTION_KEEP_RECENT_TOKENS;
813
820
  }
814
821
 
815
- getCompactionSettings(): { enabled: boolean; reserveTokens: number; keepRecentTokens: number } {
822
+ getCompactionThresholdPercent(): number | undefined {
823
+ return this.settings.compaction?.thresholdPercent;
824
+ }
825
+
826
+ /**
827
+ * Set or clear an in-memory compaction threshold-percent override.
828
+ *
829
+ * Applied to `this.settings` only; never persisted to disk. Pass `undefined`
830
+ * to clear a previously set override (necessary for idempotent re-sync from
831
+ * host integrations whose preference may have been removed).
832
+ *
833
+ * Direct mutation is used instead of `applyOverrides()` because deep-merge
834
+ * semantics skip `undefined` values, which would prevent clearing.
835
+ */
836
+ setCompactionThresholdOverride(percent: number | undefined): void {
837
+ if (!this.settings.compaction) {
838
+ this.settings.compaction = {};
839
+ }
840
+ if (percent === undefined) {
841
+ delete this.settings.compaction.thresholdPercent;
842
+ } else {
843
+ this.settings.compaction.thresholdPercent = percent;
844
+ }
845
+ }
846
+
847
+ getCompactionSettings(): {
848
+ enabled: boolean;
849
+ reserveTokens: number;
850
+ keepRecentTokens: number;
851
+ thresholdPercent?: number;
852
+ } {
816
853
  return {
817
854
  enabled: this.getCompactionEnabled(),
818
855
  reserveTokens: this.getCompactionReserveTokens(),
819
856
  keepRecentTokens: this.getCompactionKeepRecentTokens(),
857
+ thresholdPercent: this.getCompactionThresholdPercent(),
820
858
  };
821
859
  }
822
860
 
@@ -1378,6 +1378,9 @@ export class InteractiveMode {
1378
1378
  })();
1379
1379
  },
1380
1380
  getSystemPrompt: () => this.session.systemPrompt,
1381
+ setCompactionThresholdOverride: (percent) => {
1382
+ this.session.settingsManager.setCompactionThresholdOverride(percent);
1383
+ },
1381
1384
  });
1382
1385
 
1383
1386
  // Set up the extension shortcut handler on the default editor