import { u as Rule } from "./schema-BXTTXvJl.cjs"; import { c as PermissionPolicy, i as EvaluationContext, r as DecisionStep, s as PermissionDecision } from "./evaluate-CRWwRvSD.cjs"; //#region src/replay.d.ts /** How a recorded call ended: it ran, a rule denied it, or the user declined it when asked. */ type RecordedOutcome = "ran" | "denied" | "rejected"; /** One tool call read from a transcript. */ interface ToolCall { /** The tool name as the agent called it. */ tool: string; /** * What rule patterns match against: the command, file path or URL. Absent for a tool with no such input, which only a rule without a pattern can match. */ subject?: string; /** The working directory and branch recorded with the call, where the transcript has them. */ context: EvaluationContext; /** How the call ended, when the transcript records its result. */ outcome?: RecordedOutcome; } /** A call judged against a policy. */ interface ReplayedCall { call: ToolCall; decision: PermissionDecision; steps: DecisionStep[]; } /** The result of replaying a policy over recorded calls. */ interface ReplayReport { /** How many calls the policy would allow, ask about and deny. */ counts: Record; /** The calls whose recorded outcome the policy's decision could not have produced, in order. */ differing: ReplayedCall[]; } /** A proposed allow rule and how many approved calls it covers. */ interface Suggestion { rule: Rule; count: number; } /** * Read the tool calls from a JSON Lines session transcript, in the order they were made. * * @throws {SyntaxError} When a non-blank line is not JSON, naming the line. */ declare function parseTranscript(text: string): ToolCall[]; /** * Judge every call against a policy: count the decisions, and list the calls whose recorded outcome that decision could not have produced. A call with no recorded outcome is counted but never listed. */ declare function replayCalls(policy: PermissionPolicy, calls: readonly ToolCall[]): ReplayReport; /** * Propose allow rules for what the transcript shows was approved at least `minCount` times. * * Only calls that ran count as approved. A Bash line is taken command by command, and a line the shell splitter does not model is skipped. A command is never proposed when it appeared in a line a rule of `policy` denies, or in a line the transcript records as denied or declined, and a command `policy` already allows, or a rule of it asks about, is left out. Bash commands sharing a first word become one prefix rule on the words they all start with, unless that prefix would also match such an excluded command; everything else gets an exact rule, or a rule without a pattern for a tool with no subject. Rules are ordered by how many calls they cover, then by first appearance. */ declare function suggestRules(calls: readonly ToolCall[], policy: PermissionPolicy, minCount: number): Suggestion[]; //#endregion export { ToolCall as a, suggestRules as c, Suggestion as i, ReplayReport as n, parseTranscript as o, ReplayedCall as r, replayCalls as s, RecordedOutcome as t }; //# sourceMappingURL=replay-CuErI63u.d.cts.map