@dxos/echo-pipeline 0.8.4-main.9be5663bfe → 0.8.4-main.abd8ff62ef

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 (94) hide show
  1. package/dist/lib/neutral/{chunk-IZLLEN4C.mjs → chunk-VIHYDCCC.mjs} +101 -578
  2. package/dist/lib/neutral/chunk-VIHYDCCC.mjs.map +7 -0
  3. package/dist/lib/neutral/{chunk-76DA36YG.mjs → chunk-YBC6ONBZ.mjs} +1 -1
  4. package/dist/lib/neutral/{chunk-76DA36YG.mjs.map → chunk-YBC6ONBZ.mjs.map} +2 -2
  5. package/dist/lib/neutral/filter/index.mjs +1 -1
  6. package/dist/lib/neutral/index.mjs +540 -1101
  7. package/dist/lib/neutral/index.mjs.map +4 -4
  8. package/dist/lib/neutral/meta.json +1 -1
  9. package/dist/lib/neutral/testing/index.mjs +15 -93
  10. package/dist/lib/neutral/testing/index.mjs.map +2 -2
  11. package/dist/types/src/automerge/automerge-host.d.ts +1 -5
  12. package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
  13. package/dist/types/src/automerge/collection-synchronizer.d.ts.map +1 -1
  14. package/dist/types/src/automerge/echo-data-monitor.d.ts.map +1 -1
  15. package/dist/types/src/automerge/echo-network-adapter.d.ts.map +1 -1
  16. package/dist/types/src/automerge/heads-store.d.ts.map +1 -1
  17. package/dist/types/src/automerge/leveldb-storage-adapter.d.ts.map +1 -1
  18. package/dist/types/src/automerge/mesh-echo-replicator-connection.d.ts.map +1 -1
  19. package/dist/types/src/automerge/mesh-echo-replicator.d.ts.map +1 -1
  20. package/dist/types/src/automerge/network-protocol.d.ts.map +1 -1
  21. package/dist/types/src/automerge/space-collection.d.ts.map +1 -1
  22. package/dist/types/src/common/feeds.d.ts.map +1 -1
  23. package/dist/types/src/common/space-id.d.ts.map +1 -1
  24. package/dist/types/src/db-host/automerge-data-source.d.ts +2 -2
  25. package/dist/types/src/db-host/automerge-data-source.d.ts.map +1 -1
  26. package/dist/types/src/db-host/automerge-metrics.d.ts.map +1 -1
  27. package/dist/types/src/db-host/data-service.d.ts +3 -3
  28. package/dist/types/src/db-host/data-service.d.ts.map +1 -1
  29. package/dist/types/src/db-host/database-root.d.ts.map +1 -1
  30. package/dist/types/src/db-host/documents-synchronizer.d.ts.map +1 -1
  31. package/dist/types/src/db-host/echo-host.d.ts +1 -1
  32. package/dist/types/src/db-host/echo-host.d.ts.map +1 -1
  33. package/dist/types/src/db-host/index.d.ts +1 -0
  34. package/dist/types/src/db-host/index.d.ts.map +1 -1
  35. package/dist/types/src/db-host/invalidation-hint.d.ts +19 -0
  36. package/dist/types/src/db-host/invalidation-hint.d.ts.map +1 -0
  37. package/dist/types/src/db-host/local-queue-service.d.ts +2 -1
  38. package/dist/types/src/db-host/local-queue-service.d.ts.map +1 -1
  39. package/dist/types/src/db-host/query-invalidation.test.d.ts +2 -0
  40. package/dist/types/src/db-host/query-invalidation.test.d.ts.map +1 -0
  41. package/dist/types/src/db-host/query-service.d.ts +5 -2
  42. package/dist/types/src/db-host/query-service.d.ts.map +1 -1
  43. package/dist/types/src/db-host/queue-data-source.d.ts.map +1 -1
  44. package/dist/types/src/db-host/space-state-manager.d.ts.map +1 -1
  45. package/dist/types/src/db-host/stub.d.ts.map +1 -1
  46. package/dist/types/src/edge/echo-edge-replicator.d.ts.map +1 -1
  47. package/dist/types/src/edge/inflight-request-limiter.d.ts.map +1 -1
  48. package/dist/types/src/filter/filter-match.d.ts.map +1 -1
  49. package/dist/types/src/metadata/metadata-store.d.ts.map +1 -1
  50. package/dist/types/src/pipeline/message-selector.d.ts.map +1 -1
  51. package/dist/types/src/pipeline/pipeline.d.ts +1 -1
  52. package/dist/types/src/pipeline/pipeline.d.ts.map +1 -1
  53. package/dist/types/src/pipeline/timeframe-clock.d.ts.map +1 -1
  54. package/dist/types/src/query/errors.d.ts +6 -6
  55. package/dist/types/src/query/errors.d.ts.map +1 -1
  56. package/dist/types/src/query/plan.d.ts.map +1 -1
  57. package/dist/types/src/query/query-executor.d.ts +11 -10
  58. package/dist/types/src/query/query-executor.d.ts.map +1 -1
  59. package/dist/types/src/query/query-planner.d.ts.map +1 -1
  60. package/dist/types/src/space/admission-discovery-extension.d.ts.map +1 -1
  61. package/dist/types/src/space/auth.d.ts.map +1 -1
  62. package/dist/types/src/space/control-pipeline.d.ts.map +1 -1
  63. package/dist/types/src/space/space-manager.d.ts +1 -2
  64. package/dist/types/src/space/space-manager.d.ts.map +1 -1
  65. package/dist/types/src/space/space-protocol.d.ts +2 -2
  66. package/dist/types/src/space/space-protocol.d.ts.map +1 -1
  67. package/dist/types/src/space/space.d.ts.map +1 -1
  68. package/dist/types/src/testing/change-metadata.d.ts.map +1 -1
  69. package/dist/types/src/testing/test-agent-builder.d.ts.map +1 -1
  70. package/dist/types/src/testing/test-feed-builder.d.ts.map +1 -1
  71. package/dist/types/src/testing/test-network-adapter.d.ts.map +1 -1
  72. package/dist/types/src/testing/test-replicator.d.ts.map +1 -1
  73. package/dist/types/src/util.d.ts.map +1 -1
  74. package/dist/types/tsconfig.tsbuildinfo +1 -1
  75. package/package.json +37 -44
  76. package/src/automerge/automerge-host.test.ts +5 -6
  77. package/src/automerge/automerge-host.ts +2 -7
  78. package/src/automerge/collection-synchronizer.test.ts +4 -5
  79. package/src/automerge/collection-synchronizer.ts +14 -8
  80. package/src/db-host/automerge-data-source.ts +3 -4
  81. package/src/db-host/data-service.ts +6 -6
  82. package/src/db-host/echo-host.ts +145 -59
  83. package/src/db-host/index.ts +1 -0
  84. package/src/db-host/invalidation-hint.ts +50 -0
  85. package/src/db-host/local-queue-service.ts +7 -6
  86. package/src/db-host/query-invalidation.test.ts +270 -0
  87. package/src/db-host/query-service.ts +82 -9
  88. package/src/db-host/queue-service.test.ts +10 -10
  89. package/src/edge/echo-edge-replicator.ts +12 -12
  90. package/src/query/query-executor.ts +183 -14
  91. package/src/space/control-pipeline.ts +3 -2
  92. package/src/space/space-manager.ts +0 -8
  93. package/src/space/space.ts +1 -1
  94. package/dist/lib/neutral/chunk-IZLLEN4C.mjs.map +0 -7
@@ -10,24 +10,8 @@ var valueEncoding = createCodecEncoding(codec);
10
10
  import { invariant } from "@dxos/invariant";
11
11
  var __dxlog_file = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/common/feeds.ts";
12
12
  var createMappedFeedWriter = (mapper, 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
- });
13
+ invariant(mapper, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 8, S: void 0, A: ["mapper", ""] });
14
+ invariant(writer, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 9, S: void 0, A: ["writer", ""] });
31
15
  return {
32
16
  write: async (data, options) => await writer.write(await mapper(data), options)
33
17
  };
@@ -61,13 +45,13 @@ import { DataCorruptionError, STORAGE_VERSION } from "@dxos/protocols";
61
45
  import { schema as schema2 } from "@dxos/protocols/proto";
62
46
  import { Invitation, SpaceState } from "@dxos/protocols/proto/dxos/client/services";
63
47
  import { ComplexMap as ComplexMap2, arrayToBuffer, forEachAsync, isNonNullable } from "@dxos/util";
48
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
64
49
  function _ts_decorate(decorators, target, key, desc) {
65
50
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
66
51
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
67
52
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
68
53
  return c > 3 && r && Object.defineProperty(target, key, r), r;
69
54
  }
70
- var __dxlog_file2 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
71
55
  var EXPIRED_INVITATION_CLEANUP_INTERVAL = 60 * 60 * 1e3;
72
56
  var emptyEchoMetadata = () => ({
73
57
  version: STORAGE_VERSION,
@@ -83,10 +67,7 @@ var MetadataStore = class {
83
67
  _spaceLargeMetadata = new ComplexMap2(PublicKey2.hash);
84
68
  _metadataFile = void 0;
85
69
  update = new Event();
86
- _invitationCleanupCtx = new Context(void 0, {
87
- F: __dxlog_file2,
88
- L: 55
89
- });
70
+ _invitationCleanupCtx = new Context(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 35 });
90
71
  /**
91
72
  * @internal
92
73
  */
@@ -119,12 +100,7 @@ var MetadataStore = class {
119
100
  size: dataSize,
120
101
  checksum,
121
102
  name: file.filename
122
- }, {
123
- F: __dxlog_file2,
124
- L: 91,
125
- S: this,
126
- C: (f, a) => f(...a)
127
- });
103
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 63, S: this });
128
104
  if (fileLength < dataSize + 8) {
129
105
  throw new DataCorruptionError({
130
106
  message: "Metadata size is smaller than expected.",
@@ -160,12 +136,7 @@ var MetadataStore = class {
160
136
  log("saved", {
161
137
  size: encoded.length,
162
138
  checksum
163
- }, {
164
- F: __dxlog_file2,
165
- L: 129,
166
- S: this,
167
- C: (f, a) => f(...a)
168
- });
139
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 100, S: this });
169
140
  }
170
141
  async close() {
171
142
  await this._invitationCleanupCtx.dispose();
@@ -193,12 +164,7 @@ var MetadataStore = class {
193
164
  } catch (err) {
194
165
  log.error("failed to load metadata", {
195
166
  err
196
- }, {
197
- F: __dxlog_file2,
198
- L: 161,
199
- S: this,
200
- C: (f, a) => f(...a)
201
- });
167
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 129, S: this });
202
168
  this._metadata = emptyEchoMetadata();
203
169
  }
204
170
  await forEachAsync([
@@ -210,12 +176,7 @@ var MetadataStore = class {
210
176
  } catch (err) {
211
177
  log.error("failed to load space large metadata", {
212
178
  err
213
- }, {
214
- F: __dxlog_file2,
215
- L: 173,
216
- S: this,
217
- C: (f, a) => f(...a)
218
- });
179
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 141, S: this });
219
180
  }
220
181
  });
221
182
  scheduleTaskInterval(this._invitationCleanupCtx, async () => {
@@ -247,12 +208,7 @@ var MetadataStore = class {
247
208
  } catch (err) {
248
209
  log.error("failed to load space large metadata", {
249
210
  err
250
- }, {
251
- F: __dxlog_file2,
252
- L: 215,
253
- S: this,
254
- C: (f, a) => f(...a)
255
- });
211
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 174, S: this });
256
212
  }
257
213
  }
258
214
  async _saveSpaceLargeMetadata(key) {
@@ -268,15 +224,7 @@ var MetadataStore = class {
268
224
  return this._metadata.identity.haloSpace;
269
225
  }
270
226
  const space = this.spaces.find((space2) => space2.key.equals(spaceKey));
271
- invariant2(space, "Space not found", {
272
- F: __dxlog_file2,
273
- L: 237,
274
- S: this,
275
- A: [
276
- "space",
277
- "'Space not found'"
278
- ]
279
- });
227
+ invariant2(space, "Space not found", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 193, S: this, A: ["space", "'Space not found'"] });
280
228
  return space;
281
229
  }
282
230
  hasSpace(spaceKey) {
@@ -298,12 +246,7 @@ var MetadataStore = class {
298
246
  * Clears storage - doesn't work for now.
299
247
  */
300
248
  async clear() {
301
- log("clearing all metadata", void 0, {
302
- F: __dxlog_file2,
303
- L: 265,
304
- S: this,
305
- C: (f, a) => f(...a)
306
- });
249
+ log("clearing all metadata", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 215, S: this });
307
250
  await this._directory.delete();
308
251
  this._metadata = emptyEchoMetadata();
309
252
  }
@@ -311,15 +254,7 @@ var MetadataStore = class {
311
254
  return this._metadata.identity;
312
255
  }
313
256
  async setIdentityRecord(record) {
314
- invariant2(!this._metadata.identity, "Cannot overwrite existing identity in metadata", {
315
- F: __dxlog_file2,
316
- L: 275,
317
- S: this,
318
- A: [
319
- "!this._metadata.identity",
320
- "'Cannot overwrite existing identity in metadata'"
321
- ]
322
- });
257
+ invariant2(!this._metadata.identity, "Cannot overwrite existing identity in metadata", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 223, S: this, A: ["!this._metadata.identity", "'Cannot overwrite existing identity in metadata'"] });
323
258
  this._metadata.identity = record;
324
259
  await this._save();
325
260
  await this.flush();
@@ -341,15 +276,7 @@ var MetadataStore = class {
341
276
  await this.flush();
342
277
  }
343
278
  async addSpace(record) {
344
- invariant2(!(this._metadata.spaces ?? []).find((space) => space.key.equals(record.key)), "Cannot overwrite existing space in metadata", {
345
- F: __dxlog_file2,
346
- L: 303,
347
- S: this,
348
- A: [
349
- "!(this._metadata.spaces ?? []).find((space) => space.key.equals(record.key))",
350
- "'Cannot overwrite existing space in metadata'"
351
- ]
352
- });
279
+ invariant2(!(this._metadata.spaces ?? []).find((space) => space.key.equals(record.key)), "Cannot overwrite existing space in metadata", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 245, S: this, A: ["!(this._metadata.spaces ?? []).find((space)=>space.key.equals(record.key))", "'Cannot overwrite existing space in metadata'"] });
353
280
  (this._metadata.spaces ??= []).push(record);
354
281
  await this._save();
355
282
  await this.flush();
@@ -418,13 +345,13 @@ import { Event as Event2 } from "@dxos/async";
418
345
  import { timed } from "@dxos/debug";
419
346
  import { log as log2 } from "@dxos/log";
420
347
  import { Timeframe } from "@dxos/timeframe";
348
+ var __dxlog_file3 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
421
349
  function _ts_decorate2(decorators, target, key, desc) {
422
350
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
423
351
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
424
352
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
425
353
  return c > 3 && r && Object.defineProperty(target, key, r), r;
426
354
  }
427
- var __dxlog_file3 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
428
355
  var mapTimeframeToFeedIndexes = (timeframe) => timeframe.frames().map(([feedKey, index]) => ({
429
356
  feedKey,
430
357
  index
@@ -483,23 +410,13 @@ var TimeframeClock = class {
483
410
  log2("waitUntilReached", {
484
411
  target,
485
412
  current: this._timeframe
486
- }, {
487
- F: __dxlog_file3,
488
- L: 70,
489
- S: this,
490
- C: (f, a) => f(...a)
491
- });
413
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 69, S: this });
492
414
  await this.update.waitForCondition(() => {
493
415
  log2("check if reached", {
494
416
  target,
495
417
  current: this._timeframe,
496
418
  deps: Timeframe.dependencies(target, this._timeframe)
497
- }, {
498
- F: __dxlog_file3,
499
- L: 72,
500
- S: this,
501
- C: (f, a) => f(...a)
502
- });
419
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 74, S: this });
503
420
  return Timeframe.dependencies(target, this._timeframe).isEmpty();
504
421
  });
505
422
  }
