@dxos/echo-pipeline 0.1.55 → 0.1.56-main.01afb72

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 (37) hide show
  1. package/dist/lib/browser/{chunk-4VJRJ4SY.mjs → chunk-7S5RJM3K.mjs} +478 -169
  2. package/dist/lib/browser/chunk-7S5RJM3K.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/testing/index.mjs +3 -2
  6. package/dist/lib/browser/testing/index.mjs.map +3 -3
  7. package/dist/lib/node/index.cjs +474 -165
  8. package/dist/lib/node/index.cjs.map +3 -3
  9. package/dist/lib/node/meta.json +1 -1
  10. package/dist/lib/node/testing/index.cjs +464 -154
  11. package/dist/lib/node/testing/index.cjs.map +3 -3
  12. package/dist/types/src/common/feeds.d.ts.map +1 -1
  13. package/dist/types/src/db-host/data-service-host.d.ts.map +1 -1
  14. package/dist/types/src/db-host/data-service.d.ts.map +1 -1
  15. package/dist/types/src/metadata/metadata-store.d.ts.map +1 -1
  16. package/dist/types/src/pipeline/message-selector.d.ts.map +1 -1
  17. package/dist/types/src/pipeline/pipeline.d.ts.map +1 -1
  18. package/dist/types/src/space/auth.d.ts.map +1 -1
  19. package/dist/types/src/space/data-pipeline.d.ts.map +1 -1
  20. package/dist/types/src/space/space-protocol.d.ts.map +1 -1
  21. package/dist/types/src/space/space.d.ts +2 -1
  22. package/dist/types/src/space/space.d.ts.map +1 -1
  23. package/dist/types/src/testing/test-agent-builder.d.ts.map +1 -1
  24. package/package.json +32 -31
  25. package/src/common/feeds.ts +1 -2
  26. package/src/db-host/data-service-host.ts +1 -2
  27. package/src/db-host/data-service.ts +1 -2
  28. package/src/metadata/metadata-store.ts +1 -1
  29. package/src/pipeline/message-selector.ts +1 -2
  30. package/src/pipeline/pipeline.ts +1 -2
  31. package/src/space/auth.ts +1 -2
  32. package/src/space/data-pipeline.ts +1 -2
  33. package/src/space/space-protocol.ts +3 -2
  34. package/src/space/space.test.ts +18 -17
  35. package/src/space/space.ts +6 -3
  36. package/src/testing/test-agent-builder.ts +2 -1
  37. package/dist/lib/browser/chunk-4VJRJ4SY.mjs.map +0 -7
@@ -71,23 +71,40 @@ var codec = import_protocols.schema.getCodecForType("dxos.echo.feed.FeedMessage"
71
71
  var valueEncoding = (0, import_hypercore.createCodecEncoding)(codec);
72
72
 
73
73
  // packages/core/echo/echo-pipeline/src/common/feeds.ts
74
- var import_tiny_invariant = __toESM(require("tiny-invariant"));
74
+ var import_invariant = require("@dxos/invariant");
75
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/common/feeds.ts";
75
76
  var createMappedFeedWriter = (mapper, writer) => {
76
- (0, import_tiny_invariant.default)(mapper);
77
- (0, import_tiny_invariant.default)(writer);
77
+ (0, import_invariant.invariant)(mapper, void 0, {
78
+ F: __dxlog_file,
79
+ L: 16,
80
+ S: void 0,
81
+ A: [
82
+ "mapper",
83
+ ""
84
+ ]
85
+ });
86
+ (0, import_invariant.invariant)(writer, void 0, {
87
+ F: __dxlog_file,
88
+ L: 17,
89
+ S: void 0,
90
+ A: [
91
+ "writer",
92
+ ""
93
+ ]
94
+ });
78
95
  return {
79
96
  write: async (data, options) => await writer.write(await mapper(data), options)
80
97
  };
81
98
  };
82
99
 
83
100
  // packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts
84
- var import_tiny_invariant2 = __toESM(require("tiny-invariant"));
85
101
  var import_codec_protobuf = require("@dxos/codec-protobuf");
86
102
  var import_context = require("@dxos/context");
87
103
  var import_echo_db = require("@dxos/echo-db");
104
+ var import_invariant2 = require("@dxos/invariant");
88
105
  var import_log = require("@dxos/log");
89
106
  var import_util = require("@dxos/util");
90
- var __dxlog_file = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts";
107
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts";
91
108
  var DataServiceHost = class {
92
109
  constructor(_itemManager, _itemDemuxer, _writeStream) {
93
110
  this._itemManager = _itemManager;
@@ -116,13 +133,21 @@ var DataServiceHost = class {
116
133
  this._itemDemuxer.mutation.on(ctx, (message) => {
117
134
  var _a;
118
135
  const { batch, meta } = message;
119
- (0, import_tiny_invariant2.default)(!meta.clientTag, "Unexpected client tag in mutation message");
136
+ (0, import_invariant2.invariant)(!meta.clientTag, "Unexpected client tag in mutation message", {
137
+ F: __dxlog_file2,
138
+ L: 61,
139
+ S: this,
140
+ A: [
141
+ "!(meta as any).clientTag",
142
+ "'Unexpected client tag in mutation message'"
143
+ ]
144
+ });
120
145
  (0, import_log.log)("message", {
121
146
  batch,
122
147
  meta
123
148
  }, {
124
- F: __dxlog_file,
125
- L: 63,
149
+ F: __dxlog_file2,
150
+ L: 62,
126
151
  S: this,
127
152
  C: (f, a) => f(...a)
128
153
  });
@@ -149,14 +174,30 @@ var DataServiceHost = class {
149
174
  }
150
175
  async write(request) {
151
176
  var _a, _b;
152
- (0, import_tiny_invariant2.default)(!this._ctx.disposed, "Cannot write to closed DataServiceHost");
153
- (0, import_tiny_invariant2.default)(this._writeStream, "Cannot write mutations in readonly mode");
177
+ (0, import_invariant2.invariant)(!this._ctx.disposed, "Cannot write to closed DataServiceHost", {
178
+ F: __dxlog_file2,
179
+ L: 88,
180
+ S: this,
181
+ A: [
182
+ "!this._ctx.disposed",
183
+ "'Cannot write to closed DataServiceHost'"
184
+ ]
185
+ });
186
+ (0, import_invariant2.invariant)(this._writeStream, "Cannot write mutations in readonly mode", {
187
+ F: __dxlog_file2,
188
+ L: 89,
189
+ S: this,
190
+ A: [
191
+ "this._writeStream",
192
+ "'Cannot write mutations in readonly mode'"
193
+ ]
194
+ });
154
195
  (0, import_log.log)("write", {
155
196
  clientTag: request.clientTag,
156
197
  objectCount: (_b = (_a = request.batch.objects) == null ? void 0 : _a.length) != null ? _b : 0
157
198
  }, {
158
- F: __dxlog_file,
159
- L: 92,
199
+ F: __dxlog_file2,
200
+ L: 91,
160
201
  S: this,
161
202
  C: (f, a) => f(...a)
162
203
  });
@@ -169,8 +210,8 @@ var DataServiceHost = class {
169
210
  feedKey: receipt2.feedKey,
170
211
  seq: receipt2.seq
171
212
  }, {
172
- F: __dxlog_file,
173
- L: 101,
213
+ F: __dxlog_file2,
214
+ L: 100,
174
215
  S: this,
175
216
  C: (f, a) => f(...a)
176
217
  });
@@ -337,12 +378,12 @@ var SnapshotStore = class {
337
378
  };
338
379
 
339
380
  // packages/core/echo/echo-pipeline/src/db-host/data-service.ts
340
- var import_tiny_invariant3 = __toESM(require("tiny-invariant"));
341
381
  var import_debug2 = require("@dxos/debug");
382
+ var import_invariant3 = require("@dxos/invariant");
342
383
  var import_keys2 = require("@dxos/keys");
343
384
  var import_log2 = require("@dxos/log");
344
385
  var import_util2 = require("@dxos/util");
345
- var __dxlog_file2 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/db-host/data-service.ts";
386
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/data-service.ts";
346
387
  var DataServiceSubscriptions = class {
347
388
  constructor() {
348
389
  this._spaces = new import_util2.ComplexMap(import_keys2.PublicKey.hash);
@@ -354,12 +395,20 @@ var DataServiceSubscriptions = class {
354
395
  (0, import_log2.log)("Registering space", {
355
396
  spaceKey
356
397
  }, {
357
- F: __dxlog_file2,
358
- L: 31,
398
+ F: __dxlog_file3,
399
+ L: 30,
359
400
  S: this,
360
401
  C: (f, a) => f(...a)
361
402
  });
362
- (0, import_tiny_invariant3.default)(!this._spaces.has(spaceKey));
403
+ (0, import_invariant3.invariant)(!this._spaces.has(spaceKey), void 0, {
404
+ F: __dxlog_file3,
405
+ L: 31,
406
+ S: this,
407
+ A: [
408
+ "!this._spaces.has(spaceKey)",
409
+ ""
410
+ ]
411
+ });
363
412
  await host.open();
364
413
  this._spaces.set(spaceKey, host);
365
414
  }
@@ -367,8 +416,8 @@ var DataServiceSubscriptions = class {
367
416
  (0, import_log2.log)("Unregistering space", {
368
417
  spaceKey
369
418
  }, {
370
- F: __dxlog_file2,
371
- L: 38,
419
+ F: __dxlog_file3,
420
+ L: 37,
372
421
  S: this,
373
422
  C: (f, a) => f(...a)
374
423
  });
@@ -386,14 +435,38 @@ var DataServiceImpl = class {
386
435
  }
387
436
  subscribe(request) {
388
437
  var _a;
389
- (0, import_tiny_invariant3.default)(request.spaceKey);
438
+ (0, import_invariant3.invariant)(request.spaceKey, void 0, {
439
+ F: __dxlog_file3,
440
+ L: 56,
441
+ S: this,
442
+ A: [
443
+ "request.spaceKey",
444
+ ""
445
+ ]
446
+ });
390
447
  const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0, import_debug2.raise)(new Error(`space not found: ${request.spaceKey}`));
391
448
  return host.subscribe();
392
449
  }
393
450
  write(request) {
394
451
  var _a;
395
- (0, import_tiny_invariant3.default)(request.spaceKey);
396
- (0, import_tiny_invariant3.default)(request.batch);
452
+ (0, import_invariant3.invariant)(request.spaceKey, void 0, {
453
+ F: __dxlog_file3,
454
+ L: 63,
455
+ S: this,
456
+ A: [
457
+ "request.spaceKey",
458
+ ""
459
+ ]
460
+ });
461
+ (0, import_invariant3.invariant)(request.batch, void 0, {
462
+ F: __dxlog_file3,
463
+ L: 64,
464
+ S: this,
465
+ A: [
466
+ "request.batch",
467
+ ""
468
+ ]
469
+ });
397
470
  const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0, import_debug2.raise)(new Error(`space not found: ${request.spaceKey}`));
398
471
  return host.write(request);
399
472
  }
@@ -450,9 +523,9 @@ var UnknownModelError = class extends DBError {
450
523
 
451
524
  // packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts
452
525
  var import_crc_32 = __toESM(require("crc-32"));
453
- var import_tiny_invariant4 = __toESM(require("tiny-invariant"));
454
526
  var import_async2 = require("@dxos/async");
455
527
  var import_errors = require("@dxos/errors");
528
+ var import_invariant4 = require("@dxos/invariant");
456
529
  var import_log3 = require("@dxos/log");
457
530
  var import_protocols4 = require("@dxos/protocols");
458
531
  var import_services = require("@dxos/protocols/proto/dxos/client/services");
@@ -467,7 +540,7 @@ function _ts_decorate2(decorators, target, key, desc) {
467
540
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
468
541
  return c > 3 && r && Object.defineProperty(target, key, r), r;
469
542
  }
470
- var __dxlog_file3 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
543
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
471
544
  var emptyEchoMetadata = () => ({
472
545
  version: import_protocols4.STORAGE_VERSION,
473
546
  spaces: [],
@@ -514,7 +587,7 @@ var MetadataStore = class {
514
587
  size: dataSize,
515
588
  checksum
516
589
  }, {
517
- F: __dxlog_file3,
590
+ F: __dxlog_file4,
518
591
  L: 72,
519
592
  S: this,
520
593
  C: (f, a) => f(...a)
@@ -536,7 +609,7 @@ var MetadataStore = class {
536
609
  import_log3.log.error("failed to load metadata", {
537
610
  err
538
611
  }, {
539
- F: __dxlog_file3,
612
+ F: __dxlog_file4,
540
613
  L: 92,
541
614
  S: this,
542
615
  C: (f, a) => f(...a)
@@ -568,7 +641,7 @@ var MetadataStore = class {
568
641
  size: encoded.length,
569
642
  checksum
570
643
  }, {
571
- F: __dxlog_file3,
644
+ F: __dxlog_file4,
572
645
  L: 124,
573
646
  S: this,
574
647
  C: (f, a) => f(...a)
@@ -583,7 +656,15 @@ var MetadataStore = class {
583
656
  return this._metadata.identity.haloSpace;
584
657
  }
585
658
  const space = this.spaces.find((space2) => space2.key === spaceKey);
586
- (0, import_tiny_invariant4.default)(space, "Space not found");
659
+ (0, import_invariant4.invariant)(space, "Space not found", {
660
+ F: __dxlog_file4,
661
+ L: 137,
662
+ S: this,
663
+ A: [
664
+ "space",
665
+ "'Space not found'"
666
+ ]
667
+ });
587
668
  return space;
588
669
  }
589
670
  /**
@@ -591,7 +672,7 @@ var MetadataStore = class {
591
672
  */
592
673
  async clear() {
593
674
  (0, import_log3.log)("clearing all metadata", void 0, {
594
- F: __dxlog_file3,
675
+ F: __dxlog_file4,
595
676
  L: 145,
596
677
  S: this,
597
678
  C: (f, a) => f(...a)
@@ -603,13 +684,29 @@ var MetadataStore = class {
603
684
  return this._metadata.identity;
604
685
  }
605
686
  async setIdentityRecord(record) {
606
- (0, import_tiny_invariant4.default)(!this._metadata.identity, "Cannot overwrite existing identity in metadata");
687
+ (0, import_invariant4.invariant)(!this._metadata.identity, "Cannot overwrite existing identity in metadata", {
688
+ F: __dxlog_file4,
689
+ L: 155,
690
+ S: this,
691
+ A: [
692
+ "!this._metadata.identity",
693
+ "'Cannot overwrite existing identity in metadata'"
694
+ ]
695
+ });
607
696
  this._metadata.identity = record;
608
697
  await this._save();
609
698
  }
610
699
  async addSpace(record) {
611
700
  var _a, _b, _c;
612
- (0, import_tiny_invariant4.default)(!((_a = this._metadata.spaces) != null ? _a : []).find((space) => space.key === record.key), "Cannot overwrite existing space in metadata");
701
+ (0, import_invariant4.invariant)(!((_a = this._metadata.spaces) != null ? _a : []).find((space) => space.key === record.key), "Cannot overwrite existing space in metadata", {
702
+ F: __dxlog_file4,
703
+ L: 162,
704
+ S: this,
705
+ A: [
706
+ "!(this._metadata.spaces ?? []).find((space) => space.key === record.key)",
707
+ "'Cannot overwrite existing space in metadata'"
708
+ ]
709
+ });
613
710
  ((_c = (_b = this._metadata).spaces) != null ? _c : _b.spaces = []).push(record);
614
711
  await this._save();
615
712
  }
@@ -645,32 +742,40 @@ _ts_decorate2([
645
742
  var fromBytesInt32 = (buf) => buf.readInt32LE(0);
646
743
 
647
744
  // packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts
648
- var import_tiny_invariant6 = __toESM(require("tiny-invariant"));
649
745
  var import_async4 = require("@dxos/async");
650
746
  var import_context3 = require("@dxos/context");
651
747
  var import_debug4 = require("@dxos/debug");
652
748
  var import_feed_store = require("@dxos/feed-store");
749
+ var import_invariant6 = require("@dxos/invariant");
653
750
  var import_keys3 = require("@dxos/keys");
654
751
  var import_log6 = require("@dxos/log");
655
752
  var import_timeframe2 = require("@dxos/timeframe");
656
753
  var import_util4 = require("@dxos/util");
657
754
 
658
755
  // packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts
659
- var import_tiny_invariant5 = __toESM(require("tiny-invariant"));
756
+ var import_invariant5 = require("@dxos/invariant");
660
757
  var import_log4 = require("@dxos/log");
661
- var __dxlog_file4 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts";
758
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts";
662
759
  var createMessageSelector = (timeframeClock) => {
663
760
  return (messages) => {
664
761
  for (let i = 0; i < messages.length; i++) {
665
762
  const { data: { timeframe } } = messages[i];
666
- (0, import_tiny_invariant5.default)(timeframe);
763
+ (0, import_invariant5.invariant)(timeframe, void 0, {
764
+ F: __dxlog_file5,
765
+ L: 25,
766
+ S: void 0,
767
+ A: [
768
+ "timeframe",
769
+ ""
770
+ ]
771
+ });
667
772
  if (!timeframeClock.hasGaps(timeframe)) {
668
773
  return i;
669
774
  }
670
775
  }
671
776
  (0, import_log4.log)("Skipping...", void 0, {
672
- F: __dxlog_file4,
673
- L: 34,
777
+ F: __dxlog_file5,
778
+ L: 33,
674
779
  S: void 0,
675
780
  C: (f, a) => f(...a)
676
781
  });
@@ -692,7 +797,7 @@ function _ts_decorate3(decorators, target, key, desc) {
692
797
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
693
798
  return c > 3 && r && Object.defineProperty(target, key, r), r;
694
799
  }
695
- var __dxlog_file5 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
800
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
696
801
  var mapTimeframeToFeedIndexes = (timeframe) => timeframe.frames().map(([feedKey, index]) => ({
697
802
  feedKey,
698
803
  index
@@ -751,7 +856,7 @@ var TimeframeClock = class {
751
856
  target,
752
857
  current: this._timeframe
753
858
  }, {
754
- F: __dxlog_file5,
859
+ F: __dxlog_file6,
755
860
  L: 73,
756
861
  S: this,
757
862
  C: (f, a) => f(...a)
@@ -762,7 +867,7 @@ var TimeframeClock = class {
762
867
  current: this._timeframe,
763
868
  deps: import_timeframe.Timeframe.dependencies(target, this._timeframe)
764
869
  }, {
765
- F: __dxlog_file5,
870
+ F: __dxlog_file6,
766
871
  L: 75,
767
872
  S: this,
768
873
  C: (f, a) => f(...a)
@@ -786,7 +891,7 @@ function _ts_decorate4(decorators, target, key, desc) {
786
891
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
787
892
  return c > 3 && r && Object.defineProperty(target, key, r), r;
788
893
  }
789
- var __dxlog_file6 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
894
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
790
895
  var PipelineState = class {
791
896
  // prettier-ignore
792
897
  constructor(_feeds, _timeframeClock) {
@@ -843,8 +948,8 @@ var PipelineState = class {
843
948
  current: this.timeframe,
844
949
  target: this.targetTimeframe
845
950
  }, {
846
- F: __dxlog_file6,
847
- L: 126,
951
+ F: __dxlog_file7,
952
+ L: 125,
848
953
  S: this,
849
954
  C: (f, a) => f(...a)
850
955
  });
@@ -874,8 +979,8 @@ var PipelineState = class {
874
979
  target: this.targetTimeframe,
875
980
  dependencies: import_timeframe2.Timeframe.dependencies(this.targetTimeframe, this.timeframe)
876
981
  }, {
877
- F: __dxlog_file6,
878
- L: 153,
982
+ F: __dxlog_file7,
983
+ L: 152,
879
984
  S: this,
880
985
  C: (f, a) => f(...a)
881
986
  });
@@ -904,7 +1009,15 @@ var Pipeline = class {
904
1009
  return this._state;
905
1010
  }
906
1011
  get writer() {
907
- (0, import_tiny_invariant6.default)(this._writer, "Writer not set.");
1012
+ (0, import_invariant6.invariant)(this._writer, "Writer not set.", {
1013
+ F: __dxlog_file7,
1014
+ L: 230,
1015
+ S: this,
1016
+ A: [
1017
+ "this._writer",
1018
+ "'Writer not set.'"
1019
+ ]
1020
+ });
908
1021
  return this._writer;
909
1022
  }
910
1023
  hasFeed(feedKey) {
@@ -923,8 +1036,24 @@ var Pipeline = class {
923
1036
  this._setFeedDownloadState(feed);
924
1037
  }
925
1038
  setWriteFeed(feed) {
926
- (0, import_tiny_invariant6.default)(!this._writer, "Writer already set.");
927
- (0, import_tiny_invariant6.default)(feed.properties.writable, "Feed must be writable.");
1039
+ (0, import_invariant6.invariant)(!this._writer, "Writer already set.", {
1040
+ F: __dxlog_file7,
1041
+ L: 253,
1042
+ S: this,
1043
+ A: [
1044
+ "!this._writer",
1045
+ "'Writer already set.'"
1046
+ ]
1047
+ });
1048
+ (0, import_invariant6.invariant)(feed.properties.writable, "Feed must be writable.", {
1049
+ F: __dxlog_file7,
1050
+ L: 254,
1051
+ S: this,
1052
+ A: [
1053
+ "feed.properties.writable",
1054
+ "'Feed must be writable.'"
1055
+ ]
1056
+ });
928
1057
  this._writer = createMappedFeedWriter((payload) => ({
929
1058
  timeframe: this._timeframeClock.timeframe,
930
1059
  payload
@@ -932,8 +1061,8 @@ var Pipeline = class {
932
1061
  }
933
1062
  async start() {
934
1063
  (0, import_log6.log)("starting...", void 0, {
935
- F: __dxlog_file6,
936
- L: 268,
1064
+ F: __dxlog_file7,
1065
+ L: 267,
937
1066
  S: this,
938
1067
  C: (f, a) => f(...a)
939
1068
  });
@@ -941,8 +1070,8 @@ var Pipeline = class {
941
1070
  await this._feedSetIterator.open();
942
1071
  this._isStarted = true;
943
1072
  (0, import_log6.log)("started", void 0, {
944
- F: __dxlog_file6,
945
- L: 272,
1073
+ F: __dxlog_file7,
1074
+ L: 271,
946
1075
  S: this,
947
1076
  C: (f, a) => f(...a)
948
1077
  });
@@ -950,8 +1079,8 @@ var Pipeline = class {
950
1079
  async stop() {
951
1080
  var _a;
952
1081
  (0, import_log6.log)("stopping...", void 0, {
953
- F: __dxlog_file6,
954
- L: 277,
1082
+ F: __dxlog_file7,
1083
+ L: 276,
955
1084
  S: this,
956
1085
  C: (f, a) => f(...a)
957
1086
  });
@@ -963,8 +1092,8 @@ var Pipeline = class {
963
1092
  this._state._reachedTargetPromise = void 0;
964
1093
  this._isStarted = false;
965
1094
  (0, import_log6.log)("stopped", void 0, {
966
- F: __dxlog_file6,
967
- L: 285,
1095
+ F: __dxlog_file7,
1096
+ L: 284,
968
1097
  S: this,
969
1098
  C: (f, a) => f(...a)
970
1099
  });
@@ -974,7 +1103,15 @@ var Pipeline = class {
974
1103
  * The pipeline will start processing messages AFTER this timeframe.
975
1104
  */
976
1105
  async setCursor(timeframe) {
977
- (0, import_tiny_invariant6.default)(!this._isStarted || this._isPaused, "Invalid state.");
1106
+ (0, import_invariant6.invariant)(!this._isStarted || this._isPaused, "Invalid state.", {
1107
+ F: __dxlog_file7,
1108
+ L: 293,
1109
+ S: this,
1110
+ A: [
1111
+ "!this._isStarted || this._isPaused",
1112
+ "'Invalid state.'"
1113
+ ]
1114
+ });
978
1115
  this._state._startTimeframe = timeframe;
979
1116
  this._timeframeClock.setTimeframe(timeframe);
980
1117
  for (const feed of this._feeds.values()) {
@@ -990,7 +1127,15 @@ var Pipeline = class {
990
1127
  * Calling pause while processing will cause a deadlock.
991
1128
  */
992
1129
  async pause() {
993
- (0, import_tiny_invariant6.default)(this._isStarted, "Pipeline is not open.");
1130
+ (0, import_invariant6.invariant)(this._isStarted, "Pipeline is not open.", {
1131
+ F: __dxlog_file7,
1132
+ L: 315,
1133
+ S: this,
1134
+ A: [
1135
+ "this._isStarted",
1136
+ "'Pipeline is not open.'"
1137
+ ]
1138
+ });
994
1139
  if (this._isPaused) {
995
1140
  return;
996
1141
  }
@@ -999,8 +1144,24 @@ var Pipeline = class {
999
1144
  this._isPaused = true;
1000
1145
  }
1001
1146
  async unpause() {
1002
- (0, import_tiny_invariant6.default)(this._isStarted, "Pipeline is not open.");
1003
- (0, import_tiny_invariant6.default)(this._isPaused, "Pipeline is not paused.");
1147
+ (0, import_invariant6.invariant)(this._isStarted, "Pipeline is not open.", {
1148
+ F: __dxlog_file7,
1149
+ L: 327,
1150
+ S: this,
1151
+ A: [
1152
+ "this._isStarted",
1153
+ "'Pipeline is not open.'"
1154
+ ]
1155
+ });
1156
+ (0, import_invariant6.invariant)(this._isPaused, "Pipeline is not paused.", {
1157
+ F: __dxlog_file7,
1158
+ L: 328,
1159
+ S: this,
1160
+ A: [
1161
+ "this._isPaused",
1162
+ "'Pipeline is not paused.'"
1163
+ ]
1164
+ });
1004
1165
  this._pauseTrigger.wake();
1005
1166
  this._isPaused = false;
1006
1167
  }
@@ -1009,15 +1170,39 @@ var Pipeline = class {
1009
1170
  * Updates the timeframe clock after the message has bee processed.
1010
1171
  */
1011
1172
  async *consume() {
1012
- (0, import_tiny_invariant6.default)(!this._isOpen, "Pipeline is already being consumed.");
1173
+ (0, import_invariant6.invariant)(!this._isOpen, "Pipeline is already being consumed.", {
1174
+ F: __dxlog_file7,
1175
+ L: 339,
1176
+ S: this,
1177
+ A: [
1178
+ "!this._isOpen",
1179
+ "'Pipeline is already being consumed.'"
1180
+ ]
1181
+ });
1013
1182
  this._isOpen = true;
1014
- (0, import_tiny_invariant6.default)(this._feedSetIterator, "Iterator not initialized.");
1183
+ (0, import_invariant6.invariant)(this._feedSetIterator, "Iterator not initialized.", {
1184
+ F: __dxlog_file7,
1185
+ L: 342,
1186
+ S: this,
1187
+ A: [
1188
+ "this._feedSetIterator",
1189
+ "'Iterator not initialized.'"
1190
+ ]
1191
+ });
1015
1192
  let lastFeedSetIterator = this._feedSetIterator;
1016
1193
  let iterable = lastFeedSetIterator[Symbol.asyncIterator]();
1017
1194
  while (!this._isStopping) {
1018
1195
  await this._pauseTrigger.wait();
1019
1196
  if (lastFeedSetIterator !== this._feedSetIterator) {
1020
- (0, import_tiny_invariant6.default)(this._feedSetIterator, "Iterator not initialized.");
1197
+ (0, import_invariant6.invariant)(this._feedSetIterator, "Iterator not initialized.", {
1198
+ F: __dxlog_file7,
1199
+ L: 351,
1200
+ S: this,
1201
+ A: [
1202
+ "this._feedSetIterator",
1203
+ "'Iterator not initialized.'"
1204
+ ]
1205
+ });
1021
1206
  lastFeedSetIterator = this._feedSetIterator;
1022
1207
  iterable = lastFeedSetIterator[Symbol.asyncIterator]();
1023
1208
  }
@@ -1039,8 +1224,8 @@ var Pipeline = class {
1039
1224
  const seq = (_a = timeframe.get(feed.key)) != null ? _a : 0;
1040
1225
  feed.undownload({
1041
1226
  callback: () => (0, import_log6.log)("undownload", void 0, {
1042
- F: __dxlog_file6,
1043
- L: 376,
1227
+ F: __dxlog_file7,
1228
+ L: 375,
1044
1229
  S: this,
1045
1230
  C: (f, a) => f(...a)
1046
1231
  })
@@ -1052,8 +1237,8 @@ var Pipeline = class {
1052
1237
  (0, import_log6.log)("failed to download feed", {
1053
1238
  err
1054
1239
  }, {
1055
- F: __dxlog_file6,
1056
- L: 378,
1240
+ F: __dxlog_file7,
1241
+ L: 377,
1057
1242
  S: this,
1058
1243
  C: (f, a) => f(...a)
1059
1244
  });
@@ -1066,8 +1251,8 @@ var Pipeline = class {
1066
1251
  });
1067
1252
  this._feedSetIterator.stalled.on((iterator) => {
1068
1253
  import_log6.log.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, void 0, {
1069
- F: __dxlog_file6,
1070
- L: 389,
1254
+ F: __dxlog_file7,
1255
+ L: 388,
1071
1256
  S: this,
1072
1257
  C: (f, a) => f(...a)
1073
1258
  });
@@ -1095,14 +1280,14 @@ _ts_decorate4([
1095
1280
  ], Pipeline.prototype, "unpause", null);
1096
1281
 
1097
1282
  // packages/core/echo/echo-pipeline/src/space/auth.ts
1098
- var import_tiny_invariant7 = __toESM(require("tiny-invariant"));
1099
1283
  var import_async5 = require("@dxos/async");
1100
1284
  var import_context4 = require("@dxos/context");
1101
1285
  var import_crypto2 = require("@dxos/crypto");
1286
+ var import_invariant7 = require("@dxos/invariant");
1102
1287
  var import_log7 = require("@dxos/log");
1103
1288
  var import_protocols5 = require("@dxos/protocols");
1104
1289
  var import_teleport = require("@dxos/teleport");
1105
- var __dxlog_file7 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/auth.ts";
1290
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/auth.ts";
1106
1291
  var AuthExtension = class extends import_teleport.RpcExtension {
1107
1292
  constructor(_authParams) {
1108
1293
  super({
@@ -1118,8 +1303,8 @@ var AuthExtension = class extends import_teleport.RpcExtension {
1118
1303
  this._ctx = new import_context4.Context({
1119
1304
  onError: (err) => {
1120
1305
  import_log7.log.catch(err, void 0, {
1121
- F: __dxlog_file7,
1122
- L: 29,
1306
+ F: __dxlog_file8,
1307
+ L: 28,
1123
1308
  S: this,
1124
1309
  C: (f, a) => f(...a)
1125
1310
  });
@@ -1140,8 +1325,8 @@ var AuthExtension = class extends import_teleport.RpcExtension {
1140
1325
  };
1141
1326
  } catch (err) {
1142
1327
  import_log7.log.error("failed to generate auth credentials", err, {
1143
- F: __dxlog_file7,
1144
- L: 56,
1328
+ F: __dxlog_file8,
1329
+ L: 55,
1145
1330
  S: this,
1146
1331
  C: (f, a) => f(...a)
1147
1332
  });
@@ -1159,14 +1344,30 @@ var AuthExtension = class extends import_teleport.RpcExtension {
1159
1344
  const { credential } = await this.rpc.AuthService.authenticate({
1160
1345
  challenge
1161
1346
  });
1162
- (0, import_tiny_invariant7.default)((credential == null ? void 0 : credential.length) > 0, "invalid credential");
1347
+ (0, import_invariant7.invariant)((credential == null ? void 0 : credential.length) > 0, "invalid credential", {
1348
+ F: __dxlog_file8,
1349
+ L: 69,
1350
+ S: this,
1351
+ A: [
1352
+ "credential?.length > 0",
1353
+ "'invalid credential'"
1354
+ ]
1355
+ });
1163
1356
  const success = await this._authParams.verifier(challenge, credential);
1164
- (0, import_tiny_invariant7.default)(success, "credential not verified");
1357
+ (0, import_invariant7.invariant)(success, "credential not verified", {
1358
+ F: __dxlog_file8,
1359
+ L: 71,
1360
+ S: this,
1361
+ A: [
1362
+ "success",
1363
+ "'credential not verified'"
1364
+ ]
1365
+ });
1165
1366
  (0, import_async5.runInContext)(this._ctx, () => this._authParams.onAuthSuccess());
1166
1367
  } catch (err) {
1167
1368
  (0, import_log7.log)("auth failed", err, {
1168
- F: __dxlog_file7,
1169
- L: 75,
1369
+ F: __dxlog_file8,
1370
+ L: 74,
1170
1371
  S: this,
1171
1372
  C: (f, a) => f(...a)
1172
1373
  });
@@ -1182,10 +1383,11 @@ var AuthExtension = class extends import_teleport.RpcExtension {
1182
1383
  };
1183
1384
 
1184
1385
  // packages/core/echo/echo-pipeline/src/space/space.ts
1185
- var import_tiny_invariant9 = __toESM(require("tiny-invariant"));
1186
1386
  var import_async7 = require("@dxos/async");
1387
+ var import_invariant9 = require("@dxos/invariant");
1187
1388
  var import_log10 = require("@dxos/log");
1188
1389
  var import_credentials4 = require("@dxos/protocols/proto/dxos/halo/credentials");
1390
+ var import_tracing = require("@dxos/tracing");
1189
1391
  var import_util7 = require("@dxos/util");
1190
1392
 
1191
1393
  // packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
@@ -1195,7 +1397,7 @@ var import_log8 = require("@dxos/log");
1195
1397
  var import_credentials2 = require("@dxos/protocols/proto/dxos/halo/credentials");
1196
1398
  var import_timeframe3 = require("@dxos/timeframe");
1197
1399
  var import_util5 = require("@dxos/util");
1198
- var __dxlog_file8 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
1400
+ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
1199
1401
  var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 500;
1200
1402
  var ControlPipeline = class {
1201
1403
  constructor({ spaceKey, genesisFeed, feedProvider, metadataStore }) {
@@ -1210,7 +1412,7 @@ var ControlPipeline = class {
1210
1412
  (0, import_log8.log)("feed admitted", {
1211
1413
  key: info.key
1212
1414
  }, {
1213
- F: __dxlog_file8,
1415
+ F: __dxlog_file9,
1214
1416
  L: 51,
1215
1417
  S: this,
1216
1418
  C: (f, a) => f(...a)
@@ -1221,7 +1423,7 @@ var ControlPipeline = class {
1221
1423
  await this._pipeline.addFeed(feed);
1222
1424
  } catch (err) {
1223
1425
  import_log8.log.catch(err, void 0, {
1224
- F: __dxlog_file8,
1426
+ F: __dxlog_file9,
1225
1427
  L: 59,
1226
1428
  S: this,
1227
1429
  C: (f, a) => f(...a)
@@ -1244,7 +1446,7 @@ var ControlPipeline = class {
1244
1446
  }
1245
1447
  async start() {
1246
1448
  (0, import_log8.log)("starting...", void 0, {
1247
- F: __dxlog_file8,
1449
+ F: __dxlog_file9,
1248
1450
  L: 83,
1249
1451
  S: this,
1250
1452
  C: (f, a) => f(...a)
@@ -1256,7 +1458,7 @@ var ControlPipeline = class {
1256
1458
  key: msg.feedKey,
1257
1459
  seq: msg.seq
1258
1460
  }, {
1259
- F: __dxlog_file8,
1461
+ F: __dxlog_file9,
1260
1462
  L: 88,
1261
1463
  S: this,
1262
1464
  C: (f, a) => f(...a)
@@ -1269,7 +1471,7 @@ var ControlPipeline = class {
1269
1471
  import_log8.log.warn("processing failed", {
1270
1472
  msg
1271
1473
  }, {
1272
- F: __dxlog_file8,
1474
+ F: __dxlog_file9,
1273
1475
  L: 98,
1274
1476
  S: this,
1275
1477
  C: (f, a) => f(...a)
@@ -1280,7 +1482,7 @@ var ControlPipeline = class {
1280
1482
  }
1281
1483
  } catch (err) {
1282
1484
  import_log8.log.catch(err, void 0, {
1283
- F: __dxlog_file8,
1485
+ F: __dxlog_file9,
1284
1486
  L: 104,
1285
1487
  S: this,
1286
1488
  C: (f, a) => f(...a)
@@ -1290,7 +1492,7 @@ var ControlPipeline = class {
1290
1492
  });
1291
1493
  await this._pipeline.start();
1292
1494
  (0, import_log8.log)("started", void 0, {
1293
- F: __dxlog_file8,
1495
+ F: __dxlog_file9,
1294
1496
  L: 110,
1295
1497
  S: this,
1296
1498
  C: (f, a) => f(...a)
@@ -1304,7 +1506,7 @@ var ControlPipeline = class {
1304
1506
  }
1305
1507
  async stop() {
1306
1508
  (0, import_log8.log)("stopping...", void 0, {
1307
- F: __dxlog_file8,
1509
+ F: __dxlog_file9,
1308
1510
  L: 124,
1309
1511
  S: this,
1310
1512
  C: (f, a) => f(...a)
@@ -1312,7 +1514,7 @@ var ControlPipeline = class {
1312
1514
  await this._pipeline.stop();
1313
1515
  await this._saveTargetTimeframe(this._pipeline.state.timeframe);
1314
1516
  (0, import_log8.log)("stopped", void 0, {
1315
- F: __dxlog_file8,
1517
+ F: __dxlog_file9,
1316
1518
  L: 127,
1317
1519
  S: this,
1318
1520
  C: (f, a) => f(...a)
@@ -1326,7 +1528,7 @@ var ControlPipeline = class {
1326
1528
  this._targetTimeframe = newTimeframe;
1327
1529
  } catch (err) {
1328
1530
  (0, import_log8.log)(err, void 0, {
1329
- F: __dxlog_file8,
1531
+ F: __dxlog_file9,
1330
1532
  L: 136,
1331
1533
  S: this,
1332
1534
  C: (f, a) => f(...a)
@@ -1336,12 +1538,12 @@ var ControlPipeline = class {
1336
1538
  };
1337
1539
 
1338
1540
  // packages/core/echo/echo-pipeline/src/space/data-pipeline.ts
1339
- var import_tiny_invariant8 = __toESM(require("tiny-invariant"));
1340
1541
  var import_async6 = require("@dxos/async");
1341
1542
  var import_context5 = require("@dxos/context");
1342
1543
  var import_credentials3 = require("@dxos/credentials");
1343
1544
  var import_echo_db3 = require("@dxos/echo-db");
1344
1545
  var import_errors2 = require("@dxos/errors");
1546
+ var import_invariant8 = require("@dxos/invariant");
1345
1547
  var import_log9 = require("@dxos/log");
1346
1548
  var import_timeframe4 = require("@dxos/timeframe");
1347
1549
  var import_util6 = require("@dxos/util");
@@ -1355,7 +1557,7 @@ function _ts_decorate5(decorators, target, key, desc) {
1355
1557
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1356
1558
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1357
1559
  }
1358
- var __dxlog_file9 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/data-pipeline.ts";
1560
+ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/data-pipeline.ts";
1359
1561
  var MESSAGES_PER_SNAPSHOT = 10;
1360
1562
  var AUTOMATIC_SNAPSHOT_DEBOUNCE_INTERVAL = 5e3;
1361
1563
  var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL2 = 500;
@@ -1411,8 +1613,24 @@ var DataPipeline = class DataPipeline2 {
1411
1613
  }
1412
1614
  const feedWriter = {
1413
1615
  write: (data, options) => {
1414
- (0, import_tiny_invariant8.default)(this._pipeline, "Pipeline is not initialized.");
1415
- (0, import_tiny_invariant8.default)(this.currentEpoch, "Epoch is not initialized.");
1616
+ (0, import_invariant8.invariant)(this._pipeline, "Pipeline is not initialized.", {
1617
+ F: __dxlog_file10,
1618
+ L: 145,
1619
+ S: this,
1620
+ A: [
1621
+ "this._pipeline",
1622
+ "'Pipeline is not initialized.'"
1623
+ ]
1624
+ });
1625
+ (0, import_invariant8.invariant)(this.currentEpoch, "Epoch is not initialized.", {
1626
+ F: __dxlog_file10,
1627
+ L: 146,
1628
+ S: this,
1629
+ A: [
1630
+ "this.currentEpoch",
1631
+ "'Epoch is not initialized.'"
1632
+ ]
1633
+ });
1416
1634
  return this._pipeline.writer.write({
1417
1635
  data
1418
1636
  }, options);
@@ -1432,8 +1650,8 @@ var DataPipeline = class DataPipeline2 {
1432
1650
  return;
1433
1651
  }
1434
1652
  (0, import_log9.log)("close", void 0, {
1435
- F: __dxlog_file9,
1436
- L: 171,
1653
+ F: __dxlog_file10,
1654
+ L: 170,
1437
1655
  S: this,
1438
1656
  C: (f, a) => f(...a)
1439
1657
  });
@@ -1447,8 +1665,8 @@ var DataPipeline = class DataPipeline2 {
1447
1665
  }
1448
1666
  } catch (err) {
1449
1667
  import_log9.log.catch(err, void 0, {
1450
- F: __dxlog_file9,
1451
- L: 184,
1668
+ F: __dxlog_file10,
1669
+ L: 183,
1452
1670
  S: this,
1453
1671
  C: (f, a) => f(...a)
1454
1672
  });
@@ -1470,15 +1688,23 @@ var DataPipeline = class DataPipeline2 {
1470
1688
  await this._processEpochInSeparateTask(this.currentEpoch);
1471
1689
  await waitForOneEpoch;
1472
1690
  }
1473
- (0, import_tiny_invariant8.default)(this._pipeline, "Pipeline is not initialized.");
1691
+ (0, import_invariant8.invariant)(this._pipeline, "Pipeline is not initialized.", {
1692
+ F: __dxlog_file10,
1693
+ L: 206,
1694
+ S: this,
1695
+ A: [
1696
+ "this._pipeline",
1697
+ "'Pipeline is not initialized.'"
1698
+ ]
1699
+ });
1474
1700
  for await (const msg of this._pipeline.consume()) {
1475
1701
  const { feedKey, seq, data } = msg;
1476
1702
  (0, import_log9.log)("processing message", {
1477
1703
  feedKey,
1478
1704
  seq
1479
1705
  }, {
1480
- F: __dxlog_file9,
1481
- L: 210,
1706
+ F: __dxlog_file10,
1707
+ L: 209,
1482
1708
  S: this,
1483
1709
  C: (f, a) => f(...a)
1484
1710
  });
@@ -1489,8 +1715,8 @@ var DataPipeline = class DataPipeline2 {
1489
1715
  import_log9.log.warn("Could not find feed", {
1490
1716
  feedKey
1491
1717
  }, {
1492
- F: __dxlog_file9,
1493
- L: 216,
1718
+ F: __dxlog_file10,
1719
+ L: 215,
1494
1720
  S: this,
1495
1721
  C: (f, a) => f(...a)
1496
1722
  });
@@ -1512,8 +1738,8 @@ var DataPipeline = class DataPipeline2 {
1512
1738
  seq,
1513
1739
  spaceKey: this._params.spaceKey.toHex()
1514
1740
  }, {
1515
- F: __dxlog_file9,
1516
- L: 233,
1741
+ F: __dxlog_file10,
1742
+ L: 232,
1517
1743
  S: this,
1518
1744
  C: (f, a) => f(...a)
1519
1745
  });
@@ -1521,8 +1747,8 @@ var DataPipeline = class DataPipeline2 {
1521
1747
  }
1522
1748
  } catch (err) {
1523
1749
  import_log9.log.catch(err, void 0, {
1524
- F: __dxlog_file9,
1525
- L: 243,
1750
+ F: __dxlog_file10,
1751
+ L: 242,
1526
1752
  S: this,
1527
1753
  C: (f, a) => f(...a)
1528
1754
  });
@@ -1530,7 +1756,15 @@ var DataPipeline = class DataPipeline2 {
1530
1756
  }
1531
1757
  }
1532
1758
  _createSnapshot() {
1533
- (0, import_tiny_invariant8.default)(this.databaseHost, "Database backend is not initialized.");
1759
+ (0, import_invariant8.invariant)(this.databaseHost, "Database backend is not initialized.", {
1760
+ F: __dxlog_file10,
1761
+ L: 248,
1762
+ S: this,
1763
+ A: [
1764
+ "this.databaseHost",
1765
+ "'Database backend is not initialized.'"
1766
+ ]
1767
+ });
1534
1768
  return {
1535
1769
  spaceKey: this._params.spaceKey.asUint8Array(),
1536
1770
  timeframe: this._pipeline.state.timeframe,
@@ -1556,8 +1790,8 @@ var DataPipeline = class DataPipeline2 {
1556
1790
  }
1557
1791
  } catch (err) {
1558
1792
  import_log9.log.warn("Failed to cache properties", err, {
1559
- F: __dxlog_file9,
1560
- L: 278,
1793
+ F: __dxlog_file10,
1794
+ L: 277,
1561
1795
  S: this,
1562
1796
  C: (f, a) => f(...a)
1563
1797
  });
@@ -1583,15 +1817,15 @@ var DataPipeline = class DataPipeline2 {
1583
1817
  onError: (err) => {
1584
1818
  if (err instanceof import_errors2.CancelledError) {
1585
1819
  (0, import_log9.log)("Epoch processing cancelled.", void 0, {
1586
- F: __dxlog_file9,
1587
- L: 310,
1820
+ F: __dxlog_file10,
1821
+ L: 309,
1588
1822
  S: this,
1589
1823
  C: (f, a) => f(...a)
1590
1824
  });
1591
1825
  } else {
1592
1826
  import_log9.log.catch(err, void 0, {
1593
- F: __dxlog_file9,
1594
- L: 312,
1827
+ F: __dxlog_file10,
1828
+ L: 311,
1595
1829
  S: this,
1596
1830
  C: (f, a) => f(...a)
1597
1831
  });
@@ -1606,8 +1840,8 @@ var DataPipeline = class DataPipeline2 {
1606
1840
  (0, import_log9.log)("process epoch", {
1607
1841
  epoch
1608
1842
  }, {
1609
- F: __dxlog_file9,
1610
- L: 322,
1843
+ F: __dxlog_file10,
1844
+ L: 321,
1611
1845
  S: this,
1612
1846
  C: (f, a) => f(...a)
1613
1847
  });
@@ -1617,14 +1851,30 @@ var DataPipeline = class DataPipeline2 {
1617
1851
  });
1618
1852
  }
1619
1853
  async _processEpoch(ctx, epoch) {
1620
- (0, import_tiny_invariant8.default)(this._isOpen, "Space is closed.");
1621
- (0, import_tiny_invariant8.default)(this._pipeline);
1854
+ (0, import_invariant8.invariant)(this._isOpen, "Space is closed.", {
1855
+ F: __dxlog_file10,
1856
+ L: 331,
1857
+ S: this,
1858
+ A: [
1859
+ "this._isOpen",
1860
+ "'Space is closed.'"
1861
+ ]
1862
+ });
1863
+ (0, import_invariant8.invariant)(this._pipeline, void 0, {
1864
+ F: __dxlog_file10,
1865
+ L: 332,
1866
+ S: this,
1867
+ A: [
1868
+ "this._pipeline",
1869
+ ""
1870
+ ]
1871
+ });
1622
1872
  this._lastProcessedEpoch = epoch.number;
1623
1873
  (0, import_log9.log)("Processing epoch", {
1624
1874
  epoch
1625
1875
  }, {
1626
- F: __dxlog_file9,
1627
- L: 336,
1876
+ F: __dxlog_file10,
1877
+ L: 335,
1628
1878
  S: this,
1629
1879
  C: (f, a) => f(...a)
1630
1880
  });
@@ -1633,8 +1883,8 @@ var DataPipeline = class DataPipeline2 {
1633
1883
  this.databaseHost._itemDemuxer.restoreFromSnapshot(snapshot.database);
1634
1884
  }
1635
1885
  (0, import_log9.log)("restarting pipeline for epoch", void 0, {
1636
- F: __dxlog_file9,
1637
- L: 344,
1886
+ F: __dxlog_file10,
1887
+ L: 343,
1638
1888
  S: this,
1639
1889
  C: (f, a) => f(...a)
1640
1890
  });
@@ -1643,12 +1893,36 @@ var DataPipeline = class DataPipeline2 {
1643
1893
  await this._pipeline.unpause();
1644
1894
  }
1645
1895
  async waitUntilTimeframe(timeframe) {
1646
- (0, import_tiny_invariant8.default)(this._pipeline, "Pipeline is not initialized.");
1896
+ (0, import_invariant8.invariant)(this._pipeline, "Pipeline is not initialized.", {
1897
+ F: __dxlog_file10,
1898
+ L: 351,
1899
+ S: this,
1900
+ A: [
1901
+ "this._pipeline",
1902
+ "'Pipeline is not initialized.'"
1903
+ ]
1904
+ });
1647
1905
  await this._pipeline.state.waitUntilTimeframe(timeframe);
1648
1906
  }
1649
1907
  async createEpoch() {
1650
- (0, import_tiny_invariant8.default)(this._pipeline);
1651
- (0, import_tiny_invariant8.default)(this.currentEpoch);
1908
+ (0, import_invariant8.invariant)(this._pipeline, void 0, {
1909
+ F: __dxlog_file10,
1910
+ L: 357,
1911
+ S: this,
1912
+ A: [
1913
+ "this._pipeline",
1914
+ ""
1915
+ ]
1916
+ });
1917
+ (0, import_invariant8.invariant)(this.currentEpoch, void 0, {
1918
+ F: __dxlog_file10,
1919
+ L: 358,
1920
+ S: this,
1921
+ A: [
1922
+ "this.currentEpoch",
1923
+ ""
1924
+ ]
1925
+ });
1652
1926
  await this._pipeline.pause();
1653
1927
  const snapshot = await this._createSnapshot();
1654
1928
  const snapshotCid = await this._params.snapshotManager.store(snapshot);
@@ -1692,14 +1966,22 @@ function _ts_decorate6(decorators, target, key, desc) {
1692
1966
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1693
1967
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1694
1968
  }
1695
- var __dxlog_file10 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/space.ts";
1969
+ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
1696
1970
  var Space = class Space2 {
1697
1971
  constructor(params) {
1698
1972
  this._addFeedLock = new import_async7.Lock();
1699
1973
  this.onCredentialProcessed = new import_util7.Callback();
1700
1974
  this.stateUpdate = new import_async7.Event();
1701
1975
  this._isOpen = false;
1702
- (0, import_tiny_invariant9.default)(params.spaceKey && params.feedProvider);
1976
+ (0, import_invariant9.invariant)(params.spaceKey && params.feedProvider, void 0, {
1977
+ F: __dxlog_file11,
1978
+ L: 73,
1979
+ S: this,
1980
+ A: [
1981
+ "params.spaceKey && params.feedProvider",
1982
+ ""
1983
+ ]
1984
+ });
1703
1985
  this._key = params.spaceKey;
1704
1986
  this._genesisFeedKey = params.genesisFeed.key;
1705
1987
  this._feedProvider = params.feedProvider;
@@ -1734,8 +2016,8 @@ var Space = class Space2 {
1734
2016
  (0, import_log10.log)("onCredentialProcessed", {
1735
2017
  credential
1736
2018
  }, {
1737
- F: __dxlog_file10,
1738
- L: 107,
2019
+ F: __dxlog_file11,
2020
+ L: 109,
1739
2021
  S: this,
1740
2022
  C: (f, a) => f(...a)
1741
2023
  });
@@ -1800,14 +2082,30 @@ var Space = class Space2 {
1800
2082
  return this._snapshotManager;
1801
2083
  }
1802
2084
  setControlFeed(feed) {
1803
- (0, import_tiny_invariant9.default)(!this._controlFeed, "Control feed already set.");
2085
+ (0, import_invariant9.invariant)(!this._controlFeed, "Control feed already set.", {
2086
+ F: __dxlog_file11,
2087
+ L: 183,
2088
+ S: this,
2089
+ A: [
2090
+ "!this._controlFeed",
2091
+ "'Control feed already set.'"
2092
+ ]
2093
+ });
1804
2094
  this._controlFeed = feed;
1805
2095
  this._controlPipeline.setWriteFeed(feed);
1806
2096
  return this;
1807
2097
  }
1808
2098
  setDataFeed(feed) {
1809
2099
  var _a;
1810
- (0, import_tiny_invariant9.default)(!this._dataFeed, "Data feed already set.");
2100
+ (0, import_invariant9.invariant)(!this._dataFeed, "Data feed already set.", {
2101
+ F: __dxlog_file11,
2102
+ L: 190,
2103
+ S: this,
2104
+ A: [
2105
+ "!this._dataFeed",
2106
+ "'Data feed already set.'"
2107
+ ]
2108
+ });
1811
2109
  this._dataFeed = feed;
1812
2110
  (_a = this._dataPipeline.pipeline) == null ? void 0 : _a.setWriteFeed(feed);
1813
2111
  return this;
@@ -1824,10 +2122,10 @@ var Space = class Space2 {
1824
2122
  // getDataFeeds(): FeedInfo[] {
1825
2123
  // return this._dataPipeline?.getFeeds();
1826
2124
  // }
1827
- async open() {
2125
+ async open(ctx) {
1828
2126
  (0, import_log10.log)("opening...", void 0, {
1829
- F: __dxlog_file10,
1830
- L: 209,
2127
+ F: __dxlog_file11,
2128
+ L: 212,
1831
2129
  S: this,
1832
2130
  C: (f, a) => f(...a)
1833
2131
  });
@@ -1839,8 +2137,8 @@ var Space = class Space2 {
1839
2137
  await this._controlPipeline.spaceState.addCredentialProcessor(this._dataPipeline);
1840
2138
  this._isOpen = true;
1841
2139
  (0, import_log10.log)("opened", void 0, {
1842
- F: __dxlog_file10,
1843
- L: 220,
2140
+ F: __dxlog_file11,
2141
+ L: 223,
1844
2142
  S: this,
1845
2143
  C: (f, a) => f(...a)
1846
2144
  });
@@ -1849,8 +2147,8 @@ var Space = class Space2 {
1849
2147
  (0, import_log10.log)("closing...", {
1850
2148
  key: this._key
1851
2149
  }, {
1852
- F: __dxlog_file10,
1853
- L: 225,
2150
+ F: __dxlog_file11,
2151
+ L: 228,
1854
2152
  S: this,
1855
2153
  C: (f, a) => f(...a)
1856
2154
  });
@@ -1863,20 +2161,28 @@ var Space = class Space2 {
1863
2161
  await this._controlPipeline.stop();
1864
2162
  this._isOpen = false;
1865
2163
  (0, import_log10.log)("closed", void 0, {
1866
- F: __dxlog_file10,
1867
- L: 238,
2164
+ F: __dxlog_file11,
2165
+ L: 241,
1868
2166
  S: this,
1869
2167
  C: (f, a) => f(...a)
1870
2168
  });
1871
2169
  }
1872
2170
  async initializeDataPipeline() {
1873
2171
  (0, import_log10.log)("initializeDataPipeline", void 0, {
1874
- F: __dxlog_file10,
1875
- L: 243,
2172
+ F: __dxlog_file11,
2173
+ L: 246,
1876
2174
  S: this,
1877
2175
  C: (f, a) => f(...a)
1878
2176
  });
1879
- (0, import_tiny_invariant9.default)(this._isOpen, "Space must be open to initialize data pipeline.");
2177
+ (0, import_invariant9.invariant)(this._isOpen, "Space must be open to initialize data pipeline.", {
2178
+ F: __dxlog_file11,
2179
+ L: 247,
2180
+ S: this,
2181
+ A: [
2182
+ "this._isOpen",
2183
+ "'Space must be open to initialize data pipeline.'"
2184
+ ]
2185
+ });
1880
2186
  await this._dataPipeline.open();
1881
2187
  }
1882
2188
  };
@@ -1884,7 +2190,8 @@ _ts_decorate6([
1884
2190
  import_log10.logInfo
1885
2191
  ], Space.prototype, "key", null);
1886
2192
  _ts_decorate6([
1887
- import_async7.synchronized
2193
+ import_async7.synchronized,
2194
+ import_tracing.trace.span()
1888
2195
  ], Space.prototype, "open", null);
1889
2196
  _ts_decorate6([
1890
2197
  import_async7.synchronized
@@ -1893,7 +2200,8 @@ _ts_decorate6([
1893
2200
  import_async7.synchronized
1894
2201
  ], Space.prototype, "initializeDataPipeline", null);
1895
2202
  Space = _ts_decorate6([
1896
- (0, import_async7.trackLeaks)("open", "close")
2203
+ (0, import_async7.trackLeaks)("open", "close"),
2204
+ import_tracing.trace.resource()
1897
2205
  ], Space);
1898
2206
 
1899
2207
  // packages/core/echo/echo-pipeline/src/space/space-manager.ts
@@ -1923,7 +2231,7 @@ function _ts_decorate7(decorators, target, key, desc) {
1923
2231
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1924
2232
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1925
2233
  }
1926
- var __dxlog_file11 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
2234
+ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
1927
2235
  var MOCK_AUTH_PROVIDER = async (nonce) => Buffer.from("mock");
1928
2236
  var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
1929
2237
  var SpaceProtocol = class {
@@ -1953,7 +2261,7 @@ var SpaceProtocol = class {
1953
2261
  (0, import_log11.log)("addFeed", {
1954
2262
  key: feed.key
1955
2263
  }, {
1956
- F: __dxlog_file11,
2264
+ F: __dxlog_file12,
1957
2265
  L: 95,
1958
2266
  S: this,
1959
2267
  C: (f, a) => f(...a)
@@ -1975,21 +2283,22 @@ var SpaceProtocol = class {
1975
2283
  };
1976
2284
  await this.blobSync.open();
1977
2285
  (0, import_log11.log)("starting...", void 0, {
1978
- F: __dxlog_file11,
2286
+ F: __dxlog_file12,
1979
2287
  L: 120,
1980
2288
  S: this,
1981
2289
  C: (f, a) => f(...a)
1982
2290
  });
2291
+ const topic = await this._topic;
1983
2292
  this._connection = await this._networkManager.joinSwarm({
1984
2293
  protocolProvider: this._createProtocolProvider(credentials),
1985
2294
  peerId: this._swarmIdentity.peerKey,
1986
- topic: await this._topic,
2295
+ topic,
1987
2296
  topology: new import_network_manager.MMSTTopology(topologyConfig),
1988
- label: `Protocol swarm: ${this._topic}`
2297
+ label: `Protocol swarm: ${topic}`
1989
2298
  });
1990
2299
  (0, import_log11.log)("started", void 0, {
1991
- F: __dxlog_file11,
1992
- L: 129,
2300
+ F: __dxlog_file12,
2301
+ L: 130,
1993
2302
  S: this,
1994
2303
  C: (f, a) => f(...a)
1995
2304
  });
@@ -1998,15 +2307,15 @@ var SpaceProtocol = class {
1998
2307
  await this.blobSync.close();
1999
2308
  if (this._connection) {
2000
2309
  (0, import_log11.log)("stopping...", void 0, {
2001
- F: __dxlog_file11,
2002
- L: 136,
2310
+ F: __dxlog_file12,
2311
+ L: 137,
2003
2312
  S: this,
2004
2313
  C: (f, a) => f(...a)
2005
2314
  });
2006
2315
  await this._connection.close();
2007
2316
  (0, import_log11.log)("stopped", void 0, {
2008
- F: __dxlog_file11,
2009
- L: 138,
2317
+ F: __dxlog_file12,
2318
+ L: 139,
2010
2319
  S: this,
2011
2320
  C: (f, a) => f(...a)
2012
2321
  });
@@ -2073,8 +2382,8 @@ var SpaceProtocolSession = class {
2073
2382
  onAuthSuccess: () => {
2074
2383
  var _a;
2075
2384
  (0, import_log11.log)("Peer authenticated", void 0, {
2076
- F: __dxlog_file11,
2077
- L: 235,
2385
+ F: __dxlog_file12,
2386
+ L: 236,
2078
2387
  S: this,
2079
2388
  C: (f, a) => f(...a)
2080
2389
  });
@@ -2112,7 +2421,7 @@ function _ts_decorate8(decorators, target, key, desc) {
2112
2421
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2113
2422
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2114
2423
  }
2115
- var __dxlog_file12 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
2424
+ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
2116
2425
  var SpaceManager = class SpaceManager2 {
2117
2426
  constructor({ feedStore, networkManager, modelFactory, metadataStore, snapshotStore, blobStore }) {
2118
2427
  this._spaces = new import_util9.ComplexMap(import_keys6.PublicKey.hash);
@@ -2140,7 +2449,7 @@ var SpaceManager = class SpaceManager2 {
2140
2449
  import_log12.log.trace("dxos.echo.space-manager.construct-space", import_protocols6.trace.begin({
2141
2450
  id: this._instanceId
2142
2451
  }), {
2143
- F: __dxlog_file12,
2452
+ F: __dxlog_file13,
2144
2453
  L: 97,
2145
2454
  S: this,
2146
2455
  C: (f, a) => f(...a)
@@ -2148,7 +2457,7 @@ var SpaceManager = class SpaceManager2 {
2148
2457
  (0, import_log12.log)("constructing space...", {
2149
2458
  spaceKey: metadata.genesisFeedKey
2150
2459
  }, {
2151
- F: __dxlog_file12,
2460
+ F: __dxlog_file13,
2152
2461
  L: 98,
2153
2462
  S: this,
2154
2463
  C: (f, a) => f(...a)
@@ -2178,7 +2487,7 @@ var SpaceManager = class SpaceManager2 {
2178
2487
  import_log12.log.trace("dxos.echo.space-manager.construct-space", import_protocols6.trace.end({
2179
2488
  id: this._instanceId
2180
2489
  }), {
2181
- F: __dxlog_file12,
2490
+ F: __dxlog_file13,
2182
2491
  L: 125,
2183
2492
  S: this,
2184
2493
  C: (f, a) => f(...a)