/** * @license * Copyright 2026 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import type { RunEvent } from "../../run-events/RunEventTypes"; import type { WebInvocation } from "../argv"; import type { WebField } from "../commandFields"; import type { WebCommandNode } from "../commandTree"; import type { PanelData, WebStatusItem } from "../extensions"; export interface RunSummary { readonly id: string; readonly cli: string; readonly invocation: WebInvocation; readonly startedAt: number; readonly endedAt: number | undefined; readonly state: string; readonly exitCode: number | undefined; } /** * One liveness probe. * * Deliberately not routed through {@link api}: a probe must never throw for * the caller to interpret, and a bad token or a 500 answers the only question * being asked — something is serving, or nothing is. It carries its own * timeout because a half-open socket otherwise leaves the promise pending and * the page believing the last good answer forever. */ export declare function ping(timeoutMs: number): Promise<{ readonly ok: boolean; readonly startedAt?: number; }>; export declare function getCommands(): Promise<{ readonly commands: readonly WebCommandNode[]; readonly binaryName: string; }>; export declare function getFields(path: readonly string[], args: readonly string[]): Promise<{ readonly fields: readonly (WebField & { widget?: string; })[]; }>; /** * Asks a widget for its options, carrying the rest of the form with it. * * A picker is frequently only answerable in context — this CIK's accessions, * this kind's version ids — so the values travel as `v.` parameters and a * widget that ignores them behaves exactly as it did before. */ export declare function searchWidget(format: string, query: string, context?: { readonly path: readonly string[]; readonly args: readonly string[]; readonly values: Readonly>; }): Promise<{ readonly items: readonly { value: string; label: string; detail?: string; }[]; }>; export declare function getStatusWidgets(): Promise<{ readonly widgets: readonly { readonly id: string; readonly title: string; readonly source: string; readonly items: readonly WebStatusItem[]; }[]; }>; export declare function listRuns(): Promise<{ readonly runs: readonly RunSummary[]; }>; export declare function getRun(id: string): Promise; export declare function startRun(invocation: WebInvocation): Promise; export declare function abortRun(id: string): Promise<{ readonly aborted: boolean; }>; export declare function answerHuman(id: string, response: unknown): Promise<{ readonly delivered: boolean; }>; export declare function getPanels(id: string): Promise<{ readonly panels: readonly { id: string; title: string; source: string; data: PanelData; }[]; }>; /** * Subscribes to a run's stream, resuming after `afterSeq`. * * EventSource reconnects on its own and sends `Last-Event-ID`, so a laptop * waking up rejoins a run in flight rather than showing an empty console. The * token rides in the query because EventSource cannot set a header. */ export declare function openRunStream(id: string, afterSeq: number, onEvent: (seq: number, event: RunEvent) => void, onOpenChange?: (open: boolean) => void): () => void;