@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.js CHANGED
@@ -36,6 +36,12 @@ const READ_METHODS = new Set([
36
36
  "hosting.info",
37
37
  "hosting.wallet",
38
38
  "hosting.walletHistory",
39
+ "identity.devices",
40
+ "identity.joinStatus",
41
+ "identity.log",
42
+ "identity.offers",
43
+ "identity.resolve",
44
+ "identity.status",
39
45
  "language.all",
40
46
  "language.get",
41
47
  "language.meta",
@@ -146,6 +152,12 @@ const SLOWEST_LINK_BYTES_PER_MS = 16; // 16 kB/s
146
152
  * behind a large write. Shorter than PING_INTERVAL_MS, so the few ms a small
147
153
  * frame adds before a ping on an idle socket never cost a ping interval. */
148
154
  const PONG_RETURN_MS = 5000;
155
+ /** How long `checkConnection` waits for the open socket to say anything
156
+ * after its ping. If a large write sent before it may still be on the way,
157
+ * the wait lasts until that write could have crossed, as for the periodic
158
+ * ping, and half of this more for the pong. On a working path the pong is
159
+ * one round trip away. */
160
+ const CHECK_CONNECTION_DEADLINE_MS = 2000;
149
161
  /** The bytes `text` takes as UTF-8, as a WebSocket text frame sends it. */
150
162
  function utf8Length(text) {
151
163
  let bytes = text.length;
@@ -199,6 +211,8 @@ class ApiClient {
199
211
  * A message from the socket does not move it back: hearing from the executor says nothing
200
212
  * about how much of a large upload has reached it. */
201
213
  this._wsSentBy = 0;
214
+ /** A `checkConnection` probe waiting for the open socket to say anything; null when none. */
215
+ this._wsProbeTimer = null;
202
216
  // The executor sends a socket only the events it asked for (`events.watch`).
203
217
  // What the executor has for the open socket, as sent; a new socket has `{}`.
204
218
  this._watching = '{}';
@@ -208,6 +222,13 @@ class ApiClient {
208
222
  this._watchSent = Promise.resolve();
209
223
  this._watchRetries = 0;
210
224
  this._watchRetryTimer = null;
225
+ this._networkCallbacks = new Set();
226
+ /** Removes the network-change listeners; null while not listening. */
227
+ this._unlistenNetwork = null;
228
+ /** A network change waits for its socket to open, then tells `onNetworkChange`. */
229
+ this._networkChanged = false;
230
+ /** The socket dialled for the last network change. */
231
+ this._networkDial = null;
211
232
  this._wakeListening = false;
212
233
  /** `online` always; `visibilitychange` only when the page became visible. */
213
234
  this._onWake = (event) => {
@@ -238,6 +259,7 @@ class ApiClient {
238
259
  return;
239
260
  if (this._authFailed !== null)
240
261
  throw new RpcError(401, this._authFailed);
262
+ this._listenForNetworkChanges();
241
263
  // A dial ends any wait for one: a call or subscriber that dials during the backoff
242
264
  // leaves no timer behind to swallow the retry after this socket's own drop.
243
265
  this._cancelReconnect();
@@ -265,8 +287,10 @@ class ApiClient {
265
287
  // Only watchApplied() awaits this; a close before open is not an error otherwise.
266
288
  this._wsOpen.catch(() => { });
267
289
  ws.onmessage = (event) => {
268
- if (this._ws === ws)
290
+ if (this._ws === ws) {
269
291
  this._wsPingedAt = null;
292
+ this._endProbe();
293
+ }
270
294
  let parsed;
271
295
  try {
272
296
  parsed = JSON.parse(event.data);
@@ -338,6 +362,70 @@ class ApiClient {
338
362
  }
339
363
  }
340
364
  this._hasConnectedOnce = true;
365
+ if (this._networkChanged) {
366
+ this._networkChanged = false;
367
+ this._notifyNetworkChange();
368
+ }
369
+ }
370
+ /**
371
+ * Hear of network changes where the platform says so: `online` on the
372
+ * global object (browsers, Deno) redials at once, and `change` on
373
+ * `navigator.connection` (Chromium) runs `checkConnection`. Elsewhere,
374
+ * e.g. Node, nothing is heard and the ping deadline notices a dead
375
+ * socket on its own.
376
+ */
377
+ _listenForNetworkChanges() {
378
+ if (this._unlistenNetwork)
379
+ return;
380
+ const handler = () => this._onNetworkChange();
381
+ const removers = [];
382
+ const target = globalThis;
383
+ if (typeof target.addEventListener === 'function') {
384
+ target.addEventListener('online', handler);
385
+ removers.push(() => target.removeEventListener?.('online', handler));
386
+ }
387
+ const connection = globalThis.navigator?.connection;
388
+ if (typeof connection?.addEventListener === 'function') {
389
+ // `change` also fires when Chromium's downlink or rtt estimate
390
+ // moves, as a busy call makes it do: probe rather than drop.
391
+ const probe = () => this.checkConnection();
392
+ connection.addEventListener('change', probe);
393
+ removers.push(() => connection.removeEventListener?.('change', probe));
394
+ }
395
+ this._unlistenNetwork = () => { for (const remove of removers)
396
+ remove(); };
397
+ }
398
+ /**
399
+ * The network changed: the open socket most likely runs over a path that
400
+ * is gone, and nothing would say so before the ping deadline. Drop it as
401
+ * a silent socket is dropped and dial the next one now, without backoff.
402
+ * `onNetworkChange` callbacks fire once that socket opens.
403
+ */
404
+ _onNetworkChange() {
405
+ if (this._authFailed !== null)
406
+ return;
407
+ const ws = this._ws;
408
+ // A socket dialled for an earlier change is on the new network already.
409
+ if (ws && ws === this._networkDial && ws.readyState === 0 /* CONNECTING */)
410
+ return;
411
+ if (ws) {
412
+ console.info('Network changed; reconnecting the WebSocket');
413
+ this._onClose(ws);
414
+ ws.close();
415
+ }
416
+ this._cancelReconnect();
417
+ this._wsReconnectDelay = INITIAL_RECONNECT_DELAY_MS;
418
+ if (this._handlers.size === 0 && this._pendingCalls.size === 0) {
419
+ this._notifyNetworkChange();
420
+ return;
421
+ }
422
+ this._networkChanged = true;
423
+ this._ensureWs();
424
+ this._networkDial = this._ws;
425
+ }
426
+ _notifyNetworkChange() {
427
+ for (const cb of [...this._networkCallbacks])
428
+ callSafely(cb, 'Error in network-change callback:');
341
429
  }
342
430
  /** `reason` is set when the executor asked to try again later; calls that fail carry it. */
343
431
  _onClose(ws, reason) {
@@ -381,6 +469,9 @@ class ApiClient {
381
469
  this._wsPingTimer = setInterval(() => {
382
470
  if (this._ws !== ws)
383
471
  return;
472
+ // A probe has its own, shorter deadline and decides for this ping.
473
+ if (this._wsProbeTimer)
474
+ return;
384
475
  const ping = JSON.stringify({ type: 'ping' });
385
476
  if (this._wsPingedAt === null) {
386
477
  this._wsPingedAt = performance.now();
@@ -414,6 +505,13 @@ class ApiClient {
414
505
  clearInterval(this._wsPingTimer);
415
506
  this._wsPingTimer = null;
416
507
  }
508
+ this._endProbe();
509
+ }
510
+ _endProbe() {
511
+ if (this._wsProbeTimer) {
512
+ clearTimeout(this._wsProbeTimer);
513
+ this._wsProbeTimer = null;
514
+ }
417
515
  }
418
516
  _scheduleReconnect() {
419
517
  if (this._wsReconnectTimer || this._authFailed !== null)
@@ -672,6 +770,46 @@ class ApiClient {
672
770
  this._reconnectCallbacks.add(callback);
673
771
  return () => { this._reconnectCallbacks.delete(callback); };
674
772
  }
773
+ /** Register a callback that fires after the network changed (`online`,
774
+ * or a socket that failed `checkConnection`), once the socket dialled for the
775
+ * new network is open and its event watch sent. Calls made from it go
776
+ * out on that socket. Returns an unsubscribe function. */
777
+ onNetworkChange(callback) {
778
+ this._networkCallbacks.add(callback);
779
+ this._listenForNetworkChanges();
780
+ return () => { this._networkCallbacks.delete(callback); };
781
+ }
782
+ /**
783
+ * Check the open socket now rather than at the next ping: send a ping,
784
+ * and if nothing at all arrives on that socket within `deadlineMs`,
785
+ * treat it as a network change (drop it, dial the next one at once,
786
+ * `onNetworkChange` callbacks fire when it opens). Any message keeps it.
787
+ * For a caller that has seen its network path break, e.g. ICE going
788
+ * disconnected, where the platform fired no `online` event. Without an
789
+ * open socket, or while a check runs, this does nothing.
790
+ */
791
+ checkConnection(deadlineMs = CHECK_CONNECTION_DEADLINE_MS) {
792
+ const ws = this._ws;
793
+ if (!ws || ws.readyState !== 1 /* OPEN */ || this._wsProbeTimer)
794
+ return;
795
+ const first = this._wsPingedAt === null;
796
+ if (first)
797
+ this._wsPingedAt = performance.now();
798
+ this._send(ws, JSON.stringify({ type: 'ping' }));
799
+ if (first)
800
+ this._wsPingArrivesBy = this._wsSentBy;
801
+ // Any message from the socket ends the probe (`onmessage` → `_endProbe`).
802
+ // The ping reaches the executor only after what was sent before it,
803
+ // and its pong gets half the deadline to come back after that.
804
+ const wait = Math.max(deadlineMs, this._wsSentBy - performance.now() + deadlineMs / 2);
805
+ this._wsProbeTimer = setTimeout(() => {
806
+ this._wsProbeTimer = null;
807
+ if (this._ws !== ws)
808
+ return;
809
+ console.warn(`WebSocket silent for ${wait} ms after a check; reconnecting`);
810
+ this._onNetworkChange();
811
+ }, wait);
812
+ }
675
813
  /** Register a callback that fires once when the executor refuses this
676
814
  * client's token: a 401 reply, or a socket closed with code 1008. Every
677
815
  * call then fails with a 401 `RpcError` and the client does not reconnect;
@@ -689,6 +827,11 @@ class ApiClient {
689
827
  this._handlers.clear();
690
828
  this._reconnectCallbacks.clear();
691
829
  this._authFailedCallbacks.clear();
830
+ this._networkCallbacks.clear();
831
+ this._unlistenNetwork?.();
832
+ this._unlistenNetwork = null;
833
+ this._networkChanged = false;
834
+ this._networkDial = null;
692
835
  // A reused client must not fire onReconnect on its next first open.
693
836
  this._hasConnectedOnce = false;
694
837
  }
@@ -950,6 +1093,9 @@ class Agent {
950
1093
  static fromWire(wire) {
951
1094
  const agent = new Agent(wire.did, Perspective.fromWire(wire.perspective));
952
1095
  agent.directMessageLanguage = wire.directMessageLanguage;
1096
+ if ("identity" in wire && wire.identity) {
1097
+ agent.identity = wire.identity;
1098
+ }
953
1099
  return agent;
954
1100
  }
955
1101
  }
@@ -1105,6 +1251,8 @@ class AgentStatus {
1105
1251
  this.didDocument = obj.didDocument;
1106
1252
  //@ts-ignore
1107
1253
  this.error = obj.error;
1254
+ //@ts-ignore
1255
+ this.identity = obj.identity ?? null;
1108
1256
  }
1109
1257
  else {
1110
1258
  this.isInitialized = false;
@@ -1126,13 +1274,13 @@ class AgentStatus {
1126
1274
  * never need try/catch around cache operations
1127
1275
  * - Tree-shakeable: import only what you need
1128
1276
  */
1129
- var __classPrivateFieldSet$d = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1277
+ var __classPrivateFieldSet$e = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1130
1278
  if (kind === "m") throw new TypeError("Private method is not writable");
1131
1279
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1132
1280
  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");
1133
1281
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1134
1282
  };
1135
- var __classPrivateFieldGet$d = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1283
+ var __classPrivateFieldGet$e = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1136
1284
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1137
1285
  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");
1138
1286
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -1146,15 +1294,15 @@ class IDBCache {
1146
1294
  _IDBCache_storeName.set(this, void 0);
1147
1295
  _IDBCache_dbPromise.set(this, null);
1148
1296
  _IDBCache_version.set(this, 1);
1149
- __classPrivateFieldSet$d(this, _IDBCache_dbName, dbName, "f");
1150
- __classPrivateFieldSet$d(this, _IDBCache_storeName, storeName, "f");
1297
+ __classPrivateFieldSet$e(this, _IDBCache_dbName, dbName, "f");
1298
+ __classPrivateFieldSet$e(this, _IDBCache_storeName, storeName, "f");
1151
1299
  }
1152
1300
  async get(key) {
1153
1301
  try {
1154
- const db = await __classPrivateFieldGet$d(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
1302
+ const db = await __classPrivateFieldGet$e(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
1155
1303
  return new Promise((resolve) => {
1156
- const tx = db.transaction(__classPrivateFieldGet$d(this, _IDBCache_storeName, "f"), 'readonly');
1157
- const store = tx.objectStore(__classPrivateFieldGet$d(this, _IDBCache_storeName, "f"));
1304
+ const tx = db.transaction(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"), 'readonly');
1305
+ const store = tx.objectStore(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"));
1158
1306
  const req = store.get(key);
1159
1307
  req.onsuccess = () => resolve(req.result ?? undefined);
1160
1308
  req.onerror = () => resolve(undefined);
@@ -1166,10 +1314,10 @@ class IDBCache {
1166
1314
  }
1167
1315
  async put(key, value) {
1168
1316
  try {
1169
- const db = await __classPrivateFieldGet$d(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
1317
+ const db = await __classPrivateFieldGet$e(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
1170
1318
  return new Promise((resolve) => {
1171
- const tx = db.transaction(__classPrivateFieldGet$d(this, _IDBCache_storeName, "f"), 'readwrite');
1172
- const store = tx.objectStore(__classPrivateFieldGet$d(this, _IDBCache_storeName, "f"));
1319
+ const tx = db.transaction(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"), 'readwrite');
1320
+ const store = tx.objectStore(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"));
1173
1321
  store.put(value, key);
1174
1322
  tx.oncomplete = () => resolve();
1175
1323
  tx.onerror = () => resolve(); // fire-and-forget
@@ -1181,10 +1329,10 @@ class IDBCache {
1181
1329
  }
1182
1330
  async delete(key) {
1183
1331
  try {
1184
- const db = await __classPrivateFieldGet$d(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
1332
+ const db = await __classPrivateFieldGet$e(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
1185
1333
  return new Promise((resolve) => {
1186
- const tx = db.transaction(__classPrivateFieldGet$d(this, _IDBCache_storeName, "f"), 'readwrite');
1187
- const store = tx.objectStore(__classPrivateFieldGet$d(this, _IDBCache_storeName, "f"));
1334
+ const tx = db.transaction(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"), 'readwrite');
1335
+ const store = tx.objectStore(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"));
1188
1336
  store.delete(key);
1189
1337
  tx.oncomplete = () => resolve();
1190
1338
  tx.onerror = () => resolve();
@@ -1196,10 +1344,10 @@ class IDBCache {
1196
1344
  }
1197
1345
  async clear() {
1198
1346
  try {
1199
- const db = await __classPrivateFieldGet$d(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
1347
+ const db = await __classPrivateFieldGet$e(this, _IDBCache_instances, "m", _IDBCache_open).call(this);
1200
1348
  return new Promise((resolve) => {
1201
- const tx = db.transaction(__classPrivateFieldGet$d(this, _IDBCache_storeName, "f"), 'readwrite');
1202
- const store = tx.objectStore(__classPrivateFieldGet$d(this, _IDBCache_storeName, "f"));
1349
+ const tx = db.transaction(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"), 'readwrite');
1350
+ const store = tx.objectStore(__classPrivateFieldGet$e(this, _IDBCache_storeName, "f"));
1203
1351
  store.clear();
1204
1352
  tx.oncomplete = () => resolve();
1205
1353
  tx.onerror = () => resolve();
@@ -1211,10 +1359,10 @@ class IDBCache {
1211
1359
  }
1212
1360
  }
1213
1361
  _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() {
1214
- if (!__classPrivateFieldGet$d(this, _IDBCache_dbPromise, "f")) {
1215
- __classPrivateFieldSet$d(this, _IDBCache_dbPromise, new Promise((resolve, reject) => {
1216
- const storeName = __classPrivateFieldGet$d(this, _IDBCache_storeName, "f");
1217
- const req = indexedDB.open(__classPrivateFieldGet$d(this, _IDBCache_dbName, "f"), __classPrivateFieldGet$d(this, _IDBCache_version, "f"));
1362
+ if (!__classPrivateFieldGet$e(this, _IDBCache_dbPromise, "f")) {
1363
+ __classPrivateFieldSet$e(this, _IDBCache_dbPromise, new Promise((resolve, reject) => {
1364
+ const storeName = __classPrivateFieldGet$e(this, _IDBCache_storeName, "f");
1365
+ const req = indexedDB.open(__classPrivateFieldGet$e(this, _IDBCache_dbName, "f"), __classPrivateFieldGet$e(this, _IDBCache_version, "f"));
1218
1366
  req.onupgradeneeded = () => {
1219
1367
  const db = req.result;
1220
1368
  if (!db.objectStoreNames.contains(storeName)) {
@@ -1225,7 +1373,7 @@ _IDBCache_dbName = new WeakMap(), _IDBCache_storeName = new WeakMap(), _IDBCache
1225
1373
  req.onerror = () => reject(req.error);
1226
1374
  }), "f");
1227
1375
  }
1228
- return __classPrivateFieldGet$d(this, _IDBCache_dbPromise, "f");
1376
+ return __classPrivateFieldGet$e(this, _IDBCache_dbPromise, "f");
1229
1377
  };
1230
1378
  // ── NullCache (no-op fallback for Node.js) ───────────────────────────
1231
1379
  class NullCache {
@@ -1253,13 +1401,13 @@ function createPersistentCache(dbName, storeName) {
1253
1401
  return new NullCache();
1254
1402
  }
1255
1403
 
1256
- var __classPrivateFieldSet$c = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1404
+ var __classPrivateFieldSet$d = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1257
1405
  if (kind === "m") throw new TypeError("Private method is not writable");
1258
1406
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1259
1407
  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");
1260
1408
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1261
1409
  };
1262
- var __classPrivateFieldGet$c = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1410
+ var __classPrivateFieldGet$d = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1263
1411
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1264
1412
  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");
1265
1413
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -1281,47 +1429,50 @@ class AgentClient {
1281
1429
  // Self-DID for event-driven invalidation (no TTL for own profile)
1282
1430
  _AgentClient_selfDid.set(this, null);
1283
1431
  _AgentClient_onAgentUpdated.set(this, (event) => {
1284
- __classPrivateFieldGet$c(this, _AgentClient_instances, "m", _AgentClient_cacheAgent).call(this, Agent.fromWire(event.agent));
1432
+ __classPrivateFieldGet$d(this, _AgentClient_instances, "m", _AgentClient_cacheAgent).call(this, Agent.fromWire(event.agent));
1285
1433
  });
1286
- __classPrivateFieldSet$c(this, _AgentClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
1287
- __classPrivateFieldSet$c(this, _AgentClient_persistent, createPersistentCache('ad4m-agent-cache', 'agents'), "f");
1434
+ __classPrivateFieldSet$d(this, _AgentClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
1435
+ __classPrivateFieldSet$d(this, _AgentClient_persistent, createPersistentCache('ad4m-agent-cache', 'agents'), "f");
1288
1436
  }
1289
1437
  async me() {
1290
- const agentObject = toAgent(await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.get', {}));
1438
+ const agentObject = toAgent(await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.get', {}));
1291
1439
  // Auto-set selfDid so event-driven cache invalidation works
1292
1440
  // without requiring apps to call setSelfDid() manually
1293
- if (agentObject.did && !__classPrivateFieldGet$c(this, _AgentClient_selfDid, "f")) {
1294
- __classPrivateFieldSet$c(this, _AgentClient_selfDid, agentObject.did, "f");
1441
+ if (agentObject.did && !__classPrivateFieldGet$d(this, _AgentClient_selfDid, "f")) {
1442
+ __classPrivateFieldSet$d(this, _AgentClient_selfDid, agentObject.did, "f");
1295
1443
  }
1296
1444
  return agentObject;
1297
1445
  }
1298
1446
  async status() {
1299
- const agentStatus = await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.status', {});
1447
+ const agentStatus = await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.status', {});
1300
1448
  return new AgentStatus(agentStatus);
1301
1449
  }
1450
+ /** Creates the agent's keys and DID on first run. The executor refuses (409)
1451
+ * an agent that is already initialised — {@link unlock} it instead; a second
1452
+ * `generate` never replaces the existing keys and DID. */
1302
1453
  async generate(passphrase, options) {
1303
- const result = await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.generate', { passphrase }, options);
1454
+ const result = await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.generate', { passphrase }, options);
1304
1455
  return new AgentStatus(result);
1305
1456
  }
1306
1457
  async import(args) {
1307
- const result = await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.import', { ...args });
1458
+ const result = await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.import', { ...args });
1308
1459
  return new AgentStatus(result);
1309
1460
  }
1310
1461
  async lock(passphrase) {
1311
- const result = await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.lock', { passphrase });
1462
+ const result = await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.lock', { passphrase });
1312
1463
  return new AgentStatus(result);
1313
1464
  }
1314
1465
  async unlock(passphrase, holochain = true, options) {
1315
- const result = await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.unlock', { passphrase, holochain }, options);
1466
+ const result = await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.unlock', { passphrase, holochain }, options);
1316
1467
  return new AgentStatus(result);
1317
1468
  }
1318
1469
  async byDID(did) {
1319
1470
  // agent-updated events keep cached entries fresh (the self-DID entry has no TTL).
1320
- __classPrivateFieldGet$c(this, _AgentClient_instances, "m", _AgentClient_listen).call(this);
1471
+ __classPrivateFieldGet$d(this, _AgentClient_instances, "m", _AgentClient_listen).call(this);
1321
1472
  const now = Date.now();
1322
- const cached = __classPrivateFieldGet$c(this, _AgentClient_memCache, "f").get(did);
1473
+ const cached = __classPrivateFieldGet$d(this, _AgentClient_memCache, "f").get(did);
1323
1474
  if (cached) {
1324
- const isSelf = did === __classPrivateFieldGet$c(this, _AgentClient_selfDid, "f");
1475
+ const isSelf = did === __classPrivateFieldGet$d(this, _AgentClient_selfDid, "f");
1325
1476
  // Self-DID: L1 always valid (event-driven invalidation)
1326
1477
  // Remote DID: L1 valid within TTL
1327
1478
  if (isSelf || (now - cached.ts) < AgentClient.REMOTE_AGENT_TTL_MS) {
@@ -1331,21 +1482,21 @@ class AgentClient {
1331
1482
  // Deduplicate: store the promise immediately so concurrent calls share one RPC
1332
1483
  const promise = (async () => {
1333
1484
  // L2: check persistent cache before network
1334
- const entry = await __classPrivateFieldGet$c(this, _AgentClient_persistent, "f").get(did);
1485
+ const entry = await __classPrivateFieldGet$d(this, _AgentClient_persistent, "f").get(did);
1335
1486
  // entry.agent may be undefined for pre-TTL cache entries (migration) — treat as expired
1336
1487
  if (entry?.agent && (now - (entry.ts ?? 0)) < AgentClient.REMOTE_AGENT_TTL_L2_MS) {
1337
1488
  return entry.agent;
1338
1489
  }
1339
1490
  // L3: network fetch
1340
- const result = toAgent(await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.byDid', { did }));
1341
- __classPrivateFieldGet$c(this, _AgentClient_persistent, "f").put(did, { agent: result, ts: Date.now() }); // fire-and-forget write to L2
1491
+ const result = toAgent(await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.byDid', { did }));
1492
+ __classPrivateFieldGet$d(this, _AgentClient_persistent, "f").put(did, { agent: result, ts: Date.now() }); // fire-and-forget write to L2
1342
1493
  return result;
1343
1494
  })();
1344
- __classPrivateFieldGet$c(this, _AgentClient_memCache, "f").set(did, { promise, ts: now });
1495
+ __classPrivateFieldGet$d(this, _AgentClient_memCache, "f").set(did, { promise, ts: now });
1345
1496
  // Clean up on failure so next call retries
1346
1497
  promise.catch(() => {
1347
- if (__classPrivateFieldGet$c(this, _AgentClient_memCache, "f").get(did)?.promise === promise) {
1348
- __classPrivateFieldGet$c(this, _AgentClient_memCache, "f").delete(did);
1498
+ if (__classPrivateFieldGet$d(this, _AgentClient_memCache, "f").get(did)?.promise === promise) {
1499
+ __classPrivateFieldGet$d(this, _AgentClient_memCache, "f").delete(did);
1349
1500
  }
1350
1501
  });
1351
1502
  return promise;
@@ -1355,21 +1506,21 @@ class AgentClient {
1355
1506
  * The self-DID receives event-driven invalidation and is never TTL-expired.
1356
1507
  */
1357
1508
  setSelfDid(did) {
1358
- __classPrivateFieldSet$c(this, _AgentClient_selfDid, did, "f");
1509
+ __classPrivateFieldSet$d(this, _AgentClient_selfDid, did, "f");
1359
1510
  }
1360
1511
  /**
1361
1512
  * Invalidate a specific DID's cache entry in both L1 and L2.
1362
1513
  */
1363
1514
  invalidateByDid(did) {
1364
- __classPrivateFieldGet$c(this, _AgentClient_memCache, "f").delete(did);
1365
- __classPrivateFieldGet$c(this, _AgentClient_persistent, "f").delete(did); // fire-and-forget
1515
+ __classPrivateFieldGet$d(this, _AgentClient_memCache, "f").delete(did);
1516
+ __classPrivateFieldGet$d(this, _AgentClient_persistent, "f").delete(did); // fire-and-forget
1366
1517
  }
1367
1518
  /**
1368
1519
  * Clear the entire L1 (memory) byDID cache.
1369
1520
  * L2 (IndexedDB) is preserved — agent data remains valid across sessions.
1370
1521
  */
1371
1522
  clearByDidCache() {
1372
- __classPrivateFieldGet$c(this, _AgentClient_memCache, "f").clear();
1523
+ __classPrivateFieldGet$d(this, _AgentClient_memCache, "f").clear();
1373
1524
  }
1374
1525
  async updatePublicPerspective(perspective) {
1375
1526
  // Send only the signed fields: the public perspective carries no link status.
@@ -1381,36 +1532,36 @@ class AgentClient {
1381
1532
  proof: { key: proof.key, signature: proof.signature, valid: proof.valid, invalid: proof.invalid },
1382
1533
  })),
1383
1534
  };
1384
- const agent = toAgent(await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.updateProfile', { publicPerspective }));
1535
+ const agent = toAgent(await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.updateProfile', { publicPerspective }));
1385
1536
  // Immediately update byDID cache so subsequent byDID() calls
1386
1537
  // return fresh data without waiting for the agent-updated event
1387
- __classPrivateFieldGet$c(this, _AgentClient_instances, "m", _AgentClient_cacheAgent).call(this, agent);
1538
+ __classPrivateFieldGet$d(this, _AgentClient_instances, "m", _AgentClient_cacheAgent).call(this, agent);
1388
1539
  return agent;
1389
1540
  }
1390
1541
  async mutatePublicPerspective({ additions, removals }) {
1391
- const added = additions.length > 0 ? await __classPrivateFieldGet$c(this, _AgentClient_instances, "m", _AgentClient_signLinks).call(this, additions) : [];
1542
+ const added = additions.length > 0 ? await __classPrivateFieldGet$d(this, _AgentClient_instances, "m", _AgentClient_signLinks).call(this, additions) : [];
1392
1543
  const { perspective } = await this.me();
1393
1544
  const kept = (perspective?.links ?? []).filter(link => !removals.some(r => linkEqual(link, r)));
1394
1545
  return this.updatePublicPerspective({ links: [...kept, ...added] });
1395
1546
  }
1396
1547
  async updateDirectMessageLanguage(directMessageLanguage) {
1397
- const agent = toAgent(await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.updateProfile', { dmLanguage: directMessageLanguage }));
1548
+ const agent = toAgent(await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.updateProfile', { dmLanguage: directMessageLanguage }));
1398
1549
  // Immediately update byDID cache so subsequent byDID() calls
1399
1550
  // return fresh data without waiting for the agent-updated event
1400
- __classPrivateFieldGet$c(this, _AgentClient_instances, "m", _AgentClient_cacheAgent).call(this, agent);
1551
+ __classPrivateFieldGet$d(this, _AgentClient_instances, "m", _AgentClient_cacheAgent).call(this, agent);
1401
1552
  return agent;
1402
1553
  }
1403
1554
  async addEntanglementProofs(proofs) {
1404
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.addEntanglementProofs', { proofs });
1555
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.addEntanglementProofs', { proofs });
1405
1556
  }
1406
1557
  async deleteEntanglementProofs(proofs) {
1407
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.deleteEntanglementProofs', { proofs });
1558
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.deleteEntanglementProofs', { proofs });
1408
1559
  }
1409
1560
  async getEntanglementProofs() {
1410
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.getEntanglementProofs', {});
1561
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.getEntanglementProofs', {});
1411
1562
  }
1412
1563
  async entanglementProofPreFlight(deviceKey, deviceKeyType) {
1413
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.entanglementProofPreflight', { deviceKey, deviceKeyType });
1564
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.entanglementProofPreflight', { deviceKey, deviceKeyType });
1414
1565
  }
1415
1566
  /**
1416
1567
  * Asks the executor for a capability token. `agent` names the agent the token will act
@@ -1420,45 +1571,45 @@ class AgentClient {
1420
1571
  * six-digit code.
1421
1572
  */
1422
1573
  async requestCapability(authInfo, agent) {
1423
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.requestCapability', agent === undefined ? { authInfo } : { authInfo, agent });
1574
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.requestCapability', agent === undefined ? { authInfo } : { authInfo, agent });
1424
1575
  }
1425
1576
  async permitCapability(auth) {
1426
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.permitCapability', { auth });
1577
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.permitCapability', { auth });
1427
1578
  }
1428
1579
  async generateJwt(requestId, rand) {
1429
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.generateJwt', { requestId, rand });
1580
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.generateJwt', { requestId, rand });
1430
1581
  }
1431
1582
  async getApps() {
1432
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.getApps', {});
1583
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.getApps', {});
1433
1584
  }
1434
1585
  async removeApp(requestId) {
1435
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.removeApp', { id: requestId });
1586
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.removeApp', { id: requestId });
1436
1587
  }
1437
1588
  async revokeToken(requestId) {
1438
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.revokeToken', { token: requestId });
1589
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.revokeToken', { token: requestId });
1439
1590
  }
1440
1591
  async isLocked() {
1441
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.isLocked', {});
1592
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.isLocked', {});
1442
1593
  }
1443
1594
  async signMessage(message) {
1444
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('agent.sign', { message });
1595
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('agent.sign', { message });
1445
1596
  }
1446
1597
  // Multi-user methods
1447
1598
  async createUser(email, password) {
1448
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('user.create', { email, password });
1599
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('user.create', { email, password });
1449
1600
  }
1450
1601
  async loginUser(email, password) {
1451
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('user.login', { email, password });
1602
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('user.login', { email, password });
1452
1603
  }
1453
1604
  async requestLoginVerification(email, appInfo) {
1454
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('user.requestVerification', { email, appInfo });
1605
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('user.requestVerification', { email, appInfo });
1455
1606
  }
1456
1607
  async verifyEmailCode(email, code, verificationType) {
1457
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('user.verifyEmail', { email, code, verificationType });
1608
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('user.verifyEmail', { email, code, verificationType });
1458
1609
  }
1459
1610
  /** Revokes this client's user token. The executor then closes the client's sockets. */
1460
1611
  async logout() {
1461
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('user.logout', {});
1612
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('user.logout', {});
1462
1613
  }
1463
1614
  /**
1464
1615
  * Revokes every token of a user issued up to now, this client's own included, and closes
@@ -1466,43 +1617,43 @@ class AgentClient {
1466
1617
  * user. Needs AGENT_UPDATE, which a login holds. Tokens from a later login work.
1467
1618
  */
1468
1619
  async revokeAllSessions(email) {
1469
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('user.revokeAllSessions', email === undefined ? {} : { email });
1620
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('user.revokeAllSessions', email === undefined ? {} : { email });
1470
1621
  }
1471
1622
  // Hosting methods
1472
1623
  async hostingUserInfo() {
1473
- const info = (await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('hosting.info', {})).userInfo ?? {
1624
+ const info = (await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('hosting.info', {})).userInfo ?? {
1474
1625
  email: '', credits: null, hotWalletAddress: null, freeAccess: false,
1475
1626
  };
1476
1627
  return new HostingUserInfo(info.email, info.freeAccess ? 'unlimited' : String(info.credits ?? 0), info.hotWalletAddress || undefined, !!info.freeAccess);
1477
1628
  }
1478
1629
  async computeLog(since, limit, userEmail) {
1479
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('runtime.computeLog', { since, limit, userEmail });
1630
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('runtime.computeLog', { since, limit, userEmail });
1480
1631
  }
1481
1632
  async setHotWalletAddress(address) {
1482
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('hosting.setHotWallet', { address });
1633
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('hosting.setHotWallet', { address });
1483
1634
  }
1484
1635
  async requestPayment(amountHOT) {
1485
- return __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('hosting.requestPayment', { amountHOT });
1636
+ return __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('hosting.requestPayment', { amountHOT });
1486
1637
  }
1487
1638
  }
1488
1639
  _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) {
1489
1640
  if (!agent.did)
1490
1641
  return;
1491
- __classPrivateFieldGet$c(this, _AgentClient_memCache, "f").set(agent.did, { promise: Promise.resolve(agent), ts: Date.now() });
1492
- __classPrivateFieldGet$c(this, _AgentClient_persistent, "f").put(agent.did, { agent, ts: Date.now() }); // fire-and-forget
1493
- __classPrivateFieldGet$c(this, _AgentClient_instances, "m", _AgentClient_listen).call(this);
1642
+ __classPrivateFieldGet$d(this, _AgentClient_memCache, "f").set(agent.did, { promise: Promise.resolve(agent), ts: Date.now() });
1643
+ __classPrivateFieldGet$d(this, _AgentClient_persistent, "f").put(agent.did, { agent, ts: Date.now() }); // fire-and-forget
1644
+ __classPrivateFieldGet$d(this, _AgentClient_instances, "m", _AgentClient_listen).call(this);
1494
1645
  }, _AgentClient_signLinks =
1495
1646
  /** Has the executor sign `links` as this agent, in a throwaway perspective. */
1496
1647
  async function _AgentClient_signLinks(links) {
1497
- const { uuid } = await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('perspective.create', { name: 'Agent Perspective Proxy' });
1648
+ const { uuid } = await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('perspective.create', { name: 'Agent Perspective Proxy' });
1498
1649
  try {
1499
- return (await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('perspective.addLinks', { uuid, links, status: 'SHARED' })).map(LinkExpression.fromWire);
1650
+ return (await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('perspective.addLinks', { uuid, links, status: 'SHARED' })).map(LinkExpression.fromWire);
1500
1651
  }
1501
1652
  finally {
1502
- await __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").call('perspective.remove', { uuid });
1653
+ await __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").call('perspective.remove', { uuid });
1503
1654
  }
1504
1655
  }, _AgentClient_listen = function _AgentClient_listen() {
1505
- __classPrivateFieldGet$c(this, _AgentClient_apiClient, "f").on('agent-updated', __classPrivateFieldGet$c(this, _AgentClient_onAgentUpdated, "f"));
1656
+ __classPrivateFieldGet$d(this, _AgentClient_apiClient, "f").on('agent-updated', __classPrivateFieldGet$d(this, _AgentClient_onAgentUpdated, "f"));
1506
1657
  };
1507
1658
  /** TTL for remote (non-self) agent profiles in L1 cache (ms). */
1508
1659
  AgentClient.REMOTE_AGENT_TTL_MS = 5 * 60000; // 5 minutes
@@ -1510,13 +1661,13 @@ AgentClient.REMOTE_AGENT_TTL_MS = 5 * 60000; // 5 minutes
1510
1661
  * After this window any restart triggers a fresh network fetch. */
1511
1662
  AgentClient.REMOTE_AGENT_TTL_L2_MS = 5 * 60000; // 5 minutes
1512
1663
 
1513
- var __classPrivateFieldSet$b = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1664
+ var __classPrivateFieldSet$c = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1514
1665
  if (kind === "m") throw new TypeError("Private method is not writable");
1515
1666
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1516
1667
  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");
1517
1668
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1518
1669
  };
1519
- var __classPrivateFieldGet$b = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1670
+ var __classPrivateFieldGet$c = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1520
1671
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1521
1672
  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");
1522
1673
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -1525,34 +1676,34 @@ var _LanguageClient_apiClient;
1525
1676
  class LanguageClient {
1526
1677
  constructor(baseUrl, token, sharedApiClient) {
1527
1678
  _LanguageClient_apiClient.set(this, void 0);
1528
- __classPrivateFieldSet$b(this, _LanguageClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
1679
+ __classPrivateFieldSet$c(this, _LanguageClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
1529
1680
  }
1530
1681
  async byAddress(address) {
1531
- return __classPrivateFieldGet$b(this, _LanguageClient_apiClient, "f").call('language.get', { address });
1682
+ return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call('language.get', { address });
1532
1683
  }
1533
1684
  async byFilter(filter) {
1534
- return __classPrivateFieldGet$b(this, _LanguageClient_apiClient, "f").call('language.all', { filter });
1685
+ return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call('language.all', { filter });
1535
1686
  }
1536
1687
  async all() {
1537
- return __classPrivateFieldGet$b(this, _LanguageClient_apiClient, "f").call('language.all', {});
1688
+ return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call('language.all', {});
1538
1689
  }
1539
1690
  async writeSettings(languageAddress, settings) {
1540
- return __classPrivateFieldGet$b(this, _LanguageClient_apiClient, "f").call('language.writeSettings', { address: languageAddress, settings });
1691
+ return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call('language.writeSettings', { address: languageAddress, settings });
1541
1692
  }
1542
1693
  async applyTemplateAndPublish(sourceLanguageHash, templateData, options) {
1543
- return __classPrivateFieldGet$b(this, _LanguageClient_apiClient, "f").call('language.applyTemplate', { sourceLanguageHash, templateData }, options);
1694
+ return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call('language.applyTemplate', { sourceLanguageHash, templateData }, options);
1544
1695
  }
1545
1696
  async publish(languagePath, languageMeta, options) {
1546
- return __classPrivateFieldGet$b(this, _LanguageClient_apiClient, "f").call('language.publish', { languagePath, languageMeta }, options);
1697
+ return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call('language.publish', { languagePath, languageMeta }, options);
1547
1698
  }
1548
1699
  async meta(address) {
1549
- return __classPrivateFieldGet$b(this, _LanguageClient_apiClient, "f").call('language.meta', { address });
1700
+ return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call('language.meta', { address });
1550
1701
  }
1551
1702
  async source(address) {
1552
- return __classPrivateFieldGet$b(this, _LanguageClient_apiClient, "f").call('language.source', { address });
1703
+ return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call('language.source', { address });
1553
1704
  }
1554
1705
  async remove(address) {
1555
- return __classPrivateFieldGet$b(this, _LanguageClient_apiClient, "f").call('language.remove', { address });
1706
+ return __classPrivateFieldGet$c(this, _LanguageClient_apiClient, "f").call('language.remove', { address });
1556
1707
  }
1557
1708
  }
1558
1709
  _LanguageClient_apiClient = new WeakMap();
@@ -1604,13 +1755,13 @@ function neighbourhoodExpressionFromWire(wire) {
1604
1755
  return new NeighbourhoodExpression(wire.author, wire.timestamp, new Neighbourhood(wire.data.linkLanguage, meta), wire.proof);
1605
1756
  }
1606
1757
 
1607
- var __classPrivateFieldSet$a = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1758
+ var __classPrivateFieldSet$b = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
1608
1759
  if (kind === "m") throw new TypeError("Private method is not writable");
1609
1760
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1610
1761
  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");
1611
1762
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
1612
1763
  };
1613
- var __classPrivateFieldGet$a = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1764
+ var __classPrivateFieldGet$b = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
1614
1765
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1615
1766
  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");
1616
1767
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -1621,59 +1772,59 @@ class NeighbourhoodClient {
1621
1772
  _NeighbourhoodClient_apiClient.set(this, void 0);
1622
1773
  _NeighbourhoodClient_signalHandlers.set(this, new Map());
1623
1774
  _NeighbourhoodClient_signalUnsubscribers.set(this, new Map());
1624
- __classPrivateFieldSet$a(this, _NeighbourhoodClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
1775
+ __classPrivateFieldSet$b(this, _NeighbourhoodClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
1625
1776
  }
1626
1777
  async publishFromPerspective(perspectiveUUID, linkLanguage, meta, options) {
1627
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.publish', {
1778
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.publish', {
1628
1779
  perspectiveUuid: perspectiveUUID, linkLanguage, meta: Perspective.toWire(meta)
1629
1780
  }, options);
1630
1781
  }
1631
1782
  async joinFromUrl(url, options) {
1632
- return PerspectiveHandle.fromWire(await __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.join', { url }, options));
1783
+ return PerspectiveHandle.fromWire(await __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.join', { url }, options));
1633
1784
  }
1634
1785
  async otherAgents(perspectiveUUID) {
1635
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.otherAgents', { uuid: perspectiveUUID });
1786
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.otherAgents', { uuid: perspectiveUUID });
1636
1787
  }
1637
1788
  async hasTelepresenceAdapter(perspectiveUUID) {
1638
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.hasTelepresence', { uuid: perspectiveUUID });
1789
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.hasTelepresence', { uuid: perspectiveUUID });
1639
1790
  }
1640
1791
  async onlineAgents(perspectiveUUID) {
1641
- const agents = await __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.onlineAgents', { uuid: perspectiveUUID });
1792
+ const agents = await __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.onlineAgents', { uuid: perspectiveUUID });
1642
1793
  return agents.map(({ did, status }) => ({ did, status: PerspectiveExpression.fromWire(status) }));
1643
1794
  }
1644
1795
  /** The caller's own online status, as it last set it on this executor, or `null`. */
1645
1796
  async ownOnlineStatus(perspectiveUUID) {
1646
- const status = await __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.ownOnlineStatus', { uuid: perspectiveUUID });
1797
+ const status = await __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.ownOnlineStatus', { uuid: perspectiveUUID });
1647
1798
  return status ? PerspectiveExpression.fromWire(status) : null;
1648
1799
  }
1649
1800
  async setOnlineStatus(perspectiveUUID, status) {
1650
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.setOnlineStatus', { uuid: perspectiveUUID, status: Perspective.toWire(status) });
1801
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.setOnlineStatus', { uuid: perspectiveUUID, status: Perspective.toWire(status) });
1651
1802
  }
1652
1803
  async setOnlineStatusU(perspectiveUUID, status) {
1653
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.setOnlineStatus', { uuid: perspectiveUUID, status, signed: false });
1804
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.setOnlineStatus', { uuid: perspectiveUUID, status, signed: false });
1654
1805
  }
1655
1806
  async sendSignal(perspectiveUUID, remoteAgentDid, payload) {
1656
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.sendSignal', {
1807
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.sendSignal', {
1657
1808
  uuid: perspectiveUUID, remoteAgentDid, payload: Perspective.toWire(payload)
1658
1809
  });
1659
1810
  }
1660
1811
  async sendSignalU(perspectiveUUID, remoteAgentDid, payload) {
1661
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.sendSignal', {
1812
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.sendSignal', {
1662
1813
  uuid: perspectiveUUID, remoteAgentDid, payload, signed: false
1663
1814
  });
1664
1815
  }
1665
1816
  async sendBroadcast(perspectiveUUID, payload, loopback = false) {
1666
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.sendBroadcast', {
1817
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.sendBroadcast', {
1667
1818
  uuid: perspectiveUUID, payload: Perspective.toWire(payload), loopback
1668
1819
  });
1669
1820
  }
1670
1821
  async sendBroadcastU(perspectiveUUID, payload, loopback = false) {
1671
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.sendBroadcast', {
1822
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call('neighbourhood.sendBroadcast', {
1672
1823
  uuid: perspectiveUUID, payload, loopback, signed: false
1673
1824
  });
1674
1825
  }
1675
1826
  dispatchSignal(perspectiveUUID, signal) {
1676
- const handlers = __classPrivateFieldGet$a(this, _NeighbourhoodClient_signalHandlers, "f").get(perspectiveUUID);
1827
+ const handlers = __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalHandlers, "f").get(perspectiveUUID);
1677
1828
  if (handlers) {
1678
1829
  for (const handler of handlers) {
1679
1830
  try {
@@ -1686,15 +1837,15 @@ class NeighbourhoodClient {
1686
1837
  }
1687
1838
  }
1688
1839
  async subscribeToSignals(perspectiveUUID) {
1689
- const unsub = __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").on('signal', (event) => this.dispatchSignal(perspectiveUUID, PerspectiveExpression.fromWire(event.signal)), { perspective: perspectiveUUID });
1690
- __classPrivateFieldGet$a(this, _NeighbourhoodClient_signalUnsubscribers, "f").set(perspectiveUUID, unsub);
1691
- await __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").watchApplied();
1840
+ const unsub = __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").on('signal', (event) => this.dispatchSignal(perspectiveUUID, PerspectiveExpression.fromWire(event.signal)), { perspective: perspectiveUUID });
1841
+ __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalUnsubscribers, "f").set(perspectiveUUID, unsub);
1842
+ await __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").watchApplied();
1692
1843
  }
1693
1844
  async addSignalHandler(perspectiveUUID, handler) {
1694
- let handlersForPerspective = __classPrivateFieldGet$a(this, _NeighbourhoodClient_signalHandlers, "f").get(perspectiveUUID);
1845
+ let handlersForPerspective = __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalHandlers, "f").get(perspectiveUUID);
1695
1846
  if (!handlersForPerspective) {
1696
1847
  handlersForPerspective = [];
1697
- __classPrivateFieldGet$a(this, _NeighbourhoodClient_signalHandlers, "f").set(perspectiveUUID, handlersForPerspective);
1848
+ __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalHandlers, "f").set(perspectiveUUID, handlersForPerspective);
1698
1849
  handlersForPerspective.push(handler);
1699
1850
  await this.subscribeToSignals(perspectiveUUID);
1700
1851
  }
@@ -1703,18 +1854,18 @@ class NeighbourhoodClient {
1703
1854
  }
1704
1855
  }
1705
1856
  removeSignalHandler(perspectiveUUID, handler) {
1706
- const handlersForPerspective = __classPrivateFieldGet$a(this, _NeighbourhoodClient_signalHandlers, "f").get(perspectiveUUID);
1857
+ const handlersForPerspective = __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalHandlers, "f").get(perspectiveUUID);
1707
1858
  if (handlersForPerspective) {
1708
1859
  const index = handlersForPerspective.indexOf(handler);
1709
1860
  if (index > -1) {
1710
1861
  handlersForPerspective.splice(index, 1);
1711
1862
  }
1712
1863
  if (handlersForPerspective.length === 0) {
1713
- __classPrivateFieldGet$a(this, _NeighbourhoodClient_signalHandlers, "f").delete(perspectiveUUID);
1714
- const unsub = __classPrivateFieldGet$a(this, _NeighbourhoodClient_signalUnsubscribers, "f").get(perspectiveUUID);
1864
+ __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalHandlers, "f").delete(perspectiveUUID);
1865
+ const unsub = __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalUnsubscribers, "f").get(perspectiveUUID);
1715
1866
  if (unsub) {
1716
1867
  unsub();
1717
- __classPrivateFieldGet$a(this, _NeighbourhoodClient_signalUnsubscribers, "f").delete(perspectiveUUID);
1868
+ __classPrivateFieldGet$b(this, _NeighbourhoodClient_signalUnsubscribers, "f").delete(perspectiveUUID);
1718
1869
  }
1719
1870
  }
1720
1871
  }
@@ -1727,49 +1878,65 @@ class NeighbourhoodClient {
1727
1878
  // structured `CallSessionInfo` (SDP answer + optional cascade
1728
1879
  // redirect + stream mapping).
1729
1880
  async sfuStartRoom(neighbourhoodUrl, roomName) {
1730
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.startRoom", { neighbourhoodUrl, roomName });
1881
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.startRoom", { neighbourhoodUrl, roomName });
1731
1882
  }
1732
1883
  async sfuStopRoom(neighbourhoodUrl, roomName) {
1733
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.stopRoom", { neighbourhoodUrl, roomName });
1884
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.stopRoom", { neighbourhoodUrl, roomName });
1734
1885
  }
1735
1886
  async sfuListRooms() {
1736
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.listRooms", {});
1887
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.listRooms", {});
1737
1888
  }
1738
1889
  async sfuCallJoin(neighbourhoodUrl, roomName, sdpOffer) {
1739
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callJoin", {
1890
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callJoin", {
1740
1891
  neighbourhoodUrl,
1741
1892
  roomName,
1742
1893
  sdpOffer,
1743
1894
  });
1744
1895
  }
1745
1896
  async sfuCallLeave(neighbourhoodUrl, roomName) {
1746
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callLeave", { neighbourhoodUrl, roomName });
1897
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callLeave", { neighbourhoodUrl, roomName });
1747
1898
  }
1748
1899
  async sfuCallSetQualityPreference(neighbourhoodUrl, roomName, preference) {
1749
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callSetQualityPreference", {
1900
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callSetQualityPreference", {
1750
1901
  neighbourhoodUrl,
1751
1902
  roomName,
1752
1903
  preference,
1753
1904
  });
1754
1905
  }
1755
1906
  async sfuCallAnswerServerOffer(neighbourhoodUrl, roomName, sdpAnswer) {
1756
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callAnswerServerOffer", {
1907
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callAnswerServerOffer", {
1757
1908
  neighbourhoodUrl,
1758
1909
  roomName,
1759
1910
  sdpAnswer,
1760
1911
  });
1761
1912
  }
1913
+ /** Ask the SFU to restart ICE on this agent's call connection. The offer
1914
+ * arrives as an `sfu-call-renegotiation-offer` event; answer it with
1915
+ * {@link sfuCallAnswerServerOffer}. */
1916
+ async sfuCallRestartIce(neighbourhoodUrl, roomName) {
1917
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.callRestartIce", { neighbourhoodUrl, roomName });
1918
+ }
1919
+ /** Fires after a network change, once the client's socket is back on
1920
+ * the new network. See {@link ApiClient.onNetworkChange}. */
1921
+ onNetworkChange(callback) {
1922
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").onNetworkChange(callback);
1923
+ }
1924
+ /** Check the client's socket now: one that says nothing within a
1925
+ * deadline is treated as a network change. See {@link ApiClient.checkConnection}. */
1926
+ checkConnection() {
1927
+ __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").checkConnection();
1928
+ }
1762
1929
  async sfuGetConfig(neighbourhoodUrl) {
1763
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.getConfig", { neighbourhoodUrl });
1930
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.getConfig", { neighbourhoodUrl });
1764
1931
  }
1765
1932
  async sfuSetConfig(neighbourhoodUrl, config) {
1766
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.setConfig", { neighbourhoodUrl, config });
1933
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.setConfig", { neighbourhoodUrl, config });
1767
1934
  }
1768
1935
  async sfuPeerForNeighbourhood(neighbourhoodUrl) {
1769
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.sfuPeerForNeighbourhood", { neighbourhoodUrl });
1936
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.sfuPeerForNeighbourhood", { neighbourhoodUrl });
1770
1937
  }
1771
1938
  async sfuPeersForNeighbourhood(neighbourhoodUrl) {
1772
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.sfuPeersForNeighbourhood", { neighbourhoodUrl });
1939
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.sfuPeersForNeighbourhood", { neighbourhoodUrl });
1773
1940
  }
1774
1941
  // ── Trickle ICE ───────────────────────────────────────────────────
1775
1942
  /**
@@ -1781,7 +1948,7 @@ class NeighbourhoodClient {
1781
1948
  * networks).
1782
1949
  */
1783
1950
  async sfuAddIceCandidate(neighbourhoodUrl, roomName, candidate) {
1784
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.addIceCandidate", {
1951
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.addIceCandidate", {
1785
1952
  neighbourhoodUrl,
1786
1953
  roomName,
1787
1954
  candidate,
@@ -1794,7 +1961,7 @@ class NeighbourhoodClient {
1794
1961
  * publishes it as an `sfu-data` event.
1795
1962
  */
1796
1963
  async sfuSendData(neighbourhoodUrl, roomName, channelLabel, data, binary = false) {
1797
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.sendData", {
1964
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.sendData", {
1798
1965
  neighbourhoodUrl,
1799
1966
  roomName,
1800
1967
  channelLabel,
@@ -1810,11 +1977,11 @@ class NeighbourhoodClient {
1810
1977
  subscribeSfuDataChannel(callback) {
1811
1978
  // A fresh handler per call: `on` merges a repeated handler, and
1812
1979
  // each subscription must own its unsubscribe.
1813
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").on("sfu-data", (message) => callback(message));
1980
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").on("sfu-data", (message) => callback(message));
1814
1981
  }
1815
1982
  /** Subscribe to the rosters of the call rooms this agent is in: who is in each, whenever that changes. */
1816
1983
  subscribeSfuRoomRoster(callback) {
1817
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").on("sfu-room-roster", (roster) => callback(roster));
1984
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").on("sfu-room-roster", (roster) => callback(roster));
1818
1985
  }
1819
1986
  /**
1820
1987
  * Subscribe to server-pushed SFU SDP renegotiation offers. The
@@ -1828,7 +1995,7 @@ class NeighbourhoodClient {
1828
1995
  * Returns an unsubscribe function.
1829
1996
  */
1830
1997
  subscribeSfuCallRenegotiationOffer(targetDid, callback) {
1831
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").on("sfu-call-renegotiation-offer", (event) => {
1998
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").on("sfu-call-renegotiation-offer", (event) => {
1832
1999
  if (event.targetDid !== targetDid)
1833
2000
  return;
1834
2001
  callback({
@@ -1847,7 +2014,7 @@ class NeighbourhoodClient {
1847
2014
  * node. Returns an unsubscribe function.
1848
2015
  */
1849
2016
  subscribeSfuMigrateEvent(targetDid, callback) {
1850
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").on("sfu-migrate", (event) => {
2017
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").on("sfu-migrate", (event) => {
1851
2018
  if (event.targetDid !== targetDid)
1852
2019
  return;
1853
2020
  callback({
@@ -1867,12 +2034,12 @@ class NeighbourhoodClient {
1867
2034
  * @param perspectiveId The neighbourhood's perspective handle UUID.
1868
2035
  */
1869
2036
  async sfuServesAllMembers(perspectiveId) {
1870
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.servesAllMembers", { uuid: perspectiveId });
2037
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.servesAllMembers", { uuid: perspectiveId });
1871
2038
  }
1872
2039
  // ── SFU diagnostic / test-harness endpoints ────────────────────────
1873
2040
  /** The calling agent's own DID — the user's, for a user token. */
1874
2041
  async callerDid() {
1875
- return (await __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("agent.status", {})).did;
2042
+ return (await __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("agent.status", {})).did;
1876
2043
  }
1877
2044
  /**
1878
2045
  * Read-only: SFU service status including public reachability.
@@ -1881,7 +2048,7 @@ class NeighbourhoodClient {
1881
2048
  * determine its reachability (unknown).
1882
2049
  */
1883
2050
  async sfuStatus() {
1884
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.status", {});
2051
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.status", {});
1885
2052
  }
1886
2053
  /**
1887
2054
  * Read-only: how many SFU↔SFU pipe transports are fully established,
@@ -1889,14 +2056,14 @@ class NeighbourhoodClient {
1889
2056
  * assertions.
1890
2057
  */
1891
2058
  async sfuCascadeStatus() {
1892
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.cascadeStatus", {});
2059
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.cascadeStatus", {});
1893
2060
  }
1894
2061
  /**
1895
2062
  * Read-only: per-participant quality preferences the SFU event loop
1896
2063
  * currently holds. Returns `[{participantId, preference}, ...]`.
1897
2064
  */
1898
2065
  async sfuQualityPreferences() {
1899
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.qualityPreferences", {});
2066
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.qualityPreferences", {});
1900
2067
  }
1901
2068
  /**
1902
2069
  * Register a DID as a neighbourhood member on this executor.
@@ -1905,7 +2072,7 @@ class NeighbourhoodClient {
1905
2072
  * deployments.
1906
2073
  */
1907
2074
  async sfuEnsureMembership(neighbourhoodUrl, did) {
1908
- return __classPrivateFieldGet$a(this, _NeighbourhoodClient_apiClient, "f").call("sfu.ensureMembership", {
2075
+ return __classPrivateFieldGet$b(this, _NeighbourhoodClient_apiClient, "f").call("sfu.ensureMembership", {
1909
2076
  neighbourhoodUrl,
1910
2077
  did,
1911
2078
  });
@@ -1957,10 +2124,17 @@ class SfuManager {
1957
2124
  this.qualityPreference = null;
1958
2125
  /** Server offers waiting to be applied, in arrival order, one at a time. */
1959
2126
  this.offerQueue = Promise.resolve();
2127
+ /** The last server offer answered. The executor sends an unanswered
2128
+ * restart offer again when asked twice; one that was answered meanwhile
2129
+ * must not be answered again, or that answer lands on its next offer. */
2130
+ this.answeredOffer = null;
1960
2131
  this.renegotiationUnsubscribe = null;
1961
2132
  this.rosterUnsubscribe = null;
1962
2133
  this.dataChannelUnsubscribe = null;
1963
- this.disconnectedTimer = null;
2134
+ /** An ICE restart is in flight until this fires: ICE going disconnected
2135
+ * again joins it, a network change replaces it. */
2136
+ this.restartTimer = null;
2137
+ this.networkUnsubscribe = null;
1964
2138
  /** Running while the room's roster leaves this agent out: see `noticeRoster`. */
1965
2139
  this.unlistedTimer = null;
1966
2140
  this.neighbourhood = neighbourhood;
@@ -2015,6 +2189,7 @@ class SfuManager {
2015
2189
  }
2016
2190
  console.info(`SFU: connection failed, reconnecting (${this.reconnectAttempts}/${SfuManager.MAX_RECONNECTS})`);
2017
2191
  this.reconnecting = true;
2192
+ this.endRestart();
2018
2193
  try {
2019
2194
  const deadline = Date.now() + SfuManager.REJOIN_WINDOW_MS;
2020
2195
  for (let delay = 1000;; delay = Math.min(delay * 2, 10000)) {
@@ -2057,6 +2232,38 @@ class SfuManager {
2057
2232
  this.reconnecting = false;
2058
2233
  }
2059
2234
  }
2235
+ /**
2236
+ * Repair the connection in place: the SFU offers new ICE credentials
2237
+ * (`sfuCallRestartIce`), the offer is answered like any server offer,
2238
+ * and the browser gathers candidates on whatever network it has now.
2239
+ * DTLS, tracks and the room slot stay. If the connection is not back
2240
+ * within `RESTART_TIMEOUT_MS`, the call is rebuilt. One restart at a
2241
+ * time: a call while one is in flight does nothing.
2242
+ */
2243
+ restartIce(pc) {
2244
+ if (this.restartTimer || this.reconnecting || this.state.peerConnection !== pc)
2245
+ return;
2246
+ console.info("SFU: restarting ICE");
2247
+ this.restartTimer = setTimeout(() => {
2248
+ this.restartTimer = null;
2249
+ if (this.state.peerConnection !== pc)
2250
+ return;
2251
+ if (pc.iceConnectionState === "connected" || pc.iceConnectionState === "completed")
2252
+ return;
2253
+ void this.reconnect();
2254
+ }, SfuManager.RESTART_TIMEOUT_MS);
2255
+ // A refusal (an executor without the method, or one that lost this
2256
+ // session) leaves the decision to the timeout: a blip may still heal.
2257
+ this.neighbourhood.sfuCallRestartIce(this.neighbourhoodUrl, this.roomId).catch((err) => {
2258
+ console.warn("SFU: ICE restart refused:", err);
2259
+ });
2260
+ }
2261
+ endRestart() {
2262
+ if (this.restartTimer) {
2263
+ clearTimeout(this.restartTimer);
2264
+ this.restartTimer = null;
2265
+ }
2266
+ }
2060
2267
  on(event, callback) {
2061
2268
  if (!this.callbacks.has(event)) {
2062
2269
  this.callbacks.set(event, []);
@@ -2095,48 +2302,45 @@ class SfuManager {
2095
2302
  this.state.localStream = localStream;
2096
2303
  const pc = new RTCPeerConnection({ iceServers: this.iceServers });
2097
2304
  this.state.peerConnection = pc;
2098
- // ICE state monitoring for reconnecting.
2099
- // "disconnected" is often transient (network blip, route change):
2100
- // the connection gets the same grace the server gives it before
2101
- // dropping the peer, and a rebuild only follows once the server
2102
- // would have dropped it anyway. "failed" reconnects at once.
2305
+ // ICE state monitoring for recovery. "disconnected" (a route change,
2306
+ // a network switch, a blip) restarts ICE on this connection at once;
2307
+ // "failed" rebuilds the call at once.
2103
2308
  pc.oniceconnectionstatechange = () => {
2104
2309
  if (this.state.peerConnection !== pc)
2105
2310
  return; // superseded
2106
2311
  if (pc.iceConnectionState === "failed") {
2107
- if (this.disconnectedTimer) {
2108
- clearTimeout(this.disconnectedTimer);
2109
- this.disconnectedTimer = null;
2110
- }
2111
- this.reconnect();
2312
+ this.endRestart();
2313
+ void this.reconnect();
2112
2314
  }
2113
2315
  else if (pc.iceConnectionState === "disconnected") {
2114
- if (!this.disconnectedTimer) {
2115
- this.disconnectedTimer = setTimeout(() => {
2116
- this.disconnectedTimer = null;
2117
- // Only reconnect if this pc is still the active one
2118
- // and still disconnected.
2119
- if (this.state.peerConnection === pc &&
2120
- pc.iceConnectionState === "disconnected") {
2121
- this.reconnect();
2122
- }
2123
- }, SfuManager.DISCONNECT_GRACE_MS);
2124
- }
2316
+ // The path may be gone with no `online` event; the restart
2317
+ // needs a live socket, and a dead one is redialled in seconds.
2318
+ this.neighbourhood.checkConnection();
2319
+ this.restartIce(pc);
2125
2320
  }
2126
- else {
2127
- // Any other state (connected, completed, checking) cancels
2128
- // the pending disconnected timer; a working path ends a run
2129
- // of reconnects.
2130
- if (pc.iceConnectionState === "connected" ||
2131
- pc.iceConnectionState === "completed") {
2132
- this.reconnectAttempts = 0;
2133
- }
2134
- if (this.disconnectedTimer) {
2135
- clearTimeout(this.disconnectedTimer);
2136
- this.disconnectedTimer = null;
2137
- }
2321
+ else if (pc.iceConnectionState === "connected" ||
2322
+ pc.iceConnectionState === "completed") {
2323
+ // A working path ends a restart and a run of reconnects.
2324
+ this.reconnectAttempts = 0;
2325
+ this.endRestart();
2138
2326
  }
2139
2327
  };
2328
+ // A network change: the path ICE uses is likely gone, though ICE may
2329
+ // not have noticed yet. Restart it now, on the socket the change
2330
+ // reconnected, with its own timeout. If a restart's offer is still
2331
+ // unanswered (it went out over the old network and may never have
2332
+ // arrived), the executor sends it again and, once it is answered,
2333
+ // restarts again for this network. Listened to once per call, not
2334
+ // per rebuild.
2335
+ if (!this.networkUnsubscribe) {
2336
+ this.networkUnsubscribe = this.neighbourhood.onNetworkChange(() => {
2337
+ const current = this.state.peerConnection;
2338
+ if (!current || this.reconnecting)
2339
+ return;
2340
+ this.endRestart();
2341
+ this.restartIce(current);
2342
+ });
2343
+ }
2140
2344
  // Both kinds of local media, send-only, declared now whether or not a
2141
2345
  // track exists yet: the SFU only ever receives on these sections, and a
2142
2346
  // camera or screen started later replaces an empty track with no
@@ -2325,7 +2529,7 @@ class SfuManager {
2325
2529
  }
2326
2530
  /** Apply one server offer to `pc` and answer it, unless `pc` is no longer the call's. */
2327
2531
  async applyServerOffer(pc, event) {
2328
- if (this.state.peerConnection !== pc)
2532
+ if (this.state.peerConnection !== pc || event.sdpOffer === this.answeredOffer)
2329
2533
  return;
2330
2534
  // The mapping first: the tracks this offer adds arrive while it is applied.
2331
2535
  for (const entry of event.trackMapping ?? []) {
@@ -2335,6 +2539,7 @@ class SfuManager {
2335
2539
  await pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(event.sdpOffer)));
2336
2540
  await pc.setLocalDescription(await pc.createAnswer());
2337
2541
  await this.neighbourhood.sfuCallAnswerServerOffer(this.neighbourhoodUrl, event.roomName, JSON.stringify(pc.localDescription));
2542
+ this.answeredOffer = event.sdpOffer;
2338
2543
  }
2339
2544
  catch (err) {
2340
2545
  if (this.state.peerConnection !== pc)
@@ -2395,10 +2600,9 @@ class SfuManager {
2395
2600
  async leave() {
2396
2601
  this.generation++;
2397
2602
  this.releaseServerEvents();
2398
- if (this.disconnectedTimer) {
2399
- clearTimeout(this.disconnectedTimer);
2400
- this.disconnectedTimer = null;
2401
- }
2603
+ this.endRestart();
2604
+ this.networkUnsubscribe?.();
2605
+ this.networkUnsubscribe = null;
2402
2606
  this.senders.clear();
2403
2607
  this.replacedTracks.clear();
2404
2608
  this.qualityPreference = null;
@@ -2529,8 +2733,8 @@ class SfuManager {
2529
2733
  SfuManager.MAX_RECONNECTS = 3;
2530
2734
  /** How long one rebuild keeps retrying a join the executor cannot take yet. */
2531
2735
  SfuManager.REJOIN_WINDOW_MS = 120000;
2532
- /** How long ICE may stay disconnected before a rebuild: the executor's `ICE_DISCONNECT_GRACE`. */
2533
- SfuManager.DISCONNECT_GRACE_MS = 10000;
2736
+ /** How long an ICE restart has to bring the connection back before a rebuild. */
2737
+ SfuManager.RESTART_TIMEOUT_MS = 5000;
2534
2738
  /** How long the roster may leave this agent out before the call is rebuilt. */
2535
2739
  SfuManager.UNLISTED_GRACE_MS = 3000;
2536
2740
 
@@ -2842,6 +3046,7 @@ class MeshManager {
2842
3046
  * Cleared only when a renegotiation is answered.
2843
3047
  */
2844
3048
  this.renegotiationRepairs = new Map();
3049
+ this.unwatchNetwork = null;
2845
3050
  this.channel = options.channel;
2846
3051
  this.callId = options.callId;
2847
3052
  this.selfId = options.selfId;
@@ -2855,6 +3060,8 @@ class MeshManager {
2855
3060
  ?? ((configuration) => new RTCPeerConnection(configuration));
2856
3061
  this.now = options.now ?? (() => Date.now());
2857
3062
  this.sweepMs = options.sweepMs ?? SWEEP_INTERVAL_MS;
3063
+ this.onNetworkChange = options.onNetworkChange;
3064
+ this.checkConnection = options.checkConnection;
2858
3065
  }
2859
3066
  // ── Events ──────────────────────────────────────────────────────
2860
3067
  on(event, callback) {
@@ -2957,6 +3164,7 @@ class MeshManager {
2957
3164
  this.publish({ v: CALL_PROTOCOL_VERSION, call: this.callId, warm: true });
2958
3165
  if (this.sweepMs > 0)
2959
3166
  this.sweep = setInterval(() => this.tick(), this.sweepMs);
3167
+ this.unwatchNetwork = this.onNetworkChange?.(() => this.restartAll()) ?? null;
2960
3168
  }
2961
3169
  async leave() {
2962
3170
  this.closed = true;
@@ -2964,6 +3172,8 @@ class MeshManager {
2964
3172
  clearInterval(this.sweep);
2965
3173
  this.sweep = null;
2966
3174
  }
3175
+ this.unwatchNetwork?.();
3176
+ this.unwatchNetwork = null;
2967
3177
  this.unwatchPublish?.();
2968
3178
  this.unwatchPublish = null;
2969
3179
  if (this.channelUnsubscribe) {
@@ -3279,8 +3489,10 @@ class MeshManager {
3279
3489
  if (slot.offerDeferred && pc.signalingState === "stable")
3280
3490
  void negotiate();
3281
3491
  }
3282
- if (state === "disconnected" && !slot.disconnectedAt)
3492
+ if (state === "disconnected" && !slot.disconnectedAt) {
3283
3493
  slot.disconnectedAt = this.now();
3494
+ this.checkConnection?.();
3495
+ }
3284
3496
  if (state === "connected" || state === "failed")
3285
3497
  slot.disconnectedAt = 0;
3286
3498
  this.emit("peer-state", peerId, state);
@@ -3618,6 +3830,39 @@ class MeshManager {
3618
3830
  slot.attempts = attempts - 1;
3619
3831
  this.rebuild(peerId, { announce: true, rung: "rebuild" });
3620
3832
  }
3833
+ /**
3834
+ * The network changed: every pair's path is likely gone, though ICE has
3835
+ * noticed on none yet. Each negotiated pair takes the ladder's first rung
3836
+ * now, all at once — an ICE restart is one offer per pair, and waiting
3837
+ * for each to time out costs seconds of silence. Pairs still negotiating
3838
+ * have nothing to restart; the sweep keeps looking after them.
3839
+ *
3840
+ * It skips the sweep's guards (`outstanding`, one pair per sweep) on
3841
+ * purpose. They stop the sweep reading a slow send as a lost one and
3842
+ * escalating every pair at once. Here nothing is judged lost, and the
3843
+ * rung is the first one: one offer per pair, each to a different peer.
3844
+ * A restart offer that is lost falls to the sweep, guards and all.
3845
+ */
3846
+ restartAll() {
3847
+ if (this.closed)
3848
+ return;
3849
+ const at = this.now();
3850
+ for (const [peerId, slot] of this.slots) {
3851
+ if (!slot.remoteReady || typeof slot.pc.restartIce !== "function")
3852
+ continue;
3853
+ // Spaced from the sweep's next rung, but not charged to the pair's
3854
+ // budget: a network change judges no pair lost.
3855
+ slot.lastAttempt = at;
3856
+ try {
3857
+ slot.pc.restartIce();
3858
+ this.emit("peer-recovery", peerId, { rung: "ice-restart", attempts: slot.attempts });
3859
+ }
3860
+ catch (error) {
3861
+ this.fail(`restarting ice with ${peerId}`, error);
3862
+ }
3863
+ }
3864
+ this.lastRepairAt = at;
3865
+ }
3621
3866
  /** Whether this pair has been given long enough, and whether it is this side's turn to act. */
3622
3867
  dueForRepair(peerId, slot, at) {
3623
3868
  const state = slot.pc.connectionState;
@@ -3919,6 +4164,8 @@ function createSession(config) {
3919
4164
  callId: roomId,
3920
4165
  selfId: agentDid,
3921
4166
  ...(meshIce.length > 0 ? { iceServers: meshIce } : {}),
4167
+ onNetworkChange: (cb) => api.onNetworkChange(cb),
4168
+ checkConnection: () => api.checkConnection(),
3922
4169
  });
3923
4170
  meshManager = mesh;
3924
4171
  wireMeshEvents(mesh);
@@ -4090,13 +4337,13 @@ function createSession(config) {
4090
4337
  return session;
4091
4338
  }
4092
4339
 
4093
- var __classPrivateFieldSet$9 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
4340
+ var __classPrivateFieldSet$a = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
4094
4341
  if (kind === "m") throw new TypeError("Private method is not writable");
4095
4342
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4096
4343
  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");
4097
4344
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
4098
4345
  };
4099
- var __classPrivateFieldGet$9 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
4346
+ var __classPrivateFieldGet$a = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
4100
4347
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4101
4348
  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");
4102
4349
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -4112,9 +4359,9 @@ class NeighbourhoodProxy {
4112
4359
  );
4113
4360
  /** Cached SFU status — fetched once per proxy lifetime. */
4114
4361
  _NeighbourhoodProxy_sfuStatusCache.set(this, null);
4115
- __classPrivateFieldSet$9(this, _NeighbourhoodProxy_client, client, "f");
4116
- __classPrivateFieldSet$9(this, _NeighbourhoodProxy_pID, pID, "f");
4117
- __classPrivateFieldSet$9(this, _NeighbourhoodProxy_agentDid, agentDid, "f");
4362
+ __classPrivateFieldSet$a(this, _NeighbourhoodProxy_client, client, "f");
4363
+ __classPrivateFieldSet$a(this, _NeighbourhoodProxy_pID, pID, "f");
4364
+ __classPrivateFieldSet$a(this, _NeighbourhoodProxy_agentDid, agentDid, "f");
4118
4365
  }
4119
4366
  // ── Telepresence ────────────────────────────────────────────────────
4120
4367
  //
@@ -4122,51 +4369,51 @@ class NeighbourhoodProxy {
4122
4369
  // Routes through the neighbourhood's link language.
4123
4370
  /** List DIDs of agents who have joined this neighbourhood. */
4124
4371
  async otherAgents() {
4125
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").otherAgents(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"));
4372
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").otherAgents(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"));
4126
4373
  }
4127
4374
  /** Check whether the neighbourhood's link language supports telepresence. */
4128
4375
  async hasTelepresenceAdapter() {
4129
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").hasTelepresenceAdapter(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"));
4376
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").hasTelepresenceAdapter(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"));
4130
4377
  }
4131
4378
  /** List agents currently online in this neighbourhood. */
4132
4379
  async onlineAgents() {
4133
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").onlineAgents(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"));
4380
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").onlineAgents(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"));
4134
4381
  }
4135
4382
  /** This agent's own online status, as it last set it on this executor, or `null`. */
4136
4383
  async ownOnlineStatus() {
4137
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").ownOnlineStatus(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"));
4384
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").ownOnlineStatus(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"));
4138
4385
  }
4139
4386
  /** Set this agent's online status with a signed perspective payload. */
4140
4387
  async setOnlineStatus(status) {
4141
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").setOnlineStatus(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"), status);
4388
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").setOnlineStatus(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), status);
4142
4389
  }
4143
4390
  /** Set this agent's online status with an unsigned perspective payload. */
4144
4391
  async setOnlineStatusU(status) {
4145
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").setOnlineStatusU(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"), status);
4392
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").setOnlineStatusU(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), status);
4146
4393
  }
4147
4394
  /** Send a signed signal to a specific remote agent via the link language. */
4148
4395
  async sendSignal(remoteAgentDid, payload) {
4149
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sendSignal(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"), remoteAgentDid, payload);
4396
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sendSignal(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), remoteAgentDid, payload);
4150
4397
  }
4151
4398
  /** Send an unsigned signal to a specific remote agent via the link language. */
4152
4399
  async sendSignalU(remoteAgentDid, payload) {
4153
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sendSignalU(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"), remoteAgentDid, payload);
4400
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sendSignalU(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), remoteAgentDid, payload);
4154
4401
  }
4155
4402
  /** Broadcast a signed signal to all agents in the neighbourhood. */
4156
4403
  async sendBroadcast(payload, loopback = false) {
4157
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sendBroadcast(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"), payload, loopback);
4404
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sendBroadcast(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), payload, loopback);
4158
4405
  }
4159
4406
  /** Broadcast an unsigned signal to all agents in the neighbourhood. */
4160
4407
  async sendBroadcastU(payload, loopback = false) {
4161
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sendBroadcastU(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"), payload, loopback);
4408
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sendBroadcastU(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), payload, loopback);
4162
4409
  }
4163
4410
  /** Register a handler for incoming telepresence signals. */
4164
4411
  async addSignalHandler(handler) {
4165
- await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").addSignalHandler(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"), handler);
4412
+ await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").addSignalHandler(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), handler);
4166
4413
  }
4167
4414
  /** Remove a previously registered signal handler. */
4168
4415
  removeSignalHandler(handler) {
4169
- __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").removeSignalHandler(__classPrivateFieldGet$9(this, _NeighbourhoodProxy_pID, "f"), handler);
4416
+ __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").removeSignalHandler(__classPrivateFieldGet$a(this, _NeighbourhoodProxy_pID, "f"), handler);
4170
4417
  }
4171
4418
  // ── Sessions ────────────────────────────────────────────────────────
4172
4419
  //
@@ -4175,7 +4422,7 @@ class NeighbourhoodProxy {
4175
4422
  // cascade redirects, and failover internally.
4176
4423
  /** Active sessions in this neighbourhood. Destroyed sessions remove themselves. */
4177
4424
  get sessions() {
4178
- return __classPrivateFieldGet$9(this, _NeighbourhoodProxy_sessions, "f");
4425
+ return __classPrivateFieldGet$a(this, _NeighbourhoodProxy_sessions, "f");
4179
4426
  }
4180
4427
  /**
4181
4428
  * Create a WebRTC media session. Call `session.join(localStream)` to connect.
@@ -4187,16 +4434,16 @@ class NeighbourhoodProxy {
4187
4434
  async createSession(roomName, options) {
4188
4435
  // `perspective.getNeighbourhoodProxy()` builds the proxy without a DID; the session needs
4189
4436
  // the caller's own, so ask the executor once.
4190
- if (!__classPrivateFieldGet$9(this, _NeighbourhoodProxy_agentDid, "f")) {
4191
- __classPrivateFieldSet$9(this, _NeighbourhoodProxy_agentDid, (await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").callerDid()) ?? "", "f");
4437
+ if (!__classPrivateFieldGet$a(this, _NeighbourhoodProxy_agentDid, "f")) {
4438
+ __classPrivateFieldSet$a(this, _NeighbourhoodProxy_agentDid, (await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").callerDid()) ?? "", "f");
4192
4439
  }
4193
- if (!__classPrivateFieldGet$9(this, _NeighbourhoodProxy_agentDid, "f")) {
4440
+ if (!__classPrivateFieldGet$a(this, _NeighbourhoodProxy_agentDid, "f")) {
4194
4441
  throw new Error("Cannot create a call session: the executor reports no agent DID");
4195
4442
  }
4196
4443
  // Fetch SFU status once — reachability only changes at executor restart.
4197
- if (!__classPrivateFieldGet$9(this, _NeighbourhoodProxy_sfuStatusCache, "f")) {
4444
+ if (!__classPrivateFieldGet$a(this, _NeighbourhoodProxy_sfuStatusCache, "f")) {
4198
4445
  try {
4199
- __classPrivateFieldSet$9(this, _NeighbourhoodProxy_sfuStatusCache, await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuStatus(), "f");
4446
+ __classPrivateFieldSet$a(this, _NeighbourhoodProxy_sfuStatusCache, await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuStatus(), "f");
4200
4447
  }
4201
4448
  catch {
4202
4449
  // Non-fatal — session works without SFU advertisement.
@@ -4204,29 +4451,29 @@ class NeighbourhoodProxy {
4204
4451
  }
4205
4452
  const proxy = this;
4206
4453
  const session = createSession({
4207
- api: __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f"),
4454
+ api: __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f"),
4208
4455
  roomId: roomName,
4209
- agentDid: __classPrivateFieldGet$9(this, _NeighbourhoodProxy_agentDid, "f"),
4456
+ agentDid: __classPrivateFieldGet$a(this, _NeighbourhoodProxy_agentDid, "f"),
4210
4457
  neighbourhoodUrl: options?.neighbourhoodUrl ?? "",
4211
4458
  topology: options?.topology ?? "auto",
4212
4459
  sfuConfig: options?.sfuConfig,
4213
4460
  iceServers: options?.iceServers,
4214
- localSfuStatus: __classPrivateFieldGet$9(this, _NeighbourhoodProxy_sfuStatusCache, "f") ?? undefined,
4215
- sfuServesAllMembers: () => __classPrivateFieldGet$9(proxy, _NeighbourhoodProxy_client, "f").sfuServesAllMembers(__classPrivateFieldGet$9(proxy, _NeighbourhoodProxy_pID, "f")),
4461
+ localSfuStatus: __classPrivateFieldGet$a(this, _NeighbourhoodProxy_sfuStatusCache, "f") ?? undefined,
4462
+ sfuServesAllMembers: () => __classPrivateFieldGet$a(proxy, _NeighbourhoodProxy_client, "f").sfuServesAllMembers(__classPrivateFieldGet$a(proxy, _NeighbourhoodProxy_pID, "f")),
4216
4463
  // Mesh needs a signalling channel and presence callbacks.
4217
4464
  // SFU ignores these — they remain unused when the resolved
4218
4465
  // topology selects the SFU path.
4219
- channel: createTelepresenceChannel(proxy, __classPrivateFieldGet$9(proxy, _NeighbourhoodProxy_agentDid, "f")),
4466
+ channel: createTelepresenceChannel(proxy, __classPrivateFieldGet$a(proxy, _NeighbourhoodProxy_agentDid, "f")),
4220
4467
  ownOnlineStatus: () => proxy.ownOnlineStatus(),
4221
4468
  setOnlineStatus: (status) => proxy.setOnlineStatusU(status),
4222
4469
  onlineAgents: () => proxy.onlineAgents(),
4223
4470
  });
4224
- __classPrivateFieldGet$9(this, _NeighbourhoodProxy_sessions, "f").push(session);
4471
+ __classPrivateFieldGet$a(this, _NeighbourhoodProxy_sessions, "f").push(session);
4225
4472
  session.on("state-changed", (state) => {
4226
4473
  if (state === "closed") {
4227
- const idx = __classPrivateFieldGet$9(this, _NeighbourhoodProxy_sessions, "f").indexOf(session);
4474
+ const idx = __classPrivateFieldGet$a(this, _NeighbourhoodProxy_sessions, "f").indexOf(session);
4228
4475
  if (idx !== -1)
4229
- __classPrivateFieldGet$9(this, _NeighbourhoodProxy_sessions, "f").splice(idx, 1);
4476
+ __classPrivateFieldGet$a(this, _NeighbourhoodProxy_sessions, "f").splice(idx, 1);
4230
4477
  }
4231
4478
  });
4232
4479
  return session;
@@ -4238,37 +4485,37 @@ class NeighbourhoodProxy {
4238
4485
  // not per-neighbourhood, and the URL is owned by the consumer (Flux's
4239
4486
  // call context, the WE UI, etc).
4240
4487
  async sfuConfig(neighbourhoodUrl) {
4241
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuGetConfig(neighbourhoodUrl);
4488
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuGetConfig(neighbourhoodUrl);
4242
4489
  }
4243
4490
  async setSfuConfig(neighbourhoodUrl, config) {
4244
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuSetConfig(neighbourhoodUrl, config);
4491
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuSetConfig(neighbourhoodUrl, config);
4245
4492
  }
4246
4493
  async sfuPeer(neighbourhoodUrl) {
4247
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuPeerForNeighbourhood(neighbourhoodUrl);
4494
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuPeerForNeighbourhood(neighbourhoodUrl);
4248
4495
  }
4249
4496
  async sfuPeers(neighbourhoodUrl) {
4250
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuPeersForNeighbourhood(neighbourhoodUrl);
4497
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuPeersForNeighbourhood(neighbourhoodUrl);
4251
4498
  }
4252
4499
  async sfuStartRoom(neighbourhoodUrl, roomName) {
4253
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuStartRoom(neighbourhoodUrl, roomName);
4500
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuStartRoom(neighbourhoodUrl, roomName);
4254
4501
  }
4255
4502
  async sfuStopRoom(neighbourhoodUrl, roomName) {
4256
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuStopRoom(neighbourhoodUrl, roomName);
4503
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuStopRoom(neighbourhoodUrl, roomName);
4257
4504
  }
4258
4505
  async sfuListRooms() {
4259
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuListRooms();
4506
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuListRooms();
4260
4507
  }
4261
4508
  async callJoin(neighbourhoodUrl, roomName, sdpOffer) {
4262
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuCallJoin(neighbourhoodUrl, roomName, sdpOffer);
4509
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuCallJoin(neighbourhoodUrl, roomName, sdpOffer);
4263
4510
  }
4264
4511
  async callLeave(neighbourhoodUrl, roomName) {
4265
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuCallLeave(neighbourhoodUrl, roomName);
4512
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuCallLeave(neighbourhoodUrl, roomName);
4266
4513
  }
4267
4514
  async callSetQualityPreference(neighbourhoodUrl, roomName, preference) {
4268
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuCallSetQualityPreference(neighbourhoodUrl, roomName, preference);
4515
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuCallSetQualityPreference(neighbourhoodUrl, roomName, preference);
4269
4516
  }
4270
4517
  async callAnswerServerOffer(neighbourhoodUrl, roomName, sdpAnswer) {
4271
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuCallAnswerServerOffer(neighbourhoodUrl, roomName, sdpAnswer);
4518
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuCallAnswerServerOffer(neighbourhoodUrl, roomName, sdpAnswer);
4272
4519
  }
4273
4520
  /**
4274
4521
  * Subscribe to server-pushed renegotiation offers for `targetDid`.
@@ -4277,35 +4524,35 @@ class NeighbourhoodProxy {
4277
4524
  * underlying mechanism.
4278
4525
  */
4279
4526
  subscribeCallRenegotiationOffer(targetDid, callback) {
4280
- return __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").subscribeSfuCallRenegotiationOffer(targetDid, callback);
4527
+ return __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").subscribeSfuCallRenegotiationOffer(targetDid, callback);
4281
4528
  }
4282
4529
  /**
4283
4530
  * Subscribe to cascade rebalance migration events for `targetDid`.
4284
4531
  * Returns an unsubscribe function.
4285
4532
  */
4286
4533
  subscribeMigrateEvent(targetDid, callback) {
4287
- return __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").subscribeSfuMigrateEvent(targetDid, callback);
4534
+ return __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").subscribeSfuMigrateEvent(targetDid, callback);
4288
4535
  }
4289
4536
  // ── SFU trickle ICE ─────────────────────────────────────────────────
4290
4537
  async addIceCandidate(neighbourhoodUrl, roomName, candidate) {
4291
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuAddIceCandidate(neighbourhoodUrl, roomName, candidate);
4538
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuAddIceCandidate(neighbourhoodUrl, roomName, candidate);
4292
4539
  }
4293
4540
  // ── SFU data channel relay ────────────────────────────────────────
4294
4541
  async sendData(neighbourhoodUrl, roomName, channelLabel, data, binary = false) {
4295
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuSendData(neighbourhoodUrl, roomName, channelLabel, data, binary);
4542
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuSendData(neighbourhoodUrl, roomName, channelLabel, data, binary);
4296
4543
  }
4297
4544
  subscribeDataChannel(callback) {
4298
- return __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").subscribeSfuDataChannel(callback);
4545
+ return __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").subscribeSfuDataChannel(callback);
4299
4546
  }
4300
4547
  // ── SFU diagnostic / test-harness ──────────────────────────────────
4301
4548
  async sfuCascadeStatus() {
4302
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuCascadeStatus();
4549
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuCascadeStatus();
4303
4550
  }
4304
4551
  async sfuQualityPreferences() {
4305
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuQualityPreferences();
4552
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuQualityPreferences();
4306
4553
  }
4307
4554
  async sfuEnsureMembership(neighbourhoodUrl, did) {
4308
- return await __classPrivateFieldGet$9(this, _NeighbourhoodProxy_client, "f").sfuEnsureMembership(neighbourhoodUrl, did);
4555
+ return await __classPrivateFieldGet$a(this, _NeighbourhoodProxy_client, "f").sfuEnsureMembership(neighbourhoodUrl, did);
4309
4556
  }
4310
4557
  }
4311
4558
  _NeighbourhoodProxy_client = new WeakMap(), _NeighbourhoodProxy_pID = new WeakMap(), _NeighbourhoodProxy_agentDid = new WeakMap(), _NeighbourhoodProxy_sessions = new WeakMap(), _NeighbourhoodProxy_sfuStatusCache = new WeakMap();
@@ -4350,13 +4597,13 @@ class LinkQuery {
4350
4597
  }
4351
4598
  }
4352
4599
 
4353
- var __classPrivateFieldSet$8 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
4600
+ var __classPrivateFieldSet$9 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
4354
4601
  if (kind === "m") throw new TypeError("Private method is not writable");
4355
4602
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4356
4603
  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");
4357
4604
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
4358
4605
  };
4359
- var __classPrivateFieldGet$8 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
4606
+ var __classPrivateFieldGet$9 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
4360
4607
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4361
4608
  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");
4362
4609
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -4377,44 +4624,44 @@ class Literal {
4377
4624
  if (url.startsWith("literal://"))
4378
4625
  throw new Error("literal:// format is no longer supported. Use literal: instead.");
4379
4626
  const l = new Literal();
4380
- __classPrivateFieldSet$8(l, _Literal_url, url, "f");
4627
+ __classPrivateFieldSet$9(l, _Literal_url, url, "f");
4381
4628
  return l;
4382
4629
  }
4383
4630
  static from(literal) {
4384
4631
  const l = new Literal();
4385
- __classPrivateFieldSet$8(l, _Literal_literal, literal, "f");
4632
+ __classPrivateFieldSet$9(l, _Literal_literal, literal, "f");
4386
4633
  return l;
4387
4634
  }
4388
4635
  toUrl() {
4389
- if (__classPrivateFieldGet$8(this, _Literal_url, "f") && __classPrivateFieldGet$8(this, _Literal_literal, "f") === undefined)
4390
- return __classPrivateFieldGet$8(this, _Literal_url, "f");
4391
- if (__classPrivateFieldGet$8(this, _Literal_literal, "f") === undefined)
4636
+ if (__classPrivateFieldGet$9(this, _Literal_url, "f") && __classPrivateFieldGet$9(this, _Literal_literal, "f") === undefined)
4637
+ return __classPrivateFieldGet$9(this, _Literal_url, "f");
4638
+ if (__classPrivateFieldGet$9(this, _Literal_literal, "f") === undefined)
4392
4639
  throw new Error("Can't turn empty Literal into URL");
4393
4640
  let encoded;
4394
- switch (typeof __classPrivateFieldGet$8(this, _Literal_literal, "f")) {
4641
+ switch (typeof __classPrivateFieldGet$9(this, _Literal_literal, "f")) {
4395
4642
  case 'string':
4396
- encoded = `string:${encodeRFC3986URIComponent(__classPrivateFieldGet$8(this, _Literal_literal, "f"))}`;
4643
+ encoded = `string:${encodeRFC3986URIComponent(__classPrivateFieldGet$9(this, _Literal_literal, "f"))}`;
4397
4644
  break;
4398
4645
  case 'number':
4399
- encoded = `number:${encodeRFC3986URIComponent(__classPrivateFieldGet$8(this, _Literal_literal, "f"))}`;
4646
+ encoded = `number:${encodeRFC3986URIComponent(__classPrivateFieldGet$9(this, _Literal_literal, "f"))}`;
4400
4647
  break;
4401
4648
  case 'boolean':
4402
- encoded = `boolean:${encodeRFC3986URIComponent(__classPrivateFieldGet$8(this, _Literal_literal, "f"))}`;
4649
+ encoded = `boolean:${encodeRFC3986URIComponent(__classPrivateFieldGet$9(this, _Literal_literal, "f"))}`;
4403
4650
  break;
4404
4651
  case 'object':
4405
- encoded = `json:${encodeRFC3986URIComponent(JSON.stringify(__classPrivateFieldGet$8(this, _Literal_literal, "f")))}`;
4652
+ encoded = `json:${encodeRFC3986URIComponent(JSON.stringify(__classPrivateFieldGet$9(this, _Literal_literal, "f")))}`;
4406
4653
  break;
4407
4654
  }
4408
4655
  return `literal:${encoded}`;
4409
4656
  }
4410
4657
  get() {
4411
- if (__classPrivateFieldGet$8(this, _Literal_literal, "f") !== undefined)
4412
- return __classPrivateFieldGet$8(this, _Literal_literal, "f");
4413
- if (!__classPrivateFieldGet$8(this, _Literal_url, "f"))
4658
+ if (__classPrivateFieldGet$9(this, _Literal_literal, "f") !== undefined)
4659
+ return __classPrivateFieldGet$9(this, _Literal_literal, "f");
4660
+ if (!__classPrivateFieldGet$9(this, _Literal_url, "f"))
4414
4661
  throw new Error("Can't render empty Literal");
4415
- if (!__classPrivateFieldGet$8(this, _Literal_url, "f").startsWith("literal:"))
4662
+ if (!__classPrivateFieldGet$9(this, _Literal_url, "f").startsWith("literal:"))
4416
4663
  throw new Error("Can't render Literal from non-literal URL");
4417
- const body = __classPrivateFieldGet$8(this, _Literal_url, "f").substring(8);
4664
+ const body = __classPrivateFieldGet$9(this, _Literal_url, "f").substring(8);
4418
4665
  if (body.startsWith("string:")) {
4419
4666
  return decodeURIComponent(body.substring(7));
4420
4667
  }
@@ -6797,13 +7044,13 @@ function queryCacheSize() {
6797
7044
  return cache.size;
6798
7045
  }
6799
7046
 
6800
- var __classPrivateFieldSet$7 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7047
+ var __classPrivateFieldSet$8 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
6801
7048
  if (kind === "m") throw new TypeError("Private method is not writable");
6802
7049
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
6803
7050
  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");
6804
7051
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6805
7052
  };
6806
- var __classPrivateFieldGet$7 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
7053
+ var __classPrivateFieldGet$8 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
6807
7054
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
6808
7055
  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");
6809
7056
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -6889,30 +7136,30 @@ class LiveQuery {
6889
7136
  _LiveQuery_statusListeners.set(this, new Set()
6890
7137
  /** `open` subscribes on the executor; aborting its signal cancels the call. */
6891
7138
  );
6892
- __classPrivateFieldSet$7(this, _LiveQuery_client, client, "f");
6893
- __classPrivateFieldSet$7(this, _LiveQuery_uuid, uuid, "f");
6894
- __classPrivateFieldSet$7(this, _LiveQuery_open, open, "f");
6895
- __classPrivateFieldSet$7(this, _LiveQuery_onResult, onResult, "f");
6896
- __classPrivateFieldSet$7(this, _LiveQuery_unlisten, client.onQueryUpdate(update => __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_receive).call(this, update)), "f");
6897
- __classPrivateFieldSet$7(this, _LiveQuery_unreconnect, client.onReconnect(() => __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_reopen).call(this)), "f");
6898
- }
6899
- get id() { return __classPrivateFieldGet$7(this, _LiveQuery_id, "f"); }
6900
- get result() { return __classPrivateFieldGet$7(this, _LiveQuery_result, "f"); }
7139
+ __classPrivateFieldSet$8(this, _LiveQuery_client, client, "f");
7140
+ __classPrivateFieldSet$8(this, _LiveQuery_uuid, uuid, "f");
7141
+ __classPrivateFieldSet$8(this, _LiveQuery_open, open, "f");
7142
+ __classPrivateFieldSet$8(this, _LiveQuery_onResult, onResult, "f");
7143
+ __classPrivateFieldSet$8(this, _LiveQuery_unlisten, client.onQueryUpdate(update => __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_receive).call(this, update)), "f");
7144
+ __classPrivateFieldSet$8(this, _LiveQuery_unreconnect, client.onReconnect(() => __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_reopen).call(this)), "f");
7145
+ }
7146
+ get id() { return __classPrivateFieldGet$8(this, _LiveQuery_id, "f"); }
7147
+ get result() { return __classPrivateFieldGet$8(this, _LiveQuery_result, "f"); }
6901
7148
  /** Whether a re-open failed and the query is waiting to retry it. */
6902
- get reopening() { return __classPrivateFieldGet$7(this, _LiveQuery_reopening, "f"); }
7149
+ get reopening() { return __classPrivateFieldGet$8(this, _LiveQuery_reopening, "f"); }
6903
7150
  /** Call `listener` on each failed re-open and when a re-open succeeds
6904
7151
  * after one failed. Returns a remover. */
6905
7152
  onStatus(listener) {
6906
- __classPrivateFieldGet$7(this, _LiveQuery_statusListeners, "f").add(listener);
6907
- return () => __classPrivateFieldGet$7(this, _LiveQuery_statusListeners, "f").delete(listener);
7153
+ __classPrivateFieldGet$8(this, _LiveQuery_statusListeners, "f").add(listener);
7154
+ return () => __classPrivateFieldGet$8(this, _LiveQuery_statusListeners, "f").delete(listener);
6908
7155
  }
6909
7156
  /** Open the subscription (again) and return its initial result. A start
6910
7157
  * that a newer one overtakes resolves with the newer one's result. */
6911
7158
  start() {
6912
7159
  var _a;
6913
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_clearRetry).call(this);
6914
- __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");
6915
- return __classPrivateFieldGet$7(this, _LiveQuery_latest, "f");
7160
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_clearRetry).call(this);
7161
+ __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");
7162
+ return __classPrivateFieldGet$8(this, _LiveQuery_latest, "f");
6916
7163
  }
6917
7164
  /** End the subscription. With `cancelOpening`, a subscribe call still in
6918
7165
  * flight is cancelled too, so the executor stops computing a first result
@@ -6920,77 +7167,77 @@ class LiveQuery {
6920
7167
  * resolving with that result. */
6921
7168
  dispose(options = {}) {
6922
7169
  var _a;
6923
- __classPrivateFieldSet$7(this, _LiveQuery_disposed, true, "f");
6924
- __classPrivateFieldSet$7(this, _LiveQuery_generation, (_a = __classPrivateFieldGet$7(this, _LiveQuery_generation, "f"), _a++, _a), "f");
6925
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_clearRetry).call(this);
6926
- __classPrivateFieldGet$7(this, _LiveQuery_statusListeners, "f").clear();
6927
- __classPrivateFieldGet$7(this, _LiveQuery_unlisten, "f").call(this);
6928
- __classPrivateFieldGet$7(this, _LiveQuery_unreconnect, "f").call(this);
7170
+ __classPrivateFieldSet$8(this, _LiveQuery_disposed, true, "f");
7171
+ __classPrivateFieldSet$8(this, _LiveQuery_generation, (_a = __classPrivateFieldGet$8(this, _LiveQuery_generation, "f"), _a++, _a), "f");
7172
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_clearRetry).call(this);
7173
+ __classPrivateFieldGet$8(this, _LiveQuery_statusListeners, "f").clear();
7174
+ __classPrivateFieldGet$8(this, _LiveQuery_unlisten, "f").call(this);
7175
+ __classPrivateFieldGet$8(this, _LiveQuery_unreconnect, "f").call(this);
6929
7176
  if (options.cancelOpening)
6930
- __classPrivateFieldGet$7(this, _LiveQuery_opening, "f")?.abort();
6931
- if (__classPrivateFieldGet$7(this, _LiveQuery_id, "f"))
6932
- __classPrivateFieldGet$7(this, _LiveQuery_client, "f").disposeQuerySubscription(__classPrivateFieldGet$7(this, _LiveQuery_uuid, "f"), __classPrivateFieldGet$7(this, _LiveQuery_id, "f")).catch(() => { });
7177
+ __classPrivateFieldGet$8(this, _LiveQuery_opening, "f")?.abort();
7178
+ if (__classPrivateFieldGet$8(this, _LiveQuery_id, "f"))
7179
+ __classPrivateFieldGet$8(this, _LiveQuery_client, "f").disposeQuerySubscription(__classPrivateFieldGet$8(this, _LiveQuery_uuid, "f"), __classPrivateFieldGet$8(this, _LiveQuery_id, "f")).catch(() => { });
6933
7180
  }
6934
7181
  }
6935
7182
  _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) {
6936
- __classPrivateFieldSet$7(this, _LiveQuery_buffer, [], "f");
7183
+ __classPrivateFieldSet$8(this, _LiveQuery_buffer, [], "f");
6937
7184
  const opening = new AbortController();
6938
- __classPrivateFieldSet$7(this, _LiveQuery_opening, opening, "f");
7185
+ __classPrivateFieldSet$8(this, _LiveQuery_opening, opening, "f");
6939
7186
  let subscribed;
6940
7187
  try {
6941
- subscribed = await __classPrivateFieldGet$7(this, _LiveQuery_open, "f").call(this, opening.signal);
7188
+ subscribed = await __classPrivateFieldGet$8(this, _LiveQuery_open, "f").call(this, opening.signal);
6942
7189
  }
6943
7190
  catch (e) {
6944
- if (generation === __classPrivateFieldGet$7(this, _LiveQuery_generation, "f"))
6945
- __classPrivateFieldSet$7(this, _LiveQuery_buffer, null, "f");
7191
+ if (generation === __classPrivateFieldGet$8(this, _LiveQuery_generation, "f"))
7192
+ __classPrivateFieldSet$8(this, _LiveQuery_buffer, null, "f");
6946
7193
  throw e;
6947
7194
  }
6948
7195
  finally {
6949
- if (__classPrivateFieldGet$7(this, _LiveQuery_opening, "f") === opening)
6950
- __classPrivateFieldSet$7(this, _LiveQuery_opening, undefined, "f");
7196
+ if (__classPrivateFieldGet$8(this, _LiveQuery_opening, "f") === opening)
7197
+ __classPrivateFieldSet$8(this, _LiveQuery_opening, undefined, "f");
6951
7198
  }
6952
- if (__classPrivateFieldGet$7(this, _LiveQuery_disposed, "f") || generation !== __classPrivateFieldGet$7(this, _LiveQuery_generation, "f")) {
6953
- __classPrivateFieldGet$7(this, _LiveQuery_client, "f").disposeQuerySubscription(__classPrivateFieldGet$7(this, _LiveQuery_uuid, "f"), subscribed.subscriptionId).catch(() => { });
7199
+ if (__classPrivateFieldGet$8(this, _LiveQuery_disposed, "f") || generation !== __classPrivateFieldGet$8(this, _LiveQuery_generation, "f")) {
7200
+ __classPrivateFieldGet$8(this, _LiveQuery_client, "f").disposeQuerySubscription(__classPrivateFieldGet$8(this, _LiveQuery_uuid, "f"), subscribed.subscriptionId).catch(() => { });
6954
7201
  // Disposed while opening (e.g. a newer subscribe() on the same
6955
7202
  // builder): the caller still gets the snapshot that was read.
6956
- return __classPrivateFieldGet$7(this, _LiveQuery_disposed, "f") ? (__classPrivateFieldGet$7(this, _LiveQuery_result, "f") ?? subscribed.result) : __classPrivateFieldGet$7(this, _LiveQuery_latest, "f");
7203
+ return __classPrivateFieldGet$8(this, _LiveQuery_disposed, "f") ? (__classPrivateFieldGet$8(this, _LiveQuery_result, "f") ?? subscribed.result) : __classPrivateFieldGet$8(this, _LiveQuery_latest, "f");
6957
7204
  }
6958
- __classPrivateFieldSet$7(this, _LiveQuery_id, subscribed.subscriptionId, "f");
6959
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_replace).call(this, subscribed.revision, subscribed.result);
6960
- return __classPrivateFieldGet$7(this, _LiveQuery_result, "f");
7205
+ __classPrivateFieldSet$8(this, _LiveQuery_id, subscribed.subscriptionId, "f");
7206
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_replace).call(this, subscribed.revision, subscribed.result);
7207
+ return __classPrivateFieldGet$8(this, _LiveQuery_result, "f");
6961
7208
  }, _LiveQuery_reopen = function _LiveQuery_reopen(failures = 0) {
6962
- if (__classPrivateFieldGet$7(this, _LiveQuery_disposed, "f"))
7209
+ if (__classPrivateFieldGet$8(this, _LiveQuery_disposed, "f"))
6963
7210
  return;
6964
7211
  const reopened = this.start();
6965
- const generation = __classPrivateFieldGet$7(this, _LiveQuery_generation, "f");
7212
+ const generation = __classPrivateFieldGet$8(this, _LiveQuery_generation, "f");
6966
7213
  reopened.then(() => {
6967
- if (__classPrivateFieldGet$7(this, _LiveQuery_disposed, "f") || generation !== __classPrivateFieldGet$7(this, _LiveQuery_generation, "f") || !__classPrivateFieldGet$7(this, _LiveQuery_reopening, "f"))
7214
+ if (__classPrivateFieldGet$8(this, _LiveQuery_disposed, "f") || generation !== __classPrivateFieldGet$8(this, _LiveQuery_generation, "f") || !__classPrivateFieldGet$8(this, _LiveQuery_reopening, "f"))
6968
7215
  return;
6969
- __classPrivateFieldSet$7(this, _LiveQuery_reopening, false, "f");
6970
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_emit).call(this, { state: 'open' });
7216
+ __classPrivateFieldSet$8(this, _LiveQuery_reopening, false, "f");
7217
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_emit).call(this, { state: 'open' });
6971
7218
  }, error => {
6972
- if (__classPrivateFieldGet$7(this, _LiveQuery_disposed, "f") || generation !== __classPrivateFieldGet$7(this, _LiveQuery_generation, "f"))
7219
+ if (__classPrivateFieldGet$8(this, _LiveQuery_disposed, "f") || generation !== __classPrivateFieldGet$8(this, _LiveQuery_generation, "f"))
6973
7220
  return;
6974
7221
  const retryInMs = reopenDelay(failures + 1);
6975
7222
  console.error(`Error re-opening live query (attempt ${failures + 1}), retrying in ${Math.round(retryInMs)}ms:`, error);
6976
- __classPrivateFieldSet$7(this, _LiveQuery_reopening, true, "f");
6977
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_emit).call(this, { state: 'reopening', error, retryInMs });
7223
+ __classPrivateFieldSet$8(this, _LiveQuery_reopening, true, "f");
7224
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_emit).call(this, { state: 'reopening', error, retryInMs });
6978
7225
  const timer = setTimeout(() => {
6979
- __classPrivateFieldSet$7(this, _LiveQuery_retryTimer, undefined, "f");
6980
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_reopen).call(this, failures + 1);
7226
+ __classPrivateFieldSet$8(this, _LiveQuery_retryTimer, undefined, "f");
7227
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_reopen).call(this, failures + 1);
6981
7228
  }, retryInMs);
6982
7229
  // Node: a pending retry must not keep the process alive.
6983
7230
  if (typeof timer?.unref === 'function')
6984
7231
  timer.unref();
6985
- __classPrivateFieldSet$7(this, _LiveQuery_retryTimer, timer, "f");
7232
+ __classPrivateFieldSet$8(this, _LiveQuery_retryTimer, timer, "f");
6986
7233
  });
6987
7234
  }, _LiveQuery_clearRetry = function _LiveQuery_clearRetry() {
6988
- if (__classPrivateFieldGet$7(this, _LiveQuery_retryTimer, "f") === undefined)
7235
+ if (__classPrivateFieldGet$8(this, _LiveQuery_retryTimer, "f") === undefined)
6989
7236
  return;
6990
- clearTimeout(__classPrivateFieldGet$7(this, _LiveQuery_retryTimer, "f"));
6991
- __classPrivateFieldSet$7(this, _LiveQuery_retryTimer, undefined, "f");
7237
+ clearTimeout(__classPrivateFieldGet$8(this, _LiveQuery_retryTimer, "f"));
7238
+ __classPrivateFieldSet$8(this, _LiveQuery_retryTimer, undefined, "f");
6992
7239
  }, _LiveQuery_emit = function _LiveQuery_emit(status) {
6993
- for (const listener of [...__classPrivateFieldGet$7(this, _LiveQuery_statusListeners, "f")]) {
7240
+ for (const listener of [...__classPrivateFieldGet$8(this, _LiveQuery_statusListeners, "f")]) {
6994
7241
  try {
6995
7242
  listener(status);
6996
7243
  }
@@ -6999,58 +7246,133 @@ _LiveQuery_client = new WeakMap(), _LiveQuery_uuid = new WeakMap(), _LiveQuery_o
6999
7246
  }
7000
7247
  }
7001
7248
  }, _LiveQuery_replace = function _LiveQuery_replace(revision, result) {
7002
- __classPrivateFieldSet$7(this, _LiveQuery_revision, revision, "f");
7003
- __classPrivateFieldSet$7(this, _LiveQuery_result, result, "f");
7004
- const buffered = __classPrivateFieldGet$7(this, _LiveQuery_buffer, "f") ?? [];
7005
- __classPrivateFieldSet$7(this, _LiveQuery_buffer, null, "f");
7006
- if (__classPrivateFieldGet$7(this, _LiveQuery_started, "f"))
7007
- __classPrivateFieldGet$7(this, _LiveQuery_onResult, "f").call(this, result);
7008
- __classPrivateFieldSet$7(this, _LiveQuery_started, true, "f");
7249
+ __classPrivateFieldSet$8(this, _LiveQuery_revision, revision, "f");
7250
+ __classPrivateFieldSet$8(this, _LiveQuery_result, result, "f");
7251
+ const buffered = __classPrivateFieldGet$8(this, _LiveQuery_buffer, "f") ?? [];
7252
+ __classPrivateFieldSet$8(this, _LiveQuery_buffer, null, "f");
7253
+ if (__classPrivateFieldGet$8(this, _LiveQuery_started, "f"))
7254
+ __classPrivateFieldGet$8(this, _LiveQuery_onResult, "f").call(this, result);
7255
+ __classPrivateFieldSet$8(this, _LiveQuery_started, true, "f");
7009
7256
  for (const update of buffered)
7010
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_receive).call(this, update);
7257
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_receive).call(this, update);
7011
7258
  }, _LiveQuery_receive = function _LiveQuery_receive(update) {
7012
- if (__classPrivateFieldGet$7(this, _LiveQuery_buffer, "f")) {
7013
- __classPrivateFieldGet$7(this, _LiveQuery_buffer, "f").push(update);
7259
+ if (__classPrivateFieldGet$8(this, _LiveQuery_buffer, "f")) {
7260
+ __classPrivateFieldGet$8(this, _LiveQuery_buffer, "f").push(update);
7014
7261
  return;
7015
7262
  }
7016
7263
  if ('lagged' in update) {
7017
- if (__classPrivateFieldGet$7(this, _LiveQuery_id, "f"))
7018
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_resync).call(this);
7264
+ if (__classPrivateFieldGet$8(this, _LiveQuery_id, "f"))
7265
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_resync).call(this);
7019
7266
  return;
7020
7267
  }
7021
- if (update.subscriptionId !== __classPrivateFieldGet$7(this, _LiveQuery_id, "f") || update.revision <= __classPrivateFieldGet$7(this, _LiveQuery_revision, "f"))
7268
+ if (update.subscriptionId !== __classPrivateFieldGet$8(this, _LiveQuery_id, "f") || update.revision <= __classPrivateFieldGet$8(this, _LiveQuery_revision, "f"))
7022
7269
  return;
7023
- if (update.revision !== __classPrivateFieldGet$7(this, _LiveQuery_revision, "f") + 1) {
7024
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_resync).call(this);
7270
+ if (update.revision !== __classPrivateFieldGet$8(this, _LiveQuery_revision, "f") + 1) {
7271
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_resync).call(this);
7025
7272
  return;
7026
7273
  }
7027
7274
  let result;
7028
7275
  try {
7029
- result = applyUpdate(__classPrivateFieldGet$7(this, _LiveQuery_result, "f"), update);
7276
+ result = applyUpdate(__classPrivateFieldGet$8(this, _LiveQuery_result, "f"), update);
7030
7277
  }
7031
7278
  catch {
7032
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_resync).call(this);
7279
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_resync).call(this);
7033
7280
  return;
7034
7281
  }
7035
- __classPrivateFieldSet$7(this, _LiveQuery_revision, update.revision, "f");
7036
- __classPrivateFieldSet$7(this, _LiveQuery_result, result, "f");
7037
- __classPrivateFieldGet$7(this, _LiveQuery_onResult, "f").call(this, __classPrivateFieldGet$7(this, _LiveQuery_result, "f"));
7282
+ __classPrivateFieldSet$8(this, _LiveQuery_revision, update.revision, "f");
7283
+ __classPrivateFieldSet$8(this, _LiveQuery_result, result, "f");
7284
+ __classPrivateFieldGet$8(this, _LiveQuery_onResult, "f").call(this, __classPrivateFieldGet$8(this, _LiveQuery_result, "f"));
7038
7285
  }, _LiveQuery_resync = function _LiveQuery_resync() {
7039
- const generation = __classPrivateFieldGet$7(this, _LiveQuery_generation, "f");
7040
- const id = __classPrivateFieldGet$7(this, _LiveQuery_id, "f");
7041
- __classPrivateFieldSet$7(this, _LiveQuery_buffer, [], "f");
7042
- __classPrivateFieldGet$7(this, _LiveQuery_client, "f").resyncSubscription(__classPrivateFieldGet$7(this, _LiveQuery_uuid, "f"), id).then(({ revision, result }) => {
7043
- if (!__classPrivateFieldGet$7(this, _LiveQuery_disposed, "f") && generation === __classPrivateFieldGet$7(this, _LiveQuery_generation, "f"))
7044
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_replace).call(this, revision, result);
7286
+ const generation = __classPrivateFieldGet$8(this, _LiveQuery_generation, "f");
7287
+ const id = __classPrivateFieldGet$8(this, _LiveQuery_id, "f");
7288
+ __classPrivateFieldSet$8(this, _LiveQuery_buffer, [], "f");
7289
+ __classPrivateFieldGet$8(this, _LiveQuery_client, "f").resyncSubscription(__classPrivateFieldGet$8(this, _LiveQuery_uuid, "f"), id).then(({ revision, result }) => {
7290
+ if (!__classPrivateFieldGet$8(this, _LiveQuery_disposed, "f") && generation === __classPrivateFieldGet$8(this, _LiveQuery_generation, "f"))
7291
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_replace).call(this, revision, result);
7045
7292
  }, () => {
7046
7293
  // Replace the subscription with a new one.
7047
- if (!__classPrivateFieldGet$7(this, _LiveQuery_disposed, "f") && generation === __classPrivateFieldGet$7(this, _LiveQuery_generation, "f")) {
7048
- __classPrivateFieldGet$7(this, _LiveQuery_client, "f").disposeQuerySubscription(__classPrivateFieldGet$7(this, _LiveQuery_uuid, "f"), id).catch(() => { });
7049
- __classPrivateFieldGet$7(this, _LiveQuery_instances, "m", _LiveQuery_reopen).call(this);
7294
+ if (!__classPrivateFieldGet$8(this, _LiveQuery_disposed, "f") && generation === __classPrivateFieldGet$8(this, _LiveQuery_generation, "f")) {
7295
+ __classPrivateFieldGet$8(this, _LiveQuery_client, "f").disposeQuerySubscription(__classPrivateFieldGet$8(this, _LiveQuery_uuid, "f"), id).catch(() => { });
7296
+ __classPrivateFieldGet$8(this, _LiveQuery_instances, "m", _LiveQuery_reopen).call(this);
7050
7297
  }
7051
7298
  });
7052
7299
  };
7053
7300
 
7301
+ /**
7302
+ * Compare two strings by Unicode code point, ascending. This is the order
7303
+ * Rust's `String::cmp` produces (UTF-8 bytes sort in code-point order), so
7304
+ * a sort keyed on it here and in `rust-executor` agrees for every name, not
7305
+ * only ASCII. `<` on JS strings compares UTF-16 code units instead, which
7306
+ * puts U+E000–U+FFFF after the supplementary planes.
7307
+ *
7308
+ * Used by `fromLinks` to break state-value ties (#1202).
7309
+ */
7310
+ function compareCodePoints(a, b) {
7311
+ const as = Array.from(a);
7312
+ const bs = Array.from(b);
7313
+ const n = Math.min(as.length, bs.length);
7314
+ for (let i = 0; i < n; i++) {
7315
+ const d = as[i].codePointAt(0) - bs[i].codePointAt(0);
7316
+ if (d !== 0)
7317
+ return d;
7318
+ }
7319
+ return as.length - bs.length;
7320
+ }
7321
+ /**
7322
+ * Decode a state's `stateValue` link target into the number the state sort
7323
+ * keys on. **One grammar, shared verbatim with `decode_state_value` in
7324
+ * `rust-executor/src/perspectives/shacl_parser.rs`; a change to one is a
7325
+ * change to both**, and the `state value decoder matches rust` test here and
7326
+ * `state_value_decoder_matches_ts` there hold the two to the same answers.
7327
+ *
7328
+ * Not `Literal.fromUrl(target).get()`: that is `parseFloat`, which reads
7329
+ * `1abc` as 1 and `inf` as NaN, while Rust's `str::parse::<f64>` does the
7330
+ * reverse — so before #1202 the two runtimes could decode the same links to
7331
+ * different values and pick different initial states. The grammar:
7332
+ *
7333
+ * 1. The target must be a `literal:number:` literal. Anything else is NaN.
7334
+ * 2. The payload is percent-decoded: `Literal.toUrl` writes `1e21` as
7335
+ * `1e%2B21`. A payload that does not decode is NaN.
7336
+ * 3. A plain decimal — `[+-]?([0-9]+.?[0-9]*|.[0-9]+)([eE][+-]?[0-9]+)?`,
7337
+ * ASCII digits only — parses with `Number`; both runtimes' parsers agree
7338
+ * on this set. `-0` decodes to `-0`, which the sort treats as `0`.
7339
+ * 4. `inf` / `infinity`, any ASCII case, optional sign, is ±Infinity.
7340
+ * Rust's `parse_flow_to_links` writes `-inf`, `Literal.toUrl` writes
7341
+ * `-Infinity`; both runtimes read both.
7342
+ * 5. Everything else is NaN, which the sort puts last: `NaN`, an empty
7343
+ * payload, `1abc`, ` 1`, `0x10`, non-ASCII digits.
7344
+ *
7345
+ * A *missing* `stateValue` link is not this function's case: `fromLinks`
7346
+ * reads it as `0`, as Rust does.
7347
+ *
7348
+ * `STATE_VALUE_DECIMAL` is rule 3's grammar with the dot and the digits after
7349
+ * it grouped, `[0-9]+(\.[0-9]*)?`. Same strings, but a digit run can no longer
7350
+ * split between two digit classes, so V8 does not backtrack quadratically on a
7351
+ * long run that fails at the end. Rust's `regex` crate matches in linear time
7352
+ * either way.
7353
+ */
7354
+ const STATE_VALUE_DECIMAL = /^[+-]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/;
7355
+ const STATE_VALUE_INFINITE = /^[+-]?[iI][nN][fF](?:[iI][nN][iI][tT][yY])?$/;
7356
+ function decodeStateValue(target) {
7357
+ const payload = target.startsWith("literal:number:")
7358
+ ? target.slice("literal:number:".length)
7359
+ : undefined;
7360
+ if (payload === undefined)
7361
+ return NaN;
7362
+ let decoded;
7363
+ try {
7364
+ decoded = decodeURIComponent(payload);
7365
+ }
7366
+ catch {
7367
+ return NaN;
7368
+ }
7369
+ if (STATE_VALUE_DECIMAL.test(decoded))
7370
+ return Number(decoded);
7371
+ if (STATE_VALUE_INFINITE.test(decoded)) {
7372
+ return decoded.startsWith("-") ? -Infinity : Infinity;
7373
+ }
7374
+ return NaN;
7375
+ }
7054
7376
  /**
7055
7377
  * Runtime shape check for a decoded `ModelQuery`. Deserialization paths use
7056
7378
  * this to guard against malformed guard arrays leaking into flow metadata
@@ -7168,11 +7490,13 @@ class SHACLFlow {
7168
7490
  * States in this flow.
7169
7491
  *
7170
7492
  * **Ordering convention (James PR #929 R9):** the array is stored sorted
7171
- * ascending by `value`. `states[0]` is the initial state — the one
7493
+ * ascending by `value`, ties broken by state name ascending (code-point
7494
+ * order), NaN values last. `states[0]` is the initial state — the one
7172
7495
  * {@link FlowInstance.start} mints a fresh instance into. A flow author
7173
7496
  * who wants a specific state as the entry point must give it the lowest
7174
- * `value` in the set. `fromLinks` enforces this sort, so link-order on
7175
- * the graph never dictates the initial state.
7497
+ * `value` in the set; two states sharing the lowest value start in the
7498
+ * one whose name sorts first (#1202). `fromLinks` enforces this sort, so
7499
+ * link-order on the graph never dictates the initial state.
7176
7500
  */
7177
7501
  this._states = [];
7178
7502
  /** Transitions between states */
@@ -7538,7 +7862,9 @@ class SHACLFlow {
7538
7862
  stateUriToName.set(stateUri, stateName);
7539
7863
  // Get state value
7540
7864
  const valueLink = links.find(l => l.source === stateUri && l.predicate === "ad4m://stateValue");
7541
- const stateValue = valueLink ? Literal.fromUrl(valueLink.target).get() : 0;
7865
+ // Missing link: 0, as in Rust. Present link: the shared strict grammar
7866
+ // (`decodeStateValue`), NaN when it does not fit.
7867
+ const stateValue = valueLink ? decodeStateValue(valueLink.target) : 0;
7542
7868
  // Get per-state interpretation hint (optional). Same non-empty-string
7543
7869
  // guard as the flow-level hint.
7544
7870
  const hintLink = links.find(l => l.source === stateUri && l.predicate === "ad4m://interpretationHint");
@@ -7616,8 +7942,45 @@ class SHACLFlow {
7616
7942
  // was randomly one of the round-tripped states. Sort by `value` ascending
7617
7943
  // so the "initial state = states[0]" convention (used by
7618
7944
  // `FlowInstance.start`) survives a fromGraph round trip.
7945
+ //
7946
+ // This comparator must stay identical to the one in rust-executor's
7947
+ // `parse_flow_from_links` (`rust-executor/src/perspectives/shacl_parser.rs`):
7948
+ // both runtimes read `states[0]` as the genesis state, and a Rust-side
7949
+ // spawn, `derive_state` and `verify_receipt` all start from it. So must
7950
+ // its input: `decodeStateValue` above and Rust `decode_state_value` read
7951
+ // the `stateValue` literal with one grammar, so the same links decode to
7952
+ // the same numbers before this sort ever runs.
7953
+ //
7954
+ // - NaN sorts last. `decodeStateValue` returns NaN for every payload
7955
+ // outside its grammar (a literal `NaN`, an empty payload, `1abc`, …),
7956
+ // so NaN is the common case for a malformed definition; `a.value -
7957
+ // b.value` would then be NaN, which `Array.prototype.sort` treats as
7958
+ // "equal" in an engine-defined way that also scrambles the finite
7959
+ // states around it. A state whose ordering value is undecodable has
7960
+ // no claim to being first.
7961
+ // - Equal values break on state name, ascending by Unicode code point
7962
+ // (`compareCodePoints`), which is the order Rust's `String::cmp` gives
7963
+ // over UTF-8 bytes (#1202). Without this, `sort` is stable and a tie
7964
+ // kept link-discovery order, which differs between replicas: two
7965
+ // nodes loading the same definition could mint instances in
7966
+ // different initial states.
7619
7967
  // The `states` getter returns a defensive copy, so mutate `_states` directly.
7620
- flow._states.sort((a, b) => a.value - b.value);
7968
+ flow._states.sort((a, b) => {
7969
+ const aNaN = Number.isNaN(a.value);
7970
+ const bNaN = Number.isNaN(b.value);
7971
+ if (aNaN !== bNaN)
7972
+ return aNaN ? 1 : -1;
7973
+ if (!aNaN && a.value !== b.value)
7974
+ return a.value < b.value ? -1 : 1;
7975
+ return compareCodePoints(a.name, b.name);
7976
+ });
7977
+ if (flow._states.length > 1 &&
7978
+ !Number.isNaN(flow._states[0].value) &&
7979
+ flow._states[0].value === flow._states[1].value) {
7980
+ console.warn(`flow \`${flowUri}\`: states \`${flow._states[0].name}\` and \`${flow._states[1].name}\` ` +
7981
+ `tie on the lowest value ${flow._states[0].value}; ` +
7982
+ `\`${flow._states[0].name}\` is the initial state by name order (#1202)`);
7983
+ }
7621
7984
  // Find transitions
7622
7985
  const transitionLinks = links.filter(l => l.source === flowUri && l.predicate === "ad4m://hasTransition");
7623
7986
  for (const transitionLink of transitionLinks) {
@@ -7777,12 +8140,12 @@ SHACLFlow.STATE_AND_TRANSITION_PREDICATES = [
7777
8140
  "ad4m://transitionActions",
7778
8141
  ];
7779
8142
 
7780
- var __classPrivateFieldGet$6 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8143
+ var __classPrivateFieldGet$7 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
7781
8144
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
7782
8145
  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");
7783
8146
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
7784
8147
  };
7785
- var __classPrivateFieldSet$6 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8148
+ var __classPrivateFieldSet$7 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7786
8149
  if (kind === "m") throw new TypeError("Private method is not writable");
7787
8150
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
7788
8151
  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");
@@ -7829,67 +8192,67 @@ class QuerySubscriptionProxy {
7829
8192
  const open = className === undefined
7830
8193
  ? (signal) => client.subscribeQuery(uuid, query, { signal })
7831
8194
  : (signal) => client.modelSubscribe(uuid, className, query, { signal });
7832
- __classPrivateFieldSet$6(this, _QuerySubscriptionProxy_live, new LiveQuery(client, uuid, open, result => __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_deliver).call(this, result)), "f");
7833
- __classPrivateFieldSet$6(this, _QuerySubscriptionProxy_initialized, new Promise((resolve, reject) => {
7834
- __classPrivateFieldSet$6(this, _QuerySubscriptionProxy_initResolve, resolve, "f");
7835
- __classPrivateFieldSet$6(this, _QuerySubscriptionProxy_initReject, reject, "f");
8195
+ __classPrivateFieldSet$7(this, _QuerySubscriptionProxy_live, new LiveQuery(client, uuid, open, result => __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_deliver).call(this, result)), "f");
8196
+ __classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initialized, new Promise((resolve, reject) => {
8197
+ __classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initResolve, resolve, "f");
8198
+ __classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initReject, reject, "f");
7836
8199
  }), "f");
7837
8200
  // `subscribe()` throws the same error, so a caller who never reads
7838
8201
  // `initialized` must not get an unhandled rejection from it.
7839
- __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_initialized, "f").catch(() => { });
8202
+ __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_initialized, "f").catch(() => { });
7840
8203
  }
7841
8204
  /** Open the query; resolves with the first result delivered. */
7842
8205
  async subscribe() {
7843
8206
  try {
7844
- __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_deliver).call(this, await __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_live, "f").start());
8207
+ __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_instances, "m", _QuerySubscriptionProxy_deliver).call(this, await __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_live, "f").start());
7845
8208
  }
7846
8209
  catch (error) {
7847
- __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_initReject, "f")?.call(this, error);
7848
- __classPrivateFieldSet$6(this, _QuerySubscriptionProxy_initResolve, __classPrivateFieldSet$6(this, _QuerySubscriptionProxy_initReject, undefined, "f"), "f");
8210
+ __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_initReject, "f")?.call(this, error);
8211
+ __classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initResolve, __classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initReject, undefined, "f"), "f");
7849
8212
  throw error;
7850
8213
  }
7851
8214
  }
7852
8215
  /** The executor's id for this subscription. */
7853
8216
  get id() {
7854
- return __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_live, "f").id;
8217
+ return __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_live, "f").id;
7855
8218
  }
7856
8219
  /** Resolves once the first result has arrived. */
7857
8220
  get initialized() {
7858
- return __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_initialized, "f");
8221
+ return __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_initialized, "f");
7859
8222
  }
7860
8223
  /** The latest result. */
7861
8224
  get result() {
7862
- return __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_live, "f").result;
8225
+ return __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_live, "f").result;
7863
8226
  }
7864
8227
  /** Call `callback` with every later result. Returns a remover. */
7865
8228
  onResult(callback) {
7866
- __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_callbacks, "f").add(callback);
7867
- return () => __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_callbacks, "f").delete(callback);
8229
+ __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_callbacks, "f").add(callback);
8230
+ return () => __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_callbacks, "f").delete(callback);
7868
8231
  }
7869
8232
  /** Whether the query lost its subscription (a reconnect, a failed
7870
8233
  * resync), could not open it again yet and is retrying: `result` is then
7871
8234
  * not live. */
7872
8235
  get reopening() {
7873
- return __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_live, "f").reopening;
8236
+ return __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_live, "f").reopening;
7874
8237
  }
7875
8238
  /** Call `listener` on each failed re-open of the subscription and when a
7876
8239
  * re-open succeeds after one failed (see {@link LiveQueryStatus}).
7877
8240
  * Returns a remover. */
7878
8241
  onStatus(listener) {
7879
- return __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_live, "f").onStatus(listener);
8242
+ return __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_live, "f").onStatus(listener);
7880
8243
  }
7881
8244
  /** End the subscription on the executor and drop all callbacks. With
7882
8245
  * `cancelOpening`, a `subscribe()` still waiting on the executor is
7883
8246
  * cancelled too, and rejects. */
7884
8247
  dispose(options = {}) {
7885
- __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_live, "f").dispose(options);
7886
- __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_callbacks, "f").clear();
8248
+ __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_live, "f").dispose(options);
8249
+ __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_callbacks, "f").clear();
7887
8250
  }
7888
8251
  }
7889
8252
  _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) {
7890
- __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_initResolve, "f")?.call(this, true);
7891
- __classPrivateFieldSet$6(this, _QuerySubscriptionProxy_initResolve, __classPrivateFieldSet$6(this, _QuerySubscriptionProxy_initReject, undefined, "f"), "f");
7892
- for (const callback of __classPrivateFieldGet$6(this, _QuerySubscriptionProxy_callbacks, "f")) {
8253
+ __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_initResolve, "f")?.call(this, true);
8254
+ __classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initResolve, __classPrivateFieldSet$7(this, _QuerySubscriptionProxy_initReject, undefined, "f"), "f");
8255
+ for (const callback of __classPrivateFieldGet$7(this, _QuerySubscriptionProxy_callbacks, "f")) {
7893
8256
  try {
7894
8257
  callback(result);
7895
8258
  }
@@ -7939,7 +8302,7 @@ _QuerySubscriptionProxy_live = new WeakMap(), _QuerySubscriptionProxy_callbacks
7939
8302
  */
7940
8303
  class PerspectiveProxy {
7941
8304
  /** @internal Exposed for ModelQueryBuilder subscription management */
7942
- get client() { return __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f"); }
8305
+ get client() { return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f"); }
7943
8306
  /**
7944
8307
  * Creates a new PerspectiveProxy instance.
7945
8308
  * Note: Don't create this directly, use ad4m.perspective.add() instead.
@@ -7959,23 +8322,23 @@ class PerspectiveProxy {
7959
8322
  * Note: Don't create this directly, use ad4m.perspective.add() instead.
7960
8323
  */
7961
8324
  );
7962
- __classPrivateFieldSet$6(this, _PerspectiveProxy_handle, handle, "f");
7963
- __classPrivateFieldSet$6(this, _PerspectiveProxy_client, ad4m, "f");
7964
- this.uuid = __classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid;
7965
- this.name = __classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").name;
7966
- this.owners = __classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").owners;
7967
- this.sharedUrl = __classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").sharedUrl;
7968
- this.neighbourhood = __classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").neighbourhood;
7969
- this.state = __classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").state;
8325
+ __classPrivateFieldSet$7(this, _PerspectiveProxy_handle, handle, "f");
8326
+ __classPrivateFieldSet$7(this, _PerspectiveProxy_client, ad4m, "f");
8327
+ this.uuid = __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid;
8328
+ this.name = __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").name;
8329
+ this.owners = __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").owners;
8330
+ this.sharedUrl = __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").sharedUrl;
8331
+ this.neighbourhood = __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").neighbourhood;
8332
+ this.state = __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").state;
7970
8333
  }
7971
8334
  /** Update the proxy's internal handle and public fields in-place.
7972
8335
  * Keeps the same object reference so all holders see the update. */
7973
8336
  updateHandle(handle) {
7974
- if (handle.uuid !== __classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid) {
7975
- 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}". ` +
8337
+ if (handle.uuid !== __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid) {
8338
+ 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}". ` +
7976
8339
  `This would silently diverge from listeners registered under the original UUID.`);
7977
8340
  }
7978
- __classPrivateFieldSet$6(this, _PerspectiveProxy_handle, handle, "f");
8341
+ __classPrivateFieldSet$7(this, _PerspectiveProxy_handle, handle, "f");
7979
8342
  this.uuid = handle.uuid;
7980
8343
  this.name = handle.name;
7981
8344
  this.owners = handle.owners;
@@ -8056,8 +8419,8 @@ class PerspectiveProxy {
8056
8419
  * @param batchId - Optional batch ID to group this operation with others
8057
8420
  */
8058
8421
  async executeAction(actions, expression, parameters, batchId) {
8059
- 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);
8060
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8422
+ 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);
8423
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8061
8424
  return result;
8062
8425
  }
8063
8426
  /**
@@ -8082,7 +8445,7 @@ class PerspectiveProxy {
8082
8445
  * ```
8083
8446
  */
8084
8447
  async get(query, options) {
8085
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").queryLinks(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, query, options);
8448
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").queryLinks(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, query, options);
8086
8449
  }
8087
8450
  /**
8088
8451
  * Runs generic LLM interpretation over a conversation transcript, turning it
@@ -8105,7 +8468,7 @@ class PerspectiveProxy {
8105
8468
  // sixth positional parameter would have made `undefined, undefined, { … }` the normal way
8106
8469
  // to ask for the only one of them most callers want.
8107
8470
  const { existingScope, mintScope, observe, ...callOptions } = options ?? {};
8108
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").runInterpretation(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, transcript, basePrefix, classes, existingScope, mintScope, observe, callOptions);
8471
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").runInterpretation(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, transcript, basePrefix, classes, existingScope, mintScope, observe, callOptions);
8109
8472
  }
8110
8473
  /**
8111
8474
  * Harness-dispatched interpretation pass over this perspective (design v3
@@ -8132,7 +8495,7 @@ class PerspectiveProxy {
8132
8495
  // `on('auto-processor-event')` to render the harness loop
8133
8496
  // live in a UI. Absent = fast headless path (no telemetry cost).
8134
8497
  observationId, emitDebugEvents, options) {
8135
- 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);
8498
+ 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);
8136
8499
  }
8137
8500
  /**
8138
8501
  * Ask a model something about this perspective, or ask it to change something, with the
@@ -8145,7 +8508,7 @@ class PerspectiveProxy {
8145
8508
  * @param options `signal` / `timeoutMs` (default {@link LONG_TIMEOUT_MS})
8146
8509
  */
