MCPcopy
hub / github.com/claude-code-best/claude-code / tryReactiveCompact

Function tryReactiveCompact

src/services/compact/reactiveCompact.ts:66–97  ·  view source on GitHub ↗
({
  hasAttempted,
  aborted,
  messages,
  cacheSafeParams,
})

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 3

compactConversationFunction · 0.85
logForDebuggingFunction · 0.50
logErrorFunction · 0.50

Tested by

no test coverage detected