/** * ollama_doctor — first-run prerequisites + status snapshot (no-LLM). * * Probes Ollama reachability, lists loaded (/api/ps) + pulled (/api/tags) * models, compares them against the active profile's tier models, reports * allowed roots / artifact root / log path, and surfaces the last 10 errors * from the NDJSON log. Returns a single envelope with `healthy: boolean` * so a caller can gate follow-up work on "is this box actually set up?" * * Pure introspection — no model calls, no writes. Safe to call on every * session start to decide whether to nag the operator about a missing pull. */ import { z } from "zod"; import type { Envelope } from "../envelope.js"; import type { RunContext } from "../runContext.js"; export declare const doctorSchema: z.ZodObject<{}, z.core.$strip>; export type DoctorInput = z.infer; export interface DoctorResult { ollama: { reachable: boolean; host: string; error?: string; }; models: { required: string[]; pulled: string[]; loaded: string[]; missing: string[]; suggested_pulls: string[]; }; profile: { name: string; tiers: { instant: string; workhorse: string; deep: string; embed: string; }; }; paths: { allowed_roots: string[]; artifact_root: string; log_path: string; }; /** * Cloud-primary status. Present only when cloud is opted into * (OLLAMA_CLOUD_PRIMARY + OLLAMA_API_KEY). `reachable` = the cloud host * answered; `auth_ok` = the Bearer key was accepted (not 401/403); * `circuit_state` reflects the live routing breaker when available. */ cloud?: { enabled: boolean; /** * 'primary' = cloud serves the generative tiers by default (v2.7.0); * 'standby' = local-primary, cloud serves only per-call backend:'cloud' * escalations (F2a, v2.9). */ mode: "primary" | "standby"; host: string; reachable: boolean; /** * 'failed' on a definitive 401/403; 'unverified' otherwise. NOTE: the * cloud /api/tags probe lists public models and does NOT gate on the key, * so a reachable host cannot confirm a GOOD key — the key is truly * validated on the first real generate call (where a bad key trips the * sticky breaker). We never claim 'ok' from a probe that can't prove it. */ auth: "failed" | "unverified"; models: { instant: string; workhorse: string; deep: string; }; circuit_state?: string; error?: string; }; recent_errors: Array<{ ts: string; code: string; tool: string; }>; healthy: boolean; } /** Default log path — mirrors observability.ts. */ declare function defaultLogPath(): string; /** Default artifact root — mirrors artifacts/scan.ts. */ declare function defaultArtifactRoot(): string; /** Parse `allowed_roots` from INTERN_ALLOWED_ROOTS (comma/semicolon separated). */ declare function resolveAllowedRoots(): string[]; /** * Read the last N lines of the NDJSON log and return the last 10 events that * look like errors — envelope calls whose result shape carries an error flag, * guardrail denials, or known error kinds. Silent on any read failure; a * missing log file isn't a doctor problem, just a quiet operator. */ declare function readRecentErrors(logPath: string, cap?: number): Promise>; export declare function handleDoctor(_input: DoctorInput, ctx: RunContext): Promise>; export declare const __doctorInternals: { readRecentErrors: typeof readRecentErrors; resolveAllowedRoots: typeof resolveAllowedRoots; defaultLogPath: typeof defaultLogPath; defaultArtifactRoot: typeof defaultArtifactRoot; }; export {}; //# sourceMappingURL=doctor.d.ts.map