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.

956 B
Raw Blame
import { scheduleHostCredentialCleanup } from './host-credential-cleanup'
import { removeMobileRelayHostRouting } from './mobile-relay-host-overlay-store'

export async function scheduleOrphanedMobileRelayCleanup(args: {
  hostIds: string[]
  deleteCredential: (hostId: string) => Promise<void>
  scheduleCleanup?: typeof scheduleHostCredentialCleanup
  removeOverlay?: typeof removeMobileRelayHostRouting
}): Promise<void> {
  const scheduleCleanup = args.scheduleCleanup ?? scheduleHostCredentialCleanup
  const removeOverlay = args.removeOverlay ?? removeMobileRelayHostRouting
  for (const hostId of new Set(args.hostIds)) {
    try {
      // Persist keychain cleanup intent before removing an overlay orphaned by an older build’s host removal.
      await scheduleCleanup(hostId, args.deleteCredential)
      await removeOverlay(hostId)
    } catch {
      // Retain the overlay pointer if durable cleanup intent could not be recorded.
    }
  }
}