@dxos/echo-pipeline 0.3.2 → 0.3.3-main.10234ef

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.
@@ -68,7 +68,7 @@ var valueEncoding = (0, import_hypercore.createCodecEncoding)(codec);
68
68
 
69
69
  // packages/core/echo/echo-pipeline/src/common/feeds.ts
70
70
  var import_invariant = require("@dxos/invariant");
71
- var __dxlog_file = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/common/feeds.ts";
71
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/common/feeds.ts";
72
72
  var createMappedFeedWriter = (mapper, writer) => {
73
73
  (0, import_invariant.invariant)(mapper, void 0, {
74
74
  F: __dxlog_file,
@@ -103,6 +103,7 @@ var TestFeedBuilder = class extends import_testing.TestBuilder {
103
103
  };
104
104
 
105
105
  // packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts
106
+ var import_async = require("@dxos/async");
106
107
  var import_codec_protobuf = require("@dxos/codec-protobuf");
107
108
  var import_context = require("@dxos/context");
108
109
  var import_echo_db = require("@dxos/echo-db");
@@ -110,13 +111,15 @@ var import_invariant2 = require("@dxos/invariant");
110
111
  var import_log = require("@dxos/log");
111
112
  var import_service = require("@dxos/protocols/proto/dxos/echo/service");
112
113
  var import_util = require("@dxos/util");
113
- var __dxlog_file2 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts";
114
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts";
115
+ var MUTATION_LIMIT_PER_OBJECT = 10;
114
116
  var DataServiceHost = class {
115
- constructor(_itemManager, _itemDemuxer, _flush, _writeStream) {
117
+ constructor(_itemManager, _itemDemuxer, _flush, _writeStream, _opts = {}) {
116
118
  this._itemManager = _itemManager;
117
119
  this._itemDemuxer = _itemDemuxer;
118
120
  this._flush = _flush;
119
121
  this._writeStream = _writeStream;
122
+ this._opts = _opts;
120
123
  this._ctx = new import_context.Context();
121
124
  this._clientTagMap = new import_util.ComplexMap(([feedKey, seq]) => `${feedKey.toHex()}:${seq}`);
122
125
  }
@@ -125,6 +128,9 @@ var DataServiceHost = class {
125
128
  async close() {
126
129
  await this._ctx.dispose();
127
130
  }
131
+ get _deferEvents() {
132
+ return this._opts.deferEvents ?? true;
133
+ }
128
134
  /**
129
135
  * Real-time subscription to data objects in a space.
130
136
  */
@@ -137,7 +143,43 @@ var DataServiceHost = class {
137
143
  objects
138
144
  }
139
145
  });
146
+ const updateScheduler = new import_async.UpdateScheduler(ctx, async () => {
147
+ flushPendingUpdate();
148
+ }, {
149
+ maxFrequency: 10
150
+ });
151
+ const pendingUpdates = [];
152
+ const mutationsPerObject = /* @__PURE__ */ new Map();
153
+ const clearPendingUpdates = () => {
154
+ pendingUpdates.length = 0;
155
+ mutationsPerObject.clear();
156
+ };
157
+ const flushPendingUpdate = () => {
158
+ const stagedEvents = [];
159
+ const objectsWithSnapshots = /* @__PURE__ */ new Set();
160
+ for (const [id, count] of mutationsPerObject) {
161
+ if (count >= MUTATION_LIMIT_PER_OBJECT) {
162
+ objectsWithSnapshots.add(id);
163
+ const entity = this._itemManager.entities.get(id);
164
+ if (entity) {
165
+ stagedEvents.push(entity.createSnapshot());
166
+ }
167
+ }
168
+ }
169
+ for (const obj of pendingUpdates) {
170
+ if (!objectsWithSnapshots.has(obj.objectId)) {
171
+ stagedEvents.push(obj);
172
+ }
173
+ }
174
+ next({
175
+ batch: {
176
+ objects: stagedEvents
177
+ }
178
+ });
179
+ clearPendingUpdates();
180
+ };
140
181
  this._itemDemuxer.snapshot.on(ctx, (snapshot) => {
182
+ clearPendingUpdates();
141
183
  next({
142
184
  action: import_service.EchoEvent.DatabaseAction.RESET,
143
185
  batch: {
@@ -149,7 +191,7 @@ var DataServiceHost = class {
149
191
  const { batch, meta } = message;
150
192
  (0, import_invariant2.invariant)(!meta.clientTag, "Unexpected client tag in mutation message", {
151
193
  F: __dxlog_file2,
152
- L: 69,
194
+ L: 131,
153
195
  S: this,
154
196
  A: [
155
197
  "!(meta as any).clientTag",
@@ -161,7 +203,7 @@ var DataServiceHost = class {
161
203
  meta
162
204
  }, {
163
205
  F: __dxlog_file2,
164
- L: 70,
206
+ L: 132,
165
207
  S: this,
166
208
  C: (f, a) => f(...a)
167
209
  });
@@ -175,21 +217,37 @@ var DataServiceHost = class {
175
217
  });
176
218
  });
177
219
  if (clientTag) {
220
+ flushPendingUpdate();
178
221
  (0, import_echo_db.tagMutationsInBatch)(batch, clientTag, 0);
222
+ next({
223
+ clientTag,
224
+ feedKey: message.meta.feedKey,
225
+ seq: message.meta.seq,
226
+ batch
227
+ });
228
+ } else {
229
+ for (const obj of batch.objects ?? []) {
230
+ const newCount = (mutationsPerObject.get(obj.objectId) ?? 0) + 1;
231
+ mutationsPerObject.set(obj.objectId, newCount);
232
+ }
233
+ for (const obj of batch.objects ?? []) {
234
+ if ((mutationsPerObject.get(obj.objectId) ?? 0) < MUTATION_LIMIT_PER_OBJECT) {
235
+ pendingUpdates.push(obj);
236
+ }
237
+ }
238
+ if (this._deferEvents) {
239
+ updateScheduler.trigger();
240
+ } else {
241
+ flushPendingUpdate();
242
+ }
179
243
  }
180
- next({
181
- clientTag,
182
- feedKey: message.meta.feedKey,
183
- seq: message.meta.seq,
184
- batch
185
- });
186
244
  });
187
245
  });
188
246
  }
189
247
  async write(request) {
190
248
  (0, import_invariant2.invariant)(!this._ctx.disposed, "Cannot write to closed DataServiceHost", {
191
249
  F: __dxlog_file2,
192
- L: 96,
250
+ L: 177,
193
251
  S: this,
194
252
  A: [
195
253
  "!this._ctx.disposed",
@@ -198,7 +256,7 @@ var DataServiceHost = class {
198
256
  });
199
257
  (0, import_invariant2.invariant)(this._writeStream, "Cannot write mutations in readonly mode", {
200
258
  F: __dxlog_file2,
201
- L: 97,
259
+ L: 178,
202
260
  S: this,
203
261
  A: [
204
262
  "this._writeStream",
@@ -210,7 +268,7 @@ var DataServiceHost = class {
210
268
  objectCount: request.batch.objects?.length ?? 0
211
269
  }, {
212
270
  F: __dxlog_file2,
213
- L: 99,
271
+ L: 180,
214
272
  S: this,
215
273
  C: (f, a) => f(...a)
216
274
  });
@@ -224,7 +282,7 @@ var DataServiceHost = class {
224
282
  seq: receipt2.seq
225
283
  }, {
226
284
  F: __dxlog_file2,
227
- L: 108,
285
+ L: 189,
228
286
  S: this,
229
287
  C: (f, a) => f(...a)
230
288
  });
@@ -281,8 +339,8 @@ var DatabaseHost = class {
281
339
  createSnapshot() {
282
340
  return this._itemDemuxer.createSnapshot();
283
341
  }
284
- createDataServiceHost() {
285
- return new DataServiceHost(this._itemManager, this._itemDemuxer, this._flush, this._outboundStream ?? void 0);
342
+ createDataServiceHost(opts = {}) {
343
+ return new DataServiceHost(this._itemManager, this._itemDemuxer, this._flush, this._outboundStream ?? void 0, opts);
286
344
  }
287
345
  };
288
346
 
@@ -373,7 +431,7 @@ var import_invariant3 = require("@dxos/invariant");
373
431
  var import_keys2 = require("@dxos/keys");
374
432
  var import_log2 = require("@dxos/log");
375
433
  var import_util2 = require("@dxos/util");
376
- var __dxlog_file3 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/db-host/data-service.ts";
434
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/data-service.ts";
377
435
  var DataServiceSubscriptions = class {
378
436
  constructor() {
379
437
  this._spaces = new import_util2.ComplexMap(import_keys2.PublicKey.hash);
@@ -475,7 +533,7 @@ var DataServiceImpl = class {
475
533
 
476
534
  // packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts
477
535
  var import_crc_32 = __toESM(require("crc-32"));
478
- var import_async = require("@dxos/async");
536
+ var import_async2 = require("@dxos/async");
479
537
  var import_invariant4 = require("@dxos/invariant");
480
538
  var import_keys3 = require("@dxos/keys");
481
539
  var import_log3 = require("@dxos/log");
@@ -492,7 +550,7 @@ function _ts_decorate(decorators, target, key, desc) {
492
550
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
493
551
  return c > 3 && r && Object.defineProperty(target, key, r), r;
494
552
  }
495
- var __dxlog_file4 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
553
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
496
554
  var emptyEchoMetadata = () => ({
497
555
  version: import_protocols4.STORAGE_VERSION,
498
556
  spaces: [],
@@ -508,7 +566,7 @@ var MetadataStore = class {
508
566
  this._metadata = emptyEchoMetadata();
509
567
  this._spaceLargeMetadata = new import_util3.ComplexMap(import_keys3.PublicKey.hash);
510
568
  this._metadataFile = void 0;
511
- this.update = new import_async.Event();
569
+ this.update = new import_async2.Event();
512
570
  }
513
571
  get metadata() {
514
572
  return this._metadata;
@@ -767,25 +825,25 @@ var MetadataStore = class {
767
825
  }
768
826
  };
769
827
  _ts_decorate([
770
- import_async.synchronized
828
+ import_async2.synchronized
771
829
  ], MetadataStore.prototype, "load", null);
772
830
  _ts_decorate([
773
- import_async.synchronized
831
+ import_async2.synchronized
774
832
  ], MetadataStore.prototype, "_save", null);
775
833
  _ts_decorate([
776
- import_async.synchronized
834
+ import_async2.synchronized
777
835
  ], MetadataStore.prototype, "_saveSpaceLargeMetadata", null);
778
836
  var fromBytesInt32 = (buf) => buf.readInt32LE(0);
779
837
 
780
838
  // packages/core/echo/echo-pipeline/src/space/auth.ts
781
- var import_async2 = require("@dxos/async");
839
+ var import_async3 = require("@dxos/async");
782
840
  var import_context3 = require("@dxos/context");
783
841
  var import_crypto2 = require("@dxos/crypto");
784
842
  var import_invariant5 = require("@dxos/invariant");
785
843
  var import_log4 = require("@dxos/log");
786
844
  var import_protocols5 = require("@dxos/protocols");
787
845
  var import_teleport = require("@dxos/teleport");
788
- var __dxlog_file5 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/auth.ts";
846
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/auth.ts";
789
847
  var AuthExtension = class extends import_teleport.RpcExtension {
790
848
  constructor(_authParams) {
791
849
  super({
@@ -836,7 +894,7 @@ var AuthExtension = class extends import_teleport.RpcExtension {
836
894
  }
837
895
  async onOpen(context) {
838
896
  await super.onOpen(context);
839
- (0, import_async2.scheduleTask)(this._ctx, async () => {
897
+ (0, import_async3.scheduleTask)(this._ctx, async () => {
840
898
  try {
841
899
  const challenge = (0, import_crypto2.randomBytes)(32);
842
900
  const { credential } = await this.rpc.AuthService.authenticate({
@@ -861,7 +919,7 @@ var AuthExtension = class extends import_teleport.RpcExtension {
861
919
  "'credential not verified'"
862
920
  ]
863
921
  });
864
- (0, import_async2.runInContext)(this._ctx, () => this._authParams.onAuthSuccess());
922
+ (0, import_async3.runInContext)(this._ctx, () => this._authParams.onAuthSuccess());
865
923
  } catch (err) {
866
924
  (0, import_log4.log)("auth failed", err, {
867
925
  F: __dxlog_file5,
@@ -885,7 +943,7 @@ var AuthExtension = class extends import_teleport.RpcExtension {
885
943
  };
886
944
 
887
945
  // packages/core/echo/echo-pipeline/src/space/space.ts
888
- var import_async7 = require("@dxos/async");
946
+ var import_async8 = require("@dxos/async");
889
947
  var import_invariant9 = require("@dxos/invariant");
890
948
  var import_log10 = require("@dxos/log");
891
949
  var import_credentials4 = require("@dxos/protocols/proto/dxos/halo/credentials");
@@ -893,7 +951,7 @@ var import_tracing3 = require("@dxos/tracing");
893
951
  var import_util7 = require("@dxos/util");
894
952
 
895
953
  // packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
896
- var import_async5 = require("@dxos/async");
954
+ var import_async6 = require("@dxos/async");
897
955
  var import_context5 = require("@dxos/context");
898
956
  var import_credentials = require("@dxos/credentials");
899
957
  var import_keys5 = require("@dxos/keys");
@@ -904,7 +962,7 @@ var import_tracing = require("@dxos/tracing");
904
962
  var import_util5 = require("@dxos/util");
905
963
 
906
964
  // packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts
907
- var import_async4 = require("@dxos/async");
965
+ var import_async5 = require("@dxos/async");
908
966
  var import_context4 = require("@dxos/context");
909
967
  var import_debug3 = require("@dxos/debug");
910
968
  var import_feed_store = require("@dxos/feed-store");
@@ -917,7 +975,7 @@ var import_util4 = require("@dxos/util");
917
975
  // packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts
918
976
  var import_invariant6 = require("@dxos/invariant");
919
977
  var import_log5 = require("@dxos/log");
920
- var __dxlog_file6 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts";
978
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts";
921
979
  var createMessageSelector = (timeframeClock) => {
922
980
  return (messages) => {
923
981
  for (let i = 0; i < messages.length; i++) {
@@ -945,7 +1003,7 @@ var createMessageSelector = (timeframeClock) => {
945
1003
  };
946
1004
 
947
1005
  // packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts
948
- var import_async3 = require("@dxos/async");
1006
+ var import_async4 = require("@dxos/async");
949
1007
  var import_debug2 = require("@dxos/debug");
950
1008
  var import_log6 = require("@dxos/log");
951
1009
  var import_timeframe = require("@dxos/timeframe");
@@ -959,7 +1017,7 @@ function _ts_decorate2(decorators, target, key, desc) {
959
1017
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
960
1018
  return c > 3 && r && Object.defineProperty(target, key, r), r;
961
1019
  }
962
- var __dxlog_file7 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
1020
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
963
1021
  var mapFeedIndexesToTimeframe = (indexes) => new import_timeframe.Timeframe(indexes.map(({ feedKey, index }) => [
964
1022
  feedKey,
965
1023
  index
@@ -971,7 +1029,7 @@ var startAfter = (timeframe) => timeframe.frames().map(([feedKey, index]) => ({
971
1029
  var TimeframeClock = class {
972
1030
  constructor(_timeframe = new import_timeframe.Timeframe()) {
973
1031
  this._timeframe = _timeframe;
974
- this.update = new import_async3.Event();
1032
+ this.update = new import_async4.Event();
975
1033
  this._pendingTimeframe = _timeframe;
976
1034
  }
977
1035
  /**
@@ -1048,14 +1106,14 @@ function _ts_decorate3(decorators, target, key, desc) {
1048
1106
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1049
1107
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1050
1108
  }
1051
- var __dxlog_file8 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
1109
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
1052
1110
  var PipelineState = class {
1053
1111
  constructor(_feeds, _timeframeClock) {
1054
1112
  this._feeds = _feeds;
1055
1113
  this._timeframeClock = _timeframeClock;
1056
1114
  this._ctx = new import_context4.Context();
1057
1115
  this.timeframeUpdate = this._timeframeClock.update;
1058
- this.stalled = new import_async4.Event();
1116
+ this.stalled = new import_async5.Event();
1059
1117
  this._startTimeframe = new import_timeframe2.Timeframe();
1060
1118
  this._reachedTarget = false;
1061
1119
  }
@@ -1129,7 +1187,7 @@ var PipelineState = class {
1129
1187
  done = true;
1130
1188
  this._reachedTarget = true;
1131
1189
  }),
1132
- (0, import_async4.sleepWithContext)(this._ctx, timeout).then(() => {
1190
+ (0, import_async5.sleepWithContext)(this._ctx, timeout).then(() => {
1133
1191
  if (done) {
1134
1192
  return;
1135
1193
  }
@@ -1158,8 +1216,8 @@ var Pipeline = class {
1158
1216
  // External state accessor.
1159
1217
  this._state = new PipelineState(this._feeds, this._timeframeClock);
1160
1218
  // Waits for the message consumer to process the message and yield control back to the pipeline.
1161
- this._processingTrigger = new import_async4.Trigger().wake();
1162
- this._pauseTrigger = new import_async4.Trigger().wake();
1219
+ this._processingTrigger = new import_async5.Trigger().wake();
1220
+ this._pauseTrigger = new import_async5.Trigger().wake();
1163
1221
  // Pending downloads.
1164
1222
  this._downloads = new import_util4.ComplexMap((value) => import_keys4.PublicKey.hash(value.key));
1165
1223
  this._isStopping = false;
@@ -1437,19 +1495,19 @@ var Pipeline = class {
1437
1495
  }
1438
1496
  };
1439
1497
  _ts_decorate3([
1440
- import_async4.synchronized
1498
+ import_async5.synchronized
1441
1499
  ], Pipeline.prototype, "start", null);
1442
1500
  _ts_decorate3([
1443
- import_async4.synchronized
1501
+ import_async5.synchronized
1444
1502
  ], Pipeline.prototype, "stop", null);
1445
1503
  _ts_decorate3([
1446
- import_async4.synchronized
1504
+ import_async5.synchronized
1447
1505
  ], Pipeline.prototype, "setCursor", null);
1448
1506
  _ts_decorate3([
1449
- import_async4.synchronized
1507
+ import_async5.synchronized
1450
1508
  ], Pipeline.prototype, "pause", null);
1451
1509
  _ts_decorate3([
1452
- import_async4.synchronized
1510
+ import_async5.synchronized
1453
1511
  ], Pipeline.prototype, "unpause", null);
1454
1512
 
1455
1513
  // packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
@@ -1463,7 +1521,7 @@ function _ts_decorate4(decorators, target, key, desc) {
1463
1521
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1464
1522
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1465
1523
  }
1466
- var __dxlog_file9 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
1524
+ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
1467
1525
  var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 500;
1468
1526
  var CONTROL_PIPELINE_SNAPSHOT_DELAY = 1e4;
1469
1527
  var USE_SNAPSHOTS = true;
@@ -1474,8 +1532,8 @@ var ControlPipeline = class ControlPipeline2 {
1474
1532
  this.onFeedAdmitted = new import_util5.Callback();
1475
1533
  this._usage = new import_tracing.TimeUsageCounter();
1476
1534
  this._mutations = new import_tracing.TimeSeriesCounter();
1477
- this._snapshotTask = new import_async5.DeferredTask(this._ctx, async () => {
1478
- await (0, import_async5.sleepWithContext)(this._ctx, CONTROL_PIPELINE_SNAPSHOT_DELAY);
1535
+ this._snapshotTask = new import_async6.DeferredTask(this._ctx, async () => {
1536
+ await (0, import_async6.sleepWithContext)(this._ctx, CONTROL_PIPELINE_SNAPSHOT_DELAY);
1479
1537
  await this._saveSnapshot();
1480
1538
  });
1481
1539
  this._spaceKey = spaceKey;
@@ -1698,11 +1756,11 @@ _ts_decorate4([
1698
1756
  ], ControlPipeline.prototype, "_processMessage", null);
1699
1757
  ControlPipeline = _ts_decorate4([
1700
1758
  import_tracing.trace.resource(),
1701
- (0, import_async5.trackLeaks)("start", "stop")
1759
+ (0, import_async6.trackLeaks)("start", "stop")
1702
1760
  ], ControlPipeline);
1703
1761
 
1704
1762
  // packages/core/echo/echo-pipeline/src/space/data-pipeline.ts
1705
- var import_async6 = require("@dxos/async");
1763
+ var import_async7 = require("@dxos/async");
1706
1764
  var import_context6 = require("@dxos/context");
1707
1765
  var import_credentials3 = require("@dxos/credentials");
1708
1766
  var import_echo_db3 = require("@dxos/echo-db");
@@ -1722,7 +1780,7 @@ function _ts_decorate5(decorators, target, key, desc) {
1722
1780
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1723
1781
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1724
1782
  }
1725
- var __dxlog_file10 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/data-pipeline.ts";
1783
+ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/data-pipeline.ts";
1726
1784
  var MESSAGES_PER_SNAPSHOT = 10;
1727
1785
  var AUTOMATIC_SNAPSHOT_DEBOUNCE_INTERVAL = 5e3;
1728
1786
  var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL2 = 5e3;
@@ -1741,7 +1799,7 @@ var DataPipeline = class DataPipeline2 {
1741
1799
  this._mutations = new import_tracing2.TimeSeriesCounter();
1742
1800
  this.currentEpoch = void 0;
1743
1801
  this.appliedEpoch = void 0;
1744
- this.onNewEpoch = new import_async6.Event();
1802
+ this.onNewEpoch = new import_async7.Event();
1745
1803
  }
1746
1804
  get isOpen() {
1747
1805
  return this._isOpen;
@@ -1804,7 +1862,7 @@ var DataPipeline = class DataPipeline2 {
1804
1862
  this.databaseHost = new DatabaseHost(feedWriter, () => this._flush());
1805
1863
  this.itemManager = new import_echo_db3.ItemManager(this._params.modelFactory);
1806
1864
  await this.databaseHost.open(this.itemManager, this._params.modelFactory);
1807
- (0, import_async6.scheduleTask)(this._ctx, async () => {
1865
+ (0, import_async7.scheduleTask)(this._ctx, async () => {
1808
1866
  await this._consumePipeline();
1809
1867
  });
1810
1868
  this._isOpen = true;
@@ -1923,7 +1981,7 @@ var DataPipeline = class DataPipeline2 {
1923
1981
  span.end();
1924
1982
  if (++messageCounter > 1e3) {
1925
1983
  messageCounter = 0;
1926
- await (0, import_async6.sleep)(1);
1984
+ await (0, import_async7.sleep)(1);
1927
1985
  }
1928
1986
  }
1929
1987
  }
@@ -2003,7 +2061,7 @@ var DataPipeline = class DataPipeline2 {
2003
2061
  }
2004
2062
  });
2005
2063
  this._epochCtx = ctx;
2006
- (0, import_async6.scheduleTask)(ctx, async () => {
2064
+ (0, import_async7.scheduleTask)(ctx, async () => {
2007
2065
  if (!this._isOpen) {
2008
2066
  return;
2009
2067
  }
@@ -2124,19 +2182,19 @@ _ts_decorate5([
2124
2182
  import_tracing2.trace.metricsCounter()
2125
2183
  ], DataPipeline.prototype, "_mutations", void 0);
2126
2184
  _ts_decorate5([
2127
- import_async6.synchronized
2185
+ import_async7.synchronized
2128
2186
  ], DataPipeline.prototype, "open", null);
2129
2187
  _ts_decorate5([
2130
- import_async6.synchronized
2188
+ import_async7.synchronized
2131
2189
  ], DataPipeline.prototype, "close", null);
2132
2190
  _ts_decorate5([
2133
- import_async6.synchronized
2191
+ import_async7.synchronized
2134
2192
  ], DataPipeline.prototype, "_processEpoch", null);
2135
2193
  _ts_decorate5([
2136
- import_async6.synchronized
2194
+ import_async7.synchronized
2137
2195
  ], DataPipeline.prototype, "createEpoch", null);
2138
2196
  DataPipeline = _ts_decorate5([
2139
- (0, import_async6.trackLeaks)("open", "close"),
2197
+ (0, import_async7.trackLeaks)("open", "close"),
2140
2198
  import_tracing2.trace.resource()
2141
2199
  ], DataPipeline);
2142
2200
 
@@ -2151,12 +2209,12 @@ function _ts_decorate6(decorators, target, key, desc) {
2151
2209
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2152
2210
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2153
2211
  }
2154
- var __dxlog_file11 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/space.ts";
2212
+ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
2155
2213
  var Space = class Space2 {
2156
2214
  constructor(params) {
2157
- this._addFeedLock = new import_async7.Lock();
2215
+ this._addFeedLock = new import_async8.Lock();
2158
2216
  this.onCredentialProcessed = new import_util7.Callback();
2159
- this.stateUpdate = new import_async7.Event();
2217
+ this.stateUpdate = new import_async8.Event();
2160
2218
  this._isOpen = false;
2161
2219
  (0, import_invariant9.invariant)(params.spaceKey && params.feedProvider, void 0, {
2162
2220
  F: __dxlog_file11,
@@ -2375,22 +2433,22 @@ _ts_decorate6([
2375
2433
  import_tracing3.trace.info()
2376
2434
  ], Space.prototype, "key", null);
2377
2435
  _ts_decorate6([
2378
- import_async7.synchronized,
2436
+ import_async8.synchronized,
2379
2437
  import_tracing3.trace.span()
2380
2438
  ], Space.prototype, "open", null);
2381
2439
  _ts_decorate6([
2382
- import_async7.synchronized
2440
+ import_async8.synchronized
2383
2441
  ], Space.prototype, "close", null);
2384
2442
  _ts_decorate6([
2385
- import_async7.synchronized
2443
+ import_async8.synchronized
2386
2444
  ], Space.prototype, "initializeDataPipeline", null);
2387
2445
  Space = _ts_decorate6([
2388
- (0, import_async7.trackLeaks)("open", "close"),
2446
+ (0, import_async8.trackLeaks)("open", "close"),
2389
2447
  import_tracing3.trace.resource()
2390
2448
  ], Space);
2391
2449
 
2392
2450
  // packages/core/echo/echo-pipeline/src/space/space-manager.ts
2393
- var import_async8 = require("@dxos/async");
2451
+ var import_async9 = require("@dxos/async");
2394
2452
  var import_debug4 = require("@dxos/debug");
2395
2453
  var import_keys7 = require("@dxos/keys");
2396
2454
  var import_log12 = require("@dxos/log");
@@ -2416,7 +2474,7 @@ function _ts_decorate7(decorators, target, key, desc) {
2416
2474
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2417
2475
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2418
2476
  }
2419
- var __dxlog_file12 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
2477
+ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
2420
2478
  var MOCK_AUTH_PROVIDER = async (nonce) => Buffer.from("mock");
2421
2479
  var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
2422
2480
  var SpaceProtocol = class {
@@ -2614,7 +2672,7 @@ function _ts_decorate8(decorators, target, key, desc) {
2614
2672
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2615
2673
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2616
2674
  }
2617
- var __dxlog_file13 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
2675
+ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
2618
2676
  var SpaceManager = class SpaceManager2 {
2619
2677
  constructor({ feedStore, networkManager, modelFactory, metadataStore, snapshotStore, blobStore }) {
2620
2678
  this._spaces = new import_util9.ComplexMap(import_keys7.PublicKey.hash);
@@ -2688,13 +2746,13 @@ var SpaceManager = class SpaceManager2 {
2688
2746
  }
2689
2747
  };
2690
2748
  _ts_decorate8([
2691
- import_async8.synchronized
2749
+ import_async9.synchronized
2692
2750
  ], SpaceManager.prototype, "open", null);
2693
2751
  _ts_decorate8([
2694
- import_async8.synchronized
2752
+ import_async9.synchronized
2695
2753
  ], SpaceManager.prototype, "close", null);
2696
2754
  SpaceManager = _ts_decorate8([
2697
- (0, import_async8.trackLeaks)("open", "close")
2755
+ (0, import_async9.trackLeaks)("open", "close")
2698
2756
  ], SpaceManager);
2699
2757
 
2700
2758
  // packages/core/echo/echo-pipeline/src/testing/test-agent-builder.ts
@@ -2871,7 +2929,7 @@ var TestAgent = class {
2871
2929
  };
2872
2930
 
2873
2931
  // packages/core/echo/echo-pipeline/src/testing/util.ts
2874
- var import_async9 = require("@dxos/async");
2932
+ var import_async10 = require("@dxos/async");
2875
2933
  var import_document_model2 = require("@dxos/document-model");
2876
2934
  var import_echo_db4 = require("@dxos/echo-db");
2877
2935
  var import_testing2 = require("@dxos/feed-store/testing");
@@ -2933,11 +2991,11 @@ var testLocalDatabase = async (create, check = create) => {
2933
2991
  ]
2934
2992
  }
2935
2993
  });
2936
- await (0, import_async9.asyncTimeout)(check.databaseHost._itemDemuxer.mutation.waitForCondition(() => check.itemManager.entities.has(objectId)), 2e3);
2994
+ await (0, import_async10.asyncTimeout)(check.databaseHost._itemDemuxer.mutation.waitForCondition(() => check.itemManager.entities.has(objectId)), 2e3);
2937
2995
  };
2938
2996
 
2939
2997
  // packages/core/echo/echo-pipeline/src/testing/database-test-rig.ts
2940
- var import_async10 = require("@dxos/async");
2998
+ var import_async11 = require("@dxos/async");
2941
2999
  var import_document_model3 = require("@dxos/document-model");
2942
3000
  var import_echo_db5 = require("@dxos/echo-db");
2943
3001
  var import_invariant10 = require("@dxos/invariant");
@@ -2947,7 +3005,7 @@ var import_protocols8 = require("@dxos/protocols");
2947
3005
  var import_text_model = require("@dxos/text-model");
2948
3006
  var import_timeframe6 = require("@dxos/timeframe");
2949
3007
  var import_util11 = require("@dxos/util");
2950
- var __dxlog_file14 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/testing/database-test-rig.ts";
3008
+ var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/testing/database-test-rig.ts";
2951
3009
  var SPACE_KEY = import_keys10.PublicKey.random();
2952
3010
  var DatabaseTestBuilder = class {
2953
3011
  constructor() {
@@ -2970,7 +3028,7 @@ var DatabaseTestPeer = class {
2970
3028
  this.snapshots = /* @__PURE__ */ new Map();
2971
3029
  this.confirmed = -1;
2972
3030
  this.timeframe = new import_timeframe6.Timeframe();
2973
- this._onConfirm = new import_async10.Event();
3031
+ this._onConfirm = new import_async11.Event();
2974
3032
  this._writes = /* @__PURE__ */ new Set();
2975
3033
  }
2976
3034
  async open() {
@@ -2991,7 +3049,7 @@ var DatabaseTestPeer = class {
2991
3049
  options: {
2992
3050
  afterWrite
2993
3051
  },
2994
- trigger: new import_async10.Trigger()
3052
+ trigger: new import_async11.Trigger()
2995
3053
  };
2996
3054
  this._writes.add(request);
2997
3055
  await request.trigger.wait();
@@ -3005,7 +3063,9 @@ var DatabaseTestPeer = class {
3005
3063
  }
3006
3064
  this.items = new import_echo_db5.ItemManager(this.modelFactory);
3007
3065
  this.proxy = new import_echo_db5.DatabaseProxy({
3008
- service: this.host.createDataServiceHost(),
3066
+ service: this.host.createDataServiceHost({
3067
+ deferEvents: false
3068
+ }),
3009
3069
  itemManager: this.items,
3010
3070
  spaceKey: this.spaceKey
3011
3071
  });