@coasys/ad4m 0.13.1-staging.6 → 0.13.1-staging.8

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 (174) hide show
  1. package/lib/index.cjs +1130 -650
  2. package/lib/index.js +1130 -651
  3. package/lib/src/Ad4mClient.d.ts +3 -0
  4. package/lib/src/Ad4mClient.js +9 -2
  5. package/lib/src/agent/Agent.d.ts +5 -1
  6. package/lib/src/agent/Agent.js +3 -0
  7. package/lib/src/agent/AgentClient.d.ts +3 -0
  8. package/lib/src/agent/AgentClient.js +3 -0
  9. package/lib/src/agent/AgentStatus.d.ts +2 -0
  10. package/lib/src/agent/AgentStatus.js +2 -0
  11. package/lib/src/apiClient.d.ts +41 -0
  12. package/lib/src/apiClient.js +138 -1
  13. package/lib/src/generated/api/AgentStatus.d.ts +5 -0
  14. package/lib/src/generated/api/AgentWithIdentity.d.ts +14 -0
  15. package/lib/src/generated/api/AgentWithIdentity.js +1 -0
  16. package/lib/src/generated/api/BotView.d.ts +7 -0
  17. package/lib/src/generated/api/BotView.js +2 -0
  18. package/lib/src/generated/api/ClaimOfferParams.d.ts +13 -0
  19. package/lib/src/generated/api/ClaimOfferParams.js +2 -0
  20. package/lib/src/generated/api/ClaimOfferResult.d.ts +14 -0
  21. package/lib/src/generated/api/ClaimOfferResult.js +1 -0
  22. package/lib/src/generated/api/ClaimView.d.ts +11 -0
  23. package/lib/src/generated/api/ClaimView.js +2 -0
  24. package/lib/src/generated/api/CosignInceptParams.d.ts +10 -0
  25. package/lib/src/generated/api/CosignInceptParams.js +1 -0
  26. package/lib/src/generated/api/DeviceView.d.ts +17 -0
  27. package/lib/src/generated/api/DeviceView.js +1 -0
  28. package/lib/src/generated/api/DidBotScope.d.ts +7 -0
  29. package/lib/src/generated/api/DidBotScope.js +2 -0
  30. package/lib/src/generated/api/DidDocument.d.ts +16 -0
  31. package/lib/src/generated/api/DidDocument.js +1 -0
  32. package/lib/src/generated/api/DidDocumentMetadata.d.ts +18 -0
  33. package/lib/src/generated/api/DidDocumentMetadata.js +2 -0
  34. package/lib/src/generated/api/DidResolutionMetadata.d.ts +51 -0
  35. package/lib/src/generated/api/DidResolutionMetadata.js +1 -0
  36. package/lib/src/generated/api/DidResolutionResult.d.ts +16 -0
  37. package/lib/src/generated/api/DidResolutionResult.js +1 -0
  38. package/lib/src/generated/api/DidVerificationMethod.d.ts +17 -0
  39. package/lib/src/generated/api/DidVerificationMethod.js +1 -0
  40. package/lib/src/generated/api/Events.d.ts +2 -0
  41. package/lib/src/generated/api/ForkRecord.d.ts +11 -0
  42. package/lib/src/generated/api/ForkRecord.js +2 -0
  43. package/lib/src/generated/api/IdentityForkEvent.d.ts +10 -0
  44. package/lib/src/generated/api/IdentityForkEvent.js +2 -0
  45. package/lib/src/generated/api/IdentityLog.d.ts +18 -0
  46. package/lib/src/generated/api/IdentityLog.js +1 -0
  47. package/lib/src/generated/api/IdentityStatus.d.ts +48 -0
  48. package/lib/src/generated/api/IdentityStatus.js +1 -0
  49. package/lib/src/generated/api/JoinStatus.d.ts +10 -0
  50. package/lib/src/generated/api/JoinStatus.js +2 -0
  51. package/lib/src/generated/api/JoinStatusParams.d.ts +6 -0
  52. package/lib/src/generated/api/JoinStatusParams.js +2 -0
  53. package/lib/src/generated/api/LogParams.d.ts +17 -0
  54. package/lib/src/generated/api/LogParams.js +2 -0
  55. package/lib/src/generated/api/Offer.d.ts +14 -0
  56. package/lib/src/generated/api/Offer.js +1 -0
  57. package/lib/src/generated/api/OfferKind.d.ts +4 -0
  58. package/lib/src/generated/api/OfferKind.js +2 -0
  59. package/lib/src/generated/api/OfferListing.d.ts +9 -0
  60. package/lib/src/generated/api/OfferListing.js +1 -0
  61. package/lib/src/generated/api/OfferOpened.d.ts +6 -0
  62. package/lib/src/generated/api/OfferOpened.js +2 -0
  63. package/lib/src/generated/api/OfferState.d.ts +21 -0
  64. package/lib/src/generated/api/OfferState.js +1 -0
  65. package/lib/src/generated/api/OffersParams.d.ts +11 -0
  66. package/lib/src/generated/api/OffersParams.js +1 -0
  67. package/lib/src/generated/api/OpenOfferParams.d.ts +7 -0
  68. package/lib/src/generated/api/OpenOfferParams.js +1 -0
  69. package/lib/src/generated/api/PublishParams.d.ts +11 -0
  70. package/lib/src/generated/api/PublishParams.js +1 -0
  71. package/lib/src/generated/api/RequestBody.d.ts +15 -0
  72. package/lib/src/generated/api/RequestBody.js +2 -0
  73. package/lib/src/generated/api/ResetLogParams.d.ts +9 -0
  74. package/lib/src/generated/api/ResetLogParams.js +2 -0
  75. package/lib/src/generated/api/ResolveParams.d.ts +18 -0
  76. package/lib/src/generated/api/ResolveParams.js +2 -0
  77. package/lib/src/generated/api/RpcMethods.d.ts +68 -1
  78. package/lib/src/generated/api/RpcMethods.js +6 -0
  79. package/lib/src/generated/api/SignedBy.d.ts +8 -0
  80. package/lib/src/generated/api/SignedBy.js +2 -0
  81. package/lib/src/generated/api/SignedHead.d.ts +14 -0
  82. package/lib/src/generated/api/SignedHead.js +2 -0
  83. package/lib/src/generated/api/SignedOffer.d.ts +10 -0
  84. package/lib/src/generated/api/SignedOffer.js +1 -0
  85. package/lib/src/generated/api/SignedRequest.d.ts +8 -0
  86. package/lib/src/generated/api/SignedRequest.js +1 -0
  87. package/lib/src/generated/api/SkippedSource.d.ts +7 -0
  88. package/lib/src/generated/api/SkippedSource.js +2 -0
  89. package/lib/src/generated/api/StoreBehind.d.ts +13 -0
  90. package/lib/src/generated/api/StoreBehind.js +2 -0
  91. package/lib/src/generated/api/StoreInfo.d.ts +15 -0
  92. package/lib/src/generated/api/StoreInfo.js +2 -0
  93. package/lib/src/generated/api/index.d.ts +38 -0
  94. package/lib/src/identity/IdentityClient.d.ts +70 -0
  95. package/lib/src/identity/IdentityClient.js +97 -0
  96. package/lib/src/index.d.ts +1 -0
  97. package/lib/src/index.js +1 -0
  98. package/lib/src/model/Ad4mModel.d.ts +4 -0
  99. package/lib/src/model/Ad4mModel.js +12 -1
  100. package/lib/src/neighbourhood/MeshManager.d.ts +24 -0
  101. package/lib/src/neighbourhood/MeshManager.js +42 -1
  102. package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +10 -0
  103. package/lib/src/neighbourhood/NeighbourhoodClient.js +16 -0
  104. package/lib/src/neighbourhood/Session.js +2 -0
  105. package/lib/src/neighbourhood/SfuManager.d.ts +30 -3
  106. package/lib/src/neighbourhood/SfuManager.js +78 -41
  107. package/lib/src/perspectives/FlowInstance.js +6 -4
  108. package/lib/src/shacl/SHACLFlow.d.ts +5 -3
  109. package/lib/src/shacl/SHACLFlow.js +121 -5
  110. package/package.json +2 -2
  111. package/src/Ad4mClient.test.ts +64 -4
  112. package/src/Ad4mClient.ts +8 -0
  113. package/src/agent/Agent.ts +9 -1
  114. package/src/agent/AgentClient.ts +5 -1
  115. package/src/agent/AgentStatus.ts +4 -0
  116. package/src/apiClient.test.ts +302 -0
  117. package/src/apiClient.ts +136 -1
  118. package/src/generated/api/AgentStatus.ts +6 -1
  119. package/src/generated/api/AgentWithIdentity.ts +12 -0
  120. package/src/generated/api/BotView.ts +6 -0
  121. package/src/generated/api/ClaimOfferParams.ts +14 -0
  122. package/src/generated/api/ClaimOfferResult.ts +11 -0
  123. package/src/generated/api/ClaimView.ts +6 -0
  124. package/src/generated/api/CosignInceptParams.ts +11 -0
  125. package/src/generated/api/DeviceView.ts +12 -0
  126. package/src/generated/api/DidBotScope.ts +6 -0
  127. package/src/generated/api/DidDocument.ts +8 -0
  128. package/src/generated/api/DidDocumentMetadata.ts +19 -0
  129. package/src/generated/api/DidResolutionMetadata.ts +52 -0
  130. package/src/generated/api/DidResolutionResult.ts +13 -0
  131. package/src/generated/api/DidVerificationMethod.ts +15 -0
  132. package/src/generated/api/Events.ts +2 -0
  133. package/src/generated/api/ForkRecord.ts +9 -0
  134. package/src/generated/api/IdentityForkEvent.ts +7 -0
  135. package/src/generated/api/IdentityLog.ts +17 -0
  136. package/src/generated/api/IdentityStatus.ts +49 -0
  137. package/src/generated/api/JoinStatus.ts +7 -0
  138. package/src/generated/api/JoinStatusParams.ts +6 -0
  139. package/src/generated/api/LogParams.ts +18 -0
  140. package/src/generated/api/Offer.ts +8 -0
  141. package/src/generated/api/OfferKind.ts +6 -0
  142. package/src/generated/api/OfferListing.ts +8 -0
  143. package/src/generated/api/OfferOpened.ts +6 -0
  144. package/src/generated/api/OfferState.ts +7 -0
  145. package/src/generated/api/OffersParams.ts +11 -0
  146. package/src/generated/api/OpenOfferParams.ts +7 -0
  147. package/src/generated/api/PublishParams.ts +12 -0
  148. package/src/generated/api/RequestBody.ts +7 -0
  149. package/src/generated/api/ResetLogParams.ts +10 -0
  150. package/src/generated/api/ResolveParams.ts +19 -0
  151. package/src/generated/api/RpcMethods.ts +38 -1
  152. package/src/generated/api/SignedBy.ts +6 -0
  153. package/src/generated/api/SignedHead.ts +10 -0
  154. package/src/generated/api/SignedOffer.ts +8 -0
  155. package/src/generated/api/SignedRequest.ts +7 -0
  156. package/src/generated/api/SkippedSource.ts +6 -0
  157. package/src/generated/api/StoreBehind.ts +14 -0
  158. package/src/generated/api/StoreInfo.ts +16 -0
  159. package/src/generated/api/index.ts +39 -0
  160. package/src/identity/IdentityClient.ts +111 -0
  161. package/src/index.ts +1 -0
  162. package/src/model/Ad4mModel.ts +11 -1
  163. package/src/model/write-round-trips.test.ts +111 -2
  164. package/src/neighbourhood/MeshManager.test.ts +87 -0
  165. package/src/neighbourhood/MeshManager.ts +50 -1
  166. package/src/neighbourhood/NeighbourhoodClient.test.ts +27 -0
  167. package/src/neighbourhood/NeighbourhoodClient.ts +19 -0
  168. package/src/neighbourhood/Session.test.ts +5 -0
  169. package/src/neighbourhood/Session.ts +2 -0
  170. package/src/neighbourhood/SfuManager.test.ts +293 -0
  171. package/src/neighbourhood/SfuManager.ts +92 -45
  172. package/src/perspectives/FlowInstance.ts +6 -4
  173. package/src/shacl/SHACLFlow.test.ts +221 -0
  174. package/src/shacl/SHACLFlow.ts +121 -5
