/ services / compact / compactWarningState.ts
compactWarningState.ts
 1  import { createStore } from '../../state/store.js'
 2  
 3  /**
 4   * Tracks whether the "context left until autocompact" warning should be suppressed.
 5   * We suppress immediately after successful compaction since we don't have accurate
 6   * token counts until the next API response.
 7   */
 8  export const compactWarningStore = createStore<boolean>(false)
 9  
10  /** Suppress the compact warning. Call after successful compaction. */
11  export function suppressCompactWarning(): void {
12    compactWarningStore.setState(() => true)
13  }
14  
15  /** Clear the compact warning suppression. Called at start of new compact attempt. */
16  export function clearCompactWarningSuppression(): void {
17    compactWarningStore.setState(() => false)
18  }