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

Function writeSdkMessages

src/bridge/replBridge.ts:1814–1838  ·  view source on GitHub ↗
(messages)

Source from the content-addressed store, hash-verified

1812 void transport.writeBatch(events as StdoutMessage[])
1813 },
1814 writeSdkMessages(messages) {
1815 // Daemon path: query() already yields SDKMessage, skip conversion.
1816 // Still run echo dedup (server bounces writes back on the WS).
1817 // No initialMessageUUIDs filter — daemon has no initial messages.
1818 // No flushGate — daemon never starts it (no initial flush).
1819 const filtered = messages.filter(
1820 m => !m.uuid || !recentPostedUUIDs.has(m.uuid as string),
1821 )
1822 if (filtered.length === 0) return
1823 if (!transport) {
1824 logForDebugging(
1825 `[bridge:repl] Transport not configured, dropping ${filtered.length} SDK message(s) for session=${currentSessionId}`,
1826 { level: 'warn' },
1827 )
1828 return
1829 }
1830 for (const msg of filtered) {
1831 if (msg.uuid) recentPostedUUIDs.add(msg.uuid as string)
1832 }
1833 const events: TransportMessage[] = filtered.map(m => ({
1834 ...m,
1835 session_id: currentSessionId,
1836 })) as TransportMessage[]
1837 void transport.writeBatch(events as StdoutMessage[])
1838 },
1839 sendControlRequest(request: SDKControlRequest) {
1840 if (!transport) {
1841 logForDebugging(

Callers

nothing calls this directly

Calls 4

writeBatchMethod · 0.80
logForDebuggingFunction · 0.50
hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected