import { z } from 'zod';
import { MAX_CUSTOM_PATTERN_LENGTH } from '../../constants/verification/index.js';
const AllowReadOnlySchema = z.object({ type: z.literal('allow_read_only') });
const DenyDangerousPatternsSchema = z.object({ type: z.literal('deny_dangerous_patterns') });
const AllowByCategorySchema = z.object({
    type: z.literal('allow_by_category'),
    categories: z.array(z.string()),
});
const AllowByNameSchema = z.object({
    type: z.literal('allow_by_name'),
    toolNames: z.array(z.string()),
});
const DenyByNameSchema = z.object({
    type: z.literal('deny_by_name'),
    toolNames: z.array(z.string()),
});
const CustomPatternSchema = z.object({
    type: z.literal('custom_pattern'),
    pattern: z.string().max(MAX_CUSTOM_PATTERN_LENGTH),
    target: z.enum(['name', 'args', 'both']),
    decision: z.enum(['allow', 'deny']),
});
const AllowByTierSchema = z.object({
    type: z.literal('allow_by_tier'),
    tiers: z.array(z.string()),
});
export const VerificationRuleSchema = z.discriminatedUnion('type', [
    AllowReadOnlySchema,
    DenyDangerousPatternsSchema,
    AllowByCategorySchema,
    AllowByNameSchema,
    DenyByNameSchema,
    CustomPatternSchema,
    AllowByTierSchema,
]);
export const VerificationGateConfigSchema = z.object({
    enabled: z.boolean().default(false),
    rules: z.array(VerificationRuleSchema).default([]),
    allowReadOnlyTools: z.boolean().default(false),
    denyDangerousPatterns: z.boolean().default(false),
    logDecisions: z.boolean().default(true),
});
//# sourceMappingURL=index.js.map