agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
40 lines (39 loc) • 2.27 kB
TypeScript
import type { EvidenceSnapshot, ResultEvidence, ResultIdentity } from '../../../integrity/claim-binding/types.js';
export interface ClaimVerificationState {
readonly version: 1;
readonly evidence: EvidenceSnapshot;
readonly nextResultOrdinal: number;
readonly nextClaimOrdinal: number;
/** Sticky refusal: older receipts remain; later evidence is not substituted. */
readonly limited?: true;
}
/**
* Read only after the checkpoint's owner/namespace authority is established.
* The caller MUST derive largestClaimOrdinal from its validated claim rows;
* this carrier does not contain those rows and cannot infer their maximum.
* Stage commits clone changed state. At entry, admit the tracked raw value
* and publish this detached carrier before the batch; subsequent raw reads
* can reuse its immutable evidence. A live scope proxy is not that identity.
*/
export declare function readVerificationState(raw: unknown, largestClaimOrdinal: number): ClaimVerificationState;
/** Called only when opted in. No randomness is consumed at module load. */
export declare function createVerificationState(runId: string, namespaceSource?: () => string): ClaimVerificationState;
/** A resume keeps its namespace/counters, including when a process reuses runId. */
export declare function continueVerificationState(state: ClaimVerificationState, runId: string): ClaimVerificationState;
/** Publish the returned state before awaiting execution, even if it later fails. */
export declare function reserveResultIdentity(state: ClaimVerificationState, runId: string): {
readonly state: ClaimVerificationState;
readonly identity: ResultIdentity;
readonly id: string;
};
/** One occurrence, not a text key. The caller publishes state before evaluation. */
export declare function reserveClaimIdentity(state: ClaimVerificationState, runId: string): {
readonly state: ClaimVerificationState;
readonly ordinal: number;
readonly id: string;
};
/**
* Retain only a finalized, previously reserved receipt. Capacity refusal is
* sticky and never replaces an earlier result; the writer reports the limit.
*/
export declare function retainVerificationEvidence(state: ClaimVerificationState, receipt: ResultEvidence): ClaimVerificationState;