Files
orca/src/preload/api/ephemeral-vm-api.ts
T
OrcaWinandm4air bcc50483bb fix(vm): a recipe VM's SSH root runs on a managed Orca server (#27366)
* fix(vm): a recipe VM's SSH root runs on a managed Orca server

A recipe VM's hidden SSH target was counted as owned by another runtime, so
every connect refused to deploy a managed server and fell back to the relay.
Its runtime owner only records when the VM is created and destroyed, so it no
longer blocks the deploy. The VM's workspace then lives on that server: the
server adopts the provisioned root as its main worktree, and removing the
project destroys the VM and forgets its server.

* fix(vm): release the server of a relay-era VM that converted on connect

* fix(vm): resume reconnects an SSH VM's server; removal stays on its own VM

* fix(vm): removal and the remove dialog find a VM's server before the catalog loads

* fix(vm): a catalog refresh failure never blocks a VM create

---------

Co-authored-by: m4air <m4air@Mac.localdomain>
2026-10-10 21:39:23 -07:00

77 lines
2.8 KiB
TypeScript

import type { OrcaHooks } from '../../shared/orca-yaml-hook-types'
import type { PublicKnownRuntimeEnvironment } from '../../shared/runtime-environments'
import type { EphemeralVmRecipeDoctorResult } from '../../shared/ephemeral-vm-recipes'
import type { EphemeralVmRecipeResultWarning } from '../../shared/ephemeral-vm-recipe-diagnostics'
import type { EphemeralVmRuntimeRecord } from '../../shared/ephemeral-vm-runtimes'
export type EphemeralVmApi = {
listRecipes: (args: { repoId: string }) => Promise<{
status: 'ok' | 'error'
repoPath: string | null
recipes: OrcaHooks['environmentRecipes']
diagnostics: NonNullable<OrcaHooks['environmentRecipeDiagnostics']>
message?: string
}>
listRecipeCatalog: () => Promise<
{
repoId: string
repoName: string
repoPath: string
recipes: NonNullable<OrcaHooks['environmentRecipes']>
diagnostics: NonNullable<OrcaHooks['environmentRecipeDiagnostics']>
}[]
>
doctor: (args: { repoId: string; recipeId: string }) => Promise<EphemeralVmRecipeDoctorResult>
provision: (args: {
repoId: string
recipeId: string
workspaceName?: string
projectId?: string
workspaceId?: string
branch?: string
ref?: string
provisionId?: string
}) => Promise<
| {
ok: true
connectionType: 'orca-server'
runtime: EphemeralVmRuntimeRecord
environment: PublicKnownRuntimeEnvironment
stderr: string
warnings: EphemeralVmRecipeResultWarning[]
}
| {
ok: true
connectionType: 'ssh'
runtime: EphemeralVmRuntimeRecord
sshTargetId: string
/** The managed Orca server the host runs; its workspace lives there. */
environmentId?: string
expectedRefHead?: string
stderr: string
warnings: EphemeralVmRecipeResultWarning[]
}
| { ok: false; error: string; stderr: string; stdout: string }
>
cancelProvision: (args: { provisionId: string }) => Promise<{ cancelled: boolean }>
onProvisionEvent: (
callback: (event: { provisionId: string; stream: 'stdout' | 'stderr'; chunk: string }) => void
) => () => void
listRuntimes: () => Promise<EphemeralVmRuntimeRecord[]>
attachWorkspace: (args: {
runtimeId: string
workspaceId: string
}) => Promise<EphemeralVmRuntimeRecord>
suspendWorkspace: (args: { workspaceId: string }) => Promise<EphemeralVmRuntimeRecord | null>
resumeWorkspace: (args: { workspaceId: string }) => Promise<EphemeralVmRuntimeRecord | null>
cleanup: (args: { runtimeId: string }) => Promise<EphemeralVmRuntimeRecord>
stopCleanup: (args: { runtimeId: string }) => Promise<EphemeralVmRuntimeRecord>
getCleanupCommand: (args: { runtimeId: string }) => Promise<{
runtimeId: string
command: string | null
payloadJson: string
cleanupDisabled: boolean
message?: string
}>
}