MCPcopy
hub / github.com/codeaashu/claude-code / flushPromptHistory

Function flushPromptHistory

src/history.ts:329–353  ·  view source on GitHub ↗
(retries: number)

Source from the content-addressed store, hash-verified

327}
328
329async function flushPromptHistory(retries: number): Promise<void> {
330 if (isWriting || pendingEntries.length === 0) {
331 return
332 }
333
334 // Stop trying to flush history until the next user prompt
335 if (retries > 5) {
336 return
337 }
338
339 isWriting = true
340
341 try {
342 await immediateFlushHistory()
343 } finally {
344 isWriting = false
345
346 if (pendingEntries.length > 0) {
347 // Avoid trying again in a hot loop
348 await sleep(500)
349
350 void flushPromptHistory(retries + 1)
351 }
352 }
353}
354
355async function addToPromptHistory(
356 command: HistoryEntry | string,

Callers 1

addToPromptHistoryFunction · 0.85

Calls 2

immediateFlushHistoryFunction · 0.85
sleepFunction · 0.50

Tested by

no test coverage detected