peerAddress.ts
utils/peerAddress.ts
No strong subsystem tag
22
Lines
981
Bytes
1
Exports
0
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with general runtime concerns. It contains 22 lines, 0 detected imports, and 1 detected exports.
Important relationships
Detected exports
parseAddress
Keywords
schemetargetbridgestartswithaddressparseaddressintootherslicesenders
Detected imports
- No import paths detected.
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
/**
* Peer address parsing — kept separate from peerRegistry.ts so that
* SendMessageTool can import parseAddress without transitively loading
* the bridge (axios) and UDS (fs, net) modules at tool-enumeration time.
*/
/** Parse a URI-style address into scheme + target. */
export function parseAddress(to: string): {
scheme: 'uds' | 'bridge' | 'other'
target: string
} {
if (to.startsWith('uds:')) return { scheme: 'uds', target: to.slice(4) }
if (to.startsWith('bridge:')) return { scheme: 'bridge', target: to.slice(7) }
// Legacy: old-code UDS senders emit bare socket paths in from=; route them
// through the UDS branch so replies aren't silently dropped into teammate
// routing. (No bare-session-ID fallback — bridge messaging is new enough
// that no old senders exist, and the prefix would hijack teammate names
// like session_manager.)
if (to.startsWith('/')) return { scheme: 'uds', target: to }
return { scheme: 'other', target: to }
}