@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.
@@ -121,17 +121,213 @@ var SnapshotStore = class {
121
121
  }
122
122
  };
123
123
 
124
+ // packages/core/echo/echo-pipeline/src/db-host/documents-synchronizer.ts
125
+ import { UpdateScheduler } from "@dxos/async";
126
+ import { next as A } from "@dxos/automerge/automerge";
127
+ import { Resource } from "@dxos/context";
128
+ import { invariant as invariant2 } from "@dxos/invariant";
129
+ import { log } from "@dxos/log";
130
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/documents-synchronizer.ts";
131
+ var MAX_UPDATE_FREQ = 10;
132
+ var DocumentsSynchronizer = class extends Resource {
133
+ constructor(_params) {
134
+ super();
135
+ this._params = _params;
136
+ this._syncStates = /* @__PURE__ */ new Map();
137
+ this._pendingUpdates = /* @__PURE__ */ new Set();
138
+ this._sendUpdatesJob = void 0;
139
+ }
140
+ async addDocuments(documentIds) {
141
+ for (const documentId of documentIds) {
142
+ const doc = this._params.repo.find(documentId);
143
+ await doc.whenReady();
144
+ this._startSync(doc);
145
+ this._pendingUpdates.add(doc.documentId);
146
+ }
147
+ this._sendUpdatesJob.trigger();
148
+ }
149
+ removeDocuments(documentIds) {
150
+ for (const documentId of documentIds) {
151
+ this._syncStates.get(documentId)?.clearSubscriptions?.();
152
+ this._syncStates.delete(documentId);
153
+ this._pendingUpdates.delete(documentId);
154
+ }
155
+ }
156
+ async _open() {
157
+ this._sendUpdatesJob = new UpdateScheduler(this._ctx, this._checkAndSendUpdates.bind(this), {
158
+ maxFrequency: MAX_UPDATE_FREQ
159
+ });
160
+ }
161
+ async _close() {
162
+ await this._sendUpdatesJob.join();
163
+ this._syncStates.clear();
164
+ }
165
+ write(updates) {
166
+ for (const { documentId, mutation, isNew } of updates) {
167
+ if (isNew) {
168
+ const doc = this._params.repo.find(documentId);
169
+ doc.update((doc2) => A.loadIncremental(doc2, mutation));
170
+ this._startSync(doc);
171
+ } else {
172
+ this._writeMutation(documentId, mutation);
173
+ }
174
+ }
175
+ }
176
+ _startSync(doc) {
177
+ if (this._syncStates.has(doc.documentId)) {
178
+ log.info("Document already being synced", {
179
+ documentId: doc.documentId
180
+ }, {
181
+ F: __dxlog_file2,
182
+ L: 90,
183
+ S: this,
184
+ C: (f, a) => f(...a)
185
+ });
186
+ return;
187
+ }
188
+ const syncState = {
189
+ handle: doc
190
+ };
191
+ this._subscribeForChanges(syncState);
192
+ this._syncStates.set(doc.documentId, syncState);
193
+ }
194
+ _subscribeForChanges(syncState) {
195
+ const handler = () => {
196
+ this._pendingUpdates.add(syncState.handle.documentId);
197
+ this._sendUpdatesJob.trigger();
198
+ };
199
+ syncState.handle.on("heads-changed", handler);
200
+ syncState.clearSubscriptions = () => syncState.handle.off("heads-changed", handler);
201
+ }
202
+ async _checkAndSendUpdates() {
203
+ const updates = [];
204
+ const docsWithPendingUpdates = Array.from(this._pendingUpdates);
205
+ this._pendingUpdates.clear();
206
+ for (const documentId of docsWithPendingUpdates) {
207
+ const update = this._getPendingChanges(documentId);
208
+ if (update) {
209
+ updates.push({
210
+ documentId,
211
+ mutation: update
212
+ });
213
+ }
214
+ }
215
+ if (updates.length > 0) {
216
+ this._params.sendUpdates({
217
+ updates
218
+ });
219
+ }
220
+ }
221
+ _getPendingChanges(documentId) {
222
+ const syncState = this._syncStates.get(documentId);
223
+ invariant2(syncState, "Sync state for document not found", {
224
+ F: __dxlog_file2,
225
+ L: 131,
226
+ S: this,
227
+ A: [
228
+ "syncState",
229
+ "'Sync state for document not found'"
230
+ ]
231
+ });
232
+ const doc = syncState.handle.docSync();
233
+ if (!doc) {
234
+ return;
235
+ }
236
+ const mutation = syncState.lastSentHead ? A.saveSince(doc, syncState.lastSentHead) : A.save(doc);
237
+ if (mutation.length === 0) {
238
+ return;
239
+ }
240
+ syncState.lastSentHead = A.getHeads(doc);
241
+ return mutation;
242
+ }
243
+ _writeMutation(documentId, mutation) {
244
+ const syncState = this._syncStates.get(documentId);
245
+ invariant2(syncState, "Sync state for document not found", {
246
+ F: __dxlog_file2,
247
+ L: 146,
248
+ S: this,
249
+ A: [
250
+ "syncState",
251
+ "'Sync state for document not found'"
252
+ ]
253
+ });
254
+ syncState.handle.update((doc) => {
255
+ const headsBefore = A.getHeads(doc);
256
+ const newDoc = A.loadIncremental(doc, mutation);
257
+ if (A.equals(headsBefore, syncState.lastSentHead)) {
258
+ syncState.lastSentHead = A.getHeads(newDoc);
259
+ }
260
+ return newDoc;
261
+ });
262
+ }
263
+ };
264
+
124
265
  // packages/core/echo/echo-pipeline/src/db-host/data-service.ts
