MCPcopy Create free account
hub / github.com/codeaashu/claude-code / forwardMessagesToBridge

Function forwardMessagesToBridge

src/cli/print.ts:1517–1531  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1515 // recentPostedUUIDs) — the index cursor here is a pre-filter to avoid
1516 // O(n) re-scanning of already-sent messages on every call.
1517 function forwardMessagesToBridge(): void {
1518 if (!bridgeHandle) return
1519 // Guard against mutableMessages shrinking (compaction truncates it).
1520 const startIndex = Math.min(
1521 bridgeLastForwardedIndex,
1522 mutableMessages.length,
1523 )
1524 const newMessages = mutableMessages
1525 .slice(startIndex)
1526 .filter(m => m.type === 'user' || m.type === 'assistant')
1527 bridgeLastForwardedIndex = mutableMessages.length
1528 if (newMessages.length > 0) {
1529 bridgeHandle.writeMessages(newMessages)
1530 }
1531 }
1532
1533 // Helper to apply MCP server changes - used by both mcp_set_servers control message
1534 // and background plugin installation.

Callers 1

drainCommandQueueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected