@dxos/client-services 0.4.9-main.a108ade → 0.4.9-main.c54559c

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