@@ -527,46 +444,30 @@ var createMessageSelector = (timeframeClock) => {
527
444
  return (messages) => {
528
445
  for (let i = 0; i < messages.length; i++) {
529
446
  const { data: { timeframe } } = messages[i];
530
- invariant3(timeframe, void 0, {
531
- F: __dxlog_file4,
532
- L: 25,
533
- S: void 0,
534
- A: [
535
- "timeframe",
536
- ""
537
- ]
538
- });
447
+ invariant3(timeframe, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file4, L: 16, S: void 0, A: ["timeframe", ""] });
539
448
  if (!timeframeClock.hasGaps(timeframe)) {
540
449
  return i;
541
450
  }
542
451
  }
543
- log3("Skipping...", void 0, {
544
- F: __dxlog_file4,
545
- L: 33,
546
- S: void 0,
547
- C: (f, a) => f(...a)
548
- });
452
+ log3("Skipping...", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file4, L: 22, S: void 0 });
549
453
  };
550
454
  };
551
455
 
552
456
  // src/pipeline/pipeline.ts
457
+ var __dxlog_file5 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
553
458
  function _ts_decorate3(decorators, target, key, desc) {
554
459
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
555
460
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
556
461
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
557
462
  return c > 3 && r && Object.defineProperty(target, key, r), r;
558
463
  }
559
- var __dxlog_file5 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
560
464
  var PipelineState = class {
561
465
  _feeds;
562
466
  _timeframeClock;
563
467
  /**
564
468
  * @internal
565
469
  */
566
- _ctx = new Context2(void 0, {
567
- F: __dxlog_file5,
568
- L: 41
569
- });
470
+ _ctx = new Context2(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 29 });
570
471
  // TODO(dmaretskyi): Remove?. Avoid accessing `_timeframeClock` before constructor initialization.
571
472
  get timeframeUpdate() {
572
473
  return this._timeframeClock.update;
@@ -634,20 +535,12 @@ var PipelineState = class {
634
535
  *
635
536
  * @param timeout Timeout in milliseconds to specify the maximum wait time.
636
537
  */
637
- async waitUntilReachedTargetTimeframe({ ctx = new Context2(void 0, {
638
- F: __dxlog_file5,
639
- L: 131
640
- }), timeout, breakOnStall = true } = {}) {
538
+ async waitUntilReachedTargetTimeframe({ ctx = new Context2(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 91 }), timeout, breakOnStall = true } = {}) {
641
539
  log4("waitUntilReachedTargetTimeframe", {
642
540
  timeout,
643
541
  current: this.timeframe,
644
542
  target: this.targetTimeframe
645
- }, {
646
- F: __dxlog_file5,
647
- L: 135,
648
- S: this,
649
- C: (f, a) => f(...a)
650
- });
543
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 92, S: this });
651
544
  this._reachedTargetPromise ??= Promise.race([
652
545
  this._timeframeClock.update.waitForCondition(() => {
653
546
  return Timeframe2.dependencies(this.targetTimeframe, this.timeframe).isEmpty();
@@ -674,12 +567,7 @@ var PipelineState = class {
674
567
  current: this.timeframe,
675
568
  target: this.targetTimeframe,
676
569
  dependencies: Timeframe2.dependencies(this.targetTimeframe, this.timeframe)
677
- }, {
678
- F: __dxlog_file5,
679
- L: 163,
680
- S: this,
681
- C: (f, a) => f(...a)
682
- });
570
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 118, S: this });
683
571
  })
684
572
  ]);
685
573
  } else {
@@ -709,15 +597,7 @@ var Pipeline = class {
709
597
  return this._state;
710
598
  }
711
599
  get writer() {
712
- invariant4(this._writer, "Writer not set.", {
713
- F: __dxlog_file5,
714
- L: 245,
715
- S: this,
716
- A: [
717
- "this._writer",
718
- "'Writer not set.'"
719
- ]
720
- });
600
+ invariant4(this._writer, "Writer not set.", { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 184, S: this, A: ["this._writer", "'Writer not set.'"] });
721
601
  return this._writer;
722
602
  }
723
603
  hasFeed(feedKey) {
@@ -738,54 +618,20 @@ var Pipeline = class {
738
618
  }
739
619
  }
740
620
  setWriteFeed(feed) {
741
- invariant4(!this._writer, "Writer already set.", {
742
- F: __dxlog_file5,
743
- L: 272,
744
- S: this,
745
- A: [
746
- "!this._writer",
747
- "'Writer already set.'"
748
- ]
749
- });
750
- invariant4(feed.properties.writable, "Feed must be writable.", {
751
- F: __dxlog_file5,
752
- L: 273,
753
- S: this,
754
- A: [
755
- "feed.properties.writable",
756
- "'Feed must be writable.'"
757
- ]
758
- });
621
+ invariant4(!this._writer, "Writer already set.", { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 205, S: this, A: ["!this._writer", "'Writer already set.'"] });
622
+ invariant4(feed.properties.writable, "Feed must be writable.", { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 206, S: this, A: ["feed.properties.writable", "'Feed must be writable.'"] });
759
623
  this._writer = createMappedFeedWriter((payload) => ({
760
624
  timeframe: this._timeframeClock.timeframe,
761
625
  payload
762
626
  }), feed.createFeedWriter());
763
627
  }
764
628
  async start() {
765
- invariant4(!this._isStarted, "Pipeline is already started.", {
766
- F: __dxlog_file5,
767
- L: 286,
768
- S: this,
769
- A: [
770
- "!this._isStarted",
771
- "'Pipeline is already started.'"
772
- ]
773
- });
774
- log4("starting...", void 0, {
775
- F: __dxlog_file5,
776
- L: 287,
777
- S: this,
778
- C: (f, a) => f(...a)
779
- });
629
+ invariant4(!this._isStarted, "Pipeline is already started.", { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 213, S: this, A: ["!this._isStarted", "'Pipeline is already started.'"] });
630
+ log4("starting...", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 214, S: this });
780
631
  await this._initIterator();
781
632
  await this._feedSetIterator.open();
782
633
  this._isStarted = true;
783
- log4("started", void 0, {
784
- F: __dxlog_file5,
785
- L: 291,
786
- S: this,
787
- C: (f, a) => f(...a)
788
- });
634
+ log4("started", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 218, S: this });
789
635
  if (!this._isPaused) {
790
636
  for (const feed of this._feeds.values()) {
791
637
  this._setFeedDownloadState(feed);
@@ -793,12 +639,7 @@ var Pipeline = class {
793
639
  }
794
640
  }
795
641
  async stop() {
796
- log4("stopping...", void 0, {
797
- F: __dxlog_file5,
798
- L: 302,
799
- S: this,
800
- C: (f, a) => f(...a)
801
- });
642
+ log4("stopping...", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 226, S: this });
802
643
  this._isStopping = true;
803
644
  for (const [feed, handle] of this._downloads.entries()) {
804
645
  feed.undownload(handle);
@@ -807,34 +648,18 @@ var Pipeline = class {
807
648
  await this._feedSetIterator?.close();
808
649
  await this._processingTrigger.wait();
809
650
  await this._state._ctx.dispose();
810
- this._state._ctx = new Context2(void 0, {
811
- F: __dxlog_file5,
812
- L: 311
813
- });
651
+ this._state._ctx = new Context2(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 235 });
814
652
  this._state._reachedTargetPromise = void 0;
815
653
  this._state._reachedTarget = false;
816
654
  this._isStarted = false;
817
- log4("stopped", void 0, {
818
- F: __dxlog_file5,
819
- L: 315,
820
- S: this,
821
- C: (f, a) => f(...a)
822
- });
655
+ log4("stopped", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 239, S: this });
823
656
  }
