@dxos/teleport 0.3.7 → 0.3.8-main.598e316

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.
@@ -42,25 +42,165 @@ module.exports = __toCommonJS(testing_exports);
42
42
  var import_node_stream3 = require("node:stream");
43
43
  var import_invariant5 = require("@dxos/invariant");
44
44
  var import_keys2 = require("@dxos/keys");
45
- var import_log5 = require("@dxos/log");
45
+ var import_log6 = require("@dxos/log");
46
46
 
47
47
  // packages/core/mesh/teleport/src/teleport.ts
48
- var import_async4 = require("@dxos/async");
49
- var import_context2 = require("@dxos/context");
48
+ var import_async5 = require("@dxos/async");
49
+ var import_context3 = require("@dxos/context");
50
50
  var import_debug2 = require("@dxos/debug");
51
51
  var import_invariant4 = require("@dxos/invariant");
52
52
  var import_keys = require("@dxos/keys");
53
- var import_log4 = require("@dxos/log");
54
- var import_protocols2 = require("@dxos/protocols");
53
+ var import_log5 = require("@dxos/log");
54
+ var import_protocols3 = require("@dxos/protocols");
55
+
56
+ // packages/core/mesh/teleport/src/control-extension.ts
57
+ var import_async = require("@dxos/async");
58
+ var import_context = require("@dxos/context");
59
+ var import_log = require("@dxos/log");
60
+ var import_protocols = require("@dxos/protocols");
55
61
  var import_rpc = require("@dxos/rpc");
56
62
  var import_util = require("@dxos/util");
63
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/control-extension.ts";
64
+ var HEARTBEAT_RTT_WARN_THRESH = 1e4;
65
+ var ControlExtension = class {
66
+ constructor(opts, localPeerId, remotePeerId) {
67
+ this.opts = opts;
68
+ this.localPeerId = localPeerId;
69
+ this.remotePeerId = remotePeerId;
70
+ this._ctx = new import_context.Context({
71
+ onError: (err) => {
72
+ this._extensionContext.close(err);
73
+ }
74
+ });
75
+ this.onExtensionRegistered = new import_util.Callback();
76
+ }
77
+ async registerExtension(name) {
78
+ await this._rpc.rpc.Control.registerExtension({
79
+ name
80
+ });
81
+ }
82
+ async onOpen(extensionContext) {
83
+ this._extensionContext = extensionContext;
84
+ this._rpc = (0, import_rpc.createProtoRpcPeer)({
85
+ requested: {
86
+ Control: import_protocols.schema.getService("dxos.mesh.teleport.control.ControlService")
87
+ },
88
+ exposed: {
89
+ Control: import_protocols.schema.getService("dxos.mesh.teleport.control.ControlService")
90
+ },
91
+ handlers: {
92
+ Control: {
93
+ registerExtension: async (request) => {
94
+ this.onExtensionRegistered.call(request.name);
95
+ },
96
+ heartbeat: async (request) => {
97
+ (0, import_log.log)("received heartbeat request", {
98
+ ts: request.requestTimestamp,
99
+ localPeerId: this.localPeerId.truncate(),
100
+ remotePeerId: this.remotePeerId.truncate()
101
+ }, {
102
+ F: __dxlog_file,
103
+ L: 66,
104
+ S: this,
105
+ C: (f, a) => f(...a)
106
+ });
107
+ return {
108
+ requestTimestamp: request.requestTimestamp
109
+ };
110
+ }
111
+ }
112
+ },
113
+ port: await extensionContext.createPort("rpc", {
114
+ contentType: 'application/x-protobuf; messageType="dxos.rpc.Message"'
115
+ }),
116
+ timeout: this.opts.heartbeatTimeout
117
+ });
118
+ await this._rpc.open();
119
+ (0, import_async.scheduleTaskInterval)(this._ctx, async () => {
120
+ const reqTS = /* @__PURE__ */ new Date();
121
+ try {
122
+ const resp = await (0, import_async.asyncTimeout)(this._rpc.rpc.Control.heartbeat({
123
+ requestTimestamp: reqTS
124
+ }), this.opts.heartbeatTimeout);
125
+ const now = Date.now();
126
+ if (resp.requestTimestamp instanceof Date) {
127
+ if (now - resp.requestTimestamp.getTime() > (HEARTBEAT_RTT_WARN_THRESH < this.opts.heartbeatTimeout ? HEARTBEAT_RTT_WARN_THRESH : this.opts.heartbeatTimeout / 2)) {
128
+ import_log.log.warn(`heartbeat RTT for Teleport > ${HEARTBEAT_RTT_WARN_THRESH / 1e3}s`, {
129
+ rtt: now - resp.requestTimestamp.getTime(),
130
+ localPeerId: this.localPeerId.truncate(),
131
+ remotePeerId: this.remotePeerId.truncate()
132
+ }, {
133
+ F: __dxlog_file,
134
+ L: 103,
135
+ S: this,
136
+ C: (f, a) => f(...a)
137
+ });
138
+ } else {
139
+ (0, import_log.log)("heartbeat RTT", {
140
+ rtt: now - resp.requestTimestamp.getTime(),
141
+ localPeerId: this.localPeerId.truncate(),
142
+ remotePeerId: this.remotePeerId.truncate()
143
+ }, {
144
+ F: __dxlog_file,
145
+ L: 109,
146
+ S: this,
147
+ C: (f, a) => f(...a)
148
+ });
149
+ }
150
+ }
151
+ } catch (err) {
152
+ const now = Date.now();
153
+ if (err instanceof import_protocols.RpcClosedError) {
154
+ (0, import_log.log)("ignoring RpcClosedError in heartbeat", void 0, {
155
+ F: __dxlog_file,
156
+ L: 119,
157
+ S: this,
158
+ C: (f, a) => f(...a)
159
+ });
160
+ return;
161
+ }
162
+ if (err instanceof import_async.TimeoutError) {
163
+ (0, import_log.log)("timeout waiting for heartbeat response", {
164
+ err,
165
+ delay: now - reqTS.getTime()
166
+ }, {
167
+ F: __dxlog_file,
168
+ L: 123,
169
+ S: this,
170
+ C: (f, a) => f(...a)
171
+ });
172
+ this.opts.onTimeout(err);
173
+ } else {
174
+ import_log.log.info("other error waiting for heartbeat response", {
175
+ err,
176
+ delay: now - reqTS.getTime()
177
+ }, {
178
+ F: __dxlog_file,
179
+ L: 126,
180
+ S: this,
181
+ C: (f, a) => f(...a)
182
+ });
183
+ this.opts.onTimeout(err);
184
+ }
185
+ }
186
+ }, this.opts.heartbeatInterval);
187
+ }
188
+ async onClose(err) {
189
+ await this._ctx.dispose();
190
+ await this._rpc.close();
191
+ }
192
+ async onAbort(err) {
193
+ await this._ctx.dispose();
194
+ await this._rpc.abort();
195
+ }
196
+ };
57
197
 
58
198
  // packages/core/mesh/teleport/src/muxing/framer.ts
59
199
  var import_node_stream = require("node:stream");
60
- var import_async = require("@dxos/async");
200
+ var import_async2 = require("@dxos/async");
61
201
  var import_invariant = require("@dxos/invariant");
62
- var import_log = require("@dxos/log");
63
- var __dxlog_file = "/mnt/ramdisk/work/packages/core/mesh/teleport/src/muxing/framer.ts";
202
+ var import_log2 = require("@dxos/log");
203
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/muxing/framer.ts";
64
204
  var FRAME_LENGTH_SIZE = 2;
