import { type DispatchOutcome } from "./dispatch.js"; import type { Config, LadderRung } from "./config.js"; /** Minimal spend; the no-shell instruction is agy policy on this machine and harmless elsewhere. */ export declare const LANE_PROBE_PROMPT = "Reply with the single word OK. Do not run shell commands."; /** A lane probe waits out a slow cold start; past this it is inconclusive, never evidence. */ export declare const LANE_QUOTA_PROBE_TIMEOUT_MS = 240000; export interface LaneProbeSpawnResult { code: number | null; stdout: string; stderr: string; timedOut: boolean; } /** Injected spawn seam so no test ever runs a real lane; see `defaultLaneProbeSpawner`. */ export type LaneProbeSpawner = (command: string, args: string[], opts: { env: NodeJS.ProcessEnv; timeoutMs: number; }) => Promise; export type LaneQuotaVerdict = { kind: "alive"; } | { kind: "exhausted"; outcome: DispatchOutcome; retryAfterMs: number | null; evidence: string; } | { kind: "inconclusive"; reason: string; }; /** One probeable quota bucket: the cooldown key it feeds and the rung whose command tests it. */ export interface LaneQuotaTarget { /** `quota:` / `rung:` — the `dispatch.ts` cooldown key this probe would retract. */ key: string; lane: string; command: string; rung: LadderRung; } /** * Every distinct probeable quota bucket the configured ladders reference, first-appearance order. * Disabled rungs are included on purpose: disabled is a config choice about DISPATCH, but the * bucket's quota state is still worth re-testing — the motivating incident was a parked lane * whose quota had silently reset. A rung without the `{task}` placeholder cannot carry a probe * prompt and is skipped. */ export declare function laneQuotaTargets(cfg: Config): LaneQuotaTarget[]; /** * The exact invocation a probe runs: the rung's own command with `{task}` replaced by the probe * prompt, under the rung's declared env deltas. ⚠ `{task}` is substituted in ARGS only — env * values pass through verbatim, the same placeholder rule the dispatch renderer enforces * (request content must never become process configuration). */ export declare function buildLaneProbeInvocation(target: LaneQuotaTarget, prompt?: string): { command: string; args: string[]; env: NodeJS.ProcessEnv; }; export declare function classifyLaneProbeOutput(result: LaneProbeSpawnResult): LaneQuotaVerdict; /** * The real spawner. `windowsHide` is load-bearing for the console-less daemon (see * `lane-probe.ts`); the ENOENT retry-through-shell mirrors the same module's `.cmd` shim * fallback. It never rejects — every failure becomes a result the classifier reads. * * ⚠ Refuses to run under vitest, the `winenv.ts` guard: a suite must inject its own seam, never * spawn a real lane and spend real quota. */ export declare const defaultLaneProbeSpawner: LaneProbeSpawner; /** Run one bucket's probe through the injected seam and classify what came back. */ export declare function runLaneQuotaProbe(target: LaneQuotaTarget, opts: { spawn: LaneProbeSpawner; prompt?: string; timeoutMs?: number; }): Promise<{ verdict: LaneQuotaVerdict; raw: LaneProbeSpawnResult; }>;