8147
8510
  async runAgent(messages, settings, options) {
8148
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").runAgent(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, messages, settings, options);
8511
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").runAgent(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, messages, settings, options);
8149
8512
  }
8150
8513
  /**
8151
8514
  * Register a neighbourhood auto-processor on this perspective. The executor
@@ -8154,7 +8517,7 @@ class PerspectiveProxy {
8154
8517
  * processor id. Subscribe to progress via `on('auto-processor-event')`.
8155
8518
  */
8156
8519
  async addAutoProcessor(config) {
8157
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").addAutoProcessor(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, config);
8520
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").addAutoProcessor(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, config);
8158
8521
  }
8159
8522
  /**
8160
8523
  * Stop an auto-processor by deleting its config.
@@ -8172,7 +8535,7 @@ class PerspectiveProxy {
8172
8535
  * one left off rather than re-reading every turn.
8173
8536
  */
8174
8537
  async removeAutoProcessor(processorId) {
8175
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").removeAutoProcessor(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, processorId);
8538
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").removeAutoProcessor(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, processorId);
8176
8539
  }
8177
8540
  /**
8178
8541
  * Pending interpretation overlays on this perspective — LLM suggestions the
@@ -8186,17 +8549,17 @@ class PerspectiveProxy {
8186
8549
  * Each caller gets its own copy of the array.
8187
8550
  */
