@dxos/client-services 0.4.8-next.fff1521 → 0.4.9-main.1057b49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/lib/browser/{chunk-VL6WFLTS.mjs → chunk-SUJLI7YP.mjs} +210 -281
  2. package/dist/lib/browser/chunk-SUJLI7YP.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -3
  4. package/dist/lib/browser/index.mjs.map +1 -1
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs +6 -15
  7. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/{chunk-K2PCGWBW.cjs → chunk-VWAYL2FO.cjs} +226 -298
  9. package/dist/lib/node/chunk-VWAYL2FO.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +37 -39
  11. package/dist/lib/node/index.cjs.map +1 -1
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/packlets/testing/index.cjs +8 -17
  14. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  15. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  16. package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
  17. package/dist/types/src/packlets/services/diagnostics.d.ts +1 -1
  18. package/dist/types/src/packlets/services/diagnostics.d.ts.map +1 -1
  19. package/dist/types/src/packlets/services/service-context.d.ts +3 -6
  20. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  21. package/dist/types/src/packlets/services/service-host.d.ts +1 -5
  22. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  23. package/dist/types/src/packlets/spaces/automerge-space-state.d.ts +3 -0
  24. package/dist/types/src/packlets/spaces/automerge-space-state.d.ts.map +1 -1
  25. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +2 -3
  26. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  27. package/dist/types/src/packlets/spaces/data-space.d.ts +5 -3
  28. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  29. package/dist/types/src/packlets/spaces/spaces-service.d.ts +2 -3
  30. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  31. package/dist/types/src/packlets/testing/test-builder.d.ts +2 -3
  32. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  33. package/dist/types/src/version.d.ts +1 -1
  34. package/package.json +34 -37
  35. package/src/packlets/identity/identity-manager.test.ts +0 -2
  36. package/src/packlets/identity/identity.test.ts +0 -4
  37. package/src/packlets/identity/identity.ts +1 -0
  38. package/src/packlets/indexing/util.ts +2 -2
  39. package/src/packlets/invitations/space-invitation-protocol.test.ts +3 -12
  40. package/src/packlets/invitations/space-invitation-protocol.ts +0 -1
  41. package/src/packlets/services/automerge-host.test.ts +2 -5
  42. package/src/packlets/services/diagnostics.ts +5 -44
  43. package/src/packlets/services/service-context.test.ts +3 -76
  44. package/src/packlets/services/service-context.ts +5 -18
  45. package/src/packlets/services/service-host.ts +6 -23
  46. package/src/packlets/spaces/automerge-space-state.ts +9 -0
  47. package/src/packlets/spaces/data-space-manager.test.ts +3 -145
  48. package/src/packlets/spaces/data-space-manager.ts +3 -18
  49. package/src/packlets/spaces/data-space.ts +11 -43
  50. package/src/packlets/spaces/spaces-service.test.ts +4 -9
  51. package/src/packlets/spaces/spaces-service.ts +11 -15
  52. package/src/packlets/testing/test-builder.ts +4 -23
  53. package/src/version.ts +1 -1
  54. package/dist/lib/browser/chunk-VL6WFLTS.mjs.map +0 -7
  55. package/dist/lib/node/chunk-K2PCGWBW.cjs.map +0 -7
@@ -26,8 +26,8 @@ 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_K2PCGWBW_exports = {};
30
- __export(chunk_K2PCGWBW_exports, {
29
+ var chunk_VWAYL2FO_exports = {};
30
+ __export(chunk_VWAYL2FO_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -47,7 +47,6 @@ __export(chunk_K2PCGWBW_exports, {
47
47
  SpacesServiceImpl: () => SpacesServiceImpl,
48
48
  TrustedKeySetAuthVerifier: () => TrustedKeySetAuthVerifier,
49
49
  createAuthProvider: () => createAuthProvider,
50
- createDefaultModelFactory: () => createDefaultModelFactory,
51
50
  createDiagnostics: () => createDiagnostics,
52
51
  createStorageObjects: () => createStorageObjects,
53
52
  getNetworkPeers: () => getNetworkPeers,
@@ -61,7 +60,7 @@ __export(chunk_K2PCGWBW_exports, {
61
60
  subscribeToSpaces: () => subscribeToSpaces,
62
61
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
63
62
  });
64
- module.exports = __toCommonJS(chunk_K2PCGWBW_exports);
63
+ module.exports = __toCommonJS(chunk_VWAYL2FO_exports);
65
64
  var import_async = require("@dxos/async");
66
65
  var import_codec_protobuf = require("@dxos/codec-protobuf");
67
66
  var import_feed_store = require("@dxos/feed-store");
@@ -150,10 +149,7 @@ var import_rpc = require("@dxos/rpc");
150
149
  var import_tracing3 = require("@dxos/tracing");
151
150
  var import_codec_protobuf10 = require("@dxos/codec-protobuf");
152
151
  var import_credentials9 = require("@dxos/credentials");
153
- var import_document_model = require("@dxos/document-model");
154
- var import_echo_db = require("@dxos/echo-db");
155
152
  var import_invariant9 = require("@dxos/invariant");
156
- var import_log8 = require("@dxos/log");
157
153
  var import_protocols7 = require("@dxos/protocols");
158
154
  var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
159
155
  var import_tracing4 = require("@dxos/tracing");
@@ -165,28 +161,29 @@ var import_debug3 = require("@dxos/debug");
165
161
  var import_echo_pipeline = require("@dxos/echo-pipeline");
166
162
  var import_invariant10 = require("@dxos/invariant");
167
163
  var import_keys7 = require("@dxos/keys");
168
- var import_log9 = require("@dxos/log");
164
+ var import_log8 = require("@dxos/log");
169
165
  var import_protocols8 = require("@dxos/protocols");
170
166
  var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
171
167
  var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
172
168
  var import_timeframe2 = require("@dxos/timeframe");
173
169
  var import_tracing5 = require("@dxos/tracing");
174
170
  var import_util4 = require("@dxos/util");
175
- var import_credentials11 = require("@dxos/credentials");
176
171
  var import_async11 = require("@dxos/async");
172
+ var import_credentials11 = require("@dxos/credentials");
173
+ var import_async12 = require("@dxos/async");
177
174
  var import_context8 = require("@dxos/context");
178
175
  var import_invariant11 = require("@dxos/invariant");
179
176
  var import_keys8 = require("@dxos/keys");
180
- var import_log10 = require("@dxos/log");
177
+ var import_log9 = require("@dxos/log");
181
178
  var import_protocols9 = require("@dxos/protocols");
182
179
  var import_teleport2 = require("@dxos/teleport");
183
180
  var import_util5 = require("@dxos/util");
184
- var import_async12 = require("@dxos/async");
181
+ var import_async13 = require("@dxos/async");
185
182
  var import_context9 = require("@dxos/context");
186
183
  var import_credentials12 = require("@dxos/credentials");
187
184
  var import_invariant12 = require("@dxos/invariant");
188
185
  var import_keys9 = require("@dxos/keys");
189
- var import_log11 = require("@dxos/log");
186
+ var import_log10 = require("@dxos/log");
190
187
  var import_protocols10 = require("@dxos/protocols");
191
188
  var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
192
189
  var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
@@ -195,14 +192,14 @@ var import_credentials13 = require("@dxos/credentials");
195
192
  var import_debug4 = require("@dxos/debug");
196
193
  var import_credentials14 = require("@dxos/protocols/proto/dxos/halo/credentials");
197
194
  var import_timeframe3 = require("@dxos/timeframe");
198
- var import_async13 = require("@dxos/async");
195
+ var import_async14 = require("@dxos/async");
199
196
  var import_codec_protobuf11 = require("@dxos/codec-protobuf");
200
197
  var import_debug5 = require("@dxos/debug");
201
198
  var import_invariant13 = require("@dxos/invariant");
202
- var import_log12 = require("@dxos/log");
199
+ var import_log11 = require("@dxos/log");
203
200
  var import_protocols11 = require("@dxos/protocols");
204
201
  var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
205
- var import_async14 = require("@dxos/async");
202
+ var import_async15 = require("@dxos/async");
206
203
  var import_context10 = require("@dxos/context");
207
204
  var import_credentials15 = require("@dxos/credentials");
208
205
  var import_debug6 = require("@dxos/debug");
@@ -212,7 +209,7 @@ var import_indexing = require("@dxos/indexing");
212
209
  var import_invariant14 = require("@dxos/invariant");
213
210
  var import_keyring = require("@dxos/keyring");
214
211
  var import_keys10 = require("@dxos/keys");
215
- var import_log13 = require("@dxos/log");
212
+ var import_log12 = require("@dxos/log");
216
213
  var import_protocols12 = require("@dxos/protocols");
217
214
  var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
218
215
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
@@ -223,39 +220,36 @@ var import_debug7 = require("@dxos/debug");
223
220
  var import_protocols13 = require("@dxos/protocols");
224
221
  var import_invariant15 = require("@dxos/invariant");
225
222
  var import_lock_file = require("@dxos/lock-file");
226
- var import_log14 = require("@dxos/log");
223
+ var import_log13 = require("@dxos/log");
227
224
  var import_client_protocol4 = require("@dxos/client-protocol");
228
225
  var import_protocols14 = require("@dxos/protocols");
229
226
  var import_config = require("@dxos/protocols/proto/dxos/config");
230
227
  var import_random_access_storage = require("@dxos/random-access-storage");
231
228
  var import_util8 = require("@dxos/util");
232
- var import_async15 = require("@dxos/async");
229
+ var import_async16 = require("@dxos/async");
233
230
  var import_client_protocol5 = require("@dxos/client-protocol");
234
231
  var import_context11 = require("@dxos/context");
235
- var import_document_model2 = require("@dxos/document-model");
236
232
  var import_echo_pipeline3 = require("@dxos/echo-pipeline");
237
233
  var import_echo_schema = require("@dxos/echo-schema");
238
234
  var import_indexing2 = require("@dxos/indexing");
239
235
  var import_invariant16 = require("@dxos/invariant");
240
236
  var import_keys11 = require("@dxos/keys");
241
- var import_log15 = require("@dxos/log");
237
+ var import_log14 = require("@dxos/log");
242
238
  var import_messaging = require("@dxos/messaging");
243
- var import_model_factory = require("@dxos/model-factory");
244
239
  var import_network_manager2 = require("@dxos/network-manager");
245
240
  var import_protocols15 = require("@dxos/protocols");
246
241
  var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
247
- var import_text_model = require("@dxos/text-model");
248
242
  var import_tracing7 = require("@dxos/tracing");
249
243
  var import_util9 = require("@dxos/util");
250
244
  var import_websocket_rpc = require("@dxos/websocket-rpc");
251
- var import_async16 = require("@dxos/async");
245
+ var import_async17 = require("@dxos/async");
252
246
  var import_codec_protobuf12 = require("@dxos/codec-protobuf");
253
247
  var import_invariant17 = require("@dxos/invariant");
254
248
  var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
255
- var import_async17 = require("@dxos/async");
249
+ var import_async18 = require("@dxos/async");
256
250
  var import_codec_protobuf13 = require("@dxos/codec-protobuf");
257
251
  var import_keys12 = require("@dxos/keys");
258
- var import_log16 = require("@dxos/log");
252
+ var import_log15 = require("@dxos/log");
259
253
  var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
260
254
  var import_util10 = require("@dxos/util");
261
255
  var import_codec_protobuf14 = require("@dxos/codec-protobuf");
@@ -732,6 +726,7 @@ var Identity = class {
732
726
  await this.space.open(ctx);
733
727
  }
734
728
  async close(ctx) {
729
+ await this._presence?.destroy();
735
730
  await this.authVerifier.close();
736
731
  await this.space.spaceState.removeCredentialProcessor(this._profileStateMachine);
737
732
  await this.space.spaceState.removeCredentialProcessor(this._deviceStateMachine);
@@ -771,7 +766,7 @@ var Identity = class {
771
766
  getIdentityCredentialSigner() {
772
767
  (0, import_invariant.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
773
768
  F: __dxlog_file2,
774
- L: 144,
769
+ L: 145,
775
770
  S: this,
776
771
  A: [
777
772
  "this._deviceStateMachine.deviceCredentialChain",
@@ -795,7 +790,7 @@ var Identity = class {
795
790
  dataFeedKey
796
791
  }, {
797
792
  F: __dxlog_file2,
798
- L: 160,
793
+ L: 161,
799
794
  S: this,
800
795
  C: (f, a) => f(...a)
801
796
  });
@@ -2716,8 +2711,7 @@ var SpaceInvitationProtocol = class {
2716
2711
  return {
2717
2712
  space: {
2718
2713
  credential: spaceMemberCredential,
2719
- controlTimeframe: space.inner.controlPipeline.state.timeframe,
2720
- dataTimeframe: space.dataPipeline.pipelineState?.timeframe
2714
+ controlTimeframe: space.inner.controlPipeline.state.timeframe
2721
2715
  }
2722
2716
  };
2723
2717
  }
@@ -2746,7 +2740,7 @@ var SpaceInvitationProtocol = class {
2746
2740
  async accept(response) {
2747
2741
  (0, import_invariant8.invariant)(response.space, void 0, {
2748
2742
  F: __dxlog_file9,
2749
- L: 108,
2743
+ L: 107,
2750
2744
  S: this,
2751
2745
  A: [
2752
2746
  "response.space",
@@ -2757,7 +2751,7 @@ var SpaceInvitationProtocol = class {
2757
2751
  const assertion = (0, import_credentials8.getCredentialAssertion)(credential);
2758
2752
  (0, import_invariant8.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
2759
2753
  F: __dxlog_file9,
2760
- L: 111,
2754
+ L: 110,
2761
2755
  S: this,
2762
2756
  A: [
2763
2757
  "assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2766,7 +2760,7 @@ var SpaceInvitationProtocol = class {
2766
2760
  });
2767
2761
  (0, import_invariant8.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
2768
2762
  F: __dxlog_file9,
2769
- L: 112,
2763
+ L: 111,
2770
2764
  S: this,
2771
2765
  A: [
2772
2766
  "credential.subject.id.equals(this._signingContext.identityKey)",
@@ -2890,7 +2884,7 @@ var getPlatform = () => {
2890
2884
  };
2891
2885
  }
2892
2886
  };
2893
- var DXOS_VERSION = "0.4.8-next.fff1521";
2887
+ var DXOS_VERSION = "0.4.9-main.1057b49";
2894
2888
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
2895
2889
  var DEFAULT_TIMEOUT = 1e3;
2896
2890
  var createDiagnostics = async (clientServices, serviceContext, config) => {
@@ -2908,7 +2902,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
2908
2902
  {
2909
2903
  (0, import_invariant9.invariant)(clientServices.LoggingService, "SystemService is not available.", {
2910
2904
  F: __dxlog_file10,
2911
- L: 111,
2905
+ L: 108,
2912
2906
  S: void 0,
2913
2907
  A: [
2914
2908
  "clientServices.LoggingService",
@@ -2965,22 +2959,6 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
2965
2959
  diagnostics.config = config.values;
2966
2960
  return diagnostics;
2967
2961
  };
2968
- var getProperties = (space) => {
2969
- let properties = {};
2970
- try {
2971
- const propertiesItem = space.dataPipeline.itemManager.items.find((item) => item.modelMeta?.type === import_document_model.DocumentModel.meta.type && item.state?.type?.itemId === import_echo_db.TYPE_PROPERTIES);
2972
- const state = propertiesItem?.state;
2973
- properties = state?.data;
2974
- } catch (err) {
2975
- import_log8.log.warn(err.message, void 0, {
2976
- F: __dxlog_file10,
2977
- L: 196,
2978
- S: void 0,
2979
- C: (f, a) => f(...a)
2980
- });
2981
- }
2982
- return properties;
2983
- };
2984
2962
  var getSpaceStats = async (space) => {
2985
2963
  const stats = {
2986
2964
  key: space.key,
@@ -3000,28 +2978,14 @@ var getSpaceStats = async (space) => {
3000
2978
  })),
3001
2979
  pipeline: {
3002
2980
  // TODO(burdon): Pick properties from credentials if needed.
3003
- // currentEpoch: space.dataPipeline.currentEpoch,
3004
- // appliedEpoch: space.dataPipeline.appliedEpoch,
2981
+ currentEpoch: space.automergeSpaceState.lastEpoch,
2982
+ appliedEpoch: space.automergeSpaceState.lastEpoch,
3005
2983
  controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
3006
2984
  currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
3007
2985
  targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
3008
- totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe,
3009
- // TODO(burdon): Empty?
3010
- dataFeeds: space.dataPipeline.pipelineState?.feeds.map((feed) => feed.key) ?? [],
3011
- startDataTimeframe: space.dataPipeline.pipelineState?.startTimeframe,
3012
- currentDataTimeframe: space.dataPipeline.pipelineState?.timeframe,
3013
- targetDataTimeframe: space.dataPipeline.pipelineState?.targetTimeframe,
3014
- totalDataTimeframe: space.dataPipeline.pipelineState?.endTimeframe
2986
+ totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe
3015
2987
  }
3016
2988
  };
3017
- if (space.dataPipeline.itemManager) {
3018
- Object.assign(stats, {
3019
- properties: getProperties(space),
3020
- db: {
3021
- objects: space.dataPipeline.itemManager.entities.size
3022
- }
3023
- });
3024
- }
3025
2989
  if (stats.metrics) {
3026
2990
  const { open, ready } = stats.metrics;
3027
2991
  stats.metrics.startupTime = open && ready && ready.getTime() - open.getTime();
@@ -3033,6 +2997,7 @@ var AutomergeSpaceState = class {
3033
2997
  this._onNewRoot = _onNewRoot;
3034
2998
  this.rootUrl = void 0;
3035
2999
  this.lastEpoch = void 0;
3000
+ this.onNewEpoch = new import_async11.Event();
3036
3001
  this._isProcessingRootDocs = false;
3037
3002
  }
3038
3003
  async processCredential(credential) {
@@ -3046,6 +3011,7 @@ var AutomergeSpaceState = class {
3046
3011
  this._onNewRoot(this.rootUrl);
3047
3012
  }
3048
3013
  }
3014
+ this.onNewEpoch.emit(credential);
3049
3015
  }
3050
3016
  startProcessingRootDocs() {
3051
3017
  if (this._isProcessingRootDocs) {
@@ -3056,6 +3022,9 @@ var AutomergeSpaceState = class {
3056
3022
  }
3057
3023
  this._isProcessingRootDocs = true;
3058
3024
  }
3025
+ async ensureEpochInitialized() {
3026
+ await this.onNewEpoch.waitForCondition(() => !!this.lastEpoch);
3027
+ }
3059
3028
  };
3060
3029
  var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
3061
3030
  var DEFAULT_RETRY_TIMEOUT = 1e3;
@@ -3065,7 +3034,7 @@ var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
3065
3034
  var NotarizationPlugin = class {
3066
3035
  constructor() {
3067
3036
  this._ctx = new import_context8.Context();
3068
- this._extensionOpened = new import_async11.Event();
3037
+ this._extensionOpened = new import_async12.Event();
3069
3038
  this._extensions = /* @__PURE__ */ new Set();
3070
3039
  this._processedCredentials = new import_util5.ComplexSet(import_keys8.PublicKey.hash);
3071
3040
  this._processCredentialsTriggers = new import_util5.ComplexMap(import_keys8.PublicKey.hash);
@@ -3082,7 +3051,7 @@ var NotarizationPlugin = class {
3082
3051
  * Request credentials to be notarized.
3083
3052
  */
3084
3053
  async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY }) {
3085
- (0, import_log10.log)("notarize", {
3054
+ (0, import_log9.log)("notarize", {
3086
3055
  credentials
3087
3056
  }, {
3088
3057
  F: __dxlog_file11,
@@ -3099,10 +3068,10 @@ var NotarizationPlugin = class {
3099
3068
  "'Credentials must have an id'"
3100
3069
  ]
3101
3070
  });
3102
- const errors = new import_async11.Trigger();
3071
+ const errors = new import_async12.Trigger();
3103
3072
  const ctx = this._ctx.derive({
3104
3073
  onError: (err) => {
3105
- import_log10.log.warn("Notarization error", {
3074
+ import_log9.log.warn("Notarization error", {
3106
3075
  err
3107
3076
  }, {
3108
3077
  F: __dxlog_file11,
@@ -3116,8 +3085,8 @@ var NotarizationPlugin = class {
3116
3085
  });
3117
3086
  opCtx?.onDispose(() => ctx.dispose());
3118
3087
  if (timeout !== 0) {
3119
- (0, import_async11.scheduleTask)(ctx, () => {
3120
- import_log10.log.warn("Notarization timeout", {
3088
+ (0, import_async12.scheduleTask)(ctx, () => {
3089
+ import_log9.log.warn("Notarization timeout", {
3121
3090
  timeout,
3122
3091
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
3123
3092
  }, {
@@ -3127,12 +3096,12 @@ var NotarizationPlugin = class {
3127
3096
  C: (f, a) => f(...a)
3128
3097
  });
3129
3098
  void ctx.dispose();
3130
- errors.throw(new import_async11.TimeoutError(timeout, "Notarization timed out"));
3099
+ errors.throw(new import_async12.TimeoutError(timeout, "Notarization timed out"));
3131
3100
  }, timeout);
3132
3101
  }
3133
3102
  const allNotarized = Promise.all(credentials.map((credential) => this._waitUntilProcessed(credential.id)));
3134
3103
  const peersTried = /* @__PURE__ */ new Set();
3135
- const notarizeTask = new import_async11.DeferredTask(ctx, async () => {
3104
+ const notarizeTask = new import_async12.DeferredTask(ctx, async () => {
3136
3105
  try {
3137
3106
  if (this._extensions.size === 0) {
3138
3107
  return;
@@ -3141,7 +3110,7 @@ var NotarizationPlugin = class {
3141
3110
  ...this._extensions
3142
3111
  ].find((peer2) => !peersTried.has(peer2));
3143
3112
  if (!peer) {
3144
- import_log10.log.info("Exhausted all peers to notarize with", {
3113
+ import_log9.log.info("Exhausted all peers to notarize with", {
3145
3114
  retryIn: retryTimeout
3146
3115
  }, {
3147
3116
  F: __dxlog_file11,
@@ -3150,11 +3119,11 @@ var NotarizationPlugin = class {
3150
3119
  C: (f, a) => f(...a)
3151
3120
  });
3152
3121
  peersTried.clear();
3153
- (0, import_async11.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
3122
+ (0, import_async12.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
3154
3123
  return;
3155
3124
  }
3156
3125
  peersTried.add(peer);
3157
- (0, import_log10.log)("try notarizing", {
3126
+ (0, import_log9.log)("try notarizing", {
3158
3127
  peer: peer.localPeerId,
3159
3128
  credentialId: credentials.map((credential) => credential.id)
3160
3129
  }, {
@@ -3166,16 +3135,16 @@ var NotarizationPlugin = class {
3166
3135
  await peer.rpc.NotarizationService.notarize({
3167
3136
  credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
3168
3137
  });
3169
- (0, import_log10.log)("success", void 0, {
3138
+ (0, import_log9.log)("success", void 0, {
3170
3139
  F: __dxlog_file11,
3171
3140
  L: 147,
3172
3141
  S: this,
3173
3142
  C: (f, a) => f(...a)
3174
3143
  });
3175
- await (0, import_async11.sleep)(successDelay);
3144
+ await (0, import_async12.sleep)(successDelay);
3176
3145
  } catch (err) {
3177
3146
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
3178
- import_log10.log.info("error notarizing (recoverable)", err, {
3147
+ import_log9.log.info("error notarizing (recoverable)", err, {
3179
3148
  F: __dxlog_file11,
3180
3149
  L: 151,
3181
3150
  S: this,
@@ -3193,7 +3162,7 @@ var NotarizationPlugin = class {
3193
3162
  allNotarized,
3194
3163
  errors.wait()
3195
3164
  ]);
3196
- (0, import_log10.log)("done", void 0, {
3165
+ (0, import_log9.log)("done", void 0, {
3197
3166
  F: __dxlog_file11,
3198
3167
  L: 162,
3199
3168
  S: this,
@@ -3230,7 +3199,7 @@ var NotarizationPlugin = class {
3230
3199
  if (this._processedCredentials.has(id)) {
3231
3200
  return;
3232
3201
  }
3233
- await (0, import_util5.entry)(this._processCredentialsTriggers, id).orInsert(new import_async11.Trigger()).value.wait();
3202
+ await (0, import_util5.entry)(this._processCredentialsTriggers, id).orInsert(new import_async12.Trigger()).value.wait();
3234
3203
  }
3235
3204
  /**
3236
3205
  * Requests from other peers to notarize credentials.
@@ -3258,7 +3227,7 @@ var NotarizationPlugin = class {
3258
3227
  createExtension() {
3259
3228
  const extension = new NotarizationTeleportExtension({
3260
3229
  onOpen: async () => {
3261
- (0, import_log10.log)("extension opened", {
3230
+ (0, import_log9.log)("extension opened", {
3262
3231
  peer: extension.localPeerId
3263
3232
  }, {
3264
3233
  F: __dxlog_file11,
@@ -3270,7 +3239,7 @@ var NotarizationPlugin = class {
3270
3239
  this._extensionOpened.emit();
3271
3240
  },
3272
3241
  onClose: async () => {
3273
- (0, import_log10.log)("extension closed", {
3242
+ (0, import_log9.log)("extension closed", {
3274
3243
  peer: extension.localPeerId
3275
3244
  }, {
3276
3245
  F: __dxlog_file11,
@@ -3326,7 +3295,6 @@ function _ts_decorate4(decorators, target, key, desc) {
3326
3295
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3327
3296
  }
3328
3297
  var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
3329
- var ENABLE_FEED_PURGE = false;
3330
3298
  var DataSpace = class {
3331
3299
  constructor(params) {
3332
3300
  this._ctx = new import_context7.Context();
@@ -3354,11 +3322,11 @@ var DataSpace = class {
3354
3322
  });
3355
3323
  this._cache = params.cache;
3356
3324
  this._state = params.initialState;
3357
- (0, import_log9.log)("new state", {
3325
+ (0, import_log8.log)("new state", {
3358
3326
  state: import_services9.SpaceState[this._state]
3359
3327
  }, {
3360
3328
  F: __dxlog_file12,
3361
- L: 141,
3329
+ L: 132,
3362
3330
  S: this,
3363
3331
  C: (f, a) => f(...a)
3364
3332
  });
@@ -3376,9 +3344,6 @@ var DataSpace = class {
3376
3344
  get inner() {
3377
3345
  return this._inner;
3378
3346
  }
3379
- get dataPipeline() {
3380
- return this._inner.dataPipeline;
3381
- }
3382
3347
  get presence() {
3383
3348
  return this._presence;
3384
3349
  }
@@ -3407,11 +3372,11 @@ var DataSpace = class {
3407
3372
  await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
3408
3373
  await this._inner.open(new import_context7.Context());
3409
3374
  this._state = import_services9.SpaceState.CONTROL_ONLY;
3410
- (0, import_log9.log)("new state", {
3375
+ (0, import_log8.log)("new state", {
3411
3376
  state: import_services9.SpaceState[this._state]
3412
3377
  }, {
3413
3378
  F: __dxlog_file12,
3414
- L: 203,
3379
+ L: 190,
3415
3380
  S: this,
3416
3381
  C: (f, a) => f(...a)
3417
3382
  });
@@ -3425,11 +3390,11 @@ var DataSpace = class {
3425
3390
  async _close() {
3426
3391
  await this._callbacks.beforeClose?.();
3427
3392
  this._state = import_services9.SpaceState.CLOSED;
3428
- (0, import_log9.log)("new state", {
3393
+ (0, import_log8.log)("new state", {
3429
3394
  state: import_services9.SpaceState[this._state]
3430
3395
  }, {
3431
3396
  F: __dxlog_file12,
3432
- L: 217,
3397
+ L: 204,
3433
3398
  S: this,
3434
3399
  C: (f, a) => f(...a)
3435
3400
  });
@@ -3459,26 +3424,26 @@ var DataSpace = class {
3459
3424
  await this.initializeDataPipeline();
3460
3425
  } catch (err) {
3461
3426
  if (err instanceof import_protocols8.CancelledError || err instanceof import_context7.ContextDisposedError) {
3462
- (0, import_log9.log)("data pipeline initialization cancelled", err, {
3427
+ (0, import_log8.log)("data pipeline initialization cancelled", err, {
3463
3428
  F: __dxlog_file12,
3464
- L: 250,
3429
+ L: 237,
3465
3430
  S: this,
3466
3431
  C: (f, a) => f(...a)
3467
3432
  });
3468
3433
  return;
3469
3434
  }
3470
- import_log9.log.error("Error initializing data pipeline", err, {
3435
+ import_log8.log.error("Error initializing data pipeline", err, {
3471
3436
  F: __dxlog_file12,
3472
- L: 254,
3437
+ L: 241,
3473
3438
  S: this,
3474
3439
  C: (f, a) => f(...a)
3475
3440
  });
3476
3441
  this._state = import_services9.SpaceState.ERROR;
3477
- (0, import_log9.log)("new state", {
3442
+ (0, import_log8.log)("new state", {
3478
3443
  state: import_services9.SpaceState[this._state]
3479
3444
  }, {
3480
3445
  F: __dxlog_file12,
3481
- L: 256,
3446
+ L: 243,
3482
3447
  S: this,
3483
3448
  C: (f, a) => f(...a)
3484
3449
  });
@@ -3494,44 +3459,31 @@ var DataSpace = class {
3494
3459
  throw new import_protocols8.SystemError("Invalid operation");
3495
3460
  }
3496
3461
  this._state = import_services9.SpaceState.INITIALIZING;
3497
- (0, import_log9.log)("new state", {
3462
+ (0, import_log8.log)("new state", {
3498
3463
  state: import_services9.SpaceState[this._state]
3499
3464
  }, {
3500
3465
  F: __dxlog_file12,
3501
- L: 272,
3466
+ L: 259,
3502
3467
  S: this,
3503
3468
  C: (f, a) => f(...a)
3504
3469
  });
3505
3470
  await this._initializeAndReadControlPipeline();
3506
3471
  await (0, import_async10.sleep)(1);
3507
3472
  this._automergeSpaceState.startProcessingRootDocs();
3508
- await this._inner.initializeDataPipeline();
3509
- this.metrics.dataPipelineOpen = /* @__PURE__ */ new Date();
3510
- await (0, import_context7.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
3511
- (0, import_log9.log)("waiting for data pipeline to reach target timeframe", void 0, {
3473
+ await (0, import_context7.cancelWithContext)(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
3474
+ (0, import_log8.log)("data pipeline ready", void 0, {
3512
3475
  F: __dxlog_file12,
3513
- L: 288,
3514
- S: this,
3515
- C: (f, a) => f(...a)
3516
- });
3517
- await this._inner.dataPipeline.pipelineState.waitUntilReachedTargetTimeframe({
3518
- ctx: this._ctx,
3519
- breakOnStall: false
3520
- });
3521
- this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
3522
- (0, import_log9.log)("data pipeline ready", void 0, {
3523
- F: __dxlog_file12,
3524
- L: 296,
3476
+ L: 271,
3525
3477
  S: this,
3526
3478
  C: (f, a) => f(...a)
3527
3479
  });
3528
3480
  await this._callbacks.beforeReady?.();
3529
3481
  this._state = import_services9.SpaceState.READY;
3530
- (0, import_log9.log)("new state", {
3482
+ (0, import_log8.log)("new state", {
3531
3483
  state: import_services9.SpaceState[this._state]
3532
3484
  }, {
3533
3485
  F: __dxlog_file12,
3534
- L: 300,
3486
+ L: 275,
3535
3487
  S: this,
3536
3488
  C: (f, a) => f(...a)
3537
3489
  });
@@ -3545,9 +3497,9 @@ var DataSpace = class {
3545
3497
  });
3546
3498
  this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
3547
3499
  await this._createWritableFeeds();
3548
- (0, import_log9.log)("writable feeds created", void 0, {
3500
+ (0, import_log8.log)("writable feeds created", void 0, {
3549
3501
  F: __dxlog_file12,
3550
- L: 316,
3502
+ L: 291,
3551
3503
  S: this,
3552
3504
  C: (f, a) => f(...a)
3553
3505
  });
@@ -3605,12 +3557,12 @@ var DataSpace = class {
3605
3557
  }
3606
3558
  }
3607
3559
  _onNewAutomergeRoot(rootUrl) {
3608
- (0, import_log9.log)("loading automerge root doc for space", {
3560
+ (0, import_log8.log)("loading automerge root doc for space", {
3609
3561
  space: this.key,
3610
3562
  rootUrl
3611
3563
  }, {
3612
3564
  F: __dxlog_file12,
3613
- L: 382,
3565
+ L: 357,
3614
3566
  S: this,
3615
3567
  C: (f, a) => f(...a)
3616
3568
  });
@@ -3636,13 +3588,13 @@ var DataSpace = class {
3636
3588
  if (err instanceof import_context7.ContextDisposedError) {
3637
3589
  return;
3638
3590
  }
3639
- import_log9.log.warn("error loading automerge root doc", {
3591
+ import_log8.log.warn("error loading automerge root doc", {
3640
3592
  space: this.key,
3641
3593
  rootUrl,
3642
3594
  err
3643
3595
  }, {
3644
3596
  F: __dxlog_file12,
3645
- L: 405,
3597
+ L: 380,
3646
3598
  S: this,
3647
3599
  C: (f, a) => f(...a)
3648
3600
  });
@@ -3670,7 +3622,12 @@ var DataSpace = class {
3670
3622
  case void 0:
3671
3623
  case import_services9.CreateEpochRequest.Migration.NONE:
3672
3624
  {
3673
- epoch = await this.dataPipeline.createEpoch();
3625
+ epoch = {
3626
+ previousId: this._automergeSpaceState.lastEpoch?.id,
3627
+ number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
3628
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe2.Timeframe(),
3629
+ automergeRoot: this._automergeSpaceState.lastEpoch?.subject.assertion?.automergeRoot
3630
+ };
3674
3631
  }
3675
3632
  break;
3676
3633
  case import_services9.CreateEpochRequest.Migration.INIT_AUTOMERGE:
@@ -3692,7 +3649,7 @@ var DataSpace = class {
3692
3649
  const newRoot = this._automergeHost.repo.create(rootHandle.docSync());
3693
3650
  (0, import_invariant10.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
3694
3651
  F: __dxlog_file12,
3695
- L: 450,
3652
+ L: 430,
3696
3653
  S: this,
3697
3654
  A: [
3698
3655
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
@@ -3728,15 +3685,6 @@ var DataSpace = class {
3728
3685
  receipt.seq
3729
3686
  ]
3730
3687
  ]));
3731
- if (ENABLE_FEED_PURGE) {
3732
- for (const feed of this.inner.dataPipeline.pipelineState?.feeds ?? []) {
3733
- const indexBeforeEpoch = epoch.timeframe.get(feed.key);
3734
- if (indexBeforeEpoch === void 0) {
3735
- continue;
3736
- }
3737
- await feed.safeClear(0, indexBeforeEpoch + 1);
3738
- }
3739
- }
3740
3688
  }
3741
3689
  async activate() {
3742
3690
  if (this._state !== import_services9.SpaceState.INACTIVE) {
@@ -3753,11 +3701,11 @@ var DataSpace = class {
3753
3701
  await this._metadataStore.setSpaceState(this.key, import_services9.SpaceState.INACTIVE);
3754
3702
  await this._close();
3755
3703
  this._state = import_services9.SpaceState.INACTIVE;
3756
- (0, import_log9.log)("new state", {
3704
+ (0, import_log8.log)("new state", {
3757
3705
  state: import_services9.SpaceState[this._state]
3758
3706
  }, {
3759
3707
  F: __dxlog_file12,
3760
- L: 514,
3708
+ L: 482,
3761
3709
  S: this,
3762
3710
  C: (f, a) => f(...a)
3763
3711
  });
@@ -3887,16 +3835,15 @@ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
3887
3835
  var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
3888
3836
  var PRESENCE_OFFLINE_TIMEOUT = 2e4;
3889
3837
  var DataSpaceManager = class {
3890
- constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore, _automergeHost, params) {
3838
+ constructor(_spaceManager, _metadataStore, _keyring, _signingContext, _feedStore, _automergeHost, params) {
3891
3839
  this._spaceManager = _spaceManager;
3892
3840
  this._metadataStore = _metadataStore;
3893
- this._dataServiceSubscriptions = _dataServiceSubscriptions;
3894
3841
  this._keyring = _keyring;
3895
3842
  this._signingContext = _signingContext;
3896
3843
  this._feedStore = _feedStore;
3897
3844
  this._automergeHost = _automergeHost;
3898
3845
  this._ctx = new import_context9.Context();
3899
- this.updated = new import_async12.Event();
3846
+ this.updated = new import_async13.Event();
3900
3847
  this._spaces = new import_util6.ComplexMap(import_keys9.PublicKey.hash);
3901
3848
  this._isOpen = false;
3902
3849
  this._instanceId = import_keys9.PublicKey.random().toHex();
@@ -3909,46 +3856,46 @@ var DataSpaceManager = class {
3909
3856
  return this._spaces;
3910
3857
  }
3911
3858
  async open() {
3912
- (0, import_log11.log)("open", void 0, {
3859
+ (0, import_log10.log)("open", void 0, {
3913
3860
  F: __dxlog_file13,
3914
- L: 105,
3861
+ L: 98,
3915
3862
  S: this,
3916
3863
  C: (f, a) => f(...a)
3917
3864
  });
3918
- import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols10.trace.begin({
3865
+ import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols10.trace.begin({
3919
3866
  id: this._instanceId
3920
3867
  }), {
3921
3868
  F: __dxlog_file13,
3922
- L: 106,
3869
+ L: 99,
3923
3870
  S: this,
3924
3871
  C: (f, a) => f(...a)
3925
3872
  });
3926
- (0, import_log11.log)("metadata loaded", {
3873
+ (0, import_log10.log)("metadata loaded", {
3927
3874
  spaces: this._metadataStore.spaces.length
3928
3875
  }, {
3929
3876
  F: __dxlog_file13,
3930
- L: 107,
3877
+ L: 100,
3931
3878
  S: this,
3932
3879
  C: (f, a) => f(...a)
3933
3880
  });
3934
3881
  await (0, import_util6.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
3935
3882
  try {
3936
- (0, import_log11.log)("load space", {
3883
+ (0, import_log10.log)("load space", {
3937
3884
  spaceMetadata
3938
3885
  }, {
3939
3886
  F: __dxlog_file13,
3940
- L: 111,
3887
+ L: 104,
3941
3888
  S: this,
3942
3889
  C: (f, a) => f(...a)
3943
3890
  });
3944
3891
  await this._constructSpace(spaceMetadata);
3945
3892
  } catch (err) {
3946
- import_log11.log.error("Error loading space", {
3893
+ import_log10.log.error("Error loading space", {
3947
3894
  spaceMetadata,
3948
3895
  err
3949
3896
  }, {
3950
3897
  F: __dxlog_file13,
3951
- L: 114,
3898
+ L: 107,
3952
3899
  S: this,
3953
3900
  C: (f, a) => f(...a)
3954
3901
  });
@@ -3961,19 +3908,19 @@ var DataSpaceManager = class {
3961
3908
  space.initializeDataPipelineAsync();
3962
3909
  }
3963
3910
  }
3964
- import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols10.trace.end({
3911
+ import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols10.trace.end({
3965
3912
  id: this._instanceId
3966
3913
  }), {
3967
3914
  F: __dxlog_file13,
3968
- L: 127,
3915
+ L: 120,
3969
3916
  S: this,
3970
3917
  C: (f, a) => f(...a)
3971
3918
  });
3972
3919
  }
3973
3920
  async close() {
3974
- (0, import_log11.log)("close", void 0, {
3921
+ (0, import_log10.log)("close", void 0, {
3975
3922
  F: __dxlog_file13,
3976
- L: 132,
3923
+ L: 125,
3977
3924
  S: this,
3978
3925
  C: (f, a) => f(...a)
3979
3926
  });
@@ -3989,7 +3936,7 @@ var DataSpaceManager = class {
3989
3936
  async createSpace() {
3990
3937
  (0, import_invariant12.invariant)(this._isOpen, "Not open.", {
3991
3938
  F: __dxlog_file13,
3992
- L: 145,
3939
+ L: 138,
3993
3940
  S: this,
3994
3941
  A: [
3995
3942
  "this._isOpen",
@@ -4006,11 +3953,11 @@ var DataSpaceManager = class {
4006
3953
  dataFeedKey,
4007
3954
  state: import_services10.SpaceState.ACTIVE
4008
3955
  };
4009
- (0, import_log11.log)("creating space...", {
3956
+ (0, import_log10.log)("creating space...", {
4010
3957
  spaceKey
4011
3958
  }, {
4012
3959
  F: __dxlog_file13,
4013
- L: 157,
3960
+ L: 150,
4014
3961
  S: this,
4015
3962
  C: (f, a) => f(...a)
4016
3963
  });
@@ -4026,7 +3973,7 @@ var DataSpaceManager = class {
4026
3973
  const memberCredential = credentials[1];
4027
3974
  (0, import_invariant12.invariant)((0, import_credentials12.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
4028
3975
  F: __dxlog_file13,
4029
- L: 170,
3976
+ L: 163,
4030
3977
  S: this,
4031
3978
  A: [
4032
3979
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -4040,17 +3987,17 @@ var DataSpaceManager = class {
4040
3987
  }
4041
3988
  // TODO(burdon): Rename join space.
4042
3989
  async acceptSpace(opts) {
4043
- (0, import_log11.log)("accept space", {
3990
+ (0, import_log10.log)("accept space", {
4044
3991
  opts
4045
3992
  }, {
4046
3993
  F: __dxlog_file13,
4047
- L: 182,
3994
+ L: 175,
4048
3995
  S: this,
4049
3996
  C: (f, a) => f(...a)
4050
3997
  });
4051
3998
  (0, import_invariant12.invariant)(this._isOpen, "Not open.", {
4052
3999
  F: __dxlog_file13,
4053
- L: 183,
4000
+ L: 176,
4054
4001
  S: this,
4055
4002
  A: [
4056
4003
  "this._isOpen",
@@ -4059,7 +4006,7 @@ var DataSpaceManager = class {
4059
4006
  });
4060
4007
  (0, import_invariant12.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
4061
4008
  F: __dxlog_file13,
4062
- L: 184,
4009
+ L: 177,
4063
4010
  S: this,
4064
4011
  A: [
4065
4012
  "!this._spaces.has(opts.spaceKey)",
@@ -4090,11 +4037,11 @@ var DataSpaceManager = class {
4090
4037
  }));
4091
4038
  }
4092
4039
  async _constructSpace(metadata) {
4093
- (0, import_log11.log)("construct space", {
4040
+ (0, import_log10.log)("construct space", {
4094
4041
  metadata
4095
4042
  }, {
4096
4043
  F: __dxlog_file13,
4097
- L: 217,
4044
+ L: 210,
4098
4045
  S: this,
4099
4046
  C: (f, a) => f(...a)
4100
4047
  });
@@ -4130,9 +4077,9 @@ var DataSpaceManager = class {
4130
4077
  session.addExtension("dxos.mesh.teleport.automerge", this._automergeHost.createExtension());
4131
4078
  },
4132
4079
  onAuthFailure: () => {
4133
- import_log11.log.warn("auth failure", void 0, {
4080
+ import_log10.log.warn("auth failure", void 0, {
4134
4081
  F: __dxlog_file13,
4135
- L: 254,
4082
+ L: 247,
4136
4083
  S: this,
4137
4084
  C: (f, a) => f(...a)
4138
4085
  });
@@ -4152,23 +4099,22 @@ var DataSpaceManager = class {
4152
4099
  signingContext: this._signingContext,
4153
4100
  callbacks: {
4154
4101
  beforeReady: async () => {
4155
- (0, import_log11.log)("before space ready", {
4102
+ (0, import_log10.log)("before space ready", {
4156
4103
  space: space.key
4157
4104
  }, {
4158
4105
  F: __dxlog_file13,
4159
- L: 272,
4106
+ L: 265,
4160
4107
  S: this,
4161
4108
  C: (f, a) => f(...a)
4162
4109
  });
4163
- await this._dataServiceSubscriptions.registerSpace(space.key, dataSpace.dataPipeline.databaseHost.createDataServiceHost());
4164
4110
  },
4165
4111
  afterReady: async () => {
4166
- (0, import_log11.log)("after space ready", {
4112
+ (0, import_log10.log)("after space ready", {
4167
4113
  space: space.key,
4168
4114
  open: this._isOpen
4169
4115
  }, {
4170
4116
  F: __dxlog_file13,
4171
- L: 279,
4117
+ L: 268,
4172
4118
  S: this,
4173
4119
  C: (f, a) => f(...a)
4174
4120
  });
@@ -4177,15 +4123,14 @@ var DataSpaceManager = class {
4177
4123
  }
4178
4124
  },
4179
4125
  beforeClose: async () => {
4180
- (0, import_log11.log)("before space close", {
4126
+ (0, import_log10.log)("before space close", {
4181
4127
  space: space.key
4182
4128
  }, {
4183
4129
  F: __dxlog_file13,
4184
- L: 285,
4130
+ L: 274,
4185
4131
  S: this,
4186
4132
  C: (f, a) => f(...a)
4187
4133
  });
4188
- await this._dataServiceSubscriptions.unregisterSpace(space.key);
4189
4134
  }
4190
4135
  },
4191
4136
  cache: metadata.cache,
@@ -4197,34 +4142,30 @@ var DataSpaceManager = class {
4197
4142
  if (metadata.controlTimeframe) {
4198
4143
  dataSpace.inner.controlPipeline.state.setTargetTimeframe(metadata.controlTimeframe);
4199
4144
  }
4200
- if (metadata.dataTimeframe) {
4201
- dataSpace.dataPipeline.setTargetTimeframe(metadata.dataTimeframe);
4202
- }
4203
4145
  this._spaces.set(metadata.key, dataSpace);
4204
4146
  return dataSpace;
4205
4147
  }
4206
4148
  };
4207
4149
  _ts_decorate5([
4208
- import_async12.synchronized
4150
+ import_async13.synchronized
4209
4151
  ], DataSpaceManager.prototype, "open", null);
4210
4152
  _ts_decorate5([
4211
- import_async12.synchronized
4153
+ import_async13.synchronized
4212
4154
  ], DataSpaceManager.prototype, "close", null);
4213
4155
  _ts_decorate5([
4214
- import_async12.synchronized
4156
+ import_async13.synchronized
4215
4157
  ], DataSpaceManager.prototype, "createSpace", null);
4216
4158
  _ts_decorate5([
4217
- import_async12.synchronized
4159
+ import_async13.synchronized
4218
4160
  ], DataSpaceManager.prototype, "acceptSpace", null);
4219
4161
  DataSpaceManager = _ts_decorate5([
4220
- (0, import_async12.trackLeaks)("open", "close")
4162
+ (0, import_async13.trackLeaks)("open", "close")
4221
4163
  ], DataSpaceManager);
4222
4164
  var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
4223
4165
  var SpacesServiceImpl = class {
4224
- constructor(_identityManager, _spaceManager, _dataServiceSubscriptions, _getDataSpaceManager) {
4166
+ constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
4225
4167
  this._identityManager = _identityManager;
4226
4168
  this._spaceManager = _spaceManager;
4227
- this._dataServiceSubscriptions = _dataServiceSubscriptions;
4228
4169
  this._getDataSpaceManager = _getDataSpaceManager;
4229
4170
  }
4230
4171
  async createSpace() {
@@ -4253,14 +4194,14 @@ var SpacesServiceImpl = class {
4253
4194
  }
4254
4195
  querySpaces() {
4255
4196
  return new import_codec_protobuf11.Stream(({ next, ctx }) => {
4256
- const scheduler = new import_async13.UpdateScheduler(ctx, async () => {
4197
+ const scheduler = new import_async14.UpdateScheduler(ctx, async () => {
4257
4198
  const dataSpaceManager = await this._getDataSpaceManager();
4258
4199
  const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
4259
- (0, import_log12.log)("update", {
4200
+ (0, import_log11.log)("update", {
4260
4201
  spaces
4261
4202
  }, {
4262
4203
  F: __dxlog_file14,
4263
- L: 78,
4204
+ L: 77,
4264
4205
  S: this,
4265
4206
  C: (f, a) => f(...a)
4266
4207
  });
@@ -4270,20 +4211,17 @@ var SpacesServiceImpl = class {
4270
4211
  }, {
4271
4212
  maxFrequency: process.env.NODE_ENV === "test" ? void 0 : 2
4272
4213
  });
4273
- (0, import_async13.scheduleTask)(ctx, async () => {
4214
+ (0, import_async14.scheduleTask)(ctx, async () => {
4274
4215
  const dataSpaceManager = await this._getDataSpaceManager();
4275
- const subscriptions = new import_async13.EventSubscriptions();
4216
+ const subscriptions = new import_async14.EventSubscriptions();
4276
4217
  ctx.onDispose(() => subscriptions.clear());
4277
4218
  const subscribeSpaces = () => {
4278
4219
  subscriptions.clear();
4279
4220
  for (const space of dataSpaceManager.spaces.values()) {
4280
4221
  subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.forceTrigger()));
4281
4222
  subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
4282
- subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, () => scheduler.trigger()));
4223
+ subscriptions.add(space.automergeSpaceState.onNewEpoch.on(ctx, () => scheduler.trigger()));
4283
4224
  subscriptions.add(space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger()));
4284
- if (space.dataPipeline.pipelineState) {
4285
- subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.on(ctx, () => scheduler.trigger()));
4286
- }
4287
4225
  }
4288
4226
  };
4289
4227
  dataSpaceManager.updated.on(ctx, () => {
@@ -4307,7 +4245,7 @@ var SpacesServiceImpl = class {
4307
4245
  }
4308
4246
  subscribeMessages({ spaceKey, channel }) {
4309
4247
  return new import_codec_protobuf11.Stream(({ ctx, next }) => {
4310
- (0, import_async13.scheduleTask)(ctx, async () => {
4248
+ (0, import_async14.scheduleTask)(ctx, async () => {
4311
4249
  const dataSpaceManager = await this._getDataSpaceManager();
4312
4250
  const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
4313
4251
  const handle = space.listen(getChannelId(channel), (message) => {
@@ -4326,7 +4264,7 @@ var SpacesServiceImpl = class {
4326
4264
  }
4327
4265
  };
4328
4266
  ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
4329
- (0, import_async13.scheduleTask)(ctx, async () => {
4267
+ (0, import_async14.scheduleTask)(ctx, async () => {
4330
4268
  await space.spaceState.addCredentialProcessor(processor);
4331
4269
  if (noTail) {
4332
4270
  close();
@@ -4346,7 +4284,7 @@ var SpacesServiceImpl = class {
4346
4284
  } else {
4347
4285
  (0, import_invariant13.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
4348
4286
  F: __dxlog_file14,
4349
- L: 168,
4287
+ L: 164,
4350
4288
  S: this,
4351
4289
  A: [
4352
4290
  "!credential.id",
@@ -4355,7 +4293,7 @@ var SpacesServiceImpl = class {
4355
4293
  });
4356
4294
  (0, import_invariant13.invariant)(this._identityManager.identity, "Identity is not available", {
4357
4295
  F: __dxlog_file14,
4358
- L: 169,
4296
+ L: 165,
4359
4297
  S: this,
4360
4298
  A: [
4361
4299
  "this._identityManager.identity",
@@ -4365,7 +4303,7 @@ var SpacesServiceImpl = class {
4365
4303
  const signer = this._identityManager.identity.getIdentityCredentialSigner();
4366
4304
  (0, import_invariant13.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
4367
4305
  F: __dxlog_file14,
4368
- L: 171,
4306
+ L: 167,
4369
4307
  S: this,
4370
4308
  A: [
4371
4309
  "credential.issuer.equals(signer.getIssuer())",
@@ -4397,17 +4335,17 @@ var SpacesServiceImpl = class {
4397
4335
  state: space.state,
4398
4336
  error: space.error ? (0, import_protocols11.encodeError)(space.error) : void 0,
4399
4337
  pipeline: {
4400
- currentEpoch: space.dataPipeline.currentEpoch,
4401
- appliedEpoch: space.dataPipeline.appliedEpoch,
4338
+ currentEpoch: space.automergeSpaceState.lastEpoch,
4339
+ appliedEpoch: space.automergeSpaceState.lastEpoch,
4402
4340
  controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
4403
4341
  currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
4404
4342
  targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
4405
4343
  totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe,
4406
- dataFeeds: space.dataPipeline.pipelineState?.feeds.map((feed) => feed.key) ?? [],
4407
- startDataTimeframe: space.dataPipeline.pipelineState?.startTimeframe,
4408
- currentDataTimeframe: space.dataPipeline.pipelineState?.timeframe,
4409
- targetDataTimeframe: space.dataPipeline.pipelineState?.targetTimeframe,
4410
- totalDataTimeframe: space.dataPipeline.pipelineState?.endTimeframe
4344
+ dataFeeds: void 0,
4345
+ startDataTimeframe: void 0,
4346
+ currentDataTimeframe: void 0,
4347
+ targetDataTimeframe: void 0,
4348
+ totalDataTimeframe: void 0
4411
4349
  },
4412
4350
  members: Array.from(space.inner.spaceState.members.values()).map((member) => {
4413
4351
  const peers = space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key));
@@ -4443,12 +4381,12 @@ var createLoadDocuments = (automergeHost) => (
4443
4381
  const handle = automergeHost.repo.find(documentId);
4444
4382
  await (0, import_debug7.warnAfterTimeout)(5e3, "to long to load doc", () => handle.whenReady());
4445
4383
  const doc = handle.docSync();
4446
- const heads = (0, import_automerge.getHeads)(doc);
4384
+ const hash = (0, import_automerge.getHeads)(doc).join("");
4447
4385
  yield [
4448
4386
  {
4449
4387
  id,
4450
4388
  object: doc.objects[objectId],
4451
- currentHash: heads.at(-1)
4389
+ currentHash: hash
4452
4390
  }
4453
4391
  ];
4454
4392
  }
@@ -4517,14 +4455,12 @@ function _ts_decorate6(decorators, target, key, desc) {
4517
4455
  }
4518
4456
  var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
4519
4457
  var ServiceContext = class {
4520
- constructor(storage, networkManager, signalManager, modelFactory, _runtimeParams) {
4458
+ constructor(storage, networkManager, signalManager, _runtimeParams) {
4521
4459
  this.storage = storage;
4522
4460
  this.networkManager = networkManager;
4523
4461
  this.signalManager = signalManager;
4524
- this.modelFactory = modelFactory;
4525
4462
  this._runtimeParams = _runtimeParams;
4526
- this.initialized = new import_async14.Trigger();
4527
- this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
4463
+ this.initialized = new import_async15.Trigger();
4528
4464
  this._handlerFactories = /* @__PURE__ */ new Map();
4529
4465
  this._instanceId = import_keys10.PublicKey.random().toHex();
4530
4466
  this.metadataStore = new import_echo_pipeline2.MetadataStore(storage.createDirectory("metadata"));
@@ -4546,7 +4482,6 @@ var ServiceContext = class {
4546
4482
  networkManager: this.networkManager,
4547
4483
  blobStore: this.blobStore,
4548
4484
  metadataStore: this.metadataStore,
4549
- modelFactory: this.modelFactory,
4550
4485
  snapshotStore: this.snapshotStore
4551
4486
  });
4552
4487
  this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
@@ -4570,17 +4505,17 @@ var ServiceContext = class {
4570
4505
  }
4571
4506
  async open(ctx) {
4572
4507
  await this._checkStorageVersion();
4573
- (0, import_log13.log)("opening...", void 0, {
4508
+ (0, import_log12.log)("opening...", void 0, {
4574
4509
  F: __dxlog_file15,
4575
- L: 162,
4510
+ L: 151,
4576
4511
  S: this,
4577
4512
  C: (f, a) => f(...a)
4578
4513
  });
4579
- import_log13.log.trace("dxos.sdk.service-context.open", import_protocols12.trace.begin({
4514
+ import_log12.log.trace("dxos.sdk.service-context.open", import_protocols12.trace.begin({
4580
4515
  id: this._instanceId
4581
4516
  }), {
4582
4517
  F: __dxlog_file15,
4583
- L: 163,
4518
+ L: 152,
4584
4519
  S: this,
4585
4520
  C: (f, a) => f(...a)
4586
4521
  });
@@ -4592,25 +4527,25 @@ var ServiceContext = class {
4592
4527
  if (this.identityManager.identity) {
4593
4528
  await this._initialize(ctx);
4594
4529
  }
4595
- import_log13.log.trace("dxos.sdk.service-context.open", import_protocols12.trace.end({
4530
+ import_log12.log.trace("dxos.sdk.service-context.open", import_protocols12.trace.end({
4596
4531
  id: this._instanceId
4597
4532
  }), {
4598
4533
  F: __dxlog_file15,
4599
- L: 173,
4534
+ L: 162,
4600
4535
  S: this,
4601
4536
  C: (f, a) => f(...a)
4602
4537
  });
4603
- (0, import_log13.log)("opened", void 0, {
4538
+ (0, import_log12.log)("opened", void 0, {
4604
4539
  F: __dxlog_file15,
4605
- L: 174,
4540
+ L: 163,
4606
4541
  S: this,
4607
4542
  C: (f, a) => f(...a)
4608
4543
  });
4609
4544
  }
4610
4545
  async close() {
4611
- (0, import_log13.log)("closing...", void 0, {
4546
+ (0, import_log12.log)("closing...", void 0, {
4612
4547
  F: __dxlog_file15,
4613
- L: 178,
4548
+ L: 167,
4614
4549
  S: this,
4615
4550
  C: (f, a) => f(...a)
4616
4551
  });
@@ -4624,12 +4559,11 @@ var ServiceContext = class {
4624
4559
  await this.feedStore.close();
4625
4560
  await this.networkManager.close();
4626
4561
  await this.signalManager.close();
4627
- this.dataServiceSubscriptions.clear();
4628
4562
  await this.metadataStore.close();
4629
4563
  await this.indexer.destroy();
4630
- (0, import_log13.log)("closed", void 0, {
4564
+ (0, import_log12.log)("closed", void 0, {
4631
4565
  F: __dxlog_file15,
4632
- L: 192,
4566
+ L: 180,
4633
4567
  S: this,
4634
4568
  C: (f, a) => f(...a)
4635
4569
  });
@@ -4643,7 +4577,7 @@ var ServiceContext = class {
4643
4577
  const factory = this._handlerFactories.get(invitation.kind);
4644
4578
  (0, import_invariant14.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
4645
4579
  F: __dxlog_file15,
4646
- L: 203,
4580
+ L: 191,
4647
4581
  S: this,
4648
4582
  A: [
4649
4583
  "factory",
@@ -4673,9 +4607,9 @@ var ServiceContext = class {
4673
4607
  }
4674
4608
  // Called when identity is created.
4675
4609
  async _initialize(ctx) {
4676
- (0, import_log13.log)("initializing spaces...", void 0, {
4610
+ (0, import_log12.log)("initializing spaces...", void 0, {
4677
4611
  F: __dxlog_file15,
4678
- L: 234,
4612
+ L: 222,
4679
4613
  S: this,
4680
4614
  C: (f, a) => f(...a)
4681
4615
  });
@@ -4693,12 +4627,12 @@ var ServiceContext = class {
4693
4627
  });
4694
4628
  }
4695
4629
  };
4696
- this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost, this._runtimeParams);
4630
+ this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.keyring, signingContext, this.feedStore, this.automergeHost, this._runtimeParams);
4697
4631
  await this.dataSpaceManager.open();
4698
4632
  this._handlerFactories.set(import_services12.Invitation.Kind.SPACE, (invitation) => {
4699
4633
  (0, import_invariant14.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4700
4634
  F: __dxlog_file15,
4701
- L: 259,
4635
+ L: 246,
4702
4636
  S: this,
4703
4637
  A: [
4704
4638
  "this.dataSpaceManager",
@@ -4718,33 +4652,33 @@ var ServiceContext = class {
4718
4652
  return;
4719
4653
  }
4720
4654
  if (!this.dataSpaceManager) {
4721
- (0, import_log13.log)("dataSpaceManager not initialized yet, ignoring space admission", {
4655
+ (0, import_log12.log)("dataSpaceManager not initialized yet, ignoring space admission", {
4722
4656
  details: assertion
4723
4657
  }, {
4724
4658
  F: __dxlog_file15,
4725
- L: 275,
4659
+ L: 262,
4726
4660
  S: this,
4727
4661
  C: (f, a) => f(...a)
4728
4662
  });
4729
4663
  return;
4730
4664
  }
4731
4665
  if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
4732
- (0, import_log13.log)("space already exists, ignoring space admission", {
4666
+ (0, import_log12.log)("space already exists, ignoring space admission", {
4733
4667
  details: assertion
4734
4668
  }, {
4735
4669
  F: __dxlog_file15,
4736
- L: 279,
4670
+ L: 266,
4737
4671
  S: this,
4738
4672
  C: (f, a) => f(...a)
4739
4673
  });
4740
4674
  return;
4741
4675
  }
4742
4676
  try {
4743
- (0, import_log13.log)("accepting space recorded in halo", {
4677
+ (0, import_log12.log)("accepting space recorded in halo", {
4744
4678
  details: assertion
4745
4679
  }, {
4746
4680
  F: __dxlog_file15,
4747
- L: 284,
4681
+ L: 271,
4748
4682
  S: this,
4749
4683
  C: (f, a) => f(...a)
4750
4684
  });
@@ -4753,9 +4687,9 @@ var ServiceContext = class {
4753
4687
  genesisFeedKey: assertion.genesisFeedKey
4754
4688
  });
4755
4689
  } catch (err) {
4756
- import_log13.log.catch(err, void 0, {
4690
+ import_log12.log.catch(err, void 0, {
4757
4691
  F: __dxlog_file15,
4758
- L: 290,
4692
+ L: 277,
4759
4693
  S: this,
4760
4694
  C: (f, a) => f(...a)
4761
4695
  });
@@ -4818,7 +4752,7 @@ var Lock = class {
4818
4752
  return this._lockPath;
4819
4753
  }
4820
4754
  async acquire() {
4821
- (0, import_log14.log)("acquiring lock...", void 0, {
4755
+ (0, import_log13.log)("acquiring lock...", void 0, {
4822
4756
  F: __dxlog_file16,
4823
4757
  L: 32,
4824
4758
  S: this,
@@ -4826,7 +4760,7 @@ var Lock = class {
4826
4760
  });
4827
4761
  this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
4828
4762
  await this._onAcquire?.();
4829
- (0, import_log14.log)("acquired lock", void 0, {
4763
+ (0, import_log13.log)("acquired lock", void 0, {
4830
4764
  F: __dxlog_file16,
4831
4765
  L: 37,
4832
4766
  S: this,
@@ -4848,7 +4782,7 @@ var Lock = class {
4848
4782
  }
4849
4783
  };
4850
4784
  _ts_decorate7([
4851
- import_log14.logInfo
4785
+ import_log13.logInfo
4852
4786
  ], Lock.prototype, "lockKey", null);
4853
4787
  var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
4854
4788
  var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
@@ -4952,7 +4886,7 @@ var DevicesServiceImpl = class {
4952
4886
  presenceSubscribed = true;
4953
4887
  }
4954
4888
  };
4955
- const subscriptions = new import_async16.EventSubscriptions();
4889
+ const subscriptions = new import_async17.EventSubscriptions();
4956
4890
  if (this._identityManager.identity) {
4957
4891
  subscribeIdentity();
4958
4892
  subscribePresence();
@@ -4971,7 +4905,7 @@ var DevicesServiceImpl = class {
4971
4905
  };
4972
4906
  var LoggingServiceImpl = class {
4973
4907
  constructor() {
4974
- this._logs = new import_async17.Event();
4908
+ this._logs = new import_async18.Event();
4975
4909
  this._started = Date.now();
4976
4910
  this._sessionId = import_keys12.PublicKey.random().toHex();
4977
4911
  this._logProcessor = (_config, entry2) => {
@@ -4979,11 +4913,11 @@ var LoggingServiceImpl = class {
4979
4913
  };
4980
4914
  }
4981
4915
  async open() {
4982
- import_log16.log.runtimeConfig.processors.push(this._logProcessor);
4916
+ import_log15.log.runtimeConfig.processors.push(this._logProcessor);
4983
4917
  }
4984
4918
  async close() {
4985
- const index = import_log16.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
4986
- import_log16.log.runtimeConfig.processors.splice(index, 1);
4919
+ const index = import_log15.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
4920
+ import_log15.log.runtimeConfig.processors.splice(index, 1);
4987
4921
  }
4988
4922
  async controlMetrics({ reset, record }) {
4989
4923
  if (reset) {
@@ -5044,7 +4978,7 @@ var LoggingServiceImpl = class {
5044
4978
  }
5045
4979
  const record = {
5046
4980
  ...entry2,
5047
- context: (0, import_util10.jsonify)((0, import_log16.getContextFromEntry)(entry2)),
4981
+ context: (0, import_util10.jsonify)((0, import_log15.getContextFromEntry)(entry2)),
5048
4982
  timestamp: /* @__PURE__ */ new Date(),
5049
4983
  meta: {
5050
4984
  // TODO(dmaretskyi): Fix proto.
@@ -5178,13 +5112,9 @@ function _ts_decorate8(decorators, target, key, desc) {
5178
5112
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5179
5113
  }
5180
5114
  var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
5181
- var createDefaultModelFactory = () => {
5182
- return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
5183
- };
5184
5115
  var ClientServicesHost = class {
5185
5116
  constructor({
5186
5117
  config,
5187
- modelFactory = createDefaultModelFactory(),
5188
5118
  transportFactory,
5189
5119
  signalManager,
5190
5120
  storage,
@@ -5194,11 +5124,10 @@ var ClientServicesHost = class {
5194
5124
  runtimeParams
5195
5125
  } = {}) {
5196
5126
  this._tracingService = import_tracing7.TRACE_PROCESSOR.createTraceSender();
5197
- this._statusUpdate = new import_async15.Event();
5127
+ this._statusUpdate = new import_async16.Event();
5198
5128
  this._opening = false;
5199
5129
  this._open = false;
5200
5130
  this._storage = storage;
5201
- this._modelFactory = modelFactory;
5202
5131
  this._callbacks = callbacks;
5203
5132
  this._runtimeParams = runtimeParams;
5204
5133
  if (config) {
@@ -5269,23 +5198,23 @@ var ClientServicesHost = class {
5269
5198
  initialize({ config, ...options }) {
5270
5199
  (0, import_invariant16.invariant)(!this._open, "service host is open", {
5271
5200
  F: __dxlog_file18,
5272
- L: 191,
5201
+ L: 179,
5273
5202
  S: this,
5274
5203
  A: [
5275
5204
  "!this._open",
5276
5205
  "'service host is open'"
5277
5206
  ]
5278
5207
  });
5279
- (0, import_log15.log)("initializing...", void 0, {
5208
+ (0, import_log14.log)("initializing...", void 0, {
5280
5209
  F: __dxlog_file18,
5281
- L: 192,
5210
+ L: 180,
5282
5211
  S: this,
5283
5212
  C: (f, a) => f(...a)
5284
5213
  });
5285
5214
  if (config) {
5286
5215
  (0, import_invariant16.invariant)(!this._config, "config already set", {
5287
5216
  F: __dxlog_file18,
5288
- L: 195,
5217
+ L: 183,
5289
5218
  S: this,
5290
5219
  A: [
5291
5220
  "!this._config",
@@ -5303,7 +5232,7 @@ var ClientServicesHost = class {
5303
5232
  this._signalManager = signalManager;
5304
5233
  (0, import_invariant16.invariant)(!this._networkManager, "network manager already set", {
5305
5234
  F: __dxlog_file18,
5306
- L: 211,
5235
+ L: 199,
5307
5236
  S: this,
5308
5237
  A: [
5309
5238
  "!this._networkManager",
@@ -5315,9 +5244,9 @@ var ClientServicesHost = class {
5315
5244
  transportFactory,
5316
5245
  signalManager
5317
5246
  });
5318
- (0, import_log15.log)("initialized", void 0, {
5247
+ (0, import_log14.log)("initialized", void 0, {
5319
5248
  F: __dxlog_file18,
5320
- L: 218,
5249
+ L: 206,
5321
5250
  S: this,
5322
5251
  C: (f, a) => f(...a)
5323
5252
  });
@@ -5327,17 +5256,17 @@ var ClientServicesHost = class {
5327
5256
  return;
5328
5257
  }
5329
5258
  const traceId = import_keys11.PublicKey.random().toHex();
5330
- import_log15.log.trace("dxos.client-services.host.open", import_protocols15.trace.begin({
5259
+ import_log14.log.trace("dxos.client-services.host.open", import_protocols15.trace.begin({
5331
5260
  id: traceId
5332
5261
  }), {
5333
5262
  F: __dxlog_file18,
5334
- L: 229,
5263
+ L: 217,
5335
5264
  S: this,
5336
5265
  C: (f, a) => f(...a)
5337
5266
  });
5338
5267
  (0, import_invariant16.invariant)(this._config, "config not set", {
5339
5268
  F: __dxlog_file18,
5340
- L: 231,
5269
+ L: 219,
5341
5270
  S: this,
5342
5271
  A: [
5343
5272
  "this._config",
@@ -5346,7 +5275,7 @@ var ClientServicesHost = class {
5346
5275
  });
5347
5276
  (0, import_invariant16.invariant)(this._storage, "storage not set", {
5348
5277
  F: __dxlog_file18,
5349
- L: 232,
5278
+ L: 220,
5350
5279
  S: this,
5351
5280
  A: [
5352
5281
  "this._storage",
@@ -5355,7 +5284,7 @@ var ClientServicesHost = class {
5355
5284
  });
5356
5285
  (0, import_invariant16.invariant)(this._signalManager, "signal manager not set", {
5357
5286
  F: __dxlog_file18,
5358
- L: 233,
5287
+ L: 221,
5359
5288
  S: this,
5360
5289
  A: [
5361
5290
  "this._signalManager",
@@ -5364,7 +5293,7 @@ var ClientServicesHost = class {
5364
5293
  });
5365
5294
  (0, import_invariant16.invariant)(this._networkManager, "network manager not set", {
5366
5295
  F: __dxlog_file18,
5367
- L: 234,
5296
+ L: 222,
5368
5297
  S: this,
5369
5298
  A: [
5370
5299
  "this._networkManager",
@@ -5372,27 +5301,27 @@ var ClientServicesHost = class {
5372
5301
  ]
5373
5302
  });
5374
5303
  this._opening = true;
5375
- (0, import_log15.log)("opening...", {
5304
+ (0, import_log14.log)("opening...", {
5376
5305
  lockKey: this._resourceLock?.lockKey
5377
5306
  }, {
5378
5307
  F: __dxlog_file18,
5379
- L: 237,
5308
+ L: 225,
5380
5309
  S: this,
5381
5310
  C: (f, a) => f(...a)
5382
5311
  });
5383
5312
  await this._resourceLock?.acquire();
5384
5313
  await this._loggingService.open();
5385
- this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory, this._runtimeParams);
5314
+ this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._runtimeParams);
5386
5315
  this._serviceRegistry.setServices({
5387
5316
  SystemService: this._systemService,
5388
5317
  IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
5389
5318
  InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation), this._serviceContext.metadataStore),
5390
5319
  DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
5391
- SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
5320
+ SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, async () => {
5392
5321
  await this._serviceContext.initialized.wait();
5393
5322
  return this._serviceContext.dataSpaceManager;
5394
5323
  }),
5395
- DataService: new import_echo_pipeline3.DataServiceImpl(this._serviceContext.dataServiceSubscriptions, this._serviceContext.automergeHost),
5324
+ DataService: new import_echo_pipeline3.DataServiceImpl(this._serviceContext.automergeHost),
5396
5325
  IndexService: new import_indexing2.IndexServiceImpl({
5397
5326
  indexer: this._serviceContext.indexer,
5398
5327
  automergeHost: this._serviceContext.automergeHost
@@ -5410,7 +5339,7 @@ var ClientServicesHost = class {
5410
5339
  await this._serviceContext.open(ctx);
5411
5340
  (0, import_invariant16.invariant)(this.serviceRegistry.services.InvitationsService, void 0, {
5412
5341
  F: __dxlog_file18,
5413
- L: 303,
5342
+ L: 286,
5414
5343
  S: this,
5415
5344
  A: [
5416
5345
  "this.serviceRegistry.services.InvitationsService",
@@ -5418,11 +5347,11 @@ var ClientServicesHost = class {
5418
5347
  ]
5419
5348
  });
5420
5349
  const loadedInvitations = await this.serviceRegistry.services.InvitationsService.loadPersistentInvitations();
5421
- (0, import_log15.log)("loaded persistent invitations", {
5350
+ (0, import_log14.log)("loaded persistent invitations", {
5422
5351
  count: loadedInvitations.invitations?.length
5423
5352
  }, {
5424
5353
  F: __dxlog_file18,
5425
- L: 306,
5354
+ L: 289,
5426
5355
  S: this,
5427
5356
  C: (f, a) => f(...a)
5428
5357
  });
@@ -5440,19 +5369,19 @@ var ClientServicesHost = class {
5440
5369
  this._open = true;
5441
5370
  this._statusUpdate.emit();
5442
5371
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
5443
- (0, import_log15.log)("opened", {
5372
+ (0, import_log14.log)("opened", {
5444
5373
  deviceKey
5445
5374
  }, {
5446
5375
  F: __dxlog_file18,
5447
- L: 323,
5376
+ L: 306,
5448
5377
  S: this,
5449
5378
  C: (f, a) => f(...a)
5450
5379
  });
5451
- import_log15.log.trace("dxos.client-services.host.open", import_protocols15.trace.end({
5380
+ import_log14.log.trace("dxos.client-services.host.open", import_protocols15.trace.end({
5452
5381
  id: traceId
5453
5382
  }), {
5454
5383
  F: __dxlog_file18,
5455
- L: 324,
5384
+ L: 307,
5456
5385
  S: this,
5457
5386
  C: (f, a) => f(...a)
5458
5387
  });
@@ -5462,11 +5391,11 @@ var ClientServicesHost = class {
5462
5391
  return;
5463
5392
  }
5464
5393
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
5465
- (0, import_log15.log)("closing...", {
5394
+ (0, import_log14.log)("closing...", {
5466
5395
  deviceKey
5467
5396
  }, {
5468
5397
  F: __dxlog_file18,
5469
- L: 335,
5398
+ L: 318,
5470
5399
  S: this,
5471
5400
  C: (f, a) => f(...a)
5472
5401
  });
@@ -5478,44 +5407,44 @@ var ClientServicesHost = class {
5478
5407
  await this._serviceContext.close();
5479
5408
  this._open = false;
5480
5409
  this._statusUpdate.emit();
5481
- (0, import_log15.log)("closed", {
5410
+ (0, import_log14.log)("closed", {
5482
5411
  deviceKey
5483
5412
  }, {
5484
5413
  F: __dxlog_file18,
5485
- L: 342,
5414
+ L: 325,
5486
5415
  S: this,
5487
5416
  C: (f, a) => f(...a)
5488
5417
  });
5489
5418
  }
5490
5419
  async reset() {
5491
5420
  const traceId = import_keys11.PublicKey.random().toHex();
5492
- import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.begin({
5421
+ import_log14.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.begin({
5493
5422
  id: traceId
5494
5423
  }), {
5495
5424
  F: __dxlog_file18,
5496
- L: 347,
5425
+ L: 330,
5497
5426
  S: this,
5498
5427
  C: (f, a) => f(...a)
5499
5428
  });
5500
- (0, import_log15.log)("resetting...", void 0, {
5429
+ (0, import_log14.log)("resetting...", void 0, {
5501
5430
  F: __dxlog_file18,
5502
- L: 349,
5431
+ L: 332,
5503
5432
  S: this,
5504
5433
  C: (f, a) => f(...a)
5505
5434
  });
5506
5435
  await this._serviceContext?.close();
5507
5436
  await this._storage.reset();
5508
- (0, import_log15.log)("reset", void 0, {
5437
+ (0, import_log14.log)("reset", void 0, {
5509
5438
  F: __dxlog_file18,
5510
- L: 352,
5439
+ L: 335,
5511
5440
  S: this,
5512
5441
  C: (f, a) => f(...a)
5513
5442
  });
5514
- import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.end({
5443
+ import_log14.log.trace("dxos.sdk.client-services-host.reset", import_protocols15.trace.end({
5515
5444
  id: traceId
5516
5445
  }), {
5517
5446
  F: __dxlog_file18,
5518
- L: 353,
5447
+ L: 336,
5519
5448
  S: this,
5520
5449
  C: (f, a) => f(...a)
5521
5450
  });
@@ -5530,7 +5459,7 @@ var ClientServicesHost = class {
5530
5459
  const automergeIndex = space.automergeSpaceState.rootUrl;
5531
5460
  (0, import_invariant16.invariant)(automergeIndex, void 0, {
5532
5461
  F: __dxlog_file18,
5533
- L: 368,
5462
+ L: 351,
5534
5463
  S: this,
5535
5464
  A: [
5536
5465
  "automergeIndex",
@@ -5555,11 +5484,11 @@ _ts_decorate8([
5555
5484
  import_tracing7.trace.info()
5556
5485
  ], ClientServicesHost.prototype, "_open", void 0);
5557
5486
  _ts_decorate8([
5558
- import_async15.synchronized,
5487
+ import_async16.synchronized,
5559
5488
  import_tracing7.trace.span()
5560
5489
  ], ClientServicesHost.prototype, "open", null);
5561
5490
  _ts_decorate8([
5562
- import_async15.synchronized,
5491
+ import_async16.synchronized,
5563
5492
  import_tracing7.trace.span()
5564
5493
  ], ClientServicesHost.prototype, "close", null);
5565
5494
  ClientServicesHost = _ts_decorate8([
@@ -5586,7 +5515,6 @@ ClientServicesHost = _ts_decorate8([
5586
5515
  SpacesServiceImpl,
5587
5516
  TrustedKeySetAuthVerifier,
5588
5517
  createAuthProvider,
5589
- createDefaultModelFactory,
5590
5518
  createDiagnostics,
5591
5519
  createStorageObjects,
5592
5520
  getNetworkPeers,
@@ -5600,4 +5528,4 @@ ClientServicesHost = _ts_decorate8([
5600
5528
  subscribeToSpaces,
5601
5529
  subscribeToSwarmInfo
5602
5530
  });
5603
- //# sourceMappingURL=chunk-K2PCGWBW.cjs.map
5531
+ //# sourceMappingURL=chunk-VWAYL2FO.cjs.map