@cotal-ai/auth 0.12.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/admission-mediator.d.ts +319 -0
  2. package/dist/admission-mediator.d.ts.map +1 -0
  3. package/dist/admission-mediator.js +1033 -0
  4. package/dist/admission-mediator.js.map +1 -0
  5. package/dist/auth-admin.d.ts +29 -0
  6. package/dist/auth-admin.d.ts.map +1 -0
  7. package/dist/auth-admin.js +224 -0
  8. package/dist/auth-admin.js.map +1 -0
  9. package/dist/authority-client.d.ts +215 -0
  10. package/dist/authority-client.d.ts.map +1 -0
  11. package/dist/authority-client.js +346 -0
  12. package/dist/authority-client.js.map +1 -0
  13. package/dist/barrier-evict.d.ts +16 -0
  14. package/dist/barrier-evict.d.ts.map +1 -0
  15. package/dist/barrier-evict.js +100 -0
  16. package/dist/barrier-evict.js.map +1 -0
  17. package/dist/connect-reader.d.ts +72 -0
  18. package/dist/connect-reader.d.ts.map +1 -0
  19. package/dist/connect-reader.js +154 -0
  20. package/dist/connect-reader.js.map +1 -0
  21. package/dist/continuity.d.ts.map +1 -1
  22. package/dist/continuity.js +3 -0
  23. package/dist/continuity.js.map +1 -1
  24. package/dist/credential-ledger.d.ts +343 -0
  25. package/dist/credential-ledger.d.ts.map +1 -0
  26. package/dist/credential-ledger.js +732 -0
  27. package/dist/credential-ledger.js.map +1 -0
  28. package/dist/drain-repair.d.ts +95 -0
  29. package/dist/drain-repair.d.ts.map +1 -0
  30. package/dist/drain-repair.js +305 -0
  31. package/dist/drain-repair.js.map +1 -0
  32. package/dist/idp.d.ts +19 -0
  33. package/dist/idp.d.ts.map +1 -1
  34. package/dist/idp.js +17 -0
  35. package/dist/idp.js.map +1 -1
  36. package/dist/index.d.ts +5 -2
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +29 -2
  39. package/dist/index.js.map +1 -1
  40. package/dist/issuer.d.ts +8 -0
  41. package/dist/issuer.d.ts.map +1 -1
  42. package/dist/issuer.js +4 -2
  43. package/dist/issuer.js.map +1 -1
  44. package/dist/ledger-scanner.d.ts +98 -0
  45. package/dist/ledger-scanner.d.ts.map +1 -0
  46. package/dist/ledger-scanner.js +352 -0
  47. package/dist/ledger-scanner.js.map +1 -0
  48. package/dist/ledger.d.ts +7 -0
  49. package/dist/ledger.d.ts.map +1 -1
  50. package/dist/ledger.js +53 -5
  51. package/dist/ledger.js.map +1 -1
  52. package/dist/lifecycle-registry.d.ts +397 -0
  53. package/dist/lifecycle-registry.d.ts.map +1 -0
  54. package/dist/lifecycle-registry.js +819 -0
  55. package/dist/lifecycle-registry.js.map +1 -0
  56. package/dist/permissions.d.ts +5 -1
  57. package/dist/permissions.d.ts.map +1 -1
  58. package/dist/permissions.js +29 -6
  59. package/dist/permissions.js.map +1 -1
  60. package/dist/plane-claim.d.ts +83 -0
  61. package/dist/plane-claim.d.ts.map +1 -0
  62. package/dist/plane-claim.js +290 -0
  63. package/dist/plane-claim.js.map +1 -0
  64. package/dist/provider.d.ts.map +1 -1
  65. package/dist/provider.js +2 -1
  66. package/dist/provider.js.map +1 -1
  67. package/dist/records-scanner.d.ts +78 -0
  68. package/dist/records-scanner.d.ts.map +1 -0
  69. package/dist/records-scanner.js +320 -0
  70. package/dist/records-scanner.js.map +1 -0
  71. package/dist/retirement-barrier.d.ts +217 -0
  72. package/dist/retirement-barrier.d.ts.map +1 -0
  73. package/dist/retirement-barrier.js +624 -0
  74. package/dist/retirement-barrier.js.map +1 -0
  75. package/dist/retirement-cleaner.d.ts +54 -0
  76. package/dist/retirement-cleaner.d.ts.map +1 -0
  77. package/dist/retirement-cleaner.js +158 -0
  78. package/dist/retirement-cleaner.js.map +1 -0
  79. package/dist/root-credential.d.ts +26 -0
  80. package/dist/root-credential.d.ts.map +1 -0
  81. package/dist/root-credential.js +116 -0
  82. package/dist/root-credential.js.map +1 -0
  83. package/dist/service.d.ts +60 -0
  84. package/dist/service.d.ts.map +1 -1
  85. package/dist/service.js +317 -10
  86. package/dist/service.js.map +1 -1
  87. package/dist/session-ledger.d.ts +224 -0
  88. package/dist/session-ledger.d.ts.map +1 -0
  89. package/dist/session-ledger.js +713 -0
  90. package/dist/session-ledger.js.map +1 -0
  91. package/dist/token.d.ts +17 -0
  92. package/dist/token.d.ts.map +1 -1
  93. package/dist/token.js +30 -2
  94. package/dist/token.js.map +1 -1
  95. package/package.json +5 -3
