@dxos/echo-pipeline 0.6.2-main.c33bf0c → 0.6.2-main.d41f0d2

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.
@@ -26,13 +26,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_NH5WJKOW_exports = {};
30
- __export(chunk_NH5WJKOW_exports, {
29
+ var chunk_NLHNTXVQ_exports = {};
30
+ __export(chunk_NLHNTXVQ_exports, {
31
31
  AuthExtension: () => AuthExtension,
32
32
  AuthStatus: () => AuthStatus,
33
33
  CredentialRetrieverExtension: () => CredentialRetrieverExtension,
34
34
  CredentialServerExtension: () => CredentialServerExtension,
35
35
  DataServiceImpl: () => DataServiceImpl,
36
+ DocumentsSynchronizer: () => DocumentsSynchronizer,
36
37
  MOCK_AUTH_PROVIDER: () => MOCK_AUTH_PROVIDER,
37
38
  MOCK_AUTH_VERIFIER: () => MOCK_AUTH_VERIFIER,
38
39
  MetadataStore: () => MetadataStore,
@@ -53,7 +54,7 @@ __export(chunk_NH5WJKOW_exports, {
53
54
  startAfter: () => startAfter,
54
55
  valueEncoding: () => valueEncoding
55
56
  });
56
- module.exports = __toCommonJS(chunk_NH5WJKOW_exports);
57
+ module.exports = __toCommonJS(chunk_NLHNTXVQ_exports);
57
58
  var import_hypercore = require("@dxos/hypercore");
58
59
  var import_protocols = require("@dxos/protocols");
59
60
  var import_invariant = require("@dxos/invariant");
@@ -63,72 +64,80 @@ var import_protocols2 = require("@dxos/protocols");
63
64
  var import_blob = require("@dxos/protocols/proto/dxos/echo/blob");
64
65
  var import_crypto = require("@dxos/crypto");
65
66
  var import_protocols3 = require("@dxos/protocols");
66
- var import_crc_32 = __toESM(require("crc-32"));
67
67
  var import_async = require("@dxos/async");
68
+ var import_automerge = require("@dxos/automerge/automerge");
68
69
  var import_context2 = require("@dxos/context");
69
70
  var import_invariant2 = require("@dxos/invariant");
70
- var import_keys2 = require("@dxos/keys");
71
71
  var import_log = require("@dxos/log");
72
+ var import_codec_protobuf = require("@dxos/codec-protobuf");
73
+ var import_invariant3 = require("@dxos/invariant");
74
+ var import_log2 = require("@dxos/log");
75
+ var import_crc_32 = __toESM(require("crc-32"));
76
+ var import_async2 = require("@dxos/async");
77
+ var import_context3 = require("@dxos/context");
78
+ var import_invariant4 = require("@dxos/invariant");
79
+ var import_keys2 = require("@dxos/keys");
80
+ var import_log3 = require("@dxos/log");
72
81
  var import_protocols4 = require("@dxos/protocols");
73
82
  var import_services = require("@dxos/protocols/proto/dxos/client/services");
74
83
  var import_util = require("@dxos/util");
75
- var import_async2 = require("@dxos/async");
84
+ var import_async3 = require("@dxos/async");
76
85
  var import_debug = require("@dxos/debug");
77
- var import_log2 = require("@dxos/log");
86
+ var import_log4 = require("@dxos/log");
78
87
  var import_timeframe = require("@dxos/timeframe");
79
- var import_async3 = require("@dxos/async");
80
- var import_context3 = require("@dxos/context");
88
+ var import_async4 = require("@dxos/async");
89
+ var import_context4 = require("@dxos/context");
81
90
  var import_debug2 = require("@dxos/debug");
82
91
  var import_feed_store = require("@dxos/feed-store");
83
- var import_invariant3 = require("@dxos/invariant");
92
+ var import_invariant5 = require("@dxos/invariant");
84
93
  var import_keys3 = require("@dxos/keys");
85
- var import_log3 = require("@dxos/log");
94
+ var import_log5 = require("@dxos/log");
86
95
  var import_timeframe2 = require("@dxos/timeframe");
87
96
  var import_util2 = require("@dxos/util");
88
- var import_invariant4 = require("@dxos/invariant");
89
- var import_log4 = require("@dxos/log");
90
- var import_async4 = require("@dxos/async");
91
- var import_context4 = require("@dxos/context");
97
+ var import_invariant6 = require("@dxos/invariant");
98
+ var import_log6 = require("@dxos/log");
99
+ var import_async5 = require("@dxos/async");
100
+ var import_context5 = require("@dxos/context");
92
101
  var import_crypto2 = require("@dxos/crypto");
93
- var import_invariant5 = require("@dxos/invariant");
94
- var import_log5 = require("@dxos/log");
102
+ var import_invariant7 = require("@dxos/invariant");
103
+ var import_log7 = require("@dxos/log");
95
104
  var import_protocols5 = require("@dxos/protocols");
96
105
  var import_teleport = require("@dxos/teleport");
97
- var import_async5 = require("@dxos/async");
98
- var import_context5 = require("@dxos/context");
106
+ var import_async6 = require("@dxos/async");
107
+ var import_context6 = require("@dxos/context");
99
108
  var import_crypto3 = require("@dxos/crypto");
100
- var import_invariant6 = require("@dxos/invariant");
109
+ var import_invariant8 = require("@dxos/invariant");
101
110
  var import_keys4 = require("@dxos/keys");
102
- var import_log6 = require("@dxos/log");
111
+ var import_log8 = require("@dxos/log");
103
112
  var import_credentials = require("@dxos/protocols/proto/dxos/halo/credentials");
104
113
  var import_tracing = require("@dxos/tracing");
105
114
  var import_util3 = require("@dxos/util");
106
- var import_async6 = require("@dxos/async");
107
- var import_context6 = require("@dxos/context");
115
+ var import_async7 = require("@dxos/async");
116
+ var import_context7 = require("@dxos/context");
108
117
  var import_credentials2 = require("@dxos/credentials");
109
118
  var import_keys5 = require("@dxos/keys");
110
- var import_log7 = require("@dxos/log");
119
+ var import_log9 = require("@dxos/log");
111
120
  var import_credentials3 = require("@dxos/protocols/proto/dxos/halo/credentials");
112
121
  var import_timeframe3 = require("@dxos/timeframe");
113
122
  var import_tracing2 = require("@dxos/tracing");
114
123
  var import_util4 = require("@dxos/util");
115
- var import_async7 = require("@dxos/async");
116
- var import_context7 = require("@dxos/context");
124
+ var import_async8 = require("@dxos/async");
125
+ var import_context8 = require("@dxos/context");
117
126
  var import_protocols6 = require("@dxos/protocols");
118
127
  var import_teleport2 = require("@dxos/teleport");
119
128
  var import_crypto4 = require("@dxos/crypto");
120
129
  var import_keys6 = require("@dxos/keys");
121
- var import_log8 = require("@dxos/log");
130
+ var import_log10 = require("@dxos/log");
122
131
  var import_network_manager = require("@dxos/network-manager");
123
132
  var import_teleport3 = require("@dxos/teleport");
124
133
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
125
134
  var import_teleport_extension_replicator = require("@dxos/teleport-extension-replicator");
126
135
  var import_tracing3 = require("@dxos/tracing");
127
136
  var import_util5 = require("@dxos/util");
128
- var import_async8 = require("@dxos/async");
137
+ var import_async9 = require("@dxos/async");
129
138
  var import_debug3 = require("@dxos/debug");
130
139
  var import_keys7 = require("@dxos/keys");
131
- var import_log9 = require("@dxos/log");
140
+ var import_log11 = require("@dxos/log");
132
141
  var import_protocols7 = require("@dxos/protocols");
133
142
  var import_util6 = require("@dxos/util");
134
143
  var codec = import_protocols.schema.getCodecForType("dxos.echo.feed.FeedMessage");
@@ -228,16 +237,198 @@ var SnapshotStore = class {
228
237
  }));
229
238
  }
230
239
  };