266
+ import { Stream } from "@dxos/codec-protobuf";
267
+ import { invariant as invariant3 } from "@dxos/invariant";
268
+ import { log as log2 } from "@dxos/log";
269
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/data-service.ts";
125
270
  var DataServiceImpl = class {
126
271
  constructor(params) {
272
+ /**
273
+ * Map of subscriptions.
274
+ * subscriptionId -> DocumentsSynchronizer
275
+ */
276
+ this._subscriptions = /* @__PURE__ */ new Map();
127
277
  this._automergeHost = params.automergeHost;
128
278
  this._updateIndexes = params.updateIndexes;
129
279
  }
130
280
  subscribe(request) {
131
- throw new Error("Deprecated.");
281
+ return new Stream(({ next, ready }) => {
282
+ const synchronizer = new DocumentsSynchronizer({
283
+ repo: this._automergeHost.repo,
284
+ sendUpdates: (updates) => next(updates)
285
+ });
286
+ synchronizer.open().then(() => {
287
+ this._subscriptions.set(request.subscriptionId, synchronizer);
288
+ ready();
289
+ }).catch((err) => log2.catch(err, void 0, {
290
+ F: __dxlog_file3,
291
+ L: 65,
292
+ S: this,
293
+ C: (f, a) => f(...a)
294
+ }));
295
+ return () => synchronizer.close();
296
+ });
297
+ }
298
+ async updateSubscription(request) {
299
+ const synchronizer = this._subscriptions.get(request.subscriptionId);
300
+ invariant3(synchronizer, "Subscription not found", {
301
+ F: __dxlog_file3,
302
+ L: 72,
303
+ S: this,
304
+ A: [
305
+ "synchronizer",
306
+ "'Subscription not found'"
307
+ ]
308
+ });
309
+ if (request.addIds?.length) {
310
+ await synchronizer.addDocuments(request.addIds);
311
+ }
312
+ if (request.removeIds?.length) {
313
+ await synchronizer.removeDocuments(request.removeIds);
314
+ }
132
315
  }
133
- write(request) {
134
- throw new Error("Deprecated.");
316
+ async write(request) {
317
+ if (!request.updates) {
318
+ return;
319
+ }
320
+ const synchronizer = this._subscriptions.get(request.subscriptionId);
321
+ invariant3(synchronizer, "Subscription not found", {
322
+ F: __dxlog_file3,
323
+ L: 87,
324
+ S: this,
325
+ A: [
326
+ "synchronizer",
327
+ "'Subscription not found'"
328
+ ]
329
+ });
330
+ synchronizer.write(request.updates);
135
331
  }
136
332
  async flush(request) {
137
333
  await this._automergeHost.flush(request);
@@ -175,9 +371,9 @@ var DataServiceImpl = class {
175
371
  import CRC32 from "crc-32";
176
372
  import { Event, scheduleTaskInterval, synchronized } from "@dxos/async";
177
373
  import { Context } from "@dxos/context";
178
- import { invariant as invariant2 } from "@dxos/invariant";
374
+ import { invariant as invariant4 } from "@dxos/invariant";
179
375
  import { PublicKey as PublicKey2 } from "@dxos/keys";
180
- import { log } from "@dxos/log";
376
+ import { log as log3 } from "@dxos/log";
181
377
  import { DataCorruptionError, STORAGE_VERSION, schema as schema4 } from "@dxos/protocols";
182
378
  import { Invitation, SpaceState } from "@dxos/protocols/proto/dxos/client/services";
183
379
  import { ComplexMap, arrayToBuffer, forEachAsync, isNotNullOrUndefined } from "@dxos/util";
@@ -191,7 +387,7 @@ function _ts_decorate(decorators, target, key, desc) {
191
387
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
192
388
  return c > 3 && r && Object.defineProperty(target, key, r), r;
193
389
  }
194
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
390
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
195
391
  var EXPIRED_INVITATION_CLEANUP_INTERVAL = 60 * 60 * 1e3;
196
392
  var emptyEchoMetadata = () => ({
197
393
  version: STORAGE_VERSION,
@@ -209,7 +405,7 @@ var MetadataStore = class {
209
405
  this._metadataFile = void 0;
210
406
  this.update = new Event();
211
407
  this._invitationCleanupCtx = new Context(void 0, {
212
- F: __dxlog_file2,
408
+ F: __dxlog_file4,
213
409
  L: 53
214
410
  });
215
411
  this._directory = directory;
@@ -235,12 +431,12 @@ var MetadataStore = class {
235
431
  }
236
432
  const dataSize = fromBytesInt32(await file.read(0, 4));
237
433
  const checksum = fromBytesInt32(await file.read(4, 4));
238
- log("loaded", {
434
+ log3("loaded", {
239
435
  size: dataSize,
240
436
  checksum,
241
437
  name: file.filename
242
438
  }, {
243
- F: __dxlog_file2,
439
+ F: __dxlog_file4,
244
440
  L: 89,
245
441
  S: this,
246
442
  C: (f, a) => f(...a)
@@ -272,11 +468,11 @@ var MetadataStore = class {
272
468
  result.writeInt32LE(checksum, 4);
273
469
  encoded.copy(result, 8);
274
470
  await file.write(0, result);
275
- log("saved", {
471
+ log3("saved", {
276
472
  size: encoded.length,
277
473
  checksum
278
474
  }, {
279
- F: __dxlog_file2,
475
+ F: __dxlog_file4,
280
476
  L: 124,
281
477
  S: this,
282
478
  C: (f, a) => f(...a)
@@ -306,10 +502,10 @@ var MetadataStore = class {
306
502
  space.state ??= SpaceState.ACTIVE;
307
503
  });
308
504
  } catch (err) {
309
- log.error("failed to load metadata", {
505
+ log3.error("failed to load metadata", {
310
506
  err
311
507
  }, {
312
- F: __dxlog_file2,
508
+ F: __dxlog_file4,
313
509
  L: 156,
314
510
  S: this,
315
511
  C: (f, a) => f(...a)
@@ -323,10 +519,10 @@ var MetadataStore = class {
323
519
  try {
324
520
  await this._loadSpaceLargeMetadata(key);
325
521
  } catch (err) {
326
- log.error("failed to load space large metadata", {
522
+ log3.error("failed to load space large metadata", {
327
523
  err
328
524
  }, {
329
- F: __dxlog_file2,
525
+ F: __dxlog_file4,
330
526
  L: 168,
331
527
  S: this,
332
528
  C: (f, a) => f(...a)
@@ -360,10 +556,10 @@ var MetadataStore = class {
360
556
  this._spaceLargeMetadata.set(key, metadata);
361
557
  }
362
558
  } catch (err) {
363
- log.error("failed to load space large metadata", {
559
+ log3.error("failed to load space large metadata", {
364
560
  err
365
561
  }, {
366
- F: __dxlog_file2,
562
+ F: __dxlog_file4,
367
563
  L: 210,
368
564
  S: this,
369
565
  C: (f, a) => f(...a)
@@ -383,8 +579,8 @@ var MetadataStore = class {
383
579
  return this._metadata.identity.haloSpace;
384
580
  }
385
581
  const space = this.spaces.find((space2) => space2.key === spaceKey);
386
- invariant2(space, "Space not found", {
387
- F: __dxlog_file2,
582
+ invariant4(space, "Space not found", {
583
+ F: __dxlog_file4,
388
584
  L: 232,
389
585
  S: this,
390
586
  A: [
@@ -407,8 +603,8 @@ var MetadataStore = class {
407
603
  * Clears storage - doesn't work for now.
408
604
  */
409
605
  async clear() {
410
- log("clearing all metadata", void 0, {
411
- F: __dxlog_file2,
606
+ log3("clearing all metadata", void 0, {
607
+ F: __dxlog_file4,
412
608
  L: 251,
413
609
  S: this,
414
610
  C: (f, a) => f(...a)
@@ -420,8 +616,8 @@ var MetadataStore = class {
420
616
  return this._metadata.identity;
421
617
  }
422
618
  async setIdentityRecord(record) {
423
- invariant2(!this._metadata.identity, "Cannot overwrite existing identity in metadata", {
424
- F: __dxlog_file2,
619
+ invariant4(!this._metadata.identity, "Cannot overwrite existing identity in metadata", {
620
+ F: __dxlog_file4,
425
621
  L: 261,
426
622
  S: this,
427
623
  A: [
@@ -450,8 +646,8 @@ var MetadataStore = class {
450
646
  await this.flush();
451
647
  }
452
648
  async addSpace(record) {
453
- invariant2(!(this._metadata.spaces ?? []).find((space) => space.key === record.key), "Cannot overwrite existing space in metadata", {
454
- F: __dxlog_file2,
649
+ invariant4(!(this._metadata.spaces ?? []).find((space) => space.key === record.key), "Cannot overwrite existing space in metadata", {
650
+ F: __dxlog_file4,
455
651
  L: 289,
456
652
  S: this,
457
653
  A: [
@@ -517,7 +713,7 @@ var isLegacyInvitationFormat = (invitation) => {
517
713
  // packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts
518
714
  import { Event as Event2 } from "@dxos/async";
519
715
  import { timed } from "@dxos/debug";
520
- import { log as log2 } from "@dxos/log";
716
+ import { log as log4 } from "@dxos/log";
521
717
  import { Timeframe } from "@dxos/timeframe";
522
718
  function _ts_decorate2(decorators, target, key, desc) {
523
719
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -529,7 +725,7 @@ function _ts_decorate2(decorators, target, key, desc) {
529
725
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
530
726
  return c > 3 && r && Object.defineProperty(target, key, r), r;
531
727
  }
532
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
728
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
533
729
  var mapTimeframeToFeedIndexes = (timeframe) => timeframe.frames().map(([feedKey, index]) => ({
534
730
  feedKey,
535
731
  index
@@ -583,22 +779,22 @@ var TimeframeClock = class {
583
779
  return !gaps.isEmpty();
584
780
  }
585
781
  async waitUntilReached(target) {
586
- log2("waitUntilReached", {
782
+ log4("waitUntilReached", {
587
783
  target,
588
784
  current: this._timeframe
589
785
  }, {
590
- F: __dxlog_file3,
786
+ F: __dxlog_file5,
591
787
  L: 70,
592
788
  S: this,
593
789
  C: (f, a) => f(...a)
594
790
  });
595
791
  await this.update.waitForCondition(() => {
596
- log2("check if reached", {
792
+ log4("check if reached", {
597
793
  target,
598
794
  current: this._timeframe,
599
795
  deps: Timeframe.dependencies(target, this._timeframe)
600
796
  }, {
601
- F: __dxlog_file3,
797
+ F: __dxlog_file5,
602
798
  L: 72,
603
799
  S: this,
604
800
  C: (f, a) => f(...a)
@@ -616,22 +812,22 @@ import { Event as Event3, sleepWithContext, synchronized as synchronized2, Trigg
616
812
  import { Context as Context2, rejectOnDispose } from "@dxos/context";
617
813
  import { failUndefined } from "@dxos/debug";
618
814
  import { FeedSetIterator } from "@dxos/feed-store";
619
- import { invariant as invariant4 } from "@dxos/invariant";
815
+ import { invariant as invariant6 } from "@dxos/invariant";
620
816
  import { PublicKey as PublicKey3 } from "@dxos/keys";
621
- import { log as log4 } from "@dxos/log";
817
+ import { log as log6 } from "@dxos/log";
622
818
  import { Timeframe as Timeframe2 } from "@dxos/timeframe";
623
819
  import { ComplexMap as ComplexMap2 } from "@dxos/util";
624
820
 
625
821
  // packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts
626
- import { invariant as invariant3 } from "@dxos/invariant";
627
- import { log as log3 } from "@dxos/log";
628
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts";
822
+ import { invariant as invariant5 } from "@dxos/invariant";
823
+ import { log as log5 } from "@dxos/log";
824
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts";
629
825
  var createMessageSelector = (timeframeClock) => {
630
826
  return (messages) => {
631
827
  for (let i = 0; i < messages.length; i++) {
632
828
  const { data: { timeframe } } = messages[i];
633
- invariant3(timeframe, void 0, {
634
- F: __dxlog_file4,
829
+ invariant5(timeframe, void 0, {
830
+ F: __dxlog_file6,
635
831
  L: 25,
636
832
  S: void 0,
637
833
  A: [
@@ -643,8 +839,8 @@ var createMessageSelector = (timeframeClock) => {
643
839
  return i;
644
840
  }
645
841
  }
646
- log3("Skipping...", void 0, {
647
- F: __dxlog_file4,
842
+ log5("Skipping...", void 0, {
843
+ F: __dxlog_file6,
648
844
  L: 33,
649
845
  S: void 0,
650
846
  C: (f, a) => f(...a)
@@ -663,13 +859,13 @@ function _ts_decorate3(decorators, target, key, desc) {
663
859
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
664
860
  return c > 3 && r && Object.defineProperty(target, key, r), r;
665
861
  }
666
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
862
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
667
863
  var PipelineState = class {
668
864
  constructor(_feeds, _timeframeClock) {
669
865
  this._feeds = _feeds;
670
866
  this._timeframeClock = _timeframeClock;
671
867
  this._ctx = new Context2(void 0, {
672
- F: __dxlog_file5,
868
+ F: __dxlog_file7,
673
869
  L: 41
674
870
  });
675
871
  this.timeframeUpdate = this._timeframeClock.update;
@@ -720,15 +916,15 @@ var PipelineState = class {
720
916
  * @param timeout Timeout in milliseconds to specify the maximum wait time.
721
917
  */
722
918
  async waitUntilReachedTargetTimeframe({ ctx = new Context2(void 0, {
723
- F: __dxlog_file5,
919
+ F: __dxlog_file7,
724
920
  L: 129
725
921
  }), timeout, breakOnStall = true } = {}) {
726
- log4("waitUntilReachedTargetTimeframe", {
922
+ log6("waitUntilReachedTargetTimeframe", {
727
923
  timeout,
728
924
  current: this.timeframe,
729
925
  target: this.targetTimeframe
730
926
  }, {
731
- F: __dxlog_file5,
927
+ F: __dxlog_file7,
732
928
  L: 133,
733
929
  S: this,
734
930
  C: (f, a) => f(...a)
@@ -754,13 +950,13 @@ var PipelineState = class {
754
950
  if (done) {
755
951
  return;
756
952
  }
757
- log4.warn("waitUntilReachedTargetTimeframe timed out", {
953
+ log6.warn("waitUntilReachedTargetTimeframe timed out", {
758
954
  timeout,
759
955
  current: this.timeframe,
760
956
  target: this.targetTimeframe,
761
957
  dependencies: Timeframe2.dependencies(this.targetTimeframe, this.timeframe)
762
958
  }, {
763
- F: __dxlog_file5,
959
+ F: __dxlog_file7,
764
960
  L: 161,
765
961
  S: this,
766
962
  C: (f, a) => f(...a)
@@ -792,8 +988,8 @@ var Pipeline = class {
792
988
  return this._state;
793
989
  }
794
990
  get writer() {
795
- invariant4(this._writer, "Writer not set.", {
796
- F: __dxlog_file5,
991
+ invariant6(this._writer, "Writer not set.", {
992
+ F: __dxlog_file7,
797
993
  L: 243,
798
994
  S: this,
799
995
  A: [
@@ -821,8 +1017,8 @@ var Pipeline = class {
821
1017
  }
822
1018
  }
823
1019
  setWriteFeed(feed) {
824
- invariant4(!this._writer, "Writer already set.", {
825
- F: __dxlog_file5,
1020
+ invariant6(!this._writer, "Writer already set.", {
1021
+ F: __dxlog_file7,
826
1022
  L: 270,
827
1023
  S: this,
828
1024
  A: [
@@ -830,8 +1026,8 @@ var Pipeline = class {
830
1026
  "'Writer already set.'"
831
1027
  ]
832
1028
  });
833
- invariant4(feed.properties.writable, "Feed must be writable.", {
834
- F: __dxlog_file5,
1029
+ invariant6(feed.properties.writable, "Feed must be writable.", {
1030
+ F: __dxlog_file7,
835
1031
  L: 271,
836
1032
  S: this,
837
1033
  A: [
@@ -845,8 +1041,8 @@ var Pipeline = class {
845
1041
  }), feed.createFeedWriter());
846
1042
  }
847
1043
  async start() {
848
- invariant4(!this._isStarted, "Pipeline is already started.", {
849
- F: __dxlog_file5,
1044
+ invariant6(!this._isStarted, "Pipeline is already started.", {
1045
+ F: __dxlog_file7,
850
1046
  L: 284,
851
1047
  S: this,
852
1048
  A: [
@@ -854,8 +1050,8 @@ var Pipeline = class {
854
1050
  "'Pipeline is already started.'"
855
1051
  ]
856
1052
  });
857
- log4("starting...", void 0, {
858
- F: __dxlog_file5,
1053
+ log6("starting...", void 0, {
1054
+ F: __dxlog_file7,
859
1055
  L: 285,
860
1056
  S: this,
861
1057
  C: (f, a) => f(...a)
@@ -863,8 +1059,8 @@ var Pipeline = class {
863
1059
  await this._initIterator();
864
1060
  await this._feedSetIterator.open();
865
1061
  this._isStarted = true;
866
- log4("started", void 0, {
867
- F: __dxlog_file5,
1062
+ log6("started", void 0, {
1063
+ F: __dxlog_file7,
868
1064
  L: 289,
869
1065
  S: this,
870
1066
  C: (f, a) => f(...a)
@@ -876,8 +1072,8 @@ var Pipeline = class {
876
1072
  }
877
1073
  }
878
1074
  async stop() {
879
- log4("stopping...", void 0, {
880
- F: __dxlog_file5,
1075
+ log6("stopping...", void 0, {
1076
+ F: __dxlog_file7,
881
1077
  L: 300,
882
1078
  S: this,
883
1079
  C: (f, a) => f(...a)
@@ -891,14 +1087,14 @@ var Pipeline = class {
891
1087
  await this._processingTrigger.wait();
892
1088
  await this._state._ctx.dispose();
893
1089
  this._state._ctx = new Context2(void 0, {
894
- F: __dxlog_file5,
1090
+ F: __dxlog_file7,
895
1091
  L: 309
896
1092
  });
897
1093
  this._state._reachedTargetPromise = void 0;
898
1094
  this._state._reachedTarget = false;
899
1095
  this._isStarted = false;
900
- log4("stopped", void 0, {
901
- F: __dxlog_file5,
1096
+ log6("stopped", void 0, {
1097
+ F: __dxlog_file7,
902
1098
  L: 313,
903
1099
  S: this,
904
1100
  C: (f, a) => f(...a)
@@ -909,8 +1105,8 @@ var Pipeline = class {
909
1105
  * The pipeline will start processing messages AFTER this timeframe.
910
1106
  */
911
1107
  async setCursor(timeframe) {
912
- invariant4(!this._isStarted || this._isPaused, "Invalid state.", {
913
- F: __dxlog_file5,
1108
+ invariant6(!this._isStarted || this._isPaused, "Invalid state.", {
1109
+ F: __dxlog_file7,
914
1110
  L: 322,
915
1111
  S: this,
916
1112
  A: [
@@ -938,8 +1134,8 @@ var Pipeline = class {
938
1134
  this._isPaused = true;
939
1135
  }
940
1136
  async unpause() {
941
- invariant4(this._isPaused, "Pipeline is not paused.", {
942
- F: __dxlog_file5,
1137
+ invariant6(this._isPaused, "Pipeline is not paused.", {
1138
+ F: __dxlog_file7,
943
1139
  L: 351,
944
1140
  S: this,
945
1141
  A: [
@@ -958,8 +1154,8 @@ var Pipeline = class {
958
1154
  * Updates the timeframe clock after the message has bee processed.
959
1155
  */
960
1156
  async *consume() {
961
- invariant4(!this._isBeingConsumed, "Pipeline is already being consumed.", {
962
- F: __dxlog_file5,
1157
+ invariant6(!this._isBeingConsumed, "Pipeline is already being consumed.", {
1158
+ F: __dxlog_file7,
963
1159
  L: 366,
964
1160
  S: this,
965
1161
  A: [
@@ -968,8 +1164,8 @@ var Pipeline = class {
968
1164
  ]
969
1165
  });
970
1166
  this._isBeingConsumed = true;
971
- invariant4(this._feedSetIterator, "Iterator not initialized.", {
972
- F: __dxlog_file5,
1167
+ invariant6(this._feedSetIterator, "Iterator not initialized.", {
1168
+ F: __dxlog_file7,
973
1169
  L: 369,
974
1170
  S: this,
975
1171
  A: [
@@ -982,8 +1178,8 @@ var Pipeline = class {
982
1178
  while (!this._isStopping) {
983
1179
  await this._pauseTrigger.wait();
984
1180
  if (lastFeedSetIterator !== this._feedSetIterator) {
985
- invariant4(this._feedSetIterator, "Iterator not initialized.", {
986
- F: __dxlog_file5,
1181
+ invariant6(this._feedSetIterator, "Iterator not initialized.", {
1182
+ F: __dxlog_file7,
987
1183
  L: 378,
988
1184
  S: this,
989
1185
  A: [
@@ -1013,12 +1209,12 @@ var Pipeline = class {
1013
1209
  }
1014
1210
  const timeframe = this._state._startTimeframe;
1015
1211
  const seq = timeframe.get(feed.key) ?? -1;
1016
- log4("download", {
1212
+ log6("download", {
1017
1213
  feed: feed.key.truncate(),
1018
1214
  seq,
1019
1215
  length: feed.length
1020
1216
  }, {
1021
- F: __dxlog_file5,
1217
+ F: __dxlog_file7,
1022
1218
  L: 407,
1023
1219
  S: this,
1024
1220
  C: (f, a) => f(...a)
@@ -1029,10 +1225,10 @@ var Pipeline = class {
1029
1225
  }, (err, data) => {
1030
1226
  if (err) {
1031
1227
  } else {
1032
- log4.info("downloaded", {
1228
+ log6.info("downloaded", {
1033
1229
  data
1034
1230
  }, {
1035
- F: __dxlog_file5,
1231
+ F: __dxlog_file7,
1036
1232
  L: 412,
1037
1233
  S: this,
1038
1234
  C: (f, a) => f(...a)
@@ -1047,8 +1243,8 @@ var Pipeline = class {
1047
1243
  stallTimeout: 1e3
1048
1244
  });
1049
1245
  this._feedSetIterator.stalled.on((iterator) => {
1050
- log4.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, void 0, {
1051
- F: __dxlog_file5,
1246
+ log6.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, void 0, {
1247
+ F: __dxlog_file7,
1052
1248
  L: 426,
1053
1249
  S: this,
1054
1250
  C: (f, a) => f(...a)
@@ -1080,11 +1276,11 @@ _ts_decorate3([
1080
1276
  import { runInContext, scheduleTask } from "@dxos/async";
1081
1277
  import { Context as Context3 } from "@dxos/context";
1082
1278
  import { randomBytes } from "@dxos/crypto";
1083
- import { invariant as invariant5 } from "@dxos/invariant";
1084
- import { log as log5 } from "@dxos/log";
1279
+ import { invariant as invariant7 } from "@dxos/invariant";
1280
+ import { log as log7 } from "@dxos/log";
1085
1281
  import { schema as schema5 } from "@dxos/protocols";
1086
1282
  import { RpcExtension } from "@dxos/teleport";
1087
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/auth.ts";
1283
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/auth.ts";
1088
1284
  var AuthExtension = class extends RpcExtension {
1089
1285
  constructor(_authParams) {
1090
1286
  super({
@@ -1099,15 +1295,15 @@ var AuthExtension = class extends RpcExtension {
1099
1295
  this._authParams = _authParams;
1100
1296
  this._ctx = new Context3({
1101
1297
  onError: (err) => {
1102
- log5.catch(err, void 0, {
1103
- F: __dxlog_file6,
1298
+ log7.catch(err, void 0, {
1299
+ F: __dxlog_file8,
1104
1300
  L: 28,
1105
1301
  S: this,
1106
1302
  C: (f, a) => f(...a)
1107
1303
  });
1108
1304
  }
1109
1305
  }, {
1110
- F: __dxlog_file6,
1306
+ F: __dxlog_file8,
1111
1307
  L: 26
1112
1308
  });
1113
1309
  }
@@ -1124,8 +1320,8 @@ var AuthExtension = class extends RpcExtension {
1124
1320
  credential
1125
1321
  };
1126
1322
  } catch (err) {
1127
- log5.error("failed to generate auth credentials", err, {
1128
- F: __dxlog_file6,
1323
+ log7.error("failed to generate auth credentials", err, {
1324
+ F: __dxlog_file8,
1129
1325
  L: 55,
1130
1326
  S: this,
1131
1327
  C: (f, a) => f(...a)
@@ -1144,8 +1340,8 @@ var AuthExtension = class extends RpcExtension {
1144
1340
  const { credential } = await this.rpc.AuthService.authenticate({
1145
1341
  challenge
1146
1342
  });
1147
- invariant5(credential?.length > 0, "invalid credential", {
1148
- F: __dxlog_file6,
1343
+ invariant7(credential?.length > 0, "invalid credential", {
1344
+ F: __dxlog_file8,
1149
1345
  L: 69,
1150
1346
  S: this,
1151
1347
  A: [
@@ -1154,8 +1350,8 @@ var AuthExtension = class extends RpcExtension {
1154
1350
  ]
1155
1351
  });
1156
1352
  const success = await this._authParams.verifier(challenge, credential);
1157
- invariant5(success, "credential not verified", {
1158
- F: __dxlog_file6,
1353
+ invariant7(success, "credential not verified", {
1354
+ F: __dxlog_file8,
1159
1355
  L: 71,
1160
1356
  S: this,
1161
1357
  A: [
@@ -1165,8 +1361,8 @@ var AuthExtension = class extends RpcExtension {
1165
1361
  });
1166
1362
  runInContext(this._ctx, () => this._authParams.onAuthSuccess());
1167
1363
  } catch (err) {
1168
- log5("auth failed", err, {
1169
- F: __dxlog_file6,
1364
+ log7("auth failed", err, {
1365
+ F: __dxlog_file8,
1170
1366
  L: 74,
1171
1367
  S: this,
1172
1368
  C: (f, a) => f(...a)
@@ -1188,11 +1384,11 @@ var AuthExtension = class extends RpcExtension {
1188
1384
 
1189
1385
  // packages/core/echo/echo-pipeline/src/space/space.ts
1190
1386
  import { Event as Event4, Mutex, synchronized as synchronized3, trackLeaks as trackLeaks2 } from "@dxos/async";
1191
- import { LifecycleState, Resource } from "@dxos/context";
1387
+ import { LifecycleState, Resource as Resource2 } from "@dxos/context";
1192
1388
  import { subtleCrypto as subtleCrypto2 } from "@dxos/crypto";
1193
- import { invariant as invariant6 } from "@dxos/invariant";
1389
+ import { invariant as invariant8 } from "@dxos/invariant";
1194
1390
  import { PublicKey as PublicKey5, SpaceId } from "@dxos/keys";
1195
- import { log as log7, logInfo } from "@dxos/log";
1391
+ import { log as log9, logInfo } from "@dxos/log";
1196
1392
  import { AdmittedFeed as AdmittedFeed2 } from "@dxos/protocols/proto/dxos/halo/credentials";
1197
1393
  import { trace as trace2 } from "@dxos/tracing";
1198
1394
  import { Callback as Callback2, ComplexMap as ComplexMap3 } from "@dxos/util";
@@ -1202,7 +1398,7 @@ import { DeferredTask, sleepWithContext as sleepWithContext2, trackLeaks } from
1202
1398
  import { Context as Context4 } from "@dxos/context";
1203
1399
  import { SpaceStateMachine } from "@dxos/credentials";
1204
1400
  import { PublicKey as PublicKey4 } from "@dxos/keys";
1205
- import { log as log6 } from "@dxos/log";
1401
+ import { log as log8 } from "@dxos/log";
1206
1402
  import { AdmittedFeed } from "@dxos/protocols/proto/dxos/halo/credentials";
1207
1403
  import { Timeframe as Timeframe3 } from "@dxos/timeframe";
1208
1404
  import { TimeSeriesCounter, TimeUsageCounter, trace } from "@dxos/tracing";
@@ -1217,14 +1413,14 @@ function _ts_decorate4(decorators, target, key, desc) {
1217
1413
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1218
1414
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1219
1415
  }
1220
- var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
1416
+ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
1221
1417
  var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 500;
1222
1418
  var CONTROL_PIPELINE_SNAPSHOT_DELAY = 1e4;
1223
1419
  var USE_SNAPSHOTS = true;
1224
1420
  var ControlPipeline = class {
1225
1421
  constructor({ spaceKey, genesisFeed, feedProvider, metadataStore }) {
1226
1422
  this._ctx = new Context4(void 0, {
1227
- F: __dxlog_file7,
1423
+ F: __dxlog_file9,
1228
1424
  L: 47
1229
1425
  });
1230
1426
  this._lastTimeframeSaveTime = Date.now();
@@ -1241,10 +1437,10 @@ var ControlPipeline = class {
1241
1437
  void this._pipeline.addFeed(genesisFeed);
1242
1438
  this._spaceStateMachine = new SpaceStateMachine(spaceKey);
1243
1439
  this._spaceStateMachine.onFeedAdmitted.set(async (info) => {
1244
- log6("feed admitted", {
1440
+ log8("feed admitted", {
1245
1441
  key: info.key
1246
1442
  }, {
1247
- F: __dxlog_file7,
1443
+ F: __dxlog_file9,
1248
1444
  L: 82,
1249
1445
  S: this,
1250
1446
  C: (f, a) => f(...a)
@@ -1257,8 +1453,8 @@ var ControlPipeline = class {
1257
1453
  await this._pipeline.addFeed(feed);
1258
1454
  }
1259
1455
  } catch (err) {
1260
- log6.catch(err, void 0, {
1261
- F: __dxlog_file7,
1456
+ log8.catch(err, void 0, {
1457
+ F: __dxlog_file9,
1262
1458
  L: 93,
1263
1459
  S: this,
1264
1460
  C: (f, a) => f(...a)
@@ -1285,12 +1481,12 @@ var ControlPipeline = class {
1285
1481
  }
1286
1482
  async start() {
1287
1483
  const snapshot = this._metadata.getSpaceControlPipelineSnapshot(this._spaceKey);
1288
- log6("load snapshot", {
1484
+ log8("load snapshot", {
1289
1485
  key: this._spaceKey,
1290
1486
  present: !!snapshot,
1291
1487
  tf: snapshot?.timeframe
1292
1488
  }, {
1293
- F: __dxlog_file7,
1489
+ F: __dxlog_file9,
1294
1490
  L: 123,
1295
1491
  S: this,
1296
1492
  C: (f, a) => f(...a)
@@ -1298,21 +1494,21 @@ var ControlPipeline = class {
1298
1494
  if (USE_SNAPSHOTS && snapshot) {
1299
1495
  await this._processSnapshot(snapshot);
1300
1496
  }
1301
- log6("starting...", void 0, {
1302
- F: __dxlog_file7,
1497
+ log8("starting...", void 0, {
1498
+ F: __dxlog_file9,
1303
1499
  L: 128,
1304
1500
  S: this,
1305
1501
  C: (f, a) => f(...a)
1306
1502
  });
1307
1503
  setTimeout(async () => {
1308
1504
  void this._consumePipeline(new Context4(void 0, {
1309
- F: __dxlog_file7,
1505
+ F: __dxlog_file9,
1310
1506
  L: 130
1311
1507
  }));
1312
1508
  });
1313
1509
  await this._pipeline.start();
1314
- log6("started", void 0, {
1315
- F: __dxlog_file7,
1510
+ log8("started", void 0, {
1511
+ F: __dxlog_file9,
1316
1512
  L: 134,
1317
1513
  S: this,
1318
1514
  C: (f, a) => f(...a)
@@ -1326,10 +1522,10 @@ var ControlPipeline = class {
1326
1522
  skipVerification: true
1327
1523
  });
1328
1524
  if (!result) {
1329
- log6.warn("credential processing failed from snapshot", {
1525
+ log8.warn("credential processing failed from snapshot", {
1330
1526
  message
1331
1527
  }, {
1332
- F: __dxlog_file7,
1528
+ F: __dxlog_file9,
1333
1529
  L: 147,
1334
1530
  S: this,
1335
1531
  C: (f, a) => f(...a)
@@ -1347,11 +1543,11 @@ var ControlPipeline = class {
1347
1543
  }))
1348
1544
  };
1349
1545
  await this._pipeline.unpause();
1350
- log6("save snapshot", {
1546
+ log8("save snapshot", {
1351
1547
  key: this._spaceKey,
1352
1548
  snapshot
1353
1549
  }, {
1354
- F: __dxlog_file7,
1550
+ F: __dxlog_file9,
1355
1551
  L: 163,
1356
1552
  S: this,
1357
1553
  C: (f, a) => f(...a)
@@ -1365,8 +1561,8 @@ var ControlPipeline = class {
1365
1561
  try {
1366
1562
  await this._processMessage(ctx, msg);
1367
1563
  } catch (err) {
1368
- log6.catch(err, void 0, {
1369
- F: __dxlog_file7,
1564
+ log8.catch(err, void 0, {
1565
+ F: __dxlog_file9,
1370
1566
  L: 176,
1371
1567
  S: this,
1372
1568
  C: (f, a) => f(...a)
@@ -1376,11 +1572,11 @@ var ControlPipeline = class {
1376
1572
  }
1377
1573
  }
1378
1574
  async _processMessage(ctx, msg) {
1379
- log6("processing", {
1575
+ log8("processing", {
1380
1576
  key: msg.feedKey,
1381
1577
  seq: msg.seq
1382
1578
  }, {
1383
- F: __dxlog_file7,
1579
+ F: __dxlog_file9,
1384
1580
  L: 186,
1385
1581
  S: this,
1386
1582
  C: (f, a) => f(...a)
@@ -1392,10 +1588,10 @@ var ControlPipeline = class {
1392
1588
  });
1393
1589
  timer.end();
1394
1590
  if (!result) {
1395
- log6.warn("processing failed", {
1591
+ log8.warn("processing failed", {
1396
1592
  msg
1397
1593
  }, {
1398
- F: __dxlog_file7,
1594
+ F: __dxlog_file9,
1399
1595
  L: 195,
1400
1596
  S: this,
1401
1597
  C: (f, a) => f(...a)
@@ -1413,8 +1609,8 @@ var ControlPipeline = class {
1413
1609
  }
1414
1610
  }
1415
1611
  async stop() {
1416
- log6("stopping...", void 0, {
1417
- F: __dxlog_file7,
1612
+ log8("stopping...", void 0, {
1613
+ F: __dxlog_file9,
1418
1614
  L: 215,
1419
1615
  S: this,
1420
1616
  C: (f, a) => f(...a)
@@ -1422,8 +1618,8 @@ var ControlPipeline = class {
1422
1618
  await this._ctx.dispose();
1423
1619
  await this._pipeline.stop();
1424
1620
  await this._saveTargetTimeframe(this._pipeline.state.timeframe);
1425
- log6("stopped", void 0, {
1426
- F: __dxlog_file7,
1621
+ log8("stopped", void 0, {
1622
+ F: __dxlog_file9,
1427
1623
  L: 219,
1428
1624
  S: this,
1429
1625
  C: (f, a) => f(...a)
@@ -1435,8 +1631,8 @@ var ControlPipeline = class {
1435
1631
  await this._metadata.setSpaceControlLatestTimeframe(this._spaceKey, newTimeframe);
1436
1632
  this._targetTimeframe = newTimeframe;
1437
1633
  } catch (err) {
1438
- log6(err, void 0, {
1439
- F: __dxlog_file7,
1634
+ log8(err, void 0, {
1635
+ F: __dxlog_file9,
1440
1636
  L: 228,
1441
1637
  S: this,
1442
1638
  C: (f, a) => f(...a)
@@ -1477,15 +1673,15 @@ function _ts_decorate5(decorators, target, key, desc) {
1477
1673
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1478
1674
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1479
1675
  }
1480
- var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
1481
- var Space = class extends Resource {
1676
+ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
1677
+ var Space = class extends Resource2 {
1482
1678
  constructor(params) {
1483
1679
  super();
1484
1680
  this._addFeedMutex = new Mutex();
1485
1681
  this.onCredentialProcessed = new Callback2();
1486
1682
  this.stateUpdate = new Event4();
1487
- invariant6(params.spaceKey && params.feedProvider, void 0, {
1488
- F: __dxlog_file8,
1683
+ invariant8(params.spaceKey && params.feedProvider, void 0, {
1684
+ F: __dxlog_file10,
1489
1685
  L: 78,
1490
1686
  S: this,
1491
1687
  A: [
@@ -1516,10 +1712,10 @@ var Space = class extends Resource {
1516
1712
  });
1517
1713
  this._controlPipeline.onCredentialProcessed.set(async (credential) => {
1518
1714
  await this.onCredentialProcessed.callIfSet(credential);
1519
- log7("onCredentialProcessed", {
1715
+ log9("onCredentialProcessed", {
1520
1716
  credential
1521
1717
  }, {
1522
- F: __dxlog_file8,
1718
+ F: __dxlog_file10,
1523
1719
  L: 106,
1524
1720
  S: this,
1525
1721
  C: (f, a) => f(...a)
@@ -1527,10 +1723,10 @@ var Space = class extends Resource {
1527
1723
  this.stateUpdate.emit();
1528
1724
  });
1529
1725
  this._controlPipeline.onDelegatedInvitation.set(async (invitation) => {
1530
- log7("onDelegatedInvitation", {
1726
+ log9("onDelegatedInvitation", {
1531
1727
  invitation
1532
1728
  }, {
1533
- F: __dxlog_file8,
1729
+ F: __dxlog_file10,
1534
1730
  L: 110,
1535
1731
  S: this,
1536
1732
  C: (f, a) => f(...a)
@@ -1538,10 +1734,10 @@ var Space = class extends Resource {
1538
1734
  await params.onDelegatedInvitationStatusChange(invitation, true);
1539
1735
  });
1540
1736
  this._controlPipeline.onDelegatedInvitationRemoved.set(async (invitation) => {
1541
- log7("onDelegatedInvitationRemoved", {
1737
+ log9("onDelegatedInvitationRemoved", {
1542
1738
  invitation
1543
1739
  }, {
1544
- F: __dxlog_file8,
1740
+ F: __dxlog_file10,
1545
1741
  L: 114,
1546
1742
  S: this,
1547
1743
  C: (f, a) => f(...a)
@@ -1549,13 +1745,13 @@ var Space = class extends Resource {
1549
1745
  await params.onDelegatedInvitationStatusChange(invitation, false);
1550
1746
  });
1551
1747
  this._controlPipeline.onMemberRoleChanged.set(async (changedMembers) => {
1552
- log7("onMemberRoleChanged", () => ({
1748
+ log9("onMemberRoleChanged", () => ({
1553
1749
  changedMembers: changedMembers.map((m) => [
1554
1750
  m.key,
1555
1751
  m.role
1556
1752
  ])
1557
1753
  }), {
1558
- F: __dxlog_file8,
1754
+ F: __dxlog_file10,
1559
1755
  L: 118,
1560
1756
  S: this,
1561
1757
  C: (f, a) => f(...a)
@@ -1596,8 +1792,8 @@ var Space = class extends Resource {
1596
1792
  return this._snapshotManager;
1597
1793
  }
1598
1794
  async setControlFeed(feed) {
1599
- invariant6(!this._controlFeed, "Control feed already set.", {
1600
- F: __dxlog_file8,
1795
+ invariant8(!this._controlFeed, "Control feed already set.", {
1796
+ F: __dxlog_file10,
1601
1797
  L: 171,
1602
1798
  S: this,
1603
1799
  A: [
@@ -1610,8 +1806,8 @@ var Space = class extends Resource {
1610
1806
  return this;
1611
1807
  }
1612
1808
  async setDataFeed(feed) {
1613
- invariant6(!this._dataFeed, "Data feed already set.", {
1614
- F: __dxlog_file8,
1809
+ invariant8(!this._dataFeed, "Data feed already set.", {
1810
+ F: __dxlog_file10,
1615
1811
  L: 178,
1616
1812
  S: this,
1617
1813
  A: [
@@ -1629,34 +1825,34 @@ var Space = class extends Resource {
1629
1825
  return Array.from(this._controlPipeline.spaceState.feeds.values());
1630
1826
  }
1631
1827
  async _open(ctx) {
1632
- log7("opening...", void 0, {
1633
- F: __dxlog_file8,
1828
+ log9("opening...", void 0, {
1829
+ F: __dxlog_file10,
1634
1830
  L: 192,
1635
1831
  S: this,
1636
1832
  C: (f, a) => f(...a)
1637
1833
  });
1638
1834
  await this._controlPipeline.start();
1639
1835
  await this.protocol.start();
1640
- log7("opened", void 0, {
1641
- F: __dxlog_file8,
1836
+ log9("opened", void 0, {
1837
+ F: __dxlog_file10,
1642
1838
  L: 198,
1643
1839
  S: this,
1644
1840
  C: (f, a) => f(...a)
1645
1841
  });
1646
1842
  }
1647
1843
  async _close() {
1648
- log7("closing...", {
1844
+ log9("closing...", {
1649
1845
  key: this._key
1650
1846
  }, {
1651
- F: __dxlog_file8,
1847
+ F: __dxlog_file10,
1652
1848
  L: 203,
1653
1849
  S: this,
1654
1850
  C: (f, a) => f(...a)
1655
1851
  });
1656
1852
  await this.protocol.stop();
1657
1853
  await this._controlPipeline.stop();
1658
- log7("closed", void 0, {
1659
- F: __dxlog_file8,
1854
+ log9("closed", void 0, {
1855
+ F: __dxlog_file10,
1660
1856
  L: 209,
1661
1857
  S: this,
1662
1858
  C: (f, a) => f(...a)
@@ -1705,7 +1901,7 @@ import { scheduleTask as scheduleTask2 } from "@dxos/async";
1705
1901
  import { Context as Context5 } from "@dxos/context";
1706
1902
  import { ProtocolError, schema as schema6 } from "@dxos/protocols";
1707
1903
  import { RpcExtension as RpcExtension2 } from "@dxos/teleport";
1708
- var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/admission-discovery-extension.ts";
1904
+ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/admission-discovery-extension.ts";
1709
1905
  var CredentialRetrieverExtension = class extends RpcExtension2 {
1710
1906
  constructor(_request, _onResult) {
1711
1907
  super({
@@ -1716,7 +1912,7 @@ var CredentialRetrieverExtension = class extends RpcExtension2 {
1716
1912
  this._request = _request;
1717
1913
  this._onResult = _onResult;
1718
1914
  this._ctx = new Context5(void 0, {
1719
- F: __dxlog_file9,
1915
+ F: __dxlog_file11,
1720
1916
  L: 25
1721
1917
  });
1722
1918
  }
@@ -1770,7 +1966,7 @@ var CredentialServerExtension = class extends RpcExtension2 {
1770
1966
  // packages/core/echo/echo-pipeline/src/space/space-protocol.ts
1771
1967
  import { discoveryKey, subtleCrypto as subtleCrypto3 } from "@dxos/crypto";
1772
1968
  import { PublicKey as PublicKey6 } from "@dxos/keys";
1773
- import { log as log8, logInfo as logInfo2 } from "@dxos/log";
1969
+ import { log as log10, logInfo as logInfo2 } from "@dxos/log";
1774
1970
  import { MMSTTopology } from "@dxos/network-manager";
1775
1971
  import { Teleport } from "@dxos/teleport";
1776
1972
  import { BlobSync } from "@dxos/teleport-extension-object-sync";
@@ -1787,7 +1983,7 @@ function _ts_decorate6(decorators, target, key, desc) {
1787
1983
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1788
1984
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1789
1985
  }
1790
- var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
1986
+ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
1791
1987
  var MOCK_AUTH_PROVIDER = async (nonce) => Buffer.from("mock");
1792
1988
  var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
1793
1989
  var SpaceProtocol = class {
@@ -1821,10 +2017,10 @@ var SpaceProtocol = class {
1821
2017
  }
1822
2018
  // TODO(burdon): Create abstraction for Space (e.g., add keys and have provider).
1823
2019
  addFeed(feed) {
1824
- log8("addFeed", {
2020
+ log10("addFeed", {
1825
2021
  key: feed.key
1826
2022
  }, {
1827
- F: __dxlog_file10,
2023
+ F: __dxlog_file12,
1828
2024
  L: 109,
1829
2025
  S: this,
1830
2026
  C: (f, a) => f(...a)
@@ -1841,8 +2037,8 @@ var SpaceProtocol = class {
1841
2037
  }
1842
2038
  const credentials = await this._swarmIdentity.credentialProvider(Buffer.from(""));
1843
2039
  await this.blobSync.open();
1844
- log8("starting...", void 0, {
1845
- F: __dxlog_file10,
2040
+ log10("starting...", void 0, {
2041
+ F: __dxlog_file12,
1846
2042
  L: 128,
1847
2043
  S: this,
1848
2044
  C: (f, a) => f(...a)
@@ -1855,8 +2051,8 @@ var SpaceProtocol = class {
1855
2051
  topology: this._topology,
1856
2052
  label: `swarm ${topic.truncate()} for space ${this._spaceKey.truncate()}`
1857
2053
  });
1858
- log8("started", void 0, {
1859
- F: __dxlog_file10,
2054
+ log10("started", void 0, {
2055
+ F: __dxlog_file12,
1860
2056
  L: 138,
1861
2057
  S: this,
1862
2058
  C: (f, a) => f(...a)
@@ -1868,15 +2064,15 @@ var SpaceProtocol = class {
1868
2064
  async stop() {
1869
2065
  await this.blobSync.close();
1870
2066
  if (this._connection) {
1871
- log8("stopping...", void 0, {
1872
- F: __dxlog_file10,
2067
+ log10("stopping...", void 0, {
2068
+ F: __dxlog_file12,
1873
2069
  L: 149,
1874
2070
  S: this,
1875
2071
  C: (f, a) => f(...a)
1876
2072
  });
1877
2073
  await this._connection.close();
1878
- log8("stopped", void 0, {
1879
- F: __dxlog_file10,
2074
+ log10("stopped", void 0, {
2075
+ F: __dxlog_file12,
1880
2076
  L: 151,
1881
2077
  S: this,
1882
2078
  C: (f, a) => f(...a)
@@ -1949,8 +2145,8 @@ var SpaceProtocolSession = class {
1949
2145
  provider: this._swarmIdentity.credentialProvider,
1950
2146
  verifier: this._swarmIdentity.credentialAuthenticator,
1951
2147
  onAuthSuccess: () => {
1952
- log8("Peer authenticated", void 0, {
1953
- F: __dxlog_file10,
2148
+ log10("Peer authenticated", void 0, {
2149
+ F: __dxlog_file12,
1954
2150
  L: 248,
1955
2151
  S: this,
1956
2152
  C: (f, a) => f(...a)
@@ -1967,8 +2163,8 @@ var SpaceProtocolSession = class {
1967
2163
  this._teleport.addExtension("dxos.mesh.teleport.blobsync", this._blobSync.createExtension());
1968
2164
  }
1969
2165
  async close() {
1970
- log8("close", void 0, {
1971
- F: __dxlog_file10,
2166
+ log10("close", void 0, {
2167
+ F: __dxlog_file12,
1972
2168
  L: 264,
1973
2169
  S: this,
1974
2170
  C: (f, a) => f(...a)
@@ -1990,7 +2186,7 @@ _ts_decorate6([
1990
2186
  import { synchronized as synchronized4, trackLeaks as trackLeaks3, Trigger as Trigger2 } from "@dxos/async";
1991
2187
  import { failUndefined as failUndefined2 } from "@dxos/debug";
1992
2188
  import { PublicKey as PublicKey7 } from "@dxos/keys";
1993
- import { log as log9 } from "@dxos/log";
2189
+ import { log as log11 } from "@dxos/log";
1994
2190
  import { trace as trace4 } from "@dxos/protocols";
1995
2191
  import { ComplexMap as ComplexMap5 } from "@dxos/util";
1996
2192
  function _ts_decorate7(decorators, target, key, desc) {
@@ -2003,7 +2199,7 @@ function _ts_decorate7(decorators, target, key, desc) {
2003
2199
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2004
2200
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2005
2201
  }
2006
- var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
2202
+ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
2007
2203
  var SpaceManager = class {
2008
2204
  constructor({ feedStore, networkManager, metadataStore, snapshotStore, blobStore }) {
2009
2205
  this._spaces = new ComplexMap5(PublicKey7.hash);
@@ -2026,18 +2222,18 @@ var SpaceManager = class {
2026
2222
  ].map((space) => space.close()));
2027
2223
  }
2028
2224
  async constructSpace({ metadata, swarmIdentity, onAuthorizedConnection, onAuthFailure, onDelegatedInvitationStatusChange, onMemberRolesChanged, memberKey }) {
2029
- log9.trace("dxos.echo.space-manager.construct-space", trace4.begin({
2225
+ log11.trace("dxos.echo.space-manager.construct-space", trace4.begin({
2030
2226
  id: this._instanceId
2031
2227
  }), {
2032
- F: __dxlog_file11,
2228
+ F: __dxlog_file13,
2033
2229
  L: 103,
2034
2230
  S: this,
2035
2231
  C: (f, a) => f(...a)
2036
2232
  });
2037
- log9("constructing space...", {
2233
+ log11("constructing space...", {
2038
2234
  spaceKey: metadata.genesisFeedKey
2039
2235
  }, {
2040
- F: __dxlog_file11,
2236
+ F: __dxlog_file13,
2041
2237
  L: 104,
2042
2238
  S: this,
2043
2239
  C: (f, a) => f(...a)
@@ -2067,10 +2263,10 @@ var SpaceManager = class {
2067
2263
  onMemberRolesChanged
2068
2264
  });
2069
2265
  this._spaces.set(space.key, space);
2070
- log9.trace("dxos.echo.space-manager.construct-space", trace4.end({
2266
+ log11.trace("dxos.echo.space-manager.construct-space", trace4.end({
2071
2267
  id: this._instanceId
2072
2268
  }), {
2073
- F: __dxlog_file11,
2269
+ F: __dxlog_file13,
2074
2270
  L: 135,
2075
2271
  S: this,
2076
2272
  C: (f, a) => f(...a)
@@ -2079,18 +2275,18 @@ var SpaceManager = class {
2079
2275
  }
2080
2276
  async requestSpaceAdmissionCredential(params) {
2081
2277
  const traceKey = "dxos.echo.space-manager.request-space-admission";
2082
- log9.trace(traceKey, trace4.begin({
2278
+ log11.trace(traceKey, trace4.begin({
2083
2279
  id: this._instanceId
2084
2280
  }), {
2085
- F: __dxlog_file11,
2281
+ F: __dxlog_file13,
2086
2282
  L: 141,
2087
2283
  S: this,
2088
2284
  C: (f, a) => f(...a)
2089
2285
  });
2090
- log9("requesting space admission credential...", {
2286
+ log11("requesting space admission credential...", {
2091
2287
  spaceKey: params.spaceKey
2092
2288
  }, {
2093
- F: __dxlog_file11,
2289
+ F: __dxlog_file13,
2094
2290
  L: 142,
2095
2291
  S: this,
2096
2292
  C: (f, a) => f(...a)
@@ -2114,21 +2310,21 @@ var SpaceManager = class {
2114
2310
  const credential = await onCredentialResolved.wait({
2115
2311
  timeout: params.timeout
2116
2312
  });
2117
- log9.trace(traceKey, trace4.end({
2313
+ log11.trace(traceKey, trace4.end({
2118
2314
  id: this._instanceId
2119
2315
  }), {
2120
- F: __dxlog_file11,
2316
+ F: __dxlog_file13,
2121
2317
  L: 165,
2122
2318
  S: this,
2123
2319
  C: (f, a) => f(...a)
2124
2320
  });
2125
2321
  return credential;
2126
2322
  } catch (err) {
2127
- log9.trace(traceKey, trace4.error({
2323
+ log11.trace(traceKey, trace4.error({
2128
2324
  id: this._instanceId,
2129
2325
  error: err
2130
2326
  }), {
2131
- F: __dxlog_file11,
2327
+ F: __dxlog_file13,
2132
2328
  L: 168,
2133
2329
  S: this,
2134
2330
  C: (f, a) => f(...a)
@@ -2156,6 +2352,7 @@ export {
2156
2352
  createMappedFeedWriter,
2157
2353
  SnapshotManager,
2158
2354
  SnapshotStore,
2355
+ DocumentsSynchronizer,
2159
2356
  DataServiceImpl,
2160
2357
  MetadataStore,
2161
2358
  hasInvitationExpired,
@@ -2176,4 +2373,4 @@ export {
2176
2373
  SpaceProtocolSession,
2177
2374
  SpaceManager
2178
2375
  };
2179
- //# sourceMappingURL=chunk-DMUP426Q.mjs.map
2376
+ //# sourceMappingURL=chunk-SJUDZ3CQ.mjs.map