import type { HostNetwork } from "../host/host.js"; /** Posting a request to the server `agency local serve` runs. Every * caller goes through `postLocalJson`: the image provider, the vision * helpers, and the functions `agency-lang/local` exports. */ /** Where to send one request, and how its caller cancels it. * * baseUrl the server's address, such as `http://127.0.0.1:8080/v1`. * Absent: `client.baseUrl.mlx`, then `MLX_BASE_URL`, then the * default * signal aborting it ends the request with the `CANCELLED` failure */ export type LocalRequestOptions = { baseUrl?: string; signal?: AbortSignal; }; /** The server's reply as parsed JSON, or why there is none. */ export type LocalReply = { reply: Record; } | { error: string; }; /** The failure a caller gets when it aborts its own request. */ export declare const CANCELLED = "Cancelled"; /** Posts `body` as JSON to `route` on the local server and returns the * parsed reply. `serverNoun` is "image" or "vision", for the messages. A * reply that is not a success returns the server's own error message. * * A caller that aborts gets `CANCELLED`, whether the abort lands while * the request is waiting or while the reply's body is arriving. A request * that runs out of time keeps the timeout's own message. */ export declare function postLocalJson(network: HostNetwork, route: string, body: Record, timeoutMs: number, serverNoun: string, options?: LocalRequestOptions): Promise; /** `error`, or what to do about it when it means no server is running at * `baseUrl`. `serveCommand` is the command that starts one. */ export declare function explainNoServer(error: string, baseUrl: string, serveCommand: string): string;