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.

800 B
Raw Blame
import { createContext, useContext } from 'react'
import type { HostStatusGates } from '../transport/host-status-gates'

// Apart from the gate screen so a workspace's client can read capabilities without its UI.
export const HostStatusGatesContext = createContext<HostStatusGates | null>(null)

/** The gates, or null outside a host route (a screen mounted on its own, as the recorder does). */
export function useOptionalHostProtocolGates(): HostStatusGates | null {
  return useContext(HostStatusGatesContext)
}

/** The gates of the host route this screen sits under. */
export function useHostProtocolGates(): HostStatusGates {
  const gates = useOptionalHostProtocolGates()
  if (!gates) {
    throw new Error('useHostProtocolGates must be used inside <HostProtocolGate>')
  }
  return gates
}