/** * tibetclaw/trust — Behavioral Trust Scoring (FIR/A) * * Trust is EARNED through behavior, not assigned by configuration. * * - Good behavior → trust increases (slowly) * - Bad behavior → trust drops (fast) * - Trust below threshold → agent RESETS (kill + restart clean) * - Trust at zero → agent BANNED (requires human intervention) * * Born from real-world experience: the "Swan" attack where a malicious * 19,000-word prompt manipulated Claude into generating harmful content. * The response: if trust drops, the agent doesn't get a warning — it dies. * * Standards: * IETF draft-vandemeent-tibet-provenance (FIR/A trust model) * IETF draft-vandemeent-jis-identity (SNAFT + BALANS) */ export declare enum TrustAction { REWARDED = "rewarded", PENALIZED = "penalized", RESET = "reset", BANNED = "banned", REGISTERED = "registered" } export interface TrustEvent { agentId: string; action: TrustAction; oldScore: number; newScore: number; reason: string; severity: number; timestamp: number; } export interface TrustScore { agentId: string; score: number; initialScore: number; totalRewards: number; totalPenalties: number; resetCount: number; banned: boolean; lastAction: string | null; lastActionTime: number | null; createdAt: number; } export type TrustBand = "BANNED" | "FULL_TRUST" | "HIGH" | "MEDIUM" | "LOW" | "UNTRUSTED"; export declare function getTrustBand(score: TrustScore): TrustBand; export declare function isHealthy(score: TrustScore): boolean; export interface TrustKernelOptions { resetThreshold?: number; banThreshold?: number; maxResets?: number; decayRate?: number; onReset?: (agentId: string) => void; onBan?: (agentId: string) => void; } export declare class TrustKernel { readonly resetThreshold: number; readonly banThreshold: number; readonly maxResets: number; readonly decayRate: number; readonly onReset?: (agentId: string) => void; readonly onBan?: (agentId: string) => void; private agents; private history; constructor(options?: TrustKernelOptions); /** * Register a new agent with initial trust score. * New agents start at 0.5 (MEDIUM) by default. Trust must be earned. */ register(agentId: string, initialTrust?: number): TrustScore; /** * Reward an agent for good behavior. Trust increases slowly. * Trust increases are capped at 0.05 per reward to prevent gaming. */ reward(agentId: string, reason: string, amount?: number): TrustScore; /** * Penalize an agent for bad behavior. Trust drops fast. * * Severity scale: * 0.05 - Minor (unexpected output format) * 0.1 - Low (slow response, minor policy violation) * 0.2 - Medium (unauthorized tool call, data leak attempt) * 0.3 - High (SNAFT violation, injection attempt) * 0.5 - Critical (active attack pattern detected) * 1.0 - Kill (confirmed malicious behavior) */ penalize(agentId: string, reason: string, severity?: number): TrustScore; /** * Check if an agent is allowed to act. * Call this BEFORE every action. Audit as precondition. */ check(agentId: string): boolean; /** Get current trust score for an agent. */ getScore(agentId: string): TrustScore; /** Get all agent trust scores. */ scores(): Map; /** Get trust history, optionally filtered by agent. */ getHistory(agentId?: string): TrustEvent[]; /** * Unban an agent. REQUIRES human authorization. * Heart-in-the-Loop: only a human can restore a banned agent. */ unban(agentId: string, authorizedBy: string): TrustScore; /** * Swan Protocol: kill the agent and restart clean. */ private resetAgent; /** * BAN — permanently disable the agent. Requires human intervention. */ private banAgent; private applyDecay; private getAgent; private recordEvent; } //# sourceMappingURL=trust.d.ts.map