@@ -0,0 +1,319 @@
1
+ import type { NatsConnection } from "@nats-io/transport-node";
2
+ import { type AcceptanceFact } from "@cotal-ai/core";
3
+ import { type LifecycleRegistry } from "./lifecycle-registry.js";
4
+ import { type RecordsScanner } from "./records-scanner.js";
5
+ /** The sealed admission mediator for ONE endpoint (BRANDED, §13.12: a hand-assembled object
6
+ * never authorizes). The endpoint bind is structural: every obligation this mediator touches
7
+ * carries its own sealed endpoint token, so endpoint A can never obtain, settle, or replay
8
+ * endpoint B's admission (§13.8's confined-reader identity bind, in-process form). */
9
+ export interface AdmissionMediator {
10
+ readonly space: string;
11
+ readonly endpoint: string;
12
+ }
13
+ /** Open the sealed per-endpoint admission mediator over the space's PRIMARY records store —
14
+ * shape-proved at bind exactly like every trusted consumer of that store (SPEC 13.12).
15
+ * `now`/`proofTtlMs` are probe seams; the proof TTL defaults to the §13.8 reference call
16
+ * deadline (15 s). `recordsScanner` is the SEALED records-obligation scanner the mediator's
17
+ * drain-to-quiescence enumeration runs on (SPEC 13.9, site 3): the mediator's own credential holds
18
+ * NO `CONSUMER.CREATE` on the records stream (a create-request body is not subject-ACL confinable —
19
+ * nats-server#8274), so it can never build a durable+PUSH exporter of its `oblig.` subtree; the
20
+ * CREATE lives only inside {@link ./records-scanner.ts}. Required: a mediator that cannot enumerate
21
+ * cannot drain (SPEC 13.8), which is a composition bug, not a silent degrade. */
22
+ export declare function openAdmissionMediator(nc: NatsConnection, space: string, endpoint: string, opts: {
23
+ now?: () => number;
24
+ proofTtlMs?: number;
25
+ recordsScanner: RecordsScanner;
26
+ }): Promise<AdmissionMediator>;
27
+ /** The §13.8 commit-value union (CLOSED): a canonical base64url JSON encoding of the committed
28
+ * value, or an IMMUTABLE `policy`-kind records key whose stored value IS the commit value. */
29
+ export type CommitValue = {
30
+ enc: "b64u";
31
+ bytes: string;
32
+ } | {
33
+ enc: "ref";
34
+ key: string;
35
+ };
36
+ /** The complete `self`-class commit intent (§13.8): a crashed writer's commit is finishable from
37
+ * this alone. `commitDigest` is the RFC-8785 CANONICAL content digest of the committed value,
38
+ * `sha256:<hex>` (the same `*Digest` scalar shape §13.7 uses). `commitValue` is RESOLVED and
39
+ * its canonical digest VERIFIED against `commitDigest` at obtain (before the row can accept),
40
+ * so a mismatched value/digest can never reach `accepted` and wedge recovery. */
41
+ export interface SelfCommitIntent {
42
+ commitKey: string;
43
+ commitBaseRevision: number;
44
+ commitValue: CommitValue;
45
+ commitDigest: string;
46
+ }
47
+ export type ObligationState = "provisional" | "accepted" | "rejected" | "terminal";
48
+ /** One obligation row (CLOSED per-class schema, §13.8). The `decision` class is fixed by the
49
+ * TRUSTED operation kind ({@link obtainEpfObligation} vs {@link obtainSelfObligation}), never
50
+ * caller-selectable. */
51
+ export interface ObligationRow {
52
+ state: ObligationState;
53
+ decision: "epf" | "self";
54
+ opId: string;
55
+ /** Present iff target-bound: the target head's store revision pinned at the create-fence. */
56
+ mappingRevision?: number;
57
+ /** Present iff policy-admitted: the enforced policy record's store revision. */
58
+ policyRevision?: number;
59
+ /** epf-class only: the canonical acceptance's identity. */
60
+ fingerprint?: string;
61
+ sourceSeq?: number;
62
+ route?: string;
63
+ /** self-class only: the complete commit intent. */
64
+ commit?: SelfCommitIntent;
65
+ }
66
+ /** A BRANDED mediated request (§13.8: "derives the coordinate from the broker-authenticated
67
+ * request subject, never a body field"). The endpoint and caller triple come ONLY from parsing
68
+ * an authenticated request/journal subject through {@link mediatedRequestFromSubject}; a caller
69
+ * can never hand-assemble one, so the obligation coordinate's identity is structurally the
70
+ * broker-authenticated identity, not a body-supplied `caller`. */
71
+ export interface MediatedRequest {
72
+ readonly endpoint: string;
73
+ readonly caller: {
74
+ readonly owner: string;
75
+ readonly actor: string;
76
+ readonly uid: string;
77
+ };
78
+ }
79
+ /** Build the branded mediated request from the RAW authenticated request subject the broker
80
+ * delivered (an `ep`-plane request or an `epj`-plane journal submission). Core's
81
+ * {@link parseEpSubject} extracts the endpoint + caller triple STRUCTURALLY from the subject;
82
+ * a malformed subject, or one that is not a request/journal, refuses. The `id` (the
83
+ * caller-chosen request id, §13.4) is NOT in the subject and stays an explicit operation
84
+ * argument; everything that identifies WHO the caller is comes from here. */
85
+ export declare function mediatedRequestFromSubject(subject: string): MediatedRequest;
86
+ /** The operation coordinates NOT carried by the authenticated identity: the target lifecycle
87
+ * this admission binds to (omitted = the `ep` sentinel), whether it pins the enforced policy
88
+ * (§13.6), and the caller-chosen request id (§13.4, a body field, legitimately caller-supplied
89
+ * because it identifies the REQUEST, not WHO the caller is). At least one of target/policy. */
90
+ export interface AdmissionOp {
91
+ target?: {
92
+ owner: string;
93
+ actor: string;
94
+ lifecycleUid: string;
95
+ };
96
+ policy?: boolean;
97
+ id: string;
98
+ }
99
+ /** Validate an obligation row at the consuming boundary: CLOSED per-class schema, at least one
100
+ * currency pin, class-required fields present and class-foreign fields absent (SPEC 13.8). */
101
+ export declare function parseObligationRow(raw: Uint8Array, key: string): ObligationRow;
102
+ /** The govern head's normative policy selector fields (§13.6). The rest of the head value
103
+ * (the binding map, the provisional registration slot) is the registration path's and is
104
+ * PRESERVED verbatim by the selector CAS steps here. */
105
+ export interface PolicySelector {
106
+ enforcedPolicyKey?: string;
107
+ enforcedPolicyRevision?: number;
108
+ pendingPolicyKey?: string;
109
+ pendingPolicyRevision?: number;
110
+ }
111
+ /** Publish ONE immutable policy version (§13.7 `policy.<endpoint>.<digest-hex>`): the key is the
112
+ * RFC-8785 CANONICAL content digest of the value (property-order-insensitive, so a conforming
113
+ * second implementation content-addresses the same policy to the same key), so publication is
114
+ * content-addressed and idempotent; an existing key whose value does not re-digest to it is
115
+ * corruption. Provisioner-registration authority (§13.9): takes the sealed registry, not the
116
+ * mediator. */
117
+ export declare function publishPolicyVersion(reg: LifecycleRegistry, endpoint: string, value: unknown): Promise<{
118
+ key: string;
119
+ revision: number;
120
+ digestHex: string;
121
+ }>;
122
+ /** STAGE a policy mutation (§13.6 step 1, provisioner authority): verify the NEW immutable
123
+ * version exists and self-certifies, then CAS `pendingPolicy{Key,Revision}` onto the govern
124
+ * head, preserving every other head field verbatim (the binding map and registration slot are
125
+ * the registration path's). A virgin head is created with an empty binding map. A pending
126
+ * already staged refuses (`conflict`: one mutation at a time; promote or abandon it first). */
127
+ export declare function stagePolicySelector(reg: LifecycleRegistry, endpoint: string, policyKey: string): Promise<{
128
+ pendingPolicyKey: string;
129
+ pendingPolicyRevision: number;
130
+ mutationOpId: string;
131
+ governRevision: number;
132
+ }>;
133
+ /** The BRANDED drain-quiescence witness {@link drainEndpointPolicy} mints: proof that the
134
+ * endpoint's POLICY-PINNED obligations enumerated quiescent for THIS exact staged mutation.
135
+ * {@link promotePolicySelector} accepts nothing else, and binds it to the exact
136
+ * `(space, endpoint, pendingKey, pendingRevision, mutationOpId, governStageRevision)` so a
137
+ * witness cannot be replayed across spaces (the same content-addressed key elsewhere), across
138
+ * re-stages (a new mutationOpId), or against a moved govern head (the promote CASes from
139
+ * `governStageRevision`). A promote CONSUMES the witness (§13.6). */
140
+ export interface DrainQuiescence {
141
+ readonly space: string;
142
+ readonly endpoint: string;
143
+ readonly pendingPolicyKey: string;
144
+ readonly pendingPolicyRevision: number;
145
+ readonly mutationOpId: string;
146
+ readonly governStageRevision: number;
147
+ }
148
+ /** PROMOTE a staged policy mutation (§13.6 step 2, provisioner authority): only under the
149
+ * branded drain witness for the SAME endpoint and pending key. Moves `pendingPolicy…` into
150
+ * `enforcedPolicy…` and clears the pending slot, preserving every other head field. */
151
+ export declare function promotePolicySelector(reg: LifecycleRegistry, endpoint: string, quiescence: DrainQuiescence): Promise<{
152
+ enforcedPolicyKey: string;
153
+ enforcedPolicyRevision: number;
154
+ }>;
155
+ /** The confined policy read for a canonicalizer's capacity decision (§13.6/§13.8): the sealed
156
+ * mediator IS the identity bind (it reads only its own endpoint's policy). Returns
157
+ * `{ policy, revision }`; revision is what an admission pins. */
158
+ export declare function readEnforcedPolicy(med: AdmissionMediator): Promise<{
159
+ policy: unknown;
160
+ revision: number;
161
+ key: string;
162
+ }>;
163
+ /** The opaque admission proof (§13.8): BRANDED, bounded-lived, bound to
164
+ * `{ space, endpoint, obligation key, opId }`. Possession grants nothing to a caller that
165
+ * cannot present it to ITS OWN endpoint's mediator before expiry; the durable obligation is
166
+ * the authority, never the proof. */
167
+ export interface AdmissionProof {
168
+ readonly space: string;
169
+ readonly endpoint: string;
170
+ readonly obligationKey: string;
171
+ readonly opId: string;
172
+ readonly exp: number;
173
+ }
174
+ /** The STRUCTURAL proof check: branded, unexpired, same space/endpoint/key (§13.8: endpoint A
175
+ * can never replay endpoint B's proof). This is the fast pre-check; the AUTHORITATIVE gate that
176
+ * admission requires is {@link verifyAdmissionProof}, which ALSO re-reads the CURRENT obligation
177
+ * state (§13.8: a drained or settled row leaves a locally-valid-looking proof inert). */
178
+ export declare function assertAdmissionProof(med: AdmissionMediator, proof: AdmissionProof, obligationKey: string): void;
179
+ /** The COMPLETE proof gate (§13.8: "checked against the CURRENT obligation state"): the
180
+ * structural check PLUS a leader-read of the row confirming it still exists, carries the
181
+ * proof's opId, and is NOT settled (rejected/terminal). A proof whose row a drain settled after
182
+ * issuance is refused here even though its brand/bind/expiry still look valid, so admission is
183
+ * proof-gated on live state, never on stale possession. Every effect the proof authorizes (the
184
+ * EPF acceptance publish, the self-class accept) gates on THIS, not the structural check alone. */
185
+ export declare function verifyAdmissionProof(med: AdmissionMediator, proof: AdmissionProof, obligationKey: string): Promise<ObligationRow>;
186
+ /** What an obtain returns: the durable obligation coordinates plus the bounded proof. `joined`
187
+ * reports whether this call created the row or joined an existing winner. */
188
+ export interface ObtainedObligation {
189
+ key: string;
190
+ row: ObligationRow;
191
+ revision: number;
192
+ proof: AdmissionProof;
193
+ joined: boolean;
194
+ }
195
+ /** Obtain an EPF-class obligation (a canonical acceptance's reservation, §13.8). The class is
196
+ * fixed HERE, by the trusted operation kind. */
197
+ export declare function obtainEpfObligation(med: AdmissionMediator, request: MediatedRequest, args: AdmissionOp & {
198
+ fingerprint: string;
199
+ sourceSeq: number;
200
+ route: string;
201
+ }): Promise<ObtainedObligation>;
202
+ /** Obtain a SELF-class obligation (a guarded record commit's reservation, e.g. the
203
+ * restart-status CAS, §13.6/§13.8). The COMPLETE commit intent is pinned at obtain. */
204
+ export declare function obtainSelfObligation(med: AdmissionMediator, request: MediatedRequest, args: AdmissionOp & {
205
+ commit: SelfCommitIntent;
206
+ }): Promise<ObtainedObligation>;
207
+ /** Public settle of one unresolved obligation (the drains call it; the recheck refusals call
208
+ * it internally). Leader-reads the current row first. */
209
+ export declare function settleEpfOrSelfObligation(med: AdmissionMediator, obligationKey: string, why: string): Promise<"accepted" | "rejected" | "already-settled">;
210
+ /** Advance a `self`-class obligation `provisional → accepted` under an unexpired proof
211
+ * (§13.8 step 3: the guarded commit is authorized only while the row is `accepted`). */
212
+ export declare function acceptSelfObligation(med: AdmissionMediator, proof: AdmissionProof): Promise<{
213
+ revision: number;
214
+ }>;
215
+ /** The injected commit applier for {@link recoverSelfObligation}: the record write stays with
216
+ * a principal that holds it (the mediator's own grant is the obligation family, §13.9). */
217
+ export type ApplyCommit = (commitKey: string, valueBytes: Uint8Array, baseRevision: number) => Promise<void>;
218
+ /** Drive an `accepted` `self`-class obligation to `terminal` deterministically from its pinned
219
+ * intent alone (§13.8): landed (digest matches) / re-apply (still at base; via the injected
220
+ * {@link ApplyCommit}) / superseded (moved past to a foreign value). The writer's own resume
221
+ * AND the drain reconciler both use this — an accepted commit is never an unrecoverable
222
+ * orphan. Returns what it found. */
223
+ export declare function recoverSelfObligation(med: AdmissionMediator, obligationKey: string, deps: {
224
+ applyCommit: ApplyCommit;
225
+ }): Promise<"landed" | "re-applied" | "superseded">;
226
+ /** One enumerated obligation (its key, parsed row, and store revision). */
227
+ export interface EnumeratedObligation {
228
+ key: string;
229
+ row: ObligationRow;
230
+ revision: number;
231
+ }
232
+ /** Enumerate an obligation filter through the SEALED records scanner (§13.9, site 3), turning each
233
+ * raw entry into a parsed, closed-schema obligation row. Markers and parse failures abort LOUD: a
234
+ * drain that skipped either would declare quiescence over rows it never read. The scanner holds the
235
+ * ONLY `CONSUMER.CREATE` on the records stream (fence-free LastPerSubject; the caller — mediator or
236
+ * §13.1 retirement barrier — holds none, so a compromise can never durable-export the `oblig.`
237
+ * subtree, nats-server#8274). The barrier enumerates the target-wide `oblig.<targetUid>.>` (its
238
+ * endpoint discovery + quiescence re-check) through the registry's records scanner; each mediator
239
+ * enumerates its own endpoint's subtree through the scanner injected at open. INVARIANT: the
240
+ * `scanner` argument MUST come from one of those brand-asserted seams (`med.recordsScanner`,
241
+ * `registryRecordsScanner(reg)`), never a hand-passed instance; the brand assert lives at
242
+ * INJECTION (openAdmissionMediator / openLifecycleRegistry), not here, so a new caller that
243
+ * hand-passes a scanner bypasses the space bond. */
244
+ export declare function enumerateObligationRows(scanner: RecordsScanner, filter: string): Promise<EnumeratedObligation[]>;
245
+ /** A CLOSED, mediator-validated POOL-route repair command (§13.8; the confined-applier slice's
246
+ * boundary): the MEDIATOR reads and validates the acceptance decision fact itself
247
+ * (parse + row/decision binding + route + horizon), derives the exact EPW item subject and the
248
+ * canonical acceptance-derived bytes ({@link workItemBytesOf}), and hands the executor ONLY this
249
+ * command. The executor holds NO derivation authority — it can be granted exactly the one
250
+ * create-publish row and executes the command verbatim (create-only; a lost create is benign,
251
+ * the drain re-reads establishment either way). */
252
+ export interface PoolRouteRepair {
253
+ kind: "pool";
254
+ /** The exact EPW item subject (`<space>.epw.<endpoint>.<pool>.<cO>.<cA>.<cUid>.<id>`). */
255
+ subject: string;
256
+ /** The canonical acceptance-derived stored bytes. */
257
+ bytes: Uint8Array;
258
+ /** The acceptance's identity-bound absolute horizon (context for the executor's logs/refusals). */
259
+ workExpiry: number;
260
+ }
261
+ /** The injected POOL-route reconciler (§13.8: a drain must complete accept-side reconciliation
262
+ * for an accepted pool row before it declares quiescence; an accepted decision whose enqueue
263
+ * never landed would otherwise be lost). Receives a closed {@link PoolRouteRepair}; idempotent. */
264
+ export type ReconcilePoolRoute = (repair: PoolRouteRepair) => Promise<void>;
265
+ /** A CLOSED, mediator-validated EFFECTS-CANCEL repair (§13.8 option (i)): the MEDIATOR reads and
266
+ * row-binds the acceptance decision itself and derives the exact completion subject; the
267
+ * executor stamps its own retirement identity through the CORE validated builders
268
+ * (`effectCancelledFactOf` / `goalCancelledResultOf` — which refuse a foreign target) and
269
+ * publishes CREATE-ONLY, so a racing real completion wins by landing first and a lost create is
270
+ * benign. After the hook returns, the drain RE-READS the marker — a hook that neither
271
+ * established a bound terminal nor threw still fails closed. */
272
+ export interface EffectsCancelRepair {
273
+ kind: "effects-cancel";
274
+ /** The exact completion subject: the `eff` marker, or the goal's `result` coordinate. */
275
+ subject: string;
276
+ /** The obligation key (operator-facing messages only, never authority). */
277
+ key: string;
278
+ /** True when the acceptance is an ACTION (its terminal is the goal.result `cancelled` state —
279
+ * a wire shape the goal union already carries); false: the {@link EffectCancelledFact} member. */
280
+ goal: boolean;
281
+ /** The mediator-parsed, row-bound acceptance decision. */
282
+ acceptance: AcceptanceFact;
283
+ }
284
+ /** The injected ACCEPTED-EFFECTS resolution hook (§13.8): called when an accepted `effects`
285
+ * route has NO durable completion marker. A composition that wires no hook fails closed. */
286
+ export type CancelEffectsRoute = (repair: EffectsCancelRepair) => Promise<void>;
287
+ /** What one drain pass acted on. */
288
+ export interface DrainResult {
289
+ passes: number;
290
+ settledProvisional: number;
291
+ recoveredSelf: number;
292
+ /** Accepted epf rows whose route reconciliation this drain drove (they do not BLOCK quiescence
293
+ * — their route facts track them — but their accept-side reconciliation MUST run first). */
294
+ reconciledAcceptedEpf: number;
295
+ }
296
+ /** The POLICY drain (§13.6): settles ONLY the obligations pinned to the OLD enforced policy
297
+ * revision (the one being replaced), across the endpoint's whole prefix. Target-only rows and
298
+ * rows pinned to a different revision are NOT this drain's concern (settling them would burn a
299
+ * target-bound acceptance the policy movement does not govern, and target-only traffic would
300
+ * block convergence). Run AFTER {@link stagePolicySelector} (new policy-admitted proofs are
301
+ * paused, so no new old-revision row appears and the drain converges); RE-READS the govern head
302
+ * after draining to confirm the stage did not move, then mints the exact-revision-bound
303
+ * quiescence witness {@link promotePolicySelector} consumes. */
304
+ export declare function drainEndpointPolicy(med: AdmissionMediator, deps?: {
305
+ applyCommit?: ApplyCommit;
306
+ reconcilePoolRoute?: ReconcilePoolRoute;
307
+ cancelEffectsRoute?: CancelEffectsRoute;
308
+ }): Promise<DrainResult & {
309
+ quiescence: DrainQuiescence;
310
+ }>;
311
+ /** The RETIREMENT-side drain for THIS endpoint's rows under one target
312
+ * (`oblig.<targetUid>.<endpoint>.>`): the §13.1 terminal barrier (D13 (5)) runs one per
313
+ * endpoint found under the target. Both coordinates stay inside this mediator's own grant. */
314
+ export declare function drainTargetForEndpoint(med: AdmissionMediator, targetUid: string, deps?: {
315
+ applyCommit?: ApplyCommit;
316
+ reconcilePoolRoute?: ReconcilePoolRoute;
317
+ cancelEffectsRoute?: CancelEffectsRoute;
318
+ }): Promise<DrainResult>;
319
+ //# sourceMappingURL=admission-mediator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admission-mediator.d.ts","sourceRoot":"","sources":["../src/admission-mediator.ts"],"names":[],"mappings":"AAiDA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAOL,KAAK,cAAc,EAEpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEoB,KAAK,iBAAiB,EAChD,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAA6B,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAmCtF;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