package/lib/index.cjs CHANGED
@@ -40,6 +40,12 @@ const READ_METHODS = new Set([
40
40
  "hosting.info",
41
41
  "hosting.wallet",
42
42
  "hosting.walletHistory",
43
+ "identity.devices",
44
+ "identity.joinStatus",
45
+ "identity.log",
46
+ "identity.offers",
47
+ "identity.resolve",
48
+ "identity.status",
43
49
  "language.all",
44
50
  "language.get",
45
51
  "language.meta",
@@ -150,6 +156,12 @@ const SLOWEST_LINK_BYTES_PER_MS = 16; // 16 kB/s
150
156
  * behind a large write. Shorter than PING_INTERVAL_MS, so the few ms a small
151
157
  * frame adds before a ping on an idle socket never cost a ping interval. */
152
158
  const PONG_RETURN_MS = 5000;
159
+ /** How long `checkConnection` waits for the open socket to say anything
160
+ * after its ping. If a large write sent before it may still be on the way,
161
+ * the wait lasts until that write could have crossed, as for the periodic
162
+ * ping, and half of this more for the pong. On a working path the pong is
163
+ * one round trip away. */
164
+ const CHECK_CONNECTION_DEADLINE_MS = 2000;
153
165
  /** The bytes `text` takes as UTF-8, as a WebSocket text frame sends it. */
154
166
  function utf8Length(text) {
155
167
  let bytes = text.length;
@@ -203,6 +215,8 @@ class ApiClient {
203
215
  * A message from the socket does not move it back: hearing from the executor says nothing
204
216
  * about how much of a large upload has reached it. */
205
217
  this._wsSentBy = 0;
218
+ /** A `checkConnection` probe waiting for the open socket to say anything; null when none. */
219
+ this._wsProbeTimer = null;
206
220
  // The executor sends a socket only the events it asked for (`events.watch`).
207
221
  // What the executor has for the open socket, as sent; a new socket has `{}`.
208
222
  this._watching = '{}';
@@ -212,6 +226,13 @@ class ApiClient {
212
226
  this._watchSent = Promise.resolve();
213
227
  this._watchRetries = 0;
214
228
  this._watchRetryTimer = null;
229
+ this._networkCallbacks = new Set();
230
+ /** Removes the network-change listeners; null while not listening. */
231
+ this._unlistenNetwork = null;
232
+ /** A network change waits for its socket to open, then tells `onNetworkChange`. */
233
+ this._networkChanged = false;
234
+ /** The socket dialled for the last network change. */
235
+ this._networkDial = null;
215
236
  this._wakeListening = false;
216
237
  /** `online` always; `visibilitychange` only when the page became visible. */
217
238
  this._onWake = (event) => {
@@ -242,6 +263,7 @@ class ApiClient {
242
263
  return;
243
264
  if (this._authFailed !== null)
244
265
  throw new RpcError(401, this._authFailed);
266
+ this._listenForNetworkChanges();
245
267
  // A dial ends any wait for one: a call or subscriber that dials during the backoff
246
268
  // leaves no timer behind to swallow the retry after this socket's own drop.
247
269
  this._cancelReconnect();
@@ -269,8 +291,10 @@ class ApiClient {
269
291
  // Only watchApplied() awaits this; a close before open is not an error otherwise.
270
292
  this._wsOpen.catch(() => { });
271
293
  ws.onmessage = (event) => {
272
- if (this._ws === ws)
294
+ if (this._ws === ws) {
273
295
  this._wsPingedAt = null;
296
+ this._endProbe();
297
+ }
274
298
  let parsed;
275
299
  try {
276
300
  parsed = JSON.parse(event.data);
@@ -342,6 +366,70 @@ class ApiClient {
342
366
  }
343
367
  }
344
368
  this._hasConnectedOnce = true;
369
+ if (this._networkChanged) {
370
+ this._networkChanged = false;
371
+ this._notifyNetworkChange();
372
+ }
373
+ }
374
+ /**
375
+ * Hear of network changes where the platform says so: `online` on the
376
+ * global object (browsers, Deno) redials at once, and `change` on
377
+ * `navigator.connection` (Chromium) runs `checkConnection`. Elsewhere,
378
+ * e.g. Node, nothing is heard and the ping deadline notices a dead
379
+ * socket on its own.
380
+ */
381
+ _listenForNetworkChanges() {
382
+ if (this._unlistenNetwork)
383
+ return;
384
+ const handler = () => this._onNetworkChange();
385
+ const removers = [];
386
+ const target = globalThis;
387
+ if (typeof target.addEventListener === 'function') {
388
+ target.addEventListener('online', handler);
389
+ removers.push(() => target.removeEventListener?.('online', handler));
390
+ }
391
+ const connection = globalThis.navigator?.connection;
392
+ if (typeof connection?.addEventListener === 'function') {
393
+ // `change` also fires when Chromium's downlink or rtt estimate
394
+ // moves, as a busy call makes it do: probe rather than drop.
395
+ const probe = () => this.checkConnection();
396
+ connection.addEventListener('change', probe);
397
+ removers.push(() => connection.removeEventListener?.('change', probe));
398
+ }
399
+ this._unlistenNetwork = () => { for (const remove of removers)
400
+ remove(); };
401
+ }
402
+ /**
403
+ * The network changed: the open socket most likely runs over a path that
404
+ * is gone, and nothing would say so before the ping deadline. Drop it as
405
+ * a silent socket is dropped and dial the next one now, without backoff.
406
+ * `onNetworkChange` callbacks fire once that socket opens.
407
+ */
408
+ _onNetworkChange() {
409
+ if (this._authFailed !== null)
410
+ return;
411
+ const ws = this._ws;
412
+ // A socket dialled for an earlier change is on the new network already.
413
+ if (ws && ws === this._networkDial && ws.readyState === 0 /* CONNECTING */)
414
+ return;
415
+ if (ws) {
416
+ console.info('Network changed; reconnecting the WebSocket');
417
+ this._onClose(ws);
418
+ ws.close();
419
+ }
420
+ this._cancelReconnect();
421
+ this._wsReconnectDelay = INITIAL_RECONNECT_DELAY_MS;
422
+ if (this._handlers.size === 0 && this._pendingCalls.size === 0) {
423
+ this._notifyNetworkChange();
424
+ return;
425
+ }
426
+ this._networkChanged = true;
427
+ this._ensureWs();
428
+ this._networkDial = this._ws;
429
+ }
430
+ _notifyNetworkChange() {
431
+ for (const cb of [...this._networkCallbacks])
432
+ callSafely(cb, 'Error in network-change callback:');
345
433
  }
346
434
  /** `reason` is set when the executor asked to try again later; calls that fail carry it. */
347
435
  _onClose(ws, reason) {
@@ -385,6 +473,9 @@ class ApiClient {
385
473
  this._wsPingTimer = setInterval(() => {
386
474
  if (this._ws !== ws)
387
475
  return;
476
+ // A probe has its own, shorter deadline and decides for this ping.
477
+ if (this._wsProbeTimer)
478
+ return;
388
479
  const ping = JSON.stringify({ type: 'ping' });
389
480
  if (this._wsPingedAt === null) {
390
481
  this._wsPingedAt = performance.now();
@@ -418,6 +509,13 @@ class ApiClient {
418
509
  clearInterval(this._wsPingTimer);
419
510
  this._wsPingTimer = null;
420
511
  }
512
+ this._endProbe();
513
+ }
514
+ _endProbe() {
515
+ if (this._wsProbeTimer) {
516
+ clearTimeout(this._wsProbeTimer);
517
+ this._wsProbeTimer = null;
518
+ }
421
519
  }
422
520
  _scheduleReconnect() {
423
521
  if (this._wsReconnectTimer || this._authFailed !== null)
@@ -676,6 +774,46 @@ class ApiClient {
676
774
  this._reconnectCallbacks.add(callback);
677
775
  return () => { this._reconnectCallbacks.delete(callback); };
678
776
  }
777
+ /** Register a callback that fires after the network changed (`online`,
778
+ * or a socket that failed `checkConnection`), once the socket dialled for the
779
+ * new network is open and its event watch sent. Calls made from it go
780
+ * out on that socket. Returns an unsubscribe function. */
781
+ onNetworkChange(callback) {
782
+ this._networkCallbacks.add(callback);
783
+ this._listenForNetworkChanges();
784
+ return () => { this._networkCallbacks.delete(callback); };
785
+ }
786
+ /**
787
+ * Check the open socket now rather than at the next ping: send a ping,
788
+ * and if nothing at all arrives on that socket within `deadlineMs`,
789
+ * treat it as a network change (drop it, dial the next one at once,
790
+ * `onNetworkChange` callbacks fire when it opens). Any message keeps it.
791
+ * For a caller that has seen its network path break, e.g. ICE going
792
+ * disconnected, where the platform fired no `online` event. Without an
793
+ * open socket, or while a check runs, this does nothing.
794
+ */
795
+ checkConnection(deadlineMs = CHECK_CONNECTION_DEADLINE_MS) {
796
+ const ws = this._ws;
797
+ if (!ws || ws.readyState !== 1 /* OPEN */ || this._wsProbeTimer)
798
+ return;
799
+ const first = this._wsPingedAt === null;
800
+ if (first)
801
+ this._wsPingedAt = performance.now();
802
+ this._send(ws, JSON.stringify({ type: 'ping' }));
803
+ if (first)
804
+ this._wsPingArrivesBy = this._wsSentBy;
805
+ // Any message from the socket ends the probe (`onmessage` → `_endProbe`).
806
+ // The ping reaches the executor only after what was sent before it,
807
+ // and its pong gets half the deadline to come back after that.
808
+ const wait = Math.max(deadlineMs, this._wsSentBy - performance.now() + deadlineMs / 2);
809
+ this._wsProbeTimer = setTimeout(() => {
810
+ this._wsProbeTimer = null;
811
+ if (this._ws !== ws)
812
+ return;
813
+ console.warn(`WebSocket silent for ${wait} ms after a check; reconnecting`);
814
+ this._onNetworkChange();
815
+ }, wait);
816
+ }
679
817
  /** Register a callback that fires once when the executor refuses this
680
818
  * client's token: a 401 reply, or a socket closed with code 1008. Every
681
819
  * call then fails with a 401 `RpcError` and the client does not reconnect;
@@ -693,6 +831,11 @@ class ApiClient {
693
831
  this._handlers.clear();
694
832
  this._reconnectCallbacks.clear();
695
833
  this._authFailedCallbacks.clear();
834
+ this._networkCallbacks.clear();
835
+ this._unlistenNetwork?.();
836
+ this._unlistenNetwork = null;
837
+ this._networkChanged = false;
838
+ this._networkDial = null;
696
839
  // A reused client must not fire onReconnect on its next first open.
697
840
  this._hasConnectedOnce = false;
698
841
  }
@@ -954,6 +1097,9 @@ class Agent {
954
1097
  static fromWire(wire) {
955
1098
  const agent = new Agent(wire.did, Perspective.fromWire(wire.perspective));
956
1099
  agent.directMessageLanguage = wire.directMessageLanguage;
1100
+ if ("identity" in wire && wire.identity) {
1101
+ agent.identity = wire.identity;
1102
+ }
957
1103
  return agent;
958
1104
  }
959
1105
  }
@@ -1109,6 +1255,8 @@ class AgentStatus {
1109
1255
  this.didDocument = obj.didDocument;
1110
1256
  //@ts-ignore
1111
1257
  this.error = obj.error;
1258
+ //@ts-ignore
1259
+ this.identity = obj.identity ?? null;
1112
1260
  }
1113
1261
  else {
1114
1262
  this.isInitialized = false;
@@ -1130,13 +1278,13 @@ class AgentStatus {
1130
1278
  * never need try/catch around cache operations
1131
1279
  * - Tree-shakeable: import only what you need
1132
1280
  */
1133
- var __classPrivateFieldSet$d = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1281
+ var __classPrivateFieldSet$e = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1134
1282
  if (kind === "m") throw new TypeError("Private method is not writable");
1135
1283
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1136
1284
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1137
1285
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1138
1286
  };
1139
- var __classPrivateFieldGet$d = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1287
+ var __classPrivateFieldGet$e = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1140
1288
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1141
1289
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1142
1290
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -1150,15 +1298,15 @@ class IDBCache {
1150
1298
  _IDBCache_storeName.set(this, void 0);
1151
1299
  _IDBCache_dbPromise.set(this, null);
1152
1300
  _IDBCache_version.set(this, 1);
1153
- __classPrivateFieldSet$d(this, _IDBCache_dbName, dbName, "f");
1154
- __classPrivateFieldSet$d(this, _IDBCache_storeName, storeName, "f");
1301
+ __classPrivateFieldSet$e(this, _IDBCache_dbName, dbName, "f");
1302
+ __classPrivateFieldSet$e(this, _IDBCache_storeName, storeName, "f");
1155
1303
  }
1156
1304
  async get(key) {
1157
1305
  try {
1158
- const db = await __classPrivateFieldGet$d(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
1306
+ const db = await __classPrivateFieldGet$e(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
1159
1307
  return new Promise((resolve) => {
1160
- const tx = db.transaction(__classPrivateFieldGet$d(this, _IDBCache_storeName, "f"), 'readonly');
1161
- const store = tx.objectStore(__classPrivateFieldGet$d(this, _IDBCache_storeName, "f"));
1308
+ const tx = db.transaction(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"), 'readonly');
1309
+ const store = tx.objectStore(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"));
1162
1310
  const req = store.get(key);
1163
1311
  req.onsuccess = () => resolve(req.result ?? undefined);
1164
1312
  req.onerror = () => resolve(undefined);
@@ -1170,10 +1318,10 @@ class IDBCache {
1170
1318
  }
1171
1319
  async put(key, value) {
1172
1320
  try {
1173
- const db = await __classPrivateFieldGet$d(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
1321
+ const db = await __classPrivateFieldGet$e(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
1174
1322
  return new Promise((resolve) => {
1175
- const tx = db.transaction(__classPrivateFieldGet$d(this, _IDBCache_storeName, "f"), 'readwrite');
1176
- const store = tx.objectStore(__classPrivateFieldGet$d(this, _IDBCache_storeName, "f"));
1323
+ const tx = db.transaction(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"), 'readwrite');
1324
+ const store = tx.objectStore(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"));
1177
1325
  store.put(value, key);
1178
1326
  tx.oncomplete = () => resolve();
1179
1327
  tx.onerror = () => resolve(); // fire-and-forget
@@ -1185,10 +1333,10 @@ class IDBCache {
1185
1333
  }
1186
1334
  async delete(key) {
1187
1335
  try {
1188
- const db = await __classPrivateFieldGet$d(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
1336
+ const db = await __classPrivateFieldGet$e(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
1189
1337
  return new Promise((resolve) => {
1190
- const tx = db.transaction(__classPrivateFieldGet$d(this, _IDBCache_storeName, "f"), 'readwrite');
1191
- const store = tx.objectStore(__classPrivateFieldGet$d(this, _IDBCache_storeName, "f"));
1338
+ const tx = db.transaction(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"), 'readwrite');
1339
+ const store = tx.objectStore(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"));
1192
1340
  store.delete(key);
1193
1341
  tx.oncomplete = () => resolve();
1194
1342
  tx.onerror = () => resolve();
@@ -1200,10 +1348,10 @@ class IDBCache {
1200
1348
  }
1201
1349
  async clear() {
1202
1350
  try {
1203
- const db = await __classPrivateFieldGet$d(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
1351
+ const db = await __classPrivateFieldGet$e(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
1204
1352
  return new Promise((resolve) => {
1205
- const tx = db.transaction(__classPrivateFieldGet$d(this, _IDBCache_storeName, "f"), 'readwrite');
1206
- const store = tx.objectStore(__classPrivateFieldGet$d(this, _IDBCache_storeName, "f"));
1353
+ const tx = db.transaction(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"), 'readwrite');
1354
+ const store = tx.objectStore(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"));
1207
1355
  store.clear();
1208
1356
  tx.oncomplete = () => resolve();
1209
1357
  tx.onerror = () => resolve();
@@ -1215,10 +1363,10 @@ class IDBCache {
1215
1363
  }
1216
1364
  }
1217
1365
  _IDBCache_dbName = new WeakMap(), _IDBCache_storeName = new WeakMap(), _IDBCache_dbPromise = new WeakMap(), _IDBCache_version = new WeakMap(), _IDBCache_instances = new WeakSet(), _IDBCache_open = function _IDBCache_open() {
1218
- if (!__classPrivateFieldGet$d(this, _IDBCache_dbPromise, "f")) {
1219
- __classPrivateFieldSet$d(this, _IDBCache_dbPromise, new Promise((resolve, reject) => {
1220
- const storeName = __classPrivateFieldGet$d(this, _IDBCache_storeName, "f");
1221
- const req = indexedDB.open(__classPrivateFieldGet$d(this, _IDBCache_dbName, "f"), __classPrivateFieldGet$d(this, _IDBCache_version, "f"));
1366
+ if (!__classPrivateFieldGet$e(this, _IDBCache_dbPromise, "f")) {
1367
+ __classPrivateFieldSet$e(this, _IDBCache_dbPromise, new Promise((resolve, reject) => {
1368
+ const storeName = __classPrivateFieldGet$e(this, _IDBCache_storeName, "f");
1369
+ const req = indexedDB.open(__classPrivateFieldGet$e(this, _IDBCache_dbName, "f"), __classPrivateFieldGet$e(this, _IDBCache_version, "f"));
1222
1370
  req.onupgradeneeded = () => {
1223
1371
  const db = req.result;
1224
1372
  if (!db.objectStoreNames.contains(storeName)) {
@@ -1229,7 +1377,7 @@ _IDBCache_dbName = new WeakMap(), _IDBCache_storeName = new WeakMap(), _IDBCache
1229
1377
  req.onerror = () => reject(req.error);
1230
1378
  }), "f");
1231
1379
  }
1232
- return __classPrivateFieldGet$d(this, _IDBCache_dbPromise, "f");
1380
+ return __classPrivateFieldGet$e(this, _IDBCache_dbPromise, "f");
1233
1381
  };
1234
1382
  // ── NullCache (no-op fallback for Node.js) ───────────────────────────
1235
1383
  class NullCache {
@@ -1257,13 +1405,13 @@ function createPersistentCache(dbName, storeName) {
1257
1405
  return new NullCache();
1258
1406
  }
1259
1407
 
1260
- var __classPrivateFieldSet$c = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1408
+ var __classPrivateFieldSet$d = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1261
1409
  if (kind === "m") throw new TypeError("Private method is not writable");
1262
1410
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1263
1411
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1264
1412
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1265
1413
  };
1266
- var __classPrivateFieldGet$c = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1414
+ var __classPrivateFieldGet$d = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1267
1415
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1268
1416
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1269
1417
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -1285,47 +1433,50 @@ class AgentClient {
1285
1433
  // Self-DID for event-driven invalidation (no TTL for own profile)
1286
1434
  _AgentClient_selfDid.set(this, null);
1287
1435
  _AgentClient_onAgentUpdated.set(this, (event) => {
1288
- __classPrivateFieldGet$c(this, _AgentClient_instances, "m", _AgentClient_cacheAgent).call(this, Agent.fromWire(event.agent));
1436
+ __classPrivateFieldGet$d(this, _AgentClient_instances, "m", _AgentClient_cacheAgent).call(this, Agent.fromWire(event.agent));
1289
1437
  });
1290
- __classPrivateFieldSet$c(this, _AgentClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
1291
- __classPrivateFieldSet$c(this, _AgentClient_persistent, createPersistentCache('ad4m-agent-cache', 'agents'), "f");
1438
+ __classPrivateFieldSet$d(this, _AgentClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
1439
+ __classPrivateFieldSet$d(this, _AgentClient_persistent, createPersistentCache('ad4m-agent-cache', 'agents'), "f");
1292
1440
  }
1293
1441
  async me() {
1294
- const agentObject = toAgent(await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.get', {}));
1442
+ const agentObject = toAgent(await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.get', {}));
1295
1443
  // Auto-set selfDid so event-driven cache invalidation works
1296
1444
  // without requiring apps to call setSelfDid() manually
1297
- if (agentObject.did && !__classPrivateFieldGet$c(this, _AgentClient_selfDid, "f")) {
1298
- __classPrivateFieldSet$c(this, _AgentClient_selfDid, agentObject.did, "f");
1445
+ if (agentObject.did && !__classPrivateFieldGet$d(this, _AgentClient_selfDid, "f")) {
1446
+ __classPrivateFieldSet$d(this, _AgentClient_selfDid, agentObject.did, "f");
1299
1447
  }
1300
1448
  return agentObject;
1301
1449
  }
1302
1450
  async status() {
1303
- const agentStatus = await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.status', {});
1451
+ const agentStatus = await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.status', {});
1304
1452
  return new AgentStatus(agentStatus);
1305
1453
  }
1454
+ /** Creates the agent's keys and DID on first run. The executor refuses (409)
1455
+ * an agent that is already initialised — {@link unlock} it instead; a second
1456
+ * `generate` never replaces the existing keys and DID. */
1306
1457
  async generate(passphrase, options) {
1307
- const result = await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.generate', { passphrase }, options);
1458
+ const result = await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.generate', { passphrase }, options);
1308
1459
  return new AgentStatus(result);
1309
1460
  }
1310
1461
  async import(args) {
1311
- const result = await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.import', { ...args });
1462
+ const result = await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.import', { ...args });
1312
1463
  return new AgentStatus(result);
1313
1464
  }
1314
1465
  async lock(passphrase) {
1315
- const result = await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.lock', { passphrase });
1466
+ const result = await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.lock', { passphrase });
1316
1467
  return new AgentStatus(result);
1317
1468
  }
1318
1469
  async unlock(passphrase, holochain = true, options) {
1319
- const result = await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.unlock', { passphrase, holochain }, options);
1470
+ const result = await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.unlock', { passphrase, holochain }, options);
1320
1471
  return new AgentStatus(result);
1321
1472
  }
1322
1473
  async byDID(did) {
1323
1474
  // agent-updated events keep cached entries fresh (the self-DID entry has no TTL).
1324
- __classPrivateFieldGet$c(this, _AgentClient_instances, "m", _AgentClient_listen).call(this);
1475
+ __classPrivateFieldGet$d(this, _AgentClient_instances, "m", _AgentClient_listen).call(this);
1325
1476
  const now = Date.now();
1326
- const cached = __classPrivateFieldGet$c(this, _AgentClient_memCache, "f").get(did);
1477
+ const cached = __classPrivateFieldGet$d(this, _AgentClient_memCache, "f").get(did);
1327
1478
  if (cached) {
1328
- const isSelf = did === __classPrivateFieldGet$c(this, _AgentClient_selfDid, "f");
1479
+ const isSelf = did === __classPrivateFieldGet$d(this, _AgentClient_selfDid, "f");
1329
1480
  // Self-DID: L1 always valid (event-driven invalidation)
1330
1481
  // Remote DID: L1 valid within TTL
1331
1482
  if (isSelf || (now - cached.ts) < AgentClient.REMOTE_AGENT_TTL_MS) {
@@ -1335,21 +1486,21 @@ class AgentClient {
1335
1486
  // Deduplicate: store the promise immediately so concurrent calls share one RPC
1336
1487
  const promise = (async () => {
1337
1488
  // L2: check persistent cache before network
1338
- const entry = await __classPrivateFieldGet$c(this, _AgentClient_persistent, "f").get(did);
1489
+ const entry = await __classPrivateFieldGet$d(this, _AgentClient_persistent, "f").get(did);
1339
1490
  // entry.agent may be undefined for pre-TTL cache entries (migration) — treat as expired
1340
1491
  if (entry?.agent && (now - (entry.ts ?? 0)) < AgentClient.REMOTE_AGENT_TTL_L2_MS) {
1341
1492
  return entry.agent;
1342
1493
  }
1343
1494
  // L3: network fetch
1344
- const result = toAgent(await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.byDid', { did }));
1345
- __classPrivateFieldGet$c(this, _AgentClient_persistent, "f").put(did, { agent: result, ts: Date.now() }); // fire-and-forget write to L2
1495
+ const result = toAgent(await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.byDid', { did }));
1496
+ __classPrivateFieldGet$d(this, _AgentClient_persistent, "f").put(did, { agent: result, ts: Date.now() }); // fire-and-forget write to L2
1346
1497
  return result;
1347
1498
  })();
1348
- __classPrivateFieldGet$c(this, _AgentClient_memCache, "f").set(did, { promise, ts: now });
1499
+ __classPrivateFieldGet$d(this, _AgentClient_memCache, "f").set(did, { promise, ts: now });
1349
1500
  // Clean up on failure so next call retries
1350
1501
  promise.catch(() => {
1351
- if (__classPrivateFieldGet$c(this, _AgentClient_memCache, "f").get(did)?.promise === promise) {
1352
- __classPrivateFieldGet$c(this, _AgentClient_memCache, "f").delete(did);
1502
+ if (__classPrivateFieldGet$d(this, _AgentClient_memCache, "f").get(did)?.promise === promise) {
1503
+ __classPrivateFieldGet$d(this, _AgentClient_memCache, "f").delete(did);
1353
1504
  }
1354
1505
  });
1355
1506
  return promise;
@@ -1359,21 +1510,21 @@ class AgentClient {
1359
1510
  * The self-DID receives event-driven invalidation and is never TTL-expired.
1360
1511
  */
1361
1512
  setSelfDid(did) {
1362
- __classPrivateFieldSet$c(this, _AgentClient_selfDid, did, "f");
1513
+ __classPrivateFieldSet$d(this, _AgentClient_selfDid, did, "f");
1363
1514
  }
1364
1515
  /**
1365
1516
  * Invalidate a specific DID's cache entry in both L1 and L2.
1366
1517
  */
1367
1518
  invalidateByDid(did) {
1368
- __classPrivateFieldGet$c(this, _AgentClient_memCache, "f").delete(did);
1369
- __classPrivateFieldGet$c(this, _AgentClient_persistent, "f").delete(did); // fire-and-forget
1519
+ __classPrivateFieldGet$d(this, _AgentClient_memCache, "f").delete(did);
1520
+ __classPrivateFieldGet$d(this, _AgentClient_persistent, "f").delete(did); // fire-and-forget
1370
1521
  }
1371
1522
  /**
1372
1523
  * Clear the entire L1 (memory) byDID cache.
1373
1524
  * L2 (IndexedDB) is preserved — agent data remains valid across sessions.
1374
1525
  */
1375
1526
  clearByDidCache() {
1376
- __classPrivateFieldGet$c(this, _AgentClient_memCache, "f").clear();
1527
+ __classPrivateFieldGet$d(this, _AgentClient_memCache, "f").clear();
1377
1528
  }
1378
1529
  async updatePublicPerspective(perspective) {
1379
1530
  // Send only the signed fields: the public perspective carries no link status.
@@ -1385,36 +1536,36 @@ class AgentClient {
1385
1536
  proof: { key: proof.key, signature: proof.signature, valid: proof.valid, invalid: proof.invalid },
1386
1537
  })),
1387
1538
  };
1388
- const agent = toAgent(await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.updateProfile', { publicPerspective }));
1539
+ const agent = toAgent(await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.updateProfile', { publicPerspective }));
1389
1540
  // Immediately update byDID cache so subsequent byDID() calls
1390
1541
  // return fresh data without waiting for the agent-updated event
1391
- __classPrivateFieldGet$c(this, _AgentClient_instances, "m", _AgentClient_cacheAgent).call(this, agent);
1542
+ __classPrivateFieldGet$d(this, _AgentClient_instances, "m", _AgentClient_cacheAgent).call(this, agent);
1392
1543
  return agent;
1393
1544
  }
1394
1545
  async mutatePublicPerspective({ additions, removals }) {
1395
- const added = additions.length > 0 ? await __classPrivateFieldGet$c(this, _AgentClient_instances, "m", _AgentClient_signLinks).call(this, additions) : [];
1546
+ const added = additions.length > 0 ? await __classPrivateFieldGet$d(this, _AgentClient_instances, "m", _AgentClient_signLinks).call(this, additions) : [];
1396
1547
  const { perspective } = await this.me();
1397
1548
  const kept = (perspective?.links ?? []).filter(link => !removals.some(r => linkEqual(link, r)));
1398
1549
  return this.updatePublicPerspective({ links: [...kept, ...added] });
1399
1550
  }
1400
1551
  async updateDirectMessageLanguage(directMessageLanguage) {
1401
- const agent = toAgent(await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.updateProfile', { dmLanguage: directMessageLanguage }));
1552
+ const agent = toAgent(await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.updateProfile', { dmLanguage: directMessageLanguage }));
1402
1553
  // Immediately update byDID cache so subsequent byDID() calls
1403
1554
  // return fresh data without waiting for the agent-updated event
1404
- __classPrivateFieldGet$c(this, _AgentClient_instances, "m", _AgentClient_cacheAgent).call(this, agent);
1555
+ __classPrivateFieldGet$d(this, _AgentClient_instances, "m", _AgentClient_cacheAgent).call(this, agent);
1405
1556
  return agent;
1406
1557
  }
1407
1558
  async addEntanglementProofs(proofs) {
1408
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.addEntanglementProofs', { proofs });
1559
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.addEntanglementProofs', { proofs });
1409
1560
  }
1410
1561
  async deleteEntanglementProofs(proofs) {
1411
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.deleteEntanglementProofs', { proofs });
1562
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.deleteEntanglementProofs', { proofs });
1412
1563
  }
1413
1564
  async getEntanglementProofs() {
1414
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.getEntanglementProofs', {});
1565
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.getEntanglementProofs', {});
1415
1566
  }
1416
1567
  async entanglementProofPreFlight(deviceKey, deviceKeyType) {
1417
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.entanglementProofPreflight', { deviceKey, deviceKeyType });
1568
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.entanglementProofPreflight', { deviceKey, deviceKeyType });
1418
1569
  }
1419
1570
  /**
1420
1571
  * Asks the executor for a capability token. `agent` names the agent the token will act
@@ -1424,45 +1575,45 @@ class AgentClient {
1424
1575
  * six-digit code.
1425
1576
  */
1426
1577
  async requestCapability(authInfo, agent) {
1427
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.requestCapability', agent === undefined ? { authInfo } : { authInfo, agent });
1578
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.requestCapability', agent === undefined ? { authInfo } : { authInfo, agent });
1428
1579
  }
1429
1580
  async permitCapability(auth) {
1430
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.permitCapability', { auth });
1581
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.permitCapability', { auth });
1431
1582
  }
1432
1583
  async generateJwt(requestId, rand) {
1433
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.generateJwt', { requestId, rand });
1584
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.generateJwt', { requestId, rand });
1434
1585
  }
1435
1586
  async getApps() {
1436
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.getApps', {});
1587
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.getApps', {});
1437
1588
  }
1438
1589
  async removeApp(requestId) {
1439
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.removeApp', { id: requestId });
1590
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.removeApp', { id: requestId });
1440
1591
  }
1441
1592
  async revokeToken(requestId) {
1442
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.revokeToken', { token: requestId });
1593
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.revokeToken', { token: requestId });
1443
1594
  }
1444
1595
  async isLocked() {
1445
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.isLocked', {});
1596
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.isLocked', {});
1446
1597
  }
1447
1598
  async signMessage(message) {
1448
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.sign', { message });
1599
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.sign', { message });
1449
1600
  }
1450
1601
  // Multi-user methods
1451
1602
  async createUser(email, password) {
1452
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('user.create', { email, password });
1603
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('user.create', { email, password });
1453
1604
  }
1454
1605
  async loginUser(email, password) {
1455
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('user.login', { email, password });
1606
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('user.login', { email, password });
1456
1607
  }
1457
1608
  async requestLoginVerification(email, appInfo) {
1458
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('user.requestVerification', { email, appInfo });
1609
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('user.requestVerification', { email, appInfo });
1459
1610
  }
1460
1611
  async verifyEmailCode(email, code, verificationType) {
1461
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('user.verifyEmail', { email, code, verificationType });
1612
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('user.verifyEmail', { email, code, verificationType });
1462
1613
  }
1463
1614
  /** Revokes this client's user token. The executor then closes the client's sockets. */
1464
1615
  async logout() {
1465
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('user.logout', {});
1616
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('user.logout', {});
1466
1617
  }
1467
1618
  /**
1468
1619
  * Revokes every token of a user issued up to now, this client's own included, and closes
@@ -1470,43 +1621,43 @@ class AgentClient {
1470
1621
  * user. Needs AGENT_UPDATE, which a login holds. Tokens from a later login work.
1471
1622
  */
1472
1623
  async revokeAllSessions(email) {
1473
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('user.revokeAllSessions', email === undefined ? {} : { email });
1624
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('user.revokeAllSessions', email === undefined ? {} : { email });
1474
1625
  }
1475
1626
  // Hosting methods
1476
1627
  async hostingUserInfo() {
1477
- const info = (await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('hosting.info', {})).userInfo ?? {
1628
+ const info = (await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('hosting.info', {})).userInfo ?? {
1478
1629
  email: '', credits: null, hotWalletAddress: null, freeAccess: false,
1479
1630
  };
1480
1631
  return new HostingUserInfo(info.email, info.freeAccess ? 'unlimited' : String(info.credits ?? 0), info.hotWalletAddress || undefined, !!info.freeAccess);
1481
1632
  }
1482
1633
  async computeLog(since, limit, userEmail) {
1483
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('runtime.computeLog', { since, limit, userEmail });
1634
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('runtime.computeLog', { since, limit, userEmail });
1484
1635
  }
1485
1636
  async setHotWalletAddress(address) {
1486
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('hosting.setHotWallet', { address });
1637
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('hosting.setHotWallet', { address });
1487
1638
  }
1488
1639
  async requestPayment(amountHOT) {
1489
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('hosting.requestPayment', { amountHOT });
1640
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('hosting.requestPayment', { amountHOT });
1490
1641
  }
1491
1642
  }
1492
1643
  _AgentClient_apiClient = new WeakMap(), _AgentClient_memCache = new WeakMap(), _AgentClient_persistent = new WeakMap(), _AgentClient_selfDid = new WeakMap(), _AgentClient_onAgentUpdated = new WeakMap(), _AgentClient_instances = new WeakSet(), _AgentClient_cacheAgent = function _AgentClient_cacheAgent(agent) {
1493
1644
  if (!agent.did)
1494
1645
  return;
1495
- __classPrivateFieldGet$c(this, _AgentClient_memCache, "f").set(agent.did, { promise: Promise.resolve(agent), ts: Date.now() });
1496
- __classPrivateFieldGet$c(this, _AgentClient_persistent, "f").put(agent.did, { agent, ts: Date.now() }); // fire-and-forget
1497
- __classPrivateFieldGet$c(this, _AgentClient_instances, "m", _AgentClient_listen).call(this);
1646
+ __classPrivateFieldGet$d(this, _AgentClient_memCache, "f").set(agent.did, { promise: Promise.resolve(agent), ts: Date.now() });
1647
+ __classPrivateFieldGet$d(this, _AgentClient_persistent, "f").put(agent.did, { agent, ts: Date.now() }); // fire-and-forget
1648
+ __classPrivateFieldGet$d(this, _AgentClient_instances, "m", _AgentClient_listen).call(this);
1498
1649
  }, _AgentClient_signLinks =
1499
1650
  /** Has the executor sign `links` as this agent, in a throwaway perspective. */
1500
1651
  async function _AgentClient_signLinks(links) {
1501
- const { uuid } = await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('perspective.create', { name: 'Agent Perspective Proxy' });
1652
+ const { uuid } = await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('perspective.create', { name: 'Agent Perspective Proxy' });
1502
1653
  try {
1503
- return (await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('perspective.addLinks', { uuid, links, status: 'SHARED' })).map(LinkExpression.fromWire);
1654
+ return (await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('perspective.addLinks', { uuid, links, status: 'SHARED' })).map(LinkExpression.fromWire);
1504
1655
  }
1505
1656
  finally {
1506
- await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('perspective.remove', { uuid });
1657
+ await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('perspective.remove', { uuid });
1507
1658
  }
1508
1659
  }, _AgentClient_listen = function _AgentClient_listen() {
1509
- __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").on('agent-updated', __classPrivateFieldGet$c(this, _AgentClient_onAgentUpdated, "f"));
1660
+ __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").on('agent-updated', __classPrivateFieldGet$d(this, _AgentClient_onAgentUpdated, "f"));
1510
1661
  };
1511
1662
  /** TTL for remote (non-self) agent profiles in L1 cache (ms). */
1512
1663
  AgentClient.REMOTE_AGENT_TTL_MS = 5 * 60000; // 5 minutes
@@ -1514,13 +1665,13 @@ AgentClient.REMOTE_AGENT_TTL_MS = 5 * 60000; // 5 minutes
1514
1665
  * After this window any restart triggers a fresh network fetch. */
1515
1666
  AgentClient.REMOTE_AGENT_TTL_L2_MS = 5 * 60000; // 5 minutes
1516
1667
 
1517
- var __classPrivateFieldSet$b = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1668
+ var __classPrivateFieldSet$c = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1518
1669
  if (kind === "m") throw new TypeError("Private method is not writable");
1519
1670
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1520
1671
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1521
1672
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1522
1673
  };
1523
- var __classPrivateFieldGet$b = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1674
+ var __classPrivateFieldGet$c = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1524
1675
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1525
1676
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1526
1677
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -1529,34 +1680,34 @@ var _LanguageClient_apiClient;
1529
1680
  class LanguageClient {
1530
1681
  constructor(baseUrl, token, sharedApiClient) {
1531
1682
  _LanguageClient_apiClient.set(this, void 0);
1532
- __classPrivateFieldSet$b(this, _LanguageClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
1683
+ __classPrivateFieldSet$c(this, _LanguageClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
1533
1684
  }
1534
1685
  async byAddress(address) {
1535
- return __classPrivateFieldGet$b(this, _LanguageClient_apiClient, "f").call('language.get', { address });
1686
+ return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call('language.get', { address });
1536
1687
  }
1537
1688
  async byFilter(filter) {
1538
- return __classPrivateFieldGet$b(this, _LanguageClient_apiClient, "f").call('language.all', { filter });
1689
+ return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call('language.all', { filter });
1539
1690
  }
1540
1691
  async all() {
1541
- return __classPrivateFieldGet$b(this, _LanguageClient_apiClient, "f").call('language.all', {});
1692
+ return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call('language.all', {});
1542
1693
  }
1543
1694
  async writeSettings(languageAddress, settings) {
1544
- return __classPrivateFieldGet$b(this, _LanguageClient_apiClient, "f").call('language.writeSettings', { address: languageAddress, settings });
1695
+ return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call('language.writeSettings', { address: languageAddress, settings });
1545
1696
  }
1546
1697
  async applyTemplateAndPublish(sourceLanguageHash, templateData, options) {
1547
- return __classPrivateFieldGet$b(this, _LanguageClient_apiClient, "f").call('language.applyTemplate', { sourceLanguageHash, templateData }, options);
1698
+ return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call('language.applyTemplate', { sourceLanguageHash, templateData }, options);
1548
1699
  }
1549
1700
  async publish(languagePath, languageMeta, options) {
1550
- return __classPrivateFieldGet$b(this, _LanguageClient_apiClient, "f").call('language.publish', { languagePath, languageMeta }, options);
1701
+ return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call('language.publish', { languagePath, languageMeta }, options);
1551
1702
  }
1552
1703
  async meta(address) {
1553
- return __classPrivateFieldGet$b(this, _LanguageClient_apiClient, "f").call('language.meta', { address });
1704
+ return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call('language.meta', { address });
1554
1705
  }
1555
1706
  async source(address) {
1556
- return __classPrivateFieldGet$b(this, _LanguageClient_apiClient, "f").call('language.source', { address });
1707
+ return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call('language.source', { address });
1557
1708
  }
1558
1709
  async remove(address) {
1559
- return __classPrivateFieldGet$b(this, _LanguageClient_apiClient, "f").call('language.remove', { address });
1710
+ return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call('language.remove', { address });
1560
1711
  }
1561
1712
  }
1562
1713
  _LanguageClient_apiClient = new WeakMap();
@@ -1608,13 +1759,13 @@ function neighbourhoodExpressionFromWire(wire) {
1608
1759
  return new NeighbourhoodExpression(wire.author, wire.timestamp, new Neighbourhood(wire.data.linkLanguage, meta), wire.proof);
1609
1760
  }
1610
1761
 
1611
- var __classPrivateFieldSet$a = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1762
+ var __classPrivateFieldSet$b = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1612
1763
  if (kind === "m") throw new TypeError("Private method is not writable");
1613
1764
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1614
1765
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1615
1766
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1616
1767
  };
1617
- var __classPrivateFieldGet$a = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1768
+ var __classPrivateFieldGet$b = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1618
1769
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1619
1770
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1620
1771
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -1625,59 +1776,59 @@ class NeighbourhoodClient {
1625
1776
  _NeighbourhoodClient_apiClient.set(this, void 0);
1626
1777
  _NeighbourhoodClient_signalHandlers.set(this, new Map());
1627
1778
  _NeighbourhoodClient_signalUnsubscribers.set(this, new Map());
1628
- __classPrivateFieldSet$a(this, _NeighbourhoodClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
1779
+ __classPrivateFieldSet$b(this, _NeighbourhoodClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
1629
1780
  }
1630
1781
  async publishFromPerspective(perspectiveUUID, linkLanguage, meta, options) {
1631
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.publish', {
1782
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.publish', {
1632
1783
  perspectiveUuid: perspectiveUUID, linkLanguage, meta: Perspective.toWire(meta)
1633
1784
  }, options);
1634
1785
  }
1635
1786
  async joinFromUrl(url, options) {
1636
- return PerspectiveHandle.fromWire(await __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.join', { url }, options));
1787
+ return PerspectiveHandle.fromWire(await __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.join', { url }, options));
1637
1788
  }
1638
1789
  async otherAgents(perspectiveUUID) {
1639
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.otherAgents', { uuid: perspectiveUUID });
1790
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.otherAgents', { uuid: perspectiveUUID });
1640
1791
  }
1641
1792
  async hasTelepresenceAdapter(perspectiveUUID) {
1642
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.hasTelepresence', { uuid: perspectiveUUID });
1793
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.hasTelepresence', { uuid: perspectiveUUID });
1643
1794
  }
1644
1795
  async onlineAgents(perspectiveUUID) {
1645
- const agents = await __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.onlineAgents', { uuid: perspectiveUUID });
1796
+ const agents = await __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.onlineAgents', { uuid: perspectiveUUID });
1646
1797
  return agents.map(({ did, status }) => ({ did, status: PerspectiveExpression.fromWire(status) }));
1647
1798
  }
1648
1799
  /** The caller's own online status, as it last set it on this executor, or `null`. */
1649
1800
  async ownOnlineStatus(perspectiveUUID) {
1650
- const status = await __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.ownOnlineStatus', { uuid: perspectiveUUID });
1801
+ const status = await __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.ownOnlineStatus', { uuid: perspectiveUUID });
1651
1802
  return status ? PerspectiveExpression.fromWire(status) : null;
1652
1803
  }
1653
1804
  async setOnlineStatus(perspectiveUUID, status) {
1654
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.setOnlineStatus', { uuid: perspectiveUUID, status: Perspective.toWire(status) });
1805
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.setOnlineStatus', { uuid: perspectiveUUID, status: Perspective.toWire(status) });
1655
1806
  }
1656
1807
  async setOnlineStatusU(perspectiveUUID, status) {
1657
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.setOnlineStatus', { uuid: perspectiveUUID, status, signed: false });
1808
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.setOnlineStatus', { uuid: perspectiveUUID, status, signed: false });
1658
1809
  }
1659
1810
  async sendSignal(perspectiveUUID, remoteAgentDid, payload) {
1660
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.sendSignal', {
1811
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.sendSignal', {
1661
1812
  uuid: perspectiveUUID, remoteAgentDid, payload: Perspective.toWire(payload)
1662
1813
  });
1663
1814
  }
1664
1815
  async sendSignalU(perspectiveUUID, remoteAgentDid, payload) {
1665
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.sendSignal', {
1816
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.sendSignal', {
1666
1817
  uuid: perspectiveUUID, remoteAgentDid, payload, signed: false
1667
1818
  });
1668
1819
  }
1669
1820
  async sendBroadcast(perspectiveUUID, payload, loopback = false) {
1670
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.sendBroadcast', {
1821
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.sendBroadcast', {
1671
1822
  uuid: perspectiveUUID, payload: Perspective.toWire(payload), loopback
1672
1823
  });
1673
1824
  }
1674
1825
  async sendBroadcastU(perspectiveUUID, payload, loopback = false) {
1675
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.sendBroadcast', {
1826
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.sendBroadcast', {
1676
1827
  uuid: perspectiveUUID, payload, loopback, signed: false
1677
1828
  });
1678
1829
  }
1679
1830
  dispatchSignal(perspectiveUUID, signal) {
1680
- const handlers = __classPrivateFieldGet$a(this, _NeighbourhoodClient_signalHandlers, "f").get(perspectiveUUID);
1831
+ const handlers = __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalHandlers, "f").get(perspectiveUUID);
1681
1832
  if (handlers) {
1682
1833
  for (const handler of handlers) {
1683
1834
  try {
@@ -1690,15 +1841,15 @@ class NeighbourhoodClient {
1690
1841
  }
1691
1842
  }
1692
1843
  async subscribeToSignals(perspectiveUUID) {
1693
- const unsub = __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").on('signal', (event) => this.dispatchSignal(perspectiveUUID, PerspectiveExpression.fromWire(event.signal)), { perspective: perspectiveUUID });
1694
- __classPrivateFieldGet$a(this, _NeighbourhoodClient_signalUnsubscribers, "f").set(perspectiveUUID, unsub);
1695
- await __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").watchApplied();
1844
+ const unsub = __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").on('signal', (event) => this.dispatchSignal(perspectiveUUID, PerspectiveExpression.fromWire(event.signal)), { perspective: perspectiveUUID });
1845
+ __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalUnsubscribers, "f").set(perspectiveUUID, unsub);
1846
+ await __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").watchApplied();
1696
1847
  }
1697
1848
  async addSignalHandler(perspectiveUUID, handler) {
1698
- let handlersForPerspective = __classPrivateFieldGet$a(this, _NeighbourhoodClient_signalHandlers, "f").get(perspectiveUUID);
1849
+ let handlersForPerspective = __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalHandlers, "f").get(perspectiveUUID);
1699
1850
  if (!handlersForPerspective) {
1700
1851
  handlersForPerspective = [];
1701
- __classPrivateFieldGet$a(this, _NeighbourhoodClient_signalHandlers, "f").set(perspectiveUUID, handlersForPerspective);
1852
+ __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalHandlers, "f").set(perspectiveUUID, handlersForPerspective);
1702
1853
  handlersForPerspective.push(handler);
1703
1854
  await this.subscribeToSignals(perspectiveUUID);
1704
1855
  }
@@ -1707,18 +1858,18 @@ class NeighbourhoodClient {
1707
1858
  }
1708
1859
  }
1709
1860
  removeSignalHandler(perspectiveUUID, handler) {
1710
- const handlersForPerspective = __classPrivateFieldGet$a(this, _NeighbourhoodClient_signalHandlers, "f").get(perspectiveUUID);
1861
+ const handlersForPerspective = __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalHandlers, "f").get(perspectiveUUID);
1711
1862
  if (handlersForPerspective) {
1712
1863
  const index = handlersForPerspective.indexOf(handler);
1713
1864
  if (index > -1) {
1714
1865
  handlersForPerspective.splice(index, 1);
1715
1866
  }
1716
1867
  if (handlersForPerspective.length === 0) {
1717
- __classPrivateFieldGet$a(this, _NeighbourhoodClient_signalHandlers, "f").delete(perspectiveUUID);
1718
- const unsub = __classPrivateFieldGet$a(this, _NeighbourhoodClient_signalUnsubscribers, "f").get(perspectiveUUID);
1868
+ __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalHandlers, "f").delete(perspectiveUUID);
1869
+ const unsub = __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalUnsubscribers, "f").get(perspectiveUUID);
1719
1870
  if (unsub) {
1720
1871
  unsub();
1721
- __classPrivateFieldGet$a(this, _NeighbourhoodClient_signalUnsubscribers, "f").delete(perspectiveUUID);
1872
+ __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalUnsubscribers, "f").delete(perspectiveUUID);
1722
1873
  }
1723
1874
  }
1724
1875
  }
@@ -1731,49 +1882,65 @@ class NeighbourhoodClient {
1731
1882
  // structured `CallSessionInfo` (SDP answer + optional cascade
1732
1883
  // redirect + stream mapping).
1733
1884
  async sfuStartRoom(neighbourhoodUrl, roomName) {
1734
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.startRoom", { neighbourhoodUrl, roomName });
1885
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.startRoom", { neighbourhoodUrl, roomName });
1735
1886
  }
1736
1887
  async sfuStopRoom(neighbourhoodUrl, roomName) {
1737
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.stopRoom", { neighbourhoodUrl, roomName });
1888
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.stopRoom", { neighbourhoodUrl, roomName });
1738
1889
  }
1739
1890
  async sfuListRooms() {
1740
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.listRooms", {});
1891
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.listRooms", {});
1741
1892
  }
1742
1893
  async sfuCallJoin(neighbourhoodUrl, roomName, sdpOffer) {
1743
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callJoin", {
1894
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callJoin", {
1744
1895
  neighbourhoodUrl,
1745
1896
  roomName,
1746
1897
  sdpOffer,
1747
1898
  });
1748
1899
  }
1749
1900
  async sfuCallLeave(neighbourhoodUrl, roomName) {
1750
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callLeave", { neighbourhoodUrl, roomName });
1901
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callLeave", { neighbourhoodUrl, roomName });
1751
1902
  }
1752
1903
  async sfuCallSetQualityPreference(neighbourhoodUrl, roomName, preference) {
1753
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callSetQualityPreference", {
1904
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callSetQualityPreference", {
1754
1905
  neighbourhoodUrl,
1755
1906
  roomName,
1756
1907
  preference,
1757
1908
  });
1758
1909
  }
1759
1910
  async sfuCallAnswerServerOffer(neighbourhoodUrl, roomName, sdpAnswer) {
1760
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callAnswerServerOffer", {
1911
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callAnswerServerOffer", {
1761
1912
  neighbourhoodUrl,
1762
1913
  roomName,
1763
1914
  sdpAnswer,
1764
1915
  });
1765
1916
  }
1917
+ /** Ask the SFU to restart ICE on this agent's call connection. The offer
1918
+ * arrives as an `sfu-call-renegotiation-offer` event; answer it with
1919
+ * {@link sfuCallAnswerServerOffer}. */
1920
+ async sfuCallRestartIce(neighbourhoodUrl, roomName) {
1921
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callRestartIce", { neighbourhoodUrl, roomName });
1922
+ }
1923
+ /** Fires after a network change, once the client's socket is back on
1924
+ * the new network. See {@link ApiClient.onNetworkChange}. */
1925
+ onNetworkChange(callback) {
1926
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").onNetworkChange(callback);
1927
+ }
1928
+ /** Check the client's socket now: one that says nothing within a
1929
+ * deadline is treated as a network change. See {@link ApiClient.checkConnection}. */
1930
+ checkConnection() {
1931
+ __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").checkConnection();
1932
+ }
1766
1933
  async sfuGetConfig(neighbourhoodUrl) {
1767
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.getConfig", { neighbourhoodUrl });
1934
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.getConfig", { neighbourhoodUrl });
1768
1935
  }
1769
1936
  async sfuSetConfig(neighbourhoodUrl, config) {
1770
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.setConfig", { neighbourhoodUrl, config });
1937
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.setConfig", { neighbourhoodUrl, config });
1771
1938
  }
1772
1939
  async sfuPeerForNeighbourhood(neighbourhoodUrl) {
1773
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.sfuPeerForNeighbourhood", { neighbourhoodUrl });
1940
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.sfuPeerForNeighbourhood", { neighbourhoodUrl });
1774
1941
  }
1775
1942
  async sfuPeersForNeighbourhood(neighbourhoodUrl) {
1776
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.sfuPeersForNeighbourhood", { neighbourhoodUrl });
1943
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.sfuPeersForNeighbourhood", { neighbourhoodUrl });
1777
1944
  }
1778
1945
  // ── Trickle ICE ───────────────────────────────────────────────────
1779
1946
  /**
@@ -1785,7 +1952,7 @@ class NeighbourhoodClient {
1785
1952
  * networks).
1786
1953
  */
1787
1954
  async sfuAddIceCandidate(neighbourhoodUrl, roomName, candidate) {
1788
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.addIceCandidate", {
1955
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.addIceCandidate", {
1789
1956
  neighbourhoodUrl,
1790
1957
  roomName,
1791
1958
  candidate,
@@ -1798,7 +1965,7 @@ class NeighbourhoodClient {
1798
1965
  * publishes it as an `sfu-data` event.
1799
1966
  */
1800
1967
  async sfuSendData(neighbourhoodUrl, roomName, channelLabel, data, binary = false) {
1801
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.sendData", {
1968
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.sendData", {
1802
1969
  neighbourhoodUrl,
1803
1970
  roomName,
1804
1971
  channelLabel,
@@ -1814,11 +1981,11 @@ class NeighbourhoodClient {
1814
1981
  subscribeSfuDataChannel(callback) {
1815
1982
  // A fresh handler per call: `on` merges a repeated handler, and
1816
1983
  // each subscription must own its unsubscribe.
1817
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").on("sfu-data", (message) => callback(message));
1984
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").on("sfu-data", (message) => callback(message));
1818
1985
  }
1819
1986
  /** Subscribe to the rosters of the call rooms this agent is in: who is in each, whenever that changes. */
1820
1987
  subscribeSfuRoomRoster(callback) {
1821
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").on("sfu-room-roster", (roster) => callback(roster));
1988
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").on("sfu-room-roster", (roster) => callback(roster));
1822
1989
  }
1823
1990
  /**
1824
1991
  * Subscribe to server-pushed SFU SDP renegotiation offers. The
@@ -1832,7 +1999,7 @@ class NeighbourhoodClient {
1832
1999
  * Returns an unsubscribe function.
1833
2000
  */
1834
2001
  subscribeSfuCallRenegotiationOffer(targetDid, callback) {
1835
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").on("sfu-call-renegotiation-offer", (event) => {
2002
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").on("sfu-call-renegotiation-offer", (event) => {
1836
2003
  if (event.targetDid !== targetDid)
1837
2004
  return;
1838
2005
  callback({
@@ -1851,7 +2018,7 @@ class NeighbourhoodClient {
1851
2018
  * node. Returns an unsubscribe function.
1852
2019
  */
1853
2020
  subscribeSfuMigrateEvent(targetDid, callback) {
1854
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").on("sfu-migrate", (event) => {
2021
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").on("sfu-migrate", (event) => {
1855
2022
  if (event.targetDid !== targetDid)
1856
2023
  return;
1857
2024
  callback({
@@ -1871,12 +2038,12 @@ class NeighbourhoodClient {
1871
2038
  * @param perspectiveId The neighbourhood's perspective handle UUID.
1872
2039
  */
1873
2040
  async sfuServesAllMembers(perspectiveId) {
1874
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.servesAllMembers", { uuid: perspectiveId });
2041
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.servesAllMembers", { uuid: perspectiveId });
1875
2042
  }
1876
2043
  // ── SFU diagnostic / test-harness endpoints ────────────────────────
1877
2044
  /** The calling agent's own DID — the user's, for a user token. */
1878
2045
  async callerDid() {
1879
- return (await __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("agent.status", {})).did;
2046
+ return (await __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("agent.status", {})).did;
1880
2047
  }
1881
2048
  /**
1882
2049
  * Read-only: SFU service status including public reachability.
@@ -1885,7 +2052,7 @@ class NeighbourhoodClient {
1885
2052
  * determine its reachability (unknown).
1886
2053
  */
1887
2054
  async sfuStatus() {
1888
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.status", {});
2055
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.status", {});
1889
2056
  }
1890
2057
  /**
1891
2058
  * Read-only: how many SFU↔SFU pipe transports are fully established,
@@ -1893,14 +2060,14 @@ class NeighbourhoodClient {
1893
2060
  * assertions.
1894
2061
  */
1895
2062
  async sfuCascadeStatus() {
1896
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.cascadeStatus", {});
2063
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.cascadeStatus", {});
1897
2064
  }
1898
2065
  /**
1899
2066
  * Read-only: per-participant quality preferences the SFU event loop
1900
2067
  * currently holds. Returns `[{participantId, preference}, ...]`.
1901
2068
  */
1902
2069
  async sfuQualityPreferences() {
1903
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.qualityPreferences", {});
2070
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.qualityPreferences", {});
1904
2071
  }
1905
2072
  /**
1906
2073
  * Register a DID as a neighbourhood member on this executor.
@@ -1909,7 +2076,7 @@ class NeighbourhoodClient {
1909
2076
  * deployments.
1910
2077
  */
1911
2078
  async sfuEnsureMembership(neighbourhoodUrl, did) {
1912
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.ensureMembership", {
2079
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.ensureMembership", {
1913
2080
  neighbourhoodUrl,
1914
2081
  did,
1915
2082
  });
@@ -1961,10 +2128,17 @@ class SfuManager {
1961
2128
  this.qualityPreference = null;
1962
2129
  /** Server offers waiting to be applied, in arrival order, one at a time. */
1963
2130
  this.offerQueue = Promise.resolve();
2131
+ /** The last server offer answered. The executor sends an unanswered
2132
+ * restart offer again when asked twice; one that was answered meanwhile
2133
+ * must not be answered again, or that answer lands on its next offer. */
2134
+ this.answeredOffer = null;
1964
2135
  this.renegotiationUnsubscribe = null;
1965
2136
  this.rosterUnsubscribe = null;
1966
2137
  this.dataChannelUnsubscribe = null;
1967
- this.disconnectedTimer = null;
2138
+ /** An ICE restart is in flight until this fires: ICE going disconnected
2139
+ * again joins it, a network change replaces it. */
2140
+ this.restartTimer = null;
2141
+ this.networkUnsubscribe = null;
1968
2142
  /** Running while the room's roster leaves this agent out: see `noticeRoster`. */
1969
2143
  this.unlistedTimer = null;
1970
2144
  this.neighbourhood = neighbourhood;
@@ -2019,6 +2193,7 @@ class SfuManager {
2019
2193
  }
2020
2194
  console.info(`SFU: connection failed, reconnecting (${this.reconnectAttempts}/${SfuManager.MAX_RECONNECTS})`);
2021
2195
  this.reconnecting = true;
2196
+ this.endRestart();
2022
2197
  try {
2023
2198
  const deadline = Date.now() + SfuManager.REJOIN_WINDOW_MS;
2024
2199
  for (let delay = 1000;; delay = Math.min(delay * 2, 10000)) {
@@ -2061,6 +2236,38 @@ class SfuManager {
2061
2236
  this.reconnecting = false;
2062
2237
  }
2063
2238
  }
2239
+ /**
2240
+ * Repair the connection in place: the SFU offers new ICE credentials
2241
+ * (`sfuCallRestartIce`), the offer is answered like any server offer,
2242
+ * and the browser gathers candidates on whatever network it has now.
2243
+ * DTLS, tracks and the room slot stay. If the connection is not back
2244
+ * within `RESTART_TIMEOUT_MS`, the call is rebuilt. One restart at a
2245
+ * time: a call while one is in flight does nothing.
2246
+ */
2247
+ restartIce(pc) {
2248
+ if (this.restartTimer || this.reconnecting || this.state.peerConnection !== pc)
2249
+ return;
2250
+ console.info("SFU: restarting ICE");
2251
+ this.restartTimer = setTimeout(() => {
2252
+ this.restartTimer = null;
2253
+ if (this.state.peerConnection !== pc)
2254
+ return;
2255
+ if (pc.iceConnectionState === "connected" || pc.iceConnectionState === "completed")
2256
+ return;
2257
+ void this.reconnect();
2258
+ }, SfuManager.RESTART_TIMEOUT_MS);
2259
+ // A refusal (an executor without the method, or one that lost this
2260
+ // session) leaves the decision to the timeout: a blip may still heal.
2261
+ this.neighbourhood.sfuCallRestartIce(this.neighbourhoodUrl, this.roomId).catch((err) => {
2262
+ console.warn("SFU: ICE restart refused:", err);
2263
+ });
2264
+ }
2265
+ endRestart() {
2266
+ if (this.restartTimer) {
2267
+ clearTimeout(this.restartTimer);
2268
+ this.restartTimer = null;
2269
+ }
2270
+ }
2064
2271
  on(event, callback) {
2065
2272
  if (!this.callbacks.has(event)) {
2066
2273
  this.callbacks.set(event, []);
@@ -2099,48 +2306,45 @@ class SfuManager {
2099
2306
  this.state.localStream = localStream;
2100
2307
  const pc = new RTCPeerConnection({ iceServers: this.iceServers });
2101
2308
  this.state.peerConnection = pc;
2102
- // ICE state monitoring for reconnecting.
2103
- // "disconnected" is often transient (network blip, route change):
2104
- // the connection gets the same grace the server gives it before
2105
- // dropping the peer, and a rebuild only follows once the server
2106
- // would have dropped it anyway. "failed" reconnects at once.
2309
+ // ICE state monitoring for recovery. "disconnected" (a route change,
2310
+ // a network switch, a blip) restarts ICE on this connection at once;
2311
+ // "failed" rebuilds the call at once.
2107
2312
  pc.oniceconnectionstatechange = () => {
2108
2313
  if (this.state.peerConnection !== pc)
2109
2314
  return; // superseded
2110
2315
  if (pc.iceConnectionState === "failed") {
2111
- if (this.disconnectedTimer) {
2112
- clearTimeout(this.disconnectedTimer);
2113
- this.disconnectedTimer = null;
2114
- }
2115
- this.reconnect();
2316
+ this.endRestart();
2317
+ void this.reconnect();
2116
2318
  }
2117
2319
  else if (pc.iceConnectionState === "disconnected") {
2118
- if (!this.disconnectedTimer) {
2119
- this.disconnectedTimer = setTimeout(() => {
2120
- this.disconnectedTimer = null;
2121
- // Only reconnect if this pc is still the active one
2122
- // and still disconnected.
2123
- if (this.state.peerConnection === pc &&
2124
- pc.iceConnectionState === "disconnected") {
2125
- this.reconnect();
2126
- }
2127
- }, SfuManager.DISCONNECT_GRACE_MS);
2128
- }
2320
+ // The path may be gone with no `online` event; the restart
2321
+ // needs a live socket, and a dead one is redialled in seconds.
2322
+ this.neighbourhood.checkConnection();
2323
+ this.restartIce(pc);
2129
2324
  }
2130
- else {
2131
- // Any other state (connected, completed, checking) cancels
2132
- // the pending disconnected timer; a working path ends a run
2133
- // of reconnects.
2134
- if (pc.iceConnectionState === "connected" ||
2135
- pc.iceConnectionState === "completed") {
2136
- this.reconnectAttempts = 0;
2137
- }
2138
- if (this.disconnectedTimer) {
2139
- clearTimeout(this.disconnectedTimer);
2140
- this.disconnectedTimer = null;
2141
- }
2325
+ else if (pc.iceConnectionState === "connected" ||
2326
+ pc.iceConnectionState === "completed") {
2327
+ // A working path ends a restart and a run of reconnects.
2328
+ this.reconnectAttempts = 0;
2329
+ this.endRestart();
2142
2330
  }
2143
2331
  };
2332
+ // A network change: the path ICE uses is likely gone, though ICE may
2333
+ // not have noticed yet. Restart it now, on the socket the change
2334
+ // reconnected, with its own timeout. If a restart's offer is still
2335
+ // unanswered (it went out over the old network and may never have
2336
+ // arrived), the executor sends it again and, once it is answered,
2337
+ // restarts again for this network. Listened to once per call, not
2338
+ // per rebuild.
2339
+ if (!this.networkUnsubscribe) {
2340
+ this.networkUnsubscribe = this.neighbourhood.onNetworkChange(() => {
2341
+ const current = this.state.peerConnection;
2342
+ if (!current || this.reconnecting)
2343
+ return;
2344
+ this.endRestart();
2345
+ this.restartIce(current);
2346
+ });
2347
+ }
2144
2348
  // Both kinds of local media, send-only, declared now whether or not a
2145
2349
  // track exists yet: the SFU only ever receives on these sections, and a
2146
2350
  // camera or screen started later replaces an empty track with no
@@ -2329,7 +2533,7 @@ class SfuManager {
2329
2533
  }
2330
2534
  /** Apply one server offer to `pc` and answer it, unless `pc` is no longer the call's. */
2331
2535
  async applyServerOffer(pc, event) {
2332
- if (this.state.peerConnection !== pc)
2536
+ if (this.state.peerConnection !== pc || event.sdpOffer === this.answeredOffer)
2333
2537
  return;
2334
2538
  // The mapping first: the tracks this offer adds arrive while it is applied.
2335
2539
  for (const entry of event.trackMapping ?? []) {
@@ -2339,6 +2543,7 @@ class SfuManager {
2339
2543
  await pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(event.sdpOffer)));
2340
2544
  await pc.setLocalDescription(await pc.createAnswer());
2341
2545
  await this.neighbourhood.sfuCallAnswerServerOffer(this.neighbourhoodUrl, event.roomName, JSON.stringify(pc.localDescription));
2546
+ this.answeredOffer = event.sdpOffer;
2342
2547
  }
2343
2548
  catch (err) {
2344
2549
  if (this.state.peerConnection !== pc)
@@ -2399,10 +2604,9 @@ class SfuManager {
2399
2604
  async leave() {
2400
2605
  this.generation++;
2401
2606
  this.releaseServerEvents();
2402
- if (this.disconnectedTimer) {
2403
- clearTimeout(this.disconnectedTimer);
2404
- this.disconnectedTimer = null;
2405
- }
2607
+ this.endRestart();
2608
+ this.networkUnsubscribe?.();
2609
+ this.networkUnsubscribe = null;
2406
2610
  this.senders.clear();
2407
2611
  this.replacedTracks.clear();
2408
2612
  this.qualityPreference = null;
@@ -2533,8 +2737,8 @@ class SfuManager {
2533
2737
  SfuManager.MAX_RECONNECTS = 3;
2534
2738
  /** How long one rebuild keeps retrying a join the executor cannot take yet. */
2535
2739
  SfuManager.REJOIN_WINDOW_MS = 120000;
2536
- /** How long ICE may stay disconnected before a rebuild: the executor's `ICE_DISCONNECT_GRACE`. */
2537
- SfuManager.DISCONNECT_GRACE_MS = 10000;
2740
+ /** How long an ICE restart has to bring the connection back before a rebuild. */
2741
+ SfuManager.RESTART_TIMEOUT_MS = 5000;
2538
2742
  /** How long the roster may leave this agent out before the call is rebuilt. */
2539
2743
  SfuManager.UNLISTED_GRACE_MS = 3000;
2540
2744
 
@@ -2846,6 +3050,7 @@ class MeshManager {
2846
3050
  * Cleared only when a renegotiation is answered.
2847
3051
  */
2848
3052
  this.renegotiationRepairs = new Map();
3053
+ this.unwatchNetwork = null;
2849
3054
  this.channel = options.channel;
2850
3055
  this.callId = options.callId;
2851
3056
  this.selfId = options.selfId;
@@ -2859,6 +3064,8 @@ class MeshManager {
2859
3064
  ?? ((configuration) => new RTCPeerConnection(configuration));
2860
3065
  this.now = options.now ?? (() => Date.now());
2861
3066
  this.sweepMs = options.sweepMs ?? SWEEP_INTERVAL_MS;
3067
+ this.onNetworkChange = options.onNetworkChange;
3068
+ this.checkConnection = options.checkConnection;
2862
3069
  }
2863
3070
  // ── Events ──────────────────────────────────────────────────────
2864
3071
  on(event, callback) {
@@ -2961,6 +3168,7 @@ class MeshManager {
2961
3168
  this.publish({ v: CALL_PROTOCOL_VERSION, call: this.callId, warm: true });
2962
3169
  if (this.sweepMs > 0)
2963
3170
  this.sweep = setInterval(() => this.tick(), this.sweepMs);
3171
+ this.unwatchNetwork = this.onNetworkChange?.(() => this.restartAll()) ?? null;
2964
3172
  }
2965
3173
  async leave() {
2966
3174
  this.closed = true;
@@ -2968,6 +3176,8 @@ class MeshManager {
2968
3176
  clearInterval(this.sweep);
2969
3177
  this.sweep = null;
2970
3178
  }
3179
+ this.unwatchNetwork?.();
3180
+ this.unwatchNetwork = null;
2971
3181
  this.unwatchPublish?.();
2972
3182
  this.unwatchPublish = null;
2973
3183
  if (this.channelUnsubscribe) {
@@ -3283,8 +3493,10 @@ class MeshManager {
3283
3493
  if (slot.offerDeferred && pc.signalingState === "stable")
3284
3494
  void negotiate();
3285
3495
  }
3286
- if (state === "disconnected" && !slot.disconnectedAt)
3496
+ if (state === "disconnected" && !slot.disconnectedAt) {
3287
3497
  slot.disconnectedAt = this.now();
3498
+ this.checkConnection?.();
3499
+ }
3288
3500
  if (state === "connected" || state === "failed")
3289
3501
  slot.disconnectedAt = 0;
3290
3502
  this.emit("peer-state", peerId, state);
@@ -3622,6 +3834,39 @@ class MeshManager {
3622
3834
  slot.attempts = attempts - 1;
3623
3835
  this.rebuild(peerId, { announce: true, rung: "rebuild" });
3624
3836
  }
3837
+ /**
3838
+ * The network changed: every pair's path is likely gone, though ICE has
3839
+ * noticed on none yet. Each negotiated pair takes the ladder's first rung
3840
+ * now, all at once — an ICE restart is one offer per pair, and waiting
3841
+ * for each to time out costs seconds of silence. Pairs still negotiating
3842
+ * have nothing to restart; the sweep keeps looking after them.
3843
+ *
3844
+ * It skips the sweep's guards (`outstanding`, one pair per sweep) on
3845
+ * purpose. They stop the sweep reading a slow send as a lost one and
3846
+ * escalating every pair at once. Here nothing is judged lost, and the
3847
+ * rung is the first one: one offer per pair, each to a different peer.
3848
+ * A restart offer that is lost falls to the sweep, guards and all.
3849
+ */
3850
+ restartAll() {
3851
+ if (this.closed)
3852
+ return;
3853
+ const at = this.now();
3854
+ for (const [peerId, slot] of this.slots) {
3855
+ if (!slot.remoteReady || typeof slot.pc.restartIce !== "function")
3856
+ continue;
3857
+ // Spaced from the sweep's next rung, but not charged to the pair's
3858
+ // budget: a network change judges no pair lost.
3859
+ slot.lastAttempt = at;
3860
+ try {
3861
+ slot.pc.restartIce();
3862
+ this.emit("peer-recovery", peerId, { rung: "ice-restart", attempts: slot.attempts });
3863
+ }
3864
+ catch (error) {
3865
+ this.fail(`restarting ice with ${peerId}`, error);
3866
+ }
3867
+ }
3868
+ this.lastRepairAt = at;
3869
+ }
3625
3870
  /** Whether this pair has been given long enough, and whether it is this side's turn to act. */
3626
3871
  dueForRepair(peerId, slot, at) {
3627
3872
  const state = slot.pc.connectionState;
@@ -3923,6 +4168,8 @@ function createSession(config) {
3923
4168
  callId: roomId,
3924
4169
  selfId: agentDid,
3925
4170
  ...(meshIce.length > 0 ? { iceServers: meshIce } : {}),
4171
+ onNetworkChange: (cb) => api.onNetworkChange(cb),
4172
+ checkConnection: () => api.checkConnection(),
3926
4173
  });
3927
4174
  meshManager = mesh;
3928
4175
  wireMeshEvents(mesh);
@@ -4094,13 +4341,13 @@ function createSession(config) {
4094
4341
  return session;
4095
4342
  }
4096
4343
 
4097
- var __classPrivateFieldSet$9 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
4344
+ var __classPrivateFieldSet$a = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
4098
4345
  if (kind === "m") throw new TypeError("Private method is not writable");
4099
4346
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4100
4347
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
4101
4348
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
4102
4349
  };
4103
- var __classPrivateFieldGet$9 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
4350
+ var __classPrivateFieldGet$a = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
4104
4351
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4105
4352
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4106
4353
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -4116,9 +4363,9 @@ class NeighbourhoodProxy {
4116
4363
  );
4117
4364
  /** Cached SFU status — fetched once per proxy lifetime. */
4118
4365
  _NeighbourhoodProxy_sfuStatusCache.set(this, null);
4119
- __classPrivateFieldSet$9(this, _NeighbourhoodProxy_client, client, "f");
4120
- __classPrivateFieldSet$9(this, _NeighbourhoodProxy_pID, pID, "f");
4121
- __classPrivateFieldSet$9(this, _NeighbourhoodProxy_agentDid, agentDid, "f");
4366
+ __classPrivateFieldSet$a(this, _NeighbourhoodProxy_client, client, "f");
4367
+ __classPrivateFieldSet$a(this, _NeighbourhoodProxy_pID, pID, "f");
4368
+ __classPrivateFieldSet$a(this, _NeighbourhoodProxy_agentDid, agentDid, "f");
4122
4369
  }
4123
4370
  // ── Telepresence ────────────────────────────────────────────────────
4124
4371
  //
@@ -4126,51 +4373,51 @@ class NeighbourhoodProxy {
4126
4373
  // Routes through the neighbourhood's link language.
4127
4374
  /** List DIDs of agents who have joined this neighbourhood. */
4128
4375
  async otherAgents() {
4129
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").otherAgents(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"));
4376
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").otherAgents(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"));
4130
4377
  }
4131
4378
  /** Check whether the neighbourhood's link language supports telepresence. */
4132
4379
  async hasTelepresenceAdapter() {
4133
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").hasTelepresenceAdapter(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"));
4380
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").hasTelepresenceAdapter(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"));
4134
4381
  }
4135
4382
  /** List agents currently online in this neighbourhood. */
4136
4383
  async onlineAgents() {
4137
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").onlineAgents(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"));
4384
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").onlineAgents(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"));
4138
4385
  }
4139
4386
  /** This agent's own online status, as it last set it on this executor, or `null`. */
4140
4387
  async ownOnlineStatus() {
4141
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").ownOnlineStatus(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"));
4388
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").ownOnlineStatus(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"));
4142
4389
  }
4143
4390
  /** Set this agent's online status with a signed perspective payload. */
4144
4391
  async setOnlineStatus(status) {
4145
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").setOnlineStatus(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"), status);
4392
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").setOnlineStatus(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), status);
4146
4393
  }
4147
4394
  /** Set this agent's online status with an unsigned perspective payload. */
4148
4395
  async setOnlineStatusU(status) {
4149
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").setOnlineStatusU(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"), status);
4396
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").setOnlineStatusU(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), status);
4150
4397
  }
4151
4398
  /** Send a signed signal to a specific remote agent via the link language. */
4152
4399
  async sendSignal(remoteAgentDid, payload) {
4153
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sendSignal(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"), remoteAgentDid, payload);
4400
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sendSignal(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), remoteAgentDid, payload);
4154
4401
  }
4155
4402
  /** Send an unsigned signal to a specific remote agent via the link language. */
4156
4403
  async sendSignalU(remoteAgentDid, payload) {
4157
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sendSignalU(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"), remoteAgentDid, payload);
4404
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sendSignalU(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), remoteAgentDid, payload);
4158
4405
  }
4159
4406
  /** Broadcast a signed signal to all agents in the neighbourhood. */
4160
4407
  async sendBroadcast(payload, loopback = false) {
4161
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sendBroadcast(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"), payload, loopback);
4408
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sendBroadcast(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), payload, loopback);
4162
4409
  }
4163
4410
  /** Broadcast an unsigned signal to all agents in the neighbourhood. */
4164
4411
  async sendBroadcastU(payload, loopback = false) {
4165
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sendBroadcastU(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"), payload, loopback);
4412
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sendBroadcastU(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), payload, loopback);
4166
4413
  }
4167
4414
  /** Register a handler for incoming telepresence signals. */
4168
4415
  async addSignalHandler(handler) {
4169
- await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").addSignalHandler(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"), handler);
4416
+ await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").addSignalHandler(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), handler);
4170
4417
  }
4171
4418
  /** Remove a previously registered signal handler. */
4172
4419
  removeSignalHandler(handler) {
4173
- __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").removeSignalHandler(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"), handler);
4420
+ __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").removeSignalHandler(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), handler);
4174
4421
  }
4175
4422
  // ── Sessions ────────────────────────────────────────────────────────
4176
4423
  //
@@ -4179,7 +4426,7 @@ class NeighbourhoodProxy {
4179
4426
  // cascade redirects, and failover internally.
4180
4427
  /** Active sessions in this neighbourhood. Destroyed sessions remove themselves. */
4181
4428
  get sessions() {
4182
- return __classPrivateFieldGet$9(this, _NeighbourhoodProxy_sessions, "f");
4429
+ return __classPrivateFieldGet$a(this, _NeighbourhoodProxy_sessions, "f");
4183
4430
  }
4184
4431
  /**
4185
4432
  * Create a WebRTC media session. Call `session.join(localStream)` to connect.
@@ -4191,16 +4438,16 @@ class NeighbourhoodProxy {
4191
4438
  async createSession(roomName, options) {
4192
4439
  // `perspective.getNeighbourhoodProxy()` builds the proxy without a DID; the session needs
4193
4440
  // the caller's own, so ask the executor once.
4194
- if (!__classPrivateFieldGet$9(this, _NeighbourhoodProxy_agentDid, "f")) {
4195
- __classPrivateFieldSet$9(this, _NeighbourhoodProxy_agentDid, (await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").callerDid()) ?? "", "f");
4441
+ if (!__classPrivateFieldGet$a(this, _NeighbourhoodProxy_agentDid, "f")) {
4442
+ __classPrivateFieldSet$a(this, _NeighbourhoodProxy_agentDid, (await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").callerDid()) ?? "", "f");
4196
4443
  }
4197
- if (!__classPrivateFieldGet$9(this, _NeighbourhoodProxy_agentDid, "f")) {
4444
+ if (!__classPrivateFieldGet$a(this, _NeighbourhoodProxy_agentDid, "f")) {
4198
4445
  throw new Error("Cannot create a call session: the executor reports no agent DID");
4199
4446
  }
4200
4447
  // Fetch SFU status once — reachability only changes at executor restart.
4201
- if (!__classPrivateFieldGet$9(this, _NeighbourhoodProxy_sfuStatusCache, "f")) {
4448
+ if (!__classPrivateFieldGet$a(this, _NeighbourhoodProxy_sfuStatusCache, "f")) {
4202
4449
  try {
4203
- __classPrivateFieldSet$9(this, _NeighbourhoodProxy_sfuStatusCache, await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuStatus(), "f");
4450
+ __classPrivateFieldSet$a(this, _NeighbourhoodProxy_sfuStatusCache, await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuStatus(), "f");
4204
4451
  }
4205
4452
  catch {
4206
4453
  // Non-fatal — session works without SFU advertisement.
@@ -4208,29 +4455,29 @@ class NeighbourhoodProxy {
4208
4455
  }
4209
4456
  const proxy = this;
4210
4457
  const session = createSession({
4211
- api: __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f"),
4458
+ api: __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f"),
4212
4459
  roomId: roomName,
4213
- agentDid: __classPrivateFieldGet$9(this, _NeighbourhoodProxy_agentDid, "f"),
4460
+ agentDid: __classPrivateFieldGet$a(this, _NeighbourhoodProxy_agentDid, "f"),
4214
4461
  neighbourhoodUrl: options?.neighbourhoodUrl ?? "",
4215
4462
  topology: options?.topology ?? "auto",
4216
4463
  sfuConfig: options?.sfuConfig,
4217
4464
  iceServers: options?.iceServers,
4218
- localSfuStatus: __classPrivateFieldGet$9(this, _NeighbourhoodProxy_sfuStatusCache, "f") ?? undefined,
4219
- sfuServesAllMembers: () => __classPrivateFieldGet$9(proxy, _NeighbourhoodProxy_client, "f").sfuServesAllMembers(__classPrivateFieldGet$9(proxy, _NeighbourhoodProxy_pID, "f")),
4465
+ localSfuStatus: __classPrivateFieldGet$a(this, _NeighbourhoodProxy_sfuStatusCache, "f") ?? undefined,
4466
+ sfuServesAllMembers: () => __classPrivateFieldGet$a(proxy, _NeighbourhoodProxy_client, "f").sfuServesAllMembers(__classPrivateFieldGet$a(proxy, _NeighbourhoodProxy_pID, "f")),
4220
4467
  // Mesh needs a signalling channel and presence callbacks.
4221
4468
  // SFU ignores these — they remain unused when the resolved
4222
4469
  // topology selects the SFU path.
4223
- channel: createTelepresenceChannel(proxy, __classPrivateFieldGet$9(proxy, _NeighbourhoodProxy_agentDid, "f")),
4470
+ channel: createTelepresenceChannel(proxy, __classPrivateFieldGet$a(proxy, _NeighbourhoodProxy_agentDid, "f")),
4224
4471
  ownOnlineStatus: () => proxy.ownOnlineStatus(),
4225
4472
  setOnlineStatus: (status) => proxy.setOnlineStatusU(status),
4226
4473
  onlineAgents: () => proxy.onlineAgents(),
4227
4474
  });
4228
- __classPrivateFieldGet$9(this, _NeighbourhoodProxy_sessions, "f").push(session);
4475
+ __classPrivateFieldGet$a(this, _NeighbourhoodProxy_sessions, "f").push(session);
4229
4476
  session.on("state-changed", (state) => {
4230
4477
  if (state === "closed") {
4231
- const idx = __classPrivateFieldGet$9(this, _NeighbourhoodProxy_sessions, "f").indexOf(session);
4478
+ const idx = __classPrivateFieldGet$a(this, _NeighbourhoodProxy_sessions, "f").indexOf(session);
4232
4479
  if (idx !== -1)
4233
- __classPrivateFieldGet$9(this, _NeighbourhoodProxy_sessions, "f").splice(idx, 1);
4480
+ __classPrivateFieldGet$a(this, _NeighbourhoodProxy_sessions, "f").splice(idx, 1);
4234
4481
  }
4235
4482
  });
4236
4483
  return session;
@@ -4242,37 +4489,37 @@ class NeighbourhoodProxy {
4242
4489
  // not per-neighbourhood, and the URL is owned by the consumer (Flux's
4243
4490
  // call context, the WE UI, etc).
4244
4491
  async sfuConfig(neighbourhoodUrl) {
4245
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuGetConfig(neighbourhoodUrl);
4492
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuGetConfig(neighbourhoodUrl);
4246
4493
  }
4247
4494
  async setSfuConfig(neighbourhoodUrl, config) {
4248
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuSetConfig(neighbourhoodUrl, config);
4495
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuSetConfig(neighbourhoodUrl, config);
4249
4496
  }
4250
4497
  async sfuPeer(neighbourhoodUrl) {
4251
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuPeerForNeighbourhood(neighbourhoodUrl);
4498
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuPeerForNeighbourhood(neighbourhoodUrl);
4252
4499
  }
4253
4500
  async sfuPeers(neighbourhoodUrl) {
4254
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuPeersForNeighbourhood(neighbourhoodUrl);
4501
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuPeersForNeighbourhood(neighbourhoodUrl);
4255
4502
  }
4256
4503
  async sfuStartRoom(neighbourhoodUrl, roomName) {
4257
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuStartRoom(neighbourhoodUrl, roomName);
4504
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuStartRoom(neighbourhoodUrl, roomName);
4258
4505
  }
4259
4506
  async sfuStopRoom(neighbourhoodUrl, roomName) {
4260
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuStopRoom(neighbourhoodUrl, roomName);
4507
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuStopRoom(neighbourhoodUrl, roomName);
4261
4508
  }
4262
4509
  async sfuListRooms() {
4263
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuListRooms();
4510
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuListRooms();
4264
4511
  }
4265
4512
  async callJoin(neighbourhoodUrl, roomName, sdpOffer) {
4266
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuCallJoin(neighbourhoodUrl, roomName, sdpOffer);
4513
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuCallJoin(neighbourhoodUrl, roomName, sdpOffer);
4267
4514
  }
4268
4515
  async callLeave(neighbourhoodUrl, roomName) {
4269
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuCallLeave(neighbourhoodUrl, roomName);
4516
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuCallLeave(neighbourhoodUrl, roomName);
4270
4517
  }
4271
4518
  async callSetQualityPreference(neighbourhoodUrl, roomName, preference) {
4272
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuCallSetQualityPreference(neighbourhoodUrl, roomName, preference);
4519
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuCallSetQualityPreference(neighbourhoodUrl, roomName, preference);
4273
4520
  }
4274
4521
  async callAnswerServerOffer(neighbourhoodUrl, roomName, sdpAnswer) {
4275
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuCallAnswerServerOffer(neighbourhoodUrl, roomName, sdpAnswer);
4522
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuCallAnswerServerOffer(neighbourhoodUrl, roomName, sdpAnswer);
4276
4523
  }
4277
4524
  /**
4278
4525
  * Subscribe to server-pushed renegotiation offers for `targetDid`.
@@ -4281,35 +4528,35 @@ class NeighbourhoodProxy {
4281
4528
  * underlying mechanism.
4282
4529
  */
4283
4530
  subscribeCallRenegotiationOffer(targetDid, callback) {
4284
- return __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").subscribeSfuCallRenegotiationOffer(targetDid, callback);
4531
+ return __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").subscribeSfuCallRenegotiationOffer(targetDid, callback);
4285
4532
  }
4286
4533
  /**
4287
4534
  * Subscribe to cascade rebalance migration events for `targetDid`.
4288
4535
  * Returns an unsubscribe function.
4289
4536
  */
4290
4537
  subscribeMigrateEvent(targetDid, callback) {
4291
- return __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").subscribeSfuMigrateEvent(targetDid, callback);
4538
+ return __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").subscribeSfuMigrateEvent(targetDid, callback);
4292
4539
  }
4293
4540
  // ── SFU trickle ICE ─────────────────────────────────────────────────
4294
4541
  async addIceCandidate(neighbourhoodUrl, roomName, candidate) {
4295
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuAddIceCandidate(neighbourhoodUrl, roomName, candidate);
4542
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuAddIceCandidate(neighbourhoodUrl, roomName, candidate);
4296
4543
  }
4297
4544
  // ── SFU data channel relay ────────────────────────────────────────
4298
4545
  async sendData(neighbourhoodUrl, roomName, channelLabel, data, binary = false) {
4299
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuSendData(neighbourhoodUrl, roomName, channelLabel, data, binary);
4546
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuSendData(neighbourhoodUrl, roomName, channelLabel, data, binary);
4300
4547
  }
4301
4548
  subscribeDataChannel(callback) {
4302
- return __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").subscribeSfuDataChannel(callback);
4549
+ return __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").subscribeSfuDataChannel(callback);
4303
4550
  }
4304
4551
  // ── SFU diagnostic / test-harness ──────────────────────────────────
4305
4552
  async sfuCascadeStatus() {
4306
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuCascadeStatus();
4553
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuCascadeStatus();
4307
4554
  }
4308
4555
  async sfuQualityPreferences() {
4309
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuQualityPreferences();
4556
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuQualityPreferences();
4310
4557
  }
4311
4558
  async sfuEnsureMembership(neighbourhoodUrl, did) {
4312
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuEnsureMembership(neighbourhoodUrl, did);
4559
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuEnsureMembership(neighbourhoodUrl, did);
4313
4560
  }
4314
4561
  }
4315
4562
  _NeighbourhoodProxy_client = new WeakMap(), _NeighbourhoodProxy_pID = new WeakMap(), _NeighbourhoodProxy_agentDid = new WeakMap(), _NeighbourhoodProxy_sessions = new WeakMap(), _NeighbourhoodProxy_sfuStatusCache = new WeakMap();
@@ -4354,13 +4601,13 @@ class LinkQuery {
4354
4601
  }
4355
4602
  }
4356
4603
 
4357
- var __classPrivateFieldSet$8 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
4604
+ var __classPrivateFieldSet$9 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
4358
4605
  if (kind === "m") throw new TypeError("Private method is not writable");
4359
4606
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4360
4607
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
4361
4608
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
4362
4609
  };
4363
- var __classPrivateFieldGet$8 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
4610
+ var __classPrivateFieldGet$9 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
4364
4611
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4365
4612
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4366
4613
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -4381,44 +4628,44 @@ class Literal {
4381
4628
  if (url.startsWith("literal://"))
4382
4629
  throw new Error("literal:// format is no longer supported. Use literal: instead.");
4383
4630
  const l = new Literal();
4384
- __classPrivateFieldSet$8(l, _Literal_url, url, "f");
4631
+ __classPrivateFieldSet$9(l, _Literal_url, url, "f");
4385
4632
  return l;
4386
4633
  }
4387
4634
  static from(literal) {
4388
4635
  const l = new Literal();
4389
- __classPrivateFieldSet$8(l, _Literal_literal, literal, "f");
4636
+ __classPrivateFieldSet$9(l, _Literal_literal, literal, "f");
4390
4637
  return l;
4391
4638
  }
4392
4639
  toUrl() {
4393
- if (__classPrivateFieldGet$8(this, _Literal_url, "f") && __classPrivateFieldGet$8(this, _Literal_literal, "f") === undefined)
4394
- return __classPrivateFieldGet$8(this, _Literal_url, "f");
4395
- if (__classPrivateFieldGet$8(this, _Literal_literal, "f") === undefined)
4640
+ if (__classPrivateFieldGet$9(this, _Literal_url, "f") && __classPrivateFieldGet$9(this, _Literal_literal, "f") === undefined)
4641
+ return __classPrivateFieldGet$9(this, _Literal_url, "f");
4642
+ if (__classPrivateFieldGet$9(this, _Literal_literal, "f") === undefined)
4396
4643
  throw new Error("Can't turn empty Literal into URL");
4397
4644
  let encoded;
4398
- switch (typeof __classPrivateFieldGet$8(this, _Literal_literal, "f")) {
4645
+ switch (typeof __classPrivateFieldGet$9(this, _Literal_literal, "f")) {
4399
4646
  case 'string':
4400
- encoded = `string:${encodeRFC3986URIComponent(__classPrivateFieldGet$8(this, _Literal_literal, "f"))}`;
4647
+ encoded = `string:${encodeRFC3986URIComponent(__classPrivateFieldGet$9(this, _Literal_literal, "f"))}`;
4401
4648
  break;
4402
4649
  case 'number':
4403
- encoded = `number:${encodeRFC3986URIComponent(__classPrivateFieldGet$8(this, _Literal_literal, "f"))}`;
4650
+ encoded = `number:${encodeRFC3986URIComponent(__classPrivateFieldGet$9(this, _Literal_literal, "f"))}`;
4404
4651
  break;
4405
4652
  case 'boolean':
4406
- encoded = `boolean:${encodeRFC3986URIComponent(__classPrivateFieldGet$8(this, _Literal_literal, "f"))}`;
4653
+ encoded = `boolean:${encodeRFC3986URIComponent(__classPrivateFieldGet$9(this, _Literal_literal, "f"))}`;
4407
4654
  break;
4408
4655
  case 'object':
4409
- encoded = `json:${encodeRFC3986URIComponent(JSON.stringify(__classPrivateFieldGet$8(this, _Literal_literal, "f")))}`;
4656
+ encoded = `json:${encodeRFC3986URIComponent(JSON.stringify(__classPrivateFieldGet$9(this, _Literal_literal, "f")))}`;
4410
4657
  break;
4411
4658
  }
4412
4659
  return `literal:${encoded}`;
4413
4660
  }
4414
4661
  get() {
4415
- if (__classPrivateFieldGet$8(this, _Literal_literal, "f") !== undefined)
4416
- return __classPrivateFieldGet$8(this, _Literal_literal, "f");
4417
- if (!__classPrivateFieldGet$8(this, _Literal_url, "f"))
4662
+ if (__classPrivateFieldGet$9(this, _Literal_literal, "f") !== undefined)
4663
+ return __classPrivateFieldGet$9(this, _Literal_literal, "f");
4664
+ if (!__classPrivateFieldGet$9(this, _Literal_url, "f"))
4418
4665
  throw new Error("Can't render empty Literal");
4419
- if (!__classPrivateFieldGet$8(this, _Literal_url, "f").startsWith("literal:"))
4666
+ if (!__classPrivateFieldGet$9(this, _Literal_url, "f").startsWith("literal:"))
4420
4667
  throw new Error("Can't render Literal from non-literal URL");
4421
- const body = __classPrivateFieldGet$8(this, _Literal_url, "f").substring(8);
4668
+ const body = __classPrivateFieldGet$9(this, _Literal_url, "f").substring(8);
4422
4669
  if (body.startsWith("string:")) {
4423
4670
  return decodeURIComponent(body.substring(7));
4424
4671
  }
@@ -6801,13 +7048,13 @@ function queryCacheSize() {
6801
7048
  return cache.size;
6802
7049
  }
6803
7050
 
6804
- var __classPrivateFieldSet$7 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7051
+ var __classPrivateFieldSet$8 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
6805
7052
  if (kind === "m") throw new TypeError("Private method is not writable");
6806
7053
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
6807
7054
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6808
7055
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6809
7056
  };
6810
- var __classPrivateFieldGet$7 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
7057
+ var __classPrivateFieldGet$8 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
6811
7058
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
6812
7059
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
6813
7060
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -6893,30 +7140,30 @@ class LiveQuery {
6893
7140
  _LiveQuery_statusListeners.set(this, new Set()
6894
7141
  /** `open` subscribes on the executor; aborting its signal cancels the call. */
6895
7142
  );
6896
- __classPrivateFieldSet$7(this, _LiveQuery_client, client, "f");
6897
- __classPrivateFieldSet$7(this, _LiveQuery_uuid, uuid, "f");
6898
- __classPrivateFieldSet$7(this, _LiveQuery_open, open, "f");
6899
- __classPrivateFieldSet$7(this, _LiveQuery_onResult, onResult, "f");
6900
- __classPrivateFieldSet$7(this, _LiveQuery_unlisten, client.onQueryUpdate(update => __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_receive).call(this, update)), "f");
6901
- __classPrivateFieldSet$7(this, _LiveQuery_unreconnect, client.onReconnect(() => __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_reopen).call(this)), "f");
6902
- }
6903
- get id() { return __classPrivateFieldGet$7(this, _LiveQuery_id, "f"); }
6904
- get result() { return __classPrivateFieldGet$7(this, _LiveQuery_result, "f"); }
7143
+ __classPrivateFieldSet$8(this, _LiveQuery_client, client, "f");
7144
+ __classPrivateFieldSet$8(this, _LiveQuery_uuid, uuid, "f");
7145
+ __classPrivateFieldSet$8(this, _LiveQuery_open, open, "f");
7146
+ __classPrivateFieldSet$8(this, _LiveQuery_onResult, onResult, "f");
7147
+ __classPrivateFieldSet$8(this, _LiveQuery_unlisten, client.onQueryUpdate(update => __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_receive).call(this, update)), "f");
7148
+ __classPrivateFieldSet$8(this, _LiveQuery_unreconnect, client.onReconnect(() => __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_reopen).call(this)), "f");
7149
+ }
7150
+ get id() { return __classPrivateFieldGet$8(this, _LiveQuery_id, "f"); }
7151
+ get result() { return __classPrivateFieldGet$8(this, _LiveQuery_result, "f"); }
6905
7152
  /** Whether a re-open failed and the query is waiting to retry it. */
6906
- get reopening() { return __classPrivateFieldGet$7(this, _LiveQuery_reopening, "f"); }
7153
+ get reopening() { return __classPrivateFieldGet$8(this, _LiveQuery_reopening, "f"); }
6907
7154
  /** Call `listener` on each failed re-open and when a re-open succeeds
6908
7155
  * after one failed. Returns a remover. */
6909
7156
  onStatus(listener) {
6910
- __classPrivateFieldGet$7(this, _LiveQuery_statusListeners, "f").add(listener);
6911
- return () => __classPrivateFieldGet$7(this, _LiveQuery_statusListeners, "f").delete(listener);
7157
+ __classPrivateFieldGet$8(this, _LiveQuery_statusListeners, "f").add(listener);
7158
+ return () => __classPrivateFieldGet$8(this, _LiveQuery_statusListeners, "f").delete(listener);
6912
7159
  }
6913
7160
  /** Open the subscription (again) and return its initial result. A start
6914
7161
  * that a newer one overtakes resolves with the newer one's result. */
6915
7162
  start() {
6916
7163
  var _a;
6917
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_clearRetry).call(this);
6918
- __classPrivateFieldSet$7(this, _LiveQuery_latest, __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_start).call(this, __classPrivateFieldSet$7(this, _LiveQuery_generation, (_a = __classPrivateFieldGet$7(this, _LiveQuery_generation, "f"), ++_a), "f")), "f");
6919
- return __classPrivateFieldGet$7(this, _LiveQuery_latest, "f");
7164
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_clearRetry).call(this);
7165
+ __classPrivateFieldSet$8(this, _LiveQuery_latest, __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_start).call(this, __classPrivateFieldSet$8(this, _LiveQuery_generation, (_a = __classPrivateFieldGet$8(this, _LiveQuery_generation, "f"), ++_a), "f")), "f");
7166
+ return __classPrivateFieldGet$8(this, _LiveQuery_latest, "f");
6920
7167
  }
6921
7168
  /** End the subscription. With `cancelOpening`, a subscribe call still in
6922
7169
  * flight is cancelled too, so the executor stops computing a first result
@@ -6924,77 +7171,77 @@ class LiveQuery {
6924
7171
  * resolving with that result. */
6925
7172
  dispose(options = {}) {
6926
7173
  var _a;
6927
- __classPrivateFieldSet$7(this, _LiveQuery_disposed, true, "f");
6928
- __classPrivateFieldSet$7(this, _LiveQuery_generation, (_a = __classPrivateFieldGet$7(this, _LiveQuery_generation, "f"), _a++, _a), "f");
6929
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_clearRetry).call(this);
6930
- __classPrivateFieldGet$7(this, _LiveQuery_statusListeners, "f").clear();
6931
- __classPrivateFieldGet$7(this, _LiveQuery_unlisten, "f").call(this);
6932
- __classPrivateFieldGet$7(this, _LiveQuery_unreconnect, "f").call(this);
7174
+ __classPrivateFieldSet$8(this, _LiveQuery_disposed, true, "f");
7175
+ __classPrivateFieldSet$8(this, _LiveQuery_generation, (_a = __classPrivateFieldGet$8(this, _LiveQuery_generation, "f"), _a++, _a), "f");
7176
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_clearRetry).call(this);
7177
+ __classPrivateFieldGet$8(this, _LiveQuery_statusListeners, "f").clear();
7178
+ __classPrivateFieldGet$8(this, _LiveQuery_unlisten, "f").call(this);
7179
+ __classPrivateFieldGet$8(this, _LiveQuery_unreconnect, "f").call(this);
6933
7180
  if (options.cancelOpening)
6934
- __classPrivateFieldGet$7(this, _LiveQuery_opening, "f")?.abort();
6935
- if (__classPrivateFieldGet$7(this, _LiveQuery_id, "f"))
6936
- __classPrivateFieldGet$7(this, _LiveQuery_client, "f").disposeQuerySubscription(__classPrivateFieldGet$7(this, _LiveQuery_uuid, "f"), __classPrivateFieldGet$7(this, _LiveQuery_id, "f")).catch(() => { });
7181
+ __classPrivateFieldGet$8(this, _LiveQuery_opening, "f")?.abort();
7182
+ if (__classPrivateFieldGet$8(this, _LiveQuery_id, "f"))
7183
+ __classPrivateFieldGet$8(this, _LiveQuery_client, "f").disposeQuerySubscription(__classPrivateFieldGet$8(this, _LiveQuery_uuid, "f"), __classPrivateFieldGet$8(this, _LiveQuery_id, "f")).catch(() => { });
6937
7184
  }
6938
7185
  }
6939
7186
  _LiveQuery_client = new WeakMap(), _LiveQuery_uuid = new WeakMap(), _LiveQuery_open = new WeakMap(), _LiveQuery_onResult = new WeakMap(), _LiveQuery_id = new WeakMap(), _LiveQuery_revision = new WeakMap(), _LiveQuery_result = new WeakMap(), _LiveQuery_started = new WeakMap(), _LiveQuery_disposed = new WeakMap(), _LiveQuery_generation = new WeakMap(), _LiveQuery_latest = new WeakMap(), _LiveQuery_buffer = new WeakMap(), _LiveQuery_unlisten = new WeakMap(), _LiveQuery_unreconnect = new WeakMap(), _LiveQuery_opening = new WeakMap(), _LiveQuery_retryTimer = new WeakMap(), _LiveQuery_reopening = new WeakMap(), _LiveQuery_statusListeners = new WeakMap(), _LiveQuery_instances = new WeakSet(), _LiveQuery_start = async function _LiveQuery_start(generation) {
6940
- __classPrivateFieldSet$7(this, _LiveQuery_buffer, [], "f");
7187
+ __classPrivateFieldSet$8(this, _LiveQuery_buffer, [], "f");
6941
7188
  const opening = new AbortController();
6942
- __classPrivateFieldSet$7(this, _LiveQuery_opening, opening, "f");
7189
+ __classPrivateFieldSet$8(this, _LiveQuery_opening, opening, "f");
6943
7190
  let subscribed;
6944
7191
  try {
6945
- subscribed = await __classPrivateFieldGet$7(this, _LiveQuery_open, "f").call(this, opening.signal);
7192
+ subscribed = await __classPrivateFieldGet$8(this, _LiveQuery_open, "f").call(this, opening.signal);
6946
7193
  }
6947
7194
  catch (e) {
6948
- if (generation === __classPrivateFieldGet$7(this, _LiveQuery_generation, "f"))
6949
- __classPrivateFieldSet$7(this, _LiveQuery_buffer, null, "f");
7195
+ if (generation === __classPrivateFieldGet$8(this, _LiveQuery_generation, "f"))
7196
+ __classPrivateFieldSet$8(this, _LiveQuery_buffer, null, "f");
6950
7197
  throw e;
6951
7198
  }
6952
7199
  finally {
6953
- if (__classPrivateFieldGet$7(this, _LiveQuery_opening, "f") === opening)
6954
- __classPrivateFieldSet$7(this, _LiveQuery_opening, undefined, "f");
7200
+ if (__classPrivateFieldGet$8(this, _LiveQuery_opening, "f") === opening)
7201
+ __classPrivateFieldSet$8(this, _LiveQuery_opening, undefined, "f");
6955
7202
  }
6956
- if (__classPrivateFieldGet$7(this, _LiveQuery_disposed, "f") || generation !== __classPrivateFieldGet$7(this, _LiveQuery_generation, "f")) {
6957
- __classPrivateFieldGet$7(this, _LiveQuery_client, "f").disposeQuerySubscription(__classPrivateFieldGet$7(this, _LiveQuery_uuid, "f"), subscribed.subscriptionId).catch(() => { });
7203
+ if (__classPrivateFieldGet$8(this, _LiveQuery_disposed, "f") || generation !== __classPrivateFieldGet$8(this, _LiveQuery_generation, "f")) {
7204
+ __classPrivateFieldGet$8(this, _LiveQuery_client, "f").disposeQuerySubscription(__classPrivateFieldGet$8(this, _LiveQuery_uuid, "f"), subscribed.subscriptionId).catch(() => { });
6958
7205
  // Disposed while opening (e.g. a newer subscribe() on the same
6959
7206
  // builder): the caller still gets the snapshot that was read.
6960
- return __classPrivateFieldGet$7(this, _LiveQuery_disposed, "f") ? (__classPrivateFieldGet$7(this, _LiveQuery_result, "f") ?? subscribed.result) : __classPrivateFieldGet$7(this, _LiveQuery_latest, "f");
7207
+ return __classPrivateFieldGet$8(this, _LiveQuery_disposed, "f") ? (__classPrivateFieldGet$8(this, _LiveQuery_result, "f") ?? subscribed.result) : __classPrivateFieldGet$8(this, _LiveQuery_latest, "f");
6961
7208
  }
6962
- __classPrivateFieldSet$7(this, _LiveQuery_id, subscribed.subscriptionId, "f");
6963
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_replace).call(this, subscribed.revision, subscribed.result);
6964
- return __classPrivateFieldGet$7(this, _LiveQuery_result, "f");
7209
+ __classPrivateFieldSet$8(this, _LiveQuery_id, subscribed.subscriptionId, "f");
7210
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_replace).call(this, subscribed.revision, subscribed.result);
7211
+ return __classPrivateFieldGet$8(this, _LiveQuery_result, "f");
6965
7212
  }, _LiveQuery_reopen = function _LiveQuery_reopen(failures = 0) {
6966
- if (__classPrivateFieldGet$7(this, _LiveQuery_disposed, "f"))
7213
+ if (__classPrivateFieldGet$8(this, _LiveQuery_disposed, "f"))
6967
7214
  return;
6968
7215
  const reopened = this.start();
6969
- const generation = __classPrivateFieldGet$7(this, _LiveQuery_generation, "f");
7216
+ const generation = __classPrivateFieldGet$8(this, _LiveQuery_generation, "f");
6970
7217
  reopened.then(() => {
6971
- if (__classPrivateFieldGet$7(this, _LiveQuery_disposed, "f") || generation !== __classPrivateFieldGet$7(this, _LiveQuery_generation, "f") || !__classPrivateFieldGet$7(this, _LiveQuery_reopening, "f"))
7218
+ if (__classPrivateFieldGet$8(this, _LiveQuery_disposed, "f") || generation !== __classPrivateFieldGet$8(this, _LiveQuery_generation, "f") || !__classPrivateFieldGet$8(this, _LiveQuery_reopening, "f"))
6972
7219
  return;
6973
- __classPrivateFieldSet$7(this, _LiveQuery_reopening, false, "f");
6974
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_emit).call(this, { state: 'open' });
7220
+ __classPrivateFieldSet$8(this, _LiveQuery_reopening, false, "f");
7221
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_emit).call(this, { state: 'open' });
6975
7222
  }, error => {
6976
- if (__classPrivateFieldGet$7(this, _LiveQuery_disposed, "f") || generation !== __classPrivateFieldGet$7(this, _LiveQuery_generation, "f"))
7223
+ if (__classPrivateFieldGet$8(this, _LiveQuery_disposed, "f") || generation !== __classPrivateFieldGet$8(this, _LiveQuery_generation, "f"))
6977
7224
  return;
6978
7225
  const retryInMs = reopenDelay(failures + 1);
6979
7226
  console.error(`Error re-opening live query (attempt ${failures + 1}), retrying in ${Math.round(retryInMs)}ms:`, error);
6980
- __classPrivateFieldSet$7(this, _LiveQuery_reopening, true, "f");
6981
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_emit).call(this, { state: 'reopening', error, retryInMs });
7227
+ __classPrivateFieldSet$8(this, _LiveQuery_reopening, true, "f");
7228
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_emit).call(this, { state: 'reopening', error, retryInMs });
6982
7229
  const timer = setTimeout(() => {
6983
- __classPrivateFieldSet$7(this, _LiveQuery_retryTimer, undefined, "f");
6984
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_reopen).call(this, failures + 1);
7230
+ __classPrivateFieldSet$8(this, _LiveQuery_retryTimer, undefined, "f");
7231
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_reopen).call(this, failures + 1);
6985
7232
  }, retryInMs);
6986
7233
  // Node: a pending retry must not keep the process alive.
6987
7234
  if (typeof timer?.unref === 'function')
6988
7235
  timer.unref();
6989
- __classPrivateFieldSet$7(this, _LiveQuery_retryTimer, timer, "f");
7236
+ __classPrivateFieldSet$8(this, _LiveQuery_retryTimer, timer, "f");
6990
7237
  });
6991
7238
  }, _LiveQuery_clearRetry = function _LiveQuery_clearRetry() {
6992
- if (__classPrivateFieldGet$7(this, _LiveQuery_retryTimer, "f") === undefined)
7239
+ if (__classPrivateFieldGet$8(this, _LiveQuery_retryTimer, "f") === undefined)
6993
7240
  return;
6994
- clearTimeout(__classPrivateFieldGet$7(this, _LiveQuery_retryTimer, "f"));
6995
- __classPrivateFieldSet$7(this, _LiveQuery_retryTimer, undefined, "f");
7241
+ clearTimeout(__classPrivateFieldGet$8(this, _LiveQuery_retryTimer, "f"));
7242
+ __classPrivateFieldSet$8(this, _LiveQuery_retryTimer, undefined, "f");
6996
7243
  }, _LiveQuery_emit = function _LiveQuery_emit(status) {
6997
- for (const listener of [...__classPrivateFieldGet$7(this, _LiveQuery_statusListeners, "f")]) {
7244
+ for (const listener of [...__classPrivateFieldGet$8(this, _LiveQuery_statusListeners, "f")]) {
6998
7245
  try {
6999
7246
  listener(status);
7000
7247
  }
@@ -7003,58 +7250,133 @@ _LiveQuery_client = new WeakMap(), _LiveQuery_uuid = new WeakMap(), _LiveQuery_o
7003
7250
  }
7004
7251
  }
7005
7252
  }, _LiveQuery_replace = function _LiveQuery_replace(revision, result) {
7006
- __classPrivateFieldSet$7(this, _LiveQuery_revision, revision, "f");
7007
- __classPrivateFieldSet$7(this, _LiveQuery_result, result, "f");
7008
- const buffered = __classPrivateFieldGet$7(this, _LiveQuery_buffer, "f") ?? [];
7009
- __classPrivateFieldSet$7(this, _LiveQuery_buffer, null, "f");
7010
- if (__classPrivateFieldGet$7(this, _LiveQuery_started, "f"))
7011
- __classPrivateFieldGet$7(this, _LiveQuery_onResult, "f").call(this, result);
7012
- __classPrivateFieldSet$7(this, _LiveQuery_started, true, "f");
7253
+ __classPrivateFieldSet$8(this, _LiveQuery_revision, revision, "f");
7254
+ __classPrivateFieldSet$8(this, _LiveQuery_result, result, "f");
7255
+ const buffered = __classPrivateFieldGet$8(this, _LiveQuery_buffer, "f") ?? [];
7256
+ __classPrivateFieldSet$8(this, _LiveQuery_buffer, null, "f");
7257
+ if (__classPrivateFieldGet$8(this, _LiveQuery_started, "f"))
7258
+ __classPrivateFieldGet$8(this, _LiveQuery_onResult, "f").call(this, result);
7259
+ __classPrivateFieldSet$8(this, _LiveQuery_started, true, "f");
7013
7260
  for (const update of buffered)
7014
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_receive).call(this, update);
7261
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_receive).call(this, update);
7015
7262
  }, _LiveQuery_receive = function _LiveQuery_receive(update) {
7016
- if (__classPrivateFieldGet$7(this, _LiveQuery_buffer, "f")) {
7017
- __classPrivateFieldGet$7(this, _LiveQuery_buffer, "f").push(update);
7263
+ if (__classPrivateFieldGet$8(this, _LiveQuery_buffer, "f")) {
7264
+ __classPrivateFieldGet$8(this, _LiveQuery_buffer, "f").push(update);
7018
7265
  return;
7019
7266
  }
7020
7267
  if ('lagged' in update) {
7021
- if (__classPrivateFieldGet$7(this, _LiveQuery_id, "f"))
7022
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_resync).call(this);
7268
+ if (__classPrivateFieldGet$8(this, _LiveQuery_id, "f"))
7269
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_resync).call(this);
7023
7270
  return;
7024
7271
  }
7025
- if (update.subscriptionId !== __classPrivateFieldGet$7(this, _LiveQuery_id, "f") || update.revision <= __classPrivateFieldGet$7(this, _LiveQuery_revision, "f"))
7272
+ if (update.subscriptionId !== __classPrivateFieldGet$8(this, _LiveQuery_id, "f") || update.revision <= __classPrivateFieldGet$8(this, _LiveQuery_revision, "f"))
7026
7273
  return;
7027
- if (update.revision !== __classPrivateFieldGet$7(this, _LiveQuery_revision, "f") + 1) {
7028
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_resync).call(this);
7274
+ if (update.revision !== __classPrivateFieldGet$8(this, _LiveQuery_revision, "f") + 1) {
7275
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_resync).call(this);
7029
7276
  return;
7030
7277
  }
7031
7278
  let result;
7032
7279
  try {
7033
- result = applyUpdate(__classPrivateFieldGet$7(this, _LiveQuery_result, "f"), update);
7280
+ result = applyUpdate(__classPrivateFieldGet$8(this, _LiveQuery_result, "f"), update);
7034
7281
  }
7035
7282
  catch {
7036
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_resync).call(this);
7283
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_resync).call(this);
7037
7284
  return;
7038
7285
  }
7039
- __classPrivateFieldSet$7(this, _LiveQuery_revision, update.revision, "f");
7040
- __classPrivateFieldSet$7(this, _LiveQuery_result, result, "f");
7041
- __classPrivateFieldGet$7(this, _LiveQuery_onResult, "f").call(this, __classPrivateFieldGet$7(this, _LiveQuery_result, "f"));
7286
+ __classPrivateFieldSet$8(this, _LiveQuery_revision, update.revision, "f");
7287
+ __classPrivateFieldSet$8(this, _LiveQuery_result, result, "f");
7288
+ __classPrivateFieldGet$8(this, _LiveQuery_onResult, "f").call(this, __classPrivateFieldGet$8(this, _LiveQuery_result, "f"));
7042
7289
  }, _LiveQuery_resync = function _LiveQuery_resync() {
7043
- const generation = __classPrivateFieldGet$7(this, _LiveQuery_generation, "f");
7044
- const id = __classPrivateFieldGet$7(this, _LiveQuery_id, "f");
7045
- __classPrivateFieldSet$7(this, _LiveQuery_buffer, [], "f");
7046
- __classPrivateFieldGet$7(this, _LiveQuery_client, "f").resyncSubscription(__classPrivateFieldGet$7(this, _LiveQuery_uuid, "f"), id).then(({ revision, result }) => {
7047
- if (!__classPrivateFieldGet$7(this, _LiveQuery_disposed, "f") && generation === __classPrivateFieldGet$7(this, _LiveQuery_generation, "f"))
7048
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_replace).call(this, revision, result);
7290
+ const generation = __classPrivateFieldGet$8(this, _LiveQuery_generation, "f");
7291
+ const id = __classPrivateFieldGet$8(this, _LiveQuery_id, "f");
7292
+ __classPrivateFieldSet$8(this, _LiveQuery_buffer, [], "f");
7293
+ __classPrivateFieldGet$8(this, _LiveQuery_client, "f").resyncSubscription(__classPrivateFieldGet$8(this, _LiveQuery_uuid, "f"), id).then(({ revision, result }) => {
7294
+ if (!__classPrivateFieldGet$8(this, _LiveQuery_disposed, "f") && generation === __classPrivateFieldGet$8(this, _LiveQuery_generation, "f"))
7295
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_replace).call(this, revision, result);
7049
7296
  }, () => {
7050
7297
  // Replace the subscription with a new one.
7051
- if (!__classPrivateFieldGet$7(this, _LiveQuery_disposed, "f") && generation === __classPrivateFieldGet$7(this, _LiveQuery_generation, "f")) {
7052
- __classPrivateFieldGet$7(this, _LiveQuery_client, "f").disposeQuerySubscription(__classPrivateFieldGet$7(this, _LiveQuery_uuid, "f"), id).catch(() => { });
7053
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_reopen).call(this);
7298
+ if (!__classPrivateFieldGet$8(this, _LiveQuery_disposed, "f") && generation === __classPrivateFieldGet$8(this, _LiveQuery_generation, "f")) {
7299
+ __classPrivateFieldGet$8(this, _LiveQuery_client, "f").disposeQuerySubscription(__classPrivateFieldGet$8(this, _LiveQuery_uuid, "f"), id).catch(() => { });
7300
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_reopen).call(this);
7054
7301
  }
7055
7302
  });
7056
7303
  };
7057
7304
 
7305
+ /**
7306
+ * Compare two strings by Unicode code point, ascending. This is the order
7307
+ * Rust's `String::cmp` produces (UTF-8 bytes sort in code-point order), so
7308
+ * a sort keyed on it here and in `rust-executor` agrees for every name, not
7309
+ * only ASCII. `<` on JS strings compares UTF-16 code units instead, which
7310
+ * puts U+E000–U+FFFF after the supplementary planes.
7311
+ *
7312
+ * Used by `fromLinks` to break state-value ties (#1202).
7313
+ */
7314
+ function compareCodePoints(a, b) {
7315
+ const as = Array.from(a);
7316
+ const bs = Array.from(b);
7317
+ const n = Math.min(as.length, bs.length);
7318
+ for (let i = 0; i < n; i++) {
7319
+ const d = as[i].codePointAt(0) - bs[i].codePointAt(0);
7320
+ if (d !== 0)
7321
+ return d;
7322
+ }
7323
+ return as.length - bs.length;
7324
+ }
7325
+ /**
7326
+ * Decode a state's `stateValue` link target into the number the state sort
7327
+ * keys on. **One grammar, shared verbatim with `decode_state_value` in
7328
+ * `rust-executor/src/perspectives/shacl_parser.rs`; a change to one is a
7329
+ * change to both**, and the `state value decoder matches rust` test here and
7330
+ * `state_value_decoder_matches_ts` there hold the two to the same answers.
7331
+ *
7332
+ * Not `Literal.fromUrl(target).get()`: that is `parseFloat`, which reads
7333
+ * `1abc` as 1 and `inf` as NaN, while Rust's `str::parse::<f64>` does the
7334
+ * reverse — so before #1202 the two runtimes could decode the same links to
7335
+ * different values and pick different initial states. The grammar:
7336
+ *
7337
+ * 1. The target must be a `literal:number:` literal. Anything else is NaN.
7338
+ * 2. The payload is percent-decoded: `Literal.toUrl` writes `1e21` as
7339
+ * `1e%2B21`. A payload that does not decode is NaN.
7340
+ * 3. A plain decimal — `[+-]?([0-9]+.?[0-9]*|.[0-9]+)([eE][+-]?[0-9]+)?`,
7341
+ * ASCII digits only — parses with `Number`; both runtimes' parsers agree
7342
+ * on this set. `-0` decodes to `-0`, which the sort treats as `0`.
7343
+ * 4. `inf` / `infinity`, any ASCII case, optional sign, is ±Infinity.
7344
+ * Rust's `parse_flow_to_links` writes `-inf`, `Literal.toUrl` writes
7345
+ * `-Infinity`; both runtimes read both.
7346
+ * 5. Everything else is NaN, which the sort puts last: `NaN`, an empty
7347
+ * payload, `1abc`, ` 1`, `0x10`, non-ASCII digits.
7348
+ *
7349
+ * A *missing* `stateValue` link is not this function's case: `fromLinks`
7350
+ * reads it as `0`, as Rust does.
7351
+ *
7352
+ * `STATE_VALUE_DECIMAL` is rule 3's grammar with the dot and the digits after
7353
+ * it grouped, `[0-9]+(\.[0-9]*)?`. Same strings, but a digit run can no longer
7354
+ * split between two digit classes, so V8 does not backtrack quadratically on a
7355
+ * long run that fails at the end. Rust's `regex` crate matches in linear time
7356
+ * either way.
7357
+ */
7358
+ const STATE_VALUE_DECIMAL = /^[+-]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/;
7359
+ const STATE_VALUE_INFINITE = /^[+-]?[iI][nN][fF](?:[iI][nN][iI][tT][yY])?$/;
7360
+ function decodeStateValue(target) {
7361
+ const payload = target.startsWith("literal:number:")
7362
+ ? target.slice("literal:number:".length)
7363
+ : undefined;
7364
+ if (payload === undefined)
7365
+ return NaN;
7366
+ let decoded;
7367
+ try {
7368
+ decoded = decodeURIComponent(payload);
7369
+ }
7370
+ catch {
7371
+ return NaN;
7372
+ }
7373
+ if (STATE_VALUE_DECIMAL.test(decoded))
7374
+ return Number(decoded);
7375
+ if (STATE_VALUE_INFINITE.test(decoded)) {
7376
+ return decoded.startsWith("-") ? -Infinity : Infinity;
7377
+ }
7378
+ return NaN;
7379
+ }
7058
7380
  /**
7059
7381
  * Runtime shape check for a decoded `ModelQuery`. Deserialization paths use
7060
7382
  * this to guard against malformed guard arrays leaking into flow metadata
@@ -7172,11 +7494,13 @@ class SHACLFlow {
7172
7494
  * States in this flow.
7173
7495
  *
7174
7496
  * **Ordering convention (James PR #929 R9):** the array is stored sorted
7175
- * ascending by `value`. `states[0]` is the initial state — the one
7497
+ * ascending by `value`, ties broken by state name ascending (code-point
7498
+ * order), NaN values last. `states[0]` is the initial state — the one
7176
7499
  * {@link FlowInstance.start} mints a fresh instance into. A flow author
7177
7500
  * who wants a specific state as the entry point must give it the lowest
7178
- * `value` in the set. `fromLinks` enforces this sort, so link-order on
7179
- * the graph never dictates the initial state.
7501
+ * `value` in the set; two states sharing the lowest value start in the
7502
+ * one whose name sorts first (#1202). `fromLinks` enforces this sort, so
7503
+ * link-order on the graph never dictates the initial state.
7180
7504
  */
7181
7505
  this._states = [];
7182
7506
  /** Transitions between states */
@@ -7542,7 +7866,9 @@ class SHACLFlow {
7542
7866
  stateUriToName.set(stateUri, stateName);
7543
7867
  // Get state value
7544
7868
  const valueLink = links.find(l => l.source === stateUri && l.predicate === "ad4m://stateValue");
7545
- const stateValue = valueLink ? Literal.fromUrl(valueLink.target).get() : 0;
7869
+ // Missing link: 0, as in Rust. Present link: the shared strict grammar
7870
+ // (`decodeStateValue`), NaN when it does not fit.
7871
+ const stateValue = valueLink ? decodeStateValue(valueLink.target) : 0;
7546
7872
  // Get per-state interpretation hint (optional). Same non-empty-string
7547
7873
  // guard as the flow-level hint.
7548
7874
  const hintLink = links.find(l => l.source === stateUri && l.predicate === "ad4m://interpretationHint");
@@ -7620,8 +7946,45 @@ class SHACLFlow {
7620
7946
  // was randomly one of the round-tripped states. Sort by `value` ascending
7621
7947
  // so the "initial state = states[0]" convention (used by
7622
7948
  // `FlowInstance.start`) survives a fromGraph round trip.
7949
+ //
7950
+ // This comparator must stay identical to the one in rust-executor's
7951
+ // `parse_flow_from_links` (`rust-executor/src/perspectives/shacl_parser.rs`):
7952
+ // both runtimes read `states[0]` as the genesis state, and a Rust-side
7953
+ // spawn, `derive_state` and `verify_receipt` all start from it. So must
7954
+ // its input: `decodeStateValue` above and Rust `decode_state_value` read
7955
+ // the `stateValue` literal with one grammar, so the same links decode to
7956
+ // the same numbers before this sort ever runs.
7957
+ //
7958
+ // - NaN sorts last. `decodeStateValue` returns NaN for every payload
7959
+ // outside its grammar (a literal `NaN`, an empty payload, `1abc`, …),
7960
+ // so NaN is the common case for a malformed definition; `a.value -
7961
+ // b.value` would then be NaN, which `Array.prototype.sort` treats as
7962
+ // "equal" in an engine-defined way that also scrambles the finite
7963
+ // states around it. A state whose ordering value is undecodable has
7964
+ // no claim to being first.
7965
+ // - Equal values break on state name, ascending by Unicode code point
7966
+ // (`compareCodePoints`), which is the order Rust's `String::cmp` gives
7967
+ // over UTF-8 bytes (#1202). Without this, `sort` is stable and a tie
7968
+ // kept link-discovery order, which differs between replicas: two
7969
+ // nodes loading the same definition could mint instances in
7970
+ // different initial states.
7623
7971
  // The `states` getter returns a defensive copy, so mutate `_states` directly.
7624
- flow._states.sort((a, b) => a.value - b.value);
7972
+ flow._states.sort((a, b) => {
7973
+ const aNaN = Number.isNaN(a.value);
7974
+ const bNaN = Number.isNaN(b.value);
7975
+ if (aNaN !== bNaN)
7976
+ return aNaN ? 1 : -1;
7977
+ if (!aNaN && a.value !== b.value)
7978
+ return a.value < b.value ? -1 : 1;
7979
+ return compareCodePoints(a.name, b.name);
7980
+ });
7981
+ if (flow._states.length > 1 &&
7982
+ !Number.isNaN(flow._states[0].value) &&
7983
+ flow._states[0].value === flow._states[1].value) {
7984
+ console.warn(`flow \`${flowUri}\`: states \`${flow._states[0].name}\` and \`${flow._states[1].name}\` ` +
7985
+ `tie on the lowest value ${flow._states[0].value}; ` +
7986
+ `\`${flow._states[0].name}\` is the initial state by name order (#1202)`);
7987
+ }
7625
7988
  // Find transitions
7626
7989
  const transitionLinks = links.filter(l => l.source === flowUri && l.predicate === "ad4m://hasTransition");
7627
7990
  for (const transitionLink of transitionLinks) {
@@ -7781,12 +8144,12 @@ SHACLFlow.STATE_AND_TRANSITION_PREDICATES = [
7781
8144
  "ad4m://transitionActions",
7782
8145
  ];
7783
8146
 
7784
- var __classPrivateFieldGet$6 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8147
+ var __classPrivateFieldGet$7 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
7785
8148
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
7786
8149
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
7787
8150
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
7788
8151
  };
7789
- var __classPrivateFieldSet$6 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8152
+ var __classPrivateFieldSet$7 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7790
8153
  if (kind === "m") throw new TypeError("Private method is not writable");
7791
8154
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
7792
8155
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
@@ -7833,67 +8196,67 @@ class QuerySubscriptionProxy {
7833
8196
  const open = className === undefined
7834
8197
  ? (signal) => client.subscribeQuery(uuid, query, { signal })
7835
8198
  : (signal) => client.modelSubscribe(uuid, className, query, { signal });
7836
- __classPrivateFieldSet$6(this, _QuerySubscriptionProxy_live, new LiveQuery(client, uuid, open, result => __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_deliver).call(this, result)), "f");
7837
- __classPrivateFieldSet$6(this, _QuerySubscriptionProxy_initialized, new Promise((resolve, reject) => {
7838
- __classPrivateFieldSet$6(this, _QuerySubscriptionProxy_initResolve, resolve, "f");
7839
- __classPrivateFieldSet$6(this, _QuerySubscriptionProxy_initReject, reject, "f");
8199
+ __classPrivateFieldSet$7(this, _QuerySubscriptionProxy_live, new LiveQuery(client, uuid, open, result => __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_deliver).call(this, result)), "f");
8200
+ __classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initialized, new Promise((resolve, reject) => {
8201
+ __classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initResolve, resolve, "f");
8202
+ __classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initReject, reject, "f");
7840
8203
  }), "f");
7841
8204
  // `subscribe()` throws the same error, so a caller who never reads
7842
8205
  // `initialized` must not get an unhandled rejection from it.
7843
- __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_initialized, "f").catch(() => { });
8206
+ __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_initialized, "f").catch(() => { });
7844
8207
  }
7845
8208
  /** Open the query; resolves with the first result delivered. */
7846
8209
  async subscribe() {
7847
8210
  try {
7848
- __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_deliver).call(this, await __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_live, "f").start());
8211
+ __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_deliver).call(this, await __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_live, "f").start());
7849
8212
  }
7850
8213
  catch (error) {
7851
- __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_initReject, "f")?.call(this, error);
7852
- __classPrivateFieldSet$6(this, _QuerySubscriptionProxy_initResolve, __classPrivateFieldSet$6(this, _QuerySubscriptionProxy_initReject, undefined, "f"), "f");
8214
+ __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_initReject, "f")?.call(this, error);
8215
+ __classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initResolve, __classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initReject, undefined, "f"), "f");
7853
8216
  throw error;
7854
8217
  }
7855
8218
  }
7856
8219
  /** The executor's id for this subscription. */
7857
8220
  get id() {
7858
- return __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_live, "f").id;
8221
+ return __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_live, "f").id;
7859
8222
  }
7860
8223
  /** Resolves once the first result has arrived. */
7861
8224
  get initialized() {
7862
- return __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_initialized, "f");
8225
+ return __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_initialized, "f");
7863
8226
  }
7864
8227
  /** The latest result. */
7865
8228
  get result() {
7866
- return __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_live, "f").result;
8229
+ return __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_live, "f").result;
7867
8230
  }
7868
8231
  /** Call `callback` with every later result. Returns a remover. */
7869
8232
  onResult(callback) {
7870
- __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_callbacks, "f").add(callback);
7871
- return () => __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_callbacks, "f").delete(callback);
8233
+ __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_callbacks, "f").add(callback);
8234
+ return () => __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_callbacks, "f").delete(callback);
7872
8235
  }
7873
8236
  /** Whether the query lost its subscription (a reconnect, a failed
7874
8237
  * resync), could not open it again yet and is retrying: `result` is then
7875
8238
  * not live. */
7876
8239
  get reopening() {
7877
- return __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_live, "f").reopening;
8240
+ return __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_live, "f").reopening;
7878
8241
  }
