eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
46 lines (45 loc) • 2.1 kB
TypeScript
import { type Asker } from "../ask.js";
import type { SetupState } from "../state.js";
import type { SetupBox } from "../step.js";
/** One model entry from the AI Gateway catalog response. */
export interface GatewayCatalogModel {
id: string;
name: string;
type: string;
owned_by: string;
tags?: readonly string[];
}
/** Fetches the raw AI Gateway catalog. The default for {@link SelectModelDeps}. */
export declare function fetchGatewayCatalog(signal?: AbortSignal): Promise<GatewayCatalogModel[]>;
/** 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>;