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.

1.0 KB
Raw Blame
export type PtyFencedTerminationRequest = {
  id: string
  expectedIncarnationId: string
  requireNoAgentOwner: boolean
  requireUnattached: boolean
  switchCondition?: {
    token: string
    remainingMs: number
    ownedSpawn?: true
    claimGeneration?: string
  }
}

export type PtyFencedTerminationOutcome =
  | { outcome: 'ended' | 'already_exited' }
  | {
      outcome: 'refused'
      reason: 'replaced' | 'claimed' | 'attached' | 'unsupported' | 'unverifiable'
    }

export function isPtyFencedTerminationOutcome(
  value: unknown
): value is PtyFencedTerminationOutcome {
  if (!value || typeof value !== 'object' || !('outcome' in value)) {
    return false
  }
  if (value.outcome === 'ended' || value.outcome === 'already_exited') {
    return true
  }
  return (
    value.outcome === 'refused' &&
    'reason' in value &&
    (value.reason === 'replaced' ||
      value.reason === 'claimed' ||
      value.reason === 'attached' ||
      value.reason === 'unsupported' ||
      value.reason === 'unverifiable')
  )
}