Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

715 B
Raw Blame
import type { PairingCandidatePath } from './pairing-candidate-race'
import type { ConnectionLogSink } from './types'

const PATH_PREFIX: Record<PairingCandidatePath, string> = {
  direct: 'Direct: ',
  relay: 'Relay: '
}

// Attribute at the candidate seam so direct LAN diagnostics cannot look like relay retries when call sites omit path labels.
export function attributePairingLogPath(
  path: PairingCandidatePath,
  onLog: ConnectionLogSink | undefined
): ConnectionLogSink | undefined {
  if (!onLog) {
    return undefined
  }
  const prefix = PATH_PREFIX[path]
  return (entry) => {
    onLog(
      entry.message.startsWith(prefix) ? entry : { ...entry, message: `${prefix}${entry.message}` }
    )
  }
}