Files
orcs-code/src/utils/peerAddress.ts
did:key:z6MkqDnb7Siv3Cwj7pGJq4T5EsUisECqR8KpnDLwcaZq5TPr d2542c9a62 asdf
Squash the current repository state back into one baseline commit while
preserving the README reframing and repository contents.

Constraint: User explicitly requested a single squashed commit with subject "asdf"
Confidence: high
Scope-risk: broad
Reversibility: clean
Directive: This commit intentionally rewrites published history; coordinate before future force-pushes
Tested: git status clean; local history rewritten to one commit; force-pushed main to origin and instructkr
Not-tested: Fresh clone verification after push
2026-03-31 03:34:03 -07:00

22 lines
981 B
TypeScript

/**
* 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 }
}