7879
8242
  /** Call `listener` on each failed re-open of the subscription and when a
7880
8243
  * re-open succeeds after one failed (see {@link LiveQueryStatus}).
7881
8244
  * Returns a remover. */
7882
8245
  onStatus(listener) {
7883
- return __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_live, "f").onStatus(listener);
8246
+ return __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_live, "f").onStatus(listener);
7884
8247
  }
7885
8248
  /** End the subscription on the executor and drop all callbacks. With
7886
8249
  * `cancelOpening`, a `subscribe()` still waiting on the executor is
7887
8250
  * cancelled too, and rejects. */
7888
8251
  dispose(options = {}) {
7889
- __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_live, "f").dispose(options);
7890
- __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_callbacks, "f").clear();
8252
+ __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_live, "f").dispose(options);
8253
+ __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_callbacks, "f").clear();
7891
8254
  }
7892
8255
  }
7893
8256
  _QuerySubscriptionProxy_live = new WeakMap(), _QuerySubscriptionProxy_callbacks = new WeakMap(), _QuerySubscriptionProxy_initialized = new WeakMap(), _QuerySubscriptionProxy_initResolve = new WeakMap(), _QuerySubscriptionProxy_initReject = new WeakMap(), _QuerySubscriptionProxy_instances = new WeakSet(), _QuerySubscriptionProxy_deliver = function _QuerySubscriptionProxy_deliver(result) {
7894
- __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_initResolve, "f")?.call(this, true);
7895
- __classPrivateFieldSet$6(this, _QuerySubscriptionProxy_initResolve, __classPrivateFieldSet$6(this, _QuerySubscriptionProxy_initReject, undefined, "f"), "f");
7896
- for (const callback of __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_callbacks, "f")) {
8257
+ __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_initResolve, "f")?.call(this, true);
8258
+ __classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initResolve, __classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initReject, undefined, "f"), "f");
8259
+ for (const callback of __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_callbacks, "f")) {
7897
8260
  try {
7898
8261
  callback(result);
7899
8262
  }
@@ -7943,7 +8306,7 @@ _QuerySubscriptionProxy_live = new WeakMap(), _QuerySubscriptionProxy_callbacks
7943
8306
  */
7944
8307
  class PerspectiveProxy {
7945
8308
  /** @internal Exposed for ModelQueryBuilder subscription management */
7946
- get client() { return __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f"); }
8309
+ get client() { return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f"); }
7947
8310
  /**
7948
8311
  * Creates a new PerspectiveProxy instance.
7949
8312
  * Note: Don't create this directly, use ad4m.perspective.add() instead.
@@ -7963,23 +8326,23 @@ class PerspectiveProxy {
7963
8326
  * Note: Don't create this directly, use ad4m.perspective.add() instead.
7964
8327
  */
7965
8328
  );
7966
- __classPrivateFieldSet$6(this, _PerspectiveProxy_handle, handle, "f");
7967
- __classPrivateFieldSet$6(this, _PerspectiveProxy_client, ad4m, "f");
7968
- this.uuid = __classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid;
7969
- this.name = __classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").name;
7970
- this.owners = __classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").owners;
7971
- this.sharedUrl = __classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").sharedUrl;
7972
- this.neighbourhood = __classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").neighbourhood;
7973
- this.state = __classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").state;
8329
+ __classPrivateFieldSet$7(this, _PerspectiveProxy_handle, handle, "f");
8330
+ __classPrivateFieldSet$7(this, _PerspectiveProxy_client, ad4m, "f");
8331
+ this.uuid = __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid;
8332
+ this.name = __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").name;
8333
+ this.owners = __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").owners;
8334
+ this.sharedUrl = __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").sharedUrl;
8335
+ this.neighbourhood = __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").neighbourhood;
8336
+ this.state = __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").state;
7974
8337
  }
7975
8338
  /** Update the proxy's internal handle and public fields in-place.
7976
8339
  * Keeps the same object reference so all holders see the update. */
7977
8340
  updateHandle(handle) {
7978
- if (handle.uuid !== __classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid) {
7979
- throw new Error(`PerspectiveProxy.updateHandle: UUID mismatch — proxy is bound to "${__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid}" but received handle with UUID "${handle.uuid}". ` +
8341
+ if (handle.uuid !== __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid) {
8342
+ throw new Error(`PerspectiveProxy.updateHandle: UUID mismatch — proxy is bound to "${__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid}" but received handle with UUID "${handle.uuid}". ` +
7980
8343
  `This would silently diverge from listeners registered under the original UUID.`);
7981
8344
  }
7982
- __classPrivateFieldSet$6(this, _PerspectiveProxy_handle, handle, "f");
8345
+ __classPrivateFieldSet$7(this, _PerspectiveProxy_handle, handle, "f");
7983
8346
  this.uuid = handle.uuid;
7984
8347
  this.name = handle.name;
7985
8348
  this.owners = handle.owners;
@@ -8060,8 +8423,8 @@ class PerspectiveProxy {
8060
8423
  * @param batchId - Optional batch ID to group this operation with others
8061
8424
  */
8062
8425
  async executeAction(actions, expression, parameters, batchId) {
8063
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").executeCommands(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify(actions), expression, JSON.stringify(parameters), batchId);
8064
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8426
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").executeCommands(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify(actions), expression, JSON.stringify(parameters), batchId);
8427
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8065
8428
  return result;
8066
8429
  }
8067
8430
  /**
@@ -8086,7 +8449,7 @@ class PerspectiveProxy {
8086
8449
  * ```
8087
8450
  */
8088
8451
  async get(query, options) {
8089
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").queryLinks(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, query, options);
8452
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").queryLinks(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, query, options);
8090
8453
  }
8091
8454
  /**
8092
8455
  * Runs generic LLM interpretation over a conversation transcript, turning it
@@ -8109,7 +8472,7 @@ class PerspectiveProxy {
8109
8472
  // sixth positional parameter would have made `undefined, undefined, { … }` the normal way
8110
8473
  // to ask for the only one of them most callers want.
8111
8474
  const { existingScope, mintScope, observe, ...callOptions } = options ?? {};
8112
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").runInterpretation(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, transcript, basePrefix, classes, existingScope, mintScope, observe, callOptions);
8475
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").runInterpretation(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, transcript, basePrefix, classes, existingScope, mintScope, observe, callOptions);
8113
8476
  }
8114
8477
  /**
8115
8478
  * Harness-dispatched interpretation pass over this perspective (design v3
@@ -8136,7 +8499,7 @@ class PerspectiveProxy {
8136
8499
  // `on('auto-processor-event')` to render the harness loop
8137
8500
  // live in a UI. Absent = fast headless path (no telemetry cost).
8138
8501
  observationId, emitDebugEvents, options) {
8139
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").runInterpretationWithHarness(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, transcript, basePrefix, maxToolCalls, classes, modelOverride, undefined, observationId, emitDebugEvents, options);
8502
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").runInterpretationWithHarness(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, transcript, basePrefix, maxToolCalls, classes, modelOverride, undefined, observationId, emitDebugEvents, options);
8140
8503
  }
8141
8504
  /**
8142
8505
  * Ask a model something about this perspective, or ask it to change something, with the
@@ -8149,7 +8512,7 @@ class PerspectiveProxy {
8149
8512
  * @param options `signal` / `timeoutMs` (default {@link LONG_TIMEOUT_MS})
8150
8513
  */
8151
8514
  async runAgent(messages, settings, options) {
8152
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").runAgent(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, messages, settings, options);
8515
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").runAgent(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, messages, settings, options);
8153
8516
  }
8154
8517
  /**
8155
8518
  * Register a neighbourhood auto-processor on this perspective. The executor
@@ -8158,7 +8521,7 @@ class PerspectiveProxy {
8158
8521
  * processor id. Subscribe to progress via `on('auto-processor-event')`.
8159
8522
  */
8160
8523
  async addAutoProcessor(config) {
8161
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").addAutoProcessor(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, config);
8524
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").addAutoProcessor(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, config);
8162
8525
  }
8163
8526
  /**
8164
8527
  * Stop an auto-processor by deleting its config.
@@ -8176,7 +8539,7 @@ class PerspectiveProxy {
8176
8539
  * one left off rather than re-reading every turn.
8177
8540
  */
8178
8541
  async removeAutoProcessor(processorId) {
8179
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").removeAutoProcessor(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, processorId);
8542
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").removeAutoProcessor(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, processorId);
8180
8543
  }
8181
8544
  /**
8182
8545
  * Pending interpretation overlays on this perspective — LLM suggestions the
@@ -8190,17 +8553,17 @@ class PerspectiveProxy {
8190
8553
  * Each caller gets its own copy of the array.
8191
8554
  */
8192
8555
  async interpretationOverlays() {
8193
- if (__classPrivateFieldGet$6(this, _PerspectiveProxy_overlaysInFlight, "f")) {
8194
- return [...(await __classPrivateFieldGet$6(this, _PerspectiveProxy_overlaysInFlight, "f"))];
8556
+ if (__classPrivateFieldGet$7(this, _PerspectiveProxy_overlaysInFlight, "f")) {
8557
+ return [...(await __classPrivateFieldGet$7(this, _PerspectiveProxy_overlaysInFlight, "f"))];
8195
8558
  }
8196
- const pending = __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").interpretationOverlays(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8197
- __classPrivateFieldSet$6(this, _PerspectiveProxy_overlaysInFlight, pending, "f");
8559
+ const pending = __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").interpretationOverlays(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8560
+ __classPrivateFieldSet$7(this, _PerspectiveProxy_overlaysInFlight, pending, "f");
8198
8561
  try {
8199
8562
  return [...(await pending)];
8200
8563
  }
8201
8564
  finally {
8202
- if (__classPrivateFieldGet$6(this, _PerspectiveProxy_overlaysInFlight, "f") === pending) {
8203
- __classPrivateFieldSet$6(this, _PerspectiveProxy_overlaysInFlight, null, "f");
8565
+ if (__classPrivateFieldGet$7(this, _PerspectiveProxy_overlaysInFlight, "f") === pending) {
8566
+ __classPrivateFieldSet$7(this, _PerspectiveProxy_overlaysInFlight, null, "f");
8204
8567
  }
8205
8568
  }
8206
8569
  }
@@ -8211,11 +8574,11 @@ class PerspectiveProxy {
8211
8574
  */
8212
8575
  async acceptInterpretation(base, property) {
8213
8576
  try {
8214
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").acceptInterpretation(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, base, property);
8577
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").acceptInterpretation(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, base, property);
8215
8578
  }
8216
8579
  finally {
8217
8580
  // A read already in flight may predate this write; later callers must not join it.
8218
- __classPrivateFieldSet$6(this, _PerspectiveProxy_overlaysInFlight, null, "f");
8581
+ __classPrivateFieldSet$7(this, _PerspectiveProxy_overlaysInFlight, null, "f");
8219
8582
  }
8220
8583
  }
8221
8584
  /**
@@ -8225,11 +8588,11 @@ class PerspectiveProxy {
8225
8588
  */
8226
8589
  async rejectInterpretation(base, property) {
8227
8590
  try {
8228
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").rejectInterpretation(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, base, property);
8591
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").rejectInterpretation(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, base, property);
8229
8592
  }
8230
8593
  finally {
8231
8594
  // A read already in flight may predate this write; later callers must not join it.
8232
- __classPrivateFieldSet$6(this, _PerspectiveProxy_overlaysInFlight, null, "f");
8595
+ __classPrivateFieldSet$7(this, _PerspectiveProxy_overlaysInFlight, null, "f");
8233
8596
  }
8234
8597
  }
8235
8598
  /**
@@ -8240,14 +8603,14 @@ class PerspectiveProxy {
8240
8603
  * for a non-terminal state is refused.
8241
8604
  */
8242
8605
  async proposeFlowTransition(instanceUri, toState, rationale, outputs) {
8243
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").proposeFlowTransition(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, instanceUri, toState, rationale, outputs);
8606
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").proposeFlowTransition(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, instanceUri, toState, rationale, outputs);
8244
8607
  }
8245
8608
  async acceptFlowProposal(proposalUri) {
8246
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").acceptFlowProposal(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, proposalUri);
8609
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").acceptFlowProposal(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, proposalUri);
8247
8610
  }
8248
8611
  /** Withdraw our own links from a proposal; resolves to how many went. */
8249
8612
  async rejectFlowProposal(proposalUri) {
8250
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").rejectFlowProposal(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, proposalUri);
8613
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").rejectFlowProposal(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, proposalUri);
8251
8614
  }
8252
8615
  /**
8253
8616
  * Re-decide a flow receipt under this perspective's own flow catalogue.
@@ -8255,7 +8618,7 @@ class PerspectiveProxy {
8255
8618
  * `outcome`, never on a boolean you derive from it.
8256
8619
  */
8257
8620
  async verifyFlowReceipt(receipt) {
8258
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").verifyFlowReceipt(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, receipt);
8621
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").verifyFlowReceipt(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, receipt);
8259
8622
  }
8260
8623
  /**
8261
8624
  * Which instances are, as they stand, valid outputs of `flow`?
@@ -8272,7 +8635,7 @@ class PerspectiveProxy {
8272
8635
  * "no valid outputs". The filter rejects the same way.
8273
8636
  */
8274
8637
  async flowValidOutputs(flow, state) {
8275
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").flowValidOutputs(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, flow, state);
8638
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").flowValidOutputs(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, flow, state);
8276
8639
  }
8277
8640
  /**
8278
8641
  * The state each flow instance is in, as **this agent's** executor last
@@ -8287,7 +8650,7 @@ class PerspectiveProxy {
8287
8650
  * `FlowInstance.findAll` / `start` call this for you.
8288
8651
  */
8289
8652
  async flowStates(instances) {
8290
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").flowStates(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, instances);
8653
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").flowStates(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, instances);
8291
8654
  }
8292
8655
  /**
8293
8656
  * The proposals of `instance` whose votes settled an edge, as this
@@ -8295,7 +8658,7 @@ class PerspectiveProxy {
8295
8658
  * Replaces the `resolvedAs` property proposals used to carry.
8296
8659
  */
8297
8660
  async flowFired(instance) {
8298
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").flowFired(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, instance);
8661
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").flowFired(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, instance);
8299
8662
  }
8300
8663
  /**
8301
8664
  * Called whenever a flow instance on this perspective changes state on
@@ -8316,7 +8679,7 @@ class PerspectiveProxy {
8316
8679
  }
8317
8680
  /** Mint and store the receipt for a completed flow run. */
8318
8681
  async mintFlowReceipt(instanceUri) {
8319
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").mintFlowReceipt(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, instanceUri);
8682
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").mintFlowReceipt(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, instanceUri);
8320
8683
  }
8321
8684
  /**
8322
8685
  * Executes a Prolog query against the perspective's knowledge base.
@@ -8342,7 +8705,7 @@ class PerspectiveProxy {
8342
8705
  * ```
8343
8706
  */
8344
8707
  async infer(query, options) {
8345
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").queryProlog(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, query, options);
8708
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").queryProlog(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, query, options);
8346
8709
  }
8347
8710
  /**
8348
8711
  * Executes a SPARQL query against the perspective's link cache.
@@ -8367,11 +8730,11 @@ class PerspectiveProxy {
8367
8730
  * @returns Query results as parsed JSON
8368
8731
  */
8369
8732
  async querySparql(query, options) {
8370
- const cached = getCachedResult(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, query);
8733
+ const cached = getCachedResult(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, query);
8371
8734
  if (cached !== undefined)
8372
8735
  return cached;
8373
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").querySparql(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, query, options);
8374
- setCachedResult(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, query, result);
8736
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").querySparql(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, query, options);
8737
+ setCachedResult(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, query, result);
8375
8738
  return result;
8376
8739
  }
8377
8740
  /**
@@ -8388,7 +8751,7 @@ class PerspectiveProxy {
8388
8751
  * @returns Object with `instances` array and `totalCount`
8389
8752
  */
8390
8753
  async modelQuery(className, queryJson, options) {
8391
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").modelQuery(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, className, queryJson, options);
8754
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").modelQuery(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, className, queryJson, options);
8392
8755
  }
8393
8756
  /** Resolve each URI to the names of every subject class it is an instance of.
8394
8757
  *
@@ -8423,7 +8786,7 @@ class PerspectiveProxy {
8423
8786
  async subjectClassesOf(uris) {
8424
8787
  if (uris.length === 0)
8425
8788
  return {};
8426
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").subjectClassesOf(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, uris);
8789
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").subjectClassesOf(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, uris);
8427
8790
  }
8428
8791
  /**
8429
8792
  * Evaluate property getters for a batch of instances in a single RPC call.
@@ -8438,7 +8801,7 @@ class PerspectiveProxy {
8438
8801
  * @returns Map of instance ID → evaluated property values
8439
8802
  */
8440
8803
  async evaluateGetters(className, instanceIds, propertyNames) {
8441
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").evaluateGetters(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, className, instanceIds, propertyNames);
8804
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").evaluateGetters(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, className, instanceIds, propertyNames);
8442
8805
  }
8443
8806
  /**
8444
8807
  * Open a live model query on the executor. Later changes arrive as
@@ -8451,7 +8814,7 @@ class PerspectiveProxy {
8451
8814
  * @returns `subscriptionId`, initial `result` and `revision` (0)
8452
8815
  */
8453
8816
  async modelSubscribe(className, queryJson) {
8454
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").modelSubscribe(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, className, queryJson);
8817
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").modelSubscribe(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, className, queryJson);
8455
8818
  }
8456
8819
  /**
8457
8820
  * Adds a new link to the perspective.
@@ -8479,8 +8842,8 @@ class PerspectiveProxy {
8479
8842
  * ```
8480
8843
  */
8481
8844
  async add(link, status = 'shared', batchId) {
8482
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").addLink(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, link, status, batchId);
8483
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8845
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").addLink(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, link, status, batchId);
8846
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8484
8847
  return result;
8485
8848
  }
8486
8849
  /**
@@ -8493,8 +8856,8 @@ class PerspectiveProxy {
8493
8856
  * @returns Array of created LinkExpressions
8494
8857
  */
8495
8858
  async addLinks(links, status = 'shared', batchId) {
8496
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").addLinks(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, links, status, batchId);
8497
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8859
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").addLinks(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, links, status, batchId);
8860
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8498
8861
  return result;
8499
8862
  }
8500
8863
  /**
@@ -8505,8 +8868,8 @@ class PerspectiveProxy {
8505
8868
  * @returns Array of removed LinkExpressions
8506
8869
  */
8507
8870
  async removeLinks(links, batchId) {
8508
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").removeLinks(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, links, batchId);
8509
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8871
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").removeLinks(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, links, batchId);
8872
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8510
8873
  return result;
8511
8874
  }
8512
8875
  /**
@@ -8518,8 +8881,8 @@ class PerspectiveProxy {
8518
8881
  * @returns Object containing results of the mutations
8519
8882
  */
8520
8883
  async linkMutations(mutations, status = 'shared') {
8521
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").linkMutations(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, mutations, status);
8522
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8884
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").linkMutations(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, mutations, status);
8885
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8523
8886
  return result;
8524
8887
  }
8525
8888
  /**
@@ -8537,7 +8900,7 @@ class PerspectiveProxy {
8537
8900
  * @returns The added LinkExpression
8538
8901
  */
8539
8902
  async addLinkExpression(link, status = 'shared', batchId) {
8540
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").addLinkExpression(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, link, status, batchId);
8903
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").addLinkExpression(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, link, status, batchId);
8541
8904
  }
8542
8905
  /**
8543
8906
  * Updates an existing link with new data.
@@ -8547,8 +8910,8 @@ class PerspectiveProxy {
8547
8910
  * @param batchId - Optional batch ID to group this operation with others
8548
8911
  */
8549
8912
  async update(oldLink, newLink, batchId) {
8550
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").updateLink(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, oldLink, newLink, batchId);
8551
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8913
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").updateLink(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, oldLink, newLink, batchId);
8914
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8552
8915
  return result;
8553
8916
  }
8554
8917
  /**
@@ -8595,18 +8958,18 @@ class PerspectiveProxy {
8595
8958
  else {
8596
8959
  resolvedLink = link;
8597
8960
  }
8598
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").removeLink(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, resolvedLink, batchId);
8599
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8961
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").removeLink(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, resolvedLink, batchId);
8962
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8600
8963
  return result;
8601
8964
  }
8602
8965
  /** Creates a new batch for grouping operations */
8603
8966
  async createBatch() {
8604
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").createBatch(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8967
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").createBatch(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8605
8968
  }
8606
8969
  /** Commits a batch of operations */
8607
8970
  async commitBatch(batchId) {
8608
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").commitBatch(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, batchId);
8609
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8971
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").commitBatch(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, batchId);
8972
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8610
8973
  return result;
8611
8974
  }
8612
8975
  /**
@@ -8616,7 +8979,7 @@ class PerspectiveProxy {
8616
8979
  * @returns The rendered Expression
8617
8980
  */
8618
8981
  async getExpression(expressionURI) {
8619
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").getExpression(expressionURI);
8982
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getExpression(expressionURI);
8620
8983
  }
8621
8984
  /**
8622
8985
  * Creates a new Expression in the specified Language.
@@ -8626,7 +8989,7 @@ class PerspectiveProxy {
8626
8989
  * @returns URI of the created Expression
8627
8990
  */
8628
8991
  async createExpression(content, languageAddress) {
8629
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").createExpression(content, languageAddress);
8992
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").createExpression(content, languageAddress);
8630
8993
  }
8631
8994
  /**
8632
8995
  * Call `handler` with every `type` event about this perspective, until the
@@ -8642,18 +9005,18 @@ class PerspectiveProxy {
8642
9005
  on(type, handler) {
8643
9006
  // A registration of this proxy's own, so dispose() cannot release another proxy's
8644
9007
  // registration of the same function (on() treats equal handlers as one).
8645
- const release = __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").on(type, (event) => handler(event), { perspective: __classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid });
9008
+ const release = __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").on(type, (event) => handler(event), { perspective: __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid });
8646
9009
  const releaseOnce = () => {
8647
- if (__classPrivateFieldGet$6(this, _PerspectiveProxy_releases, "f").delete(releaseOnce))
9010
+ if (__classPrivateFieldGet$7(this, _PerspectiveProxy_releases, "f").delete(releaseOnce))
8648
9011
  release();
8649
9012
  };
8650
- __classPrivateFieldGet$6(this, _PerspectiveProxy_releases, "f").add(releaseOnce);
9013
+ __classPrivateFieldGet$7(this, _PerspectiveProxy_releases, "f").add(releaseOnce);
8651
9014
  return releaseOnce;
8652
9015
  }
8653
9016
  /** Removes every handler this proxy registered. Other proxies for the same
8654
9017
  * perspective keep theirs. */
8655
9018
  dispose() {
8656
- for (const release of [...__classPrivateFieldGet$6(this, _PerspectiveProxy_releases, "f")])
9019
+ for (const release of [...__classPrivateFieldGet$7(this, _PerspectiveProxy_releases, "f")])
8657
9020
  release();
8658
9021
  }
8659
9022
  /**
@@ -8663,7 +9026,7 @@ class PerspectiveProxy {
8663
9026
  * @returns Perspective object containing all links
8664
9027
  */
8665
9028
  async snapshot() {
8666
- return __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").snapshotByUUID(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
9029
+ return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").snapshotByUUID(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8667
9030
  }
8668
9031
  /**
8669
9032
  * Loads a perspective snapshot, replacing current content.
@@ -8867,14 +9230,14 @@ class PerspectiveProxy {
8867
9230
  * await perspective.addSdna('Recipe', prologCode, 'subject_class');
8868
9231
  */
8869
9232
  async addSdna(name, sdnaCode, sdnaType, shaclJson) {
8870
- return __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").addSdna(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, name, sdnaCode, sdnaType, shaclJson);
9233
+ return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").addSdna(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, name, sdnaCode, sdnaType, shaclJson);
8871
9234
  }
8872
9235
  /**
8873
9236
  * Batch variant of addSdna — registers multiple SDNA entries in a single RPC call.
8874
9237
  * Acquires the Rust-side mutex once for the entire batch.
8875
9238
  */
8876
9239
  async addSdnaAll(entries) {
8877
- return __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").addSdnaBatch(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, entries);
9240
+ return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").addSdnaBatch(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, entries);
8878
9241
  }
8879
9242
  /**
8880
9243
  * Batch-registers multiple model classes as SHACL subject classes in a single RPC call.
@@ -8887,7 +9250,7 @@ class PerspectiveProxy {
8887
9250
  if (Object.prototype.hasOwnProperty.call(jsClass, 'builtinUri'))
8888
9251
  continue;
8889
9252
  const className = jsClass.className || jsClass.prototype?.className || jsClass.name;
8890
- if (__classPrivateFieldGet$6(this, _PerspectiveProxy_ensuredSubjectClasses, "f").has(className))
9253
+ if (__classPrivateFieldGet$7(this, _PerspectiveProxy_ensuredSubjectClasses, "f").has(className))
8891
9254
  continue;
8892
9255
  if (!jsClass.generateSHACL) {
8893
9256
  throw new Error(`Class ${jsClass.name} must have generateSHACL(). Use @Model decorator.`);
@@ -8903,7 +9266,7 @@ class PerspectiveProxy {
8903
9266
  return;
8904
9267
  await this.addSdnaAll(entries);
8905
9268
  for (const entry of entries) {
8906
- __classPrivateFieldGet$6(this, _PerspectiveProxy_ensuredSubjectClasses, "f").add(entry.name);
9269
+ __classPrivateFieldGet$7(this, _PerspectiveProxy_ensuredSubjectClasses, "f").add(entry.name);
8907
9270
  }
8908
9271
  }
8909
9272
  /**
@@ -8943,7 +9306,7 @@ class PerspectiveProxy {
8943
9306
  * in-process and returns link triples for client-side reconstruction.
8944
9307
  */
8945
9308
  async getShacl(name) {
8946
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").getShacl(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, name);
9309
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getShacl(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, name);
8947
9310
  if (!result)
8948
9311
  return null;
8949
9312
  return SHACLShape.fromLinks(result.links, result.shapeUri);
@@ -8952,7 +9315,7 @@ class PerspectiveProxy {
8952
9315
  * List the names of every SHACL shape stored in this Perspective (one RPC call).
8953
9316
  */
8954
9317
  async getShaclNames() {
8955
- return __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").getShaclNames(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
9318
+ return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getShaclNames(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8956
9319
  }
8957
9320
  /**
8958
9321
  * Resolve a shape's `sh:targetClass` by name (one RPC call).
@@ -8963,7 +9326,7 @@ class PerspectiveProxy {
8963
9326
  * so this method is a pure passthrough.
8964
9327
  */
8965
9328
  async getShaclTargetClass(name) {
8966
- return __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").getShaclTargetClass(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, name);
9329
+ return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getShaclTargetClass(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, name);
8967
9330
  }
8968
9331
  /**
8969
9332
  * Get all SHACL shapes stored in this Perspective (one RPC call).
@@ -8972,7 +9335,7 @@ class PerspectiveProxy {
8972
9335
  * does not hide the others.
8973
9336
  */
8974
9337
  async getAllShacl() {
8975
- const entries = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").getAllShacl(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
9338
+ const entries = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getAllShacl(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8976
9339
  const shapes = [];
8977
9340
  for (const { name, shapeUri, links } of entries) {
8978
9341
  try {
@@ -9183,7 +9546,7 @@ class PerspectiveProxy {
9183
9546
  let className;
9184
9547
  if (typeof subjectClass === "string") {
9185
9548
  className = subjectClass;
9186
- await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").createSubject(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({
9549
+ await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").createSubject(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({
9187
9550
  className,
9188
9551
  initialValues
9189
9552
  }), exprAddr, initialValues ? JSON.stringify(initialValues) : undefined, batchId);
@@ -9195,7 +9558,7 @@ class PerspectiveProxy {
9195
9558
  if (!resolvedClassName) {
9196
9559
  throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");
9197
9560
  }
9198
- await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").createSubject(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({
9561
+ await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").createSubject(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({
9199
9562
  className: resolvedClassName,
9200
9563
  initialValues
9201
9564
  }), exprAddr, initialValues ? JSON.stringify(initialValues) : undefined, batchId);
@@ -9212,12 +9575,12 @@ class PerspectiveProxy {
9212
9575
  * abstract class (#1435), each value is written by every class of the
9213
9576
  * record that the abstract class reads, under its own name. */
9214
9577
  async updateSubject(className, exprAddr, values, batchId) {
9215
- await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").updateSubject(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, className, exprAddr, JSON.stringify(values), batchId);
9216
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
9578
+ await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").updateSubject(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, className, exprAddr, JSON.stringify(values), batchId);
9579
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
9217
9580
  }
9218
9581
  async getSubjectData(subjectClass, exprAddr) {
9219
9582
  if (typeof subjectClass === "string") {
9220
- return JSON.parse(await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").getSubjectData(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({ className: subjectClass }), exprAddr));
9583
+ return JSON.parse(await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getSubjectData(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({ className: subjectClass }), exprAddr));
9221
9584
  }
9222
9585
  const obj = subjectClass;
9223
9586
  const resolvedClassName = obj.className || obj.constructor?.className || obj.constructor?.prototype?.className
@@ -9225,7 +9588,7 @@ class PerspectiveProxy {
9225
9588
  if (!resolvedClassName) {
9226
9589
  throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");
9227
9590
  }
9228
- return JSON.parse(await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").getSubjectData(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({ className: resolvedClassName }), exprAddr));
9591
+ return JSON.parse(await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getSubjectData(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({ className: resolvedClassName }), exprAddr));
9229
9592
  }
9230
9593
  /**
9231
9594
  * Gets actions from SHACL links for a given predicate (e.g., ad4m://constructor, ad4m://destructor).
@@ -9276,8 +9639,8 @@ class PerspectiveProxy {
9276
9639
  // so it has no marker: the executor dispatches it by its URI.
9277
9640
  const ctor = subjectClass?.constructor;
9278
9641
  if (typeof subjectClass === "object" && ctor && Object.prototype.hasOwnProperty.call(ctor, 'builtinUri')) {
9279
- await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").removeSubject(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, ctor.builtinUri, exprAddr, batchId);
9280
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
9642
+ await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").removeSubject(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, ctor.builtinUri, exprAddr, batchId);
9643
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
9281
9644
  return;
9282
9645
  }
9283
9646
  let className = await this.stringOrTemplateObjectToSubjectClassName(subjectClass);
@@ -9286,8 +9649,8 @@ class PerspectiveProxy {
9286
9649
  const shapePattern = new RegExp(`[/:#]${this.escapeRegExp(className)}Shape$`);
9287
9650
  const markers = await this.get(new LinkQuery({ predicate: "ad4m://abstract" }));
9288
9651
  if (markers.some((link) => shapePattern.test(link.data.source))) {
9289
- await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").removeSubject(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, className, exprAddr, batchId);
9290
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
9652
+ await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").removeSubject(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, className, exprAddr, batchId);
9653
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
9291
9654
  return;
9292
9655
  }
9293
9656
  // Get destructor actions from SHACL links (Prolog-free)
@@ -9609,7 +9972,7 @@ class PerspectiveProxy {
9609
9972
  // Get the class name from the JS class
9610
9973
  const className = jsClass.className || jsClass.prototype?.className || jsClass.name;
9611
9974
  // Skip if already registered for this perspective instance
9612
- if (__classPrivateFieldGet$6(this, _PerspectiveProxy_ensuredSubjectClasses, "f").has(className))
9975
+ if (__classPrivateFieldGet$7(this, _PerspectiveProxy_ensuredSubjectClasses, "f").has(className))
9613
9976
  return;
9614
9977
  // Note: Duplicate checking is handled on the Rust side in add_sdna
9615
9978
  // Generate SHACL SDNA (Prolog-free)
@@ -9624,13 +9987,13 @@ class PerspectiveProxy {
9624
9987
  // Backend stores SHACL links directly
9625
9988
  await this.addSdna(className, '', 'subject_class', shaclJson);
9626
9989
  // Mark as registered for this perspective instance
9627
- __classPrivateFieldGet$6(this, _PerspectiveProxy_ensuredSubjectClasses, "f").add(className);
9990
+ __classPrivateFieldGet$7(this, _PerspectiveProxy_ensuredSubjectClasses, "f").add(className);
9628
9991
  }
9629
9992
  /** Clear the per-instance ensured subject class cache.
9630
9993
  * Call this after wiping a perspective's links so that
9631
9994
  * subsequent register() calls re-add SHACL definitions. */
9632
9995
  clearEnsuredSubjectClasses() {
9633
- __classPrivateFieldGet$6(this, _PerspectiveProxy_ensuredSubjectClasses, "f").clear();
9996
+ __classPrivateFieldGet$7(this, _PerspectiveProxy_ensuredSubjectClasses, "f").clear();
9634
9997
  }
9635
9998
  /**
9636
9999
  * Returns a list of all class names that have been registered as SHACL
@@ -9805,7 +10168,7 @@ class PerspectiveProxy {
9805
10168
  }));
9806
10169
  }
9807
10170
  getNeighbourhoodProxy() {
9808
- return __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").getNeighbourhoodProxy(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
10171
+ return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getNeighbourhoodProxy(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
9809
10172
  }
9810
10173
  /**
9811
10174
  * Returns a proxy object for working with AI capabilities.
@@ -9822,13 +10185,13 @@ class PerspectiveProxy {
9822
10185
  * ```
9823
10186
  */
9824
10187
  get ai() {
9825
- return __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").aiClient;
10188
+ return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").aiClient;
9826
10189
  }
9827
10190
  /** Live SPARQL query: resolves once the first result is in.
9828
10191
  * Call `dispose()` on the returned proxy when done. The executor
9829
10192
  * refuses a Prolog query (400): Prolog live queries are not supported. */
9830
10193
  async subscribeQuery(query) {
9831
- const subscription = new QuerySubscriptionProxy(this.uuid, query, __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f"));
10194
+ const subscription = new QuerySubscriptionProxy(this.uuid, query, __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f"));
9832
10195
  try {
9833
10196
  await subscription.subscribe();
9834
10197
  }
@@ -9843,13 +10206,13 @@ class PerspectiveProxy {
9843
10206
  }
9844
10207
  _PerspectiveProxy_handle = new WeakMap(), _PerspectiveProxy_client = new WeakMap(), _PerspectiveProxy_releases = new WeakMap(), _PerspectiveProxy_ensuredSubjectClasses = new WeakMap(), _PerspectiveProxy_overlaysInFlight = new WeakMap();
9845
10208
 
9846
- var __classPrivateFieldSet$5 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10209
+ var __classPrivateFieldSet$6 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
9847
10210
  if (kind === "m") throw new TypeError("Private method is not writable");
9848
10211
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9849
10212
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
9850
10213
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
9851
10214
  };
9852
- var __classPrivateFieldGet$5 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10215
+ var __classPrivateFieldGet$6 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9853
10216
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9854
10217
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
9855
10218
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -9865,27 +10228,27 @@ class PerspectiveClient {
9865
10228
  _PerspectiveClient_expressionClient.set(this, void 0);
9866
10229
  _PerspectiveClient_neighbourhoodClient.set(this, void 0);
9867
10230
  _PerspectiveClient_aiClient.set(this, void 0);
9868
- __classPrivateFieldSet$5(this, _PerspectiveClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
10231
+ __classPrivateFieldSet$6(this, _PerspectiveClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
9869
10232
  }
9870
10233
  setExpressionClient(client) {
9871
- __classPrivateFieldSet$5(this, _PerspectiveClient_expressionClient, client, "f");
10234
+ __classPrivateFieldSet$6(this, _PerspectiveClient_expressionClient, client, "f");
9872
10235
  }
9873
10236
  setNeighbourhoodClient(client) {
9874
- __classPrivateFieldSet$5(this, _PerspectiveClient_neighbourhoodClient, client, "f");
10237
+ __classPrivateFieldSet$6(this, _PerspectiveClient_neighbourhoodClient, client, "f");
9875
10238
  }
9876
10239
  setAIClient(client) {
9877
- __classPrivateFieldSet$5(this, _PerspectiveClient_aiClient, client, "f");
10240
+ __classPrivateFieldSet$6(this, _PerspectiveClient_aiClient, client, "f");
9878
10241
  }
9879
10242
  get aiClient() {
9880
- return __classPrivateFieldGet$5(this, _PerspectiveClient_aiClient, "f");
10243
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_aiClient, "f");
9881
10244
  }
9882
10245
  async all() {
9883
- const perspectives = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.all', {});
10246
+ const perspectives = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.all', {});
9884
10247
  return perspectives.map(handle => new PerspectiveProxy(PerspectiveHandle.fromWire(handle), this));
9885
10248
  }
9886
10249
  async byUUID(uuid) {
9887
10250
  try {
9888
- const perspective = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.get', { uuid });
10251
+ const perspective = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.get', { uuid });
9889
10252
  if (!perspective)
9890
10253
  return null;
9891
10254
  return new PerspectiveProxy(PerspectiveHandle.fromWire(perspective), this);
@@ -9897,11 +10260,11 @@ class PerspectiveClient {
9897
10260
  }
9898
10261
  }
9899
10262
  async snapshotByUUID(uuid) {
9900
- const snapshot = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.snapshot', { uuid });
10263
+ const snapshot = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.snapshot', { uuid });
9901
10264
  return snapshot ? new Perspective(snapshot.links.map(LinkExpression.fromWire)) : null;
9902
10265
  }
9903
10266
  async publishSnapshotByUUID(uuid) {
9904
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.publishSnapshot', { uuid });
10267
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.publishSnapshot', { uuid });
9905
10268
  }
9906
10269
  async queryLinks(uuid, query, options) {
9907
10270
  const params = { uuid };
@@ -9917,45 +10280,45 @@ class PerspectiveClient {
9917
10280
  params.untilDate = query.untilDate instanceof Date ? query.untilDate.toISOString() : String(query.untilDate);
9918
10281
  if (query.limit !== undefined)
9919
10282
  params.limit = query.limit;
9920
- const links = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.queryLinks', params, options);
10283
+ const links = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.queryLinks', params, options);
9921
10284
  return links.map(LinkExpression.fromWire);
9922
10285
  }
9923
10286
  async queryProlog(uuid, query, options) {
9924
- const result = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.queryProlog', { uuid, query }, options);
10287
+ const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.queryProlog', { uuid, query }, options);
9925
10288
  return JSON.parse(result);
9926
10289
  }
9927
10290
  async querySparql(uuid, query, options) {
9928
- const result = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.querySparql', { uuid, engine: 'sparql', query }, options);
10291
+ const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.querySparql', { uuid, engine: 'sparql', query }, options);
9929
10292
  return JSON.parse(result);
9930
10293
  }
9931
10294
  /** Open a live SPARQL query. Updates arrive through {@link onQueryUpdate}. */
9932
10295
  /** `options.signal` cancels the call, and the executor stops computing the first result. */
9933
10296
  async subscribeQuery(uuid, query, options) {
9934
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.subscribeQuery', { uuid, query }, options);
10297
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.subscribeQuery', { uuid, query }, options);
9935
10298
  }
9936
10299
  /** Every `query-subscription-update` event on this client's socket. */
9937
10300
  onQueryUpdate(cb) {
9938
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").on('query-subscription-update', cb);
10301
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").on('query-subscription-update', cb);
9939
10302
  }
9940
10303
  /** The current result and revision of a live query, after a revision gap. */
9941
10304
  async resyncSubscription(uuid, subscriptionId) {
9942
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.resyncSubscription', { uuid, subscriptionId });
10305
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.resyncSubscription', { uuid, subscriptionId });
9943
10306
  }
9944
10307
  /** Ends the subscription on the executor. The caller releases its local listener
9945
10308
  * with the function {@link onQueryUpdate} returned. */
9946
10309
  async disposeQuerySubscription(uuid, subscriptionId) {
9947
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.disposeQuery', { uuid, subscriptionId });
10310
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.disposeQuery', { uuid, subscriptionId });
9948
10311
  }
9949
10312
  /** `className` may name several classes: one query over their union (#1238). */
9950
10313
  async modelQuery(uuid, className, queryJson, options) {
9951
- const resultJson = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.modelQuery', { uuid, ...classParams(className), query_json: queryJson }, options);
10314
+ const resultJson = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.modelQuery', { uuid, ...classParams(className), query_json: queryJson }, options);
9952
10315
  return JSON.parse(resultJson);
9953
10316
  }
9954
10317
  async subjectClassesOf(uuid, uris) {
9955
- return await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.subjectClassesOf', { uuid, uris });
10318
+ return await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.subjectClassesOf', { uuid, uris });
9956
10319
  }
9957
10320
  async evaluateGetters(uuid, className, instanceIds, propertyNames) {
9958
- const resultJson = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.evaluateGetters', {
10321
+ const resultJson = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.evaluateGetters', {
9959
10322
  uuid,
9960
10323
  class_name: className,
9961
10324
  instance_ids: instanceIds,
@@ -9966,34 +10329,34 @@ class PerspectiveClient {
9966
10329
  /** Open a live model query over one class or several. Updates arrive through {@link onQueryUpdate}. */
9967
10330
  /** `options.signal` cancels the call, and the executor stops computing the first result. */
9968
10331
  async modelSubscribe(uuid, className, queryJson, options) {
9969
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.modelSubscribe', { uuid, ...classParams(className), query_json: queryJson }, options);
10332
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.modelSubscribe', { uuid, ...classParams(className), query_json: queryJson }, options);
9970
10333
  }
9971
10334
  async add(name) {
9972
- const handle = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.create', { name });
10335
+ const handle = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.create', { name });
9973
10336
  return new PerspectiveProxy(PerspectiveHandle.fromWire(handle), this);
9974
10337
  }
9975
10338
  async update(uuid, name) {
9976
- const handle = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.update', { uuid, name });
10339
+ const handle = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.update', { uuid, name });
9977
10340
  return new PerspectiveProxy(PerspectiveHandle.fromWire(handle), this);
9978
10341
  }
9979
10342
  async remove(uuid) {
9980
- const result = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.remove', { uuid });
10343
+ const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.remove', { uuid });
9981
10344
  return { perspectiveRemove: result };
9982
10345
  }
9983
10346
  async addLink(uuid, link, status = 'shared', batchId) {
9984
- const added = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.addLink', { uuid, link, status, batchId });
10347
+ const added = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.addLink', { uuid, link, status, batchId });
9985
10348
  return LinkExpression.fromWire(added);
9986
10349
  }
9987
10350
  async addLinks(uuid, links, status = 'shared', batchId) {
9988
- const added = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.addLinks', { uuid, links, status, batchId });
10351
+ const added = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.addLinks', { uuid, links, status, batchId });
9989
10352
  return added.map(LinkExpression.fromWire);
9990
10353
  }
9991
10354
  async removeLinks(uuid, links, batchId) {
9992
- const removed = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.removeLinks', { uuid, links: links.map(linkExpressionInputToWire), batchId });
10355
+ const removed = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.removeLinks', { uuid, links: links.map(linkExpressionInputToWire), batchId });
9993
10356
  return removed.map(LinkExpression.fromWire);
9994
10357
  }
9995
10358
  async linkMutations(uuid, mutations, status) {
9996
- const diff = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.linkMutations', { uuid, mutations: linkMutationsToWire(mutations), status });
10359
+ const diff = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.linkMutations', { uuid, mutations: linkMutationsToWire(mutations), status });
9997
10360
  return LinkExpressionMutations.fromWire(diff);
9998
10361
  }
9999
10362
  /**
@@ -10013,7 +10376,7 @@ class PerspectiveClient {
10013
10376
  * are NOT re-parented — same rule as the watcher).
10014
10377
  */
10015
10378
  async runInterpretation(uuid, transcript, basePrefix, classes, existingScope, mintScope, observe, options) {
10016
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.runInterpretation', {
10379
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.runInterpretation', {
10017
10380
  uuid, transcript, basePrefix, classes, existingScope, mintScope,
10018
10381
  observationId: observe?.observationId,
10019
10382
  emitDebugEvents: observe?.emitDebugEvents,
@@ -10040,7 +10403,7 @@ class PerspectiveClient {
10040
10403
  // `emitDebugEvents` is a dead-letter without an observationId
10041
10404
  // (nothing to key against); the server gates on both.
10042
10405
  observationId, emitDebugEvents, options) {
10043
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.runInterpretationWithHarness', {
10406
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.runInterpretationWithHarness', {
10044
10407
  uuid,
10045
10408
  transcript,
10046
10409
  basePrefix,
@@ -10063,7 +10426,7 @@ class PerspectiveClient {
10063
10426
  * calls before it answers.
10064
10427
  */
10065
10428
  async runAgent(uuid, messages, settings, options) {
10066
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.runAgent', { uuid, messages, ...settings }, options);
10429
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.runAgent', { uuid, messages, ...settings }, options);
10067
10430
  }
10068
10431
  /**
10069
10432
  * Register a neighbourhood auto-processor on this perspective. The executor's
@@ -10074,15 +10437,15 @@ class PerspectiveClient {
10074
10437
  * Returns the processor id.
10075
10438
  */
10076
10439
  async addAutoProcessor(uuid, config) {
10077
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.addAutoProcessor', { ...config, uuid });
10440
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.addAutoProcessor', { ...config, uuid });
10078
10441
  }
10079
10442
  /** Delete an auto-processor's config. `false` when there was none to delete. */
10080
10443
  async removeAutoProcessor(uuid, processorId) {
10081
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.removeAutoProcessor', { uuid, processorId });
10444
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.removeAutoProcessor', { uuid, processorId });
10082
10445
  }
10083
10446
  /** Pending interpretation overlays (LLM suggestions awaiting human accept/reject). */
10084
10447
  async interpretationOverlays(uuid) {
10085
- const overlays = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.interpretationOverlays', { uuid });
10448
+ const overlays = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.interpretationOverlays', { uuid });
10086
10449
  return overlays.map(({ base, kind, run, inferred }) => ({
10087
10450
  base, run, inferred, kind: kind === 'create' ? 'create' : 'update',
10088
10451
  }));
@@ -10090,18 +10453,18 @@ class PerspectiveClient {
10090
10453
  /** Accept an overlay's suggestion(s): the LLM value becomes the real value and
10091
10454
  * the overlay is deleted. Omit `property` to accept the whole base. */
10092
10455
  async acceptInterpretation(uuid, base, property) {
10093
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.acceptInterpretation', { uuid, base, property });
10456
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.acceptInterpretation', { uuid, base, property });
10094
10457
  }
10095
10458
  /** Reject an overlay's suggestion(s). Omit `property` to reject the whole base
10096
10459
  * (a rejected `create` deletes the suggested instance). */
10097
10460
  async rejectInterpretation(uuid, base, property) {
10098
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.rejectInterpretation', { uuid, base, property });
10461
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.rejectInterpretation', { uuid, base, property });
10099
10462
  }
10100
10463
  async proposeFlowTransition(uuid, instanceUri, toState, rationale, outputs) {
10101
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.proposeFlowTransition', { uuid, instanceUri, toState, rationale, outputs });
10464
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.proposeFlowTransition', { uuid, instanceUri, toState, rationale, outputs });
10102
10465
  }
10103
10466
  async acceptFlowProposal(uuid, proposalUri) {
10104
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.acceptFlowProposal', { uuid, proposalUri });
10467
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.acceptFlowProposal', { uuid, proposalUri });
10105
10468
  }
10106
10469
  /**
10107
10470
  * Withdraw this agent's own links from a proposal. Resolves to how many
@@ -10109,69 +10472,69 @@ class PerspectiveClient {
10109
10472
  * proposal this agent opened.
10110
10473
  */
10111
10474
  async rejectFlowProposal(uuid, proposalUri) {
10112
- const result = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.rejectFlowProposal', { uuid, proposalUri });
10475
+ const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.rejectFlowProposal', { uuid, proposalUri });
10113
10476
  return result.retractedLinks;
10114
10477
  }
10115
10478
  /** Re-decide a flow receipt under this perspective's own flow catalogue. */
10116
10479
  async verifyFlowReceipt(uuid, receipt) {
10117
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.verifyFlowReceipt', { uuid, receipt });
10480
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.verifyFlowReceipt', { uuid, receipt });
10118
10481
  }
10119
10482
  /** The instances that are, as they stand, valid outputs of `flow`
10120
10483
  * (optionally: of runs settled into terminal state `state`). */
10121
10484
  async flowValidOutputs(uuid, flow, state) {
10122
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.flowValidOutputs', { uuid, flow, state });
10485
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.flowValidOutputs', { uuid, flow, state });
10123
10486
  }
10124
10487
  /** The calling agent's recorded state of each flow instance it has
10125
10488
  * derived, optionally narrowed to `instances`. */
10126
10489
  async flowStates(uuid, instances) {
10127
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.flowStates', { uuid, instances });
10490
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.flowStates', { uuid, instances });
10128
10491
  }
10129
10492
  /** The proposals of `instance` the calling agent's replica recorded as
10130
10493
  * fired, sorted. */
10131
10494
  async flowFired(uuid, instance) {
10132
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.flowFired', { uuid, instance });
10495
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.flowFired', { uuid, instance });
10133
10496
  }
10134
10497
  /** Mint and store the receipt for a completed flow run. Fails while the
10135
10498
  * run has not settled into a terminal state, and when an output's
10136
10499
  * content no longer matches what the quorum committed to. */
10137
10500
  async mintFlowReceipt(uuid, instanceUri) {
10138
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.mintFlowReceipt', { uuid, instanceUri });
10501
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.mintFlowReceipt', { uuid, instanceUri });
10139
10502
  }
10140
10503
  async addLinkExpression(uuid, link, status = 'shared', batchId) {
10141
- const added = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.addLinkExpression', { uuid, link: linkExpressionToWire(link), status, batchId });
10504
+ const added = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.addLinkExpression', { uuid, link: linkExpressionToWire(link), status, batchId });
10142
10505
  return LinkExpression.fromWire(added);
10143
10506
  }
10144
10507
  async updateLink(uuid, oldLink, newLink, batchId) {
10145
- const updated = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.updateLink', { uuid, oldLink: linkExpressionInputToWire(oldLink), newLink, batchId });
10508
+ const updated = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.updateLink', { uuid, oldLink: linkExpressionInputToWire(oldLink), newLink, batchId });
10146
10509
  return LinkExpression.fromWire(updated);
10147
10510
  }
10148
10511
  async removeLink(uuid, link, batchId) {
10149
10512
  const { status, ...wire } = linkExpressionInputToWire(link);
10150
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.removeLink', { uuid, link: wire, batchId });
10513
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.removeLink', { uuid, link: wire, batchId });
10151
10514
  }
10152
10515
  async addSdna(uuid, name, sdnaCode, sdnaType, shaclJson) {
10153
- const result = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.addSdna', { uuid, name, sdnaCode: sdnaCode || "", sdnaType, shaclJson });
10516
+ const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.addSdna', { uuid, name, sdnaCode: sdnaCode || "", sdnaType, shaclJson });
10154
10517
  return typeof result === 'boolean' ? result : result.every(Boolean);
10155
10518
  }
10156
10519
  async addSdnaBatch(uuid, entries) {
10157
- const result = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.addSdna', { uuid, entries: entries.map(e => ({ ...e, sdnaCode: e.sdnaCode || "" })) });
10520
+ const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.addSdna', { uuid, entries: entries.map(e => ({ ...e, sdnaCode: e.sdnaCode || "" })) });
10158
10521
  return typeof result === 'boolean' ? [result] : result;
10159
10522
  }
10160
10523
  async executeCommands(uuid, commands, expression, parameters, batchId) {
10161
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.executeCommands', { uuid, commands, expression, parameters, batchId });
10524
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.executeCommands', { uuid, commands, expression, parameters, batchId });
10162
10525
  }
10163
10526
  async createSubject(uuid, subjectClass, expressionAddress, initialValues, batchId) {
10164
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.createSubject', { uuid, subjectClass, expressionAddress, initialValues, batchId });
10527
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.createSubject', { uuid, subjectClass, expressionAddress, initialValues, batchId });
10165
10528
  }
10166
10529
  /** Through an abstract class (#1435), the executor writes to the record's own classes. */
10167
10530
  async updateSubject(uuid, subjectClass, expressionAddress, values, batchId) {
10168
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.updateSubject', { uuid, subjectClass, expressionAddress, values, batchId });
10531
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.updateSubject', { uuid, subjectClass, expressionAddress, values, batchId });
10169
10532
  }
10170
10533
  async removeSubject(uuid, subjectClass, expressionAddress, batchId) {
10171
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.removeSubject', { uuid, subjectClass, expressionAddress, batchId });
10534
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.removeSubject', { uuid, subjectClass, expressionAddress, batchId });
10172
10535
  }
10173
10536
  async getSubjectData(uuid, subjectClass, expressionAddress) {
10174
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.getSubjectData', { uuid, subjectClass, expressionAddress });
10537
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.getSubjectData', { uuid, subjectClass, expressionAddress });
10175
10538
  }
10176
10539
  // ── SHACL resolution (server-side) ─────────────────────────────────────────
10177
10540
  // These methods delegate shape resolution to the executor, which reads links
@@ -10179,7 +10542,7 @@ class PerspectiveClient {
10179
10542
  // `queryLinks` sequences the old PerspectiveProxy methods performed.
10180
10543
  /** List the names of every SHACL shape stored in a perspective (one RPC call). */
10181
10544
  async getShaclNames(uuid) {
10182
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.getShaclNames', { uuid });
10545
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.getShaclNames', { uuid });
10183
10546
  }
10184
10547
  /**
10185
10548
  * Resolve a shape's `sh:targetClass` by name (one RPC call).
@@ -10192,7 +10555,7 @@ class PerspectiveClient {
10192
10555
  * than pushing the null one layer further up. PR #935 review r3897752023.
10193
10556
  */
10194
10557
  async getShaclTargetClass(uuid, name) {
10195
- const result = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.getShaclTargetClass', { uuid, name });
10558
+ const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.getShaclTargetClass', { uuid, name });
10196
10559
  return result ?? undefined;
10197
10560
  }
10198
10561
  /**
@@ -10201,51 +10564,51 @@ class PerspectiveClient {
10201
10564
  * or `null` if no shape with that name exists.
10202
10565
  */
10203
10566
  async getShacl(uuid, name) {
10204
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.getShacl', { uuid, name });
10567
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.getShacl', { uuid, name });
10205
10568
  }
10206
10569
  /**
10207
10570
  * Retrieve all SHACL shapes in one call. Returns an array of
10208
10571
  * `{name, shapeUri, links}` — one entry per shape (one RPC call).
10209
10572
  */
10210
10573
  async getAllShacl(uuid) {
10211
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.getAllShacl', { uuid });
10574
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.getAllShacl', { uuid });
10212
10575
  }
10213
10576
  // ExpressionClient functions, needed for Subjects:
10214
10577
  async getExpression(expressionURI) {
10215
- return await __classPrivateFieldGet$5(this, _PerspectiveClient_expressionClient, "f").get(expressionURI);
10578
+ return await __classPrivateFieldGet$6(this, _PerspectiveClient_expressionClient, "f").get(expressionURI);
10216
10579
  }
10217
10580
  async createExpression(content, languageAddress) {
10218
- return await __classPrivateFieldGet$5(this, _PerspectiveClient_expressionClient, "f").create(content, languageAddress);
10581
+ return await __classPrivateFieldGet$6(this, _PerspectiveClient_expressionClient, "f").create(content, languageAddress);
10219
10582
  }
10220
10583
  /** The client's event bus; see {@link ApiClient.on}. */
10221
10584
  on(type, handler, filter) {
10222
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").on(type, handler, filter);
10585
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").on(type, handler, filter);
10223
10586
  }
10224
10587
  getNeighbourhoodProxy(uuid) {
10225
- return new NeighbourhoodProxy(__classPrivateFieldGet$5(this, _PerspectiveClient_neighbourhoodClient, "f"), uuid);
10588
+ return new NeighbourhoodProxy(__classPrivateFieldGet$6(this, _PerspectiveClient_neighbourhoodClient, "f"), uuid);
10226
10589
  }
10227
10590
  async createBatch(uuid) {
10228
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.createBatch', { uuid });
10591
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.createBatch', { uuid });
10229
10592
  }
10230
10593
  async commitBatch(uuid, batchId) {
10231
- const diff = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.commitBatch', { uuid, batchId });
10594
+ const diff = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.commitBatch', { uuid, batchId });
10232
10595
  return LinkExpressionMutations.fromWire(diff);
10233
10596
  }
10234
10597
  /** Register a callback that fires after a successful WebSocket reconnect.
10235
10598
  * Passes through to ApiClient.onReconnect(). Returns an unsubscribe function. */
10236
10599
  onReconnect(callback) {
10237
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").onReconnect(callback);
10600
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").onReconnect(callback);
10238
10601
  }
10239
10602
  }
10240
10603
  _PerspectiveClient_apiClient = new WeakMap(), _PerspectiveClient_expressionClient = new WeakMap(), _PerspectiveClient_neighbourhoodClient = new WeakMap(), _PerspectiveClient_aiClient = new WeakMap();
10241
10604
 
10242
- var __classPrivateFieldSet$4 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10605
+ var __classPrivateFieldSet$5 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10243
10606
  if (kind === "m") throw new TypeError("Private method is not writable");
10244
10607
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10245
10608
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10246
10609
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
10247
10610
  };
10248
- var __classPrivateFieldGet$4 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10611
+ var __classPrivateFieldGet$5 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10249
10612
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10250
10613
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10251
10614
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -10254,197 +10617,197 @@ var _RuntimeClient_apiClient;
10254
10617
  class RuntimeClient {
10255
10618
  constructor(baseUrl, token, sharedApiClient) {
10256
10619
  _RuntimeClient_apiClient.set(this, void 0);
10257
- __classPrivateFieldSet$4(this, _RuntimeClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
10620
+ __classPrivateFieldSet$5(this, _RuntimeClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
10258
10621
  }
10259
10622
  async info() {
10260
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.info', {});
10623
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.info', {});
10261
10624
  }
10262
10625
  async tlsDomain() {
10263
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.tlsDomain', {});
10626
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.tlsDomain', {});
10264
10627
  }
10265
10628
  async quit() {
10266
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.quit', {});
10629
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.quit', {});
10267
10630
  }
10268
10631
  async openLink(url) {
10269
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.openLink', { url });
10632
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.openLink', { url });
10270
10633
  }
10271
10634
  async addTrustedAgents(agents) {
10272
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('agent.addTrustedAgents', { agents });
10635
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('agent.addTrustedAgents', { agents });
10273
10636
  }
10274
10637
  async deleteTrustedAgents(agents) {
10275
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('agent.deleteTrustedAgents', { agents });
10638
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('agent.deleteTrustedAgents', { agents });
10276
10639
  }
10277
10640
  async getTrustedAgents() {
10278
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('agent.getTrustedAgents', {});
10641
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('agent.getTrustedAgents', {});
10279
10642
  }
10280
10643
  async addKnownLinkLanguageTemplates(addresses) {
10281
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.addLinkLanguageTemplates', { addresses });
10644
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.addLinkLanguageTemplates', { addresses });
10282
10645
  }
10283
10646
  async removeKnownLinkLanguageTemplates(addresses) {
10284
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.removeLinkLanguageTemplates', { addresses });
10647
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.removeLinkLanguageTemplates', { addresses });
10285
10648
  }
10286
10649
  /** Every link-language template the executor knows, with its meta (name, description,
10287
10650
  * `possibleTemplateParams`). A template whose meta cannot be read is left out. */
10288
10651
  async knownLinkLanguageTemplates() {
10289
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.linkLanguageTemplates', {});
10652
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.linkLanguageTemplates', {});
10290
10653
  }
10291
10654
  async addFriends(dids) {
10292
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.addFriends', { dids });
10655
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.addFriends', { dids });
10293
10656
  }
10294
10657
  async removeFriends(dids) {
10295
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.removeFriends', { dids });
10658
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.removeFriends', { dids });
10296
10659
  }
10297
10660
  async friends() {
10298
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.friends', {});
10661
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.friends', {});
10299
10662
  }
10300
10663
  async hcAgentInfos() {
10301
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.hcAgentInfos', {});
10664
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.hcAgentInfos', {});
10302
10665
  }
10303
10666
  async getNetworkMetrics() {
10304
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.networkMetrics', {});
10667
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.networkMetrics', {});
10305
10668
  }
10306
10669
  async restartHolochain(options) {
10307
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.restartHolochain', {}, options);
10670
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.restartHolochain', {}, options);
10308
10671
  }
10309
10672
  async hcAddAgentInfos(agentInfos) {
10310
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.addHcAgentInfos', { agentInfos });
10673
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.addHcAgentInfos', { agentInfos });
10311
10674
  }
10312
10675
  async verifyStringSignedByDid(did, didSigningKeyId, data, signedData) {
10313
10676
  // The executor resolves the key from the DID document; `didSigningKeyId` goes unused.
10314
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.verifySignature', { did, data, signedData });
10677
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.verifySignature', { did, data, signedData });
10315
10678
  }
10316
10679
  async setStatus(perspective) {
10317
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.setStatus', { status: Perspective.toWire(perspective) });
10680
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.setStatus', { status: Perspective.toWire(perspective) });
10318
10681
  }
10319
10682
  async friendStatus(did) {
10320
- const status = await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.friendStatus', { did });
10683
+ const status = await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.friendStatus', { did });
10321
10684
  return status ? PerspectiveExpression.fromWire(status) : null;
10322
10685
  }
10323
10686
  async friendSendMessage(did, message) {
10324
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.sendFriendMessage', { did, message: Perspective.toWire(message) });
10687
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.sendFriendMessage', { did, message: Perspective.toWire(message) });
10325
10688
  }
10326
10689
  async messageInbox() {
10327
- return (await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.inbox', {})).map(PerspectiveExpression.fromWire);
10690
+ return (await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.inbox', {})).map(PerspectiveExpression.fromWire);
10328
10691
  }
10329
10692
  async messageOutbox() {
10330
- const sent = await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.outbox', {});
10693
+ const sent = await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.outbox', {});
10331
10694
  return sent.map(({ recipient, message }) => ({ recipient, message: PerspectiveExpression.fromWire(message) }));
10332
10695
  }
10333
10696
  async requestInstallNotification(notification) {
10334
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.createNotification', { ...notification });
10697
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.createNotification', { ...notification });
10335
10698
  }
10336
10699
  async grantNotification(id) {
10337
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.grantNotification', { id, granted: true });
10700
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.grantNotification', { id, granted: true });
10338
10701
  }
10339
10702
  async exportDb(filePath) {
10340
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.exportData', { type: "db", filePath });
10703
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.exportData', { type: "db", filePath });
10341
10704
  }
10342
10705
  async importDb(filePath) {
10343
- const result = await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.importData', { type: "db", filePath });
10706
+ const result = await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.importData', { type: "db", filePath });
10344
10707
  if ('success' in result)
10345
10708
  throw new Error('runtime.importData answered a perspective import for type "db"');
10346
10709
  return result;
10347
10710
  }
10348
10711
  async notifications() {
10349
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.notifications', {});
10712
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.notifications', {});
10350
10713
  }
10351
10714
  async updateNotification(id, notification) {
10352
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.updateNotification', { ...notification, id });
10715
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.updateNotification', { ...notification, id });
10353
10716
  }
10354
10717
  async removeNotification(id) {
10355
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.deleteNotification', { id });
10718
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.deleteNotification', { id });
10356
10719
  }
10357
10720
  async exportPerspective(uuid, filePath) {
10358
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.exportData', { type: "perspective", perspectiveUuid: uuid, filePath });
10721
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.exportData', { type: "perspective", perspectiveUuid: uuid, filePath });
10359
10722
  }
10360
10723
  async importPerspective(filePath) {
10361
- const result = await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.importData', { type: "perspective", filePath });
10724
+ const result = await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.importData', { type: "perspective", filePath });
10362
10725
  return 'success' in result && result.success;
10363
10726
  }
10364
10727
  async multiUserEnabled() {
10365
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.multiUserEnabled', {});
10728
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.multiUserEnabled', {});
10366
10729
  }
10367
10730
  async setMultiUserEnabled(enabled) {
10368
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.setMultiUserEnabled', { enabled });
10731
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.setMultiUserEnabled', { enabled });
10369
10732
  }
10370
10733
  async freeHostingEnabled() {
10371
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.freeHostingEnabled', {});
10734
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.freeHostingEnabled', {});
10372
10735
  }
10373
10736
  async setFreeHostingEnabled(enabled) {
10374
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.setFreeHostingEnabled', { enabled });
10737
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.setFreeHostingEnabled', { enabled });
10375
10738
  }
10376
10739
  async listUsers() {
10377
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.list', {});
10740
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.list', {});
10378
10741
  }
10379
10742
  async userWalletAddress(email) {
10380
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.wallet', { email });
10743
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.wallet', { email });
10381
10744
  }
10382
10745
  async emailTestModeEnable() {
10383
- return (await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'enable' })) === true;
10746
+ return (await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'enable' })) === true;
10384
10747
  }
10385
10748
  async emailTestModeDisable() {
10386
- return (await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'disable' })) === true;
10749
+ return (await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'disable' })) === true;
10387
10750
  }
10388
10751
  async emailTestGetCode(email) {
10389
- const code = await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'get-code', email });
10752
+ const code = await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'get-code', email });
10390
10753
  return typeof code === 'string' ? code : null;
10391
10754
  }
10392
10755
  async emailTestClearCodes() {
10393
- return (await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'clear-codes' })) === true;
10756
+ return (await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'clear-codes' })) === true;
10394
10757
  }
10395
10758
  async emailTestSetExpiry(email, verificationType, expiresAt) {
10396
- return (await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'set-expiry', email, verificationType, expiresAt })) === true;
10759
+ return (await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'set-expiry', email, verificationType, expiresAt })) === true;
10397
10760
  }
10398
10761
  // ---- Unyt / mHOT methods ----
10399
10762
  async unytAgentKey() {
10400
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.unytAgentKey', {});
10763
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.unytAgentKey', {});
10401
10764
  }
10402
10765
  async unytHotAgentPubkey() {
10403
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.unytHotAgentPubkey', {});
10766
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.unytHotAgentPubkey', {});
10404
10767
  }
10405
10768
  async unytWalletBalance() {
10406
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.unytWalletBalance', {});
10769
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.unytWalletBalance', {});
10407
10770
  }
10408
10771
  async unytWalletHistory(page, perPage) {
10409
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.unytWalletHistory', { page, perPage });
10772
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.unytWalletHistory', { page, perPage });
10410
10773
  }
10411
10774
  /** Installed and bundled DNA versions, and why the last install failed (`installError`). */
10412
10775
  async unytVersionInfo() {
10413
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.unytVersionInfo', {});
10776
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.unytVersionInfo', {});
10414
10777
  }
10415
10778
  /** Stores the membrane proof (base64); the executor then installs the Unyt DNA in the
10416
10779
  * background. Poll {@link unytVersionInfo} for the outcome. */
10417
10780
  async setUnytMembraneProof(proof) {
10418
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.setUnytMembraneProof', { proof });
10781
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.setUnytMembraneProof', { proof });
10419
10782
  }
10420
10783
  async unytReinstallDna() {
10421
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.unytReinstallDna', {});
10784
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.unytReinstallDna', {});
10422
10785
  }
10423
10786
  async unytSendHot(recipient, amount) {
10424
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.unytSendHot', { recipient, amount });
10787
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.unytSendHot', { recipient, amount });
10425
10788
  }
10426
10789
  async setUserCredits(email, amount) {
10427
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.credits', { email, amount });
10790
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.credits', { email, amount });
10428
10791
  }
10429
10792
  async setUserFreeAccess(email, enabled) {
10430
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.freeAccess', { email, enabled });
10793
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.freeAccess', { email, enabled });
10431
10794
  }
10432
10795
  async setHostRates(rates) {
10433
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.setHostRates', { rates });
10796
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.setHostRates', { rates });
10434
10797
  }
10435
10798
  async hostRates() {
10436
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.hostRates', {});
10799
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.hostRates', {});
10437
10800
  }
10438
10801
  }
10439
10802
  _RuntimeClient_apiClient = new WeakMap();
10440
10803
 
10441
- var __classPrivateFieldSet$3 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10804
+ var __classPrivateFieldSet$4 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10442
10805
  if (kind === "m") throw new TypeError("Private method is not writable");
10443
10806
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10444
10807
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10445
10808
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
10446
10809
  };
10447
- var __classPrivateFieldGet$3 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10810
+ var __classPrivateFieldGet$4 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10448
10811
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10449
10812
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10450
10813
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -10460,8 +10823,8 @@ class ExpressionClient {
10460
10823
  _ExpressionClient_totalMemBytes.set(this, 0);
10461
10824
  // L2: persistent cache (IndexedDB in browser, NullCache in Node)
10462
10825
  _ExpressionClient_persistent.set(this, void 0);
10463
- __classPrivateFieldSet$3(this, _ExpressionClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
10464
- __classPrivateFieldSet$3(this, _ExpressionClient_persistent, createPersistentCache('ad4m-expression-cache', 'expressions'), "f");
10826
+ __classPrivateFieldSet$4(this, _ExpressionClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
10827
+ __classPrivateFieldSet$4(this, _ExpressionClient_persistent, createPersistentCache('ad4m-expression-cache', 'expressions'), "f");
10465
10828
  }
10466
10829
  async get(url, alwaysGet = false) {
10467
10830
  // Existing literal fast-path
@@ -10478,55 +10841,55 @@ class ExpressionClient {
10478
10841
  }
10479
10842
  // L1: memory hit
10480
10843
  if (!alwaysGet) {
10481
- const memHit = __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").get(url);
10844
+ const memHit = __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").get(url);
10482
10845
  if (memHit)
10483
10846
  return memHit.data;
10484
10847
  }
10485
10848
  // Deduplicate in-flight requests
10486
10849
  if (!alwaysGet) {
10487
- const existing = __classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").get(url);
10850
+ const existing = __classPrivateFieldGet$4(this, _ExpressionClient_inflight, "f").get(url);
10488
10851
  if (existing)
10489
10852
  return existing;
10490
10853
  }
10491
10854
  // L2 check + L3 network
10492
10855
  const promise = (async () => {
10493
10856
  if (!alwaysGet) {
10494
- const persisted = await __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").get(url);
10857
+ const persisted = await __classPrivateFieldGet$4(this, _ExpressionClient_persistent, "f").get(url);
10495
10858
  if (persisted) {
10496
- __classPrivateFieldGet$3(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, url, persisted); // promote to L1
10859
+ __classPrivateFieldGet$4(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, url, persisted); // promote to L1
10497
10860
  return persisted;
10498
10861
  }
10499
10862
  }
10500
10863
  // L3: network fetch
10501
- const result = await __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.get', { url });
10502
- __classPrivateFieldGet$3(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, url, result);
10503
- __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").put(url, result); // fire-and-forget write to L2
10864
+ const result = await __classPrivateFieldGet$4(this, _ExpressionClient_apiClient, "f").call('expression.get', { url });
10865
+ __classPrivateFieldGet$4(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, url, result);
10866
+ __classPrivateFieldGet$4(this, _ExpressionClient_persistent, "f").put(url, result); // fire-and-forget write to L2
10504
10867
  return result;
10505
10868
  })();
10506
- __classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").set(url, promise);
10869
+ __classPrivateFieldGet$4(this, _ExpressionClient_inflight, "f").set(url, promise);
10507
10870
  try {
10508
10871
  return await promise;
10509
10872
  }
10510
10873
  finally {
10511
- __classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").delete(url);
10874
+ __classPrivateFieldGet$4(this, _ExpressionClient_inflight, "f").delete(url);
10512
10875
  }
10513
10876
  }
10514
10877
  async getMany(urls) {
10515
10878
  // Check L1 first
10516
- const results = urls.map(u => __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").get(u)?.data ?? null);
10879
+ const results = urls.map(u => __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").get(u)?.data ?? null);
10517
10880
  let uncachedIndices = results
10518
10881
  .map((r, i) => r === null ? i : -1)
10519
10882
  .filter(i => i >= 0);
10520
10883
  if (uncachedIndices.length === 0)
10521
10884
  return results;
10522
10885
  // Check L2 for remaining misses
10523
- const l2Results = await Promise.all(uncachedIndices.map(i => __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").get(urls[i])));
10886
+ const l2Results = await Promise.all(uncachedIndices.map(i => __classPrivateFieldGet$4(this, _ExpressionClient_persistent, "f").get(urls[i])));
10524
10887
  const stillMissing = [];
10525
10888
  for (let j = 0; j < uncachedIndices.length; j++) {
10526
10889
  const idx = uncachedIndices[j];
10527
10890
  if (l2Results[j]) {
10528
10891
  results[idx] = l2Results[j];
10529
- __classPrivateFieldGet$3(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, urls[idx], l2Results[j]); // promote to L1
10892
+ __classPrivateFieldGet$4(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, urls[idx], l2Results[j]); // promote to L1
10530
10893
  }
10531
10894
  else {
10532
10895
  stillMissing.push(idx);
@@ -10536,13 +10899,13 @@ class ExpressionClient {
10536
10899
  return results;
10537
10900
  // L3: fetch only truly uncached URLs
10538
10901
  const uncachedUrls = stillMissing.map(i => urls[i]);
10539
- const fetched = await __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.getMany', { urls: uncachedUrls });
10902
+ const fetched = await __classPrivateFieldGet$4(this, _ExpressionClient_apiClient, "f").call('expression.getMany', { urls: uncachedUrls });
10540
10903
  for (let i = 0; i < stillMissing.length; i++) {
10541
10904
  const idx = stillMissing[i];
10542
10905
  results[idx] = fetched[i];
10543
10906
  if (fetched[i]) {
10544
- __classPrivateFieldGet$3(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, uncachedUrls[i], fetched[i]);
10545
- __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").put(uncachedUrls[i], fetched[i]); // fire-and-forget
10907
+ __classPrivateFieldGet$4(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, uncachedUrls[i], fetched[i]);
10908
+ __classPrivateFieldGet$4(this, _ExpressionClient_persistent, "f").put(uncachedUrls[i], fetched[i]); // fire-and-forget
10546
10909
  }
10547
10910
  }
10548
10911
  return results;
@@ -10551,44 +10914,44 @@ class ExpressionClient {
10551
10914
  * Clear both L1 (memory) and L2 (persistent) expression caches.
10552
10915
  */
10553
10916
  clearCache() {
10554
- __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").clear();
10555
- __classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").clear();
10556
- __classPrivateFieldSet$3(this, _ExpressionClient_totalMemBytes, 0, "f");
10557
- __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").clear(); // fire-and-forget
10917
+ __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").clear();
10918
+ __classPrivateFieldGet$4(this, _ExpressionClient_inflight, "f").clear();
10919
+ __classPrivateFieldSet$4(this, _ExpressionClient_totalMemBytes, 0, "f");
10920
+ __classPrivateFieldGet$4(this, _ExpressionClient_persistent, "f").clear(); // fire-and-forget
10558
10921
  }
10559
10922
  async getRaw(url) {
10560
- return __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.getRaw', { url });
10923
+ return __classPrivateFieldGet$4(this, _ExpressionClient_apiClient, "f").call('expression.getRaw', { url });
10561
10924
  }
10562
10925
  async create(content, languageAddress) {
10563
10926
  const serialized = JSON.stringify(content);
10564
- return __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.create', { content: serialized, languageAddress });
10927
+ return __classPrivateFieldGet$4(this, _ExpressionClient_apiClient, "f").call('expression.create', { content: serialized, languageAddress });
10565
10928
  }
10566
10929
  async interactions(url) {
10567
- return __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.interactions', { url });
10930
+ return __classPrivateFieldGet$4(this, _ExpressionClient_apiClient, "f").call('expression.interactions', { url });
10568
10931
  }
10569
10932
  async interact(url, interactionCall) {
10570
- const result = await __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.interact', { url, interactionCall });
10933
+ const result = await __classPrivateFieldGet$4(this, _ExpressionClient_apiClient, "f").call('expression.interact', { url, interactionCall });
10571
10934
  // Interactions can mutate the expression — invalidate cache so next get() fetches fresh
10572
- __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").delete(url);
10573
- __classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").delete(url);
10574
- __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").delete(url); // fire-and-forget
10935
+ __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").delete(url);
10936
+ __classPrivateFieldGet$4(this, _ExpressionClient_inflight, "f").delete(url);
10937
+ __classPrivateFieldGet$4(this, _ExpressionClient_persistent, "f").delete(url); // fire-and-forget
10575
10938
  return result;
10576
10939
  }
10577
10940
  }
10578
10941
  _ExpressionClient_apiClient = new WeakMap(), _ExpressionClient_memCache = new WeakMap(), _ExpressionClient_inflight = new WeakMap(), _ExpressionClient_totalMemBytes = new WeakMap(), _ExpressionClient_persistent = new WeakMap(), _ExpressionClient_instances = new WeakSet(), _ExpressionClient_memCacheResult = function _ExpressionClient_memCacheResult(url, data) {
10579
10942
  const size = JSON.stringify(data).length;
10580
10943
  // Evict oldest entries if we'd exceed limits
10581
- while (__classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").size >= ExpressionClient.MAX_MEM_ENTRIES ||
10582
- __classPrivateFieldGet$3(this, _ExpressionClient_totalMemBytes, "f") + size > ExpressionClient.MAX_MEM_BYTES) {
10583
- const oldest = __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").keys().next().value;
10944
+ while (__classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").size >= ExpressionClient.MAX_MEM_ENTRIES ||
10945
+ __classPrivateFieldGet$4(this, _ExpressionClient_totalMemBytes, "f") + size > ExpressionClient.MAX_MEM_BYTES) {
10946
+ const oldest = __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").keys().next().value;
10584
10947
  if (!oldest)
10585
10948
  break;
10586
- const entry = __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").get(oldest);
10587
- __classPrivateFieldSet$3(this, _ExpressionClient_totalMemBytes, __classPrivateFieldGet$3(this, _ExpressionClient_totalMemBytes, "f") - entry.size, "f");
10588
- __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").delete(oldest);
10949
+ const entry = __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").get(oldest);
10950
+ __classPrivateFieldSet$4(this, _ExpressionClient_totalMemBytes, __classPrivateFieldGet$4(this, _ExpressionClient_totalMemBytes, "f") - entry.size, "f");
10951
+ __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").delete(oldest);
10589
10952
  }
10590
- __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").set(url, { data, size });
10591
- __classPrivateFieldSet$3(this, _ExpressionClient_totalMemBytes, __classPrivateFieldGet$3(this, _ExpressionClient_totalMemBytes, "f") + size, "f");
10953
+ __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").set(url, { data, size });
10954
+ __classPrivateFieldSet$4(this, _ExpressionClient_totalMemBytes, __classPrivateFieldGet$4(this, _ExpressionClient_totalMemBytes, "f") + size, "f");
10592
10955
  };
10593
10956
  /** Maximum number of entries in the L1 memory cache. */
10594
10957
  ExpressionClient.MAX_MEM_ENTRIES = 200;
@@ -17664,13 +18027,13 @@ class AIModelLoadingStatus {
17664
18027
  }
17665
18028
  }
17666
18029
 
17667
- var __classPrivateFieldSet$2 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
18030
+ var __classPrivateFieldSet$3 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
17668
18031
  if (kind === "m") throw new TypeError("Private method is not writable");
17669
18032
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
17670
18033
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
17671
18034
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
17672
18035
  };
17673
- var __classPrivateFieldGet$2 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
18036
+ var __classPrivateFieldGet$3 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
17674
18037
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
17675
18038
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
17676
18039
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -17681,14 +18044,14 @@ class AIClient {
17681
18044
  _AIClient_apiClient.set(this, void 0);
17682
18045
  _AIClient_transcriptionUnsubscribers.set(this, new Map());
17683
18046
  _AIClient_pendingStreamIds.set(this, new Set());
17684
- __classPrivateFieldSet$2(this, _AIClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
18047
+ __classPrivateFieldSet$3(this, _AIClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
17685
18048
  }
17686
18049
  /** The executor names the model type `type`. */
17687
18050
  serializeModelInput({ modelType, ...model }) {
17688
18051
  return { ...model, type: modelType };
17689
18052
  }
17690
18053
  async getModels() {
17691
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.models', {});
18054
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.models', {});
17692
18055
  }
17693
18056
  /**
17694
18057
  * Ask a remote endpoint which models it serves, before adding one.
@@ -17703,35 +18066,35 @@ class AIClient {
17703
18066
  * that is not Anthropic speaks.
17704
18067
  */
17705
18068
  async discoverModels(baseUrl, apiKey, apiType) {
17706
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.discoverModels', { baseUrl, apiKey, apiType });
18069
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.discoverModels', { baseUrl, apiKey, apiType });
17707
18070
  }
17708
18071
  async addModel(model, options) {
17709
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.addModel', { model: this.serializeModelInput(model) }, options);
18072
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.addModel', { model: this.serializeModelInput(model) }, options);
17710
18073
  }
17711
18074
  async updateModel(modelId, model) {
17712
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.updateModel', { id: modelId, model: this.serializeModelInput(model) });
18075
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.updateModel', { id: modelId, model: this.serializeModelInput(model) });
17713
18076
  }
17714
18077
  async removeModel(modelId) {
17715
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.removeModel', { id: modelId });
18078
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.removeModel', { id: modelId });
17716
18079
  }
17717
18080
  async setDefaultModel(modelType, modelId) {
17718
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.setDefaultModel', { id: modelId, modelType });
18081
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.setDefaultModel', { id: modelId, modelType });
17719
18082
  }
17720
18083
  async getDefaultModel(modelType) {
17721
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.getDefaultModel', { modelType });
18084
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.getDefaultModel', { modelType });
17722
18085
  }
17723
18086
  async tasks() {
17724
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.tasks', {});
18087
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.tasks', {});
17725
18088
  }
17726
18089
  async addTask(name, modelId, systemPrompt, promptExamples, metaData) {
17727
18090
  const task = new AITaskInput(name, modelId, systemPrompt, promptExamples, metaData);
17728
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.addTask', { task });
18091
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.addTask', { task });
17729
18092
  }
17730
18093
  async removeTask(taskId) {
17731
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.removeTask', { id: taskId });
18094
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.removeTask', { id: taskId });
17732
18095
  }
17733
18096
  async updateTask(taskId, task) {
17734
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.updateTask', {
18097
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.updateTask', {
17735
18098
  task: {
17736
18099
  taskId,
17737
18100
  name: task.name,
@@ -17745,13 +18108,13 @@ class AIClient {
17745
18108
  });
17746
18109
  }
17747
18110
  async modelLoadingStatus(model) {
17748
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.modelLoadingStatus', { model });
18111
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.modelLoadingStatus', { model });
17749
18112
  }
17750
18113
  async prompt(taskId, prompt, options) {
17751
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.prompt', { taskId, prompt }, options);
18114
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.prompt', { taskId, prompt }, options);
17752
18115
  }
17753
18116
  async embed(modelId, text, options) {
17754
- const aiEmbed = await __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.embed', { modelId, text }, options);
18117
+ const aiEmbed = await __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.embed', { modelId, text }, options);
17755
18118
  const compressed = base64Js.toByteArray(aiEmbed);
17756
18119
  // NB: pako v1 accepts `{ to: 'string' }`, pako v2 wants `{ toText: true }`,
17757
18120
  // pako v3 also drops that overload from its bundled types. Call the
@@ -17762,22 +18125,22 @@ class AIClient {
17762
18125
  return decompressed;
17763
18126
  }
17764
18127
  async openTranscriptionStream(modelId, streamCallback, params) {
17765
- const streamId = await __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.transcriptionOpen', { modelId, params });
17766
- const unsub = __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").on('transcription-text', (event) => {
18128
+ const streamId = await __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.transcriptionOpen', { modelId, params });
18129
+ const unsub = __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").on('transcription-text', (event) => {
17767
18130
  if (event.streamId === streamId && event.text)
17768
18131
  streamCallback(event.text);
17769
18132
  });
17770
- __classPrivateFieldGet$2(this, _AIClient_transcriptionUnsubscribers, "f").set(streamId, unsub);
18133
+ __classPrivateFieldGet$3(this, _AIClient_transcriptionUnsubscribers, "f").set(streamId, unsub);
17771
18134
  return streamId;
17772
18135
  }
17773
18136
  async closeTranscriptionStream(streamId) {
17774
- __classPrivateFieldGet$2(this, _AIClient_pendingStreamIds, "f").delete(streamId);
18137
+ __classPrivateFieldGet$3(this, _AIClient_pendingStreamIds, "f").delete(streamId);
17775
18138
  try {
17776
- await __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.transcriptionClose', { streamId });
18139
+ await __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.transcriptionClose', { streamId });
17777
18140
  }
17778
18141
  finally {
17779
- __classPrivateFieldGet$2(this, _AIClient_transcriptionUnsubscribers, "f").get(streamId)?.();
17780
- __classPrivateFieldGet$2(this, _AIClient_transcriptionUnsubscribers, "f").delete(streamId);
18142
+ __classPrivateFieldGet$3(this, _AIClient_transcriptionUnsubscribers, "f").get(streamId)?.();
18143
+ __classPrivateFieldGet$3(this, _AIClient_transcriptionUnsubscribers, "f").delete(streamId);
17781
18144
  }
17782
18145
  }
17783
18146
  /**
@@ -17799,12 +18162,12 @@ class AIClient {
17799
18162
  if (ids.length === 0 || typedAudio.length === 0) {
17800
18163
  return;
17801
18164
  }
17802
- const baseUrl = __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").getBaseUrl();
17803
- const token = __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").getToken();
18165
+ const baseUrl = __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").getBaseUrl();
18166
+ const token = __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").getToken();
17804
18167
  // Use slice to get only the relevant portion of the underlying ArrayBuffer
17805
18168
  // (Float32Array may be a view over a larger buffer)
17806
18169
  const bodyBuffer = typedAudio.buffer.slice(typedAudio.byteOffset, typedAudio.byteOffset + typedAudio.byteLength);
17807
- const response = await __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").doFetch(`${baseUrl}/api/v1/ai/transcription/feed`, {
18170
+ const response = await __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").doFetch(`${baseUrl}/api/v1/ai/transcription/feed`, {
17808
18171
  method: 'POST',
17809
18172
  headers: {
17810
18173
  'Content-Type': 'application/octet-stream',
@@ -17821,6 +18184,103 @@ class AIClient {
17821
18184
  }
17822
18185
  _AIClient_apiClient = new WeakMap(), _AIClient_transcriptionUnsubscribers = new WeakMap(), _AIClient_pendingStreamIds = new WeakMap();
17823
18186
 
18187
+ var __classPrivateFieldSet$2 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
18188
+ if (kind === "m") throw new TypeError("Private method is not writable");
18189
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
18190
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
18191
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
18192
+ };
18193
+ var __classPrivateFieldGet$2 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
18194
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
18195
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
18196
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
18197
+ };
18198
+ var _IdentityClient_apiClient;
18199
+ /**
18200
+ * The executor's `did:scid:coasys:1` calls.
18201
+ *
18202
+ * The executor holds device keys only. Master keys and the 12 words stay with the app
18203
+ * (`ad4m-identity-client`), which signs the events and offers these calls pass on.
18204
+ * `agent.status()` and `agent.me()` carry `identity`, the `did:scid` the agent speaks for.
18205
+ */
18206
+ class IdentityClient {
18207
+ constructor(baseUrl, token, sharedApiClient) {
18208
+ _IdentityClient_apiClient.set(this, void 0);
18209
+ __classPrivateFieldSet$2(this, _IdentityClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
18210
+ }
18211
+ /**
18212
+ * This agent's identity, device key, `enc` key and the cached head. `storeBehind` is set
18213
+ * (`{ since, seq }`) while the configured store answers the log behind the executor's cache,
18214
+ * and `null` once it catches up. `store` is the identity store this executor uses
18215
+ * (`{ url, trusted }`: its config's, else its network's) and whether it trusts a key for it;
18216
+ * `null` when its network has no store, so identities cannot be created or linked there.
18217
+ */
18218
+ async status() {
18219
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.status", {});
18220
+ }
18221
+ /** A log through the executor's cache; `fresh` refreshes it from the store first. */
18222
+ async log(did, from, fresh) {
18223
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.log", { did, from, fresh });
18224
+ }
18225
+ /**
18226
+ * Resolves a `did:scid:coasys:1` DID URL (`?src=`, `?versionId=`, `#d1`) or a bare device
18227
+ * `did:key` to a W3C DID Core resolution result. The executor answers from its key-log
18228
+ * cache unless `fresh`, or the cache lacks the log or the asked version. A refusal comes
18229
+ * back as `didResolutionMetadata.error` (`invalidDid`, `invalidDidUrl`, `notFound`, …), not
18230
+ * as a thrown error. With a fragment, `didDocument` is null and `verificationMethod` holds
18231
+ * that method. For a `did:key`, `didResolutionMetadata["coasys:keyId"]` and
18232
+ * `["coasys:keyValid"]` say which key of the person's log it is and whether it is valid.
18233
+ */
18234
+ async resolve(didUrl, options = {}) {
18235
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.resolve", {
18236
+ didUrl,
18237
+ fresh: options.fresh,
18238
+ accept: options.accept,
18239
+ });
18240
+ }
18241
+ /**
18242
+ * Drops this executor's cached copy of `did`'s log (its events, accepted head and recorded
18243
+ * forks); the next read refreshes from the configured store and takes the store's branch.
18244
+ * The way out of an `identity-fork`. The operator (admin credential) only.
18245
+ */
18246
+ async resetLog(did) {
18247
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.resetLog", { did });
18248
+ }
18249
+ /**
18250
+ * Adds this agent's device-key proof to an `incept` that lists its key. For the main
18251
+ * agent the admin credential only; a user's session for its own agent.
18252
+ */
18253
+ async cosignIncept(event) {
18254
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.cosignIncept", { event: event });
18255
+ }
18256
+ /**
18257
+ * Appends signed events through the agent language. For the main agent the admin
18258
+ * credential only; a user's session for its own agent.
18259
+ */
18260
+ async publish(events) {
18261
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.publish", { events: events });
18262
+ }
18263
+ async openOffer(signedOffer) {
18264
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.openOffer", { signedOffer });
18265
+ }
18266
+ /** The identity's open and claimed offers, for a request signed by its current master key. */
18267
+ async offers(request, wait) {
18268
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.offers", { request, wait });
18269
+ }
18270
+ /** Claims an offer link for this executor (the operator only). */
18271
+ async claimOffer(offer, hint) {
18272
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.claimOffer", { offer, hint });
18273
+ }
18274
+ async joinStatus(offerId) {
18275
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.joinStatus", { offerId });
18276
+ }
18277
+ /** The identity's device keys, from its log. */
18278
+ async devices() {
18279
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.devices", {});
18280
+ }
18281
+ }
18282
+ _IdentityClient_apiClient = new WeakMap();
18283
+
17824
18284
  /**
17825
18285
  * Shared type definitions for the Ad4mModel system.
17826
18286
  *
@@ -20173,6 +20633,10 @@ class Ad4mModel {
20173
20633
  */
20174
20634
  constructor(perspective, baseExpression) {
20175
20635
  this._snapshot = null;
20636
+ /** True when the constructor minted the id: no record can hold links yet. */
20637
+ this._idMinted = false;
20638
+ /** Predicates this instance has already written relation links under (`add*`/`set*`), so they may hold links. */
20639
+ this._relationsWritten = new Set();
20176
20640
  // Use a dedicated `ad4m://obj/<id>` scheme for auto-generated
20177
20641
  // baseExpressions instead of `Literal.from(...).toUrl()`'s
20178
20642
  // `literal:string:<id>`. After typed-literal storage lands, the storage
@@ -20183,6 +20647,7 @@ class Ad4mModel {
20183
20647
  // IRIs, so relation links like `<post> --has_comment--> <comment-id>`
20184
20648
  // round-trip correctly through the SPARQL store.
20185
20649
  this._baseExpression = baseExpression ? baseExpression : `ad4m://obj/${makeRandomId(24)}`;
20650
+ this._idMinted = !baseExpression;
20186
20651
  this._perspective = perspective;
20187
20652
  }
20188
20653
  /**
@@ -21001,6 +21466,7 @@ class Ad4mModel {
21001
21466
  console.warn(`Relation "${key}" has no metadata, skipping`);
21002
21467
  return;
21003
21468
  }
21469
+ this._relationsWritten.add(metadata.predicate);
21004
21470
  const abstractName = this.abstractName();
21005
21471
  if (abstractName) {
21006
21472
  if (value != null)
@@ -21024,6 +21490,7 @@ class Ad4mModel {
21024
21490
  console.warn(`Relation "${key}" has no metadata, skipping`);
21025
21491
  return;
21026
21492
  }
21493
+ this._relationsWritten.add(metadata.predicate);
21027
21494
  const abstractName = this.abstractName();
21028
21495
  if (abstractName) {
21029
21496
  if (value != null)
@@ -21272,7 +21739,11 @@ class Ad4mModel {
21272
21739
  }
21273
21740
  }
21274
21741
  else if (Array.isArray(value)) {
21275
- // Handle all arrays as relations, including empty ones (which clears the relation)
21742
+ // Handle all arrays as relations, including empty ones (which clears the relation).
21743
+ // A record being created under an id minted here has no links to
21744
+ // clear, so an empty relation there costs a round trip and writes nothing.
21745
+ if (value.length === 0 && !this._snapshot && this._idMinted && !this._relationsWritten.has(this.getRelationOptions(key)?.predicate ?? key))
21746
+ continue;
21276
21747
  await this.setRelationValues(key, value, batchId);
21277
21748
  }
21278
21749
  else if (value !== undefined && value !== null && value !== "") {
@@ -21876,7 +22347,7 @@ var __classPrivateFieldGet$1 = (undefined && undefined.__classPrivateFieldGet) |
21876
22347
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
21877
22348
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
21878
22349
  };
21879
- var _Ad4mClient_baseUrl, _Ad4mClient_token, _Ad4mClient_apiClient, _Ad4mClient_agentClient, _Ad4mClient_expressionClient, _Ad4mClient_languageClient, _Ad4mClient_neighbourhoodClient, _Ad4mClient_perspectiveClient, _Ad4mClient_runtimeClient, _Ad4mClient_aiClient;
22350
+ var _Ad4mClient_baseUrl, _Ad4mClient_token, _Ad4mClient_apiClient, _Ad4mClient_agentClient, _Ad4mClient_expressionClient, _Ad4mClient_languageClient, _Ad4mClient_neighbourhoodClient, _Ad4mClient_perspectiveClient, _Ad4mClient_runtimeClient, _Ad4mClient_aiClient, _Ad4mClient_identityClient;
21880
22351
  /**
21881
22352
  * Client for the Ad4m interface wrapping WebSocket RPC calls
21882
22353
  * for convenient use in user facing code.
@@ -21900,6 +22371,7 @@ class Ad4mClient {
21900
22371
  _Ad4mClient_perspectiveClient.set(this, void 0);
21901
22372
  _Ad4mClient_runtimeClient.set(this, void 0);
21902
22373
  _Ad4mClient_aiClient.set(this, void 0);
22374
+ _Ad4mClient_identityClient.set(this, void 0);
21903
22375
  __classPrivateFieldSet$1(this, _Ad4mClient_baseUrl, baseUrl, "f");
21904
22376
  __classPrivateFieldSet$1(this, _Ad4mClient_token, token, "f");
21905
22377
  __classPrivateFieldSet$1(this, _Ad4mClient_apiClient, new ApiClient(baseUrl, token, options?.webSocketImpl, options?.fetchImpl), "f");
@@ -21913,6 +22385,7 @@ class Ad4mClient {
21913
22385
  __classPrivateFieldGet$1(this, _Ad4mClient_perspectiveClient, "f").setNeighbourhoodClient(__classPrivateFieldGet$1(this, _Ad4mClient_neighbourhoodClient, "f"));
21914
22386
  __classPrivateFieldGet$1(this, _Ad4mClient_perspectiveClient, "f").setAIClient(__classPrivateFieldGet$1(this, _Ad4mClient_aiClient, "f"));
21915
22387
  __classPrivateFieldSet$1(this, _Ad4mClient_runtimeClient, new RuntimeClient(baseUrl, token, __classPrivateFieldGet$1(this, _Ad4mClient_apiClient, "f")), "f");
22388
+ __classPrivateFieldSet$1(this, _Ad4mClient_identityClient, new IdentityClient(baseUrl, token, __classPrivateFieldGet$1(this, _Ad4mClient_apiClient, "f")), "f");
21916
22389
  // Register with AD4M DevTools if the bridge is installed (e.g. browser extension)
21917
22390
  try {
21918
22391
  const dt = globalThis.__AD4M_DEVTOOLS__;
@@ -21944,6 +22417,10 @@ class Ad4mClient {
21944
22417
  get ai() {
21945
22418
  return __classPrivateFieldGet$1(this, _Ad4mClient_aiClient, "f");
21946
22419
  }
22420
+ /** The executor's identity calls (`did:scid:coasys:1`). */
22421
+ get identity() {
22422
+ return __classPrivateFieldGet$1(this, _Ad4mClient_identityClient, "f");
22423
+ }
21947
22424
  /**
21948
22425
  * Call `handler` with every `type` event, or only those about
21949
22426
  * `filter.perspective`. The payload is typed by the executor's event
@@ -21976,7 +22453,7 @@ class Ad4mClient {
21976
22453
  __classPrivateFieldGet$1(this, _Ad4mClient_apiClient, "f").closeAll();
21977
22454
  }
21978
22455
  }
21979
- _Ad4mClient_baseUrl = new WeakMap(), _Ad4mClient_token = new WeakMap(), _Ad4mClient_apiClient = new WeakMap(), _Ad4mClient_agentClient = new WeakMap(), _Ad4mClient_expressionClient = new WeakMap(), _Ad4mClient_languageClient = new WeakMap(), _Ad4mClient_neighbourhoodClient = new WeakMap(), _Ad4mClient_perspectiveClient = new WeakMap(), _Ad4mClient_runtimeClient = new WeakMap(), _Ad4mClient_aiClient = new WeakMap();
22456
+ _Ad4mClient_baseUrl = new WeakMap(), _Ad4mClient_token = new WeakMap(), _Ad4mClient_apiClient = new WeakMap(), _Ad4mClient_agentClient = new WeakMap(), _Ad4mClient_expressionClient = new WeakMap(), _Ad4mClient_languageClient = new WeakMap(), _Ad4mClient_neighbourhoodClient = new WeakMap(), _Ad4mClient_perspectiveClient = new WeakMap(), _Ad4mClient_runtimeClient = new WeakMap(), _Ad4mClient_aiClient = new WeakMap(), _Ad4mClient_identityClient = new WeakMap();
21980
22457
 
21981
22458
  exports.ExceptionType = void 0;
21982
22459
  (function (ExceptionType) {
@@ -22932,10 +23409,12 @@ class FlowInstance {
22932
23409
  // synthetic hydration field and would be silently shadowed on read).
22933
23410
  // No explicit start-time field: Ad4mModel synthesises `createdAt` on
22934
23411
  // hydration from the earliest link timestamp on the instance's URI.
22935
- // Convention: `SHACLFlow.states` is stored sorted ascending by `value`
22936
- // (enforced by `fromLinks`), so `states[0]` is the initial state. A
22937
- // flow author who wants a specific state as the entry point must give
22938
- // it the lowest `value` in the set.
23412
+ // Convention: `SHACLFlow.states` is stored sorted ascending by `value`,
23413
+ // ties broken by state name (enforced by `fromLinks`, same key as
23414
+ // rust-executor — #1202), so `states[0]` is the initial state. A flow
23415
+ // author who wants a specific state as the entry point must give it
23416
+ // the lowest `value` in the set, and not share that value with another
23417
+ // state unless the name order is the intended one.
22939
23418
  //
22940
23419
  // A run already on this subject for this flow is the one to return:
22941
23420
  // minting another would leave two runs, each with its own state, and
@@ -24611,6 +25090,7 @@ exports.HasOne = HasOne;
24611
25090
  exports.HostingUserInfo = HostingUserInfo;
24612
25091
  exports.IDBCache = IDBCache;
24613
25092
  exports.Icon = Icon;
25093
+ exports.IdentityClient = IdentityClient;
24614
25094
  exports.ImportResult = ImportResult;
24615
25095
  exports.ImportStats = ImportStats;
24616
25096
  exports.InteractionCall = InteractionCall;