({
hasAttempted,
aborted,
messages,
cacheSafeParams,
})
| 64 | messages: Message[] |
| 65 | cacheSafeParams: Record<string, unknown> |
| 66 | }) => Promise<CompactionResult | null> = async ({ |
| 67 | hasAttempted, |
| 68 | aborted, |
| 69 | messages, |
| 70 | cacheSafeParams, |
| 71 | }) => { |
| 72 | if (hasAttempted || aborted) return null |
| 73 | const params = cacheSafeParams as unknown as CacheSafeParams |
| 74 | try { |
| 75 | const result = await compactConversation( |
| 76 | messages, |
| 77 | params.toolUseContext, |
| 78 | params, |
| 79 | true, |
| 80 | undefined, |
| 81 | true, |
| 82 | { |
| 83 | isRecompactionInChain: false, |
| 84 | turnsSincePreviousCompact: 0, |
| 85 | autoCompactThreshold: 0, |
| 86 | }, |
| 87 | ) |
| 88 | return result |
| 89 | } catch (error) { |
| 90 | logForDebugging( |
| 91 | `reactiveCompact: emergency compaction failed — ${String(error)}`, |
| 92 | { level: 'warn' }, |
| 93 | ) |
| 94 | logError(error) |
| 95 | return null |
| 96 | } |
| 97 | } |
nothing calls this directly
no test coverage detected