8188
8551
  async interpretationOverlays() {
8189
- if (__classPrivateFieldGet$6(this, _PerspectiveProxy_overlaysInFlight, "f")) {
8190
- return [...(await __classPrivateFieldGet$6(this, _PerspectiveProxy_overlaysInFlight, "f"))];
8552
+ if (__classPrivateFieldGet$7(this, _PerspectiveProxy_overlaysInFlight, "f")) {
8553
+ return [...(await __classPrivateFieldGet$7(this, _PerspectiveProxy_overlaysInFlight, "f"))];
8191
8554
  }
8192
- const pending = __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").interpretationOverlays(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8193
- __classPrivateFieldSet$6(this, _PerspectiveProxy_overlaysInFlight, pending, "f");
8555
+ const pending = __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").interpretationOverlays(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8556
+ __classPrivateFieldSet$7(this, _PerspectiveProxy_overlaysInFlight, pending, "f");
8194
8557
  try {
8195
8558
  return [...(await pending)];
8196
8559
  }
8197
8560
  finally {
8198
- if (__classPrivateFieldGet$6(this, _PerspectiveProxy_overlaysInFlight, "f") === pending) {
8199
- __classPrivateFieldSet$6(this, _PerspectiveProxy_overlaysInFlight, null, "f");
8561
+ if (__classPrivateFieldGet$7(this, _PerspectiveProxy_overlaysInFlight, "f") === pending) {
8562
+ __classPrivateFieldSet$7(this, _PerspectiveProxy_overlaysInFlight, null, "f");
8200
8563
  }
8201
8564
  }
8202
8565
  }
@@ -8207,11 +8570,11 @@ class PerspectiveProxy {
8207
8570
  */
8208
8571
  async acceptInterpretation(base, property) {
8209
8572
  try {
8210
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").acceptInterpretation(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, base, property);
8573
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").acceptInterpretation(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, base, property);
8211
8574
  }
8212
8575
  finally {
8213
8576
  // A read already in flight may predate this write; later callers must not join it.
8214
- __classPrivateFieldSet$6(this, _PerspectiveProxy_overlaysInFlight, null, "f");
8577
+ __classPrivateFieldSet$7(this, _PerspectiveProxy_overlaysInFlight, null, "f");
8215
8578
  }
8216
8579
  }
8217
8580
  /**
@@ -8221,11 +8584,11 @@ class PerspectiveProxy {
8221
8584
  */
8222
8585
  async rejectInterpretation(base, property) {
8223
8586
  try {
8224
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").rejectInterpretation(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, base, property);
8587
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").rejectInterpretation(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, base, property);
8225
8588
  }
8226
8589
  finally {
8227
8590
  // A read already in flight may predate this write; later callers must not join it.
8228
- __classPrivateFieldSet$6(this, _PerspectiveProxy_overlaysInFlight, null, "f");
8591
+ __classPrivateFieldSet$7(this, _PerspectiveProxy_overlaysInFlight, null, "f");
8229
8592
  }
8230
8593
  }
8231
8594
  /**
@@ -8236,14 +8599,14 @@ class PerspectiveProxy {
8236
8599
  * for a non-terminal state is refused.
8237
8600
  */
8238
8601
  async proposeFlowTransition(instanceUri, toState, rationale, outputs) {
8239
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").proposeFlowTransition(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, instanceUri, toState, rationale, outputs);
8602
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").proposeFlowTransition(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, instanceUri, toState, rationale, outputs);
8240
8603
  }
8241
8604
  async acceptFlowProposal(proposalUri) {
8242
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").acceptFlowProposal(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, proposalUri);
8605
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").acceptFlowProposal(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, proposalUri);
8243
8606
  }
8244
8607
  /** Withdraw our own links from a proposal; resolves to how many went. */
8245
8608
  async rejectFlowProposal(proposalUri) {
8246
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").rejectFlowProposal(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, proposalUri);
8609
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").rejectFlowProposal(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, proposalUri);
8247
8610
  }
8248
8611
  /**
8249
8612
  * Re-decide a flow receipt under this perspective's own flow catalogue.
@@ -8251,7 +8614,7 @@ class PerspectiveProxy {
8251
8614
  * `outcome`, never on a boolean you derive from it.
8252
8615
  */
8253
8616
  async verifyFlowReceipt(receipt) {
8254
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").verifyFlowReceipt(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, receipt);
8617
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").verifyFlowReceipt(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, receipt);
8255
8618
  }
8256
8619
  /**
8257
8620
  * Which instances are, as they stand, valid outputs of `flow`?
@@ -8268,7 +8631,7 @@ class PerspectiveProxy {
8268
8631
  * "no valid outputs". The filter rejects the same way.
8269
8632
  */
8270
8633
  async flowValidOutputs(flow, state) {
8271
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").flowValidOutputs(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, flow, state);
8634
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").flowValidOutputs(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, flow, state);
8272
8635
  }
8273
8636
  /**
8274
8637
  * The state each flow instance is in, as **this agent's** executor last
@@ -8283,7 +8646,7 @@ class PerspectiveProxy {
8283
8646
  * `FlowInstance.findAll` / `start` call this for you.
8284
8647
  */
8285
8648
  async flowStates(instances) {
8286
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").flowStates(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, instances);
8649
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").flowStates(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, instances);
8287
8650
  }
8288
8651
  /**
8289
8652
  * The proposals of `instance` whose votes settled an edge, as this
@@ -8291,7 +8654,7 @@ class PerspectiveProxy {
8291
8654
  * Replaces the `resolvedAs` property proposals used to carry.
8292
8655
  */
8293
8656
  async flowFired(instance) {
8294
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").flowFired(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, instance);
8657
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").flowFired(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, instance);
8295
8658
  }
8296
8659
  /**
8297
8660
  * Called whenever a flow instance on this perspective changes state on
@@ -8312,7 +8675,7 @@ class PerspectiveProxy {
8312
8675
  }
8313
8676
  /** Mint and store the receipt for a completed flow run. */
8314
8677
  async mintFlowReceipt(instanceUri) {
8315
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").mintFlowReceipt(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, instanceUri);
8678
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").mintFlowReceipt(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, instanceUri);
8316
8679
  }
8317
8680
  /**
8318
8681
  * Executes a Prolog query against the perspective's knowledge base.
@@ -8338,7 +8701,7 @@ class PerspectiveProxy {
8338
8701
  * ```
8339
8702
  */
8340
8703
  async infer(query, options) {
8341
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").queryProlog(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, query, options);
8704
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").queryProlog(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, query, options);
8342
8705
  }
8343
8706
  /**
8344
8707
  * Executes a SPARQL query against the perspective's link cache.
@@ -8363,11 +8726,11 @@ class PerspectiveProxy {
8363
8726
  * @returns Query results as parsed JSON
8364
8727
  */
8365
8728
  async querySparql(query, options) {
8366
- const cached = getCachedResult(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, query);
8729
+ const cached = getCachedResult(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, query);
8367
8730
  if (cached !== undefined)
8368
8731
  return cached;
8369
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").querySparql(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, query, options);
8370
- setCachedResult(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, query, result);
8732
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").querySparql(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, query, options);
8733
+ setCachedResult(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, query, result);
8371
8734
  return result;
8372
8735
  }
8373
8736
  /**
@@ -8384,7 +8747,7 @@ class PerspectiveProxy {
8384
8747
  * @returns Object with `instances` array and `totalCount`
8385
8748
  */
8386
8749
  async modelQuery(className, queryJson, options) {
8387
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").modelQuery(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, className, queryJson, options);
8750
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").modelQuery(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, className, queryJson, options);
8388
8751
  }
8389
8752
  /** Resolve each URI to the names of every subject class it is an instance of.
8390
8753
  *
@@ -8419,7 +8782,7 @@ class PerspectiveProxy {
8419
8782
  async subjectClassesOf(uris) {
8420
8783
  if (uris.length === 0)
8421
8784
  return {};
8422
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").subjectClassesOf(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, uris);
8785
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").subjectClassesOf(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, uris);
8423
8786
  }
8424
8787
  /**
8425
8788
  * Evaluate property getters for a batch of instances in a single RPC call.
@@ -8434,7 +8797,7 @@ class PerspectiveProxy {
8434
8797
  * @returns Map of instance ID → evaluated property values
8435
8798
  */
8436
8799
  async evaluateGetters(className, instanceIds, propertyNames) {
8437
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").evaluateGetters(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, className, instanceIds, propertyNames);
8800
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").evaluateGetters(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, className, instanceIds, propertyNames);
8438
8801
  }
8439
8802
  /**
8440
8803
  * Open a live model query on the executor. Later changes arrive as
@@ -8447,7 +8810,7 @@ class PerspectiveProxy {
8447
8810
  * @returns `subscriptionId`, initial `result` and `revision` (0)
8448
8811
  */
8449
8812
  async modelSubscribe(className, queryJson) {
8450
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").modelSubscribe(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, className, queryJson);
8813
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").modelSubscribe(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, className, queryJson);
8451
8814
  }
8452
8815
  /**
8453
8816
  * Adds a new link to the perspective.
@@ -8475,8 +8838,8 @@ class PerspectiveProxy {
8475
8838
  * ```
8476
8839
  */
8477
8840
  async add(link, status = 'shared', batchId) {
8478
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").addLink(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, link, status, batchId);
8479
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8841
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").addLink(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, link, status, batchId);
8842
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8480
8843
  return result;
8481
8844
  }
8482
8845
  /**
@@ -8489,8 +8852,8 @@ class PerspectiveProxy {
8489
8852
  * @returns Array of created LinkExpressions
8490
8853
  */
8491
8854
  async addLinks(links, status = 'shared', batchId) {
8492
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").addLinks(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, links, status, batchId);
8493
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8855
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").addLinks(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, links, status, batchId);
8856
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8494
8857
  return result;
8495
8858
  }
8496
8859
  /**
@@ -8501,8 +8864,8 @@ class PerspectiveProxy {
8501
8864
  * @returns Array of removed LinkExpressions
8502
8865
  */
8503
8866
  async removeLinks(links, batchId) {
8504
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").removeLinks(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, links, batchId);
8505
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8867
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").removeLinks(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, links, batchId);
8868
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8506
8869
  return result;
8507
8870
  }
8508
8871
  /**
@@ -8514,8 +8877,8 @@ class PerspectiveProxy {
8514
8877
  * @returns Object containing results of the mutations
8515
8878
  */
8516
8879
  async linkMutations(mutations, status = 'shared') {
8517
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").linkMutations(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, mutations, status);
8518
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8880
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").linkMutations(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, mutations, status);
8881
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8519
8882
  return result;
8520
8883
  }
8521
8884
  /**
@@ -8533,7 +8896,7 @@ class PerspectiveProxy {
8533
8896
  * @returns The added LinkExpression
8534
8897
  */
8535
8898
  async addLinkExpression(link, status = 'shared', batchId) {
8536
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").addLinkExpression(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, link, status, batchId);
8899
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").addLinkExpression(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, link, status, batchId);
8537
8900
  }
8538
8901
  /**
8539
8902
  * Updates an existing link with new data.
@@ -8543,8 +8906,8 @@ class PerspectiveProxy {
8543
8906
  * @param batchId - Optional batch ID to group this operation with others
8544
8907
  */
8545
8908
  async update(oldLink, newLink, batchId) {
8546
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").updateLink(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, oldLink, newLink, batchId);
8547
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8909
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").updateLink(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, oldLink, newLink, batchId);
8910
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8548
8911
  return result;
8549
8912
  }
8550
8913
  /**
@@ -8591,18 +8954,18 @@ class PerspectiveProxy {
8591
8954
  else {
8592
8955
  resolvedLink = link;
8593
8956
  }
8594
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").removeLink(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, resolvedLink, batchId);
8595
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8957
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").removeLink(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, resolvedLink, batchId);
8958
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8596
8959
  return result;
8597
8960
  }
8598
8961
  /** Creates a new batch for grouping operations */
8599
8962
  async createBatch() {
8600
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").createBatch(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8963
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").createBatch(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8601
8964
  }
8602
8965
  /** Commits a batch of operations */
8603
8966
  async commitBatch(batchId) {
8604
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").commitBatch(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, batchId);
8605
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
8967
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").commitBatch(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, batchId);
8968
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8606
8969
  return result;
8607
8970
  }
8608
8971
  /**
@@ -8612,7 +8975,7 @@ class PerspectiveProxy {
8612
8975
  * @returns The rendered Expression
8613
8976
  */
8614
8977
  async getExpression(expressionURI) {
8615
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").getExpression(expressionURI);
8978
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getExpression(expressionURI);
8616
8979
  }
8617
8980
  /**
8618
8981
  * Creates a new Expression in the specified Language.
@@ -8622,7 +8985,7 @@ class PerspectiveProxy {
8622
8985
  * @returns URI of the created Expression
8623
8986
  */
8624
8987
  async createExpression(content, languageAddress) {
8625
- return await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").createExpression(content, languageAddress);
8988
+ return await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").createExpression(content, languageAddress);
8626
8989
  }
8627
8990
  /**
8628
8991
  * Call `handler` with every `type` event about this perspective, until the
@@ -8638,18 +9001,18 @@ class PerspectiveProxy {
8638
9001
  on(type, handler) {
8639
9002
  // A registration of this proxy's own, so dispose() cannot release another proxy's
8640
9003
  // registration of the same function (on() treats equal handlers as one).
8641
- const release = __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").on(type, (event) => handler(event), { perspective: __classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid });
9004
+ const release = __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").on(type, (event) => handler(event), { perspective: __classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid });
8642
9005
  const releaseOnce = () => {
8643
- if (__classPrivateFieldGet$6(this, _PerspectiveProxy_releases, "f").delete(releaseOnce))
9006
+ if (__classPrivateFieldGet$7(this, _PerspectiveProxy_releases, "f").delete(releaseOnce))
8644
9007
  release();
8645
9008
  };
8646
- __classPrivateFieldGet$6(this, _PerspectiveProxy_releases, "f").add(releaseOnce);
9009
+ __classPrivateFieldGet$7(this, _PerspectiveProxy_releases, "f").add(releaseOnce);
8647
9010
  return releaseOnce;
8648
9011
  }
8649
9012
  /** Removes every handler this proxy registered. Other proxies for the same
8650
9013
  * perspective keep theirs. */
8651
9014
  dispose() {
8652
- for (const release of [...__classPrivateFieldGet$6(this, _PerspectiveProxy_releases, "f")])
9015
+ for (const release of [...__classPrivateFieldGet$7(this, _PerspectiveProxy_releases, "f")])
8653
9016
  release();
8654
9017
  }
8655
9018
  /**
@@ -8659,7 +9022,7 @@ class PerspectiveProxy {
8659
9022
  * @returns Perspective object containing all links
8660
9023
  */
8661
9024
  async snapshot() {
8662
- return __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").snapshotByUUID(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
9025
+ return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").snapshotByUUID(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8663
9026
  }
8664
9027
  /**
8665
9028
  * Loads a perspective snapshot, replacing current content.
@@ -8863,14 +9226,14 @@ class PerspectiveProxy {
8863
9226
  * await perspective.addSdna('Recipe', prologCode, 'subject_class');
8864
9227
  */
8865
9228
  async addSdna(name, sdnaCode, sdnaType, shaclJson) {
8866
- return __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").addSdna(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, name, sdnaCode, sdnaType, shaclJson);
9229
+ return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").addSdna(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, name, sdnaCode, sdnaType, shaclJson);
8867
9230
  }
8868
9231
  /**
8869
9232
  * Batch variant of addSdna — registers multiple SDNA entries in a single RPC call.
8870
9233
  * Acquires the Rust-side mutex once for the entire batch.
8871
9234
  */
8872
9235
  async addSdnaAll(entries) {
8873
- return __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").addSdnaBatch(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, entries);
9236
+ return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").addSdnaBatch(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, entries);
8874
9237
  }
8875
9238
  /**
8876
9239
  * Batch-registers multiple model classes as SHACL subject classes in a single RPC call.
@@ -8883,7 +9246,7 @@ class PerspectiveProxy {
8883
9246
  if (Object.prototype.hasOwnProperty.call(jsClass, 'builtinUri'))
8884
9247
  continue;
8885
9248
  const className = jsClass.className || jsClass.prototype?.className || jsClass.name;
8886
- if (__classPrivateFieldGet$6(this, _PerspectiveProxy_ensuredSubjectClasses, "f").has(className))
9249
+ if (__classPrivateFieldGet$7(this, _PerspectiveProxy_ensuredSubjectClasses, "f").has(className))
8887
9250
  continue;
8888
9251
  if (!jsClass.generateSHACL) {
8889
9252
  throw new Error(`Class ${jsClass.name} must have generateSHACL(). Use @Model decorator.`);
@@ -8899,7 +9262,7 @@ class PerspectiveProxy {
8899
9262
  return;
8900
9263
  await this.addSdnaAll(entries);
8901
9264
  for (const entry of entries) {
8902
- __classPrivateFieldGet$6(this, _PerspectiveProxy_ensuredSubjectClasses, "f").add(entry.name);
9265
+ __classPrivateFieldGet$7(this, _PerspectiveProxy_ensuredSubjectClasses, "f").add(entry.name);
8903
9266
  }
8904
9267
  }
8905
9268
  /**
@@ -8939,7 +9302,7 @@ class PerspectiveProxy {
8939
9302
  * in-process and returns link triples for client-side reconstruction.
8940
9303
  */
8941
9304
  async getShacl(name) {
8942
- const result = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").getShacl(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, name);
9305
+ const result = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getShacl(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, name);
8943
9306
  if (!result)
8944
9307
  return null;
8945
9308
  return SHACLShape.fromLinks(result.links, result.shapeUri);
@@ -8948,7 +9311,7 @@ class PerspectiveProxy {
8948
9311
  * List the names of every SHACL shape stored in this Perspective (one RPC call).
8949
9312
  */
8950
9313
  async getShaclNames() {
8951
- return __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").getShaclNames(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
9314
+ return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getShaclNames(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8952
9315
  }
8953
9316
  /**
8954
9317
  * Resolve a shape's `sh:targetClass` by name (one RPC call).
@@ -8959,7 +9322,7 @@ class PerspectiveProxy {
8959
9322
  * so this method is a pure passthrough.
8960
9323
  */
8961
9324
  async getShaclTargetClass(name) {
8962
- return __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").getShaclTargetClass(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, name);
9325
+ return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getShaclTargetClass(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, name);
8963
9326
  }
8964
9327
  /**
8965
9328
  * Get all SHACL shapes stored in this Perspective (one RPC call).
@@ -8968,7 +9331,7 @@ class PerspectiveProxy {
8968
9331
  * does not hide the others.
8969
9332
  */
8970
9333
  async getAllShacl() {
8971
- const entries = await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").getAllShacl(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
9334
+ const entries = await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getAllShacl(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
8972
9335
  const shapes = [];
8973
9336
  for (const { name, shapeUri, links } of entries) {
8974
9337
  try {
@@ -9179,7 +9542,7 @@ class PerspectiveProxy {
9179
9542
  let className;
9180
9543
  if (typeof subjectClass === "string") {
9181
9544
  className = subjectClass;
9182
- await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").createSubject(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({
9545
+ await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").createSubject(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({
9183
9546
  className,
9184
9547
  initialValues
9185
9548
  }), exprAddr, initialValues ? JSON.stringify(initialValues) : undefined, batchId);
@@ -9191,7 +9554,7 @@ class PerspectiveProxy {
9191
9554
  if (!resolvedClassName) {
9192
9555
  throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");
9193
9556
  }
9194
- await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").createSubject(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({
9557
+ await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").createSubject(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({
9195
9558
  className: resolvedClassName,
9196
9559
  initialValues
9197
9560
  }), exprAddr, initialValues ? JSON.stringify(initialValues) : undefined, batchId);
@@ -9208,12 +9571,12 @@ class PerspectiveProxy {
9208
9571
  * abstract class (#1435), each value is written by every class of the
9209
9572
  * record that the abstract class reads, under its own name. */
9210
9573
  async updateSubject(className, exprAddr, values, batchId) {
9211
- await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").updateSubject(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, className, exprAddr, JSON.stringify(values), batchId);
9212
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
9574
+ await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").updateSubject(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, className, exprAddr, JSON.stringify(values), batchId);
9575
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
9213
9576
  }
9214
9577
  async getSubjectData(subjectClass, exprAddr) {
9215
9578
  if (typeof subjectClass === "string") {
9216
- return JSON.parse(await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").getSubjectData(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({ className: subjectClass }), exprAddr));
9579
+ return JSON.parse(await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getSubjectData(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({ className: subjectClass }), exprAddr));
9217
9580
  }
9218
9581
  const obj = subjectClass;
9219
9582
  const resolvedClassName = obj.className || obj.constructor?.className || obj.constructor?.prototype?.className
@@ -9221,7 +9584,7 @@ class PerspectiveProxy {
9221
9584
  if (!resolvedClassName) {
9222
9585
  throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");
9223
9586
  }
9224
- return JSON.parse(await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").getSubjectData(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({ className: resolvedClassName }), exprAddr));
9587
+ return JSON.parse(await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getSubjectData(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, JSON.stringify({ className: resolvedClassName }), exprAddr));
9225
9588
  }
9226
9589
  /**
9227
9590
  * Gets actions from SHACL links for a given predicate (e.g., ad4m://constructor, ad4m://destructor).
@@ -9272,8 +9635,8 @@ class PerspectiveProxy {
9272
9635
  // so it has no marker: the executor dispatches it by its URI.
9273
9636
  const ctor = subjectClass?.constructor;
9274
9637
  if (typeof subjectClass === "object" && ctor && Object.prototype.hasOwnProperty.call(ctor, 'builtinUri')) {
9275
- await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").removeSubject(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, ctor.builtinUri, exprAddr, batchId);
9276
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
9638
+ await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").removeSubject(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, ctor.builtinUri, exprAddr, batchId);
9639
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
9277
9640
  return;
9278
9641
  }
9279
9642
  let className = await this.stringOrTemplateObjectToSubjectClassName(subjectClass);
@@ -9282,8 +9645,8 @@ class PerspectiveProxy {
9282
9645
  const shapePattern = new RegExp(`[/:#]${this.escapeRegExp(className)}Shape$`);
9283
9646
  const markers = await this.get(new LinkQuery({ predicate: "ad4m://abstract" }));
9284
9647
  if (markers.some((link) => shapePattern.test(link.data.source))) {
9285
- await __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").removeSubject(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid, className, exprAddr, batchId);
9286
- invalidatePerspectiveCache(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
9648
+ await __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").removeSubject(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid, className, exprAddr, batchId);
9649
+ invalidatePerspectiveCache(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
9287
9650
  return;
9288
9651
  }
9289
9652
  // Get destructor actions from SHACL links (Prolog-free)
@@ -9605,7 +9968,7 @@ class PerspectiveProxy {
9605
9968
  // Get the class name from the JS class
9606
9969
  const className = jsClass.className || jsClass.prototype?.className || jsClass.name;
9607
9970
  // Skip if already registered for this perspective instance
9608
- if (__classPrivateFieldGet$6(this, _PerspectiveProxy_ensuredSubjectClasses, "f").has(className))
9971
+ if (__classPrivateFieldGet$7(this, _PerspectiveProxy_ensuredSubjectClasses, "f").has(className))
9609
9972
  return;
9610
9973
  // Note: Duplicate checking is handled on the Rust side in add_sdna
9611
9974
  // Generate SHACL SDNA (Prolog-free)
@@ -9620,13 +9983,13 @@ class PerspectiveProxy {
9620
9983
  // Backend stores SHACL links directly
9621
9984
  await this.addSdna(className, '', 'subject_class', shaclJson);
9622
9985
  // Mark as registered for this perspective instance
9623
- __classPrivateFieldGet$6(this, _PerspectiveProxy_ensuredSubjectClasses, "f").add(className);
9986
+ __classPrivateFieldGet$7(this, _PerspectiveProxy_ensuredSubjectClasses, "f").add(className);
9624
9987
  }
9625
9988
  /** Clear the per-instance ensured subject class cache.
9626
9989
  * Call this after wiping a perspective's links so that
9627
9990
  * subsequent register() calls re-add SHACL definitions. */
9628
9991
  clearEnsuredSubjectClasses() {
9629
- __classPrivateFieldGet$6(this, _PerspectiveProxy_ensuredSubjectClasses, "f").clear();
9992
+ __classPrivateFieldGet$7(this, _PerspectiveProxy_ensuredSubjectClasses, "f").clear();
9630
9993
  }
9631
9994
  /**
9632
9995
  * Returns a list of all class names that have been registered as SHACL
@@ -9801,7 +10164,7 @@ class PerspectiveProxy {
9801
10164
  }));
9802
10165
  }
9803
10166
  getNeighbourhoodProxy() {
9804
- return __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").getNeighbourhoodProxy(__classPrivateFieldGet$6(this, _PerspectiveProxy_handle, "f").uuid);
10167
+ return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").getNeighbourhoodProxy(__classPrivateFieldGet$7(this, _PerspectiveProxy_handle, "f").uuid);
9805
10168
  }
9806
10169
  /**
9807
10170
  * Returns a proxy object for working with AI capabilities.
@@ -9818,13 +10181,13 @@ class PerspectiveProxy {
9818
10181
  * ```
9819
10182
  */
9820
10183
  get ai() {
9821
- return __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f").aiClient;
10184
+ return __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f").aiClient;
9822
10185
  }
9823
10186
  /** Live SPARQL query: resolves once the first result is in.
9824
10187
  * Call `dispose()` on the returned proxy when done. The executor
9825
10188
  * refuses a Prolog query (400): Prolog live queries are not supported. */
9826
10189
  async subscribeQuery(query) {
9827
- const subscription = new QuerySubscriptionProxy(this.uuid, query, __classPrivateFieldGet$6(this, _PerspectiveProxy_client, "f"));
10190
+ const subscription = new QuerySubscriptionProxy(this.uuid, query, __classPrivateFieldGet$7(this, _PerspectiveProxy_client, "f"));
9828
10191
  try {
9829
10192
  await subscription.subscribe();
9830
10193
  }
@@ -9839,13 +10202,13 @@ class PerspectiveProxy {
9839
10202
  }
9840
10203
  _PerspectiveProxy_handle = new WeakMap(), _PerspectiveProxy_client = new WeakMap(), _PerspectiveProxy_releases = new WeakMap(), _PerspectiveProxy_ensuredSubjectClasses = new WeakMap(), _PerspectiveProxy_overlaysInFlight = new WeakMap();
9841
10204
 
9842
- var __classPrivateFieldSet$5 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10205
+ var __classPrivateFieldSet$6 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
9843
10206
  if (kind === "m") throw new TypeError("Private method is not writable");
9844
10207
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9845
10208
  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");
9846
10209
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
9847
10210
  };
9848
- var __classPrivateFieldGet$5 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10211
+ var __classPrivateFieldGet$6 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9849
10212
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9850
10213
  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");
9851
10214
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -9861,27 +10224,27 @@ class PerspectiveClient {
9861
10224
  _PerspectiveClient_expressionClient.set(this, void 0);
9862
10225
  _PerspectiveClient_neighbourhoodClient.set(this, void 0);
9863
10226
  _PerspectiveClient_aiClient.set(this, void 0);
9864
- __classPrivateFieldSet$5(this, _PerspectiveClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
10227
+ __classPrivateFieldSet$6(this, _PerspectiveClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
9865
10228
  }
9866
10229
  setExpressionClient(client) {
9867
- __classPrivateFieldSet$5(this, _PerspectiveClient_expressionClient, client, "f");
10230
+ __classPrivateFieldSet$6(this, _PerspectiveClient_expressionClient, client, "f");
9868
10231
  }
9869
10232
  setNeighbourhoodClient(client) {
9870
- __classPrivateFieldSet$5(this, _PerspectiveClient_neighbourhoodClient, client, "f");
10233
+ __classPrivateFieldSet$6(this, _PerspectiveClient_neighbourhoodClient, client, "f");
9871
10234
  }
9872
10235
  setAIClient(client) {
9873
- __classPrivateFieldSet$5(this, _PerspectiveClient_aiClient, client, "f");
10236
+ __classPrivateFieldSet$6(this, _PerspectiveClient_aiClient, client, "f");
9874
10237
  }
9875
10238
  get aiClient() {
9876
- return __classPrivateFieldGet$5(this, _PerspectiveClient_aiClient, "f");
10239
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_aiClient, "f");
9877
10240
  }
9878
10241
  async all() {
9879
- const perspectives = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.all', {});
10242
+ const perspectives = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.all', {});
9880
10243
  return perspectives.map(handle => new PerspectiveProxy(PerspectiveHandle.fromWire(handle), this));
9881
10244
  }
9882
10245
  async byUUID(uuid) {
9883
10246
  try {
9884
- const perspective = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.get', { uuid });
10247
+ const perspective = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.get', { uuid });
9885
10248
  if (!perspective)
9886
10249
  return null;
9887
10250
  return new PerspectiveProxy(PerspectiveHandle.fromWire(perspective), this);
@@ -9893,11 +10256,11 @@ class PerspectiveClient {
9893
10256
  }
9894
10257
  }
9895
10258
  async snapshotByUUID(uuid) {
9896
- const snapshot = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.snapshot', { uuid });
10259
+ const snapshot = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.snapshot', { uuid });
9897
10260
  return snapshot ? new Perspective(snapshot.links.map(LinkExpression.fromWire)) : null;
9898
10261
  }
9899
10262
  async publishSnapshotByUUID(uuid) {
9900
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.publishSnapshot', { uuid });
10263
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.publishSnapshot', { uuid });
9901
10264
  }
9902
10265
  async queryLinks(uuid, query, options) {
9903
10266
  const params = { uuid };
@@ -9913,45 +10276,45 @@ class PerspectiveClient {
9913
10276
  params.untilDate = query.untilDate instanceof Date ? query.untilDate.toISOString() : String(query.untilDate);
9914
10277
  if (query.limit !== undefined)
9915
10278
  params.limit = query.limit;
9916
- const links = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.queryLinks', params, options);
10279
+ const links = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.queryLinks', params, options);
9917
10280
  return links.map(LinkExpression.fromWire);
9918
10281
  }
9919
10282
  async queryProlog(uuid, query, options) {
9920
- const result = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.queryProlog', { uuid, query }, options);
10283
+ const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.queryProlog', { uuid, query }, options);
9921
10284
  return JSON.parse(result);
9922
10285
  }
9923
10286
  async querySparql(uuid, query, options) {
9924
- const result = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.querySparql', { uuid, engine: 'sparql', query }, options);
10287
+ const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.querySparql', { uuid, engine: 'sparql', query }, options);
9925
10288
  return JSON.parse(result);
9926
10289
  }
9927
10290
  /** Open a live SPARQL query. Updates arrive through {@link onQueryUpdate}. */
9928
10291
  /** `options.signal` cancels the call, and the executor stops computing the first result. */
9929
10292
  async subscribeQuery(uuid, query, options) {
9930
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.subscribeQuery', { uuid, query }, options);
10293
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.subscribeQuery', { uuid, query }, options);
9931
10294
  }
9932
10295
  /** Every `query-subscription-update` event on this client's socket. */
9933
10296
  onQueryUpdate(cb) {
9934
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").on('query-subscription-update', cb);
10297
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").on('query-subscription-update', cb);
9935
10298
  }
9936
10299
  /** The current result and revision of a live query, after a revision gap. */
9937
10300
  async resyncSubscription(uuid, subscriptionId) {
9938
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.resyncSubscription', { uuid, subscriptionId });
10301
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.resyncSubscription', { uuid, subscriptionId });
9939
10302
  }
9940
10303
  /** Ends the subscription on the executor. The caller releases its local listener
9941
10304
  * with the function {@link onQueryUpdate} returned. */
9942
10305
  async disposeQuerySubscription(uuid, subscriptionId) {
9943
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.disposeQuery', { uuid, subscriptionId });
10306
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.disposeQuery', { uuid, subscriptionId });
9944
10307
  }
9945
10308
  /** `className` may name several classes: one query over their union (#1238). */
9946
10309
  async modelQuery(uuid, className, queryJson, options) {
9947
- const resultJson = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.modelQuery', { uuid, ...classParams(className), query_json: queryJson }, options);
10310
+ const resultJson = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.modelQuery', { uuid, ...classParams(className), query_json: queryJson }, options);
9948
10311
  return JSON.parse(resultJson);
9949
10312
  }
9950
10313
  async subjectClassesOf(uuid, uris) {
9951
- return await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.subjectClassesOf', { uuid, uris });
10314
+ return await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.subjectClassesOf', { uuid, uris });
9952
10315
  }
9953
10316
  async evaluateGetters(uuid, className, instanceIds, propertyNames) {
9954
- const resultJson = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.evaluateGetters', {
10317
+ const resultJson = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.evaluateGetters', {
9955
10318
  uuid,
9956
10319
  class_name: className,
9957
10320
  instance_ids: instanceIds,
@@ -9962,34 +10325,34 @@ class PerspectiveClient {
9962
10325
  /** Open a live model query over one class or several. Updates arrive through {@link onQueryUpdate}. */
9963
10326
  /** `options.signal` cancels the call, and the executor stops computing the first result. */
9964
10327
  async modelSubscribe(uuid, className, queryJson, options) {
9965
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.modelSubscribe', { uuid, ...classParams(className), query_json: queryJson }, options);
10328
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.modelSubscribe', { uuid, ...classParams(className), query_json: queryJson }, options);
9966
10329
  }
9967
10330
  async add(name) {
9968
- const handle = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.create', { name });
10331
+ const handle = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.create', { name });
9969
10332
  return new PerspectiveProxy(PerspectiveHandle.fromWire(handle), this);
9970
10333
  }
9971
10334
  async update(uuid, name) {
9972
- const handle = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.update', { uuid, name });
10335
+ const handle = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.update', { uuid, name });
9973
10336
  return new PerspectiveProxy(PerspectiveHandle.fromWire(handle), this);
9974
10337
  }
9975
10338
  async remove(uuid) {
9976
- const result = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.remove', { uuid });
10339
+ const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.remove', { uuid });
9977
10340
  return { perspectiveRemove: result };
9978
10341
  }
9979
10342
  async addLink(uuid, link, status = 'shared', batchId) {
9980
- const added = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.addLink', { uuid, link, status, batchId });
10343
+ const added = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.addLink', { uuid, link, status, batchId });
9981
10344
  return LinkExpression.fromWire(added);
9982
10345
  }
9983
10346
  async addLinks(uuid, links, status = 'shared', batchId) {
9984
- const added = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.addLinks', { uuid, links, status, batchId });
10347
+ const added = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.addLinks', { uuid, links, status, batchId });
9985
10348
  return added.map(LinkExpression.fromWire);
9986
10349
  }
9987
10350
  async removeLinks(uuid, links, batchId) {
9988
- const removed = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.removeLinks', { uuid, links: links.map(linkExpressionInputToWire), batchId });
10351
+ const removed = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.removeLinks', { uuid, links: links.map(linkExpressionInputToWire), batchId });
9989
10352
  return removed.map(LinkExpression.fromWire);
9990
10353
  }
9991
10354
  async linkMutations(uuid, mutations, status) {
9992
- const diff = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.linkMutations', { uuid, mutations: linkMutationsToWire(mutations), status });
10355
+ const diff = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.linkMutations', { uuid, mutations: linkMutationsToWire(mutations), status });
9993
10356
  return LinkExpressionMutations.fromWire(diff);
9994
10357
  }
9995
10358
  /**
@@ -10009,7 +10372,7 @@ class PerspectiveClient {
10009
10372
  * are NOT re-parented — same rule as the watcher).
10010
10373
  */
10011
10374
  async runInterpretation(uuid, transcript, basePrefix, classes, existingScope, mintScope, observe, options) {
10012
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.runInterpretation', {
10375
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.runInterpretation', {
10013
10376
  uuid, transcript, basePrefix, classes, existingScope, mintScope,
10014
10377
  observationId: observe?.observationId,
10015
10378
  emitDebugEvents: observe?.emitDebugEvents,
@@ -10036,7 +10399,7 @@ class PerspectiveClient {
10036
10399
  // `emitDebugEvents` is a dead-letter without an observationId
10037
10400
  // (nothing to key against); the server gates on both.
10038
10401
  observationId, emitDebugEvents, options) {
10039
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.runInterpretationWithHarness', {
10402
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.runInterpretationWithHarness', {
10040
10403
  uuid,
10041
10404
  transcript,
10042
10405
  basePrefix,
@@ -10059,7 +10422,7 @@ class PerspectiveClient {
10059
10422
  * calls before it answers.
10060
10423
  */
10061
10424
  async runAgent(uuid, messages, settings, options) {
10062
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.runAgent', { uuid, messages, ...settings }, options);
10425
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.runAgent', { uuid, messages, ...settings }, options);
10063
10426
  }
10064
10427
  /**
10065
10428
  * Register a neighbourhood auto-processor on this perspective. The executor's
@@ -10070,15 +10433,15 @@ class PerspectiveClient {
10070
10433
  * Returns the processor id.
10071
10434
  */
10072
10435
  async addAutoProcessor(uuid, config) {
10073
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.addAutoProcessor', { ...config, uuid });
10436
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.addAutoProcessor', { ...config, uuid });
10074
10437
  }
10075
10438
  /** Delete an auto-processor's config. `false` when there was none to delete. */
10076
10439
  async removeAutoProcessor(uuid, processorId) {
10077
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.removeAutoProcessor', { uuid, processorId });
10440
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.removeAutoProcessor', { uuid, processorId });
10078
10441
  }
10079
10442
  /** Pending interpretation overlays (LLM suggestions awaiting human accept/reject). */
10080
10443
  async interpretationOverlays(uuid) {
10081
- const overlays = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.interpretationOverlays', { uuid });
10444
+ const overlays = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.interpretationOverlays', { uuid });
10082
10445
  return overlays.map(({ base, kind, run, inferred }) => ({
10083
10446
  base, run, inferred, kind: kind === 'create' ? 'create' : 'update',
10084
10447
  }));
@@ -10086,18 +10449,18 @@ class PerspectiveClient {
10086
10449
  /** Accept an overlay's suggestion(s): the LLM value becomes the real value and
10087
10450
  * the overlay is deleted. Omit `property` to accept the whole base. */
10088
10451
  async acceptInterpretation(uuid, base, property) {
10089
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.acceptInterpretation', { uuid, base, property });
10452
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.acceptInterpretation', { uuid, base, property });
10090
10453
  }
10091
10454
  /** Reject an overlay's suggestion(s). Omit `property` to reject the whole base
10092
10455
  * (a rejected `create` deletes the suggested instance). */
10093
10456
  async rejectInterpretation(uuid, base, property) {
10094
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.rejectInterpretation', { uuid, base, property });
10457
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.rejectInterpretation', { uuid, base, property });
10095
10458
  }
10096
10459
  async proposeFlowTransition(uuid, instanceUri, toState, rationale, outputs) {
10097
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.proposeFlowTransition', { uuid, instanceUri, toState, rationale, outputs });
10460
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.proposeFlowTransition', { uuid, instanceUri, toState, rationale, outputs });
10098
10461
  }
10099
10462
  async acceptFlowProposal(uuid, proposalUri) {
10100
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.acceptFlowProposal', { uuid, proposalUri });
10463
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.acceptFlowProposal', { uuid, proposalUri });
10101
10464
  }
10102
10465
  /**
10103
10466
  * Withdraw this agent's own links from a proposal. Resolves to how many
@@ -10105,69 +10468,69 @@ class PerspectiveClient {
10105
10468
  * proposal this agent opened.
10106
10469
  */
10107
10470
  async rejectFlowProposal(uuid, proposalUri) {
10108
- const result = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.rejectFlowProposal', { uuid, proposalUri });
10471
+ const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.rejectFlowProposal', { uuid, proposalUri });
10109
10472
  return result.retractedLinks;
10110
10473
  }
10111
10474
  /** Re-decide a flow receipt under this perspective's own flow catalogue. */
10112
10475
  async verifyFlowReceipt(uuid, receipt) {
10113
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.verifyFlowReceipt', { uuid, receipt });
10476
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.verifyFlowReceipt', { uuid, receipt });
10114
10477
  }
10115
10478
  /** The instances that are, as they stand, valid outputs of `flow`
10116
10479
  * (optionally: of runs settled into terminal state `state`). */
10117
10480
  async flowValidOutputs(uuid, flow, state) {
10118
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.flowValidOutputs', { uuid, flow, state });
10481
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.flowValidOutputs', { uuid, flow, state });
10119
10482
  }
10120
10483
  /** The calling agent's recorded state of each flow instance it has
10121
10484
  * derived, optionally narrowed to `instances`. */
10122
10485
  async flowStates(uuid, instances) {
10123
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.flowStates', { uuid, instances });
10486
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.flowStates', { uuid, instances });
10124
10487
  }
10125
10488
  /** The proposals of `instance` the calling agent's replica recorded as
10126
10489
  * fired, sorted. */
10127
10490
  async flowFired(uuid, instance) {
10128
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.flowFired', { uuid, instance });
10491
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.flowFired', { uuid, instance });
10129
10492
  }
10130
10493
  /** Mint and store the receipt for a completed flow run. Fails while the
10131
10494
  * run has not settled into a terminal state, and when an output's
10132
10495
  * content no longer matches what the quorum committed to. */
10133
10496
  async mintFlowReceipt(uuid, instanceUri) {
10134
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.mintFlowReceipt', { uuid, instanceUri });
10497
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.mintFlowReceipt', { uuid, instanceUri });
10135
10498
  }
10136
10499
  async addLinkExpression(uuid, link, status = 'shared', batchId) {
10137
- const added = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.addLinkExpression', { uuid, link: linkExpressionToWire(link), status, batchId });
10500
+ const added = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.addLinkExpression', { uuid, link: linkExpressionToWire(link), status, batchId });
10138
10501
  return LinkExpression.fromWire(added);
10139
10502
  }
10140
10503
  async updateLink(uuid, oldLink, newLink, batchId) {
10141
- const updated = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.updateLink', { uuid, oldLink: linkExpressionInputToWire(oldLink), newLink, batchId });
10504
+ const updated = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.updateLink', { uuid, oldLink: linkExpressionInputToWire(oldLink), newLink, batchId });
10142
10505
  return LinkExpression.fromWire(updated);
10143
10506
  }
10144
10507
  async removeLink(uuid, link, batchId) {
10145
10508
  const { status, ...wire } = linkExpressionInputToWire(link);
10146
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.removeLink', { uuid, link: wire, batchId });
10509
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.removeLink', { uuid, link: wire, batchId });
10147
10510
  }
10148
10511
  async addSdna(uuid, name, sdnaCode, sdnaType, shaclJson) {
10149
- const result = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.addSdna', { uuid, name, sdnaCode: sdnaCode || "", sdnaType, shaclJson });
10512
+ const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.addSdna', { uuid, name, sdnaCode: sdnaCode || "", sdnaType, shaclJson });
10150
10513
  return typeof result === 'boolean' ? result : result.every(Boolean);
10151
10514
  }
10152
10515
  async addSdnaBatch(uuid, entries) {
10153
- const result = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.addSdna', { uuid, entries: entries.map(e => ({ ...e, sdnaCode: e.sdnaCode || "" })) });
10516
+ const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.addSdna', { uuid, entries: entries.map(e => ({ ...e, sdnaCode: e.sdnaCode || "" })) });
10154
10517
  return typeof result === 'boolean' ? [result] : result;
10155
10518
  }
10156
10519
  async executeCommands(uuid, commands, expression, parameters, batchId) {
10157
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.executeCommands', { uuid, commands, expression, parameters, batchId });
10520
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.executeCommands', { uuid, commands, expression, parameters, batchId });
10158
10521
  }
10159
10522
  async createSubject(uuid, subjectClass, expressionAddress, initialValues, batchId) {
10160
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.createSubject', { uuid, subjectClass, expressionAddress, initialValues, batchId });
10523
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.createSubject', { uuid, subjectClass, expressionAddress, initialValues, batchId });
10161
10524
  }
10162
10525
  /** Through an abstract class (#1435), the executor writes to the record's own classes. */
10163
10526
  async updateSubject(uuid, subjectClass, expressionAddress, values, batchId) {
10164
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.updateSubject', { uuid, subjectClass, expressionAddress, values, batchId });
10527
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.updateSubject', { uuid, subjectClass, expressionAddress, values, batchId });
10165
10528
  }
10166
10529
  async removeSubject(uuid, subjectClass, expressionAddress, batchId) {
10167
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.removeSubject', { uuid, subjectClass, expressionAddress, batchId });
10530
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.removeSubject', { uuid, subjectClass, expressionAddress, batchId });
10168
10531
  }
10169
10532
  async getSubjectData(uuid, subjectClass, expressionAddress) {
10170
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.getSubjectData', { uuid, subjectClass, expressionAddress });
10533
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.getSubjectData', { uuid, subjectClass, expressionAddress });
10171
10534
  }
10172
10535
  // ── SHACL resolution (server-side) ─────────────────────────────────────────
10173
10536
  // These methods delegate shape resolution to the executor, which reads links
@@ -10175,7 +10538,7 @@ class PerspectiveClient {
10175
10538
  // `queryLinks` sequences the old PerspectiveProxy methods performed.
10176
10539
  /** List the names of every SHACL shape stored in a perspective (one RPC call). */
10177
10540
  async getShaclNames(uuid) {
10178
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.getShaclNames', { uuid });
10541
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.getShaclNames', { uuid });
10179
10542
  }
10180
10543
  /**
10181
10544
  * Resolve a shape's `sh:targetClass` by name (one RPC call).
@@ -10188,7 +10551,7 @@ class PerspectiveClient {
10188
10551
  * than pushing the null one layer further up. PR #935 review r3897752023.
10189
10552
  */
10190
10553
  async getShaclTargetClass(uuid, name) {
10191
- const result = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.getShaclTargetClass', { uuid, name });
10554
+ const result = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.getShaclTargetClass', { uuid, name });
10192
10555
  return result ?? undefined;
10193
10556
  }
10194
10557
  /**
@@ -10197,51 +10560,51 @@ class PerspectiveClient {
10197
10560
  * or `null` if no shape with that name exists.
10198
10561
  */
10199
10562
  async getShacl(uuid, name) {
10200
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.getShacl', { uuid, name });
10563
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.getShacl', { uuid, name });
10201
10564
  }
10202
10565
  /**
10203
10566
  * Retrieve all SHACL shapes in one call. Returns an array of
10204
10567
  * `{name, shapeUri, links}` — one entry per shape (one RPC call).
10205
10568
  */
10206
10569
  async getAllShacl(uuid) {
10207
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.getAllShacl', { uuid });
10570
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.getAllShacl', { uuid });
10208
10571
  }
10209
10572
  // ExpressionClient functions, needed for Subjects:
10210
10573
  async getExpression(expressionURI) {
10211
- return await __classPrivateFieldGet$5(this, _PerspectiveClient_expressionClient, "f").get(expressionURI);
10574
+ return await __classPrivateFieldGet$6(this, _PerspectiveClient_expressionClient, "f").get(expressionURI);
10212
10575
  }
10213
10576
  async createExpression(content, languageAddress) {
10214
- return await __classPrivateFieldGet$5(this, _PerspectiveClient_expressionClient, "f").create(content, languageAddress);
10577
+ return await __classPrivateFieldGet$6(this, _PerspectiveClient_expressionClient, "f").create(content, languageAddress);
10215
10578
  }
10216
10579
  /** The client's event bus; see {@link ApiClient.on}. */
10217
10580
  on(type, handler, filter) {
10218
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").on(type, handler, filter);
10581
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").on(type, handler, filter);
10219
10582
  }
10220
10583
  getNeighbourhoodProxy(uuid) {
10221
- return new NeighbourhoodProxy(__classPrivateFieldGet$5(this, _PerspectiveClient_neighbourhoodClient, "f"), uuid);
10584
+ return new NeighbourhoodProxy(__classPrivateFieldGet$6(this, _PerspectiveClient_neighbourhoodClient, "f"), uuid);
10222
10585
  }
10223
10586
  async createBatch(uuid) {
10224
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.createBatch', { uuid });
10587
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.createBatch', { uuid });
10225
10588
  }
10226
10589
  async commitBatch(uuid, batchId) {
10227
- const diff = await __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").call('perspective.commitBatch', { uuid, batchId });
10590
+ const diff = await __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").call('perspective.commitBatch', { uuid, batchId });
10228
10591
  return LinkExpressionMutations.fromWire(diff);
10229
10592
  }
10230
10593
  /** Register a callback that fires after a successful WebSocket reconnect.
10231
10594
  * Passes through to ApiClient.onReconnect(). Returns an unsubscribe function. */
10232
10595
  onReconnect(callback) {
10233
- return __classPrivateFieldGet$5(this, _PerspectiveClient_apiClient, "f").onReconnect(callback);
10596
+ return __classPrivateFieldGet$6(this, _PerspectiveClient_apiClient, "f").onReconnect(callback);
10234
10597
  }
10235
10598
  }
10236
10599
  _PerspectiveClient_apiClient = new WeakMap(), _PerspectiveClient_expressionClient = new WeakMap(), _PerspectiveClient_neighbourhoodClient = new WeakMap(), _PerspectiveClient_aiClient = new WeakMap();
10237
10600
 
10238
- var __classPrivateFieldSet$4 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10601
+ var __classPrivateFieldSet$5 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10239
10602
  if (kind === "m") throw new TypeError("Private method is not writable");
10240
10603
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10241
10604
  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");
10242
10605
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
10243
10606
  };
10244
- var __classPrivateFieldGet$4 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10607
+ var __classPrivateFieldGet$5 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10245
10608
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10246
10609
  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");
10247
10610
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -10250,197 +10613,197 @@ var _RuntimeClient_apiClient;
10250
10613
  class RuntimeClient {
10251
10614
  constructor(baseUrl, token, sharedApiClient) {
10252
10615
  _RuntimeClient_apiClient.set(this, void 0);
10253
- __classPrivateFieldSet$4(this, _RuntimeClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
10616
+ __classPrivateFieldSet$5(this, _RuntimeClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
10254
10617
  }
10255
10618
  async info() {
10256
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.info', {});
10619
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.info', {});
10257
10620
  }
10258
10621
  async tlsDomain() {
10259
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.tlsDomain', {});
10622
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.tlsDomain', {});
10260
10623
  }
10261
10624
  async quit() {
10262
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.quit', {});
10625
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.quit', {});
10263
10626
  }
10264
10627
  async openLink(url) {
10265
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.openLink', { url });
10628
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.openLink', { url });
10266
10629
  }
10267
10630
  async addTrustedAgents(agents) {
10268
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('agent.addTrustedAgents', { agents });
10631
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('agent.addTrustedAgents', { agents });
10269
10632
  }
10270
10633
  async deleteTrustedAgents(agents) {
10271
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('agent.deleteTrustedAgents', { agents });
10634
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('agent.deleteTrustedAgents', { agents });
10272
10635
  }
10273
10636
  async getTrustedAgents() {
10274
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('agent.getTrustedAgents', {});
10637
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('agent.getTrustedAgents', {});
10275
10638
  }
10276
10639
  async addKnownLinkLanguageTemplates(addresses) {
10277
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.addLinkLanguageTemplates', { addresses });
10640
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.addLinkLanguageTemplates', { addresses });
10278
10641
  }
10279
10642
  async removeKnownLinkLanguageTemplates(addresses) {
10280
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.removeLinkLanguageTemplates', { addresses });
10643
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.removeLinkLanguageTemplates', { addresses });
10281
10644
  }
10282
10645
  /** Every link-language template the executor knows, with its meta (name, description,
10283
10646
  * `possibleTemplateParams`). A template whose meta cannot be read is left out. */
10284
10647
  async knownLinkLanguageTemplates() {
10285
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.linkLanguageTemplates', {});
10648
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.linkLanguageTemplates', {});
10286
10649
  }
10287
10650
  async addFriends(dids) {
10288
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.addFriends', { dids });
10651
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.addFriends', { dids });
10289
10652
  }
10290
10653
  async removeFriends(dids) {
10291
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.removeFriends', { dids });
10654
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.removeFriends', { dids });
10292
10655
  }
10293
10656
  async friends() {
10294
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.friends', {});
10657
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.friends', {});
10295
10658
  }
10296
10659
  async hcAgentInfos() {
10297
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.hcAgentInfos', {});
10660
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.hcAgentInfos', {});
10298
10661
  }
10299
10662
  async getNetworkMetrics() {
10300
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.networkMetrics', {});
10663
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.networkMetrics', {});
10301
10664
  }
10302
10665
  async restartHolochain(options) {
10303
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.restartHolochain', {}, options);
10666
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.restartHolochain', {}, options);
10304
10667
  }
10305
10668
  async hcAddAgentInfos(agentInfos) {
10306
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.addHcAgentInfos', { agentInfos });
10669
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.addHcAgentInfos', { agentInfos });
10307
10670
  }
10308
10671
  async verifyStringSignedByDid(did, didSigningKeyId, data, signedData) {
10309
10672
  // The executor resolves the key from the DID document; `didSigningKeyId` goes unused.
10310
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.verifySignature', { did, data, signedData });
10673
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.verifySignature', { did, data, signedData });
10311
10674
  }
10312
10675
  async setStatus(perspective) {
10313
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.setStatus', { status: Perspective.toWire(perspective) });
10676
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.setStatus', { status: Perspective.toWire(perspective) });
10314
10677
  }
10315
10678
  async friendStatus(did) {
10316
- const status = await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.friendStatus', { did });
10679
+ const status = await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.friendStatus', { did });
10317
10680
  return status ? PerspectiveExpression.fromWire(status) : null;
10318
10681
  }
10319
10682
  async friendSendMessage(did, message) {
10320
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.sendFriendMessage', { did, message: Perspective.toWire(message) });
10683
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.sendFriendMessage', { did, message: Perspective.toWire(message) });
10321
10684
  }
10322
10685
  async messageInbox() {
10323
- return (await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.inbox', {})).map(PerspectiveExpression.fromWire);
10686
+ return (await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.inbox', {})).map(PerspectiveExpression.fromWire);
10324
10687
  }
10325
10688
  async messageOutbox() {
10326
- const sent = await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.outbox', {});
10689
+ const sent = await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.outbox', {});
10327
10690
  return sent.map(({ recipient, message }) => ({ recipient, message: PerspectiveExpression.fromWire(message) }));
10328
10691
  }
10329
10692
  async requestInstallNotification(notification) {
10330
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.createNotification', { ...notification });
10693
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.createNotification', { ...notification });
10331
10694
  }
10332
10695
  async grantNotification(id) {
10333
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.grantNotification', { id, granted: true });
10696
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.grantNotification', { id, granted: true });
10334
10697
  }
10335
10698
  async exportDb(filePath) {
10336
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.exportData', { type: "db", filePath });
10699
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.exportData', { type: "db", filePath });
10337
10700
  }
10338
10701
  async importDb(filePath) {
10339
- const result = await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.importData', { type: "db", filePath });
10702
+ const result = await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.importData', { type: "db", filePath });
10340
10703
  if ('success' in result)
10341
10704
  throw new Error('runtime.importData answered a perspective import for type "db"');
10342
10705
  return result;
10343
10706
  }
10344
10707
  async notifications() {
10345
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.notifications', {});
10708
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.notifications', {});
10346
10709
  }
10347
10710
  async updateNotification(id, notification) {
10348
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.updateNotification', { ...notification, id });
10711
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.updateNotification', { ...notification, id });
10349
10712
  }
10350
10713
  async removeNotification(id) {
10351
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.deleteNotification', { id });
10714
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.deleteNotification', { id });
10352
10715
  }
10353
10716
  async exportPerspective(uuid, filePath) {
10354
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.exportData', { type: "perspective", perspectiveUuid: uuid, filePath });
10717
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.exportData', { type: "perspective", perspectiveUuid: uuid, filePath });
10355
10718
  }
10356
10719
  async importPerspective(filePath) {
10357
- const result = await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.importData', { type: "perspective", filePath });
10720
+ const result = await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.importData', { type: "perspective", filePath });
10358
10721
  return 'success' in result && result.success;
10359
10722
  }
10360
10723
  async multiUserEnabled() {
10361
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.multiUserEnabled', {});
10724
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.multiUserEnabled', {});
10362
10725
  }
10363
10726
  async setMultiUserEnabled(enabled) {
10364
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.setMultiUserEnabled', { enabled });
10727
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.setMultiUserEnabled', { enabled });
10365
10728
  }
10366
10729
  async freeHostingEnabled() {
10367
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.freeHostingEnabled', {});
10730
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.freeHostingEnabled', {});
10368
10731
  }
10369
10732
  async setFreeHostingEnabled(enabled) {
10370
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.setFreeHostingEnabled', { enabled });
10733
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.setFreeHostingEnabled', { enabled });
10371
10734
  }
10372
10735
  async listUsers() {
10373
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.list', {});
10736
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.list', {});
10374
10737
  }
10375
10738
  async userWalletAddress(email) {
10376
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.wallet', { email });
10739
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.wallet', { email });
10377
10740
  }
10378
10741
  async emailTestModeEnable() {
10379
- return (await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'enable' })) === true;
10742
+ return (await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'enable' })) === true;
10380
10743
  }
10381
10744
  async emailTestModeDisable() {
10382
- return (await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'disable' })) === true;
10745
+ return (await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'disable' })) === true;
10383
10746
  }
10384
10747
  async emailTestGetCode(email) {
10385
- const code = await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'get-code', email });
10748
+ const code = await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'get-code', email });
10386
10749
  return typeof code === 'string' ? code : null;
10387
10750
  }
10388
10751
  async emailTestClearCodes() {
10389
- return (await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'clear-codes' })) === true;
10752
+ return (await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'clear-codes' })) === true;
10390
10753
  }
10391
10754
  async emailTestSetExpiry(email, verificationType, expiresAt) {
10392
- return (await __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'set-expiry', email, verificationType, expiresAt })) === true;
10755
+ return (await __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.emailTest', { action: 'set-expiry', email, verificationType, expiresAt })) === true;
10393
10756
  }
10394
10757
  // ---- Unyt / mHOT methods ----
10395
10758
  async unytAgentKey() {
10396
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.unytAgentKey', {});
10759
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.unytAgentKey', {});
10397
10760
  }
10398
10761
  async unytHotAgentPubkey() {
10399
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.unytHotAgentPubkey', {});
10762
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.unytHotAgentPubkey', {});
10400
10763
  }
10401
10764
  async unytWalletBalance() {
10402
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.unytWalletBalance', {});
10765
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.unytWalletBalance', {});
10403
10766
  }
10404
10767
  async unytWalletHistory(page, perPage) {
10405
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.unytWalletHistory', { page, perPage });
10768
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.unytWalletHistory', { page, perPage });
10406
10769
  }
10407
10770
  /** Installed and bundled DNA versions, and why the last install failed (`installError`). */
10408
10771
  async unytVersionInfo() {
10409
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.unytVersionInfo', {});
10772
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.unytVersionInfo', {});
10410
10773
  }
10411
10774
  /** Stores the membrane proof (base64); the executor then installs the Unyt DNA in the
10412
10775
  * background. Poll {@link unytVersionInfo} for the outcome. */
10413
10776
  async setUnytMembraneProof(proof) {
10414
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.setUnytMembraneProof', { proof });
10777
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.setUnytMembraneProof', { proof });
10415
10778
  }
10416
10779
  async unytReinstallDna() {
10417
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.unytReinstallDna', {});
10780
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.unytReinstallDna', {});
10418
10781
  }
10419
10782
  async unytSendHot(recipient, amount) {
10420
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.unytSendHot', { recipient, amount });
10783
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.unytSendHot', { recipient, amount });
10421
10784
  }
10422
10785
  async setUserCredits(email, amount) {
10423
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.credits', { email, amount });
10786
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.credits', { email, amount });
10424
10787
  }
10425
10788
  async setUserFreeAccess(email, enabled) {
10426
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('user.freeAccess', { email, enabled });
10789
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('user.freeAccess', { email, enabled });
10427
10790
  }
10428
10791
  async setHostRates(rates) {
10429
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.setHostRates', { rates });
10792
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.setHostRates', { rates });
10430
10793
  }
10431
10794
  async hostRates() {
10432
- return __classPrivateFieldGet$4(this, _RuntimeClient_apiClient, "f").call('runtime.hostRates', {});
10795
+ return __classPrivateFieldGet$5(this, _RuntimeClient_apiClient, "f").call('runtime.hostRates', {});
10433
10796
  }
10434
10797
  }
10435
10798
  _RuntimeClient_apiClient = new WeakMap();
10436
10799
 
10437
- var __classPrivateFieldSet$3 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10800
+ var __classPrivateFieldSet$4 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
10438
10801
  if (kind === "m") throw new TypeError("Private method is not writable");
10439
10802
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10440
10803
  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");
10441
10804
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
10442
10805
  };
10443
- var __classPrivateFieldGet$3 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10806
+ var __classPrivateFieldGet$4 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
10444
10807
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10445
10808
  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");
10446
10809
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -10456,8 +10819,8 @@ class ExpressionClient {
10456
10819
  _ExpressionClient_totalMemBytes.set(this, 0);
10457
10820
  // L2: persistent cache (IndexedDB in browser, NullCache in Node)
10458
10821
  _ExpressionClient_persistent.set(this, void 0);
10459
- __classPrivateFieldSet$3(this, _ExpressionClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
10460
- __classPrivateFieldSet$3(this, _ExpressionClient_persistent, createPersistentCache('ad4m-expression-cache', 'expressions'), "f");
10822
+ __classPrivateFieldSet$4(this, _ExpressionClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
10823
+ __classPrivateFieldSet$4(this, _ExpressionClient_persistent, createPersistentCache('ad4m-expression-cache', 'expressions'), "f");
10461
10824
  }
10462
10825
  async get(url, alwaysGet = false) {
10463
10826
  // Existing literal fast-path
@@ -10474,55 +10837,55 @@ class ExpressionClient {
10474
10837
  }
10475
10838
  // L1: memory hit
10476
10839
  if (!alwaysGet) {
10477
- const memHit = __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").get(url);
10840
+ const memHit = __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").get(url);
10478
10841
  if (memHit)
10479
10842
  return memHit.data;
10480
10843
  }
10481
10844
  // Deduplicate in-flight requests
10482
10845
  if (!alwaysGet) {
10483
- const existing = __classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").get(url);
10846
+ const existing = __classPrivateFieldGet$4(this, _ExpressionClient_inflight, "f").get(url);
10484
10847
  if (existing)
10485
10848
  return existing;
10486
10849
  }
10487
10850
  // L2 check + L3 network
10488
10851
  const promise = (async () => {
10489
10852
  if (!alwaysGet) {
10490
- const persisted = await __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").get(url);
10853
+ const persisted = await __classPrivateFieldGet$4(this, _ExpressionClient_persistent, "f").get(url);
10491
10854
  if (persisted) {
10492
- __classPrivateFieldGet$3(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, url, persisted); // promote to L1
10855
+ __classPrivateFieldGet$4(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, url, persisted); // promote to L1
10493
10856
  return persisted;
10494
10857
  }
10495
10858
  }
10496
10859
  // L3: network fetch
10497
- const result = await __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.get', { url });
10498
- __classPrivateFieldGet$3(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, url, result);
10499
- __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").put(url, result); // fire-and-forget write to L2
10860
+ const result = await __classPrivateFieldGet$4(this, _ExpressionClient_apiClient, "f").call('expression.get', { url });
10861
+ __classPrivateFieldGet$4(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, url, result);
10862
+ __classPrivateFieldGet$4(this, _ExpressionClient_persistent, "f").put(url, result); // fire-and-forget write to L2
10500
10863
  return result;
10501
10864
  })();
10502
- __classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").set(url, promise);
10865
+ __classPrivateFieldGet$4(this, _ExpressionClient_inflight, "f").set(url, promise);
10503
10866
  try {
10504
10867
  return await promise;
10505
10868
  }
10506
10869
  finally {
10507
- __classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").delete(url);
10870
+ __classPrivateFieldGet$4(this, _ExpressionClient_inflight, "f").delete(url);
10508
10871
  }
10509
10872
  }
10510
10873
  async getMany(urls) {
10511
10874
  // Check L1 first
10512
- const results = urls.map(u => __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").get(u)?.data ?? null);
10875
+ const results = urls.map(u => __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").get(u)?.data ?? null);
10513
10876
  let uncachedIndices = results
10514
10877
  .map((r, i) => r === null ? i : -1)
10515
10878
  .filter(i => i >= 0);
10516
10879
  if (uncachedIndices.length === 0)
10517
10880
  return results;
10518
10881
  // Check L2 for remaining misses
10519
- const l2Results = await Promise.all(uncachedIndices.map(i => __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").get(urls[i])));
10882
+ const l2Results = await Promise.all(uncachedIndices.map(i => __classPrivateFieldGet$4(this, _ExpressionClient_persistent, "f").get(urls[i])));
10520
10883
  const stillMissing = [];
10521
10884
  for (let j = 0; j < uncachedIndices.length; j++) {
10522
10885
  const idx = uncachedIndices[j];
10523
10886
  if (l2Results[j]) {
10524
10887
  results[idx] = l2Results[j];
10525
- __classPrivateFieldGet$3(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, urls[idx], l2Results[j]); // promote to L1
10888
+ __classPrivateFieldGet$4(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, urls[idx], l2Results[j]); // promote to L1
10526
10889
  }
10527
10890
  else {
10528
10891
  stillMissing.push(idx);
@@ -10532,13 +10895,13 @@ class ExpressionClient {
10532
10895
  return results;
10533
10896
  // L3: fetch only truly uncached URLs
10534
10897
  const uncachedUrls = stillMissing.map(i => urls[i]);
10535
- const fetched = await __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.getMany', { urls: uncachedUrls });
10898
+ const fetched = await __classPrivateFieldGet$4(this, _ExpressionClient_apiClient, "f").call('expression.getMany', { urls: uncachedUrls });
10536
10899
  for (let i = 0; i < stillMissing.length; i++) {
10537
10900
  const idx = stillMissing[i];
10538
10901
  results[idx] = fetched[i];
10539
10902
  if (fetched[i]) {
10540
- __classPrivateFieldGet$3(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, uncachedUrls[i], fetched[i]);
10541
- __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").put(uncachedUrls[i], fetched[i]); // fire-and-forget
10903
+ __classPrivateFieldGet$4(this, _ExpressionClient_instances, "m", _ExpressionClient_memCacheResult).call(this, uncachedUrls[i], fetched[i]);
10904
+ __classPrivateFieldGet$4(this, _ExpressionClient_persistent, "f").put(uncachedUrls[i], fetched[i]); // fire-and-forget
10542
10905
  }
10543
10906
  }
10544
10907
  return results;
@@ -10547,44 +10910,44 @@ class ExpressionClient {
10547
10910
  * Clear both L1 (memory) and L2 (persistent) expression caches.
10548
10911
  */
10549
10912
  clearCache() {
10550
- __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").clear();
10551
- __classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").clear();
10552
- __classPrivateFieldSet$3(this, _ExpressionClient_totalMemBytes, 0, "f");
10553
- __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").clear(); // fire-and-forget
10913
+ __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").clear();
10914
+ __classPrivateFieldGet$4(this, _ExpressionClient_inflight, "f").clear();
10915
+ __classPrivateFieldSet$4(this, _ExpressionClient_totalMemBytes, 0, "f");
10916
+ __classPrivateFieldGet$4(this, _ExpressionClient_persistent, "f").clear(); // fire-and-forget
10554
10917
  }
10555
10918
  async getRaw(url) {
10556
- return __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.getRaw', { url });
10919
+ return __classPrivateFieldGet$4(this, _ExpressionClient_apiClient, "f").call('expression.getRaw', { url });
10557
10920
  }
10558
10921
  async create(content, languageAddress) {
10559
10922
  const serialized = JSON.stringify(content);
10560
- return __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.create', { content: serialized, languageAddress });
10923
+ return __classPrivateFieldGet$4(this, _ExpressionClient_apiClient, "f").call('expression.create', { content: serialized, languageAddress });
10561
10924
  }
10562
10925
  async interactions(url) {
10563
- return __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.interactions', { url });
10926
+ return __classPrivateFieldGet$4(this, _ExpressionClient_apiClient, "f").call('expression.interactions', { url });
10564
10927
  }
10565
10928
  async interact(url, interactionCall) {
10566
- const result = await __classPrivateFieldGet$3(this, _ExpressionClient_apiClient, "f").call('expression.interact', { url, interactionCall });
10929
+ const result = await __classPrivateFieldGet$4(this, _ExpressionClient_apiClient, "f").call('expression.interact', { url, interactionCall });
10567
10930
  // Interactions can mutate the expression — invalidate cache so next get() fetches fresh
10568
- __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").delete(url);
10569
- __classPrivateFieldGet$3(this, _ExpressionClient_inflight, "f").delete(url);
10570
- __classPrivateFieldGet$3(this, _ExpressionClient_persistent, "f").delete(url); // fire-and-forget
10931
+ __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").delete(url);
10932
+ __classPrivateFieldGet$4(this, _ExpressionClient_inflight, "f").delete(url);
10933
+ __classPrivateFieldGet$4(this, _ExpressionClient_persistent, "f").delete(url); // fire-and-forget
10571
10934
  return result;
10572
10935
  }
10573
10936
  }
10574
10937
  _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) {
10575
10938
  const size = JSON.stringify(data).length;
10576
10939
  // Evict oldest entries if we'd exceed limits
10577
- while (__classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").size >= ExpressionClient.MAX_MEM_ENTRIES ||
10578
- __classPrivateFieldGet$3(this, _ExpressionClient_totalMemBytes, "f") + size > ExpressionClient.MAX_MEM_BYTES) {
10579
- const oldest = __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").keys().next().value;
10940
+ while (__classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").size >= ExpressionClient.MAX_MEM_ENTRIES ||
10941
+ __classPrivateFieldGet$4(this, _ExpressionClient_totalMemBytes, "f") + size > ExpressionClient.MAX_MEM_BYTES) {
10942
+ const oldest = __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").keys().next().value;
10580
10943
  if (!oldest)
10581
10944
  break;
10582
- const entry = __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").get(oldest);
10583
- __classPrivateFieldSet$3(this, _ExpressionClient_totalMemBytes, __classPrivateFieldGet$3(this, _ExpressionClient_totalMemBytes, "f") - entry.size, "f");
10584
- __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").delete(oldest);
10945
+ const entry = __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").get(oldest);
10946
+ __classPrivateFieldSet$4(this, _ExpressionClient_totalMemBytes, __classPrivateFieldGet$4(this, _ExpressionClient_totalMemBytes, "f") - entry.size, "f");
10947
+ __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").delete(oldest);
10585
10948
  }
10586
- __classPrivateFieldGet$3(this, _ExpressionClient_memCache, "f").set(url, { data, size });
10587
- __classPrivateFieldSet$3(this, _ExpressionClient_totalMemBytes, __classPrivateFieldGet$3(this, _ExpressionClient_totalMemBytes, "f") + size, "f");
10949
+ __classPrivateFieldGet$4(this, _ExpressionClient_memCache, "f").set(url, { data, size });
10950
+ __classPrivateFieldSet$4(this, _ExpressionClient_totalMemBytes, __classPrivateFieldGet$4(this, _ExpressionClient_totalMemBytes, "f") + size, "f");
10588
10951
  };
10589
10952
  /** Maximum number of entries in the L1 memory cache. */
10590
10953
  ExpressionClient.MAX_MEM_ENTRIES = 200;
@@ -17660,13 +18023,13 @@ class AIModelLoadingStatus {
17660
18023
  }
17661
18024
  }
17662
18025
 
17663
- var __classPrivateFieldSet$2 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
18026
+ var __classPrivateFieldSet$3 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
17664
18027
  if (kind === "m") throw new TypeError("Private method is not writable");
17665
18028
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
17666
18029
  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");
17667
18030
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
17668
18031
  };
17669
- var __classPrivateFieldGet$2 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
18032
+ var __classPrivateFieldGet$3 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
17670
18033
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
17671
18034
  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");
17672
18035
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
@@ -17677,14 +18040,14 @@ class AIClient {
17677
18040
  _AIClient_apiClient.set(this, void 0);
17678
18041
  _AIClient_transcriptionUnsubscribers.set(this, new Map());
17679
18042
  _AIClient_pendingStreamIds.set(this, new Set());
17680
- __classPrivateFieldSet$2(this, _AIClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
18043
+ __classPrivateFieldSet$3(this, _AIClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
17681
18044
  }
17682
18045
  /** The executor names the model type `type`. */
17683
18046
  serializeModelInput({ modelType, ...model }) {
17684
18047
  return { ...model, type: modelType };
17685
18048
  }
17686
18049
  async getModels() {
17687
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.models', {});
18050
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.models', {});
17688
18051
  }
17689
18052
  /**
17690
18053
  * Ask a remote endpoint which models it serves, before adding one.
@@ -17699,35 +18062,35 @@ class AIClient {
17699
18062
  * that is not Anthropic speaks.
17700
18063
  */
17701
18064
  async discoverModels(baseUrl, apiKey, apiType) {
17702
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.discoverModels', { baseUrl, apiKey, apiType });
18065
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.discoverModels', { baseUrl, apiKey, apiType });
17703
18066
  }
17704
18067
  async addModel(model, options) {
17705
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.addModel', { model: this.serializeModelInput(model) }, options);
18068
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.addModel', { model: this.serializeModelInput(model) }, options);
17706
18069
  }
17707
18070
  async updateModel(modelId, model) {
17708
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.updateModel', { id: modelId, model: this.serializeModelInput(model) });
18071
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.updateModel', { id: modelId, model: this.serializeModelInput(model) });
17709
18072
  }
17710
18073
  async removeModel(modelId) {
17711
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.removeModel', { id: modelId });
18074
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.removeModel', { id: modelId });
17712
18075
  }
17713
18076
  async setDefaultModel(modelType, modelId) {
17714
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.setDefaultModel', { id: modelId, modelType });
18077
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.setDefaultModel', { id: modelId, modelType });
17715
18078
  }
17716
18079
  async getDefaultModel(modelType) {
17717
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.getDefaultModel', { modelType });
18080
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.getDefaultModel', { modelType });
17718
18081
  }
17719
18082
  async tasks() {
17720
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.tasks', {});
18083
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.tasks', {});
17721
18084
  }
17722
18085
  async addTask(name, modelId, systemPrompt, promptExamples, metaData) {
17723
18086
  const task = new AITaskInput(name, modelId, systemPrompt, promptExamples, metaData);
17724
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.addTask', { task });
18087
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.addTask', { task });
17725
18088
  }
17726
18089
  async removeTask(taskId) {
17727
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.removeTask', { id: taskId });
18090
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.removeTask', { id: taskId });
17728
18091
  }
17729
18092
  async updateTask(taskId, task) {
17730
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.updateTask', {
18093
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.updateTask', {
17731
18094
  task: {
17732
18095
  taskId,
17733
18096
  name: task.name,
@@ -17741,13 +18104,13 @@ class AIClient {
17741
18104
  });
17742
18105
  }
17743
18106
  async modelLoadingStatus(model) {
17744
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.modelLoadingStatus', { model });
18107
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.modelLoadingStatus', { model });
17745
18108
  }
17746
18109
  async prompt(taskId, prompt, options) {
17747
- return __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.prompt', { taskId, prompt }, options);
18110
+ return __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.prompt', { taskId, prompt }, options);
17748
18111
  }
17749
18112
  async embed(modelId, text, options) {
17750
- const aiEmbed = await __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.embed', { modelId, text }, options);
18113
+ const aiEmbed = await __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.embed', { modelId, text }, options);
17751
18114
  const compressed = base64Js.toByteArray(aiEmbed);
17752
18115
  // NB: pako v1 accepts `{ to: 'string' }`, pako v2 wants `{ toText: true }`,
17753
18116
  // pako v3 also drops that overload from its bundled types. Call the
@@ -17758,22 +18121,22 @@ class AIClient {
17758
18121
  return decompressed;
17759
18122
  }
17760
18123
  async openTranscriptionStream(modelId, streamCallback, params) {
17761
- const streamId = await __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.transcriptionOpen', { modelId, params });
17762
- const unsub = __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").on('transcription-text', (event) => {
18124
+ const streamId = await __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.transcriptionOpen', { modelId, params });
18125
+ const unsub = __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").on('transcription-text', (event) => {
17763
18126
  if (event.streamId === streamId && event.text)
17764
18127
  streamCallback(event.text);
17765
18128
  });
17766
- __classPrivateFieldGet$2(this, _AIClient_transcriptionUnsubscribers, "f").set(streamId, unsub);
18129
+ __classPrivateFieldGet$3(this, _AIClient_transcriptionUnsubscribers, "f").set(streamId, unsub);
17767
18130
  return streamId;
17768
18131
  }
17769
18132
  async closeTranscriptionStream(streamId) {
17770
- __classPrivateFieldGet$2(this, _AIClient_pendingStreamIds, "f").delete(streamId);
18133
+ __classPrivateFieldGet$3(this, _AIClient_pendingStreamIds, "f").delete(streamId);
17771
18134
  try {
17772
- await __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").call('ai.transcriptionClose', { streamId });
18135
+ await __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").call('ai.transcriptionClose', { streamId });
17773
18136
  }
17774
18137
  finally {
17775
- __classPrivateFieldGet$2(this, _AIClient_transcriptionUnsubscribers, "f").get(streamId)?.();
17776
- __classPrivateFieldGet$2(this, _AIClient_transcriptionUnsubscribers, "f").delete(streamId);
18138
+ __classPrivateFieldGet$3(this, _AIClient_transcriptionUnsubscribers, "f").get(streamId)?.();
18139
+ __classPrivateFieldGet$3(this, _AIClient_transcriptionUnsubscribers, "f").delete(streamId);
17777
18140
  }
17778
18141
  }
17779
18142
  /**
@@ -17795,12 +18158,12 @@ class AIClient {
17795
18158
  if (ids.length === 0 || typedAudio.length === 0) {
17796
18159
  return;
17797
18160
  }
17798
- const baseUrl = __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").getBaseUrl();
17799
- const token = __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").getToken();
18161
+ const baseUrl = __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").getBaseUrl();
18162
+ const token = __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").getToken();
17800
18163
  // Use slice to get only the relevant portion of the underlying ArrayBuffer
17801
18164
  // (Float32Array may be a view over a larger buffer)
17802
18165
  const bodyBuffer = typedAudio.buffer.slice(typedAudio.byteOffset, typedAudio.byteOffset + typedAudio.byteLength);
17803
- const response = await __classPrivateFieldGet$2(this, _AIClient_apiClient, "f").doFetch(`${baseUrl}/api/v1/ai/transcription/feed`, {
18166
+ const response = await __classPrivateFieldGet$3(this, _AIClient_apiClient, "f").doFetch(`${baseUrl}/api/v1/ai/transcription/feed`, {
17804
18167
  method: 'POST',
17805
18168
  headers: {
17806
18169
  'Content-Type': 'application/octet-stream',
@@ -17817,6 +18180,103 @@ class AIClient {
17817
18180
  }
17818
18181
  _AIClient_apiClient = new WeakMap(), _AIClient_transcriptionUnsubscribers = new WeakMap(), _AIClient_pendingStreamIds = new WeakMap();
17819
18182
 
18183
+ var __classPrivateFieldSet$2 = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
18184
+ if (kind === "m") throw new TypeError("Private method is not writable");
18185
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
18186
+ 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");
18187
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
18188
+ };
18189
+ var __classPrivateFieldGet$2 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
18190
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
18191
+ 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");
18192
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
18193
+ };
18194
+ var _IdentityClient_apiClient;
18195
+ /**
18196
+ * The executor's `did:scid:coasys:1` calls.
18197
+ *
18198
+ * The executor holds device keys only. Master keys and the 12 words stay with the app
18199
+ * (`ad4m-identity-client`), which signs the events and offers these calls pass on.
18200
+ * `agent.status()` and `agent.me()` carry `identity`, the `did:scid` the agent speaks for.
18201
+ */
18202
+ class IdentityClient {
18203
+ constructor(baseUrl, token, sharedApiClient) {
18204
+ _IdentityClient_apiClient.set(this, void 0);
18205
+ __classPrivateFieldSet$2(this, _IdentityClient_apiClient, sharedApiClient || new ApiClient(baseUrl, token), "f");
18206
+ }
18207
+ /**
18208
+ * This agent's identity, device key, `enc` key and the cached head. `storeBehind` is set
18209
+ * (`{ since, seq }`) while the configured store answers the log behind the executor's cache,
18210
+ * and `null` once it catches up. `store` is the identity store this executor uses
18211
+ * (`{ url, trusted }`: its config's, else its network's) and whether it trusts a key for it;
18212
+ * `null` when its network has no store, so identities cannot be created or linked there.
18213
+ */
18214
+ async status() {
18215
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.status", {});
18216
+ }
18217
+ /** A log through the executor's cache; `fresh` refreshes it from the store first. */
18218
+ async log(did, from, fresh) {
18219
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.log", { did, from, fresh });
18220
+ }
18221
+ /**
18222
+ * Resolves a `did:scid:coasys:1` DID URL (`?src=`, `?versionId=`, `#d1`) or a bare device
18223
+ * `did:key` to a W3C DID Core resolution result. The executor answers from its key-log
18224
+ * cache unless `fresh`, or the cache lacks the log or the asked version. A refusal comes
18225
+ * back as `didResolutionMetadata.error` (`invalidDid`, `invalidDidUrl`, `notFound`, …), not
18226
+ * as a thrown error. With a fragment, `didDocument` is null and `verificationMethod` holds
18227
+ * that method. For a `did:key`, `didResolutionMetadata["coasys:keyId"]` and
18228
+ * `["coasys:keyValid"]` say which key of the person's log it is and whether it is valid.
18229
+ */
18230
+ async resolve(didUrl, options = {}) {
18231
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.resolve", {
18232
+ didUrl,
18233
+ fresh: options.fresh,
18234
+ accept: options.accept,
18235
+ });
18236
+ }
18237
+ /**
18238
+ * Drops this executor's cached copy of `did`'s log (its events, accepted head and recorded
18239
+ * forks); the next read refreshes from the configured store and takes the store's branch.
18240
+ * The way out of an `identity-fork`. The operator (admin credential) only.
18241
+ */
18242
+ async resetLog(did) {
18243
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.resetLog", { did });
18244
+ }
18245
+ /**
18246
+ * Adds this agent's device-key proof to an `incept` that lists its key. For the main
18247
+ * agent the admin credential only; a user's session for its own agent.
18248
+ */
18249
+ async cosignIncept(event) {
18250
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.cosignIncept", { event: event });
18251
+ }
18252
+ /**
18253
+ * Appends signed events through the agent language. For the main agent the admin
18254
+ * credential only; a user's session for its own agent.
18255
+ */
18256
+ async publish(events) {
18257
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.publish", { events: events });
18258
+ }
18259
+ async openOffer(signedOffer) {
18260
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.openOffer", { signedOffer });
18261
+ }
18262
+ /** The identity's open and claimed offers, for a request signed by its current master key. */
18263
+ async offers(request, wait) {
18264
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.offers", { request, wait });
18265
+ }
18266
+ /** Claims an offer link for this executor (the operator only). */
18267
+ async claimOffer(offer, hint) {
18268
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.claimOffer", { offer, hint });
18269
+ }
18270
+ async joinStatus(offerId) {
18271
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.joinStatus", { offerId });
18272
+ }
18273
+ /** The identity's device keys, from its log. */
18274
+ async devices() {
18275
+ return __classPrivateFieldGet$2(this, _IdentityClient_apiClient, "f").call("identity.devices", {});
18276
+ }
18277
+ }
18278
+ _IdentityClient_apiClient = new WeakMap();
18279
+
17820
18280
  /**
17821
18281
  * Shared type definitions for the Ad4mModel system.
17822
18282
  *
@@ -20169,6 +20629,10 @@ class Ad4mModel {
20169
20629
  */
20170
20630
  constructor(perspective, baseExpression) {
20171
20631
  this._snapshot = null;
20632
+ /** True when the constructor minted the id: no record can hold links yet. */
20633
+ this._idMinted = false;
20634
+ /** Predicates this instance has already written relation links under (`add*`/`set*`), so they may hold links. */
20635
+ this._relationsWritten = new Set();
20172
20636
  // Use a dedicated `ad4m://obj/<id>` scheme for auto-generated
20173
20637
  // baseExpressions instead of `Literal.from(...).toUrl()`'s
20174
20638
  // `literal:string:<id>`. After typed-literal storage lands, the storage
@@ -20179,6 +20643,7 @@ class Ad4mModel {
20179
20643
  // IRIs, so relation links like `<post> --has_comment--> <comment-id>`
20180
20644
  // round-trip correctly through the SPARQL store.
20181
20645
  this._baseExpression = baseExpression ? baseExpression : `ad4m://obj/${makeRandomId(24)}`;
20646
+ this._idMinted = !baseExpression;
20182
20647
  this._perspective = perspective;
20183
20648
  }
20184
20649
  /**
@@ -20997,6 +21462,7 @@ class Ad4mModel {
20997
21462
  console.warn(`Relation "${key}" has no metadata, skipping`);
20998
21463
  return;
20999
21464
  }
21465
+ this._relationsWritten.add(metadata.predicate);
21000
21466
  const abstractName = this.abstractName();
21001
21467
  if (abstractName) {
21002
21468
  if (value != null)
@@ -21020,6 +21486,7 @@ class Ad4mModel {
21020
21486
  console.warn(`Relation "${key}" has no metadata, skipping`);
21021
21487
  return;
21022
21488
  }
21489
+ this._relationsWritten.add(metadata.predicate);
21023
21490
  const abstractName = this.abstractName();
21024
21491
  if (abstractName) {
21025
21492
  if (value != null)
@@ -21268,7 +21735,11 @@ class Ad4mModel {
21268
21735
  }
21269
21736
  }
21270
21737
  else if (Array.isArray(value)) {
21271
- // Handle all arrays as relations, including empty ones (which clears the relation)
21738
+ // Handle all arrays as relations, including empty ones (which clears the relation).
21739
+ // A record being created under an id minted here has no links to
21740
+ // clear, so an empty relation there costs a round trip and writes nothing.
21741
+ if (value.length === 0 && !this._snapshot && this._idMinted && !this._relationsWritten.has(this.getRelationOptions(key)?.predicate ?? key))
21742
+ continue;
21272
21743
  await this.setRelationValues(key, value, batchId);
21273
21744
  }
21274
21745
  else if (value !== undefined && value !== null && value !== "") {
@@ -21872,7 +22343,7 @@ var __classPrivateFieldGet$1 = (undefined && undefined.__classPrivateFieldGet) |
21872
22343
  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");
21873
22344
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
21874
22345
  };
21875
- var _Ad4mClient_baseUrl, _Ad4mClient_token, _Ad4mClient_apiClient, _Ad4mClient_agentClient, _Ad4mClient_expressionClient, _Ad4mClient_languageClient, _Ad4mClient_neighbourhoodClient, _Ad4mClient_perspectiveClient, _Ad4mClient_runtimeClient, _Ad4mClient_aiClient;
22346
+ var _Ad4mClient_baseUrl, _Ad4mClient_token, _Ad4mClient_apiClient, _Ad4mClient_agentClient, _Ad4mClient_expressionClient, _Ad4mClient_languageClient, _Ad4mClient_neighbourhoodClient, _Ad4mClient_perspectiveClient, _Ad4mClient_runtimeClient, _Ad4mClient_aiClient, _Ad4mClient_identityClient;
21876
22347
  /**
21877
22348
  * Client for the Ad4m interface wrapping WebSocket RPC calls
21878
22349
  * for convenient use in user facing code.
@@ -21896,6 +22367,7 @@ class Ad4mClient {
21896
22367
  _Ad4mClient_perspectiveClient.set(this, void 0);
21897
22368
  _Ad4mClient_runtimeClient.set(this, void 0);
21898
22369
  _Ad4mClient_aiClient.set(this, void 0);
22370
+ _Ad4mClient_identityClient.set(this, void 0);
21899
22371
  __classPrivateFieldSet$1(this, _Ad4mClient_baseUrl, baseUrl, "f");
21900
22372
  __classPrivateFieldSet$1(this, _Ad4mClient_token, token, "f");
21901
22373
  __classPrivateFieldSet$1(this, _Ad4mClient_apiClient, new ApiClient(baseUrl, token, options?.webSocketImpl, options?.fetchImpl), "f");
@@ -21909,6 +22381,7 @@ class Ad4mClient {
21909
22381
  __classPrivateFieldGet$1(this, _Ad4mClient_perspectiveClient, "f").setNeighbourhoodClient(__classPrivateFieldGet$1(this, _Ad4mClient_neighbourhoodClient, "f"));
21910
22382
  __classPrivateFieldGet$1(this, _Ad4mClient_perspectiveClient, "f").setAIClient(__classPrivateFieldGet$1(this, _Ad4mClient_aiClient, "f"));
21911
22383
  __classPrivateFieldSet$1(this, _Ad4mClient_runtimeClient, new RuntimeClient(baseUrl, token, __classPrivateFieldGet$1(this, _Ad4mClient_apiClient, "f")), "f");
22384
+ __classPrivateFieldSet$1(this, _Ad4mClient_identityClient, new IdentityClient(baseUrl, token, __classPrivateFieldGet$1(this, _Ad4mClient_apiClient, "f")), "f");
21912
22385
  // Register with AD4M DevTools if the bridge is installed (e.g. browser extension)
21913
22386
  try {
21914
22387
  const dt = globalThis.__AD4M_DEVTOOLS__;
@@ -21940,6 +22413,10 @@ class Ad4mClient {
21940
22413
  get ai() {
21941
22414
  return __classPrivateFieldGet$1(this, _Ad4mClient_aiClient, "f");
21942
22415
  }
22416
+ /** The executor's identity calls (`did:scid:coasys:1`). */
22417
+ get identity() {
22418
+ return __classPrivateFieldGet$1(this, _Ad4mClient_identityClient, "f");
22419
+ }
21943
22420
  /**
21944
22421
  * Call `handler` with every `type` event, or only those about
21945
22422
  * `filter.perspective`. The payload is typed by the executor's event
@@ -21972,7 +22449,7 @@ class Ad4mClient {
21972
22449
  __classPrivateFieldGet$1(this, _Ad4mClient_apiClient, "f").closeAll();
21973
22450
  }
21974
22451
  }
21975
- _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();
22452
+ _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();
21976
22453
 
21977
22454
  var ExceptionType;
21978
22455
  (function (ExceptionType) {
@@ -22928,10 +23405,12 @@ class FlowInstance {
22928
23405
  // synthetic hydration field and would be silently shadowed on read).
22929
23406
  // No explicit start-time field: Ad4mModel synthesises `createdAt` on
22930
23407
  // hydration from the earliest link timestamp on the instance's URI.
22931
- // Convention: `SHACLFlow.states` is stored sorted ascending by `value`
22932
- // (enforced by `fromLinks`), so `states[0]` is the initial state. A
22933
- // flow author who wants a specific state as the entry point must give
22934
- // it the lowest `value` in the set.
23408
+ // Convention: `SHACLFlow.states` is stored sorted ascending by `value`,
23409
+ // ties broken by state name (enforced by `fromLinks`, same key as
23410
+ // rust-executor — #1202), so `states[0]` is the initial state. A flow
23411
+ // author who wants a specific state as the entry point must give it
23412
+ // the lowest `value` in the set, and not share that value with another
23413
+ // state unless the name order is the intended one.
22935
23414
  //
22936
23415
  // A run already on this subject for this flow is the one to return:
22937
23416
  // minting another would leave two runs, each with its own state, and
@@ -24565,4 +25044,4 @@ const SCOPED_EVENTS = new Set([
24565
25044
  "flow-state-changed",
24566
25045
  ]);
24567
25046
 
24568
- export { ACCEPTED_BY_GETTER, AIClient, Model as AIModel, AIModelLoadingStatus, AIPromptExamples, AIPromptExamplesInput, AITask, AITaskInput, Ad4mClient, Ad4mModel, Agent, AgentClient, AgentExpression, AgentSignature, AgentStatus, Apps, AuthInfo, AuthInfoInput, AutoProcessorConfig, BelongsToMany, BelongsToOne, CALL_PROTOCOL_VERSION, Capability, CapabilityInput, ComputeLogEntry, Container, DEFAULT_ICE_SERVERS, EntanglementProof, EntanglementProofInput, ExceptionInfo, ExceptionType, Expression, ExpressionGeneric, ExpressionGenericInput, ExpressionProof, ExpressionProofInput, ExpressionRef, ExpressionRendered, Flag, FlowInstance, FlowInstanceRecord, FlowTransitionProposal, HasMany, HasOne, HostingUserInfo, IDBCache, Icon, ImportResult, ImportStats, InteractionCall, InteractionMeta, InteractionParameter, InterpretationOverlay, InterpretationRun, LONG_METHODS, LONG_TIMEOUT_MS, LanguageExpression, LanguageHandle, LanguageLanguageInput, LanguageMeta, LanguageMetaInput, LanguageMetaInternal, LanguageRef, Link, LinkExpression, LinkExpressionInput, LinkExpressionMutations, LinkExpressionUpdated, LinkInput, LinkMutations, LinkQuery, Literal, LiveQuery, LocalModel, LocalModelInput, MENTION_TEXT_LIMIT, Mentioning, MeshManager, Model$1 as Model, ModelApi, ModelApiInput, ModelInput, ModelQueryBuilder, Neighbourhood, NeighbourhoodExpression, NeighbourhoodProxy, Notification, NotificationInput, NullCache, OnlineAgent, Optional, PROPOSER_GETTER, PaymentRequestResult, Perspective, PerspectiveDiff, PerspectiveDiffExpression, PerspectiveExpression, PerspectiveHandle, PerspectiveInput, PerspectiveProxy, PerspectiveState, PerspectiveUnsignedInput, Property, QuerySubscriptionProxy, READ_METHODS, REOPEN_BASE_DELAY_MS, REOPEN_MAX_DELAY_MS, ReadOnly, Resource, ResourceInput, RpcError, RuntimeInfo, SCOPED_EVENTS, SHACLFlow, SHACLShape, SMART_LITERAL_CONTENT_PREDICATE, SentMessage, SmartLiteral, TextContent, TokenizerSource, TokenizerSourceInput, TriggeredNotification, UserCreationResult, UserStatistics, VerificationRequestResult, VoiceActivityParamsInput, WakerSubscriptionManager, applyUpdate, buildConformanceFilter, buildModelFromJSONSchema, buildPaginationSubquery, buildSDNA, buildSHACL, buildSPARQLQuery, buildWhereCondition, capSentence, clearQueryCache, coalesce, compileWhereClause, concat, createPersistentCache, createTelepresenceChannel, determineNamespace, determinePredicate, effectiveLiteralStorage, escapeQueryString, exists, exprRef2String, fileToDataUri, fn, focus, formatList, formatQueryValue, formatSPARQLValue, getCachedResult, getDefaultValueForType, getMemoizedSHACL, getPropertiesMetadata, getPropertyOption, getRelationsMetadata, hasJsOnlyWhereFilters, hintFor, holdsAWholeWordTerm, ifExpr, invalidatePerspectiveCache, isArrayType, isContainedScope, isContainmentTraversal, isExpression, isIncludeProjection, isLink, isNodeExpression, isNumericType, isObjectType, isSchemaType, isTraverseScope, linkEqual, linkExpressionInputToWire, linkExpressionToWire, linkMutationsToWire, literal, looksLikeUri, mentionOf, neighbourhoodExpressionFromWire, normalizeNamespaceString, normalizeSchemaType, normalizeValue, normalizeWhereForSparql, parseCallMessage, parseExprUrl, parseLit, parseLitBoolean, parseLitNumber, parseSparqlCount, path, queryCacheSize, reopenDelay, requireSingleParent, resolveParentPredicate, setCachedResult, setPropertyRegistryEntry, setRelationRegistryEntry, typeDefsString, valueToLiteralIri };
25047
+ export { ACCEPTED_BY_GETTER, AIClient, Model as AIModel, AIModelLoadingStatus, AIPromptExamples, AIPromptExamplesInput, AITask, AITaskInput, Ad4mClient, Ad4mModel, Agent, AgentClient, AgentExpression, AgentSignature, AgentStatus, Apps, AuthInfo, AuthInfoInput, AutoProcessorConfig, BelongsToMany, BelongsToOne, CALL_PROTOCOL_VERSION, Capability, CapabilityInput, ComputeLogEntry, Container, DEFAULT_ICE_SERVERS, EntanglementProof, EntanglementProofInput, ExceptionInfo, ExceptionType, Expression, ExpressionGeneric, ExpressionGenericInput, ExpressionProof, ExpressionProofInput, ExpressionRef, ExpressionRendered, Flag, FlowInstance, FlowInstanceRecord, FlowTransitionProposal, HasMany, HasOne, HostingUserInfo, IDBCache, Icon, IdentityClient, ImportResult, ImportStats, InteractionCall, InteractionMeta, InteractionParameter, InterpretationOverlay, InterpretationRun, LONG_METHODS, LONG_TIMEOUT_MS, LanguageExpression, LanguageHandle, LanguageLanguageInput, LanguageMeta, LanguageMetaInput, LanguageMetaInternal, LanguageRef, Link, LinkExpression, LinkExpressionInput, LinkExpressionMutations, LinkExpressionUpdated, LinkInput, LinkMutations, LinkQuery, Literal, LiveQuery, LocalModel, LocalModelInput, MENTION_TEXT_LIMIT, Mentioning, MeshManager, Model$1 as Model, ModelApi, ModelApiInput, ModelInput, ModelQueryBuilder, Neighbourhood, NeighbourhoodExpression, NeighbourhoodProxy, Notification, NotificationInput, NullCache, OnlineAgent, Optional, PROPOSER_GETTER, PaymentRequestResult, Perspective, PerspectiveDiff, PerspectiveDiffExpression, PerspectiveExpression, PerspectiveHandle, PerspectiveInput, PerspectiveProxy, PerspectiveState, PerspectiveUnsignedInput, Property, QuerySubscriptionProxy, READ_METHODS, REOPEN_BASE_DELAY_MS, REOPEN_MAX_DELAY_MS, ReadOnly, Resource, ResourceInput, RpcError, RuntimeInfo, SCOPED_EVENTS, SHACLFlow, SHACLShape, SMART_LITERAL_CONTENT_PREDICATE, SentMessage, SmartLiteral, TextContent, TokenizerSource, TokenizerSourceInput, TriggeredNotification, UserCreationResult, UserStatistics, VerificationRequestResult, VoiceActivityParamsInput, WakerSubscriptionManager, applyUpdate, buildConformanceFilter, buildModelFromJSONSchema, buildPaginationSubquery, buildSDNA, buildSHACL, buildSPARQLQuery, buildWhereCondition, capSentence, clearQueryCache, coalesce, compileWhereClause, concat, createPersistentCache, createTelepresenceChannel, determineNamespace, determinePredicate, effectiveLiteralStorage, escapeQueryString, exists, exprRef2String, fileToDataUri, fn, focus, formatList, formatQueryValue, formatSPARQLValue, getCachedResult, getDefaultValueForType, getMemoizedSHACL, getPropertiesMetadata, getPropertyOption, getRelationsMetadata, hasJsOnlyWhereFilters, hintFor, holdsAWholeWordTerm, ifExpr, invalidatePerspectiveCache, isArrayType, isContainedScope, isContainmentTraversal, isExpression, isIncludeProjection, isLink, isNodeExpression, isNumericType, isObjectType, isSchemaType, isTraverseScope, linkEqual, linkExpressionInputToWire, linkExpressionToWire, linkMutationsToWire, literal, looksLikeUri, mentionOf, neighbourhoodExpressionFromWire, normalizeNamespaceString, normalizeSchemaType, normalizeValue, normalizeWhereForSparql, parseCallMessage, parseExprUrl, parseLit, parseLitBoolean, parseLitNumber, parseSparqlCount, path, queryCacheSize, reopenDelay, requireSingleParent, resolveParentPredicate, setCachedResult, setPropertyRegistryEntry, setRelationRegistryEntry, typeDefsString, valueToLiteralIri };