/** * Effort discovery for the INSTALLED claude CLI. * * Claude Code's effort ladder is a property of the binary on this machine, not * of Claudexor: 2.1.89 advertises `low, medium, high, max` while 2.1.165 * advertises `low, medium, high, xhigh, max`. Hardcoding either one means one * installed version gets silently clamped, which is exactly the defect this * replaces. So we read the ladder out of the binary's own `--help`. * * The help line looks like: * --effort Effort level for the current session (low, medium, high, xhigh, max) * with the parenthesized list possibly wrapped onto following lines — and HOW FAR * it wraps depends on the terminal width, so the parse reads the flag's whole * block rather than a fixed number of lines. * * On a missing binary, an unparseable help text, or a `--help` that stops * documenting the values, the recorded snapshot fills in and the run proceeds. */ import type { HarnessEvent, HarnessRunSpec } from "@claudexor/schema"; import { EffortHint } from "@claudexor/schema"; export declare const BIN: string; /** * Recorded fallback, captured from `claude --help` on the CLI version stamped * below (2.1.281 retains the full low/medium/high/xhigh/max ladder). Used ONLY * when the live parse cannot answer. */ export declare const CLAUDE_EFFORT_SNAPSHOT: readonly EffortHint[]; /** Vendor CLI version `CLAUDE_EFFORT_SNAPSHOT` was captured from. Aliases the * per-package vendor-version SSOT (vendor-cli-version.ts), the same constant * the remote installer pins — bumping the pin without re-recording this * snapshot is a lie the alias makes impossible to tell twice. */ export declare const CLAUDE_EFFORT_SNAPSHOT_VERIFIED_AGAINST: string; /** * Whether the recorded snapshot may be TRUSTED for arg emission against the * installed binary (INV-105). The snapshot is another `--help`'s recorded * answer, so it is only that binary's truth on the exact CLI version it was * captured from: 2.1.165 advertises `xhigh`, 2.1.89 rejects it, and a 2.1.89 * install whose live parse failed used to be handed the 2.1.165 ladder anyway * — `--effort xhigh` then went to a CLI that refuses the flag. * * The installed version string is whatever `claude --version` printed * (e.g. `2.1.281 (Claude Code)`), so the comparison extracts the full dotted * numeric token and requires it to EQUAL the snapshot stamp exactly. An * unknown or unparseable version can never vouch for the snapshot. */ export declare function claudeSnapshotTrustedForVersion(installedVersion: string | null): boolean; /** * The effort ladder the RUN may resolve `--effort` against, version-gating * snapshot trust (INV-105): * * - a LIVE parse is the installed binary's own answer — trusted on any version; * - the snapshot FALLBACK is trusted only when the installed version equals * `CLAUDE_EFFORT_SNAPSHOT_VERIFIED_AGAINST` (same binary, same ladder); * - a fallback on ANY OTHER version (mismatch, unknown, unparseable) yields an * EMPTY ladder: the normalizer then sends no `--effort` flag at all, and the * existing drop seam (`claudeEffortIgnoredEvent`) discloses it — the run * proceeds at the vendor default rather than forwarding a level another * version's snapshot advertises to a binary that may reject it. */ export declare function claudeAdvertisedEffortsForRun(efforts: { levels: readonly EffortHint[]; live: boolean; }, installedVersion: string | null): readonly EffortHint[]; /** * The RUN's whole INV-105 effort seam in one place: probe the installed * binary's ladder, version-gate snapshot-fallback trust * (`claudeAdvertisedEffortsForRun`), and derive the DROP/CLAMP disclosure on * the SAME advertised list the arg builder will resolve against — so the flag * sent and the disclosure emitted can never disagree. The `--version` spawn * happens only when it can matter (fallback ladder AND an effort actually * requested); a live parse or a hint-less run never pays for it. */ export declare function claudeRunEffortResolution(spec: Pick & { env?: HarnessRunSpec["env"]; }, deps: { probeEffortLevels: typeof probeClaudeEffortLevels; detectVersion: typeof detectClaudeVersion; }, abortSignal?: AbortSignal): Promise<{ advertised: readonly EffortHint[]; disclosure: HarnessEvent | null; }>; /** The PATH a run's env patch selects the binary on, when it carries one. */ export declare function claudeRunPatchPath(spec: { env?: HarnessRunSpec["env"]; }): string | undefined; /** * `claude --version` of the binary a caller will execute — resolved and spawned * exactly as the `--help` memo is (host PATH, or the caller's PATH patch), so the * snapshot-trust gate (INV-105) judges the binary whose ladder it fell back * from, never a different host install's. Null when nothing could be spawned. */ export declare function detectClaudeVersion(abortSignal?: AbortSignal, patchPath?: string): Promise; /** * Pull the advertised levels out of `claude --help` text, or null when the * `--effort` line is absent or documents no values. * * Pure and separately testable: the spawn lives in the adapter's runtime deps so * a test can feed recorded help text for any CLI version. */ export declare function parseClaudeEffortHelp(help: string): EffortHint[] | null; type ClaudeHelpProbe = { ok: true; help: string; code: number | null; } | { ok: false; error: string; }; /** * The shared capture, with the caller's cancellation bounding only the CALLER'S * OWN wait. An abandoned caller reads a probe failure — its run is going away * anyway, and the ladder falls back to the snapshot for that one run — while the * capture keeps running for everybody else. */ export declare function probeClaudeHelp(abortSignal?: AbortSignal, patchPath?: string): Promise; /** * The effort ladder the INSTALLED claude binary advertises, falling back to the * recorded snapshot when `--help` cannot be read or no longer documents the * values. A probe failure costs freshness, never the run. */ export declare function probeClaudeEffortLevels(abortSignal?: AbortSignal, /** The run's PATH patch, when its env carries one (see helpProbeIdentity). */ patchPath?: string): Promise<{ levels: readonly EffortHint[]; live: boolean; }>; /** * The INV-105 disclosure for an effort the RUN itself could not honor, or null * when nothing was dropped. Preflight validates against the manifest ladder, * but the arg builder resolves against what the INSTALLED binary advertises at * run time (an older CLI's `--help` can be narrower than the discovered * manifest), and its normalizer answers "send no flag" — which without this * event was a silent vendor-default run. The payload rides the same * `ignored_settings` channel governance uses (QA-070 timeline warning). */ export declare function claudeEffortIgnoredEvent(spec: Pick, advertised: readonly EffortHint[]): HarnessEvent | null; /** * The INV-105 disclosure for an effort the resolution CLAMPED, or null when the * level rode through verbatim (or was dropped — `claudeEffortIgnoredEvent`'s * shape; the two are mutually exclusive: a drop sends no flag, a clamp sends a * different one). Mirrors the codex clamp seam so a moved level is disclosed * the same way on both adapters, and takes the SAME (advertised, ladder) * inputs the arg builder's normalizer takes so the disclosure can never * disagree with the flag actually sent. * * Reachability today: the arg builder resolves with the installed binary's own * list as both advertised set and rank ladder (`normalizeEffort`'s two-arg * form), and against one's own ladder every miss is a DROP, never a clamp — * so with current call sites this event only fires if a rank ladder broader * than the binary's list is ever threaded through (the codex-shaped future, * e.g. `ultra` ranking above a max-capped binary and clamping onto `max`). * The seam exists precisely so that future cannot be silent. */ /** * The one INV-105 seam the run yields: the DROP disclosure or the CLAMP * disclosure, whichever applies (they are mutually exclusive by construction — * a drop sends no flag, a clamp sends a different one), or null when the * requested level rode through verbatim or nothing was requested. */ export declare function claudeEffortDisclosureEvent(spec: Pick, advertised: readonly EffortHint[]): HarnessEvent | null; export declare function claudeEffortClampedEvent(spec: Pick, advertised: readonly EffortHint[], ladder?: readonly EffortHint[]): HarnessEvent | null; export {}; //# sourceMappingURL=effort-probe.d.ts.map