@dxos/client-services 0.5.9-main.4ed8273 → 0.5.9-main.72c50cd

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 (39) hide show
  1. package/dist/lib/browser/{chunk-YJ5SPRLY.mjs → chunk-G25WUL6O.mjs} +589 -731
  2. package/dist/lib/browser/chunk-G25WUL6O.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/packlets/testing/index.mjs +9 -10
  6. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  7. package/dist/lib/node/{chunk-RQHBQWKH.cjs → chunk-FTGPY2GQ.cjs} +809 -947
  8. package/dist/lib/node/chunk-FTGPY2GQ.cjs.map +7 -0
  9. package/dist/lib/node/index.cjs +42 -42
  10. package/dist/lib/node/meta.json +1 -1
  11. package/dist/lib/node/packlets/testing/index.cjs +15 -16
  12. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  13. package/dist/types/src/packlets/identity/identity-service.d.ts +7 -14
  14. package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
  15. package/dist/types/src/packlets/identity/identity.d.ts +1 -4
  16. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  17. package/dist/types/src/packlets/services/service-host.d.ts +1 -1
  18. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  19. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +3 -5
  20. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  21. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  22. package/dist/types/src/packlets/testing/test-builder.d.ts +6 -8
  23. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  24. package/dist/types/src/version.d.ts +1 -1
  25. package/package.json +36 -36
  26. package/src/packlets/identity/identity-service.test.ts +5 -35
  27. package/src/packlets/identity/identity-service.ts +8 -50
  28. package/src/packlets/identity/identity.ts +2 -25
  29. package/src/packlets/services/service-host.ts +40 -13
  30. package/src/packlets/spaces/data-space-manager.test.ts +1 -46
  31. package/src/packlets/spaces/data-space-manager.ts +25 -54
  32. package/src/packlets/spaces/data-space.ts +5 -10
  33. package/src/packlets/testing/test-builder.ts +6 -11
  34. package/src/version.ts +1 -1
  35. package/dist/lib/browser/chunk-YJ5SPRLY.mjs.map +0 -7
  36. package/dist/lib/node/chunk-RQHBQWKH.cjs.map +0 -7
  37. package/dist/types/src/packlets/identity/default-space-state-machine.d.ts +0 -19
  38. package/dist/types/src/packlets/identity/default-space-state-machine.d.ts.map +0 -1
  39. package/src/packlets/identity/default-space-state-machine.ts +0 -44
@@ -355,7 +355,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
355
355
  import { TRACE_PROCESSOR } from "@dxos/tracing";
356
356
 
357
357
  // packages/sdk/client-services/src/version.ts
358
- var DXOS_VERSION = "0.5.9-main.4ed8273";
358
+ var DXOS_VERSION = "0.5.9-main.72c50cd";
359
359
 
360
360
  // packages/sdk/client-services/src/packlets/services/platform.ts