824
657
  /**
825
658
  * @param timeframe Timeframe of already processed messages.
826
659
  * The pipeline will start processing messages AFTER this timeframe.
827
660
  */
828
661
  async setCursor(timeframe) {
829
- invariant4(!this._isStarted || this._isPaused, "Invalid state.", {
830
- F: __dxlog_file5,
831
- L: 324,
832
- S: this,
833
- A: [
834
- "!this._isStarted || this._isPaused",
835
- "'Invalid state.'"
836
- ]
837
- });
662
+ invariant4(!this._isStarted || this._isPaused, "Invalid state.", { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 245, S: this, A: ["!this._isStarted || this._isPaused", "'Invalid state.'"] });
838
663
  this._state._startTimeframe = timeframe;
839
664
  this._timeframeClock.setTimeframe(timeframe);
840
665
  if (this._feedSetIterator) {
@@ -855,15 +680,7 @@ var Pipeline = class {
855
680
  this._isPaused = true;
856
681
  }
857
682
  async unpause() {
858
- invariant4(this._isPaused, "Pipeline is not paused.", {
859
- F: __dxlog_file5,
860
- L: 353,
861
- S: this,
862
- A: [
863
- "this._isPaused",
864
- "'Pipeline is not paused.'"
865
- ]
866
- });
683
+ invariant4(this._isPaused, "Pipeline is not paused.", { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 266, S: this, A: ["this._isPaused", "'Pipeline is not paused.'"] });
867
684
  this._pauseTrigger.wake();
868
685
  this._isPaused = false;
869
686
  for (const feed of this._feeds.values()) {
@@ -875,39 +692,15 @@ var Pipeline = class {
875
692
  * Updates the timeframe clock after the message has bee processed.
876
693
  */
877
694
  async *consume() {
878
- invariant4(!this._isBeingConsumed, "Pipeline is already being consumed.", {
879
- F: __dxlog_file5,
880
- L: 368,
881
- S: this,
882
- A: [
883
- "!this._isBeingConsumed",
884
- "'Pipeline is already being consumed.'"
885
- ]
886
- });
695
+ invariant4(!this._isBeingConsumed, "Pipeline is already being consumed.", { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 277, S: this, A: ["!this._isBeingConsumed", "'Pipeline is already being consumed.'"] });
887
696
  this._isBeingConsumed = true;
888
- invariant4(this._feedSetIterator, "Iterator not initialized.", {
889
- F: __dxlog_file5,
890
- L: 371,
891
- S: this,
892
- A: [
893
- "this._feedSetIterator",
894
- "'Iterator not initialized.'"
895
- ]
896
- });
697
+ invariant4(this._feedSetIterator, "Iterator not initialized.", { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 279, S: this, A: ["this._feedSetIterator", "'Iterator not initialized.'"] });
897
698
  let lastFeedSetIterator = this._feedSetIterator;
898
699
  let iterable = lastFeedSetIterator[Symbol.asyncIterator]();
899
700
  while (!this._isStopping) {
900
701
  await this._pauseTrigger.wait();
901
702
  if (lastFeedSetIterator !== this._feedSetIterator) {
902
- invariant4(this._feedSetIterator, "Iterator not initialized.", {
903
- F: __dxlog_file5,
904
- L: 380,
905
- S: this,
906
- A: [
907
- "this._feedSetIterator",
908
- "'Iterator not initialized.'"
909
- ]
910
- });
703
+ invariant4(this._feedSetIterator, "Iterator not initialized.", { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 286, S: this, A: ["this._feedSetIterator", "'Iterator not initialized.'"] });
911
704
  lastFeedSetIterator = this._feedSetIterator;
912
705
  iterable = lastFeedSetIterator[Symbol.asyncIterator]();
913
706
  }
@@ -934,12 +727,7 @@ var Pipeline = class {
934
727
  feed: feed.key.truncate(),
935
728
  seq,
936
729
  length: feed.length
937
- }, {
938
- F: __dxlog_file5,
939
- L: 409,
940
- S: this,
941
- C: (f, a) => f(...a)
942
- });
730
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 311, S: this });
943
731
  handle = feed.download({
944
732
  start: seq + 1,
945
733
  linear: true
@@ -948,12 +736,7 @@ var Pipeline = class {
948
736
  } else {
949
737
  log4("downloaded", {
950
738
  data
951
- }, {
952
- F: __dxlog_file5,
953
- L: 414,
954
- S: this,
955
- C: (f, a) => f(...a)
956
- });
739
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 323, S: this });
957
740
  }
958
741
  });
959
742
  this._downloads.set(feed, handle);
@@ -967,12 +750,7 @@ var Pipeline = class {
967
750
  log4.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, {
968
751
  currentTimeframe: this._timeframeClock.timeframe,
969
752
  targetTimeframe: this._state.targetTimeframe
970
- }, {
971
- F: __dxlog_file5,
972
- L: 428,
973
- S: this,
974
- C: (f, a) => f(...a)
975
- });
753
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file5, L: 336, S: this });
976
754
  this._state.stalled.emit();
977
755
  });