240
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/documents-synchronizer.ts";
241
+ var MAX_UPDATE_FREQ = 10;
242
+ var DocumentsSynchronizer = class extends import_context2.Resource {
243
+ constructor(_params) {
244
+ super();
245
+ this._params = _params;
246
+ this._syncStates = /* @__PURE__ */ new Map();
247
+ this._pendingUpdates = /* @__PURE__ */ new Set();
248
+ this._sendUpdatesJob = void 0;
249
+ }
250
+ async addDocuments(documentIds) {
251
+ for (const documentId of documentIds) {
252
+ const doc = this._params.repo.find(documentId);
253
+ await doc.whenReady();
254
+ this._startSync(doc);
255
+ this._pendingUpdates.add(doc.documentId);
256
+ }
257
+ this._sendUpdatesJob.trigger();
258
+ }
259
+ removeDocuments(documentIds) {
260
+ for (const documentId of documentIds) {
261
+ this._syncStates.get(documentId)?.clearSubscriptions?.();
262
+ this._syncStates.delete(documentId);
263
+ this._pendingUpdates.delete(documentId);
264
+ }
265
+ }
266
+ async _open() {
267
+ this._sendUpdatesJob = new import_async.UpdateScheduler(this._ctx, this._checkAndSendUpdates.bind(this), {
268
+ maxFrequency: MAX_UPDATE_FREQ
269
+ });
270
+ }
271
+ async _close() {
272
+ await this._sendUpdatesJob.join();
273
+ this._syncStates.clear();
274
+ }
275
+ write(updates) {
276
+ for (const { documentId, mutation, isNew } of updates) {
277
+ if (isNew) {
278
+ const doc = this._params.repo.find(documentId);
279
+ doc.update((doc2) => import_automerge.next.loadIncremental(doc2, mutation));
280
+ this._startSync(doc);
281
+ } else {
282
+ this._writeMutation(documentId, mutation);
283
+ }
284
+ }
285
+ }
286
+ _startSync(doc) {
287
+ if (this._syncStates.has(doc.documentId)) {
288
+ import_log.log.info("Document already being synced", {
289
+ documentId: doc.documentId
290
+ }, {
291
+ F: __dxlog_file2,
292
+ L: 90,
293
+ S: this,
294
+ C: (f, a) => f(...a)
295
+ });
296
+ return;
297
+ }
298
+ const syncState = {
299
+ handle: doc
300
+ };
301
+ this._subscribeForChanges(syncState);
302
+ this._syncStates.set(doc.documentId, syncState);
303
+ }
304
+ _subscribeForChanges(syncState) {
305
+ const handler = () => {
306
+ this._pendingUpdates.add(syncState.handle.documentId);
307
+ this._sendUpdatesJob.trigger();
308
+ };
309
+ syncState.handle.on("heads-changed", handler);
310
+ syncState.clearSubscriptions = () => syncState.handle.off("heads-changed", handler);
311
+ }
312
+ async _checkAndSendUpdates() {
313
+ const updates = [];
314
+ const docsWithPendingUpdates = Array.from(this._pendingUpdates);
315
+ this._pendingUpdates.clear();
316
+ for (const documentId of docsWithPendingUpdates) {
317
+ const update = this._getPendingChanges(documentId);
318
+ if (update) {
319
+ updates.push({
320
+ documentId,
321
+ mutation: update
322
+ });
323
+ }
324
+ }
325
+ if (updates.length > 0) {
326
+ this._params.sendUpdates({
327
+ updates
328
+ });
329
+ }
330
+ }
331
+ _getPendingChanges(documentId) {
332
+ const syncState = this._syncStates.get(documentId);
333
+ (0, import_invariant2.invariant)(syncState, "Sync state for document not found", {
334
+ F: __dxlog_file2,
335
+ L: 131,
336
+ S: this,
337
+ A: [
338
+ "syncState",
339
+ "'Sync state for document not found'"
340
+ ]
341
+ });
342
+ const doc = syncState.handle.docSync();
343
+ if (!doc) {
344
+ return;
345
+ }
346
+ const mutation = syncState.lastSentHead ? import_automerge.next.saveSince(doc, syncState.lastSentHead) : import_automerge.next.save(doc);
347
+ if (mutation.length === 0) {
348
+ return;
349
+ }
350
+ syncState.lastSentHead = import_automerge.next.getHeads(doc);
351
+ return mutation;
352
+ }
353
+ _writeMutation(documentId, mutation) {
354
+ const syncState = this._syncStates.get(documentId);
355
+ (0, import_invariant2.invariant)(syncState, "Sync state for document not found", {
356
+ F: __dxlog_file2,
357
+ L: 146,
358
+ S: this,
359
+ A: [
360
+ "syncState",
361
+ "'Sync state for document not found'"
362
+ ]
363
+ });
364
+ syncState.handle.update((doc) => {
365
+ const headsBefore = import_automerge.next.getHeads(doc);
366
+ const newDoc = import_automerge.next.loadIncremental(doc, mutation);
367
+ if (import_automerge.next.equals(headsBefore, syncState.lastSentHead)) {
368
+ syncState.lastSentHead = import_automerge.next.getHeads(newDoc);
369
+ }
370
+ return newDoc;
371
+ });
372
+ }
373
+ };
374
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/data-service.ts";
231
375
  var DataServiceImpl = class {
232
376
  constructor(params) {
377
+ this._subscriptions = /* @__PURE__ */ new Map();
233
378
  this._automergeHost = params.automergeHost;
234
379
  this._updateIndexes = params.updateIndexes;
235
380
  }
236
381
  subscribe(request) {
237
- throw new Error("Deprecated.");
382
+ return new import_codec_protobuf.Stream(({ next, ready }) => {
383
+ const synchronizer = new DocumentsSynchronizer({
384
+ repo: this._automergeHost.repo,
385
+ sendUpdates: (updates) => next(updates)
386
+ });
387
+ synchronizer.open().then(() => {
388
+ this._subscriptions.set(request.subscriptionId, synchronizer);
389
+ ready();
390
+ }).catch((err) => import_log2.log.catch(err, void 0, {
391
+ F: __dxlog_file3,
392
+ L: 65,
393
+ S: this,
394
+ C: (f, a) => f(...a)
395
+ }));
396
+ return () => synchronizer.close();
397
+ });
398
+ }
399
+ async updateSubscription(request) {
400
+ const synchronizer = this._subscriptions.get(request.subscriptionId);
401
+ (0, import_invariant3.invariant)(synchronizer, "Subscription not found", {
402
+ F: __dxlog_file3,
403
+ L: 72,
404
+ S: this,
405
+ A: [
406
+ "synchronizer",
407
+ "'Subscription not found'"
408
+ ]
409
+ });
410
+ if (request.addIds?.length) {
411
+ await synchronizer.addDocuments(request.addIds);
412
+ }
413
+ if (request.removeIds?.length) {
414
+ await synchronizer.removeDocuments(request.removeIds);
415
+ }
238
416
  }
239
- write(request) {
240
- throw new Error("Deprecated.");
417
+ async write(request) {
418
+ if (!request.updates) {
419
+ return;
420
+ }
421
+ const synchronizer = this._subscriptions.get(request.subscriptionId);
422
+ (0, import_invariant3.invariant)(synchronizer, "Subscription not found", {
423
+ F: __dxlog_file3,
424
+ L: 87,
425
+ S: this,
426
+ A: [
427
+ "synchronizer",
428
+ "'Subscription not found'"
429
+ ]
430
+ });
431
+ synchronizer.write(request.updates);
241
432
  }
242
433
  async flush(request) {
243
434
  await this._automergeHost.flush(request);
@@ -286,7 +477,7 @@ function _ts_decorate(decorators, target, key, desc) {
286
477
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
287
478
  return c > 3 && r && Object.defineProperty(target, key, r), r;
288
479
  }
289
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
480
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
290
481
  var EXPIRED_INVITATION_CLEANUP_INTERVAL = 60 * 60 * 1e3;
291
482
  var emptyEchoMetadata = () => ({
292
483
  version: import_protocols4.STORAGE_VERSION,
@@ -302,9 +493,9 @@ var MetadataStore = class {
302
493
  this._metadata = emptyEchoMetadata();
303
494
  this._spaceLargeMetadata = new import_util.ComplexMap(import_keys2.PublicKey.hash);
304
495
  this._metadataFile = void 0;
305
- this.update = new import_async.Event();
306
- this._invitationCleanupCtx = new import_context2.Context(void 0, {
307
- F: __dxlog_file2,
496
+ this.update = new import_async2.Event();
497
+ this._invitationCleanupCtx = new import_context3.Context(void 0, {
498
+ F: __dxlog_file4,
308
499
  L: 53
309
500
  });
310
501
  this._directory = directory;
@@ -330,12 +521,12 @@ var MetadataStore = class {
330
521
  }
331
522
  const dataSize = fromBytesInt32(await file.read(0, 4));
332
523
  const checksum = fromBytesInt32(await file.read(4, 4));
333
- (0, import_log.log)("loaded", {
524
+ (0, import_log3.log)("loaded", {
334
525
  size: dataSize,
335
526
  checksum,
336
527
  name: file.filename
337
528
  }, {
338
- F: __dxlog_file2,
529
+ F: __dxlog_file4,
339
530
  L: 89,
340
531
  S: this,
341
532
  C: (f, a) => f(...a)
@@ -367,11 +558,11 @@ var MetadataStore = class {
367
558
  result.writeInt32LE(checksum, 4);
368
559
  encoded.copy(result, 8);
369
560
  await file.write(0, result);
370
- (0, import_log.log)("saved", {
561
+ (0, import_log3.log)("saved", {
371
562
  size: encoded.length,
372
563
  checksum
373
564
  }, {
374
- F: __dxlog_file2,
565
+ F: __dxlog_file4,
375
566
  L: 124,
376
567
  S: this,
377
568
  C: (f, a) => f(...a)
@@ -401,10 +592,10 @@ var MetadataStore = class {
401
592
  space.state ??= import_services.SpaceState.ACTIVE;
402
593
  });
403
594
  } catch (err) {
404
- import_log.log.error("failed to load metadata", {
595
+ import_log3.log.error("failed to load metadata", {
405
596
  err
406
597
  }, {
407
- F: __dxlog_file2,
598
+ F: __dxlog_file4,
408
599
  L: 156,
409
600
  S: this,
410
601
  C: (f, a) => f(...a)
@@ -418,17 +609,17 @@ var MetadataStore = class {
418
609
  try {
419
610
  await this._loadSpaceLargeMetadata(key);
420
611
  } catch (err) {
421
- import_log.log.error("failed to load space large metadata", {
612
+ import_log3.log.error("failed to load space large metadata", {
422
613
  err
423
614
  }, {
424
- F: __dxlog_file2,
615
+ F: __dxlog_file4,
425
616
  L: 168,
426
617
  S: this,
427
618
  C: (f, a) => f(...a)
428
619
  });
429
620
  }
430
621
  });
431
- (0, import_async.scheduleTaskInterval)(this._invitationCleanupCtx, async () => {
622
+ (0, import_async2.scheduleTaskInterval)(this._invitationCleanupCtx, async () => {
432
623
  for (const invitation of this._metadata.invitations ?? []) {
433
624
  if (hasInvitationExpired(invitation) || isLegacyInvitationFormat(invitation)) {
434
625
  await this.removeInvitation(invitation.invitationId);
@@ -455,10 +646,10 @@ var MetadataStore = class {
455
646
  this._spaceLargeMetadata.set(key, metadata);
456
647
  }
457
648
  } catch (err) {
458
- import_log.log.error("failed to load space large metadata", {
649
+ import_log3.log.error("failed to load space large metadata", {
459
650
  err
460
651
  }, {
461
- F: __dxlog_file2,
652
+ F: __dxlog_file4,
462
653
  L: 210,
463
654
  S: this,
464
655
  C: (f, a) => f(...a)
@@ -478,8 +669,8 @@ var MetadataStore = class {
478
669
  return this._metadata.identity.haloSpace;
479
670
  }
480
671
  const space = this.spaces.find((space2) => space2.key === spaceKey);
481
- (0, import_invariant2.invariant)(space, "Space not found", {
482
- F: __dxlog_file2,
672
+ (0, import_invariant4.invariant)(space, "Space not found", {
673
+ F: __dxlog_file4,
483
674
  L: 232,
484
675
  S: this,
485
676
  A: [
@@ -502,8 +693,8 @@ var MetadataStore = class {
502
693
  * Clears storage - doesn't work for now.
503
694
  */
504
695
  async clear() {
505
- (0, import_log.log)("clearing all metadata", void 0, {
506
- F: __dxlog_file2,
696
+ (0, import_log3.log)("clearing all metadata", void 0, {
697
+ F: __dxlog_file4,
507
698
  L: 251,
508
699
  S: this,
509
700
  C: (f, a) => f(...a)
@@ -515,8 +706,8 @@ var MetadataStore = class {
515
706
  return this._metadata.identity;
516
707
  }
517
708
  async setIdentityRecord(record) {
518
- (0, import_invariant2.invariant)(!this._metadata.identity, "Cannot overwrite existing identity in metadata", {
519
- F: __dxlog_file2,
709
+ (0, import_invariant4.invariant)(!this._metadata.identity, "Cannot overwrite existing identity in metadata", {
710
+ F: __dxlog_file4,
520
711
  L: 261,
521
712
  S: this,
522
713
  A: [
@@ -545,8 +736,8 @@ var MetadataStore = class {
545
736
  await this.flush();
546
737
  }
547
738
  async addSpace(record) {
548
- (0, import_invariant2.invariant)(!(this._metadata.spaces ?? []).find((space) => space.key === record.key), "Cannot overwrite existing space in metadata", {
549
- F: __dxlog_file2,
739
+ (0, import_invariant4.invariant)(!(this._metadata.spaces ?? []).find((space) => space.key === record.key), "Cannot overwrite existing space in metadata", {
740
+ F: __dxlog_file4,
550
741
  L: 289,
551
742
  S: this,
552
743
  A: [
@@ -593,13 +784,13 @@ var MetadataStore = class {
593
784
  }
594
785
  };
595
786
  _ts_decorate([
596
- import_async.synchronized
787
+ import_async2.synchronized
597
788
  ], MetadataStore.prototype, "load", null);
598
789
  _ts_decorate([
599
- import_async.synchronized
790
+ import_async2.synchronized
600
791
  ], MetadataStore.prototype, "_save", null);
601
792
  _ts_decorate([
602
- import_async.synchronized
793
+ import_async2.synchronized
603
794
  ], MetadataStore.prototype, "_saveSpaceLargeMetadata", null);
604
795
  var fromBytesInt32 = (buf) => buf.readInt32LE(0);
605
796
  var hasInvitationExpired = (invitation) => {
@@ -618,7 +809,7 @@ function _ts_decorate2(decorators, target, key, desc) {
618
809
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
619
810
  return c > 3 && r && Object.defineProperty(target, key, r), r;
620
811
  }
621
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
812
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
622
813
  var mapTimeframeToFeedIndexes = (timeframe) => timeframe.frames().map(([feedKey, index]) => ({
623
814
  feedKey,
624
815
  index
@@ -634,7 +825,7 @@ var startAfter = (timeframe) => timeframe.frames().map(([feedKey, index]) => ({
634
825
  var TimeframeClock = class {
635
826
  constructor(_timeframe = new import_timeframe.Timeframe()) {
636
827
  this._timeframe = _timeframe;
637
- this.update = new import_async2.Event();
828
+ this.update = new import_async3.Event();
638
829
  this._pendingTimeframe = _timeframe;
639
830
  }
640
831
  /**
@@ -672,22 +863,22 @@ var TimeframeClock = class {
672
863
  return !gaps.isEmpty();
673
864
  }
674
865
  async waitUntilReached(target) {
675
- (0, import_log2.log)("waitUntilReached", {
866
+ (0, import_log4.log)("waitUntilReached", {
676
867
  target,
677
868
  current: this._timeframe
678
869
  }, {
679
- F: __dxlog_file3,
870
+ F: __dxlog_file5,
680
871
  L: 70,
681
872
  S: this,
682
873
  C: (f, a) => f(...a)
683
874
  });
684
875
  await this.update.waitForCondition(() => {
685
- (0, import_log2.log)("check if reached", {
876
+ (0, import_log4.log)("check if reached", {
686
877
  target,
687
878
  current: this._timeframe,
688
879
  deps: import_timeframe.Timeframe.dependencies(target, this._timeframe)
689
880
  }, {
690
- F: __dxlog_file3,
881
+ F: __dxlog_file5,
691
882
  L: 72,
692
883
  S: this,
693
884
  C: (f, a) => f(...a)
@@ -699,13 +890,13 @@ var TimeframeClock = class {
699
890
  _ts_decorate2([
700
891
  (0, import_debug.timed)(5e3)
701
892
  ], TimeframeClock.prototype, "waitUntilReached", null);
702
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts";
893
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts";
703
894
  var createMessageSelector = (timeframeClock) => {
704
895
  return (messages) => {
705
896
  for (let i = 0; i < messages.length; i++) {
706
897
  const { data: { timeframe } } = messages[i];
707
- (0, import_invariant4.invariant)(timeframe, void 0, {
708
- F: __dxlog_file4,
898
+ (0, import_invariant6.invariant)(timeframe, void 0, {
899
+ F: __dxlog_file6,
709
900
  L: 25,
710
901
  S: void 0,
711
902
  A: [
@@ -717,8 +908,8 @@ var createMessageSelector = (timeframeClock) => {
717
908
  return i;
718
909
  }
719
910
  }
720
- (0, import_log4.log)("Skipping...", void 0, {
721
- F: __dxlog_file4,
911
+ (0, import_log6.log)("Skipping...", void 0, {
912
+ F: __dxlog_file6,
722
913
  L: 33,
723
914
  S: void 0,
724
915
  C: (f, a) => f(...a)
@@ -735,17 +926,17 @@ function _ts_decorate3(decorators, target, key, desc) {
735
926
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
736
927
  return c > 3 && r && Object.defineProperty(target, key, r), r;
737
928
  }
738
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
929
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
739
930
  var PipelineState = class {
740
931
  constructor(_feeds, _timeframeClock) {
741
932
  this._feeds = _feeds;
742
933
  this._timeframeClock = _timeframeClock;
743
- this._ctx = new import_context3.Context(void 0, {
744
- F: __dxlog_file5,
934
+ this._ctx = new import_context4.Context(void 0, {
935
+ F: __dxlog_file7,
745
936
  L: 41
746
937
  });
747
938
  this.timeframeUpdate = this._timeframeClock.update;
748
- this.stalled = new import_async3.Event();
939
+ this.stalled = new import_async4.Event();
749
940
  this._startTimeframe = new import_timeframe2.Timeframe();
750
941
  this._reachedTarget = false;
751
942
  }
@@ -791,16 +982,16 @@ var PipelineState = class {
791
982
  *
792
983
  * @param timeout Timeout in milliseconds to specify the maximum wait time.
793
984
  */
794
- async waitUntilReachedTargetTimeframe({ ctx = new import_context3.Context(void 0, {
795
- F: __dxlog_file5,
985
+ async waitUntilReachedTargetTimeframe({ ctx = new import_context4.Context(void 0, {
986
+ F: __dxlog_file7,
796
987
  L: 129
797
988
  }), timeout, breakOnStall = true } = {}) {
798
- (0, import_log3.log)("waitUntilReachedTargetTimeframe", {
989
+ (0, import_log5.log)("waitUntilReachedTargetTimeframe", {
799
990
  timeout,
800
991
  current: this.timeframe,
801
992
  target: this.targetTimeframe
802
993
  }, {
803
- F: __dxlog_file5,
994
+ F: __dxlog_file7,
804
995
  L: 133,
805
996
  S: this,
806
997
  C: (f, a) => f(...a)
@@ -816,23 +1007,23 @@ var PipelineState = class {
816
1007
  let done = false;
817
1008
  if (timeout) {
818
1009
  return Promise.race([
819
- (0, import_context3.rejectOnDispose)(ctx),
820
- (0, import_context3.rejectOnDispose)(this._ctx),
1010
+ (0, import_context4.rejectOnDispose)(ctx),
1011
+ (0, import_context4.rejectOnDispose)(this._ctx),
821
1012
  this._reachedTargetPromise.then(() => {
822
1013
  done = true;
823
1014
  this._reachedTarget = true;
824
1015
  }),
825
- (0, import_async3.sleepWithContext)(this._ctx, timeout).then(() => {
1016
+ (0, import_async4.sleepWithContext)(this._ctx, timeout).then(() => {
826
1017
  if (done) {
827
1018
  return;
828
1019
  }
829
- import_log3.log.warn("waitUntilReachedTargetTimeframe timed out", {
1020
+ import_log5.log.warn("waitUntilReachedTargetTimeframe timed out", {
830
1021
  timeout,
831
1022
  current: this.timeframe,
832
1023
  target: this.targetTimeframe,
833
1024
  dependencies: import_timeframe2.Timeframe.dependencies(this.targetTimeframe, this.timeframe)
834
1025
  }, {
835
- F: __dxlog_file5,
1026
+ F: __dxlog_file7,
836
1027
  L: 161,
837
1028
  S: this,
838
1029
  C: (f, a) => f(...a)
@@ -849,8 +1040,8 @@ var Pipeline = class {
849
1040
  this._timeframeClock = new TimeframeClock(new import_timeframe2.Timeframe());
850
1041
  this._feeds = new import_util2.ComplexMap(import_keys3.PublicKey.hash);
851
1042
  this._state = new PipelineState(this._feeds, this._timeframeClock);
852
- this._processingTrigger = new import_async3.Trigger().wake();
853
- this._pauseTrigger = new import_async3.Trigger().wake();
1043
+ this._processingTrigger = new import_async4.Trigger().wake();
1044
+ this._pauseTrigger = new import_async4.Trigger().wake();
854
1045
  this._downloads = new import_util2.ComplexMap((value) => import_keys3.PublicKey.hash(value.key));
855
1046
  this._isStopping = false;
856
1047
  this._isStarted = false;
@@ -861,8 +1052,8 @@ var Pipeline = class {
861
1052
  return this._state;
862
1053
  }
863
1054
  get writer() {
864
- (0, import_invariant3.invariant)(this._writer, "Writer not set.", {
865
- F: __dxlog_file5,
1055
+ (0, import_invariant5.invariant)(this._writer, "Writer not set.", {
1056
+ F: __dxlog_file7,
866
1057
  L: 243,
867
1058
  S: this,
868
1059
  A: [
@@ -890,8 +1081,8 @@ var Pipeline = class {
890
1081
  }
891
1082
  }
892
1083
  setWriteFeed(feed) {
893
- (0, import_invariant3.invariant)(!this._writer, "Writer already set.", {
894
- F: __dxlog_file5,
1084
+ (0, import_invariant5.invariant)(!this._writer, "Writer already set.", {
1085
+ F: __dxlog_file7,
895
1086
  L: 270,
896
1087
  S: this,
897
1088
  A: [
@@ -899,8 +1090,8 @@ var Pipeline = class {
899
1090
  "'Writer already set.'"
900
1091
  ]
901
1092
  });
902
- (0, import_invariant3.invariant)(feed.properties.writable, "Feed must be writable.", {
903
- F: __dxlog_file5,
1093
+ (0, import_invariant5.invariant)(feed.properties.writable, "Feed must be writable.", {
1094
+ F: __dxlog_file7,
904
1095
  L: 271,
905
1096
  S: this,
906
1097
  A: [
@@ -914,8 +1105,8 @@ var Pipeline = class {
914
1105
  }), feed.createFeedWriter());
915
1106
  }
916
1107
  async start() {
917
- (0, import_invariant3.invariant)(!this._isStarted, "Pipeline is already started.", {
918
- F: __dxlog_file5,
1108
+ (0, import_invariant5.invariant)(!this._isStarted, "Pipeline is already started.", {
1109
+ F: __dxlog_file7,
919
1110
  L: 284,
920
1111
  S: this,
921
1112
  A: [
@@ -923,8 +1114,8 @@ var Pipeline = class {
923
1114
  "'Pipeline is already started.'"
924
1115
  ]
925
1116
  });
926
- (0, import_log3.log)("starting...", void 0, {
927
- F: __dxlog_file5,
1117
+ (0, import_log5.log)("starting...", void 0, {
1118
+ F: __dxlog_file7,
928
1119
  L: 285,
929
1120
  S: this,
930
1121
  C: (f, a) => f(...a)
@@ -932,8 +1123,8 @@ var Pipeline = class {
932
1123
  await this._initIterator();
933
1124
  await this._feedSetIterator.open();
934
1125
  this._isStarted = true;
935
- (0, import_log3.log)("started", void 0, {
936
- F: __dxlog_file5,
1126
+ (0, import_log5.log)("started", void 0, {
1127
+ F: __dxlog_file7,
937
1128
  L: 289,
938
1129
  S: this,
939
1130
  C: (f, a) => f(...a)
@@ -945,8 +1136,8 @@ var Pipeline = class {
945
1136
  }
946
1137
  }
947
1138
  async stop() {
948
- (0, import_log3.log)("stopping...", void 0, {
949
- F: __dxlog_file5,
1139
+ (0, import_log5.log)("stopping...", void 0, {
1140
+ F: __dxlog_file7,
950
1141
  L: 300,
951
1142
  S: this,
952
1143
  C: (f, a) => f(...a)
@@ -959,15 +1150,15 @@ var Pipeline = class {
959
1150
  await this._feedSetIterator?.close();
960
1151
  await this._processingTrigger.wait();
961
1152
  await this._state._ctx.dispose();
962
- this._state._ctx = new import_context3.Context(void 0, {
963
- F: __dxlog_file5,
1153
+ this._state._ctx = new import_context4.Context(void 0, {
1154
+ F: __dxlog_file7,
964
1155
  L: 309
965
1156
  });
966
1157
  this._state._reachedTargetPromise = void 0;
967
1158
  this._state._reachedTarget = false;
968
1159
  this._isStarted = false;
969
- (0, import_log3.log)("stopped", void 0, {
970
- F: __dxlog_file5,
1160
+ (0, import_log5.log)("stopped", void 0, {
1161
+ F: __dxlog_file7,
971
1162
  L: 313,
972
1163
  S: this,
973
1164
  C: (f, a) => f(...a)
@@ -978,8 +1169,8 @@ var Pipeline = class {
978
1169
  * The pipeline will start processing messages AFTER this timeframe.
979
1170
  */
980
1171
  async setCursor(timeframe) {
981
- (0, import_invariant3.invariant)(!this._isStarted || this._isPaused, "Invalid state.", {
982
- F: __dxlog_file5,
1172
+ (0, import_invariant5.invariant)(!this._isStarted || this._isPaused, "Invalid state.", {
1173
+ F: __dxlog_file7,
983
1174
  L: 322,
984
1175
  S: this,
985
1176
  A: [
@@ -1007,8 +1198,8 @@ var Pipeline = class {
1007
1198
  this._isPaused = true;
1008
1199
  }
1009
1200
  async unpause() {
1010
- (0, import_invariant3.invariant)(this._isPaused, "Pipeline is not paused.", {
1011
- F: __dxlog_file5,
1201
+ (0, import_invariant5.invariant)(this._isPaused, "Pipeline is not paused.", {
1202
+ F: __dxlog_file7,
1012
1203
  L: 351,
1013
1204
  S: this,
1014
1205
  A: [
@@ -1027,8 +1218,8 @@ var Pipeline = class {
1027
1218
  * Updates the timeframe clock after the message has bee processed.
1028
1219
  */
1029
1220
  async *consume() {
1030
- (0, import_invariant3.invariant)(!this._isBeingConsumed, "Pipeline is already being consumed.", {
1031
- F: __dxlog_file5,
1221
+ (0, import_invariant5.invariant)(!this._isBeingConsumed, "Pipeline is already being consumed.", {
1222
+ F: __dxlog_file7,
1032
1223
  L: 366,
1033
1224
  S: this,
1034
1225
  A: [
@@ -1037,8 +1228,8 @@ var Pipeline = class {
1037
1228
  ]
1038
1229
  });
1039
1230
  this._isBeingConsumed = true;
1040
- (0, import_invariant3.invariant)(this._feedSetIterator, "Iterator not initialized.", {
1041
- F: __dxlog_file5,
1231
+ (0, import_invariant5.invariant)(this._feedSetIterator, "Iterator not initialized.", {
1232
+ F: __dxlog_file7,
1042
1233
  L: 369,
1043
1234
  S: this,
1044
1235
  A: [
@@ -1051,8 +1242,8 @@ var Pipeline = class {
1051
1242
  while (!this._isStopping) {
1052
1243
  await this._pauseTrigger.wait();
1053
1244
  if (lastFeedSetIterator !== this._feedSetIterator) {
1054
- (0, import_invariant3.invariant)(this._feedSetIterator, "Iterator not initialized.", {
1055
- F: __dxlog_file5,
1245
+ (0, import_invariant5.invariant)(this._feedSetIterator, "Iterator not initialized.", {
1246
+ F: __dxlog_file7,
1056
1247
  L: 378,
1057
1248
  S: this,
1058
1249
  A: [
@@ -1082,12 +1273,12 @@ var Pipeline = class {
1082
1273
  }
1083
1274
  const timeframe = this._state._startTimeframe;
1084
1275
  const seq = timeframe.get(feed.key) ?? -1;
1085
- (0, import_log3.log)("download", {
1276
+ (0, import_log5.log)("download", {
1086
1277
  feed: feed.key.truncate(),
1087
1278
  seq,
1088
1279
  length: feed.length
1089
1280
  }, {
1090
- F: __dxlog_file5,
1281
+ F: __dxlog_file7,
1091
1282
  L: 407,
1092
1283
  S: this,
1093
1284
  C: (f, a) => f(...a)
@@ -1098,10 +1289,10 @@ var Pipeline = class {
1098
1289
  }, (err, data) => {
1099
1290
  if (err) {
1100
1291
  } else {
1101
- import_log3.log.info("downloaded", {
1292
+ import_log5.log.info("downloaded", {
1102
1293
  data
1103
1294
  }, {
1104
- F: __dxlog_file5,
1295
+ F: __dxlog_file7,
1105
1296
  L: 412,
1106
1297
  S: this,
1107
1298
  C: (f, a) => f(...a)
@@ -1116,8 +1307,8 @@ var Pipeline = class {
1116
1307
  stallTimeout: 1e3
1117
1308
  });
1118
1309
  this._feedSetIterator.stalled.on((iterator) => {
1119
- import_log3.log.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, void 0, {
1120
- F: __dxlog_file5,
1310
+ import_log5.log.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, void 0, {
1311
+ F: __dxlog_file7,
1121
1312
  L: 426,
1122
1313
  S: this,
1123
1314
  C: (f, a) => f(...a)
@@ -1130,21 +1321,21 @@ var Pipeline = class {
1130
1321
  }
1131
1322
  };
1132
1323
  _ts_decorate3([
1133
- import_async3.synchronized
1324
+ import_async4.synchronized
1134
1325
  ], Pipeline.prototype, "start", null);
1135
1326
  _ts_decorate3([
1136
- import_async3.synchronized
1327
+ import_async4.synchronized
1137
1328
  ], Pipeline.prototype, "stop", null);
1138
1329
  _ts_decorate3([
1139
- import_async3.synchronized
1330
+ import_async4.synchronized
1140
1331
  ], Pipeline.prototype, "setCursor", null);
1141
1332
  _ts_decorate3([
1142
- import_async3.synchronized
1333
+ import_async4.synchronized
1143
1334
  ], Pipeline.prototype, "pause", null);
1144
1335
  _ts_decorate3([
1145
- import_async3.synchronized
1336
+ import_async4.synchronized
1146
1337
  ], Pipeline.prototype, "unpause", null);
1147
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/auth.ts";
1338
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/auth.ts";
1148
1339
  var AuthExtension = class extends import_teleport.RpcExtension {
1149
1340
  constructor(_authParams) {
1150
1341
  super({
@@ -1157,17 +1348,17 @@ var AuthExtension = class extends import_teleport.RpcExtension {
1157
1348
  timeout: 60 * 1e3
1158
1349
  });
1159
1350
  this._authParams = _authParams;
1160
- this._ctx = new import_context4.Context({
1351
+ this._ctx = new import_context5.Context({
1161
1352
  onError: (err) => {
1162
- import_log5.log.catch(err, void 0, {
1163
- F: __dxlog_file6,
1353
+ import_log7.log.catch(err, void 0, {
1354
+ F: __dxlog_file8,
1164
1355
  L: 28,
1165
1356
  S: this,
1166
1357
  C: (f, a) => f(...a)
1167
1358
  });
1168
1359
  }
1169
1360
  }, {
1170
- F: __dxlog_file6,
1361
+ F: __dxlog_file8,
1171
1362
  L: 26
1172
1363
  });
1173
1364
  }
@@ -1184,8 +1375,8 @@ var AuthExtension = class extends import_teleport.RpcExtension {
1184
1375
  credential
1185
1376
  };
1186
1377
  } catch (err) {
1187
- import_log5.log.error("failed to generate auth credentials", err, {
1188
- F: __dxlog_file6,
1378
+ import_log7.log.error("failed to generate auth credentials", err, {
1379
+ F: __dxlog_file8,
1189
1380
  L: 55,
1190
1381
  S: this,
1191
1382
  C: (f, a) => f(...a)
@@ -1198,14 +1389,14 @@ var AuthExtension = class extends import_teleport.RpcExtension {
1198
1389
  }
1199
1390
  async onOpen(context) {
1200
1391
  await super.onOpen(context);
1201
- (0, import_async4.scheduleTask)(this._ctx, async () => {
1392
+ (0, import_async5.scheduleTask)(this._ctx, async () => {
1202
1393
  try {
1203
1394
  const challenge = (0, import_crypto2.randomBytes)(32);
1204
1395
  const { credential } = await this.rpc.AuthService.authenticate({
1205
1396
  challenge
1206
1397
  });
1207
- (0, import_invariant5.invariant)(credential?.length > 0, "invalid credential", {
1208
- F: __dxlog_file6,
1398
+ (0, import_invariant7.invariant)(credential?.length > 0, "invalid credential", {
1399
+ F: __dxlog_file8,
1209
1400
  L: 69,
1210
1401
  S: this,
1211
1402
  A: [
@@ -1214,8 +1405,8 @@ var AuthExtension = class extends import_teleport.RpcExtension {
1214
1405
  ]
1215
1406
  });
1216
1407
  const success = await this._authParams.verifier(challenge, credential);
1217
- (0, import_invariant5.invariant)(success, "credential not verified", {
1218
- F: __dxlog_file6,
1408
+ (0, import_invariant7.invariant)(success, "credential not verified", {
1409
+ F: __dxlog_file8,
1219
1410
  L: 71,
1220
1411
  S: this,
1221
1412
  A: [
@@ -1223,10 +1414,10 @@ var AuthExtension = class extends import_teleport.RpcExtension {
1223
1414
  "'credential not verified'"
1224
1415
  ]
1225
1416
  });
1226
- (0, import_async4.runInContext)(this._ctx, () => this._authParams.onAuthSuccess());
1417
+ (0, import_async5.runInContext)(this._ctx, () => this._authParams.onAuthSuccess());
1227
1418
  } catch (err) {
1228
- (0, import_log5.log)("auth failed", err, {
1229
- F: __dxlog_file6,
1419
+ (0, import_log7.log)("auth failed", err, {
1420
+ F: __dxlog_file8,
1230
1421
  L: 74,
1231
1422
  S: this,
1232
1423
  C: (f, a) => f(...a)
@@ -1255,22 +1446,22 @@ function _ts_decorate4(decorators, target, key, desc) {
1255
1446
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1256
1447
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1257
1448
  }
1258
- var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
1449
+ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
1259
1450
  var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 500;
1260
1451
  var CONTROL_PIPELINE_SNAPSHOT_DELAY = 1e4;
1261
1452
  var USE_SNAPSHOTS = true;
1262
1453
  var ControlPipeline = class {
1263
1454
  constructor({ spaceKey, genesisFeed, feedProvider, metadataStore }) {
1264
- this._ctx = new import_context6.Context(void 0, {
1265
- F: __dxlog_file7,
1455
+ this._ctx = new import_context7.Context(void 0, {
1456
+ F: __dxlog_file9,
1266
1457
  L: 47
1267
1458
  });
1268
1459
  this._lastTimeframeSaveTime = Date.now();
1269
1460
  this.onFeedAdmitted = new import_util4.Callback();
1270
1461
  this._usage = new import_tracing2.TimeUsageCounter();
1271
1462
  this._mutations = new import_tracing2.TimeSeriesCounter();
1272
- this._snapshotTask = new import_async6.DeferredTask(this._ctx, async () => {
1273
- await (0, import_async6.sleepWithContext)(this._ctx, CONTROL_PIPELINE_SNAPSHOT_DELAY);
1463
+ this._snapshotTask = new import_async7.DeferredTask(this._ctx, async () => {
1464
+ await (0, import_async7.sleepWithContext)(this._ctx, CONTROL_PIPELINE_SNAPSHOT_DELAY);
1274
1465
  await this._saveSnapshot();
1275
1466
  });
1276
1467
  this._spaceKey = spaceKey;
@@ -1279,10 +1470,10 @@ var ControlPipeline = class {
1279
1470
  void this._pipeline.addFeed(genesisFeed);
1280
1471
  this._spaceStateMachine = new import_credentials2.SpaceStateMachine(spaceKey);
1281
1472
  this._spaceStateMachine.onFeedAdmitted.set(async (info) => {
1282
- (0, import_log7.log)("feed admitted", {
1473
+ (0, import_log9.log)("feed admitted", {
1283
1474
  key: info.key
1284
1475
  }, {
1285
- F: __dxlog_file7,
1476
+ F: __dxlog_file9,
1286
1477
  L: 82,
1287
1478
  S: this,
1288
1479
  C: (f, a) => f(...a)
@@ -1295,8 +1486,8 @@ var ControlPipeline = class {
1295
1486
  await this._pipeline.addFeed(feed);
1296
1487
  }
1297
1488
  } catch (err) {
1298
- import_log7.log.catch(err, void 0, {
1299
- F: __dxlog_file7,
1489
+ import_log9.log.catch(err, void 0, {
1490
+ F: __dxlog_file9,
1300
1491
  L: 93,
1301
1492
  S: this,
1302
1493
  C: (f, a) => f(...a)
@@ -1323,12 +1514,12 @@ var ControlPipeline = class {
1323
1514
  }
1324
1515
  async start() {
1325
1516
  const snapshot = this._metadata.getSpaceControlPipelineSnapshot(this._spaceKey);
1326
- (0, import_log7.log)("load snapshot", {
1517
+ (0, import_log9.log)("load snapshot", {
1327
1518
  key: this._spaceKey,
1328
1519
  present: !!snapshot,
1329
1520
  tf: snapshot?.timeframe
1330
1521
  }, {
1331
- F: __dxlog_file7,
1522
+ F: __dxlog_file9,
1332
1523
  L: 123,
1333
1524
  S: this,
1334
1525
  C: (f, a) => f(...a)
@@ -1336,21 +1527,21 @@ var ControlPipeline = class {
1336
1527
  if (USE_SNAPSHOTS && snapshot) {
1337
1528
  await this._processSnapshot(snapshot);
1338
1529
  }
1339
- (0, import_log7.log)("starting...", void 0, {
1340
- F: __dxlog_file7,
1530
+ (0, import_log9.log)("starting...", void 0, {
1531
+ F: __dxlog_file9,
1341
1532
  L: 128,
1342
1533
  S: this,
1343
1534
  C: (f, a) => f(...a)
1344
1535
  });
1345
1536
  setTimeout(async () => {
1346
- void this._consumePipeline(new import_context6.Context(void 0, {
1347
- F: __dxlog_file7,
1537
+ void this._consumePipeline(new import_context7.Context(void 0, {
1538
+ F: __dxlog_file9,
1348
1539
  L: 130
1349
1540
  }));
1350
1541
  });
1351
1542
  await this._pipeline.start();
1352
- (0, import_log7.log)("started", void 0, {
1353
- F: __dxlog_file7,
1543
+ (0, import_log9.log)("started", void 0, {
1544
+ F: __dxlog_file9,
1354
1545
  L: 134,
1355
1546
  S: this,
1356
1547
  C: (f, a) => f(...a)
@@ -1364,10 +1555,10 @@ var ControlPipeline = class {
1364
1555
  skipVerification: true
1365
1556
  });
1366
1557
  if (!result) {
1367
- import_log7.log.warn("credential processing failed from snapshot", {
1558
+ import_log9.log.warn("credential processing failed from snapshot", {
1368
1559
  message
1369
1560
  }, {
1370
- F: __dxlog_file7,
1561
+ F: __dxlog_file9,
1371
1562
  L: 147,
1372
1563
  S: this,
1373
1564
  C: (f, a) => f(...a)
@@ -1385,11 +1576,11 @@ var ControlPipeline = class {
1385
1576
  }))
1386
1577
  };
1387
1578
  await this._pipeline.unpause();
1388
- (0, import_log7.log)("save snapshot", {
1579
+ (0, import_log9.log)("save snapshot", {
1389
1580
  key: this._spaceKey,
1390
1581
  snapshot
1391
1582
  }, {
1392
- F: __dxlog_file7,
1583
+ F: __dxlog_file9,
1393
1584
  L: 163,
1394
1585
  S: this,
1395
1586
  C: (f, a) => f(...a)
@@ -1403,8 +1594,8 @@ var ControlPipeline = class {
1403
1594
  try {
1404
1595
  await this._processMessage(ctx, msg);
1405
1596
  } catch (err) {
1406
- import_log7.log.catch(err, void 0, {
1407
- F: __dxlog_file7,
1597
+ import_log9.log.catch(err, void 0, {
1598
+ F: __dxlog_file9,
1408
1599
  L: 176,
1409
1600
  S: this,
1410
1601
  C: (f, a) => f(...a)
@@ -1414,11 +1605,11 @@ var ControlPipeline = class {
1414
1605
  }
1415
1606
  }
1416
1607
  async _processMessage(ctx, msg) {
1417
- (0, import_log7.log)("processing", {
1608
+ (0, import_log9.log)("processing", {
1418
1609
  key: msg.feedKey,
1419
1610
  seq: msg.seq
1420
1611
  }, {
1421
- F: __dxlog_file7,
1612
+ F: __dxlog_file9,
1422
1613
  L: 186,
1423
1614
  S: this,
1424
1615
  C: (f, a) => f(...a)
@@ -1430,10 +1621,10 @@ var ControlPipeline = class {
1430
1621
  });
1431
1622
  timer.end();
1432
1623
  if (!result) {
1433
- import_log7.log.warn("processing failed", {
1624
+ import_log9.log.warn("processing failed", {
1434
1625
  msg
1435
1626
  }, {
1436
- F: __dxlog_file7,
1627
+ F: __dxlog_file9,
1437
1628
  L: 195,
1438
1629
  S: this,
1439
1630
  C: (f, a) => f(...a)
@@ -1451,8 +1642,8 @@ var ControlPipeline = class {
1451
1642
  }
1452
1643
  }
1453
1644
  async stop() {
1454
- (0, import_log7.log)("stopping...", void 0, {
1455
- F: __dxlog_file7,
1645
+ (0, import_log9.log)("stopping...", void 0, {
1646
+ F: __dxlog_file9,
1456
1647
  L: 215,
1457
1648
  S: this,
1458
1649
  C: (f, a) => f(...a)
@@ -1460,8 +1651,8 @@ var ControlPipeline = class {
1460
1651
  await this._ctx.dispose();
1461
1652
  await this._pipeline.stop();
1462
1653
  await this._saveTargetTimeframe(this._pipeline.state.timeframe);
1463
- (0, import_log7.log)("stopped", void 0, {
1464
- F: __dxlog_file7,
1654
+ (0, import_log9.log)("stopped", void 0, {
1655
+ F: __dxlog_file9,
1465
1656
  L: 219,
1466
1657
  S: this,
1467
1658
  C: (f, a) => f(...a)
@@ -1473,8 +1664,8 @@ var ControlPipeline = class {
1473
1664
  await this._metadata.setSpaceControlLatestTimeframe(this._spaceKey, newTimeframe);
1474
1665
  this._targetTimeframe = newTimeframe;
1475
1666
  } catch (err) {
1476
- (0, import_log7.log)(err, void 0, {
1477
- F: __dxlog_file7,
1667
+ (0, import_log9.log)(err, void 0, {
1668
+ F: __dxlog_file9,
1478
1669
  L: 228,
1479
1670
  S: this,
1480
1671
  C: (f, a) => f(...a)
@@ -1501,7 +1692,7 @@ _ts_decorate4([
1501
1692
  ], ControlPipeline.prototype, "_processMessage", null);
1502
1693
  ControlPipeline = _ts_decorate4([
1503
1694
  import_tracing2.trace.resource(),
1504
- (0, import_async6.trackLeaks)("start", "stop")
1695
+ (0, import_async7.trackLeaks)("start", "stop")
1505
1696
  ], ControlPipeline);
1506
1697
  function _ts_decorate5(decorators, target, key, desc) {
1507
1698
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1513,15 +1704,15 @@ function _ts_decorate5(decorators, target, key, desc) {
1513
1704
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1514
1705
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1515
1706
  }
1516
- var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
1517
- var Space = class extends import_context5.Resource {
1707
+ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
1708
+ var Space = class extends import_context6.Resource {
1518
1709
  constructor(params) {
1519
1710
  super();
1520
- this._addFeedMutex = new import_async5.Mutex();
1711
+ this._addFeedMutex = new import_async6.Mutex();
1521
1712
  this.onCredentialProcessed = new import_util3.Callback();
1522
- this.stateUpdate = new import_async5.Event();
1523
- (0, import_invariant6.invariant)(params.spaceKey && params.feedProvider, void 0, {
1524
- F: __dxlog_file8,
1713
+ this.stateUpdate = new import_async6.Event();
1714
+ (0, import_invariant8.invariant)(params.spaceKey && params.feedProvider, void 0, {
1715
+ F: __dxlog_file10,
1525
1716
  L: 78,
1526
1717
  S: this,
1527
1718
  A: [
@@ -1552,10 +1743,10 @@ var Space = class extends import_context5.Resource {
1552
1743
  });
1553
1744
  this._controlPipeline.onCredentialProcessed.set(async (credential) => {
1554
1745
  await this.onCredentialProcessed.callIfSet(credential);
1555
- (0, import_log6.log)("onCredentialProcessed", {
1746
+ (0, import_log8.log)("onCredentialProcessed", {
1556
1747
  credential
1557
1748
  }, {
1558
- F: __dxlog_file8,
1749
+ F: __dxlog_file10,
1559
1750
  L: 106,
1560
1751
  S: this,
1561
1752
  C: (f, a) => f(...a)
@@ -1563,10 +1754,10 @@ var Space = class extends import_context5.Resource {
1563
1754
  this.stateUpdate.emit();
1564
1755
  });
1565
1756
  this._controlPipeline.onDelegatedInvitation.set(async (invitation) => {
1566
- (0, import_log6.log)("onDelegatedInvitation", {
1757
+ (0, import_log8.log)("onDelegatedInvitation", {
1567
1758
  invitation
1568
1759
  }, {
1569
- F: __dxlog_file8,
1760
+ F: __dxlog_file10,
1570
1761
  L: 110,
1571
1762
  S: this,
1572
1763
  C: (f, a) => f(...a)
@@ -1574,10 +1765,10 @@ var Space = class extends import_context5.Resource {
1574
1765
  await params.onDelegatedInvitationStatusChange(invitation, true);
1575
1766
  });
1576
1767
  this._controlPipeline.onDelegatedInvitationRemoved.set(async (invitation) => {
1577
- (0, import_log6.log)("onDelegatedInvitationRemoved", {
1768
+ (0, import_log8.log)("onDelegatedInvitationRemoved", {
1578
1769
  invitation
1579
1770
  }, {
1580
- F: __dxlog_file8,
1771
+ F: __dxlog_file10,
1581
1772
  L: 114,
1582
1773
  S: this,
1583
1774
  C: (f, a) => f(...a)
@@ -1585,13 +1776,13 @@ var Space = class extends import_context5.Resource {
1585
1776
  await params.onDelegatedInvitationStatusChange(invitation, false);
1586
1777
  });
1587
1778
  this._controlPipeline.onMemberRoleChanged.set(async (changedMembers) => {
1588
- (0, import_log6.log)("onMemberRoleChanged", () => ({
1779
+ (0, import_log8.log)("onMemberRoleChanged", () => ({
1589
1780
  changedMembers: changedMembers.map((m) => [
1590
1781
  m.key,
1591
1782
  m.role
1592
1783
  ])
1593
1784
  }), {
1594
- F: __dxlog_file8,
1785
+ F: __dxlog_file10,
1595
1786
  L: 118,
1596
1787
  S: this,
1597
1788
  C: (f, a) => f(...a)
@@ -1608,7 +1799,7 @@ var Space = class extends import_context5.Resource {
1608
1799
  return this._key;
1609
1800
  }
1610
1801
  get isOpen() {
1611
- return this._lifecycleState === import_context5.LifecycleState.OPEN;
1802
+ return this._lifecycleState === import_context6.LifecycleState.OPEN;
1612
1803
  }
1613
1804
  get genesisFeedKey() {
1614
1805
  return this._genesisFeedKey;
@@ -1632,8 +1823,8 @@ var Space = class extends import_context5.Resource {
1632
1823
  return this._snapshotManager;
1633
1824
  }
1634
1825
  async setControlFeed(feed) {
1635
- (0, import_invariant6.invariant)(!this._controlFeed, "Control feed already set.", {
1636
- F: __dxlog_file8,
1826
+ (0, import_invariant8.invariant)(!this._controlFeed, "Control feed already set.", {
1827
+ F: __dxlog_file10,
1637
1828
  L: 171,
1638
1829
  S: this,
1639
1830
  A: [
@@ -1646,8 +1837,8 @@ var Space = class extends import_context5.Resource {
1646
1837
  return this;
1647
1838
  }
1648
1839
  async setDataFeed(feed) {
1649
- (0, import_invariant6.invariant)(!this._dataFeed, "Data feed already set.", {
1650
- F: __dxlog_file8,
1840
+ (0, import_invariant8.invariant)(!this._dataFeed, "Data feed already set.", {
1841
+ F: __dxlog_file10,
1651
1842
  L: 178,
1652
1843
  S: this,
1653
1844
  A: [
@@ -1665,34 +1856,34 @@ var Space = class extends import_context5.Resource {
1665
1856
  return Array.from(this._controlPipeline.spaceState.feeds.values());
1666
1857
  }
1667
1858
  async _open(ctx) {
1668
- (0, import_log6.log)("opening...", void 0, {
1669
- F: __dxlog_file8,
1859
+ (0, import_log8.log)("opening...", void 0, {
1860
+ F: __dxlog_file10,
1670
1861
  L: 192,
1671
1862
  S: this,
1672
1863
  C: (f, a) => f(...a)
1673
1864
  });
1674
1865
  await this._controlPipeline.start();
1675
1866
  await this.protocol.start();
1676
- (0, import_log6.log)("opened", void 0, {
1677
- F: __dxlog_file8,
1867
+ (0, import_log8.log)("opened", void 0, {
1868
+ F: __dxlog_file10,
1678
1869
  L: 198,
1679
1870
  S: this,
1680
1871
  C: (f, a) => f(...a)
1681
1872
  });
1682
1873
  }
1683
1874
  async _close() {
1684
- (0, import_log6.log)("closing...", {
1875
+ (0, import_log8.log)("closing...", {
1685
1876
  key: this._key
1686
1877
  }, {
1687
- F: __dxlog_file8,
1878
+ F: __dxlog_file10,
1688
1879
  L: 203,
1689
1880
  S: this,
1690
1881
  C: (f, a) => f(...a)
1691
1882
  });
1692
1883
  await this.protocol.stop();
1693
1884
  await this._controlPipeline.stop();
1694
- (0, import_log6.log)("closed", void 0, {
1695
- F: __dxlog_file8,
1885
+ (0, import_log8.log)("closed", void 0, {
1886
+ F: __dxlog_file10,
1696
1887
  L: 209,
1697
1888
  S: this,
1698
1889
  C: (f, a) => f(...a)
@@ -1706,21 +1897,21 @@ _ts_decorate5([
1706
1897
  import_tracing.trace.info()
1707
1898
  ], Space.prototype, "_controlPipeline", void 0);
1708
1899
  _ts_decorate5([
1709
- import_log6.logInfo,
1900
+ import_log8.logInfo,
1710
1901
  import_tracing.trace.info()
1711
1902
  ], Space.prototype, "id", null);
1712
1903
  _ts_decorate5([
1713
- import_log6.logInfo,
1904
+ import_log8.logInfo,
1714
1905
  import_tracing.trace.info()
1715
1906
  ], Space.prototype, "key", null);
1716
1907
  _ts_decorate5([
1717
1908
  import_tracing.trace.span()
1718
1909
  ], Space.prototype, "_open", null);
1719
1910
  _ts_decorate5([
1720
- import_async5.synchronized
1911
+ import_async6.synchronized
1721
1912
  ], Space.prototype, "_close", null);
1722
1913
  Space = _ts_decorate5([
1723
- (0, import_async5.trackLeaks)("open", "close"),
1914
+ (0, import_async6.trackLeaks)("open", "close"),
1724
1915
  import_tracing.trace.resource()
1725
1916
  ], Space);
1726
1917
  var SPACE_IDS_CACHE = new import_util3.ComplexMap(import_keys4.PublicKey.hash);
@@ -1735,7 +1926,7 @@ var createIdFromSpaceKey = async (spaceKey) => {
1735
1926
  SPACE_IDS_CACHE.set(spaceKey, spaceId);
1736
1927
  return spaceId;
1737
1928
  };
1738
- var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/admission-discovery-extension.ts";
1929
+ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/admission-discovery-extension.ts";
1739
1930
  var CredentialRetrieverExtension = class extends import_teleport2.RpcExtension {
1740
1931
  constructor(_request, _onResult) {
1741
1932
  super({
@@ -1745,8 +1936,8 @@ var CredentialRetrieverExtension = class extends import_teleport2.RpcExtension {
1745
1936
  });
1746
1937
  this._request = _request;
1747
1938
  this._onResult = _onResult;
1748
- this._ctx = new import_context7.Context(void 0, {
1749
- F: __dxlog_file9,
1939
+ this._ctx = new import_context8.Context(void 0, {
1940
+ F: __dxlog_file11,
1750
1941
  L: 25
1751
1942
  });
1752
1943
  }
@@ -1755,7 +1946,7 @@ var CredentialRetrieverExtension = class extends import_teleport2.RpcExtension {
1755
1946
  }
1756
1947
  async onOpen(context) {
1757
1948
  await super.onOpen(context);
1758
- (0, import_async7.scheduleTask)(this._ctx, async () => {
1949
+ (0, import_async8.scheduleTask)(this._ctx, async () => {
1759
1950
  try {
1760
1951
  const result = await this.rpc.AdmissionDiscoveryService.getAdmissionCredential(this._request);
1761
1952
  this._onResult.wake(result.admissionCredential);
@@ -1806,7 +1997,7 @@ function _ts_decorate6(decorators, target, key, desc) {
1806
1997
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1807
1998
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1808
1999
  }
1809
- var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
2000
+ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
1810
2001
  var MOCK_AUTH_PROVIDER = async (nonce) => Buffer.from("mock");
1811
2002
  var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
1812
2003
  var SpaceProtocol = class {
@@ -1839,10 +2030,10 @@ var SpaceProtocol = class {
1839
2030
  }
1840
2031
  // TODO(burdon): Create abstraction for Space (e.g., add keys and have provider).
1841
2032
  addFeed(feed) {
1842
- (0, import_log8.log)("addFeed", {
2033
+ (0, import_log10.log)("addFeed", {
1843
2034
  key: feed.key
1844
2035
  }, {
1845
- F: __dxlog_file10,
2036
+ F: __dxlog_file12,
1846
2037
  L: 109,
1847
2038
  S: this,
1848
2039
  C: (f, a) => f(...a)
@@ -1859,8 +2050,8 @@ var SpaceProtocol = class {
1859
2050
  }
1860
2051
  const credentials = await this._swarmIdentity.credentialProvider(Buffer.from(""));
1861
2052
  await this.blobSync.open();
1862
- (0, import_log8.log)("starting...", void 0, {
1863
- F: __dxlog_file10,
2053
+ (0, import_log10.log)("starting...", void 0, {
2054
+ F: __dxlog_file12,
1864
2055
  L: 128,
1865
2056
  S: this,
1866
2057
  C: (f, a) => f(...a)
@@ -1873,8 +2064,8 @@ var SpaceProtocol = class {
1873
2064
  topology: this._topology,
1874
2065
  label: `swarm ${topic.truncate()} for space ${this._spaceKey.truncate()}`
1875
2066
  });
1876
- (0, import_log8.log)("started", void 0, {
1877
- F: __dxlog_file10,
2067
+ (0, import_log10.log)("started", void 0, {
2068
+ F: __dxlog_file12,
1878
2069
  L: 138,
1879
2070
  S: this,
1880
2071
  C: (f, a) => f(...a)
@@ -1886,15 +2077,15 @@ var SpaceProtocol = class {
1886
2077
  async stop() {
1887
2078
  await this.blobSync.close();
1888
2079
  if (this._connection) {
1889
- (0, import_log8.log)("stopping...", void 0, {
1890
- F: __dxlog_file10,
2080
+ (0, import_log10.log)("stopping...", void 0, {
2081
+ F: __dxlog_file12,
1891
2082
  L: 149,
1892
2083
  S: this,
1893
2084
  C: (f, a) => f(...a)
1894
2085
  });
1895
2086
  await this._connection.close();
1896
- (0, import_log8.log)("stopped", void 0, {
1897
- F: __dxlog_file10,
2087
+ (0, import_log10.log)("stopped", void 0, {
2088
+ F: __dxlog_file12,
1898
2089
  L: 151,
1899
2090
  S: this,
1900
2091
  C: (f, a) => f(...a)
@@ -1919,14 +2110,14 @@ var SpaceProtocol = class {
1919
2110
  }
1920
2111
  };
1921
2112
  _ts_decorate6([
1922
- import_log8.logInfo,
2113
+ import_log10.logInfo,
1923
2114
  import_tracing3.trace.info()
1924
2115
  ], SpaceProtocol.prototype, "_topic", void 0);
1925
2116
  _ts_decorate6([
1926
2117
  import_tracing3.trace.info()
1927
2118
  ], SpaceProtocol.prototype, "_spaceKey", void 0);
1928
2119
  _ts_decorate6([
1929
- import_log8.logInfo
2120
+ import_log10.logInfo
1930
2121
  ], SpaceProtocol.prototype, "_ownPeerKey", null);
1931
2122
  SpaceProtocol = _ts_decorate6([
1932
2123
  import_tracing3.trace.resource()
@@ -1966,8 +2157,8 @@ var SpaceProtocolSession = class {
1966
2157
  provider: this._swarmIdentity.credentialProvider,
1967
2158
  verifier: this._swarmIdentity.credentialAuthenticator,
1968
2159
  onAuthSuccess: () => {
1969
- (0, import_log8.log)("Peer authenticated", void 0, {
1970
- F: __dxlog_file10,
2160
+ (0, import_log10.log)("Peer authenticated", void 0, {
2161
+ F: __dxlog_file12,
1971
2162
  L: 248,
1972
2163
  S: this,
1973
2164
  C: (f, a) => f(...a)
@@ -1984,8 +2175,8 @@ var SpaceProtocolSession = class {
1984
2175
  this._teleport.addExtension("dxos.mesh.teleport.blobsync", this._blobSync.createExtension());
1985
2176
  }
1986
2177
  async close() {
1987
- (0, import_log8.log)("close", void 0, {
1988
- F: __dxlog_file10,
2178
+ (0, import_log10.log)("close", void 0, {
2179
+ F: __dxlog_file12,
1989
2180
  L: 264,
1990
2181
  S: this,
1991
2182
  C: (f, a) => f(...a)
@@ -1997,10 +2188,10 @@ var SpaceProtocolSession = class {
1997
2188
  }
1998
2189
  };
1999
2190
  _ts_decorate6([
2000
- import_log8.logInfo
2191
+ import_log10.logInfo
2001
2192
  ], SpaceProtocolSession.prototype, "_wireParams", void 0);
2002
2193
  _ts_decorate6([
2003
- import_log8.logInfo
2194
+ import_log10.logInfo
2004
2195
  ], SpaceProtocolSession.prototype, "authStatus", null);
2005
2196
  function _ts_decorate7(decorators, target, key, desc) {
2006
2197
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -2012,7 +2203,7 @@ function _ts_decorate7(decorators, target, key, desc) {
2012
2203
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2013
2204
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2014
2205
  }
2015
- var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
2206
+ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
2016
2207
  var SpaceManager = class {
2017
2208
  constructor({ feedStore, networkManager, metadataStore, snapshotStore, blobStore }) {
2018
2209
  this._spaces = new import_util6.ComplexMap(import_keys7.PublicKey.hash);
@@ -2035,18 +2226,18 @@ var SpaceManager = class {
2035
2226
  ].map((space) => space.close()));
2036
2227
  }
2037
2228
  async constructSpace({ metadata, swarmIdentity, onAuthorizedConnection, onAuthFailure, onDelegatedInvitationStatusChange, onMemberRolesChanged, memberKey }) {
2038
- import_log9.log.trace("dxos.echo.space-manager.construct-space", import_protocols7.trace.begin({
2229
+ import_log11.log.trace("dxos.echo.space-manager.construct-space", import_protocols7.trace.begin({
2039
2230
  id: this._instanceId
2040
2231
  }), {
2041
- F: __dxlog_file11,
2232
+ F: __dxlog_file13,
2042
2233
  L: 103,
2043
2234
  S: this,
2044
2235
  C: (f, a) => f(...a)
2045
2236
  });
2046
- (0, import_log9.log)("constructing space...", {
2237
+ (0, import_log11.log)("constructing space...", {
2047
2238
  spaceKey: metadata.genesisFeedKey
2048
2239
  }, {
2049
- F: __dxlog_file11,
2240
+ F: __dxlog_file13,
2050
2241
  L: 104,
2051
2242
  S: this,
2052
2243
  C: (f, a) => f(...a)
@@ -2076,10 +2267,10 @@ var SpaceManager = class {
2076
2267
  onMemberRolesChanged
2077
2268
  });
2078
2269
  this._spaces.set(space.key, space);
2079
- import_log9.log.trace("dxos.echo.space-manager.construct-space", import_protocols7.trace.end({
2270
+ import_log11.log.trace("dxos.echo.space-manager.construct-space", import_protocols7.trace.end({
2080
2271
  id: this._instanceId
2081
2272
  }), {
2082
- F: __dxlog_file11,
2273
+ F: __dxlog_file13,
2083
2274
  L: 135,
2084
2275
  S: this,
2085
2276
  C: (f, a) => f(...a)
@@ -2088,23 +2279,23 @@ var SpaceManager = class {
2088
2279
  }
2089
2280
  async requestSpaceAdmissionCredential(params) {
2090
2281
  const traceKey = "dxos.echo.space-manager.request-space-admission";
2091
- import_log9.log.trace(traceKey, import_protocols7.trace.begin({
2282
+ import_log11.log.trace(traceKey, import_protocols7.trace.begin({
2092
2283
  id: this._instanceId
2093
2284
  }), {
2094
- F: __dxlog_file11,
2285
+ F: __dxlog_file13,
2095
2286
  L: 141,
2096
2287
  S: this,
2097
2288
  C: (f, a) => f(...a)
2098
2289
  });
2099
- (0, import_log9.log)("requesting space admission credential...", {
2290
+ (0, import_log11.log)("requesting space admission credential...", {
2100
2291
  spaceKey: params.spaceKey
2101
2292
  }, {
2102
- F: __dxlog_file11,
2293
+ F: __dxlog_file13,
2103
2294
  L: 142,
2104
2295
  S: this,
2105
2296
  C: (f, a) => f(...a)
2106
2297
  });
2107
- const onCredentialResolved = new import_async8.Trigger();
2298
+ const onCredentialResolved = new import_async9.Trigger();
2108
2299
  const protocol = new SpaceProtocol({
2109
2300
  topic: params.spaceKey,
2110
2301
  swarmIdentity: params.swarmIdentity,
@@ -2123,21 +2314,21 @@ var SpaceManager = class {
2123
2314
  const credential = await onCredentialResolved.wait({
2124
2315
  timeout: params.timeout
2125
2316
  });
2126
- import_log9.log.trace(traceKey, import_protocols7.trace.end({
2317
+ import_log11.log.trace(traceKey, import_protocols7.trace.end({
2127
2318
  id: this._instanceId
2128
2319
  }), {
2129
- F: __dxlog_file11,
2320
+ F: __dxlog_file13,
2130
2321
  L: 165,
2131
2322
  S: this,
2132
2323
  C: (f, a) => f(...a)
2133
2324
  });
2134
2325
  return credential;
2135
2326
  } catch (err) {
2136
- import_log9.log.trace(traceKey, import_protocols7.trace.error({
2327
+ import_log11.log.trace(traceKey, import_protocols7.trace.error({
2137
2328
  id: this._instanceId,
2138
2329
  error: err
2139
2330
  }), {
2140
- F: __dxlog_file11,
2331
+ F: __dxlog_file13,
2141
2332
  L: 168,
2142
2333
  S: this,
2143
2334
  C: (f, a) => f(...a)
@@ -2149,13 +2340,13 @@ var SpaceManager = class {
2149
2340
  }
2150
2341
  };
2151
2342
  _ts_decorate7([
2152
- import_async8.synchronized
2343
+ import_async9.synchronized
2153
2344
  ], SpaceManager.prototype, "open", null);
2154
2345
  _ts_decorate7([
2155
- import_async8.synchronized
2346
+ import_async9.synchronized
2156
2347
  ], SpaceManager.prototype, "close", null);
2157
2348
  SpaceManager = _ts_decorate7([
2158
- (0, import_async8.trackLeaks)("open", "close")
2349
+ (0, import_async9.trackLeaks)("open", "close")
2159
2350
  ], SpaceManager);
2160
2351
  // Annotate the CommonJS export names for ESM import in node:
2161
2352
  0 && (module.exports = {
@@ -2164,6 +2355,7 @@ SpaceManager = _ts_decorate7([
2164
2355
  CredentialRetrieverExtension,
2165
2356
  CredentialServerExtension,
2166
2357
  DataServiceImpl,
2358
+ DocumentsSynchronizer,
2167
2359
  MOCK_AUTH_PROVIDER,
2168
2360
  MOCK_AUTH_VERIFIER,
2169
2361
  MetadataStore,
@@ -2184,4 +2376,4 @@ SpaceManager = _ts_decorate7([
2184
2376
  startAfter,
2185
2377
  valueEncoding
2186
2378
  });
2187
- //# sourceMappingURL=chunk-NH5WJKOW.cjs.map
2379
+ //# sourceMappingURL=chunk-NLHNTXVQ.cjs.map