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 message?: string }> listRecipeCatalog: () => Promise< { repoId: string repoName: string repoPath: string recipes: NonNullable diagnostics: NonNullable }[] > doctor: (args: { repoId: string; recipeId: string }) => Promise 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 attachWorkspace: (args: { runtimeId: string workspaceId: string }) => Promise suspendWorkspace: (args: { workspaceId: string }) => Promise resumeWorkspace: (args: { workspaceId: string }) => Promise cleanup: (args: { runtimeId: string }) => Promise stopCleanup: (args: { runtimeId: string }) => Promise getCleanupCommand: (args: { runtimeId: string }) => Promise<{ runtimeId: string command: string | null payloadJson: string cleanupDisabled: boolean message?: string }> }