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.

566 B
Raw Blame
/** sun_path includes NUL: 108 bytes on Linux/Windows AF_UNIX, 104 on macOS/BSD. Measure UTF-8 bytes, not characters. */
const SUN_PATH_SIZE: Record<'linux' | 'darwin', number> = { linux: 108, darwin: 104 }

/** Longest socket path, in UTF-8 bytes, that fits `sun_path` beside its NUL. */
function unixSocketPathByteLimit(os: 'linux' | 'darwin'): number {
  return SUN_PATH_SIZE[os] - 1
}

export function unixSocketPathFits(socketPath: string, os: 'linux' | 'darwin'): boolean {
  return new TextEncoder().encode(socketPath).length <= unixSocketPathByteLimit(os)
}