/** * `/connect`: configuring and authenticating Harness providers from a terminal. * * The division of labour is the same one the rest of this frontend follows, and * it is worth stating plainly because provider configuration is where a TUI is * most tempted to grow its own opinions. Harness owns the provider directory, * the settings document, the credential store, and every login flow. dshline * owns the rows, the keyboard, and where a sign-in URL lands. There is no * provider registry here, no OAuth implementation, and no `if (provider === * 'openai')`: a route reaches this browser because a mounted adapter declared * it configurable, and it is configured through the seam that owns it. * * That is also why a change made here shows up in the official web Models page * and the other way round. Both surfaces write the same settings namespace * through `ctx.settings` and the same reference through `ctx.credentials`; * neither has a store of its own to disagree from. The `_API_KEY` * derivation is shared for exactly this reason — a key stored from the terminal * has to be the reference the web page reads. * * `/model` is the other half of the pair and stays what it was: choosing among * models that already exist. `/connect` is how a model comes to exist. * @module dshline/connect */ import type { Context } from '@deepseek-ai/cordis'; import type { ConnectActionOutcome } from './actions.ts'; export type { ConnectCredentials, ConnectLlm, ConnectSeams, ConnectSettings, ConnectAuthorization, } from './harness.ts'; export { connectSeams } from './harness.ts'; export { ConnectCatalog, readRouteCredential, readRouteReadiness, watchAdapters } from './catalog.ts'; export type { ConnectCatalogSpec, ConnectRouteReadiness } from './catalog.ts'; export type { ConnectActionOutcome } from './actions.ts'; export { activateRoute, clearApiKey, deactivateRoute, forgetSignIn, setApiKey } from './actions.ts'; export { noticeLines, runAuthorization } from './authorize.ts'; export type { ConnectAction, ConnectActionId, ConnectCapabilities, ConnectProviderRow, ConnectReadiness, ConnectRow, ConnectRouteState, ConnectSignInRow, ConnectState, } from './model.ts'; export { connectSelectableCount, derivedCredentialRef, filterRows, matchesRow, noActionsReason, providerDetail, providerFacts, providerReadiness, readinessOf, rowActions, signInDetail, signInFacts, } from './model.ts'; export { createConnectOverlay } from './overlay.ts'; export type { ConnectOverlay, ConnectOverlaySpec } from './overlay.ts'; export { credentialRefFields, profileNode, valueAt } from './schema.ts'; export { piAiSignInRoute } from './pi-ai.ts'; export { offerRouteActivation } from './activation.ts'; export type { ActivationOfferSpec } from './activation.ts'; /** What opening the browser needs from the window it opens over. */ export interface ConnectSpec { /** Context carrying the harness seams and the slot registry. */ readonly ctx: Context; /** Write finished rows into the terminal's own scrollback. */ readonly commit: (lines: readonly string[]) => void; /** Text the browser's query box opens with, from `/connect `. */ readonly query?: string; /** Current time; injected so notice expiry is assertable. */ readonly now?: () => number; /** * Whether the gesture that opened the browser still has authority to run. * * `/connect` has two callers with different lifetimes: the guided first run, * which owns the window and outlives any attachment, and the `/setup` and * `/connect` commands an attachment owns. Only the second has an epoch to be * withdrawn with, so only the second passes controls — omitting them means * unfenced, which is what the first-run offer wants. */ readonly mayAct?: () => boolean; /** Withdraw the browser, and everything it started, when that epoch retires. */ readonly signal?: AbortSignal; } /** * Every configurable route, for completing `/connect`'s argument. * * The directory, not the registry: a route worth naming here is most often one * that is NOT live yet, which is exactly what `listProviders()` would omit. * @param ctx - context carrying the model registry. * @returns each route key beside the name its adapter chose. */ export declare function listConnectTargets(ctx: Context): readonly { value: string; note: string; }[]; /** * Show the Connect browser and stay until the reader closes it. * * Unlike the Sessions browser this resolves with nothing: every action it can * take has already been taken through the owning seam by the time it returns, * and none of them changes what the window is attached to. * @param spec - the context and where transcript rows go. * @returns when the browser is closed. */ export declare function openConnect(spec: ConnectSpec): Promise; /** * One outcome as a transcript row. * * Escaped as a whole before styling, which is the only order that works: * `escapeControls` neutralizes the escape character itself, so running it over * already-coloured text would destroy the colour. The message carries a * credential reference out of the settings document, a namespace name, and a * Harness error's own words — none of it written by this frontend. * @param outcome - what Harness answered. * @returns the single line to commit. */ export declare function outcomeLines(outcome: ConnectActionOutcome): string[]; //# sourceMappingURL=index.d.ts.map