/** * Editing and declaring one `llm-pi-ai` route from a terminal. * * Two flows live here, both sequences of the same `promptSelect`/`promptText` * overlays every other Connect action already uses — there is no new overlay * type, because a menu that edits a few named fields does not need one. * {@link runRouteEditor} opens on a route the directory already lists; * {@link runCreateRoute} opens on an address `pi-ai.ts`'s * `piAiDeclarationTarget` already confirmed it can service, where no route * exists yet. Both build a draft in memory, let the reader fetch or type * model candidates through {@link editModels}, and commit through a single * revision-checked `settings.mutate` — never a wholesale replace, so a * sibling field this pass does not render survives untouched. Neither * persists anything before its final explicit action: {@link runCreateRoute} * in particular walks the whole draft through one review menu, so leaving a * submenu never mutates settings on its own. * * A route that serves no explicit `models` list inherits the installed * catalog, and there per-model edits are written as `modelOverrides.` * path ops — one model corrected, the other thirty-seven untouched. A route * whose profile DOES list models writes that whole array back with every * uncurated field (including `compat`) carried through. The two are never * written into one profile at once, because `llm-pi-ai` refuses an override * beside a list. * * A save that loses a revision race does not retry. {@link runRouteEditor} * keeps the draft on screen, re-reads the descriptor and the provider * directory, says plainly that the route changed elsewhere, and waits for a * second explicit Save before writing against the fresh revision. A route * deleted underneath the editor is never resurrected: the draft stays for * inspection and the reader is told to back out and add it again. * * Nothing here imports `@deepseek-ai/dsh-llm-pi-ai` or performs network I/O. * The one seam that touches an endpoint is `ctx.llm.discoverModels`, and its * result is candidates a reader chooses from, never a fact adopted automatically. * @module dshline/connect/route-editor */ import type { Context } from '@deepseek-ai/cordis'; import type { ConnectActionOutcome } from './actions.ts'; import type { ConnectSeams } from './harness.ts'; import type { ConnectNewRouteTarget, ConnectProviderRow } from './model.ts'; /** * Edit one route the directory already lists. * * The route menu and every submenu are side-effect free; a save is the only * write, and it is one revision-checked `settings.mutate`. A rejected write * never discards the draft: the cause is shown, the descriptor and directory * are re-read, and the reader must Save again — so a revision race is resolved * by a person, not by an automatic retry that could apply a stale intent. * @param ctx - context carrying the slot registry. * @param seams - the Harness seams. * @param row - the route being edited. * @param signal - the browser's lifetime, so this run's questions are withdrawn with it. * @returns what Harness answered, or undefined when the reader left without saving. */ export declare function runRouteEditor(ctx: Context, seams: ConnectSeams, row: ConnectProviderRow, signal?: AbortSignal): Promise; /** * Declare a brand-new route at an address a presentation module confirmed it * can service. * * Whether an API key is ever asked for depends on whether the schema still * names a `credential-ref` field for this route — read once, right after the * fresh descriptor comes back, and before any prompt runs. Its absence is a * legitimate state (an unauthenticated local server has to stay possible), so * the wizard omits the key step and its review row entirely rather than * asking a question it has nowhere to put the answer to. That is the * difference between "no key was offered" and "a typed key was quietly * dropped after a successful-looking write," and only the first is allowed to * happen. * @param ctx - context carrying the slot registry. * @param seams - the Harness seams. * @param target - where the new route's profile would be written. * @param signal - the browser's lifetime, so this run's questions are withdrawn with it. * @returns what Harness answered, or undefined when the reader backed out * before the final confirmation, having written nothing. */ export declare function runCreateRoute(ctx: Context, seams: ConnectSeams, target: ConnectNewRouteTarget, signal?: AbortSignal): Promise; //# sourceMappingURL=route-editor.d.ts.map