import type { JsonObject } from "@decionis/agent-safe-pipeline"; import type { ChainHead } from "../audit/HashChain.js"; import type { LineWriter } from "../audit/LineAuditSink.js"; import type { PostureReport } from "../posture/HostPosture.js"; export declare const EVIDENCE_BUNDLE_VERSION = "agent-safe.evidence-bundle/1"; export declare class EvidenceError extends Error { readonly code: "EVIDENCE_DIR_NOT_CONFIGURED" | "EVIDENCE_WRITE_FAILED" | "EVIDENCE_SIGNING_FAILED"; constructor(code: "EVIDENCE_DIR_NOT_CONFIGURED" | "EVIDENCE_WRITE_FAILED" | "EVIDENCE_SIGNING_FAILED"); } /** * The last N lines of one stream, and how many fell off the end. * * The durable store for evidence is the log pipeline the lines are written * to; this window exists so an operator can take a bundle out of a running * process during an incident without first arranging log export. Saying how * many lines were dropped is the point: a bundle that silently held a partial * range would look like a complete one, and the chain's own sequence numbers * are what let a reader see the gap. */ export declare class LineWindow { readonly capacity: number; private readonly buffer; private droppedCount; constructor(capacity: number); push(line: string): void; /** Wraps a writer so every line it takes is also remembered here. */ tee(write: LineWriter): LineWriter; get lines(): readonly string[]; get dropped(): number; clear(): void; } /** One file in a bundle: what it is, how long, and what it hashes to. */ export interface BundleFile { readonly name: string; readonly bytes: number; readonly sha256: string; /** Lines this process no longer held when the bundle was made. */ readonly dropped?: number; } /** The bundle's own record of itself, and the only file a signature covers. */ export interface EvidenceBundleManifest { readonly version: typeof EVIDENCE_BUNDLE_VERSION; readonly exported_at: string; readonly exported_by: string; readonly reason: string; readonly package_version: string; readonly image: { readonly digest: string | null; readonly self_verified: false; }; readonly configuration_digest: string; readonly secrets: readonly { readonly name: string; readonly present: boolean; readonly rotations: number; }[]; readonly chains: Readonly>; readonly files: readonly BundleFile[]; } export interface EvidenceExportInput { /** The operator who asked, and the reason they gave. */ readonly principal: string; readonly reason: string; } export interface EvidenceExportOptions { readonly dir: string | null; readonly audit: LineWindow; readonly security: LineWindow; readonly packageVersion: string; /** As the platform reported it; a process cannot read its own image's digest. */ readonly imageDigest: string | null; readonly posture: () => PostureReport; readonly openAttempts: () => JsonObject; readonly heads: () => Readonly>; /** The non-secret configuration, for a digest over what this process was told. */ readonly configuration: () => JsonObject; /** * Secret names with presence and a rotation counter, and nothing else: not * a value, and not a digest of one either, because a low-entropy * credential's digest is a guessable oracle. */ readonly secrets: () => readonly { readonly name: string; readonly present: boolean; readonly rotations: number; }[]; readonly clock?: () => Date; /** Signs the manifest as a detached JWS; absent when no key is configured. */ readonly sign?: (payload: Uint8Array) => Promise; readonly writeFile?: (path: string, body: string) => void; readonly makeDir?: (path: string) => void; } export interface EvidenceBundle { readonly directory: string; readonly manifest: EvidenceBundleManifest; /** Present when a signing key was configured: a detached JWS over the manifest. */ readonly signature: string | null; } /** * An evidence bundle: what this process can say about an incident, written * where an operator can pick it up, with a manifest that digests every file * so a later reader can tell the bundle they hold is the bundle that was * made. * * What is deliberately not in it: any secret, any digest of a secret (a * low-entropy credential's digest is a guessable oracle), any request * parameter, and any provider body. The attempt journal holds parameters, so * it is named by identifier and state and never copied. What is in it is * identifiers, digests, statuses, counts and the two chained streams. * * Without a signing key the bundle proves its own internal consistency and * nothing about who produced it. With one it carries a detached JWS over the * manifest, and `verify-bundle` says which of the two a reader is holding * rather than letting the distinction pass unnoticed. */ export declare class EvidenceExport { private readonly options; private readonly clock; private readonly write; private readonly makeDir; constructor(options: EvidenceExportOptions); get configured(): boolean; export(input: EvidenceExportInput): Promise; } //# sourceMappingURL=EvidenceExport.d.ts.map