978
756
  for (const feed of this._feeds.values()) {
@@ -1009,17 +787,9 @@ var AuthExtension = class extends RpcExtension {
1009
787
  _authProps;
1010
788
  _ctx = new Context3({
1011
789
  onError: (err) => {
1012
- log5.catch(err, void 0, {
1013
- F: __dxlog_file6,
1014
- L: 28,
1015
- S: this,
1016
- C: (f, a) => f(...a)
1017
- });
790
+ log5.catch(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file6, L: 15, S: this });
1018
791
  }
1019
- }, {
1020
- F: __dxlog_file6,
1021
- L: 26
1022
- });
792
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file6, L: 13 });
1023
793
  constructor(_authProps) {
1024
794
  super({
1025
795
  requested: {
@@ -1044,12 +814,7 @@ var AuthExtension = class extends RpcExtension {
1044
814
  credential
1045
815
  };
1046
816
  } catch (err) {
1047
- log5.error("failed to generate auth credentials", err, {
1048
- F: __dxlog_file6,
1049
- L: 55,
1050
- S: this,
1051
- C: (f, a) => f(...a)
1052
- });
817
+ log5.error("failed to generate auth credentials", err, { "~LogMeta": "~LogMeta", F: __dxlog_file6, L: 42, S: this });
1053
818
  throw new Error("auth rejected");
1054
819
  }
1055
820
  }
@@ -1064,33 +829,12 @@ var AuthExtension = class extends RpcExtension {
1064
829
  const { credential } = await this.rpc.AuthService.authenticate({
1065
830
  challenge
1066
831
  });
1067
- invariant5(credential?.length > 0, "invalid credential", {
1068
- F: __dxlog_file6,
1069
- L: 69,
1070
- S: this,
1071
- A: [
1072
- "credential?.length > 0",
1073
- "'invalid credential'"
1074
- ]
1075
- });
832
+ invariant5(credential?.length > 0, "invalid credential", { "~LogMeta": "~LogMeta", F: __dxlog_file6, L: 57, S: this, A: ["credential?.length > 0", "'invalid credential'"] });
1076
833
  const success = await this._authProps.verifier(challenge, credential);
1077
- invariant5(success, "credential not verified", {
1078
- F: __dxlog_file6,
1079
- L: 71,
1080
- S: this,
1081
- A: [
1082
- "success",
1083
- "'credential not verified'"
1084
- ]
1085
- });
834
+ invariant5(success, "credential not verified", { "~LogMeta": "~LogMeta", F: __dxlog_file6, L: 59, S: this, A: ["success", "'credential not verified'"] });
1086
835
  runInContext(this._ctx, () => this._authProps.onAuthSuccess());
1087
836
  } catch (err) {
1088
- log5("auth failed", err, {
1089
- F: __dxlog_file6,
1090
- L: 74,
1091
- S: this,
1092
- C: (f, a) => f(...a)
1093
- });
837
+ log5("auth failed", err, { "~LogMeta": "~LogMeta", F: __dxlog_file6, L: 62, S: this });
1094
838
  this.close();
1095
839
  this._authProps.onAuthFailure();
1096
840
  }
@@ -1125,21 +869,18 @@ import { AdmittedFeed } from "@dxos/protocols/proto/dxos/halo/credentials";
1125
869
  import { Timeframe as Timeframe3 } from "@dxos/timeframe";
1126
870
  import { TimeSeriesCounter, TimeUsageCounter, trace } from "@dxos/tracing";
1127
871
  import { Callback, tracer } from "@dxos/util";
872
+ var __dxlog_file7 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
1128
873
  function _ts_decorate4(decorators, target, key, desc) {
1129
874
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1130
875
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1131
876
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1132
877
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1133
878
  }
1134
- var __dxlog_file7 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
1135
879
  var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 500;
1136
880
  var CONTROL_PIPELINE_SNAPSHOT_DELAY = 1e4;
1137
881
  var USE_SNAPSHOTS = true;
1138
882
  var ControlPipeline = class {
1139
- _ctx = new Context4(void 0, {
1140
- F: __dxlog_file7,
1141
- L: 47
1142
- });
883
+ _ctx = new Context4(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file7, L: 24 });
1143
884
  _pipeline;
1144
885
  _spaceStateMachine;
1145
886
  _spaceKey;
@@ -1166,12 +907,7 @@ var ControlPipeline = class {
1166
907
  this._spaceStateMachine.onFeedAdmitted.set(async (info) => {
1167
908
  log6("feed admitted", {
1168
909
  key: info.key
1169
- }, {
1170
- F: __dxlog_file7,
1171
- L: 82,
1172
- S: this,
1173
- C: (f, a) => f(...a)
1174
- });
910
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file7, L: 50, S: this });
1175
911
  if (info.assertion.designation === AdmittedFeed.Designation.CONTROL && !info.key.equals(genesisFeed.key)) {
1176
912
  scheduleMicroTask(this._ctx, async () => {
1177
913
  try {
@@ -1183,12 +919,7 @@ var ControlPipeline = class {
1183
919
  await this._pipeline.addFeed(feed);
1184
920
  }
1185
921
  } catch (err) {
1186
- log6.catch(err, void 0, {
1187
- F: __dxlog_file7,
1188
- L: 96,
1189
- S: this,
1190
- C: (f, a) => f(...a)
1191
- });
922
+ log6.catch(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file7, L: 65, S: this });
1192
923
  }
1193
924
  });
1194
925
  }
@@ -1215,31 +946,16 @@ var ControlPipeline = class {
1215
946
  key: this._spaceKey,
1216
947
  present: !!snapshot,
1217
948
  tf: snapshot?.timeframe
1218
- }, {
1219
- F: __dxlog_file7,
1220
- L: 126,
1221
- S: this,
1222
- C: (f, a) => f(...a)
1223
- });
949
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file7, L: 88, S: this });
1224
950
  if (USE_SNAPSHOTS && snapshot) {
1225
951
  await this._processSnapshot(snapshot);
1226
952
  }
1227
- log6("starting...", void 0, {
1228
- F: __dxlog_file7,
1229
- L: 131,
1230
- S: this,
1231
- C: (f, a) => f(...a)
1232
- });
953
+ log6("starting...", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file7, L: 96, S: this });
1233
954
  setTimeout(async () => {
1234
955
  void this._consumePipeline(ctx);
1235
956
  });
1236
957
  await this._pipeline.start();
1237
- log6("started", void 0, {
1238
- F: __dxlog_file7,
1239
- L: 137,
1240
- S: this,
1241
- C: (f, a) => f(...a)
1242
- });
958
+ log6("started", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file7, L: 101, S: this });
1243
959
  }
1244
960
  async _processSnapshot(snapshot) {
1245
961
  await this._pipeline.setCursor(snapshot.timeframe);
@@ -1251,12 +967,7 @@ var ControlPipeline = class {
1251
967
  if (!result) {
1252
968
  log6.warn("credential processing failed from snapshot", {
1253
969
  message
1254
- }, {
1255
- F: __dxlog_file7,
1256
- L: 150,
1257
- S: this,
1258
- C: (f, a) => f(...a)
1259
- });
970
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file7, L: 111, S: this });
1260
971
  }
1261
972
  }
1262
973
  }
@@ -1273,12 +984,7 @@ var ControlPipeline = class {
1273
984
  log6("save snapshot", {
1274
985
  key: this._spaceKey,
1275
986
  snapshot: getSnapshotLoggerContext(snapshot)
1276
- }, {
1277
- F: __dxlog_file7,
1278
- L: 166,
1279
- S: this,
1280
- C: (f, a) => f(...a)
1281
- });
987
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file7, L: 127, S: this });
1282
988
  await this._metadata.setSpaceControlPipelineSnapshot(this._spaceKey, snapshot);
1283
989
  }
1284
990
  async _consumePipeline(ctx) {
@@ -1288,12 +994,7 @@ var ControlPipeline = class {
1288
994
  try {
1289
995
  await this._processMessage(ctx, msg);
1290
996
  } catch (err) {
1291
- log6.catch(err, void 0, {
1292
- F: __dxlog_file7,
1293
- L: 178,
1294
- S: this,
1295
- C: (f, a) => f(...a)
1296
- });
997
+ log6.catch(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file7, L: 140, S: this });
1297
998
  }
1298
999
  span.end();
1299
1000
  }
@@ -1302,12 +1003,7 @@ var ControlPipeline = class {
1302
1003
  log6("processing", {
1303
1004
  key: msg.feedKey,
1304
1005
  seq: msg.seq
1305
- }, {
1306
- F: __dxlog_file7,
1307
- L: 187,
1308
- S: this,
1309
- C: (f, a) => f(...a)
1310
- });
1006
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file7, L: 146, S: this });
1311
1007
  if (msg.data.payload.credential) {
1312
1008
  const timer = tracer.mark("dxos.echo.pipeline.control");
1313
1009
  const result = await this._spaceStateMachine.process(msg.data.payload.credential.credential, {
@@ -1317,12 +1013,7 @@ var ControlPipeline = class {
1317
1013
  if (!result) {
1318
1014
  log6.warn("processing failed", {
1319
1015
  msg
1320
- }, {
1321
- F: __dxlog_file7,
1322
- L: 196,
1323
- S: this,
1324
- C: (f, a) => f(...a)
1325
- });
1016
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file7, L: 157, S: this });
1326
1017
  } else {
1327
1018
  await this._noteTargetStateIfNeeded(this._pipeline.state.pendingTimeframe);
1328
1019
  }
@@ -1336,21 +1027,11 @@ var ControlPipeline = class {
1336
1027
  }
1337
1028
  }
1338
1029
  async stop() {
1339
- log6("stopping...", void 0, {
1340
- F: __dxlog_file7,
1341
- L: 216,
1342
- S: this,
1343
- C: (f, a) => f(...a)
1344
- });
1030
+ log6("stopping...", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file7, L: 174, S: this });
1345
1031
  await this._ctx.dispose();
1346
1032
  await this._pipeline.stop();
1347
1033
  await this._saveTargetTimeframe(this._pipeline.state.timeframe);
1348
- log6("stopped", void 0, {
1349
- F: __dxlog_file7,
1350
- L: 220,
1351
- S: this,
1352
- C: (f, a) => f(...a)
1353
- });
1034
+ log6("stopped", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file7, L: 178, S: this });
1354
1035
  }
1355
1036
  async _saveTargetTimeframe(timeframe) {
1356
1037
  try {
@@ -1358,15 +1039,15 @@ var ControlPipeline = class {
1358
1039
  await this._metadata.setSpaceControlLatestTimeframe(this._spaceKey, newTimeframe);
1359
1040
  this._targetTimeframe = newTimeframe;
1360
1041
  } catch (err) {
1361
- log6(err, void 0, {
1362
- F: __dxlog_file7,
1363
- L: 229,
1364
- S: this,
1365
- C: (f, a) => f(...a)
1366
- });
1042
+ log6(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file7, L: 186, S: this });
1367
1043
  }
1368
1044
  }
1369
1045
  };
1046
+ _ts_decorate4([
1047
+ trace.info({
1048
+ spanAttribute: true
1049
+ })
1050
+ ], ControlPipeline.prototype, "_spaceKey", void 0);
1370
1051
  _ts_decorate4([
1371
1052
  trace.metricsCounter()
1372
1053
  ], ControlPipeline.prototype, "_usage", void 0);
@@ -1375,11 +1056,15 @@ _ts_decorate4([
1375
1056
  ], ControlPipeline.prototype, "_mutations", void 0);
1376
1057
  _ts_decorate4([
1377
1058
  trace.span({
1378
- showInBrowserTimeline: true
1059
+ showInBrowserTimeline: true,
1060
+ op: "lifecycle"
1379
1061
  })
1380
1062
  ], ControlPipeline.prototype, "start", null);
1381
1063
  _ts_decorate4([
1382
- trace.span()
1064
+ trace.span({
1065
+ showInBrowserTimeline: true,
1066
+ showInRemoteTracing: false
1067
+ })
1383
1068
  ], ControlPipeline.prototype, "_processMessage", null);
1384
1069
  ControlPipeline = _ts_decorate4([
1385
1070
  trace.resource(),
@@ -1399,13 +1084,13 @@ var getSnapshotLoggerContext = (snapshot) => {
1399
1084
  };
1400
1085
 
1401
1086
  // src/space/space.ts
1087
+ var __dxlog_file8 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
1402
1088
  function _ts_decorate5(decorators, target, key, desc) {
1403
1089
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1404
1090
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1405
1091
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1406
1092
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1407
1093
  }
1408
- var __dxlog_file8 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
1409
1094
  var Space = class extends Resource {
1410
1095
  onCredentialProcessed = new Callback2();
1411
1096
  stateUpdate = new Event4();
@@ -1419,15 +1104,7 @@ var Space = class extends Resource {
1419
1104
  _dataFeed;
1420
1105
  constructor(params) {
1421
1106
  super();
1422
- invariant6(params.spaceKey && params.feedProvider, void 0, {
1423
- F: __dxlog_file8,
1424
- L: 72,
1425
- S: this,
1426
- A: [
1427
- "params.spaceKey && params.feedProvider",
1428
- ""
1429
- ]
1430
- });
1107
+ invariant6(params.spaceKey && params.feedProvider, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file8, L: 31, S: this, A: ["params.spaceKey && params.feedProvider", ""] });
1431
1108
  this._id = params.id;
1432
1109
  this._key = params.spaceKey;
1433
1110
  this._genesisFeedKey = params.genesisFeed.key;
@@ -1452,34 +1129,19 @@ var Space = class extends Resource {
1452
1129
  await this.onCredentialProcessed.callIfSet(credential);
1453
1130
  log7("onCredentialProcessed", {
1454
1131
  credential
1455
- }, {
1456
- F: __dxlog_file8,
1457
- L: 99,
1458
- S: this,
1459
- C: (f, a) => f(...a)
1460
- });
1132
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file8, L: 56, S: this });
1461
1133
  this.stateUpdate.emit();
1462
1134
  });
1463
1135
  this._controlPipeline.onDelegatedInvitation.set(async (invitation) => {
1464
1136
  log7("onDelegatedInvitation", {
1465
1137
  invitation
1466
- }, {
1467
- F: __dxlog_file8,
1468
- L: 103,
1469
- S: this,
1470
- C: (f, a) => f(...a)
1471
- });
1138
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file8, L: 62, S: this });
1472
1139
  await params.onDelegatedInvitationStatusChange(invitation, true);
1473
1140
  });
1474
1141
  this._controlPipeline.onDelegatedInvitationRemoved.set(async (invitation) => {
1475
1142
  log7("onDelegatedInvitationRemoved", {
1476
1143
  invitation
1477
- }, {
1478
- F: __dxlog_file8,
1479
- L: 107,
1480
- S: this,
1481
- C: (f, a) => f(...a)
1482
- });
1144
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file8, L: 68, S: this });
1483
1145
  await params.onDelegatedInvitationStatusChange(invitation, false);
1484
1146
  });
1485
1147
  this._controlPipeline.onMemberRoleChanged.set(async (changedMembers) => {
@@ -1488,12 +1150,7 @@ var Space = class extends Resource {
1488
1150
  m.key,
1489
1151
  m.role
1490
1152
  ])
1491
- }), {
1492
- F: __dxlog_file8,
1493
- L: 111,
1494
- S: this,
1495
- C: (f, a) => f(...a)
1496
- });
1153
+ }), { "~LogMeta": "~LogMeta", F: __dxlog_file8, L: 74, S: this });
1497
1154
  await params.onMemberRolesChanged(changedMembers);
