/** * The cost guard — tests estimated above the token budget are owner-gated. * * Operators declare command patterns and their estimated cost in tokens * (`guards.expensiveTests.patterns`), plus a ceiling (`maxTokens`, `0` = every * match is gated). A bash command matching a pattern whose estimate exceeds the * ceiling is blocked — an LLM-driven suite or a mutation run can burn a budget * silently, and "it was just a test" is not authorization to spend it. * * The estimate is exactly what the word says: a number the operator wrote next * to the pattern, not a measurement. It answers "may this run unattended?", * never "how much did it cost?". * * The only way through is an explicit owner instruction in the same turn, * carried as the command's first word: `AW_ALLOW=cost`. Listing or reading * tests is never gated. */ import { type GuardDecision, type ToolCallLike } from "./guard-util.js"; import type { GuardsCostPattern } from "../config/types.js"; export declare const COST_REASON: string; /** The estimated cost of one command, or null when it matches nothing. */ export declare function estimatedCost(command: string, patterns: GuardsCostPattern[]): number | null; /** * The `tool_call` gate, bash only. `policy.maxTokens` is the ceiling; `0` * gates every match. The guard is a no-op while no patterns are configured. */ export declare function costGuard({ toolName, command }: ToolCallLike, policy?: { maxTokens: number; patterns: GuardsCostPattern[]; }): GuardDecision;