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.

2.7 KB
Raw Blame
import type { FolderWorkspace } from '../folder-workspace-types'
import type { Repo } from '../repo-types'
import type { SavedPortForward, SshRemotePtyLease } from '../ssh-types'

export const ORCAD_MIGRATION_DEPENDENCY_KINDS = [
  'saved-port-forward',
  'terminal-lease',
  'terminal-recovery',
  'workspace-session',
  'worktree-metadata',
  'worktree-lineage',
  'workspace-lineage',
  'sparse-preset',
  'retired-worktree-name',
  'automation',
  'automation-run',
  'mobile-tab-selection',
  'ui-routing'
] as const

export type OrcadMigrationDependencyKind = (typeof ORCAD_MIGRATION_DEPENDENCY_KINDS)[number]

export type OrcadMigrationDependency = {
  kind: OrcadMigrationDependencyKind
  count: number
  /** A bounded sample of what holds the reference, so the user can find and clear it. */
  names?: string[]
}

export type OrcadMigrationRepository = Pick<Repo, 'id' | 'path' | 'displayName' | 'kind'>
export type OrcadMigrationFolderWorkspace = Pick<FolderWorkspace, 'id' | 'name' | 'folderPath'>
export type OrcadMigrationTerminalLease = Pick<
  SshRemotePtyLease,
  'ptyId' | 'worktreeId' | 'tabId' | 'leafId' | 'state' | 'updatedAt'
>

export type OrcadMigrationBlocker =
  | {
      code: 'orcad_migration_target_not_found'
      category: 'registration'
    }
  | {
      code: 'orcad_migration_target_owned'
      category: 'exclusive-ownership'
      holder:
        | { kind: 'runtime'; runtimeId: string }
        | { kind: 'managed-server'; environmentId: string }
    }
  | {
      /** Owned by the asking environment, but no durable record of why. */
      code: 'orcad_migration_owner_unrecorded'
      category: 'exclusive-ownership'
    }
  | {
      code: 'orcad_migration_direct_ssh_repositories'
      category: 'drainable-static-state'
      repositories: OrcadMigrationRepository[]
    }
  | {
      code: 'orcad_migration_direct_ssh_folder_workspaces'
      category: 'drainable-static-state'
      folderWorkspaces: OrcadMigrationFolderWorkspace[]
    }
  | {
      code: 'orcad_migration_direct_ssh_terminal_leases'
      category: 'live-or-unverifiable'
      terminalLeases: OrcadMigrationTerminalLease[]
    }
  | {
      code: 'orcad_migration_saved_port_forwards'
      category: 'client-owned-state'
      portForwards: SavedPortForward[]
    }
  | {
      code: 'orcad_migration_dependent_state'
      category: 'client-owned-state'
      dependencies: OrcadMigrationDependency[]
    }
  | {
      code: 'orcad_migration_dependency_unverifiable'
      category: 'live-or-unverifiable'
      sources: OrcadMigrationDependencyKind[]
    }

export type OrcadMigrationPreflight = {
  targetId: string
  targetLabel: string | null
  claimable: boolean
  blockers: OrcadMigrationBlocker[]
}