@sema-agent/core
Version:
Stateless, task-oriented AI agent core
798 lines • 58.6 kB
TypeScript
/**
* The settlement record and the gate outcome — the L0 vocabulary of what ONE tool-gate pass decided,
* what ask it settled and who asked. One structure, minted once (the gate's exit; the decide lane for a
* durable park) and projected three times without re-derivation: the `permissionDenied` observer's
* payload, the call's `tool_end` frame, and the durable row's resolved outcome. Lives beside
* `tool-policy.ts` rather than in it because it is a different concern from the permission verdict a
* policy composes: a policy says allow / ask / deny; this file says how the pass that consumed that
* verdict ended.
*/
import { type Arbitration, type AskClass, type AskOrigin, type AssertAllKeysHandled, type ModeReleaseReason, type PermissionMode, type PersistedRuleMandate } from "./ask-origin.js";
import { type AutoModeClassifierRound, type AutoModeFallbackCause } from "./auto-mode.js";
import { type AllowRuleClearance } from "./allow-rule-shadow.js";
import type { ResolvedOutcome } from "./checkpoint-store.js";
import { type RefusalEcho } from "./refusal-echo.js";
import { type ClassifierCategory } from "./classifier-category.js";
/**
* How the wait an ask was in ENDED — the closed set. One word per way a wait can end; the `who` on the
* record says which party ended it and is fixed BY the word (see {@link Settlement}).
* - `human_allowed` / `human_refused` — a person (or the approver acting for one) decided; the refusal's
* own note, when the decider attached one, rides `note`.
* - `policy_allowed` / `policy_refused` — the DEPLOYMENT'S OWN POLICY decided: the approval channel reported
* that a machine, not a person, answered this ask (an unattended lane answering by class, a headless lane
* with no interactive approval surface, a standing deployment posture). A person and a policy are the two
* DECIDERS: each answers either way, with the same capabilities, and differs only in whose decision the
* record names. A policy's refusal is distinct from `human_refused` because the model is told a different
* thing: a person's "no" is the user's direction, a policy's is a capability of this run. Distinct from
* `no_approver` because an approval channel WAS wired and answered — core did not fall back to its own
* headless posture. The refusal's own note, when the channel attached one, reaches the model as the
* policy's words and NOT as a person's; it is not on this record (the note seat belongs to the person's
* two words, whose ABSENCE is a control-flow fact the policy's do not have).
* - `approval_window_expired` — an approval window elapsed with no answer: the engine's own approval
* factory window (`createApprovalPolicy.approvalTimeoutMs`), or a synchronous host approver that
* reported its own window elapsed.
* - `denial_limit_window_expired` — the classifier denial-limit fallback's auto-deny window (core's own
* timer over the synchronous leg) elapsed with no answer.
* - `park_sla_expired` — a DURABLE park's SLA deadline passed and the host's sweep resolved it as a deny
* (FACET A). A store `expire`/`reap` produces no `tool_end` and therefore no settlement.
* - `no_approver` — headless: no approver (or no question face) is wired, or the deny posture string (arguments no approval
* can be bound to are refused there in the binding's own sentence, under this word).
* - `approver_unavailable` — the approver (or an ancestor's frozen approver) answered the ROUTING question
* "nobody reachable", and no park took the ask.
* - `approver_error` — the approver threw.
* - `approver_contract` — the approver answered outside its contract (a non-boolean verdict, an
* unreadable member, a timeout-settled allow, a refused attribution…).
* - `presentation_failed` — at a seat with an approver, the arguments could not be bound (`bindableArgsOf`: not a record of plain
* JSON data nested at most 256 levels deep): the asked ones — nobody was asked — or a resolution's edit (the engine's resolver's
* or, recorded by the gate, a host resolver's) — its yes is not used.
* - `blanket_allow_refused` — an allow NO PERSON JUDGED met a `requiresRealApproval` ask: a blanket
* `onAsk:"allow"`, or an approver's allow it reported as the deployment's policy (`settledBy: "policy"`).
* - `task_aborted` — the wait's abort signal ended it (the run's own end, or a turn-level interrupt).
* - `approval_withdrawn` — the HOST's approval system closed the question before anyone answered it, while the
* run that asked is still going (a sibling of a batch whose outcome made this question moot, every target the
* card was sent to gone, a replay of a row its system had already closed): nobody refused, the call did not
* run, and asking again is legitimate. A synchronous approver reports it as `settledBy: "withdrawn"`; the
* host is the party (`who.party: "host"`, as for its own elapsed window), never `none` — that party is the
* engine's own fail-closed ends, which a host does not get to stamp.
* - `manager_allowed` / `manager_refused` — the run that dispatched this worker declared `TaskSpec.managerApproves`, and
* its manager's side judgment answered this plain ordinary card before it reached the approval seat. Minted only by
* the engine's manager station; no host outcome or decision carries it. Not a person's answer: it unlocks no ask that
* requires real approval, stores no rule or grant, and a refusal is not the user's direction.
*/
export declare const SETTLEMENT_KINDS: readonly ["human_allowed", "human_refused", "approval_window_expired", "denial_limit_window_expired", "park_sla_expired", "no_approver", "approver_unavailable", "approver_error", "approver_contract", "presentation_failed", "blanket_allow_refused", "policy_allowed", "policy_refused", "task_aborted", "approval_withdrawn", "manager_allowed", "manager_refused"];
export type SettlementKind = (typeof SETTLEMENT_KINDS)[number];
/** Membership test for {@link SettlementKind} — the word crosses process boundaries on `tool_end`, so a
* consumer validating one it received must not hand-roll the set. */
export declare function isSettlementKind(v: unknown): v is SettlementKind;
/**
* The settlement record: WHAT ended the wait (`kind`), WHO ended it (`who` — its shape is decided by the
* word: the person's two words carry a person, the policy's two words the policy, the window words say whose
* window, the park word the host, the fail-closed family nobody), WHEN (epoch ms, written at the settlement site), and for a person's
* refusal the decider's own NOTE when one was attached (a refusal WITHOUT a note is a bare "no", the arm
* the runner treats as a control-flow boundary for the issuing batch).
*
* It is a discriminated union and not a free product of `kind` × `who` on purpose: a free product can
* express "human_allowed, ended by the engine's window" — a structurally complete record that contradicts
* itself — and a consumer would then need the pairing rules this shape makes unwritable.
*
* @contract settlement.single_mint — every `Settlement` kind is composed by CORE at the site whose wait
* ended (the ask resolver's arms, the approval factory's arms, the decide lane over a host's decision
* FACTS), and the four DECIDER words by one composer ({@link settledByDecider}). A host never mints a kind: a synchronous approver reports `"human"`/`"timeout"`/`"policy"`/`"withdrawn"` on its
* outcome and a durable decide reports `hostDecision.decidedBy` (`"person"`/`"sla_timeout"`/`"policy"`) — facts
* core turns into the word. A settlement reaches the gate's exit only inside an engine-minted record on the decision
* (`PermissionResult.attestation`, {@link import("./tool-policy.js").EngineAttestation}), which a policy cannot compose:
* the receipt refuses a record the engine did not mint.
*/
export type Settlement = {
kind: "human_allowed" | "human_refused";
who: {
party: "person";
approver?: string;
};
when: number;
note?: string;
} | {
kind: "policy_allowed" | "policy_refused";
who: {
party: "policy";
approver?: string;
};
when: number;
} | {
kind: "approval_window_expired";
who: {
party: "engine";
window: "approval_factory";
} | {
party: "host";
};
when: number;
} | {
kind: "approval_withdrawn";
who: {
party: "host";
};
when: number;
} | {
kind: "denial_limit_window_expired";
who: {
party: "engine";
window: "denial_limit";
};
when: number;
} | {
kind: "park_sla_expired";
who: {
party: "host";
approver?: string;
};
when: number;
} | {
kind: "manager_allowed" | "manager_refused";
who: {
party: "manager";
};
when: number;
} | {
kind: "no_approver" | "approver_unavailable" | "approver_error" | "approver_contract" | "presentation_failed" | "blanket_allow_refused" | "task_aborted";
who: {
party: "none";
};
when: number;
};
/**
* WHO ended a wait — the closed set of `Settlement.who.party` words, one per party a record can name:
* `person` (a person decided), `policy` (the deployment's own policy decided), `engine` (one of the engine's
* own windows elapsed), `host` (the host's window or its park sweep), `none` (nobody: the engine ended the
* wait itself — no approver, a throw, an abort, an out-of-contract answer), `manager` (the dispatching run's manager
* judged a worker's card, `TaskSpec.managerApproves`). Which party a word names is
* fixed by the word ({@link Settlement}); the word crosses process boundaries on `tool_end`, so a consumer
* validating a record it received reads this set rather than hand-rolling one.
*/
export declare const SETTLEMENT_PARTIES: readonly ["person", "policy", "engine", "host", "none", "manager"];
export type SettlementParty = (typeof SETTLEMENT_PARTIES)[number];
/** Compile-time fence: `never` while the closed set and the record's `who.party` union are the same words. */
export type SettlementPartiesMatchTheRecord = AssertAllKeysHandled<Exclude<Settlement["who"]["party"], SettlementParty> | Exclude<SettlementParty, Settlement["who"]["party"]>>;
/** Membership test for {@link SettlementParty}. */
export declare function isSettlementParty(v: unknown): v is SettlementParty;
/** Who REPORTED a durable decide (`hostDecision.decidedBy`): a person, the host's own SLA sweep at the row's deadline, or the
* deployment's policy — the closed set; a host's decide door mirrors the words it accepts from this one. */
export declare const HOST_DECIDERS: readonly ["person", "sla_timeout", "policy"];
export type HostDecider = (typeof HOST_DECIDERS)[number];
export declare const isHostDecider: (word: unknown) => word is HostDecider;
/**
* WHICH MACHINE SEAT answered when the deployment's policy decided an ask — the closed set of the `decidedVia` member
* (`AskOutcome.decidedVia` on the synchronous leg, `hostDecision.decidedVia` on a durable decide; one word set, one
* name, both faces). It refines the policy decider and nothing else: a person, an elapsed window and the host's SLA
* sweep are not machines that answered, so the member beside any other decider word is refused, never ignored.
* - `policy` — the deployment's own policy answered (an unattended lane answering by class, a headless lane whose
* seat can show nobody a prompt). ABSENT reads the same: an unrevised host is unchanged.
* - `permission_request_hook` — a PermissionRequest hook answered the ask on the deployment's behalf (the
* reference's `decisionReason.type: "hook"` with `hookName: "PermissionRequest"`, `iPt` (cli309.js:288208) /
* `runHooks` (cli309.js:295883)). A hook's refusal is not "this run has no approval channel": something DID answer,
* and the model reads that the hook declined, with the hook's own words.
* - `host_window_closed` — the deployment's policy refused because the host's OWN approval window closed with no one
* answering (a deployment that declares "refuse when the window runs out"). A person could have answered, so this is
* neither "no interactive approval channel" nor "headless": the sentences that name the refusal say the window closed.
* A refusal's seat only ({@link DECIDED_VIA_MAY_ALLOW}): a window that ran out approves nothing.
* The record is unchanged by it (`policy_allowed` / `policy_refused`, `who.party: "policy"`): the member decides which
* sentence the model reads ({@link import("./tool-policy.js").policyRefusalMessage}), not which party the record names.
*/
export declare const DECIDED_VIA: readonly ["policy", "permission_request_hook", "host_window_closed"];
export type DecidedVia = (typeof DECIDED_VIA)[number];
export declare const isDecidedVia: (word: unknown) => word is DecidedVia;
/** The model-facing NAME of each machine seat a policy decision can come from ({@link policyDeciderOf}). */
declare const POLICY_DECIDER_NAMES: Readonly<{
readonly policy: "this deployment's own policy";
readonly permission_request_hook: "a PermissionRequest hook";
readonly host_window_closed: "this deployment's policy when its approval window closed with no one answering it";
}>;
/** The fence over the name table: `never` while every seat word has a name. */
export type PolicyDeciderNamesCoverEverySeat = AssertAllKeysHandled<Exclude<DecidedVia, keyof typeof POLICY_DECIDER_NAMES>>;
/** May a seat be what APPROVED a call — read by the one screen both doors hold the member to
* ({@link import("./tool-policy.js").screenDecidedVia}); an allow from a seat with `false` is the approver's contract defect. */
export declare const DECIDED_VIA_MAY_ALLOW: Readonly<{
readonly policy: true;
readonly permission_request_hook: true;
readonly host_window_closed: false;
}>;
/** The fence over the allow table: `never` while every seat word has a row. */
export type DecidedViaAllowTableCoversEverySeat = AssertAllKeysHandled<Exclude<DecidedVia, keyof typeof DECIDED_VIA_MAY_ALLOW>>;
/**
* THE reading of `decidedVia` — the one place its absence folds ("absent ⇒ the deployment's own policy") and the one
* place each seat is NAMED to the model. Every sentence that names who REFUSED a tool approval for the policy reads it:
* the refusal composer ({@link import("./tool-policy.js").policyRefusalMessage}, all three legs) and the durable
* resume's continuation reminder, so the tool result and the reminder about the same refusal can never name two
* different deciders. A sentence about a policy's ALLOW that a later check refuses names the party alone ("not a
* person"), and so does a plan pause's reminder.
*/
export declare function policyDeciderOf(decidedVia: DecidedVia | undefined): {
readonly seat: DecidedVia;
readonly name: string;
};
/** The host's DECISION FACTS on a durable decide — who ended the wait, and the attribution the approval channel
* reported for that party. ONE shape for every decide that records its decider (a tool approval's and a plan
* pause's); core mints the settlement word from it ({@link settlementOfHostDecision}), the host never supplies one.
* `decidedVia` — which machine seat answered for a `"policy"` decider ({@link DECIDED_VIA}); legal only beside
* `decidedBy: "policy"`, absent ⇒ the deployment's policy. */
export interface HostDecisionFacts {
decidedBy: HostDecider;
approver?: string;
decidedVia?: DecidedVia;
}
/** The DECIDER arms of {@link Settlement} — a person's and the deployment policy's, the two parties that
* answer an ask either way. Named so a site that both composes one and quotes its note can read the seat
* off the record instead of re-deriving it. */
export type DeciderSettlement = Extract<Settlement, {
who: {
party: "person" | "policy";
};
}>;
/**
* A decider's NOTE, normalised — the one rule for "did the decider say anything": empty text is a
* decider who attached nothing and reads as absent wherever the note travels. Whitespace-only text is
* not empty by this rule and stays a note: that half is PINNED CURRENT BEHAVIOUR, not a promise —
* nothing here requires a note to carry content, and narrowing it is a separate decision with its own
* consumers to warn.
*/
export declare function decidersNote(text: string | undefined): string | undefined;
/**
* THE mint for a decider's settlement — the party (a person, or the deployment's own policy) and its verdict
* pick the word, and the channel's attribution is transcribed onto `who`. The synchronous resolver's arms,
* the approval factory's arms and the durable decide lane all compose their decider record here, so one
* answer cannot end as two different records depending on which path carried it, and the two parties are
* one rule with a parameter rather than two composers.
*
* @contract settlement.note — the `note` seat is the PERSON's: filled exactly when the person attached a
* reason, and its absence is how the record says the refusal was bare (the runner reads that absence, and
* nothing else, as the issuing batch's control-flow boundary). Empty text folds to absence HERE, once, for
* every path that fills the seat ({@link decidersNote}); a site that hand-builds the record instead is a
* second answer to the same question, which is how one path came to halt a batch the other let run. A
* policy's record has no note seat — its words reach the model inside the policy sentence, and a policy's
* refusal is never a control-flow boundary — so a note handed with the policy party is not filed here.
*/
export declare function settledByDecider(party: DeciderSettlement["who"]["party"], verdict: "allowed" | "refused", approver: string | undefined, note?: string): DeciderSettlement;
/** The members a settlement record gives a booked row: its `who` — `party`, and `approver` when the record holds one — or nothing
* when there is no record or it names nobody (`none` is never booked). The one reading for every mint that books a row (the
* synchronous ask lane, a reused grant, a durable resume), so a row and the frame of the same record name the same answerer. */
export declare function rowDeciderOf(settlement: Settlement | undefined): {
party: Exclude<SettlementParty, "none">;
approver?: string;
} | Record<never, never>;
/**
* THE mint for a durable decide's settlement, from the host's decision FACTS: the SLA sweep's word is the host's own
* record (`park_sla_expired`, whatever the verdict — the capture refuses a sweep that allows), a person's and the
* deployment policy's go through {@link settledByDecider}. Every durable decide that records its decider — a tool
* approval's and a plan pause's — composes its record here, so one answer cannot end as two records depending on
* which kind of row it resolved. `note` is the decider's own text on a refusal (filed on the person's refusal only).
*/
export declare function settlementOfHostDecision(facts: HostDecisionFacts, verdict: "allowed" | "refused", note?: string): Settlement;
/** Which settlement kinds are REFUSALS (the ask ended as a deny). Total over the closed set — the fence
* below refuses a member without a row — so invariant I2 is a table lookup, not a list in a condition. */
export declare const SETTLEMENT_IS_REFUSAL: {
readonly human_allowed: false;
readonly human_refused: true;
readonly approval_window_expired: true;
readonly denial_limit_window_expired: true;
readonly park_sla_expired: true;
readonly no_approver: true;
readonly approver_unavailable: true;
readonly approver_error: true;
readonly approver_contract: true;
readonly presentation_failed: true;
readonly blanket_allow_refused: true;
readonly policy_allowed: false;
readonly policy_refused: true;
readonly task_aborted: true;
readonly approval_withdrawn: true;
readonly manager_allowed: false;
readonly manager_refused: true;
};
/** Compile-time fence: `never` while every settlement kind has a refusal row. */
export type SettlementRefusalTableCoversEveryKind = AssertAllKeysHandled<Exclude<SettlementKind, keyof typeof SETTLEMENT_IS_REFUSAL>>;
/**
* Which settlement kinds are a refusal NOBODY JUDGED — the wait ended because this run has no one who
* could answer the question, not because someone considered it and said no. The classifier's
* denial-limit fallback reads it: that fallback exists to bound a classifier that would otherwise deny
* without end, and its last resort is to STOP the run rather than let the model keep re-asking a
* question nothing in this deployment can answer.
*
* It is a TABLE and not a condition for the reason the sibling above is: this question used to be a
* hand-written two-word disjunction at one site and a three-word one at another, so a settlement word
* added later answered it by falling out of both — which is exactly what `policy_refused` did on the
* commit that introduced it (a headless lane that refused by policy stopped reaching the stop seat that
* the same lane reached when it refused by returning a bare `false`).
*
* The rows that say `false` each say something:
* - the person's two words, `policy_allowed` and the window words — someone WAS asked; a decider answered,
* or a window ran out. The run is not out of judges. (`policy_refused` is `true`: the deployment's own
* policy declined a question it exists to answer, so nothing in this run will say yes to it.)
* - `approver_unavailable` — a ROUTING answer, not a posture: the main gate owns that arm (it may park
* the ask on a durable queue instead), and the two sites that treat it as headless anyway say so at
* their own call, because they are the ones with no park route left.
* - `approver_error` / `approver_contract` / `presentation_failed` — the approver was there and the
* engine could not use its answer, or could not put these arguments before it (or adopt its edit). Not a
* deployment with nobody home: with no approver, such arguments are refused under `no_approver`.
* - `task_aborted` — the run ended; nothing is escalating anywhere.
* - `approval_withdrawn` — the question was taken back before anyone answered it, not left with nobody to
* answer it: the same call asked again reaches the same approval system.
*/
export declare const SETTLEMENT_NOBODY_JUDGED: {
readonly human_allowed: false;
readonly human_refused: false;
readonly approval_window_expired: false;
readonly denial_limit_window_expired: false;
readonly park_sla_expired: false;
readonly no_approver: true;
readonly approver_unavailable: false;
readonly approver_error: false;
readonly approver_contract: false;
readonly presentation_failed: false;
readonly blanket_allow_refused: true;
readonly policy_allowed: false;
readonly policy_refused: true;
readonly task_aborted: false;
readonly approval_withdrawn: false;
readonly manager_allowed: false;
readonly manager_refused: false;
};
/** Compile-time fence: `never` while every settlement kind has a nobody-judged row. */
export type NobodyJudgedTableCoversEveryKind = AssertAllKeysHandled<Exclude<SettlementKind, keyof typeof SETTLEMENT_NOBODY_JUDGED>>;
/** Which words of a durable row's winner ({@link ResolvedOutcome.decision}) are the ALLOW direction: a tool approval's `allow`, a plan
* pause's `approve` / `edit`; the others refuse. Total over the winner's words — the fence below refuses a word without a row — so
* invariant I11 compares directions by table lookup. */
declare const WINNER_DECISION_ALLOWS: {
readonly allow: true;
readonly approve: true;
readonly edit: true;
readonly deny: false;
readonly reject: false;
};
/** Compile-time fence: `never` while every word a winner can hold has a direction row. */
export type WinnerDecisionTableCoversEveryDecision = AssertAllKeysHandled<Exclude<ResolvedOutcome["decision"], keyof typeof WINNER_DECISION_ALLOWS>>;
/**
* WHO REFUSED a call — the layer whose verdict is the deny. The other question a deny raises, "who ASKED",
* is answered by {@link GateOutcome.origin} (an {@link import("./ask-origin.js").AskOrigin}); the two used
* to share one seven-word list (`PermissionDeniedSource`) in which `classifier` meant both "the classifier
* asked" and "the classifier denied".
* - `policy` — the deployment `ToolPolicy` denied (directly, or re-checking an approved edit), or the
* approval-edit chain hit its round cap, or the deployment's cross-boundary posture refused at the allow exit (the
* call's obligation, read again as it would run, is one no person answered, or the record it owes could not be written).
* - `hook` — a PreToolUse hook denied, threw, or never answered (the engine's fail-closed block on a
* hook that made no decision counts as the hook layer's refusal for attribution).
* - `org` — an organization policy rule denied; or, on a durable resume, the org's current verdict demands a person and
* the recorded decider is the deployment's policy, not a person.
* - `classifier` — the auto-mode classifier denied directly (its ASK-side role is `origin:
* "denial_limit_fallback"`).
* - `persisted_rule` — the person's persisted-rule lane refused: a deny row (live), or, on a durable resume, a deny
* row, a call unreadable against the rows, or a wait for them the task's cancel ended.
* - `compliance` — the compliance call-time lock.
* - `write_protection` — an approved edit was rewritten by the restriction chain onto a write-protected
* path that no approval covers.
* - `ask_resolution` — the ask's own settlement is the refusal (a person said no, a window elapsed,
* nobody could be asked…); the detail is on {@link GateOutcome.settlement}.
* - `read_boundary` — the shell read station refused: a deny-listed read (refused on every seat, with no
* ask), a read the read-only shell face may not make, a rewritten / re-established command whose reads
* no longer are what a person approved, or a command one of whose lookups the execution target refused before
* it started (`target_unavailable`, with the environment's own sentence); and the file stations' refusals, ahead of the
* questions the fold puts: a read a leg that refuses reads outside its directories may not make, and a file write tool's target
* its own root fence refuses (outside the write roots under a roots write face — the tool's sentence, the `path_not_in_root` card).
* - `mode` — the permission MODE refused a surviving ask at the gate's arbitration point: `dontAsk` turns every ask
* but a hook's own into a refusal, and `bypassPermissions` refuses a write whose protection
* could not be judged. The disposition carries `mode`, `askClass` and `classes` beside the word.
*/
export declare const DENIED_BY_VALUES: readonly ["policy", "hook", "org", "persisted_rule", "classifier", "compliance", "write_protection", "ask_resolution", "read_boundary", "mode"];
export type DeniedBy = (typeof DENIED_BY_VALUES)[number];
/** Membership test for {@link DeniedBy}. */
export declare function isDeniedBy(v: unknown): v is DeniedBy;
/** Which layers may VETO an approval a decider already gave (invariant I3: an approval settlement — a
* non-refusal kind, a person's or a policy's — beside a `denied` disposition names one of these). The
* approval-edit re-screen (hook), the policy, org and persisted-rule re-checks, and the write-protection
* re-judge run AFTER the decider's yes; the
* classifier and compliance run before any ask exists, and `ask_resolution` IS the
* settlement, not a veto of it. `persisted_rule` = a person's own standing DENY row (their settings'
* deny list, imported) — the personal-store sibling of `org`, and like it re-judged on an edited
* command. `read_boundary` vetoes too: the rewrite re-judge and the pre-spawn re-establishment run after
* the decider's yes, on bytes or targets the decider never saw. */
export declare const DENIED_BY_MAY_VETO: {
readonly policy: true;
readonly hook: true;
readonly org: true;
readonly persisted_rule: true;
readonly classifier: false;
readonly compliance: false;
readonly write_protection: true;
readonly ask_resolution: false;
readonly read_boundary: true;
readonly mode: false;
};
/** Compile-time fence: `never` while every deny layer has a veto row. */
export type VetoTableCoversEveryDeniedBy = AssertAllKeysHandled<Exclude<DeniedBy, keyof typeof DENIED_BY_MAY_VETO>>;
/**
* The FORM of an auto-mode classifier deny — the one structural position a consumer branches on when a
* deny came through the classifier station. The classifier ends a round three ways, and until this
* member the wire carried the three as one layer word plus prose:
* - `unavailable` — the classifier could not run (the model leg threw / rejected / ran past the cap):
* a fail-closed refusal that SAYS SO — the call may simply be retried later;
* - `parse_error` — the classifier answered outside its verdict contract: blocked for safety, counted by
* the denial limit like a ruling;
* - ABSENT beside `deniedBy: "classifier"` — the classifier's own RULING (a `<block>yes` verdict).
* The WHY behind an `unavailable` (error vs timeout) is not a branching fact: the deny sentence spells it
* and the `auto_mode.classified` trace frame carries it (`cause: "error" | "timeout"`).
*/
export declare const CLASSIFIER_DENY_CAUSES: readonly ["unavailable", "parse_error"];
export type ClassifierDenyCause = (typeof CLASSIFIER_DENY_CAUSES)[number];
/** Membership test for {@link ClassifierDenyCause}. */
export declare function isClassifierDenyCause(v: unknown): v is ClassifierDenyCause;
/** Which deny layers a classifier cause may stand beside: the gate's own classifier station (`classifier`),
* and an ANCESTOR's frozen classifier reached through the inherited policy chain, whose deny the child's
* gate attributes to the chain (`policy`, station row 14) — the cause is attested by the station that
* minted the deny, so the word beside it is whichever layer word the child's ledger assigns. The same two
* layers are where the classifier's own `reason` / `category` may stand (the facts of a ruling, as `cause`
* is the fact of a classification that did not rule): one table, the classifier station's members. */
export declare const DENIED_BY_MAY_CARRY_CAUSE: {
readonly policy: true;
readonly hook: false;
readonly org: false;
readonly persisted_rule: false;
readonly classifier: true;
readonly compliance: false;
readonly write_protection: false;
readonly ask_resolution: false;
readonly read_boundary: false;
readonly mode: false;
};
/** Compile-time fence: `never` while every deny layer has a cause row. */
export type CauseTableCoversEveryDeniedBy = AssertAllKeysHandled<Exclude<DeniedBy, keyof typeof DENIED_BY_MAY_CARRY_CAUSE>>;
/** Which deny layers may name the extension whose handler ended the call ({@link GateDisposition}'s `extension`): the hook layer
* alone — an extension's `tool.check` answer or failure is a hook-layer refusal, and no other layer's verdict is an extension's.
* The mint reads it as the producer and the screen (invariant I12) as the archive: one table, two readers. Module-level only; not
* part of the package root. */
export declare const DENIED_BY_MAY_NAME_EXTENSION: {
readonly policy: false;
readonly hook: true;
readonly org: false;
readonly persisted_rule: false;
readonly classifier: false;
readonly compliance: false;
readonly write_protection: false;
readonly ask_resolution: false;
readonly read_boundary: false;
readonly mode: false;
};
/** Compile-time fence: `never` while every deny layer has an extension-naming row. */
export type ExtensionTableCoversEveryDeniedBy = AssertAllKeysHandled<Exclude<DeniedBy, keyof typeof DENIED_BY_MAY_NAME_EXTENSION>>;
/** Which deny layers may carry the literals their refusal sentence quotes ({@link GateDisposition}'s `echoed`): the read station,
* whose deny sentence is minted with them from one finding; an ask's resolution, whose refusal sentence quotes the question the
* engine composed with its literals. The mint reads it as the producer and the screen (invariant I13) as the archive: one table,
* two readers. Module-level only; not part of the package root. */
export declare const DENIED_BY_MAY_ECHO: {
readonly policy: false;
readonly hook: false;
readonly org: false;
readonly persisted_rule: false;
readonly classifier: false;
readonly compliance: false;
readonly write_protection: false;
readonly ask_resolution: true;
readonly read_boundary: true;
readonly mode: false;
};
/** Compile-time fence: `never` while every deny layer has an echo row. */
export type EchoTableCoversEveryDeniedBy = AssertAllKeysHandled<Exclude<DeniedBy, keyof typeof DENIED_BY_MAY_ECHO>>;
/** The final disposition of a gate pass. `cause` is present exactly when the deny came out of an auto-mode
* classifier round that did not RULE ({@link ClassifierDenyCause}); a ruling block and every non-classifier
* deny carry none. Invariant I5 ({@link screenGateOutcome}): a cause stands only beside a layer word in
* {@link DENIED_BY_MAY_CARRY_CAUSE}.
*
* `classifier` — the classification's model attribution, on BOTH arms (a classification ends either way,
* allow or deny) and from BOTH stations (this gate's own classifier step, and an ANCESTOR's frozen
* classifier reached through the inherited policy chain, whose allow and deny carry it out on the same seat
* that carries the FORM): which model it was for, which one answered, and — only when the ladder moved —
* the rung it left and why. It is the classification's account, not the settlement's: a classification that
* RULED keeps it whoever then decided the call — a call whose question a person then answered (an ask a
* station after the classifier raised, or a block at the DENIAL-LIMIT bound, which becomes an ask) carries
* it beside that person's settlement on {@link GateOutcome}; who decided is read from the settlement
* (`human_allowed`, `policy_allowed`, …), never from this member's presence. ABSENT reads UNKNOWN, never
* "the seat answered" (that is `fallback` absent WITH the member present), and a consumer cannot tell its
* three causes apart from the record alone: no classification happened; one ran on a decider given no
* candidate ladder and can name no model (a hand-built decider; a parked ancestor's cross-process rebuild,
* whose single fresh leg has none); or one did not rule (it could not run, or replied with no verdict) and
* handed the question to the approval seat, whose settlement then names the resolution that ask reached.
* Additive. Invariant I6 ({@link screenGateOutcome}) screens its shape.
*
* `clearedBy` — the allow layer's account of a call it let run without asking: which member cleared the ask (`hook`, an
* extension's `classic.PreToolUse` or `tool.check` allow, / `deployment` / `persisted` / `skill` / `request`) and the entries it stood on, sanitized and capped as a shadow
* record is, with `positions` for a list member (the indices of those entries in the list the run received — a host maps them
* onto the declaration it sent for this run). Present exactly when an allow member cleared a standing ask and nobody answered
* it: absent on a call nothing asked about, a mode's release or acceptance, the read-only arm's, the classifier's or the
* sandbox's allow, and a person's yes. Additive. Invariant I9 ({@link screenGateOutcome}) screens its shape.
*
* `extension` — on the denied arm only: the registration name of the extension whose handler ended the call at the hook layer,
* by its `deny` answer (`tool.check`, `classic.PreToolUse`, `tool.call`) or by its failure (a throw, a budget overrun, an
* answer the station cannot take — the engine fails the call closed). Present exactly when `deniedBy` is `hook` and the
* refusing handler's registration is known; ABSENT beside every other layer word (an ancestor leg's screening reaches a
* descendant as a `policy` refusal, and a refusal an inherited installation's question settled is that question's), and beside
* a `hook` refusal that names no registration (the engine's own failed raise, a cancel). A display and audit fact: the call is
* refused whatever the name. Additive. Invariant I12 ({@link screenGateOutcome}) screens its shape.
*
* `echoed` — on the denied arm only: the literals the refusal's sentence quotes — the path (with its canonical target where the
* sentence names one), the view of it the deny row actually matched when that is another spelling, and the pattern — in the order
* the sentence quotes them, each whole (the sentence elides the middle of a long one, this list never does). Minted with the
* sentence from one finding, so a consumer reads WHICH path, command or pattern was refused from here and never by taking the
* sentence apart. Present when `deniedBy` is `read_boundary` and the refusal is a deny-row hit, and when `deniedBy` is
* `ask_resolution` and the refusal quotes a question the engine composed with its literals (a write gate's or the plan mode's
* generic question about a path: the list then holds that path as the call spells it — not a canonical one) while the refusal's
* sentence is still the one the resolver composed ({@link DENIED_BY_MAY_ECHO}). ABSENT beside every other layer word, on a
* read-boundary refusal that quotes no deny row (a containment or identity finding), and on a resolution refusal whose question
* was anyone else's words or was rewritten or appended to on the way (a hook's, a persisted rule's, a card's added sentence): the
* sentence is then the whole account, and a consumer that finds the member absent reads it as it always did — what was asked is
* the call's own arguments. The member's presence says nothing about the layer: read the layer off `deniedBy`. Additive.
* Invariant I13 ({@link screenGateOutcome}) screens its shape.
*
* `reason` and `category` — on the denied arm only: what an auto-mode classifier's RULING block said about itself. Two facts, never
* one string. `reason` is the one sentence the classifier gave — UNTRUSTED text from the classifier model (the main model's own when
* the ladder fell back to it: `classifier.fallback` on the same record says so): one line, at most 160 code points (a cut one ends in
* `…`), its tag and fence markers defused (`inlineUntrusted`); a renderer shows it as text and nothing reads it as an instruction or
* runs it. It is the very string the call's deny sentence ends with (`auto-mode classifier blocked this call: <reason>`), folded once
* and read twice. `category` is the rule the classifier filed the call under, as a word of the CLOSED set
* {@link import("./classifier-category.js").CLASSIFIER_CATEGORIES} (79 words, the reference client's own): present only when the reply named exactly one category of the
* accepted spelling and its normalized word is in the set — a rule name outside the set (a deployment's own) leaves it absent, and so
* does a verdict a hand-built decider returns without `categoryWord`. The deny sentence never quotes the rule name. Each is present
* exactly when it was given; both are absent on a ruling that said nothing the record can carry. Present only beside a layer word
* {@link DENIED_BY_MAY_CARRY_CAUSE} admits (the classifier station, and an inherited ancestor classifier's refusal that the chain
* attributes to `policy`) and never beside a `cause`: a classification that did not rule (`unavailable`, `parse_error`) has no reason
* to give and carries its form as `cause`; every other layer's refusal carries neither. A later layer that refuses the same call in
* its place drops them with the decision it replaced. Not to be confused with two other members named `reason` — a released ask's
* `released.reason` (a closed word) and the `permissionDenied` observer payload's `reason` (the whole refusal sentence). Additive.
* Invariant I14 ({@link screenGateOutcome}) screens their shape. */
export type GateDisposition = {
kind: "allowed";
classifier?: AutoModeClassifierRound;
released?: ModeRelease;
clearedBy?: AllowRuleClearance;
asked?: ClassifierAsked;
} | {
kind: "denied";
deniedBy: DeniedBy;
cause?: ClassifierDenyCause;
reason?: string;
category?: ClassifierCategory;
classifier?: AutoModeClassifierRound;
mode?: ModeRefusal["mode"];
askClass?: AskClass;
classes?: readonly AskClass[];
extension?: string;
echoed?: readonly RefusalEcho[];
};
/**
* The question an auto-mode classifier ALLOWED — the allowed disposition's account of the ask it answered with nobody asked, as a
* release names the ask a mode answered: the disclosed class word (`askClass`, the first member of `classes` in `ASK_CLASSES` order)
* and the whole set. Present exactly when a classifier's allow is the pass's answer (the leg's own classifier station, an ancestor's
* frozen classifier, a re-check's): beside `classifier`, never beside a settlement, a release or a clearance. Absent = no classifier
* answered the call — or the record was written by an engine that did not keep it (a reader cannot tell those apart, and reads
* absence as "not known"). Additive. Invariant I15 ({@link screenGateOutcome}) screens its shape.
*/
export interface ClassifierAsked {
askClass: AskClass;
classes: readonly AskClass[];
}
/**
* A permission MODE released a surviving ask — the allowed disposition's account of the question it did not put
* to anyone: the mode, the disclosed class word (`askClass`, the first member of the folded set in `ASK_CLASSES`
* order — one of {@link releasableAskClassesFor} on the call's face), the whole set, and the origin / mandate words the card would
* have shown. `reason` is a member of {@link import("./ask-origin.js").MODE_RELEASE_REASONS} (`isModeReleaseReason`):
* `"target_unresolved"` marks a release (the shell face) over a write target whose reading could not say where it leads;
* absent, the release names none. `readUnestablished` is the read station's fact about this call: it could not establish what
* the command reads (a scan it declined, a read it could not establish, or no answer), so no row of the leg's read-deny table
* was applied to those reads — and it names that table, read once when the mode released the call: `tiers` (the active built-in
* tiers), `rows` (the first {@link READ_DENY_ROWS_NAMED} rows beside them — the deployment's and the task's patterns, the
* read-face rule rows) and `rowCount` (every such row). The three empty WITHOUT `tableUnread` say no read-deny table stood; WITH
* `tableUnread: true` (the three then empty) the release read no table — the seat threw, answered no table, or none was handed
* (a host driving the gate directly) — so a table may well have stood. Absent, the reads were established
* (or the call ran no shell read station) and the table was applied as usual — on a record this engine wrote. A record an engine
* before the member wrote never carries it, so there its absence says NOTHING about the reads ("not known", not "established");
* the record names no version of its own, and a reader tells the two apart by the engine version that produced it. The record
* is the release's one account: no notice repeats it. The record carries no face, so the screen asks that SOME face releases
* the class.
*/
export interface ModeRelease {
mode: PermissionMode;
askClass: AskClass;
classes: readonly AskClass[];
origin?: AskOrigin;
mandate?: PersistedRuleMandate;
reason?: ModeReleaseReason;
readUnestablished?: {
readonly tiers: readonly string[];
readonly rows: readonly string[];
readonly rowCount: number;
readonly tableUnread?: true;
};
/** The mode released the call BECAUSE the Runner declares its shape (`RunnerDeps.deploymentShape`): `classes` holds a class of
* {@link import("./ask-origin.js").RELEASED_ON_CONFINED_RUNNER} that keeps the question on a Runner that declares none. Absent ⇒ the
* release stands on any Runner. Not a class: the class set is the question's, this is the deployment's declaration. */
confined?: true;
}
/** The read-deny table one call is judged with: the active built-in tiers and the rows beside them (`ToolGateInput.readDenyInForce`). */
export interface ReadDenyTable {
readonly tiers: readonly string[];
readonly rows: readonly string[];
}
/** The most rows of that table a release record names; `rowCount` says how many it holds. */
export declare const READ_DENY_ROWS_NAMED = 8;
/** The one mint of a release record: the arbitration's verdict (its `kind` tag dropped) and, when the call's reads were not
* established, what the release read of the table they went past — the table (the tiers, the first
* {@link READ_DENY_ROWS_NAMED} rows, the count of all), or `"unread"`: no table was read (named as none, `tableUnread`).
* Every account of a release — the allowed disposition, the gate's `onModeReleased` seat, a tool's own consent release —
* is this value. */
export declare function modeReleaseOf(a: Extract<Arbitration, {
kind: "released";
}>, unapplied?: ReadDenyTable | "unread"): ModeRelease;
/** The two modes that refuse on their own account (`deniedBy: "mode"`): `dontAsk` every ask but a hook's own,
* `bypassPermissions` a write whose protection could not be judged. `plan` refuses nothing here — its questions ask. */
export interface ModeRefusal {
mode: "bypassPermissions" | "dontAsk";
askClass: AskClass;
classes: readonly AskClass[];
}
/**
* The WHOLE record of one tool-gate pass: the final disposition, plus — when this pass settled an ask —
* the settlement it consumed and the ask's origin. Minted ONCE (the gate's exit; the decide lane for a
* durable park) and projected three times without re-derivation: the `permissionDenied` observer's
* payload, the call's `tool_end` frame, and the durable row's resolved outcome. The three faces are the
* same object graph, so they cannot tell different stories.
*
* The three members are orthogonal but bound by the invariants ({@link screenGateOutcome}):
* I1 `settlement` present ⇔ `origin` present (they describe the same ask);
* I2 `disposition.deniedBy === "ask_resolution"` ⇒ `settlement` present and a refusal kind;
* I3 `settlement` an approval (a kind {@link SETTLEMENT_IS_REFUSAL} says is not a refusal) ∧
* `disposition.kind === "denied"` ⇒ `deniedBy` is a veto layer ({@link DENIED_BY_MAY_VETO}) — a decider
* approved, a later re-check refused; the approver stays on the settlement (it is not the approver's
* refusal);
* I4 `disposition.kind === "allowed"` ⇒ `settlement` absent or an approval (not a refusal kind);
* I5 `disposition.cause` present ⇒ a member of {@link CLASSIFIER_DENY_CAUSES} beside a layer word
* {@link DENIED_BY_MAY_CARRY_CAUSE} admits (the classifier station, or the inherited chain's `policy`);
* I6 `disposition.classifier` present ⇒ both model ids are non-empty strings, and a `fallback` on it
* names a `to` that IS `modelUsed` (the ladder landed where the record says) with a cause in
* {@link import("./auto-mode.js").AUTO_MODE_FALLBACK_CAUSES} — a record whose `to` and `modelUsed`
* disagree would let a reader answer "which model decided this call?" two ways;
* I7 `disposition.released` present ⇒ `kind === "allowed"`, no settlement, `mode` is `bypassPermissions`,
* `askClass` is an ask class (a member of the closed set — SHAPE; whether the class was releasable is the mint's
* law at mint time, read by the gate's mode-release arm, never re-judged here against today's table: a persisted
* record outlives the policy of its day), every member of `classes` is an ask class, `origin` / `mandate` / `reason`,
* when present, are members of their closed sets, `reason` names a member of `classes` (the mint takes it from
* that set), and `readUnestablished`, when present, names a table: `tiers` and `rows` lists of strings, `rows` at most
* {@link READ_DENY_ROWS_NAMED} long, `rowCount` a whole number no smaller than `rows`, and `tableUnread`, when present,
* `true` beside an empty table (no tiers, no rows, `rowCount: 0`), and `confined`, when present, is `true` — a mode
* releases nothing a person answered;
* I8 `deniedBy === "mode"` ⇔ `mode` present (`bypassPermissions` | `dontAsk`) with `askClass` and `classes`;
* I9 `disposition.clearedBy` present ⇒ `kind === "allowed"`, no settlement and no release (an allow member cleared the ask
* before anyone answered it), `member` one of the allow layer's members, `entries` a list of strings, `omitted` a positive
* whole number when present, and `positions` — only on a list member (`request`, `deployment`) — a list of non-negative
* whole numbers;
* I10 `settlement.when` present ⇒ a finite number (epoch ms — the moment the wait ended is a value a reader can order);
* I15 `disposition.asked` present ⇒ `kind === "allowed"` with `classifier` beside it, no settlement, no release and no clearance
* (a classifier answered the ask and nobody else did), `askClass` an ask class and a member of `classes`, a non-empty list of
* ask classes;
* I12 `disposition.extension` present ⇒ the denied arm, a layer word {@link DENIED_BY_MAY_NAME_EXTENSION} admits (the hook layer),
* and a non-empty string (a registration's name);
* I13 `disposition.echoed` present ⇒ the denied arm, a layer word {@link DENIED_BY_MAY_ECHO} admits (the read station, an ask's resolution), and a
* non-empty list of echoes ({@link refusalEchoDefects}): a kind of the closed set, a non-empty `value`, and a `canonical`
* only on a path;
* I11 a winner's `decision` stated beside the record (the caller reads a durable row: `winnerDecision`) ⇒ a word a winner holds,
* and its direction (allow: `allow` / `approve` / `edit`; refusal: `deny` / `reject`) is the direction of the record's
* settlement ({@link SETTLEMENT_IS_REFUSAL}) and of its disposition (`allowed` / `denied`) — one decision, one direction.
* Nothing here is read out of an ABSENCE: an ordinary allow with no ask is `{ disposition: { kind: "allowed" } }`,
* a direct policy deny is `{ disposition: { kind: "denied", deniedBy: "policy" } }`, and neither carries a
* settlement because neither settled one.
*/
export interface GateOutcome {
disposition: GateDisposition;
settlement?: Settlement;
origin?: AskOrigin;
}
/**
* Whether `gate` is a person's refusal: the refusing layer is the ask's resolution and its settlement is a person's refusal — not a
* later layer's deny that followed a person's answer, nor a policy's, a window's, a cancellation's or a failed approver's settlement.
* The one reading behind every consequence the engine draws from a person's "no" (the bare refusal that ends a turn, the parked
* decision a person refused to continue).
*/
export declare function isHumanRefusal(gate: GateOutcome | undefined): gate is GateOutcome & {
readonly settlement: Settlement & {
readonly kind: "human_refused";
};
};
/** A release as `major.minor.patch`: the version whose engine stopped minting a retired word. */
type ReleaseVersion = `${number}.${number}.${number}`;
/**
* The words that LEFT a closed set a gate record carries, one list per set, each word with the version whose engine stopped
* minting it. A persisted record outlives the vocabulary of its day as it outlives the policy of its day, so the screen's
* archive reading ({@link screenGateOutcome}) reads each set as its live members plus these, and its producer reading reads the
* live members alone. Every set the screen reads has a list (empty when nothing left it); no word is both live and retired
* ({@link RetiredMembersAreNotLive}). A word-indexed table ({@link DENIED_BY_MAY_VETO}, {@link DENIED_BY_MAY_CARRY_CAUSE},
* {@link SETTLEMENT_IS_REFUSAL}) keeps rows for live words only: a retired word is read as granted nothing by it.
*/
export declare const RETIRED_MEMBERS: Readonly<{
askClass: readonly (Readonly<{
word: "write_protection_unresolved";
retiredIn: ReleaseVersion;
}> | Readonly<{
word: "governance_unavailable";
retiredIn: ReleaseVersion;
}>)[];
modeReleaseReason: readonly (Readonly<{
word: "write_protection_unresolved";
retiredIn: ReleaseVersion;
}> | Readonly<{
word: "rule_unreadable";
retiredIn: ReleaseVersion;
}>)[];
askOrigin: readonly Readonly<{
word: "unresolvable";
retiredIn: ReleaseVersion;
}>[];
persistedRuleMandate: readonly Readonly<{
word: "write_protection_unresolved";
retiredIn: ReleaseVersion;
}>[];
deniedBy: readonly Readonly<{
word: "plan_mode";
retiredIn: ReleaseVersion;
}>[];
settlementKind: readonly [];
settlementParty: readonly [];
classifierDenyCause: readonly [];
classifierCategory: readonly [];
permissionMode: readonly [];
autoModeFallbackCause: readonly [];
}>;
type MemberSet = keyof typeof RETIRED_MEMBERS;
type RetiredWord<S extends MemberSet> = (typeof RETIRED_MEMBERS)[S][number]["word"];
/** Compile-time fence: `never` while no retired word is also a live member of its set. */
export type RetiredMembersAreNotLive = AssertAllKeysHandled<Extract<RetiredWord<"askClass">, AskClass> | Extract<RetiredWord<"modeReleaseReason">, ModeReleaseReason> | Extract<RetiredWord<"askOrigin">, AskOrigin> | Extract<RetiredWord<"persistedRuleMandate">, PersistedRuleMandate> | Extract<RetiredWord<"deniedBy">, DeniedBy> | Extract<RetiredWord<"settlementKind">, SettlementKind> | Extract<RetiredWord<"settlementParty">, SettlementParty> | Extract<RetiredWord<"classifierDenyCause">, ClassifierDenyCause> | Extract<RetiredWord<"classifierCategory">, ClassifierCategory> | Extract<RetiredWord<"permissionMode">, PermissionMode> | Extract<RetiredWord<"autoModeFallbackCause">, AutoModeFallbackCause>>;
/** Compile-time fence: `never` while every reason word, live or retired, is an ask class of its day (I7 reads it in `classes`). */
export type RetiredReasonsAreClassWords = AssertAllKeysHandled<Exclude<RetiredWord<"modeReleaseReason">, AskClass | RetiredWord<"askClass">>>;
/** Whether `word` left the closed set `set` ({@link RETIRED_MEMBERS}). A set name outside the registry throws. */
export declare function isRetiredMember<S extends MemberSet>(set: S, word: unknown): word is RetiredWord<S>;
/**
* The release law of THIS engine (I7's policy half): a mode release names a set of classes that one face of the engine's table
* releases whole (`releasableAskClassesFor`) — the arbitration releases a set only when no member is immune on the call's face; a
* release that says `confined` reads the confined Runner's lists and holds a member only they release.
* Policy, not shape — it moves between versions — so only the producer reading of {@link screenGateOutcome} reads it.
* Module-level only; not part of the package root.
*/
export declare function releasePolicyDefects(g: unknown): string[];
/** The one reading of a read-deny table a seat handed (`ToolGateInput.readDenyInForce`): its two lists of strings, copied once,
* or `undefined` when the value is not such a table. */
export declare function readDenyTableOf(v: unknown): ReadDenyTable | undefined;
/** The members only the denied arm of a {@link GateDisposition} carries. */
declare const DENY_ONLY_MEMBERS: readonly ["deniedBy", "cause", "reason", "category", "mode", "askClass", "classes", "extension", "echoed"];
type DenyOnlyMember = Exclude<keyof Extract<GateDisposition, {
kind: "denied";
}>, keyof Extract<GateDisposition, {
kind: "allowed";
}>>;
/** Compile-time fence: `never` while the list is exactly the denied arm's own members. */
export type DenyOnlyMembersAreListed = AssertAllKeysHandled<Exclude<DenyOnlyMember, (typeof DENY_ONLY_MEMBERS)[number]> | Exclude<(typeof DENY_ONLY_MEMBERS)[number], DenyOnlyMember>>;
/**
* The one invariant screen for a {@link GateOutcome} (I1–I12 above, plus the closed-set word each member carries). Two readings:
* - `"archive"` (the default) — a record read back from where it was kept (a replay, a ledger, a durable row): its shape, with
* every closed set read as its live members plus {@link RETIRED_MEMBERS}. A record lawful when minted is not a defect later.
* - `"producer"` — a record THIS engine is composing or publishing now: the live sets alone, and the engine's release law
* ({@link releasePolicyDefects}). The gate's exit and its station screen read this.
* The record is read as whatever it holds (`unknown`): a member that is not the shape the type names — `null`, an array, a
* primitive where a record belongs, an object where a word belongs — is a defect naming its position, never an exception, and
* every class, reason, origin and mandate word is read wherever the record carries it.
* A caller reading a durable row's winner ({@link ResolvedOutcome}) states the winner's `decision` beside the record it carries
* (`winnerDecision`, the key present whatever it holds, read as `reading` is read): invariant I11 then reads that word, so the decision and the record it filed
* cannot be read as two directions. Without the key there is no winner beside the record and I11 reads nothing.
* Returns the defects as sentences (an empty list is a clean record); the caller decides the fail-loud form (report + withhold,
* or refuse), never silently repairs the record. An options value that is not an object, or a reading outside the two, throws.
*/
export declare function screenGateOutcome(g: unknown, opts?: {
readonly reading?: "archive" | "producer";
readonly winnerDecision?: unknown;
}): string[];
export {};