@dxos/messaging 0.6.13 → 0.6.14-main.2b6a0f3

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 (58) hide show
  1. package/dist/lib/browser/chunk-BZOQIXEW.mjs +691 -0
  2. package/dist/lib/browser/chunk-BZOQIXEW.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +256 -923
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +147 -0
  7. package/dist/lib/browser/testing/index.mjs.map +7 -0
  8. package/dist/lib/node/chunk-WDA7H2PO.cjs +688 -0
  9. package/dist/lib/node/chunk-WDA7H2PO.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +272 -916
  11. package/dist/lib/node/index.cjs.map +4 -4
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/testing/index.cjs +162 -0
  14. package/dist/lib/node/testing/index.cjs.map +7 -0
  15. package/dist/lib/node-esm/chunk-RAYDHHAO.mjs +683 -0
  16. package/dist/lib/node-esm/chunk-RAYDHHAO.mjs.map +7 -0
  17. package/dist/lib/node-esm/index.mjs +1631 -0
  18. package/dist/lib/node-esm/index.mjs.map +7 -0
  19. package/dist/lib/node-esm/meta.json +1 -0
  20. package/dist/lib/node-esm/testing/index.mjs +146 -0
  21. package/dist/lib/node-esm/testing/index.mjs.map +7 -0
  22. package/dist/types/src/messenger.blueprint-test.d.ts +2 -3
  23. package/dist/types/src/messenger.blueprint-test.d.ts.map +1 -1
  24. package/dist/types/src/messenger.d.ts.map +1 -1
  25. package/dist/types/src/messenger.node.test.d.ts +2 -0
  26. package/dist/types/src/messenger.node.test.d.ts.map +1 -0
  27. package/dist/types/src/signal-client/signal-client.node.test.d.ts +2 -0
  28. package/dist/types/src/signal-client/signal-client.node.test.d.ts.map +1 -0
  29. package/dist/types/src/signal-client/signal-rpc-client.node.test.d.ts +2 -0
  30. package/dist/types/src/signal-client/signal-rpc-client.node.test.d.ts.map +1 -0
  31. package/dist/types/src/signal-manager/edge-signal-manager.d.ts.map +1 -1
  32. package/dist/types/src/signal-manager/websocket-signal-manager.node.test.d.ts +2 -0
  33. package/dist/types/src/signal-manager/websocket-signal-manager.node.test.d.ts.map +1 -0
  34. package/dist/types/src/testing/test-builder.d.ts +3 -4
  35. package/dist/types/src/testing/test-builder.d.ts.map +1 -1
  36. package/dist/types/src/testing/test-peer.d.ts +0 -1
  37. package/dist/types/src/testing/test-peer.d.ts.map +1 -1
  38. package/package.json +32 -21
  39. package/src/messenger.blueprint-test.ts +25 -33
  40. package/src/{messenger.test.ts → messenger.node.test.ts} +6 -19
  41. package/src/messenger.ts +1 -1
  42. package/src/signal-client/{signal-client.test.ts → signal-client.node.test.ts} +9 -8
  43. package/src/signal-client/{signal-rpc-client.test.ts → signal-rpc-client.node.test.ts} +8 -13
  44. package/src/signal-manager/edge-signal-manager.ts +16 -6
  45. package/src/signal-manager/{websocket-signal-manager.test.ts → websocket-signal-manager.node.test.ts} +12 -30
  46. package/src/testing/test-builder.ts +3 -6
  47. package/src/testing/test-peer.ts +5 -7
  48. package/dist/types/src/messenger.test.d.ts +0 -2
  49. package/dist/types/src/messenger.test.d.ts.map +0 -1
  50. package/dist/types/src/signal-client/signal-client.test.d.ts +0 -2
  51. package/dist/types/src/signal-client/signal-client.test.d.ts.map +0 -1
  52. package/dist/types/src/signal-client/signal-rpc-client.test.d.ts +0 -2
  53. package/dist/types/src/signal-client/signal-rpc-client.test.d.ts.map +0 -1
  54. package/dist/types/src/signal-manager/edge-signal-manager.test.d.ts +0 -2
  55. package/dist/types/src/signal-manager/edge-signal-manager.test.d.ts.map +0 -1
  56. package/dist/types/src/signal-manager/websocket-signal-manager.test.d.ts +0 -2
  57. package/dist/types/src/signal-manager/websocket-signal-manager.test.d.ts.map +0 -1
  58. package/src/signal-manager/edge-signal-manager.test.ts +0 -67
@@ -29,462 +29,60 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  var node_exports = {};
30
30
  __export(node_exports, {
31
31
  EdgeSignalManager: () => EdgeSignalManager,
32
- MemorySignalManager: () => MemorySignalManager,
33
- MemorySignalManagerContext: () => MemorySignalManagerContext,
34
- Messenger: () => Messenger,
35
- PeerInfoHash: () => PeerInfoHash,
32
+ MemorySignalManager: () => import_chunk_WDA7H2PO.MemorySignalManager,
33
+ MemorySignalManagerContext: () => import_chunk_WDA7H2PO.MemorySignalManagerContext,
34
+ Messenger: () => import_chunk_WDA7H2PO.Messenger,
35
+ PeerInfoHash: () => import_chunk_WDA7H2PO.PeerInfoHash,
36
36
  SignalClient: () => SignalClient,
37
37
  WebsocketSignalManager: () => WebsocketSignalManager,
38
38
  setIdentityTags: () => setIdentityTags
39
39
  });
40
40
  module.exports = __toCommonJS(node_exports);
41
+ var import_chunk_WDA7H2PO = require("./chunk-WDA7H2PO.cjs");
41
42
  var import_async = require("@dxos/async");
42
43
  var import_context = require("@dxos/context");
43
44
  var import_invariant = require("@dxos/invariant");
44
45
  var import_keys = require("@dxos/keys");
45
46
  var import_log = require("@dxos/log");
46
47
  var import_protocols = require("@dxos/protocols");
47
- var import_proto = require("@dxos/protocols/proto");
48
- var import_util = require("@dxos/util");
48
+ var import_signal = require("@dxos/protocols/proto/dxos/mesh/signal");
49
49
  var import_tracing = require("@dxos/tracing");
50
50
  var import_async2 = require("@dxos/async");
51
51
  var import_context2 = require("@dxos/context");
52
- var import_invariant2 = require("@dxos/invariant");
53
52
  var import_keys2 = require("@dxos/keys");
54
53
  var import_log2 = require("@dxos/log");
55
- var import_protocols2 = require("@dxos/protocols");
56
- var import_signal = require("@dxos/protocols/proto/dxos/mesh/signal");
57
- var import_tracing2 = require("@dxos/tracing");
54
+ var import_util = require("@dxos/util");
55
+ var import_isomorphic_ws = __toESM(require("isomorphic-ws"));
58
56
  var import_async3 = require("@dxos/async");
59
57
  var import_context3 = require("@dxos/context");
58
+ var import_invariant2 = require("@dxos/invariant");
60
59
  var import_keys3 = require("@dxos/keys");
61
60
  var import_log3 = require("@dxos/log");
62
- var import_util2 = require("@dxos/util");
63
- var import_isomorphic_ws = __toESM(require("isomorphic-ws"));
61
+ var import_protocols2 = require("@dxos/protocols");
62
+ var import_proto = require("@dxos/protocols/proto");
63
+ var import_rpc = require("@dxos/rpc");
64
+ var import_tracing2 = require("@dxos/tracing");
64
65
  var import_async4 = require("@dxos/async");
65
66
  var import_context4 = require("@dxos/context");
66
67
  var import_invariant3 = require("@dxos/invariant");
67
68
  var import_keys4 = require("@dxos/keys");
68
69
  var import_log4 = require("@dxos/log");
69
70
  var import_protocols3 = require("@dxos/protocols");
70
- var import_proto2 = require("@dxos/protocols/proto");
71
- var import_rpc = require("@dxos/rpc");
71
+ var import_util2 = require("@dxos/util");
72
72
  var import_tracing3 = require("@dxos/tracing");
73
73
  var import_async5 = require("@dxos/async");
74
74
  var import_context5 = require("@dxos/context");
75
+ var import_edge_client = require("@dxos/edge-client");
75
76
  var import_invariant4 = require("@dxos/invariant");
76
77
  var import_keys5 = require("@dxos/keys");
77
78
  var import_log5 = require("@dxos/log");
78
- var import_proto3 = require("@dxos/protocols/proto");
79
+ var import_protocols4 = require("@dxos/protocols");
80
+ var import_buf = require("@dxos/protocols/buf");
81
+ var import_messenger_pb = require("@dxos/protocols/buf/dxos/edge/messenger_pb");
79
82
  var import_util3 = require("@dxos/util");
80
- var import_async6 = require("@dxos/async");
81
- var import_context6 = require("@dxos/context");
82
83
  var import_invariant5 = require("@dxos/invariant");
83
- var import_keys6 = require("@dxos/keys");
84
84
  var import_log6 = require("@dxos/log");
85
- var import_protocols4 = require("@dxos/protocols");
86
- var import_util4 = require("@dxos/util");
87
- var import_tracing4 = require("@dxos/tracing");
88
- var import_wkt = require("@bufbuild/protobuf/wkt");
89
- var import_async7 = require("@dxos/async");
90
- var import_context7 = require("@dxos/context");
91
- var import_edge_client = require("@dxos/edge-client");
92
- var import_invariant6 = require("@dxos/invariant");
93
- var import_keys7 = require("@dxos/keys");
94
- var import_log7 = require("@dxos/log");
95
- var import_protocols5 = require("@dxos/protocols");
96
- var import_messenger_pb = require("@dxos/protocols/buf/dxos/edge/messenger_pb");
97
- var import_util5 = require("@dxos/util");
98
- var import_invariant7 = require("@dxos/invariant");
99
- var import_log8 = require("@dxos/log");
100
85
  var import_services = require("@dxos/protocols/proto/dxos/client/services");
