/**
 * @sanity/ailf-core — Test-budget schemas.
 *
 * Per-provider daily USD spend caps for Tier 3 (live-LLM) CI workflows.
 * The cap is the maximum cost a single Tier 3 nightly run may incur for
 * a given provider; the workflow fails loudly if any provider's actual
 * spend exceeds its cap.
 *
 * @see docs/design-docs/testing-strategy.md — "Tier 3 — Live LLMs"
 * @see packages/eval/config/test-budgets.ts — authored config
 */
import { z } from "zod";
// ---------------------------------------------------------------------------
// Provider cap entry
// ---------------------------------------------------------------------------
const NonNegativeUsd = z
    .number()
    .nonnegative("budget caps must be non-negative USD amounts");
export const ProviderBudgetCapsSchema = z
    .record(z.string().min(1), NonNegativeUsd)
    .refine((caps) => Object.keys(caps).length > 0, {
    message: "perProviderDaily must declare at least one provider",
});
// ---------------------------------------------------------------------------
// Test budget config
// ---------------------------------------------------------------------------
export const TestBudgetConfigSchema = z.object({
    perProviderDaily: ProviderBudgetCapsSchema,
    warnFraction: z
        .number()
        .gt(0)
        .lte(1, "warnFraction must be in (0, 1]")
        .default(0.8),
});
