import { Schema } from "effect";
import type { ToolPolicyAction, ToolPolicyRow } from "./core-schema";
import { PolicyId, ScopeId } from "./ids";
export interface ToolPolicy {
    readonly id: PolicyId;
    readonly scopeId: ScopeId;
    readonly pattern: string;
    readonly action: ToolPolicyAction;
    /** Fractional-indexing key. Lower lex order = higher precedence.
     *  Use `generateKeyBetween(a, b)` from the `fractional-indexing`
     *  package to produce a key that sits between two existing rows. */
    readonly position: string;
    readonly createdAt: Date;
    readonly updatedAt: Date;
}
export interface CreateToolPolicyInput {
    readonly targetScope: string;
    readonly pattern: string;
    readonly action: ToolPolicyAction;
    /** Optional explicit position. Defaults to a key above the current
     *  minimum (top of the scope's list; highest precedence). */
    readonly position?: string;
}
export interface UpdateToolPolicyInput {
    readonly id: string;
    readonly targetScope: string;
    readonly pattern?: string;
    readonly action?: ToolPolicyAction;
    readonly position?: string;
}
export interface RemoveToolPolicyInput {
    readonly id: string;
    readonly targetScope: string;
}
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;
    /** Matched pattern; populated only when `source === "user"`. */
    readonly pattern?: string;
    /** Policy row id; populated only when `source === "user"`. */
    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[], scopeRank: (row: Pick<ToolPolicyRow, "scope_id">) => number) => PolicyMatch | undefined;
export declare const resolveEffectivePolicy: (toolId: string, policies: readonly ToolPolicyRow[], scopeRank: (row: Pick<ToolPolicyRow, "scope_id">) => number, defaultRequiresApproval?: boolean) => EffectivePolicy;
export declare const effectivePolicyFromSorted: (toolId: string, sortedPolicies: readonly (Pick<ToolPolicy, "pattern" | "action" | "id"> & Partial<Pick<ToolPolicy, "scopeId">>)[], 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