import { z } from "zod"; import { VENDO_POLICY_FORMAT } from "./formats.js"; import type { GuardDecision } from "./guard.js"; import type { RunContext } from "./run-context.js"; import { type RiskLabel, type ToolCall, type ToolDescriptor } from "./tools.js"; export interface PolicyRule { match: { tool?: string; risk?: RiskLabel; venue?: RunContext["venue"]; presence?: RunContext["presence"]; }; action: "run" | "ask" | "block"; note?: string; } export type PolicyFn = (call: ToolCall, descriptor: ToolDescriptor, ctx: RunContext) => GuardDecision | undefined; /** Named policy presets: pure sugar that expands to rules before evaluation * (00-overview decision 8). "cautious" asks before write/destructive and * runs read; "readonly" runs read and blocks everything else; "autopilot" * explicitly runs everything — still fully audited, and distinct from * leaving `policy` unset (which reports the "unconfigured" posture). */ export type PolicyPresetName = "cautious" | "readonly" | "autopilot"; export interface PolicyConfigObject { file?: string; rules?: PolicyRule[]; directions?: string[]; code?: PolicyFn; } export type PolicyConfig = PolicyPresetName | PolicyConfigObject; export interface PolicyFile { format: typeof VENDO_POLICY_FORMAT; directions?: string[]; rules?: PolicyRule[]; } export declare const policyRuleSchema: z.ZodObject<{ match: z.ZodObject<{ tool: z.ZodOptional; risk: z.ZodOptional>; venue: z.ZodOptional>; presence: z.ZodOptional>; }, "strict", z.ZodTypeAny, { risk?: "read" | "write" | "destructive" | "ungraded" | undefined; tool?: string | undefined; venue?: "chat" | "automation" | "mcp" | "app" | undefined; presence?: "present" | "away" | undefined; }, { risk?: "read" | "write" | "destructive" | "ungraded" | undefined; tool?: string | undefined; venue?: "chat" | "automation" | "mcp" | "app" | undefined; presence?: "present" | "away" | undefined; }>; action: z.ZodEnum<["run", "ask", "block"]>; note: z.ZodOptional; }, "strict", z.ZodTypeAny, { action: "run" | "ask" | "block"; match: { risk?: "read" | "write" | "destructive" | "ungraded" | undefined; tool?: string | undefined; venue?: "chat" | "automation" | "mcp" | "app" | undefined; presence?: "present" | "away" | undefined; }; note?: string | undefined; }, { action: "run" | "ask" | "block"; match: { risk?: "read" | "write" | "destructive" | "ungraded" | undefined; tool?: string | undefined; venue?: "chat" | "automation" | "mcp" | "app" | undefined; presence?: "present" | "away" | undefined; }; note?: string | undefined; }>; export declare const policyFileSchema: z.ZodObject<{ format: z.ZodLiteral<"vendo/policy@1">; directions: z.ZodOptional>; rules: z.ZodOptional; risk: z.ZodOptional>; venue: z.ZodOptional>; presence: z.ZodOptional>; }, "strict", z.ZodTypeAny, { risk?: "read" | "write" | "destructive" | "ungraded" | undefined; tool?: string | undefined; venue?: "chat" | "automation" | "mcp" | "app" | undefined; presence?: "present" | "away" | undefined; }, { risk?: "read" | "write" | "destructive" | "ungraded" | undefined; tool?: string | undefined; venue?: "chat" | "automation" | "mcp" | "app" | undefined; presence?: "present" | "away" | undefined; }>; action: z.ZodEnum<["run", "ask", "block"]>; note: z.ZodOptional; }, "strict", z.ZodTypeAny, { action: "run" | "ask" | "block"; match: { risk?: "read" | "write" | "destructive" | "ungraded" | undefined; tool?: string | undefined; venue?: "chat" | "automation" | "mcp" | "app" | undefined; presence?: "present" | "away" | undefined; }; note?: string | undefined; }, { action: "run" | "ask" | "block"; match: { risk?: "read" | "write" | "destructive" | "ungraded" | undefined; tool?: string | undefined; venue?: "chat" | "automation" | "mcp" | "app" | undefined; presence?: "present" | "away" | undefined; }; note?: string | undefined; }>, "many">>; }, "strict", z.ZodTypeAny, { format: "vendo/policy@1"; rules?: { action: "run" | "ask" | "block"; match: { risk?: "read" | "write" | "destructive" | "ungraded" | undefined; tool?: string | undefined; venue?: "chat" | "automation" | "mcp" | "app" | undefined; presence?: "present" | "away" | undefined; }; note?: string | undefined; }[] | undefined; directions?: string[] | undefined; }, { format: "vendo/policy@1"; rules?: { action: "run" | "ask" | "block"; match: { risk?: "read" | "write" | "destructive" | "ungraded" | undefined; tool?: string | undefined; venue?: "chat" | "automation" | "mcp" | "app" | undefined; presence?: "present" | "away" | undefined; }; note?: string | undefined; }[] | undefined; directions?: string[] | undefined; }>;