@serfab/cadre-core 0.12.0 → 1.0.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.
Files changed (155) hide show
  1. package/README.md +23 -8
  2. package/dist/bootstrap-peer-store-file.js +2 -2
  3. package/dist/bootstrap-peer-store.d.ts +32 -12
  4. package/dist/bootstrap-peer-store.js +41 -15
  5. package/dist/bootstrap-peer-store.js.map +1 -1
  6. package/dist/cadre-node.d.ts +883 -102
  7. package/dist/cadre-node.js +1800 -209
  8. package/dist/cadre-node.js.map +1 -1
  9. package/dist/control-authorization.d.ts +2 -2
  10. package/dist/control-authorization.js +1 -0
  11. package/dist/control-authorization.js.map +1 -1
  12. package/dist/control-cohort.d.ts +13 -26
  13. package/dist/control-cohort.js +0 -26
  14. package/dist/control-cohort.js.map +1 -1
  15. package/dist/control-database.d.ts +318 -44
  16. package/dist/control-database.js +516 -74
  17. package/dist/control-database.js.map +1 -1
  18. package/dist/control-read-retry.d.ts +40 -11
  19. package/dist/control-read-retry.js +48 -15
  20. package/dist/control-read-retry.js.map +1 -1
  21. package/dist/control-retry.d.ts +58 -3
  22. package/dist/control-retry.js +58 -3
  23. package/dist/control-retry.js.map +1 -1
  24. package/dist/control-schema.d.ts +1 -1
  25. package/dist/control-schema.js +133 -21
  26. package/dist/control-schema.js.map +1 -1
  27. package/dist/control-write-retry.d.ts +80 -11
  28. package/dist/control-write-retry.js +168 -29
  29. package/dist/control-write-retry.js.map +1 -1
  30. package/dist/enrolled-machine-store-file.d.ts +13 -0
  31. package/dist/enrolled-machine-store-file.js +41 -0
  32. package/dist/enrolled-machine-store-file.js.map +1 -0
  33. package/dist/enrolled-machine-store.d.ts +81 -0
  34. package/dist/enrolled-machine-store.js +225 -0
  35. package/dist/enrolled-machine-store.js.map +1 -0
  36. package/dist/file-durable-slot.js +5 -3
  37. package/dist/file-durable-slot.js.map +1 -1
  38. package/dist/index.d.ts +17 -8
  39. package/dist/index.js +54 -9
  40. package/dist/index.js.map +1 -1
  41. package/dist/membership-connection-gater.d.ts +15 -1
  42. package/dist/membership-connection-gater.js +9 -3
  43. package/dist/membership-connection-gater.js.map +1 -1
  44. package/dist/node-local-snapshot.d.ts +21 -7
  45. package/dist/node-local-snapshot.js +30 -9
  46. package/dist/node-local-snapshot.js.map +1 -1
  47. package/dist/peer-dial.d.ts +143 -0
  48. package/dist/peer-dial.js +176 -0
  49. package/dist/peer-dial.js.map +1 -0
  50. package/dist/{strand-backfill.d.ts → peer-join-backfill.d.ts} +49 -20
  51. package/dist/{strand-backfill.js → peer-join-backfill.js} +133 -52
  52. package/dist/peer-join-backfill.js.map +1 -0
  53. package/dist/relay-addrs.d.ts +160 -49
  54. package/dist/relay-addrs.js +287 -60
  55. package/dist/relay-addrs.js.map +1 -1
  56. package/dist/relay-reservation.d.ts +71 -3
  57. package/dist/relay-reservation.js +116 -8
  58. package/dist/relay-reservation.js.map +1 -1
  59. package/dist/seed-bootstrap.d.ts +30 -1
  60. package/dist/seed-bootstrap.js +62 -17
  61. package/dist/seed-bootstrap.js.map +1 -1
  62. package/dist/storage-scope.d.ts +62 -0
  63. package/dist/storage-scope.js +75 -0
  64. package/dist/storage-scope.js.map +1 -0
  65. package/dist/strand-database.d.ts +41 -11
  66. package/dist/strand-database.js +48 -18
  67. package/dist/strand-database.js.map +1 -1
  68. package/dist/strand-first-sync-gate.d.ts +152 -0
  69. package/dist/strand-first-sync-gate.js +208 -0
  70. package/dist/strand-first-sync-gate.js.map +1 -0
  71. package/dist/strand-formation-manager.d.ts +99 -5
  72. package/dist/strand-formation-manager.js +119 -8
  73. package/dist/strand-formation-manager.js.map +1 -1
  74. package/dist/strand-formation-protocol.d.ts +97 -3
  75. package/dist/strand-formation-protocol.js +108 -2
  76. package/dist/strand-formation-protocol.js.map +1 -1
  77. package/dist/strand-instance-manager.d.ts +389 -19
  78. package/dist/strand-instance-manager.js +678 -65
  79. package/dist/strand-instance-manager.js.map +1 -1
  80. package/dist/strand-member-key.d.ts +20 -12
  81. package/dist/strand-member-key.js +20 -12
  82. package/dist/strand-member-key.js.map +1 -1
  83. package/dist/strand-member-registry.js +3 -0
  84. package/dist/strand-member-registry.js.map +1 -1
  85. package/dist/strand-membership-reconciler.d.ts +361 -0
  86. package/dist/strand-membership-reconciler.js +548 -0
  87. package/dist/strand-membership-reconciler.js.map +1 -0
  88. package/dist/strand-membership-writer.d.ts +143 -11
  89. package/dist/strand-membership-writer.js +419 -135
  90. package/dist/strand-membership-writer.js.map +1 -1
  91. package/dist/strand-network-config.d.ts +116 -0
  92. package/dist/strand-network-config.js +192 -0
  93. package/dist/strand-network-config.js.map +1 -0
  94. package/dist/strand-revocation-enforcer.d.ts +392 -0
  95. package/dist/strand-revocation-enforcer.js +533 -0
  96. package/dist/strand-revocation-enforcer.js.map +1 -0
  97. package/dist/strand-solicitation.d.ts +17 -1
  98. package/dist/strand-solicitation.js +13 -2
  99. package/dist/strand-solicitation.js.map +1 -1
  100. package/dist/strand-wake-protocol.d.ts +11 -7
  101. package/dist/strand-wake-protocol.js +20 -52
  102. package/dist/strand-wake-protocol.js.map +1 -1
  103. package/dist/strand-watcher.js +12 -1
  104. package/dist/strand-watcher.js.map +1 -1
  105. package/dist/timed-step.d.ts +12 -0
  106. package/dist/timed-step.js +28 -0
  107. package/dist/timed-step.js.map +1 -0
  108. package/dist/timeout-scheduler.d.ts +19 -0
  109. package/dist/timeout-scheduler.js +22 -0
  110. package/dist/timeout-scheduler.js.map +1 -0
  111. package/dist/types.d.ts +472 -46
  112. package/dist/types.js +7 -1
  113. package/dist/types.js.map +1 -1
  114. package/package.json +16 -8
  115. package/src/bootstrap-peer-store-file.ts +2 -2
  116. package/src/bootstrap-peer-store.ts +69 -27
  117. package/src/cadre-node.ts +1926 -228
  118. package/src/control-authorization.ts +2 -1
  119. package/src/control-cohort.ts +122 -130
  120. package/src/control-database.ts +586 -74
  121. package/src/control-read-retry.ts +202 -167
  122. package/src/control-retry.ts +297 -190
  123. package/src/control-schema.ts +133 -21
  124. package/src/control-write-retry.ts +525 -383
  125. package/src/enrolled-machine-store-file.ts +43 -0
  126. package/src/enrolled-machine-store.ts +280 -0
  127. package/src/file-durable-slot.ts +5 -3
  128. package/src/index.ts +134 -15
  129. package/src/membership-connection-gater.ts +9 -3
  130. package/src/node-local-snapshot.ts +38 -9
  131. package/src/peer-addr-book.ts +251 -250
  132. package/src/peer-dial.ts +215 -0
  133. package/src/{strand-backfill.ts → peer-join-backfill.ts} +478 -389
  134. package/src/relay-addrs.ts +458 -218
  135. package/src/relay-reservation.ts +951 -828
  136. package/src/seed-bootstrap.ts +76 -18
  137. package/src/storage-scope.ts +78 -0
  138. package/src/strand-database.ts +61 -21
  139. package/src/strand-first-sync-gate.ts +258 -0
  140. package/src/strand-formation-manager.ts +162 -8
  141. package/src/strand-formation-protocol.ts +850 -692
  142. package/src/strand-instance-manager.ts +877 -74
  143. package/src/strand-member-key.ts +20 -12
  144. package/src/strand-member-registry.ts +3 -0
  145. package/src/strand-membership-reconciler.ts +680 -0
  146. package/src/strand-membership-writer.ts +550 -190
  147. package/src/strand-network-config.ts +250 -0
  148. package/src/strand-revocation-enforcer.ts +653 -0
  149. package/src/strand-solicitation.ts +499 -471
  150. package/src/strand-wake-protocol.ts +21 -66
  151. package/src/strand-watcher.ts +325 -314
  152. package/src/timed-step.ts +28 -0
  153. package/src/timeout-scheduler.ts +28 -0
  154. package/src/types.ts +487 -52
  155. package/dist/strand-backfill.js.map +0 -1
