MCPcopy Create free account
hub / github.com/Noumena-Network/code / drainFlushGate

Function drainFlushGate

src/bridge/remoteBridgeCore.ts:594–609  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

592
593 // ── 8. History flush + drain helpers ────────────────────────────────────
594 function drainFlushGate(): void {
595 const msgs = flushGate.end()
596 if (msgs.length === 0) return
597 for (const msg of msgs) recentPostedUUIDs.add(msg.uuid)
598 const events = toSDKMessages(msgs).map(m => ({
599 ...m,
600 session_id: sessionId,
601 }))
602 if (msgs.some(m => m.type === 'user')) {
603 transport.reportState('running')
604 }
605 logForDebugging(
606 `[remote-bridge] Drained ${msgs.length} queued message(s) after flush`,
607 )
608 void transport.writeBatch(events)
609 }
610
611 async function flushHistory(msgs: Message[]): Promise<void> {
612 // v2 always creates a fresh server session (unconditional createCodeSession

Callers 2

wireTransportCallbacksFunction · 0.70
rebuildTransportFunction · 0.70

Calls 6

toSDKMessagesFunction · 0.85
reportStateMethod · 0.80
writeBatchMethod · 0.80
logForDebuggingFunction · 0.50
endMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected