@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
@@ -7,23 +7,40 @@ var codec = schema.getCodecForType("dxos.echo.feed.FeedMessage");
7
7
  var valueEncoding = createCodecEncoding(codec);
8
8
 
9
9
  // packages/core/echo/echo-pipeline/src/common/feeds.ts
10
- import invariant from "tiny-invariant";
10
+ import { invariant } from "@dxos/invariant";
11
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/common/feeds.ts";
11
12
  var createMappedFeedWriter = (mapper, writer) => {
12
- invariant(mapper);
13
- invariant(writer);
13
+ invariant(mapper, void 0, {
14
+ F: __dxlog_file,
15
+ L: 16,
16
+ S: void 0,
17
+ A: [
18
+ "mapper",
19
+ ""
20
+ ]
21
+ });
22
+ invariant(writer, void 0, {
23
+ F: __dxlog_file,
24
+ L: 17,
25
+ S: void 0,
26
+ A: [
27
+ "writer",
28
+ ""
29
+ ]
30
+ });
14
31
  return {
15
32
  write: async (data, options) => await writer.write(await mapper(data), options)
16
33
  };
17
34
  };
18
35
 
19
36
  // packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts
20
- import invariant2 from "tiny-invariant";
21
37
  import { Stream } from "@dxos/codec-protobuf";
22
38
  import { Context } from "@dxos/context";
23
39
  import { tagMutationsInBatch, setMetadataOnObject } from "@dxos/echo-db";
40
+ import { invariant as invariant2 } from "@dxos/invariant";
24
41
  import { log } from "@dxos/log";
25
42
  import { ComplexMap } from "@dxos/util";
26
- var __dxlog_file = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts";
43
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts";
27
44
  var DataServiceHost = class {
28
45
  constructor(_itemManager, _itemDemuxer, _writeStream) {
29
46
  this._itemManager = _itemManager;
@@ -52,13 +69,21 @@ var DataServiceHost = class {
52
69
  this._itemDemuxer.mutation.on(ctx, (message) => {
53
70
  var _a;
54
71
  const { batch, meta } = message;
55
- invariant2(!meta.clientTag, "Unexpected client tag in mutation message");
72
+ invariant2(!meta.clientTag, "Unexpected client tag in mutation message", {
73
+ F: __dxlog_file2,
74
+ L: 61,
75
+ S: this,
76
+ A: [
77
+ "!(meta as any).clientTag",
78
+ "'Unexpected client tag in mutation message'"
79
+ ]
80
+ });
56
81
  log("message", {
57
82
  batch,
58
83
  meta
59
84
  }, {
60
- F: __dxlog_file,
61
- L: 63,
85
+ F: __dxlog_file2,
86
+ L: 62,
62
87
  S: this,
63
88
  C: (f, a) => f(...a)
64
89
  });
@@ -85,14 +110,30 @@ var DataServiceHost = class {
85
110
  }
86
111
  async write(request) {
87
112
  var _a, _b;
88
- invariant2(!this._ctx.disposed, "Cannot write to closed DataServiceHost");
89
- invariant2(this._writeStream, "Cannot write mutations in readonly mode");
113
+ invariant2(!this._ctx.disposed, "Cannot write to closed DataServiceHost", {
114
+ F: __dxlog_file2,
115
+ L: 88,
116
+ S: this,
117
+ A: [
118
+ "!this._ctx.disposed",
119
+ "'Cannot write to closed DataServiceHost'"
120
+ ]
121
+ });
122
+ invariant2(this._writeStream, "Cannot write mutations in readonly mode", {
123
+ F: __dxlog_file2,
124
+ L: 89,
125
+ S: this,
126
+ A: [
127
+ "this._writeStream",
128
+ "'Cannot write mutations in readonly mode'"
129
+ ]
130
+ });
90
131
  log("write", {
91
132
  clientTag: request.clientTag,
92
133
  objectCount: (_b = (_a = request.batch.objects) == null ? void 0 : _a.length) != null ? _b : 0
93
134
  }, {
94
- F: __dxlog_file,
95
- L: 92,
135
+ F: __dxlog_file2,
136
+ L: 91,
96
137
  S: this,
97
138
  C: (f, a) => f(...a)
98
139
  });
@@ -105,8 +146,8 @@ var DataServiceHost = class {
105
146
  feedKey: receipt2.feedKey,
106
147
  seq: receipt2.seq
107
148
  }, {
108
- F: __dxlog_file,
109
- L: 101,
149
+ F: __dxlog_file2,
150
+ L: 100,
110
151
  S: this,
111
152
  C: (f, a) => f(...a)
112
153
  });
@@ -273,12 +314,12 @@ var SnapshotStore = class {
273
314
  };
274
315
 
275
316
  // packages/core/echo/echo-pipeline/src/db-host/data-service.ts
276
- import invariant3 from "tiny-invariant";
277
317
  import { raise } from "@dxos/debug";
318
+ import { invariant as invariant3 } from "@dxos/invariant";
278
319
  import { PublicKey as PublicKey2 } from "@dxos/keys";
279
320
  import { log as log2 } from "@dxos/log";
280
321
  import { ComplexMap as ComplexMap2 } from "@dxos/util";
281
- var __dxlog_file2 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/db-host/data-service.ts";
322
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/data-service.ts";
282
323
  var DataServiceSubscriptions = class {
283
324
  constructor() {
284
325
  this._spaces = new ComplexMap2(PublicKey2.hash);
@@ -290,12 +331,20 @@ var DataServiceSubscriptions = class {
290
331
  log2("Registering space", {
291
332
  spaceKey
292
333
  }, {
293
- F: __dxlog_file2,
294
- L: 31,
334
+ F: __dxlog_file3,
335
+ L: 30,
295
336
  S: this,
296
337
  C: (f, a) => f(...a)
297
338
  });
298
- invariant3(!this._spaces.has(spaceKey));
339
+ invariant3(!this._spaces.has(spaceKey), void 0, {
340
+ F: __dxlog_file3,
341
+ L: 31,
342
+ S: this,
343
+ A: [
344
+ "!this._spaces.has(spaceKey)",
345
+ ""
346
+ ]
347
+ });
299
348
  await host.open();
300
349
  this._spaces.set(spaceKey, host);
301
350
  }
@@ -303,8 +352,8 @@ var DataServiceSubscriptions = class {
303
352
  log2("Unregistering space", {
304
353
  spaceKey
305
354
  }, {
306
- F: __dxlog_file2,
307
- L: 38,
355
+ F: __dxlog_file3,
356
+ L: 37,
308
357
  S: this,
309
358
  C: (f, a) => f(...a)
310
359
  });
@@ -322,14 +371,38 @@ var DataServiceImpl = class {
322
371
  }
323
372
  subscribe(request) {
324
373
  var _a;
325
- invariant3(request.spaceKey);
374
+ invariant3(request.spaceKey, void 0, {
375
+ F: __dxlog_file3,
376
+ L: 56,
377
+ S: this,
378
+ A: [
379
+ "request.spaceKey",
380
+ ""
381
+ ]
382
+ });
326
383
  const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : raise(new Error(`space not found: ${request.spaceKey}`));
327
384
  return host.subscribe();
328
385
  }
329
386
  write(request) {
330
387
  var _a;
331
- invariant3(request.spaceKey);
332
- invariant3(request.batch);
388
+ invariant3(request.spaceKey, void 0, {
389
+ F: __dxlog_file3,
390
+ L: 63,
391
+ S: this,
392
+ A: [
393
+ "request.spaceKey",
394
+ ""
395
+ ]
396
+ });
397
+ invariant3(request.batch, void 0, {
398
+ F: __dxlog_file3,
399
+ L: 64,
400
+ S: this,
401
+ A: [
402
+ "request.batch",
403
+ ""
404
+ ]
405
+ });
333
406
  const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : raise(new Error(`space not found: ${request.spaceKey}`));
334
407
  return host.write(request);
335
408
  }
@@ -337,9 +410,9 @@ var DataServiceImpl = class {
337
410
 
338
411
  // packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts
339
412
  import CRC32 from "crc-32";
340
- import invariant4 from "tiny-invariant";
341
413
  import { synchronized, Event } from "@dxos/async";
342
414
  import { DataCorruptionError } from "@dxos/errors";
415
+ import { invariant as invariant4 } from "@dxos/invariant";
343
416
  import { log as log3 } from "@dxos/log";
344
417
  import { STORAGE_VERSION, schema as schema4 } from "@dxos/protocols";
345
418
  import { SpaceState } from "@dxos/protocols/proto/dxos/client/services";
@@ -354,7 +427,7 @@ function _ts_decorate2(decorators, target, key, desc) {
354
427
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
355
428
  return c > 3 && r && Object.defineProperty(target, key, r), r;
356
429
  }
357
- var __dxlog_file3 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
430
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
358
431
  var emptyEchoMetadata = () => ({
359
432
  version: STORAGE_VERSION,
360
433
  spaces: [],
@@ -401,7 +474,7 @@ var MetadataStore = class {
401
474
  size: dataSize,
402
475
  checksum
403
476
  }, {
404
- F: __dxlog_file3,
477
+ F: __dxlog_file4,
405
478
  L: 72,
406
479
  S: this,
407
480
  C: (f, a) => f(...a)
@@ -423,7 +496,7 @@ var MetadataStore = class {
423
496
  log3.error("failed to load metadata", {
424
497
  err
425
498
  }, {
426
- F: __dxlog_file3,
499
+ F: __dxlog_file4,
427
500
  L: 92,
428
501
  S: this,
429
502
  C: (f, a) => f(...a)
@@ -455,7 +528,7 @@ var MetadataStore = class {
455
528
  size: encoded.length,
456
529
  checksum
457
530
  }, {
458
- F: __dxlog_file3,
531
+ F: __dxlog_file4,
459
532
  L: 124,
460
533
  S: this,
461
534
  C: (f, a) => f(...a)
@@ -470,7 +543,15 @@ var MetadataStore = class {
470
543
  return this._metadata.identity.haloSpace;
471
544
  }
472
545
  const space = this.spaces.find((space2) => space2.key === spaceKey);
473
- invariant4(space, "Space not found");
546
+ invariant4(space, "Space not found", {
547
+ F: __dxlog_file4,
548
+ L: 137,
549
+ S: this,
550
+ A: [
551
+ "space",
552
+ "'Space not found'"
553
+ ]
554
+ });
474
555
  return space;
475
556
  }
476
557
  /**
@@ -478,7 +559,7 @@ var MetadataStore = class {
478
559
  */
479
560
  async clear() {
480
561
  log3("clearing all metadata", void 0, {
481
- F: __dxlog_file3,
562
+ F: __dxlog_file4,
482
563
  L: 145,
483
564
  S: this,
484
565
  C: (f, a) => f(...a)
@@ -490,13 +571,29 @@ var MetadataStore = class {
490
571
  return this._metadata.identity;
491
572
  }
492
573
  async setIdentityRecord(record) {
493
- invariant4(!this._metadata.identity, "Cannot overwrite existing identity in metadata");
574
+ invariant4(!this._metadata.identity, "Cannot overwrite existing identity in metadata", {
575
+ F: __dxlog_file4,
576
+ L: 155,
577
+ S: this,
578
+ A: [
579
+ "!this._metadata.identity",
580
+ "'Cannot overwrite existing identity in metadata'"
581
+ ]
582
+ });
494
583
  this._metadata.identity = record;
495
584
  await this._save();
496
585
  }
497
586
  async addSpace(record) {
498
587
  var _a, _b, _c;
499
- invariant4(!((_a = this._metadata.spaces) != null ? _a : []).find((space) => space.key === record.key), "Cannot overwrite existing space in metadata");
588
+ invariant4(!((_a = this._metadata.spaces) != null ? _a : []).find((space) => space.key === record.key), "Cannot overwrite existing space in metadata", {
589
+ F: __dxlog_file4,
590
+ L: 162,
591
+ S: this,
592
+ A: [
593
+ "!(this._metadata.spaces ?? []).find((space) => space.key === record.key)",
594
+ "'Cannot overwrite existing space in metadata'"
595
+ ]
596
+ });
500
597
  ((_c = (_b = this._metadata).spaces) != null ? _c : _b.spaces = []).push(record);
501
598
  await this._save();
502
599
  }
@@ -546,7 +643,7 @@ function _ts_decorate3(decorators, target, key, desc) {
546
643
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
547
644
  return c > 3 && r && Object.defineProperty(target, key, r), r;
548
645
  }
549
- var __dxlog_file4 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
646
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
550
647
  var mapTimeframeToFeedIndexes = (timeframe) => timeframe.frames().map(([feedKey, index]) => ({
551
648
  feedKey,
552
649
  index
@@ -605,7 +702,7 @@ var TimeframeClock = class {
605
702
  target,
606
703
  current: this._timeframe
607
704
  }, {
608
- F: __dxlog_file4,
705
+ F: __dxlog_file5,
609
706
  L: 73,
610
707
  S: this,
611
708
  C: (f, a) => f(...a)
@@ -616,7 +713,7 @@ var TimeframeClock = class {
616
713
  current: this._timeframe,
617
714
  deps: Timeframe.dependencies(target, this._timeframe)
618
715
  }, {
619
- F: __dxlog_file4,
716
+ F: __dxlog_file5,
620
717
  L: 75,
621
718
  S: this,
622
719
  C: (f, a) => f(...a)
@@ -630,32 +727,40 @@ _ts_decorate3([
630
727
  ], TimeframeClock.prototype, "waitUntilReached", null);
631
728
 
632
729
  // packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts
633
- import invariant6 from "tiny-invariant";
634
730
  import { Event as Event3, sleep, synchronized as synchronized2, Trigger } from "@dxos/async";
635
731
  import { Context as Context2, rejectOnDispose } from "@dxos/context";
636
732
  import { failUndefined } from "@dxos/debug";
637
733
  import { FeedSetIterator } from "@dxos/feed-store";
734
+ import { invariant as invariant6 } from "@dxos/invariant";
638
735
  import { PublicKey as PublicKey3 } from "@dxos/keys";
639
736
  import { log as log6 } from "@dxos/log";
640
737
  import { Timeframe as Timeframe2 } from "@dxos/timeframe";
641
738
  import { ComplexMap as ComplexMap3 } from "@dxos/util";
642
739
 
643
740
  // packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts
644
- import invariant5 from "tiny-invariant";
741
+ import { invariant as invariant5 } from "@dxos/invariant";
645
742
  import { log as log5 } from "@dxos/log";
646
- var __dxlog_file5 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts";
743
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts";
647
744
  var createMessageSelector = (timeframeClock) => {
648
745
  return (messages) => {
649
746
  for (let i = 0; i < messages.length; i++) {
650
747
  const { data: { timeframe } } = messages[i];
651
- invariant5(timeframe);
748
+ invariant5(timeframe, void 0, {
749
+ F: __dxlog_file6,
750
+ L: 25,
751
+ S: void 0,
752
+ A: [
753
+ "timeframe",
754
+ ""
755
+ ]
756
+ });
652
757
  if (!timeframeClock.hasGaps(timeframe)) {
653
758
  return i;
654
759
  }
655
760
  }
656
761
  log5("Skipping...", void 0, {
657
- F: __dxlog_file5,
658
- L: 34,
762
+ F: __dxlog_file6,
763
+ L: 33,
659
764
  S: void 0,
660
765
  C: (f, a) => f(...a)
661
766
  });
@@ -673,7 +778,7 @@ function _ts_decorate4(decorators, target, key, desc) {
673
778
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
674
779
  return c > 3 && r && Object.defineProperty(target, key, r), r;
675
780
  }
676
- var __dxlog_file6 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
781
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
677
782
  var PipelineState = class {
678
783
  // prettier-ignore
679
784
  constructor(_feeds, _timeframeClock) {
@@ -730,8 +835,8 @@ var PipelineState = class {
730
835
  current: this.timeframe,
731
836
  target: this.targetTimeframe
732
837
  }, {
733
- F: __dxlog_file6,
734
- L: 126,
838
+ F: __dxlog_file7,
839
+ L: 125,
735
840
  S: this,
736
841
  C: (f, a) => f(...a)
737
842
  });
@@ -761,8 +866,8 @@ var PipelineState = class {
761
866
  target: this.targetTimeframe,
762
867
  dependencies: Timeframe2.dependencies(this.targetTimeframe, this.timeframe)
763
868
  }, {
764
- F: __dxlog_file6,
765
- L: 153,
869
+ F: __dxlog_file7,
870
+ L: 152,
766
871
  S: this,
767
872
  C: (f, a) => f(...a)
768
873
  });
@@ -791,7 +896,15 @@ var Pipeline = class {
791
896
  return this._state;
792
897
  }
793
898
  get writer() {
794
- invariant6(this._writer, "Writer not set.");
899
+ invariant6(this._writer, "Writer not set.", {
900
+ F: __dxlog_file7,
901
+ L: 230,
902
+ S: this,
903
+ A: [
904
+ "this._writer",
905
+ "'Writer not set.'"
906
+ ]
907
+ });
795
908
  return this._writer;
796
909
  }
797
910
  hasFeed(feedKey) {
@@ -810,8 +923,24 @@ var Pipeline = class {
810
923
  this._setFeedDownloadState(feed);
811
924
  }
812
925
  setWriteFeed(feed) {
813
- invariant6(!this._writer, "Writer already set.");
814
- invariant6(feed.properties.writable, "Feed must be writable.");
926
+ invariant6(!this._writer, "Writer already set.", {
927
+ F: __dxlog_file7,
928
+ L: 253,
929
+ S: this,
930
+ A: [
931
+ "!this._writer",
932
+ "'Writer already set.'"
933
+ ]
934
+ });
935
+ invariant6(feed.properties.writable, "Feed must be writable.", {
936
+ F: __dxlog_file7,
937
+ L: 254,
938
+ S: this,
939
+ A: [
940
+ "feed.properties.writable",
941
+ "'Feed must be writable.'"
942
+ ]
943
+ });
815
944
  this._writer = createMappedFeedWriter((payload) => ({
816
945
  timeframe: this._timeframeClock.timeframe,
817
946
  payload
@@ -819,8 +948,8 @@ var Pipeline = class {
819
948
  }
820
949
  async start() {
821
950
  log6("starting...", void 0, {
822
- F: __dxlog_file6,
823
- L: 268,
951
+ F: __dxlog_file7,
952
+ L: 267,
824
953
  S: this,
825
954
  C: (f, a) => f(...a)
826
955
  });
@@ -828,8 +957,8 @@ var Pipeline = class {
828
957
  await this._feedSetIterator.open();
829
958
  this._isStarted = true;
830
959
  log6("started", void 0, {
831
- F: __dxlog_file6,
832
- L: 272,
960
+ F: __dxlog_file7,
961
+ L: 271,
833
962
  S: this,
834
963
  C: (f, a) => f(...a)
835
964
  });
@@ -837,8 +966,8 @@ var Pipeline = class {
837
966
  async stop() {
838
967
  var _a;
839
968
  log6("stopping...", void 0, {
840
- F: __dxlog_file6,
841
- L: 277,
969
+ F: __dxlog_file7,
970
+ L: 276,
842
971
  S: this,
843
972
  C: (f, a) => f(...a)
844
973
  });
@@ -850,8 +979,8 @@ var Pipeline = class {
850
979
  this._state._reachedTargetPromise = void 0;
851
980
  this._isStarted = false;
852
981
  log6("stopped", void 0, {
853
- F: __dxlog_file6,
854
- L: 285,
982
+ F: __dxlog_file7,
983
+ L: 284,
855
984
  S: this,
856
985
  C: (f, a) => f(...a)
857
986
  });
@@ -861,7 +990,15 @@ var Pipeline = class {
861
990
  * The pipeline will start processing messages AFTER this timeframe.
862
991
  */
863
992
  async setCursor(timeframe) {
864
- invariant6(!this._isStarted || this._isPaused, "Invalid state.");
993
+ invariant6(!this._isStarted || this._isPaused, "Invalid state.", {
994
+ F: __dxlog_file7,
995
+ L: 293,
996
+ S: this,
997
+ A: [
998
+ "!this._isStarted || this._isPaused",
999
+ "'Invalid state.'"
1000
+ ]
1001
+ });
865
1002
  this._state._startTimeframe = timeframe;
866
1003
  this._timeframeClock.setTimeframe(timeframe);
867
1004
  for (const feed of this._feeds.values()) {
@@ -877,7 +1014,15 @@ var Pipeline = class {
877
1014
  * Calling pause while processing will cause a deadlock.
878
1015
  */
879
1016
  async pause() {
880
- invariant6(this._isStarted, "Pipeline is not open.");
1017
+ invariant6(this._isStarted, "Pipeline is not open.", {
1018
+ F: __dxlog_file7,
1019
+ L: 315,
1020
+ S: this,
1021
+ A: [
1022
+ "this._isStarted",
1023
+ "'Pipeline is not open.'"
1024
+ ]
1025
+ });
881
1026
  if (this._isPaused) {
882
1027
  return;
883
1028
  }
@@ -886,8 +1031,24 @@ var Pipeline = class {
886
1031
  this._isPaused = true;
887
1032
  }
888
1033
  async unpause() {
889
- invariant6(this._isStarted, "Pipeline is not open.");
890
- invariant6(this._isPaused, "Pipeline is not paused.");
1034
+ invariant6(this._isStarted, "Pipeline is not open.", {
1035
+ F: __dxlog_file7,
1036
+ L: 327,
1037
+ S: this,
1038
+ A: [
1039
+ "this._isStarted",
1040
+ "'Pipeline is not open.'"
1041
+ ]
1042
+ });
1043
+ invariant6(this._isPaused, "Pipeline is not paused.", {
1044
+ F: __dxlog_file7,
1045
+ L: 328,
1046
+ S: this,
1047
+ A: [
1048
+ "this._isPaused",
1049
+ "'Pipeline is not paused.'"
1050
+ ]
1051
+ });
891
1052
  this._pauseTrigger.wake();
892
1053
  this._isPaused = false;
893
1054
  }
@@ -896,15 +1057,39 @@ var Pipeline = class {
896
1057
  * Updates the timeframe clock after the message has bee processed.
897
1058
  */
898
1059
  async *consume() {
899
- invariant6(!this._isOpen, "Pipeline is already being consumed.");
1060
+ invariant6(!this._isOpen, "Pipeline is already being consumed.", {
1061
+ F: __dxlog_file7,
1062
+ L: 339,
1063
+ S: this,
1064
+ A: [
1065
+ "!this._isOpen",
1066
+ "'Pipeline is already being consumed.'"
1067
+ ]
1068
+ });
900
1069
  this._isOpen = true;
901
- invariant6(this._feedSetIterator, "Iterator not initialized.");
1070
+ invariant6(this._feedSetIterator, "Iterator not initialized.", {
1071
+ F: __dxlog_file7,
1072
+ L: 342,
1073
+ S: this,
1074
+ A: [
1075
+ "this._feedSetIterator",
1076
+ "'Iterator not initialized.'"
1077
+ ]
1078
+ });
902
1079
  let lastFeedSetIterator = this._feedSetIterator;
903
1080
  let iterable = lastFeedSetIterator[Symbol.asyncIterator]();
904
1081
  while (!this._isStopping) {
905
1082
  await this._pauseTrigger.wait();
906
1083
  if (lastFeedSetIterator !== this._feedSetIterator) {
907
- invariant6(this._feedSetIterator, "Iterator not initialized.");
1084
+ invariant6(this._feedSetIterator, "Iterator not initialized.", {
1085
+ F: __dxlog_file7,
1086
+ L: 351,
1087
+ S: this,
1088
+ A: [
1089
+ "this._feedSetIterator",
1090
+ "'Iterator not initialized.'"
1091
+ ]
1092
+ });
908
1093
  lastFeedSetIterator = this._feedSetIterator;
909
1094
  iterable = lastFeedSetIterator[Symbol.asyncIterator]();
910
1095
  }
@@ -926,8 +1111,8 @@ var Pipeline = class {
926
1111
  const seq = (_a = timeframe.get(feed.key)) != null ? _a : 0;
927
1112
  feed.undownload({
928
1113
  callback: () => log6("undownload", void 0, {
929
- F: __dxlog_file6,
930
- L: 376,
1114
+ F: __dxlog_file7,
1115
+ L: 375,
931
1116
  S: this,
932
1117
  C: (f, a) => f(...a)
933
1118
  })
@@ -939,8 +1124,8 @@ var Pipeline = class {
939
1124
  log6("failed to download feed", {
940
1125
  err
941
1126
  }, {
942
- F: __dxlog_file6,
943
- L: 378,
1127
+ F: __dxlog_file7,
1128
+ L: 377,
944
1129
  S: this,
945
1130
  C: (f, a) => f(...a)
946
1131
  });
@@ -953,8 +1138,8 @@ var Pipeline = class {
953
1138
  });
954
1139
  this._feedSetIterator.stalled.on((iterator) => {
955
1140
  log6.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, void 0, {
956
- F: __dxlog_file6,
957
- L: 389,
1141
+ F: __dxlog_file7,
1142
+ L: 388,
958
1143
  S: this,
959
1144
  C: (f, a) => f(...a)
960
1145
  });
@@ -982,14 +1167,14 @@ _ts_decorate4([
982
1167
  ], Pipeline.prototype, "unpause", null);
983
1168
 
984
1169
  // packages/core/echo/echo-pipeline/src/space/auth.ts
985
- import invariant7 from "tiny-invariant";
986
1170
  import { runInContext, scheduleTask } from "@dxos/async";
987
1171
  import { Context as Context3 } from "@dxos/context";
988
1172
  import { randomBytes } from "@dxos/crypto";
1173
+ import { invariant as invariant7 } from "@dxos/invariant";
989
1174
  import { log as log7 } from "@dxos/log";
990
1175
  import { schema as schema5 } from "@dxos/protocols";
991
1176
  import { RpcExtension } from "@dxos/teleport";
992
- var __dxlog_file7 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/auth.ts";
1177
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/auth.ts";
993
1178
  var AuthExtension = class extends RpcExtension {
994
1179
  constructor(_authParams) {
995
1180
  super({
@@ -1005,8 +1190,8 @@ var AuthExtension = class extends RpcExtension {
1005
1190
  this._ctx = new Context3({
1006
1191
  onError: (err) => {
1007
1192
  log7.catch(err, void 0, {
1008
- F: __dxlog_file7,
1009
- L: 29,
1193
+ F: __dxlog_file8,
1194
+ L: 28,
1010
1195
  S: this,
1011
1196
  C: (f, a) => f(...a)
1012
1197
  });
@@ -1027,8 +1212,8 @@ var AuthExtension = class extends RpcExtension {
1027
1212
  };
1028
1213
  } catch (err) {
1029
1214
  log7.error("failed to generate auth credentials", err, {
1030
- F: __dxlog_file7,
1031
- L: 56,
1215
+ F: __dxlog_file8,
1216
+ L: 55,
1032
1217
  S: this,
1033
1218
  C: (f, a) => f(...a)
1034
1219
  });
@@ -1046,14 +1231,30 @@ var AuthExtension = class extends RpcExtension {
1046
1231
  const { credential } = await this.rpc.AuthService.authenticate({
1047
1232
  challenge
1048
1233
  });
1049
- invariant7((credential == null ? void 0 : credential.length) > 0, "invalid credential");
1234
+ invariant7((credential == null ? void 0 : credential.length) > 0, "invalid credential", {
1235
+ F: __dxlog_file8,
1236
+ L: 69,
1237
+ S: this,
1238
+ A: [
1239
+ "credential?.length > 0",
1240
+ "'invalid credential'"
1241
+ ]
1242
+ });
1050
1243
  const success = await this._authParams.verifier(challenge, credential);
1051
- invariant7(success, "credential not verified");
1244
+ invariant7(success, "credential not verified", {
1245
+ F: __dxlog_file8,
1246
+ L: 71,
1247
+ S: this,
1248
+ A: [
1249
+ "success",
1250
+ "'credential not verified'"
1251
+ ]
1252
+ });
1052
1253
  runInContext(this._ctx, () => this._authParams.onAuthSuccess());
1053
1254
  } catch (err) {
1054
1255
  log7("auth failed", err, {
1055
- F: __dxlog_file7,
1056
- L: 75,
1256
+ F: __dxlog_file8,
1257
+ L: 74,
1057
1258
  S: this,
1058
1259
  C: (f, a) => f(...a)
1059
1260
  });
@@ -1069,12 +1270,12 @@ var AuthExtension = class extends RpcExtension {
1069
1270
  };
1070
1271
 
1071
1272
  // packages/core/echo/echo-pipeline/src/space/data-pipeline.ts
1072
- import invariant8 from "tiny-invariant";
1073
1273
  import { Event as Event4, scheduleTask as scheduleTask2, synchronized as synchronized3, trackLeaks as trackLeaks2 } from "@dxos/async";
1074
1274
  import { Context as Context4 } from "@dxos/context";
1075
1275
  import { checkCredentialType } from "@dxos/credentials";
1076
1276
  import { getStateMachineFromItem, ItemManager } from "@dxos/echo-db";
1077
1277
  import { CancelledError } from "@dxos/errors";
1278
+ import { invariant as invariant8 } from "@dxos/invariant";
1078
1279
  import { log as log8 } from "@dxos/log";
1079
1280
  import { Timeframe as Timeframe3 } from "@dxos/timeframe";
1080
1281
  import { tracer } from "@dxos/util";
@@ -1088,7 +1289,7 @@ function _ts_decorate5(decorators, target, key, desc) {
1088
1289
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1089
1290
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1090
1291
  }
1091
- var __dxlog_file8 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/data-pipeline.ts";
1292
+ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/data-pipeline.ts";
1092
1293
  var MESSAGES_PER_SNAPSHOT = 10;
1093
1294
  var AUTOMATIC_SNAPSHOT_DEBOUNCE_INTERVAL = 5e3;
1094
1295
  var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 500;
@@ -1144,8 +1345,24 @@ var DataPipeline = class DataPipeline2 {
1144
1345
  }
1145
1346
  const feedWriter = {
1146
1347
  write: (data, options) => {
1147
- invariant8(this._pipeline, "Pipeline is not initialized.");
1148
- invariant8(this.currentEpoch, "Epoch is not initialized.");
1348
+ invariant8(this._pipeline, "Pipeline is not initialized.", {
1349
+ F: __dxlog_file9,
1350
+ L: 145,
1351
+ S: this,
1352
+ A: [
1353
+ "this._pipeline",
1354
+ "'Pipeline is not initialized.'"
1355
+ ]
1356
+ });
1357
+ invariant8(this.currentEpoch, "Epoch is not initialized.", {
1358
+ F: __dxlog_file9,
1359
+ L: 146,
1360
+ S: this,
1361
+ A: [
1362
+ "this.currentEpoch",
1363
+ "'Epoch is not initialized.'"
1364
+ ]
1365
+ });
1149
1366
  return this._pipeline.writer.write({
1150
1367
  data
1151
1368
  }, options);
@@ -1165,8 +1382,8 @@ var DataPipeline = class DataPipeline2 {
1165
1382
  return;
1166
1383
  }
1167
1384
  log8("close", void 0, {
1168
- F: __dxlog_file8,
1169
- L: 171,
1385
+ F: __dxlog_file9,
1386
+ L: 170,
1170
1387
  S: this,
1171
1388
  C: (f, a) => f(...a)
1172
1389
  });
@@ -1180,8 +1397,8 @@ var DataPipeline = class DataPipeline2 {
1180
1397
  }
1181
1398
  } catch (err) {
1182
1399
  log8.catch(err, void 0, {
1183
- F: __dxlog_file8,
1184
- L: 184,
1400
+ F: __dxlog_file9,
1401
+ L: 183,
1185
1402
  S: this,
1186
1403
  C: (f, a) => f(...a)
1187
1404
  });
@@ -1203,15 +1420,23 @@ var DataPipeline = class DataPipeline2 {
1203
1420
  await this._processEpochInSeparateTask(this.currentEpoch);
1204
1421
  await waitForOneEpoch;
1205
1422
  }
1206
- invariant8(this._pipeline, "Pipeline is not initialized.");
1423
+ invariant8(this._pipeline, "Pipeline is not initialized.", {
1424
+ F: __dxlog_file9,
1425
+ L: 206,
1426
+ S: this,
1427
+ A: [
1428
+ "this._pipeline",
1429
+ "'Pipeline is not initialized.'"
1430
+ ]
1431
+ });
1207
1432
  for await (const msg of this._pipeline.consume()) {
1208
1433
  const { feedKey, seq, data } = msg;
1209
1434
  log8("processing message", {
1210
1435
  feedKey,
1211
1436
  seq
1212
1437
  }, {
1213
- F: __dxlog_file8,
1214
- L: 210,
1438
+ F: __dxlog_file9,
1439
+ L: 209,
1215
1440
  S: this,
1216
1441
  C: (f, a) => f(...a)
1217
1442
  });
@@ -1222,8 +1447,8 @@ var DataPipeline = class DataPipeline2 {
1222
1447
  log8.warn("Could not find feed", {
1223
1448
  feedKey
1224
1449
  }, {
1225
- F: __dxlog_file8,
1226
- L: 216,
1450
+ F: __dxlog_file9,
1451
+ L: 215,
1227
1452
  S: this,
1228
1453
  C: (f, a) => f(...a)
1229
1454
  });
@@ -1245,8 +1470,8 @@ var DataPipeline = class DataPipeline2 {
1245
1470
  seq,
1246
1471
  spaceKey: this._params.spaceKey.toHex()
1247
1472
  }, {
1248
- F: __dxlog_file8,
1249
- L: 233,
1473
+ F: __dxlog_file9,
1474
+ L: 232,
1250
1475
  S: this,
1251
1476
  C: (f, a) => f(...a)
1252
1477
  });
@@ -1254,8 +1479,8 @@ var DataPipeline = class DataPipeline2 {
1254
1479
  }
1255
1480
  } catch (err) {
1256
1481
  log8.catch(err, void 0, {
1257
- F: __dxlog_file8,
1258
- L: 243,
1482
+ F: __dxlog_file9,
1483
+ L: 242,
1259
1484
  S: this,
1260
1485
  C: (f, a) => f(...a)
1261
1486
  });
@@ -1263,7 +1488,15 @@ var DataPipeline = class DataPipeline2 {
1263
1488
  }
1264
1489
  }
1265
1490
  _createSnapshot() {
1266
- invariant8(this.databaseHost, "Database backend is not initialized.");
1491
+ invariant8(this.databaseHost, "Database backend is not initialized.", {
1492
+ F: __dxlog_file9,
1493
+ L: 248,
1494
+ S: this,
1495
+ A: [
1496
+ "this.databaseHost",
1497
+ "'Database backend is not initialized.'"
1498
+ ]
1499
+ });
1267
1500
  return {
1268
1501
  spaceKey: this._params.spaceKey.asUint8Array(),
1269
1502
  timeframe: this._pipeline.state.timeframe,
@@ -1289,8 +1522,8 @@ var DataPipeline = class DataPipeline2 {
1289
1522
  }
1290
1523
  } catch (err) {
1291
1524
  log8.warn("Failed to cache properties", err, {
1292
- F: __dxlog_file8,
1293
- L: 278,
1525
+ F: __dxlog_file9,
1526
+ L: 277,
1294
1527
  S: this,
1295
1528
  C: (f, a) => f(...a)
1296
1529
  });
@@ -1316,15 +1549,15 @@ var DataPipeline = class DataPipeline2 {
1316
1549
  onError: (err) => {
1317
1550
  if (err instanceof CancelledError) {
1318
1551
  log8("Epoch processing cancelled.", void 0, {
1319
- F: __dxlog_file8,
1320
- L: 310,
1552
+ F: __dxlog_file9,
1553
+ L: 309,
1321
1554
  S: this,
1322
1555
  C: (f, a) => f(...a)
1323
1556
  });
1324
1557
  } else {
1325
1558
  log8.catch(err, void 0, {
1326
- F: __dxlog_file8,
1327
- L: 312,
1559
+ F: __dxlog_file9,
1560
+ L: 311,
1328
1561
  S: this,
1329
1562
  C: (f, a) => f(...a)
1330
1563
  });
@@ -1339,8 +1572,8 @@ var DataPipeline = class DataPipeline2 {
1339
1572
  log8("process epoch", {
1340
1573
  epoch
1341
1574
  }, {
1342
- F: __dxlog_file8,
1343
- L: 322,
1575
+ F: __dxlog_file9,
1576
+ L: 321,
1344
1577
  S: this,
1345
1578
  C: (f, a) => f(...a)
1346
1579
  });
@@ -1350,14 +1583,30 @@ var DataPipeline = class DataPipeline2 {
1350
1583
  });
1351
1584
  }
1352
1585
  async _processEpoch(ctx, epoch) {
1353
- invariant8(this._isOpen, "Space is closed.");
1354
- invariant8(this._pipeline);
1586
+ invariant8(this._isOpen, "Space is closed.", {
1587
+ F: __dxlog_file9,
1588
+ L: 331,
1589
+ S: this,
1590
+ A: [
1591
+ "this._isOpen",
1592
+ "'Space is closed.'"
1593
+ ]
1594
+ });
1595
+ invariant8(this._pipeline, void 0, {
1596
+ F: __dxlog_file9,
1597
+ L: 332,
1598
+ S: this,
1599
+ A: [
1600
+ "this._pipeline",
1601
+ ""
1602
+ ]
1603
+ });
1355
1604
  this._lastProcessedEpoch = epoch.number;
1356
1605
  log8("Processing epoch", {
1357
1606
  epoch
1358
1607
  }, {
1359
- F: __dxlog_file8,
1360
- L: 336,
1608
+ F: __dxlog_file9,
1609
+ L: 335,
1361
1610
  S: this,
1362
1611
  C: (f, a) => f(...a)
1363
1612
  });
@@ -1366,8 +1615,8 @@ var DataPipeline = class DataPipeline2 {
1366
1615
  this.databaseHost._itemDemuxer.restoreFromSnapshot(snapshot.database);
1367
1616
  }
1368
1617
  log8("restarting pipeline for epoch", void 0, {
1369
- F: __dxlog_file8,
1370
- L: 344,
1618
+ F: __dxlog_file9,
1619
+ L: 343,
1371
1620
  S: this,
1372
1621
  C: (f, a) => f(...a)
1373
1622
  });
@@ -1376,12 +1625,36 @@ var DataPipeline = class DataPipeline2 {
1376
1625
  await this._pipeline.unpause();
1377
1626
  }
1378
1627
  async waitUntilTimeframe(timeframe) {
1379
- invariant8(this._pipeline, "Pipeline is not initialized.");
1628
+ invariant8(this._pipeline, "Pipeline is not initialized.", {
1629
+ F: __dxlog_file9,
1630
+ L: 351,
1631
+ S: this,
1632
+ A: [
1633
+ "this._pipeline",
1634
+ "'Pipeline is not initialized.'"
1635
+ ]
1636
+ });
1380
1637
  await this._pipeline.state.waitUntilTimeframe(timeframe);
1381
1638
  }
1382
1639
  async createEpoch() {
1383
- invariant8(this._pipeline);
1384
- invariant8(this.currentEpoch);
1640
+ invariant8(this._pipeline, void 0, {
1641
+ F: __dxlog_file9,
1642
+ L: 357,
1643
+ S: this,
1644
+ A: [
1645
+ "this._pipeline",
1646
+ ""
1647
+ ]
1648
+ });
1649
+ invariant8(this.currentEpoch, void 0, {
1650
+ F: __dxlog_file9,
1651
+ L: 358,
1652
+ S: this,
1653
+ A: [
1654
+ "this.currentEpoch",
1655
+ ""
1656
+ ]
1657
+ });
1385
1658
  await this._pipeline.pause();
1386
1659
  const snapshot = await this._createSnapshot();
1387
1660
  const snapshotCid = await this._params.snapshotManager.store(snapshot);
@@ -1415,10 +1688,11 @@ DataPipeline = _ts_decorate5([
1415
1688
  ], DataPipeline);
1416
1689
 
1417
1690
  // packages/core/echo/echo-pipeline/src/space/space.ts
1418
- import invariant9 from "tiny-invariant";
1419
1691
  import { Event as Event5, synchronized as synchronized4, trackLeaks as trackLeaks3, Lock } from "@dxos/async";
1692
+ import { invariant as invariant9 } from "@dxos/invariant";
1420
1693
  import { log as log10, logInfo } from "@dxos/log";
1421
1694
  import { AdmittedFeed as AdmittedFeed2 } from "@dxos/protocols/proto/dxos/halo/credentials";
1695
+ import { trace } from "@dxos/tracing";
1422
1696
  import { Callback as Callback2 } from "@dxos/util";
1423
1697
 
1424
1698
  // packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
@@ -1428,7 +1702,7 @@ import { log as log9 } from "@dxos/log";
1428
1702
  import { AdmittedFeed } from "@dxos/protocols/proto/dxos/halo/credentials";
1429
1703
  import { Timeframe as Timeframe4 } from "@dxos/timeframe";
1430
1704
  import { Callback, tracer as tracer2 } from "@dxos/util";
1431
- var __dxlog_file9 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
1705
+ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
1432
1706
  var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL2 = 500;
1433
1707
  var ControlPipeline = class {
1434
1708
  constructor({ spaceKey, genesisFeed, feedProvider, metadataStore }) {
@@ -1443,7 +1717,7 @@ var ControlPipeline = class {
1443
1717
  log9("feed admitted", {
1444
1718
  key: info.key
1445
1719
  }, {
1446
- F: __dxlog_file9,
1720
+ F: __dxlog_file10,
1447
1721
  L: 51,
1448
1722
  S: this,
1449
1723
  C: (f, a) => f(...a)
@@ -1454,7 +1728,7 @@ var ControlPipeline = class {
1454
1728
  await this._pipeline.addFeed(feed);
1455
1729
  } catch (err) {
1456
1730
  log9.catch(err, void 0, {
1457
- F: __dxlog_file9,
1731
+ F: __dxlog_file10,
1458
1732
  L: 59,
1459
1733
  S: this,
1460
1734
  C: (f, a) => f(...a)
@@ -1477,7 +1751,7 @@ var ControlPipeline = class {
1477
1751
  }
1478
1752
  async start() {
1479
1753
  log9("starting...", void 0, {
1480
- F: __dxlog_file9,
1754
+ F: __dxlog_file10,
1481
1755
  L: 83,
1482
1756
  S: this,
1483
1757
  C: (f, a) => f(...a)
@@ -1489,7 +1763,7 @@ var ControlPipeline = class {
1489
1763
  key: msg.feedKey,
1490
1764
  seq: msg.seq
1491
1765
  }, {
1492
- F: __dxlog_file9,
1766
+ F: __dxlog_file10,
1493
1767
  L: 88,
1494
1768
  S: this,
1495
1769
  C: (f, a) => f(...a)
@@ -1502,7 +1776,7 @@ var ControlPipeline = class {
1502
1776
  log9.warn("processing failed", {
1503
1777
  msg
1504
1778
  }, {
1505
- F: __dxlog_file9,
1779
+ F: __dxlog_file10,
1506
1780
  L: 98,
1507
1781
  S: this,
1508
1782
  C: (f, a) => f(...a)
@@ -1513,7 +1787,7 @@ var ControlPipeline = class {
1513
1787
  }
1514
1788
  } catch (err) {
1515
1789
  log9.catch(err, void 0, {
1516
- F: __dxlog_file9,
1790
+ F: __dxlog_file10,
1517
1791
  L: 104,
1518
1792
  S: this,
1519
1793
  C: (f, a) => f(...a)
@@ -1523,7 +1797,7 @@ var ControlPipeline = class {
1523
1797
  });
1524
1798
  await this._pipeline.start();
1525
1799
  log9("started", void 0, {
1526
- F: __dxlog_file9,
1800
+ F: __dxlog_file10,
1527
1801
  L: 110,
1528
1802
  S: this,
1529
1803
  C: (f, a) => f(...a)
@@ -1537,7 +1811,7 @@ var ControlPipeline = class {
1537
1811
  }
1538
1812
  async stop() {
1539
1813
  log9("stopping...", void 0, {
1540
- F: __dxlog_file9,
1814
+ F: __dxlog_file10,
1541
1815
  L: 124,
1542
1816
  S: this,
1543
1817
  C: (f, a) => f(...a)
@@ -1545,7 +1819,7 @@ var ControlPipeline = class {
1545
1819
  await this._pipeline.stop();
1546
1820
  await this._saveTargetTimeframe(this._pipeline.state.timeframe);
1547
1821
  log9("stopped", void 0, {
1548
- F: __dxlog_file9,
1822
+ F: __dxlog_file10,
1549
1823
  L: 127,
1550
1824
  S: this,
1551
1825
  C: (f, a) => f(...a)
@@ -1559,7 +1833,7 @@ var ControlPipeline = class {
1559
1833
  this._targetTimeframe = newTimeframe;
1560
1834
  } catch (err) {
1561
1835
  log9(err, void 0, {
1562
- F: __dxlog_file9,
1836
+ F: __dxlog_file10,
1563
1837
  L: 136,
1564
1838
  S: this,
1565
1839
  C: (f, a) => f(...a)
@@ -1579,14 +1853,22 @@ function _ts_decorate6(decorators, target, key, desc) {
1579
1853
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1580
1854
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1581
1855
  }
1582
- var __dxlog_file10 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/space.ts";
1856
+ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
1583
1857
  var Space = class Space2 {
1584
1858
  constructor(params) {
1585
1859
  this._addFeedLock = new Lock();
1586
1860
  this.onCredentialProcessed = new Callback2();
1587
1861
  this.stateUpdate = new Event5();
1588
1862
  this._isOpen = false;
1589
- invariant9(params.spaceKey && params.feedProvider);
1863
+ invariant9(params.spaceKey && params.feedProvider, void 0, {
1864
+ F: __dxlog_file11,
1865
+ L: 73,
1866
+ S: this,
1867
+ A: [
1868
+ "params.spaceKey && params.feedProvider",
1869
+ ""
1870
+ ]
1871
+ });
1590
1872
  this._key = params.spaceKey;
1591
1873
  this._genesisFeedKey = params.genesisFeed.key;
1592
1874
  this._feedProvider = params.feedProvider;
@@ -1621,8 +1903,8 @@ var Space = class Space2 {
1621
1903
  log10("onCredentialProcessed", {
1622
1904
  credential
1623
1905
  }, {
1624
- F: __dxlog_file10,
1625
- L: 107,
1906
+ F: __dxlog_file11,
1907
+ L: 109,
1626
1908
  S: this,
1627
1909
  C: (f, a) => f(...a)
1628
1910
  });
@@ -1687,14 +1969,30 @@ var Space = class Space2 {
1687
1969
  return this._snapshotManager;
1688
1970
  }
1689
1971
  setControlFeed(feed) {
1690
- invariant9(!this._controlFeed, "Control feed already set.");
1972
+ invariant9(!this._controlFeed, "Control feed already set.", {
1973
+ F: __dxlog_file11,
1974
+ L: 183,
1975
+ S: this,
1976
+ A: [
1977
+ "!this._controlFeed",
1978
+ "'Control feed already set.'"
1979
+ ]
1980
+ });
1691
1981
  this._controlFeed = feed;
1692
1982
  this._controlPipeline.setWriteFeed(feed);
1693
1983
  return this;
1694
1984
  }
1695
1985
  setDataFeed(feed) {
1696
1986
  var _a;
1697
- invariant9(!this._dataFeed, "Data feed already set.");
1987
+ invariant9(!this._dataFeed, "Data feed already set.", {
1988
+ F: __dxlog_file11,
1989
+ L: 190,
1990
+ S: this,
1991
+ A: [
1992
+ "!this._dataFeed",
1993
+ "'Data feed already set.'"
1994
+ ]
1995
+ });
1698
1996
  this._dataFeed = feed;
1699
1997
  (_a = this._dataPipeline.pipeline) == null ? void 0 : _a.setWriteFeed(feed);
1700
1998
  return this;
@@ -1711,10 +2009,10 @@ var Space = class Space2 {
1711
2009
  // getDataFeeds(): FeedInfo[] {
1712
2010
  // return this._dataPipeline?.getFeeds();
1713
2011
  // }
1714
- async open() {
2012
+ async open(ctx) {
1715
2013
  log10("opening...", void 0, {
1716
- F: __dxlog_file10,
1717
- L: 209,
2014
+ F: __dxlog_file11,
2015
+ L: 212,
1718
2016
  S: this,
1719
2017
  C: (f, a) => f(...a)
1720
2018
  });
@@ -1726,8 +2024,8 @@ var Space = class Space2 {
1726
2024
  await this._controlPipeline.spaceState.addCredentialProcessor(this._dataPipeline);
1727
2025
  this._isOpen = true;
1728
2026
  log10("opened", void 0, {
1729
- F: __dxlog_file10,
1730
- L: 220,
2027
+ F: __dxlog_file11,
2028
+ L: 223,
1731
2029
  S: this,
1732
2030
  C: (f, a) => f(...a)
1733
2031
  });
@@ -1736,8 +2034,8 @@ var Space = class Space2 {
1736
2034
  log10("closing...", {
1737
2035
  key: this._key
1738
2036
  }, {
1739
- F: __dxlog_file10,
1740
- L: 225,
2037
+ F: __dxlog_file11,
2038
+ L: 228,
1741
2039
  S: this,
1742
2040
  C: (f, a) => f(...a)
1743
2041
  });
@@ -1750,20 +2048,28 @@ var Space = class Space2 {
1750
2048
  await this._controlPipeline.stop();
1751
2049
  this._isOpen = false;
1752
2050
  log10("closed", void 0, {
1753
- F: __dxlog_file10,
1754
- L: 238,
2051
+ F: __dxlog_file11,
2052
+ L: 241,
1755
2053
  S: this,
1756
2054
  C: (f, a) => f(...a)
1757
2055
  });
1758
2056
  }
1759
2057
  async initializeDataPipeline() {
1760
2058
  log10("initializeDataPipeline", void 0, {
1761
- F: __dxlog_file10,
1762
- L: 243,
2059
+ F: __dxlog_file11,
2060
+ L: 246,
1763
2061
  S: this,
1764
2062
  C: (f, a) => f(...a)
1765
2063
  });
1766
- invariant9(this._isOpen, "Space must be open to initialize data pipeline.");
2064
+ invariant9(this._isOpen, "Space must be open to initialize data pipeline.", {
2065
+ F: __dxlog_file11,
2066
+ L: 247,
2067
+ S: this,
2068
+ A: [
2069
+ "this._isOpen",
2070
+ "'Space must be open to initialize data pipeline.'"
2071
+ ]
2072
+ });
1767
2073
  await this._dataPipeline.open();
1768
2074
  }
1769
2075
  };
@@ -1771,7 +2077,8 @@ _ts_decorate6([
1771
2077
  logInfo
1772
2078
  ], Space.prototype, "key", null);
1773
2079
  _ts_decorate6([
1774
- synchronized4
2080
+ synchronized4,
2081
+ trace.span()
1775
2082
  ], Space.prototype, "open", null);
1776
2083
  _ts_decorate6([
1777
2084
  synchronized4
@@ -1780,7 +2087,8 @@ _ts_decorate6([
1780
2087
  synchronized4
1781
2088
  ], Space.prototype, "initializeDataPipeline", null);
1782
2089
  Space = _ts_decorate6([
1783
- trackLeaks3("open", "close")
2090
+ trackLeaks3("open", "close"),
2091
+ trace.resource()
1784
2092
  ], Space);
1785
2093
 
1786
2094
  // packages/core/echo/echo-pipeline/src/space/space-protocol.ts
@@ -1802,7 +2110,7 @@ function _ts_decorate7(decorators, target, key, desc) {
1802
2110
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1803
2111
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1804
2112
  }
1805
- var __dxlog_file11 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
2113
+ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
1806
2114
  var MOCK_AUTH_PROVIDER = async (nonce) => Buffer.from("mock");
1807
2115
  var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
1808
2116
  var SpaceProtocol = class {
@@ -1832,7 +2140,7 @@ var SpaceProtocol = class {
1832
2140
  log11("addFeed", {
1833
2141
  key: feed.key
1834
2142
  }, {
1835
- F: __dxlog_file11,
2143
+ F: __dxlog_file12,
1836
2144
  L: 95,
1837
2145
  S: this,
1838
2146
  C: (f, a) => f(...a)
@@ -1854,21 +2162,22 @@ var SpaceProtocol = class {
1854
2162
  };
1855
2163
  await this.blobSync.open();
1856
2164
  log11("starting...", void 0, {
1857
- F: __dxlog_file11,
2165
+ F: __dxlog_file12,
1858
2166
  L: 120,
1859
2167
  S: this,
1860
2168
  C: (f, a) => f(...a)
1861
2169
  });
2170
+ const topic = await this._topic;
1862
2171
  this._connection = await this._networkManager.joinSwarm({
1863
2172
  protocolProvider: this._createProtocolProvider(credentials),
1864
2173
  peerId: this._swarmIdentity.peerKey,
1865
- topic: await this._topic,
2174
+ topic,
1866
2175
  topology: new MMSTTopology(topologyConfig),
1867
- label: `Protocol swarm: ${this._topic}`
2176
+ label: `Protocol swarm: ${topic}`
1868
2177
  });
1869
2178
  log11("started", void 0, {
1870
- F: __dxlog_file11,
1871
- L: 129,
2179
+ F: __dxlog_file12,
2180
+ L: 130,
1872
2181
  S: this,
1873
2182
  C: (f, a) => f(...a)
1874
2183
  });
@@ -1877,15 +2186,15 @@ var SpaceProtocol = class {
1877
2186
  await this.blobSync.close();
1878
2187
  if (this._connection) {
1879
2188
  log11("stopping...", void 0, {
1880
- F: __dxlog_file11,
1881
- L: 136,
2189
+ F: __dxlog_file12,
2190
+ L: 137,
1882
2191
  S: this,
1883
2192
  C: (f, a) => f(...a)
1884
2193
  });
1885
2194
  await this._connection.close();
1886
2195
  log11("stopped", void 0, {
1887
- F: __dxlog_file11,
1888
- L: 138,
2196
+ F: __dxlog_file12,
2197
+ L: 139,
1889
2198
  S: this,
1890
2199
  C: (f, a) => f(...a)
1891
2200
  });
@@ -1952,8 +2261,8 @@ var SpaceProtocolSession = class {
1952
2261
  onAuthSuccess: () => {
1953
2262
  var _a;
1954
2263
  log11("Peer authenticated", void 0, {
1955
- F: __dxlog_file11,
1956
- L: 235,
2264
+ F: __dxlog_file12,
2265
+ L: 236,
1957
2266
  S: this,
1958
2267
  C: (f, a) => f(...a)
1959
2268
  });
@@ -1985,7 +2294,7 @@ import { synchronized as synchronized5, trackLeaks as trackLeaks4 } from "@dxos/
1985
2294
  import { failUndefined as failUndefined2 } from "@dxos/debug";
1986
2295
  import { PublicKey as PublicKey6 } from "@dxos/keys";
1987
2296
  import { log as log12 } from "@dxos/log";
1988
- import { trace } from "@dxos/protocols";
2297
+ import { trace as trace2 } from "@dxos/protocols";
1989
2298
  import { ComplexMap as ComplexMap5 } from "@dxos/util";
1990
2299
  function _ts_decorate8(decorators, target, key, desc) {
1991
2300
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1997,7 +2306,7 @@ function _ts_decorate8(decorators, target, key, desc) {
1997
2306
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1998
2307
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1999
2308
  }
2000
- var __dxlog_file12 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
2309
+ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
2001
2310
  var SpaceManager = class SpaceManager2 {
2002
2311
  constructor({ feedStore, networkManager, modelFactory, metadataStore, snapshotStore, blobStore }) {
2003
2312
  this._spaces = new ComplexMap5(PublicKey6.hash);
@@ -2022,10 +2331,10 @@ var SpaceManager = class SpaceManager2 {
2022
2331
  }
2023
2332
  async constructSpace({ metadata, swarmIdentity, onNetworkConnection, onAuthFailure, memberKey }) {
2024
2333
  var _a;
2025
- log12.trace("dxos.echo.space-manager.construct-space", trace.begin({
2334
+ log12.trace("dxos.echo.space-manager.construct-space", trace2.begin({
2026
2335
  id: this._instanceId
2027
2336
  }), {
2028
- F: __dxlog_file12,
2337
+ F: __dxlog_file13,
2029
2338
  L: 97,
2030
2339
  S: this,
2031
2340
  C: (f, a) => f(...a)
@@ -2033,7 +2342,7 @@ var SpaceManager = class SpaceManager2 {
2033
2342
  log12("constructing space...", {
2034
2343
  spaceKey: metadata.genesisFeedKey
2035
2344
  }, {
2036
- F: __dxlog_file12,
2345
+ F: __dxlog_file13,
2037
2346
  L: 98,
2038
2347
  S: this,
2039
2348
  C: (f, a) => f(...a)
@@ -2060,10 +2369,10 @@ var SpaceManager = class SpaceManager2 {
2060
2369
  memberKey
2061
2370
  });
2062
2371
  this._spaces.set(space.key, space);
2063
- log12.trace("dxos.echo.space-manager.construct-space", trace.end({
2372
+ log12.trace("dxos.echo.space-manager.construct-space", trace2.end({
2064
2373
  id: this._instanceId
2065
2374
  }), {
2066
- F: __dxlog_file12,
2375
+ F: __dxlog_file13,
2067
2376
  L: 125,
2068
2377
  S: this,
2069
2378
  C: (f, a) => f(...a)
@@ -2107,4 +2416,4 @@ export {
2107
2416
  SpaceProtocolSession,
2108
2417
  SpaceManager
2109
2418
  };
2110
- //# sourceMappingURL=chunk-4VJRJ4SY.mjs.map
2419
+ //# sourceMappingURL=chunk-7S5RJM3K.mjs.map