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

Function forwardMessagesToBridge

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

Source from the content-addressed store, hash-verified

1532 // recentPostedUUIDs) — the index cursor here is a pre-filter to avoid
1533 // O(n) re-scanning of already-sent messages on every call.
1534 function forwardMessagesToBridge(): void {
1535 if (!bridgeHandle) return
1536 // Guard against mutableMessages shrinking (compaction truncates it).
1537 const startIndex = Math.min(
1538 bridgeLastForwardedIndex,
1539 mutableMessages.length,
1540 )
1541 const newMessages = mutableMessages
1542 .slice(startIndex)
1543 .filter(m => m.type === 'user' || m.type === 'assistant')
1544 bridgeLastForwardedIndex = mutableMessages.length
1545 if (newMessages.length > 0) {
1546 bridgeHandle.writeMessages(newMessages)
1547 }
1548 }
1549
1550 // Helper to apply MCP server changes - used by both mcp_set_servers control message
1551 // and background plugin installation.

Callers 1

drainCommandQueueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected