mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 17:17:38 +00:00
* feat(runtime): remove an agent's downloaded runtime only once nothing on the host can still run it
managedRuntime.remove {agent} (host-admin, capability managed-runtime.remove.v1)
deletes the agent's releases inside the launch gate. Before anything is deleted the
gate aborts starts under way (chat starts and conversation copies), stops the
agent's loaded chats on this host, and proves every retained child gone: failed
chat starts and sign-in children whose close was never proven. Every close settles
before the gate releases; if any owner stays unproven, Remove fails and keeps the
files. Stopping chats by agent is now one generic host helper that sign-in shares.
Install refuses while a removal runs, Remove refuses while an install runs, and a
removal cannot be cancelled.
* fix(runtime): status says whether a copy is there to remove, damaged copies included
canRemove is set whenever Orca's copy is present, whole or damaged, so Settings offers Remove for a
damaged copy too. The failed-start retain is dropped: the launch gate already holds every child it
admitted until it exits.
46 lines
1.8 KiB
TypeScript
46 lines
1.8 KiB
TypeScript
// A runtime Orca installs for an agent only when the person asks, as its host reports it.
|
|
|
|
// The host answers managedRuntime.subscribe, managedRuntime.install and managedRuntime.cancel.
|
|
export const MANAGED_RUNTIME_INSTALL_RUNTIME_CAPABILITY = 'managed-runtime.install.v1' as const
|
|
// Why separate: a host that installs may predate managedRuntime.remove.
|
|
export const MANAGED_RUNTIME_REMOVE_RUNTIME_CAPABILITY = 'managed-runtime.remove.v1' as const
|
|
|
|
export type ManagedRuntimeOperation = {
|
|
id: string
|
|
kind: 'install' | 'remove'
|
|
/** A Cancel ends in `cancelled`, or `succeeded` when the install had already committed. */
|
|
phase:
|
|
| 'downloading'
|
|
| 'extracting'
|
|
| 'verifying'
|
|
| 'removing'
|
|
| 'succeeded'
|
|
| 'failed'
|
|
| 'cancelled'
|
|
downloadedBytes: number
|
|
totalBytes: number | null
|
|
error?: string
|
|
}
|
|
|
|
export type ManagedRuntimeInstallState = {
|
|
agent: string
|
|
/** Rises with every change the host publishes, across operations. */
|
|
revision: number
|
|
/** The host has a pinned release; otherwise no Install is offered. */
|
|
available: boolean
|
|
version: string | null
|
|
/** The pinned release's download size; absent without one. */
|
|
downloadBytes?: number
|
|
installedVersion: string | null
|
|
/** False with an installed version: an update is available. */
|
|
installedCurrent: boolean
|
|
/** The pinned release's folder is there but not whole; Install repairs it. */
|
|
damaged?: boolean
|
|
/** Orca's copy is there to remove, whole or damaged; absent from a host without Remove. */
|
|
canRemove?: boolean
|
|
/** What a chat start runs now: Orca's release, a copy found outside it, or nothing. */
|
|
source: 'managed' | 'external' | null
|
|
/** The latest operation; an ended one stays readable until the next starts. */
|
|
operation: ManagedRuntimeOperation | null
|
|
}
|