eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
50 lines (49 loc) • 2.77 kB
TypeScript
import { type GatewayCatalogModel } from "#shared/gateway-model-catalog.js";
import { type Asker, type SelectOption } from "../ask.js";
import type { SetupState } from "../state.js";
import type { SetupBox } from "../step.js";
export type { GatewayCatalogModel } from "#shared/gateway-model-catalog.js";
/** Fetches the raw AI Gateway catalog. The default for {@link SelectModelDeps}. */
export declare function fetchGatewayCatalog(signal?: AbortSignal): Promise<GatewayCatalogModel[]>;
export { parseGatewayModelCatalog as parseGatewayCatalog } from "#shared/gateway-model-catalog.js";
/**
* Builds picker options from a fetched catalog, keeping the default model and
* filtering the rest to language models with the `web-search` tag. The curated
* shortlist comes first in its own order, followed by the rest newest-first.
* Catalog entries on the shortlist are marked `featured`, so a searchable
* picker opens on just them and scrolling or filtering reaches the rest. Falls
* back to a static shortlist when the catalog is missing or yields nothing.
*/
export declare function modelOptionsFromCatalog(catalog: readonly GatewayCatalogModel[] | undefined): SelectOption<string>[];
/** Injected for tests; defaults to the real AI Gateway catalog fetch. */
export interface SelectModelDeps {
fetchModels: (signal?: AbortSignal) => Promise<GatewayCatalogModel[]>;
}
export interface SelectModelOptions {
/** Resolves the model question; the composed stack decides how. */
asker: Asker;
/**
* Resolve to this value without fetching the catalog or asking. Stays a
* factory option (not a `withAnswers` rung) because a preset must keep
* short-circuiting the catalog fetch and must keep accepting ids the
* filtered catalog does not list, exactly as the dual-face box did.
*/
presetModel?: string;
/**
* Pre-select this model in the picker so enter confirms it. Falls back to the
* top catalog entry when omitted or not present in the catalog.
*/
defaultModel?: string;
deps?: SelectModelDeps;
}
/**
* THE MODEL BOX: pick the default model baked into `agent/agent.ts`. The
* gather fetches the AI Gateway catalog and asks one required "model" select
* through the box's asker, so an interactive stack offers a searchable picker
* while a headless stack refuses structurally when no preset answered it.
* The model is the first thing the interview decides about the agent itself;
* how the credential is wired (gateway vs your own provider key) is the
* provisioning box's later decision, and the byok scaffold derives its
* provider block from whatever model was picked here.
*/
export declare function selectModel(options: SelectModelOptions): SetupBox<SetupState, string, string>;