import { Schema } from "effect";
import type { ToolPolicyAction, ToolPolicyRow } from "./core-schema";
import { Owner, PolicyId } from "./ids";
export interface ToolPolicy {
    readonly id: PolicyId;
    readonly owner: Owner;
    readonly pattern: string;
    readonly action: ToolPolicyAction;
    /** Fractional-indexing key. Lower lex order = higher precedence. */
    readonly position: string;
    readonly createdAt: Date;
    readonly updatedAt: Date;
}
export interface CreateToolPolicyInput {
    readonly owner: Owner;
    readonly pattern: string;
    /** Optional explicit position. Defaults to a key above the current minimum
     *  (top of the owner's list; highest precedence). */
    readonly action: ToolPolicyAction;
    readonly position?: string;
}
export interface UpdateToolPolicyInput {
    readonly id: string;
    readonly owner: Owner;
    readonly pattern?: string;
    readonly action?: ToolPolicyAction;
    readonly position?: string;
}
export interface RemoveToolPolicyInput {
    readonly id: string;
    readonly owner: Owner;
}
export interface PolicyMatch {
    readonly action: ToolPolicyAction;
    readonly pattern: string;
    readonly policyId: string;
}
export type PolicySource = "user" | "plugin-default";
export interface EffectivePolicy {
    readonly action: ToolPolicyAction;
    readonly source: PolicySource;
    readonly pattern?: string;
    readonly policyId?: string;
}
export declare const matchPattern: (pattern: string, toolId: string) => boolean;
export declare const isValidPattern: (pattern: string) => boolean;
export declare const comparePolicyRow: (a: Pick<ToolPolicyRow, "position" | "id">, b: Pick<ToolPolicyRow, "position" | "id">) => number;
export declare const resolveToolPolicy: (toolId: string, policies: readonly ToolPolicyRow[], ownerRank: (row: Pick<ToolPolicyRow, "owner">) => number) => PolicyMatch | undefined;
export declare const resolveEffectivePolicy: (toolId: string, policies: readonly ToolPolicyRow[], ownerRank: (row: Pick<ToolPolicyRow, "owner">) => number, defaultRequiresApproval?: boolean) => EffectivePolicy;
export declare const effectivePolicyFromSorted: (toolId: string, sortedPolicies: readonly (Pick<ToolPolicy, "pattern" | "action" | "id"> & Partial<Pick<ToolPolicy, "owner">>)[], defaultRequiresApproval?: boolean) => EffectivePolicy;
export declare const rowToToolPolicy: (row: ToolPolicyRow) => ToolPolicy;
export declare const ToolPolicyActionSchema: Schema.Literals<readonly ["approve", "require_approval", "block"]>;
//# sourceMappingURL=policies.d.ts.map