/** Timeout for the probe process (ms). */ export declare const CHILD_MODEL_PROBE_TIMEOUT_MS = 30000; /** SIGTERM -> SIGKILL grace window for a timed-out probe (ms). */ export declare const CHILD_MODEL_PROBE_KILL_GRACE_MS = 5000; /** Truncation bound for probe stdout/stderr (keeps the tail). */ export declare const CHILD_MODEL_PROBE_OUTPUT_LIMIT: number; /** Minimal readable stream surface expected on the spawned process. */ export interface PiProbeReadable { setEncoding(encoding: BufferEncoding): unknown; on(event: "data", listener: (chunk: string) => void): unknown; } /** Minimal child process surface consumed by the probe runner. */ export interface PiProbeProcess { stdout: PiProbeReadable; stderr: PiProbeReadable; kill(signal: NodeJS.Signals): boolean; on(event: "error", listener: (error: Error) => void): unknown; on(event: "close", listener: (code: number | null) => void): unknown; } export type PiProbeSpawnFn = (input: { command: string; args: string[]; cwd: string; env: NodeJS.ProcessEnv; }) => PiProbeProcess; export interface PiModelListRun { code: number; stdout: string; stderr: string; timedOut: boolean; } export interface PiModelListProbeInput { /** The exact model to look up, e.g. "openai/gpt-4o" or "gpt-4o". */ model: string; /** Provider extension passed as `-e ` when present. */ providerExtension?: string; /** Working directory for the probe process (defaults to process.cwd()). */ cwd?: string; /** Environment for the probe process (defaults to process.env). */ env?: NodeJS.ProcessEnv; } export interface PiModelListProbeOptions { /** Injectable spawner; defaults to `node:child_process` spawn. */ spawnFn?: PiProbeSpawnFn; /** Command to spawn (default "pi"). */ command?: string; timeoutMs?: number; killGraceMs?: number; } /** * Whether a `pi --list-models ` output contains the exact model. A * slash in the expected model requires provider+id equality; otherwise the id * alone suffices. Skips empty lines and the literal `provider` header. */ export declare function modelListHasExactModel(output: string, expectedModel: string): boolean; /** * Run a single `pi --list-models ` probe process. * * Args (harness order): `--no-extensions` (+ `-e ` when * present) then `--list-models `. Bounded output (tail 128 KB), timeout * with SIGTERM -> SIGKILL grace, `unref()` timers. Returns code/stdout/stderr * and whether the probe timed out. */ export declare function runPiModelListProbe(input: PiModelListProbeInput, options?: PiModelListProbeOptions): Promise; export interface PiProbeAvailabilityInput { providerExtension?: string; cwd?: string; env?: NodeJS.ProcessEnv; command?: string; spawnFn?: PiProbeSpawnFn; timeoutMs?: number; killGraceMs?: number; } /** * Build an `AvailabilityProbe`-compatible probe (model: string) => result, * evaluating code 0 AND exact-model presence as success. Returns an honest * `{ok:false, reason}` for timeout, non-zero exit, or missing model. Designed * to back `AvailabilityCache` (never imported by the pure core). */ export declare function createPiModelProbe(input?: PiProbeAvailabilityInput): (model: string) => Promise<{ ok: boolean; reason?: string; }>;