65
205
  var Framer = class {
66
206
  constructor() {
@@ -72,7 +212,7 @@ var Framer = class {
72
212
  this._bytesSent = 0;
73
213
  this._bytesReceived = 0;
74
214
  this._writable = true;
75
- this.drain = new import_async.Event();
215
+ this.drain = new import_async2.Event();
76
216
  // TODO(egorgripasov): Consider using a Transform stream if it provides better backpressure handling.
77
217
  this._stream = new import_node_stream.Duplex({
78
218
  objectMode: false,
@@ -81,7 +221,7 @@ var Framer = class {
81
221
  },
82
222
  write: (chunk, encoding, callback) => {
83
223
  (0, import_invariant.invariant)(!this._subscribeCb, "Internal Framer bug. Concurrent writes detected.", {
84
- F: __dxlog_file,
224
+ F: __dxlog_file2,
85
225
  L: 40,
86
226
  S: this,
87
227
  A: [
@@ -125,7 +265,7 @@ var Framer = class {
125
265
  },
126
266
  subscribe: (callback) => {
127
267
  (0, import_invariant.invariant)(!this._messageCb, "Rpc port already has a message listener.", {
128
- F: __dxlog_file,
268
+ F: __dxlog_file2,
129
269
  L: 79,
130
270
  S: this,
131
271
  A: [
@@ -181,16 +321,16 @@ var Framer = class {
181
321
  }
182
322
  destroy() {
183
323
  if (this._stream.readableLength > 0) {
184
- import_log.log.warn("framer destroyed while there are still read bytes in the buffer.", void 0, {
185
- F: __dxlog_file,
324
+ import_log2.log.info("framer destroyed while there are still read bytes in the buffer.", void 0, {
325
+ F: __dxlog_file2,
186
326
  L: 140,
187
327
  S: this,
188
328
  C: (f, a) => f(...a)
189
329
  });
190
330
  }
191
331
  if (this._stream.writableLength > 0) {
192
- import_log.log.warn("framer destroyed while there are still write bytes in the buffer.", void 0, {
193
- F: __dxlog_file,
332
+ import_log2.log.warn("framer destroyed while there are still write bytes in the buffer.", void 0, {
333
+ F: __dxlog_file2,
194
334
  L: 143,
195
335
  S: this,
196
336
  C: (f, a) => f(...a)
@@ -223,19 +363,19 @@ var encodeFrame = (payload) => {
223
363
 
224
364
  // packages/core/mesh/teleport/src/muxing/muxer.ts
225
365
  var import_node_stream2 = require("node:stream");
226
- var import_async3 = require("@dxos/async");
227
- var import_context = require("@dxos/context");
366
+ var import_async4 = require("@dxos/async");
367
+ var import_context2 = require("@dxos/context");
228
368
  var import_debug = require("@dxos/debug");
229
369
  var import_invariant3 = require("@dxos/invariant");
230
- var import_log3 = require("@dxos/log");
231
- var import_protocols = require("@dxos/protocols");
370
+ var import_log4 = require("@dxos/log");
371
+ var import_protocols2 = require("@dxos/protocols");
232
372
 
233
373
  // packages/core/mesh/teleport/src/muxing/balancer.ts
234
374
  var varint = __toESM(require("varint"));
235
- var import_async2 = require("@dxos/async");
375
+ var import_async3 = require("@dxos/async");
236
376
  var import_invariant2 = require("@dxos/invariant");
237
- var import_log2 = require("@dxos/log");
238
- var __dxlog_file2 = "/mnt/ramdisk/work/packages/core/mesh/teleport/src/muxing/balancer.ts";
377
+ var import_log3 = require("@dxos/log");
378
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/muxing/balancer.ts";
239
379
  var MAX_CHUNK_SIZE = 8192;
240
380
  var Balancer = class {
241
381
  constructor(_sysChannelId) {
@@ -246,7 +386,7 @@ var Balancer = class {
246
386
  this._sendBuffers = /* @__PURE__ */ new Map();
247
387
  this._receiveBuffers = /* @__PURE__ */ new Map();
248
388
  this._sending = false;
249
- this.incomingData = new import_async2.Event();
389
+ this.incomingData = new import_async3.Event();
250
390
  this.stream = this._framer.stream;
251
391
  this._channels.push(_sysChannelId);
252
392
  this._framer.port.subscribe(this._processIncomingMessage.bind(this));
@@ -265,8 +405,8 @@ var Balancer = class {
265
405
  }
266
406
  pushData(data, trigger, channelId) {
267
407
  this._enqueueChunk(data, trigger, channelId);
268
- this._sendChunks().catch((err) => import_log2.log.catch(err, void 0, {
269
- F: __dxlog_file2,
408
+ this._sendChunks().catch((err) => import_log3.log.catch(err, void 0, {
409
+ F: __dxlog_file3,
270
410
  L: 75,
271
411
  S: this,
272
412
  C: (f, a) => f(...a)
@@ -274,8 +414,8 @@ var Balancer = class {
274
414
  }
275
415
  destroy() {
276
416
  if (this._sendBuffers.size !== 0) {
277
- import_log2.log.warn("destroying balancer with pending calls", void 0, {
278
- F: __dxlog_file2,
417
+ import_log3.log.info("destroying balancer with pending calls", void 0, {
418
+ F: __dxlog_file3,
279
419
  L: 80,
280
420
  S: this,
281
421
  C: (f, a) => f(...a)
@@ -370,15 +510,15 @@ var Balancer = class {
370
510
  chunk = this._getNextChunk();
371
511
  while (chunk) {
372
512
  if (!this._framer.writable) {
373
- (0, import_log2.log)("PAUSE for drain", void 0, {
374
- F: __dxlog_file2,
513
+ (0, import_log3.log)("PAUSE for drain", void 0, {
514
+ F: __dxlog_file3,
375
515
  L: 179,
376
516
  S: this,
377
517
  C: (f, a) => f(...a)
378
518
  });
379
519
  await this._framer.drain.waitForCount(1);
380
- (0, import_log2.log)("RESUME for drain", void 0, {
381
- F: __dxlog_file2,
520
+ (0, import_log3.log)("RESUME for drain", void 0, {
521
+ F: __dxlog_file3,
382
522
  L: 181,
383
523
  S: this,
384
524
  C: (f, a) => f(...a)
@@ -388,10 +528,10 @@ var Balancer = class {
388
528
  await this._framer.port.send(chunk.msg);
389
529
  chunk.trigger?.wake();
390
530
  } catch (err) {
391
- (0, import_log2.log)("Error sending chunk", {
531
+ (0, import_log3.log)("Error sending chunk", {
392
532
  err
393
533
  }, {
394
- F: __dxlog_file2,
534
+ F: __dxlog_file3,
395
535
  L: 187,
396
536
  S: this,
397
537
  C: (f, a) => f(...a)
@@ -401,7 +541,7 @@ var Balancer = class {
401
541
  chunk = this._getNextChunk();
402
542
  }
403
543
  (0, import_invariant2.invariant)(this._sendBuffers.size === 0, "sendBuffers not empty", {
404
- F: __dxlog_file2,
544
+ F: __dxlog_file3,
405
545
  L: 192,
406
546
  S: this,
407
547
  A: [
@@ -440,8 +580,8 @@ var decodeChunk = (data, withLength) => {
440
580
  };
441
581
 
442
582
  // packages/core/mesh/teleport/src/muxing/muxer.ts
443
- var __dxlog_file3 = "/mnt/ramdisk/work/packages/core/mesh/teleport/src/muxing/muxer.ts";
444
- var Command = import_protocols.schema.getCodecForType("dxos.mesh.muxer.Command");
583
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/muxing/muxer.ts";
584
+ var Command = import_protocols2.schema.getCodecForType("dxos.mesh.muxer.Command");
445
585
  var DEFAULT_SEND_COMMAND_TIMEOUT = 6e4;
446
586
  var DESTROY_COMMAND_SEND_TIMEOUT = 5e3;
447
587
  var STATS_INTERVAL = 1e3;
@@ -453,15 +593,15 @@ var Muxer = class {
453
593
  this._balancer = new Balancer(SYSTEM_CHANNEL_ID);
454
594
  this._channelsByLocalId = /* @__PURE__ */ new Map();
455
595
  this._channelsByTag = /* @__PURE__ */ new Map();
456
- this._ctx = new import_context.Context();
596
+ this._ctx = new import_context2.Context();
457
597
  this._nextId = 1;
458
598
  this._closing = false;
459
599
  this._destroying = false;
460
600
  this._disposed = false;
461
601
  this._lastStats = void 0;
462
602
  this._lastChannelStats = /* @__PURE__ */ new Map();
463
- this.afterClosed = new import_async3.Event();
464
- this.statsUpdated = new import_async3.Event();
603
+ this.afterClosed = new import_async4.Event();
604
+ this.statsUpdated = new import_async4.Event();
465
605
  this.stream = this._balancer.stream;
466
606
  this._balancer.incomingData.on(async (msg) => {
467
607
  await this._handleCommand(Command.decode(msg));
@@ -479,7 +619,7 @@ var Muxer = class {
479
619
  contentType: opts.contentType
480
620
  });
481
621
  (0, import_invariant3.invariant)(!channel.push, `Channel already open: ${tag}`, {
482
- F: __dxlog_file3,
622
+ F: __dxlog_file4,
483
623
  L: 140,
484
624
  S: this,
485
625
  A: [
@@ -527,7 +667,7 @@ var Muxer = class {
527
667
  contentType: opts.contentType
528
668
  });
529
669
  (0, import_invariant3.invariant)(!channel.push, `Channel already open: ${tag}`, {
530
- F: __dxlog_file3,
670
+ F: __dxlog_file4,
531
671
  L: 192,
532
672
  S: this,
533
673
  A: [
@@ -551,7 +691,7 @@ var Muxer = class {
551
691
  },
552
692
  subscribe: (cb) => {
553
693
  (0, import_invariant3.invariant)(!callback, "Only one subscriber is allowed", {
554
- F: __dxlog_file3,
694
+ F: __dxlog_file4,
555
695
  L: 214,
556
696
  S: this,
557
697
  A: [
@@ -583,8 +723,8 @@ var Muxer = class {
583
723
  // initiate graceful close
584
724
  async close(err) {
585
725
  if (this._destroying) {
586
- (0, import_log3.log)("already destroying, ignoring graceful close request", void 0, {
587
- F: __dxlog_file3,
726
+ (0, import_log4.log)("already destroying, ignoring graceful close request", void 0, {
727
+ F: __dxlog_file4,
588
728
  L: 247,
589
729
  S: this,
590
730
  C: (f, a) => f(...a)
@@ -592,8 +732,8 @@ var Muxer = class {
592
732
  return;
593
733
  }
594
734
  if (this._closing) {
595
- (0, import_log3.log)("already closing, ignoring graceful close request", void 0, {
596
- F: __dxlog_file3,
735
+ (0, import_log4.log)("already closing, ignoring graceful close request", void 0, {
736
+ F: __dxlog_file4,
597
737
  L: 251,
598
738
  S: this,
599
739
  C: (f, a) => f(...a)
@@ -606,10 +746,10 @@ var Muxer = class {
606
746
  error: err?.message
607
747
  }
608
748
  }, SYSTEM_CHANNEL_ID, DESTROY_COMMAND_SEND_TIMEOUT).catch(async (err2) => {
609
- (0, import_log3.log)("error sending close command", {
749
+ (0, import_log4.log)("error sending close command", {
610
750
  err: err2
611
751
  }, {
612
- F: __dxlog_file3,
752
+ F: __dxlog_file4,
613
753
  L: 266,
614
754
  S: this,
615
755
  C: (f, a) => f(...a)
@@ -619,7 +759,7 @@ var Muxer = class {
619
759
  await Promise.race([
620
760
  new Promise((_resolve, reject) => {
621
761
  setTimeout(() => {
622
- reject(new import_protocols.TimeoutError("gracefully closing muxer"));
762
+ reject(new import_protocols2.TimeoutError("gracefully closing muxer"));
623
763
  }, GRACEFUL_CLOSE_TIMEOUT);
624
764
  }),
625
765
  (async () => {
@@ -630,8 +770,8 @@ var Muxer = class {
630
770
  // force close without confirmation
631
771
  async destroy(err) {
632
772
  if (this._destroying) {
633
- (0, import_log3.log)("already destroying, ignoring destroy request", void 0, {
634
- F: __dxlog_file3,
773
+ (0, import_log4.log)("already destroying, ignoring destroy request", void 0, {
774
+ F: __dxlog_file4,
635
775
  L: 287,
636
776
  S: this,
637
777
  C: (f, a) => f(...a)
@@ -641,8 +781,8 @@ var Muxer = class {
641
781
  this._destroying = true;
642
782
  void this._ctx.dispose();
643
783
  if (this._closing) {
644
- (0, import_log3.log)("destroy cancelling graceful close", void 0, {
645
- F: __dxlog_file3,
784
+ (0, import_log4.log)("destroy cancelling graceful close", void 0, {
785
+ F: __dxlog_file4,
646
786
  L: 293,
647
787
  S: this,
648
788
  C: (f, a) => f(...a)
@@ -654,10 +794,10 @@ var Muxer = class {
654
794
  error: err?.message
655
795
  }
656
796
  }, SYSTEM_CHANNEL_ID).catch(async (err2) => {
657
- (0, import_log3.log)("error sending courtesy close command", {
797
+ (0, import_log4.log)("error sending courtesy close command", {
658
798
  err: err2
659
799
  }, {
660
- F: __dxlog_file3,
800
+ F: __dxlog_file4,
661
801
  L: 306,
662
802
  S: this,
663
803
  C: (f, a) => f(...a)
@@ -665,10 +805,10 @@ var Muxer = class {
665
805
  });
666
806
  }
667
807
  this.dispose(err).catch((err2) => {
668
- (0, import_log3.log)("error disposing after destroy", {
808
+ (0, import_log4.log)("error disposing after destroy", {
669
809
  err: err2
670
810
  }, {
671
- F: __dxlog_file3,
811
+ F: __dxlog_file4,
672
812
  L: 311,
673
813
  S: this,
674
814
  C: (f, a) => f(...a)
@@ -678,8 +818,8 @@ var Muxer = class {
678
818
  // complete the termination, graceful or otherwise
679
819
  async dispose(err) {
680
820
  if (this._disposed) {
681
- (0, import_log3.log)("already destroyed, ignoring dispose request", void 0, {
682
- F: __dxlog_file3,
821
+ (0, import_log4.log)("already destroyed, ignoring dispose request", void 0, {
822
+ F: __dxlog_file4,
683
823
  L: 319,
684
824
  S: this,
685
825
  C: (f, a) => f(...a)
@@ -698,10 +838,10 @@ var Muxer = class {
698
838
  }
699
839
  async _handleCommand(cmd) {
700
840
  if (this._disposed) {
701
- import_log3.log.warn("Received command after destroy", {
841
+ import_log4.log.warn("Received command after disposed", {
702
842
  cmd
703
843
  }, {
704
- F: __dxlog_file3,
844
+ F: __dxlog_file4,
705
845
  L: 341,
706
846
  S: this,
707
847
  C: (f, a) => f(...a)
@@ -710,16 +850,16 @@ var Muxer = class {
710
850
  }
711
851
  if (cmd.close) {
712
852
  if (!this._closing) {
713
- (0, import_log3.log)("received peer close, initiating my own graceful close", void 0, {
714
- F: __dxlog_file3,
853
+ (0, import_log4.log)("received peer close, initiating my own graceful close", void 0, {
854
+ F: __dxlog_file4,
715
855
  L: 347,
716
856
  S: this,
717
857
  C: (f, a) => f(...a)
718
858
  });
719
859
  await this.close();
720
860
  } else {
721
- (0, import_log3.log)("received close from peer, already closing", void 0, {
722
- F: __dxlog_file3,
861
+ (0, import_log4.log)("received close from peer, already closing", void 0, {
862
+ F: __dxlog_file4,
723
863
  L: 350,
724
864
  S: this,
725
865
  C: (f, a) => f(...a)
@@ -745,10 +885,10 @@ var Muxer = class {
745
885
  } else if (cmd.data) {
746
886
  const stream = this._channelsByLocalId.get(cmd.data.channelId) ?? (0, import_debug.failUndefined)();
747
887
  if (!stream.push) {
748
- import_log3.log.warn("Received data for channel before it was opened", {
888
+ import_log4.log.warn("Received data for channel before it was opened", {
749
889
  tag: stream.tag
750
890
  }, {
751
- F: __dxlog_file3,
891
+ F: __dxlog_file4,
752
892
  L: 379,
753
893
  S: this,
754
894
  C: (f, a) => f(...a)
@@ -759,8 +899,19 @@ var Muxer = class {
759
899
  }
760
900
  }
761
901
  async _sendCommand(cmd, channelId = -1, timeout = DEFAULT_SEND_COMMAND_TIMEOUT) {
902
+ if (this._disposed) {
903
+ import_log4.log.info("ignoring sendCommand after disposed", {
904
+ cmd
905
+ }, {
906
+ F: __dxlog_file4,
907
+ L: 388,
908
+ S: this,
909
+ C: (f, a) => f(...a)
910
+ });
911
+ return;
912
+ }
762
913
  try {
763
- const trigger = new import_async3.Trigger();
914
+ const trigger = new import_async4.Trigger();
764
915
  this._balancer.pushData(Command.encode(cmd), trigger, channelId);
765
916
  await trigger.wait({
766
917
  timeout
@@ -771,7 +922,7 @@ var Muxer = class {
771
922
  }
772
923
  _getOrCreateStream(params) {
773
924
  if (this._channelsByTag.size === 0) {
774
- (0, import_async3.scheduleTaskInterval)(this._ctx, async () => this._emitStats(), STATS_INTERVAL);
925
+ (0, import_async4.scheduleTaskInterval)(this._ctx, async () => this._emitStats(), STATS_INTERVAL);
775
926
  }
776
927
  let channel = this._channelsByTag.get(params.tag);
777
928
  if (!channel) {
@@ -796,12 +947,12 @@ var Muxer = class {
796
947
  }
797
948
  async _sendData(channel, data, timeout) {
798
949
  if (data.length > MAX_SAFE_FRAME_SIZE) {
799
- import_log3.log.warn("frame size exceeds maximum safe value", {
950
+ import_log4.log.warn("frame size exceeds maximum safe value", {
800
951
  size: data.length,
801
952
  threshold: MAX_SAFE_FRAME_SIZE
802
953
  }, {
803
- F: __dxlog_file3,
804
- L: 425,
954
+ F: __dxlog_file4,
955
+ L: 429,
805
956
  S: this,
806
957
  C: (f, a) => f(...a)
807
958
  });
@@ -878,17 +1029,17 @@ function _ts_decorate(decorators, target, key, desc) {
878
1029
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
879
1030
  return c > 3 && r && Object.defineProperty(target, key, r), r;
880
1031
  }
881
- var __dxlog_file4 = "/mnt/ramdisk/work/packages/core/mesh/teleport/src/teleport.ts";
1032
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/teleport.ts";
882
1033
  var CONTROL_HEARTBEAT_INTERVAL = 1e4;
883
1034
  var CONTROL_HEARTBEAT_TIMEOUT = 6e4;
884
1035
  var Teleport = class {
885
1036
  constructor({ initiator, localPeerId, remotePeerId }) {
886
- this._ctx = new import_context2.Context({
1037
+ this._ctx = new import_context3.Context({
887
1038
  onError: (err) => {
888
1039
  void this.destroy(err).catch(() => {
889
- import_log4.log.error("Error during destroy", err, {
890
- F: __dxlog_file4,
891
- L: 47,
1040
+ import_log5.log.error("Error during destroy", err, {
1041
+ F: __dxlog_file5,
1042
+ L: 38,
892
1043
  S: this,
893
1044
  C: (f, a) => f(...a)
894
1045
  });
@@ -896,35 +1047,14 @@ var Teleport = class {
896
1047
  }
897
1048
  });
898
1049
  this._muxer = new Muxer();
899
- this._control = new ControlExtension({
900
- heartbeatInterval: CONTROL_HEARTBEAT_INTERVAL,
901
- heartbeatTimeout: CONTROL_HEARTBEAT_TIMEOUT,
902
- onTimeout: () => {
903
- if (this._destroying || this._aborting) {
904
- return;
905
- }
906
- (0, import_log4.log)("abort teleport due to onTimeout in ControlExtension", void 0, {
907
- F: __dxlog_file4,
908
- L: 62,
909
- S: this,
910
- C: (f, a) => f(...a)
911
- });
912
- this.abort(new import_protocols2.TimeoutError("control extension")).catch((err) => import_log4.log.catch(err, void 0, {
913
- F: __dxlog_file4,
914
- L: 63,
915
- S: this,
916
- C: (f, a) => f(...a)
917
- }));
918
- }
919
- });
920
1050
  this._extensions = /* @__PURE__ */ new Map();
921
1051
  this._remoteExtensions = /* @__PURE__ */ new Set();
922
1052
  this._open = false;
923
1053
  this._destroying = false;
924
1054
  this._aborting = false;
925
1055
  (0, import_invariant4.invariant)(typeof initiator === "boolean", void 0, {
926
- F: __dxlog_file4,
927
- L: 75,
1056
+ F: __dxlog_file5,
1057
+ L: 55,
928
1058
  S: this,
929
1059
  A: [
930
1060
  "typeof initiator === 'boolean'",
@@ -932,8 +1062,8 @@ var Teleport = class {
932
1062
  ]
933
1063
  });
934
1064
  (0, import_invariant4.invariant)(import_keys.PublicKey.isPublicKey(localPeerId), void 0, {
935
- F: __dxlog_file4,
936
- L: 76,
1065
+ F: __dxlog_file5,
1066
+ L: 56,
937
1067
  S: this,
938
1068
  A: [
939
1069
  "PublicKey.isPublicKey(localPeerId)",
@@ -941,8 +1071,8 @@ var Teleport = class {
941
1071
  ]
942
1072
  });
943
1073
  (0, import_invariant4.invariant)(import_keys.PublicKey.isPublicKey(remotePeerId), void 0, {
944
- F: __dxlog_file4,
945
- L: 77,
1074
+ F: __dxlog_file5,
1075
+ L: 57,
946
1076
  S: this,
947
1077
  A: [
948
1078
  "PublicKey.isPublicKey(remotePeerId)",
@@ -952,18 +1082,39 @@ var Teleport = class {
952
1082
  this.initiator = initiator;
953
1083
  this.localPeerId = localPeerId;
954
1084
  this.remotePeerId = remotePeerId;
1085
+ this._control = new ControlExtension({
1086
+ heartbeatInterval: CONTROL_HEARTBEAT_INTERVAL,
1087
+ heartbeatTimeout: CONTROL_HEARTBEAT_TIMEOUT,
1088
+ onTimeout: () => {
1089
+ if (this._destroying || this._aborting) {
1090
+ return;
1091
+ }
1092
+ import_log5.log.info("abort teleport due to onTimeout in ControlExtension", void 0, {
1093
+ F: __dxlog_file5,
1094
+ L: 70,
1095
+ S: this,
1096
+ C: (f, a) => f(...a)
1097
+ });
1098
+ this.abort(new import_protocols3.TimeoutError("control extension")).catch((err) => import_log5.log.catch(err, void 0, {
1099
+ F: __dxlog_file5,
1100
+ L: 71,
1101
+ S: this,
1102
+ C: (f, a) => f(...a)
1103
+ }));
1104
+ }
1105
+ }, this.localPeerId, this.remotePeerId);
955
1106
  this._control.onExtensionRegistered.set(async (name) => {
956
- (0, import_log4.log)("remote extension", {
1107
+ (0, import_log5.log)("remote extension", {
957
1108
  name
958
1109
  }, {
959
- F: __dxlog_file4,
960
- L: 83,
1110
+ F: __dxlog_file5,
1111
+ L: 79,
961
1112
  S: this,
962
1113
  C: (f, a) => f(...a)
963
1114
  });
964
1115
  (0, import_invariant4.invariant)(!this._remoteExtensions.has(name), "Remote extension already exists", {
965
- F: __dxlog_file4,
966
- L: 84,
1116
+ F: __dxlog_file5,
1117
+ L: 80,
967
1118
  S: this,
968
1119
  A: [
969
1120
  "!this._remoteExtensions.has(name)",
@@ -982,9 +1133,9 @@ var Teleport = class {
982
1133
  {
983
1134
  this._muxer.stream.on("close", async () => {
984
1135
  if (this._destroying || this._aborting) {
985
- (0, import_log4.log)("destroy teleport due to muxer stream close, skipping due to already destroying/aborting", void 0, {
986
- F: __dxlog_file4,
987
- L: 100,
1136
+ (0, import_log5.log)("destroy teleport due to muxer stream close, skipping due to already destroying/aborting", void 0, {
1137
+ F: __dxlog_file5,
1138
+ L: 96,
988
1139
  S: this,
989
1140
  C: (f, a) => f(...a)
990
1141
  });
@@ -997,7 +1148,7 @@ var Teleport = class {
997
1148
  });
998
1149
  }
999
1150
  this._muxer.statsUpdated.on((stats) => {
1000
- import_log4.log.trace("dxos.mesh.teleport.stats", {
1151
+ import_log5.log.trace("dxos.mesh.teleport.stats", {
1001
1152
  localPeerId,
1002
1153
  remotePeerId,
1003
1154
  bytesSent: stats.bytesSent,
@@ -1006,8 +1157,8 @@ var Teleport = class {
1006
1157
  bytesReceivedRate: stats.bytesReceivedRate,
1007
1158
  channels: stats.channels
1008
1159
  }, {
1009
- F: __dxlog_file4,
1010
- L: 113,
1160
+ F: __dxlog_file5,
1161
+ L: 109,
1011
1162
  S: this,
1012
1163
  C: (f, a) => f(...a)
1013
1164
  });
@@ -1043,9 +1194,9 @@ var Teleport = class {
1043
1194
  try {
1044
1195
  await extension.onAbort(err);
1045
1196
  } catch (err2) {
1046
- import_log4.log.catch(err2, void 0, {
1047
- F: __dxlog_file4,
1048
- L: 166,
1197
+ import_log5.log.catch(err2, void 0, {
1198
+ F: __dxlog_file5,
1199
+ L: 162,
1049
1200
  S: this,
1050
1201
  C: (f, a) => f(...a)
1051
1202
  });
@@ -1066,9 +1217,9 @@ var Teleport = class {
1066
1217
  try {
1067
1218
  await extension.onClose(err);
1068
1219
  } catch (err2) {
1069
- import_log4.log.catch(err2, void 0, {
1070
- F: __dxlog_file4,
1071
- L: 190,
1220
+ import_log5.log.catch(err2, void 0, {
1221
+ F: __dxlog_file5,
1222
+ L: 186,
1072
1223
  S: this,
1073
1224
  C: (f, a) => f(...a)
1074
1225
  });
@@ -1080,35 +1231,35 @@ var Teleport = class {
1080
1231
  if (!this._open) {
1081
1232
  throw new Error("Not open");
1082
1233
  }
1083
- (0, import_log4.log)("addExtension", {
1234
+ (0, import_log5.log)("addExtension", {
1084
1235
  name
1085
1236
  }, {
1086
- F: __dxlog_file4,
1087
- L: 202,
1237
+ F: __dxlog_file5,
1238
+ L: 198,
1088
1239
  S: this,
1089
1240
  C: (f, a) => f(...a)
1090
1241
  });
1091
1242
  this._setExtension(name, extension);
1092
- (0, import_async4.scheduleTask)(this._ctx, async () => {
1243
+ (0, import_async5.scheduleTask)(this._ctx, async () => {
1093
1244
  try {
1094
1245
  await this._control.registerExtension(name);
1095
1246
  } catch (err) {
1096
- if (err instanceof import_protocols2.RpcClosedError) {
1247
+ if (err instanceof import_protocols3.RpcClosedError) {
1097
1248
  return;
1098
1249
  }
1099
1250
  throw err;
1100
1251
  }
1101
1252
  });
1102
1253
  if (this._remoteExtensions.has(name)) {
1103
- (0, import_async4.scheduleTask)(this._ctx, async () => {
1254
+ (0, import_async5.scheduleTask)(this._ctx, async () => {
1104
1255
  await this._openExtension(name);
1105
1256
  });
1106
1257
  }
1107
1258
  }
1108
1259
  _setExtension(extensionName, extension) {
1109
1260
  (0, import_invariant4.invariant)(!extensionName.includes("/"), "Invalid extension name", {
1110
- F: __dxlog_file4,
1111
- L: 226,
1261
+ F: __dxlog_file5,
1262
+ L: 222,
1112
1263
  S: this,
1113
1264
  A: [
1114
1265
  "!extensionName.includes('/')",
@@ -1116,8 +1267,8 @@ var Teleport = class {
1116
1267
  ]
1117
1268
  });
1118
1269
  (0, import_invariant4.invariant)(!this._extensions.has(extensionName), "Extension already exists", {
1119
- F: __dxlog_file4,
1120
- L: 227,
1270
+ F: __dxlog_file5,
1271
+ L: 223,
1121
1272
  S: this,
1122
1273
  A: [
1123
1274
  "!this._extensions.has(extensionName)",
@@ -1127,11 +1278,11 @@ var Teleport = class {
1127
1278
  this._extensions.set(extensionName, extension);
1128
1279
  }
1129
1280
  async _openExtension(extensionName) {
1130
- (0, import_log4.log)("open extension", {
1281
+ (0, import_log5.log)("open extension", {
1131
1282
  extensionName
1132
1283
  }, {
1133
- F: __dxlog_file4,
1134
- L: 232,
1284
+ F: __dxlog_file5,
1285
+ L: 228,
1135
1286
  S: this,
1136
1287
  C: (f, a) => f(...a)
1137
1288
  });
@@ -1142,8 +1293,8 @@ var Teleport = class {
1142
1293
  remotePeerId: this.remotePeerId,
1143
1294
  createPort: async (channelName, opts) => {
1144
1295
  (0, import_invariant4.invariant)(!channelName.includes("/"), "Invalid channel name", {
1145
- F: __dxlog_file4,
1146
- L: 240,
1296
+ F: __dxlog_file5,
1297
+ L: 236,
1147
1298
  S: this,
1148
1299
  A: [
1149
1300
  "!channelName.includes('/')",
@@ -1154,8 +1305,8 @@ var Teleport = class {
1154
1305
  },
1155
1306
  createStream: async (channelName, opts) => {
1156
1307
  (0, import_invariant4.invariant)(!channelName.includes("/"), "Invalid channel name", {
1157
- F: __dxlog_file4,
1158
- L: 244,
1308
+ F: __dxlog_file5,
1309
+ L: 240,
1159
1310
  S: this,
1160
1311
  A: [
1161
1312
  "!channelName.includes('/')",
@@ -1165,86 +1316,31 @@ var Teleport = class {
1165
1316
  return this._muxer.createStream(`${extensionName}/${channelName}`, opts);
1166
1317
  },
1167
1318
  close: (err) => {
1168
- void (0, import_async4.runInContextAsync)(this._ctx, async () => {
1319
+ void (0, import_async5.runInContextAsync)(this._ctx, async () => {
1169
1320
  await this.close(err);
1170
1321
  });
1171
1322
  }
1172
1323
  };
1173
1324
  await extension.onOpen(context);
1174
- (0, import_log4.log)("extension opened", {
1325
+ (0, import_log5.log)("extension opened", {
1175
1326
  extensionName
1176
1327
  }, {
1177
- F: __dxlog_file4,
1178
- L: 255,
1328
+ F: __dxlog_file5,
1329
+ L: 251,
1179
1330
  S: this,
1180
1331
  C: (f, a) => f(...a)
1181
1332
  });
1182
1333
  }
1183
1334
  };
1184
1335
  _ts_decorate([
1185
- import_async4.synchronized
1336
+ import_async5.synchronized
1186
1337
  ], Teleport.prototype, "abort", null);
1187
1338
  _ts_decorate([
1188
- import_async4.synchronized
1339
+ import_async5.synchronized
1189
1340
  ], Teleport.prototype, "destroy", null);
1190
- var ControlExtension = class {
1191
- constructor(opts) {
1192
- this.opts = opts;
1193
- this._ctx = new import_context2.Context({
1194
- onError: (err) => {
1195
- this._extensionContext.close(err);
1196
- }
1197
- });
1198
- this.onExtensionRegistered = new import_util.Callback();
1199
- }
1200
- async registerExtension(name) {
1201
- await this._rpc.rpc.Control.registerExtension({
1202
- name
1203
- });
1204
- }
1205
- async onOpen(extensionContext) {
1206
- this._extensionContext = extensionContext;
1207
- this._rpc = (0, import_rpc.createProtoRpcPeer)({
1208
- requested: {
1209
- Control: import_protocols2.schema.getService("dxos.mesh.teleport.control.ControlService")
1210
- },
1211
- exposed: {
1212
- Control: import_protocols2.schema.getService("dxos.mesh.teleport.control.ControlService")
1213
- },
1214
- handlers: {
1215
- Control: {
1216
- registerExtension: async (request) => {
1217
- this.onExtensionRegistered.call(request.name);
1218
- },
1219
- heartbeat: async (request) => {
1220
- }
1221
- }
1222
- },
1223
- port: await extensionContext.createPort("rpc", {
1224
- contentType: 'application/x-protobuf; messagType="dxos.rpc.Message"'
1225
- })
1226
- });
1227
- await this._rpc.open();
1228
- (0, import_async4.scheduleTaskInterval)(this._ctx, async () => {
1229
- try {
1230
- await (0, import_async4.asyncTimeout)(this._rpc.rpc.Control.heartbeat(), this.opts.heartbeatTimeout);
1231
- } catch (err) {
1232
- this.opts.onTimeout();
1233
- }
1234
- }, this.opts.heartbeatInterval);
1235
- }
1236
- async onClose(err) {
1237
- await this._ctx.dispose();
1238
- await this._rpc.close();
1239
- }
1240
- async onAbort(err) {
1241
- await this._ctx.dispose();
1242
- await this._rpc.abort();
1243
- }
1244
- };
1245
1341
 
1246
1342
  // packages/core/mesh/teleport/src/testing/test-builder.ts
1247
- var __dxlog_file5 = "/mnt/ramdisk/work/packages/core/mesh/teleport/src/testing/test-builder.ts";
1343
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/testing/test-builder.ts";
1248
1344
  var TestBuilder = class {
1249
1345
  constructor() {
1250
1346
  this._peers = /* @__PURE__ */ new Set();
@@ -1264,7 +1360,7 @@ var TestBuilder = class {
1264
1360
  }
1265
1361
  async connect(peer1, peer2) {
1266
1362
  (0, import_invariant5.invariant)(peer1 !== peer2, void 0, {
1267
- F: __dxlog_file5,
1363
+ F: __dxlog_file6,
1268
1364
  L: 37,
1269
1365
  S: this,
1270
1366
  A: [
@@ -1273,7 +1369,7 @@ var TestBuilder = class {
1273
1369
  ]
1274
1370
  });
1275
1371
  (0, import_invariant5.invariant)(this._peers.has(peer1), void 0, {
1276
- F: __dxlog_file5,
1372
+ F: __dxlog_file6,
1277
1373
  L: 38,
1278
1374
  S: this,
1279
1375
  A: [
@@ -1282,7 +1378,7 @@ var TestBuilder = class {
1282
1378
  ]
1283
1379
  });
1284
1380
  (0, import_invariant5.invariant)(this._peers.has(peer1), void 0, {
1285
- F: __dxlog_file5,
1381
+ F: __dxlog_file6,
1286
1382
  L: 39,
1287
1383
  S: this,
1288
1384
  A: [
@@ -1310,7 +1406,7 @@ var TestBuilder = class {
1310
1406
  }
1311
1407
  async disconnect(peer1, peer2) {
1312
1408
  (0, import_invariant5.invariant)(peer1 !== peer2, void 0, {
1313
- F: __dxlog_file5,
1409
+ F: __dxlog_file6,
1314
1410
  L: 51,
1315
1411
  S: this,
1316
1412
  A: [
@@ -1319,7 +1415,7 @@ var TestBuilder = class {
1319
1415
  ]
1320
1416
  });
1321
1417
  (0, import_invariant5.invariant)(this._peers.has(peer1), void 0, {
1322
- F: __dxlog_file5,
1418
+ F: __dxlog_file6,
1323
1419
  L: 52,
1324
1420
  S: this,
1325
1421
  A: [
@@ -1328,7 +1424,7 @@ var TestBuilder = class {
1328
1424
  ]
1329
1425
  });
1330
1426
  (0, import_invariant5.invariant)(this._peers.has(peer1), void 0, {
1331
- F: __dxlog_file5,
1427
+ F: __dxlog_file6,
1332
1428
  L: 53,
1333
1429
  S: this,
1334
1430
  A: [
@@ -1339,7 +1435,7 @@ var TestBuilder = class {
1339
1435
  const connection1 = Array.from(peer1.connections).find((connection) => connection.remotePeerId.equals(peer2.peerId));
1340
1436
  const connection2 = Array.from(peer2.connections).find((connection) => connection.remotePeerId.equals(peer1.peerId));
1341
1437
  (0, import_invariant5.invariant)(connection1, void 0, {
1342
- F: __dxlog_file5,
1438
+ F: __dxlog_file6,
1343
1439
  L: 62,
1344
1440
  S: this,
1345
1441
  A: [
@@ -1348,7 +1444,7 @@ var TestBuilder = class {
1348
1444
  ]
1349
1445
  });
1350
1446
  (0, import_invariant5.invariant)(connection2, void 0, {
1351
- F: __dxlog_file5,
1447
+ F: __dxlog_file6,
1352
1448
  L: 63,
1353
1449
  S: this,
1354
1450
  A: [
@@ -1378,7 +1474,7 @@ var TestPeer = class {
1378
1474
  }
1379
1475
  async openConnection(connection) {
1380
1476
  (0, import_invariant5.invariant)(this.connections.has(connection), void 0, {
1381
- F: __dxlog_file5,
1477
+ F: __dxlog_file6,
1382
1478
  L: 84,
1383
1479
  S: this,
1384
1480
  A: [
@@ -1391,7 +1487,7 @@ var TestPeer = class {
1391
1487
  }
1392
1488
  async closeConnection(connection) {
1393
1489
  (0, import_invariant5.invariant)(this.connections.has(connection), void 0, {
1394
- F: __dxlog_file5,
1490
+ F: __dxlog_file6,
1395
1491
  L: 90,
1396
1492
  S: this,
1397
1493
  A: [
@@ -1412,8 +1508,8 @@ var TestPeer = class {
1412
1508
  var pipeStreams = (stream1, stream2) => {
1413
1509
  (0, import_node_stream3.pipeline)(stream1, stream2, (err) => {
1414
1510
  if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
1415
- import_log5.log.catch(err, void 0, {
1416
- F: __dxlog_file5,
1511
+ import_log6.log.catch(err, void 0, {
1512
+ F: __dxlog_file6,
1417
1513
  L: 106,
1418
1514
  S: void 0,
1419
1515
  C: (f, a) => f(...a)
@@ -1422,8 +1518,8 @@ var pipeStreams = (stream1, stream2) => {
1422
1518
  });
1423
1519
  (0, import_node_stream3.pipeline)(stream2, stream1, (err) => {
1424
1520
  if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") {
1425
- import_log5.log.catch(err, void 0, {
1426
- F: __dxlog_file5,
1521
+ import_log6.log.catch(err, void 0, {
1522
+ F: __dxlog_file6,
1427
1523
  L: 111,
1428
1524
  S: void 0,
1429
1525
  C: (f, a) => f(...a)
@@ -1445,28 +1541,28 @@ var TestConnection = class {
1445
1541
  };
1446
1542
 
1447
1543
  // packages/core/mesh/teleport/src/testing/test-extension.ts
1448
- var import_async5 = require("@dxos/async");
1544
+ var import_async6 = require("@dxos/async");
1449
1545
  var import_invariant6 = require("@dxos/invariant");
1450
- var import_log6 = require("@dxos/log");
1451
- var import_protocols3 = require("@dxos/protocols");
1546
+ var import_log7 = require("@dxos/log");
1547
+ var import_protocols4 = require("@dxos/protocols");
1452
1548
  var import_rpc2 = require("@dxos/rpc");
1453
- var __dxlog_file6 = "/mnt/ramdisk/work/packages/core/mesh/teleport/src/testing/test-extension.ts";
1549
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/testing/test-extension.ts";
1454
1550
  var TestExtension = class {
1455
1551
  constructor(callbacks = {}) {
1456
1552
  this.callbacks = callbacks;
1457
- this.open = new import_async5.Trigger();
1458
- this.closed = new import_async5.Trigger();
1459
- this.aborted = new import_async5.Trigger();
1553
+ this.open = new import_async6.Trigger();
1554
+ this.closed = new import_async6.Trigger();
1555
+ this.aborted = new import_async6.Trigger();
1460
1556
  }
1461
1557
  get remotePeerId() {
1462
1558
  return this.extensionContext?.remotePeerId;
1463
1559
  }
1464
1560
  async onOpen(context) {
1465
- (0, import_log6.log)("onOpen", {
1561
+ (0, import_log7.log)("onOpen", {
1466
1562
  localPeerId: context.localPeerId,
1467
1563
  remotePeerId: context.remotePeerId
1468
1564
  }, {
1469
- F: __dxlog_file6,
1565
+ F: __dxlog_file7,
1470
1566
  L: 34,
1471
1567
  S: this,
1472
1568
  C: (f, a) => f(...a)
@@ -1477,10 +1573,10 @@ var TestExtension = class {
1477
1573
  contentType: 'application/x-protobuf; messageType="dxos.rpc.Message"'
1478
1574
  }),
1479
1575
  requested: {
1480
- TestService: import_protocols3.schema.getService("example.testing.rpc.TestService")
1576
+ TestService: import_protocols4.schema.getService("example.testing.rpc.TestService")
1481
1577
  },
1482
1578
  exposed: {
1483
- TestService: import_protocols3.schema.getService("example.testing.rpc.TestService")
1579
+ TestService: import_protocols4.schema.getService("example.testing.rpc.TestService")
1484
1580
  },
1485
1581
  handlers: {
1486
1582
  TestService: {
@@ -1500,10 +1596,10 @@ var TestExtension = class {
1500
1596
  this.open.wake();
1501
1597
  }
1502
1598
  async onClose(err) {
1503
- (0, import_log6.log)("onClose", {
1599
+ (0, import_log7.log)("onClose", {
1504
1600
  err
1505
1601
  }, {
1506
- F: __dxlog_file6,
1602
+ F: __dxlog_file7,
1507
1603
  L: 68,
1508
1604
  S: this,
1509
1605
  C: (f, a) => f(...a)
@@ -1513,10 +1609,10 @@ var TestExtension = class {
1513
1609
  await this._rpc?.close();
1514
1610
  }
1515
1611
  async onAbort(err) {
1516
- (0, import_log6.log)("onAbort", {
1612
+ (0, import_log7.log)("onAbort", {
1517
1613
  err
1518
1614
  }, {
1519
- F: __dxlog_file6,
1615
+ F: __dxlog_file7,
1520
1616
  L: 75,
1521
1617
  S: this,
1522
1618
  C: (f, a) => f(...a)
@@ -1529,11 +1625,11 @@ var TestExtension = class {
1529
1625
  await this.open.wait({
1530
1626
  timeout: 1500
1531
1627
  });
1532
- const res = await (0, import_async5.asyncTimeout)(this._rpc.rpc.TestService.testCall({
1628
+ const res = await (0, import_async6.asyncTimeout)(this._rpc.rpc.TestService.testCall({
1533
1629
  data: message
1534
1630
  }), 1500);
1535
1631
  (0, import_invariant6.invariant)(res.data === message, void 0, {
1536
- F: __dxlog_file6,
1632
+ F: __dxlog_file7,
1537
1633
  L: 84,
1538
1634
  S: this,
1539
1635
  A: [
@@ -1552,18 +1648,18 @@ var TestExtension = class {
1552
1648
 
1553
1649
  // packages/core/mesh/teleport/src/testing/test-extension-with-streams.ts
1554
1650
  var import_node_crypto = require("node:crypto");
1555
- var import_async6 = require("@dxos/async");
1651
+ var import_async7 = require("@dxos/async");
1556
1652
  var import_invariant7 = require("@dxos/invariant");
1557
- var import_log7 = require("@dxos/log");
1558
- var import_protocols4 = require("@dxos/protocols");
1653
+ var import_log8 = require("@dxos/log");
1654
+ var import_protocols5 = require("@dxos/protocols");
1559
1655
  var import_rpc3 = require("@dxos/rpc");
1560
- var __dxlog_file7 = "/mnt/ramdisk/work/packages/core/mesh/teleport/src/testing/test-extension-with-streams.ts";
1656
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/mesh/teleport/src/testing/test-extension-with-streams.ts";
1561
1657
  var TestExtensionWithStreams = class {
1562
1658
  constructor(callbacks = {}) {
1563
1659
  this.callbacks = callbacks;
1564
- this.open = new import_async6.Trigger();
1565
- this.closed = new import_async6.Trigger();
1566
- this.aborted = new import_async6.Trigger();
1660
+ this.open = new import_async7.Trigger();
1661
+ this.closed = new import_async7.Trigger();
1662
+ this.aborted = new import_async7.Trigger();
1567
1663
  this._streams = /* @__PURE__ */ new Map();
1568
1664
  }
1569
1665
  get remotePeerId() {
@@ -1571,7 +1667,7 @@ var TestExtensionWithStreams = class {
1571
1667
  }
1572
1668
  async _openStream(streamTag, interval = 5, chunkSize = 2048) {
1573
1669
  (0, import_invariant7.invariant)(!this._streams.has(streamTag), `Stream already exists: ${streamTag}`, {
1574
- F: __dxlog_file7,
1670
+ F: __dxlog_file8,
1575
1671
  L: 39,
1576
1672
  S: this,
1577
1673
  A: [
@@ -1619,7 +1715,7 @@ var TestExtensionWithStreams = class {
1619
1715
  });
1620
1716
  streamEntry.reportingTimer = setInterval(() => {
1621
1717
  const { bytesSent, bytesReceived, sendErrors, receiveErrors } = streamEntry;
1622
- import_log7.log.trace("dxos.test.stream-stats", {
1718
+ import_log8.log.trace("dxos.test.stream-stats", {
1623
1719
  streamTag,
1624
1720
  bytesSent,
1625
1721
  bytesReceived,
@@ -1628,7 +1724,7 @@ var TestExtensionWithStreams = class {
1628
1724
  from: this.extensionContext?.localPeerId,
1629
1725
  to: this.extensionContext?.remotePeerId
1630
1726
  }, {
1631
- F: __dxlog_file7,
1727
+ F: __dxlog_file8,
1632
1728
  L: 93,
1633
1729
  S: this,
1634
1730
  C: (f, a) => f(...a)
@@ -1637,7 +1733,7 @@ var TestExtensionWithStreams = class {
1637
1733
  }
1638
1734
  _closeStream(streamTag) {
1639
1735
  (0, import_invariant7.invariant)(this._streams.has(streamTag), `Stream does not exist: ${streamTag}`, {
1640
- F: __dxlog_file7,
1736
+ F: __dxlog_file8,
1641
1737
  L: 106,
1642
1738
  S: this,
1643
1739
  A: [
@@ -1660,11 +1756,11 @@ var TestExtensionWithStreams = class {
1660
1756
  };
1661
1757
  }
1662
1758
  async onOpen(context) {
1663
- (0, import_log7.log)("onOpen", {
1759
+ (0, import_log8.log)("onOpen", {
1664
1760
  localPeerId: context.localPeerId,
1665
1761
  remotePeerId: context.remotePeerId
1666
1762
  }, {
1667
- F: __dxlog_file7,
1763
+ F: __dxlog_file8,
1668
1764
  L: 128,
1669
1765
  S: this,
1670
1766
  C: (f, a) => f(...a)
@@ -1675,10 +1771,10 @@ var TestExtensionWithStreams = class {
1675
1771
  contentType: 'application/x-protobuf; messageType="dxos.rpc.Message"'
1676
1772
  }),
1677
1773
  requested: {
1678
- TestServiceWithStreams: import_protocols4.schema.getService("example.testing.rpc.TestServiceWithStreams")
1774
+ TestServiceWithStreams: import_protocols5.schema.getService("example.testing.rpc.TestServiceWithStreams")
1679
1775
  },
1680
1776
  exposed: {
1681
- TestServiceWithStreams: import_protocols4.schema.getService("example.testing.rpc.TestServiceWithStreams")
1777
+ TestServiceWithStreams: import_protocols5.schema.getService("example.testing.rpc.TestServiceWithStreams")
1682
1778
  },
1683
1779
  handlers: {
1684
1780
  TestServiceWithStreams: {
@@ -1710,10 +1806,10 @@ var TestExtensionWithStreams = class {
1710
1806
  this.open.wake();
1711
1807
  }
1712
1808
  async onClose(err) {
1713
- (0, import_log7.log)("onClose", {
1809
+ (0, import_log8.log)("onClose", {
1714
1810
  err
1715
1811
  }, {
1716
- F: __dxlog_file7,
1812
+ F: __dxlog_file8,
1717
1813
  L: 179,
1718
1814
  S: this,
1719
1815
  C: (f, a) => f(...a)
@@ -1721,10 +1817,10 @@ var TestExtensionWithStreams = class {
1721
1817
  await this.callbacks.onClose?.();
1722
1818
  this.closed.wake();
1723
1819
  for (const [streamTag, stream] of Object.entries(this._streams)) {
1724
- (0, import_log7.log)("closing stream", {
1820
+ (0, import_log8.log)("closing stream", {
1725
1821
  streamTag
1726
1822
  }, {
1727
- F: __dxlog_file7,
1823
+ F: __dxlog_file8,
1728
1824
  L: 183,
1729
1825
  S: this,
1730
1826
  C: (f, a) => f(...a)
@@ -1735,10 +1831,10 @@ var TestExtensionWithStreams = class {
1735
1831
  await this._rpc?.close();
1736
1832
  }
1737
1833
  async onAbort(err) {
1738
- (0, import_log7.log)("onAbort", {
1834
+ (0, import_log8.log)("onAbort", {
1739
1835
  err
1740
1836
  }, {
1741
- F: __dxlog_file7,
1837
+ F: __dxlog_file8,
1742
1838
  L: 191,
1743
1839
  S: this,
1744
1840
  C: (f, a) => f(...a)
@@ -1760,7 +1856,7 @@ var TestExtensionWithStreams = class {
1760
1856
  streamLoadChunkSize
1761
1857
  });
1762
1858
  (0, import_invariant7.invariant)(data === streamTag, void 0, {
1763
- F: __dxlog_file7,
1859
+ F: __dxlog_file8,
1764
1860
  L: 207,
1765
1861
  S: this,
1766
1862
  A: [
@@ -1779,7 +1875,7 @@ var TestExtensionWithStreams = class {
1779
1875
  data: streamTag
1780
1876
  });
1781
1877
  (0, import_invariant7.invariant)(data === streamTag, void 0, {
1782
- F: __dxlog_file7,
1878
+ F: __dxlog_file8,
1783
1879
  L: 220,
1784
1880
  S: this,
1785
1881
  A: [