import { C as Capabilities, B as BaseLLMAdapter, L as LLMProviderConfig, b as LLMCompletionRequest, c as LLMCompletionResponse, d as LLMStreamChunk } from '../base-adapter-BQZiL4zs.cjs'; /** * Vast.ai Serverless Adapter — the sovereign-serving DURABLE foundation. * * Unlike the raw-instance fleet path (`OpenAICompatibleAdapter` against a box IP * resolved from the orchestrator `/serve/resolve` registry), this speaks Vast's * SERVERLESS PyWorker endpoint, where Vast OWNS the autoscaling and a cold-worker * pool — resume in seconds, $0 idle, no fragile local autoscaler tick and no raw * Docker-cold-pull stall (the failure modes that bricked the raw path, 2026-06-14). * * Vast serverless is NOT plain-OpenAI-at-a-stable-URL. The transport mirrors the * proven `scripts/vast-serverless-client.mjs` `sovereignServerlessChat` * (validated against the vastai SDK serverless client): * 1. POST https://run.vast.ai/route/ {endpoint, api_key, cost, request_idx, * replay_timeout} — poll until the body carries a worker `url` (the cold pool * wakes when cost >= the start threshold; SDK default 100). A not-ready body * carries a `status` worker-count breakdown instead. * 2. POST /v1/chat/completions * {auth_data: , session_id: null, payload: } * — the PyWorker validates the signature in auth_data, then proxies the * payload to Ollama's OpenAI-compatible /v1 (streaming passthrough). * * The SSE parse (text + fragmented `tool_calls.function.arguments` accumulation → * `LLMStreamChunk`) is identical to `OpenAICompatibleAdapter`; only the request * envelope and the dynamically-resolved worker URL differ. Sovereign by * construction: our Qwen on our rented GPU, OpenAI PROTOCOL only. */ type VastServerlessAdapterConfig = Omit & { /** The VAST_API_KEY — bearer for BOTH the route call and the worker call. */ apiKey: string; /** Vast serverless endpoint name (e.g. 'holoscript-qwen-coder'). */ endpointName: string; /** Ollama model tag the endpoint serves. */ model?: string; /** Route load signal; >= the start threshold wakes the cold pool. SDK default 100 (cost=1 never wakes it). */ cost?: number; /** Cap on cold-resume polling (seconds). */ maxWaitS?: number; /** Delay between route polls while the cold pool wakes (ms; default 10000). */ pollIntervalMs?: number; }; declare const VAST_SERVERLESS_CAPABILITIES: Capabilities; declare class VastServerlessAdapter extends BaseLLMAdapter { readonly name: "fleet"; readonly models: readonly string[]; readonly defaultHoloScriptModel: string; readonly capabilities: Capabilities; private readonly vastKey; private readonly endpointName; private readonly cost; private readonly maxWaitS; private readonly pollIntervalMs; constructor(config: VastServerlessAdapterConfig); protected getDefaultModel(): string; private mapFinishReason; /** * Wake (or replay against) the serverless endpoint: POST run.vast.ai/route/ * until a worker `url` is READY, returning that url + the FULL route body * (the signature the PyWorker validates as `auth_data`). */ private resolveWorker; private mapToolToOpenAI; /** The OpenAI-style chat body that becomes the envelope `payload`. */ private buildPayload; /** POST the resolved worker with the {auth_data, session_id, payload} envelope. */ private postWorker; private completionBoundTelemetryHeaders; private buildRequestId; private buildResponseHeaders; complete(request: LLMCompletionRequest, model?: string): Promise; streamCompletion(request: LLMCompletionRequest, model?: string): AsyncIterable; /** Health: a route call that wakes/replays the endpoint and confirms a worker resolves. */ healthCheck(): Promise<{ ok: boolean; latencyMs: number; error?: string; }>; } export { VAST_SERVERLESS_CAPABILITIES, VastServerlessAdapter, type VastServerlessAdapterConfig };