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.3 KB
Raw Blame
import { RelayHostReachabilityLatch } from './relay-host-reachability-latch'
import { RelayPairingRejectionLatch } from './relay-pairing-rejection-latch'
import type { RelayHostReachability } from './relay-host-reachability'
import type { StableLogicalRpcClient } from './stable-logical-rpc-client'

export type RelayRecoveryReporter = Pick<
  StableLogicalRpcClient,
  'setRecoveryAttempt' | 'setPairingRejected' | 'setRelayHostReachability'
>

// Clear pairing rejection and host reachability together only after authenticated success on either path.
export class RelayRecoveryEvidence {
  private readonly pairingRejection = new RelayPairingRejectionLatch()
  private readonly hostReachability = new RelayHostReachabilityLatch()

  reportTo(
    logical: Pick<RelayRecoveryReporter, 'setPairingRejected' | 'setRelayHostReachability'>
  ): void {
    this.pairingRejection.reportTo(logical.setPairingRejected)
    this.hostReachability.reportTo(logical.setRelayHostReachability)
  }

  record(error: Error | null): void {
    this.pairingRejection.record(error)
    this.hostReachability.record(error)
  }

  assert(reachability: RelayHostReachability): void {
    this.hostReachability.assert(reachability)
  }

  clear(): void {
    this.pairingRejection.clear()
    this.hostReachability.clear()
  }
}