import type { ExtensionContext } from "@earendil-works/pi-coding-agent"; import type { AutoPermissionsConfig } from "./config.js"; import type { Gate } from "./gates.js"; /** What a permission decision hands back to Pi to stop the tool call. */ export type BlockResult = { block: true; reason: string }; /** The tool call a review belongs to. */ export interface ReviewTarget { toolName: string; toolCallId?: string; /** * The model-issued call (a codemode script) this call was made from, when * one was: the top of the chain, however many tool calls sit in between. */ scriptToolCallId?: string; } /** * Everything one gated command is judged against, built once per `tool_call` * and passed whole to the display, the reviewer, the denial log and the * approval prompt — so they never disagree about which command, gate or * config they are talking about. */ export interface ReviewScope { ctx: ExtensionContext; config: AutoPermissionsConfig; gate: Gate; command: string; target: ReviewTarget; /** * Aborts when the call can no longer run for a reason other than the turn: * for a call a codemode script made, when that script ends. Pi hands such a * call an already-aborted signal, so its review and prompt are moot. */ callSignal?: AbortSignal; }