/** * The report of an acceptance run, `agent-safe.acceptance/1`: what the * gateway observed of the writes a plan named, what the agent's zone reported * of its own routes, the fingerprint both were observed under, and the fixed * list of what no run establishes * ([ADR 0009](../../../../docs/architecture/decisions/0009-acceptance-run-on-named-targets.md)). * * The gateway signs it with a key of its own, which signs nothing else. The * signature carries the gateway's word for what the gateway observed, and only * the zone's word for what the zone reported: every case says which. A report * establishes the named writes, targets and window, under one fingerprint; * it does not carry over to other adapters, routes or environments. */ import { type KeyObject } from "node:crypto"; import { type JsonValue } from "@decionis/agent-safe-pipeline"; import { z } from "zod"; import { type ZoneFindings } from "./ZoneProbes.js"; export declare const ACCEPTANCE_REPORT_VERSION = "agent-safe.acceptance/1"; /** The JWS `typ` of an acceptance report. */ export declare const ACCEPTANCE_REPORT_TYPE = "agent-safe-acceptance+jwt"; /** What a report says of its own reach, in every report. */ export declare const ACCEPTANCE_SCOPE = "This report establishes the named writes, targets, origins and window, under the fingerprint it carries, and nothing else. It does not carry over to other adapters, routes or environments."; /** What no run establishes, and why, in every report. */ export declare const STATED_NOT_RUN: readonly [{ readonly case: "grants_after_issuance"; readonly reason: "The agent's zone never holds a grant, so it has none to alter, replay or carry to another boundary; the zone's credential scan is what reports what it does hold. The authority's and the provider's refusals of an altered, replayed or misdirected grant are established by the build: the Changed Conditions Test, the Compromised Principal Test and the provider conformance vectors."; }, { readonly case: "lost_outcome_and_restart"; readonly reason: "Established by the build's trusted-executor proof, not by a run."; }, { readonly case: "downstream_consequences"; readonly reason: "No record establishes what a confirmed effect leads to."; }, { readonly case: "executor_host_integrity"; readonly reason: "No record establishes that the host running the boundary is the one deployed."; }, { readonly case: "node_and_kernel_isolation"; readonly reason: "No record establishes the isolation the platform under the boundary provides."; }]; /** One chained line the gateway wrote for a case, by its place in its stream. */ declare const LineSchema: z.ZodObject<{ stream: z.ZodString; seq: z.ZodNumber; hash: z.ZodString; event: z.ZodString; }, z.core.$strict>; /** What the gateway did with one request it governed, as it reported it. */ declare const GovernedSchema: z.ZodObject<{ upstream_status: z.ZodNullable; state: z.ZodNullable; verdict: z.ZodNullable>; execution: z.ZodNullable; intent_id: z.ZodNullable; decision_id: z.ZodNullable; dossier_id: z.ZodNullable; reason_codes: z.ZodArray; }, z.core.$strict>; declare const PermittedSchema: z.ZodObject<{ effect: z.ZodNullable; reason_codes: z.ZodArray; }, z.core.$strict>>; lines: z.ZodArray>; passed: z.ZodBoolean; failure: z.ZodNullable; upstream_status: z.ZodNullable; state: z.ZodNullable; verdict: z.ZodNullable>; execution: z.ZodNullable; intent_id: z.ZodNullable; decision_id: z.ZodNullable; dossier_id: z.ZodNullable; reason_codes: z.ZodArray; name: z.ZodString; method: z.ZodEnum<{ POST: "POST"; PUT: "PUT"; PATCH: "PATCH"; DELETE: "DELETE"; }>; path: z.ZodString; action: z.ZodNullable; observed_by: z.ZodLiteral<"GATEWAY">; }, z.core.$strict>; declare const ObservationSchema: z.ZodObject<{ outcome: z.ZodEnum<{ UNREADABLE: "UNREADABLE"; UNCHANGED: "UNCHANGED"; CHANGED: "CHANGED"; }>; version_before: z.ZodNullable; version_after: z.ZodNullable; read_before_at: z.ZodNullable; read_after_at: z.ZodNullable; }, z.core.$strict>; declare const ProhibitedSchema: z.ZodObject<{ observation: z.ZodNullable; version_before: z.ZodNullable; version_after: z.ZodNullable; read_before_at: z.ZodNullable; read_after_at: z.ZodNullable; }, z.core.$strict>>; lines: z.ZodArray>; passed: z.ZodBoolean; failure: z.ZodNullable; upstream_status: z.ZodNullable; state: z.ZodNullable; verdict: z.ZodNullable>; execution: z.ZodNullable; intent_id: z.ZodNullable; decision_id: z.ZodNullable; dossier_id: z.ZodNullable; reason_codes: z.ZodArray; name: z.ZodString; method: z.ZodEnum<{ POST: "POST"; PUT: "PUT"; PATCH: "PATCH"; DELETE: "DELETE"; }>; path: z.ZodString; action: z.ZodNullable; canary: z.ZodString; observed_by: z.ZodLiteral<"GATEWAY">; shadow: z.ZodObject<{ verdict: z.ZodNullable>; reason_codes: z.ZodArray; decision_id: z.ZodNullable; dossier_id: z.ZodNullable; }, z.core.$strict>; sent: z.ZodBoolean; }, z.core.$strict>; declare const OutageSchema: z.ZodObject<{ name: z.ZodString; method: z.ZodEnum<{ POST: "POST"; PUT: "PUT"; PATCH: "PATCH"; DELETE: "DELETE"; }>; path: z.ZodString; action: z.ZodNullable; observed_by: z.ZodLiteral<"GATEWAY">; skipped: z.ZodNullable>; status: z.ZodNullable; execution: z.ZodNullable; reason_codes: z.ZodArray; upstream_writes: z.ZodNumber; passed: z.ZodBoolean; failure: z.ZodNullable; }, z.core.$strict>; /** Which of the gateway's routes the authority decides, and which it does not, by kind. */ export declare const CoverageSchema: z.ZodObject<{ governed: z.ZodArray; path: z.ZodString; action: z.ZodNullable; target_read: z.ZodBoolean; }, z.core.$strict>>; ungoverned: z.ZodArray; path: z.ZodString; action: z.ZodNullable; kind: z.ZodEnum<{ SHADOW: "SHADOW"; FAIL_OPEN: "FAIL_OPEN"; PASSTHROUGH: "PASSTHROUGH"; }>; }, z.core.$strict>>; refused: z.ZodArray; path: z.ZodString; action: z.ZodNullable; }, z.core.$strict>>; reads: z.ZodEnum<{ PASSTHROUGH: "PASSTHROUGH"; CHECK: "CHECK"; REFUSE_UNKNOWN: "REFUSE_UNKNOWN"; }>; }, z.core.$strict>; export type Coverage = z.infer; export declare const AcceptanceReportSchema: z.ZodObject<{ report: z.ZodLiteral<"agent-safe.acceptance/1">; run_id: z.ZodString; boundary_id: z.ZodString; issued_at: z.ZodString; expires_at: z.ZodString; plan_digest: z.ZodString; fingerprint: z.ZodObject<{ digest: z.ZodString; document: z.ZodType>; }, z.core.$strict>; coverage: z.ZodObject<{ governed: z.ZodArray; path: z.ZodString; action: z.ZodNullable; target_read: z.ZodBoolean; }, z.core.$strict>>; ungoverned: z.ZodArray; path: z.ZodString; action: z.ZodNullable; kind: z.ZodEnum<{ SHADOW: "SHADOW"; FAIL_OPEN: "FAIL_OPEN"; PASSTHROUGH: "PASSTHROUGH"; }>; }, z.core.$strict>>; refused: z.ZodArray; path: z.ZodString; action: z.ZodNullable; }, z.core.$strict>>; reads: z.ZodEnum<{ PASSTHROUGH: "PASSTHROUGH"; CHECK: "CHECK"; REFUSE_UNKNOWN: "REFUSE_UNKNOWN"; }>; }, z.core.$strict>; permitted: z.ZodArray; reason_codes: z.ZodArray; }, z.core.$strict>>; lines: z.ZodArray>; passed: z.ZodBoolean; failure: z.ZodNullable; upstream_status: z.ZodNullable; state: z.ZodNullable; verdict: z.ZodNullable>; execution: z.ZodNullable; intent_id: z.ZodNullable; decision_id: z.ZodNullable; dossier_id: z.ZodNullable; reason_codes: z.ZodArray; name: z.ZodString; method: z.ZodEnum<{ POST: "POST"; PUT: "PUT"; PATCH: "PATCH"; DELETE: "DELETE"; }>; path: z.ZodString; action: z.ZodNullable; observed_by: z.ZodLiteral<"GATEWAY">; }, z.core.$strict>>; prohibited: z.ZodArray; version_before: z.ZodNullable; version_after: z.ZodNullable; read_before_at: z.ZodNullable; read_after_at: z.ZodNullable; }, z.core.$strict>>; lines: z.ZodArray>; passed: z.ZodBoolean; failure: z.ZodNullable; upstream_status: z.ZodNullable; state: z.ZodNullable; verdict: z.ZodNullable>; execution: z.ZodNullable; intent_id: z.ZodNullable; decision_id: z.ZodNullable; dossier_id: z.ZodNullable; reason_codes: z.ZodArray; name: z.ZodString; method: z.ZodEnum<{ POST: "POST"; PUT: "PUT"; PATCH: "PATCH"; DELETE: "DELETE"; }>; path: z.ZodString; action: z.ZodNullable; canary: z.ZodString; observed_by: z.ZodLiteral<"GATEWAY">; shadow: z.ZodObject<{ verdict: z.ZodNullable>; reason_codes: z.ZodArray; decision_id: z.ZodNullable; dossier_id: z.ZodNullable; }, z.core.$strict>; sent: z.ZodBoolean; }, z.core.$strict>>; outage: z.ZodArray; path: z.ZodString; action: z.ZodNullable; observed_by: z.ZodLiteral<"GATEWAY">; skipped: z.ZodNullable>; status: z.ZodNullable; execution: z.ZodNullable; reason_codes: z.ZodArray; upstream_writes: z.ZodNumber; passed: z.ZodBoolean; failure: z.ZodNullable; }, z.core.$strict>>; zone: z.ZodObject<{ origins: z.ZodArray; detail: z.ZodString; }, z.core.$strict>; control: z.ZodObject<{ status: z.ZodNullable; detail: z.ZodString; }, z.core.$strict>; verdict: z.ZodEnum<{ REACHABLE: "REACHABLE"; CONTAINED: "CONTAINED"; INCONCLUSIVE: "INCONCLUSIVE"; }>; at: z.ZodISODateTime; }, z.core.$strict>>; providers: z.ZodArray; reason_code: z.ZodNullable; detail: z.ZodString; }, z.core.$strict>; signed: z.ZodNullable; reason_code: z.ZodNullable; detail: z.ZodString; }, z.core.$strict>>; verdict: z.ZodEnum<{ REFUSED: "REFUSED"; INCONCLUSIVE: "INCONCLUSIVE"; ACCEPTED: "ACCEPTED"; }>; at: z.ZodISODateTime; }, z.core.$strict>>; mcp: z.ZodArray; detail: z.ZodString; at: z.ZodISODateTime; }, z.core.$strict>>; credentials: z.ZodArray; name: z.ZodString; kind: z.ZodEnum<{ jwt: "jwt"; "pem-private-key": "pem-private-key"; "url-with-userinfo": "url-with-userinfo"; "aws-access-key": "aws-access-key"; "aws-secret-key": "aws-secret-key"; "aws-session-token": "aws-session-token"; "azure-client-secret": "azure-client-secret"; "github-token": "github-token"; "credential-file-path": "credential-file-path"; "secret-like": "secret-like"; "service-account-token": "service-account-token"; "web-identity-token": "web-identity-token"; "aws-credentials": "aws-credentials"; "gcp-credentials": "gcp-credentials"; "azure-cli-credentials": "azure-cli-credentials"; kubeconfig: "kubeconfig"; "docker-config": "docker-config"; netrc: "netrc"; npmrc: "npmrc"; }>; own: z.ZodBoolean; }, z.core.$strict>>; metadata: z.ZodNullable; detail: z.ZodString; verdict: z.ZodEnum<{ REACHABLE: "REACHABLE"; CONTAINED: "CONTAINED"; INCONCLUSIVE: "INCONCLUSIVE"; }>; at: z.ZodISODateTime; }, z.core.$strict>>; }, z.core.$strict>; stated: z.ZodArray>; verdict: z.ZodEnum<{ ACCEPTED: "ACCEPTED"; NOT_ACCEPTED: "NOT_ACCEPTED"; }>; failures: z.ZodArray>; scope: z.ZodLiteral<"This report establishes the named writes, targets, origins and window, under the fingerprint it carries, and nothing else. It does not carry over to other adapters, routes or environments.">; }, z.core.$strict>; export type AcceptanceReport = z.infer; export type PermittedCase = z.infer; export type ProhibitedCase = z.infer; export type OutageCase = z.infer; export type CaseLine = z.infer; export type GovernedOutcome = z.infer; export type TargetObservation = z.infer; /** * Whether a permitted write went as the plan says it should: allowed, * forwarded once, answered `2xx`, and not read back as something else. A * write whose effect was not read passes as `PENDING`, which says so. */ export declare function judgePermitted(outcome: GovernedOutcome, effect: { readonly confirmation: "CONFIRMED" | "UNKNOWN" | "PENDING"; } | null): { readonly passed: boolean; readonly failure: string | null; }; /** * Whether a prohibited write was refused and its target read unchanged * after: decided BLOCK or ESCALATE in shadow, sent, refused in enforcement, * and observed `UNCHANGED`. Anything less fails, and says how. */ export declare function judgeProhibited(input: { readonly shadow: ProhibitedCase["shadow"]["verdict"]; readonly sent: boolean; readonly outcome: GovernedOutcome; readonly observation: TargetObservation | null; }): { readonly passed: boolean; readonly failure: string | null; }; /** Whether the second gateway refused with the authority down and sent nothing on. */ export declare function judgeOutage(input: { readonly status: number | null; readonly execution: string | null; readonly upstreamWrites: number; }): { readonly passed: boolean; readonly failure: string | null; }; /** * The zone's findings that fail a run, by case and name. An origin passes * only `CONTAINED`; a provider only when it refused both writes; the metadata * endpoint, when probed, only when it did not answer. Reachable MCP servers * and the credentials found are listed, not judged: what the zone may hold is * the operator's to say. */ export declare function zoneFailures(zone: ZoneFindings): readonly { readonly case: string; readonly name: string; readonly code: string; }[]; /** The run's verdict: accepted only when every case that ran passed. */ export declare function acceptanceVerdict(cases: { readonly permitted: readonly PermittedCase[]; readonly prohibited: readonly ProhibitedCase[]; readonly outage: readonly OutageCase[]; readonly zone: ZoneFindings; }): Pick; /** `sha256:` over a value's RFC 8785 form. */ export declare function canonicalDigest(value: JsonValue): string; /** `sha256:` over the report as signed, the compact JWS's own bytes. */ export declare function reportDigest(token: string): string; /** A gateway's acceptance key: Ed25519, with the `kid` reports carry. */ export interface AcceptanceSigningKey { readonly kid: string; readonly privateKey: KeyObject; readonly publicJwk: { readonly kty: "OKP"; readonly crv: "Ed25519"; readonly x: string; }; } /** * Reads a PKCS#8 PEM Ed25519 key. The `kid` is the one configured, or the * key's RFC 7638 thumbprint, so the same key always has the same id. */ export declare function acceptanceSigningKey(pem: string, kid?: string | null): AcceptanceSigningKey; /** The compact JWS: `alg` EdDSA, `typ` the acceptance report's, `kid` the key's. */ export declare function signAcceptanceReport(report: AcceptanceReport, key: AcceptanceSigningKey): Promise; export type AcceptanceReportRead = { readonly ok: true; readonly kid: string; readonly report: AcceptanceReport; } | { readonly ok: false; readonly code: string; }; /** * Checks a report's signature against a public key, its shape against the * schema, and that its fingerprint digest is the digest of the document it * carries. It does not ask whether the deployment is still the one tested: * that is a comparison with a running gateway, made apart from this. */ export declare function readAcceptanceReport(token: string, publicJwk: Readonly>): Promise; export type Currency = { readonly state: "CURRENT"; } | { readonly state: "EXPIRED"; readonly expired_at: string; } | { readonly state: "STALE"; readonly changed: readonly string[]; }; /** * Whether a report still describes a deployment: `EXPIRED` once its date * has passed, `STALE` with the fingerprint fields that differ when the * deployment is no longer the one tested, `CURRENT` otherwise. It changes * nothing anywhere: a stale report is reported, never enforced. */ export declare function currency(report: AcceptanceReport, running: { readonly digest: string; readonly document: object; }, now: number, changed: (before: object, after: object) => readonly string[]): Currency; export {}; //# sourceMappingURL=AcceptanceReport.d.ts.map