import { a as Explanation, c as PermissionPolicy, i as EvaluationContext } from "./evaluate-DXlKxvts.mjs"; import * as z from "zod"; //#region src/prompt-tool.d.ts /** The arguments a permission-prompt tool is called with: the tool the agent wants to run, its input, and the id of that call. */ export declare const PermissionPromptRequest: z.ZodObject<{ tool_name: z.ZodString; input: z.ZodRecord; tool_use_id: z.ZodOptional; }, z.core.$strip>; export type PermissionPromptRequest = z.infer; /** The answer to a permission prompt. An allow echoes the input (or a changed one); a deny tells the agent why. */ export type PermissionPromptResult = { behavior: "allow"; updatedInput: Record; } | { behavior: "deny"; message: string; }; /** A call the policy neither allows nor denies, handed to the host to settle. */ export interface AskRequest { request: PermissionPromptRequest; /** The string whose explanation decided the call (see {@link toolSubjects}). */ subject: string; /** How the policy reached `ask`, rule by rule. */ explanation: Explanation; } /** * Settles an `ask` decision. The host decides how: show a person the request, hold it until someone approves it elsewhere, or consult another policy. The signal aborts when the agent abandons the call. */ export type AskHandler = (ask: AskRequest, signal: AbortSignal) => Promise; export interface PermissionPromptOptions { /** Reads the policy for each prompt, so edits to the policy files apply to the next call. */ loadPolicy: () => Promise; /** The project root: a file inside it is judged by its `./`-relative path as well as its absolute one. */ root: string; /** Conditions on a field left out here are unknown: they never allow a call, and may still deny or ask. */ context?: EvaluationContext; /** Settles `ask` decisions. Without it, a call the policy asks about is denied. */ onAsk?: AskHandler; } /** Answers one permission prompt. */ export type PermissionPrompt = (request: PermissionPromptRequest, signal: AbortSignal) => Promise; /** * The strings a tool call's rule patterns are matched against: the command for `Bash`, the URL for `WebFetch`, the query for `WebSearch`. A file tool's path is resolved against `root` and judged in both forms a policy may write it: absolute, and `./`-relative when it lies inside `root`. Any other tool is judged by its name alone, so its one subject is empty. `undefined` when the field a tool is judged by is missing or not a string. */ export declare function toolSubjects(toolName: string, input: Readonly>, root: string): readonly string[] | undefined; /** Builds a {@link PermissionPrompt} that judges each call against the policy. */ export declare function createPermissionPrompt(options: PermissionPromptOptions): PermissionPrompt; /** A result as an MCP tool returns it: one text block holding the result as JSON. */ export declare function promptToolContent(result: PermissionPromptResult): { content: [{ type: "text"; text: string; }]; }; //#endregion //# sourceMappingURL=prompt-tool.d.mts.map