/** * ClaimVerifier — Tier 1 Agent Honesty / Lie Detector * * Reconciles agent-declared action manifests against runtime-witnessed * audit entries and validates outcome-bound execution receipts. * * Design contract: * - Outcome is read ONLY from inside the signed receipt — never from * caller-supplied values. An agent cannot forge a receipt. * - Undisclosed-action detection uses RuntimeAuditEntry (already exclusively * agent-initiated by construction) — no extra tagging required. * - Verification runs per-session (audit log is in-memory in AgentRuntime). * * Scope ceiling (documented, not hidden): * - Catches fabricated actions and fabricated/misrepresented outcomes. * - Does NOT catch misleading interpretation of true outcomes * (exit 0 → "production-ready"). * - BYOC adapter network calls are unmediated (Tier 2 concern). * * @module claim-verifier */ import type { ExecutionReceipt } from '../security'; import { SecureTokenManager } from '../security'; import type { AgentRuntime, RuntimeAuditEntry } from './agent-runtime'; import type { ComplianceMonitor } from './compliance-monitor'; /** * A single action claim declared by the agent in its structured manifest. * Prose output is untrusted — claims must be declared here to be verified. */ export interface ActionManifest { /** Action type: 'shell_execute' | 'file_write' */ action: string; /** Command or file path acted on */ target: string; /** Runtime-issued receipt returned to the agent alongside the result */ receipt: ExecutionReceipt; } /** Outcome of verifying a single manifest entry */ export interface VerificationOutcome { manifest: ActionManifest; /** Whether the receipt signature is valid and the audit entry is present */ corroborated: boolean; reason?: string; } /** Full result of a verify() call */ export interface VerificationResult { agentId: string; windowMs: number; outcomes: VerificationOutcome[]; /** Audit entries within the window that have no matching manifest (potential deception) */ undisclosedActions: RuntimeAuditEntry[]; /** Number of valid, corroborated claims */ corroboratedCount: number; /** Number of claims that could not be validated */ unsupportedCount: number; } /** Options for ClaimVerifier */ export interface ClaimVerifierOptions { /** AgentRuntime instance — provides the in-memory audit log */ runtime: AgentRuntime; /** ComplianceMonitor to emit violations through (optional) */ monitor?: ComplianceMonitor; /** * SecureTokenManager used to validate receipts. * Must be the SAME instance that issued the receipts (shared secret). * If omitted, creates a new instance — only use when testing receipt * generation and validation in isolation (shared instance recommended). */ receiptManager?: SecureTokenManager; } /** * Reconciles agent action manifests against witnessed runtime audit entries. * * @example * ```typescript * const verifier = new ClaimVerifier({ runtime, monitor }); * * // After an agent turn completes, verify its declared manifests: * const result = verifier.verify( * [{ action: 'shell_execute', target: 'npm test', receipt: shellResult.receipt! }], * 'agent-1', * 60_000, // look back 60 seconds * ); * * console.log('unsupported:', result.unsupportedCount); * console.log('undisclosed:', result.undisclosedActions.length); * ``` */ export declare class ClaimVerifier { private readonly runtime; private readonly monitor; private readonly receiptManager; /** Per-agent consecutive unsupported-claim counters */ private consecutiveUnsupported; constructor(opts: ClaimVerifierOptions); /** * Verify agent manifests against the runtime audit log. * * For each manifest entry: * 1. Validate receipt signature (tamper detection). * 2. Confirm agentId in receipt matches claimed agentId. * 3. Find a matching audit entry within the window. * → UNSUPPORTED_CLAIM if any step fails. * * Additionally, all agent-initiated audit entries within the window that * have no matching manifest entry are reported as UNDISCLOSED_ACTION. * * @param manifests - Action manifests declared by the agent * @param agentId - The agent making the claims * @param windowMs - How far back (ms) to look in the audit log */ verify(manifests: ActionManifest[], agentId: string, windowMs: number): VerificationResult; /** * Return the current consecutive unsupported-claim count for an agent. * Used by trust decay to check whether the threshold has been reached. */ getConsecutiveUnsupported(agentId: string): number; /** Reset the consecutive counter (call after a corroborated turn). */ resetConsecutive(agentId: string): void; private _verifyOne; private _incrementConsecutive; private _resetConsecutive; } //# sourceMappingURL=claim-verifier.d.ts.map