/** * AgentGuard® — model-agnostic provenance that survives hot-swap. * * The "headless" / model-fungibility problem (raised on All-In E280): teams want * to hot-swap models — frontier → open-weight → self-hosted — per task to cut * cost, but "no one has figured out how to abstract memory/context/AUDIT away * from the model." A provider console can't help: it only sees its own tokens, * and the trail breaks the moment you route to a different provider. * * AgentGuard's signed decision log already records, per call, which model served * it (provenance) inside one continuous hash chain. This module reads that log * and produces a PORTABLE, model-agnostic provenance manifest per workload: the * ordered model lineage, every swap, the frontier/dark origin mix, and a single * tamper-evidence verdict that spans the whole swap sequence. The audit is keyed * to the workload, not the model — so it survives the swap. * * Honest scope note (same as the dashboard): the signed SpendDecision does not * carry a first-class workload/agent id (only `triggeredScopeKey`). Callers pass * a `keyOf` selector to group; the default uses `triggeredScopeKey`. We never * invent a grouping the ledger does not support. * * Patent notice: signed hash-chained decision log (U.S. application filed May * 2026); composes with DAG Trust Attestation, Patent D §7.3 (App. No. * 63/984,626). AgentGuard® is a U.S. registered trademark (Reg. No. 8281464) of * Dunecrest Ventures Inc. */ import type { SignedDecisionLogEntry, SpendDecision } from '../types'; import { type TokenOrigin } from '../dashboard/aggregate'; export interface ModelUse { model: string; origin: TokenOrigin; provider: string; calls: number; cents: number; } export interface ModelSwap { atSequence: number; fromModel: string; toModel: string; fromOrigin: TokenOrigin; toOrigin: TokenOrigin; /** True when the swap crossed the frontier↔dark boundary (the audit-risky kind). */ crossesBoundary: boolean; } export interface WorkloadProvenance { key: string; calls: number; spentCents: number; frontierCents: number; darkCents: number; firstAt: string | null; lastAt: string | null; models: ModelUse[]; /** Ordered model lineage, e.g. ['claude-5','gpt-5-mini','glm-5.2']. */ lineage: string[]; swaps: ModelSwap[]; } export interface WorkloadProvenanceReport { workloads: WorkloadProvenance[]; /** Chain-level tamper evidence spans ALL swaps — the point of the manifest. */ continuity: { verified: boolean; entries: number; reason?: string; }; } /** * Build the portable per-workload provenance manifest from signed ledger * entries. Pass the async `verifyChain` result as `continuity` so this stays a * pure, synchronous function (never null-continuity in production — a manifest * without tamper evidence is not the product). */ export declare function workloadProvenance(entries: SignedDecisionLogEntry[], continuity?: WorkloadProvenanceReport['continuity'], keyOf?: (d: SpendDecision) => string): WorkloadProvenanceReport; /** Human-readable lineage, e.g. "claude-5 → gpt-5-mini → glm-5.2". */ export declare const formatLineage: (w: WorkloadProvenance) => string; //# sourceMappingURL=portability.d.ts.map