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.

3.4 KB
Raw Blame
import type {
  EnrichedDetectedPort,
  PortForwardEntry,
  UnrestoredPortForward,
  SshConfigHostListArgs,
  SshConfigHostListResult,
  SshConfigHostResolution,
  SshConfigImportResult,
  SshConnectionState,
  SshTarget,
  SshTargetAddResult,
  SshTargetCreateInput,
  SshTargetUpdateInput
} from '../../shared/ssh-types'
import type { FilesystemPathFlavor } from '../../shared/filesystem-entry-types'

export type SshApi = {
  listTargets: () => Promise<SshTarget[]>
  // Last known labels keyed by removed target ID, for workspaces still pinned to them.
  listRemovedTargetLabels: () => Promise<Record<string, string>>
  addTarget: (args: { target: SshTargetCreateInput }) => Promise<SshTargetAddResult>
  updateTarget: (args: { id: string; updates: SshTargetUpdateInput }) => Promise<SshTarget>
  removeTarget: (args: { id: string }) => Promise<void>
  importConfig: (args?: { reAdopt?: boolean }) => Promise<SshConfigImportResult>
  listConfigHosts: (args?: SshConfigHostListArgs) => Promise<SshConfigHostListResult>
  resolveConfigHost: (args: { alias: string }) => Promise<SshConfigHostResolution | null>
  /** `automatic`: a connect no user asked for; it never lifts a cancelled sign-in. */
  connect: (args: { targetId: string; automatic?: boolean }) => Promise<SshConnectionState | null>
  disconnect: (args: { targetId: string }) => Promise<void>
  getState: (args: { targetId: string }) => Promise<SshConnectionState | null>
  needsPassphrasePrompt: (args: { targetId: string }) => Promise<boolean>
  testConnection: (args: {
    targetId: string
  }) => Promise<{ success: boolean; error?: string; state?: SshConnectionState }>
  onStateChanged: (
    callback: (data: { targetId: string; state: SshConnectionState }) => void
  ) => () => void
  addPortForward: (args: {
    targetId: string
    localPort: number
    remoteHost: string
    remotePort: number
    label?: string
  }) => Promise<PortForwardEntry>
  updatePortForward: (args: {
    id: string
    targetId: string
    localPort: number
    remoteHost: string
    remotePort: number
    label?: string
  }) => Promise<PortForwardEntry>
  removePortForward: (args: { id: string }) => Promise<PortForwardEntry | null>
  listPortForwards: (args?: { targetId?: string }) => Promise<PortForwardEntry[]>
  listUnrestoredPortForwards: (args: { targetId: string }) => Promise<UnrestoredPortForward[]>
  removeSavedPortForward: (args: {
    targetId: string
    localPort: number
    remoteHost: string
    remotePort: number
  }) => Promise<void>
  listDetectedPorts: (args: { targetId: string }) => Promise<EnrichedDetectedPort[]>
  onPortForwardsChanged: (
    callback: (data: {
      targetId: string
      forwards: PortForwardEntry[]
      unrestored?: UnrestoredPortForward[]
    }) => void
  ) => () => void
  onDetectedPortsChanged: (
    callback: (data: { targetId: string; ports: EnrichedDetectedPort[] }) => void
  ) => () => void
  browseDir: (args: { targetId: string; dirPath: string }) => Promise<{
    entries: { name: string; isDirectory: boolean }[]
    resolvedPath: string
    pathFlavor: FilesystemPathFlavor
  }>
  onCredentialRequest: (
    callback: (data: {
      requestId: string
      targetId: string
      kind: 'passphrase' | 'password' | 'keyboard-interactive'
      detail: string
      echo?: boolean
    }) => void
  ) => () => void
  onCredentialResolved: (callback: (data: { requestId: string }) => void) => () => void
  submitCredential: (args: { requestId: string; value: string | null }) => Promise<void>
}