361
361
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -803,59 +803,10 @@ import { DeviceStateMachine, createCredentialSignerWithKey, createCredentialSign
803
803
  import { writeMessages } from "@dxos/feed-store";
804
804
  import { invariant as invariant2 } from "@dxos/invariant";
805
805
  import { PublicKey as PublicKey3 } from "@dxos/keys";
806
- import { log as log4 } from "@dxos/log";
806
+ import { log as log3 } from "@dxos/log";
807
807
  import { AdmittedFeed } from "@dxos/protocols/proto/dxos/halo/credentials";
808
- import { Timeframe } from "@dxos/timeframe";
809
808
  import { trace as trace2 } from "@dxos/tracing";
810
809
  import { ComplexSet } from "@dxos/util";
811
-
812
- // packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts
813
- import { getCredentialAssertion } from "@dxos/credentials";
814
- import { SpaceId } from "@dxos/keys";
815
- import { log as log3 } from "@dxos/log";
816
- var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts";
817
- var DefaultSpaceStateMachine = class {
818
- constructor(_params) {
819
- this._params = _params;
820
- }
821
- get spaceId() {
822
- return this._spaceId;
823
- }
824
- async processCredential(credential) {
825
- const assertion = getCredentialAssertion(credential);
826
- switch (assertion["@type"]) {
827
- case "dxos.halo.credentials.DefaultSpace": {
828
- if (!credential.subject.id.equals(this._params.identityKey)) {
829
- log3.warn("Invalid default space credential", {
830
- expectedIdentity: this._params.identityKey,
831
- credential
832
- }, {
833
- F: __dxlog_file4,
834
- L: 32,
835
- S: this,
836
- C: (f, a) => f(...a)
837
- });
838
- return;
839
- }
840
- if (!SpaceId.isValid(assertion.spaceId)) {
841
- log3.warn("Invalid default space id", {
842
- id: assertion.spaceId
843
- }, {
844
- F: __dxlog_file4,
845
- L: 36,
846
- S: this,
847
- C: (f, a) => f(...a)
848
- });
849
- return;
850
- }
851
- this._spaceId = assertion.spaceId;
852
- break;
853
- }
854
- }
855
- }
856
- };
857
-
858
- // packages/sdk/client-services/src/packlets/identity/identity.ts
859
810
  function _ts_decorate2(decorators, target, key, desc) {
860
811
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
861
812
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -866,7 +817,7 @@ function _ts_decorate2(decorators, target, key, desc) {
866
817
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
867
818
  return c > 3 && r && Object.defineProperty(target, key, r), r;
868
819
  }
869
- var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
820
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
870
821
  var Identity = class {
871
822
  constructor({ space, signer, identityKey, deviceKey, presence }) {
872
823
  this.stateUpdate = new Event();
@@ -875,11 +826,11 @@ var Identity = class {
875
826
  this._presence = presence;
876
827
  this.identityKey = identityKey;
877
828
  this.deviceKey = deviceKey;
878
- log4.trace("dxos.halo.device", {
829
+ log3.trace("dxos.halo.device", {
879
830
  deviceKey
880
831
  }, {
881
- F: __dxlog_file5,
882
- L: 70,
832
+ F: __dxlog_file4,
833
+ L: 67,
883
834
  S: this,
884
835
  C: (f, a) => f(...a)
885
836
  });
@@ -892,10 +843,6 @@ var Identity = class {
892
843
  identityKey: this.identityKey,
893
844
  onUpdate: () => this.stateUpdate.emit()
894
845
  });
895
- this._defaultSpaceStateMachine = new DefaultSpaceStateMachine({
896
- identityKey: this.identityKey,
897
- onUpdate: () => this.stateUpdate.emit()
898
- });
899
846
  this.authVerifier = new TrustedKeySetAuthVerifier({
900
847
  trustedKeysProvider: () => new ComplexSet(PublicKey3.hash, this.authorizedDeviceKeys.keys()),
901
848
  update: this.stateUpdate,
@@ -906,20 +853,14 @@ var Identity = class {
906
853
  get authorizedDeviceKeys() {
907
854
  return this._deviceStateMachine.authorizedDeviceKeys;
908
855
  }
909
- get defaultSpaceId() {
910
- return this._defaultSpaceStateMachine.spaceId;
911
- }
912
856
  async open(ctx) {
913
- await this._presence?.open();
914
857
  await this.space.spaceState.addCredentialProcessor(this._deviceStateMachine);
915
858
  await this.space.spaceState.addCredentialProcessor(this._profileStateMachine);
916
- await this.space.spaceState.addCredentialProcessor(this._defaultSpaceStateMachine);
917
859
  await this.space.open(ctx);
918
860
  }
919
861
  async close(ctx) {
920
- await this._presence?.close();
862
+ await this._presence?.destroy();
921
863
  await this.authVerifier.close();
922
- await this.space.spaceState.removeCredentialProcessor(this._defaultSpaceStateMachine);
923
864
  await this.space.spaceState.removeCredentialProcessor(this._profileStateMachine);
924
865
  await this.space.spaceState.removeCredentialProcessor(this._deviceStateMachine);
925
866
  await this.space.close();
@@ -957,8 +898,8 @@ var Identity = class {
957
898
  */
958
899
  getIdentityCredentialSigner() {
959
900
  invariant2(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
960
- F: __dxlog_file5,
961
- L: 159,
901
+ F: __dxlog_file4,
902
+ L: 145,
962
903
  S: this,
963
904
  A: [
964
905
  "this._deviceStateMachine.deviceCredentialChain",
@@ -973,36 +914,16 @@ var Identity = class {
973
914
  getDeviceCredentialSigner() {
974
915
  return createCredentialSignerWithKey(this._signer, this.deviceKey);
975
916
  }
976
- async updateDefaultSpace(spaceId) {
977
- const credential = await this.getDeviceCredentialSigner().createCredential({
978
- subject: this.identityKey,
979
- assertion: {
980
- "@type": "dxos.halo.credentials.DefaultSpace",
981
- spaceId
982
- }
983
- });
984
- const receipt = await this.controlPipeline.writer.write({
985
- credential: {
986
- credential
987
- }
988
- });
989
- await this.controlPipeline.state.waitUntilTimeframe(new Timeframe([
990
- [
991
- receipt.feedKey,
992
- receipt.seq
993
- ]
994
- ]));
995
- }
996
917
  async admitDevice({ deviceKey, controlFeedKey, dataFeedKey }) {
997
- log4("Admitting device:", {
918
+ log3("Admitting device:", {
998
919
  identityKey: this.identityKey,
999
920
  hostDevice: this.deviceKey,
1000
921
  deviceKey,
1001
922
  controlFeedKey,
1002
923
  dataFeedKey
1003
924
  }, {
1004
- F: __dxlog_file5,
1005
- L: 184,
925
+ F: __dxlog_file4,
926
+ L: 161,
1006
927
  S: this,
1007
928
  C: (f, a) => f(...a)
1008
929
  });
@@ -1060,12 +981,12 @@ import { Context as Context3 } from "@dxos/context";
1060
981
  import { createCredentialSignerWithKey as createCredentialSignerWithKey2, CredentialGenerator } from "@dxos/credentials";
1061
982
  import { invariant as invariant3 } from "@dxos/invariant";
1062
983
  import { PublicKey as PublicKey4 } from "@dxos/keys";
1063
- import { log as log5 } from "@dxos/log";
984
+ import { log as log4 } from "@dxos/log";
1064
985
  import { trace as trace3 } from "@dxos/protocols";
1065
986
  import { Device, DeviceKind } from "@dxos/protocols/proto/dxos/client/services";
1066
987
  import { AdmittedFeed as AdmittedFeed2, DeviceType } from "@dxos/protocols/proto/dxos/halo/credentials";
1067
988
  import { Gossip, Presence } from "@dxos/teleport-extension-gossip";
1068
- import { Timeframe as Timeframe2 } from "@dxos/timeframe";
989
+ import { Timeframe } from "@dxos/timeframe";
1069
990
  import { trace as Trace } from "@dxos/tracing";
1070
991
  import { isNode, deferFunction } from "@dxos/util";
1071
992
  function _ts_decorate3(decorators, target, key, desc) {
@@ -1078,7 +999,7 @@ function _ts_decorate3(decorators, target, key, desc) {
1078
999
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1079
1000
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1080
1001
  }
1081
- var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
1002
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
1082
1003
  var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
1083
1004
  var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
1084
1005
  var IdentityManager = class {
@@ -1099,19 +1020,19 @@ var IdentityManager = class {
1099
1020
  }
1100
1021
  async open(ctx) {
1101
1022
  const traceId = PublicKey4.random().toHex();
1102
- log5.trace("dxos.halo.identity-manager.open", trace3.begin({
1023
+ log4.trace("dxos.halo.identity-manager.open", trace3.begin({
1103
1024
  id: traceId
1104
1025
  }), {
1105
- F: __dxlog_file6,
1026
+ F: __dxlog_file5,
1106
1027
  L: 104,
1107
1028
  S: this,
1108
1029
  C: (f, a) => f(...a)
1109
1030
  });
1110
1031
  const identityRecord = this._metadataStore.getIdentityRecord();
1111
- log5("identity record", {
1032
+ log4("identity record", {
1112
1033
  identityRecord
1113
1034
  }, {
1114
- F: __dxlog_file6,
1035
+ F: __dxlog_file5,
1115
1036
  L: 107,
1116
1037
  S: this,
1117
1038
  C: (f, a) => f(...a)
@@ -1120,21 +1041,21 @@ var IdentityManager = class {
1120
1041
  this._identity = await this._constructIdentity(identityRecord);
1121
1042
  await this._identity.open(ctx);
1122
1043
  await this._identity.ready();
1123
- log5.trace("dxos.halo.identity", {
1044
+ log4.trace("dxos.halo.identity", {
1124
1045
  identityKey: identityRecord.identityKey,
1125
1046
  displayName: this._identity.profileDocument?.displayName
1126
1047
  }, {
1127
- F: __dxlog_file6,
1048
+ F: __dxlog_file5,
1128
1049
  L: 112,
1129
1050
  S: this,
1130
1051
  C: (f, a) => f(...a)
1131
1052
  });
1132
1053
  this.stateUpdate.emit();
1133
1054
  }
1134
- log5.trace("dxos.halo.identity-manager.open", trace3.end({
1055
+ log4.trace("dxos.halo.identity-manager.open", trace3.end({
1135
1056
  id: traceId
1136
1057
  }), {
1137
- F: __dxlog_file6,
1058
+ F: __dxlog_file5,
1138
1059
  L: 119,
1139
1060
  S: this,
1140
1061
  C: (f, a) => f(...a)
@@ -1145,7 +1066,7 @@ var IdentityManager = class {
1145
1066
  }
1146
1067
  async createIdentity({ displayName, deviceProfile } = {}) {
1147
1068
  invariant3(!this._identity, "Identity already exists.", {
1148
- F: __dxlog_file6,
1069
+ F: __dxlog_file5,
1149
1070
  L: 128,
1150
1071
  S: this,
1151
1072
  A: [
@@ -1153,8 +1074,8 @@ var IdentityManager = class {
1153
1074
  "'Identity already exists.'"
1154
1075
  ]
1155
1076
  });
1156
- log5("creating identity...", void 0, {
1157
- F: __dxlog_file6,
1077
+ log4("creating identity...", void 0, {
1078
+ F: __dxlog_file5,
1158
1079
  L: 129,
1159
1080
  S: this,
1160
1081
  C: (f, a) => f(...a)
@@ -1175,7 +1096,7 @@ var IdentityManager = class {
1175
1096
  {
1176
1097
  const generator = new CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
1177
1098
  invariant3(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
1178
- F: __dxlog_file6,
1099
+ F: __dxlog_file5,
1179
1100
  L: 148,
1180
1101
  S: this,
1181
1102
  A: [
@@ -1184,7 +1105,7 @@ var IdentityManager = class {
1184
1105
  ]
1185
1106
  });
1186
1107
  invariant3(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
1187
- F: __dxlog_file6,
1108
+ F: __dxlog_file5,
1188
1109
  L: 149,
1189
1110
  S: this,
1190
1111
  A: [
@@ -1219,22 +1140,22 @@ var IdentityManager = class {
1219
1140
  await this._metadataStore.setIdentityRecord(identityRecord);
1220
1141
  this._identity = identity;
1221
1142
  await this._identity.ready();
1222
- log5.trace("dxos.halo.identity", {
1143
+ log4.trace("dxos.halo.identity", {
1223
1144
  identityKey: identityRecord.identityKey,
1224
1145
  displayName: this._identity.profileDocument?.displayName
1225
1146
  }, {
1226
- F: __dxlog_file6,
1147
+ F: __dxlog_file5,
1227
1148
  L: 191,
1228
1149
  S: this,
1229
1150
  C: (f, a) => f(...a)
1230
1151
  });
1231
1152
  this.stateUpdate.emit();
1232
- log5("created identity", {
1153
+ log4("created identity", {
1233
1154
  identityKey: identity.identityKey,
1234
1155
  deviceKey: identity.deviceKey,
1235
1156
  profile: identity.profileDocument
1236
1157
  }, {
1237
- F: __dxlog_file6,
1158
+ F: __dxlog_file5,
1238
1159
  L: 197,
1239
1160
  S: this,
1240
1161
  C: (f, a) => f(...a)
@@ -1268,16 +1189,16 @@ var IdentityManager = class {
1268
1189
  * Accept an existing identity. Expects its device key to be authorized (now or later).
1269
1190
  */
1270
1191
  async acceptIdentity(params) {
1271
- log5("accepting identity", {
1192
+ log4("accepting identity", {
1272
1193
  params
1273
1194
  }, {
1274
- F: __dxlog_file6,
1195
+ F: __dxlog_file5,
1275
1196
  L: 235,
1276
1197
  S: this,
1277
1198
  C: (f, a) => f(...a)
1278
1199
  });
1279
1200
  invariant3(!this._identity, "Identity already exists.", {
1280
- F: __dxlog_file6,
1201
+ F: __dxlog_file5,
1281
1202
  L: 236,
1282
1203
  S: this,
1283
1204
  A: [
@@ -1301,11 +1222,11 @@ var IdentityManager = class {
1301
1222
  this._identity = identity;
1302
1223
  await this._metadataStore.setIdentityRecord(identityRecord);
1303
1224
  await this._identity.ready();
1304
- log5.trace("dxos.halo.identity", {
1225
+ log4.trace("dxos.halo.identity", {
1305
1226
  identityKey: identityRecord.identityKey,
1306
1227
  displayName: this._identity.profileDocument?.displayName
1307
1228
  }, {
1308
- F: __dxlog_file6,
1229
+ F: __dxlog_file5,
1309
1230
  L: 255,
1310
1231
  S: this,
1311
1232
  C: (f, a) => f(...a)
@@ -1315,11 +1236,11 @@ var IdentityManager = class {
1315
1236
  ...params.deviceProfile
1316
1237
  });
1317
1238
  this.stateUpdate.emit();
1318
- log5("accepted identity", {
1239
+ log4("accepted identity", {
1319
1240
  identityKey: identity.identityKey,
1320
1241
  deviceKey: identity.deviceKey
1321
1242
  }, {
1322
- F: __dxlog_file6,
1243
+ F: __dxlog_file5,
1323
1244
  L: 265,
1324
1245
  S: this,
1325
1246
  C: (f, a) => f(...a)
@@ -1331,7 +1252,7 @@ var IdentityManager = class {
1331
1252
  */
1332
1253
  async updateProfile(profile) {
1333
1254
  invariant3(this._identity, "Identity not initialized.", {
1334
- F: __dxlog_file6,
1255
+ F: __dxlog_file5,
1335
1256
  L: 273,
1336
1257
  S: this,
1337
1258
  A: [
@@ -1351,7 +1272,7 @@ var IdentityManager = class {
1351
1272
  credential
1352
1273
  }
1353
1274
  });
1354
- await this._identity.controlPipeline.state.waitUntilTimeframe(new Timeframe2([
1275
+ await this._identity.controlPipeline.state.waitUntilTimeframe(new Timeframe([
1355
1276
  [
1356
1277
  receipt.feedKey,
1357
1278
  receipt.seq
@@ -1362,7 +1283,7 @@ var IdentityManager = class {
1362
1283
  }
1363
1284
  async updateDeviceProfile(profile) {
1364
1285
  invariant3(this._identity, "Identity not initialized.", {
1365
- F: __dxlog_file6,
1286
+ F: __dxlog_file5,
1366
1287
  L: 290,
1367
1288
  S: this,
1368
1289
  A: [
@@ -1382,7 +1303,7 @@ var IdentityManager = class {
1382
1303
  credential
1383
1304
  }
1384
1305
  });
1385
- await this._identity.controlPipeline.state.waitUntilTimeframe(new Timeframe2([
1306
+ await this._identity.controlPipeline.state.waitUntilTimeframe(new Timeframe([
1386
1307
  [
1387
1308
  receipt.feedKey,
1388
1309
  receipt.seq
@@ -1398,7 +1319,7 @@ var IdentityManager = class {
1398
1319
  }
1399
1320
  async _constructIdentity(identityRecord) {
1400
1321
  invariant3(!this._identity, void 0, {
1401
- F: __dxlog_file6,
1322
+ F: __dxlog_file5,
1402
1323
  L: 316,
1403
1324
  S: this,
1404
1325
  A: [
@@ -1406,10 +1327,10 @@ var IdentityManager = class {
1406
1327
  ""
1407
1328
  ]
1408
1329
  });
1409
- log5("constructing identity", {
1330
+ log4("constructing identity", {
1410
1331
  identityRecord
1411
1332
  }, {
1412
- F: __dxlog_file6,
1333
+ F: __dxlog_file5,
1413
1334
  L: 317,
1414
1335
  S: this,
1415
1336
  C: (f, a) => f(...a)
@@ -1424,7 +1345,7 @@ var IdentityManager = class {
1424
1345
  gossip
1425
1346
  });
1426
1347
  invariant3(identityRecord.haloSpace.controlFeedKey, void 0, {
1427
- F: __dxlog_file6,
1348
+ F: __dxlog_file5,
1428
1349
  L: 330,
1429
1350
  S: this,
1430
1351
  A: [
@@ -1436,7 +1357,7 @@ var IdentityManager = class {
1436
1357
  writable: true
1437
1358
  });
1438
1359
  invariant3(identityRecord.haloSpace.dataFeedKey, void 0, {
1439
- F: __dxlog_file6,
1360
+ F: __dxlog_file5,
1440
1361
  L: 334,
1441
1362
  S: this,
1442
1363
  A: [
@@ -1467,10 +1388,10 @@ var IdentityManager = class {
1467
1388
  identityKey: identityRecord.identityKey,
1468
1389
  deviceKey: identityRecord.deviceKey
1469
1390
  });
1470
- log5("done", {
1391
+ log4("done", {
1471
1392
  identityKey: identityRecord.identityKey
1472
1393
  }, {
1473
- F: __dxlog_file6,
1394
+ F: __dxlog_file5,
1474
1395
  L: 360,
1475
1396
  S: this,
1476
1397
  C: (f, a) => f(...a)
@@ -1494,8 +1415,8 @@ var IdentityManager = class {
1494
1415
  }));
1495
1416
  },
1496
1417
  onAuthFailure: () => {
1497
- log5.warn("auth failure", void 0, {
1498
- F: __dxlog_file6,
1418
+ log4.warn("auth failure", void 0, {
1419
+ F: __dxlog_file5,
1499
1420
  L: 385,
1500
1421
  S: this,
1501
1422
  C: (f, a) => f(...a)
@@ -1520,50 +1441,24 @@ IdentityManager = _ts_decorate3([
1520
1441
 
1521
1442
  // packages/sdk/client-services/src/packlets/identity/identity-service.ts
1522
1443
  import { Stream as Stream8 } from "@dxos/codec-protobuf";
1523
- import { Resource } from "@dxos/context";
1524
1444
  import { signPresentation } from "@dxos/credentials";
1525
1445
  import { todo } from "@dxos/debug";
1526
1446
  import { invariant as invariant4 } from "@dxos/invariant";
1527
- import { SpaceState } from "@dxos/protocols/proto/dxos/client/services";
1528
- var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
1529
- var IdentityServiceImpl = class extends Resource {
1530
- constructor(_identityManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
1531
- super();
1447
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
1448
+ var IdentityServiceImpl = class {
1449
+ constructor(_createIdentity, _identityManager, _keyring, _onProfileUpdate) {
1450
+ this._createIdentity = _createIdentity;
1532
1451
  this._identityManager = _identityManager;
1533
1452
  this._keyring = _keyring;
1534
- this._dataSpaceManagerProvider = _dataSpaceManagerProvider;
1535
- this._createIdentity = _createIdentity;
1536
1453
  this._onProfileUpdate = _onProfileUpdate;
1537
1454
  }
1538
- async _open() {
1539
- const identity = this._identityManager.identity;
1540
- if (identity && !identity.defaultSpaceId) {
1541
- await this._fixIdentityWithoutDefaultSpace(identity);
1542
- }
1543
- }
1544
1455
  async createIdentity(request) {
1545
1456
  await this._createIdentity({
1546
1457
  displayName: request.profile?.displayName,
1547
1458
  deviceProfile: request.deviceProfile
1548
1459
  });
1549
- const dataSpaceManager = this._dataSpaceManagerProvider();
1550
- await this._createDefaultSpace(dataSpaceManager);
1551
1460
  return this._getIdentity();
1552
1461
  }
1553
- async _createDefaultSpace(dataSpaceManager) {
1554
- const space = await dataSpaceManager.createDefaultSpace();
1555
- const identity = this._identityManager.identity;
1556
- invariant4(identity, void 0, {
1557
- F: __dxlog_file7,
1558
- L: 54,
1559
- S: this,
1560
- A: [
1561
- "identity",
1562
- ""
1563
- ]
1564
- });
1565
- await identity.updateDefaultSpace(space.id);
1566
- }
1567
1462
  async recoverIdentity(request) {
1568
1463
  return todo();
1569
1464
  }
@@ -1588,8 +1483,8 @@ var IdentityServiceImpl = class extends Resource {
1588
1483
  }
1589
1484
  async updateProfile(profile) {
1590
1485
  invariant4(this._identityManager.identity, "Identity not initialized.", {
1591
- F: __dxlog_file7,
1592
- L: 84,
1486
+ F: __dxlog_file6,
1487
+ L: 61,
1593
1488
  S: this,
1594
1489
  A: [
1595
1490
  "this._identityManager.identity",
@@ -1602,8 +1497,8 @@ var IdentityServiceImpl = class extends Resource {
1602
1497
  }
1603
1498
  async signPresentation({ presentation, nonce }) {
1604
1499
  invariant4(this._identityManager.identity, "Identity not initialized.", {
1605
- F: __dxlog_file7,
1606
- L: 91,
1500
+ F: __dxlog_file6,
1501
+ L: 68,
1607
1502
  S: this,
1608
1503
  A: [
1609
1504
  "this._identityManager.identity",
@@ -1618,31 +1513,13 @@ var IdentityServiceImpl = class extends Resource {
1618
1513
  nonce
1619
1514
  });
1620
1515
  }
1621
- async _fixIdentityWithoutDefaultSpace(identity) {
1622
- let hasDefaultSpace = false;
1623
- const dataSpaceManager = this._dataSpaceManagerProvider();
1624
- for (const space of dataSpaceManager.spaces.values()) {
1625
- if (space.state === SpaceState.CLOSED) {
1626
- await space.open();
1627
- await space.initializeDataPipeline();
1628
- }
1629
- if (await dataSpaceManager.isDefaultSpace(space)) {
1630
- await identity.updateDefaultSpace(space.id);
1631
- hasDefaultSpace = true;
1632
- break;
1633
- }
1634
- }
1635
- if (!hasDefaultSpace) {
1636
- await this._createDefaultSpace(dataSpaceManager);
1637
- }
1638
- }
1639
1516
  };
1640
1517
 
1641
1518
  // packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts
1642
1519
  import { invariant as invariant5 } from "@dxos/invariant";
1643
1520
  import { AlreadyJoinedError } from "@dxos/protocols";
1644
1521
  import { Invitation } from "@dxos/protocols/proto/dxos/client/services";
1645
- var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
1522
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
1646
1523
  var DeviceInvitationProtocol = class {
1647
1524
  constructor(_keyring, _getIdentity, _acceptIdentity) {
1648
1525
  this._keyring = _keyring;
@@ -1668,7 +1545,7 @@ var DeviceInvitationProtocol = class {
1668
1545
  }
1669
1546
  async admit(_, request) {
1670
1547
  invariant5(request.device, void 0, {
1671
- F: __dxlog_file8,
1548
+ F: __dxlog_file7,
1672
1549
  L: 50,
1673
1550
  S: this,
1674
1551
  A: [
@@ -1714,7 +1591,7 @@ var DeviceInvitationProtocol = class {
1714
1591
  }
1715
1592
  async accept(response, request) {
1716
1593
  invariant5(response.device, void 0, {
1717
- F: __dxlog_file8,
1594
+ F: __dxlog_file7,
1718
1595
  L: 95,
1719
1596
  S: this,
1720
1597
  A: [
@@ -1724,7 +1601,7 @@ var DeviceInvitationProtocol = class {
1724
1601
  });
1725
1602
  const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
1726
1603
  invariant5(request.device, void 0, {
1727
- F: __dxlog_file8,
1604
+ F: __dxlog_file7,
1728
1605
  L: 98,
1729
1606
  S: this,
1730
1607
  A: [
@@ -1756,7 +1633,7 @@ import { ContextDisposedError as ContextDisposedError2 } from "@dxos/context";
1756
1633
  import { createKeyPair, sign } from "@dxos/crypto";
1757
1634
  import { invariant as invariant9 } from "@dxos/invariant";
1758
1635
  import { PublicKey as PublicKey7 } from "@dxos/keys";
1759
- import { log as log9 } from "@dxos/log";
1636
+ import { log as log8 } from "@dxos/log";
1760
1637
  import { createTeleportProtocolFactory } from "@dxos/network-manager";
1761
1638
  import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError3, trace as trace5 } from "@dxos/protocols";
1762
1639
  import { Invitation as Invitation4 } from "@dxos/protocols/proto/dxos/client/services";
@@ -1768,7 +1645,7 @@ import { ComplexSet as ComplexSet3 } from "@dxos/util";
1768
1645
  import { Trigger as Trigger3 } from "@dxos/async";
1769
1646
  import { cancelWithContext as cancelWithContext2, Context as Context4 } from "@dxos/context";
1770
1647
  import { invariant as invariant6 } from "@dxos/invariant";
1771
- import { log as log6 } from "@dxos/log";
1648
+ import { log as log5 } from "@dxos/log";
1772
1649
  import { InvalidInvitationExtensionRoleError, schema as schema2 } from "@dxos/protocols";
1773
1650
  import { Options } from "@dxos/protocols/proto/dxos/halo/invitations";
1774
1651
  import { RpcExtension } from "@dxos/teleport";
@@ -1793,7 +1670,7 @@ var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
1793
1670
  };
1794
1671
 
1795
1672
  // packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts
1796
- var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
1673
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
1797
1674
  var OPTIONS_TIMEOUT = 1e4;
1798
1675
  var InvitationGuestExtension = class extends RpcExtension {
1799
1676
  constructor(_invitationFlowMutex, _callbacks) {
@@ -1819,7 +1696,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1819
1696
  InvitationHostService: {
1820
1697
  options: async (options) => {
1821
1698
  invariant6(!this._remoteOptions, "Remote options already set.", {
1822
- F: __dxlog_file9,
1699
+ F: __dxlog_file8,
1823
1700
  L: 63,
1824
1701
  S: this,
1825
1702
  A: [
@@ -1845,15 +1722,15 @@ var InvitationGuestExtension = class extends RpcExtension {
1845
1722
  async onOpen(context) {
1846
1723
  await super.onOpen(context);
1847
1724
  try {
1848
- log6("guest acquire lock", void 0, {
1849
- F: __dxlog_file9,
1725
+ log5("guest acquire lock", void 0, {
1726
+ F: __dxlog_file8,
1850
1727
  L: 84,
1851
1728
  S: this,
1852
1729
  C: (f, a) => f(...a)
1853
1730
  });
1854
1731
  this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
1855
- log6("guest lock acquired", void 0, {
1856
- F: __dxlog_file9,
1732
+ log5("guest lock acquired", void 0, {
1733
+ F: __dxlog_file8,
1857
1734
  L: 86,
1858
1735
  S: this,
1859
1736
  C: (f, a) => f(...a)
@@ -1861,8 +1738,8 @@ var InvitationGuestExtension = class extends RpcExtension {
1861
1738
  await cancelWithContext2(this._ctx, this.rpc.InvitationHostService.options({
1862
1739
  role: Options.Role.GUEST
1863
1740
  }));
1864
- log6("options sent", void 0, {
1865
- F: __dxlog_file9,
1741
+ log5("options sent", void 0, {
1742
+ F: __dxlog_file8,
1866
1743
  L: 88,
1867
1744
  S: this,
1868
1745
  C: (f, a) => f(...a)
@@ -1870,8 +1747,8 @@ var InvitationGuestExtension = class extends RpcExtension {
1870
1747
  await cancelWithContext2(this._ctx, this._remoteOptionsTrigger.wait({
1871
1748
  timeout: OPTIONS_TIMEOUT
1872
1749
  }));
1873
- log6("options received", void 0, {
1874
- F: __dxlog_file9,
1750
+ log5("options received", void 0, {
1751
+ F: __dxlog_file8,
1875
1752
  L: 90,
1876
1753
  S: this,
1877
1754
  C: (f, a) => f(...a)
@@ -1904,8 +1781,8 @@ var InvitationGuestExtension = class extends RpcExtension {
1904
1781
  if (this._invitationFlowLock != null) {
1905
1782
  this._invitationFlowLock.release();
1906
1783
  this._invitationFlowLock = null;
1907
- log6("invitation flow lock released", void 0, {
1908
- F: __dxlog_file9,
1784
+ log5("invitation flow lock released", void 0, {
1785
+ F: __dxlog_file8,
1909
1786
  L: 123,
1910
1787
  S: this,
1911
1788
  C: (f, a) => f(...a)
@@ -1920,12 +1797,12 @@ import { cancelWithContext as cancelWithContext3, Context as Context5 } from "@d
1920
1797
  import { randomBytes, verify } from "@dxos/crypto";
1921
1798
  import { invariant as invariant7, InvariantViolation } from "@dxos/invariant";
1922
1799
  import { PublicKey as PublicKey5 } from "@dxos/keys";
1923
- import { log as log7 } from "@dxos/log";
1800
+ import { log as log6 } from "@dxos/log";
1924
1801
  import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError2, schema as schema3, trace as trace4 } from "@dxos/protocols";
1925
1802
  import { Invitation as Invitation3 } from "@dxos/protocols/proto/dxos/client/services";
1926
1803
  import { AuthenticationResponse, Options as Options2 } from "@dxos/protocols/proto/dxos/halo/invitations";
1927
1804
  import { RpcExtension as RpcExtension2 } from "@dxos/teleport";
1928
- var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
1805
+ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
1929
1806
  var OPTIONS_TIMEOUT2 = 1e4;
1930
1807
  var MAX_OTP_ATTEMPTS = 3;
1931
1808
  var InvitationHostExtension = class extends RpcExtension2 {
@@ -1959,7 +1836,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
1959
1836
  InvitationHostService: {
1960
1837
  options: async (options) => {
1961
1838
  invariant7(!this._remoteOptions, "Remote options already set.", {
1962
- F: __dxlog_file10,
1839
+ F: __dxlog_file9,
1963
1840
  L: 101,
1964
1841
  S: this,
1965
1842
  A: [
@@ -1973,10 +1850,10 @@ var InvitationHostExtension = class extends RpcExtension2 {
1973
1850
  introduce: async (request) => {
1974
1851
  const { profile, invitationId } = request;
1975
1852
  const traceId = PublicKey5.random().toHex();
1976
- log7.trace("dxos.sdk.invitation-handler.host.introduce", trace4.begin({
1853
+ log6.trace("dxos.sdk.invitation-handler.host.introduce", trace4.begin({
1977
1854
  id: traceId
1978
1855
  }), {
1979
- F: __dxlog_file10,
1856
+ F: __dxlog_file9,
1980
1857
  L: 110,
1981
1858
  S: this,
1982
1859
  C: (f, a) => f(...a)
@@ -1984,11 +1861,11 @@ var InvitationHostExtension = class extends RpcExtension2 {
1984
1861
  const invitation = this._requireActiveInvitation();
1985
1862
  this._assertInvitationState(Invitation3.State.CONNECTED);
1986
1863
  if (invitationId !== invitation?.invitationId) {
1987
- log7.warn("incorrect invitationId", {
1864
+ log6.warn("incorrect invitationId", {
1988
1865
  expected: invitation.invitationId,
1989
1866
  actual: invitationId
1990
1867
  }, {
1991
- F: __dxlog_file10,
1868
+ F: __dxlog_file9,
1992
1869
  L: 116,
1993
1870
  S: this,
1994
1871
  C: (f, a) => f(...a)
@@ -1999,10 +1876,10 @@ var InvitationHostExtension = class extends RpcExtension2 {
1999
1876
  authMethod: Invitation3.AuthMethod.NONE
2000
1877
  };
2001
1878
  }
2002
- log7("guest introduced themselves", {
1879
+ log6("guest introduced themselves", {
2003
1880
  guestProfile: profile
2004
1881
  }, {
2005
- F: __dxlog_file10,
1882
+ F: __dxlog_file9,
2006
1883
  L: 125,
2007
1884
  S: this,
2008
1885
  C: (f, a) => f(...a)
@@ -2010,10 +1887,10 @@ var InvitationHostExtension = class extends RpcExtension2 {
2010
1887
  this.guestProfile = profile;
2011
1888
  this._callbacks.onStateUpdate(Invitation3.State.READY_FOR_AUTHENTICATION);
2012
1889
  this._challenge = invitation.authMethod === Invitation3.AuthMethod.KNOWN_PUBLIC_KEY ? randomBytes(32) : void 0;
2013
- log7.trace("dxos.sdk.invitation-handler.host.introduce", trace4.end({
1890
+ log6.trace("dxos.sdk.invitation-handler.host.introduce", trace4.end({
2014
1891
  id: traceId
2015
1892
  }), {
2016
- F: __dxlog_file10,
1893
+ F: __dxlog_file9,
2017
1894
  L: 132,
2018
1895
  S: this,
2019
1896
  C: (f, a) => f(...a)
@@ -2025,19 +1902,19 @@ var InvitationHostExtension = class extends RpcExtension2 {
2025
1902
  },
2026
1903
  authenticate: async ({ authCode: code, signedChallenge }) => {
2027
1904
  const traceId = PublicKey5.random().toHex();
2028
- log7.trace("dxos.sdk.invitation-handler.host.authenticate", trace4.begin({
1905
+ log6.trace("dxos.sdk.invitation-handler.host.authenticate", trace4.begin({
2029
1906
  id: traceId
2030
1907
  }), {
2031
- F: __dxlog_file10,
1908
+ F: __dxlog_file9,
2032
1909
  L: 141,
2033
1910
  S: this,
2034
1911
  C: (f, a) => f(...a)
2035
1912
  });
2036
1913
  const invitation = this._requireActiveInvitation();
2037
- log7("received authentication request", {
1914
+ log6("received authentication request", {
2038
1915
  authCode: code
2039
1916
  }, {
2040
- F: __dxlog_file10,
1917
+ F: __dxlog_file9,
2041
1918
  L: 144,
2042
1919
  S: this,
2043
1920
  C: (f, a) => f(...a)
@@ -2050,8 +1927,8 @@ var InvitationHostExtension = class extends RpcExtension2 {
2050
1927
  this._callbacks.onStateUpdate(Invitation3.State.AUTHENTICATING);
2051
1928
  switch (invitation.authMethod) {
2052
1929
  case Invitation3.AuthMethod.NONE: {
2053
- log7("authentication not required", void 0, {
2054
- F: __dxlog_file10,
1930
+ log6("authentication not required", void 0, {
1931
+ F: __dxlog_file9,
2055
1932
  L: 152,
2056
1933
  S: this,
2057
1934
  C: (f, a) => f(...a)
@@ -2086,10 +1963,10 @@ var InvitationHostExtension = class extends RpcExtension2 {
2086
1963
  break;
2087
1964
  }
2088
1965
  default: {
2089
- log7.error("invalid authentication method", {
1966
+ log6.error("invalid authentication method", {
2090
1967
  authMethod: invitation.authMethod
2091
1968
  }, {
2092
- F: __dxlog_file10,
1969
+ F: __dxlog_file9,
2093
1970
  L: 190,
2094
1971
  S: this,
2095
1972
  C: (f, a) => f(...a)
@@ -2108,13 +1985,13 @@ var InvitationHostExtension = class extends RpcExtension2 {
2108
1985
  status
2109
1986
  };
2110
1987
  }
2111
- log7.trace("dxos.sdk.invitation-handler.host.authenticate", trace4.end({
1988
+ log6.trace("dxos.sdk.invitation-handler.host.authenticate", trace4.end({
2112
1989
  id: traceId,
2113
1990
  data: {
2114
1991
  status
2115
1992
  }
2116
1993
  }), {
2117
- F: __dxlog_file10,
1994
+ F: __dxlog_file9,
2118
1995
  L: 202,
2119
1996
  S: this,
2120
1997
  C: (f, a) => f(...a)
@@ -2125,10 +2002,10 @@ var InvitationHostExtension = class extends RpcExtension2 {
2125
2002
  },
2126
2003
  admit: async (request) => {
2127
2004
  const traceId = PublicKey5.random().toHex();
2128
- log7.trace("dxos.sdk.invitation-handler.host.admit", trace4.begin({
2005
+ log6.trace("dxos.sdk.invitation-handler.host.admit", trace4.begin({
2129
2006
  id: traceId
2130
2007
  }), {
2131
- F: __dxlog_file10,
2008
+ F: __dxlog_file9,
2132
2009
  L: 208,
2133
2010
  S: this,
2134
2011
  C: (f, a) => f(...a)
@@ -2142,10 +2019,10 @@ var InvitationHostExtension = class extends RpcExtension2 {
2142
2019
  }
2143
2020
  }
2144
2021
  const response = await this._callbacks.admit(request);
2145
- log7.trace("dxos.sdk.invitation-handler.host.admit", trace4.end({
2022
+ log6.trace("dxos.sdk.invitation-handler.host.admit", trace4.end({
2146
2023
  id: traceId
2147
2024
  }), {
2148
- F: __dxlog_file10,
2025
+ F: __dxlog_file9,
2149
2026
  L: 222,
2150
2027
  S: this,
2151
2028
  C: (f, a) => f(...a)
@@ -2162,15 +2039,15 @@ var InvitationHostExtension = class extends RpcExtension2 {
2162
2039
  async onOpen(context) {
2163
2040
  await super.onOpen(context);
2164
2041
  try {
2165
- log7("host acquire lock", void 0, {
2166
- F: __dxlog_file10,
2042
+ log6("host acquire lock", void 0, {
2043
+ F: __dxlog_file9,
2167
2044
  L: 237,
2168
2045
  S: this,
2169
2046
  C: (f, a) => f(...a)
2170
2047
  });
2171
2048
  this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
2172
- log7("host lock acquired", void 0, {
2173
- F: __dxlog_file10,
2049
+ log6("host lock acquired", void 0, {
2050
+ F: __dxlog_file9,
2174
2051
  L: 239,
2175
2052
  S: this,
2176
2053
  C: (f, a) => f(...a)
@@ -2180,8 +2057,8 @@ var InvitationHostExtension = class extends RpcExtension2 {
2180
2057
  await this.rpc.InvitationHostService.options({
2181
2058
  role: Options2.Role.HOST
2182
2059
  });
2183
- log7("options sent", void 0, {
2184
- F: __dxlog_file10,
2060
+ log6("options sent", void 0, {
2061
+ F: __dxlog_file9,
2185
2062
  L: 243,
2186
2063
  S: this,
2187
2064
  C: (f, a) => f(...a)
@@ -2189,8 +2066,8 @@ var InvitationHostExtension = class extends RpcExtension2 {
2189
2066
  await cancelWithContext3(this._ctx, this._remoteOptionsTrigger.wait({
2190
2067
  timeout: OPTIONS_TIMEOUT2
2191
2068
  }));
2192
- log7("options received", void 0, {
2193
- F: __dxlog_file10,
2069
+ log6("options received", void 0, {
2070
+ F: __dxlog_file9,
2194
2071
  L: 245,
2195
2072
  S: this,
2196
2073
  C: (f, a) => f(...a)
@@ -2243,8 +2120,8 @@ var InvitationHostExtension = class extends RpcExtension2 {
2243
2120
  if (this._invitationFlowLock != null) {
2244
2121
  this._invitationFlowLock?.release();
2245
2122
  this._invitationFlowLock = null;
2246
- log7("invitation flow lock released", void 0, {
2247
- F: __dxlog_file10,
2123
+ log6("invitation flow lock released", void 0, {
2124
+ F: __dxlog_file9,
2248
2125
  L: 300,
2249
2126
  S: this,
2250
2127
  C: (f, a) => f(...a)
@@ -2257,10 +2134,10 @@ var isAuthenticationRequired = (invitation) => invitation.authMethod !== Invitat
2257
2134
  // packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts
2258
2135
  import { invariant as invariant8 } from "@dxos/invariant";
2259
2136
  import { PublicKey as PublicKey6 } from "@dxos/keys";
2260
- import { log as log8 } from "@dxos/log";
2137
+ import { log as log7 } from "@dxos/log";
2261
2138
  import { Options as Options3 } from "@dxos/protocols/proto/dxos/halo/invitations";
2262
2139
  import { ComplexSet as ComplexSet2 } from "@dxos/util";
2263
- var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
2140
+ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
2264
2141
  var InvitationTopology = class {
2265
2142
  constructor(_role) {
2266
2143
  this._role = _role;
@@ -2268,7 +2145,7 @@ var InvitationTopology = class {
2268
2145
  }
2269
2146
  init(controller) {
2270
2147
  invariant8(!this._controller, "Already initialized.", {
2271
- F: __dxlog_file11,
2148
+ F: __dxlog_file10,
2272
2149
  L: 42,
2273
2150
  S: this,
2274
2151
  A: [
@@ -2280,7 +2157,7 @@ var InvitationTopology = class {
2280
2157
  }
2281
2158
  update() {
2282
2159
  invariant8(this._controller, "Not initialized.", {
2283
- F: __dxlog_file11,
2160
+ F: __dxlog_file10,
2284
2161
  L: 47,
2285
2162
  S: this,
2286
2163
  A: [
@@ -2299,11 +2176,11 @@ var InvitationTopology = class {
2299
2176
  const firstUnknownPeer = candidates.find((peerId) => !this._seenPeers.has(peerId));
2300
2177
  this._seenPeers = new ComplexSet2(PublicKey6.hash, allPeers.filter((peerId) => this._seenPeers.has(peerId)));
2301
2178
  if (firstUnknownPeer != null) {
2302
- log8("invitation connect", {
2179
+ log7("invitation connect", {
2303
2180
  ownPeerId,
2304
2181
  remotePeerId: firstUnknownPeer
2305
2182
  }, {
2306
- F: __dxlog_file11,
2183
+ F: __dxlog_file10,
2307
2184
  L: 69,
2308
2185
  S: this,
2309
2186
  C: (f, a) => f(...a)
@@ -2314,7 +2191,7 @@ var InvitationTopology = class {
2314
2191
  }
2315
2192
  async onOffer(peer) {
2316
2193
  invariant8(this._controller, "Not initialized.", {
2317
- F: __dxlog_file11,
2194
+ F: __dxlog_file10,
2318
2195
  L: 76,
2319
2196
  S: this,
2320
2197
  A: [
@@ -2333,7 +2210,7 @@ var InvitationTopology = class {
2333
2210
  };
2334
2211
 
2335
2212
  // packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
2336
- var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
2213
+ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
2337
2214
  var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
2338
2215
  var InvitationsHandler = class {
2339
2216
  /**
@@ -2358,7 +2235,7 @@ var InvitationsHandler = class {
2358
2235
  try {
2359
2236
  const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
2360
2237
  invariant9(deviceKey, void 0, {
2361
- F: __dxlog_file12,
2238
+ F: __dxlog_file11,
2362
2239
  L: 90,
2363
2240
  S: this,
2364
2241
  A: [
@@ -2384,18 +2261,18 @@ var InvitationsHandler = class {
2384
2261
  scheduleTask3(connectionCtx, async () => {
2385
2262
  const traceId = PublicKey7.random().toHex();
2386
2263
  try {
2387
- log9.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.begin({
2264
+ log8.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.begin({
2388
2265
  id: traceId
2389
2266
  }), {
2390
- F: __dxlog_file12,
2267
+ F: __dxlog_file11,
2391
2268
  L: 115,
2392
2269
  S: this,
2393
2270
  C: (f, a) => f(...a)
2394
2271
  });
2395
- log9("connected", {
2272
+ log8("connected", {
2396
2273
  ...protocol.toJSON()
2397
2274
  }, {
2398
- F: __dxlog_file12,
2275
+ F: __dxlog_file11,
2399
2276
  L: 116,
2400
2277
  S: this,
2401
2278
  C: (f, a) => f(...a)
@@ -2403,20 +2280,20 @@ var InvitationsHandler = class {
2403
2280
  const deviceKey = await extension.completedTrigger.wait({
2404
2281
  timeout: invitation.timeout
2405
2282
  });
2406
- log9("admitted guest", {
2283
+ log8("admitted guest", {
2407
2284
  guest: deviceKey,
2408
2285
  ...protocol.toJSON()
2409
2286
  }, {
2410
- F: __dxlog_file12,
2287
+ F: __dxlog_file11,
2411
2288
  L: 118,
2412
2289
  S: this,
2413
2290
  C: (f, a) => f(...a)
2414
2291
  });
2415
2292
  guardedState.set(extension, Invitation4.State.SUCCESS);
2416
- log9.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.end({
2293
+ log8.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.end({
2417
2294
  id: traceId
2418
2295
  }), {
2419
- F: __dxlog_file12,
2296
+ F: __dxlog_file11,
2420
2297
  L: 120,
2421
2298
  S: this,
2422
2299
  C: (f, a) => f(...a)
@@ -2428,10 +2305,10 @@ var InvitationsHandler = class {
2428
2305
  } catch (err) {
2429
2306
  if (err instanceof TimeoutError) {
2430
2307
  if (guardedState.set(extension, Invitation4.State.TIMEOUT)) {
2431
- log9("timeout", {
2308
+ log8("timeout", {
2432
2309
  ...protocol.toJSON()
2433
2310
  }, {
2434
- F: __dxlog_file12,
2311
+ F: __dxlog_file11,
2435
2312
  L: 129,
2436
2313
  S: this,
2437
2314
  C: (f, a) => f(...a)
@@ -2439,19 +2316,19 @@ var InvitationsHandler = class {
2439
2316
  }
2440
2317
  } else {
2441
2318
  if (guardedState.error(extension, err)) {
2442
- log9.error("failed", err, {
2443
- F: __dxlog_file12,
2319
+ log8.error("failed", err, {
2320
+ F: __dxlog_file11,
2444
2321
  L: 133,
2445
2322
  S: this,
2446
2323
  C: (f, a) => f(...a)
2447
2324
  });
2448
2325
  }
2449
2326
  }
2450
- log9.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.error({
2327
+ log8.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.error({
2451
2328
  id: traceId,
2452
2329
  error: err
2453
2330
  }), {
2454
- F: __dxlog_file12,
2331
+ F: __dxlog_file11,
2455
2332
  L: 136,
2456
2333
  S: this,
2457
2334
  C: (f, a) => f(...a)
@@ -2462,10 +2339,10 @@ var InvitationsHandler = class {
2462
2339
  },
2463
2340
  onError: (err) => {
2464
2341
  if (err instanceof InvalidInvitationExtensionRoleError3) {
2465
- log9("invalid role", {
2342
+ log8("invalid role", {
2466
2343
  ...err.context
2467
2344
  }, {
2468
- F: __dxlog_file12,
2345
+ F: __dxlog_file11,
2469
2346
  L: 144,
2470
2347
  S: this,
2471
2348
  C: (f, a) => f(...a)
@@ -2474,10 +2351,10 @@ var InvitationsHandler = class {
2474
2351
  }
2475
2352
  if (err instanceof TimeoutError) {
2476
2353
  if (guardedState.set(extension, Invitation4.State.TIMEOUT)) {
2477
- log9("timeout", {
2354
+ log8("timeout", {
2478
2355
  err
2479
2356
  }, {
2480
- F: __dxlog_file12,
2357
+ F: __dxlog_file11,
2481
2358
  L: 149,
2482
2359
  S: this,
2483
2360
  C: (f, a) => f(...a)
@@ -2485,8 +2362,8 @@ var InvitationsHandler = class {
2485
2362
  }
2486
2363
  } else {
2487
2364
  if (guardedState.error(extension, err)) {
2488
- log9.error("failed", err, {
2489
- F: __dxlog_file12,
2365
+ log8.error("failed", err, {
2366
+ F: __dxlog_file11,
2490
2367
  L: 153,
2491
2368
  S: this,
2492
2369
  C: (f, a) => f(...a)
@@ -2499,8 +2376,8 @@ var InvitationsHandler = class {
2499
2376
  };
2500
2377
  if (invitation.lifetime && invitation.created) {
2501
2378
  if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
2502
- log9.warn("invitation has already expired", void 0, {
2503
- F: __dxlog_file12,
2379
+ log8.warn("invitation has already expired", void 0, {
2380
+ F: __dxlog_file11,
2504
2381
  L: 164,
2505
2382
  S: this,
2506
2383
  C: (f, a) => f(...a)
@@ -2523,7 +2400,7 @@ var InvitationsHandler = class {
2523
2400
  const { timeout = INVITATION_TIMEOUT } = invitation;
2524
2401
  if (deviceProfile) {
2525
2402
  invariant9(invitation.kind === Invitation4.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
2526
- F: __dxlog_file12,
2403
+ F: __dxlog_file11,
2527
2404
  L: 197,
2528
2405
  S: this,
2529
2406
  A: [
@@ -2536,12 +2413,12 @@ var InvitationsHandler = class {
2536
2413
  const guardedState = this._createGuardedState(ctx, invitation, stream);
2537
2414
  const shouldCancelInvitationFlow = (extension) => {
2538
2415
  const isLockedByAnotherConnection = guardedState.mutex.isLocked() && !extension.hasFlowLock();
2539
- log9("should cancel invitation flow", {
2416
+ log8("should cancel invitation flow", {
2540
2417
  isLockedByAnotherConnection,
2541
2418
  invitationType: Invitation4.Type.DELEGATED,
2542
2419
  triedPeers: triedPeersIds.size
2543
2420
  }, {
2544
- F: __dxlog_file12,
2421
+ F: __dxlog_file11,
2545
2422
  L: 205,
2546
2423
  S: this,
2547
2424
  C: (f, a) => f(...a)
@@ -2564,11 +2441,11 @@ var InvitationsHandler = class {
2564
2441
  return;
2565
2442
  }
2566
2443
  connectionCtx.onDispose(async () => {
2567
- log9("extension disposed", {
2444
+ log8("extension disposed", {
2568
2445
  admitted,
2569
2446
  currentState: guardedState.current.state
2570
2447
  }, {
2571
- F: __dxlog_file12,
2448
+ F: __dxlog_file11,
2572
2449
  L: 233,
2573
2450
  S: this,
2574
2451
  C: (f, a) => f(...a)
@@ -2583,10 +2460,10 @@ var InvitationsHandler = class {
2583
2460
  scheduleTask3(connectionCtx, async () => {
2584
2461
  const traceId = PublicKey7.random().toHex();
2585
2462
  try {
2586
- log9.trace("dxos.sdk.invitations-handler.guest.onOpen", trace5.begin({
2463
+ log8.trace("dxos.sdk.invitations-handler.guest.onOpen", trace5.begin({
2587
2464
  id: traceId
2588
2465
  }), {
2589
- F: __dxlog_file12,
2466
+ F: __dxlog_file11,
2590
2467
  L: 245,
2591
2468
  S: this,
2592
2469
  C: (f, a) => f(...a)
@@ -2595,19 +2472,19 @@ var InvitationsHandler = class {
2595
2472
  guardedState.set(extension, Invitation4.State.TIMEOUT);
2596
2473
  extensionCtx.close();
2597
2474
  }, timeout);
2598
- log9("connected", {
2475
+ log8("connected", {
2599
2476
  ...protocol.toJSON()
2600
2477
  }, {
2601
- F: __dxlog_file12,
2478
+ F: __dxlog_file11,
2602
2479
  L: 256,
2603
2480
  S: this,
2604
2481
  C: (f, a) => f(...a)
2605
2482
  });
2606
2483
  guardedState.set(extension, Invitation4.State.CONNECTED);
2607
- log9("introduce", {
2484
+ log8("introduce", {
2608
2485
  ...protocol.toJSON()
2609
2486
  }, {
2610
- F: __dxlog_file12,
2487
+ F: __dxlog_file11,
2611
2488
  L: 260,
2612
2489
  S: this,
2613
2490
  C: (f, a) => f(...a)
@@ -2616,11 +2493,11 @@ var InvitationsHandler = class {
2616
2493
  invitationId: invitation.invitationId,
2617
2494
  ...protocol.createIntroduction()
2618
2495
  });
2619
- log9("introduce response", {
2496
+ log8("introduce response", {
2620
2497
  ...protocol.toJSON(),
2621
2498
  response: introductionResponse
2622
2499
  }, {
2623
- F: __dxlog_file12,
2500
+ F: __dxlog_file11,
2624
2501
  L: 265,
2625
2502
  S: this,
2626
2503
  C: (f, a) => f(...a)
@@ -2638,10 +2515,10 @@ var InvitationsHandler = class {
2638
2515
  break;
2639
2516
  }
2640
2517
  }
2641
- log9("request admission", {
2518
+ log8("request admission", {
2642
2519
  ...protocol.toJSON()
2643
2520
  }, {
2644
- F: __dxlog_file12,
2521
+ F: __dxlog_file11,
2645
2522
  L: 291,
2646
2523
  S: this,
2647
2524
  C: (f, a) => f(...a)
@@ -2650,10 +2527,10 @@ var InvitationsHandler = class {
2650
2527
  const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
2651
2528
  admitted = true;
2652
2529
  const result = await protocol.accept(admissionResponse, admissionRequest);
2653
- log9("admitted by host", {
2530
+ log8("admitted by host", {
2654
2531
  ...protocol.toJSON()
2655
2532
  }, {
2656
- F: __dxlog_file12,
2533
+ F: __dxlog_file11,
2657
2534
  L: 302,
2658
2535
  S: this,
2659
2536
  C: (f, a) => f(...a)
@@ -2663,28 +2540,28 @@ var InvitationsHandler = class {
2663
2540
  ...result,
2664
2541
  state: Invitation4.State.SUCCESS
2665
2542
  });
2666
- log9.trace("dxos.sdk.invitations-handler.guest.onOpen", trace5.end({
2543
+ log8.trace("dxos.sdk.invitations-handler.guest.onOpen", trace5.end({
2667
2544
  id: traceId
2668
2545
  }), {
2669
- F: __dxlog_file12,
2546
+ F: __dxlog_file11,
2670
2547
  L: 308,
2671
2548
  S: this,
2672
2549
  C: (f, a) => f(...a)
2673
2550
  });
2674
2551
  } catch (err) {
2675
2552
  if (err instanceof TimeoutError) {
2676
- log9("timeout", {
2553
+ log8("timeout", {
2677
2554
  ...protocol.toJSON()
2678
2555
  }, {
2679
- F: __dxlog_file12,
2556
+ F: __dxlog_file11,
2680
2557
  L: 311,
2681
2558
  S: this,
2682
2559
  C: (f, a) => f(...a)
2683
2560
  });
2684
2561
  guardedState.set(extension, Invitation4.State.TIMEOUT);
2685
2562
  } else {
2686
- log9("auth failed", err, {
2687
- F: __dxlog_file12,
2563
+ log8("auth failed", err, {
2564
+ F: __dxlog_file11,
2688
2565
  L: 314,
2689
2566
  S: this,
2690
2567
  C: (f, a) => f(...a)
@@ -2692,11 +2569,11 @@ var InvitationsHandler = class {
2692
2569
  guardedState.error(extension, err);
2693
2570
  }
2694
2571
  extensionCtx.close(err);
2695
- log9.trace("dxos.sdk.invitations-handler.guest.onOpen", trace5.error({
2572
+ log8.trace("dxos.sdk.invitations-handler.guest.onOpen", trace5.error({
2696
2573
  id: traceId,
2697
2574
  error: err
2698
2575
  }), {
2699
- F: __dxlog_file12,
2576
+ F: __dxlog_file11,
2700
2577
  L: 318,
2701
2578
  S: this,
2702
2579
  C: (f, a) => f(...a)
@@ -2709,18 +2586,18 @@ var InvitationsHandler = class {
2709
2586
  return;
2710
2587
  }
2711
2588
  if (err instanceof TimeoutError) {
2712
- log9("timeout", {
2589
+ log8("timeout", {
2713
2590
  ...protocol.toJSON()
2714
2591
  }, {
2715
- F: __dxlog_file12,
2592
+ F: __dxlog_file11,
2716
2593
  L: 327,
2717
2594
  S: this,
2718
2595
  C: (f, a) => f(...a)
2719
2596
  });
2720
2597
  guardedState.set(extension, Invitation4.State.TIMEOUT);
2721
2598
  } else {
2722
- log9("auth failed", err, {
2723
- F: __dxlog_file12,
2599
+ log8("auth failed", err, {
2600
+ F: __dxlog_file11,
2724
2601
  L: 330,
2725
2602
  S: this,
2726
2603
  C: (f, a) => f(...a)
@@ -2738,7 +2615,7 @@ var InvitationsHandler = class {
2738
2615
  await ctx.dispose();
2739
2616
  } else {
2740
2617
  invariant9(invitation.swarmKey, void 0, {
2741
- F: __dxlog_file12,
2618
+ F: __dxlog_file11,
2742
2619
  L: 345,
2743
2620
  S: this,
2744
2621
  A: [
@@ -2832,12 +2709,12 @@ var InvitationsHandler = class {
2832
2709
  };
2833
2710
  }
2834
2711
  _logStateUpdate(invitation, actor, newState) {
2835
- log9("invitation state update", {
2712
+ log8("invitation state update", {
2836
2713
  actor: actor?.constructor.name,
2837
2714
  newState: stateToString(newState),
2838
2715
  oldState: stateToString(invitation.state)
2839
2716
  }, {
2840
- F: __dxlog_file12,
2717
+ F: __dxlog_file11,
2841
2718
  L: 438,
2842
2719
  S: this,
2843
2720
  C: (f, a) => f(...a)
@@ -2854,16 +2731,16 @@ var InvitationsHandler = class {
2854
2731
  }
2855
2732
  async _handleGuestOtpAuth(extension, setState, authenticated, options) {
2856
2733
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
2857
- log9("guest waiting for authentication code...", void 0, {
2858
- F: __dxlog_file12,
2734
+ log8("guest waiting for authentication code...", void 0, {
2735
+ F: __dxlog_file11,
2859
2736
  L: 462,
2860
2737
  S: this,
2861
2738
  C: (f, a) => f(...a)
2862
2739
  });
2863
2740
  setState(Invitation4.State.READY_FOR_AUTHENTICATION);
2864
2741
  const authCode = await authenticated.wait(options);
2865
- log9("sending authentication request", void 0, {
2866
- F: __dxlog_file12,
2742
+ log8("sending authentication request", void 0, {
2743
+ F: __dxlog_file11,
2867
2744
  L: 466,
2868
2745
  S: this,
2869
2746
  C: (f, a) => f(...a)
@@ -2879,10 +2756,10 @@ var InvitationsHandler = class {
2879
2756
  if (attempt === MAX_OTP_ATTEMPTS) {
2880
2757
  throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
2881
2758
  } else {
2882
- log9("retrying invalid code", {
2759
+ log8("retrying invalid code", {
2883
2760
  attempt
2884
2761
  }, {
2885
- F: __dxlog_file12,
2762
+ F: __dxlog_file11,
2886
2763
  L: 477,
2887
2764
  S: this,
2888
2765
  C: (f, a) => f(...a)
@@ -2899,8 +2776,8 @@ var InvitationsHandler = class {
2899
2776
  if (introductionResponse.challenge == null) {
2900
2777
  throw new Error("challenge missing in the introduction");
2901
2778
  }
2902
- log9("sending authentication request", void 0, {
2903
- F: __dxlog_file12,
2779
+ log8("sending authentication request", void 0, {
2780
+ F: __dxlog_file11,
2904
2781
  L: 496,
2905
2782
  S: this,
2906
2783
  C: (f, a) => f(...a)
@@ -3021,14 +2898,14 @@ var InvitationsServiceImpl = class {
3021
2898
  };
3022
2899
 
3023
2900
  // packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts
3024
- import { createAdmissionCredentials, createCancelDelegatedSpaceInvitationCredential, createDelegatedSpaceInvitationCredential, getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
2901
+ import { createAdmissionCredentials, createCancelDelegatedSpaceInvitationCredential, createDelegatedSpaceInvitationCredential, getCredentialAssertion } from "@dxos/credentials";
3025
2902
  import { writeMessages as writeMessages2 } from "@dxos/feed-store";
3026
2903
  import { invariant as invariant10 } from "@dxos/invariant";
3027
- import { log as log10 } from "@dxos/log";
2904
+ import { log as log9 } from "@dxos/log";
3028
2905
  import { AlreadyJoinedError as AlreadyJoinedError2, AuthorizationError, InvalidInvitationError, SpaceNotFoundError } from "@dxos/protocols";
3029
2906
  import { Invitation as Invitation5 } from "@dxos/protocols/proto/dxos/client/services";
3030
2907
  import { SpaceMember as SpaceMember2 } from "@dxos/protocols/proto/dxos/halo/credentials";
3031
- var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
2908
+ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
3032
2909
  var SpaceInvitationProtocol = class {
3033
2910
  constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
3034
2911
  this._spaceManager = _spaceManager;
@@ -3063,7 +2940,7 @@ var SpaceInvitationProtocol = class {
3063
2940
  }
3064
2941
  async admit(invitation, request, guestProfile) {
3065
2942
  invariant10(this._spaceKey, void 0, {
3066
- F: __dxlog_file13,
2943
+ F: __dxlog_file12,
3067
2944
  L: 76,
3068
2945
  S: this,
3069
2946
  A: [
@@ -3073,7 +2950,7 @@ var SpaceInvitationProtocol = class {
3073
2950
  });
3074
2951
  const space = this._spaceManager.spaces.get(this._spaceKey);
3075
2952
  invariant10(space, void 0, {
3076
- F: __dxlog_file13,
2953
+ F: __dxlog_file12,
3077
2954
  L: 78,
3078
2955
  S: this,
3079
2956
  A: [
@@ -3082,7 +2959,7 @@ var SpaceInvitationProtocol = class {
3082
2959
  ]
3083
2960
  });
3084
2961
  invariant10(request.space, void 0, {
3085
- F: __dxlog_file13,
2962
+ F: __dxlog_file12,
3086
2963
  L: 80,
3087
2964
  S: this,
3088
2965
  A: [
@@ -3094,18 +2971,18 @@ var SpaceInvitationProtocol = class {
3094
2971
  if (space.inner.spaceState.getMemberRole(identityKey) !== SpaceMember2.Role.REMOVED) {
3095
2972
  throw new AlreadyJoinedError2();
3096
2973
  }
3097
- log10("writing guest credentials", {
2974
+ log9("writing guest credentials", {
3098
2975
  host: this._signingContext.deviceKey,
3099
2976
  guest: deviceKey
3100
2977
  }, {
3101
- F: __dxlog_file13,
2978
+ F: __dxlog_file12,
3102
2979
  L: 87,
3103
2980
  S: this,
3104
2981
  C: (f, a) => f(...a)
3105
2982
  });
3106
2983
  const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, invitation.role ?? SpaceMember2.Role.ADMIN, space.inner.spaceState.membershipChainHeads, guestProfile, invitation.delegationCredentialId);
3107
2984
  invariant10(credentials[0].credential, void 0, {
3108
- F: __dxlog_file13,
2985
+ F: __dxlog_file12,
3109
2986
  L: 101,
3110
2987
  S: this,
3111
2988
  A: [
@@ -3114,8 +2991,8 @@ var SpaceInvitationProtocol = class {
3114
2991
  ]
3115
2992
  });
3116
2993
  const spaceMemberCredential = credentials[0].credential.credential;
3117
- invariant10(getCredentialAssertion2(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3118
- F: __dxlog_file13,
2994
+ invariant10(getCredentialAssertion(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2995
+ F: __dxlog_file12,
3119
2996
  L: 103,
3120
2997
  S: this,
3121
2998
  A: [
@@ -3133,7 +3010,7 @@ var SpaceInvitationProtocol = class {
3133
3010
  }
3134
3011
  async delegate(invitation) {
3135
3012
  invariant10(this._spaceKey, void 0, {
3136
- F: __dxlog_file13,
3013
+ F: __dxlog_file12,
3137
3014
  L: 116,
3138
3015
  S: this,
3139
3016
  A: [
@@ -3143,7 +3020,7 @@ var SpaceInvitationProtocol = class {
3143
3020
  });
3144
3021
  const space = this._spaceManager.spaces.get(this._spaceKey);
3145
3022
  invariant10(space, void 0, {
3146
- F: __dxlog_file13,
3023
+ F: __dxlog_file12,
3147
3024
  L: 118,
3148
3025
  S: this,
3149
3026
  A: [
@@ -3153,7 +3030,7 @@ var SpaceInvitationProtocol = class {
3153
3030
  });
3154
3031
  if (invitation.authMethod === Invitation5.AuthMethod.KNOWN_PUBLIC_KEY) {
3155
3032
  invariant10(invitation.guestKeypair?.publicKey, void 0, {
3156
- F: __dxlog_file13,
3033
+ F: __dxlog_file12,
3157
3034
  L: 120,
3158
3035
  S: this,
3159
3036
  A: [
@@ -3162,11 +3039,11 @@ var SpaceInvitationProtocol = class {
3162
3039
  ]
3163
3040
  });
3164
3041
  }
3165
- log10("writing delegate space invitation", {
3042
+ log9("writing delegate space invitation", {
3166
3043
  host: this._signingContext.deviceKey,
3167
3044
  id: invitation.invitationId
3168
3045
  }, {
3169
- F: __dxlog_file13,
3046
+ F: __dxlog_file12,
3170
3047
  L: 123,
3171
3048
  S: this,
3172
3049
  C: (f, a) => f(...a)
@@ -3181,7 +3058,7 @@ var SpaceInvitationProtocol = class {
3181
3058
  guestKey: invitation.authMethod === Invitation5.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
3182
3059
  });
3183
3060
  invariant10(credential.credential, void 0, {
3184
- F: __dxlog_file13,
3061
+ F: __dxlog_file12,
3185
3062
  L: 143,
3186
3063
  S: this,
3187
3064
  A: [
@@ -3196,7 +3073,7 @@ var SpaceInvitationProtocol = class {
3196
3073
  }
3197
3074
  async cancelDelegation(invitation) {
3198
3075
  invariant10(this._spaceKey, void 0, {
3199
- F: __dxlog_file13,
3076
+ F: __dxlog_file12,
3200
3077
  L: 149,
3201
3078
  S: this,
3202
3079
  A: [
@@ -3205,7 +3082,7 @@ var SpaceInvitationProtocol = class {
3205
3082
  ]
3206
3083
  });
3207
3084
  invariant10(invitation.type === Invitation5.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
3208
- F: __dxlog_file13,
3085
+ F: __dxlog_file12,
3209
3086
  L: 150,
3210
3087
  S: this,
3211
3088
  A: [
@@ -3215,7 +3092,7 @@ var SpaceInvitationProtocol = class {
3215
3092
  });
3216
3093
  const space = this._spaceManager.spaces.get(this._spaceKey);
3217
3094
  invariant10(space, void 0, {
3218
- F: __dxlog_file13,
3095
+ F: __dxlog_file12,
3219
3096
  L: 152,
3220
3097
  S: this,
3221
3098
  A: [
@@ -3223,18 +3100,18 @@ var SpaceInvitationProtocol = class {
3223
3100
  ""
3224
3101
  ]
3225
3102
  });
3226
- log10("cancelling delegated space invitation", {
3103
+ log9("cancelling delegated space invitation", {
3227
3104
  host: this._signingContext.deviceKey,
3228
3105
  id: invitation.invitationId
3229
3106
  }, {
3230
- F: __dxlog_file13,
3107
+ F: __dxlog_file12,
3231
3108
  L: 154,
3232
3109
  S: this,
3233
3110
  C: (f, a) => f(...a)
3234
3111
  });
3235
3112
  const credential = await createCancelDelegatedSpaceInvitationCredential(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
3236
3113
  invariant10(credential.credential, void 0, {
3237
- F: __dxlog_file13,
3114
+ F: __dxlog_file12,
3238
3115
  L: 161,
3239
3116
  S: this,
3240
3117
  A: [
@@ -3273,7 +3150,7 @@ var SpaceInvitationProtocol = class {
3273
3150
  }
3274
3151
  async accept(response) {
3275
3152
  invariant10(response.space, void 0, {
3276
- F: __dxlog_file13,
3153
+ F: __dxlog_file12,
3277
3154
  L: 196,
3278
3155
  S: this,
3279
3156
  A: [
@@ -3282,9 +3159,9 @@ var SpaceInvitationProtocol = class {
3282
3159
  ]
3283
3160
  });
3284
3161
  const { credential, controlTimeframe, dataTimeframe } = response.space;
3285
- const assertion = getCredentialAssertion2(credential);
3162
+ const assertion = getCredentialAssertion(credential);
3286
3163
  invariant10(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
3287
- F: __dxlog_file13,
3164
+ F: __dxlog_file12,
3288
3165
  L: 199,
3289
3166
  S: this,
3290
3167
  A: [
@@ -3293,7 +3170,7 @@ var SpaceInvitationProtocol = class {
3293
3170
  ]
3294
3171
  });
3295
3172
  invariant10(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
3296
- F: __dxlog_file13,
3173
+ F: __dxlog_file12,
3297
3174
  L: 200,
3298
3175
  S: this,
3299
3176
  A: [
@@ -3325,10 +3202,10 @@ import { generatePasscode } from "@dxos/credentials";
3325
3202
  import { hasInvitationExpired } from "@dxos/echo-pipeline";
3326
3203
  import { invariant as invariant11 } from "@dxos/invariant";
3327
3204
  import { PublicKey as PublicKey8 } from "@dxos/keys";
3328
- import { log as log11 } from "@dxos/log";
3205
+ import { log as log10 } from "@dxos/log";
3329
3206
  import { Invitation as Invitation6 } from "@dxos/protocols/proto/dxos/client/services";
3330
3207
  import { SpaceMember as SpaceMember3 } from "@dxos/protocols/proto/dxos/halo/credentials";
3331
- var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
3208
+ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
3332
3209
  var InvitationsManager = class {
3333
3210
  constructor(_invitationsHandler, _getHandler, _metadataStore) {
3334
3211
  this._invitationsHandler = _invitationsHandler;
@@ -3370,8 +3247,8 @@ var InvitationsManager = class {
3370
3247
  try {
3371
3248
  await this._persistIfRequired(handler, stream, invitation);
3372
3249
  } catch (err) {
3373
- log11.catch(err, void 0, {
3374
- F: __dxlog_file14,
3250
+ log10.catch(err, void 0, {
3251
+ F: __dxlog_file13,
3375
3252
  L: 82,
3376
3253
  S: this,
3377
3254
  C: (f, a) => f(...a)
@@ -3394,7 +3271,7 @@ var InvitationsManager = class {
3394
3271
  const freshInvitations = persistentInvitations.filter((invitation) => !hasInvitationExpired(invitation));
3395
3272
  const loadTasks = freshInvitations.map((persistentInvitation) => {
3396
3273
  invariant11(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
3397
- F: __dxlog_file14,
3274
+ F: __dxlog_file13,
3398
3275
  L: 103,
3399
3276
  S: this,
3400
3277
  A: [
@@ -3412,8 +3289,8 @@ var InvitationsManager = class {
3412
3289
  invitations: cInvitations.map((invitation) => invitation.get())
3413
3290
  };
3414
3291
  } catch (err) {
3415
- log11.catch(err, void 0, {
3416
- F: __dxlog_file14,
3292
+ log10.catch(err, void 0, {
3293
+ F: __dxlog_file13,
3417
3294
  L: 110,
3418
3295
  S: this,
3419
3296
  C: (f, a) => f(...a)
@@ -3444,14 +3321,14 @@ var InvitationsManager = class {
3444
3321
  return invitation;
3445
3322
  }
3446
3323
  async authenticate({ invitationId, authCode }) {
3447
- log11("authenticating...", void 0, {
3448
- F: __dxlog_file14,
3324
+ log10("authenticating...", void 0, {
3325
+ F: __dxlog_file13,
3449
3326
  L: 140,
3450
3327
  S: this,
3451
3328
  C: (f, a) => f(...a)
3452
3329
  });
3453
3330
  invariant11(invitationId, void 0, {
3454
- F: __dxlog_file14,
3331
+ F: __dxlog_file13,
3455
3332
  L: 141,
3456
3333
  S: this,
3457
3334
  A: [
@@ -3461,10 +3338,10 @@ var InvitationsManager = class {
3461
3338
  });
3462
3339
  const observable = this._acceptInvitations.get(invitationId);
3463
3340
  if (!observable) {
3464
- log11.warn("invalid invitation", {
3341
+ log10.warn("invalid invitation", {
3465
3342
  invitationId
3466
3343
  }, {
3467
- F: __dxlog_file14,
3344
+ F: __dxlog_file13,
3468
3345
  L: 144,
3469
3346
  S: this,
3470
3347
  C: (f, a) => f(...a)
@@ -3474,16 +3351,16 @@ var InvitationsManager = class {
3474
3351
  }
3475
3352
  }
3476
3353
  async cancelInvitation({ invitationId }) {
3477
- log11("cancelInvitation...", {
3354
+ log10("cancelInvitation...", {
3478
3355
  invitationId
3479
3356
  }, {
3480
- F: __dxlog_file14,
3357
+ F: __dxlog_file13,
3481
3358
  L: 151,
3482
3359
  S: this,
3483
3360
  C: (f, a) => f(...a)
3484
3361
  });
3485
3362
  invariant11(invitationId, void 0, {
3486
- F: __dxlog_file14,
3363
+ F: __dxlog_file13,
3487
3364
  L: 152,
3488
3365
  S: this,
3489
3366
  A: [
@@ -3559,10 +3436,10 @@ var InvitationsManager = class {
3559
3436
  }
3560
3437
  });
3561
3438
  ctx.onDispose(() => {
3562
- log11("complete", {
3439
+ log10("complete", {
3563
3440
  ...handler.toJSON()
3564
3441
  }, {
3565
- F: __dxlog_file14,
3442
+ F: __dxlog_file13,
3566
3443
  L: 241,
3567
3444
  S: this,
3568
3445
  C: (f, a) => f(...a)
@@ -3592,10 +3469,10 @@ var InvitationsManager = class {
3592
3469
  const ctx = new Context6({
3593
3470
  onError: (err) => {
3594
3471
  if (err instanceof TimeoutError2) {
3595
- log11("timeout", {
3472
+ log10("timeout", {
3596
3473
  ...handler.toJSON()
3597
3474
  }, {
3598
- F: __dxlog_file14,
3475
+ F: __dxlog_file13,
3599
3476
  L: 261,
3600
3477
  S: this,
3601
3478
  C: (f, a) => f(...a)
@@ -3605,8 +3482,8 @@ var InvitationsManager = class {
3605
3482
  state: Invitation6.State.TIMEOUT
3606
3483
  });
3607
3484
  } else {
3608
- log11.warn("auth failed", err, {
3609
- F: __dxlog_file14,
3485
+ log10.warn("auth failed", err, {
3486
+ F: __dxlog_file13,
3610
3487
  L: 264,
3611
3488
  S: this,
3612
3489
  C: (f, a) => f(...a)
@@ -3620,10 +3497,10 @@ var InvitationsManager = class {
3620
3497
  }
3621
3498
  });
3622
3499
  ctx.onDispose(() => {
3623
- log11("complete", {
3500
+ log10("complete", {
3624
3501
  ...handler.toJSON()
3625
3502
  }, {
3626
- F: __dxlog_file14,
3503
+ F: __dxlog_file13,
3627
3504
  L: 271,
3628
3505
  S: this,
3629
3506
  C: (f, a) => f(...a)
@@ -3667,8 +3544,8 @@ var InvitationsManager = class {
3667
3544
  try {
3668
3545
  await this._metadataStore.removeInvitation(invitation.invitationId);
3669
3546
  } catch (err) {
3670
- log11.catch(err, void 0, {
3671
- F: __dxlog_file14,
3547
+ log10.catch(err, void 0, {
3548
+ F: __dxlog_file13,
3672
3549
  L: 307,
3673
3550
  S: this,
3674
3551
  C: (f, a) => f(...a)
@@ -3691,11 +3568,11 @@ import { AutomergeDocumentLoaderImpl, createIdFromSpaceKey, createMappedFeedWrit
3691
3568
  import { TYPE_PROPERTIES } from "@dxos/echo-schema";
3692
3569
  import { failedInvariant, invariant as invariant13 } from "@dxos/invariant";
3693
3570
  import { PublicKey as PublicKey10 } from "@dxos/keys";
3694
- import { log as log13 } from "@dxos/log";
3571
+ import { log as log12 } from "@dxos/log";
3695
3572
  import { CancelledError, SystemError } from "@dxos/protocols";
3696
- import { CreateEpochRequest, SpaceState as SpaceState2 } from "@dxos/protocols/proto/dxos/client/services";
3573
+ import { CreateEpochRequest, SpaceState } from "@dxos/protocols/proto/dxos/client/services";
3697
3574
  import { AdmittedFeed as AdmittedFeed3, SpaceMember as SpaceMember4 } from "@dxos/protocols/proto/dxos/halo/credentials";
3698
- import { Timeframe as Timeframe3 } from "@dxos/timeframe";
3575
+ import { Timeframe as Timeframe2 } from "@dxos/timeframe";
3699
3576
  import { trace as trace6 } from "@dxos/tracing";
3700
3577
  import { ComplexSet as ComplexSet5, assignDeep } from "@dxos/util";
3701
3578
 
@@ -3742,11 +3619,11 @@ import { DeferredTask, Event as Event5, scheduleTask as scheduleTask4, sleep, Ti
3742
3619
  import { Context as Context7, rejectOnDispose } from "@dxos/context";
3743
3620
  import { invariant as invariant12 } from "@dxos/invariant";
3744
3621
  import { PublicKey as PublicKey9 } from "@dxos/keys";
3745
- import { log as log12 } from "@dxos/log";
3622
+ import { log as log11 } from "@dxos/log";
3746
3623
  import { schema as schema4 } from "@dxos/protocols";
3747
3624
  import { RpcExtension as RpcExtension3 } from "@dxos/teleport";
3748
3625
  import { ComplexMap as ComplexMap2, ComplexSet as ComplexSet4, entry } from "@dxos/util";
3749
- var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
3626
+ var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
3750
3627
  var DEFAULT_RETRY_TIMEOUT = 1e3;
3751
3628
  var DEFAULT_SUCCESS_DELAY = 1e3;
3752
3629
  var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
@@ -3771,16 +3648,16 @@ var NotarizationPlugin = class {
3771
3648
  * Request credentials to be notarized.
3772
3649
  */
3773
3650
  async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY }) {
3774
- log12("notarize", {
3651
+ log11("notarize", {
3775
3652
  credentials
3776
3653
  }, {
3777
- F: __dxlog_file15,
3654
+ F: __dxlog_file14,
3778
3655
  L: 90,
3779
3656
  S: this,
3780
3657
  C: (f, a) => f(...a)
3781
3658
  });
3782
3659
  invariant12(credentials.every((credential) => credential.id), "Credentials must have an id", {
3783
- F: __dxlog_file15,
3660
+ F: __dxlog_file14,
3784
3661
  L: 91,
3785
3662
  S: this,
3786
3663
  A: [
@@ -3791,10 +3668,10 @@ var NotarizationPlugin = class {
3791
3668
  const errors = new Trigger6();
3792
3669
  const ctx = this._ctx.derive({
3793
3670
  onError: (err) => {
3794
- log12.warn("Notarization error", {
3671
+ log11.warn("Notarization error", {
3795
3672
  err
3796
3673
  }, {
3797
- F: __dxlog_file15,
3674
+ F: __dxlog_file14,
3798
3675
  L: 99,
3799
3676
  S: this,
3800
3677
  C: (f, a) => f(...a)
@@ -3806,11 +3683,11 @@ var NotarizationPlugin = class {
3806
3683
  opCtx?.onDispose(() => ctx.dispose());
3807
3684
  if (timeout !== 0) {
3808
3685
  scheduleTask4(ctx, () => {
3809
- log12.warn("Notarization timeout", {
3686
+ log11.warn("Notarization timeout", {
3810
3687
  timeout,
3811
3688
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
3812
3689
  }, {
3813
- F: __dxlog_file15,
3690
+ F: __dxlog_file14,
3814
3691
  L: 111,
3815
3692
  S: this,
3816
3693
  C: (f, a) => f(...a)
@@ -3830,10 +3707,10 @@ var NotarizationPlugin = class {
3830
3707
  ...this._extensions
3831
3708
  ].find((peer2) => !peersTried.has(peer2));
3832
3709
  if (!peer) {
3833
- log12.info("Exhausted all peers to notarize with", {
3710
+ log11.info("Exhausted all peers to notarize with", {
3834
3711
  retryIn: retryTimeout
3835
3712
  }, {
3836
- F: __dxlog_file15,
3713
+ F: __dxlog_file14,
3837
3714
  L: 136,
3838
3715
  S: this,
3839
3716
  C: (f, a) => f(...a)
@@ -3843,11 +3720,11 @@ var NotarizationPlugin = class {
3843
3720
  return;
3844
3721
  }
3845
3722
  peersTried.add(peer);
3846
- log12("try notarizing", {
3723
+ log11("try notarizing", {
3847
3724
  peer: peer.localPeerId,
3848
3725
  credentialId: credentials.map((credential) => credential.id)
3849
3726
  }, {
3850
- F: __dxlog_file15,
3727
+ F: __dxlog_file14,
3851
3728
  L: 143,
3852
3729
  S: this,
3853
3730
  C: (f, a) => f(...a)
@@ -3855,8 +3732,8 @@ var NotarizationPlugin = class {
3855
3732
  await peer.rpc.NotarizationService.notarize({
3856
3733
  credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
3857
3734
  });
3858
- log12("success", void 0, {
3859
- F: __dxlog_file15,
3735
+ log11("success", void 0, {
3736
+ F: __dxlog_file14,
3860
3737
  L: 147,
3861
3738
  S: this,
3862
3739
  C: (f, a) => f(...a)
@@ -3864,8 +3741,8 @@ var NotarizationPlugin = class {
3864
3741
  await sleep(successDelay);
3865
3742
  } catch (err) {
3866
3743
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
3867
- log12.info("error notarizing (recoverable)", err, {
3868
- F: __dxlog_file15,
3744
+ log11.info("error notarizing (recoverable)", err, {
3745
+ F: __dxlog_file14,
3869
3746
  L: 151,
3870
3747
  S: this,
3871
3748
  C: (f, a) => f(...a)
@@ -3882,8 +3759,8 @@ var NotarizationPlugin = class {
3882
3759
  allNotarized,
3883
3760
  errors.wait()
3884
3761
  ]);
3885
- log12("done", void 0, {
3886
- F: __dxlog_file15,
3762
+ log11("done", void 0, {
3763
+ F: __dxlog_file14,
3887
3764
  L: 162,
3888
3765
  S: this,
3889
3766
  C: (f, a) => f(...a)
@@ -3905,7 +3782,7 @@ var NotarizationPlugin = class {
3905
3782
  }
3906
3783
  setWriter(writer) {
3907
3784
  invariant12(!this._writer, "Writer already set.", {
3908
- F: __dxlog_file15,
3785
+ F: __dxlog_file14,
3909
3786
  L: 181,
3910
3787
  S: this,
3911
3788
  A: [
@@ -3930,7 +3807,7 @@ var NotarizationPlugin = class {
3930
3807
  }
3931
3808
  for (const credential of request.credentials ?? []) {
3932
3809
  invariant12(credential.id, "Credential must have an id", {
3933
- F: __dxlog_file15,
3810
+ F: __dxlog_file14,
3934
3811
  L: 200,
3935
3812
  S: this,
3936
3813
  A: [
@@ -3947,10 +3824,10 @@ var NotarizationPlugin = class {
3947
3824
  createExtension() {
3948
3825
  const extension = new NotarizationTeleportExtension({
3949
3826
  onOpen: async () => {
3950
- log12("extension opened", {
3827
+ log11("extension opened", {
3951
3828
  peer: extension.localPeerId
3952
3829
  }, {
3953
- F: __dxlog_file15,
3830
+ F: __dxlog_file14,
3954
3831
  L: 211,
3955
3832
  S: this,
3956
3833
  C: (f, a) => f(...a)
@@ -3959,10 +3836,10 @@ var NotarizationPlugin = class {
3959
3836
  this._extensionOpened.emit();
3960
3837
  },
3961
3838
  onClose: async () => {
3962
- log12("extension closed", {
3839
+ log11("extension closed", {
3963
3840
  peer: extension.localPeerId
3964
3841
  }, {
3965
- F: __dxlog_file15,
3842
+ F: __dxlog_file14,
3966
3843
  L: 216,
3967
3844
  S: this,
3968
3845
  C: (f, a) => f(...a)
@@ -4016,7 +3893,7 @@ function _ts_decorate4(decorators, target, key, desc) {
4016
3893
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4017
3894
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4018
3895
  }
4019
- var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
3896
+ var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
4020
3897
  var DataSpace = class {
4021
3898
  constructor(params) {
4022
3899
  this._ctx = new Context8();
@@ -4024,7 +3901,7 @@ var DataSpace = class {
4024
3901
  this._cache = void 0;
4025
3902
  // TODO(dmaretskyi): Move into Space?
4026
3903
  this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
4027
- this._state = SpaceState2.CLOSED;
3904
+ this._state = SpaceState.CLOSED;
4028
3905
  /**
4029
3906
  * Error for _state === SpaceState.ERROR.
4030
3907
  */
@@ -4048,10 +3925,10 @@ var DataSpace = class {
4048
3925
  });
4049
3926
  this._cache = params.cache;
4050
3927
  this._state = params.initialState;
4051
- log13("new state", {
4052
- state: SpaceState2[this._state]
3928
+ log12("new state", {
3929
+ state: SpaceState[this._state]
4053
3930
  }, {
4054
- F: __dxlog_file16,
3931
+ F: __dxlog_file15,
4055
3932
  L: 143,
4056
3933
  S: this,
4057
3934
  C: (f, a) => f(...a)
@@ -4092,23 +3969,20 @@ var DataSpace = class {
4092
3969
  };
4093
3970
  }
4094
3971
  async open() {
4095
- if (this._state === SpaceState2.CLOSED) {
4096
- await this._open();
4097
- }
3972
+ await this._open();
4098
3973
  }
4099
3974
  async _open() {
4100
- await this._presence.open();
4101
3975
  await this._gossip.open();
4102
3976
  await this._notarizationPlugin.open();
4103
3977
  await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
4104
3978
  await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
4105
3979
  await this._inner.open(new Context8());
4106
- this._state = SpaceState2.CONTROL_ONLY;
4107
- log13("new state", {
4108
- state: SpaceState2[this._state]
3980
+ this._state = SpaceState.CONTROL_ONLY;
3981
+ log12("new state", {
3982
+ state: SpaceState[this._state]
4109
3983
  }, {
4110
- F: __dxlog_file16,
4111
- L: 209,
3984
+ F: __dxlog_file15,
3985
+ L: 206,
4112
3986
  S: this,
4113
3987
  C: (f, a) => f(...a)
4114
3988
  });
@@ -4121,12 +3995,12 @@ var DataSpace = class {
4121
3995
  }
4122
3996
  async _close() {
4123
3997
  await this._callbacks.beforeClose?.();
4124
- this._state = SpaceState2.CLOSED;
4125
- log13("new state", {
4126
- state: SpaceState2[this._state]
3998
+ this._state = SpaceState.CLOSED;
3999
+ log12("new state", {
4000
+ state: SpaceState[this._state]
4127
4001
  }, {
4128
- F: __dxlog_file16,
4129
- L: 223,
4002
+ F: __dxlog_file15,
4003
+ L: 220,
4130
4004
  S: this,
4131
4005
  C: (f, a) => f(...a)
4132
4006
  });
@@ -4137,7 +4011,7 @@ var DataSpace = class {
4137
4011
  await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
4138
4012
  await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
4139
4013
  await this._notarizationPlugin.close();
4140
- await this._presence.close();
4014
+ await this._presence.destroy();
4141
4015
  await this._gossip.close();
4142
4016
  }
4143
4017
  async postMessage(channel, message) {
@@ -4156,26 +4030,26 @@ var DataSpace = class {
4156
4030
  await this.initializeDataPipeline();
4157
4031
  } catch (err) {
4158
4032
  if (err instanceof CancelledError || err instanceof ContextDisposedError3) {
4159
- log13("data pipeline initialization cancelled", err, {
4160
- F: __dxlog_file16,
4161
- L: 256,
4033
+ log12("data pipeline initialization cancelled", err, {
4034
+ F: __dxlog_file15,
4035
+ L: 253,
4162
4036
  S: this,
4163
4037
  C: (f, a) => f(...a)
4164
4038
  });
4165
4039
  return;
4166
4040
  }
4167
- log13.error("Error initializing data pipeline", err, {
4168
- F: __dxlog_file16,
4169
- L: 260,
4041
+ log12.error("Error initializing data pipeline", err, {
4042
+ F: __dxlog_file15,
4043
+ L: 257,
4170
4044
  S: this,
4171
4045
  C: (f, a) => f(...a)
4172
4046
  });
4173
- this._state = SpaceState2.ERROR;
4174
- log13("new state", {
4175
- state: SpaceState2[this._state]
4047
+ this._state = SpaceState.ERROR;
4048
+ log12("new state", {
4049
+ state: SpaceState[this._state]
4176
4050
  }, {
4177
- F: __dxlog_file16,
4178
- L: 262,
4051
+ F: __dxlog_file15,
4052
+ L: 259,
4179
4053
  S: this,
4180
4054
  C: (f, a) => f(...a)
4181
4055
  });
@@ -4187,15 +4061,15 @@ var DataSpace = class {
4187
4061
  });
4188
4062
  }
4189
4063
  async initializeDataPipeline() {
4190
- if (this._state !== SpaceState2.CONTROL_ONLY) {
4064
+ if (this._state !== SpaceState.CONTROL_ONLY) {
4191
4065
  throw new SystemError("Invalid operation");
4192
4066
  }
4193
- this._state = SpaceState2.INITIALIZING;
4194
- log13("new state", {
4195
- state: SpaceState2[this._state]
4067
+ this._state = SpaceState.INITIALIZING;
4068
+ log12("new state", {
4069
+ state: SpaceState[this._state]
4196
4070
  }, {
4197
- F: __dxlog_file16,
4198
- L: 278,
4071
+ F: __dxlog_file15,
4072
+ L: 275,
4199
4073
  S: this,
4200
4074
  C: (f, a) => f(...a)
4201
4075
  });
@@ -4203,19 +4077,19 @@ var DataSpace = class {
4203
4077
  await sleep2(1);
4204
4078
  this._automergeSpaceState.startProcessingRootDocs();
4205
4079
  await cancelWithContext4(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
4206
- log13("data pipeline ready", void 0, {
4207
- F: __dxlog_file16,
4208
- L: 290,
4080
+ log12("data pipeline ready", void 0, {
4081
+ F: __dxlog_file15,
4082
+ L: 287,
4209
4083
  S: this,
4210
4084
  C: (f, a) => f(...a)
4211
4085
  });
4212
4086
  await this._callbacks.beforeReady?.();
4213
- this._state = SpaceState2.READY;
4214
- log13("new state", {
4215
- state: SpaceState2[this._state]
4087
+ this._state = SpaceState.READY;
4088
+ log12("new state", {
4089
+ state: SpaceState[this._state]
4216
4090
  }, {
4217
- F: __dxlog_file16,
4218
- L: 294,
4091
+ F: __dxlog_file15,
4092
+ L: 291,
4219
4093
  S: this,
4220
4094
  C: (f, a) => f(...a)
4221
4095
  });
@@ -4229,9 +4103,9 @@ var DataSpace = class {
4229
4103
  });
4230
4104
  this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
4231
4105
  await this._createWritableFeeds();
4232
- log13("writable feeds created", void 0, {
4233
- F: __dxlog_file16,
4234
- L: 310,
4106
+ log12("writable feeds created", void 0, {
4107
+ F: __dxlog_file15,
4108
+ L: 307,
4235
4109
  S: this,
4236
4110
  C: (f, a) => f(...a)
4237
4111
  });
@@ -4289,12 +4163,12 @@ var DataSpace = class {
4289
4163
  }
4290
4164
  }
4291
4165
  _onNewAutomergeRoot(rootUrl) {
4292
- log13("loading automerge root doc for space", {
4166
+ log12("loading automerge root doc for space", {
4293
4167
  space: this.key,
4294
4168
  rootUrl
4295
4169
  }, {
4296
- F: __dxlog_file16,
4297
- L: 376,
4170
+ F: __dxlog_file15,
4171
+ L: 373,
4298
4172
  S: this,
4299
4173
  C: (f, a) => f(...a)
4300
4174
  });
@@ -4319,12 +4193,12 @@ var DataSpace = class {
4319
4193
  if (!this._echoHost.roots.has(handle.documentId)) {
4320
4194
  await this._echoHost.openSpaceRoot(handle.url);
4321
4195
  } else {
4322
- log13.warn("echo database root already exists", {
4196
+ log12.warn("echo database root already exists", {
4323
4197
  space: this.key,
4324
4198
  rootUrl
4325
4199
  }, {
4326
- F: __dxlog_file16,
4327
- L: 403,
4200
+ F: __dxlog_file15,
4201
+ L: 400,
4328
4202
  S: this,
4329
4203
  C: (f, a) => f(...a)
4330
4204
  });
@@ -4333,13 +4207,13 @@ var DataSpace = class {
4333
4207
  if (err instanceof ContextDisposedError3) {
4334
4208
  return;
4335
4209
  }
4336
- log13.warn("error loading automerge root doc", {
4210
+ log12.warn("error loading automerge root doc", {
4337
4211
  space: this.key,
4338
4212
  rootUrl,
4339
4213
  err
4340
4214
  }, {
4341
- F: __dxlog_file16,
4342
- L: 409,
4215
+ F: __dxlog_file15,
4216
+ L: 406,
4343
4217
  S: this,
4344
4218
  C: (f, a) => f(...a)
4345
4219
  });
@@ -4370,7 +4244,7 @@ var DataSpace = class {
4370
4244
  epoch = {
4371
4245
  previousId: this._automergeSpaceState.lastEpoch?.id,
4372
4246
  number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
4373
- timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe3(),
4247
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe2(),
4374
4248
  automergeRoot: this._automergeSpaceState.lastEpoch?.subject.assertion?.automergeRoot
4375
4249
  };
4376
4250
  }
@@ -4381,7 +4255,7 @@ var DataSpace = class {
4381
4255
  epoch = {
4382
4256
  previousId: this._automergeSpaceState.lastEpoch?.id,
4383
4257
  number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
4384
- timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe3(),
4258
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe2(),
4385
4259
  automergeRoot: document.url
4386
4260
  };
4387
4261
  }
@@ -4392,12 +4266,9 @@ var DataSpace = class {
4392
4266
  const rootHandle = this._echoHost.automergeRepo.find(currentRootUrl);
4393
4267
  await cancelWithContext4(this._ctx, asyncTimeout2(rootHandle.whenReady(), 1e4));
4394
4268
  const newRoot = this._echoHost.automergeRepo.create(rootHandle.docSync());
4395
- await this._echoHost.automergeRepo.flush([
4396
- newRoot.documentId
4397
- ]);
4398
4269
  invariant13(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
4399
- F: __dxlog_file16,
4400
- L: 460,
4270
+ F: __dxlog_file15,
4271
+ L: 456,
4401
4272
  S: this,
4402
4273
  A: [
4403
4274
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
@@ -4407,16 +4278,16 @@ var DataSpace = class {
4407
4278
  epoch = {
4408
4279
  previousId: this._automergeSpaceState.lastEpoch?.id,
4409
4280
  number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
4410
- timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe3(),
4281
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe2(),
4411
4282
  automergeRoot: newRoot.url
4412
4283
  };
4413
4284
  }
4414
4285
  break;
4415
4286
  case CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT:
4416
4287
  {
4417
- log13.info("Fragmenting", void 0, {
4418
- F: __dxlog_file16,
4419
- L: 472,
4288
+ log12.info("Fragmenting", void 0, {
4289
+ F: __dxlog_file15,
4290
+ L: 468,
4420
4291
  S: this,
4421
4292
  C: (f, a) => f(...a)
4422
4293
  });
@@ -4427,8 +4298,8 @@ var DataSpace = class {
4427
4298
  const properties = findPropertiesObject(rootHandle.docSync());
4428
4299
  const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
4429
4300
  invariant13(properties, "Properties not found", {
4430
- F: __dxlog_file16,
4431
- L: 482,
4301
+ F: __dxlog_file15,
4302
+ L: 478,
4432
4303
  S: this,
4433
4304
  A: [
4434
4305
  "properties",
@@ -4443,8 +4314,8 @@ var DataSpace = class {
4443
4314
  };
4444
4315
  const newRoot = this._echoHost.automergeRepo.create(newSpaceDoc);
4445
4316
  invariant13(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
4446
- F: __dxlog_file16,
4447
- L: 487,
4317
+ F: __dxlog_file15,
4318
+ L: 483,
4448
4319
  S: this,
4449
4320
  A: [
4450
4321
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
@@ -4467,7 +4338,7 @@ var DataSpace = class {
4467
4338
  epoch = {
4468
4339
  previousId: this._automergeSpaceState.lastEpoch?.id,
4469
4340
  number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
4470
- timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe3(),
4341
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe2(),
4471
4342
  automergeRoot: newRoot.url
4472
4343
  };
4473
4344
  }
@@ -4475,8 +4346,8 @@ var DataSpace = class {
4475
4346
  case CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT:
4476
4347
  {
4477
4348
  invariant13(options.newAutomergeRoot, void 0, {
4478
- F: __dxlog_file16,
4479
- L: 517,
4349
+ F: __dxlog_file15,
4350
+ L: 513,
4480
4351
  S: this,
4481
4352
  A: [
4482
4353
  "options.newAutomergeRoot",
@@ -4486,7 +4357,7 @@ var DataSpace = class {
4486
4357
  epoch = {
4487
4358
  previousId: this._automergeSpaceState.lastEpoch?.id,
4488
4359
  number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
4489
- timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe3(),
4360
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe2(),
4490
4361
  automergeRoot: options.newAutomergeRoot
4491
4362
  };
4492
4363
  }
@@ -4506,7 +4377,7 @@ var DataSpace = class {
4506
4377
  })
4507
4378
  }
4508
4379
  });
4509
- await this.inner.controlPipeline.state.waitUntilTimeframe(new Timeframe3([
4380
+ await this.inner.controlPipeline.state.waitUntilTimeframe(new Timeframe2([
4510
4381
  [
4511
4382
  receipt.feedKey,
4512
4383
  receipt.seq
@@ -4515,30 +4386,25 @@ var DataSpace = class {
4515
4386
  await this._echoHost.updateIndexes();
4516
4387
  }
4517
4388
  async activate() {
4518
- if (![
4519
- SpaceState2.CLOSED,
4520
- SpaceState2.INACTIVE
4521
- ].includes(this._state)) {
4389
+ if (this._state !== SpaceState.INACTIVE) {
4522
4390
  return;
4523
4391
  }
4524
- await this._metadataStore.setSpaceState(this.key, SpaceState2.ACTIVE);
4392
+ await this._metadataStore.setSpaceState(this.key, SpaceState.ACTIVE);
4525
4393
  await this._open();
4526
4394
  this.initializeDataPipelineAsync();
4527
4395
  }
4528
4396
  async deactivate() {
4529
- if (this._state === SpaceState2.INACTIVE) {
4397
+ if (this._state === SpaceState.INACTIVE) {
4530
4398
  return;
4531
4399
  }
4532
- await this._metadataStore.setSpaceState(this.key, SpaceState2.INACTIVE);
4533
- if (this._state !== SpaceState2.CLOSED) {
4534
- await this._close();
4535
- }
4536
- this._state = SpaceState2.INACTIVE;
4537
- log13("new state", {
4538
- state: SpaceState2[this._state]
4400
+ await this._metadataStore.setSpaceState(this.key, SpaceState.INACTIVE);
4401
+ await this._close();
4402
+ this._state = SpaceState.INACTIVE;
4403
+ log12("new state", {
4404
+ state: SpaceState[this._state]
4539
4405
  }, {
4540
- F: __dxlog_file16,
4541
- L: 571,
4406
+ F: __dxlog_file15,
4407
+ L: 566,
4542
4408
  S: this,
4543
4409
  C: (f, a) => f(...a)
4544
4410
  });
@@ -4556,7 +4422,7 @@ _ts_decorate4([
4556
4422
  ], DataSpace.prototype, "key", null);
4557
4423
  _ts_decorate4([
4558
4424
  trace6.info({
4559
- enum: SpaceState2
4425
+ enum: SpaceState
4560
4426
  })
4561
4427
  ], DataSpace.prototype, "state", null);
4562
4428
  _ts_decorate4([
@@ -4608,27 +4474,24 @@ var findPropertiesObject = (spaceDoc) => {
4608
4474
 
4609
4475
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
4610
4476
  import { Event as Event7, synchronized as synchronized2, trackLeaks as trackLeaks2 } from "@dxos/async";
4611
- import { PropertiesType } from "@dxos/client-protocol";
4612
4477
  import { cancelWithContext as cancelWithContext5, Context as Context9 } from "@dxos/context";
4613
- import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
4478
+ import { getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
4614
4479
  import { AuthStatus } from "@dxos/echo-pipeline";
4615
- import { encodeReference } from "@dxos/echo-protocol";
4616
- import { getTypeReference } from "@dxos/echo-schema";
4617
4480
  import { invariant as invariant14 } from "@dxos/invariant";
4618
4481
  import { PublicKey as PublicKey11 } from "@dxos/keys";
4619
- import { log as log14 } from "@dxos/log";
4482
+ import { log as log13 } from "@dxos/log";
4620
4483
  import { trace as Trace2 } from "@dxos/protocols";
4621
- import { Invitation as Invitation7, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
4484
+ import { Invitation as Invitation7, SpaceState as SpaceState2 } from "@dxos/protocols/proto/dxos/client/services";
4622
4485
  import { SpaceMember as SpaceMember6 } from "@dxos/protocols/proto/dxos/halo/credentials";
4623
4486
  import { Gossip as Gossip2, Presence as Presence2 } from "@dxos/teleport-extension-gossip";
4624
4487
  import { trace as trace7 } from "@dxos/tracing";
4625
- import { assignDeep as assignDeep2, ComplexMap as ComplexMap3, deferFunction as deferFunction2, forEachAsync } from "@dxos/util";
4488
+ import { ComplexMap as ComplexMap3, deferFunction as deferFunction2, forEachAsync } from "@dxos/util";
4626
4489
 
4627
4490
  // packages/sdk/client-services/src/packlets/spaces/genesis.ts
4628
4491
  import { createCredential } from "@dxos/credentials";
4629
4492
  import { failUndefined } from "@dxos/debug";
4630
4493
  import { AdmittedFeed as AdmittedFeed4, SpaceMember as SpaceMember5 } from "@dxos/protocols/proto/dxos/halo/credentials";
4631
- import { Timeframe as Timeframe4 } from "@dxos/timeframe";
4494
+ import { Timeframe as Timeframe3 } from "@dxos/timeframe";
4632
4495
  var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4633
4496
  const credentials = [
4634
4497
  await createCredential({
@@ -4678,7 +4541,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4678
4541
  "@type": "dxos.halo.credentials.Epoch",
4679
4542
  number: 0,
4680
4543
  previousId: void 0,
4681
- timeframe: new Timeframe4(),
4544
+ timeframe: new Timeframe3(),
4682
4545
  snapshotCid: void 0,
4683
4546
  automergeRoot
4684
4547
  }
@@ -4705,12 +4568,11 @@ function _ts_decorate5(decorators, target, key, desc) {
4705
4568
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4706
4569
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4707
4570
  }
4708
- var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
4571
+ var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
4709
4572
  var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
4710
4573
  var PRESENCE_OFFLINE_TIMEOUT = 2e4;
4711
- var DEFAULT_SPACE_KEY = "__DEFAULT__";
4712
4574
  var DataSpaceManager = class {
4713
- constructor(_spaceManager, _metadataStore, _keyring, _signingContext, _feedStore, _echoHost, _invitationsManager, _params) {
4575
+ constructor(_spaceManager, _metadataStore, _keyring, _signingContext, _feedStore, _echoHost, _invitationsManager, params) {
4714
4576
  this._spaceManager = _spaceManager;
4715
4577
  this._metadataStore = _metadataStore;
4716
4578
  this._keyring = _keyring;
@@ -4718,12 +4580,14 @@ var DataSpaceManager = class {
4718
4580
  this._feedStore = _feedStore;
4719
4581
  this._echoHost = _echoHost;
4720
4582
  this._invitationsManager = _invitationsManager;
4721
- this._params = _params;
4722
4583
  this._ctx = new Context9();
4723
4584
  this.updated = new Event7();
4724
4585
  this._spaces = new ComplexMap3(PublicKey11.hash);
4725
4586
  this._isOpen = false;
4726
4587
  this._instanceId = PublicKey11.random().toHex();
4588
+ const { spaceMemberPresenceAnnounceInterval = PRESENCE_ANNOUNCE_INTERVAL, spaceMemberPresenceOfflineTimeout = PRESENCE_OFFLINE_TIMEOUT } = params ?? {};
4589
+ this._spaceMemberPresenceAnnounceInterval = spaceMemberPresenceAnnounceInterval;
4590
+ this._spaceMemberPresenceOfflineTimeout = spaceMemberPresenceOfflineTimeout;
4727
4591
  trace7.diagnostic({
4728
4592
  id: "spaces",
4729
4593
  name: "Spaces",
@@ -4735,7 +4599,7 @@ var DataSpaceManager = class {
4735
4599
  const properties = rootDoc && findPropertiesObject(rootDoc);
4736
4600
  return {
4737
4601
  key: space.key.toHex(),
4738
- state: SpaceState3[space.state],
4602
+ state: SpaceState2[space.state],
4739
4603
  name: properties?.[1].data.name ?? null,
4740
4604
  inlineObjects: rootDoc ? Object.keys(rootDoc.objects ?? {}).length : null,
4741
4605
  linkedObjects: rootDoc ? Object.keys(rootDoc.links ?? {}).length : null,
@@ -4752,46 +4616,46 @@ var DataSpaceManager = class {
4752
4616
  return this._spaces;
4753
4617
  }
4754
4618
  async open() {
4755
- log14("open", void 0, {
4756
- F: __dxlog_file17,
4757
- L: 140,
4619
+ log13("open", void 0, {
4620
+ F: __dxlog_file16,
4621
+ L: 144,
4758
4622
  S: this,
4759
4623
  C: (f, a) => f(...a)
4760
4624
  });
4761
- log14.trace("dxos.echo.data-space-manager.open", Trace2.begin({
4625
+ log13.trace("dxos.echo.data-space-manager.open", Trace2.begin({
4762
4626
  id: this._instanceId
4763
4627
  }), {
4764
- F: __dxlog_file17,
4765
- L: 141,
4628
+ F: __dxlog_file16,
4629
+ L: 145,
4766
4630
  S: this,
4767
4631
  C: (f, a) => f(...a)
4768
4632
  });
4769
- log14("metadata loaded", {
4633
+ log13("metadata loaded", {
4770
4634
  spaces: this._metadataStore.spaces.length
4771
4635
  }, {
4772
- F: __dxlog_file17,
4773
- L: 142,
4636
+ F: __dxlog_file16,
4637
+ L: 146,
4774
4638
  S: this,
4775
4639
  C: (f, a) => f(...a)
4776
4640
  });
4777
4641
  await forEachAsync(this._metadataStore.spaces, async (spaceMetadata) => {
4778
4642
  try {
4779
- log14("load space", {
4643
+ log13("load space", {
4780
4644
  spaceMetadata
4781
4645
  }, {
4782
- F: __dxlog_file17,
4783
- L: 146,
4646
+ F: __dxlog_file16,
4647
+ L: 150,
4784
4648
  S: this,
4785
4649
  C: (f, a) => f(...a)
4786
4650
  });
4787
4651
  await this._constructSpace(spaceMetadata);
4788
4652
  } catch (err) {
4789
- log14.error("Error loading space", {
4653
+ log13.error("Error loading space", {
4790
4654
  spaceMetadata,
4791
4655
  err
4792
4656
  }, {
4793
- F: __dxlog_file17,
4794
- L: 149,
4657
+ F: __dxlog_file16,
4658
+ L: 153,
4795
4659
  S: this,
4796
4660
  C: (f, a) => f(...a)
4797
4661
  });
@@ -4799,19 +4663,24 @@ var DataSpaceManager = class {
4799
4663
  });
4800
4664
  this._isOpen = true;
4801
4665
  this.updated.emit();
4802
- log14.trace("dxos.echo.data-space-manager.open", Trace2.end({
4666
+ for (const space of this._spaces.values()) {
4667
+ if (space.state !== SpaceState2.INACTIVE) {
4668
+ space.initializeDataPipelineAsync();
4669
+ }
4670
+ }
4671
+ log13.trace("dxos.echo.data-space-manager.open", Trace2.end({
4803
4672
  id: this._instanceId
4804
4673
  }), {
4805
- F: __dxlog_file17,
4806
- L: 156,
4674
+ F: __dxlog_file16,
4675
+ L: 166,
4807
4676
  S: this,
4808
4677
  C: (f, a) => f(...a)
4809
4678
  });
4810
4679
  }
4811
4680
  async close() {
4812
- log14("close", void 0, {
4813
- F: __dxlog_file17,
4814
- L: 161,
4681
+ log13("close", void 0, {
4682
+ F: __dxlog_file16,
4683
+ L: 171,
4815
4684
  S: this,
4816
4685
  C: (f, a) => f(...a)
4817
4686
  });
@@ -4820,15 +4689,14 @@ var DataSpaceManager = class {
4820
4689
  for (const space of this._spaces.values()) {
4821
4690
  await space.close();
4822
4691
  }
4823
- this._spaces.clear();
4824
4692
  }
4825
4693
  /**
4826
4694
  * Creates a new space writing the genesis credentials to the control feed.
4827
4695
  */
4828
4696
  async createSpace() {
4829
4697
  invariant14(this._isOpen, "Not open.", {
4830
- F: __dxlog_file17,
4831
- L: 175,
4698
+ F: __dxlog_file16,
4699
+ L: 184,
4832
4700
  S: this,
4833
4701
  A: [
4834
4702
  "this._isOpen",
@@ -4843,25 +4711,24 @@ var DataSpaceManager = class {
4843
4711
  genesisFeedKey: controlFeedKey,
4844
4712
  controlFeedKey,
4845
4713
  dataFeedKey,
4846
- state: SpaceState3.ACTIVE
4714
+ state: SpaceState2.ACTIVE
4847
4715
  };
4848
- log14("creating space...", {
4716
+ log13("creating space...", {
4849
4717
  spaceKey
4850
4718
  }, {
4851
- F: __dxlog_file17,
4852
- L: 187,
4719
+ F: __dxlog_file16,
4720
+ L: 196,
4853
4721
  S: this,
4854
4722
  C: (f, a) => f(...a)
4855
4723
  });
4856
4724
  const root = await this._echoHost.createSpaceRoot(spaceKey);
4857
4725
  const space = await this._constructSpace(metadata);
4858
- await space.open();
4859
4726
  const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, root.url);
4860
4727
  await this._metadataStore.addSpace(metadata);
4861
4728
  const memberCredential = credentials[1];
4862
- invariant14(getCredentialAssertion3(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
4863
- F: __dxlog_file17,
4864
- L: 197,
4729
+ invariant14(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
4730
+ F: __dxlog_file16,
4731
+ L: 205,
4865
4732
  S: this,
4866
4733
  A: [
4867
4734
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -4873,63 +4740,19 @@ var DataSpaceManager = class {
4873
4740
  this.updated.emit();
4874
4741
  return space;
4875
4742
  }
4876
- async isDefaultSpace(space) {
4877
- const rootDoc = await this._getSpaceRootDocument(space);
4878
- const [_, properties] = findPropertiesObject(rootDoc.docSync()) ?? [];
4879
- return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
4880
- }
4881
- async createDefaultSpace() {
4882
- const space = await this.createSpace();
4883
- const document = await this._getSpaceRootDocument(space);
4884
- const properties = {
4885
- system: {
4886
- type: encodeReference(getTypeReference(PropertiesType))
4887
- },
4888
- data: {
4889
- [DEFAULT_SPACE_KEY]: this._signingContext.identityKey.toHex()
4890
- },
4891
- meta: {
4892
- keys: []
4893
- }
4894
- };
4895
- const propertiesId = PublicKey11.random().toHex();
4896
- document.change((doc) => {
4897
- assignDeep2(doc, [
4898
- "objects",
4899
- propertiesId
4900
- ], properties);
4901
- });
4902
- await this._echoHost.flush();
4903
- return space;
4904
- }
4905
- async _getSpaceRootDocument(space) {
4906
- const automergeIndex = space.automergeSpaceState.rootUrl;
4907
- invariant14(automergeIndex, void 0, {
4908
- F: __dxlog_file17,
4909
- L: 240,
4910
- S: this,
4911
- A: [
4912
- "automergeIndex",
4913
- ""
4914
- ]
4915
- });
4916
- const document = this._echoHost.automergeRepo.find(automergeIndex);
4917
- await document.whenReady();
4918
- return document;
4919
- }
4920
4743
  // TODO(burdon): Rename join space.
4921
4744
  async acceptSpace(opts) {
4922
- log14("accept space", {
4745
+ log13("accept space", {
4923
4746
  opts
4924
4747
  }, {
4925
- F: __dxlog_file17,
4926
- L: 249,
4748
+ F: __dxlog_file16,
4749
+ L: 217,
4927
4750
  S: this,
4928
4751
  C: (f, a) => f(...a)
4929
4752
  });
4930
4753
  invariant14(this._isOpen, "Not open.", {
4931
- F: __dxlog_file17,
4932
- L: 250,
4754
+ F: __dxlog_file16,
4755
+ L: 218,
4933
4756
  S: this,
4934
4757
  A: [
4935
4758
  "this._isOpen",
@@ -4937,8 +4760,8 @@ var DataSpaceManager = class {
4937
4760
  ]
4938
4761
  });
4939
4762
  invariant14(!this._spaces.has(opts.spaceKey), "Space already exists.", {
4940
- F: __dxlog_file17,
4941
- L: 251,
4763
+ F: __dxlog_file16,
4764
+ L: 219,
4942
4765
  S: this,
4943
4766
  A: [
4944
4767
  "!this._spaces.has(opts.spaceKey)",
@@ -4952,7 +4775,6 @@ var DataSpaceManager = class {
4952
4775
  dataTimeframe: opts.dataTimeframe
4953
4776
  };
4954
4777
  const space = await this._constructSpace(metadata);
4955
- await space.open();
4956
4778
  await this._metadataStore.addSpace(metadata);
4957
4779
  space.initializeDataPipelineAsync();
4958
4780
  this.updated.emit();
@@ -4966,15 +4788,15 @@ var DataSpaceManager = class {
4966
4788
  async waitUntilSpaceReady(spaceKey) {
4967
4789
  await cancelWithContext5(this._ctx, this.updated.waitForCondition(() => {
4968
4790
  const space = this._spaces.get(spaceKey);
4969
- return !!space && space.state === SpaceState3.READY;
4791
+ return !!space && space.state === SpaceState2.READY;
4970
4792
  }));
4971
4793
  }
4972
4794
  async _constructSpace(metadata) {
4973
- log14("construct space", {
4795
+ log13("construct space", {
4974
4796
  metadata
4975
4797
  }, {
4976
- F: __dxlog_file17,
4977
- L: 285,
4798
+ F: __dxlog_file16,
4799
+ L: 252,
4978
4800
  S: this,
4979
4801
  C: (f, a) => f(...a)
4980
4802
  });
@@ -4982,8 +4804,8 @@ var DataSpaceManager = class {
4982
4804
  localPeerId: this._signingContext.deviceKey
4983
4805
  });
4984
4806
  const presence = new Presence2({
4985
- announceInterval: this._params?.spaceMemberPresenceAnnounceInterval ?? PRESENCE_ANNOUNCE_INTERVAL,
4986
- offlineTimeout: this._params?.spaceMemberPresenceOfflineTimeout ?? PRESENCE_OFFLINE_TIMEOUT,
4807
+ announceInterval: this._spaceMemberPresenceAnnounceInterval,
4808
+ offlineTimeout: this._spaceMemberPresenceOfflineTimeout,
4987
4809
  identityKey: this._signingContext.identityKey,
4988
4810
  gossip
4989
4811
  });
@@ -5010,15 +4832,15 @@ var DataSpaceManager = class {
5010
4832
  session.addExtension("dxos.mesh.teleport.automerge", this._echoHost.createReplicationExtension());
5011
4833
  },
5012
4834
  onAuthFailure: () => {
5013
- log14.warn("auth failure", void 0, {
5014
- F: __dxlog_file17,
5015
- L: 322,
4835
+ log13.warn("auth failure", void 0, {
4836
+ F: __dxlog_file16,
4837
+ L: 289,
5016
4838
  S: this,
5017
4839
  C: (f, a) => f(...a)
5018
4840
  });
5019
4841
  },
5020
4842
  onMemberRolesChanged: async (members) => {
5021
- if (dataSpace?.state === SpaceState3.READY) {
4843
+ if (dataSpace?.state === SpaceState2.READY) {
5022
4844
  this._handleMemberRoleChanges(presence, space.protocol, members);
5023
4845
  }
5024
4846
  },
@@ -5031,7 +4853,7 @@ var DataSpaceManager = class {
5031
4853
  dataFeed && await space.setDataFeed(dataFeed);
5032
4854
  const dataSpace = new DataSpace({
5033
4855
  inner: space,
5034
- initialState: metadata.state === SpaceState3.INACTIVE ? SpaceState3.INACTIVE : SpaceState3.CLOSED,
4856
+ initialState: metadata.state === SpaceState2.INACTIVE ? SpaceState2.INACTIVE : SpaceState2.CLOSED,
5035
4857
  metadataStore: this._metadataStore,
5036
4858
  gossip,
5037
4859
  presence,
@@ -5041,22 +4863,22 @@ var DataSpaceManager = class {
5041
4863
  signingContext: this._signingContext,
5042
4864
  callbacks: {
5043
4865
  beforeReady: async () => {
5044
- log14("before space ready", {
4866
+ log13("before space ready", {
5045
4867
  space: space.key
5046
4868
  }, {
5047
- F: __dxlog_file17,
5048
- L: 349,
4869
+ F: __dxlog_file16,
4870
+ L: 316,
5049
4871
  S: this,
5050
4872
  C: (f, a) => f(...a)
5051
4873
  });
5052
4874
  },
5053
4875
  afterReady: async () => {
5054
- log14("after space ready", {
4876
+ log13("after space ready", {
5055
4877
  space: space.key,
5056
4878
  open: this._isOpen
5057
4879
  }, {
5058
- F: __dxlog_file17,
5059
- L: 352,
4880
+ F: __dxlog_file16,
4881
+ L: 319,
5060
4882
  S: this,
5061
4883
  C: (f, a) => f(...a)
5062
4884
  });
@@ -5071,11 +4893,11 @@ var DataSpaceManager = class {
5071
4893
  }
5072
4894
  },
5073
4895
  beforeClose: async () => {
5074
- log14("before space close", {
4896
+ log13("before space close", {
5075
4897
  space: space.key
5076
4898
  }, {
5077
- F: __dxlog_file17,
5078
- L: 360,
4899
+ F: __dxlog_file16,
4900
+ L: 327,
5079
4901
  S: this,
5080
4902
  C: (f, a) => f(...a)
5081
4903
  });
@@ -5084,10 +4906,13 @@ var DataSpaceManager = class {
5084
4906
  cache: metadata.cache
5085
4907
  });
5086
4908
  presence.newPeer.on((peerState) => {
5087
- if (dataSpace.state === SpaceState3.READY) {
4909
+ if (dataSpace.state === SpaceState2.READY) {
5088
4910
  this._handleNewPeerConnected(space, peerState);
5089
4911
  }
5090
4912
  });
4913
+ if (metadata.state !== SpaceState2.INACTIVE) {
4914
+ await dataSpace.open();
4915
+ }
5091
4916
  if (metadata.controlTimeframe) {
5092
4917
  dataSpace.inner.controlPipeline.state.setTargetTimeframe(metadata.controlTimeframe);
5093
4918
  }
@@ -5106,17 +4931,17 @@ var DataSpaceManager = class {
5106
4931
  return (s && member.role === SpaceMember6.Role.REMOVED !== (s.authStatus === AuthStatus.FAILURE)) ?? false;
5107
4932
  });
5108
4933
  sessionsToClose.forEach((session) => {
5109
- void session.close().catch(log14.error);
4934
+ void session.close().catch(log13.error);
5110
4935
  });
5111
4936
  closedSessions += sessionsToClose.length;
5112
4937
  }
5113
- log14("processed member role changes", {
4938
+ log13("processed member role changes", {
5114
4939
  roleChangeCount: memberInfo.length,
5115
4940
  peersOnline: presence.getPeersOnline().length,
5116
4941
  closedSessions
5117
4942
  }, {
5118
- F: __dxlog_file17,
5119
- L: 396,
4943
+ F: __dxlog_file16,
4944
+ L: 367,
5120
4945
  S: this,
5121
4946
  C: (f, a) => f(...a)
5122
4947
  });
@@ -5127,20 +4952,20 @@ var DataSpaceManager = class {
5127
4952
  if (role === SpaceMember6.Role.REMOVED) {
5128
4953
  const session = peerState.peerId && space.protocol.sessions.get(peerState.peerId);
5129
4954
  if (session != null) {
5130
- log14("closing a session with a removed peer", {
4955
+ log13("closing a session with a removed peer", {
5131
4956
  peerId: peerState.peerId
5132
4957
  }, {
5133
- F: __dxlog_file17,
5134
- L: 410,
4958
+ F: __dxlog_file16,
4959
+ L: 381,
5135
4960
  S: this,
5136
4961
  C: (f, a) => f(...a)
5137
4962
  });
5138
- void session.close().catch(log14.error);
4963
+ void session.close().catch(log13.error);
5139
4964
  }
5140
4965
  }
5141
4966
  }
5142
4967
  async _handleInvitationStatusChange(dataSpace, delegatedInvitation, isActive) {
5143
- if (dataSpace?.state !== SpaceState3.READY) {
4968
+ if (dataSpace?.state !== SpaceState2.READY) {
5144
4969
  return;
5145
4970
  }
5146
4971
  if (isActive) {
@@ -5194,15 +5019,15 @@ DataSpaceManager = _ts_decorate5([
5194
5019
  // packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
5195
5020
  import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTask as scheduleTask6 } from "@dxos/async";
5196
5021
  import { Stream as Stream10 } from "@dxos/codec-protobuf";
5197
- import { createAdmissionCredentials as createAdmissionCredentials2, getCredentialAssertion as getCredentialAssertion4 } from "@dxos/credentials";
5022
+ import { createAdmissionCredentials as createAdmissionCredentials2, getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
5198
5023
  import { raise as raise2 } from "@dxos/debug";
5199
5024
  import { writeMessages as writeMessages3 } from "@dxos/feed-store";
5200
5025
  import { invariant as invariant15 } from "@dxos/invariant";
5201
- import { log as log15 } from "@dxos/log";
5026
+ import { log as log14 } from "@dxos/log";
5202
5027
  import { ApiError, SpaceNotFoundError as SpaceNotFoundError2, encodeError, IdentityNotInitializedError, AuthorizationError as AuthorizationError2 } from "@dxos/protocols";
5203
- import { SpaceMember as SpaceMember7, SpaceState as SpaceState4 } from "@dxos/protocols/proto/dxos/client/services";
5028
+ import { SpaceMember as SpaceMember7, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
5204
5029
  import { trace as trace8 } from "@dxos/tracing";
5205
- var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
5030
+ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
5206
5031
  var SpacesServiceImpl = class {
5207
5032
  constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
5208
5033
  this._identityManager = _identityManager;
@@ -5221,10 +5046,10 @@ var SpacesServiceImpl = class {
5221
5046
  const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError2(spaceKey));
5222
5047
  if (state) {
5223
5048
  switch (state) {
5224
- case SpaceState4.ACTIVE:
5049
+ case SpaceState3.ACTIVE:
5225
5050
  await space.activate();
5226
5051
  break;
5227
- case SpaceState4.INACTIVE:
5052
+ case SpaceState3.INACTIVE:
5228
5053
  await space.deactivate();
5229
5054
  break;
5230
5055
  default:
@@ -5246,7 +5071,7 @@ var SpacesServiceImpl = class {
5246
5071
  }
5247
5072
  const credentials = await createAdmissionCredentials2(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
5248
5073
  invariant15(credentials[0].credential, void 0, {
5249
- F: __dxlog_file18,
5074
+ F: __dxlog_file17,
5250
5075
  L: 97,
5251
5076
  S: this,
5252
5077
  A: [
@@ -5255,8 +5080,8 @@ var SpacesServiceImpl = class {
5255
5080
  ]
5256
5081
  });
5257
5082
  const spaceMemberCredential = credentials[0].credential.credential;
5258
- invariant15(getCredentialAssertion4(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
5259
- F: __dxlog_file18,
5083
+ invariant15(getCredentialAssertion3(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
5084
+ F: __dxlog_file17,
5260
5085
  L: 99,
5261
5086
  S: this,
5262
5087
  A: [
@@ -5271,10 +5096,10 @@ var SpacesServiceImpl = class {
5271
5096
  const scheduler = new UpdateScheduler(ctx, async () => {
5272
5097
  const dataSpaceManager = await this._getDataSpaceManager();
5273
5098
  const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
5274
- log15("update", {
5099
+ log14("update", {
5275
5100
  spaces
5276
5101
  }, {
5277
- F: __dxlog_file18,
5102
+ F: __dxlog_file17,
5278
5103
  L: 110,
5279
5104
  S: this,
5280
5105
  C: (f, a) => f(...a)
@@ -5358,7 +5183,7 @@ var SpacesServiceImpl = class {
5358
5183
  });
5359
5184
  } else {
5360
5185
  invariant15(!credential.id, "Id on unsigned credentials is not allowed", {
5361
- F: __dxlog_file18,
5186
+ F: __dxlog_file17,
5362
5187
  L: 198,
5363
5188
  S: this,
5364
5189
  A: [
@@ -5367,7 +5192,7 @@ var SpacesServiceImpl = class {
5367
5192
  ]
5368
5193
  });
5369
5194
  invariant15(this._identityManager.identity, "Identity is not available", {
5370
- F: __dxlog_file18,
5195
+ F: __dxlog_file17,
5371
5196
  L: 199,
5372
5197
  S: this,
5373
5198
  A: [
@@ -5377,7 +5202,7 @@ var SpacesServiceImpl = class {
5377
5202
  });
5378
5203
  const signer = this._identityManager.identity.getIdentityCredentialSigner();
5379
5204
  invariant15(credential.issuer.equals(signer.getIssuer()), void 0, {
5380
- F: __dxlog_file18,
5205
+ F: __dxlog_file17,
5381
5206
  L: 201,
5382
5207
  S: this,
5383
5208
  A: [
@@ -5467,8 +5292,8 @@ var getChannelId = (channel) => `user-channel/${channel}`;
5467
5292
 
5468
5293
  // packages/sdk/client-services/src/packlets/services/service-context.ts
5469
5294
  import { Trigger as Trigger7 } from "@dxos/async";
5470
- import { Context as Context10, Resource as Resource2 } from "@dxos/context";
5471
- import { getCredentialAssertion as getCredentialAssertion5 } from "@dxos/credentials";
5295
+ import { Context as Context10, Resource } from "@dxos/context";
5296
+ import { getCredentialAssertion as getCredentialAssertion4 } from "@dxos/credentials";
5472
5297
  import { failUndefined as failUndefined2 } from "@dxos/debug";
5473
5298
  import { EchoHost } from "@dxos/echo-db";
5474
5299
  import { MetadataStore, SnapshotStore, SpaceManager, valueEncoding } from "@dxos/echo-pipeline";
@@ -5476,7 +5301,7 @@ import { FeedFactory, FeedStore } from "@dxos/feed-store";
5476
5301
  import { invariant as invariant16 } from "@dxos/invariant";
5477
5302
  import { Keyring } from "@dxos/keyring";
5478
5303
  import { PublicKey as PublicKey12 } from "@dxos/keys";
5479
- import { log as log16 } from "@dxos/log";
5304
+ import { log as log15 } from "@dxos/log";
5480
5305
  import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace9 } from "@dxos/protocols";
5481
5306
  import { Invitation as Invitation8 } from "@dxos/protocols/proto/dxos/client/services";
5482
5307
  import { BlobStore } from "@dxos/teleport-extension-object-sync";
@@ -5492,8 +5317,8 @@ function _ts_decorate6(decorators, target, key, desc) {
5492
5317
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5493
5318
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5494
5319
  }
5495
- var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
5496
- var ServiceContext = class extends Resource2 {
5320
+ var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
5321
+ var ServiceContext = class extends Resource {
5497
5322
  constructor(storage, level, networkManager, signalManager, _runtimeParams) {
5498
5323
  super();
5499
5324
  this.storage = storage;
@@ -5536,16 +5361,16 @@ var ServiceContext = class extends Resource2 {
5536
5361
  }
5537
5362
  async _open(ctx) {
5538
5363
  await this._checkStorageVersion();
5539
- log16("opening...", void 0, {
5540
- F: __dxlog_file19,
5364
+ log15("opening...", void 0, {
5365
+ F: __dxlog_file18,
5541
5366
  L: 152,
5542
5367
  S: this,
5543
5368
  C: (f, a) => f(...a)
5544
5369
  });
5545
- log16.trace("dxos.sdk.service-context.open", trace9.begin({
5370
+ log15.trace("dxos.sdk.service-context.open", trace9.begin({
5546
5371
  id: this._instanceId
5547
5372
  }), {
5548
- F: __dxlog_file19,
5373
+ F: __dxlog_file18,
5549
5374
  L: 153,
5550
5375
  S: this,
5551
5376
  C: (f, a) => f(...a)
@@ -5560,32 +5385,32 @@ var ServiceContext = class extends Resource2 {
5560
5385
  await this._initialize(ctx);
5561
5386
  }
5562
5387
  const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
5563
- log16("loaded persistent invitations", {
5388
+ log15("loaded persistent invitations", {
5564
5389
  count: loadedInvitations.invitations?.length
5565
5390
  }, {
5566
- F: __dxlog_file19,
5391
+ F: __dxlog_file18,
5567
5392
  L: 166,
5568
5393
  S: this,
5569
5394
  C: (f, a) => f(...a)
5570
5395
  });
5571
- log16.trace("dxos.sdk.service-context.open", trace9.end({
5396
+ log15.trace("dxos.sdk.service-context.open", trace9.end({
5572
5397
  id: this._instanceId
5573
5398
  }), {
5574
- F: __dxlog_file19,
5399
+ F: __dxlog_file18,
5575
5400
  L: 168,
5576
5401
  S: this,
5577
5402
  C: (f, a) => f(...a)
5578
5403
  });
5579
- log16("opened", void 0, {
5580
- F: __dxlog_file19,
5404
+ log15("opened", void 0, {
5405
+ F: __dxlog_file18,
5581
5406
  L: 169,
5582
5407
  S: this,
5583
5408
  C: (f, a) => f(...a)
5584
5409
  });
5585
5410
  }
5586
5411
  async _close(ctx) {
5587
- log16("closing...", void 0, {
5588
- F: __dxlog_file19,
5412
+ log15("closing...", void 0, {
5413
+ F: __dxlog_file18,
5589
5414
  L: 173,
5590
5415
  S: this,
5591
5416
  C: (f, a) => f(...a)
@@ -5601,8 +5426,8 @@ var ServiceContext = class extends Resource2 {
5601
5426
  await this.echoHost.close(ctx);
5602
5427
  await this.networkManager.close();
5603
5428
  await this.signalManager.close();
5604
- log16("closed", void 0, {
5605
- F: __dxlog_file19,
5429
+ log15("closed", void 0, {
5430
+ F: __dxlog_file18,
5606
5431
  L: 185,
5607
5432
  S: this,
5608
5433
  C: (f, a) => f(...a)
@@ -5616,7 +5441,7 @@ var ServiceContext = class extends Resource2 {
5616
5441
  getInvitationHandler(invitation) {
5617
5442
  const factory = this._handlerFactories.get(invitation.kind);
5618
5443
  invariant16(factory, `Unknown invitation kind: ${invitation.kind}`, {
5619
- F: __dxlog_file19,
5444
+ F: __dxlog_file18,
5620
5445
  L: 196,
5621
5446
  S: this,
5622
5447
  A: [
@@ -5647,8 +5472,8 @@ var ServiceContext = class extends Resource2 {
5647
5472
  }
5648
5473
  // Called when identity is created.
5649
5474
  async _initialize(ctx) {
5650
- log16("initializing spaces...", void 0, {
5651
- F: __dxlog_file19,
5475
+ log15("initializing spaces...", void 0, {
5476
+ F: __dxlog_file18,
5652
5477
  L: 227,
5653
5478
  S: this,
5654
5479
  C: (f, a) => f(...a)
@@ -5671,7 +5496,7 @@ var ServiceContext = class extends Resource2 {
5671
5496
  await this.dataSpaceManager.open();
5672
5497
  this._handlerFactories.set(Invitation8.Kind.SPACE, (invitation) => {
5673
5498
  invariant16(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
5674
- F: __dxlog_file19,
5499
+ F: __dxlog_file18,
5675
5500
  L: 252,
5676
5501
  S: this,
5677
5502
  A: [
@@ -5684,7 +5509,7 @@ var ServiceContext = class extends Resource2 {
5684
5509
  this.initialized.wake();
5685
5510
  this._deviceSpaceSync = {
5686
5511
  processCredential: async (credential) => {
5687
- const assertion = getCredentialAssertion5(credential);
5512
+ const assertion = getCredentialAssertion4(credential);
5688
5513
  if (assertion["@type"] !== "dxos.halo.credentials.SpaceMember") {
5689
5514
  return;
5690
5515
  }
@@ -5692,10 +5517,10 @@ var ServiceContext = class extends Resource2 {
5692
5517
  return;
5693
5518
  }
5694
5519
  if (!this.dataSpaceManager) {
5695
- log16("dataSpaceManager not initialized yet, ignoring space admission", {
5520
+ log15("dataSpaceManager not initialized yet, ignoring space admission", {
5696
5521
  details: assertion
5697
5522
  }, {
5698
- F: __dxlog_file19,
5523
+ F: __dxlog_file18,
5699
5524
  L: 268,
5700
5525
  S: this,
5701
5526
  C: (f, a) => f(...a)
@@ -5703,10 +5528,10 @@ var ServiceContext = class extends Resource2 {
5703
5528
  return;
5704
5529
  }
5705
5530
  if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
5706
- log16("space already exists, ignoring space admission", {
5531
+ log15("space already exists, ignoring space admission", {
5707
5532
  details: assertion
5708
5533
  }, {
5709
- F: __dxlog_file19,
5534
+ F: __dxlog_file18,
5710
5535
  L: 272,
5711
5536
  S: this,
5712
5537
  C: (f, a) => f(...a)
@@ -5714,10 +5539,10 @@ var ServiceContext = class extends Resource2 {
5714
5539
  return;
5715
5540
  }
5716
5541
  try {
5717
- log16("accepting space recorded in halo", {
5542
+ log15("accepting space recorded in halo", {
5718
5543
  details: assertion
5719
5544
  }, {
5720
- F: __dxlog_file19,
5545
+ F: __dxlog_file18,
5721
5546
  L: 277,
5722
5547
  S: this,
5723
5548
  C: (f, a) => f(...a)
@@ -5727,8 +5552,8 @@ var ServiceContext = class extends Resource2 {
5727
5552
  genesisFeedKey: assertion.genesisFeedKey
5728
5553
  });
5729
5554
  } catch (err) {
5730
- log16.catch(err, void 0, {
5731
- F: __dxlog_file19,
5555
+ log15.catch(err, void 0, {
5556
+ F: __dxlog_file18,
5732
5557
  L: 283,
5733
5558
  S: this,
5734
5559
  C: (f, a) => f(...a)
@@ -5777,7 +5602,7 @@ var ServiceRegistry = class {
5777
5602
  // packages/sdk/client-services/src/packlets/locks/browser.ts
5778
5603
  import { asyncTimeout as asyncTimeout3, Trigger as Trigger8 } from "@dxos/async";
5779
5604
  import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
5780
- import { log as log17, logInfo } from "@dxos/log";
5605
+ import { log as log16, logInfo } from "@dxos/log";
5781
5606
  function _ts_decorate7(decorators, target, key, desc) {
5782
5607
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5783
5608
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -5788,7 +5613,7 @@ function _ts_decorate7(decorators, target, key, desc) {
5788
5613
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5789
5614
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5790
5615
  }
5791
- var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/browser.ts";
5616
+ var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/browser.ts";
5792
5617
  var Message;
5793
5618
  (function(Message2) {
5794
5619
  Message2["ACQUIRING"] = "acquiring";
@@ -5810,29 +5635,29 @@ var Lock = class {
5810
5635
  message: "acquiring"
5811
5636
  });
5812
5637
  try {
5813
- log17("aquiring lock...", void 0, {
5814
- F: __dxlog_file20,
5638
+ log16("aquiring lock...", void 0, {
5639
+ F: __dxlog_file19,
5815
5640
  L: 42,
5816
5641
  S: this,
5817
5642
  C: (f, a) => f(...a)
5818
5643
  });
5819
5644
  await asyncTimeout3(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
5820
- log17("acquired lock", void 0, {
5821
- F: __dxlog_file20,
5645
+ log16("acquired lock", void 0, {
5646
+ F: __dxlog_file19,
5822
5647
  L: 44,
5823
5648
  S: this,
5824
5649
  C: (f, a) => f(...a)
5825
5650
  });
5826
5651
  } catch {
5827
- log17("stealing lock...", void 0, {
5828
- F: __dxlog_file20,
5652
+ log16("stealing lock...", void 0, {
5653
+ F: __dxlog_file19,
5829
5654
  L: 46,
5830
5655
  S: this,
5831
5656
  C: (f, a) => f(...a)
5832
5657
  });
5833
5658
  await this._requestLock(true);
5834
- log17("stolen lock", void 0, {
5835
- F: __dxlog_file20,
5659
+ log16("stolen lock", void 0, {
5660
+ F: __dxlog_file19,
5836
5661
  L: 48,
5837
5662
  S: this,
5838
5663
  C: (f, a) => f(...a)
@@ -5848,10 +5673,10 @@ var Lock = class {
5848
5673
  }
5849
5674
  }
5850
5675
  async _requestLock(steal = false) {
5851
- log17("requesting lock...", {
5676
+ log16("requesting lock...", {
5852
5677
  steal
5853
5678
  }, {
5854
- F: __dxlog_file20,
5679
+ F: __dxlog_file19,
5855
5680
  L: 63,
5856
5681
  S: this,
5857
5682
  C: (f, a) => f(...a)
@@ -5864,15 +5689,15 @@ var Lock = class {
5864
5689
  acquired.wake();
5865
5690
  this._releaseTrigger = new Trigger8();
5866
5691
  await this._releaseTrigger.wait();
5867
- log17("releasing lock...", void 0, {
5868
- F: __dxlog_file20,
5692
+ log16("releasing lock...", void 0, {
5693
+ F: __dxlog_file19,
5869
5694
  L: 72,
5870
5695
  S: this,
5871
5696
  C: (f, a) => f(...a)
5872
5697
  });
5873
5698
  await this._onRelease?.();
5874
- log17("released lock", void 0, {
5875
- F: __dxlog_file20,
5699
+ log16("released lock", void 0, {
5700
+ F: __dxlog_file19,
5876
5701
  L: 74,
5877
5702
  S: this,
5878
5703
  C: (f, a) => f(...a)
@@ -5881,10 +5706,10 @@ var Lock = class {
5881
5706
  await this._onRelease?.();
5882
5707
  });
5883
5708
  await acquired.wait();
5884
- log17("recieved lock", {
5709
+ log16("recieved lock", {
5885
5710
  steal
5886
5711
  }, {
5887
- F: __dxlog_file20,
5712
+ F: __dxlog_file19,
5888
5713
  L: 81,
5889
5714
  S: this,
5890
5715
  C: (f, a) => f(...a)
@@ -5974,16 +5799,19 @@ var createLevel = async (config) => {
5974
5799
 
5975
5800
  // packages/sdk/client-services/src/packlets/services/service-host.ts
5976
5801
  import { Event as Event9, synchronized as synchronized3 } from "@dxos/async";
5977
- import { clientServiceBundle } from "@dxos/client-protocol";
5802
+ import { clientServiceBundle, defaultKey, PropertiesType } from "@dxos/client-protocol";
5978
5803
  import { Context as Context11 } from "@dxos/context";
5804
+ import { encodeReference } from "@dxos/echo-protocol";
5805
+ import { getTypeReference } from "@dxos/echo-schema";
5979
5806
  import { invariant as invariant18 } from "@dxos/invariant";
5980
5807
  import { PublicKey as PublicKey16 } from "@dxos/keys";
5981
- import { log as log19 } from "@dxos/log";
5808
+ import { log as log18 } from "@dxos/log";
5982
5809
  import { WebsocketSignalManager } from "@dxos/messaging";
5983
5810
  import { SwarmNetworkManager, createSimplePeerTransportFactory } from "@dxos/network-manager";
5984
5811
  import { trace as trace10 } from "@dxos/protocols";
5985
5812
  import { SystemStatus } from "@dxos/protocols/proto/dxos/client/services";
5986
5813
  import { TRACE_PROCESSOR as TRACE_PROCESSOR3, trace as Trace4 } from "@dxos/tracing";
5814
+ import { assignDeep as assignDeep2 } from "@dxos/util";
5987
5815
  import { WebsocketRpcClient } from "@dxos/websocket-rpc";
5988
5816
 
5989
5817
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
@@ -5991,7 +5819,7 @@ import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
5991
5819
  import { Stream as Stream11 } from "@dxos/codec-protobuf";
5992
5820
  import { invariant as invariant17 } from "@dxos/invariant";
5993
5821
  import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
5994
- var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
5822
+ var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
5995
5823
  var DevicesServiceImpl = class {
5996
5824
  constructor(_identityManager) {
5997
5825
  this._identityManager = _identityManager;
@@ -6009,7 +5837,7 @@ var DevicesServiceImpl = class {
6009
5837
  });
6010
5838
  } else {
6011
5839
  invariant17(this._identityManager.identity?.presence, "presence not present", {
6012
- F: __dxlog_file21,
5840
+ F: __dxlog_file20,
6013
5841
  L: 32,
6014
5842
  S: this,
6015
5843
  A: [
@@ -6119,7 +5947,7 @@ var findConfigs = () => {
6119
5947
  import { Event as Event8 } from "@dxos/async";
6120
5948
  import { Stream as Stream12 } from "@dxos/codec-protobuf";
6121
5949
  import { PublicKey as PublicKey15 } from "@dxos/keys";
6122
- import { getContextFromEntry, log as log18 } from "@dxos/log";
5950
+ import { getContextFromEntry, log as log17 } from "@dxos/log";
6123
5951
  import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
6124
5952
  import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
6125
5953
  var LoggingServiceImpl = class {
@@ -6132,11 +5960,11 @@ var LoggingServiceImpl = class {
6132
5960
  };
6133
5961
  }
6134
5962
  async open() {
6135
- log18.runtimeConfig.processors.push(this._logProcessor);
5963
+ log17.runtimeConfig.processors.push(this._logProcessor);
6136
5964
  }
6137
5965
  async close() {
6138
- const index = log18.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
6139
- log18.runtimeConfig.processors.splice(index, 1);
5966
+ const index = log17.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
5967
+ log17.runtimeConfig.processors.splice(index, 1);
6140
5968
  }
6141
5969
  async controlMetrics({ reset, record }) {
6142
5970
  if (reset) {
@@ -6340,7 +6168,7 @@ function _ts_decorate8(decorators, target, key, desc) {
6340
6168
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6341
6169
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6342
6170
  }
6343
- var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
6171
+ var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
6344
6172
  var ClientServicesHost = class {
6345
6173
  constructor({
6346
6174
  config,
@@ -6360,7 +6188,7 @@ var ClientServicesHost = class {
6360
6188
  this._storage = storage;
6361
6189
  this._level = level;
6362
6190
  this._callbacks = callbacks;
6363
- this._runtimeParams = runtimeParams ?? {};
6191
+ this._runtimeParams = runtimeParams;
6364
6192
  if (config) {
6365
6193
  this.initialize({
6366
6194
  config,
@@ -6429,24 +6257,24 @@ var ClientServicesHost = class {
6429
6257
  */
6430
6258
  initialize({ config, ...options }) {
6431
6259
  invariant18(!this._open, "service host is open", {
6432
- F: __dxlog_file22,
6433
- L: 186,
6260
+ F: __dxlog_file21,
6261
+ L: 189,
6434
6262
  S: this,
6435
6263
  A: [
6436
6264
  "!this._open",
6437
6265
  "'service host is open'"
6438
6266
  ]
6439
6267
  });
6440
- log19("initializing...", void 0, {
6441
- F: __dxlog_file22,
6442
- L: 187,
6268
+ log18("initializing...", void 0, {
6269
+ F: __dxlog_file21,
6270
+ L: 190,
6443
6271
  S: this,
6444
6272
  C: (f, a) => f(...a)
6445
6273
  });
6446
6274
  if (config) {
6447
6275
  invariant18(!this._config, "config already set", {
6448
- F: __dxlog_file22,
6449
- L: 190,
6276
+ F: __dxlog_file21,
6277
+ L: 193,
6450
6278
  S: this,
6451
6279
  A: [
6452
6280
  "!this._config",
@@ -6459,9 +6287,9 @@ var ClientServicesHost = class {
6459
6287
  }
6460
6288
  }
6461
6289
  if (!options.signalManager) {
6462
- log19.warn("running signaling without telemetry metadata.", void 0, {
6463
- F: __dxlog_file22,
6464
- L: 198,
6290
+ log18.warn("running signaling without telemetry metadata.", void 0, {
6291
+ F: __dxlog_file21,
6292
+ L: 201,
6465
6293
  S: this,
6466
6294
  C: (f, a) => f(...a)
6467
6295
  });
@@ -6471,8 +6299,8 @@ var ClientServicesHost = class {
6471
6299
  }), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
6472
6300
  this._signalManager = signalManager;
6473
6301
  invariant18(!this._networkManager, "network manager already set", {
6474
- F: __dxlog_file22,
6475
- L: 209,
6302
+ F: __dxlog_file21,
6303
+ L: 212,
6476
6304
  S: this,
6477
6305
  A: [
6478
6306
  "!this._networkManager",
@@ -6484,9 +6312,9 @@ var ClientServicesHost = class {
6484
6312
  transportFactory,
6485
6313
  signalManager
6486
6314
  });
6487
- log19("initialized", void 0, {
6488
- F: __dxlog_file22,
6489
- L: 216,
6315
+ log18("initialized", void 0, {
6316
+ F: __dxlog_file21,
6317
+ L: 219,
6490
6318
  S: this,
6491
6319
  C: (f, a) => f(...a)
6492
6320
  });
@@ -6496,17 +6324,17 @@ var ClientServicesHost = class {
6496
6324
  return;
6497
6325
  }
6498
6326
  const traceId = PublicKey16.random().toHex();
6499
- log19.trace("dxos.client-services.host.open", trace10.begin({
6327
+ log18.trace("dxos.client-services.host.open", trace10.begin({
6500
6328
  id: traceId
6501
6329
  }), {
6502
- F: __dxlog_file22,
6503
- L: 227,
6330
+ F: __dxlog_file21,
6331
+ L: 230,
6504
6332
  S: this,
6505
6333
  C: (f, a) => f(...a)
6506
6334
  });
6507
6335
  invariant18(this._config, "config not set", {
6508
- F: __dxlog_file22,
6509
- L: 229,
6336
+ F: __dxlog_file21,
6337
+ L: 232,
6510
6338
  S: this,
6511
6339
  A: [
6512
6340
  "this._config",
@@ -6514,8 +6342,8 @@ var ClientServicesHost = class {
6514
6342
  ]
6515
6343
  });
6516
6344
  invariant18(this._storage, "storage not set", {
6517
- F: __dxlog_file22,
6518
- L: 230,
6345
+ F: __dxlog_file21,
6346
+ L: 233,
6519
6347
  S: this,
6520
6348
  A: [
6521
6349
  "this._storage",
@@ -6523,8 +6351,8 @@ var ClientServicesHost = class {
6523
6351
  ]
6524
6352
  });
6525
6353
  invariant18(this._signalManager, "signal manager not set", {
6526
- F: __dxlog_file22,
6527
- L: 231,
6354
+ F: __dxlog_file21,
6355
+ L: 234,
6528
6356
  S: this,
6529
6357
  A: [
6530
6358
  "this._signalManager",
@@ -6532,8 +6360,8 @@ var ClientServicesHost = class {
6532
6360
  ]
6533
6361
  });
6534
6362
  invariant18(this._networkManager, "network manager not set", {
6535
- F: __dxlog_file22,
6536
- L: 232,
6363
+ F: __dxlog_file21,
6364
+ L: 235,
6537
6365
  S: this,
6538
6366
  A: [
6539
6367
  "this._networkManager",
@@ -6541,11 +6369,11 @@ var ClientServicesHost = class {
6541
6369
  ]
6542
6370
  });
6543
6371
  this._opening = true;
6544
- log19("opening...", {
6372
+ log18("opening...", {
6545
6373
  lockKey: this._resourceLock?.lockKey
6546
6374
  }, {
6547
- F: __dxlog_file22,
6548
- L: 235,
6375
+ F: __dxlog_file21,
6376
+ L: 238,
6549
6377
  S: this,
6550
6378
  C: (f, a) => f(...a)
6551
6379
  });
@@ -6556,10 +6384,9 @@ var ClientServicesHost = class {
6556
6384
  await this._level.open();
6557
6385
  await this._loggingService.open();
6558
6386
  this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
6559
- const identityService = new IdentityServiceImpl(this._serviceContext.identityManager, this._serviceContext.keyring, () => this._serviceContext.dataSpaceManager, (params) => this._createIdentity(params), (profile) => this._serviceContext.broadcastProfileUpdate(profile));
6560
6387
  this._serviceRegistry.setServices({
6561
6388
  SystemService: this._systemService,
6562
- IdentityService: identityService,
6389
+ IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
6563
6390
  InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
6564
6391
  DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
6565
6392
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, async () => {
@@ -6579,7 +6406,6 @@ var ClientServicesHost = class {
6579
6406
  })
6580
6407
  });
6581
6408
  await this._serviceContext.open(ctx);
6582
- await identityService.open();
6583
6409
  const devtoolsProxy = this._config?.get("runtime.client.devtoolsProxy");
6584
6410
  if (devtoolsProxy) {
6585
6411
  this._devtoolsProxy = new WebsocketRpcClient({
@@ -6595,18 +6421,18 @@ var ClientServicesHost = class {
6595
6421
  this._open = true;
6596
6422
  this._statusUpdate.emit();
6597
6423
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
6598
- log19("opened", {
6424
+ log18("opened", {
6599
6425
  deviceKey
6600
6426
  }, {
6601
- F: __dxlog_file22,
6427
+ F: __dxlog_file21,
6602
6428
  L: 314,
6603
6429
  S: this,
6604
6430
  C: (f, a) => f(...a)
6605
6431
  });
6606
- log19.trace("dxos.client-services.host.open", trace10.end({
6432
+ log18.trace("dxos.client-services.host.open", trace10.end({
6607
6433
  id: traceId
6608
6434
  }), {
6609
- F: __dxlog_file22,
6435
+ F: __dxlog_file21,
6610
6436
  L: 315,
6611
6437
  S: this,
6612
6438
  C: (f, a) => f(...a)
@@ -6617,10 +6443,10 @@ var ClientServicesHost = class {
6617
6443
  return;
6618
6444
  }
6619
6445
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
6620
- log19("closing...", {
6446
+ log18("closing...", {
6621
6447
  deviceKey
6622
6448
  }, {
6623
- F: __dxlog_file22,
6449
+ F: __dxlog_file21,
6624
6450
  L: 326,
6625
6451
  S: this,
6626
6452
  C: (f, a) => f(...a)
@@ -6635,10 +6461,10 @@ var ClientServicesHost = class {
6635
6461
  await this._level?.close();
6636
6462
  this._open = false;
6637
6463
  this._statusUpdate.emit();
6638
- log19("closed", {
6464
+ log18("closed", {
6639
6465
  deviceKey
6640
6466
  }, {
6641
- F: __dxlog_file22,
6467
+ F: __dxlog_file21,
6642
6468
  L: 335,
6643
6469
  S: this,
6644
6470
  C: (f, a) => f(...a)
@@ -6646,32 +6472,32 @@ var ClientServicesHost = class {
6646
6472
  }
6647
6473
  async reset() {
6648
6474
  const traceId = PublicKey16.random().toHex();
6649
- log19.trace("dxos.sdk.client-services-host.reset", trace10.begin({
6475
+ log18.trace("dxos.sdk.client-services-host.reset", trace10.begin({
6650
6476
  id: traceId
6651
6477
  }), {
6652
- F: __dxlog_file22,
6478
+ F: __dxlog_file21,
6653
6479
  L: 340,
6654
6480
  S: this,
6655
6481
  C: (f, a) => f(...a)
6656
6482
  });
6657
- log19.info("resetting...", void 0, {
6658
- F: __dxlog_file22,
6483
+ log18.info("resetting...", void 0, {
6484
+ F: __dxlog_file21,
6659
6485
  L: 342,
6660
6486
  S: this,
6661
6487
  C: (f, a) => f(...a)
6662
6488
  });
6663
6489
  await this._serviceContext?.close();
6664
6490
  await this._storage.reset();
6665
- log19.info("reset", void 0, {
6666
- F: __dxlog_file22,
6491
+ log18.info("reset", void 0, {
6492
+ F: __dxlog_file21,
6667
6493
  L: 345,
6668
6494
  S: this,
6669
6495
  C: (f, a) => f(...a)
6670
6496
  });
6671
- log19.trace("dxos.sdk.client-services-host.reset", trace10.end({
6497
+ log18.trace("dxos.sdk.client-services-host.reset", trace10.end({
6672
6498
  id: traceId
6673
6499
  }), {
6674
- F: __dxlog_file22,
6500
+ F: __dxlog_file21,
6675
6501
  L: 346,
6676
6502
  S: this,
6677
6503
  C: (f, a) => f(...a)
@@ -6681,6 +6507,38 @@ var ClientServicesHost = class {
6681
6507
  async _createIdentity(params) {
6682
6508
  const identity = await this._serviceContext.createIdentity(params);
6683
6509
  await this._serviceContext.initialized.wait();
6510
+ const space = await this._serviceContext.dataSpaceManager.createSpace();
6511
+ const automergeIndex = space.automergeSpaceState.rootUrl;
6512
+ invariant18(automergeIndex, void 0, {
6513
+ F: __dxlog_file21,
6514
+ L: 358,
6515
+ S: this,
6516
+ A: [
6517
+ "automergeIndex",
6518
+ ""
6519
+ ]
6520
+ });
6521
+ const document = this._serviceContext.echoHost.automergeRepo.find(automergeIndex);
6522
+ await document.whenReady();
6523
+ const properties = {
6524
+ system: {
6525
+ type: encodeReference(getTypeReference(PropertiesType))
6526
+ },
6527
+ data: {
6528
+ [defaultKey]: identity.identityKey.toHex()
6529
+ },
6530
+ meta: {
6531
+ keys: []
6532
+ }
6533
+ };
6534
+ const propertiesId = PublicKey16.random().toHex();
6535
+ document.change((doc) => {
6536
+ assignDeep2(doc, [
6537
+ "objects",
6538
+ propertiesId
6539
+ ], properties);
6540
+ });
6541
+ await this._serviceContext.echoHost.flush();
6684
6542
  return identity;
6685
6543
  }
6686
6544
  };
@@ -6743,4 +6601,4 @@ export {
6743
6601
  ClientServicesProviderResource,
6744
6602
  DiagnosticsCollector
6745
6603
  };
6746
- //# sourceMappingURL=chunk-YJ5SPRLY.mjs.map
6604
+ //# sourceMappingURL=chunk-G25WUL6O.mjs.map