@941design/marmot 0.0.0-stage → 0.2.0-alpha.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.
- package/CHANGELOG.md +739 -0
- package/LICENSE +21 -0
- package/README.md +33 -2
- package/dist/account/admin.d.ts +72 -0
- package/dist/account/admin.js +209 -0
- package/dist/account/device-deps.d.ts +379 -0
- package/dist/account/device-deps.js +36 -0
- package/dist/account/device-lineage.d.ts +199 -0
- package/dist/account/device-lineage.js +390 -0
- package/dist/account/device-registry.d.ts +93 -0
- package/dist/account/device-registry.js +1290 -0
- package/dist/account/device-rotation.d.ts +61 -0
- package/dist/account/device-rotation.js +827 -0
- package/dist/account/enrolment.d.ts +339 -0
- package/dist/account/enrolment.js +1247 -0
- package/dist/account/identity-proof.d.ts +79 -0
- package/dist/account/identity-proof.js +264 -0
- package/dist/account/index.d.ts +17 -0
- package/dist/account/index.js +16 -0
- package/dist/account/restore-rotation.d.ts +21 -0
- package/dist/account/restore-rotation.js +22 -0
- package/dist/account/same-account-authorization.d.ts +86 -0
- package/dist/account/same-account-authorization.js +180 -0
- package/dist/account/teardown.d.ts +190 -0
- package/dist/account/teardown.js +878 -0
- package/dist/client/admission-cleanup.d.ts +197 -0
- package/dist/client/admission-cleanup.js +635 -0
- package/dist/client/adoption-proof.d.ts +39 -0
- package/dist/client/adoption-proof.js +102 -0
- package/dist/client/before-create-group.d.ts +18 -0
- package/dist/client/before-create-group.js +65 -0
- package/dist/client/before-publish-hooks.d.ts +121 -0
- package/dist/client/before-publish-hooks.js +182 -0
- package/dist/client/client-config.d.ts +42 -0
- package/dist/client/client-config.js +13 -0
- package/dist/client/commit-redrive.d.ts +92 -0
- package/dist/client/commit-redrive.js +274 -0
- package/dist/client/component-update.d.ts +43 -0
- package/dist/client/component-update.js +53 -0
- package/dist/client/confirm-hooks.d.ts +55 -0
- package/dist/client/confirm-hooks.js +74 -0
- package/dist/client/create-client.d.ts +1126 -0
- package/dist/client/create-client.js +1232 -0
- package/dist/client/group-availability.d.ts +182 -0
- package/dist/client/group-availability.js +301 -0
- package/dist/client/group-disband.d.ts +28 -0
- package/dist/client/group-disband.js +64 -0
- package/dist/client/group-history.d.ts +461 -0
- package/dist/client/group-history.js +1365 -0
- package/dist/client/group-profile.d.ts +31 -0
- package/dist/client/group-profile.js +62 -0
- package/dist/client/group-records.d.ts +522 -0
- package/dist/client/group-records.js +1117 -0
- package/dist/client/group-removal.d.ts +36 -0
- package/dist/client/group-removal.js +127 -0
- package/dist/client/group-remove-member.d.ts +49 -0
- package/dist/client/group-remove-member.js +163 -0
- package/dist/client/group-runtime.d.ts +415 -0
- package/dist/client/group-runtime.js +2811 -0
- package/dist/client/group-snapshot.d.ts +104 -0
- package/dist/client/group-snapshot.js +474 -0
- package/dist/client/history-pages.d.ts +107 -0
- package/dist/client/history-pages.js +194 -0
- package/dist/client/inbox-send.d.ts +19 -0
- package/dist/client/inbox-send.js +71 -0
- package/dist/client/index.d.ts +24 -0
- package/dist/client/index.js +13 -0
- package/dist/client/ingest.d.ts +82 -0
- package/dist/client/ingest.js +1584 -0
- package/dist/client/invitation-outcomes.d.ts +50 -0
- package/dist/client/invitation-outcomes.js +135 -0
- package/dist/client/lifecycle-events.d.ts +63 -0
- package/dist/client/lifecycle-events.js +35 -0
- package/dist/client/opaque-candidates.d.ts +82 -0
- package/dist/client/opaque-candidates.js +170 -0
- package/dist/client/own-change-outbox.d.ts +66 -0
- package/dist/client/own-change-outbox.js +158 -0
- package/dist/client/pending-leaf.d.ts +116 -0
- package/dist/client/pending-leaf.js +378 -0
- package/dist/client/permissions.d.ts +9 -0
- package/dist/client/permissions.js +12 -0
- package/dist/client/pipeline.d.ts +583 -0
- package/dist/client/pipeline.js +3666 -0
- package/dist/client/reentrancy-guard.d.ts +102 -0
- package/dist/client/reentrancy-guard.js +159 -0
- package/dist/client/rekey.d.ts +58 -0
- package/dist/client/rekey.js +149 -0
- package/dist/client/transport-policy.d.ts +181 -0
- package/dist/client/transport-policy.js +214 -0
- package/dist/history/admission-lineage.d.ts +186 -0
- package/dist/history/admission-lineage.js +589 -0
- package/dist/history/equivocation.d.ts +55 -0
- package/dist/history/equivocation.js +113 -0
- package/dist/history/fencing.d.ts +66 -0
- package/dist/history/fencing.js +121 -0
- package/dist/history/hex.d.ts +3 -0
- package/dist/history/hex.js +10 -0
- package/dist/history/index.d.ts +74 -0
- package/dist/history/index.js +32 -0
- package/dist/history/notifications.d.ts +270 -0
- package/dist/history/notifications.js +264 -0
- package/dist/history/ordering-key.d.ts +24 -0
- package/dist/history/ordering-key.js +101 -0
- package/dist/history/own-change-fork.d.ts +112 -0
- package/dist/history/own-change-fork.js +196 -0
- package/dist/history/own-change.d.ts +118 -0
- package/dist/history/own-change.js +146 -0
- package/dist/history/policy.d.ts +48 -0
- package/dist/history/policy.js +52 -0
- package/dist/history/retained-window.d.ts +215 -0
- package/dist/history/retained-window.js +565 -0
- package/dist/inbox/demux.d.ts +90 -0
- package/dist/inbox/demux.js +78 -0
- package/dist/inbox/handler-registry.d.ts +42 -0
- package/dist/inbox/handler-registry.js +37 -0
- package/dist/inbox/index.d.ts +11 -0
- package/dist/inbox/index.js +10 -0
- package/dist/inbox/seen-set.d.ts +82 -0
- package/dist/inbox/seen-set.js +202 -0
- package/dist/inbox/subscription.d.ts +236 -0
- package/dist/inbox/subscription.js +644 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +9 -0
- package/dist/invitations/competing-welcome.d.ts +223 -0
- package/dist/invitations/competing-welcome.js +128 -0
- package/dist/invitations/decline.d.ts +67 -0
- package/dist/invitations/decline.js +149 -0
- package/dist/invitations/delivery-evidence.d.ts +288 -0
- package/dist/invitations/delivery-evidence.js +766 -0
- package/dist/invitations/expect-welcome.d.ts +66 -0
- package/dist/invitations/expect-welcome.js +138 -0
- package/dist/invitations/index.d.ts +18 -0
- package/dist/invitations/index.js +18 -0
- package/dist/invitations/invitation-outcome.d.ts +110 -0
- package/dist/invitations/invitation-outcome.js +210 -0
- package/dist/invitations/invite.d.ts +358 -0
- package/dist/invitations/invite.js +1102 -0
- package/dist/invitations/offers.d.ts +79 -0
- package/dist/invitations/offers.js +115 -0
- package/dist/invitations/on-proposal.d.ts +47 -0
- package/dist/invitations/on-proposal.js +40 -0
- package/dist/invitations/pending-proposal-policy.d.ts +52 -0
- package/dist/invitations/pending-proposal-policy.js +139 -0
- package/dist/invitations/proposal-deadline.d.ts +133 -0
- package/dist/invitations/proposal-deadline.js +164 -0
- package/dist/invitations/relay-planes.d.ts +43 -0
- package/dist/invitations/relay-planes.js +70 -0
- package/dist/invitations/welcome-processor.d.ts +272 -0
- package/dist/invitations/welcome-processor.js +1241 -0
- package/dist/key-packages/device-key.d.ts +131 -0
- package/dist/key-packages/device-key.js +272 -0
- package/dist/key-packages/device-rotation-records.d.ts +83 -0
- package/dist/key-packages/device-rotation-records.js +173 -0
- package/dist/key-packages/group-refs.d.ts +40 -0
- package/dist/key-packages/group-refs.js +79 -0
- package/dist/key-packages/index.d.ts +18 -0
- package/dist/key-packages/index.js +18 -0
- package/dist/key-packages/key-package-ref.d.ts +16 -0
- package/dist/key-packages/key-package-ref.js +21 -0
- package/dist/key-packages/observation-stream.d.ts +4 -0
- package/dist/key-packages/observation-stream.js +120 -0
- package/dist/key-packages/offer-rumor.d.ts +26 -0
- package/dist/key-packages/offer-rumor.js +69 -0
- package/dist/key-packages/publisher.d.ts +174 -0
- package/dist/key-packages/publisher.js +1247 -0
- package/dist/key-packages/select-key-package.d.ts +24 -0
- package/dist/key-packages/select-key-package.js +90 -0
- package/dist/key-packages/slot-manager.d.ts +167 -0
- package/dist/key-packages/slot-manager.js +327 -0
- package/dist/key-packages/validate-key-package-event.d.ts +3 -0
- package/dist/key-packages/validate-key-package-event.js +49 -0
- package/dist/media/cache.d.ts +14 -0
- package/dist/media/cache.js +10 -0
- package/dist/media/index.d.ts +52 -0
- package/dist/media/index.js +71 -0
- package/dist/mls.d.ts +15 -0
- package/dist/mls.js +15 -0
- package/dist/shared/account-pubkey.d.ts +4 -0
- package/dist/shared/account-pubkey.js +10 -0
- package/dist/shared/errors.d.ts +28 -0
- package/dist/shared/errors.js +96 -0
- package/dist/shared/hex.d.ts +4 -0
- package/dist/shared/hex.js +13 -0
- package/dist/shared/index.d.ts +14 -0
- package/dist/shared/index.js +14 -0
- package/dist/shared/kinds.d.ts +8 -0
- package/dist/shared/kinds.js +28 -0
- package/dist/shared/publish-classification.d.ts +26 -0
- package/dist/shared/publish-classification.js +31 -0
- package/dist/storage/envelope.d.ts +39 -0
- package/dist/storage/envelope.js +201 -0
- package/dist/storage/index.d.ts +237 -0
- package/dist/storage/index.js +491 -0
- package/dist/storage/indexeddb/idb-types.d.ts +68 -0
- package/dist/storage/indexeddb/idb-types.js +1 -0
- package/dist/storage/indexeddb/index.d.ts +17 -0
- package/dist/storage/indexeddb/index.js +141 -0
- package/dist/storage/lease.d.ts +54 -0
- package/dist/storage/lease.js +168 -0
- package/dist/storage/memory/deterministic-signer.d.ts +27 -0
- package/dist/storage/memory/deterministic-signer.js +65 -0
- package/dist/storage/memory/index.d.ts +32 -0
- package/dist/storage/memory/index.js +87 -0
- package/dist/storage/memory/lock-manager.d.ts +8 -0
- package/dist/storage/memory/lock-manager.js +71 -0
- package/package.json +66 -3
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { type ClientState } from '@941design/marmot-engine/mls';
|
|
2
|
+
import { type AdmissionDerivation, type LineageAnchor, type RetainedWindow } from '../history/index.js';
|
|
3
|
+
import { type AddAnchor, type CleanupReference, type DeclineCandidate } from '../invitations/index.js';
|
|
4
|
+
import type { AccountStore, GroupStore, GroupStoreTx, KeyValueView, Storable } from '../storage/index.js';
|
|
5
|
+
import { type AdmissionTarget, type PendingIntentRecord } from './group-records.js';
|
|
6
|
+
import type { GroupRuntime } from './group-runtime.js';
|
|
7
|
+
import { type ReentrancyGuard } from './reentrancy-guard.js';
|
|
8
|
+
/** Where a candidate's cleanup stands (SC-12; the spec's disposition table). */
|
|
9
|
+
export type CleanupDisposition = 'eligible' | 'pending' | 'removed-revisable' | 'removed-settled' | 'absent' | 'insufficient-evidence';
|
|
10
|
+
/** Why a disposition is `absent` or `insufficient-evidence`. */
|
|
11
|
+
export type CleanupDispositionCause = 'add-off-path' | 'occupancy-ended' | 'lineage-gap' | 'unresolved-selector' | 'ambiguous-legacy' | 'no-anchor';
|
|
12
|
+
/** One read of a candidate's cleanup disposition (`invitations.cleanupDisposition`). */
|
|
13
|
+
export interface CleanupDispositionReport {
|
|
14
|
+
readonly groupId: string;
|
|
15
|
+
readonly candidateId: string;
|
|
16
|
+
/** The cleanup's root intent id (`pending`, `removed-*`). */
|
|
17
|
+
readonly intentId?: string;
|
|
18
|
+
readonly disposition: CleanupDisposition;
|
|
19
|
+
readonly cause?: CleanupDispositionCause;
|
|
20
|
+
/** The confirmed cleanup commit (`removed-*`). */
|
|
21
|
+
readonly commitDigest?: string;
|
|
22
|
+
/** `true` when the group is fenced: the disposition is the last one the store proved and no longer advances. */
|
|
23
|
+
readonly lastKnown: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare function lineageAnchorOf(anchor: AddAnchor): LineageAnchor;
|
|
26
|
+
/**
|
|
27
|
+
* The lineage seeds of one confirmed invite commit: its anchors (by KeyPackageRef) grouped by lineage key, each with
|
|
28
|
+
* the candidates (deliveries of invite `inviteId`) it admitted.
|
|
29
|
+
*/
|
|
30
|
+
export declare function lineageSeedsOf(groupId: string, inviteId: string, anchors: ReadonlyMap<string, AddAnchor>): Map<string, {
|
|
31
|
+
readonly anchor: LineageAnchor;
|
|
32
|
+
readonly candidateIds: readonly string[];
|
|
33
|
+
}>;
|
|
34
|
+
export type { AdmissionTarget };
|
|
35
|
+
/** Group extension holding one {@link CleanupLedgerEntry} per candidate, keyed by `candidateId`. */
|
|
36
|
+
export declare const ADMISSION_CLEANUP_EXTENSION = "marmot.admission-cleanup";
|
|
37
|
+
/**
|
|
38
|
+
* SC-5: the cleanup ledger entry of one candidate. Written with the cleanup's `pendingIntents` record in ONE group transaction (I13);
|
|
39
|
+
* `rootIntentId` is the root of the cleanup currently responsible for the candidate, replaced only when a new root is created (I15b);
|
|
40
|
+
* `confirmed` lists every own commit that carried an INLINE Remove of the target and was confirmed — never shortened, so an earlier
|
|
41
|
+
* attribution survives a new root (AC-REMOVE-29).
|
|
42
|
+
*/
|
|
43
|
+
export interface CleanupLedgerEntry {
|
|
44
|
+
readonly v: 1;
|
|
45
|
+
readonly rootIntentId: string;
|
|
46
|
+
readonly target: AdmissionTarget;
|
|
47
|
+
readonly confirmed: readonly {
|
|
48
|
+
readonly digest: string;
|
|
49
|
+
readonly tag: string;
|
|
50
|
+
}[];
|
|
51
|
+
}
|
|
52
|
+
/** The ledger as the disposition reads it (S4 named the read type; S5 gives it values). */
|
|
53
|
+
export type CleanupLedgerEntryView = CleanupLedgerEntry;
|
|
54
|
+
/** Strict decoder of the ledger row `key` (its candidate id). */
|
|
55
|
+
export declare function decodeCleanupLedgerEntry(key: string, raw: unknown): CleanupLedgerEntry;
|
|
56
|
+
export declare function encodeCleanupLedgerEntry(entry: CleanupLedgerEntry): Storable;
|
|
57
|
+
/**
|
|
58
|
+
* The ledger entry of `candidateId`, or `undefined`. A row that does not decode reads as none: no entry means no attribution and
|
|
59
|
+
* no in-flight root, which only ever makes the disposition LESS positive (fail closed); any other read error propagates.
|
|
60
|
+
*/
|
|
61
|
+
export declare function readCleanupLedgerEntry(view: KeyValueView, candidateId: string): Promise<CleanupLedgerEntry | undefined>;
|
|
62
|
+
export declare function writeCleanupLedgerEntry(view: KeyValueView, entry: CleanupLedgerEntry): Promise<void>;
|
|
63
|
+
/** The cleanup target a pending record drives: an original's intent target, or a re-drive's (not yet lost) `admission-removed` change's. */
|
|
64
|
+
export declare function cleanupTargetOf(record: Pick<PendingIntentRecord, 'intent' | 'changes'>): AdmissionTarget | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* I15a — the ONLY definition of "a cleanup for `cid` is in flight": the first `pendingIntents` record (in `records`' order, `seq`)
|
|
67
|
+
* that is (original) a `commit` record whose intent's `removeAdmission` names `cid`, in any state (`pending-confirm` included), or
|
|
68
|
+
* (re-drive) a record re-enqueued from the entry's root whose `changes` hold an `admission-removed` change of `cid`. Without an entry
|
|
69
|
+
* (none written yet, or a row that did not decode) a re-drive record naming `cid` still matches: coalescing never removes twice.
|
|
70
|
+
*/
|
|
71
|
+
export declare function matchingCleanupRecord(records: readonly PendingIntentRecord[], entry: Pick<CleanupLedgerEntry, 'rootIntentId'> | undefined, cid: string): PendingIntentRecord | undefined;
|
|
72
|
+
export interface CleanupDispositionInput {
|
|
73
|
+
readonly groupId: string;
|
|
74
|
+
readonly candidate: Pick<DeclineCandidate, 'candidateId' | 'status' | 'basis'>;
|
|
75
|
+
/** The delivery's Add anchor, or the one lazy legacy resolution found; absent when neither names the admission. */
|
|
76
|
+
readonly anchor?: LineageAnchor;
|
|
77
|
+
/** What the selected path proves about that admission (required with `anchor`). */
|
|
78
|
+
readonly admission?: AdmissionDerivation;
|
|
79
|
+
/** The candidate's cleanup ledger entry (S5), when one was written: at most one, `target.candidateId` the candidate's. */
|
|
80
|
+
readonly ledger: readonly CleanupLedgerEntryView[];
|
|
81
|
+
/** S5 (I15a): the root intent id of the cleanup in flight for the candidate ({@link matchingCleanupRecord}), when one is. */
|
|
82
|
+
readonly inFlight?: {
|
|
83
|
+
readonly intentId: string;
|
|
84
|
+
};
|
|
85
|
+
readonly lastKnown: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* SC-3 I9a: the disposition as a pure function of durable evidence and lineage. A cleanup in flight (I15a) is `pending`
|
|
89
|
+
* under its root intent id, whatever else holds (S5). An ambiguous candidate is insufficient evidence (`ambiguous-legacy`
|
|
90
|
+
* when only a pre-upgrade decline covers it, else `unresolved-selector`); an actionable one without an anchor is
|
|
91
|
+
* `no-anchor`; otherwise the admission's occupancy decides — `occupying` → `eligible`, `ended` → `removed-revisable` /
|
|
92
|
+
* `removed-settled` when the end is this candidate's own confirmed INLINE Remove (I14), else `absent`
|
|
93
|
+
* (`occupancy-ended`), `add-off-path` → `absent`, a `gap` → `lineage-gap`.
|
|
94
|
+
*/
|
|
95
|
+
export declare function cleanupDispositionOf(input: CleanupDispositionInput): CleanupDispositionReport;
|
|
96
|
+
/**
|
|
97
|
+
* I9b: the anchor of a delivery recorded without one (a pre-upgrade or unanchorable delivery), found in the retained
|
|
98
|
+
* window. Succeeds only when the invite commit's node (`commitTag`) is still in the window with its link, its commit
|
|
99
|
+
* decodes as a framed PublicMessage commit, exactly one Add carried by value in it holds a KeyPackage whose ref is
|
|
100
|
+
* `inviteeRef`, and that KeyPackage's leaf is the unique new KeyPackage-sourced leaf of the commit's state (SC-1 I1).
|
|
101
|
+
* A pruned, absent, undecodable or by-reference commit, or zero or several matching Adds: `undefined` (`no-anchor`).
|
|
102
|
+
* Never throws.
|
|
103
|
+
*/
|
|
104
|
+
export declare function resolveLegacyAnchor(input: {
|
|
105
|
+
readonly window: RetainedWindow;
|
|
106
|
+
readonly tipState: ClientState;
|
|
107
|
+
readonly commitTag: string;
|
|
108
|
+
readonly commitEventId: string;
|
|
109
|
+
readonly inviteeRef: string;
|
|
110
|
+
}): Promise<LineageAnchor | undefined>;
|
|
111
|
+
/**
|
|
112
|
+
* SC-9 for `invitations.cleanupDisposition`, evaluated synchronously: `reentrant` (naming the surface) inside any live
|
|
113
|
+
* account-scope frame other than an inbox surface (store, signer, verifier, …: the read's account transaction would
|
|
114
|
+
* queue behind it), inside a group-scope `onConfirm` / `onBeforePublish` / `verifier` / `onProposal` frame (its group
|
|
115
|
+
* transaction is open), or inside a group-scope consumer `store` frame. An inbox handler or `onApplicationRumor` frame
|
|
116
|
+
* holds no store transaction: the read proceeds from it, as from an event listener.
|
|
117
|
+
*/
|
|
118
|
+
export declare function assertCleanupDispositionAllowed(guard: ReentrancyGuard): void;
|
|
119
|
+
export interface CleanupDispositionReaderDeps {
|
|
120
|
+
readonly guard: ReentrancyGuard;
|
|
121
|
+
readonly account: AccountStore;
|
|
122
|
+
/** The group's store (the same object for the same id: `WritableStores.groupFactory`). */
|
|
123
|
+
groupStore(groupId: string): GroupStore;
|
|
124
|
+
/** The signer's account (SC-3 I9c): a reference of any other account is foreign. */
|
|
125
|
+
accountKey(): Promise<string>;
|
|
126
|
+
/** Whether a fence of `groupId` was raised in this client session (its marker write may have failed). */
|
|
127
|
+
sessionFenced(groupId: string): boolean;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* `invitations.cleanupDisposition(ref)`. The guard runs synchronously (a refused call returns an already rejected
|
|
131
|
+
* promise, before any store access). Then: a reference that does not decode → `invalid-options`
|
|
132
|
+
* `malformed-reference`; one of another account than the signer's → `foreign-reference` (I9c: the reference's
|
|
133
|
+
* account part is never trusted as authority); one naming no candidate of this store (an unknown or purged group
|
|
134
|
+
* included) → `unknown-reference`. None of them reads a group store, writes, publishes or resumes anything.
|
|
135
|
+
*/
|
|
136
|
+
export declare function readCleanupDisposition(deps: CleanupDispositionReaderDeps, ref: CleanupReference | unknown): Promise<CleanupDispositionReport>;
|
|
137
|
+
/** What one disposition read derived: the report, and (when it got that far) the anchor and what the selected path proves of it. */
|
|
138
|
+
export interface DerivedCleanupDisposition {
|
|
139
|
+
readonly report: CleanupDispositionReport;
|
|
140
|
+
readonly anchor?: LineageAnchor;
|
|
141
|
+
readonly admission?: AdmissionDerivation;
|
|
142
|
+
/** The anchor came from lazy legacy resolution (SC-3 I9b) and no lineage record names it yet: D9 seeds one. */
|
|
143
|
+
readonly seedLegacyAnchor?: true;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The one-instant read behind {@link readCleanupDisposition} and the ladder's D3 (G9: the same derivation, so a submit's report equals
|
|
147
|
+
* the read's): one read-only group transaction (window, state, fence marker, lineage, the candidate's ledger entry, `pendingIntents`)
|
|
148
|
+
* awaiting one read-only account transaction (evidence); the derivation is pure, after both closed. `unknown-reference` when the
|
|
149
|
+
* evidence names no candidate. Runs no guard check of its own (the callers did).
|
|
150
|
+
*/
|
|
151
|
+
export declare function deriveCleanupDisposition(deps: Pick<CleanupDispositionReaderDeps, 'guard' | 'account' | 'groupStore' | 'sessionFenced'>, scope: {
|
|
152
|
+
readonly account: string;
|
|
153
|
+
readonly groupId: string;
|
|
154
|
+
readonly candidateId: string;
|
|
155
|
+
}): Promise<DerivedCleanupDisposition>;
|
|
156
|
+
/** Whether the MLS commit message `bytes` carries an INLINE (by-value) Remove of `leafIndex`. Never throws. */
|
|
157
|
+
export declare function carriesInlineRemove(bytes: Uint8Array, leafIndex: number): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* I13, in the confirming group transaction: when `record` is a scoped cleanup (an original, or a re-drive still owing its
|
|
160
|
+
* `admission-removed` change) and the confirmed commit carried an INLINE Remove of the target's position, `{digest, tag}` is appended
|
|
161
|
+
* to the candidate's ledger entry (created under `rootIntentId` if none was written — a record written before its entry existed).
|
|
162
|
+
* Idempotent: a digest already listed is not added again.
|
|
163
|
+
*/
|
|
164
|
+
export declare function recordCleanupConfirmation(tx: Pick<GroupStoreTx, 'extension'>, input: {
|
|
165
|
+
readonly record: Pick<PendingIntentRecord, 'intent' | 'changes'>;
|
|
166
|
+
readonly rootIntentId: string;
|
|
167
|
+
readonly commitMessage: Uint8Array;
|
|
168
|
+
readonly digest: string;
|
|
169
|
+
readonly tag: string;
|
|
170
|
+
}): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* I15: what the selected path proves about `target`'s admission at the runtime's current tip — its stored lineage record (or the
|
|
173
|
+
* anchor alone) derived over the in-memory window. `undefined` when no tip state is at hand. Read on the group's queue.
|
|
174
|
+
*/
|
|
175
|
+
export declare function readCleanupTargetAdmission(rt: GroupRuntime, target: AdmissionTarget): Promise<AdmissionDerivation | undefined>;
|
|
176
|
+
/**
|
|
177
|
+
* Marks `candidateId` as one this runtime reports `cleanupDisposition` changes for: a cleanup this session submitted, confirmed or saw
|
|
178
|
+
* withdrawn. In memory only — the event is best effort; a consumer that missed one reads the disposition by reference (AC-REMOVE-21).
|
|
179
|
+
*/
|
|
180
|
+
export declare function noteCleanupCandidate(rt: GroupRuntime, candidateId: string, report?: CleanupDispositionReport): void;
|
|
181
|
+
/**
|
|
182
|
+
* Re-derives the disposition of every candidate {@link noteCleanupCandidate} named and emits `cleanupDisposition` for each one whose
|
|
183
|
+
* report changed since the last emission. Detached: never awaited by the caller, never throws, and a failed read emits nothing (the
|
|
184
|
+
* read by reference recovers it). Reads only — no write, no transport call.
|
|
185
|
+
*/
|
|
186
|
+
export declare function emitCleanupDispositions(rt: GroupRuntime): void;
|
|
187
|
+
/**
|
|
188
|
+
* `MarmotGroup.removeAdmission(ref)` on the group's queue: the SC-11 ladder, in total order. Phase P (P1–P5) is a pure-read prefix —
|
|
189
|
+
* no `preflight`, no `resumePending`, no write, no timer, no transport call — that ends in a coalesce: a cleanup already in flight for
|
|
190
|
+
* the candidate (I15a) resolves `pending` under its root intent id. Phase D then resumes pending work (`preflight`), applies the send
|
|
191
|
+
* gate, re-reads the disposition (anything but `eligible` resolves with that report), refuses the committer's own leaf (`self`), a
|
|
192
|
+
* non-admin, an admin coupling the account removal would refuse, another own commit pending and a staged proposal in the way — each
|
|
193
|
+
* refusal enqueues nothing — and finally writes the cleanup record and the candidate's ledger entry in ONE group transaction (I13).
|
|
194
|
+
* The commit is built and published in the background (the group's resume), re-checking the target on the actual parent (I15); the
|
|
195
|
+
* call resolves `pending` with the new root intent id.
|
|
196
|
+
*/
|
|
197
|
+
export declare function removeAdmissionIntent(rt: GroupRuntime, ref: unknown): Promise<CleanupDispositionReport>;
|