@@ -100,6 +100,29 @@ export declare function signStrandApproval(fields: ReadonlyArray<string | number
100
100
  * @returns A fresh base64url stamp (43 chars for 32 bytes).
101
101
  */
102
102
  export declare function generateStrandStampId(): string;
103
+ /**
104
+ * A membership writer that runs only in a transaction of its own found another
105
+ * transaction already open on the strand database, and wrote nothing. Raised only
106
+ * under `joinOpenTransaction: false` (see {@link StrandWriteOptions}) — the background
107
+ * callers, which treat it as "the app is mid-transaction; try again later".
108
+ */
109
+ export declare class StrandTransactionBusyError extends Error {
110
+ constructor(options?: ErrorOptions);
111
+ }
112
+ /** Options every transactional membership writer accepts. */
113
+ export interface StrandWriteOptions {
114
+ /**
115
+ * Default true: when a transaction is already open on the database, run the writer's
116
+ * statements inside it. The caller composes several writers in one transaction (e.g. a
117
+ * resign + revoke pair that must land together) and owns its commit and rollback, so
118
+ * the deferred constraints fire once, at the caller's commit.
119
+ *
120
+ * Background callers (the membership reconciler, the unpublish binding cleanup) pass
121
+ * false: they share the database with the app and must never join a transaction
122
+ * someone else opened, so the writer throws {@link StrandTransactionBusyError} instead.
123
+ */
124
+ joinOpenTransaction?: boolean;
125
+ }
103
126
  /** Parameters for {@link bootstrapFounderMembership}. */
104
127
  export interface FounderBootstrapParams {
105
128
  /** The strand id — written to `Header.Id`. */
@@ -114,7 +137,45 @@ export interface FounderBootstrapParams {
114
137
  * Required for a closed strand; ignored for an open strand.
115
138
  */
116
139
  founderKeyPair?: Ed25519KeyPair;
140
+ /**
141
+ * The public key derived from the strand row's SHARED `MemberPrivateKey` (the read
142
+ * secret every joining party holds). When supplied for a closed strand, a
143
+ * `Strand.Member` or `Strand.Manager` row holding it refuses the bootstrap with
144
+ * {@link PreSplitStrandIdentityError} (see {@link assertNotPreSplitStrand}): nothing
145
+ * seats that key since the per-party identity split, so its presence is exactly the
146
+ * fingerprint of a strand founded before it. Omitted, no such check runs (a caller that
147
+ * holds no shared key has nothing to compare against). Ignored for an open strand.
148
+ */
149
+ sharedMemberPublicKey?: string;
150
+ }
151
+ /**
152
+ * A closed strand founded BEFORE the per-party identity split: its founding
153
+ * `Strand.Member` (and, unless handed on, `Strand.Manager`) is the key derived from the
154
+ * shared `MemberPrivateKey`, which every joining party holds, so any member can sign as
155
+ * the founder. There is no repair — rewriting the membership cannot be trusted, since any
156
+ * joiner could already have admitted or revoked anyone, or could race the rewrite — so
157
+ * the strand must be recreated. Thrown by {@link assertNotPreSplitStrand} (a founder
158
+ * bootstrap, or membership-invite issuance); the formation layer maps it to a
159
+ * non-retryable rejection.
160
+ */
161
+ export declare class PreSplitStrandIdentityError extends Error {
162
+ readonly strandId: string;
163
+ constructor(strandId: string);
117
164
  }
165
+ /**
166
+ * Refuse a closed strand whose membership still holds the key derived from the shared
167
+ * `MemberPrivateKey` (see {@link FounderBootstrapParams.sharedMemberPublicKey}). `Member`
168
+ * is the primary probe — every manager is a member (`Manager.MemberExists`), so it also
169
+ * catches a pre-split founder who handed management to another key and resigned, or a
170
+ * sealed pre-split strand. `Manager` is probed too, for the partition case the schema
171
+ * notes on `MemberExists` (a Manager row converged without its Member row). Cannot
172
+ * misfire: nothing seats the shared-derived key since the split, and rows not yet loaded
173
+ * read as absent.
174
+ *
175
+ * @throws {PreSplitStrandIdentityError} when a `Strand.Member` or `Strand.Manager` row is
176
+ * the shared-derived key.
177
+ */
178
+ export declare function assertNotPreSplitStrand(db: Database, strandId: string, sharedMemberPublicKey: string): Promise<void>;
118
179
  /**
119
180
  * Founder-only one-time bootstrap of a strand's `Strand.*` membership/RBAC rows.
120
181
  *
@@ -136,10 +197,17 @@ export interface FounderBootstrapParams {
136
197
  * Manager could never admit anyone, so failing loudly here (which propagates out
137
198
  * of `StrandDatabase.initialize()` and triggers the runtime's rollback) is correct.
138
199
  *
200
+ * A closed strand whose membership holds `sharedMemberPublicKey` throws
201
+ * {@link PreSplitStrandIdentityError} before writing anything: the insert-if-absent
202
+ * guards would otherwise skip over its pre-split founding rows and leave the shared
203
+ * key seated.
204
+ *
139
205
  * @param db - The strand's Quereus database (schema already applied).
140
206
  * @param params - Strand id/type, the sApp config for the Header, and (closed only)
141
- * the derived founder keypair.
207
+ * the derived founder keypair and the shared-derived public key to refuse.
142
208
  * @throws If `type === 'c'` and no `founderKeyPair` is supplied.
209
+ * @throws {PreSplitStrandIdentityError} If `type === 'c'` and a `Strand.Member` or
210
+ * `Strand.Manager` row is `sharedMemberPublicKey`.
143
211
  */
144
212
  export declare function bootstrapFounderMembership(db: Database, params: FounderBootstrapParams): Promise<void>;
145
213
  /** Parameters for {@link issueInvite}. */
@@ -244,11 +312,41 @@ export interface ConsumeInviteParams {
244
312
  * @param db - The closed strand's database.
245
313
  * @param params - The invite key/secret, the joining member's public key, and an
246
314
  * optional `nowMs` instant for the expiry comparison (default `Date.now()`).
315
+ * @param options - Whether to join an already-open transaction (see {@link StrandWriteOptions}).
247
316
  * @throws If any constraint rejects (bad signature, missing invite, or an expired
248
317
  * invite); the whole transaction rolls back (neither the `Member` nor the
249
318
  * `ConsumedInvite` row survives).
319
+ * @throws {StrandTransactionBusyError} Under `joinOpenTransaction: false`, when another
320
+ * transaction is open; nothing was written.
250
321
  */
251
- export declare function consumeInvite(db: Database, params: ConsumeInviteParams): Promise<void>;
322
+ export declare function consumeInvite(db: Database, params: ConsumeInviteParams, options?: StrandWriteOptions): Promise<void>;
323
+ /**
324
+ * Burn an invitation against an ALREADY-SEATED member: insert the
325
+ * `Strand.ConsumedInvite` row alone, naming the existing `Member.Key`, so the bearer
326
+ * credential can never be spent by anyone else.
327
+ *
328
+ * The already-member arm of the bring-up membership reconciler
329
+ * (`strand-membership-reconciler.ts`): a machine that finds its party's `Member` row
330
+ * already present (a sibling machine redeemed the invitation's twin first, or a
331
+ * manager admitted the party directly) may still hold an UNSPENT formation-delivered
332
+ * invitation — a bearer credential whoever presents can join with. Every
333
+ * `ConsumedInvite` constraint is satisfiable without a same-transaction `Member`
334
+ * insert (`MemberExists` reads the live table), so this is one statement whose
335
+ * deferred checks fire at its own commit. It seats nobody now or later:
336
+ * `Member.Authorized`'s invite branch requires a same-transaction FRESH consumption,
337
+ * so the row it leaves is exactly as inert as any other spent invitation's.
338
+ *
339
+ * @param db - The closed strand's database (the member already exists).
340
+ * @param params - The invite key/secret and the EXISTING member's public key, plus the
341
+ * optional `nowMs` instant for the expiry gate (default `Date.now()`).
342
+ * @param options - Whether to join an already-open transaction (see {@link StrandWriteOptions}).
343
+ * @throws If any constraint rejects — already consumed (the `InviteKey` primary key),
344
+ * cancelled, expired, or a sealed strand. Callers treat a burn failure as "already
345
+ * dead" and log rather than retry.
346
+ * @throws {StrandTransactionBusyError} Under `joinOpenTransaction: false`, when another
347
+ * transaction is open; nothing was tried, so the invitation is exactly as live as before.
348
+ */
349
+ export declare function burnInvite(db: Database, params: ConsumeInviteParams, options?: StrandWriteOptions): Promise<void>;
252
350
  /** Parameters for {@link cancelInvite}. */
253
351
  export interface CancelInviteParams {
254
352
  /**
@@ -338,6 +436,15 @@ export interface OutstandingInvite {
338
436
  * matters); empty if none.
339
437
  */
340
438
  export declare function listOutstandingInvites(db: Database, nowMs?: number): Promise<OutstandingInvite[]>;
439
+ /**
440
+ * Whether `memberKey` holds a live `Strand.Member` row, as seen by THIS database
441
+ * instance — the membership probe behind the bring-up reconciler
442
+ * (`strand-membership-reconciler.ts`). Reads via {@link memberStampId}'s unfiltered
443
+ * scan + JavaScript compare (the {@link scanMemberPeers} argument for why a PK point
444
+ * lookup is not reliable on a networked strand). Local visibility only: `false` can
445
+ * mean "not replicated here yet", never a durable verdict about the strand.
446
+ */
447
+ export declare function isStrandMember(db: Database, memberKey: string): Promise<boolean>;
341
448
  /** Parameters for {@link addMemberByManager}. */
342
449
  export interface AddMemberByManagerParams {
343
450
  /**
@@ -364,10 +471,11 @@ export interface AddMemberByManagerParams {
364
471
  *
365
472
  * @param db - The closed strand's database.
366
473
  * @param params - The admitting manager keypair and the new member key.
474
+ * @param options - Whether to join an already-open transaction (see {@link StrandWriteOptions}).
367
475
  * @throws If `Member.Authorized` rejects (e.g. a non-manager key); the insert
368
476
  * rolls back, leaving no `Member` row.
369
477
  */
370
- export declare function addMemberByManager(db: Database, params: AddMemberByManagerParams): Promise<void>;
478
+ export declare function addMemberByManager(db: Database, params: AddMemberByManagerParams, options?: StrandWriteOptions): Promise<void>;
371
479
  /** Parameters for {@link revokeMember}. */
372
480
  export interface RevokeMemberParams {
373
481
  /**
@@ -417,14 +525,22 @@ export interface RevokeMemberParams {
417
525
  * (`Member.MinOneMember`, a local-count floor with the cross-node caveat its
418
526
  * schema NOTE states).
419
527
  *
528
+ * Callers running inside a cadre runtime should follow this write with
529
+ * `CadreNode.refreshRevocationEnforcement(strandId)`. The removed party's
530
+ * machines are refused at the network layer by the strand's revoked-peer gate
531
+ * (`strand-revocation-enforcer.ts`), which polls for membership changes because
532
+ * this bare `Database` handle raises no event the runtime can hook — so without
533
+ * that call the cut lands up to one poll interval (default 30 s) later.
534
+ *
420
535
  * @param db - The closed strand's database.
421
536
  * @param params - The revoking manager keypair and the target member key.
537
+ * @param options - Whether to join an already-open transaction (see {@link StrandWriteOptions}).
422
538
  * @throws If `Member.Authorized` rejects (a non-manager or same-transaction
423
539
  * signer), `Member.NotAManager` rejects (the target still holds a Manager
424
540
  * row), or `Member.MinOneMember` rejects (the removal would empty the member
425
541
  * set); the whole delete+tombstone transaction rolls back.
426
542
  */
427
- export declare function revokeMember(db: Database, params: RevokeMemberParams): Promise<void>;
543
+ export declare function revokeMember(db: Database, params: RevokeMemberParams, options?: StrandWriteOptions): Promise<void>;
428
544
  /** Parameters for {@link leaveStrand}. */
429
545
  export interface LeaveStrandParams {
430
546
  /**
@@ -452,12 +568,18 @@ export interface LeaveStrandParams {
452
568
  * The same floors as {@link revokeMember} apply: a manager must resign first
453
569
  * (`NotAManager`) and the last member cannot leave (`MinOneMember`).
454
570
  *
571
+ * Like {@link revokeMember}, a caller inside a cadre runtime should follow this
572
+ * with `CadreNode.refreshRevocationEnforcement(strandId)` — here it is what
573
+ * makes the departing node notice its own departure promptly (the gate emits
574
+ * `strand:revoked` when it finds this node's own peer id revoked).
575
+ *
455
576
  * @param db - The closed strand's database.
456
577
  * @param params - The departing member's own keypair.
578
+ * @param options - Whether to join an already-open transaction (see {@link StrandWriteOptions}).
457
579
  * @throws If `Member.Authorized`, `Member.NotAManager`, or `Member.MinOneMember`
458
580
  * rejects; the whole delete+tombstone transaction rolls back.
459
581
  */
460
- export declare function leaveStrand(db: Database, params: LeaveStrandParams): Promise<void>;
582
+ export declare function leaveStrand(db: Database, params: LeaveStrandParams, options?: StrandWriteOptions): Promise<void>;
461
583
  /** Parameters for {@link registerMemberPeer}. */
462
584
  export interface RegisterMemberPeerParams {
463
585
  /**
@@ -503,10 +625,13 @@ export interface RegisterMemberPeerParams {
503
625
  *
504
626
  * @param db - The closed strand's database (the member already exists).
505
627
  * @param params - The member's own keypair and the peer id to bind.
628
+ * @param options - Whether to join an already-open transaction (see {@link StrandWriteOptions}).
506
629
  * @throws If `MemberPeer.Authorized`/`MemberExists` rejects (wrong signer, or no
507
630
  * matching `Member` row); the insert rolls back, leaving no `MemberPeer` row.
631
+ * @throws {StrandTransactionBusyError} Under `joinOpenTransaction: false`, when another
632
+ * transaction is open; nothing was written.
508
633
  */
509
- export declare function registerMemberPeer(db: Database, params: RegisterMemberPeerParams): Promise<void>;
634
+ export declare function registerMemberPeer(db: Database, params: RegisterMemberPeerParams, options?: StrandWriteOptions): Promise<void>;
510
635
  /**
511
636
  * Every `PeerId` currently bound to `memberKey`, in storage order.
512
637
  *
@@ -589,10 +714,13 @@ export type RemoveMemberPeerParams = RemoveOwnPeerParams | RemoveMemberPeerByMan
589
714
  * @param db - The closed strand's database.
590
715
  * @param params - Either the owning member's keypair, or a manager's keypair plus the
591
716
  * target member key.
717
+ * @param options - Whether to join an already-open transaction (see {@link StrandWriteOptions}).
592
718
  * @throws If `MemberPeer.Authorized` rejects (neither branch satisfied), or if the row
593
719
  * is still present after the delete (see the point-lookup note below).
720
+ * @throws {StrandTransactionBusyError} Under `joinOpenTransaction: false`, when another
721
+ * transaction is open; nothing was written.
594
722
  */
595
- export declare function removeMemberPeer(db: Database, params: RemoveMemberPeerParams): Promise<void>;
723
+ export declare function removeMemberPeer(db: Database, params: RemoveMemberPeerParams, options?: StrandWriteOptions): Promise<void>;
596
724
  /** Parameters for {@link addManager}. */
597
725
  export interface AddManagerParams {
598
726
  /**
@@ -636,11 +764,12 @@ export interface AddManagerParams {
636
764
  *
637
765
  * @param db - The closed strand's database (founder manager already seated).
638
766
  * @param params - The authorizing manager's keypair and the new manager key.
767
+ * @param options - Whether to join an already-open transaction (see {@link StrandWriteOptions}).
639
768
  * @throws If `Manager.Authorized` rejects, or if `Manager.MemberExists` rejects because
640
769
  * `newManagerKey` holds no `Member` row (admit it first, or use
641
770
  * {@link admitManager}); the insert rolls back.
642
771
  */
643
- export declare function addManager(db: Database, params: AddManagerParams): Promise<void>;
772
+ export declare function addManager(db: Database, params: AddManagerParams, options?: StrandWriteOptions): Promise<void>;
644
773
  /** Parameters for {@link admitManager} — the same shape as {@link AddManagerParams}. */
645
774
  export type AdmitManagerParams = AddManagerParams;
646
775
  /**
@@ -670,10 +799,11 @@ export type AdmitManagerParams = AddManagerParams;
670
799
  *
671
800
  * @param db - The closed strand's database (founder manager already seated).
672
801
  * @param params - The authorizing manager's keypair and the key to admit + promote.
802
+ * @param options - Whether to join an already-open transaction (see {@link StrandWriteOptions}).
673
803
  * @throws If either half is rejected (`Member.Authorized`, `Manager.Authorized`, a
674
804
  * duplicate `Member` key, …); the whole transaction rolls back, leaving neither row.
675
805
  */
676
- export declare function admitManager(db: Database, params: AdmitManagerParams): Promise<void>;
806
+ export declare function admitManager(db: Database, params: AdmitManagerParams, options?: StrandWriteOptions): Promise<void>;
677
807
  /** Parameters for {@link removeManager}. */
678
808
  export interface RemoveManagerParams {
679
809
  /**
@@ -758,13 +888,14 @@ export interface RemoveManagerParams {
758
888
  *
759
889
  * @param db - The closed strand's database.
760
890
  * @param params - The authorizing keypair and the target manager key.
891
+ * @param options - Whether to join an already-open transaction (see {@link StrandWriteOptions}).
761
892
  * @throws If the signer IS the target and it is the sole manager (before writing —
762
893
  * the operation the caller wants is {@link sealStrand}), or if `Manager.Authorized`
763
894
  * rejects (a signer that is neither another existing manager nor the target
764
895
  * itself, or a raw sole-manager `'resign'` whose post-image count is zero); the
765
896
  * whole delete+tombstone transaction rolls back.
766
897
  */
767
- export declare function removeManager(db: Database, params: RemoveManagerParams): Promise<void>;
898
+ export declare function removeManager(db: Database, params: RemoveManagerParams, options?: StrandWriteOptions): Promise<void>;
768
899
  /** Parameters for {@link sealStrand}. */
769
900
  export interface SealStrandParams {
770
901
  /**
@@ -813,6 +944,7 @@ export interface SealStrandParams {
813
944
  *
814
945
  * @param db - The closed strand's database.
815
946
  * @param params - The sole manager's own keypair.
947
+ * @param options - Whether to join an already-open transaction (see {@link StrandWriteOptions}).
816
948
  * @throws If more than one manager exists (the caller wants {@link removeManager}),
817
949
  * or the supplied keypair holds no `Manager` row while one exists, or the strand
818
950
  * holds no `Manager` row and has never retired one (not founded yet — see
@@ -821,7 +953,7 @@ export interface SealStrandParams {
821
953
  * and returns quietly (restart-safe, matching {@link bootstrapFounderMembership}
822
954
  * and {@link removeManager}'s absent-row no-op).
823
955
  */
824
- export declare function sealStrand(db: Database, params: SealStrandParams): Promise<void>;
956
+ export declare function sealStrand(db: Database, params: SealStrandParams, options?: StrandWriteOptions): Promise<void>;
825
957
  /**
826
958
  * Whether the strand is sealed: a CLOSED strand that holds no `Manager` rows AND
827
959
  * has retired at least one `Manager` stamp into `Strand.Revocation`.