@real-life/trust-protocol 0.6.0 → 0.7.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,EAAE;AACF,qEAAqE;AACrE,qEAAqE;AACrE,qEAAqE;AACrE,uEAAuE;AACvE,6BAA6B;AAC7B,EAAE;AACF,qEAAqE;AACrE,SAAS;AACT,wEAAwE;AACxE,4CAA4C;AAC5C,yEAAyE;AACzE,uEAAuE;AACvE,0EAA0E;AAC1E,uEAAuE;AACvE,uEAAuE;AACvE,oEAAoE;AACpE,yEAAyE;AACzE,EAAE;AACF,0DAA0D;AAC1D,oEAAoE;AACpE,wEAAwE;AACxE,oEAAoE;AACpE,uEAAuE;AACvE,yDAAyD;AACzD,EAAE;AACF,2DAA2D;AAC3D,wEAAwE;AACxE,yEAAyE;AACzE,mEAAmE;AACnE,sEAAsE;AACtE,2EAA2E;AAC3E,qEAAqE;AACrE,0EAA0E;AAC1E,yEAAyE;AACzE,0EAA0E;AAC1E,uEAAuE;AACvE,qEAAqE;AACrE,2EAA2E;AAC3E,wEAAwE;AACxE,2EAA2E;AAC3E,yEAAyE;AACzE,kEAAkE;AAClE,yEAAyE;AACzE,uEAAuE;AACvE,0EAA0E;AAC1E,wEAAwE;AACxE,qDAAqD;AACrD,iEAAiE;AACjE,gEAAgE;AAChE,uCAAuC;AACvC,sEAAsE;AACtE,6DAA6D;AAC7D,0EAA0E;AAC1E,0EAA0E;AAC1E,yEAAyE;AACzE,uEAAuE;AACvE,+HAA+H;AAC/H,wEAAwE;AACxE,0EAA0E;AAC1E,yEAAyE;AACzE,0EAA0E;AAC1E,yEAAyE;AACzE,uEAAuE;AACvE,0EAA0E;AAC1E,6BAA6B;AAC7B,qEAAqE;AACrE,+CAA+C;AAC/C,uEAAuE;AACvE,sDAAsD;AACtD,yEA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,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;QAC9B,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,SAAS,KAAK,IAAI;YAAE,SAAQ;QAChD,MAAM,CAAC,GAAG,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,CAAA;QAC9E,IAAI,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACpB,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAE,KAAkB,EAAE,OAAgC,EAAE,OAAsB,EAAE;IAChH,IAAI,CAAC,KAAK,EAAE,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI;QAAE,MAAM,IAAI,SAAS,CAAC,qCAAqC,CAAC,CAAA;IAC5F,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAChD,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;IAC7D,MAAM,MAAM,CAAC,IAAI,EAAE,CAAA;IACnB,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["// engine — the holder's small engine (lib Stage 2, note §4.1–4.4, 4.7).\n//\n// Modules own their rules as pure transitions and register commands,\n// task handlers and duty handlers here, once, at construction; after\n// that the registries are frozen. No module has a commit path of its\n// own: the engine coordinates snapshot, preparation, check, commit and\n// release, and nothing else.\n//\n// An act runs in four steps (note §4.2), serialized by one in-engine\n// queue:\n// 1. read the snapshot {state, version} from the store and decode it;\n// raise `when` to state.lastWhen (4.7)\n// 2. prepare (async, outside the transaction): crypto, entropy, ports;\n// `prepared` is bound to the version and commitSeq it ran against\n// 3. apply (synchronous, pure, on a deep-frozen snapshot), then one CAS\n// commit of state, outbox, duties, the act journal and commitSeq;\n// on `conflict` back to 1 — the queue serializes this engine, CAS\n// catches every other writer — bounded by retry.commitAttempts\n// 4. only after the commit: events to subscribers, the result returned\n//\n// A commit that throws has an unknown outcome: InfraError\n// 'unknown-commit-outcome'. The engine then settles before its next\n// operation: it re-reads and, if the commit landed (the stored state is\n// the one it wrote, or the journal holds the act at its commitSeq),\n// releases that commit's events late; otherwise drops them. A repeated\n// human act finds its result in the journal (note §4.2).\n//\n// Choices this file makes where the note leaves them open:\n// - snapshots handed to prepare/apply are always deep-frozen (also in\n// production): a mutating module throws a TypeError, nothing commits\n// - every act reads the store afresh; the engine caches no state\n// - eventId is `<commitSeq>.<index>`: unique per holder, no entropy\n// - the input is bound at the public call: a canonical, deep-frozen JSON\n// copy (undefined object members dropped, anything else non-JSON\n// refused); its hash, every preparation and every apply use that copy\n// - a `when` above lastWhen is a state change and commits; a non-human\n// act whose apply returns the identical state object and nothing else\n// commits nothing only when lastWhen stays too. A human act always\n// commits, because its journal entry is the result. Refusals and\n// journal replays commit nothing, lastWhen included — but for a replay\n// that finds one of its documents past its lifetime or the horizon:\n// that give-up runs first as an operation of its own on the one commit\n// path (resume's CommitOp, its timer carried to the replay's answer)\n// - outbound of an act starts at attempt 1 with nextAttemptAt =\n// when + ceil(backoff(1)); resume() re-emits only items that are due\n// and pauses re-emission while the last step is awaiting-transport\n// (the adapter holds the item) and never re-emits an accepted one. It\n// gives up every non-terminal item (submitted, held or accepted) at\n// first submission + horizonMs, never by attempt\n// count, or earlier at the sender lifetime its type declared\n// (expiresAt, Delivery 7020); nextDueAt is the earliest due\n// re-emission, horizon or lifetime\n// - the holder's give-up is failed(expired-by-adapter-policy), at a\n// lifetime failed(task-expired) (Delivery 6110); a later\n// delivered report is late by that history, whatever the adapter says\n// - replay of a human act returns the journaled events and the outbound\n// of its documents that are not terminal (delivered, failed) and not\n// due for the give-up, at their current attempt; one due for it is\n// given up in a commit of its own first (6115: never handed out again). Idempotency is bounded by the journal's retention:\n// max(P90D, retry.horizonMs), the key-retention of Delivery §7 that\n// bounds effects and their acks; after it the same actId is a new act\n// - KeyProvider, Log and Access rejections inside a preparation become\n// InfraError('key-provider' | 'log' | 'access') with the cause. Known\n// limitation: a provider's argument errors (a module passing a label\n// outside the registry, say) are wrapped the same way, so a module\n// programming error surfaces as an infrastructure error; the original\n// error stays in `cause`\n// - events are deep-frozen before listeners or callers see them; a\n// listener's throw or rejection is dropped\n// - the next state is validated by the codec before every commit; an\n// invalid state is a programming error and throws\n// - receive (receive.ts) is a built-in like tick: a failed disposition\n// commits nothing, lastWhen included (like a refusal); duplicate-known\n// commits only a raised lastWhen; a CAS conflict re-reads and runs the\n// stages again, which re-checks the effect cache at stage 4\n// - an ack is stored sealed (StoredAck: envelope, digest, recipient) in\n// its effect, so every re-send is byte-identical down to the envelope.\n// It stays `sent: false` until a service takes it (report accepted or\n// delivered: `sentBy: 'accepted'`), the adapter reports it failed\n// (`'failed'`), or its horizon passes (effect commit + horizonMs:\n// `'horizon'`, no event: acks have no trias) — Delivery RLTP-DEL-6330.\n// An awaiting-transport report keeps it unsent and records `held`; a\n// held ack is not re-offered by resume (the adapter has it) and stays\n// in pendingTransport. Unsent and not held, it has the outbox's retry\n// schedule: attempt 1 at the receive, re-offered by resume when due\n// (attempt + 1, backoff), counted into nextDueAt. Sent or not, it stays\n// with its effect until the effect expires (RLTP-DEL-6335). A\n// duplicate's re-send carries attempt + 1 and does not move the\n// schedule; it commits the answer it makes due (6330), else nothing\n// beyond lastWhen\n// - custody (Delivery RLTP-DEL-6120 to 6135): pendingTransport(when) is\n// the set the holder keeps for transport — every outbox item neither\n// terminal nor accepted, held ones included, and every unsent ack —\n// each with its deadline (notAfter: the horizon from the first\n// submission, or the type's sender lifetime if earlier) and without\n// those whose deadline has passed at `when`, whether or not a resume\n// has recorded the give-up yet. It answers only after a resume of this\n// engine has completed (a resume that throws withdraws that again), and\n// its entries are issued to this engine: mayHandOver(entry, when)\n// accepts only an entry this engine issued, re-reads the store and says\n// yes only while the engine is open and the entry is still pending\n// there with the same envelope before its deadline. handOver(entry,\n// when, start) is the same check with the deposit's start inside the\n// queue: nothing of this engine runs between the check and the start.\n// A duplicate makes an answer due, stored with the ack (answers,\n// answerDue: kept across a lock): a `resend` entry numbered by it,\n// beside the ack's retries and independent of their state, deadline the\n// effect's retention; the begun hand-over ends it (a commit): it is one\n// hand-over with no retries (Delivery 6330), so a deposit the wire\n// refuses is not tried again — the sender's next redelivery asks anew;\n// a duplicate while one is due is answered by it (the same bytes); a resume that throws, its settling\n// included, withdraws the authority until one completes. The check is\n// this engine's: a second engine over the same store commits through\n// CAS but is not serialized with this one's hand-overs, so one opening\n// per store at a time is the app's to keep (its writer lock). close() ends the\n// engine: every later operation rejects with InfraError('closed'),\n// mayHandOver answers false, and no entry issued before authorizes\n// anything. An operation already running when close() is called\n// completes\n// - outbound of one commit, in order: outbox re-emissions, released\n// acks, new documents\n// - resume runs duties after the outbox, ordered by dueAt (absent: due\n// always, counted as 0), then id. An Applied fulfils the duty and the\n// engine removes it in the same commit; 'not-due' and a refusal keep it\n// without a trace. A duty of a registered kind at another version is\n// announced as duty.unsupported on every resume (a commit of its own);\n// a kind no module registers is kept silently. A duty with awaitHead\n// runs only when its handler's awaitHolds says so (none: never). Each\n// planned duty is checked again against the state the duties before it\n// left: still present at the handler's version, due, its awaited head\n// holding; a prepared duty whose data changed since its preparation is\n// deferred to the next resume and prepared afresh there. Its handler's\n// apply re-checks every other state-dependent precondition itself\n// (note §4.2 step 3). nextDueAt comes from the final duty set, the\n// duties created in this resume included: a future dueAt, or `when` for\n// duty work runnable now that did not run; a duty that ran and stayed\n// (not-due, refused) sets no timer while its record is unchanged since\n// that run. A duty whose kind changed since the plan is not run by the\n// planned handler; the next resume dispatches it. New documents of\n// duties count in too. The duties a handler opens are folded into the\n// state before the next handler runs (an id already open is kept), so\n// later handlers' drop rules and dedupe see them; they run on the next\n// resume (the plan is fixed at the snapshot)\n// - every committed operation but resume names the duty work it opened or\n// unblocked as nextDueAt on its result (ActResult, ReceiveResult\n// unique): `when` where a duty that is new, changed, or newly runnable\n// (its awaited head now holding) can run now, else the earliest future\n// dueAt among those; absent where it opened none. It is the app's cue to\n// call resume (or set a timer), as resume's own nextDueAt is. A journal\n// replay of a human act carries none: its duties were announced then\n// - sweeps (Trust 5.4 reconciliation, PR 4b) run in resume after the\n// duties, in registration order, on the state the duties left; their\n// preparations run against resume's snapshot beside the duties'. A\n// piece whose inputs moved since is skipped and makes `when` the\n// nextDueAt, as does sweep work that became pending during the resume\n// itself (a give-up at the horizon, a duty's change) without having\n// been prepared. Their new documents count into nextDueAt like the\n// duties'. Every other committed operation whose state adds a key to\n// a sweep's `pending` names `when` as its nextDueAt; a sweep that\n// declares the state parts it reads (`reads`) is skipped there when the\n// operation left all of them untouched (by reference)\n// - a verified delivery-ack runs the ack handler registered for the\n// acknowledged item's type in its own transaction; a report never does\n// - an outbox item that turns failed (a failed report, or the holder's\n// own give-up at the horizon inside resume) runs the failure handler\n// registered for its type in that same transaction, once, at the\n// transition; duties it opens are folded into the state there (so two\n// failures of one resume cannot open one duty twice) and count into\n// nextDueAt like any new duty. A late delivered after failed runs the\n// ack handler as usual, never the failure handler again\n// - the Encounter latch exception (receive.ts TaskRefusal, Refusal):\n// a refusal carrying `latch` commits exactly that state (checked to\n// shrink encounter.challenges and touch nothing else) and the raised\n// lastWhen, with no journal entry, cache entry, ack, outbound or event;\n// the result stays the refusal (receive: failed at stage 9)\n// - a task handler's refusal commits nothing; its TaskDiscarded (an\n// assembly discarded at a resource limit or rejected, Trust 5365/5366)\n// commits its state and nothing else: disposition `discarded` with the\n// reason, no cache entry, no ack, no event\n// - a transition's `renames` (Applied) are followed in the effect cache by\n// the engine after the transition: each stored ack's recipient.contactId\n// that a rename names moves to its new id; the envelope, sealed to the\n// key agreement, is untouched (an ack re-sent is byte-identical)\n// - a module's ownRetries are task types it re-issues itself: resume\n// never re-emits their outbox items (the horizon still gives them up);\n// its keepKeys name own rkids tick must not tombstone though no live\n// tuple carries them. Both trust the registered modules: no ownership\n// of a type or a key is checked (modules are the library's own, not\n// app plug-ins)\n// - a failure handler gets the retry backoff, so a failure can make work\n// due no earlier than its schedule allows\n// - the timer contract: tick does the time-driven work (expiry,\n// retention, the modules' `retain`), resume the delivery work (retries,\n// due duties, sweeps, acks). nextDueAt names the earliest of both: on\n// resume, the earliest future deadline of the expiry work (prompt\n// expiresAt, effect expiry, the act journal's, a terminal outbox item's\n// and an address key's retention, every module's `deadlines`); on an\n// act or receive, also a deadline the commit newly introduced. The app\n// sets one timer on it and, when it fires, calls tick and then resume\n// (README \"The holder\")\n// - after its own retention, tick runs every module's `retain` hook on\n// the result (the trust module drops in-flight star deliveries whose\n// outbox items have all been retained away); the address keys' retention\n// comes last, its live set and keepKeys read on what the hooks left, so\n// a key whose last claim (an act's pin, 8290) left in this tick leaves in\n// the same tick and no passed key deadline outlives it\n// - without an Access port, EngineOptions.accessFrom (createHolder: the\n// membership module's localAccess) builds one over each preparation's\n// own snapshot, so it describes exactly the state the commit lands on\n// - EngineOptions.check (createHolder's `invariants: true`) runs on every\n// commit after the codec's validation and before the CAS; its throw\n// aborts the operation, nothing commits\n// - tick retains with the key-retention max(P90D, horizonMs): effects\n// with their acks at expiresAt; terminal outbox items once the\n// retention has passed since their last step, unless a kept journal\n// entry names them; an address key not shown for the retention and\n// the own rkid of no tuple that is not deactivated becomes a tombstone —\n// except a member key (a group/… label): an identity context of\n// Identity §6.1 rather than a delivery address of Delivery §5 (one\n// derivation per group, reused whenever the holder is invited to it\n// again), it leaves `addresses` without a tombstone (a point for\n// Delivery 0.82: addresses and identity contexts)\nimport { jcs, b64uOf } from './core.js'\nimport { CODEC, decodeState, encodeState } from './codec.js'\nimport { emptyState, toOpaque, triasOf } from './state.js'\nimport type { Dec, Duty, Effect, HolderState, Millis, OutboxItem, OutboxStep, Prompt, PromptChoice, PromptKind, StoredAck } from './state.js'\nimport type { Access, CarrierKey, DeliveryReport, KeyProvider, KeyRelease, Log, Outbound, PreTransportReason, Recipient, RetryPolicy, Store, StoreSnapshot } from './ports.js'\nimport type { Envelope } from './delivery.js'\nimport type { HolderEvent } from './events.js'\nimport { CryptoUnavailableError, InfraError } from './results.js'\nimport type { ActError, ActResult, InfraErrorCode, ReceiveResult, ResumeResult } from './results.js'\nimport { randomEntropy } from './entropy.js'\nimport type { Entropy, PlatformRandom } from './entropy.js'\nimport { ED_PKCS8, X_PKCS8 } from './keys-seed.js'\nimport { freezeDeep } from './util-freeze.js'\nimport { ACK_TYPE } from './ack.js'\nimport { challengeAged } from './encounter.js'\nimport { ackOutbound, handlerPrepared, isTaskRefusal, markDelivered, prepareReceive } from './receive.js'\nimport { isTaskDiscarded } from './receive.js'\nimport type { Arrival, Channel, ReceivePlan, ReceivedDocument, TaskDiscarded, TaskRefusal } from './receive.js'\nimport type { CommitOp } from './invariants.js'\nexport type { Arrival, Channel, ReceivedDocument, TaskDiscarded, TaskFailure, TaskRefusal } from './receive.js'\n\n// ── types ──────────────────────────────────────────────────────────────\n\ntype DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never\n\n/** An event as a module emits it; the engine adds eventId, commitSeq, actId. */\nexport type EventDraft = DistributiveOmit<HolderEvent, 'eventId' | 'commitSeq' | 'actId'>\n/** A document as a module issues it; the engine sets attempt 1 and files\n * it in the outbox. `expiresAt`: the sender lifetime its type declares\n * (Delivery RLTP-DEL-7020), after which resume moves it to\n * failed(task-expired) and never hands it out again (6110, 6115). */\nexport type OutboundDraft = Omit<Outbound, 'attempt'> & { expiresAt?: Millis }\n\n/** What a WebCrypto handle must offer; resolved at construction. The\n * default entropy also needs getRandomValues and randomUUID from it. */\nexport type CryptoHandle = { subtle: SubtleCrypto } & Partial<PlatformRandom>\n\n/** What a preparation sees. The snapshot is deep-frozen; `release` is the\n * key release read from its `addresses` (note §3 KeyProvider). */\nexport interface PrepareCtx {\n readonly snapshot: Readonly<HolderState>\n readonly keys: KeyProvider\n readonly entropy: Entropy\n readonly access?: Access\n readonly log?: Log\n readonly crypto: CryptoHandle\n readonly when: Millis\n readonly release: KeyRelease\n}\n\n/** A preparation's value, bound to the store version and commitSeq of the\n * snapshot it ran against. The commit is CAS on exactly that version, so\n * a prepared value never lands on any other state. */\nexport interface Prepared<P = unknown> {\n readonly value: P\n readonly version: string | null\n readonly commitSeq: Dec\n}\n\n/** A holder-local identity rename (2100, 2140): stored acks whose\n * recipient.contactId is one of `from` (for an own rkid in `rkids`, or\n * any where null) now name `to`. */\nexport interface IdentityRename { from: string[], to: string, rkids: string[] | null }\n\n/** A transition's outcome: the next state (a new object; the input is\n * frozen) and what it issues. `renames`: identities the transition\n * rewrote; the engine follows them in the stored acks (only the core\n * writes the effect cache; the sealed envelopes stay untouched). */\nexport interface Applied {\n state: HolderState\n outbound?: OutboundDraft[]\n events?: EventDraft[]\n duties?: Duty[]\n renames?: IdentityRename[]\n}\n\n/** A refused act: nothing commits — except an Encounter aging latch\n * (`latch`, receive.ts TaskRefusal): then exactly that state and the\n * raised lastWhen commit, without a journal entry, outbound or event. */\nexport interface Refusal { ok: false, code: ActError, ref?: string, latch?: HolderState }\n\n/** The Encounter latch exception (receive.ts TaskRefusal): a latch state\n * differs from its base in encounter.challenges alone; every challenge it\n * keeps is byte-identical, and every one it removes is aged at `when`, the\n * commit's authoritative time (Encounter 5190, 5260). Anything else is a\n * programming error and throws. */\nfunction checkLatch (base: Readonly<HolderState>, latch: Readonly<HolderState>, when: Millis): void {\n for (const k of Object.keys(base) as Array<keyof HolderState>) {\n if (k === 'encounter') continue\n if (base[k] !== latch[k]) throw new Error(`engine: an aging latch changed ${k}`)\n }\n const e = base.encounter, l = latch.encounter\n for (const k of Object.keys(e) as Array<keyof HolderState['encounter']>) {\n if (k !== 'challenges' && e[k] !== l[k]) throw new Error(`engine: an aging latch changed encounter.${k}`)\n }\n for (const [v, c] of Object.entries(l.challenges)) {\n if (!Object.hasOwn(e.challenges, v)) throw new Error('engine: an aging latch added a challenge')\n if (jcs(c) !== jcs(e.challenges[v])) throw new Error(`engine: an aging latch changed the challenge ${v}`)\n }\n for (const [v, c] of Object.entries(e.challenges)) {\n if (!Object.hasOwn(l.challenges, v) && !challengeAged(c.tCh, when)) throw new Error(`engine: an aging latch removed the unaged challenge ${v}`)\n }\n}\n\n/** One command of a module. `human` acts need an actId and are journaled. */\nexport interface CommandDef<I = any, P = any> {\n human: boolean\n prepare?: (ctx: PrepareCtx, input: I) => Promise<P>\n /** synchronous and pure: must not mutate `state`, returns a new object */\n apply: (state: Readonly<HolderState>, prepared: Prepared<P>, input: I, when: Millis) => Applied | Refusal\n}\n\n/**\n * A received task type's handler, keyed by its full task URI with\n * version (note §4.3; receive.ts runs it). `decode` is the payload's\n * decoder and validator (stage 7: refuse 'malformed'; stage 8: any other\n * reason); `prepare` the async stage-8 work (MAC checks, key agreement),\n * which may also refuse; `apply` the synchronous stage-9 transition. The\n * core, never the handler, writes the effect-cache entry with its ack in\n * the same commit and releases the events after it; a handler whose\n * state touches `effects` is a programming error and throws.\n */\nexport interface TaskHandler<T = any, P = any> {\n /** the registry entry's proof declaration (Delivery 4.4): whether the\n * document itself carries a `proof` (its artifacts' own MACs and\n * signatures are the payload's business); checked at stage 6 */\n proof: 'absent' | 'required'\n decode: (payload: unknown) => T | TaskRefusal\n /** the acceptance binding of a document that may arrive on an own key no\n * tuple carries yet (receive.ts): the counterpart's key agreement and\n * contact, from the document itself, or a refusal; absent: the arrival\n * tuple's binding (Delivery 4.4) */\n channel?: (state: Readonly<HolderState>, doc: ReceivedDocument<T>, rkid: string) => Channel | TaskRefusal\n /** under the arrival tuple's binding: the document may arrive on a tuple\n * a chaining deactivated, because the handler binds it to the tuples an\n * act pinned and checks that pin itself (Trust 8270); absent: the arrival\n * tuple must be the active head of a live relationship (6190, 6240) */\n pinned?: true\n prepare?: (ctx: PrepareCtx, doc: ReceivedDocument<T>, arrival: Arrival) => Promise<P | TaskRefusal>\n /** a TaskDiscarded commits its `state` as the disposition `discarded`\n * (no effect-cache entry, no ack): a resource-limit discard (Trust 5365) */\n apply: (state: Readonly<HolderState>, prepared: Prepared<P>, doc: ReceivedDocument<T>, arrival: Arrival) => Applied | TaskRefusal | TaskDiscarded\n}\n\n/** What a duty's apply sees beside the state: its preparation. */\nexport interface DutyCtx<P = unknown> {\n readonly prepared: Prepared<P>\n /** the holder's retry backoff (RetryPolicy): the delay before attempt\n * n, for duties that re-schedule themselves (dueAt) */\n readonly backoff: (attempt: number) => number\n}\n\n/**\n * A duty kind's handler at one version (note §2.1 duties), run by\n * resume(when). A duty of the kind at another `v` stays untouched and is\n * announced as duty.unsupported. `awaitHolds` is the module's pure\n * condition for a duty that carries an `awaitHead` (6596); without it\n * such a duty never runs. `apply` returning Applied fulfils the duty\n * (the engine removes it in the same commit); 'not-due' and a refusal\n * leave it as it is.\n */\nexport interface DutyHandler<P = any> {\n v: number\n prepare?: (ctx: PrepareCtx, duty: Duty) => Promise<P>\n awaitHolds?: (state: Readonly<HolderState>, duty: Duty) => boolean\n apply: (state: Readonly<HolderState>, duty: Duty, ctx: DutyCtx<P>, when: Millis) => Applied | Refusal | 'not-due'\n}\n\n/**\n * A module's reconciliation sweep (Trust 5.4), run by resume(when) after\n * the duties, on the state they left. `prepare` runs against resume's\n * snapshot (before the duties); `apply` re-checks every prepared piece\n * against the state it gets and skips one whose inputs moved, reporting\n * `deferred` (resume then names `when` as nextDueAt). `pending` is the\n * pure answer to \"would the sweep issue now?\", as keys: an operation\n * other than resume whose commit adds a key names `when` as its\n * nextDueAt, the app's cue to call resume (engine.ts header).\n */\nexport interface SweepHandler<P = any> {\n pending: (state: Readonly<HolderState>, when: Millis) => string[]\n /** the top-level state parts `pending` reads; where given, an operation\n * that replaced none of them skips `pending` (its keys cannot change) */\n reads?: ReadonlyArray<keyof HolderState>\n prepare: (ctx: PrepareCtx) => Promise<P>\n apply: (state: Readonly<HolderState>, prepared: Prepared<P>, when: Millis) => Applied & { deferred?: boolean }\n}\n\n/**\n * What a verified delivery-ack does for the module whose task type the\n * acknowledged outbox item carries (receive.ts, the common ack path):\n * synchronous and pure, inside the ack's transaction, after the item is\n * marked delivered. Adapter reports never reach it: only a verified ack\n * completes (ports.ts DeliveryReport, 5660).\n */\nexport type AckHandler = (state: Readonly<HolderState>, ref: string, when: Millis) => Applied\n\n/**\n * What the module whose task type an outbox item carries does when that\n * item turns failed (a failed report, or the holder's give-up at the\n * horizon): synchronous and pure, inside that transaction, after the item\n * is marked failed. Its duties are folded into the state (an id already\n * open is kept as it is); it must not write the effect cache.\n */\nexport type FailureHandler = (state: Readonly<HolderState>, ref: string, when: Millis, ctx: { readonly backoff: (attempt: number) => number }) => Applied\n\n/**\n * What a human's choice on a prompt of one kind does in its domain\n * (prompts.ts): synchronous and pure like apply, run inside the decision's\n * own transition, so the domain effect and the closing commit together.\n * It sees the prompt still open; the prompts module removes it after. A\n * refusal refuses the decision.\n */\nexport type DecisionHandler = DecisionFn | DecisionDef\n\n/** The synchronous form: the domain effect needs no preparation. */\nexport type DecisionFn = (state: Readonly<HolderState>, prompt: Readonly<Prompt>, choice: PromptChoice, when: Millis) => Applied | Refusal\n\n/**\n * The prepared form, for a domain effect that signs or seals (the\n * counter-step, the membership accept, the introduction's consent):\n * `prepare` runs in the decision's preparation against its snapshot, the\n * prompt still open there; `apply` gets its value bound to that snapshot.\n */\nexport interface DecisionDef<P = any> {\n prepare?: (ctx: PrepareCtx, prompt: Readonly<Prompt>, choice: PromptChoice) => Promise<P>\n apply: (state: Readonly<HolderState>, prompt: Readonly<Prompt>, choice: PromptChoice, when: Millis, prepared: Prepared<P>) => Applied | Refusal\n}\n\n/** A domain module: what it registers with the engine. */\nexport interface HolderModule {\n name: string\n commands: Record<string, CommandDef>\n tasks?: Record<string, TaskHandler>\n duties?: Record<string, DutyHandler>\n /** reconciliation sweeps, run by resume after the duties, by name */\n sweeps?: Record<string, SweepHandler>\n /** ack handlers by the full task type URI of the acknowledged document;\n * at most one per type across all modules */\n acks?: Record<string, AckHandler>\n /** failure handlers by the full task type URI of the failed document;\n * at most one per type across all modules */\n failures?: Record<string, FailureHandler>\n /** task types whose documents the module re-issues itself (a fresh\n * document, never a reproduction): the outbox never re-emits their\n * items and gives them up only at the horizon. Trusted as registered:\n * the engine checks no ownership of the types named, since modules are\n * part of the library, not app plug-ins */\n ownRetries?: readonly string[]\n /** own rkids the module still needs although no live tuple carries\n * them: tick does not tombstone them. Trusted as registered, like\n * ownRetries: no check that the module has any claim to the keys */\n keepKeys?: (state: Readonly<HolderState>, when: Millis) => Iterable<string>\n /** the module's own retention, run by tick after the engine's: pure and\n * synchronous, returning the same state object where nothing goes */\n retain?: (state: Readonly<HolderState>, when: Millis) => HolderState\n /** the times at which the module's `retain` (run by tick) changes the\n * state: counted into nextDueAt (the timer contract, the header) */\n deadlines?: (state: Readonly<HolderState>) => Iterable<Millis>\n /** at most one handler per prompt kind across all modules; collected by\n * createHolder for the prompts module (prompts.ts) */\n decisions?: Partial<Record<PromptKind, DecisionHandler>>\n /** run in the stage-9 transaction of every document disposed `unique`\n * (through a task handler, after it; or a verified delivery-ack, after\n * its ack handler), on the state it left: pure and\n * synchronous, returning the same object where nothing changes; it must\n * not write the effect cache (the readiness of a tuple, Message Tasks\n * 5.1) */\n accepted?: (state: Readonly<HolderState>, doc: ReceivedDocument, arrival: Arrival) => HolderState\n}\n\n/** The ports of a holder (note §3); retry fields fall back to ENGINE_DEFAULTS. */\nexport interface EnginePorts {\n store: Store\n keys: KeyProvider\n entropy?: Entropy\n log?: Log\n access?: Access\n retry?: Partial<RetryPolicy>\n crypto?: CryptoHandle\n}\n\n/** Engine options beside the ports. `check` runs on every commit before\n * the store's CAS, on the state read and the state about to be written,\n * with the operation; a throw aborts the operation and nothing commits\n * (createHolder's `invariants: true`, invariants.ts). */\nexport interface EngineOptions {\n check?: (before: Readonly<HolderState>, after: Readonly<HolderState>, op: CommitOp) => void\n /** where no Access port is given: an Access over each preparation's own\n * snapshot (createHolder passes the membership module's localAccess) */\n accessFrom?: (state: Readonly<HolderState>) => Access\n}\n\n/** Announced after every commit of this engine, with its commitSeq. */\nexport type CommitListener = (commit: { commitSeq: Dec, events: HolderEvent[] }) => void\n\n/** A deep-frozen decoded state and its commitSeq. */\nexport interface EngineSnapshot { state: Readonly<HolderState>, commitSeq: Dec }\n\nexport interface Engine {\n /** the names registered at construction, frozen */\n readonly registry: Readonly<{ commands: readonly string[], tasks: readonly string[], duties: readonly string[], sweeps: readonly string[] }>\n act (command: string, input: unknown, when: Millis, opts?: { actId?: string }): Promise<ActResult>\n /** expiry and retention: effects, prompts, the act journal, terminal\n * outbox items, address keys to tombstones; raises lastWhen */\n tick (when: Millis): Promise<ActResult>\n /** re-emits due outbox items (attempt + 1) or gives them up, runs due\n * duties, re-emits unsent acks */\n resume (when: Millis): Promise<ResumeResult>\n /** an adapter's delivery report (Delivery §6.1); on an ack's digest it\n * marks the stored ack sent */\n report (report: DeliveryReport, when: Millis): Promise<ActResult>\n /** an arriving envelope: Delivery §6.2 stages 1–9 (receive.ts) */\n receive (env: unknown, when: Millis): Promise<ReceiveResult>\n subscribe (listener: CommitListener): () => void\n snapshot (): Promise<EngineSnapshot>\n /** what the holder keeps for transport at `when` (Delivery RLTP-DEL-6120):\n * refused until a resume of this engine has completed */\n pendingTransport (when: Millis): Promise<TransportView | TransportRefusal>\n /** whether `entry`, issued by this engine, may be handed over now: open,\n * still pending in the store, its envelope unchanged, before notAfter */\n mayHandOver (entry: TransportEntry, when: Millis): Promise<boolean>\n /** the hand-over itself: checks as mayHandOver, then calls `start` inside\n * the engine's queue, so no operation of this engine runs between the\n * check and the start of the deposit; `start` returns whether it started\n * one (a resend entry's grant is used up then). Resolves to the check's\n * verdict and `start`'s answer together; false when closed */\n handOver (entry: TransportEntry, when: Millis, start: () => boolean): Promise<boolean>\n /** ends this engine: later operations reject with InfraError('closed');\n * resolves once the operation running at the call has finished, after\n * which this engine commits nothing more */\n close (): Promise<void>\n readonly closed: boolean\n}\n\n// ── defaults ───────────────────────────────────────────────────────────\n\nconst DAY = 86_400_000\n\n/** Defaults of the retry policy and the retention it implies. */\nexport const ENGINE_DEFAULTS = Object.freeze({\n /** 30 s, doubling, at most 6 h */\n backoff: (attempt: number): number => Math.min(30_000 * 2 ** Math.max(0, attempt - 1), 6 * 3_600_000),\n /** P7D, inside Delivery's give-up range [P1D, P90D]; the only give-up */\n horizonMs: 7 * DAY,\n commitAttempts: 8,\n /** max(P90D, horizonMs) with the default horizon */\n retentionMs: 90 * DAY,\n})\n\n/** Delivery's give-up range for horizonMs: [P1D, P90D]. */\nconst HORIZON_MIN = DAY\nconst HORIZON_MAX = 90 * DAY\n\nconst BUILTIN = ['tick', 'resume', 'report', 'receive'] as const\n\n/** One document the holder keeps for transport (Delivery RLTP-DEL-6120):\n * issued by one engine's pendingTransport, deep-frozen; only that engine's\n * mayHandOver accepts it, and only while it stays pending. */\nexport interface TransportEntry {\n readonly digest: string\n /** an outbox document, or a stored acknowledgement */\n readonly kind: 'document' | 'ack'\n readonly envelope: Envelope\n readonly type: string\n readonly threadId: string\n readonly recipient: Recipient\n /** emissions on the holder's retry schedule so far */\n readonly attempt: number\n /** the first submission as the holder recorded it (an ack: its effect's\n * commit): an adapter's own horizon counts from here, never from when\n * it took the entry over (Delivery RLTP-DEL-6130) */\n readonly since: Millis\n /** the send deadline: from then on it is given up (or, an ack, no longer\n * offered) and never handed over again */\n readonly notAfter: Millis\n /** when the holder's retry schedule next re-offers it (absent: due, or held) */\n readonly nextAttemptAt?: Millis\n /** the adapter's last report on it was awaiting-transport */\n readonly held?: PreTransportReason\n /** a duplicate's answer due (Delivery RLTP-DEL-6330, 6335), beside the\n * ack's retries: its number (StoredAck.answers), its deadline the\n * effect's retention; its begun hand-over ends it */\n readonly resend?: number\n}\n\n/** pendingTransport's answer: the set at `at` — the `when` asked for, or\n * the holder's lastWhen if that is later — and the commit it was read at. */\nexport interface TransportView {\n readonly ok: true\n readonly commitSeq: Dec\n readonly at: Millis\n readonly entries: readonly TransportEntry[]\n}\n\n/** pendingTransport refuses until a resume of this engine has completed:\n * the transitions due at the opening come first (RLTP-DEL-6130, 6135). */\nexport interface TransportRefusal { readonly ok: false, readonly code: 'not-resumed' }\nconst TASK_URI = /^[a-z][a-z0-9+.-]*:\\S+\\/[0-9]+\\.[0-9]+$/\n\n// ── helpers ────────────────────────────────────────────────────────────\n\nconst ALGORITHMS = ['Ed25519', 'X25519', 'HKDF', 'HMAC', 'AES-GCM', 'SHA-256'] as const\n\nconst concat = (a: Uint8Array, b: Uint8Array): Uint8Array => { const o = new Uint8Array(a.length + b.length); o.set(a); o.set(b, a.length); return o }\n\n/** Resolves the WebCrypto handle and probes every algorithm the library uses. */\nasync function resolveCrypto (c?: CryptoHandle): Promise<CryptoHandle> {\n const h = c ?? (globalThis.crypto as CryptoHandle | undefined)\n const S = h?.subtle\n if (!S || typeof S.importKey !== 'function' || typeof S.digest !== 'function') throw new CryptoUnavailableError(['subtle', ...ALGORITHMS])\n const k = new Uint8Array(32).fill(1)\n const probes: Record<typeof ALGORITHMS[number], () => Promise<unknown>> = {\n Ed25519: () => S.importKey('pkcs8', concat(ED_PKCS8, k), { name: 'Ed25519' }, false, ['sign']),\n X25519: () => S.importKey('pkcs8', concat(X_PKCS8, k), { name: 'X25519' }, false, ['deriveBits']),\n HKDF: () => S.importKey('raw', k, 'HKDF', false, ['deriveBits']),\n HMAC: () => S.importKey('raw', k, { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']),\n 'AES-GCM': () => S.importKey('raw', k, { name: 'AES-GCM' }, false, ['encrypt']),\n 'SHA-256': () => S.digest('SHA-256', k),\n }\n const ok = await Promise.all(ALGORITHMS.map(async (a) => { try { await probes[a](); return true } catch { return false } }))\n const missing = ALGORITHMS.filter((_, i) => !ok[i])\n if (missing.length) throw new CryptoUnavailableError(missing)\n return h as CryptoHandle\n}\n\nconst te = new TextEncoder()\n/** The stack's document digest (u + multihash sha2-256 over JCS), on the resolved handle. */\nconst digestOf = async (S: SubtleCrypto, x: unknown): Promise<string> =>\n 'u' + b64uOf(concat(Uint8Array.from([0x12, 0x20]), new Uint8Array(await S.digest('SHA-256', te.encode(jcs(x))))))\n\n/** Drops undefined object members (as JSON does) without hiding what jcs refuses. */\nconst dropUndefined = (x: unknown): unknown => {\n if (x === null || typeof x !== 'object') return x\n if (Object.getOwnPropertySymbols(x).length > 0) return x\n if (Array.isArray(x)) {\n if (Object.getOwnPropertyNames(x).length !== x.length + 1) return x\n for (let i = 0; i < x.length; i++) if (!(i in x)) return x\n return x.map(dropUndefined)\n }\n const proto = Object.getPrototypeOf(x)\n if (proto !== null && proto !== Object.prototype) return x\n if (Object.getOwnPropertyNames(x).length !== Object.keys(x).length) return x\n // own data properties, never assignment: a \"__proto__\" key stays a key\n // (assignment would hit the inherited setter and change the prototype)\n const out: Record<string, unknown> = {}\n for (const [k, v] of Object.entries(x)) {\n if (v !== undefined) Object.defineProperty(out, k, { value: dropUndefined(v), enumerable: true, writable: true, configurable: true })\n }\n return out\n}\n\n/** The act input as bound at the call: canonical JSON, deep-frozen. A\n * \"__proto__\" member is an ordinary key throughout: jcs serializes own\n * keys (Object.keys) and JSON.parse defines own data properties, so it is\n * hashed, journaled and handed to prepare/apply like any other key. */\nconst bindInput = <T>(x: T): T => freezeDeep(JSON.parse(jcs(x === undefined ? null : dropUndefined(x))) as T)\n\n/** when + ceil(delay), clamped to safe integer milliseconds. */\nconst dueAt = (when: Millis, delay: number): Millis => {\n const d = Number.isNaN(delay) ? 0 : Math.max(0, Math.ceil(delay))\n return Math.min(when + d, Number.MAX_SAFE_INTEGER)\n}\n\n/** A port whose rejections become InfraError(code); InfraError passes as is. */\nfunction guard<T extends object> (port: T, names: ReadonlyArray<keyof T & string>, code: InfraErrorCode, wrapResult?: (r: any) => unknown): T {\n const out: Record<string, unknown> = {}\n for (const n of names) {\n out[n] = async (...args: unknown[]) => {\n let r: unknown\n try { r = await (port[n] as (...a: unknown[]) => Promise<unknown>).apply(port, args) } catch (e) {\n throw e instanceof InfraError ? e : new InfraError(code, `${code}: ${n} failed`, { cause: e })\n }\n return wrapResult ? wrapResult(r) : r\n }\n }\n return Object.freeze(out) as T\n}\n\nconst inc = (d: Dec): Dec => (BigInt(d) + 1n).toString()\n\nconst releaseOf = (state: Readonly<HolderState>): KeyRelease => (rkid) => {\n if (state.addresses.tombstones.includes(rkid)) return { status: 'retired' }\n if (!Object.hasOwn(state.addresses.keys, rkid)) return { status: 'unknown' }\n const k = state.addresses.keys[rkid]\n return k.retiredAt !== undefined ? { status: 'retired' } : { status: 'live', label: k.label }\n}\n\nconst isRefusal = (r: unknown): r is Refusal => (r as Refusal)?.ok === false\n\n/** The effect cache with the stored acks' recipients renamed. */\nfunction renameAcks (effects: HolderState['effects'], renames: readonly IdentityRename[]): HolderState['effects'] {\n let out: HolderState['effects'] | null = null\n for (const [d, e] of Object.entries(effects)) {\n let a = e.ack\n if (!a) continue\n for (const r of renames) {\n if (r.from.includes(a.recipient.contactId) && (r.rkids === null || r.rkids.includes(a.recipient.via ?? a.recipient.rkid))) a = { ...a, recipient: { ...a.recipient, contactId: r.to } }\n }\n if (a !== e.ack) (out ??= { ...effects })[d] = { ...e, ack: a }\n }\n return out ?? effects\n}\n\nconst closedError = (): InfraError => new InfraError('closed', 'the holder was closed')\n\nconst checkWhen = (when: unknown): void => {\n if (!Number.isSafeInteger(when) || (when as number) < 0) throw new TypeError(`when must be non-negative integer milliseconds, got ${String(when)}`)\n}\n\n// ── internal command form: built-ins may also re-emit and schedule ─────\n\ninterface InternalApplied extends Applied {\n /** outbox items re-emitted (already in state, attempt set) */\n emit?: Outbound[]\n /** outbound handed out without an outbox item: acks (receive.ts). It\n * forces no commit; with nothing else to commit it is released as is */\n release?: Outbound[]\n nextDueAt?: Millis\n /** passed through to the caller of #run */\n detail?: unknown\n}\n/** A built-in's end without a commit, lastWhen included, carrying its answer. */\ninterface Halt { halt: true, detail: unknown }\ninterface InternalDef {\n human: boolean\n prepare?: (ctx: PrepareCtx, input: any) => Promise<unknown>\n apply: (state: Readonly<HolderState>, prepared: Prepared<any>, input: any, when: Millis) => InternalApplied | Refusal | Halt\n}\n\n/** Outbound order of one commit: re-emissions, then released acks, then new documents. */\ntype RunResult = { ok: true, outbound: Outbound[], events: HolderEvent[], nextDueAt?: Millis, detail?: unknown } | Refusal | Halt\n\n/** A duty's dueAt; absent counts as 0 (due always). */\nconst dutyDue = (d: Duty): number => (Number.isSafeInteger(d.dueAt) ? d.dueAt as number : 0)\n\n/** Due, and not waiting on a head its handler's awaitHolds denies (none: waits forever). */\nconst dutyRunnable = (d: Duty, h: DutyHandler, state: Readonly<HolderState>, when: Millis): boolean => {\n if (dutyDue(d) > when) return false\n const awaits = (d as { awaitHead?: unknown }).awaitHead\n return typeof awaits !== 'string' || (h.awaitHolds?.(state, d) ?? false)\n}\n\nconst isHalt = (r: unknown): r is Halt => (r as Halt)?.halt === true\n\nconst actResult = (r: RunResult): ActResult => {\n if (isHalt(r)) throw new Error('engine: an act does not halt')\n return r.ok ? { ok: true, outbound: r.outbound, events: r.events, ...(r.nextDueAt !== undefined ? { nextDueAt: r.nextDueAt } : {}) } : r\n}\n\ninterface Policy { backoff: (attempt: number) => number, horizonMs: number, commitAttempts: number, retentionMs: number }\n\n// ── the engine ─────────────────────────────────────────────────────────\n\nclass HolderEngine implements Engine {\n readonly registry: Engine['registry']\n readonly #store: Store\n readonly #ports: EnginePorts\n /** the ports a preparation sees, rejections typed (InfraError) */\n readonly #keys: KeyProvider\n readonly #log?: Log\n readonly #access?: Access\n readonly #crypto: CryptoHandle\n readonly #entropy: Entropy\n readonly #policy: Policy\n readonly #commands: ReadonlyMap<string, InternalDef>\n readonly #tasks: ReadonlyMap<string, TaskHandler>\n readonly #duties: ReadonlyMap<string, DutyHandler>\n readonly #sweeps: ReadonlyMap<string, SweepHandler>\n readonly #acks: ReadonlyMap<string, AckHandler>\n readonly #failures: ReadonlyMap<string, FailureHandler>\n readonly #ownRetries: ReadonlySet<string>\n readonly #keepKeys: ReadonlyArray<(state: Readonly<HolderState>, when: Millis) => Iterable<string>>\n readonly #retain: ReadonlyArray<(state: Readonly<HolderState>, when: Millis) => HolderState>\n readonly #accepted: ReadonlyArray<NonNullable<HolderModule['accepted']>>\n readonly #deadlines: ReadonlyArray<(state: Readonly<HolderState>) => Iterable<Millis>>\n readonly #builtins: Readonly<Record<typeof BUILTIN[number], InternalDef>>\n readonly #check?: EngineOptions['check']\n readonly #accessFrom?: EngineOptions['accessFrom']\n readonly #listeners = new Set<CommitListener>()\n #chain: Promise<unknown> = Promise.resolve()\n /** a commit whose outcome is unknown, settled before the next operation */\n #unsettled: { text: string, actId?: string, commitSeq: Dec, events: HolderEvent[] } | null = null\n /** close() was called: nothing more runs, nothing issued authorizes */\n #closed = false\n /** a resume of this engine completed (and none threw since) */\n #resumed = false\n /** the transport entries this engine issued (RLTP-DEL-6130) */\n readonly #issued = new WeakSet<object>()\n\n constructor (ports: EnginePorts, crypto: CryptoHandle, modules: readonly HolderModule[], opts: EngineOptions = {}) {\n if (opts.check !== undefined && typeof opts.check !== 'function') throw new TypeError('check must be a function')\n this.#check = opts.check\n if (opts.accessFrom !== undefined && typeof opts.accessFrom !== 'function') throw new TypeError('accessFrom must be a function')\n this.#accessFrom = opts.accessFrom\n this.#store = ports.store\n this.#ports = ports\n this.#crypto = crypto\n this.#entropy = ports.entropy ?? randomEntropy(crypto)\n const r = ports.retry ?? {}\n const horizonMs = r.horizonMs ?? ENGINE_DEFAULTS.horizonMs\n const backoff = r.backoff ?? ENGINE_DEFAULTS.backoff\n const commitAttempts = r.commitAttempts ?? ENGINE_DEFAULTS.commitAttempts\n if (!Number.isSafeInteger(horizonMs) || horizonMs < HORIZON_MIN || horizonMs > HORIZON_MAX) throw new RangeError(`retry.horizonMs must be integer ms within [P1D, P90D], got ${horizonMs}`)\n if (typeof backoff !== 'function') throw new RangeError('retry.backoff must be a function')\n for (let n = 1; n <= 3; n++) {\n const d = backoff(n)\n if (typeof d !== 'number' || !Number.isFinite(d) || d < 0) throw new RangeError(`retry.backoff(${n}) must be a finite non-negative number, got ${d}`)\n }\n if (!Number.isSafeInteger(commitAttempts) || commitAttempts < 1) throw new RangeError('retry.commitAttempts must be a positive integer')\n this.#policy = Object.freeze({ backoff, horizonMs, commitAttempts, retentionMs: Math.max(ENGINE_DEFAULTS.retentionMs, horizonMs) })\n const carrierKey = (k: CarrierKey): CarrierKey => Object.freeze({ principal: k.principal, sign: guard(k, ['sign'], 'key-provider').sign })\n const base = guard(ports.keys, ['anchorOf', 'sign', 'agree'], 'key-provider')\n this.#keys = Object.freeze({\n anchorOf: base.anchorOf, sign: base.sign, agree: base.agree,\n carrierPrincipal: guard(ports.keys, ['carrierPrincipal'], 'key-provider', carrierKey).carrierPrincipal,\n })\n if (ports.log) this.#log = guard(ports.log, ['head', 'at', 'append'], 'log')\n if (ports.access) this.#access = guard(ports.access, ['memberships', 'membership'], 'access')\n\n const commands = new Map<string, InternalDef>()\n const tasks = new Map<string, TaskHandler>()\n const duties = new Map<string, DutyHandler>()\n const sweeps = new Map<string, SweepHandler>()\n const acks = new Map<string, AckHandler>()\n const failures = new Map<string, FailureHandler>()\n const ownRetries = new Set<string>()\n const keepKeys: Array<(state: Readonly<HolderState>, when: Millis) => Iterable<string>> = []\n const retain: Array<(state: Readonly<HolderState>, when: Millis) => HolderState> = []\n const accepted: Array<NonNullable<HolderModule['accepted']>> = []\n const deadlines: Array<(state: Readonly<HolderState>) => Iterable<Millis>> = []\n const names = new Set<string>()\n for (const m of modules) {\n if (!m || typeof m.name !== 'string' || !m.name) throw new TypeError('a module needs a name')\n if (names.has(m.name)) throw new Error(`duplicate module ${m.name}`)\n names.add(m.name)\n for (const [name, def] of Object.entries(m.commands ?? {})) {\n if (commands.has(name) || (BUILTIN as readonly string[]).includes(name)) throw new Error(`duplicate command ${name} (module ${m.name})`)\n if (typeof def?.apply !== 'function' || typeof def.human !== 'boolean') throw new TypeError(`command ${name} (module ${m.name}) needs human and apply`)\n commands.set(name, Object.freeze({ ...def }))\n }\n for (const [uri, h] of Object.entries(m.tasks ?? {})) {\n if (!TASK_URI.test(uri)) throw new Error(`not a full task URI with version: ${uri} (module ${m.name})`)\n if (uri === ACK_TYPE) throw new Error(`${uri} is built in: acks take the common path (module ${m.name})`)\n if (tasks.has(uri)) throw new Error(`duplicate task ${uri} (module ${m.name})`)\n if (typeof h?.apply !== 'function' || typeof h.decode !== 'function') throw new TypeError(`task ${uri} (module ${m.name}) needs decode and apply`)\n if (h.proof !== 'absent' && h.proof !== 'required') throw new TypeError(`task ${uri} (module ${m.name}) needs its proof declaration: 'absent' or 'required'`)\n if (h.channel !== undefined && typeof h.channel !== 'function') throw new TypeError(`task ${uri} (module ${m.name}): channel must be a function`)\n if (h.pinned !== undefined && (h.pinned !== true || h.channel !== undefined)) throw new TypeError(`task ${uri} (module ${m.name}): pinned is true or absent, and only under the tuple binding`)\n tasks.set(uri, Object.freeze({ ...h }))\n }\n for (const [kind, h] of Object.entries(m.duties ?? {})) {\n if (duties.has(kind)) throw new Error(`duplicate duty ${kind} (module ${m.name})`)\n if (typeof h?.apply !== 'function') throw new TypeError(`duty ${kind} (module ${m.name}) needs apply`)\n if (!Number.isSafeInteger(h.v) || h.v < 1) throw new TypeError(`duty ${kind} (module ${m.name}) needs its version v, a positive integer`)\n if (h.awaitHolds !== undefined && typeof h.awaitHolds !== 'function') throw new TypeError(`duty ${kind} (module ${m.name}): awaitHolds must be a function`)\n duties.set(kind, Object.freeze({ ...h }))\n }\n for (const [name, h] of Object.entries(m.sweeps ?? {})) {\n if (sweeps.has(name)) throw new Error(`duplicate sweep ${name} (module ${m.name})`)\n if (typeof h?.apply !== 'function' || typeof h.prepare !== 'function' || typeof h.pending !== 'function') throw new TypeError(`sweep ${name} (module ${m.name}) needs pending, prepare and apply`)\n sweeps.set(name, Object.freeze({ ...h }))\n }\n for (const [uri, h] of Object.entries(m.acks ?? {})) {\n if (!TASK_URI.test(uri)) throw new Error(`not a full task URI with version: ${uri} (module ${m.name})`)\n if (acks.has(uri)) throw new Error(`duplicate ack handler ${uri} (module ${m.name})`)\n if (typeof h !== 'function') throw new TypeError(`ack handler ${uri} (module ${m.name}) must be a function`)\n acks.set(uri, h)\n }\n for (const [uri, h] of Object.entries(m.failures ?? {})) {\n if (!TASK_URI.test(uri)) throw new Error(`not a full task URI with version: ${uri} (module ${m.name})`)\n if (failures.has(uri)) throw new Error(`duplicate failure handler ${uri} (module ${m.name})`)\n if (typeof h !== 'function') throw new TypeError(`failure handler ${uri} (module ${m.name}) must be a function`)\n failures.set(uri, h)\n }\n for (const uri of m.ownRetries ?? []) {\n if (!TASK_URI.test(uri)) throw new Error(`not a full task URI with version: ${uri} (module ${m.name})`)\n ownRetries.add(uri)\n }\n if (m.keepKeys !== undefined) {\n if (typeof m.keepKeys !== 'function') throw new TypeError(`keepKeys (module ${m.name}) must be a function`)\n keepKeys.push(m.keepKeys)\n }\n if (m.retain !== undefined) {\n if (typeof m.retain !== 'function') throw new TypeError(`retain (module ${m.name}) must be a function`)\n retain.push(m.retain)\n }\n if (m.deadlines !== undefined) {\n if (typeof m.deadlines !== 'function') throw new TypeError(`deadlines (module ${m.name}) must be a function`)\n deadlines.push(m.deadlines)\n }\n if (m.accepted !== undefined) {\n if (typeof m.accepted !== 'function') throw new TypeError(`accepted (module ${m.name}) must be a function`)\n accepted.push(m.accepted)\n }\n }\n this.#commands = commands\n this.#tasks = tasks\n this.#duties = duties\n this.#sweeps = sweeps\n this.#acks = acks\n this.#failures = failures\n this.#ownRetries = ownRetries\n this.#keepKeys = Object.freeze(keepKeys)\n this.#deadlines = Object.freeze(deadlines)\n this.#retain = Object.freeze(retain)\n this.#accepted = Object.freeze(accepted)\n this.#builtins = Object.freeze({ tick: this.#tickDef(), resume: this.#resumeDef(), report: this.#reportDef(), receive: this.#receiveDef() })\n this.registry = Object.freeze({\n commands: Object.freeze([...commands.keys()]),\n tasks: Object.freeze([...tasks.keys()]),\n duties: Object.freeze([...duties.keys()]),\n sweeps: Object.freeze([...sweeps.keys()]),\n })\n }\n\n // ── loading ──────────────────────────────────────────────────────────\n\n async #readRaw (): Promise<StoreSnapshot> {\n try { return await this.#store.read() } catch (e) { throw new InfraError('store-read', undefined, { cause: e }) }\n }\n\n async #read (): Promise<{ state: Readonly<HolderState>, version: string | null }> {\n const snap = await this.#readRaw()\n if (snap.state === null) throw new Error('engine: the store holds no state')\n return { state: freezeDeep(decodeState(snap.state)), version: snap.version }\n }\n\n /** Initialise an empty store with the empty state, or check the stored one decodes. */\n async load (): Promise<void> {\n const snap = await this.#readRaw()\n if (snap.state !== null) { decodeState(snap.state); return }\n let cause: unknown\n try { if ((await this.#store.commit(null, toOpaque(emptyState(CODEC)))).ok) return } catch (e) { cause = e }\n const again = await this.#readRaw() // conflict or unknown outcome: someone (maybe we) wrote\n if (again.state === null) throw new InfraError('store-commit', 'could not initialise the store', { cause })\n decodeState(again.state)\n }\n\n // ── the queue ────────────────────────────────────────────────────────\n\n #enqueue<T> (fn: () => Promise<T>): Promise<T> {\n if (this.#closed) return Promise.reject(closedError())\n const p = this.#chain.then(async () => {\n if (this.#closed) throw closedError()\n await this.#settle()\n return fn()\n })\n this.#chain = p.then(() => undefined, () => undefined)\n return p\n }\n\n async #settle (): Promise<void> {\n const u = this.#unsettled\n if (!u) return\n const { state } = await this.#read()\n const landed = jcs(state) === u.text ||\n (u.actId !== undefined && Object.hasOwn(state.acts, u.actId) && state.acts[u.actId].commitSeq === u.commitSeq)\n this.#unsettled = null\n if (landed) this.#announce(u.commitSeq, u.events)\n }\n\n #announce (commitSeq: Dec, events: HolderEvent[]): void {\n for (const l of [...this.#listeners]) {\n // a listener's failure (throw or rejection) neither undoes nor blocks the commit\n try {\n const r: unknown = l({ commitSeq, events })\n if (r !== null && typeof r === 'object' && typeof (r as Promise<unknown>).then === 'function') (r as Promise<unknown>).then(undefined, () => undefined)\n } catch { /* dropped */ }\n }\n }\n\n // ── the four steps ───────────────────────────────────────────────────\n\n /** `input` is already bound (bindInput); `inputHash` its journal hash for human acts. */\n async #run (def: InternalDef, op: CommitOp, input: unknown, when: Millis, actId?: string, inputHash?: string): Promise<RunResult> {\n /** a replay's give-up work (below): its timer, carried to the replay's answer */\n let replayWake: Millis | undefined\n /** give-ups a replay ran: each moves at least one of its finitely many\n * journaled documents to failed, so they are bounded by that number */\n let gaveUp = 0\n for (let attempt = 1; attempt <= this.#policy.commitAttempts; attempt++) {\n // 1 — snapshot, when\n const { state, version } = await this.#read()\n const at = Math.max(when, state.lastWhen)\n if (def.human && Object.hasOwn(state.acts, actId!)) {\n const rec = state.acts[actId!]\n if (rec.inputHash !== inputHash) return { ok: false, code: 'actid-conflict' }\n const events: HolderEvent[] = structuredClone(rec.events) as HolderEvent[]\n // the act's documents are handed out again only while live; one past\n // its sender lifetime or the horizon is given up first, in an\n // operation of its own on the engine's one commit path (as resume's\n // give-up: Delivery 6110, 6115), and is never handed out — the\n // journal's events are not announced again\n const live: string[] = []\n const expired: string[] = []\n for (const d of rec.outboundDigests) {\n const it = this.#itemOf(state, d)\n const t = triasOf(it)\n if (t === 'delivered' || t === 'failed') continue\n if (this.#giveUp(it, at)) expired.push(d); else live.push(d)\n }\n if (expired.length) {\n const g = await this.#run(this.#giveUpDef(), { kind: 'resume' }, expired, at)\n if (!isHalt(g) && g.ok && g.nextDueAt !== undefined) replayWake = replayWake === undefined ? g.nextDueAt : Math.min(replayWake, g.nextDueAt)\n // re-read: the act's documents as the give-up left them, outside\n // the CAS budget (no conflict happened); bounded by the act's documents\n if (gaveUp++ <= rec.outboundDigests.length) attempt--\n continue\n }\n return { ok: true, outbound: live.map((d) => this.#outboundOf(state, d)), events: freezeDeep(events), ...(replayWake !== undefined ? { nextDueAt: replayWake } : {}) }\n }\n // 2 — prepare, bound to this snapshot\n const ctx: PrepareCtx = Object.freeze({\n snapshot: state, keys: this.#keys, entropy: this.#entropy, access: this.#access ?? this.#accessFrom?.(state), log: this.#log,\n crypto: this.#crypto, when: at, release: releaseOf(state),\n })\n const value = def.prepare ? await def.prepare(ctx, input) : undefined\n const prepared: Prepared = Object.freeze({ value, version, commitSeq: state.commitSeq })\n // 3 — apply, assemble, CAS\n const r = def.apply(state, prepared, input, at)\n if (isHalt(r)) return r\n if (isRefusal(r)) {\n const refusal: Refusal = { ok: false, code: r.code, ...(r.ref !== undefined ? { ref: r.ref } : {}) }\n if (!r.latch) return refusal\n // the Encounter latch exception: the latch and lastWhen commit, nothing else\n checkLatch(state, r.latch, at)\n const seq = inc(state.commitSeq)\n const next: HolderState = { ...r.latch, commitSeq: seq, lastWhen: at }\n const text = encodeState(next)\n if (this.#check) this.#check(state, next, op.kind === 'act' ? { ...op, events: [] } : op)\n let res\n try { res = await this.#store.commit(version, toOpaque(next)) } catch (e) {\n this.#unsettled = { text, commitSeq: seq, events: [] }\n throw new InfraError('unknown-commit-outcome', undefined, { cause: e })\n }\n if (!res.ok) continue\n this.#announce(seq, [])\n return refusal\n }\n const drafts = r.outbound ?? []\n const eventDrafts = r.events ?? []\n const newDuties = r.duties ?? []\n const emit = r.emit ?? []\n const release = r.release ?? []\n // resume computes its own timer; every other operation names the duty\n // work it opened or unblocked, the app's cue to call resume\n const wake = r.nextDueAt ?? (def === this.#builtins.resume ? undefined : this.#wake(state, r.state, newDuties, at))\n const extra = { ...(wake !== undefined ? { nextDueAt: wake } : {}), ...(r.detail !== undefined ? { detail: r.detail } : {}) }\n if (!def.human && r.state === state && !r.renames?.length && at === state.lastWhen && !drafts.length && !eventDrafts.length && !newDuties.length && !emit.length) {\n return { ok: true, outbound: [...release], events: [], ...extra }\n }\n const seq = inc(state.commitSeq)\n const events: HolderEvent[] = eventDrafts.map((e, i) => ({ ...e, eventId: `${seq}.${i}`, commitSeq: seq, ...(def.human ? { actId } : {}) }) as HolderEvent)\n freezeDeep(events)\n const outbound: Outbound[] = drafts.map((o) => ({ digest: o.digest, envelope: o.envelope, type: o.type, threadId: o.threadId, recipient: o.recipient, attempt: 1 }))\n const outbox: Record<string, OutboxItem> = { ...r.state.outbox }\n for (const [i, o] of outbound.entries()) {\n if (Object.hasOwn(outbox, o.digest)) throw new Error(`engine: outbound ${o.digest} is already in the outbox`)\n const life = drafts[i].expiresAt\n if (life !== undefined && (!Number.isSafeInteger(life) || life <= at)) throw new Error(`engine: outbound ${o.digest} expires at ${life}, not after ${at}`)\n outbox[o.digest] = {\n type: o.type, threadId: o.threadId, recipient: o.recipient, envelope: o.envelope, attempt: 1,\n history: [{ status: 'submitted', at, attempt: 1 }], nextAttemptAt: dueAt(at, this.#policy.backoff(1)),\n ...(life !== undefined ? { expiresAt: life } : {}),\n }\n }\n const duties: Record<string, Duty> = { ...r.state.duties }\n for (const d of newDuties) {\n if (Object.hasOwn(duties, d.id)) throw new Error(`engine: duty ${d.id} already exists`)\n duties[d.id] = d\n }\n const acts = def.human\n ? { ...r.state.acts, [actId!]: { actId: actId!, inputHash: inputHash!, commitSeq: seq, outboundDigests: outbound.map((o) => o.digest), events, at } }\n : r.state.acts\n const effects = r.renames?.length ? renameAcks(r.state.effects, r.renames) : r.state.effects\n const next: HolderState = { ...r.state, effects, commitSeq: seq, lastWhen: at, outbox, duties, acts }\n const text = encodeState(next) // validates; an invalid next state is a programming error\n if (this.#check) {\n const d = (r.detail ?? {}) as { disposition?: string, digest?: string, type?: string, ref?: string, rkid?: string, fulfilled?: string[] }\n const pick = <K extends keyof typeof d>(k: K) => (d[k] !== undefined ? { [k]: d[k] } : {})\n this.#check(state, next,\n op.kind === 'receive' ? { kind: 'receive', ...pick('disposition'), ...pick('digest'), ...pick('type'), ...pick('ref'), ...pick('rkid') }\n : op.kind === 'resume' ? { kind: 'resume', fulfilled: d.fulfilled ?? [] }\n : op.kind === 'act' ? { ...op, events } : op)\n }\n let res\n try { res = await this.#store.commit(version, toOpaque(next)) } catch (e) {\n this.#unsettled = { text, commitSeq: seq, events, ...(def.human ? { actId } : {}) }\n throw new InfraError('unknown-commit-outcome', undefined, { cause: e })\n }\n if (!res.ok) continue\n // 4 — release\n this.#announce(seq, events)\n return { ok: true, outbound: [...emit, ...release, ...outbound], events, ...extra }\n }\n throw new InfraError('commit-conflict', `no commit after ${this.#policy.commitAttempts} attempts`)\n }\n\n /** The work an operation opened or unblocked: its duty work (#dutyWake),\n * or `when` where a sweep's pending keys gained one. */\n /** Every time at which tick's expiry and retention change `state`: the\n * engine's own and the modules' `deadlines` (the timer contract). */\n #expiries (state: Readonly<HolderState>): Millis[] {\n const retention = this.#policy.retentionMs\n const out: Millis[] = []\n for (const p of Object.values(state.prompts)) if (p.expiresAt !== undefined) out.push(p.expiresAt)\n for (const e of Object.values(state.effects)) out.push(e.expiresAt)\n for (const a of Object.values(state.acts)) out.push(a.at + retention)\n for (const it of Object.values(state.outbox)) {\n const t = triasOf(it)\n if ((t === 'delivered' || t === 'failed') && it.history.length) out.push(it.history[it.history.length - 1].at + retention)\n }\n for (const k of Object.values(state.addresses.keys)) out.push(k.lastShown + retention)\n for (const f of this.#deadlines) for (const t of f(state)) out.push(t)\n return out.filter((t) => Number.isSafeInteger(t))\n }\n\n /** The earliest expiry deadline after `when`, among those `only` admits. */\n #nextExpiry (state: Readonly<HolderState>, when: Millis, only: (t: Millis) => boolean = () => true): Millis | undefined {\n let next: Millis | undefined\n for (const t of this.#expiries(state)) if (t > when && only(t) && (next === undefined || t < next)) next = t\n return next\n }\n\n #wake (before: Readonly<HolderState>, after: Readonly<HolderState>, added: readonly Duty[], when: Millis): Millis | undefined {\n const d0 = this.#dutyWake(before, after, added, when)\n // a deadline the commit introduced (a prompt opened, an act started, …)\n const had = before === after ? null : new Set(this.#expiries(before))\n const x = had === null ? undefined : this.#nextExpiry(after, when, (t) => !had.has(t))\n const d = d0 === undefined ? x : x === undefined ? d0 : Math.min(d0, x)\n if (d === when || before === after) return d\n for (const sw of this.#sweeps.values()) {\n // a sweep whose declared inputs are untouched (by reference) cannot have new pending keys\n if (sw.reads && sw.reads.every((k) => before[k] === after[k])) continue\n const had = new Set(sw.pending(before, when))\n if (sw.pending(after, when).some((k) => !had.has(k))) return when\n }\n return d\n }\n\n /** The duty work an operation opened or unblocked: over the duties that\n * are new, changed, or runnable now but not before, `when` where one\n * is runnable now, else the earliest future dueAt; undefined where none. */\n #dutyWake (before: Readonly<HolderState>, after: Readonly<HolderState>, added: readonly Duty[], when: Millis): Millis | undefined {\n let wake: Millis | undefined\n for (const d of [...Object.values(after.duties), ...added]) {\n const h = this.#duties.get(d.kind)\n if (!h || d.v !== h.v) continue\n const prev = Object.hasOwn(before.duties, d.id) ? before.duties[d.id] : undefined\n const runnable = dutyRunnable(d, h, after, when)\n if (prev !== undefined && jcs(prev) === jcs(d) && (!runnable || dutyRunnable(prev, h, before, when))) continue\n const t = runnable ? when : dutyDue(d) > when ? dutyDue(d) : undefined\n if (t !== undefined) wake = wake === undefined ? t : Math.min(wake, t)\n }\n return wake\n }\n\n /** The failure handlers of the items `digests` (each just turned\n * failed), in order, on `state`; their duties folded into the state. */\n #failed (state: HolderState, digests: readonly string[], when: Millis): { state: HolderState, events: EventDraft[] } {\n let cur = state\n const events: EventDraft[] = []\n for (const digest of digests) {\n const h = this.#failures.get(cur.outbox[digest].type)\n if (!h) continue\n const r = h(cur, digest, when, { backoff: this.#policy.backoff })\n if (r.state.effects !== cur.effects) throw new Error(`engine: the failure handler of ${cur.outbox[digest].type} wrote the effect cache`)\n if (r.outbound?.length) throw new Error(`engine: the failure handler of ${cur.outbox[digest].type} issued documents; it opens duties`)\n cur = r.state\n events.push(...(r.events ?? []))\n if (r.duties?.length) {\n const duties = { ...cur.duties }\n for (const d of r.duties) if (!Object.hasOwn(duties, d.id)) duties[d.id] = d\n cur = { ...cur, duties }\n }\n }\n return { state: cur, events }\n }\n\n /** The give-up of the outbox items named (a replay found them due, see\n * #run): as resume's, the failed step, the status event, the failure\n * handlers in the same transaction; items no longer due are left alone. */\n #giveUpDef (): InternalDef {\n const giveUp = (it: Readonly<OutboxItem>, when: Millis) => this.#giveUp(it, when)\n const failed = (st: HolderState, digests: readonly string[], when: Millis) => this.#failed(st, digests, when)\n return {\n human: false,\n apply (state, _p, digests: string[], when) {\n const outbox: Record<string, OutboxItem> = { ...state.outbox }\n const events: EventDraft[] = []\n const gave: string[] = []\n for (const d of digests) {\n const it = state.outbox[d]\n const t = triasOf(it)\n if (t === 'delivered' || t === 'failed') continue\n const why = giveUp(it, when)\n if (!why) continue\n const { nextAttemptAt: _, ...rest } = it\n outbox[d] = { ...rest, history: [...rest.history, { status: 'failed', at: when, reason: why }] }\n events.push({ type: 'delivery.status', digest: d, threadId: it.threadId, status: 'failed' })\n gave.push(d)\n }\n if (!gave.length) return { state: state as HolderState }\n const f = failed({ ...state, outbox }, gave, when)\n return { state: f.state, events: [...events, ...f.events] }\n },\n }\n }\n\n /** Why a non-terminal outbox item is given up at `when`, or null: its\n * sender lifetime, where it ends no later than the horizon\n * (failed(task-expired), Delivery 6110), else the horizon\n * (failed(expired-by-adapter-policy)). */\n #giveUp (it: Readonly<OutboxItem>, when: Millis): 'task-expired' | 'expired-by-adapter-policy' | null {\n const first = it.history.length ? it.history[0].at : when\n const expiry = Math.min(first + this.#policy.horizonMs, Number.MAX_SAFE_INTEGER)\n const life = it.expiresAt\n if (life !== undefined && when >= life && life <= expiry) return 'task-expired'\n return when >= expiry ? 'expired-by-adapter-policy' : null\n }\n\n #itemOf (state: Readonly<HolderState>, digest: string): OutboxItem {\n if (!Object.hasOwn(state.outbox, digest)) throw new Error(`engine: journaled outbound ${digest} is missing from the outbox`)\n return state.outbox[digest]\n }\n\n #outboundOf (state: Readonly<HolderState>, digest: string): Outbound {\n const it = this.#itemOf(state, digest)\n return structuredClone({ digest, envelope: it.envelope, type: it.type, threadId: it.threadId, recipient: it.recipient, attempt: it.attempt })\n }\n\n // ── built-ins ────────────────────────────────────────────────────────\n\n #tickDef (): InternalDef {\n const policy = (): Policy => this.#policy\n const retainers = () => this.#retain\n const keepers = () => this.#keepKeys\n return {\n human: false,\n apply (state, _p, _input, when) {\n const retention = policy().retentionMs\n let dropped = false\n const keep = <T>(rec: Record<string, T>, live: (x: T, key: string) => boolean): Record<string, T> => {\n const out: Record<string, T> = {}\n for (const [k, v] of Object.entries(rec)) { if (live(v, k)) out[k] = v; else dropped = true }\n return out\n }\n // effects leave with their acks (Delivery 4.2); prompts at expiry; the\n // act journal after the retention\n const effects = keep(state.effects, (x) => x.expiresAt > when)\n const prompts = keep(state.prompts, (x) => x.expiresAt === undefined || x.expiresAt > when)\n const acts = keep(state.acts, (x) => x.at + retention > when)\n // terminal outbox items, the retention after their last step, unless a\n // kept journal entry still answers with them (replay needs the item)\n const journaled = new Set(Object.values(acts).flatMap((a) => a.outboundDigests))\n const outbox = keep(state.outbox, (it, digest) => {\n const t = triasOf(it)\n if (t !== 'delivered' && t !== 'failed') return true\n const last = it.history.length ? it.history[it.history.length - 1].at : 0\n return last + retention > when || journaled.has(digest)\n })\n let next: HolderState = dropped ? { ...state, effects, prompts, acts, outbox } : state as HolderState\n // the modules' own retention, on what the engine's left\n for (const r of retainers()) {\n const after = r(next, when)\n if (after.effects !== next.effects) throw new Error('engine: a module\\'s retain wrote the effect cache')\n next = after\n }\n // addresses (Delivery §5), on what the retention left, so a key whose\n // last claim left in this tick leaves with it: a key not shown for the\n // retention, and the own rkid of no live tuple, becomes a tombstone —\n // its id alone, kept forever; tombstones never shrink\n const held = next\n const live = new Set<string>()\n for (const r of Object.values(held.relationships)) for (const t of r.tuples) if (!t.deactivated) live.add(t.rkid)\n // and the rkids a module still needs (a deactivated prior whose continuity flow is open)\n // (at this tick's time: a claim that ends now ends in this tick)\n for (const k of keepers()) for (const rkid of k(held, when)) live.add(rkid)\n const tombstones = [...held.addresses.tombstones]\n let gone = false\n const keys: HolderState['addresses']['keys'] = {}\n for (const [rkid, k] of Object.entries(held.addresses.keys)) {\n if (k.lastShown + retention > when || live.has(rkid)) { keys[rkid] = k; continue }\n gone = true\n // a member key (group/…) is an identity context, not a delivery\n // address of Delivery §5: it leaves without a tombstone, so the same\n // derivation can serve the same group again (a re-invitation)\n if (!k.label.startsWith('group/') && !tombstones.includes(rkid)) tombstones.push(rkid)\n }\n if (gone) next = { ...held, addresses: { keys, tombstones } }\n return { state: next } // unchanged: the engine still commits a raised lastWhen\n },\n }\n }\n\n /** The duties a resume plans to run, in fixed order (dueAt, then id),\n * and the registered kinds met at an unknown version. Each planned\n * duty is checked again against the current state right before its\n * handler runs (#resumeDef). */\n #dutyPlan (state: Readonly<HolderState>, when: Millis): { run: Array<{ duty: Duty, h: DutyHandler }>, unsupported: Duty[] } {\n const order = Object.values(state.duties).sort((a, b) => (dutyDue(a) - dutyDue(b)) || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0))\n const run: Array<{ duty: Duty, h: DutyHandler }> = []\n const unsupported: Duty[] = []\n for (const duty of order) {\n const h = this.#duties.get(duty.kind)\n if (!h) continue // a kind no module here registers: kept, silent\n if (duty.v !== h.v) { unsupported.push(duty); continue }\n if (dutyRunnable(duty, h, state, when)) run.push({ duty, h })\n }\n return { run, unsupported }\n }\n\n #resumeDef (): InternalDef {\n const expiryAfter = (st: Readonly<HolderState>, w: Millis): Millis | undefined => this.#nextExpiry(st, w)\n const policy = (): Policy => this.#policy\n const plan = (state: Readonly<HolderState>, when: Millis) => this.#dutyPlan(state, when)\n const handlers = (): ReadonlyMap<string, DutyHandler> => this.#duties\n const sweeps = (): ReadonlyMap<string, SweepHandler> => this.#sweeps\n const failed = (st: HolderState, digests: readonly string[], when: Millis) => this.#failed(st, digests, when)\n const ownRetries = (): ReadonlySet<string> => this.#ownRetries\n const giveUp = (it: Readonly<OutboxItem>, when: Millis) => this.#giveUp(it, when)\n return {\n human: false,\n // the due duties' and the sweeps' preparations, against the snapshot apply will see\n async prepare (ctx) {\n const values: Record<string, unknown> = {}\n for (const { duty, h } of plan(ctx.snapshot, ctx.when).run) if (h.prepare) values[duty.id] = await h.prepare(ctx, duty)\n const swept: Record<string, unknown> = {}\n for (const [name, sw] of sweeps()) swept[name] = await sw.prepare(ctx)\n return { duties: values, sweeps: swept }\n },\n apply (state, prepared, _input, when) {\n const p = policy()\n const outbox: Record<string, OutboxItem> = { ...state.outbox }\n const emit: Outbound[] = []\n const events: EventDraft[] = []\n const gaveUp: string[] = []\n let nextDueAt: Millis | undefined\n const due = (t: Millis): void => { nextDueAt = nextDueAt === undefined ? t : Math.min(nextDueAt, t) }\n // 1 — the outbox, by due time, then digest\n const order = Object.keys(state.outbox).sort((a, b) =>\n ((state.outbox[a].nextAttemptAt ?? 0) - (state.outbox[b].nextAttemptAt ?? 0)) || (a < b ? -1 : a > b ? 1 : 0))\n for (const digest of order) {\n const it = state.outbox[digest]\n const trias = triasOf(it)\n if (trias === 'delivered' || trias === 'failed') continue\n // the horizon applies to every non-terminal item: held, accepted or\n // not; a sender lifetime the type declares ends it earlier, as\n // failed(task-expired), never handed out again (Delivery 6110, 6115)\n const why = giveUp(it, when)\n if (why) {\n const { nextAttemptAt: _, ...rest } = it\n outbox[digest] = { ...rest, history: [...it.history, { status: 'failed', at: when, reason: why }] }\n events.push({ type: 'delivery.status', digest, threadId: it.threadId, status: 'failed' })\n gaveUp.push(digest)\n continue\n }\n const first = it.history.length ? it.history[0].at : when\n const expiry = Math.min(first + p.horizonMs, Number.MAX_SAFE_INTEGER)\n due(it.expiresAt !== undefined ? Math.min(it.expiresAt, expiry) : expiry)\n // never re-emitted: an accepted item (the service has it) and one the\n // adapter holds (awaiting-transport, until it reports again)\n if (trias === 'accepted' || it.history[it.history.length - 1]?.status === 'awaiting-transport') continue\n // a type its module re-issues itself is never reproduced (Trust 6710)\n if (ownRetries().has(it.type)) continue\n if (it.nextAttemptAt !== undefined && it.nextAttemptAt > when) { due(it.nextAttemptAt); continue }\n const attempt = it.attempt + 1\n const nextAttemptAt = dueAt(when, p.backoff(attempt))\n outbox[digest] = { ...it, attempt, nextAttemptAt, history: [...it.history, { status: 'submitted', at: when, attempt }] }\n emit.push(structuredClone({ digest, envelope: it.envelope, type: it.type, threadId: it.threadId, recipient: it.recipient, attempt }))\n due(nextAttemptAt)\n }\n // 2 — duties, in the plan's order, each on the state the one before\n // left and checked against it right before its handler: still there\n // at the handler's version, due, its awaited head still holding. A\n // prepared duty whose data changed since its preparation is deferred\n // to the next resume, which prepares it afresh (due at once)\n const { run, unsupported } = plan(state, when)\n for (const d of unsupported) events.push({ type: 'duty.unsupported', dutyId: d.id, kind: d.kind, v: d.v })\n // the outbox changed only by a re-emission or a give-up (an event so far)\n let cur: HolderState = !emit.length && !events.length ? state as HolderState : { ...state, outbox }\n // the failure handlers of the items given up, in the give-up's transaction\n if (gaveUp.length) { const f = failed(cur, gaveUp, when); cur = f.state; events.push(...f.events) }\n const drafts: OutboundDraft[] = []\n const renames: IdentityRename[] = []\n // the duties whose handler returned Applied (invariants.ts: fulfilment)\n const fulfilled: string[] = []\n // ran and stayed (not-due, refused): id → its record as it ran\n const kept = new Map<string, string>()\n const { duties: values, sweeps: swept } = prepared.value as { duties: Record<string, unknown>, sweeps: Record<string, unknown> }\n for (const { duty, h } of run) {\n if (!Object.hasOwn(cur.duties, duty.id)) continue // fulfilled or dropped meanwhile\n const now = cur.duties[duty.id]\n // another kind or version since the plan: the next resume dispatches it\n if (now.kind !== duty.kind || now.id !== duty.id || now.v !== h.v || !dutyRunnable(now, h, cur, when)) continue // the final pass sets its timer\n if (h.prepare && jcs(now) !== jcs(duty)) continue // prepared on other data\n const r = h.apply(cur, now, Object.freeze({ prepared: Object.freeze({ value: values[duty.id], version: prepared.version, commitSeq: prepared.commitSeq }), backoff: p.backoff }), when)\n if (r === 'not-due' || isRefusal(r)) { kept.set(duty.id, jcs(now)); continue }\n // fulfilled: the duty leaves; what its handler opened is folded into\n // the state at once (an id already open is kept), so the duties\n // after it see it — their drop rules and their dedupe included\n const left = { ...r.state.duties }\n delete left[duty.id]\n for (const d of r.duties ?? []) if (!Object.hasOwn(left, d.id)) left[d.id] = d\n cur = { ...r.state, duties: left }\n fulfilled.push(duty.id)\n drafts.push(...(r.outbound ?? []))\n events.push(...(r.events ?? []))\n renames.push(...(r.renames ?? []))\n }\n // 2b — the sweeps, on the state the duties left; a prepared piece\n // whose inputs moved is skipped and due again at once\n for (const [name, sw] of sweeps()) {\n const r = sw.apply(cur, Object.freeze({ value: swept[name], version: prepared.version, commitSeq: prepared.commitSeq }), when)\n if (r.state.effects !== cur.effects) throw new Error(`engine: the sweep ${name} wrote the effect cache`)\n cur = r.state\n if (r.duties?.length) {\n const all = { ...cur.duties }\n for (const d of r.duties) if (!Object.hasOwn(all, d.id)) all[d.id] = d\n cur = { ...cur, duties: all }\n }\n drafts.push(...(r.outbound ?? []))\n events.push(...(r.events ?? []))\n if (r.deferred) due(when)\n }\n // work a sweep owes now but did not prepare: a divergence the outbox\n // step (a give-up at the horizon) or a duty of this resume created —\n // due at once, prepared by the next resume\n if (cur !== state) {\n for (const sw of sweeps().values()) {\n const had = new Set(sw.pending(state, when))\n if (sw.pending(cur, when).some((k) => !had.has(k))) { due(when); break }\n }\n }\n // the timer from the final duty set, new duties included: a future\n // dueAt, or `when` for work runnable now that did not run (deferred,\n // newly created, newly unblocked); a duty that ran and stayed\n // (not-due, refused) sets none while its record is unchanged since\n // its run — changed by a later duty, it counts like any other\n for (const d of Object.values(cur.duties)) {\n const h = handlers().get(d.kind)\n if (!h || d.v !== h.v || kept.get(d.id) === jcs(d)) continue\n if (dutyDue(d) > when) due(dutyDue(d))\n else if (dutyRunnable(d, h, cur, when)) due(when)\n }\n // the duties' new documents enter the outbox in #run, due at backoff(1)\n if (drafts.length) due(dueAt(when, p.backoff(1)))\n // 3 — acks still unsent (a restart between the receive commit and the\n // send, or no report yet): re-offered byte-identical on the retry\n // policy, by effect digest; at the horizon marked sent by it\n const release: Outbound[] = []\n let effects: HolderState['effects'] | null = null\n for (const d of Object.keys(cur.effects).sort()) {\n const a = cur.effects[d].ack\n if (!a || a.sent) continue\n const expiry = Math.min(a.at + p.horizonMs, Number.MAX_SAFE_INTEGER)\n effects ??= { ...cur.effects }\n if (when >= expiry) {\n const { nextAttemptAt: _, held: _h, ...rest } = a\n effects[d] = { ...cur.effects[d], ack: { ...rest, sent: true, sentBy: 'horizon' } }\n continue\n }\n due(expiry)\n // held: the adapter has it (awaiting-transport); pendingTransport offers it\n if (a.held !== undefined) continue\n if (a.nextAttemptAt !== undefined && a.nextAttemptAt > when) { due(a.nextAttemptAt); continue }\n const attempt = a.attempt + 1\n const nextAttemptAt = dueAt(when, p.backoff(attempt))\n effects[d] = { ...cur.effects[d], ack: { ...a, attempt, nextAttemptAt } }\n release.push(ackOutbound(a, attempt))\n due(nextAttemptAt)\n }\n if (effects && jcs(effects) !== jcs(cur.effects)) cur = { ...cur, effects }\n // the expiry work tick does (the timer contract, the header)\n const ex = expiryAfter(cur, when)\n if (ex !== undefined) due(ex)\n return {\n state: cur, emit, events, outbound: drafts, release, detail: { fulfilled },\n ...(renames.length ? { renames } : {}),\n ...(nextDueAt !== undefined ? { nextDueAt } : {}),\n }\n },\n }\n }\n\n /** an answer's hand-over began: it is no longer due (handOver) */\n #answeredDef (): InternalDef {\n return {\n human: false,\n apply (state, _p, input: { digest: string, n: number }) {\n const eff = Object.keys(state.effects).find((d) => state.effects[d].ack?.digest === input.digest)\n if (eff === undefined) return { state: state as HolderState }\n const a = state.effects[eff].ack!\n if (a.answerDue !== true || a.answers !== input.n) return { state: state as HolderState }\n const { answerDue: _d, ...rest } = a\n return { state: { ...state, effects: { ...state.effects, [eff]: { ...state.effects[eff], ack: rest } } } }\n },\n }\n }\n\n #reportDef (): InternalDef {\n const failed = (st: HolderState, digests: readonly string[], when: Millis) => this.#failed(st, digests, when)\n return {\n human: false,\n apply (state, _p, report: DeliveryReport, when) {\n if (!Object.hasOwn(state.outbox, report.digest)) {\n // an ack (outbox-less, no trias; Delivery RLTP-DEL-6330): sent once\n // a service took it or the adapter gave it up; awaiting-transport\n // records that the adapter holds it and ends nothing\n const eff = Object.keys(state.effects).find((d) => state.effects[d].ack?.digest === report.digest)\n if (eff === undefined) return { ok: false, code: 'unknown-digest' }\n const e = state.effects[eff]\n const a = e.ack!\n if (a.sent) return { state: state as HolderState }\n const { nextAttemptAt: _, held: _h, ...rest } = a\n let ack: StoredAck\n switch (report.status) {\n case 'awaiting-transport':\n if (a.held === report.reason) return { state: state as HolderState }\n ack = { ...rest, held: report.reason }\n break\n case 'accepted':\n case 'delivered':\n ack = { ...rest, sent: true, sentBy: 'accepted' }\n break\n case 'failed':\n ack = { ...rest, sent: true, sentBy: 'failed' }\n break\n default:\n throw new TypeError(`unknown report status ${String((report as { status?: unknown }).status)}`)\n }\n return { state: { ...state, effects: { ...state.effects, [eff]: { ...e, ack } } } }\n }\n const it = state.outbox[report.digest]\n const trias = triasOf(it)\n const had = (s: OutboxStep['status']): boolean => it.history.some((x) => x.status === s)\n const same = { state: state as HolderState }\n let step: OutboxStep\n switch (report.status) {\n case 'awaiting-transport': {\n const last = it.history[it.history.length - 1]\n if (trias !== 'submitted') return same // no step back before the trias\n if (last?.status === 'awaiting-transport' && last.reason === report.reason) return same\n step = { status: 'awaiting-transport', at: when, reason: report.reason }\n break\n }\n case 'accepted':\n if (had('accepted') || trias !== 'submitted') return same\n step = { status: 'accepted', at: when }\n break\n case 'delivered': {\n // lateness is the holder's own history: delivered after failed\n // (its own give-up or the adapter's) is late, whatever the flag says\n const m = markDelivered(state, report.digest, when)\n return m.event ? { state: { ...state, outbox: m.outbox }, events: [m.event] } : same\n }\n case 'failed':\n if (had('failed') || trias === 'delivered') return same\n step = report.reason === 'rejected-by-receiver'\n ? { status: 'failed', at: when, reason: report.reason, code: report.code }\n : { status: 'failed', at: when, reason: report.reason }\n break\n default:\n throw new TypeError(`unknown report status ${String((report as { status?: unknown }).status)}`)\n }\n const base = step.status === 'awaiting-transport' ? it : (({ nextAttemptAt: _, ...rest }) => rest)(it)\n const outbox = { ...state.outbox, [report.digest]: { ...base, history: [...it.history, step] } }\n const events: EventDraft[] = step.status === 'awaiting-transport' ? [] : [{\n type: 'delivery.status', digest: report.digest, threadId: it.threadId, status: step.status,\n }]\n if (step.status === 'failed') {\n const f = failed({ ...state, outbox }, [report.digest], when)\n return { state: f.state, events: [...events, ...f.events] }\n }\n return { state: { ...state, outbox }, events }\n },\n }\n }\n\n #receiveDef (): InternalDef {\n const tasks = (): ReadonlyMap<string, TaskHandler> => this.#tasks\n const acks = (): ReadonlyMap<string, AckHandler> => this.#acks\n const acceptedHooks = (): ReadonlyArray<NonNullable<HolderModule['accepted']>> => this.#accepted\n const policy = (): Policy => this.#policy\n return {\n human: false,\n prepare: (ctx, env) => prepareReceive(ctx, env, tasks()),\n apply (state, prepared, _env, when) {\n const plan = prepared.value as ReceivePlan\n const cached = (ack: Effect['ack']): Effect => ({ ack, expiresAt: Math.min(when + policy().retentionMs, Number.MAX_SAFE_INTEGER) })\n switch (plan.kind) {\n case 'failed': return { halt: true, detail: plan.result }\n case 'duplicate': {\n // the stored ack, byte-identical; a terminal document has none\n // (its outbound attempt is one past the schedule's, which it does not move)\n // and an answer due (Delivery RLTP-DEL-6330): a hand-over of its\n // own, kept across a lock until it begins; while one is due, a\n // further duplicate is answered by it (the same bytes)\n const a = state.effects[plan.digest].ack\n const next: HolderState = a && a.answerDue === undefined\n ? { ...state, effects: { ...state.effects, [plan.digest]: { ...state.effects[plan.digest], ack: { ...a, answers: (a.answers ?? 0) + 1, answerDue: true } } } }\n : state as HolderState\n return { state: next, release: a ? [ackOutbound(a, a.attempt + 1)] : [], detail: { disposition: 'duplicate-known', digest: plan.digest } }\n }\n case 'ack': {\n // terminal: the sender-status update and its cache entry, no ack;\n // the issuing module's ack handler runs in the same transaction\n const m = markDelivered(state, plan.ref, when)\n let next: HolderState = { ...state, outbox: m.outbox }\n const events: EventDraft[] = m.event ? [m.event] : []\n const h = acks().get(state.outbox[plan.ref].type)\n if (h) {\n const r = h(next, plan.ref, when)\n if (r.state.effects !== next.effects) throw new Error(`engine: the ack handler of ${state.outbox[plan.ref].type} wrote the effect cache`)\n next = r.state\n events.push(...(r.events ?? []))\n }\n // a verified ack is an accepted document of its issuer too: the\n // modules' accepted hooks, in the same transaction\n for (const hook of acceptedHooks()) {\n next = hook(next, plan.doc, plan.arrival)\n if (next.effects !== state.effects) throw new Error('engine: an accepted hook wrote the effect cache')\n }\n return {\n state: { ...next, effects: { ...next.effects, [plan.digest]: cached(null) } },\n events,\n detail: { disposition: 'unique', digest: plan.digest, type: ACK_TYPE, ref: plan.ref },\n }\n }\n case 'task': {\n const h = tasks().get(plan.type)!\n const r = h.apply(state, handlerPrepared(prepared, plan.value), plan.doc, plan.arrival)\n if (isTaskRefusal(r)) {\n const failedDetail = { disposition: 'failed', reason: r.reason, stage: 9, digest: plan.digest, ...(r.ref !== undefined ? { ref: r.ref } : {}) }\n if (!r.latch) return { halt: true, detail: failedDetail }\n // the Encounter latch exception (receive.ts): only the latch commits\n checkLatch(state, r.latch, when)\n return { state: r.latch, detail: failedDetail }\n }\n if (isTaskDiscarded(r)) {\n // a resource-limit discard: its state commits; no cache entry, no ack\n if (r.state.effects !== state.effects) throw new Error(`engine: the handler of ${plan.type} wrote the effect cache`)\n return { state: r.state, detail: { disposition: 'discarded', digest: plan.digest, type: plan.type, reason: r.reason, ...(r.ref !== undefined ? { ref: r.ref } : {}) } }\n }\n if (r.state.effects !== state.effects) throw new Error(`engine: the handler of ${plan.type} wrote the effect cache; the core writes it`)\n // the modules' accepted hooks, in the same transaction\n let after = r.state\n for (const hook of acceptedHooks()) {\n after = hook(after, plan.doc, plan.arrival)\n if (after.effects !== state.effects) throw new Error('engine: an accepted hook wrote the effect cache')\n }\n return {\n state: { ...after, effects: { ...state.effects, [plan.digest]: cached({ ...plan.ack, at: when, attempt: 1, nextAttemptAt: dueAt(when, policy().backoff(1)), sent: false }) } },\n ...(r.outbound ? { outbound: r.outbound } : {}),\n ...(r.events ? { events: r.events } : {}),\n ...(r.duties ? { duties: r.duties } : {}),\n ...(r.renames ? { renames: r.renames } : {}),\n release: [ackOutbound(plan.ack, 1)],\n detail: { disposition: 'unique', digest: plan.digest, type: plan.type, rkid: plan.arrival.rkid },\n }\n }\n }\n },\n }\n }\n\n // ── public surface ───────────────────────────────────────────────────\n\n act (command: string, input: unknown, when: Millis, opts: { actId?: string } = {}): Promise<ActResult> {\n let def: InternalDef | undefined\n let bound: unknown\n let hash: Promise<string> | undefined\n let actId: string | undefined\n try {\n def = this.#commands.get(command)\n if (!def) throw new Error((BUILTIN as readonly string[]).includes(command) ? `${command} is built in: call engine.${command}()` : `unknown command ${command}`)\n checkWhen(when)\n actId = def.human ? opts.actId : undefined\n if (def.human && (typeof actId !== 'string' || actId === '')) return Promise.resolve({ ok: false, code: 'actid-missing' })\n // bound here, synchronously: later changes by the caller reach nothing\n bound = bindInput(input)\n if (def.human) {\n hash = digestOf(this.#crypto.subtle, { command, input: bound })\n hash.catch(() => undefined) // awaited in the queue; no unhandled rejection meanwhile\n }\n } catch (e) { return Promise.reject(e) }\n const d = def\n return this.#enqueue(async () => {\n return actResult(await this.#run(d, { kind: 'act', command }, bound, when, actId, hash === undefined ? undefined : await hash))\n })\n }\n\n tick (when: Millis): Promise<ActResult> {\n try { checkWhen(when) } catch (e) { return Promise.reject(e) }\n return this.#enqueue(async () => {\n return actResult(await this.#run(this.#builtins.tick, { kind: 'tick' }, null, when))\n })\n }\n\n resume (when: Millis): Promise<ResumeResult> {\n try { checkWhen(when) } catch (e) { return Promise.reject(e) }\n // fail closed: a resume that throws anywhere — the settling of an\n // earlier commit included — leaves nothing to go out until one completes\n return this.#enqueue(async () => {\n this.#resumed = false\n const r = await this.#run(this.#builtins.resume, { kind: 'resume' }, null, when)\n if (isHalt(r) || !r.ok) throw new Error('engine: resume does not refuse')\n this.#resumed = true\n return { outbound: r.outbound, events: r.events, ...(r.nextDueAt !== undefined ? { nextDueAt: r.nextDueAt } : {}) }\n }).catch((e) => { this.#resumed = false; throw e })\n }\n\n report (report: DeliveryReport, when: Millis): Promise<ActResult> {\n let bound: DeliveryReport\n try { checkWhen(when); bound = bindInput(report) } catch (e) { return Promise.reject(e) }\n return this.#enqueue(async () => {\n return actResult(await this.#run(this.#builtins.report, { kind: 'report', status: bound.status }, bound, when))\n })\n }\n\n receive (env: unknown, when: Millis): Promise<ReceiveResult> {\n try { checkWhen(when) } catch (e) { return Promise.reject(e) }\n // bound at the call like any input; what is not JSON is no envelope\n let bound: unknown\n try { bound = bindInput(env) } catch { bound = null }\n return this.#enqueue(async () => {\n const r = await this.#run(this.#builtins.receive, { kind: 'receive' }, bound, when)\n if (isHalt(r)) return r.detail as ReceiveResult\n if (!r.ok) throw new Error('engine: receive does not refuse')\n if ((r.detail as { disposition?: string } | undefined)?.disposition === 'failed') return r.detail as ReceiveResult // a latch committed\n const d = r.detail as { disposition: 'unique' | 'duplicate-known' | 'discarded', digest: string, type?: string, reason?: 'resource-limit' | 'rejected', ref?: string }\n if (d.disposition === 'discarded') return { disposition: 'discarded', digest: d.digest, type: d.type!, reason: d.reason!, ...(d.ref !== undefined ? { ref: d.ref } : {}) }\n return d.disposition === 'unique'\n ? { disposition: 'unique', digest: d.digest, type: d.type!, outbound: r.outbound, events: r.events, ...(r.nextDueAt !== undefined ? { nextDueAt: r.nextDueAt } : {}) }\n : { disposition: 'duplicate-known', digest: d.digest, outbound: r.outbound }\n })\n }\n\n subscribe (listener: CommitListener): () => void {\n if (typeof listener !== 'function') throw new TypeError('listener must be a function')\n this.#listeners.add(listener)\n return () => { this.#listeners.delete(listener) }\n }\n\n snapshot (): Promise<EngineSnapshot> {\n return this.#enqueue(async () => {\n const { state } = await this.#read()\n return Object.freeze({ state, commitSeq: state.commitSeq })\n })\n }\n\n pendingTransport (when: Millis): Promise<TransportView | TransportRefusal> {\n try { checkWhen(when) } catch (e) { return Promise.reject(e) }\n return this.#enqueue(async () => {\n if (!this.#resumed) return Object.freeze({ ok: false as const, code: 'not-resumed' as const })\n const { state } = await this.#read()\n // the holder's time never runs back: an earlier `when` reads at lastWhen\n const at = Math.max(when, state.lastWhen)\n const entries = transportEntries(state, at, this.#policy.horizonMs).map((e) => {\n const f = freezeDeep(e)\n this.#issued.add(f)\n return f\n })\n return Object.freeze({ ok: true as const, commitSeq: state.commitSeq, at, entries: Object.freeze(entries) })\n })\n }\n\n mayHandOver (entry: TransportEntry, when: Millis): Promise<boolean> {\n try { checkWhen(when) } catch (e) { return Promise.reject(e) }\n if (this.#closed || entry === null || typeof entry !== 'object' || !this.#issued.has(entry)) return Promise.resolve(false)\n return this.#enqueue(() => this.#mayGo(entry, when)).catch((e) => {\n if (e instanceof InfraError && e.code === 'closed') return false\n throw e\n })\n }\n\n handOver (entry: TransportEntry, when: Millis, start: () => boolean): Promise<boolean> {\n try { checkWhen(when) } catch (e) { return Promise.reject(e) }\n if (typeof start !== 'function') return Promise.reject(new TypeError('handOver needs a start function'))\n if (this.#closed || entry === null || typeof entry !== 'object' || !this.#issued.has(entry)) return Promise.resolve(false)\n return this.#enqueue(async () => {\n if (!this.#resumed) return false\n const { state } = await this.#read()\n // no await from here to start(): close() and every other operation\n // of this engine come before the check or after the start\n if (!this.#passes(state, entry, when)) return false\n if (start() !== true) return false\n // an answer's hand-over has begun: it is no longer due (a later\n // duplicate grants the next); a commit that fails leaves it due, and\n // it may go out once more — the receiver absorbs it\n if (entry.resend !== undefined) {\n try { await this.#run(this.#answeredDef(), { kind: 'report', status: 'answered' }, { digest: entry.digest, n: entry.resend }, Math.max(when, state.lastWhen)) } catch { /* stays due */ }\n }\n return true\n }).catch((e) => {\n if (e instanceof InfraError && e.code === 'closed') return false\n throw e\n })\n }\n\n /** the gate's check, inside the queue: open, resumed, still pending in\n * the store as issued, before its deadline */\n async #mayGo (entry: TransportEntry, when: Millis): Promise<boolean> {\n if (!this.#resumed) return false\n const { state } = await this.#read()\n return this.#passes(state, entry, when)\n }\n\n /** synchronous: open, resumed, the entry pending in `state` as issued,\n * before its deadline at max(when, lastWhen) */\n #passes (state: Readonly<HolderState>, entry: TransportEntry, when: Millis): boolean {\n if (this.#closed || !this.#resumed) return false\n const now = transportEntryOf(state, entry.kind, entry.digest, Math.max(when, state.lastWhen), this.#policy.horizonMs, entry.resend)\n return now !== null && now.resend === entry.resend && jcs(now.envelope) === jcs(entry.envelope)\n }\n\n close (): Promise<void> {\n this.#closed = true\n return this.#chain.then(() => undefined, () => undefined)\n }\n\n get closed (): boolean { return this.#closed }\n}\n\n/** The send deadline of an outbox item: the horizon from its first\n * submission, or the sender lifetime its type declared if that is\n * earlier (#giveUp's two bounds as one instant). */\nconst notAfterOf = (it: Readonly<OutboxItem>, horizonMs: number): Millis | null => {\n if (!it.history.length) return null\n const expiry = Math.min(it.history[0].at + horizonMs, Number.MAX_SAFE_INTEGER)\n return it.expiresAt !== undefined ? Math.min(it.expiresAt, expiry) : expiry\n}\n\n/** The transport entry of one pending document or ack at `when`, or null:\n * terminal, accepted, sent, past its deadline, or absent (RLTP-DEL-6135:\n * absent means stop). */\nfunction transportEntryOf (state: Readonly<HolderState>, kind: 'document' | 'ack', digest: string, when: Millis, horizonMs: number, resend?: number): TransportEntry | null {\n if (kind === 'document') {\n if (!Object.hasOwn(state.outbox, digest)) return null\n const it = state.outbox[digest]\n const trias = triasOf(it)\n if (trias !== 'submitted') return null\n const notAfter = notAfterOf(it, horizonMs)\n if (notAfter === null || when >= notAfter) return null\n const last = it.history[it.history.length - 1]\n return structuredClone({\n digest, kind, envelope: it.envelope, type: it.type, threadId: it.threadId, recipient: it.recipient, attempt: it.attempt, since: it.history[0].at, notAfter,\n ...(last.status === 'awaiting-transport' ? { held: last.reason } : it.nextAttemptAt !== undefined ? { nextAttemptAt: it.nextAttemptAt } : {}),\n })\n }\n for (const d of Object.keys(state.effects)) {\n const a = state.effects[d].ack\n if (a === null || a.digest !== digest) continue\n if (resend !== undefined) {\n // a duplicate's answer: its own hand-over, apart from the retries and\n // whatever state they are in, while due and the effect keeps the ack (6335)\n if (a.answerDue !== true || a.answers !== resend || when >= state.effects[d].expiresAt) return null\n return structuredClone({\n digest, kind, envelope: a.envelope, type: ACK_TYPE, threadId: a.threadId, recipient: a.recipient, attempt: a.attempt, since: a.at,\n notAfter: state.effects[d].expiresAt, resend,\n })\n }\n const notAfter = Math.min(a.at + horizonMs, Number.MAX_SAFE_INTEGER)\n if (a.sent || when >= notAfter) return null\n return structuredClone({\n digest, kind, envelope: a.envelope, type: ACK_TYPE, threadId: a.threadId, recipient: a.recipient, attempt: a.attempt, since: a.at, notAfter,\n ...(a.held !== undefined ? { held: a.held } : a.nextAttemptAt !== undefined ? { nextAttemptAt: a.nextAttemptAt } : {}),\n })\n }\n return null\n}\n\n/** Everything the holder keeps for transport at `when`: the outbox items\n * by due time, then digest, then the unsent acks by effect digest. */\nfunction transportEntries (state: Readonly<HolderState>, when: Millis, horizonMs: number): TransportEntry[] {\n const out: TransportEntry[] = []\n const order = Object.keys(state.outbox).sort((a, b) =>\n ((state.outbox[a].nextAttemptAt ?? 0) - (state.outbox[b].nextAttemptAt ?? 0)) || (a < b ? -1 : a > b ? 1 : 0))\n for (const d of order) {\n const e = transportEntryOf(state, 'document', d, when, horizonMs)\n if (e) out.push(e)\n }\n for (const d of Object.keys(state.effects).sort()) {\n const a = state.effects[d].ack\n if (a === null) continue\n const e = transportEntryOf(state, 'ack', a.digest, when, horizonMs)\n if (e) out.push(e)\n }\n // the duplicates' answers due, each its own entry beside the retries\n for (const d of Object.keys(state.effects).sort()) {\n const a = state.effects[d].ack\n if (a === null || a.answerDue !== true) continue\n const e = transportEntryOf(state, 'ack', a.digest, when, horizonMs, a.answers)\n if (e) out.push(e)\n }\n return out\n}\n\n/**\n * Build an engine over the ports and modules: resolves and probes\n * WebCrypto, freezes the registries (duplicate command names, task URIs\n * or duty kinds throw), and initialises an empty store with the empty\n * state at the current codec.\n */\nexport async function createEngine (ports: EnginePorts, modules: readonly HolderModule[], opts: EngineOptions = {}): Promise<Engine> {\n if (!ports?.store || !ports.keys) throw new TypeError('createEngine needs a store and keys')\n const crypto = await resolveCrypto(ports.crypto)\n const engine = new HolderEngine(ports, crypto, modules, opts)\n await engine.load()\n return engine\n}\n"]}
1
+ {"version":3,"file":"engine.js","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,EAAE;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AI,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACpB,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAE,KAAkB,EAAE,OAAgC,EAAE,OAAsB,EAAE;IAChH,IAAI,CAAC,KAAK,EAAE,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI;QAAE,MAAM,IAAI,SAAS,CAAC,qCAAqC,CAAC,CAAA;IAC5F,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAChD,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;IAC7D,MAAM,MAAM,CAAC,IAAI,EAAE,CAAA;IACnB,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["// engine — the holder's small engine (lib Stage 2, note §4.1–4.4, 4.7).\n//\n// Modules own their rules as pure transitions and register commands,\n// task handlers and duty handlers here, once, at construction; after\n// that the registries are frozen. No module has a commit path of its\n// own: the engine coordinates snapshot, preparation, check, commit and\n// release, and nothing else.\n//\n// An act runs in four steps (note §4.2), serialized by one in-engine\n// queue:\n// 1. read the snapshot {state, version} from the store and decode it;\n// raise `when` to state.lastWhen (4.7)\n// 2. prepare (async, outside the transaction): crypto, entropy, ports;\n// `prepared` is bound to the version and commitSeq it ran against\n// 3. apply (synchronous, pure, on a deep-frozen snapshot), then one CAS\n// commit of state, outbox, duties, the act journal and commitSeq;\n// on `conflict` back to 1 — the queue serializes this engine, CAS\n// catches every other writer — bounded by retry.commitAttempts\n// 4. only after the commit: events to subscribers, the result returned\n//\n// A commit that throws has an unknown outcome: InfraError\n// 'unknown-commit-outcome'. The engine then settles before its next\n// operation: it re-reads and, if the commit landed (the stored state is\n// the one it wrote, or the journal holds the act at its commitSeq),\n// releases that commit's events late; otherwise drops them. A repeated\n// human act finds its result in the journal (note §4.2).\n//\n// Choices this file makes where the note leaves them open:\n// - snapshots handed to prepare/apply are always deep-frozen (also in\n// production): a mutating module throws a TypeError, nothing commits\n// - every act reads the store afresh; the engine caches no state\n// - eventId is `<commitSeq>.<index>`: unique per holder, no entropy\n// - the input is bound at the public call: a canonical, deep-frozen JSON\n// copy (undefined object members dropped, anything else non-JSON\n// refused); its hash, every preparation and every apply use that copy\n// - a `when` above lastWhen is a state change and commits; a non-human\n// act whose apply returns the identical state object and nothing else\n// commits nothing only when lastWhen stays too. A human act always\n// commits, because its journal entry is the result. Refusals and\n// journal replays commit nothing, lastWhen included — but for a replay\n// that finds one of its documents past its lifetime or the horizon:\n// that give-up runs first as an operation of its own on the one commit\n// path (resume's CommitOp, its timer carried to the replay's answer)\n// - outbound of an act starts at attempt 1 with nextAttemptAt =\n// when + ceil(backoff(1)); the act names that or the document's send\n// deadline, whichever is first, in nextDueAt (a repeat names its live\n// documents' the same way), so an idle holder's timer reaches the\n// retries, the give-up and the journal's end. An act without documents\n// names no journal deadline: the next resume names the end of its entry\n// (a tick does not); resume() re-emits only items that are due\n// and pauses re-emission while the last step is awaiting-transport\n// (the adapter holds the item) and never re-emits an accepted one. It\n// gives up every non-terminal item (submitted, held or accepted) at\n// first submission + horizonMs, never by attempt\n// count, or earlier at the sender lifetime its type declared\n// (expiresAt, Delivery 7020); nextDueAt is the earliest due\n// re-emission, horizon or lifetime\n// - the holder's give-up is failed(expired-by-adapter-policy), at a\n// lifetime failed(task-expired) (Delivery 6110); a later\n// delivered report is late by that history, whatever the adapter says\n// - replay of a human act returns the journaled events and the outbound\n// of its documents that are not terminal (delivered, failed) and not\n// due for the give-up, at their current attempt; one due for it is\n// given up in a commit of its own first (6115: never handed out again). Idempotency is bounded by the journal's retention:\n// max(P90D, retry.horizonMs), the key-retention of Delivery §7 that\n// bounds effects and their acks, counted from the act's commit and\n// from the last step of each of its documents, whichever is later (a\n// document not yet terminal keeps the act): the act's result stays as\n// long as its documents' completion does; after it the same actId is\n// a new act. The retention runs in holder time (an entry leaves at the\n// tick at or after its end, `when` raised to lastWhen): a clock set\n// ahead by more than the retention ends it early in real time. The\n// bound is one of time, not of count: one entry per human act (its\n// events and document digests, the documents themselves kept beside\n// it), removed by the tick that is due. A replay\n// answers from the journal alone, before any preparation: no key, no\n// entropy, no new document; the time it reads at changes nothing in it\n// - replay(actId, when) is the journal read without the act: in the\n// queue (after the settling of an unsettled commit), on the stored\n// state, committing nothing, lastWhen included; it names which of the\n// act's documents a repeat at max(when, lastWhen) would hand out, and\n// gives none up. unknown-act: no entry under the id (never committed,\n// or past the retention)\n// - KeyProvider, Log and Access rejections inside a preparation become\n// InfraError('key-provider' | 'log' | 'access') with the cause. Known\n// limitation: a provider's argument errors (a module passing a label\n// outside the registry, say) are wrapped the same way, so a module\n// programming error surfaces as an infrastructure error; the original\n// error stays in `cause`\n// - events are deep-frozen before listeners or callers see them; a\n// listener's throw or rejection is dropped\n// - the next state is validated by the codec before every commit; an\n// invalid state is a programming error and throws\n// - receive (receive.ts) is a built-in like tick: a failed disposition\n// commits nothing, lastWhen included (like a refusal); duplicate-known\n// commits only a raised lastWhen; a CAS conflict re-reads and runs the\n// stages again, which re-checks the effect cache at stage 4\n// - an ack is stored sealed (StoredAck: envelope, digest, recipient) in\n// its effect, so every re-send is byte-identical down to the envelope.\n// It stays `sent: false` until a service takes it (report accepted or\n// delivered: `sentBy: 'accepted'`), the adapter reports it failed\n// (`'failed'`), or its horizon passes (effect commit + horizonMs:\n// `'horizon'`, no event: acks have no trias) — Delivery RLTP-DEL-6330.\n// An awaiting-transport report keeps it unsent and records `held`; a\n// held ack is not re-offered by resume (the adapter has it) and stays\n// in pendingTransport. Unsent and not held, it has the outbox's retry\n// schedule: attempt 1 at the receive, re-offered by resume when due\n// (attempt + 1, backoff), counted into nextDueAt. Sent or not, it stays\n// with its effect until the effect expires (RLTP-DEL-6335). A\n// duplicate's re-send carries attempt + 1 and does not move the\n// schedule; it commits the answer it makes due (6330), else nothing\n// beyond lastWhen\n// - custody (Delivery RLTP-DEL-6120 to 6135): pendingTransport(when) is\n// the set the holder keeps for transport — every outbox item neither\n// terminal nor accepted, held ones included, and every unsent ack —\n// each with its deadline (notAfter: the horizon from the first\n// submission, or the type's sender lifetime if earlier) and without\n// those whose deadline has passed at `when`, whether or not a resume\n// has recorded the give-up yet. It answers only after a resume of this\n// engine has completed (a resume that throws withdraws that again), and\n// its entries are issued to this engine: mayHandOver(entry, when)\n// accepts only an entry this engine issued, re-reads the store and says\n// yes only while the engine is open and the entry is still pending\n// there with the same envelope before its deadline. handOver(entry,\n// when, start) is the same check with the deposit's start inside the\n// queue: nothing of this engine runs between the check and the start.\n// A duplicate makes an answer due, stored with the ack (answers,\n// answerDue: kept across a lock): a `resend` entry numbered by it,\n// beside the ack's retries and independent of their state, deadline the\n// effect's retention; the begun hand-over ends it (a commit): it is one\n// hand-over with no retries (Delivery 6330), so a deposit the wire\n// refuses is not tried again — the sender's next redelivery asks anew;\n// a duplicate while one is due is answered by it (the same bytes); a resume that throws, its settling\n// included, withdraws the authority until one completes. The check is\n// this engine's: a second engine over the same store commits through\n// CAS but is not serialized with this one's hand-overs, so one opening\n// per store at a time is the app's to keep (its writer lock). close() ends the\n// engine: every later operation rejects with InfraError('closed'),\n// mayHandOver answers false, and no entry issued before authorizes\n// anything. An operation already running when close() is called\n// completes\n// - outbound of one commit, in order: outbox re-emissions, released\n// acks, new documents\n// - resume runs duties after the outbox, ordered by dueAt (absent: due\n// always, counted as 0), then id. An Applied fulfils the duty and the\n// engine removes it in the same commit; 'not-due' and a refusal keep it\n// without a trace. A duty of a registered kind at another version is\n// announced as duty.unsupported on every resume (a commit of its own);\n// a kind no module registers is kept silently. A duty with awaitHead\n// runs only when its handler's awaitHolds says so (none: never). Each\n// planned duty is checked again against the state the duties before it\n// left: still present at the handler's version, due, its awaited head\n// holding; a prepared duty whose data changed since its preparation is\n// deferred to the next resume and prepared afresh there. Its handler's\n// apply re-checks every other state-dependent precondition itself\n// (note §4.2 step 3). nextDueAt comes from the final duty set, the\n// duties created in this resume included: a future dueAt, or `when` for\n// duty work runnable now that did not run; a duty that ran and stayed\n// (not-due, refused) sets no timer while its record is unchanged since\n// that run. A duty whose kind changed since the plan is not run by the\n// planned handler; the next resume dispatches it. New documents of\n// duties count in too. The duties a handler opens are folded into the\n// state before the next handler runs (an id already open is kept), so\n// later handlers' drop rules and dedupe see them; they run on the next\n// resume (the plan is fixed at the snapshot)\n// - every committed operation but resume names the duty work it opened or\n// unblocked as nextDueAt on its result (ActResult, ReceiveResult\n// unique): `when` where a duty that is new, changed, or newly runnable\n// (its awaited head now holding) can run now, else the earliest future\n// dueAt among those; absent where it opened none. It is the app's cue to\n// call resume (or set a timer), as resume's own nextDueAt is. A journal\n// replay of a human act carries none: its duties were announced then\n// - sweeps (Trust 5.4 reconciliation, PR 4b) run in resume after the\n// duties, in registration order, on the state the duties left; their\n// preparations run against resume's snapshot beside the duties'. A\n// piece whose inputs moved since is skipped and makes `when` the\n// nextDueAt, as does sweep work that became pending during the resume\n// itself (a give-up at the horizon, a duty's change) without having\n// been prepared. Their new documents count into nextDueAt like the\n// duties'. Every other committed operation whose state adds a key to\n// a sweep's `pending` names `when` as its nextDueAt; a sweep that\n// declares the state parts it reads (`reads`) is skipped there when the\n// operation left all of them untouched (by reference)\n// - a verified delivery-ack runs the ack handler registered for the\n// acknowledged item's type in its own transaction; a report never does\n// - an outbox item that turns failed (a failed report, or the holder's\n// own give-up at the horizon inside resume) runs the failure handler\n// registered for its type in that same transaction, once, at the\n// transition; duties it opens are folded into the state there (so two\n// failures of one resume cannot open one duty twice) and count into\n// nextDueAt like any new duty. A late delivered after failed runs the\n// ack handler as usual, never the failure handler again\n// - the Encounter latch exception (receive.ts TaskRefusal, Refusal):\n// a refusal carrying `latch` commits exactly that state (checked to\n// shrink encounter.challenges and touch nothing else) and the raised\n// lastWhen, with no journal entry, cache entry, ack, outbound or event;\n// the result stays the refusal (receive: failed at stage 9)\n// - a task handler's refusal commits nothing; its TaskDiscarded (an\n// assembly discarded at a resource limit or rejected, Trust 5365/5366)\n// commits its state and nothing else: disposition `discarded` with the\n// reason, no cache entry, no ack, no event\n// - a transition's `renames` (Applied) are followed in the effect cache by\n// the engine after the transition: each stored ack's recipient.contactId\n// that a rename names moves to its new id; the envelope, sealed to the\n// key agreement, is untouched (an ack re-sent is byte-identical)\n// - a module's ownRetries are task types it re-issues itself: resume\n// never re-emits their outbox items (the horizon still gives them up);\n// its keepKeys name own rkids tick must not tombstone though no live\n// tuple carries them. Both trust the registered modules: no ownership\n// of a type or a key is checked (modules are the library's own, not\n// app plug-ins)\n// - a failure handler gets the retry backoff, so a failure can make work\n// due no earlier than its schedule allows\n// - the timer contract: tick does the time-driven work (expiry,\n// retention, the modules' `retain`), resume the delivery work (retries,\n// due duties, sweeps, acks). nextDueAt names the earliest of both: on\n// resume, the earliest future deadline of the expiry work (prompt\n// expiresAt, effect expiry, the act journal's, a terminal outbox item's\n// and an address key's retention, every module's `deadlines`); on an\n// act or receive, also a deadline the commit newly introduced. The app\n// sets one timer on it and, when it fires, calls tick and then resume\n// (README \"The holder\")\n// - after its own retention, tick runs every module's `retain` hook on\n// the result (the trust module drops in-flight star deliveries whose\n// outbox items have all been retained away); the address keys' retention\n// comes last, its live set and keepKeys read on what the hooks left, so\n// a key whose last claim (an act's pin, 8290) left in this tick leaves in\n// the same tick and no passed key deadline outlives it\n// - without an Access port, EngineOptions.accessFrom (createHolder: the\n// membership module's localAccess) builds one over each preparation's\n// own snapshot, so it describes exactly the state the commit lands on\n// - EngineOptions.check (createHolder's `invariants: true`) runs on every\n// commit after the codec's validation and before the CAS; its throw\n// aborts the operation, nothing commits\n// - tick retains with the key-retention max(P90D, horizonMs): effects\n// with their acks at expiresAt; terminal outbox items once the\n// retention has passed since their last step, unless a kept journal\n// entry names them; an address key not shown for the retention and\n// the own rkid of no tuple that is not deactivated becomes a tombstone —\n// except a member key (a group/… label): an identity context of\n// Identity §6.1 rather than a delivery address of Delivery §5 (one\n// derivation per group, reused whenever the holder is invited to it\n// again), it leaves `addresses` without a tombstone (a point for\n// Delivery 0.82: addresses and identity contexts)\nimport { jcs, b64uOf } from './core.js'\nimport { CODEC, decodeState, encodeState } from './codec.js'\nimport { emptyState, toOpaque, triasOf } from './state.js'\nimport type { ActRecord, Dec, Duty, Effect, HolderState, Millis, OutboxItem, OutboxStep, Prompt, PromptChoice, PromptKind, StoredAck } from './state.js'\nimport type { Access, CarrierKey, DeliveryReport, KeyProvider, KeyRelease, Log, Outbound, PreTransportReason, Recipient, RetryPolicy, Store, StoreSnapshot } from './ports.js'\nimport type { Envelope } from './delivery.js'\nimport type { HolderEvent } from './events.js'\nimport { CryptoUnavailableError, InfraError } from './results.js'\nimport type { ActError, ActResult, InfraErrorCode, ReceiveResult, ReplayResult, ResumeResult } from './results.js'\nimport { randomEntropy } from './entropy.js'\nimport type { Entropy, PlatformRandom } from './entropy.js'\nimport { ED_PKCS8, X_PKCS8 } from './keys-seed.js'\nimport { freezeDeep } from './util-freeze.js'\nimport { ACK_TYPE } from './ack.js'\nimport { challengeAged } from './encounter.js'\nimport { ackOutbound, handlerPrepared, isTaskRefusal, markDelivered, prepareReceive } from './receive.js'\nimport { isTaskDiscarded } from './receive.js'\nimport type { Arrival, Channel, ReceivePlan, ReceivedDocument, TaskDiscarded, TaskRefusal } from './receive.js'\nimport type { CommitOp } from './invariants.js'\nexport type { Arrival, Channel, ReceivedDocument, TaskDiscarded, TaskFailure, TaskRefusal } from './receive.js'\n\n// ── types ──────────────────────────────────────────────────────────────\n\ntype DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never\n\n/** An event as a module emits it; the engine adds eventId, commitSeq, actId. */\nexport type EventDraft = DistributiveOmit<HolderEvent, 'eventId' | 'commitSeq' | 'actId'>\n/** A document as a module issues it; the engine sets attempt 1 and files\n * it in the outbox. `expiresAt`: the sender lifetime its type declares\n * (Delivery RLTP-DEL-7020), after which resume moves it to\n * failed(task-expired) and never hands it out again (6110, 6115). */\nexport type OutboundDraft = Omit<Outbound, 'attempt'> & { expiresAt?: Millis }\n\n/** What a WebCrypto handle must offer; resolved at construction. The\n * default entropy also needs getRandomValues and randomUUID from it. */\nexport type CryptoHandle = { subtle: SubtleCrypto } & Partial<PlatformRandom>\n\n/** What a preparation sees. The snapshot is deep-frozen; `release` is the\n * key release read from its `addresses` (note §3 KeyProvider). */\nexport interface PrepareCtx {\n readonly snapshot: Readonly<HolderState>\n readonly keys: KeyProvider\n readonly entropy: Entropy\n readonly access?: Access\n readonly log?: Log\n readonly crypto: CryptoHandle\n readonly when: Millis\n readonly release: KeyRelease\n}\n\n/** A preparation's value, bound to the store version and commitSeq of the\n * snapshot it ran against. The commit is CAS on exactly that version, so\n * a prepared value never lands on any other state. */\nexport interface Prepared<P = unknown> {\n readonly value: P\n readonly version: string | null\n readonly commitSeq: Dec\n}\n\n/** A holder-local identity rename (2100, 2140): stored acks whose\n * recipient.contactId is one of `from` (for an own rkid in `rkids`, or\n * any where null) now name `to`. */\nexport interface IdentityRename { from: string[], to: string, rkids: string[] | null }\n\n/** A transition's outcome: the next state (a new object; the input is\n * frozen) and what it issues. `renames`: identities the transition\n * rewrote; the engine follows them in the stored acks (only the core\n * writes the effect cache; the sealed envelopes stay untouched). */\nexport interface Applied {\n state: HolderState\n outbound?: OutboundDraft[]\n events?: EventDraft[]\n duties?: Duty[]\n renames?: IdentityRename[]\n}\n\n/** A refused act: nothing commits — except an Encounter aging latch\n * (`latch`, receive.ts TaskRefusal): then exactly that state and the\n * raised lastWhen commit, without a journal entry, outbound or event. */\nexport interface Refusal { ok: false, code: ActError, ref?: string, latch?: HolderState }\n\n/** The Encounter latch exception (receive.ts TaskRefusal): a latch state\n * differs from its base in encounter.challenges alone; every challenge it\n * keeps is byte-identical, and every one it removes is aged at `when`, the\n * commit's authoritative time (Encounter 5190, 5260). Anything else is a\n * programming error and throws. */\nfunction checkLatch (base: Readonly<HolderState>, latch: Readonly<HolderState>, when: Millis): void {\n for (const k of Object.keys(base) as Array<keyof HolderState>) {\n if (k === 'encounter') continue\n if (base[k] !== latch[k]) throw new Error(`engine: an aging latch changed ${k}`)\n }\n const e = base.encounter, l = latch.encounter\n for (const k of Object.keys(e) as Array<keyof HolderState['encounter']>) {\n if (k !== 'challenges' && e[k] !== l[k]) throw new Error(`engine: an aging latch changed encounter.${k}`)\n }\n for (const [v, c] of Object.entries(l.challenges)) {\n if (!Object.hasOwn(e.challenges, v)) throw new Error('engine: an aging latch added a challenge')\n if (jcs(c) !== jcs(e.challenges[v])) throw new Error(`engine: an aging latch changed the challenge ${v}`)\n }\n for (const [v, c] of Object.entries(e.challenges)) {\n if (!Object.hasOwn(l.challenges, v) && !challengeAged(c.tCh, when)) throw new Error(`engine: an aging latch removed the unaged challenge ${v}`)\n }\n}\n\n/** One command of a module. `human` acts need an actId and are journaled. */\nexport interface CommandDef<I = any, P = any> {\n human: boolean\n prepare?: (ctx: PrepareCtx, input: I) => Promise<P>\n /** synchronous and pure: must not mutate `state`, returns a new object */\n apply: (state: Readonly<HolderState>, prepared: Prepared<P>, input: I, when: Millis) => Applied | Refusal\n}\n\n/**\n * A received task type's handler, keyed by its full task URI with\n * version (note §4.3; receive.ts runs it). `decode` is the payload's\n * decoder and validator (stage 7: refuse 'malformed'; stage 8: any other\n * reason); `prepare` the async stage-8 work (MAC checks, key agreement),\n * which may also refuse; `apply` the synchronous stage-9 transition. The\n * core, never the handler, writes the effect-cache entry with its ack in\n * the same commit and releases the events after it; a handler whose\n * state touches `effects` is a programming error and throws.\n */\nexport interface TaskHandler<T = any, P = any> {\n /** the registry entry's proof declaration (Delivery 4.4): whether the\n * document itself carries a `proof` (its artifacts' own MACs and\n * signatures are the payload's business); checked at stage 6 */\n proof: 'absent' | 'required'\n decode: (payload: unknown) => T | TaskRefusal\n /** the acceptance binding of a document that may arrive on an own key no\n * tuple carries yet (receive.ts): the counterpart's key agreement and\n * contact, from the document itself, or a refusal; absent: the arrival\n * tuple's binding (Delivery 4.4) */\n channel?: (state: Readonly<HolderState>, doc: ReceivedDocument<T>, rkid: string) => Channel | TaskRefusal\n /** under the arrival tuple's binding: the document may arrive on a tuple\n * a chaining deactivated, because the handler binds it to the tuples an\n * act pinned and checks that pin itself (Trust 8270); absent: the arrival\n * tuple must be the active head of a live relationship (6190, 6240) */\n pinned?: true\n prepare?: (ctx: PrepareCtx, doc: ReceivedDocument<T>, arrival: Arrival) => Promise<P | TaskRefusal>\n /** a TaskDiscarded commits its `state` as the disposition `discarded`\n * (no effect-cache entry, no ack): a resource-limit discard (Trust 5365) */\n apply: (state: Readonly<HolderState>, prepared: Prepared<P>, doc: ReceivedDocument<T>, arrival: Arrival) => Applied | TaskRefusal | TaskDiscarded\n}\n\n/** What a duty's apply sees beside the state: its preparation. */\nexport interface DutyCtx<P = unknown> {\n readonly prepared: Prepared<P>\n /** the holder's retry backoff (RetryPolicy): the delay before attempt\n * n, for duties that re-schedule themselves (dueAt) */\n readonly backoff: (attempt: number) => number\n}\n\n/**\n * A duty kind's handler at one version (note §2.1 duties), run by\n * resume(when). A duty of the kind at another `v` stays untouched and is\n * announced as duty.unsupported. `awaitHolds` is the module's pure\n * condition for a duty that carries an `awaitHead` (6596); without it\n * such a duty never runs. `apply` returning Applied fulfils the duty\n * (the engine removes it in the same commit); 'not-due' and a refusal\n * leave it as it is.\n */\nexport interface DutyHandler<P = any> {\n v: number\n prepare?: (ctx: PrepareCtx, duty: Duty) => Promise<P>\n awaitHolds?: (state: Readonly<HolderState>, duty: Duty) => boolean\n apply: (state: Readonly<HolderState>, duty: Duty, ctx: DutyCtx<P>, when: Millis) => Applied | Refusal | 'not-due'\n}\n\n/**\n * A module's reconciliation sweep (Trust 5.4), run by resume(when) after\n * the duties, on the state they left. `prepare` runs against resume's\n * snapshot (before the duties); `apply` re-checks every prepared piece\n * against the state it gets and skips one whose inputs moved, reporting\n * `deferred` (resume then names `when` as nextDueAt). `pending` is the\n * pure answer to \"would the sweep issue now?\", as keys: an operation\n * other than resume whose commit adds a key names `when` as its\n * nextDueAt, the app's cue to call resume (engine.ts header).\n */\nexport interface SweepHandler<P = any> {\n pending: (state: Readonly<HolderState>, when: Millis) => string[]\n /** the top-level state parts `pending` reads; where given, an operation\n * that replaced none of them skips `pending` (its keys cannot change) */\n reads?: ReadonlyArray<keyof HolderState>\n prepare: (ctx: PrepareCtx) => Promise<P>\n apply: (state: Readonly<HolderState>, prepared: Prepared<P>, when: Millis) => Applied & { deferred?: boolean }\n}\n\n/**\n * What a verified delivery-ack does for the module whose task type the\n * acknowledged outbox item carries (receive.ts, the common ack path):\n * synchronous and pure, inside the ack's transaction, after the item is\n * marked delivered. Adapter reports never reach it: only a verified ack\n * completes (ports.ts DeliveryReport, 5660).\n */\nexport type AckHandler = (state: Readonly<HolderState>, ref: string, when: Millis) => Applied\n\n/**\n * What the module whose task type an outbox item carries does when that\n * item turns failed (a failed report, or the holder's give-up at the\n * horizon): synchronous and pure, inside that transaction, after the item\n * is marked failed. Its duties are folded into the state (an id already\n * open is kept as it is); it must not write the effect cache.\n */\nexport type FailureHandler = (state: Readonly<HolderState>, ref: string, when: Millis, ctx: { readonly backoff: (attempt: number) => number }) => Applied\n\n/**\n * What a human's choice on a prompt of one kind does in its domain\n * (prompts.ts): synchronous and pure like apply, run inside the decision's\n * own transition, so the domain effect and the closing commit together.\n * It sees the prompt still open; the prompts module removes it after. A\n * refusal refuses the decision.\n */\nexport type DecisionHandler = DecisionFn | DecisionDef\n\n/** The synchronous form: the domain effect needs no preparation. */\nexport type DecisionFn = (state: Readonly<HolderState>, prompt: Readonly<Prompt>, choice: PromptChoice, when: Millis) => Applied | Refusal\n\n/**\n * The prepared form, for a domain effect that signs or seals (the\n * counter-step, the membership accept, the introduction's consent):\n * `prepare` runs in the decision's preparation against its snapshot, the\n * prompt still open there; `apply` gets its value bound to that snapshot.\n */\nexport interface DecisionDef<P = any> {\n prepare?: (ctx: PrepareCtx, prompt: Readonly<Prompt>, choice: PromptChoice) => Promise<P>\n apply: (state: Readonly<HolderState>, prompt: Readonly<Prompt>, choice: PromptChoice, when: Millis, prepared: Prepared<P>) => Applied | Refusal\n}\n\n/** A domain module: what it registers with the engine. */\nexport interface HolderModule {\n name: string\n commands: Record<string, CommandDef>\n tasks?: Record<string, TaskHandler>\n duties?: Record<string, DutyHandler>\n /** reconciliation sweeps, run by resume after the duties, by name */\n sweeps?: Record<string, SweepHandler>\n /** ack handlers by the full task type URI of the acknowledged document;\n * at most one per type across all modules */\n acks?: Record<string, AckHandler>\n /** failure handlers by the full task type URI of the failed document;\n * at most one per type across all modules */\n failures?: Record<string, FailureHandler>\n /** task types whose documents the module re-issues itself (a fresh\n * document, never a reproduction): the outbox never re-emits their\n * items and gives them up only at the horizon. Trusted as registered:\n * the engine checks no ownership of the types named, since modules are\n * part of the library, not app plug-ins */\n ownRetries?: readonly string[]\n /** own rkids the module still needs although no live tuple carries\n * them: tick does not tombstone them. Trusted as registered, like\n * ownRetries: no check that the module has any claim to the keys */\n keepKeys?: (state: Readonly<HolderState>, when: Millis) => Iterable<string>\n /** the module's own retention, run by tick after the engine's: pure and\n * synchronous, returning the same state object where nothing goes */\n retain?: (state: Readonly<HolderState>, when: Millis) => HolderState\n /** the times at which the module's `retain` (run by tick) changes the\n * state: counted into nextDueAt (the timer contract, the header) */\n deadlines?: (state: Readonly<HolderState>) => Iterable<Millis>\n /** at most one handler per prompt kind across all modules; collected by\n * createHolder for the prompts module (prompts.ts) */\n decisions?: Partial<Record<PromptKind, DecisionHandler>>\n /** run in the stage-9 transaction of every document disposed `unique`\n * (through a task handler, after it; or a verified delivery-ack, after\n * its ack handler), on the state it left: pure and\n * synchronous, returning the same object where nothing changes; it must\n * not write the effect cache (the readiness of a tuple, Message Tasks\n * 5.1) */\n accepted?: (state: Readonly<HolderState>, doc: ReceivedDocument, arrival: Arrival) => HolderState\n}\n\n/** The ports of a holder (note §3); retry fields fall back to ENGINE_DEFAULTS. */\nexport interface EnginePorts {\n store: Store\n keys: KeyProvider\n entropy?: Entropy\n log?: Log\n access?: Access\n retry?: Partial<RetryPolicy>\n crypto?: CryptoHandle\n}\n\n/** Engine options beside the ports. `check` runs on every commit before\n * the store's CAS, on the state read and the state about to be written,\n * with the operation; a throw aborts the operation and nothing commits\n * (createHolder's `invariants: true`, invariants.ts). */\nexport interface EngineOptions {\n check?: (before: Readonly<HolderState>, after: Readonly<HolderState>, op: CommitOp) => void\n /** where no Access port is given: an Access over each preparation's own\n * snapshot (createHolder passes the membership module's localAccess) */\n accessFrom?: (state: Readonly<HolderState>) => Access\n}\n\n/** Announced after every commit of this engine, with its commitSeq. */\nexport type CommitListener = (commit: { commitSeq: Dec, events: HolderEvent[] }) => void\n\n/** A deep-frozen decoded state and its commitSeq. */\nexport interface EngineSnapshot { state: Readonly<HolderState>, commitSeq: Dec }\n\nexport interface Engine {\n /** the names registered at construction, frozen */\n readonly registry: Readonly<{ commands: readonly string[], tasks: readonly string[], duties: readonly string[], sweeps: readonly string[] }>\n act (command: string, input: unknown, when: Millis, opts?: { actId?: string }): Promise<ActResult>\n /** expiry and retention: effects, prompts, the act journal, terminal\n * outbox items, address keys to tombstones; raises lastWhen */\n tick (when: Millis): Promise<ActResult>\n /** re-emits due outbox items (attempt + 1) or gives them up, runs due\n * duties, re-emits unsent acks */\n resume (when: Millis): Promise<ResumeResult>\n /** an adapter's delivery report (Delivery §6.1); on an ack's digest it\n * marks the stored ack sent */\n report (report: DeliveryReport, when: Millis): Promise<ActResult>\n /** an arriving envelope: Delivery §6.2 stages 1–9 (receive.ts) */\n receive (env: unknown, when: Millis): Promise<ReceiveResult>\n subscribe (listener: CommitListener): () => void\n snapshot (): Promise<EngineSnapshot>\n /** the journaled result of the human act `actId`, or `unknown-act`: a\n * pure read in the queue — never runs, gives up or commits anything */\n replay (actId: string, when: Millis): Promise<ReplayResult>\n /** what the holder keeps for transport at `when` (Delivery RLTP-DEL-6120):\n * refused until a resume of this engine has completed */\n pendingTransport (when: Millis): Promise<TransportView | TransportRefusal>\n /** whether `entry`, issued by this engine, may be handed over now: open,\n * still pending in the store, its envelope unchanged, before notAfter */\n mayHandOver (entry: TransportEntry, when: Millis): Promise<boolean>\n /** the hand-over itself: checks as mayHandOver, then calls `start` inside\n * the engine's queue, so no operation of this engine runs between the\n * check and the start of the deposit; `start` returns whether it started\n * one (a resend entry's grant is used up then). Resolves to the check's\n * verdict and `start`'s answer together; false when closed */\n handOver (entry: TransportEntry, when: Millis, start: () => boolean): Promise<boolean>\n /** ends this engine: later operations reject with InfraError('closed');\n * resolves once the operation running at the call has finished, after\n * which this engine commits nothing more */\n close (): Promise<void>\n readonly closed: boolean\n}\n\n// ── defaults ───────────────────────────────────────────────────────────\n\nconst DAY = 86_400_000\n\n/** Defaults of the retry policy and the retention it implies. */\nexport const ENGINE_DEFAULTS = Object.freeze({\n /** 30 s, doubling, at most 6 h */\n backoff: (attempt: number): number => Math.min(30_000 * 2 ** Math.max(0, attempt - 1), 6 * 3_600_000),\n /** P7D, inside Delivery's give-up range [P1D, P90D]; the only give-up */\n horizonMs: 7 * DAY,\n commitAttempts: 8,\n /** max(P90D, horizonMs) with the default horizon */\n retentionMs: 90 * DAY,\n})\n\n/** Delivery's give-up range for horizonMs: [P1D, P90D]. */\nconst HORIZON_MIN = DAY\nconst HORIZON_MAX = 90 * DAY\n\nconst BUILTIN = ['tick', 'resume', 'report', 'receive'] as const\n\n/** One document the holder keeps for transport (Delivery RLTP-DEL-6120):\n * issued by one engine's pendingTransport, deep-frozen; only that engine's\n * mayHandOver accepts it, and only while it stays pending. */\nexport interface TransportEntry {\n readonly digest: string\n /** an outbox document, or a stored acknowledgement */\n readonly kind: 'document' | 'ack'\n readonly envelope: Envelope\n readonly type: string\n readonly threadId: string\n readonly recipient: Recipient\n /** emissions on the holder's retry schedule so far */\n readonly attempt: number\n /** the first submission as the holder recorded it (an ack: its effect's\n * commit): an adapter's own horizon counts from here, never from when\n * it took the entry over (Delivery RLTP-DEL-6130) */\n readonly since: Millis\n /** the send deadline: from then on it is given up (or, an ack, no longer\n * offered) and never handed over again */\n readonly notAfter: Millis\n /** when the holder's retry schedule next re-offers it (absent: due, or held) */\n readonly nextAttemptAt?: Millis\n /** the adapter's last report on it was awaiting-transport */\n readonly held?: PreTransportReason\n /** a duplicate's answer due (Delivery RLTP-DEL-6330, 6335), beside the\n * ack's retries: its number (StoredAck.answers), its deadline the\n * effect's retention; its begun hand-over ends it */\n readonly resend?: number\n}\n\n/** pendingTransport's answer: the set at `at` — the `when` asked for, or\n * the holder's lastWhen if that is later — and the commit it was read at. */\nexport interface TransportView {\n readonly ok: true\n readonly commitSeq: Dec\n readonly at: Millis\n readonly entries: readonly TransportEntry[]\n}\n\n/** pendingTransport refuses until a resume of this engine has completed:\n * the transitions due at the opening come first (RLTP-DEL-6130, 6135). */\nexport interface TransportRefusal { readonly ok: false, readonly code: 'not-resumed' }\nconst TASK_URI = /^[a-z][a-z0-9+.-]*:\\S+\\/[0-9]+\\.[0-9]+$/\n\n// ── helpers ────────────────────────────────────────────────────────────\n\nconst ALGORITHMS = ['Ed25519', 'X25519', 'HKDF', 'HMAC', 'AES-GCM', 'SHA-256'] as const\n\nconst concat = (a: Uint8Array, b: Uint8Array): Uint8Array => { const o = new Uint8Array(a.length + b.length); o.set(a); o.set(b, a.length); return o }\n\n/** Resolves the WebCrypto handle and probes every algorithm the library uses. */\nasync function resolveCrypto (c?: CryptoHandle): Promise<CryptoHandle> {\n const h = c ?? (globalThis.crypto as CryptoHandle | undefined)\n const S = h?.subtle\n if (!S || typeof S.importKey !== 'function' || typeof S.digest !== 'function') throw new CryptoUnavailableError(['subtle', ...ALGORITHMS])\n const k = new Uint8Array(32).fill(1)\n const probes: Record<typeof ALGORITHMS[number], () => Promise<unknown>> = {\n Ed25519: () => S.importKey('pkcs8', concat(ED_PKCS8, k), { name: 'Ed25519' }, false, ['sign']),\n X25519: () => S.importKey('pkcs8', concat(X_PKCS8, k), { name: 'X25519' }, false, ['deriveBits']),\n HKDF: () => S.importKey('raw', k, 'HKDF', false, ['deriveBits']),\n HMAC: () => S.importKey('raw', k, { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']),\n 'AES-GCM': () => S.importKey('raw', k, { name: 'AES-GCM' }, false, ['encrypt']),\n 'SHA-256': () => S.digest('SHA-256', k),\n }\n const ok = await Promise.all(ALGORITHMS.map(async (a) => { try { await probes[a](); return true } catch { return false } }))\n const missing = ALGORITHMS.filter((_, i) => !ok[i])\n if (missing.length) throw new CryptoUnavailableError(missing)\n return h as CryptoHandle\n}\n\nconst te = new TextEncoder()\n/** The stack's document digest (u + multihash sha2-256 over JCS), on the resolved handle. */\nconst digestOf = async (S: SubtleCrypto, x: unknown): Promise<string> =>\n 'u' + b64uOf(concat(Uint8Array.from([0x12, 0x20]), new Uint8Array(await S.digest('SHA-256', te.encode(jcs(x))))))\n\n/** Drops undefined object members (as JSON does) without hiding what jcs refuses. */\nconst dropUndefined = (x: unknown): unknown => {\n if (x === null || typeof x !== 'object') return x\n if (Object.getOwnPropertySymbols(x).length > 0) return x\n if (Array.isArray(x)) {\n if (Object.getOwnPropertyNames(x).length !== x.length + 1) return x\n for (let i = 0; i < x.length; i++) if (!(i in x)) return x\n return x.map(dropUndefined)\n }\n const proto = Object.getPrototypeOf(x)\n if (proto !== null && proto !== Object.prototype) return x\n if (Object.getOwnPropertyNames(x).length !== Object.keys(x).length) return x\n // own data properties, never assignment: a \"__proto__\" key stays a key\n // (assignment would hit the inherited setter and change the prototype)\n const out: Record<string, unknown> = {}\n for (const [k, v] of Object.entries(x)) {\n if (v !== undefined) Object.defineProperty(out, k, { value: dropUndefined(v), enumerable: true, writable: true, configurable: true })\n }\n return out\n}\n\n/** The act input as bound at the call: canonical JSON, deep-frozen. A\n * \"__proto__\" member is an ordinary key throughout: jcs serializes own\n * keys (Object.keys) and JSON.parse defines own data properties, so it is\n * hashed, journaled and handed to prepare/apply like any other key. */\nconst bindInput = <T>(x: T): T => freezeDeep(JSON.parse(jcs(x === undefined ? null : dropUndefined(x))) as T)\n\n/** when + ceil(delay), clamped to safe integer milliseconds. */\nconst dueAt = (when: Millis, delay: number): Millis => {\n const d = Number.isNaN(delay) ? 0 : Math.max(0, Math.ceil(delay))\n return Math.min(when + d, Number.MAX_SAFE_INTEGER)\n}\n\n/** A port whose rejections become InfraError(code); InfraError passes as is. */\nfunction guard<T extends object> (port: T, names: ReadonlyArray<keyof T & string>, code: InfraErrorCode, wrapResult?: (r: any) => unknown): T {\n const out: Record<string, unknown> = {}\n for (const n of names) {\n out[n] = async (...args: unknown[]) => {\n let r: unknown\n try { r = await (port[n] as (...a: unknown[]) => Promise<unknown>).apply(port, args) } catch (e) {\n throw e instanceof InfraError ? e : new InfraError(code, `${code}: ${n} failed`, { cause: e })\n }\n return wrapResult ? wrapResult(r) : r\n }\n }\n return Object.freeze(out) as T\n}\n\nconst inc = (d: Dec): Dec => (BigInt(d) + 1n).toString()\n\nconst releaseOf = (state: Readonly<HolderState>): KeyRelease => (rkid) => {\n if (state.addresses.tombstones.includes(rkid)) return { status: 'retired' }\n if (!Object.hasOwn(state.addresses.keys, rkid)) return { status: 'unknown' }\n const k = state.addresses.keys[rkid]\n return k.retiredAt !== undefined ? { status: 'retired' } : { status: 'live', label: k.label }\n}\n\nconst isRefusal = (r: unknown): r is Refusal => (r as Refusal)?.ok === false\n\n/** The effect cache with the stored acks' recipients renamed. */\nfunction renameAcks (effects: HolderState['effects'], renames: readonly IdentityRename[]): HolderState['effects'] {\n let out: HolderState['effects'] | null = null\n for (const [d, e] of Object.entries(effects)) {\n let a = e.ack\n if (!a) continue\n for (const r of renames) {\n if (r.from.includes(a.recipient.contactId) && (r.rkids === null || r.rkids.includes(a.recipient.via ?? a.recipient.rkid))) a = { ...a, recipient: { ...a.recipient, contactId: r.to } }\n }\n if (a !== e.ack) (out ??= { ...effects })[d] = { ...e, ack: a }\n }\n return out ?? effects\n}\n\nconst closedError = (): InfraError => new InfraError('closed', 'the holder was closed')\n\nconst checkWhen = (when: unknown): void => {\n if (!Number.isSafeInteger(when) || (when as number) < 0) throw new TypeError(`when must be non-negative integer milliseconds, got ${String(when)}`)\n}\n\n// ── internal command form: built-ins may also re-emit and schedule ─────\n\ninterface InternalApplied extends Applied {\n /** outbox items re-emitted (already in state, attempt set) */\n emit?: Outbound[]\n /** outbound handed out without an outbox item: acks (receive.ts). It\n * forces no commit; with nothing else to commit it is released as is */\n release?: Outbound[]\n nextDueAt?: Millis\n /** passed through to the caller of #run */\n detail?: unknown\n}\n/** A built-in's end without a commit, lastWhen included, carrying its answer. */\ninterface Halt { halt: true, detail: unknown }\ninterface InternalDef {\n human: boolean\n prepare?: (ctx: PrepareCtx, input: any) => Promise<unknown>\n apply: (state: Readonly<HolderState>, prepared: Prepared<any>, input: any, when: Millis) => InternalApplied | Refusal | Halt\n}\n\n/** Outbound order of one commit: re-emissions, then released acks, then new documents. */\ntype RunResult = { ok: true, outbound: Outbound[], events: HolderEvent[], nextDueAt?: Millis, detail?: unknown } | Refusal | Halt\n\n/** A duty's dueAt; absent counts as 0 (due always). */\nconst dutyDue = (d: Duty): number => (Number.isSafeInteger(d.dueAt) ? d.dueAt as number : 0)\n\n/** Due, and not waiting on a head its handler's awaitHolds denies (none: waits forever). */\nconst dutyRunnable = (d: Duty, h: DutyHandler, state: Readonly<HolderState>, when: Millis): boolean => {\n if (dutyDue(d) > when) return false\n const awaits = (d as { awaitHead?: unknown }).awaitHead\n return typeof awaits !== 'string' || (h.awaitHolds?.(state, d) ?? false)\n}\n\nconst isHalt = (r: unknown): r is Halt => (r as Halt)?.halt === true\n\nconst actResult = (r: RunResult): ActResult => {\n if (isHalt(r)) throw new Error('engine: an act does not halt')\n return r.ok ? { ok: true, outbound: r.outbound, events: r.events, ...(r.nextDueAt !== undefined ? { nextDueAt: r.nextDueAt } : {}) } : r\n}\n\ninterface Policy { backoff: (attempt: number) => number, horizonMs: number, commitAttempts: number, retentionMs: number }\n\n// ── the engine ─────────────────────────────────────────────────────────\n\nclass HolderEngine implements Engine {\n readonly registry: Engine['registry']\n readonly #store: Store\n readonly #ports: EnginePorts\n /** the ports a preparation sees, rejections typed (InfraError) */\n readonly #keys: KeyProvider\n readonly #log?: Log\n readonly #access?: Access\n readonly #crypto: CryptoHandle\n readonly #entropy: Entropy\n readonly #policy: Policy\n readonly #commands: ReadonlyMap<string, InternalDef>\n readonly #tasks: ReadonlyMap<string, TaskHandler>\n readonly #duties: ReadonlyMap<string, DutyHandler>\n readonly #sweeps: ReadonlyMap<string, SweepHandler>\n readonly #acks: ReadonlyMap<string, AckHandler>\n readonly #failures: ReadonlyMap<string, FailureHandler>\n readonly #ownRetries: ReadonlySet<string>\n readonly #keepKeys: ReadonlyArray<(state: Readonly<HolderState>, when: Millis) => Iterable<string>>\n readonly #retain: ReadonlyArray<(state: Readonly<HolderState>, when: Millis) => HolderState>\n readonly #accepted: ReadonlyArray<NonNullable<HolderModule['accepted']>>\n readonly #deadlines: ReadonlyArray<(state: Readonly<HolderState>) => Iterable<Millis>>\n readonly #builtins: Readonly<Record<typeof BUILTIN[number], InternalDef>>\n readonly #check?: EngineOptions['check']\n readonly #accessFrom?: EngineOptions['accessFrom']\n readonly #listeners = new Set<CommitListener>()\n #chain: Promise<unknown> = Promise.resolve()\n /** a commit whose outcome is unknown, settled before the next operation */\n #unsettled: { text: string, actId?: string, commitSeq: Dec, events: HolderEvent[] } | null = null\n /** close() was called: nothing more runs, nothing issued authorizes */\n #closed = false\n /** a resume of this engine completed (and none threw since) */\n #resumed = false\n /** the transport entries this engine issued (RLTP-DEL-6130) */\n readonly #issued = new WeakSet<object>()\n\n constructor (ports: EnginePorts, crypto: CryptoHandle, modules: readonly HolderModule[], opts: EngineOptions = {}) {\n if (opts.check !== undefined && typeof opts.check !== 'function') throw new TypeError('check must be a function')\n this.#check = opts.check\n if (opts.accessFrom !== undefined && typeof opts.accessFrom !== 'function') throw new TypeError('accessFrom must be a function')\n this.#accessFrom = opts.accessFrom\n this.#store = ports.store\n this.#ports = ports\n this.#crypto = crypto\n this.#entropy = ports.entropy ?? randomEntropy(crypto)\n const r = ports.retry ?? {}\n const horizonMs = r.horizonMs ?? ENGINE_DEFAULTS.horizonMs\n const backoff = r.backoff ?? ENGINE_DEFAULTS.backoff\n const commitAttempts = r.commitAttempts ?? ENGINE_DEFAULTS.commitAttempts\n if (!Number.isSafeInteger(horizonMs) || horizonMs < HORIZON_MIN || horizonMs > HORIZON_MAX) throw new RangeError(`retry.horizonMs must be integer ms within [P1D, P90D], got ${horizonMs}`)\n if (typeof backoff !== 'function') throw new RangeError('retry.backoff must be a function')\n for (let n = 1; n <= 3; n++) {\n const d = backoff(n)\n if (typeof d !== 'number' || !Number.isFinite(d) || d < 0) throw new RangeError(`retry.backoff(${n}) must be a finite non-negative number, got ${d}`)\n }\n if (!Number.isSafeInteger(commitAttempts) || commitAttempts < 1) throw new RangeError('retry.commitAttempts must be a positive integer')\n this.#policy = Object.freeze({ backoff, horizonMs, commitAttempts, retentionMs: Math.max(ENGINE_DEFAULTS.retentionMs, horizonMs) })\n const carrierKey = (k: CarrierKey): CarrierKey => Object.freeze({ principal: k.principal, sign: guard(k, ['sign'], 'key-provider').sign })\n const base = guard(ports.keys, ['anchorOf', 'sign', 'agree'], 'key-provider')\n this.#keys = Object.freeze({\n anchorOf: base.anchorOf, sign: base.sign, agree: base.agree,\n carrierPrincipal: guard(ports.keys, ['carrierPrincipal'], 'key-provider', carrierKey).carrierPrincipal,\n })\n if (ports.log) this.#log = guard(ports.log, ['head', 'at', 'append'], 'log')\n if (ports.access) this.#access = guard(ports.access, ['memberships', 'membership'], 'access')\n\n const commands = new Map<string, InternalDef>()\n const tasks = new Map<string, TaskHandler>()\n const duties = new Map<string, DutyHandler>()\n const sweeps = new Map<string, SweepHandler>()\n const acks = new Map<string, AckHandler>()\n const failures = new Map<string, FailureHandler>()\n const ownRetries = new Set<string>()\n const keepKeys: Array<(state: Readonly<HolderState>, when: Millis) => Iterable<string>> = []\n const retain: Array<(state: Readonly<HolderState>, when: Millis) => HolderState> = []\n const accepted: Array<NonNullable<HolderModule['accepted']>> = []\n const deadlines: Array<(state: Readonly<HolderState>) => Iterable<Millis>> = []\n const names = new Set<string>()\n for (const m of modules) {\n if (!m || typeof m.name !== 'string' || !m.name) throw new TypeError('a module needs a name')\n if (names.has(m.name)) throw new Error(`duplicate module ${m.name}`)\n names.add(m.name)\n for (const [name, def] of Object.entries(m.commands ?? {})) {\n if (commands.has(name) || (BUILTIN as readonly string[]).includes(name)) throw new Error(`duplicate command ${name} (module ${m.name})`)\n if (typeof def?.apply !== 'function' || typeof def.human !== 'boolean') throw new TypeError(`command ${name} (module ${m.name}) needs human and apply`)\n commands.set(name, Object.freeze({ ...def }))\n }\n for (const [uri, h] of Object.entries(m.tasks ?? {})) {\n if (!TASK_URI.test(uri)) throw new Error(`not a full task URI with version: ${uri} (module ${m.name})`)\n if (uri === ACK_TYPE) throw new Error(`${uri} is built in: acks take the common path (module ${m.name})`)\n if (tasks.has(uri)) throw new Error(`duplicate task ${uri} (module ${m.name})`)\n if (typeof h?.apply !== 'function' || typeof h.decode !== 'function') throw new TypeError(`task ${uri} (module ${m.name}) needs decode and apply`)\n if (h.proof !== 'absent' && h.proof !== 'required') throw new TypeError(`task ${uri} (module ${m.name}) needs its proof declaration: 'absent' or 'required'`)\n if (h.channel !== undefined && typeof h.channel !== 'function') throw new TypeError(`task ${uri} (module ${m.name}): channel must be a function`)\n if (h.pinned !== undefined && (h.pinned !== true || h.channel !== undefined)) throw new TypeError(`task ${uri} (module ${m.name}): pinned is true or absent, and only under the tuple binding`)\n tasks.set(uri, Object.freeze({ ...h }))\n }\n for (const [kind, h] of Object.entries(m.duties ?? {})) {\n if (duties.has(kind)) throw new Error(`duplicate duty ${kind} (module ${m.name})`)\n if (typeof h?.apply !== 'function') throw new TypeError(`duty ${kind} (module ${m.name}) needs apply`)\n if (!Number.isSafeInteger(h.v) || h.v < 1) throw new TypeError(`duty ${kind} (module ${m.name}) needs its version v, a positive integer`)\n if (h.awaitHolds !== undefined && typeof h.awaitHolds !== 'function') throw new TypeError(`duty ${kind} (module ${m.name}): awaitHolds must be a function`)\n duties.set(kind, Object.freeze({ ...h }))\n }\n for (const [name, h] of Object.entries(m.sweeps ?? {})) {\n if (sweeps.has(name)) throw new Error(`duplicate sweep ${name} (module ${m.name})`)\n if (typeof h?.apply !== 'function' || typeof h.prepare !== 'function' || typeof h.pending !== 'function') throw new TypeError(`sweep ${name} (module ${m.name}) needs pending, prepare and apply`)\n sweeps.set(name, Object.freeze({ ...h }))\n }\n for (const [uri, h] of Object.entries(m.acks ?? {})) {\n if (!TASK_URI.test(uri)) throw new Error(`not a full task URI with version: ${uri} (module ${m.name})`)\n if (acks.has(uri)) throw new Error(`duplicate ack handler ${uri} (module ${m.name})`)\n if (typeof h !== 'function') throw new TypeError(`ack handler ${uri} (module ${m.name}) must be a function`)\n acks.set(uri, h)\n }\n for (const [uri, h] of Object.entries(m.failures ?? {})) {\n if (!TASK_URI.test(uri)) throw new Error(`not a full task URI with version: ${uri} (module ${m.name})`)\n if (failures.has(uri)) throw new Error(`duplicate failure handler ${uri} (module ${m.name})`)\n if (typeof h !== 'function') throw new TypeError(`failure handler ${uri} (module ${m.name}) must be a function`)\n failures.set(uri, h)\n }\n for (const uri of m.ownRetries ?? []) {\n if (!TASK_URI.test(uri)) throw new Error(`not a full task URI with version: ${uri} (module ${m.name})`)\n ownRetries.add(uri)\n }\n if (m.keepKeys !== undefined) {\n if (typeof m.keepKeys !== 'function') throw new TypeError(`keepKeys (module ${m.name}) must be a function`)\n keepKeys.push(m.keepKeys)\n }\n if (m.retain !== undefined) {\n if (typeof m.retain !== 'function') throw new TypeError(`retain (module ${m.name}) must be a function`)\n retain.push(m.retain)\n }\n if (m.deadlines !== undefined) {\n if (typeof m.deadlines !== 'function') throw new TypeError(`deadlines (module ${m.name}) must be a function`)\n deadlines.push(m.deadlines)\n }\n if (m.accepted !== undefined) {\n if (typeof m.accepted !== 'function') throw new TypeError(`accepted (module ${m.name}) must be a function`)\n accepted.push(m.accepted)\n }\n }\n this.#commands = commands\n this.#tasks = tasks\n this.#duties = duties\n this.#sweeps = sweeps\n this.#acks = acks\n this.#failures = failures\n this.#ownRetries = ownRetries\n this.#keepKeys = Object.freeze(keepKeys)\n this.#deadlines = Object.freeze(deadlines)\n this.#retain = Object.freeze(retain)\n this.#accepted = Object.freeze(accepted)\n this.#builtins = Object.freeze({ tick: this.#tickDef(), resume: this.#resumeDef(), report: this.#reportDef(), receive: this.#receiveDef() })\n this.registry = Object.freeze({\n commands: Object.freeze([...commands.keys()]),\n tasks: Object.freeze([...tasks.keys()]),\n duties: Object.freeze([...duties.keys()]),\n sweeps: Object.freeze([...sweeps.keys()]),\n })\n }\n\n // ── loading ──────────────────────────────────────────────────────────\n\n async #readRaw (): Promise<StoreSnapshot> {\n try { return await this.#store.read() } catch (e) { throw new InfraError('store-read', undefined, { cause: e }) }\n }\n\n async #read (): Promise<{ state: Readonly<HolderState>, version: string | null }> {\n const snap = await this.#readRaw()\n if (snap.state === null) throw new Error('engine: the store holds no state')\n return { state: freezeDeep(decodeState(snap.state)), version: snap.version }\n }\n\n /** Initialise an empty store with the empty state, or check the stored one decodes. */\n async load (): Promise<void> {\n const snap = await this.#readRaw()\n if (snap.state !== null) { decodeState(snap.state); return }\n let cause: unknown\n try { if ((await this.#store.commit(null, toOpaque(emptyState(CODEC)))).ok) return } catch (e) { cause = e }\n const again = await this.#readRaw() // conflict or unknown outcome: someone (maybe we) wrote\n if (again.state === null) throw new InfraError('store-commit', 'could not initialise the store', { cause })\n decodeState(again.state)\n }\n\n // ── the queue ────────────────────────────────────────────────────────\n\n #enqueue<T> (fn: () => Promise<T>): Promise<T> {\n if (this.#closed) return Promise.reject(closedError())\n const p = this.#chain.then(async () => {\n if (this.#closed) throw closedError()\n await this.#settle()\n return fn()\n })\n this.#chain = p.then(() => undefined, () => undefined)\n return p\n }\n\n async #settle (): Promise<void> {\n const u = this.#unsettled\n if (!u) return\n const { state } = await this.#read()\n // the journal entry at that commitSeq with these very events: another\n // opening's commit of the same act at the same commitSeq is not this one\n const landed = jcs(state) === u.text ||\n (u.actId !== undefined && Object.hasOwn(state.acts, u.actId) && state.acts[u.actId].commitSeq === u.commitSeq &&\n jcs(state.acts[u.actId].events) === jcs(u.events))\n this.#unsettled = null\n if (landed) this.#announce(u.commitSeq, u.events)\n }\n\n #announce (commitSeq: Dec, events: HolderEvent[]): void {\n for (const l of [...this.#listeners]) {\n // a listener's failure (throw or rejection) neither undoes nor blocks the commit\n try {\n const r: unknown = l({ commitSeq, events })\n if (r !== null && typeof r === 'object' && typeof (r as Promise<unknown>).then === 'function') (r as Promise<unknown>).then(undefined, () => undefined)\n } catch { /* dropped */ }\n }\n }\n\n // ── the four steps ───────────────────────────────────────────────────\n\n /** `input` is already bound (bindInput); `inputHash` its journal hash for human acts. */\n async #run (def: InternalDef, op: CommitOp, input: unknown, when: Millis, actId?: string, inputHash?: string): Promise<RunResult> {\n /** a replay's give-up work (below): its timer, carried to the replay's answer */\n let replayWake: Millis | undefined\n /** give-ups a replay ran: each moves at least one of its finitely many\n * journaled documents to failed, so they are bounded by that number */\n let gaveUp = 0\n for (let attempt = 1; attempt <= this.#policy.commitAttempts; attempt++) {\n // 1 — snapshot, when\n const { state, version } = await this.#read()\n const at = Math.max(when, state.lastWhen)\n if (def.human && Object.hasOwn(state.acts, actId!)) {\n const rec = state.acts[actId!]\n if (rec.inputHash !== inputHash) return { ok: false, code: 'actid-conflict' }\n const events: HolderEvent[] = structuredClone(rec.events) as HolderEvent[]\n // the act's documents are handed out again only while live; one past\n // its sender lifetime or the horizon is given up first, in an\n // operation of its own on the engine's one commit path (as resume's\n // give-up: Delivery 6110, 6115), and is never handed out — the\n // journal's events are not announced again\n const live: string[] = []\n const expired: string[] = []\n for (const d of rec.outboundDigests) {\n const it = this.#itemOf(state, d)\n const t = triasOf(it)\n if (t === 'delivered' || t === 'failed') continue\n if (this.#giveUp(it, at)) expired.push(d); else live.push(d)\n }\n if (expired.length) {\n const g = await this.#run(this.#giveUpDef(), { kind: 'resume' }, expired, at)\n if (!isHalt(g) && g.ok && g.nextDueAt !== undefined) replayWake = replayWake === undefined ? g.nextDueAt : Math.min(replayWake, g.nextDueAt)\n // re-read: the act's documents as the give-up left them, outside\n // the CAS budget (no conflict happened); bounded by the act's documents\n if (gaveUp++ <= rec.outboundDigests.length) attempt--\n continue\n }\n // the timer as the act named it: the next attempt of its live documents\n // (and a give-up's own timer), so a repeat answers as the act did\n const soon = (t: Millis | null | undefined): void => { if (t !== undefined && t !== null) replayWake = replayWake === undefined ? t : Math.min(replayWake, t) }\n for (const d of live) { const it = this.#itemOf(state, d); soon(it.nextAttemptAt); soon(notAfterOf(it, this.#policy.horizonMs)) }\n return { ok: true, outbound: live.map((d) => this.#outboundOf(state, d)), events: freezeDeep(events), ...(replayWake !== undefined ? { nextDueAt: replayWake } : {}) }\n }\n // 2 — prepare, bound to this snapshot\n const ctx: PrepareCtx = Object.freeze({\n snapshot: state, keys: this.#keys, entropy: this.#entropy, access: this.#access ?? this.#accessFrom?.(state), log: this.#log,\n crypto: this.#crypto, when: at, release: releaseOf(state),\n })\n const value = def.prepare ? await def.prepare(ctx, input) : undefined\n const prepared: Prepared = Object.freeze({ value, version, commitSeq: state.commitSeq })\n // 3 — apply, assemble, CAS\n const r = def.apply(state, prepared, input, at)\n if (isHalt(r)) return r\n if (isRefusal(r)) {\n const refusal: Refusal = { ok: false, code: r.code, ...(r.ref !== undefined ? { ref: r.ref } : {}) }\n if (!r.latch) return refusal\n // the Encounter latch exception: the latch and lastWhen commit, nothing else\n checkLatch(state, r.latch, at)\n const seq = inc(state.commitSeq)\n const next: HolderState = { ...r.latch, commitSeq: seq, lastWhen: at }\n const text = encodeState(next)\n if (this.#check) this.#check(state, next, op.kind === 'act' ? { ...op, events: [] } : op)\n let res\n try { res = await this.#store.commit(version, toOpaque(next)) } catch (e) {\n this.#unsettled = { text, commitSeq: seq, events: [] }\n throw new InfraError('unknown-commit-outcome', undefined, { cause: e })\n }\n if (!res.ok) continue\n this.#announce(seq, [])\n return refusal\n }\n const drafts = r.outbound ?? []\n const eventDrafts = r.events ?? []\n const newDuties = r.duties ?? []\n const emit = r.emit ?? []\n const release = r.release ?? []\n // resume computes its own timer; every other operation names the duty\n // work it opened or unblocked, the app's cue to call resume\n const wake = r.nextDueAt ?? (def === this.#builtins.resume ? undefined : this.#wake(state, r.state, newDuties, at))\n const extra = { ...(wake !== undefined ? { nextDueAt: wake } : {}), ...(r.detail !== undefined ? { detail: r.detail } : {}) }\n if (!def.human && r.state === state && !r.renames?.length && at === state.lastWhen && !drafts.length && !eventDrafts.length && !newDuties.length && !emit.length) {\n return { ok: true, outbound: [...release], events: [], ...extra }\n }\n const seq = inc(state.commitSeq)\n const events: HolderEvent[] = eventDrafts.map((e, i) => ({ ...e, eventId: `${seq}.${i}`, commitSeq: seq, ...(def.human ? { actId } : {}) }) as HolderEvent)\n freezeDeep(events)\n const outbound: Outbound[] = drafts.map((o) => ({ digest: o.digest, envelope: o.envelope, type: o.type, threadId: o.threadId, recipient: o.recipient, attempt: 1 }))\n const outbox: Record<string, OutboxItem> = { ...r.state.outbox }\n for (const [i, o] of outbound.entries()) {\n if (Object.hasOwn(outbox, o.digest)) throw new Error(`engine: outbound ${o.digest} is already in the outbox`)\n const life = drafts[i].expiresAt\n if (life !== undefined && (!Number.isSafeInteger(life) || life <= at)) throw new Error(`engine: outbound ${o.digest} expires at ${life}, not after ${at}`)\n outbox[o.digest] = {\n type: o.type, threadId: o.threadId, recipient: o.recipient, envelope: o.envelope, attempt: 1,\n history: [{ status: 'submitted', at, attempt: 1 }], nextAttemptAt: dueAt(at, this.#policy.backoff(1)),\n ...(life !== undefined ? { expiresAt: life } : {}),\n }\n }\n const duties: Record<string, Duty> = { ...r.state.duties }\n for (const d of newDuties) {\n if (Object.hasOwn(duties, d.id)) throw new Error(`engine: duty ${d.id} already exists`)\n duties[d.id] = d\n }\n const acts = def.human\n ? { ...r.state.acts, [actId!]: { actId: actId!, inputHash: inputHash!, commitSeq: seq, outboundDigests: outbound.map((o) => o.digest), events, at } }\n : r.state.acts\n const effects = r.renames?.length ? renameAcks(r.state.effects, r.renames) : r.state.effects\n const next: HolderState = { ...r.state, effects, commitSeq: seq, lastWhen: at, outbox, duties, acts }\n const text = encodeState(next) // validates; an invalid next state is a programming error\n // the timer for the documents this commit issues: each one's first\n // retry or its send deadline, whichever comes first, beside the duty\n // work the module's state opened\n let full = wake\n if (r.nextDueAt === undefined && def !== this.#builtins.resume) {\n const soon = (t: Millis | null | undefined): void => { if (t !== undefined && t !== null) full = full === undefined ? t : Math.min(full, t) }\n // each document's first retry or its send deadline, whichever comes first\n for (const o of outbound) { soon(outbox[o.digest].nextAttemptAt); soon(notAfterOf(outbox[o.digest], this.#policy.horizonMs)) }\n }\n const fullExtra = { ...(full !== undefined ? { nextDueAt: full } : {}), ...(r.detail !== undefined ? { detail: r.detail } : {}) }\n if (this.#check) {\n const d = (r.detail ?? {}) as { disposition?: string, digest?: string, type?: string, ref?: string, rkid?: string, fulfilled?: string[] }\n const pick = <K extends keyof typeof d>(k: K) => (d[k] !== undefined ? { [k]: d[k] } : {})\n this.#check(state, next,\n op.kind === 'receive' ? { kind: 'receive', ...pick('disposition'), ...pick('digest'), ...pick('type'), ...pick('ref'), ...pick('rkid') }\n : op.kind === 'resume' ? { kind: 'resume', fulfilled: d.fulfilled ?? [] }\n : op.kind === 'act' ? { ...op, events } : op)\n }\n let res\n try { res = await this.#store.commit(version, toOpaque(next)) } catch (e) {\n this.#unsettled = { text, commitSeq: seq, events, ...(def.human ? { actId } : {}) }\n throw new InfraError('unknown-commit-outcome', undefined, { cause: e })\n }\n if (!res.ok) continue\n // 4 — release\n this.#announce(seq, events)\n return { ok: true, outbound: [...emit, ...release, ...outbound], events, ...fullExtra }\n }\n throw new InfraError('commit-conflict', `no commit after ${this.#policy.commitAttempts} attempts`)\n }\n\n /** The work an operation opened or unblocked: its duty work (#dutyWake),\n * or `when` where a sweep's pending keys gained one. */\n /** Every time at which tick's expiry and retention change `state`: the\n * engine's own and the modules' `deadlines` (the timer contract). */\n #expiries (state: Readonly<HolderState>): Millis[] {\n const retention = this.#policy.retentionMs\n const out: Millis[] = []\n for (const p of Object.values(state.prompts)) if (p.expiresAt !== undefined) out.push(p.expiresAt)\n for (const e of Object.values(state.effects)) out.push(e.expiresAt)\n for (const a of Object.values(state.acts)) { const end = actEnd(state, a, retention); if (end !== Infinity) out.push(end) }\n for (const it of Object.values(state.outbox)) {\n const t = triasOf(it)\n if ((t === 'delivered' || t === 'failed') && it.history.length) out.push(it.history[it.history.length - 1].at + retention)\n }\n for (const k of Object.values(state.addresses.keys)) out.push(k.lastShown + retention)\n for (const f of this.#deadlines) for (const t of f(state)) out.push(t)\n return out.filter((t) => Number.isSafeInteger(t))\n }\n\n /** The earliest expiry deadline after `when`, among those `only` admits. */\n #nextExpiry (state: Readonly<HolderState>, when: Millis, only: (t: Millis) => boolean = () => true): Millis | undefined {\n let next: Millis | undefined\n for (const t of this.#expiries(state)) if (t > when && only(t) && (next === undefined || t < next)) next = t\n return next\n }\n\n #wake (before: Readonly<HolderState>, after: Readonly<HolderState>, added: readonly Duty[], when: Millis): Millis | undefined {\n const d0 = this.#dutyWake(before, after, added, when)\n // a deadline the commit introduced (a prompt opened, an act started, …)\n const had = before === after ? null : new Set(this.#expiries(before))\n const x = had === null ? undefined : this.#nextExpiry(after, when, (t) => !had.has(t))\n const d = d0 === undefined ? x : x === undefined ? d0 : Math.min(d0, x)\n if (d === when || before === after) return d\n for (const sw of this.#sweeps.values()) {\n // a sweep whose declared inputs are untouched (by reference) cannot have new pending keys\n if (sw.reads && sw.reads.every((k) => before[k] === after[k])) continue\n const had = new Set(sw.pending(before, when))\n if (sw.pending(after, when).some((k) => !had.has(k))) return when\n }\n return d\n }\n\n /** The duty work an operation opened or unblocked: over the duties that\n * are new, changed, or runnable now but not before, `when` where one\n * is runnable now, else the earliest future dueAt; undefined where none. */\n #dutyWake (before: Readonly<HolderState>, after: Readonly<HolderState>, added: readonly Duty[], when: Millis): Millis | undefined {\n let wake: Millis | undefined\n for (const d of [...Object.values(after.duties), ...added]) {\n const h = this.#duties.get(d.kind)\n if (!h || d.v !== h.v) continue\n const prev = Object.hasOwn(before.duties, d.id) ? before.duties[d.id] : undefined\n const runnable = dutyRunnable(d, h, after, when)\n if (prev !== undefined && jcs(prev) === jcs(d) && (!runnable || dutyRunnable(prev, h, before, when))) continue\n const t = runnable ? when : dutyDue(d) > when ? dutyDue(d) : undefined\n if (t !== undefined) wake = wake === undefined ? t : Math.min(wake, t)\n }\n return wake\n }\n\n /** The failure handlers of the items `digests` (each just turned\n * failed), in order, on `state`; their duties folded into the state. */\n #failed (state: HolderState, digests: readonly string[], when: Millis): { state: HolderState, events: EventDraft[] } {\n let cur = state\n const events: EventDraft[] = []\n for (const digest of digests) {\n const h = this.#failures.get(cur.outbox[digest].type)\n if (!h) continue\n const r = h(cur, digest, when, { backoff: this.#policy.backoff })\n if (r.state.effects !== cur.effects) throw new Error(`engine: the failure handler of ${cur.outbox[digest].type} wrote the effect cache`)\n if (r.outbound?.length) throw new Error(`engine: the failure handler of ${cur.outbox[digest].type} issued documents; it opens duties`)\n cur = r.state\n events.push(...(r.events ?? []))\n if (r.duties?.length) {\n const duties = { ...cur.duties }\n for (const d of r.duties) if (!Object.hasOwn(duties, d.id)) duties[d.id] = d\n cur = { ...cur, duties }\n }\n }\n return { state: cur, events }\n }\n\n /** The give-up of the outbox items named (a replay found them due, see\n * #run): as resume's, the failed step, the status event, the failure\n * handlers in the same transaction; items no longer due are left alone. */\n #giveUpDef (): InternalDef {\n const giveUp = (it: Readonly<OutboxItem>, when: Millis) => this.#giveUp(it, when)\n const failed = (st: HolderState, digests: readonly string[], when: Millis) => this.#failed(st, digests, when)\n return {\n human: false,\n apply (state, _p, digests: string[], when) {\n const outbox: Record<string, OutboxItem> = { ...state.outbox }\n const events: EventDraft[] = []\n const gave: string[] = []\n for (const d of digests) {\n const it = state.outbox[d]\n const t = triasOf(it)\n if (t === 'delivered' || t === 'failed') continue\n const why = giveUp(it, when)\n if (!why) continue\n const { nextAttemptAt: _, ...rest } = it\n outbox[d] = { ...rest, history: [...rest.history, { status: 'failed', at: when, reason: why }] }\n events.push({ type: 'delivery.status', digest: d, threadId: it.threadId, status: 'failed' })\n gave.push(d)\n }\n if (!gave.length) return { state: state as HolderState }\n const f = failed({ ...state, outbox }, gave, when)\n return { state: f.state, events: [...events, ...f.events] }\n },\n }\n }\n\n /** Why a non-terminal outbox item is given up at `when`, or null: its\n * sender lifetime, where it ends no later than the horizon\n * (failed(task-expired), Delivery 6110), else the horizon\n * (failed(expired-by-adapter-policy)). */\n #giveUp (it: Readonly<OutboxItem>, when: Millis): 'task-expired' | 'expired-by-adapter-policy' | null {\n const first = it.history.length ? it.history[0].at : when\n const expiry = Math.min(first + this.#policy.horizonMs, Number.MAX_SAFE_INTEGER)\n const life = it.expiresAt\n if (life !== undefined && when >= life && life <= expiry) return 'task-expired'\n return when >= expiry ? 'expired-by-adapter-policy' : null\n }\n\n #itemOf (state: Readonly<HolderState>, digest: string): OutboxItem {\n if (!Object.hasOwn(state.outbox, digest)) throw new Error(`engine: journaled outbound ${digest} is missing from the outbox`)\n return state.outbox[digest]\n }\n\n #outboundOf (state: Readonly<HolderState>, digest: string): Outbound {\n const it = this.#itemOf(state, digest)\n return structuredClone({ digest, envelope: it.envelope, type: it.type, threadId: it.threadId, recipient: it.recipient, attempt: it.attempt })\n }\n\n // ── built-ins ────────────────────────────────────────────────────────\n\n #tickDef (): InternalDef {\n const policy = (): Policy => this.#policy\n const retainers = () => this.#retain\n const keepers = () => this.#keepKeys\n return {\n human: false,\n apply (state, _p, _input, when) {\n const retention = policy().retentionMs\n let dropped = false\n const keep = <T>(rec: Record<string, T>, live: (x: T, key: string) => boolean): Record<string, T> => {\n const out: Record<string, T> = {}\n // defined, not assigned: a key such as `__proto__` (an app's actId) stays an own member\n for (const [k, v] of Object.entries(rec)) { if (live(v, k)) Object.defineProperty(out, k, { value: v, enumerable: true, writable: true, configurable: true }); else dropped = true }\n return out\n }\n // effects leave with their acks (Delivery 4.2); prompts at expiry; the\n // act journal after the retention\n const effects = keep(state.effects, (x) => x.expiresAt > when)\n const prompts = keep(state.prompts, (x) => x.expiresAt === undefined || x.expiresAt > when)\n const acts = keep(state.acts, (x) => actEnd(state, x, retention) > when)\n // terminal outbox items, the retention after their last step, unless a\n // kept journal entry still answers with them (replay needs the item)\n const journaled = new Set(Object.values(acts).flatMap((a) => a.outboundDigests))\n const outbox = keep(state.outbox, (it, digest) => {\n const t = triasOf(it)\n if (t !== 'delivered' && t !== 'failed') return true\n const last = it.history.length ? it.history[it.history.length - 1].at : 0\n return last + retention > when || journaled.has(digest)\n })\n let next: HolderState = dropped ? { ...state, effects, prompts, acts, outbox } : state as HolderState\n // the modules' own retention, on what the engine's left\n for (const r of retainers()) {\n const after = r(next, when)\n if (after.effects !== next.effects) throw new Error('engine: a module\\'s retain wrote the effect cache')\n next = after\n }\n // addresses (Delivery §5), on what the retention left, so a key whose\n // last claim left in this tick leaves with it: a key not shown for the\n // retention, and the own rkid of no live tuple, becomes a tombstone —\n // its id alone, kept forever; tombstones never shrink\n const held = next\n const live = new Set<string>()\n for (const r of Object.values(held.relationships)) for (const t of r.tuples) if (!t.deactivated) live.add(t.rkid)\n // and the rkids a module still needs (a deactivated prior whose continuity flow is open)\n // (at this tick's time: a claim that ends now ends in this tick)\n for (const k of keepers()) for (const rkid of k(held, when)) live.add(rkid)\n const tombstones = [...held.addresses.tombstones]\n let gone = false\n const keys: HolderState['addresses']['keys'] = {}\n for (const [rkid, k] of Object.entries(held.addresses.keys)) {\n if (k.lastShown + retention > when || live.has(rkid)) { keys[rkid] = k; continue }\n gone = true\n // a member key (group/…) is an identity context, not a delivery\n // address of Delivery §5: it leaves without a tombstone, so the same\n // derivation can serve the same group again (a re-invitation)\n if (!k.label.startsWith('group/') && !tombstones.includes(rkid)) tombstones.push(rkid)\n }\n if (gone) next = { ...held, addresses: { keys, tombstones } }\n return { state: next } // unchanged: the engine still commits a raised lastWhen\n },\n }\n }\n\n /** The duties a resume plans to run, in fixed order (dueAt, then id),\n * and the registered kinds met at an unknown version. Each planned\n * duty is checked again against the current state right before its\n * handler runs (#resumeDef). */\n #dutyPlan (state: Readonly<HolderState>, when: Millis): { run: Array<{ duty: Duty, h: DutyHandler }>, unsupported: Duty[] } {\n const order = Object.values(state.duties).sort((a, b) => (dutyDue(a) - dutyDue(b)) || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0))\n const run: Array<{ duty: Duty, h: DutyHandler }> = []\n const unsupported: Duty[] = []\n for (const duty of order) {\n const h = this.#duties.get(duty.kind)\n if (!h) continue // a kind no module here registers: kept, silent\n if (duty.v !== h.v) { unsupported.push(duty); continue }\n if (dutyRunnable(duty, h, state, when)) run.push({ duty, h })\n }\n return { run, unsupported }\n }\n\n #resumeDef (): InternalDef {\n const expiryAfter = (st: Readonly<HolderState>, w: Millis): Millis | undefined => this.#nextExpiry(st, w)\n const policy = (): Policy => this.#policy\n const plan = (state: Readonly<HolderState>, when: Millis) => this.#dutyPlan(state, when)\n const handlers = (): ReadonlyMap<string, DutyHandler> => this.#duties\n const sweeps = (): ReadonlyMap<string, SweepHandler> => this.#sweeps\n const failed = (st: HolderState, digests: readonly string[], when: Millis) => this.#failed(st, digests, when)\n const ownRetries = (): ReadonlySet<string> => this.#ownRetries\n const giveUp = (it: Readonly<OutboxItem>, when: Millis) => this.#giveUp(it, when)\n return {\n human: false,\n // the due duties' and the sweeps' preparations, against the snapshot apply will see\n async prepare (ctx) {\n const values: Record<string, unknown> = {}\n for (const { duty, h } of plan(ctx.snapshot, ctx.when).run) if (h.prepare) values[duty.id] = await h.prepare(ctx, duty)\n const swept: Record<string, unknown> = {}\n for (const [name, sw] of sweeps()) swept[name] = await sw.prepare(ctx)\n return { duties: values, sweeps: swept }\n },\n apply (state, prepared, _input, when) {\n const p = policy()\n const outbox: Record<string, OutboxItem> = { ...state.outbox }\n const emit: Outbound[] = []\n const events: EventDraft[] = []\n const gaveUp: string[] = []\n let nextDueAt: Millis | undefined\n const due = (t: Millis): void => { nextDueAt = nextDueAt === undefined ? t : Math.min(nextDueAt, t) }\n // 1 — the outbox, by due time, then digest\n const order = Object.keys(state.outbox).sort((a, b) =>\n ((state.outbox[a].nextAttemptAt ?? 0) - (state.outbox[b].nextAttemptAt ?? 0)) || (a < b ? -1 : a > b ? 1 : 0))\n for (const digest of order) {\n const it = state.outbox[digest]\n const trias = triasOf(it)\n if (trias === 'delivered' || trias === 'failed') continue\n // the horizon applies to every non-terminal item: held, accepted or\n // not; a sender lifetime the type declares ends it earlier, as\n // failed(task-expired), never handed out again (Delivery 6110, 6115)\n const why = giveUp(it, when)\n if (why) {\n const { nextAttemptAt: _, ...rest } = it\n outbox[digest] = { ...rest, history: [...it.history, { status: 'failed', at: when, reason: why }] }\n events.push({ type: 'delivery.status', digest, threadId: it.threadId, status: 'failed' })\n gaveUp.push(digest)\n continue\n }\n const first = it.history.length ? it.history[0].at : when\n const expiry = Math.min(first + p.horizonMs, Number.MAX_SAFE_INTEGER)\n due(it.expiresAt !== undefined ? Math.min(it.expiresAt, expiry) : expiry)\n // never re-emitted: an accepted item (the service has it) and one the\n // adapter holds (awaiting-transport, until it reports again)\n if (trias === 'accepted' || it.history[it.history.length - 1]?.status === 'awaiting-transport') continue\n // a type its module re-issues itself is never reproduced (Trust 6710)\n if (ownRetries().has(it.type)) continue\n if (it.nextAttemptAt !== undefined && it.nextAttemptAt > when) { due(it.nextAttemptAt); continue }\n const attempt = it.attempt + 1\n const nextAttemptAt = dueAt(when, p.backoff(attempt))\n outbox[digest] = { ...it, attempt, nextAttemptAt, history: [...it.history, { status: 'submitted', at: when, attempt }] }\n emit.push(structuredClone({ digest, envelope: it.envelope, type: it.type, threadId: it.threadId, recipient: it.recipient, attempt }))\n due(nextAttemptAt)\n }\n // 2 — duties, in the plan's order, each on the state the one before\n // left and checked against it right before its handler: still there\n // at the handler's version, due, its awaited head still holding. A\n // prepared duty whose data changed since its preparation is deferred\n // to the next resume, which prepares it afresh (due at once)\n const { run, unsupported } = plan(state, when)\n for (const d of unsupported) events.push({ type: 'duty.unsupported', dutyId: d.id, kind: d.kind, v: d.v })\n // the outbox changed only by a re-emission or a give-up (an event so far)\n let cur: HolderState = !emit.length && !events.length ? state as HolderState : { ...state, outbox }\n // the failure handlers of the items given up, in the give-up's transaction\n if (gaveUp.length) { const f = failed(cur, gaveUp, when); cur = f.state; events.push(...f.events) }\n const drafts: OutboundDraft[] = []\n const renames: IdentityRename[] = []\n // the duties whose handler returned Applied (invariants.ts: fulfilment)\n const fulfilled: string[] = []\n // ran and stayed (not-due, refused): id → its record as it ran\n const kept = new Map<string, string>()\n const { duties: values, sweeps: swept } = prepared.value as { duties: Record<string, unknown>, sweeps: Record<string, unknown> }\n for (const { duty, h } of run) {\n if (!Object.hasOwn(cur.duties, duty.id)) continue // fulfilled or dropped meanwhile\n const now = cur.duties[duty.id]\n // another kind or version since the plan: the next resume dispatches it\n if (now.kind !== duty.kind || now.id !== duty.id || now.v !== h.v || !dutyRunnable(now, h, cur, when)) continue // the final pass sets its timer\n if (h.prepare && jcs(now) !== jcs(duty)) continue // prepared on other data\n const r = h.apply(cur, now, Object.freeze({ prepared: Object.freeze({ value: values[duty.id], version: prepared.version, commitSeq: prepared.commitSeq }), backoff: p.backoff }), when)\n if (r === 'not-due' || isRefusal(r)) { kept.set(duty.id, jcs(now)); continue }\n // fulfilled: the duty leaves; what its handler opened is folded into\n // the state at once (an id already open is kept), so the duties\n // after it see it — their drop rules and their dedupe included\n const left = { ...r.state.duties }\n delete left[duty.id]\n for (const d of r.duties ?? []) if (!Object.hasOwn(left, d.id)) left[d.id] = d\n cur = { ...r.state, duties: left }\n fulfilled.push(duty.id)\n drafts.push(...(r.outbound ?? []))\n events.push(...(r.events ?? []))\n renames.push(...(r.renames ?? []))\n }\n // 2b — the sweeps, on the state the duties left; a prepared piece\n // whose inputs moved is skipped and due again at once\n for (const [name, sw] of sweeps()) {\n const r = sw.apply(cur, Object.freeze({ value: swept[name], version: prepared.version, commitSeq: prepared.commitSeq }), when)\n if (r.state.effects !== cur.effects) throw new Error(`engine: the sweep ${name} wrote the effect cache`)\n cur = r.state\n if (r.duties?.length) {\n const all = { ...cur.duties }\n for (const d of r.duties) if (!Object.hasOwn(all, d.id)) all[d.id] = d\n cur = { ...cur, duties: all }\n }\n drafts.push(...(r.outbound ?? []))\n events.push(...(r.events ?? []))\n if (r.deferred) due(when)\n }\n // work a sweep owes now but did not prepare: a divergence the outbox\n // step (a give-up at the horizon) or a duty of this resume created —\n // due at once, prepared by the next resume\n if (cur !== state) {\n for (const sw of sweeps().values()) {\n const had = new Set(sw.pending(state, when))\n if (sw.pending(cur, when).some((k) => !had.has(k))) { due(when); break }\n }\n }\n // the timer from the final duty set, new duties included: a future\n // dueAt, or `when` for work runnable now that did not run (deferred,\n // newly created, newly unblocked); a duty that ran and stayed\n // (not-due, refused) sets none while its record is unchanged since\n // its run — changed by a later duty, it counts like any other\n for (const d of Object.values(cur.duties)) {\n const h = handlers().get(d.kind)\n if (!h || d.v !== h.v || kept.get(d.id) === jcs(d)) continue\n if (dutyDue(d) > when) due(dutyDue(d))\n else if (dutyRunnable(d, h, cur, when)) due(when)\n }\n // the duties' new documents enter the outbox in #run, due at backoff(1)\n if (drafts.length) due(dueAt(when, p.backoff(1)))\n // 3 — acks still unsent (a restart between the receive commit and the\n // send, or no report yet): re-offered byte-identical on the retry\n // policy, by effect digest; at the horizon marked sent by it\n const release: Outbound[] = []\n let effects: HolderState['effects'] | null = null\n for (const d of Object.keys(cur.effects).sort()) {\n const a = cur.effects[d].ack\n if (!a || a.sent) continue\n const expiry = Math.min(a.at + p.horizonMs, Number.MAX_SAFE_INTEGER)\n effects ??= { ...cur.effects }\n if (when >= expiry) {\n const { nextAttemptAt: _, held: _h, ...rest } = a\n effects[d] = { ...cur.effects[d], ack: { ...rest, sent: true, sentBy: 'horizon' } }\n continue\n }\n due(expiry)\n // held: the adapter has it (awaiting-transport); pendingTransport offers it\n if (a.held !== undefined) continue\n if (a.nextAttemptAt !== undefined && a.nextAttemptAt > when) { due(a.nextAttemptAt); continue }\n const attempt = a.attempt + 1\n const nextAttemptAt = dueAt(when, p.backoff(attempt))\n effects[d] = { ...cur.effects[d], ack: { ...a, attempt, nextAttemptAt } }\n release.push(ackOutbound(a, attempt))\n due(nextAttemptAt)\n }\n if (effects && jcs(effects) !== jcs(cur.effects)) cur = { ...cur, effects }\n // the expiry work tick does (the timer contract, the header)\n const ex = expiryAfter(cur, when)\n if (ex !== undefined) due(ex)\n return {\n state: cur, emit, events, outbound: drafts, release, detail: { fulfilled },\n ...(renames.length ? { renames } : {}),\n ...(nextDueAt !== undefined ? { nextDueAt } : {}),\n }\n },\n }\n }\n\n /** an answer's hand-over began: it is no longer due (handOver) */\n #answeredDef (): InternalDef {\n return {\n human: false,\n apply (state, _p, input: { digest: string, n: number }) {\n const eff = Object.keys(state.effects).find((d) => state.effects[d].ack?.digest === input.digest)\n if (eff === undefined) return { state: state as HolderState }\n const a = state.effects[eff].ack!\n if (a.answerDue !== true || a.answers !== input.n) return { state: state as HolderState }\n const { answerDue: _d, ...rest } = a\n return { state: { ...state, effects: { ...state.effects, [eff]: { ...state.effects[eff], ack: rest } } } }\n },\n }\n }\n\n #reportDef (): InternalDef {\n const failed = (st: HolderState, digests: readonly string[], when: Millis) => this.#failed(st, digests, when)\n return {\n human: false,\n apply (state, _p, report: DeliveryReport, when) {\n if (!Object.hasOwn(state.outbox, report.digest)) {\n // an ack (outbox-less, no trias; Delivery RLTP-DEL-6330): sent once\n // a service took it or the adapter gave it up; awaiting-transport\n // records that the adapter holds it and ends nothing\n const eff = Object.keys(state.effects).find((d) => state.effects[d].ack?.digest === report.digest)\n if (eff === undefined) return { ok: false, code: 'unknown-digest' }\n const e = state.effects[eff]\n const a = e.ack!\n if (a.sent) return { state: state as HolderState }\n const { nextAttemptAt: _, held: _h, ...rest } = a\n let ack: StoredAck\n switch (report.status) {\n case 'awaiting-transport':\n if (a.held === report.reason) return { state: state as HolderState }\n ack = { ...rest, held: report.reason }\n break\n case 'accepted':\n case 'delivered':\n ack = { ...rest, sent: true, sentBy: 'accepted' }\n break\n case 'failed':\n ack = { ...rest, sent: true, sentBy: 'failed' }\n break\n default:\n throw new TypeError(`unknown report status ${String((report as { status?: unknown }).status)}`)\n }\n return { state: { ...state, effects: { ...state.effects, [eff]: { ...e, ack } } } }\n }\n const it = state.outbox[report.digest]\n const trias = triasOf(it)\n const had = (s: OutboxStep['status']): boolean => it.history.some((x) => x.status === s)\n const same = { state: state as HolderState }\n let step: OutboxStep\n switch (report.status) {\n case 'awaiting-transport': {\n const last = it.history[it.history.length - 1]\n if (trias !== 'submitted') return same // no step back before the trias\n if (last?.status === 'awaiting-transport' && last.reason === report.reason) return same\n step = { status: 'awaiting-transport', at: when, reason: report.reason }\n break\n }\n case 'accepted':\n if (had('accepted') || trias !== 'submitted') return same\n step = { status: 'accepted', at: when }\n break\n case 'delivered': {\n // lateness is the holder's own history: delivered after failed\n // (its own give-up or the adapter's) is late, whatever the flag says\n const m = markDelivered(state, report.digest, when)\n return m.event ? { state: { ...state, outbox: m.outbox }, events: [m.event] } : same\n }\n case 'failed':\n if (had('failed') || trias === 'delivered') return same\n step = report.reason === 'rejected-by-receiver'\n ? { status: 'failed', at: when, reason: report.reason, code: report.code }\n : { status: 'failed', at: when, reason: report.reason }\n break\n default:\n throw new TypeError(`unknown report status ${String((report as { status?: unknown }).status)}`)\n }\n const base = step.status === 'awaiting-transport' ? it : (({ nextAttemptAt: _, ...rest }) => rest)(it)\n const outbox = { ...state.outbox, [report.digest]: { ...base, history: [...it.history, step] } }\n const events: EventDraft[] = step.status === 'awaiting-transport' ? [] : [{\n type: 'delivery.status', digest: report.digest, threadId: it.threadId, status: step.status,\n }]\n if (step.status === 'failed') {\n const f = failed({ ...state, outbox }, [report.digest], when)\n return { state: f.state, events: [...events, ...f.events] }\n }\n return { state: { ...state, outbox }, events }\n },\n }\n }\n\n #receiveDef (): InternalDef {\n const tasks = (): ReadonlyMap<string, TaskHandler> => this.#tasks\n const acks = (): ReadonlyMap<string, AckHandler> => this.#acks\n const acceptedHooks = (): ReadonlyArray<NonNullable<HolderModule['accepted']>> => this.#accepted\n const policy = (): Policy => this.#policy\n return {\n human: false,\n prepare: (ctx, env) => prepareReceive(ctx, env, tasks()),\n apply (state, prepared, _env, when) {\n const plan = prepared.value as ReceivePlan\n const cached = (ack: Effect['ack']): Effect => ({ ack, expiresAt: Math.min(when + policy().retentionMs, Number.MAX_SAFE_INTEGER) })\n switch (plan.kind) {\n case 'failed': return { halt: true, detail: plan.result }\n case 'duplicate': {\n // the stored ack, byte-identical; a terminal document has none\n // (its outbound attempt is one past the schedule's, which it does not move)\n // and an answer due (Delivery RLTP-DEL-6330): a hand-over of its\n // own, kept across a lock until it begins; while one is due, a\n // further duplicate is answered by it (the same bytes)\n const a = state.effects[plan.digest].ack\n const next: HolderState = a && a.answerDue === undefined\n ? { ...state, effects: { ...state.effects, [plan.digest]: { ...state.effects[plan.digest], ack: { ...a, answers: (a.answers ?? 0) + 1, answerDue: true } } } }\n : state as HolderState\n return { state: next, release: a ? [ackOutbound(a, a.attempt + 1)] : [], detail: { disposition: 'duplicate-known', digest: plan.digest } }\n }\n case 'ack': {\n // terminal: the sender-status update and its cache entry, no ack;\n // the issuing module's ack handler runs in the same transaction\n const m = markDelivered(state, plan.ref, when)\n let next: HolderState = { ...state, outbox: m.outbox }\n const events: EventDraft[] = m.event ? [m.event] : []\n const h = acks().get(state.outbox[plan.ref].type)\n if (h) {\n const r = h(next, plan.ref, when)\n if (r.state.effects !== next.effects) throw new Error(`engine: the ack handler of ${state.outbox[plan.ref].type} wrote the effect cache`)\n next = r.state\n events.push(...(r.events ?? []))\n }\n // a verified ack is an accepted document of its issuer too: the\n // modules' accepted hooks, in the same transaction\n for (const hook of acceptedHooks()) {\n next = hook(next, plan.doc, plan.arrival)\n if (next.effects !== state.effects) throw new Error('engine: an accepted hook wrote the effect cache')\n }\n return {\n state: { ...next, effects: { ...next.effects, [plan.digest]: cached(null) } },\n events,\n detail: { disposition: 'unique', digest: plan.digest, type: ACK_TYPE, ref: plan.ref },\n }\n }\n case 'task': {\n const h = tasks().get(plan.type)!\n const r = h.apply(state, handlerPrepared(prepared, plan.value), plan.doc, plan.arrival)\n if (isTaskRefusal(r)) {\n const failedDetail = { disposition: 'failed', reason: r.reason, stage: 9, digest: plan.digest, ...(r.ref !== undefined ? { ref: r.ref } : {}) }\n if (!r.latch) return { halt: true, detail: failedDetail }\n // the Encounter latch exception (receive.ts): only the latch commits\n checkLatch(state, r.latch, when)\n return { state: r.latch, detail: failedDetail }\n }\n if (isTaskDiscarded(r)) {\n // a resource-limit discard: its state commits; no cache entry, no ack\n if (r.state.effects !== state.effects) throw new Error(`engine: the handler of ${plan.type} wrote the effect cache`)\n return { state: r.state, detail: { disposition: 'discarded', digest: plan.digest, type: plan.type, reason: r.reason, ...(r.ref !== undefined ? { ref: r.ref } : {}) } }\n }\n if (r.state.effects !== state.effects) throw new Error(`engine: the handler of ${plan.type} wrote the effect cache; the core writes it`)\n // the modules' accepted hooks, in the same transaction\n let after = r.state\n for (const hook of acceptedHooks()) {\n after = hook(after, plan.doc, plan.arrival)\n if (after.effects !== state.effects) throw new Error('engine: an accepted hook wrote the effect cache')\n }\n return {\n state: { ...after, effects: { ...state.effects, [plan.digest]: cached({ ...plan.ack, at: when, attempt: 1, nextAttemptAt: dueAt(when, policy().backoff(1)), sent: false }) } },\n ...(r.outbound ? { outbound: r.outbound } : {}),\n ...(r.events ? { events: r.events } : {}),\n ...(r.duties ? { duties: r.duties } : {}),\n ...(r.renames ? { renames: r.renames } : {}),\n release: [ackOutbound(plan.ack, 1)],\n detail: { disposition: 'unique', digest: plan.digest, type: plan.type, rkid: plan.arrival.rkid },\n }\n }\n }\n },\n }\n }\n\n // ── public surface ───────────────────────────────────────────────────\n\n act (command: string, input: unknown, when: Millis, opts: { actId?: string } = {}): Promise<ActResult> {\n let def: InternalDef | undefined\n let bound: unknown\n let hash: Promise<string> | undefined\n let actId: string | undefined\n try {\n def = this.#commands.get(command)\n if (!def) throw new Error((BUILTIN as readonly string[]).includes(command) ? `${command} is built in: call engine.${command}()` : `unknown command ${command}`)\n checkWhen(when)\n actId = def.human ? opts.actId : undefined\n if (def.human && (typeof actId !== 'string' || actId === '')) return Promise.resolve({ ok: false, code: 'actid-missing' })\n // bound here, synchronously: later changes by the caller reach nothing\n bound = bindInput(input)\n if (def.human) {\n hash = digestOf(this.#crypto.subtle, { command, input: bound })\n hash.catch(() => undefined) // awaited in the queue; no unhandled rejection meanwhile\n }\n } catch (e) { return Promise.reject(e) }\n const d = def\n return this.#enqueue(async () => {\n return actResult(await this.#run(d, { kind: 'act', command }, bound, when, actId, hash === undefined ? undefined : await hash))\n })\n }\n\n tick (when: Millis): Promise<ActResult> {\n try { checkWhen(when) } catch (e) { return Promise.reject(e) }\n return this.#enqueue(async () => {\n return actResult(await this.#run(this.#builtins.tick, { kind: 'tick' }, null, when))\n })\n }\n\n resume (when: Millis): Promise<ResumeResult> {\n try { checkWhen(when) } catch (e) { return Promise.reject(e) }\n // fail closed: a resume that throws anywhere — the settling of an\n // earlier commit included — leaves nothing to go out until one completes\n return this.#enqueue(async () => {\n this.#resumed = false\n const r = await this.#run(this.#builtins.resume, { kind: 'resume' }, null, when)\n if (isHalt(r) || !r.ok) throw new Error('engine: resume does not refuse')\n this.#resumed = true\n return { outbound: r.outbound, events: r.events, ...(r.nextDueAt !== undefined ? { nextDueAt: r.nextDueAt } : {}) }\n }).catch((e) => { this.#resumed = false; throw e })\n }\n\n report (report: DeliveryReport, when: Millis): Promise<ActResult> {\n let bound: DeliveryReport\n try { checkWhen(when); bound = bindInput(report) } catch (e) { return Promise.reject(e) }\n return this.#enqueue(async () => {\n return actResult(await this.#run(this.#builtins.report, { kind: 'report', status: bound.status }, bound, when))\n })\n }\n\n receive (env: unknown, when: Millis): Promise<ReceiveResult> {\n try { checkWhen(when) } catch (e) { return Promise.reject(e) }\n // bound at the call like any input; what is not JSON is no envelope\n let bound: unknown\n try { bound = bindInput(env) } catch { bound = null }\n return this.#enqueue(async () => {\n const r = await this.#run(this.#builtins.receive, { kind: 'receive' }, bound, when)\n if (isHalt(r)) return r.detail as ReceiveResult\n if (!r.ok) throw new Error('engine: receive does not refuse')\n if ((r.detail as { disposition?: string } | undefined)?.disposition === 'failed') return r.detail as ReceiveResult // a latch committed\n const d = r.detail as { disposition: 'unique' | 'duplicate-known' | 'discarded', digest: string, type?: string, reason?: 'resource-limit' | 'rejected', ref?: string }\n if (d.disposition === 'discarded') return { disposition: 'discarded', digest: d.digest, type: d.type!, reason: d.reason!, ...(d.ref !== undefined ? { ref: d.ref } : {}) }\n return d.disposition === 'unique'\n ? { disposition: 'unique', digest: d.digest, type: d.type!, outbound: r.outbound, events: r.events, ...(r.nextDueAt !== undefined ? { nextDueAt: r.nextDueAt } : {}) }\n : { disposition: 'duplicate-known', digest: d.digest, outbound: r.outbound }\n })\n }\n\n subscribe (listener: CommitListener): () => void {\n if (typeof listener !== 'function') throw new TypeError('listener must be a function')\n this.#listeners.add(listener)\n return () => { this.#listeners.delete(listener) }\n }\n\n snapshot (): Promise<EngineSnapshot> {\n return this.#enqueue(async () => {\n const { state } = await this.#read()\n return Object.freeze({ state, commitSeq: state.commitSeq })\n })\n }\n\n replay (actId: string, when: Millis): Promise<ReplayResult> {\n try { checkWhen(when) } catch (e) { return Promise.reject(e) }\n if (typeof actId !== 'string' || actId === '') return Promise.resolve(Object.freeze({ ok: false as const, code: 'actid-missing' as const }))\n return this.#enqueue(async () => {\n const { state } = await this.#read()\n if (!Object.hasOwn(state.acts, actId)) return Object.freeze({ ok: false as const, code: 'unknown-act' as const })\n const rec = state.acts[actId]\n // as a repeat of the act would see them at max(when, lastWhen), without\n // the give-up it would commit first: a pure read\n const at = Math.max(when, state.lastWhen)\n const outbound = rec.outboundDigests.map((digest) => {\n const it = Object.hasOwn(state.outbox, digest) ? state.outbox[digest] : undefined\n const t = it ? triasOf(it) : undefined\n return { digest, live: it !== undefined && t !== 'delivered' && t !== 'failed' && this.#giveUp(it, at) === null }\n })\n return freezeDeep({ ok: true as const, result: { actId: rec.actId, commitSeq: rec.commitSeq, at: rec.at, events: structuredClone(rec.events) as HolderEvent[], outbound } })\n })\n }\n\n pendingTransport (when: Millis): Promise<TransportView | TransportRefusal> {\n try { checkWhen(when) } catch (e) { return Promise.reject(e) }\n return this.#enqueue(async () => {\n if (!this.#resumed) return Object.freeze({ ok: false as const, code: 'not-resumed' as const })\n const { state } = await this.#read()\n // the holder's time never runs back: an earlier `when` reads at lastWhen\n const at = Math.max(when, state.lastWhen)\n const entries = transportEntries(state, at, this.#policy.horizonMs).map((e) => {\n const f = freezeDeep(e)\n this.#issued.add(f)\n return f\n })\n return Object.freeze({ ok: true as const, commitSeq: state.commitSeq, at, entries: Object.freeze(entries) })\n })\n }\n\n mayHandOver (entry: TransportEntry, when: Millis): Promise<boolean> {\n try { checkWhen(when) } catch (e) { return Promise.reject(e) }\n if (this.#closed || entry === null || typeof entry !== 'object' || !this.#issued.has(entry)) return Promise.resolve(false)\n return this.#enqueue(() => this.#mayGo(entry, when)).catch((e) => {\n if (e instanceof InfraError && e.code === 'closed') return false\n throw e\n })\n }\n\n handOver (entry: TransportEntry, when: Millis, start: () => boolean): Promise<boolean> {\n try { checkWhen(when) } catch (e) { return Promise.reject(e) }\n if (typeof start !== 'function') return Promise.reject(new TypeError('handOver needs a start function'))\n if (this.#closed || entry === null || typeof entry !== 'object' || !this.#issued.has(entry)) return Promise.resolve(false)\n return this.#enqueue(async () => {\n if (!this.#resumed) return false\n const { state } = await this.#read()\n // no await from here to start(): close() and every other operation\n // of this engine come before the check or after the start\n if (!this.#passes(state, entry, when)) return false\n if (start() !== true) return false\n // an answer's hand-over has begun: it is no longer due (a later\n // duplicate grants the next); a commit that fails leaves it due, and\n // it may go out once more — the receiver absorbs it\n if (entry.resend !== undefined) {\n try { await this.#run(this.#answeredDef(), { kind: 'report', status: 'answered' }, { digest: entry.digest, n: entry.resend }, Math.max(when, state.lastWhen)) } catch { /* stays due */ }\n }\n return true\n }).catch((e) => {\n if (e instanceof InfraError && e.code === 'closed') return false\n throw e\n })\n }\n\n /** the gate's check, inside the queue: open, resumed, still pending in\n * the store as issued, before its deadline */\n async #mayGo (entry: TransportEntry, when: Millis): Promise<boolean> {\n if (!this.#resumed) return false\n const { state } = await this.#read()\n return this.#passes(state, entry, when)\n }\n\n /** synchronous: open, resumed, the entry pending in `state` as issued,\n * before its deadline at max(when, lastWhen) */\n #passes (state: Readonly<HolderState>, entry: TransportEntry, when: Millis): boolean {\n if (this.#closed || !this.#resumed) return false\n const now = transportEntryOf(state, entry.kind, entry.digest, Math.max(when, state.lastWhen), this.#policy.horizonMs, entry.resend)\n return now !== null && now.resend === entry.resend && jcs(now.envelope) === jcs(entry.envelope)\n }\n\n close (): Promise<void> {\n this.#closed = true\n return this.#chain.then(() => undefined, () => undefined)\n }\n\n get closed (): boolean { return this.#closed }\n}\n\n/** When the journal entry of an act may leave (tick): the retention after\n * its commit and after the last step of each of its documents that is\n * terminal — the act's result stays as long as the completion of its\n * documents does; Infinity while one of them is not terminal yet (its\n * give-up makes it terminal, and the deadline follows then). */\nconst actEnd = (state: Readonly<HolderState>, a: Readonly<ActRecord>, retention: number): Millis => {\n let end = a.at\n for (const d of a.outboundDigests) {\n if (!Object.hasOwn(state.outbox, d)) continue\n const it = state.outbox[d]\n const t = triasOf(it)\n if (t !== 'delivered' && t !== 'failed') return Infinity\n if (it.history.length) end = Math.max(end, it.history[it.history.length - 1].at)\n }\n return end + retention\n}\n\n/** The send deadline of an outbox item: the horizon from its first\n * submission, or the sender lifetime its type declared if that is\n * earlier (#giveUp's two bounds as one instant). */\nconst notAfterOf = (it: Readonly<OutboxItem>, horizonMs: number): Millis | null => {\n if (!it.history.length) return null\n const expiry = Math.min(it.history[0].at + horizonMs, Number.MAX_SAFE_INTEGER)\n return it.expiresAt !== undefined ? Math.min(it.expiresAt, expiry) : expiry\n}\n\n/** The transport entry of one pending document or ack at `when`, or null:\n * terminal, accepted, sent, past its deadline, or absent (RLTP-DEL-6135:\n * absent means stop). */\nfunction transportEntryOf (state: Readonly<HolderState>, kind: 'document' | 'ack', digest: string, when: Millis, horizonMs: number, resend?: number): TransportEntry | null {\n if (kind === 'document') {\n if (!Object.hasOwn(state.outbox, digest)) return null\n const it = state.outbox[digest]\n const trias = triasOf(it)\n if (trias !== 'submitted') return null\n const notAfter = notAfterOf(it, horizonMs)\n if (notAfter === null || when >= notAfter) return null\n const last = it.history[it.history.length - 1]\n return structuredClone({\n digest, kind, envelope: it.envelope, type: it.type, threadId: it.threadId, recipient: it.recipient, attempt: it.attempt, since: it.history[0].at, notAfter,\n ...(last.status === 'awaiting-transport' ? { held: last.reason } : it.nextAttemptAt !== undefined ? { nextAttemptAt: it.nextAttemptAt } : {}),\n })\n }\n for (const d of Object.keys(state.effects)) {\n const a = state.effects[d].ack\n if (a === null || a.digest !== digest) continue\n if (resend !== undefined) {\n // a duplicate's answer: its own hand-over, apart from the retries and\n // whatever state they are in, while due and the effect keeps the ack (6335)\n if (a.answerDue !== true || a.answers !== resend || when >= state.effects[d].expiresAt) return null\n return structuredClone({\n digest, kind, envelope: a.envelope, type: ACK_TYPE, threadId: a.threadId, recipient: a.recipient, attempt: a.attempt, since: a.at,\n notAfter: state.effects[d].expiresAt, resend,\n })\n }\n const notAfter = Math.min(a.at + horizonMs, Number.MAX_SAFE_INTEGER)\n if (a.sent || when >= notAfter) return null\n return structuredClone({\n digest, kind, envelope: a.envelope, type: ACK_TYPE, threadId: a.threadId, recipient: a.recipient, attempt: a.attempt, since: a.at, notAfter,\n ...(a.held !== undefined ? { held: a.held } : a.nextAttemptAt !== undefined ? { nextAttemptAt: a.nextAttemptAt } : {}),\n })\n }\n return null\n}\n\n/** Everything the holder keeps for transport at `when`: the outbox items\n * by due time, then digest, then the unsent acks by effect digest. */\nfunction transportEntries (state: Readonly<HolderState>, when: Millis, horizonMs: number): TransportEntry[] {\n const out: TransportEntry[] = []\n const order = Object.keys(state.outbox).sort((a, b) =>\n ((state.outbox[a].nextAttemptAt ?? 0) - (state.outbox[b].nextAttemptAt ?? 0)) || (a < b ? -1 : a > b ? 1 : 0))\n for (const d of order) {\n const e = transportEntryOf(state, 'document', d, when, horizonMs)\n if (e) out.push(e)\n }\n for (const d of Object.keys(state.effects).sort()) {\n const a = state.effects[d].ack\n if (a === null) continue\n const e = transportEntryOf(state, 'ack', a.digest, when, horizonMs)\n if (e) out.push(e)\n }\n // the duplicates' answers due, each its own entry beside the retries\n for (const d of Object.keys(state.effects).sort()) {\n const a = state.effects[d].ack\n if (a === null || a.answerDue !== true) continue\n const e = transportEntryOf(state, 'ack', a.digest, when, horizonMs, a.answers)\n if (e) out.push(e)\n }\n return out\n}\n\n/**\n * Build an engine over the ports and modules: resolves and probes\n * WebCrypto, freezes the registries (duplicate command names, task URIs\n * or duty kinds throw), and initialises an empty store with the empty\n * state at the current codec.\n */\nexport async function createEngine (ports: EnginePorts, modules: readonly HolderModule[], opts: EngineOptions = {}): Promise<Engine> {\n if (!ports?.store || !ports.keys) throw new TypeError('createEngine needs a store and keys')\n const crypto = await resolveCrypto(ports.crypto)\n const engine = new HolderEngine(ports, crypto, modules, opts)\n await engine.load()\n return engine\n}\n"]}