/** * `monomind agent test --json` engine (issue #390, protocol rev 18). * * Sends one "Reply with the single word: ok" turn through the same * in-process engine `agent exec` uses (runAgentExec) — max turns * AGENT_TEST_MAX_TURNS, no * caller tools, scoped access, a fresh temporary cwd, and optionally * `--sandbox` / `--env` as in `agent exec` (#474) — and folds the NDJSON * events into one result object with a status a caller can store: * ok | ok_unexpected | auth | quota | rate_limited | model_unavailable | timeout | * missing_binary | error. */ import { type AgentFailureStatus } from './agent-error-classify.js'; import type { AgentRunner } from './agent-runner.js'; import type { NativeSandbox, SandboxFallback, SandboxMode } from './runner-sandbox.js'; export declare const AGENT_TEST_PROMPT = "Reply with the single word: ok"; /** #564: a runtime counts one turn per model call, so a model that runs one * of its CLI's own tools (pi's ls/read, say) before answering needs a second * turn. With a cap of 1 the runner aborted that answer and the test failed * with error_max_turns although the runtime worked. A little headroom keeps * the test about the runtime, not about whether the model looked around. */ export declare const AGENT_TEST_MAX_TURNS = 3; export type AgentTestStatus = 'ok' | 'ok_unexpected' | AgentFailureStatus; export interface AgentTestError { code: string; message: string; login_hint?: string; } export interface AgentTestResult { v: 1; runtime: string; model: string | null; status: AgentTestStatus; reply: string | null; latency_first_ms: number | null; latency_ms: number; input_tokens: number; output_tokens: number; /** null when the runtime reported no cost and the model has no price entry. */ cost_usd: number | null; cost_estimated: boolean; runtime_version: string | null; /** * #474: the vendor CLI's sandbox for this turn, from the `start` event * (`agent exec`'s native_sandbox). null when the turn never started * (missing binary, unsupported --sandbox, unknown runtime). */ native_sandbox: NativeSandbox | null; /** #482: the `--sandbox` mode the turn ran in, after `--sandbox-fallback` * (the start event's sandbox_applied); null without `--sandbox`. */ sandbox_applied: SandboxMode | null; error: AgentTestError | null; } /** Binary lookup: path = found, null = required but absent, undefined = none needed. */ export type BinaryFinder = (runtime: string) => string | null | undefined; export interface AgentTestOptions { runtime: string; model?: string; timeoutMs: number; /** #474: `agent exec --sandbox`; it can tighten the turn, never loosen it. */ sandbox?: SandboxMode; /** #482: `agent exec --sandbox-fallback` for an unsupported `sandbox`. */ sandboxFallback?: SandboxFallback; /** #474: extra env for the agent process, as `agent exec --env`. */ env?: Record; /** Test seams; production uses the registry, PATH, and the real runner. */ runnerOverride?: AgentRunner; findBinary?: BinaryFinder; versionOf?: (runtime: string, binPath: string) => Promise; now?: () => number; } /** The runtime's binary as `agent scan` would find it. */ export declare function findRuntimeBinary(runtime: string): string | null | undefined; /** "ok", case-insensitive, trimmed, with optional trailing punctuation. */ export declare function isOkReply(reply: string | null | undefined): boolean; /** Runtime-reported cost, else a pricing-table estimate from the token * counts, else null — an unknown cost is never reported as $0. A reported * 0 with tokens spent is treated as "could not price" (grok, pi), not free. */ export declare function resolveCost(model: string | undefined, reportedUsd: number | null, inputTokens: number, outputTokens: number): { cost_usd: number | null; cost_estimated: boolean; }; /** Run one test turn and fold its events into an AgentTestResult. */ export declare function runAgentTest(opts: AgentTestOptions): Promise; /** Process exit code for a result: 0 when the turn succeeded, 124 on timeout. */ export declare function agentTestExitCode(status: AgentTestStatus): number; //# sourceMappingURL=agent-test.d.ts.map