1498
1155
  });
1499
1156
  this.protocol = params.protocol;
@@ -1523,29 +1180,13 @@ var Space = class extends Resource {
1523
1180
  return this._controlPipeline.pipeline;
1524
1181
  }
1525
1182
  async setControlFeed(feed) {
1526
- invariant6(!this._controlFeed, "Control feed already set.", {
1527
- F: __dxlog_file8,
1528
- L: 155,
1529
- S: this,
1530
- A: [
1531
- "!this._controlFeed",
1532
- "'Control feed already set.'"
1533
- ]
1534
- });
1183
+ invariant6(!this._controlFeed, "Control feed already set.", { "~LogMeta": "~LogMeta", F: __dxlog_file8, L: 109, S: this, A: ["!this._controlFeed", "'Control feed already set.'"] });
1535
1184
  this._controlFeed = feed;
1536
1185
  await this._controlPipeline.setWriteFeed(feed);
1537
1186
  return this;
1538
1187
  }
1539
1188
  async setDataFeed(feed) {
1540
- invariant6(!this._dataFeed, "Data feed already set.", {
1541
- F: __dxlog_file8,
1542
- L: 162,
1543
- S: this,
1544
- A: [
1545
- "!this._dataFeed",
1546
- "'Data feed already set.'"
1547
- ]
1548
- });
1189
+ invariant6(!this._dataFeed, "Data feed already set.", { "~LogMeta": "~LogMeta", F: __dxlog_file8, L: 115, S: this, A: ["!this._dataFeed", "'Data feed already set.'"] });
1549
1190
  this._dataFeed = feed;
1550
1191
  return this;
1551
1192
  }
@@ -1556,50 +1197,22 @@ var Space = class extends Resource {
1556
1197
  return Array.from(this._controlPipeline.spaceState.feeds.values());
1557
1198
  }
1558
1199
  async _open(ctx) {
1559
- log7("opening...", void 0, {
1560
- F: __dxlog_file8,
1561
- L: 176,
1562
- S: this,
1563
- C: (f, a) => f(...a)
1564
- });
1200
+ log7("opening...", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file8, L: 125, S: this });
1565
1201
  await this._controlPipeline.start(ctx);
1566
- log7("opened", void 0, {
1567
- F: __dxlog_file8,
1568
- L: 181,
1569
- S: this,
1570
- C: (f, a) => f(...a)
1571
- });
1202
+ log7("opened", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file8, L: 128, S: this });
1572
1203
  }
1573
1204
  async startProtocol(ctx) {
1574
- invariant6(this.isOpen, void 0, {
1575
- F: __dxlog_file8,
1576
- L: 186,
1577
- S: this,
1578
- A: [
1579
- "this.isOpen",
1580
- ""
1581
- ]
1582
- });
1205
+ invariant6(this.isOpen, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file8, L: 131, S: this, A: ["this.isOpen", ""] });
1583
1206
  await this.protocol.start(ctx);
1584
1207
  await this.protocol.addFeed(await this._feedProvider(this._genesisFeedKey));
1585
1208
  }
1586
1209
  async _close(ctx) {
1587
1210
  log7("closing...", {
1588
1211
  key: this._key
1589
- }, {
1590
- F: __dxlog_file8,
1591
- L: 193,
1592
- S: this,
1593
- C: (f, a) => f(...a)
1594
- });
1212
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file8, L: 136, S: this });
1595
1213
  await this.protocol.stop(ctx);
1596
1214
  await this._controlPipeline.stop();
1597
- log7("closed", void 0, {
1598
- F: __dxlog_file8,
1599
- L: 199,
1600
- S: this,
1601
- C: (f, a) => f(...a)
1602
- });
1215
+ log7("closed", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file8, L: 142, S: this });
1603
1216
  }
1604
1217
  };
