feat(compact): add optional cancellation signal to the compact seam methods

This commit is contained in:
Hypatia May
2026-06-23 15:45:35 +08:00
parent bdaf9f651d
commit f4180bd764
4 changed files with 47 additions and 6 deletions

View File

@@ -351,8 +351,8 @@ Implementations MUST honor:
- **Blocking**: no compaction begins while another is in progress for the same session. The recommended mechanism is the log-recorded lock — append `compact/start` before the slow work and `compact/end` after (even on failure) — so the lock is visible to replay and crash recovery.
```ts cordis-catalog
abstract compactIfNeeded( session: Session, systemPrompt?: string, model?: string, ): Promise<CompactionResult | null>
abstract compactRegion( session: Session, start: number, end: number, model: string, ): Promise<CompactionResult>
abstract compactIfNeeded( session: Session, systemPrompt?: string, model?: string, signal?: AbortSignal, ): Promise<CompactionResult | null>
abstract compactRegion( session: Session, start: number, end: number, model: string, signal?: AbortSignal, ): Promise<CompactionResult>
```
Source: [`packages/compact/compact/src/index.ts:57`](../../packages/compact/compact/src/index.ts)