import { type JsonObject, type TargetPrecondition } from "@decionis/agent-safe-pipeline"; import type { RegisteredEffect } from "../adapters/EffectEvidenceRegister.js"; /** The record the gateway writes for what it read back, beside the executor's BEAP record. */ export declare const GATEWAY_EFFECT_PROFILE = "agent-safe.gateway-effect/1"; export type Sha256 = `sha256:${string}`; /** * Why an attempt's effect stays `PENDING`: what the gateway was not asked to * read back, or could not. * * - `EFFECT_UNDECLARED`: the write's operation names no effect, or no read; * - `EFFECT_UNSTATED`: the call states none of the values its effect names; * - `EFFECT_NOT_BOUND`: facts-only privacy, where no digest of the call's * values may leave the gateway, so the grant commits to none; * - `EFFECT_NOT_READ`: the upstream answered with a redirect, not a `2xx`; * - `EFFECT_UNREADABLE`: the read after the write did not answer. */ export type EffectPending = "EFFECT_UNDECLARED" | "EFFECT_UNSTATED" | "EFFECT_NOT_BOUND" | "EFFECT_NOT_READ" | "EFFECT_UNREADABLE"; /** What a write expects its read to state once it has landed, and the digest the grant commits to. */ export interface ExpectedEffect { readonly expected: JsonObject; readonly digest: Sha256; } /** What the gateway says about one forwarded attempt's effect, in the confirmation vocabulary. */ export interface EffectStatement { readonly confirmation: "CONFIRMED" | "UNKNOWN" | "PENDING"; readonly reasonCodes: readonly string[]; } /** One read after a write: the record the finalization carries, and what the report says. */ export interface ObservedEffect { readonly record: RegisteredEffect; readonly statement: EffectStatement; } /** What a read after a refusal showed: the target where it was, moved, or not stated. */ export type RefusalOutcome = "UNCHANGED" | "CHANGED" | "UNREADABLE"; /** * The digest of an effect projection: SHA-256 over the RFC 8785 form of the * operation that names it (`#`) and the projection. The * one function makes the expected digest at capture and the observed one * after the read, so equal projections are equal digests, which is all the * authority compares. Only this gateway computes either, so it is total: a * value another language's JSON writer would spell differently still has one * digest here. */ export declare function effectDigest(operation: string, projection: JsonObject): Sha256; /** * What a write's call lets the grant commit to: nothing when its operation * names no effect (`null`), when the call states none of it (`{}`), or under * facts-only privacy; otherwise the expectation and its digest. */ export declare function expectEffect(operation: string, expected: JsonObject | null, factsOnly: boolean): ExpectedEffect | EffectPending; /** * The record of one read after a write, as the finalization carries it: the * expectation against what the read stated, `null` when it did not answer. * A match is `CONFIRMED`, the gateway's read-back being a method a profile * declared; the authority still records it so only from an observer on its * own allowlist. A difference is `UNKNOWN` with `EFFECT_MISMATCH`: something * landed, and what it was is exactly what nobody can say. No answer is * `PENDING`. The record carries digests, pointers and statuses: no value of * the call or the answer. */ export declare function effectRecord(input: { readonly operation: string; readonly effect: ExpectedEffect; readonly observed: JsonObject | null; readonly observedAt: string; }): ObservedEffect; /** * A read after a refusal against the read before the decision: the version * the same, another, or none stated. Unchanged says no write landed on that * resource between the two reads, by any route; it says nothing about any * other resource or any other time. */ export declare function refusalOutcome(before: TargetPrecondition, after: TargetPrecondition | null): RefusalOutcome; //# sourceMappingURL=TargetEffect.d.ts.map