/** * 📑 THE SLA CERTIFICATE — a signed, both-party-verifiable service-level agreement for AI QUALITY (not just uptime). * * AI services today are sold on uptime SLAs + "trust us" on quality. But the thing a buyer actually cares about — * is the model still calibrated? still fair? still accurate enough? under the latency budget? — is never put in a * contract you can ENFORCE, because nobody could prove compliance or breach. This certificate makes the quality * terms themselves the SLA: the provider commits a set of measurable terms (each a metric, an observed value, a * threshold and a direction), the period's compliance is evaluated deterministically, and the verdict — PASS, or * BREACH naming exactly which terms failed and by how much — is signed. Each term can BIND to the underlying signed * metric certificate (a calibration cert, a fairness cert, …) so the observed value isn't "trust me" either. * * WHO BENEFITS (≥2 parties, by design): ① the PROVIDER turns "our model is good" into a signed, enforceable promise * that wins enterprise deals and bounds their liability to the stated terms; ② the CONSUMER gets a guarantee with * teeth — a breach is provable + offline-checkable, so refunds / penalties / switching are no longer he-said-she-said. * * WORLD-FIRST + LLM-impossible: an LLM cannot deterministically evaluate the terms against thresholds, bind them to * re-derivable metric certificates, and sign an offline-checkable compliance verdict — it drafts prose. (DIAKRISIS — * MEASURED: a compliant period is PASS; a breached term flips the verdict to BREACH and is NAMED with its margin; * mixed terms name every breach; both threshold directions [≤ and ≥] are handled; a forged PASS over a real breach is * rejected on re-derivation; signed/tamper/deterministic/total. HONEST: this certifies the TERMS as stated against * the OBSERVED values supplied — its strength is exactly the strength of the bound metric certificates + that the * observed values are real; it does not itself measure the model.) */ import { type KeyObject } from "node:crypto"; export interface SlaTerm { name: string; metric: string; observed: number; threshold: number; direction: "<=" | ">="; certHash?: string | null; } interface EvaluatedTerm extends SlaTerm { satisfied: boolean; margin: number; } export interface SlaCertificate { standard: "melete-sla-certificate/v1"; provider: string; consumer: string; period: string; verdict: "PASS" | "BREACH" | "EMPTY"; terms: EvaluatedTerm[]; breached: string[]; payloadHash: string; signature: string; publicKeyPem: string; algo: "ed25519+sha256"; } export declare function slaCertificate(opts: { provider?: string; consumer?: string; period?: string; terms: SlaTerm[]; keys?: { publicKey: KeyObject; privateKey: KeyObject; }; }): SlaCertificate; export declare function verifySlaCertificate(c: SlaCertificate): { ok: boolean; reason: string; }; export interface SlaLedgerEntry { seq: number; periodCert: SlaCertificate; prevHash: string; entryHash: string; } export interface SlaLedger { standard: "melete-sla-ledger/v1"; provider: string; consumer: string; penaltyPerBreach: number; entries: SlaLedgerEntry[]; headHash: string; signature: string; publicKeyPem: string; algo: "ed25519+sha256"; } export declare function buildSlaLedger(opts: { provider?: string; consumer?: string; penaltyPerBreach?: number; periodCerts: SlaCertificate[]; keys?: { publicKey: KeyObject; privateKey: KeyObject; }; }): SlaLedger; export declare function verifySlaLedger(l: SlaLedger): { ok: boolean; reason: string; }; export declare function slaLedgerReport(l: SlaLedger): { periods: number; passCount: number; breachCount: number; breachRate: number; longestCleanStreak: number; penaltyOwed: number; breachesByTerm: Record; }; export declare function slaGauntlet(): { score: 0 | 100; checks: Array<{ name: string; pass: boolean; detail: string; }>; }; export {}; //# sourceMappingURL=sla.d.ts.map