101
- var MessengerMonitor = class {
102
- recordMessageAckFailed() {
103
- import_tracing.trace.metrics.increment("dxos.mesh.signal.messenger.failed-ack", 1);
104
- }
105
- recordReliableMessage(params) {
106
- import_tracing.trace.metrics.increment("dxos.mesh.signal.messenger.reliable-send", 1, {
107
- tags: {
108
- success: params.sent,
109
- attempts: params.sendAttempts
110
- }
111
- });
112
- }
113
- };
114
- var MESSAGE_TIMEOUT = 1e4;
115
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/messenger.ts";
116
- var ReliablePayload = import_proto.schema.getCodecForType("dxos.mesh.messaging.ReliablePayload");
117
- var Acknowledgement = import_proto.schema.getCodecForType("dxos.mesh.messaging.Acknowledgement");
118
- var RECEIVED_MESSAGES_GC_INTERVAL = 12e4;
119
- var Messenger = class {
120
- constructor({ signalManager, retryDelay = 300 }) {
121
- this._monitor = new MessengerMonitor();
122
- this._listeners = new import_util.ComplexMap(({ peerId, payloadType }) => peerId + payloadType);
123
- this._defaultListeners = /* @__PURE__ */ new Map();
124
- this._onAckCallbacks = new import_util.ComplexMap(import_keys.PublicKey.hash);
125
- this._receivedMessages = new import_util.ComplexSet(import_keys.PublicKey.hash);
126
- this._toClear = new import_util.ComplexSet(import_keys.PublicKey.hash);
127
- this._closed = true;
128
- this._signalManager = signalManager;
129
- this._retryDelay = retryDelay;
130
- this.open();
131
- }
132
- open() {
133
- if (!this._closed) {
134
- return;
135
- }
136
- const traceId = import_keys.PublicKey.random().toHex();
137
- import_log.log.trace("dxos.mesh.messenger.open", import_protocols.trace.begin({
138
- id: traceId
139
- }), {
140
- F: __dxlog_file,
141
- L: 72,
142
- S: this,
143
- C: (f, a) => f(...a)
144
- });
145
- this._ctx = new import_context.Context({
146
- onError: (err) => import_log.log.catch(err, void 0, {
147
- F: __dxlog_file,
148
- L: 74,
149
- S: this,
150
- C: (f, a) => f(...a)
151
- })
152
- }, {
153
- F: __dxlog_file,
154
- L: 73
155
- });
156
- this._ctx.onDispose(this._signalManager.onMessage.on(async (message) => {
157
- (0, import_log.log)("received message", {
158
- from: message.author
159
- }, {
160
- F: __dxlog_file,
161
- L: 78,
162
- S: this,
163
- C: (f, a) => f(...a)
164
- });
165
- await this._handleMessage(message);
166
- }));
167
- (0, import_async.scheduleTaskInterval)(this._ctx, async () => {
168
- this._performGc();
169
- }, RECEIVED_MESSAGES_GC_INTERVAL);
170
- this._closed = false;
171
- import_log.log.trace("dxos.mesh.messenger.open", import_protocols.trace.end({
172
- id: traceId
173
- }), {
174
- F: __dxlog_file,
175
- L: 93,
176
- S: this,
177
- C: (f, a) => f(...a)
178
- });
179
- }
180
- async close() {
181
- if (this._closed) {
182
- return;
183
- }
184
- this._closed = true;
185
- await this._ctx.dispose();
186
- }
187
- async sendMessage({ author, recipient, payload }) {
188
- (0, import_invariant.invariant)(!this._closed, "Closed", {
189
- F: __dxlog_file,
190
- L: 105,
191
- S: this,
192
- A: [
193
- "!this._closed",
194
- "'Closed'"
195
- ]
196
- });
197
- const messageContext = this._ctx.derive();
198
- const reliablePayload = {
199
- messageId: import_keys.PublicKey.random(),
200
- payload
201
- };
202
- (0, import_invariant.invariant)(!this._onAckCallbacks.has(reliablePayload.messageId), void 0, {
203
- F: __dxlog_file,
204
- L: 112,
205
- S: this,
206
- A: [
207
- "!this._onAckCallbacks.has(reliablePayload.messageId!)",
208
- ""
209
- ]
210
- });
211
- (0, import_log.log)("send message", {
212
- messageId: reliablePayload.messageId,
213
- author,
214
- recipient
215
- }, {
216
- F: __dxlog_file,
217
- L: 113,
218
- S: this,
219
- C: (f, a) => f(...a)
220
- });
221
- let messageReceived;
222
- let timeoutHit;
223
- let sendAttempts = 0;
224
- const promise = new Promise((resolve, reject) => {
225
- messageReceived = resolve;
226
- timeoutHit = reject;
227
- });
228
- (0, import_async.scheduleExponentialBackoffTaskInterval)(messageContext, async () => {
229
- (0, import_log.log)("retrying message", {
230
- messageId: reliablePayload.messageId
231
- }, {
232
- F: __dxlog_file,
233
- L: 128,
234
- S: this,
235
- C: (f, a) => f(...a)
236
- });
237
- sendAttempts++;
238
- await this._encodeAndSend({
239
- author,
240
- recipient,
241
- reliablePayload
242
- }).catch((err) => (0, import_log.log)("failed to send message", {
243
- err
244
- }, {
245
- F: __dxlog_file,
246
- L: 131,
247
- S: this,
248
- C: (f, a) => f(...a)
249
- }));
250
- }, this._retryDelay);
251
- (0, import_async.scheduleTask)(messageContext, () => {
252
- (0, import_log.log)("message not delivered", {
253
- messageId: reliablePayload.messageId
254
- }, {
255
- F: __dxlog_file,
256
- L: 140,
257
- S: this,
258
- C: (f, a) => f(...a)
259
- });
260
- this._onAckCallbacks.delete(reliablePayload.messageId);
261
- timeoutHit(new import_protocols.TimeoutError("signaling message not delivered", new import_async.TimeoutError(MESSAGE_TIMEOUT, "Message not delivered")));
262
- void messageContext.dispose();
263
- this._monitor.recordReliableMessage({
264
- sendAttempts,
265
- sent: false
266
- });
267
- }, MESSAGE_TIMEOUT);
268
- this._onAckCallbacks.set(reliablePayload.messageId, () => {
269
- messageReceived();
270
- this._onAckCallbacks.delete(reliablePayload.messageId);
271
- void messageContext.dispose();
272
- this._monitor.recordReliableMessage({
273
- sendAttempts,
274
- sent: true
275
- });
276
- });
277
- await this._encodeAndSend({
278
- author,
279
- recipient,
280
- reliablePayload
281
- });
282
- return promise;
283
- }
284
- /**
285
- * Subscribes onMessage function to messages that contains payload with payloadType.
286
- * @param payloadType if not specified, onMessage will be subscribed to all types of messages.
287
- */
288
- async listen({ peer, payloadType, onMessage }) {
289
- (0, import_invariant.invariant)(!this._closed, "Closed", {
290
- F: __dxlog_file,
291
- L: 178,
292
- S: this,
293
- A: [
294
- "!this._closed",
295
- "'Closed'"
296
- ]
297
- });
298
- await this._signalManager.subscribeMessages(peer);
299
- let listeners;
300
- (0, import_invariant.invariant)(peer.peerKey, "Peer key is required", {
301
- F: __dxlog_file,
302
- L: 182,
303
- S: this,
304
- A: [
305
- "peer.peerKey",
306
- "'Peer key is required'"
307
- ]
308
- });
309
- if (!payloadType) {
310
- listeners = this._defaultListeners.get(peer.peerKey);
311
- if (!listeners) {
312
- listeners = /* @__PURE__ */ new Set();
313
- this._defaultListeners.set(peer.peerKey, listeners);
314
- }
315
- } else {
316
- listeners = this._listeners.get({
317
- peerId: peer.peerKey,
318
- payloadType
319
- });
320
- if (!listeners) {
321
- listeners = /* @__PURE__ */ new Set();
322
- this._listeners.set({
323
- peerId: peer.peerKey,
324
- payloadType
325
- }, listeners);
326
- }
327
- }
328
- listeners.add(onMessage);
329
- return {
330
- unsubscribe: async () => {
331
- listeners.delete(onMessage);
332
- }
333
- };
334
- }
335
- async _encodeAndSend({ author, recipient, reliablePayload }) {
336
- await this._signalManager.sendMessage({
337
- author,
338
- recipient,
339
- payload: {
340
- type_url: "dxos.mesh.messaging.ReliablePayload",
341
- value: ReliablePayload.encode(reliablePayload, {
342
- preserveAny: true
343
- })
344
- }
345
- });
346
- }
347
- async _handleMessage(message) {
348
- switch (message.payload.type_url) {
349
- case "dxos.mesh.messaging.ReliablePayload": {
350
- await this._handleReliablePayload(message);
351
- break;
352
- }
353
- case "dxos.mesh.messaging.Acknowledgement": {
354
- await this._handleAcknowledgement({
355
- payload: message.payload
356
- });
357
- break;
358
- }
359
- }
360
- }
361
- async _handleReliablePayload({ author, recipient, payload }) {
362
- (0, import_invariant.invariant)(payload.type_url === "dxos.mesh.messaging.ReliablePayload", void 0, {
363
- F: __dxlog_file,
364
- L: 240,
365
- S: this,
366
- A: [
367
- "payload.type_url === 'dxos.mesh.messaging.ReliablePayload'",
368
- ""
369
- ]
370
- });
371
- const reliablePayload = ReliablePayload.decode(payload.value, {
372
- preserveAny: true
373
- });
374
- (0, import_log.log)("handling message", {
375
- messageId: reliablePayload.messageId
376
- }, {
377
- F: __dxlog_file,
378
- L: 243,
379
- S: this,
380
- C: (f, a) => f(...a)
381
- });
382
- try {
383
- await this._sendAcknowledgement({
384
- author,
385
- recipient,
386
- messageId: reliablePayload.messageId
387
- });
388
- } catch (err) {
389
- this._monitor.recordMessageAckFailed();
390
- throw err;
391
- }
392
- if (this._receivedMessages.has(reliablePayload.messageId)) {
393
- return;
394
- }
395
- this._receivedMessages.add(reliablePayload.messageId);
396
- await this._callListeners({
397
- author,
398
- recipient,
399
- payload: reliablePayload.payload
400
- });
401
- }
402
- async _handleAcknowledgement({ payload }) {
403
- (0, import_invariant.invariant)(payload.type_url === "dxos.mesh.messaging.Acknowledgement", void 0, {
404
- F: __dxlog_file,
405
- L: 271,
406
- S: this,
407
- A: [
408
- "payload.type_url === 'dxos.mesh.messaging.Acknowledgement'",
409
- ""
410
- ]
411
- });
412
- this._onAckCallbacks.get(Acknowledgement.decode(payload.value).messageId)?.();
413
- }
414
- async _sendAcknowledgement({ author, recipient, messageId }) {
415
- (0, import_log.log)("sending ACK", {
416
- messageId,
417
- from: recipient,
418
- to: author
419
- }, {
420
- F: __dxlog_file,
421
- L: 284,
422
- S: this,
423
- C: (f, a) => f(...a)
424
- });
425
- await this._signalManager.sendMessage({
426
- author: recipient,
427
- recipient: author,
428
- payload: {
429
- type_url: "dxos.mesh.messaging.Acknowledgement",
430
- value: Acknowledgement.encode({
431
- messageId
432
- })
433
- }
434
- });
435
- }
436
- async _callListeners(message) {
437
- {
438
- (0, import_invariant.invariant)(message.recipient.peerKey, "Peer key is required", {
439
- F: __dxlog_file,
440
- L: 298,
441
- S: this,
442
- A: [
443
- "message.recipient.peerKey",
444
- "'Peer key is required'"
445
- ]
446
- });
447
- const defaultListenerMap = this._defaultListeners.get(message.recipient.peerKey);
448
- if (defaultListenerMap) {
449
- for (const listener of defaultListenerMap) {
450
- await listener(message);
451
- }
452
- }
453
- }
454
- {
455
- const listenerMap = this._listeners.get({
456
- peerId: message.recipient.peerKey,
457
- payloadType: message.payload.type_url
458
- });
459
- if (listenerMap) {
460
- for (const listener of listenerMap) {
461
- await listener(message);
462
- }
463
- }
464
- }
465
- }
466
- _performGc() {
467
- const start = performance.now();
468
- for (const key of this._toClear.keys()) {
469
- this._receivedMessages.delete(key);
470
- }
471
- this._toClear.clear();
472
- for (const key of this._receivedMessages.keys()) {
473
- this._toClear.add(key);
474
- }
475
- const elapsed = performance.now() - start;
476
- if (elapsed > 100) {
477
- import_log.log.warn("GC took too long", {
478
- elapsed
479
- }, {
480
- F: __dxlog_file,
481
- L: 333,
482
- S: this,
483
- C: (f, a) => f(...a)
484
- });
485
- }
486
- }
487
- };
488
86
  var SignalClientMonitor = class {
489
87
  constructor() {
490
88
  this._performance = {
@@ -511,7 +109,7 @@ var SignalClientMonitor = class {
511
109
  }
512
110
  recordReconnect(params) {
513
111
  this._performance.reconnectCounter++;
514
- import_tracing2.trace.metrics.increment("dxos.mesh.signal.signal-client.reconnect", 1, {
112
+ import_tracing.trace.metrics.increment("dxos.mesh.signal.signal-client.reconnect", 1, {
515
113
  tags: {
516
114
  success: params.success
517
115
  }
@@ -525,10 +123,10 @@ var SignalClientMonitor = class {
525
123
  }
526
124
  recordMessageReceived(message) {
527
125
  this._performance.receivedMessages++;
528
- import_tracing2.trace.metrics.increment("dxos.mesh.signal.signal-client.received-total", 1, {
126
+ import_tracing.trace.metrics.increment("dxos.mesh.signal.signal-client.received-total", 1, {
529
127
  tags: createIdentityTags(message)
530
128
  });
531
- import_tracing2.trace.metrics.distribution("dxos.mesh.signal.signal-client.bytes-in", getByteCount(message), {
129
+ import_tracing.trace.metrics.distribution("dxos.mesh.signal.signal-client.bytes-in", getByteCount(message), {
532
130
  tags: createIdentityTags(message)
533
131
  });
534
132
  }
@@ -540,16 +138,16 @@ var SignalClientMonitor = class {
540
138
  const reqStart = Date.now();
541
139
  await sendMessage();
542
140
  const reqDuration = Date.now() - reqStart;
543
- import_tracing2.trace.metrics.distribution("dxos.mesh.signal.signal-client.send-duration", reqDuration, {
141
+ import_tracing.trace.metrics.distribution("dxos.mesh.signal.signal-client.send-duration", reqDuration, {
544
142
  tags
545
143
  });
546
- import_tracing2.trace.metrics.distribution("dxos.mesh.signal.signal-client.bytes-out", getByteCount(message), {
144
+ import_tracing.trace.metrics.distribution("dxos.mesh.signal.signal-client.bytes-out", getByteCount(message), {
547
145
  tags
548
146
  });
549
147
  } catch (err) {
550
148
  success = false;
551
149
  }
552
- import_tracing2.trace.metrics.increment("dxos.mesh.signal.signal-client.sent-total", 1, {
150
+ import_tracing.trace.metrics.increment("dxos.mesh.signal.signal-client.sent-total", 1, {
553
151
  tags: {
554
152
  ...tags,
555
153
  success
@@ -557,10 +155,10 @@ var SignalClientMonitor = class {
557
155
  });
558
156
  }
559
157
  recordStreamCloseErrors(count) {
560
- import_tracing2.trace.metrics.increment("dxos.mesh.signal.signal-client.stream-close-errors", count);
158
+ import_tracing.trace.metrics.increment("dxos.mesh.signal.signal-client.stream-close-errors", count);
561
159
  }
562
160
  recordReconciliation(params) {
563
- import_tracing2.trace.metrics.increment("dxos.mesh.signal.signal-client.reconciliation", 1, {
161
+ import_tracing.trace.metrics.increment("dxos.mesh.signal.signal-client.reconciliation", 1, {
564
162
  tags: {
565
163
  success: params.success
566
164
  }
@@ -575,16 +173,16 @@ var createIdentityTags = (message) => {
575
173
  peer: message.author.peerKey
576
174
  };
577
175
  };
578
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-client/signal-local-state.ts";
176
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-client/signal-local-state.ts";
579
177
  var SignalLocalState = class {
580
178
  constructor(_onMessage, _onSwarmEvent) {
581
179
  this._onMessage = _onMessage;
582
180
  this._onSwarmEvent = _onSwarmEvent;
583
- this._swarmStreams = new import_util2.ComplexMap(({ topic, peerId }) => topic.toHex() + peerId.toHex());
584
- this._joinedTopics = new import_util2.ComplexSet(({ topic, peerId }) => topic.toHex() + peerId.toHex());
585
- this._subscribedMessages = new import_util2.ComplexSet(({ peerId }) => peerId.toHex());
586
- this.messageStreams = new import_util2.ComplexMap((key) => key.toHex());
587
- this.reconciled = new import_async3.Event();
181
+ this._swarmStreams = new import_util.ComplexMap(({ topic, peerId }) => topic.toHex() + peerId.toHex());
182
+ this._joinedTopics = new import_util.ComplexSet(({ topic, peerId }) => topic.toHex() + peerId.toHex());
183
+ this._subscribedMessages = new import_util.ComplexSet(({ peerId }) => peerId.toHex());
184
+ this.messageStreams = new import_util.ComplexMap((key) => key.toHex());
185
+ this.reconciled = new import_async2.Event();
588
186
  }
589
187
  async safeCloseStreams() {
590
188
  const streams = [
@@ -594,7 +192,7 @@ var SignalLocalState = class {
594
192
  ]);
595
193
  this._swarmStreams.clear();
596
194
  this.messageStreams.clear();
597
- const failureCount = (await (0, import_util2.safeAwaitAll)(streams, (s) => s.close())).length;
195
+ const failureCount = (await (0, import_util.safeAwaitAll)(streams, (s) => s.close())).length;
598
196
  return {
599
197
  failureCount
600
198
  };
@@ -625,10 +223,10 @@ var SignalLocalState = class {
625
223
  });
626
224
  }
627
225
  unsubscribeMessages(peerId) {
628
- (0, import_log3.log)("unsubscribing from messages", {
226
+ (0, import_log2.log)("unsubscribing from messages", {
629
227
  peerId
630
228
  }, {
631
- F: __dxlog_file2,
229
+ F: __dxlog_file,
632
230
  L: 79,
633
231
  S: this,
634
232
  C: (f, a) => f(...a)
@@ -668,7 +266,7 @@ var SignalLocalState = class {
668
266
  })) {
669
267
  continue;
670
268
  }
671
- const swarmStream = await (0, import_async3.asyncTimeout)((0, import_context3.cancelWithContext)(ctx, client.join({
269
+ const swarmStream = await (0, import_async2.asyncTimeout)((0, import_context2.cancelWithContext)(ctx, client.join({
672
270
  topic,
673
271
  peerId
674
272
  })), 5e3);
@@ -677,10 +275,10 @@ var SignalLocalState = class {
677
275
  topic,
678
276
  peerId
679
277
  })) {
680
- (0, import_log3.log)("swarm event", {
278
+ (0, import_log2.log)("swarm event", {
681
279
  swarmEvent
682
280
  }, {
683
- F: __dxlog_file2,
281
+ F: __dxlog_file,
684
282
  L: 115,
685
283
  S: this,
686
284
  C: (f, a) => f(...a)
@@ -690,7 +288,7 @@ var SignalLocalState = class {
690
288
  peerAvailable: {
691
289
  ...swarmEvent.peerAvailable,
692
290
  peer: {
693
- peerKey: import_keys3.PublicKey.from(swarmEvent.peerAvailable.peer).toHex()
291
+ peerKey: import_keys2.PublicKey.from(swarmEvent.peerAvailable.peer).toHex()
694
292
  }
695
293
  }
696
294
  } : {
@@ -698,7 +296,7 @@ var SignalLocalState = class {
698
296
  peerLeft: {
699
297
  ...swarmEvent.peerLeft,
700
298
  peer: {
701
- peerKey: import_keys3.PublicKey.from(swarmEvent.peerLeft.peer).toHex()
299
+ peerKey: import_keys2.PublicKey.from(swarmEvent.peerLeft.peer).toHex()
702
300
  }
703
301
  }
704
302
  };
@@ -725,17 +323,17 @@ var SignalLocalState = class {
725
323
  if (this.messageStreams.has(peerId)) {
726
324
  continue;
727
325
  }
728
- const messageStream = await (0, import_async3.asyncTimeout)((0, import_context3.cancelWithContext)(ctx, client.receiveMessages(peerId)), 5e3);
326
+ const messageStream = await (0, import_async2.asyncTimeout)((0, import_context2.cancelWithContext)(ctx, client.receiveMessages(peerId)), 5e3);
729
327
  messageStream.subscribe(async (signalMessage) => {
730
328
  if (this._subscribedMessages.has({
731
329
  peerId
732
330
  })) {
733
331
  const message = {
734
332
  author: {
735
- peerKey: import_keys3.PublicKey.from(signalMessage.author).toHex()
333
+ peerKey: import_keys2.PublicKey.from(signalMessage.author).toHex()
736
334
  },
737
335
  recipient: {
738
- peerKey: import_keys3.PublicKey.from(signalMessage.recipient).toHex()
336
+ peerKey: import_keys2.PublicKey.from(signalMessage.recipient).toHex()
739
337
  },
740
338
  payload: signalMessage.payload
741
339
  };
@@ -748,26 +346,26 @@ var SignalLocalState = class {
748
346
  };
749
347
  var SignalRpcClientMonitor = class {
750
348
  recordClientCloseFailure(params) {
751
- import_tracing3.trace.metrics.increment("dxos.mesh.signal.signal-rpc-client.close-failure", 1, {
349
+ import_tracing2.trace.metrics.increment("dxos.mesh.signal.signal-rpc-client.close-failure", 1, {
752
350
  tags: {
753
351
  reason: params.failureReason
754
352
  }
755
353
  });
756
354
  }
757
355
  };
758
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-client/signal-rpc-client.ts";
356
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-client/signal-rpc-client.ts";
759
357
  var SIGNAL_KEEPALIVE_INTERVAL = 1e4;
760
358
  var SignalRPCClient = class {
761
359
  constructor({ url, callbacks = {} }) {
762
- this._connectTrigger = new import_async4.Trigger();
360
+ this._connectTrigger = new import_async3.Trigger();
763
361
  this._closed = false;
764
- this._closeComplete = new import_async4.Trigger();
362
+ this._closeComplete = new import_async3.Trigger();
765
363
  this._monitor = new SignalRpcClientMonitor();
766
- const traceId = import_keys4.PublicKey.random().toHex();
767
- import_log4.log.trace("dxos.mesh.signal-rpc-client.constructor", import_protocols3.trace.begin({
364
+ const traceId = import_keys3.PublicKey.random().toHex();
365
+ import_log3.log.trace("dxos.mesh.signal-rpc-client.constructor", import_protocols2.trace.begin({
768
366
  id: traceId
769
367
  }), {
770
- F: __dxlog_file3,
368
+ F: __dxlog_file2,
771
369
  L: 61,
772
370
  S: this,
773
371
  C: (f, a) => f(...a)
@@ -777,7 +375,7 @@ var SignalRPCClient = class {
777
375
  this._socket = new import_isomorphic_ws.default(this._url);
778
376
  this._rpc = (0, import_rpc.createProtoRpcPeer)({
779
377
  requested: {
780
- Signal: import_proto2.schema.getService("dxos.mesh.signal.Signal")
378
+ Signal: import_proto.schema.getService("dxos.mesh.signal.Signal")
781
379
  },
782
380
  noHandshake: true,
783
381
  port: {
@@ -788,8 +386,8 @@ var SignalRPCClient = class {
788
386
  try {
789
387
  this._socket.send(msg);
790
388
  } catch (err) {
791
- import_log4.log.warn("send error", err, {
792
- F: __dxlog_file3,
389
+ import_log3.log.warn("send error", err, {
390
+ F: __dxlog_file2,
793
391
  L: 80,
794
392
  S: this,
795
393
  C: (f, a) => f(...a)
@@ -817,19 +415,19 @@ var SignalRPCClient = class {
817
415
  await this._safeCloseRpc();
818
416
  return;
819
417
  }
820
- (0, import_log4.log)(`RPC open ${this._url}`, void 0, {
821
- F: __dxlog_file3,
418
+ (0, import_log3.log)(`RPC open ${this._url}`, void 0, {
419
+ F: __dxlog_file2,
822
420
  L: 105,
823
421
  S: this,
824
422
  C: (f, a) => f(...a)
825
423
  });
826
424
  this._callbacks.onConnected?.();
827
425
  this._connectTrigger.wake();
828
- this._keepaliveCtx = new import_context4.Context(void 0, {
829
- F: __dxlog_file3,
426
+ this._keepaliveCtx = new import_context3.Context(void 0, {
427
+ F: __dxlog_file2,
830
428
  L: 108
831
429
  });
832
- (0, import_async4.scheduleTaskInterval)(this._keepaliveCtx, async () => {
430
+ (0, import_async3.scheduleTaskInterval)(this._keepaliveCtx, async () => {
833
431
  this._socket?.send("__ping__");
834
432
  }, SIGNAL_KEEPALIVE_INTERVAL);
835
433
  } catch (err) {
@@ -839,8 +437,8 @@ var SignalRPCClient = class {
839
437
  }
840
438
  };
841
439
  this._socket.onclose = async () => {
842
- (0, import_log4.log)(`Disconnected ${this._url}`, void 0, {
843
- F: __dxlog_file3,
440
+ (0, import_log3.log)(`Disconnected ${this._url}`, void 0, {
441
+ F: __dxlog_file2,
844
442
  L: 128,
845
443
  S: this,
846
444
  C: (f, a) => f(...a)
@@ -857,20 +455,20 @@ var SignalRPCClient = class {
857
455
  this._closed = true;
858
456
  this._callbacks.onError?.(event.error ?? new Error(event.message));
859
457
  await this._safeCloseRpc();
860
- import_log4.log.warn(`Socket ${event.type ?? "unknown"} error`, {
458
+ import_log3.log.warn(`Socket ${event.type ?? "unknown"} error`, {
861
459
  message: event.message,
862
460
  url: this._url
863
461
  }, {
864
- F: __dxlog_file3,
462
+ F: __dxlog_file2,
865
463
  L: 144,
866
464
  S: this,
867
465
  C: (f, a) => f(...a)
868
466
  });
869
467
  };
870
- import_log4.log.trace("dxos.mesh.signal-rpc-client.constructor", import_protocols3.trace.end({
468
+ import_log3.log.trace("dxos.mesh.signal-rpc-client.constructor", import_protocols2.trace.end({
871
469
  id: traceId
872
470
  }), {
873
- F: __dxlog_file3,
471
+ F: __dxlog_file2,
874
472
  L: 147,
875
473
  S: this,
876
474
  C: (f, a) => f(...a)
@@ -891,25 +489,25 @@ var SignalRPCClient = class {
891
489
  timeout: 1e3
892
490
  });
893
491
  } catch (err) {
894
- const failureReason = err instanceof import_async4.TimeoutError ? "timeout" : err?.constructor?.name ?? "unknown";
492
+ const failureReason = err instanceof import_async3.TimeoutError ? "timeout" : err?.constructor?.name ?? "unknown";
895
493
  this._monitor.recordClientCloseFailure({
896
494
  failureReason
897
495
  });
898
496
  }
899
497
  }
900
498
  async join({ topic, peerId }) {
901
- (0, import_log4.log)("join", {
499
+ (0, import_log3.log)("join", {
902
500
  topic,
903
501
  peerId,
904
502
  metadata: this._callbacks?.getMetadata?.()
905
503
  }, {
906
- F: __dxlog_file3,
504
+ F: __dxlog_file2,
907
505
  L: 173,
908
506
  S: this,
909
507
  C: (f, a) => f(...a)
910
508
  });
911
- (0, import_invariant3.invariant)(!this._closed, "SignalRPCClient is closed", {
912
- F: __dxlog_file3,
509
+ (0, import_invariant2.invariant)(!this._closed, "SignalRPCClient is closed", {
510
+ F: __dxlog_file2,
913
511
  L: 174,
914
512
  S: this,
915
513
  A: [
@@ -927,16 +525,16 @@ var SignalRPCClient = class {
927
525
  return swarmStream;
928
526
  }
929
527
  async receiveMessages(peerId) {
930
- (0, import_log4.log)("receiveMessages", {
528
+ (0, import_log3.log)("receiveMessages", {
931
529
  peerId
932
530
  }, {
933
- F: __dxlog_file3,
531
+ F: __dxlog_file2,
934
532
  L: 186,
935
533
  S: this,
936
534
  C: (f, a) => f(...a)
937
535
  });
938
- (0, import_invariant3.invariant)(!this._closed, "SignalRPCClient is closed", {
939
- F: __dxlog_file3,
536
+ (0, import_invariant2.invariant)(!this._closed, "SignalRPCClient is closed", {
537
+ F: __dxlog_file2,
940
538
  L: 187,
941
539
  S: this,
942
540
  A: [
@@ -952,19 +550,19 @@ var SignalRPCClient = class {
952
550
  return messageStream;
953
551
  }
954
552
  async sendMessage({ author, recipient, payload }) {
955
- (0, import_log4.log)("sendMessage", {
553
+ (0, import_log3.log)("sendMessage", {
956
554
  author,
957
555
  recipient,
958
556
  payload,
959
557
  metadata: this._callbacks?.getMetadata?.()
960
558
  }, {
961
- F: __dxlog_file3,
559
+ F: __dxlog_file2,
962
560
  L: 197,
963
561
  S: this,
964
562
  C: (f, a) => f(...a)
965
563
  });
966
- (0, import_invariant3.invariant)(!this._closed, "SignalRPCClient is closed", {
967
- F: __dxlog_file3,
564
+ (0, import_invariant2.invariant)(!this._closed, "SignalRPCClient is closed", {
565
+ F: __dxlog_file2,
968
566
  L: 198,
969
567
  S: this,
970
568
  A: [
@@ -985,8 +583,8 @@ var SignalRPCClient = class {
985
583
  this._connectTrigger.reset();
986
584
  await this._rpc.close();
987
585
  } catch (err) {
988
- import_log4.log.catch(err, void 0, {
989
- F: __dxlog_file3,
586
+ import_log3.log.catch(err, void 0, {
587
+ F: __dxlog_file2,
990
588
  L: 213,
991
589
  S: this,
992
590
  C: (f, a) => f(...a)
@@ -994,12 +592,12 @@ var SignalRPCClient = class {
994
592
  }
995
593
  }
996
594
  };
997
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-client/signal-client.ts";
595
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-client/signal-client.ts";
998
596
  var DEFAULT_RECONNECT_TIMEOUT = 100;
999
597
  var MAX_RECONNECT_TIMEOUT = 5e3;
1000
598
  var ERROR_RECONCILE_DELAY = 1e3;
1001
599
  var RECONCILE_INTERVAL = 5e3;
1002
- var SignalClient = class extends import_context2.Resource {
600
+ var SignalClient = class extends import_context.Resource {
1003
601
  /**
1004
602
  * @param _host Signal server websocket URL.
1005
603
  * @param onMessage called when a new message is received.
@@ -1013,12 +611,12 @@ var SignalClient = class extends import_context2.Resource {
1013
611
  this._monitor = new SignalClientMonitor();
1014
612
  this._state = import_signal.SignalState.CLOSED;
1015
613
  this._lastReconciliationFailed = false;
1016
- this._clientReady = new import_async2.Trigger();
614
+ this._clientReady = new import_async.Trigger();
1017
615
  this._reconnectAfter = DEFAULT_RECONNECT_TIMEOUT;
1018
- this._instanceId = import_keys2.PublicKey.random().toHex();
1019
- this.statusChanged = new import_async2.Event();
1020
- this.onMessage = new import_async2.Event();
1021
- this.swarmEvent = new import_async2.Event();
616
+ this._instanceId = import_keys.PublicKey.random().toHex();
617
+ this.statusChanged = new import_async.Event();
618
+ this.onMessage = new import_async.Event();
619
+ this.swarmEvent = new import_async.Event();
1022
620
  if (!this._host.startsWith("wss://") && !this._host.startsWith("ws://")) {
1023
621
  throw new Error(`Signal server requires a websocket URL. Provided: ${this._host}`);
1024
622
  }
@@ -1028,10 +626,10 @@ var SignalClient = class extends import_context2.Resource {
1028
626
  }, async (event) => this.swarmEvent.emit(event));
1029
627
  }
1030
628
  async _open() {
1031
- import_log2.log.trace("dxos.mesh.signal-client.open", import_protocols2.trace.begin({
629
+ import_log.log.trace("dxos.mesh.signal-client.open", import_protocols.trace.begin({
1032
630
  id: this._instanceId
1033
631
  }), {
1034
- F: __dxlog_file4,
632
+ F: __dxlog_file3,
1035
633
  L: 92,
1036
634
  S: this,
1037
635
  C: (f, a) => f(...a)
@@ -1043,13 +641,13 @@ var SignalClient = class extends import_context2.Resource {
1043
641
  return;
1044
642
  }
1045
643
  this._setState(import_signal.SignalState.CONNECTING);
1046
- this._reconcileTask = new import_async2.DeferredTask(this._ctx, async () => {
644
+ this._reconcileTask = new import_async.DeferredTask(this._ctx, async () => {
1047
645
  try {
1048
- await (0, import_context2.cancelWithContext)(this._connectionCtx, this._clientReady.wait({
646
+ await (0, import_context.cancelWithContext)(this._connectionCtx, this._clientReady.wait({
1049
647
  timeout: 5e3
1050
648
  }));
1051
- (0, import_invariant2.invariant)(this._state === import_signal.SignalState.CONNECTED, "Not connected to Signal Server", {
1052
- F: __dxlog_file4,
649
+ (0, import_invariant.invariant)(this._state === import_signal.SignalState.CONNECTED, "Not connected to Signal Server", {
650
+ F: __dxlog_file3,
1053
651
  L: 102,
1054
652
  S: this,
1055
653
  A: [
@@ -1070,12 +668,12 @@ var SignalClient = class extends import_context2.Resource {
1070
668
  throw err;
1071
669
  }
1072
670
  });
1073
- (0, import_async2.scheduleTaskInterval)(this._ctx, async () => {
671
+ (0, import_async.scheduleTaskInterval)(this._ctx, async () => {
1074
672
  if (this._state === import_signal.SignalState.CONNECTED) {
1075
673
  this._reconcileTask.schedule();
1076
674
  }
1077
675
  }, RECONCILE_INTERVAL);
1078
- this._reconnectTask = new import_async2.DeferredTask(this._ctx, async () => {
676
+ this._reconnectTask = new import_async.DeferredTask(this._ctx, async () => {
1079
677
  try {
1080
678
  await this._reconnect();
1081
679
  this._monitor.recordReconnect({
@@ -1089,10 +687,10 @@ var SignalClient = class extends import_context2.Resource {
1089
687
  }
1090
688
  });
1091
689
  this._createClient();
1092
- import_log2.log.trace("dxos.mesh.signal-client.open", import_protocols2.trace.end({
690
+ import_log.log.trace("dxos.mesh.signal-client.open", import_protocols.trace.end({
1093
691
  id: this._instanceId
1094
692
  }), {
1095
- F: __dxlog_file4,
693
+ F: __dxlog_file3,
1096
694
  L: 135,
1097
695
  S: this,
1098
696
  C: (f, a) => f(...a)
@@ -1103,8 +701,8 @@ var SignalClient = class extends import_context2.Resource {
1103
701
  return;
1104
702
  }
1105
703
  if (this._state === import_signal.SignalState.CONNECTED && !this._lastReconciliationFailed) {
1106
- import_log2.log.warn("SignalClient error:", err, {
1107
- F: __dxlog_file4,
704
+ import_log.log.warn("SignalClient error:", err, {
705
+ F: __dxlog_file3,
1108
706
  L: 144,
1109
707
  S: this,
1110
708
  C: (f, a) => f(...a)
@@ -1113,8 +711,8 @@ var SignalClient = class extends import_context2.Resource {
1113
711
  this._scheduleReconcileAfterError();
1114
712
  }
1115
713
  async _close() {
1116
- (0, import_log2.log)("closing...", void 0, {
1117
- F: __dxlog_file4,
714
+ (0, import_log.log)("closing...", void 0, {
715
+ F: __dxlog_file3,
1118
716
  L: 150,
1119
717
  S: this,
1120
718
  C: (f, a) => f(...a)
@@ -1126,8 +724,8 @@ var SignalClient = class extends import_context2.Resource {
1126
724
  }
1127
725
  this._setState(import_signal.SignalState.CLOSED);
1128
726
  await this._safeResetClient();
1129
- (0, import_log2.log)("closed", void 0, {
1130
- F: __dxlog_file4,
727
+ (0, import_log.log)("closed", void 0, {
728
+ F: __dxlog_file3,
1131
729
  L: 158,
1132
730
  S: this,
1133
731
  C: (f, a) => f(...a)
@@ -1143,11 +741,11 @@ var SignalClient = class extends import_context2.Resource {
1143
741
  };
1144
742
  }
1145
743
  async join(args) {
1146
- (0, import_log2.log)("joining", {
744
+ (0, import_log.log)("joining", {
1147
745
  topic: args.topic,
1148
746
  peerId: args.peer.peerKey
1149
747
  }, {
1150
- F: __dxlog_file4,
748
+ F: __dxlog_file3,
1151
749
  L: 172,
1152
750
  S: this,
1153
751
  C: (f, a) => f(...a)
@@ -1155,16 +753,16 @@ var SignalClient = class extends import_context2.Resource {
1155
753
  this._monitor.recordJoin();
1156
754
  this.localState.join({
1157
755
  topic: args.topic,
1158
- peerId: import_keys2.PublicKey.from(args.peer.peerKey)
756
+ peerId: import_keys.PublicKey.from(args.peer.peerKey)
1159
757
  });
1160
758
  this._reconcileTask?.schedule();
1161
759
  }
1162
760
  async leave(args) {
1163
- (0, import_log2.log)("leaving", {
761
+ (0, import_log.log)("leaving", {
1164
762
  topic: args.topic,
1165
763
  peerId: args.peer.peerKey
1166
764
  }, {
1167
- F: __dxlog_file4,
765
+ F: __dxlog_file3,
1168
766
  L: 179,
1169
767
  S: this,
1170
768
  C: (f, a) => f(...a)
@@ -1172,14 +770,14 @@ var SignalClient = class extends import_context2.Resource {
1172
770
  this._monitor.recordLeave();
1173
771
  this.localState.leave({
1174
772
  topic: args.topic,
1175
- peerId: import_keys2.PublicKey.from(args.peer.peerKey)
773
+ peerId: import_keys.PublicKey.from(args.peer.peerKey)
1176
774
  });
1177
775
  }
1178
776
  async sendMessage(msg) {
1179
777
  return this._monitor.recordMessageSending(msg, async () => {
1180
778
  await this._clientReady.wait();
1181
- (0, import_invariant2.invariant)(this._state === import_signal.SignalState.CONNECTED, "Not connected to Signal Server", {
1182
- F: __dxlog_file4,
779
+ (0, import_invariant.invariant)(this._state === import_signal.SignalState.CONNECTED, "Not connected to Signal Server", {
780
+ F: __dxlog_file3,
1183
781
  L: 187,
1184
782
  S: this,
1185
783
  A: [
@@ -1187,8 +785,8 @@ var SignalClient = class extends import_context2.Resource {
1187
785
  "'Not connected to Signal Server'"
1188
786
  ]
1189
787
  });
1190
- (0, import_invariant2.invariant)(msg.author.peerKey, "Author key required", {
1191
- F: __dxlog_file4,
788
+ (0, import_invariant.invariant)(msg.author.peerKey, "Author key required", {
789
+ F: __dxlog_file3,
1192
790
  L: 188,
1193
791
  S: this,
1194
792
  A: [
@@ -1196,8 +794,8 @@ var SignalClient = class extends import_context2.Resource {
1196
794
  "'Author key required'"
1197
795
  ]
1198
796
  });
1199
- (0, import_invariant2.invariant)(msg.recipient.peerKey, "Recipient key required", {
1200
- F: __dxlog_file4,
797
+ (0, import_invariant.invariant)(msg.recipient.peerKey, "Recipient key required", {
798
+ F: __dxlog_file3,
1201
799
  L: 189,
1202
800
  S: this,
1203
801
  A: [
@@ -1206,15 +804,15 @@ var SignalClient = class extends import_context2.Resource {
1206
804
  ]
1207
805
  });
1208
806
  await this._client.sendMessage({
1209
- author: import_keys2.PublicKey.from(msg.author.peerKey),
1210
- recipient: import_keys2.PublicKey.from(msg.recipient.peerKey),
807
+ author: import_keys.PublicKey.from(msg.author.peerKey),
808
+ recipient: import_keys.PublicKey.from(msg.recipient.peerKey),
1211
809
  payload: msg.payload
1212
810
  });
1213
811
  });
1214
812
  }
1215
813
  async subscribeMessages(peer) {
1216
- (0, import_invariant2.invariant)(peer.peerKey, "Peer key required", {
1217
- F: __dxlog_file4,
814
+ (0, import_invariant.invariant)(peer.peerKey, "Peer key required", {
815
+ F: __dxlog_file3,
1218
816
  L: 199,
1219
817
  S: this,
1220
818
  A: [
@@ -1222,20 +820,20 @@ var SignalClient = class extends import_context2.Resource {
1222
820
  "'Peer key required'"
1223
821
  ]
1224
822
  });
1225
- (0, import_log2.log)("subscribing to messages", {
823
+ (0, import_log.log)("subscribing to messages", {
1226
824
  peer
1227
825
  }, {
1228
- F: __dxlog_file4,
826
+ F: __dxlog_file3,
1229
827
  L: 200,
1230
828
  S: this,
1231
829
  C: (f, a) => f(...a)
1232
830
  });
1233
- this.localState.subscribeMessages(import_keys2.PublicKey.from(peer.peerKey));
831
+ this.localState.subscribeMessages(import_keys.PublicKey.from(peer.peerKey));
1234
832
  this._reconcileTask?.schedule();
1235
833
  }
1236
834
  async unsubscribeMessages(peer) {
1237
- (0, import_invariant2.invariant)(peer.peerKey, "Peer key required", {
1238
- F: __dxlog_file4,
835
+ (0, import_invariant.invariant)(peer.peerKey, "Peer key required", {
836
+ F: __dxlog_file3,
1239
837
  L: 206,
1240
838
  S: this,
1241
839
  A: [
@@ -1243,31 +841,31 @@ var SignalClient = class extends import_context2.Resource {
1243
841
  "'Peer key required'"
1244
842
  ]
1245
843
  });
1246
- (0, import_log2.log)("unsubscribing from messages", {
844
+ (0, import_log.log)("unsubscribing from messages", {
1247
845
  peer
1248
846
  }, {
1249
- F: __dxlog_file4,
847
+ F: __dxlog_file3,
1250
848
  L: 207,
1251
849
  S: this,
1252
850
  C: (f, a) => f(...a)
1253
851
  });
1254
- this.localState.unsubscribeMessages(import_keys2.PublicKey.from(peer.peerKey));
852
+ this.localState.unsubscribeMessages(import_keys.PublicKey.from(peer.peerKey));
1255
853
  }
1256
854
  _scheduleReconcileAfterError() {
1257
- (0, import_async2.scheduleTask)(this._ctx, () => this._reconcileTask.schedule(), ERROR_RECONCILE_DELAY);
855
+ (0, import_async.scheduleTask)(this._ctx, () => this._reconcileTask.schedule(), ERROR_RECONCILE_DELAY);
1258
856
  }
1259
857
  _createClient() {
1260
- (0, import_log2.log)("creating client", {
858
+ (0, import_log.log)("creating client", {
1261
859
  host: this._host,
1262
860
  state: this._state
1263
861
  }, {
1264
- F: __dxlog_file4,
862
+ F: __dxlog_file3,
1265
863
  L: 216,
1266
864
  S: this,
1267
865
  C: (f, a) => f(...a)
1268
866
  });
1269
- (0, import_invariant2.invariant)(!this._client, "Client already created", {
1270
- F: __dxlog_file4,
867
+ (0, import_invariant.invariant)(!this._client, "Client already created", {
868
+ F: __dxlog_file3,
1271
869
  L: 217,
1272
870
  S: this,
1273
871
  A: [
@@ -1278,8 +876,8 @@ var SignalClient = class extends import_context2.Resource {
1278
876
  this._monitor.recordConnectionStartTime();
1279
877
  this._connectionCtx = this._ctx.derive();
1280
878
  this._connectionCtx.onDispose(async () => {
1281
- (0, import_log2.log)("connection context disposed", void 0, {
1282
- F: __dxlog_file4,
879
+ (0, import_log.log)("connection context disposed", void 0, {
880
+ F: __dxlog_file3,
1283
881
  L: 224,
1284
882
  S: this,
1285
883
  C: (f, a) => f(...a)
@@ -1293,8 +891,8 @@ var SignalClient = class extends import_context2.Resource {
1293
891
  callbacks: {
1294
892
  onConnected: () => {
1295
893
  if (client === this._client) {
1296
- (0, import_log2.log)("socket connected", void 0, {
1297
- F: __dxlog_file4,
894
+ (0, import_log.log)("socket connected", void 0, {
895
+ F: __dxlog_file3,
1298
896
  L: 235,
1299
897
  S: this,
1300
898
  C: (f, a) => f(...a)
@@ -1306,10 +904,10 @@ var SignalClient = class extends import_context2.Resource {
1306
904
  if (client !== this._client) {
1307
905
  return;
1308
906
  }
1309
- (0, import_log2.log)("socket disconnected", {
907
+ (0, import_log.log)("socket disconnected", {
1310
908
  state: this._state
1311
909
  }, {
1312
- F: __dxlog_file4,
910
+ F: __dxlog_file3,
1313
911
  L: 244,
1314
912
  S: this,
1315
913
  C: (f, a) => f(...a)
@@ -1322,11 +920,11 @@ var SignalClient = class extends import_context2.Resource {
1322
920
  },
1323
921
  onError: (error) => {
1324
922
  if (client === this._client) {
1325
- (0, import_log2.log)("socket error", {
923
+ (0, import_log.log)("socket error", {
1326
924
  error,
1327
925
  state: this._state
1328
926
  }, {
1329
- F: __dxlog_file4,
927
+ F: __dxlog_file3,
1330
928
  L: 256,
1331
929
  S: this,
1332
930
  C: (f, a) => f(...a)
@@ -1348,17 +946,17 @@ var SignalClient = class extends import_context2.Resource {
1348
946
  }
1349
947
  }
1350
948
  async _reconnect() {
1351
- (0, import_log2.log)(`reconnecting in ${this._reconnectAfter}ms`, {
949
+ (0, import_log.log)(`reconnecting in ${this._reconnectAfter}ms`, {
1352
950
  state: this._state
1353
951
  }, {
1354
- F: __dxlog_file4,
952
+ F: __dxlog_file3,
1355
953
  L: 271,
1356
954
  S: this,
1357
955
  C: (f, a) => f(...a)
1358
956
  });
1359
957
  if (this._state === import_signal.SignalState.RECONNECTING) {
1360
- import_log2.log.info("Signal api already reconnecting.", void 0, {
1361
- F: __dxlog_file4,
958
+ import_log.log.info("Signal api already reconnecting.", void 0, {
959
+ F: __dxlog_file3,
1362
960
  L: 274,
1363
961
  S: this,
1364
962
  C: (f, a) => f(...a)
@@ -1370,7 +968,7 @@ var SignalClient = class extends import_context2.Resource {
1370
968
  }
1371
969
  this._setState(import_signal.SignalState.RECONNECTING);
1372
970
  await this._safeResetClient();
1373
- await (0, import_context2.cancelWithContext)(this._ctx, (0, import_async2.sleep)(this._reconnectAfter));
971
+ await (0, import_context.cancelWithContext)(this._ctx, (0, import_async.sleep)(this._reconnectAfter));
1374
972
  this._createClient();
1375
973
  }
1376
974
  _onConnected() {
@@ -1397,10 +995,10 @@ var SignalClient = class extends import_context2.Resource {
1397
995
  _setState(newState) {
1398
996
  this._state = newState;
1399
997
  this._monitor.recordStateChangeTime();
1400
- (0, import_log2.log)("signal state changed", {
998
+ (0, import_log.log)("signal state changed", {
1401
999
  status: this.getStatus()
1402
1000
  }, {
1403
- F: __dxlog_file4,
1001
+ F: __dxlog_file3,
1404
1002
  L: 315,
1405
1003
  S: this,
1406
1004
  C: (f, a) => f(...a)
@@ -1422,263 +1020,12 @@ var SignalClient = class extends import_context2.Resource {
1422
1020
  this._client = void 0;
1423
1021
  }
1424
1022
  };
1425
- var PeerInfoHash = ({ peerKey }) => peerKey;
1426
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-manager/memory-signal-manager.ts";
1427
- var MemorySignalManagerContext = class {
1428
- constructor() {
1429
- this.swarmEvent = new import_async5.Event();
1430
- this.swarms = new import_util3.ComplexMap(import_keys5.PublicKey.hash);
1431
- this.connections = new import_util3.ComplexMap(PeerInfoHash);
1432
- }
1433
- };
1434
- var MemorySignalManager = class {
1435
- constructor(_context) {
1436
- this._context = _context;
1437
- this.statusChanged = new import_async5.Event();
1438
- this.swarmEvent = new import_async5.Event();
1439
- this.onMessage = new import_async5.Event();
1440
- this._joinedSwarms = new import_util3.ComplexSet(({ topic, peer }) => topic.toHex() + peer.peerKey);
1441
- this._freezeTrigger = new import_async5.Trigger().wake();
1442
- this._ctx = new import_context5.Context(void 0, {
1443
- F: __dxlog_file5,
1444
- L: 51
1445
- });
1446
- this._ctx.onDispose(this._context.swarmEvent.on((data) => this.swarmEvent.emit(data)));
1447
- }
1448
- async open() {
1449
- if (!this._ctx.disposed) {
1450
- return;
1451
- }
1452
- this._ctx = new import_context5.Context(void 0, {
1453
- F: __dxlog_file5,
1454
- L: 60
1455
- });
1456
- this._ctx.onDispose(this._context.swarmEvent.on((data) => this.swarmEvent.emit(data)));
1457
- await Promise.all([
1458
- ...this._joinedSwarms.values()
1459
- ].map((value) => this.join(value)));
1460
- }
1461
- async close() {
1462
- if (this._ctx.disposed) {
1463
- return;
1464
- }
1465
- const joinedSwarmsCopy = new import_util3.ComplexSet(({ topic, peer }) => topic.toHex() + peer.peerKey, [
1466
- ...this._joinedSwarms.values()
1467
- ]);
1468
- await Promise.all([
1469
- ...this._joinedSwarms.values()
1470
- ].map((value) => this.leave(value)));
1471
- this._joinedSwarms = joinedSwarmsCopy;
1472
- await this._ctx.dispose();
1473
- }
1474
- getStatus() {
1475
- return [];
1476
- }
1477
- async join({ topic, peer }) {
1478
- (0, import_invariant4.invariant)(!this._ctx.disposed, "Closed", {
1479
- F: __dxlog_file5,
1480
- L: 89,
1481
- S: this,
1482
- A: [
1483
- "!this._ctx.disposed",
1484
- "'Closed'"
1485
- ]
1486
- });
1487
- this._joinedSwarms.add({
1488
- topic,
1489
- peer
1490
- });
1491
- if (!this._context.swarms.has(topic)) {
1492
- this._context.swarms.set(topic, new import_util3.ComplexSet(PeerInfoHash));
1493
- }
1494
- this._context.swarms.get(topic).add(peer);
1495
- this._context.swarmEvent.emit({
1496
- topic,
1497
- peerAvailable: {
1498
- peer,
1499
- since: /* @__PURE__ */ new Date()
1500
- }
1501
- });
1502
- for (const [topic2, peers] of this._context.swarms) {
1503
- Array.from(peers).forEach((peer2) => {
1504
- this.swarmEvent.emit({
1505
- topic: topic2,
1506
- peerAvailable: {
1507
- peer: peer2,
1508
- since: /* @__PURE__ */ new Date()
1509
- }
1510
- });
1511
- });
1512
- }
1513
- }
1514
- async leave({ topic, peer }) {
1515
- (0, import_invariant4.invariant)(!this._ctx.disposed, "Closed", {
1516
- F: __dxlog_file5,
1517
- L: 121,
1518
- S: this,
1519
- A: [
1520
- "!this._ctx.disposed",
1521
- "'Closed'"
1522
- ]
1523
- });
1524
- this._joinedSwarms.delete({
1525
- topic,
1526
- peer
1527
- });
1528
- if (!this._context.swarms.has(topic)) {
1529
- this._context.swarms.set(topic, new import_util3.ComplexSet(PeerInfoHash));
1530
- }
1531
- this._context.swarms.get(topic).delete(peer);
1532
- const swarmEvent = {
1533
- topic,
1534
- peerLeft: {
1535
- peer
1536
- }
1537
- };
1538
- this._context.swarmEvent.emit(swarmEvent);
1539
- }
1540
- async sendMessage({ author, recipient, payload }) {
1541
- (0, import_log5.log)("send message", {
1542
- author,
1543
- recipient,
1544
- ...dec(payload)
1545
- }, {
1546
- F: __dxlog_file5,
1547
- L: 142,
1548
- S: this,
1549
- C: (f, a) => f(...a)
1550
- });
1551
- (0, import_invariant4.invariant)(recipient, void 0, {
1552
- F: __dxlog_file5,
1553
- L: 144,
1554
- S: this,
1555
- A: [
1556
- "recipient",
1557
- ""
1558
- ]
1559
- });
1560
- (0, import_invariant4.invariant)(!this._ctx.disposed, "Closed", {
1561
- F: __dxlog_file5,
1562
- L: 145,
1563
- S: this,
1564
- A: [
1565
- "!this._ctx.disposed",
1566
- "'Closed'"
1567
- ]
1568
- });
1569
- await this._freezeTrigger.wait();
1570
- const remote = this._context.connections.get(recipient);
1571
- if (!remote) {
1572
- import_log5.log.warn("recipient is not subscribed for messages", {
1573
- author,
1574
- recipient
1575
- }, {
1576
- F: __dxlog_file5,
1577
- L: 151,
1578
- S: this,
1579
- C: (f, a) => f(...a)
1580
- });
1581
- return;
1582
- }
1583
- if (remote._ctx.disposed) {
1584
- import_log5.log.warn("recipient is disposed", {
1585
- author,
1586
- recipient
1587
- }, {
1588
- F: __dxlog_file5,
1589
- L: 156,
1590
- S: this,
1591
- C: (f, a) => f(...a)
1592
- });
1593
- return;
1594
- }
1595
- remote._freezeTrigger.wait().then(() => {
1596
- if (remote._ctx.disposed) {
1597
- import_log5.log.warn("recipient is disposed", {
1598
- author,
1599
- recipient
1600
- }, {
1601
- F: __dxlog_file5,
1602
- L: 164,
1603
- S: this,
1604
- C: (f, a) => f(...a)
1605
- });
1606
- return;
1607
- }
1608
- (0, import_log5.log)("receive message", {
1609
- author,
1610
- recipient,
1611
- ...dec(payload)
1612
- }, {
1613
- F: __dxlog_file5,
1614
- L: 168,
1615
- S: this,
1616
- C: (f, a) => f(...a)
1617
- });
1618
- remote.onMessage.emit({
1619
- author,
1620
- recipient,
1621
- payload
1622
- });
1623
- }).catch((err) => {
1624
- import_log5.log.error("error while waiting for freeze", {
1625
- err
1626
- }, {
1627
- F: __dxlog_file5,
1628
- L: 173,
1629
- S: this,
1630
- C: (f, a) => f(...a)
1631
- });
1632
- });
1633
- }
1634
- async subscribeMessages(peerInfo) {
1635
- (0, import_log5.log)("subscribing", {
1636
- peerInfo
1637
- }, {
1638
- F: __dxlog_file5,
1639
- L: 178,
1640
- S: this,
1641
- C: (f, a) => f(...a)
1642
- });
1643
- this._context.connections.set(peerInfo, this);
1644
- }
1645
- async unsubscribeMessages(peerInfo) {
1646
- (0, import_log5.log)("unsubscribing", {
1647
- peerInfo
1648
- }, {
1649
- F: __dxlog_file5,
1650
- L: 183,
1651
- S: this,
1652
- C: (f, a) => f(...a)
1653
- });
1654
- this._context.connections.delete(peerInfo);
1655
- }
1656
- freeze() {
1657
- this._freezeTrigger.reset();
1658
- }
1659
- unfreeze() {
1660
- this._freezeTrigger.wake();
1661
- }
1662
- };
1663
- var dec = (payload) => {
1664
- if (!payload.type_url.endsWith("ReliablePayload")) {
1665
- return {};
1666
- }
1667
- const relPayload = import_proto3.schema.getCodecForType("dxos.mesh.messaging.ReliablePayload").decode(payload.value);
1668
- if (typeof relPayload?.payload?.data === "object") {
1669
- return {
1670
- payload: Object.keys(relPayload?.payload?.data)[0],
1671
- sessionId: relPayload?.payload?.sessionId
1672
- };
1673
- }
1674
- return {};
1675
- };
1676
1023
  var WebsocketSignalManagerMonitor = class {
1677
1024
  recordRateLimitExceeded() {
1678
- import_tracing4.trace.metrics.increment("dxos.mesh.signal.signal-manager.rate-limit-hit", 1);
1025
+ import_tracing3.trace.metrics.increment("dxos.mesh.signal.signal-manager.rate-limit-hit", 1);
1679
1026
  }
1680
1027
  recordServerFailure(params) {
1681
- import_tracing4.trace.metrics.increment("dxos.mesh.signal.signal-manager.server-failure", 1, {
1028
+ import_tracing3.trace.metrics.increment("dxos.mesh.signal.signal-manager.server-failure", 1, {
1682
1029
  tags: {
1683
1030
  server: params.serverName,
1684
1031
  restarted: params.willRestart
@@ -1692,10 +1039,10 @@ function _ts_decorate(decorators, target, key, desc) {
1692
1039
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1693
1040
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1694
1041
  }
1695
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-manager/websocket-signal-manager.ts";
1042
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-manager/websocket-signal-manager.ts";
1696
1043
  var MAX_SERVER_FAILURES = 5;
1697
1044
  var WSS_SIGNAL_SERVER_REBOOT_DELAY = 3e3;
1698
- var WebsocketSignalManager = class extends import_context6.Resource {
1045
+ var WebsocketSignalManager = class extends import_context4.Resource {
1699
1046
  constructor(_hosts, _getMetadata) {
1700
1047
  super();
1701
1048
  this._hosts = _hosts;
@@ -1703,14 +1050,14 @@ var WebsocketSignalManager = class extends import_context6.Resource {
1703
1050
  this._servers = /* @__PURE__ */ new Map();
1704
1051
  this._monitor = new WebsocketSignalManagerMonitor();
1705
1052
  this.failureCount = /* @__PURE__ */ new Map();
1706
- this.statusChanged = new import_async6.Event();
1707
- this.swarmEvent = new import_async6.Event();
1708
- this.onMessage = new import_async6.Event();
1709
- this._instanceId = import_keys6.PublicKey.random().toHex();
1710
- (0, import_log6.log)("Created WebsocketSignalManager", {
1053
+ this.statusChanged = new import_async4.Event();
1054
+ this.swarmEvent = new import_async4.Event();
1055
+ this.onMessage = new import_async4.Event();
1056
+ this._instanceId = import_keys4.PublicKey.random().toHex();
1057
+ (0, import_log4.log)("Created WebsocketSignalManager", {
1711
1058
  hosts: this._hosts
1712
1059
  }, {
1713
- F: __dxlog_file6,
1060
+ F: __dxlog_file4,
1714
1061
  L: 54,
1715
1062
  S: this,
1716
1063
  C: (f, a) => f(...a)
@@ -1726,49 +1073,49 @@ var WebsocketSignalManager = class extends import_context6.Resource {
1726
1073
  this._servers.set(host.server, server);
1727
1074
  this.failureCount.set(host.server, 0);
1728
1075
  }
1729
- this._failedServersBitfield = import_util4.BitField.zeros(this._hosts.length);
1076
+ this._failedServersBitfield = import_util2.BitField.zeros(this._hosts.length);
1730
1077
  }
1731
1078
  async _open() {
1732
- (0, import_log6.log)("open signal manager", {
1079
+ (0, import_log4.log)("open signal manager", {
1733
1080
  hosts: this._hosts
1734
1081
  }, {
1735
- F: __dxlog_file6,
1082
+ F: __dxlog_file4,
1736
1083
  L: 74,
1737
1084
  S: this,
1738
1085
  C: (f, a) => f(...a)
1739
1086
  });
1740
- import_log6.log.trace("dxos.mesh.websocket-signal-manager.open", import_protocols4.trace.begin({
1087
+ import_log4.log.trace("dxos.mesh.websocket-signal-manager.open", import_protocols3.trace.begin({
1741
1088
  id: this._instanceId
1742
1089
  }), {
1743
- F: __dxlog_file6,
1090
+ F: __dxlog_file4,
1744
1091
  L: 75,
1745
1092
  S: this,
1746
1093
  C: (f, a) => f(...a)
1747
1094
  });
1748
- await (0, import_util4.safeAwaitAll)(this._servers.values(), (server) => server.open());
1749
- import_log6.log.trace("dxos.mesh.websocket-signal-manager.open", import_protocols4.trace.end({
1095
+ await (0, import_util2.safeAwaitAll)(this._servers.values(), (server) => server.open());
1096
+ import_log4.log.trace("dxos.mesh.websocket-signal-manager.open", import_protocols3.trace.end({
1750
1097
  id: this._instanceId
1751
1098
  }), {
1752
- F: __dxlog_file6,
1099
+ F: __dxlog_file4,
1753
1100
  L: 79,
1754
1101
  S: this,
1755
1102
  C: (f, a) => f(...a)
1756
1103
  });
1757
1104
  }
1758
1105
  async _close() {
1759
- await (0, import_util4.safeAwaitAll)(this._servers.values(), (server) => server.close());
1106
+ await (0, import_util2.safeAwaitAll)(this._servers.values(), (server) => server.close());
1760
1107
  }
1761
1108
  async restartServer(serverName) {
1762
- (0, import_log6.log)("restarting server", {
1109
+ (0, import_log4.log)("restarting server", {
1763
1110
  serverName
1764
1111
  }, {
1765
- F: __dxlog_file6,
1112
+ F: __dxlog_file4,
1766
1113
  L: 87,
1767
1114
  S: this,
1768
1115
  C: (f, a) => f(...a)
1769
1116
  });
1770
- (0, import_invariant5.invariant)(this._lifecycleState === import_context6.LifecycleState.OPEN, void 0, {
1771
- F: __dxlog_file6,
1117
+ (0, import_invariant3.invariant)(this._lifecycleState === import_context4.LifecycleState.OPEN, void 0, {
1118
+ F: __dxlog_file4,
1772
1119
  L: 88,
1773
1120
  S: this,
1774
1121
  A: [
@@ -1777,8 +1124,8 @@ var WebsocketSignalManager = class extends import_context6.Resource {
1777
1124
  ]
1778
1125
  });
1779
1126
  const server = this._servers.get(serverName);
1780
- (0, import_invariant5.invariant)(server, "server not found", {
1781
- F: __dxlog_file6,
1127
+ (0, import_invariant3.invariant)(server, "server not found", {
1128
+ F: __dxlog_file4,
1782
1129
  L: 91,
1783
1130
  S: this,
1784
1131
  A: [
@@ -1787,24 +1134,24 @@ var WebsocketSignalManager = class extends import_context6.Resource {
1787
1134
  ]
1788
1135
  });
1789
1136
  await server.close();
1790
- await (0, import_async6.sleep)(WSS_SIGNAL_SERVER_REBOOT_DELAY);
1137
+ await (0, import_async4.sleep)(WSS_SIGNAL_SERVER_REBOOT_DELAY);
1791
1138
  await server.open();
1792
1139
  }
1793
1140
  getStatus() {
1794
1141
  return Array.from(this._servers.values()).map((server) => server.getStatus());
1795
1142
  }
1796
1143
  async join({ topic, peer }) {
1797
- (0, import_log6.log)("join", {
1144
+ (0, import_log4.log)("join", {
1798
1145
  topic,
1799
1146
  peer
1800
1147
  }, {
1801
- F: __dxlog_file6,
1148
+ F: __dxlog_file4,
1802
1149
  L: 104,
1803
1150
  S: this,
1804
1151
  C: (f, a) => f(...a)
1805
1152
  });
1806
- (0, import_invariant5.invariant)(this._lifecycleState === import_context6.LifecycleState.OPEN, void 0, {
1807
- F: __dxlog_file6,
1153
+ (0, import_invariant3.invariant)(this._lifecycleState === import_context4.LifecycleState.OPEN, void 0, {
1154
+ F: __dxlog_file4,
1808
1155
  L: 105,
1809
1156
  S: this,
1810
1157
  A: [
@@ -1818,17 +1165,17 @@ var WebsocketSignalManager = class extends import_context6.Resource {
1818
1165
  }));
1819
1166
  }
1820
1167
  async leave({ topic, peer }) {
1821
- (0, import_log6.log)("leaving", {
1168
+ (0, import_log4.log)("leaving", {
1822
1169
  topic,
1823
1170
  peer
1824
1171
  }, {
1825
- F: __dxlog_file6,
1172
+ F: __dxlog_file4,
1826
1173
  L: 111,
1827
1174
  S: this,
1828
1175
  C: (f, a) => f(...a)
1829
1176
  });
1830
- (0, import_invariant5.invariant)(this._lifecycleState === import_context6.LifecycleState.OPEN, void 0, {
1831
- F: __dxlog_file6,
1177
+ (0, import_invariant3.invariant)(this._lifecycleState === import_context4.LifecycleState.OPEN, void 0, {
1178
+ F: __dxlog_file4,
1832
1179
  L: 112,
1833
1180
  S: this,
1834
1181
  A: [
@@ -1842,16 +1189,16 @@ var WebsocketSignalManager = class extends import_context6.Resource {
1842
1189
  }));
1843
1190
  }
1844
1191
  async sendMessage({ author, recipient, payload }) {
1845
- (0, import_log6.log)("signal", {
1192
+ (0, import_log4.log)("signal", {
1846
1193
  recipient
1847
1194
  }, {
1848
- F: __dxlog_file6,
1195
+ F: __dxlog_file4,
1849
1196
  L: 117,
1850
1197
  S: this,
1851
1198
  C: (f, a) => f(...a)
1852
1199
  });
1853
- (0, import_invariant5.invariant)(this._lifecycleState === import_context6.LifecycleState.OPEN, void 0, {
1854
- F: __dxlog_file6,
1200
+ (0, import_invariant3.invariant)(this._lifecycleState === import_context4.LifecycleState.OPEN, void 0, {
1201
+ F: __dxlog_file4,
1855
1202
  L: 118,
1856
1203
  S: this,
1857
1204
  A: [
@@ -1865,31 +1212,31 @@ var WebsocketSignalManager = class extends import_context6.Resource {
1865
1212
  recipient,
1866
1213
  payload
1867
1214
  }).then(() => this._clearServerFailedFlag(serverName, index)).catch((err) => {
1868
- if (err instanceof import_protocols4.RateLimitExceededError) {
1869
- import_log6.log.info("WSS rate limit exceeded", {
1215
+ if (err instanceof import_protocols3.RateLimitExceededError) {
1216
+ import_log4.log.info("WSS rate limit exceeded", {
1870
1217
  err
1871
1218
  }, {
1872
- F: __dxlog_file6,
1219
+ F: __dxlog_file4,
1873
1220
  L: 126,
1874
1221
  S: this,
1875
1222
  C: (f, a) => f(...a)
1876
1223
  });
1877
1224
  this._monitor.recordRateLimitExceeded();
1878
- } else if (err instanceof import_protocols4.TimeoutError || err.constructor.name === "TimeoutError") {
1879
- import_log6.log.info("WSS sendMessage timeout", {
1225
+ } else if (err instanceof import_protocols3.TimeoutError || err.constructor.name === "TimeoutError") {
1226
+ import_log4.log.info("WSS sendMessage timeout", {
1880
1227
  err
1881
1228
  }, {
1882
- F: __dxlog_file6,
1229
+ F: __dxlog_file4,
1883
1230
  L: 129,
1884
1231
  S: this,
1885
1232
  C: (f, a) => f(...a)
1886
1233
  });
1887
1234
  void this.checkServerFailure(serverName, index);
1888
1235
  } else {
1889
- import_log6.log.warn(`error sending to ${serverName}`, {
1236
+ import_log4.log.warn(`error sending to ${serverName}`, {
1890
1237
  err
1891
1238
  }, {
1892
- F: __dxlog_file6,
1239
+ F: __dxlog_file4,
1893
1240
  L: 132,
1894
1241
  S: this,
1895
1242
  C: (f, a) => f(...a)
@@ -1907,17 +1254,17 @@ var WebsocketSignalManager = class extends import_context6.Resource {
1907
1254
  willRestart: isRestartRequired
1908
1255
  });
1909
1256
  if (isRestartRequired) {
1910
- if (!import_util4.BitField.get(this._failedServersBitfield, index)) {
1911
- import_log6.log.warn("too many failures for ws-server, restarting", {
1257
+ if (!import_util2.BitField.get(this._failedServersBitfield, index)) {
1258
+ import_log4.log.warn("too many failures for ws-server, restarting", {
1912
1259
  serverName,
1913
1260
  failureCount
1914
1261
  }, {
1915
- F: __dxlog_file6,
1262
+ F: __dxlog_file4,
1916
1263
  L: 146,
1917
1264
  S: this,
1918
1265
  C: (f, a) => f(...a)
1919
1266
  });
1920
- import_util4.BitField.set(this._failedServersBitfield, index, true);
1267
+ import_util2.BitField.set(this._failedServersBitfield, index, true);
1921
1268
  }
1922
1269
  await this.restartServer(serverName);
1923
1270
  this.failureCount.set(serverName, 0);
@@ -1926,30 +1273,30 @@ var WebsocketSignalManager = class extends import_context6.Resource {
1926
1273
  this.failureCount.set(serverName, (this.failureCount.get(serverName) ?? 0) + 1);
1927
1274
  }
1928
1275
  _clearServerFailedFlag(serverName, index) {
1929
- if (import_util4.BitField.get(this._failedServersBitfield, index)) {
1930
- import_log6.log.info("server connection restored", {
1276
+ if (import_util2.BitField.get(this._failedServersBitfield, index)) {
1277
+ import_log4.log.info("server connection restored", {
1931
1278
  serverName
1932
1279
  }, {
1933
- F: __dxlog_file6,
1280
+ F: __dxlog_file4,
1934
1281
  L: 159,
1935
1282
  S: this,
1936
1283
  C: (f, a) => f(...a)
1937
1284
  });
1938
- import_util4.BitField.set(this._failedServersBitfield, index, false);
1285
+ import_util2.BitField.set(this._failedServersBitfield, index, false);
1939
1286
  this.failureCount.set(serverName, 0);
1940
1287
  }
1941
1288
  }
1942
1289
  async subscribeMessages(peer) {
1943
- (0, import_log6.log)("subscribed for message stream", {
1290
+ (0, import_log4.log)("subscribed for message stream", {
1944
1291
  peer
1945
1292
  }, {
1946
- F: __dxlog_file6,
1293
+ F: __dxlog_file4,
1947
1294
  L: 166,
1948
1295
  S: this,
1949
1296
  C: (f, a) => f(...a)
1950
1297
  });
1951
- (0, import_invariant5.invariant)(this._lifecycleState === import_context6.LifecycleState.OPEN, void 0, {
1952
- F: __dxlog_file6,
1298
+ (0, import_invariant3.invariant)(this._lifecycleState === import_context4.LifecycleState.OPEN, void 0, {
1299
+ F: __dxlog_file4,
1953
1300
  L: 167,
1954
1301
  S: this,
1955
1302
  A: [
@@ -1960,16 +1307,16 @@ var WebsocketSignalManager = class extends import_context6.Resource {
1960
1307
  await this._forEachServer(async (server) => server.subscribeMessages(peer));
1961
1308
  }
1962
1309
  async unsubscribeMessages(peer) {
1963
- (0, import_log6.log)("subscribed for message stream", {
1310
+ (0, import_log4.log)("subscribed for message stream", {
1964
1311
  peer
1965
1312
  }, {
1966
- F: __dxlog_file6,
1313
+ F: __dxlog_file4,
1967
1314
  L: 173,
1968
1315
  S: this,
1969
1316
  C: (f, a) => f(...a)
1970
1317
  });
1971
- (0, import_invariant5.invariant)(this._lifecycleState === import_context6.LifecycleState.OPEN, void 0, {
1972
- F: __dxlog_file6,
1318
+ (0, import_invariant3.invariant)(this._lifecycleState === import_context4.LifecycleState.OPEN, void 0, {
1319
+ F: __dxlog_file4,
1973
1320
  L: 174,
1974
1321
  S: this,
1975
1322
  A: [
@@ -1984,21 +1331,21 @@ var WebsocketSignalManager = class extends import_context6.Resource {
1984
1331
  }
1985
1332
  };
1986
1333
  _ts_decorate([
1987
- import_async6.synchronized
1334
+ import_async4.synchronized
1988
1335
  ], WebsocketSignalManager.prototype, "join", null);
1989
1336
  _ts_decorate([
1990
- import_async6.synchronized
1337
+ import_async4.synchronized
1991
1338
  ], WebsocketSignalManager.prototype, "leave", null);
1992
1339
  _ts_decorate([
1993
- import_async6.synchronized
1340
+ import_async4.synchronized
1994
1341
  ], WebsocketSignalManager.prototype, "checkServerFailure", null);
1995
- var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-manager/edge-signal-manager.ts";
1996
- var EdgeSignalManager = class extends import_context7.Resource {
1342
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-manager/edge-signal-manager.ts";
1343
+ var EdgeSignalManager = class extends import_context5.Resource {
1997
1344
  constructor({ edgeConnection }) {
1998
1345
  super();
1999
- this.swarmEvent = new import_async7.Event();
2000
- this.onMessage = new import_async7.Event();
2001
- this._swarmPeers = new import_util5.ComplexMap(import_keys7.PublicKey.hash);
1346
+ this.swarmEvent = new import_async5.Event();
1347
+ this.onMessage = new import_async5.Event();
1348
+ this._swarmPeers = new import_util3.ComplexMap(import_keys5.PublicKey.hash);
2002
1349
  this._edgeConnection = edgeConnection;
2003
1350
  }
2004
1351
  async _open() {
@@ -2011,22 +1358,23 @@ var EdgeSignalManager = class extends import_context7.Resource {
2011
1358
  */
2012
1359
  async join({ topic, peer }) {
2013
1360
  if (!this._matchSelfPeerInfo(peer)) {
2014
- import_log7.log.warn("ignoring peer info on join request", {
1361
+ import_log5.log.warn("ignoring peer info on join request", {
2015
1362
  peer,
2016
1363
  expected: {
2017
1364
  peerKey: this._edgeConnection.peerKey,
2018
1365
  identityKey: this._edgeConnection.identityKey
2019
1366
  }
2020
1367
  }, {
2021
- F: __dxlog_file7,
1368
+ F: __dxlog_file5,
2022
1369
  L: 53,
2023
1370
  S: this,
2024
1371
  C: (f, a) => f(...a)
2025
1372
  });
2026
1373
  }
2027
- this._swarmPeers.set(topic, new import_util5.ComplexSet(PeerInfoHash));
1374
+ this._swarmPeers.set(topic, new import_util3.ComplexSet(import_chunk_WDA7H2PO.PeerInfoHash));
2028
1375
  await this._edgeConnection.send(import_edge_client.protocol.createMessage(import_messenger_pb.SwarmRequestSchema, {
2029
- serviceId: import_protocols5.EdgeService.SWARM_SERVICE_ID,
1376
+ serviceId: import_protocols4.EdgeService.SWARM_SERVICE_ID,
1377
+ source: createMessageSource(topic, peer),
2030
1378
  payload: {
2031
1379
  action: import_messenger_pb.SwarmRequest_Action.JOIN,
2032
1380
  swarmKeys: [
@@ -2038,7 +1386,8 @@ var EdgeSignalManager = class extends import_context7.Resource {
2038
1386
  async leave({ topic, peer }) {
2039
1387
  this._swarmPeers.delete(topic);
2040
1388
  await this._edgeConnection.send(import_edge_client.protocol.createMessage(import_messenger_pb.SwarmRequestSchema, {
2041
- serviceId: import_protocols5.EdgeService.SWARM_SERVICE_ID,
1389
+ serviceId: import_protocols4.EdgeService.SWARM_SERVICE_ID,
1390
+ source: createMessageSource(topic, peer),
2042
1391
  payload: {
2043
1392
  action: import_messenger_pb.SwarmRequest_Action.LEAVE,
2044
1393
  swarmKeys: [
@@ -2049,21 +1398,21 @@ var EdgeSignalManager = class extends import_context7.Resource {
2049
1398
  }
2050
1399
  async sendMessage(message) {
2051
1400
  if (!this._matchSelfPeerInfo(message.author)) {
2052
- import_log7.log.warn("ignoring author on send request", {
1401
+ import_log5.log.warn("ignoring author on send request", {
2053
1402
  author: message.author,
2054
1403
  expected: {
2055
1404
  peerKey: this._edgeConnection.peerKey,
2056
1405
  identityKey: this._edgeConnection.identityKey
2057
1406
  }
2058
1407
  }, {
2059
- F: __dxlog_file7,
2060
- L: 84,
1408
+ F: __dxlog_file5,
1409
+ L: 86,
2061
1410
  S: this,
2062
1411
  C: (f, a) => f(...a)
2063
1412
  });
2064
1413
  }
2065
- await this._edgeConnection.send(import_edge_client.protocol.createMessage(import_wkt.AnySchema, {
2066
- serviceId: import_protocols5.EdgeService.SIGNAL_SERVICE_ID,
1414
+ await this._edgeConnection.send(import_edge_client.protocol.createMessage(import_buf.bufWkt.AnySchema, {
1415
+ serviceId: import_protocols4.EdgeService.SIGNAL_SERVICE_ID,
2067
1416
  source: message.author,
2068
1417
  target: [
2069
1418
  message.recipient
@@ -2080,19 +1429,19 @@ var EdgeSignalManager = class extends import_context7.Resource {
2080
1429
  }
2081
1430
  _onMessage(message) {
2082
1431
  switch (message.serviceId) {
2083
- case import_protocols5.EdgeService.SWARM_SERVICE_ID: {
1432
+ case import_protocols4.EdgeService.SWARM_SERVICE_ID: {
2084
1433
  this._processSwarmResponse(message);
2085
1434
  break;
2086
1435
  }
2087
- case import_protocols5.EdgeService.SIGNAL_SERVICE_ID: {
1436
+ case import_protocols4.EdgeService.SIGNAL_SERVICE_ID: {
2088
1437
  this._processMessage(message);
2089
1438
  }
2090
1439
  }
2091
1440
  }
2092
1441
  _processSwarmResponse(message) {
2093
- (0, import_invariant6.invariant)(import_edge_client.protocol.getPayloadType(message) === import_messenger_pb.SwarmResponseSchema.typeName, "Wrong payload type", {
2094
- F: __dxlog_file7,
2095
- L: 121,
1442
+ (0, import_invariant4.invariant)(import_edge_client.protocol.getPayloadType(message) === import_messenger_pb.SwarmResponseSchema.typeName, "Wrong payload type", {
1443
+ F: __dxlog_file5,
1444
+ L: 123,
2096
1445
  S: this,
2097
1446
  A: [
2098
1447
  "protocol.getPayloadType(message) === SwarmResponseSchema.typeName",
@@ -2100,21 +1449,21 @@ var EdgeSignalManager = class extends import_context7.Resource {
2100
1449
  ]
2101
1450
  });
2102
1451
  const payload = import_edge_client.protocol.getPayload(message, import_messenger_pb.SwarmResponseSchema);
2103
- const topic = import_keys7.PublicKey.from(payload.swarmKey);
1452
+ const topic = import_keys5.PublicKey.from(payload.swarmKey);
2104
1453
  if (!this._swarmPeers.has(topic)) {
2105
- import_log7.log.warn("Received message from wrong topic", {
1454
+ import_log5.log.warn("Received message from wrong topic", {
2106
1455
  topic
2107
1456
  }, {
2108
- F: __dxlog_file7,
2109
- L: 125,
1457
+ F: __dxlog_file5,
1458
+ L: 127,
2110
1459
  S: this,
2111
1460
  C: (f, a) => f(...a)
2112
1461
  });
2113
1462
  return;
2114
1463
  }
2115
1464
  const oldPeers = this._swarmPeers.get(topic);
2116
- const timestamp = new Date(Date.parse(message.timestamp));
2117
- const newPeers = new import_util5.ComplexSet(PeerInfoHash, payload.peers);
1465
+ const timestamp = message.timestamp ? new Date(Date.parse(message.timestamp)) : /* @__PURE__ */ new Date();
1466
+ const newPeers = new import_util3.ComplexSet(import_chunk_WDA7H2PO.PeerInfoHash, payload.peers);
2118
1467
  for (const peer of newPeers) {
2119
1468
  if (oldPeers.has(peer)) {
2120
1469
  continue;
@@ -2141,37 +1490,37 @@ var EdgeSignalManager = class extends import_context7.Resource {
2141
1490
  this._swarmPeers.set(topic, newPeers);
2142
1491
  }
2143
1492
  _processMessage(message) {
2144
- (0, import_invariant6.invariant)(import_edge_client.protocol.getPayloadType(message) === import_wkt.AnySchema.typeName, "Wrong payload type", {
2145
- F: __dxlog_file7,
2146
- L: 158,
1493
+ (0, import_invariant4.invariant)(import_edge_client.protocol.getPayloadType(message) === import_buf.bufWkt.AnySchema.typeName, "Wrong payload type", {
1494
+ F: __dxlog_file5,
1495
+ L: 160,
2147
1496
  S: this,
2148
1497
  A: [
2149
- "protocol.getPayloadType(message) === AnySchema.typeName",
1498
+ "protocol.getPayloadType(message) === bufWkt.AnySchema.typeName",
2150
1499
  "'Wrong payload type'"
2151
1500
  ]
2152
1501
  });
2153
- const payload = import_edge_client.protocol.getPayload(message, import_wkt.AnySchema);
2154
- (0, import_invariant6.invariant)(message.source, "source is missing", {
2155
- F: __dxlog_file7,
2156
- L: 160,
1502
+ const payload = import_edge_client.protocol.getPayload(message, import_buf.bufWkt.AnySchema);
1503
+ (0, import_invariant4.invariant)(message.source, "source is missing", {
1504
+ F: __dxlog_file5,
1505
+ L: 162,
2157
1506
  S: this,
2158
1507
  A: [
2159
1508
  "message.source",
2160
1509
  "'source is missing'"
2161
1510
  ]
2162
1511
  });
2163
- (0, import_invariant6.invariant)(message.target, "target is missing", {
2164
- F: __dxlog_file7,
2165
- L: 161,
1512
+ (0, import_invariant4.invariant)(message.target, "target is missing", {
1513
+ F: __dxlog_file5,
1514
+ L: 163,
2166
1515
  S: this,
2167
1516
  A: [
2168
1517
  "message.target",
2169
1518
  "'target is missing'"
2170
1519
  ]
2171
1520
  });
2172
- (0, import_invariant6.invariant)(message.target.length === 1, "target should have exactly one item", {
2173
- F: __dxlog_file7,
2174
- L: 162,
1521
+ (0, import_invariant4.invariant)(message.target.length === 1, "target should have exactly one item", {
1522
+ F: __dxlog_file5,
1523
+ L: 164,
2175
1524
  S: this,
2176
1525
  A: [
2177
1526
  "message.target.length === 1",
@@ -2191,11 +1540,11 @@ var EdgeSignalManager = class extends import_context7.Resource {
2191
1540
  return peer && (peer.peerKey === this._edgeConnection.peerKey || peer.identityKey === this._edgeConnection.identityKey);
2192
1541
  }
2193
1542
  async _rejoinAllSwarms() {
2194
- (0, import_log7.log)("rejoin swarms", {
1543
+ (0, import_log5.log)("rejoin swarms", {
2195
1544
  swarms: Array.from(this._swarmPeers.keys())
2196
1545
  }, {
2197
- F: __dxlog_file7,
2198
- L: 181,
1546
+ F: __dxlog_file5,
1547
+ L: 183,
2199
1548
  S: this,
2200
1549
  C: (f, a) => f(...a)
2201
1550
  });
@@ -2210,14 +1559,21 @@ var EdgeSignalManager = class extends import_context7.Resource {
2210
1559
  }
2211
1560
  }
2212
1561
  };
2213
- var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-manager/utils.ts";
1562
+ var createMessageSource = (topic, peerInfo) => {
1563
+ return {
1564
+ swarmKey: topic.toHex(),
1565
+ identityKey: peerInfo.identityKey,
1566
+ peerKey: peerInfo.peerKey
1567
+ };
1568
+ };
1569
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/messaging/src/signal-manager/utils.ts";
2214
1570
  var setIdentityTags = ({ identityService, devicesService, setTag }) => {
2215
1571
  identityService.queryIdentity().subscribe((idqr) => {
2216
1572
  if (!idqr?.identity?.identityKey) {
2217
- (0, import_log8.log)("empty response from identity service", {
1573
+ (0, import_log6.log)("empty response from identity service", {
2218
1574
  idqr
2219
1575
  }, {
2220
- F: __dxlog_file8,
1576
+ F: __dxlog_file6,
2221
1577
  L: 21,
2222
1578
  S: void 0,
2223
1579
  C: (f, a) => f(...a)
@@ -2228,18 +1584,18 @@ var setIdentityTags = ({ identityService, devicesService, setTag }) => {
2228
1584
  });
2229
1585
  devicesService.queryDevices().subscribe((dqr) => {
2230
1586
  if (!dqr || !dqr.devices || dqr.devices.length === 0) {
2231
- (0, import_log8.log)("empty response from device service", {
1587
+ (0, import_log6.log)("empty response from device service", {
2232
1588
  device: dqr
2233
1589
  }, {
2234
- F: __dxlog_file8,
1590
+ F: __dxlog_file6,
2235
1591
  L: 30,
2236
1592
  S: void 0,
2237
1593
  C: (f, a) => f(...a)
2238
1594
  });
2239
1595
  return;
2240
1596
  }
2241
- (0, import_invariant7.invariant)(dqr, "empty response from device service", {
2242
- F: __dxlog_file8,
1597
+ (0, import_invariant5.invariant)(dqr, "empty response from device service", {
1598
+ F: __dxlog_file6,
2243
1599
  L: 33,
2244
1600
  S: void 0,
2245
1601
  A: [
@@ -2249,10 +1605,10 @@ var setIdentityTags = ({ identityService, devicesService, setTag }) => {
2249
1605
  });
2250
1606
  const thisDevice = dqr.devices.find((device) => device.kind === import_services.DeviceKind.CURRENT);
2251
1607
  if (!thisDevice) {
2252
- (0, import_log8.log)("no current device", {
1608
+ (0, import_log6.log)("no current device", {
2253
1609
  device: dqr
2254
1610
  }, {
2255
- F: __dxlog_file8,
1611
+ F: __dxlog_file6,
2256
1612
  L: 37,
2257
1613
  S: void 0,
2258
1614
  C: (f, a) => f(...a)