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.

897 B
Raw Blame
/** Resolve the one tab introduced by the harness. Ambiguity would make the
 *  post-crash input oracle capable of targeting an unrelated restored tab. */
export function selectCreatedTabId(beforeTabIds, afterTabIds) {
  const before = new Set(beforeTabIds)
  const created = afterTabIds.filter((tabId) => !before.has(tabId))
  if (created.length !== 1) {
    throw new Error(`expected exactly one created terminal tab, found ${created.length}`)
  }
  return created[0]
}

/** The canary rejects a respawned shell; the PID additionally proves that input
 *  reached the exact survivor whose liveness was checked during the crash. */
export function reattachSentinelMatches(raw, expectedCanary, expectedShellPid) {
  const [pidPart, canaryPart, extraPart] = raw.trim().split('|')
  return (
    extraPart === undefined && canaryPart === expectedCanary && Number(pidPart) === expectedShellPid
  )
}