import type { ChatRuntime, ModelOptions, ServeFlags, ServeKind } from "./localServe.js"; /** The `agency local serve` command line: which flags name a model, how * the per-model options written after a model are grouped with it, and * the one list of targets that `serveTargets` takes. */ /** One model to serve, and everything said about how to serve it. The * command line and `serve()` in `agency-lang/local` each build a list of * these, and `serveTargets` takes nothing else about a model. * * model the name, URI, or directory, as the caller wrote it * kind the kind a flag gave it. Absent: read it from the model * runtime the chat runtime a flag gave it. Absent: the kind's default * flag the flag that named it, for messages. Absent for a plain * argument * lazy load it on its first request, and stop it when another lazy * model needs the memory. Absent: load it at startup and keep * it loaded */ export type ServeTarget = { model: string; kind?: ServeKind; runtime?: ChatRuntime; flag?: string; lazy?: boolean; } & ModelOptions; /** The flags that name a model rather than set an option, so the model * after them is a target too. * * kind the kind the flag gives its model. Null: read it from the model */ export type NamingFlag = { flag: string; key: "embedding" | "speech" | "image" | "vlm" | "lazy"; kind: ServeKind | null; runtime: ChatRuntime | null; lazy: boolean; }; export declare const NAMING_FLAGS: NamingFlag[]; /** The flags on a command line that take a value, by spelling: "required" * when the next token is always the value, "optional" when it is the value * only if it does not start with `-`. A flag not listed takes no value, as * `--limit-answers` does. */ export type ValueFlags = Record; /** An option as commander declares it. Only the parts `valueFlagsOf` reads. */ type DeclaredOption = { long?: string; short?: string; required: boolean; optional: boolean; }; /** A command as commander declares it, with the commands above it. */ type DeclaredCommand = { options: readonly DeclaredOption[]; parent: DeclaredCommand | null; }; /** The flags that take a value on `command` and every command above it, * since commander accepts an ancestor's flag after the subcommand too. * Read from the declarations, so a new flag is known here the moment it * is declared. */ export declare function valueFlagsOf(command: DeclaredCommand): ValueFlags; /** The tokens after `local serve` on the command line, or none when the * command line is not `local serve`. Walks the operands the way commander * does, stepping over flags and their values, so a flag whose value * happens to be the word `serve` does not fool it. */ export declare function argvAfterServe(argv: string[], valueFlags: ValueFlags): string[]; /** Groups the arguments after `serve` into one entry per model, each with * the per-model options that followed it. `agency local serve a --draft d * b` drafts for `a` and not `b`. Any other flag belongs to the command as * a whole and is left for the option parser; `valueFlags` says whether it * takes the next token as its value, so `a --limit-answers b` is two * models. A parser, so its order is its nature; it holds nothing but what * it returns. */ export declare function groupServeArgv(argv: string[], valueFlags: ValueFlags): ServeTarget[]; /** The per-model options from grouped targets, keyed by model, for * `ServeFlags.options`. */ export declare function optionsByModel(targets: ServeTarget[]): Record; /** What one chat server is started with, beyond its model and port. */ /** The targets a parsed command line names: each plain argument, then each * model a naming flag listed, with that flag's kind and runtime and the * options written after the model. The one reader of `flags.options` and * of the per-flag lists. */ export declare function targetsFromFlags(values: string[], flags: ServeFlags): ServeTarget[]; export {};