1605
1218
  _ts_decorate5([
@@ -1617,7 +1230,9 @@ _ts_decorate5([
1617
1230
  trace2.info()
1618
1231
  ], Space.prototype, "key", null);
1619
1232
  _ts_decorate5([
1620
- trace2.span()
1233
+ trace2.span({
1234
+ op: "lifecycle"
1235
+ })
1621
1236
  ], Space.prototype, "_open", null);
1622
1237
  _ts_decorate5([
1623
1238
  synchronized3
@@ -1640,10 +1255,7 @@ var __dxlog_file9 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/a
1640
1255
  var CredentialRetrieverExtension = class extends RpcExtension2 {
1641
1256
  _request;
1642
1257
  _onResult;
1643
- _ctx = new Context5(void 0, {
1644
- F: __dxlog_file9,
1645
- L: 26
1646
- });
1258
+ _ctx = new Context5(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file9, L: 14 });
1647
1259
  constructor(_request, _onResult) {
1648
1260
  super({
1649
1261
  requested: {
@@ -1713,13 +1325,13 @@ import { BlobSync } from "@dxos/teleport-extension-object-sync";
1713
1325
  import { ReplicatorExtension } from "@dxos/teleport-extension-replicator";
1714
1326
  import { trace as trace3 } from "@dxos/tracing";
1715
1327
  import { CallbackCollection, ComplexMap as ComplexMap4 } from "@dxos/util";
1328
+ var __dxlog_file10 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
1716
1329
  function _ts_decorate6(decorators, target, key, desc) {
1717
1330
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1718
1331
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1719
1332
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1720
1333
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1721
1334
  }
1722
- var __dxlog_file10 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
1723
1335
  var MOCK_AUTH_PROVIDER = async (nonce) => Buffer.from("mock");
1724
1336
  var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
1725
1337
  var SpaceProtocol = class {
@@ -1766,12 +1378,7 @@ var SpaceProtocol = class {
1766
1378
  async addFeed(feed) {
1767
1379
  log8("addFeed", {
1768
1380
  key: feed.key
1769
- }, {
1770
- F: __dxlog_file10,
1771
- L: 132,
1772
- S: this,
1773
- C: (f, a) => f(...a)
1774
- });
1381
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file10, L: 65, S: this });
1775
1382
  this._feeds.add(feed);
1776
1383
  for (const session of this._sessions.values()) {
1777
1384
  session.replicator.addFeed(feed);
@@ -1785,12 +1392,7 @@ var SpaceProtocol = class {
1785
1392
  }
1786
1393
  const credentials = await this._swarmIdentity.credentialProvider(Buffer.from(""));
1787
1394
  await this.blobSync.open();
1788
- log8("starting...", void 0, {
1789
- F: __dxlog_file10,
1790
- L: 153,
1791
- S: this,
1792
- C: (f, a) => f(...a)
1793
- });
1395
+ log8("starting...", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file10, L: 82, S: this });
1794
1396
  const topic = await this._topic;
1795
1397
  this._connection = await this._networkManager.joinSwarm(ctx, {
1796
1398
  protocolProvider: this._createProtocolProvider(credentials),
@@ -1798,12 +1400,7 @@ var SpaceProtocol = class {
1798
1400
  topology: this._topology,
1799
1401
  label: `swarm ${topic.truncate()} for space ${this._spaceKey.truncate()}`
1800
1402
  });
1801
- log8("started", void 0, {
1802
- F: __dxlog_file10,
1803
- L: 162,
1804
- S: this,
1805
- C: (f, a) => f(...a)
1806
- });
1403
+ log8("started", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file10, L: 90, S: this });
1807
1404
  }
1808
1405
  updateTopology() {
1809
1406
  this._topology.forceUpdate();
@@ -1811,19 +1408,9 @@ var SpaceProtocol = class {
1811
1408
  async stop(ctx) {
1812
1409
  await this.blobSync.close();
1813
1410
  if (this._connection) {
1814
- log8("stopping...", void 0, {
1815
- F: __dxlog_file10,
1816
- L: 173,
1817
- S: this,
1818
- C: (f, a) => f(...a)
1819
- });
1411
+ log8("stopping...", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file10, L: 98, S: this });
1820
1412
  await this._connection.close(ctx);
1821
- log8("stopped", void 0, {
1822
- F: __dxlog_file10,
1823
- L: 175,
1824
- S: this,
1825
- C: (f, a) => f(...a)
1826
- });
1413
+ log8("stopped", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file10, L: 100, S: this });
1827
1414
  }
1828
1415
  }
1829
1416
  _createProtocolProvider(credentials) {
@@ -1901,12 +1488,7 @@ var SpaceProtocolSession = class {
1901
1488
  provider: this._swarmIdentity.credentialProvider,
1902
1489
  verifier: this._swarmIdentity.credentialAuthenticator,
1903
1490
  onAuthSuccess: () => {
1904
- log8("Peer authenticated", void 0, {
1905
- F: __dxlog_file10,
1906
- L: 286,
1907
- S: this,
1908
- C: (f, a) => f(...a)
1909
- });
1491
+ log8("Peer authenticated", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file10, L: 181, S: this });
1910
1492
  this._authStatus = "SUCCESS";
1911
1493
  this._onSessionAuth?.(this._teleport);
1912
1494
  },
@@ -1921,12 +1503,7 @@ var SpaceProtocolSession = class {
1921
1503
  this._teleport.addExtension("dxos.mesh.teleport.blobsync", this._blobSync.createExtension());
1922
1504
  }
1923
1505
  async close() {
1924
- log8("close", void 0, {
1925
- F: __dxlog_file10,
1926
- L: 305,
1927
- S: this,
1928
- C: (f, a) => f(...a)
1929
- });
1506
+ log8("close", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file10, L: 197, S: this });
1930
1507
  await this._teleport.close();
1931
1508
  }
1932
1509
  async abort() {
@@ -1947,22 +1524,20 @@ import { getCredentialAssertion } from "@dxos/credentials";
1947
1524
  import { failUndefined as failUndefined2 } from "@dxos/debug";
1948
1525
  import { PublicKey as PublicKey6 } from "@dxos/keys";
1949
1526
  import { log as log9 } from "@dxos/log";
1950
- import { trace as trace4 } from "@dxos/protocols";
1951
1527
  import { ComplexMap as ComplexMap5 } from "@dxos/util";
1528
+ var __dxlog_file11 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
1952
1529
  function _ts_decorate7(decorators, target, key, desc) {
1953
1530
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1954
1531
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1955
1532
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1956
1533
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1957
1534
  }
1958
- var __dxlog_file11 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
1959
1535
  var SpaceManager = class {
1960
1536
  _spaces = new ComplexMap5(PublicKey6.hash);
1961
1537
  _feedStore;
1962
1538
  _networkManager;
1963
1539
  _metadataStore;
1964
1540
  _blobStore;
1965
- _instanceId = PublicKey6.random().toHex();
1966
1541
  _disableP2pReplication;
1967
1542
  constructor({ feedStore, networkManager, metadataStore, blobStore, disableP2pReplication }) {
1968
1543
  this._feedStore = feedStore;
@@ -1983,22 +1558,9 @@ var SpaceManager = class {
1983
1558
  ].map((space) => space.close()));
1984
1559
  }
1985
1560
  async constructSpace({ metadata, swarmIdentity, onAuthorizedConnection, onAuthFailure, onDelegatedInvitationStatusChange, onMemberRolesChanged, memberKey }) {
1986
- log9.trace("dxos.echo.space-manager.construct-space", trace4.begin({
1987
- id: this._instanceId
1988
- }), {
1989
- F: __dxlog_file11,
1990
- L: 103,
1991
- S: this,
1992
- C: (f, a) => f(...a)
1993
- });
1994
1561
  log9("constructing space...", {
1995
1562
  spaceKey: metadata.genesisFeedKey
1996
- }, {
1997
- F: __dxlog_file11,
1998
- L: 104,
1999
- S: this,
2000
- C: (f, a) => f(...a)
2001
- });
1563
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file11, L: 47, S: this });
2002
1564
  const genesisFeed = await this._feedStore.openFeed(metadata.genesisFeedKey ?? failUndefined2());
2003
1565
  const spaceKey = metadata.key;
2004
1566
  const spaceId = await createIdFromSpaceKey(spaceKey);
@@ -2023,34 +1585,12 @@ var SpaceManager = class {
2023
1585
  onMemberRolesChanged
2024
1586
  });
2025
1587
  this._spaces.set(space.key, space);
2026
- log9.trace("dxos.echo.space-manager.construct-space", trace4.end({
2027
- id: this._instanceId
2028
- }), {
2029
- F: __dxlog_file11,
2030
- L: 134,
2031
- S: this,
2032
- C: (f, a) => f(...a)
2033
- });
2034
1588
  return space;
2035
1589
  }
2036
1590
  async requestSpaceAdmissionCredential(ctx, params) {
2037
- const traceKey = "dxos.echo.space-manager.request-space-admission";
2038
- log9.trace(traceKey, trace4.begin({
2039
- id: this._instanceId
2040
- }), {
2041
- F: __dxlog_file11,
2042
- L: 143,
2043
- S: this,
2044
- C: (f, a) => f(...a)
2045
- });
2046
1591
  log9("requesting space admission credential...", {
2047
1592
  spaceKey: params.spaceKey
2048
- }, {
2049
- F: __dxlog_file11,
2050
- L: 144,
2051
- S: this,
2052
- C: (f, a) => f(...a)
2053
- });
1593
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file11, L: 78, S: this });
2054
1594
  const onCredentialResolved = new Trigger2();
2055
1595
  const protocol = new SpaceProtocol({
2056
1596
  topic: params.spaceKey,
@@ -2071,25 +1611,8 @@ var SpaceManager = class {
2071
1611
  const credential = await onCredentialResolved.wait({
2072
1612
  timeout: params.timeout
2073
1613
  });
2074
- log9.trace(traceKey, trace4.end({
2075
- id: this._instanceId
2076
- }), {
2077
- F: __dxlog_file11,
2078
- L: 168,
2079
- S: this,
2080
- C: (f, a) => f(...a)
2081
- });
2082
1614
  return credential;
2083
1615
  } catch (err) {
2084
- log9.trace(traceKey, trace4.error({
2085
- id: this._instanceId,
2086
- error: err
2087
- }), {
2088
- F: __dxlog_file11,
2089
- L: 171,
2090
- S: this,
2091
- C: (f, a) => f(...a)
2092
- });
2093
1616
  throw err;
2094
1617
  } finally {
2095
1618
  await protocol.stop(ctx);
@@ -2145,4 +1668,4 @@ export {
2145
1668
  SpaceProtocolSession,
2146
1669
  SpaceManager
2147
1670
  };
2148
- //# sourceMappingURL=chunk-IZLLEN4C.mjs.map
1671
+ //# sourceMappingURL=chunk-VIHYDCCC.mjs.map