mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
Home's team list leaves routine-run VMs out unless the new Routine runs switch is on. The switch is offered only when the team has routines, counts the running runs it hides, and is remembered per account. Hidden runs leave the workspace count but keep their sandbox hours in the total. Listed runs carry a routine mark and 'Routine · <name>'. Control plane: GET /v1/team/workspaces ?routines=include, plus fromRoutine/routineName per row and a routineRuns summary.
74 lines
3.3 KiB
TypeScript
74 lines
3.3 KiB
TypeScript
import type {
|
|
CloudWorkspace,
|
|
CloudWorkspaceGrant,
|
|
CloudWorkspaceListQuery,
|
|
CloudWorkspacePatch,
|
|
CloudWorkspaceRoutineRuns,
|
|
OrgPrompts
|
|
} from '../../shared/cloud-workspaces/cloud-workspaces-wire'
|
|
import type { CloudReadSnapshotState } from '../../shared/cloud-workspaces/read-snapshot-state'
|
|
|
|
export type CloudWorkspacesResult<T> =
|
|
| { ok: true; value: T }
|
|
| { ok: false; error: string; reason?: string; status?: number }
|
|
|
|
/** A list read, plus what Home's Routine runs switch hides (absent from older control planes). */
|
|
export type CloudWorkspaceListResult =
|
|
| { ok: true; value: CloudWorkspace[]; routineRuns?: CloudWorkspaceRoutineRuns }
|
|
| { ok: false; error: string; reason?: string; status?: number }
|
|
|
|
export type LocalCloudWorkspace = {
|
|
sandboxId: string
|
|
worktreeId: string | null
|
|
runtimeEnvironmentId: string | null
|
|
}
|
|
|
|
/** The runtime environment a granted workspace was added as, and the grant that paired it. */
|
|
export type CloudWorkspaceBinding = { environmentId: string; grantId: string | null }
|
|
|
|
export type CloudWorkspacesApi = {
|
|
/** False when this build has no Orca Cloud control plane configured. */
|
|
available: () => Promise<boolean>
|
|
list: (query: CloudWorkspaceListQuery) => Promise<CloudWorkspaceListResult>
|
|
get: (id: string) => Promise<CloudWorkspacesResult<CloudWorkspace>>
|
|
patch: (id: string, patch: CloudWorkspacePatch) => Promise<CloudWorkspacesResult<CloudWorkspace>>
|
|
resolveLink: (
|
|
workspaceId: string,
|
|
chatId?: string | null
|
|
) => Promise<CloudWorkspacesResult<{ workspace: CloudWorkspace; chatId: string | null }>>
|
|
/** A fresh per-device pairing link for a teammate's workspace (E2EE grant, opened in main). */
|
|
openGrant: (
|
|
id: string
|
|
) => Promise<CloudWorkspacesResult<{ grantId: string; pairingCode: string }>>
|
|
/** A sleeping workspace's sealed read snapshot, opened in main with this device's reader key. Never wakes it. */
|
|
readSnapshot: (id: string) => Promise<CloudWorkspacesResult<CloudReadSnapshotState>>
|
|
listGrants: (id: string) => Promise<CloudWorkspacesResult<CloudWorkspaceGrant[]>>
|
|
revokeGrant: (id: string, grantId: string) => Promise<CloudWorkspacesResult<void>>
|
|
localWorkspaces: () => Promise<LocalCloudWorkspace[]>
|
|
/** Owner or team admin, from the team list: sleep or delete a workspace this desktop doesn't run. */
|
|
sleep: (id: string) => Promise<CloudWorkspacesResult<void>>
|
|
destroy: (id: string) => Promise<CloudWorkspacesResult<void>>
|
|
/** "I just sent a message here" (opens my git-as-sender window on the control plane). */
|
|
noteSent: (id: string) => Promise<void>
|
|
/** Remembers which local runtime environment a granted workspace was added as. */
|
|
bindEnvironment: (
|
|
sandboxId: string,
|
|
runtimeEnvironmentId: string,
|
|
grantId?: string | null
|
|
) => Promise<void>
|
|
environmentBindings: () => Promise<Record<string, CloudWorkspaceBinding>>
|
|
setActive: (args: {
|
|
sandboxId: string | null
|
|
chatId?: string | null
|
|
typing?: boolean
|
|
leased?: boolean
|
|
}) => Promise<void>
|
|
getOrgPrompts: () => Promise<CloudWorkspacesResult<OrgPrompts>>
|
|
putOrgPrompts: (
|
|
document: OrgPrompts['document'],
|
|
revision: number
|
|
) => Promise<CloudWorkspacesResult<OrgPrompts>>
|
|
onOpenLink: (callback: (link: string) => void) => () => void
|
|
consumePendingLink: () => Promise<string | null>
|
|
}
|