/** * The Connect browser: what Harness can be configured to talk to, and how. * * A bounded overlay, like Sessions, Work, and Todos. The committed transcript * under it is never rewritten, and closing it leaves the terminal exactly as it * was — which matters more here than elsewhere, because an authorization flow * commits its sign-in page and device code into that same scrollback while this * is open, and those are the two lines a person is about to select and copy. * * Two sections, deliberately not one list. `Provider routes` are what * configuration can activate, and what `/model` will offer once they are live. * `Sign-ins` are the flows Harness can run to obtain a credential. They are * related — signing in to a provider is usually why you then activate its route * — but Harness publishes no correlation between the two, so the browser shows * both and asserts nothing about which belongs to which. * @module dshline/connect/overlay */ import type { TuiOverlay } from '../slots.ts'; import type { ConnectRow, ConnectState } from './model.ts'; /** What the browser needs from its owner. */ export interface ConnectOverlaySpec { /** The current reading of Harness's provider configuration. */ readonly state: () => ConnectState; /** * Text the query box opens with. * * `/connect openai` narrows to that provider rather than acting on it: naming * a route says which one you mean, and what to DO with it is still a choice * between storing a key, activating it, and removing it. */ readonly query?: string; /** Re-read every surface. */ readonly refresh: () => void; /** * Act on one row. * * The owner runs the action — it owns the seams, the transcript, and the * prompts an action may raise — and hands back a sentence to show over the * list. The overlay stays mounted throughout, because a flow's own prompts * stack on top of it and the reader returns here when they settle. */ readonly act: (row: ConnectRow) => void; /** Current time, injected so notice expiry is assertable. */ readonly now: () => number; /** Remove this overlay from the live region. */ readonly close: () => void; /** Redraw after a move, an edit, or a landed read. */ readonly invalidate: () => void; } /** The Connect overlay, plus the one thing its owner pushes back into it. */ export interface ConnectOverlay extends TuiOverlay { /** * Show a result over the list. * @param text - the sentence to show. * @param failed - whether it reports a refusal. */ report(text: string, failed: boolean): void; } /** * Create the Connect browser overlay. * @param spec - the reading, the action authority, and overlay controls. * @returns a temporary live-region overlay that never writes the transcript. */ export declare function createConnectOverlay(spec: ConnectOverlaySpec): ConnectOverlay; //# sourceMappingURL=overlay.d.ts.map