/** * What the gateway says about itself and each request, in two renderings: * human lines for a terminal, one JSON object per line for everything else. * The vocabulary keeps the authority's verdicts and the runtime's failure * states apart, so an unreachable authority never reads as a policy BLOCK. */ import { type ShadowReport } from "./ShadowLedger.js"; export type GatewayState = "ALLOW" | "BLOCK" | "ESCALATE" | "SHADOW" | "AUTHORITY_UNAVAILABLE" | "EXECUTION_FAILED" | "EXECUTION_INDETERMINATE" | "ERROR" /** The gateway's own refusal of a request for its subject: no authority was asked. */ | "REFUSED" /** An allowed payment a cumulative limit refused after the claim: nothing was sent. */ | "EXPOSURE_EXCEEDED" /** An allowed payment the exposure ledger could not be asked about: nothing was sent. */ | "EXPOSURE_UNAVAILABLE"; export type ExecutionDisposition = "FORWARDED" | "NOT_FORWARDED" | "HELD" | "PASSTHROUGH" | "FORWARDED_UNGOVERNED" | "FAILED" | "INDETERMINATE" /** A read reached the upstream and its answer was not relayed. */ | "WITHHELD"; /** * What a route that releases money found in the exposure ledger: within * every covering limit, no limit covering it, a limit exceeded, the ledger * unavailable (or, under an explicit fail-open, forwarded ungoverned), or, * in shadow, facts the request did not state. Limit keys and codes only: * never an amount or a subject. */ export interface ExposureReport { readonly status: "WITHIN_LIMIT" | "NOT_APPLICABLE" | "EXCEEDED" | "UNAVAILABLE" | "UNGOVERNED" | "UNREADABLE"; readonly reason_codes: readonly string[]; /** The limits reserved against, or the one exceeded. */ readonly limits: readonly string[]; /** Limits that cover the action but whose subject the route does not state. */ readonly unstated: readonly string[]; /** What became of the reservations once the upstream answered; null before then, or in shadow. */ readonly settlement: "SETTLED" | "RELEASED" | "KEPT" | "NONE" | "FAILED" | null; } export interface InterceptionReport { readonly event: "INTERCEPTED"; readonly at: string; readonly method: string; readonly path: string; readonly action: string; readonly state: GatewayState; readonly verdict: "ALLOW" | "ESCALATE" | "BLOCK" | null; readonly reason_codes: readonly string[]; readonly execution: ExecutionDisposition; readonly mode: "SHADOW" | "ENFORCEMENT"; readonly authority: string; readonly intent_id: string | null; readonly intent_hash: string | null; readonly decision_id: string | null; readonly dossier_id: string | null; readonly upstream_status: number | null; readonly finalization: string | null; readonly latency_ms: number; readonly authority_ms: number | null; /** * A forwarded write's effect, as the gateway read it back: `CONFIRMED` * when the read after it states what the call asked, `UNKNOWN` when it * states something else, and `PENDING`, with why, when nothing was read. * Present only for a write the upstream accepted in enforcement. */ readonly effect?: { readonly confirmation: "CONFIRMED" | "UNKNOWN" | "PENDING"; readonly reason_codes: readonly string[]; }; /** A route that releases money: what the exposure ledger said. */ readonly exposure?: ExposureReport; } export interface StartedReport { readonly event: "GATEWAY_STARTED"; readonly at: string; readonly gateway: string; readonly upstream: string; readonly mode: "SHADOW" | "ENFORCEMENT"; readonly authority: string; readonly failure_policy: "FAIL_CLOSED" | "FAIL_OPEN"; readonly routes: number; readonly evidence: string; readonly version: string; } export interface NoteReport { readonly event: "NOTE"; readonly at: string; readonly level: "info" | "warn" | "error"; readonly code: string; readonly message: string; } export interface StoppedReport { readonly event: "GATEWAY_STOPPED"; readonly at: string; readonly signal: string; } /** * Which enforcement boundary this process is, said once at start. It carries * identifiers and versions only: no address, no host, no container. */ export interface BoundaryIdentifiedReport { readonly event: "BOUNDARY_IDENTIFIED"; readonly at: string; readonly boundary_id: string; readonly boundary_source: "configured" | "derived"; readonly deployment_type: string; readonly environment: string | null; readonly protocol_version: string; readonly conformance_version: string; } /** * What software this boundary is standing in front of, said once at start. * Identifiers and digests only, and `trust_level` is always beside them: a * reader must never have to guess whether a digest was checked. */ export interface WorkloadResolvedReport { readonly event: "WORKLOAD_RESOLVED"; readonly at: string; readonly runtime: string | null; readonly artifact_type: string | null; readonly image: string | null; readonly digest: string | null; readonly publisher: string | null; readonly source: string; readonly trust_level: string; } export interface ActivationMilestoneReport { readonly event: "ACTIVATION"; readonly milestone: string; readonly at: string; } export type GatewayReport = InterceptionReport | StartedReport | BoundaryIdentifiedReport | WorkloadResolvedReport | NoteReport | StoppedReport | ActivationMilestoneReport | ShadowReport; /** The label a state prints under, spaced for reading. */ export declare function stateLabel(state: GatewayState): string; export declare function executionLabel(execution: ExecutionDisposition): string; export interface RenderOptions { readonly color: boolean; } /** * Renders one report for a terminal. Every state is a distinct heading, and * with color on, a distinct color; a shadow observation says what would have * been decided and that the request went through regardless. */ export declare function renderHuman(report: GatewayReport, options: RenderOptions): string; /** One line of JSON; the same fields, nothing rendered. */ export declare function renderJson(report: GatewayReport): string; //# sourceMappingURL=GatewayReport.d.ts.map