@dxos/client-services 0.5.9-main.21b00b3 → 0.5.9-main.2dbe289

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-6Y4QMNUK.mjs → chunk-QWL2M4EU.mjs} +589 -728
  2. package/dist/lib/browser/chunk-QWL2M4EU.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-FYT7BPEG.cjs → chunk-NPYJIVOX.cjs} +809 -944
  8. package/dist/lib/node/chunk-NPYJIVOX.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 -9
  33. package/src/packlets/testing/test-builder.ts +6 -11
  34. package/src/version.ts +1 -1
  35. package/dist/lib/browser/chunk-6Y4QMNUK.mjs.map +0 -7
  36. package/dist/lib/node/chunk-FYT7BPEG.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.21b00b3";
358
+ var DXOS_VERSION = "0.5.9-main.2dbe289";
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
  }
@@ -4396,8 +4270,8 @@ var DataSpace = class {
4396
4270
  newRoot.documentId
4397
4271
  ]);
4398
4272
  invariant13(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
4399
- F: __dxlog_file16,
4400
- L: 460,
4273
+ F: __dxlog_file15,
4274
+ L: 457,
4401
4275
  S: this,
4402
4276
  A: [
4403
4277
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
@@ -4407,16 +4281,16 @@ var DataSpace = class {
4407
4281
  epoch = {
4408
4282
  previousId: this._automergeSpaceState.lastEpoch?.id,
4409
4283
  number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
4410
- timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe3(),
4284
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe2(),
4411
4285
  automergeRoot: newRoot.url
4412
4286
  };
4413
4287
  }
4414
4288
  break;
4415
4289
  case CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT:
4416
4290
  {
4417
- log13.info("Fragmenting", void 0, {
4418
- F: __dxlog_file16,
4419
- L: 472,
4291
+ log12.info("Fragmenting", void 0, {
4292
+ F: __dxlog_file15,
4293
+ L: 469,
4420
4294
  S: this,
4421
4295
  C: (f, a) => f(...a)
4422
4296
  });
@@ -4427,8 +4301,8 @@ var DataSpace = class {
4427
4301
  const properties = findPropertiesObject(rootHandle.docSync());
4428
4302
  const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
4429
4303
  invariant13(properties, "Properties not found", {
4430
- F: __dxlog_file16,
4431
- L: 482,
4304
+ F: __dxlog_file15,
4305
+ L: 479,
4432
4306
  S: this,
4433
4307
  A: [
4434
4308
  "properties",
@@ -4443,8 +4317,8 @@ var DataSpace = class {
4443
4317
  };
4444
4318
  const newRoot = this._echoHost.automergeRepo.create(newSpaceDoc);
4445
4319
  invariant13(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
4446
- F: __dxlog_file16,
4447
- L: 487,
4320
+ F: __dxlog_file15,
4321
+ L: 484,
4448
4322
  S: this,
4449
4323
  A: [
4450
4324
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
@@ -4467,7 +4341,7 @@ var DataSpace = class {
4467
4341
  epoch = {
4468
4342
  previousId: this._automergeSpaceState.lastEpoch?.id,
4469
4343
  number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
4470
- timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe3(),
4344
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe2(),
4471
4345
  automergeRoot: newRoot.url
4472
4346
  };
4473
4347
  }
@@ -4475,8 +4349,8 @@ var DataSpace = class {
4475
4349
  case CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT:
4476
4350
  {
4477
4351
  invariant13(options.newAutomergeRoot, void 0, {
4478
- F: __dxlog_file16,
4479
- L: 517,
4352
+ F: __dxlog_file15,
4353
+ L: 514,
4480
4354
  S: this,
4481
4355
  A: [
4482
4356
  "options.newAutomergeRoot",
@@ -4486,7 +4360,7 @@ var DataSpace = class {
4486
4360
  epoch = {
4487
4361
  previousId: this._automergeSpaceState.lastEpoch?.id,
4488
4362
  number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
4489
- timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe3(),
4363
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe2(),
4490
4364
  automergeRoot: options.newAutomergeRoot
4491
4365
  };
4492
4366
  }
@@ -4506,7 +4380,7 @@ var DataSpace = class {
4506
4380
  })
4507
4381
  }
4508
4382
  });
4509
- await this.inner.controlPipeline.state.waitUntilTimeframe(new Timeframe3([
4383
+ await this.inner.controlPipeline.state.waitUntilTimeframe(new Timeframe2([
4510
4384
  [
4511
4385
  receipt.feedKey,
4512
4386
  receipt.seq
@@ -4515,30 +4389,25 @@ var DataSpace = class {
4515
4389
  await this._echoHost.updateIndexes();
4516
4390
  }
4517
4391
  async activate() {
4518
- if (![
4519
- SpaceState2.CLOSED,
4520
- SpaceState2.INACTIVE
4521
- ].includes(this._state)) {
4392
+ if (this._state !== SpaceState.INACTIVE) {
4522
4393
  return;
4523
4394
  }
4524
- await this._metadataStore.setSpaceState(this.key, SpaceState2.ACTIVE);
4395
+ await this._metadataStore.setSpaceState(this.key, SpaceState.ACTIVE);
4525
4396
  await this._open();
4526
4397
  this.initializeDataPipelineAsync();
4527
4398
  }
4528
4399
  async deactivate() {
4529
- if (this._state === SpaceState2.INACTIVE) {
4400
+ if (this._state === SpaceState.INACTIVE) {
4530
4401
  return;
4531
4402
  }
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]
4403
+ await this._metadataStore.setSpaceState(this.key, SpaceState.INACTIVE);
4404
+ await this._close();
4405
+ this._state = SpaceState.INACTIVE;
4406
+ log12("new state", {
4407
+ state: SpaceState[this._state]
4539
4408
  }, {
4540
- F: __dxlog_file16,
4541
- L: 571,
4409
+ F: __dxlog_file15,
4410
+ L: 567,
4542
4411
  S: this,
4543
4412
  C: (f, a) => f(...a)
4544
4413
  });
@@ -4556,7 +4425,7 @@ _ts_decorate4([
4556
4425
  ], DataSpace.prototype, "key", null);
4557
4426
  _ts_decorate4([
4558
4427
  trace6.info({
4559
- enum: SpaceState2
4428
+ enum: SpaceState
4560
4429
  })
4561
4430
  ], DataSpace.prototype, "state", null);
4562
4431
  _ts_decorate4([
@@ -4608,27 +4477,24 @@ var findPropertiesObject = (spaceDoc) => {
4608
4477
 
4609
4478
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
4610
4479
  import { Event as Event7, synchronized as synchronized2, trackLeaks as trackLeaks2 } from "@dxos/async";
4611
- import { PropertiesType } from "@dxos/client-protocol";
4612
4480
  import { cancelWithContext as cancelWithContext5, Context as Context9 } from "@dxos/context";
4613
- import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
4481
+ import { getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
4614
4482
  import { AuthStatus } from "@dxos/echo-pipeline";
4615
- import { encodeReference } from "@dxos/echo-protocol";
4616
- import { getTypeReference } from "@dxos/echo-schema";
4617
4483
  import { invariant as invariant14 } from "@dxos/invariant";
4618
4484
  import { PublicKey as PublicKey11 } from "@dxos/keys";
4619
- import { log as log14 } from "@dxos/log";
4485
+ import { log as log13 } from "@dxos/log";
4620
4486
  import { trace as Trace2 } from "@dxos/protocols";
4621
- import { Invitation as Invitation7, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
4487
+ import { Invitation as Invitation7, SpaceState as SpaceState2 } from "@dxos/protocols/proto/dxos/client/services";
4622
4488
  import { SpaceMember as SpaceMember6 } from "@dxos/protocols/proto/dxos/halo/credentials";
4623
4489
  import { Gossip as Gossip2, Presence as Presence2 } from "@dxos/teleport-extension-gossip";
4624
4490
  import { trace as trace7 } from "@dxos/tracing";
4625
- import { assignDeep as assignDeep2, ComplexMap as ComplexMap3, deferFunction as deferFunction2, forEachAsync } from "@dxos/util";
4491
+ import { ComplexMap as ComplexMap3, deferFunction as deferFunction2, forEachAsync } from "@dxos/util";
4626
4492
 
4627
4493
  // packages/sdk/client-services/src/packlets/spaces/genesis.ts
4628
4494
  import { createCredential } from "@dxos/credentials";
4629
4495
  import { failUndefined } from "@dxos/debug";
4630
4496
  import { AdmittedFeed as AdmittedFeed4, SpaceMember as SpaceMember5 } from "@dxos/protocols/proto/dxos/halo/credentials";
4631
- import { Timeframe as Timeframe4 } from "@dxos/timeframe";
4497
+ import { Timeframe as Timeframe3 } from "@dxos/timeframe";
4632
4498
  var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4633
4499
  const credentials = [
4634
4500
  await createCredential({
@@ -4678,7 +4544,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4678
4544
  "@type": "dxos.halo.credentials.Epoch",
4679
4545
  number: 0,
4680
4546
  previousId: void 0,
4681
- timeframe: new Timeframe4(),
4547
+ timeframe: new Timeframe3(),
4682
4548
  snapshotCid: void 0,
4683
4549
  automergeRoot
4684
4550
  }
@@ -4705,12 +4571,11 @@ function _ts_decorate5(decorators, target, key, desc) {
4705
4571
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4706
4572
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4707
4573
  }
4708
- var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
4574
+ var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
4709
4575
  var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
4710
4576
  var PRESENCE_OFFLINE_TIMEOUT = 2e4;
4711
- var DEFAULT_SPACE_KEY = "__DEFAULT__";
4712
4577
  var DataSpaceManager = class {
4713
- constructor(_spaceManager, _metadataStore, _keyring, _signingContext, _feedStore, _echoHost, _invitationsManager, _params) {
4578
+ constructor(_spaceManager, _metadataStore, _keyring, _signingContext, _feedStore, _echoHost, _invitationsManager, params) {
4714
4579
  this._spaceManager = _spaceManager;
4715
4580
  this._metadataStore = _metadataStore;
4716
4581
  this._keyring = _keyring;
@@ -4718,12 +4583,14 @@ var DataSpaceManager = class {
4718
4583
  this._feedStore = _feedStore;
4719
4584
  this._echoHost = _echoHost;
4720
4585
  this._invitationsManager = _invitationsManager;
4721
- this._params = _params;
4722
4586
  this._ctx = new Context9();
4723
4587
  this.updated = new Event7();
4724
4588
  this._spaces = new ComplexMap3(PublicKey11.hash);
4725
4589
  this._isOpen = false;
4726
4590
  this._instanceId = PublicKey11.random().toHex();
4591
+ const { spaceMemberPresenceAnnounceInterval = PRESENCE_ANNOUNCE_INTERVAL, spaceMemberPresenceOfflineTimeout = PRESENCE_OFFLINE_TIMEOUT } = params ?? {};
4592
+ this._spaceMemberPresenceAnnounceInterval = spaceMemberPresenceAnnounceInterval;
4593
+ this._spaceMemberPresenceOfflineTimeout = spaceMemberPresenceOfflineTimeout;
4727
4594
  trace7.diagnostic({
4728
4595
  id: "spaces",
4729
4596
  name: "Spaces",
@@ -4735,7 +4602,7 @@ var DataSpaceManager = class {
4735
4602
  const properties = rootDoc && findPropertiesObject(rootDoc);
4736
4603
  return {
4737
4604
  key: space.key.toHex(),
4738
- state: SpaceState3[space.state],
4605
+ state: SpaceState2[space.state],
4739
4606
  name: properties?.[1].data.name ?? null,
4740
4607
  inlineObjects: rootDoc ? Object.keys(rootDoc.objects ?? {}).length : null,
4741
4608
  linkedObjects: rootDoc ? Object.keys(rootDoc.links ?? {}).length : null,
@@ -4752,46 +4619,46 @@ var DataSpaceManager = class {
4752
4619
  return this._spaces;
4753
4620
  }
4754
4621
  async open() {
4755
- log14("open", void 0, {
4756
- F: __dxlog_file17,
4757
- L: 140,
4622
+ log13("open", void 0, {
4623
+ F: __dxlog_file16,
4624
+ L: 144,
4758
4625
  S: this,
4759
4626
  C: (f, a) => f(...a)
4760
4627
  });
4761
- log14.trace("dxos.echo.data-space-manager.open", Trace2.begin({
4628
+ log13.trace("dxos.echo.data-space-manager.open", Trace2.begin({
4762
4629
  id: this._instanceId
4763
4630
  }), {
4764
- F: __dxlog_file17,
4765
- L: 141,
4631
+ F: __dxlog_file16,
4632
+ L: 145,
4766
4633
  S: this,
4767
4634
  C: (f, a) => f(...a)
4768
4635
  });
4769
- log14("metadata loaded", {
4636
+ log13("metadata loaded", {
4770
4637
  spaces: this._metadataStore.spaces.length
4771
4638
  }, {
4772
- F: __dxlog_file17,
4773
- L: 142,
4639
+ F: __dxlog_file16,
4640
+ L: 146,
4774
4641
  S: this,
4775
4642
  C: (f, a) => f(...a)
4776
4643
  });
4777
4644
  await forEachAsync(this._metadataStore.spaces, async (spaceMetadata) => {
4778
4645
  try {
4779
- log14("load space", {
4646
+ log13("load space", {
4780
4647
  spaceMetadata
4781
4648
  }, {
4782
- F: __dxlog_file17,
4783
- L: 146,
4649
+ F: __dxlog_file16,
4650
+ L: 150,
4784
4651
  S: this,
4785
4652
  C: (f, a) => f(...a)
4786
4653
  });
4787
4654
  await this._constructSpace(spaceMetadata);
4788
4655
  } catch (err) {
4789
- log14.error("Error loading space", {
4656
+ log13.error("Error loading space", {
4790
4657
  spaceMetadata,
4791
4658
  err
4792
4659
  }, {
4793
- F: __dxlog_file17,
4794
- L: 149,
4660
+ F: __dxlog_file16,
4661
+ L: 153,
4795
4662
  S: this,
4796
4663
  C: (f, a) => f(...a)
4797
4664
  });
@@ -4799,19 +4666,24 @@ var DataSpaceManager = class {
4799
4666
  });
4800
4667
  this._isOpen = true;
4801
4668
  this.updated.emit();
4802
- log14.trace("dxos.echo.data-space-manager.open", Trace2.end({
4669
+ for (const space of this._spaces.values()) {
4670
+ if (space.state !== SpaceState2.INACTIVE) {
4671
+ space.initializeDataPipelineAsync();
4672
+ }
4673
+ }
4674
+ log13.trace("dxos.echo.data-space-manager.open", Trace2.end({
4803
4675
  id: this._instanceId
4804
4676
  }), {
4805
- F: __dxlog_file17,
4806
- L: 156,
4677
+ F: __dxlog_file16,
4678
+ L: 166,
4807
4679
  S: this,
4808
4680
  C: (f, a) => f(...a)
4809
4681
  });
4810
4682
  }
4811
4683
  async close() {
4812
- log14("close", void 0, {
4813
- F: __dxlog_file17,
4814
- L: 161,
4684
+ log13("close", void 0, {
4685
+ F: __dxlog_file16,
4686
+ L: 171,
4815
4687
  S: this,
4816
4688
  C: (f, a) => f(...a)
4817
4689
  });
@@ -4820,15 +4692,14 @@ var DataSpaceManager = class {
4820
4692
  for (const space of this._spaces.values()) {
4821
4693
  await space.close();
4822
4694
  }
4823
- this._spaces.clear();
4824
4695
  }
4825
4696
  /**
4826
4697
  * Creates a new space writing the genesis credentials to the control feed.
4827
4698
  */
4828
4699
  async createSpace() {
4829
4700
  invariant14(this._isOpen, "Not open.", {
4830
- F: __dxlog_file17,
4831
- L: 175,
4701
+ F: __dxlog_file16,
4702
+ L: 184,
4832
4703
  S: this,
4833
4704
  A: [
4834
4705
  "this._isOpen",
@@ -4843,25 +4714,24 @@ var DataSpaceManager = class {
4843
4714
  genesisFeedKey: controlFeedKey,
4844
4715
  controlFeedKey,
4845
4716
  dataFeedKey,
4846
- state: SpaceState3.ACTIVE
4717
+ state: SpaceState2.ACTIVE
4847
4718
  };
4848
- log14("creating space...", {
4719
+ log13("creating space...", {
4849
4720
  spaceKey
4850
4721
  }, {
4851
- F: __dxlog_file17,
4852
- L: 187,
4722
+ F: __dxlog_file16,
4723
+ L: 196,
4853
4724
  S: this,
4854
4725
  C: (f, a) => f(...a)
4855
4726
  });
4856
4727
  const root = await this._echoHost.createSpaceRoot(spaceKey);
4857
4728
  const space = await this._constructSpace(metadata);
4858
- await space.open();
4859
4729
  const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, root.url);
4860
4730
  await this._metadataStore.addSpace(metadata);
4861
4731
  const memberCredential = credentials[1];
4862
- invariant14(getCredentialAssertion3(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
4863
- F: __dxlog_file17,
4864
- L: 197,
4732
+ invariant14(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
4733
+ F: __dxlog_file16,
4734
+ L: 205,
4865
4735
  S: this,
4866
4736
  A: [
4867
4737
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -4873,63 +4743,19 @@ var DataSpaceManager = class {
4873
4743
  this.updated.emit();
4874
4744
  return space;
4875
4745
  }
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
4746
  // TODO(burdon): Rename join space.
4921
4747
  async acceptSpace(opts) {
4922
- log14("accept space", {
4748
+ log13("accept space", {
4923
4749
  opts
4924
4750
  }, {
4925
- F: __dxlog_file17,
4926
- L: 249,
4751
+ F: __dxlog_file16,
4752
+ L: 217,
4927
4753
  S: this,
4928
4754
  C: (f, a) => f(...a)
4929
4755
  });
4930
4756
  invariant14(this._isOpen, "Not open.", {
4931
- F: __dxlog_file17,
4932
- L: 250,
4757
+ F: __dxlog_file16,
4758
+ L: 218,
4933
4759
  S: this,
4934
4760
  A: [
4935
4761
  "this._isOpen",
@@ -4937,8 +4763,8 @@ var DataSpaceManager = class {
4937
4763
  ]
4938
4764
  });
4939
4765
  invariant14(!this._spaces.has(opts.spaceKey), "Space already exists.", {
4940
- F: __dxlog_file17,
4941
- L: 251,
4766
+ F: __dxlog_file16,
4767
+ L: 219,
4942
4768
  S: this,
4943
4769
  A: [
4944
4770
  "!this._spaces.has(opts.spaceKey)",
@@ -4952,7 +4778,6 @@ var DataSpaceManager = class {
4952
4778
  dataTimeframe: opts.dataTimeframe
4953
4779
  };
4954
4780
  const space = await this._constructSpace(metadata);
4955
- await space.open();
4956
4781
  await this._metadataStore.addSpace(metadata);
4957
4782
  space.initializeDataPipelineAsync();
4958
4783
  this.updated.emit();
@@ -4966,15 +4791,15 @@ var DataSpaceManager = class {
4966
4791
  async waitUntilSpaceReady(spaceKey) {
4967
4792
  await cancelWithContext5(this._ctx, this.updated.waitForCondition(() => {
4968
4793
  const space = this._spaces.get(spaceKey);
4969
- return !!space && space.state === SpaceState3.READY;
4794
+ return !!space && space.state === SpaceState2.READY;
4970
4795
  }));
4971
4796
  }
4972
4797
  async _constructSpace(metadata) {
4973
- log14("construct space", {
4798
+ log13("construct space", {
4974
4799
  metadata
4975
4800
  }, {
4976
- F: __dxlog_file17,
4977
- L: 285,
4801
+ F: __dxlog_file16,
4802
+ L: 252,
4978
4803
  S: this,
4979
4804
  C: (f, a) => f(...a)
4980
4805
  });
@@ -4982,8 +4807,8 @@ var DataSpaceManager = class {
4982
4807
  localPeerId: this._signingContext.deviceKey
4983
4808
  });
4984
4809
  const presence = new Presence2({
4985
- announceInterval: this._params?.spaceMemberPresenceAnnounceInterval ?? PRESENCE_ANNOUNCE_INTERVAL,
4986
- offlineTimeout: this._params?.spaceMemberPresenceOfflineTimeout ?? PRESENCE_OFFLINE_TIMEOUT,
4810
+ announceInterval: this._spaceMemberPresenceAnnounceInterval,
4811
+ offlineTimeout: this._spaceMemberPresenceOfflineTimeout,
4987
4812
  identityKey: this._signingContext.identityKey,
4988
4813
  gossip
4989
4814
  });
@@ -5010,15 +4835,15 @@ var DataSpaceManager = class {
5010
4835
  session.addExtension("dxos.mesh.teleport.automerge", this._echoHost.createReplicationExtension());
5011
4836
  },
5012
4837
  onAuthFailure: () => {
5013
- log14.warn("auth failure", void 0, {
5014
- F: __dxlog_file17,
5015
- L: 322,
4838
+ log13.warn("auth failure", void 0, {
4839
+ F: __dxlog_file16,
4840
+ L: 289,
5016
4841
  S: this,
5017
4842
  C: (f, a) => f(...a)
5018
4843
  });
5019
4844
  },
5020
4845
  onMemberRolesChanged: async (members) => {
5021
- if (dataSpace?.state === SpaceState3.READY) {
4846
+ if (dataSpace?.state === SpaceState2.READY) {
5022
4847
  this._handleMemberRoleChanges(presence, space.protocol, members);
5023
4848
  }
5024
4849
  },
@@ -5031,7 +4856,7 @@ var DataSpaceManager = class {
5031
4856
  dataFeed && await space.setDataFeed(dataFeed);
5032
4857
  const dataSpace = new DataSpace({
5033
4858
  inner: space,
5034
- initialState: metadata.state === SpaceState3.INACTIVE ? SpaceState3.INACTIVE : SpaceState3.CLOSED,
4859
+ initialState: metadata.state === SpaceState2.INACTIVE ? SpaceState2.INACTIVE : SpaceState2.CLOSED,
5035
4860
  metadataStore: this._metadataStore,
5036
4861
  gossip,
5037
4862
  presence,
@@ -5041,22 +4866,22 @@ var DataSpaceManager = class {
5041
4866
  signingContext: this._signingContext,
5042
4867
  callbacks: {
5043
4868
  beforeReady: async () => {
5044
- log14("before space ready", {
4869
+ log13("before space ready", {
5045
4870
  space: space.key
5046
4871
  }, {
5047
- F: __dxlog_file17,
5048
- L: 349,
4872
+ F: __dxlog_file16,
4873
+ L: 316,
5049
4874
  S: this,
5050
4875
  C: (f, a) => f(...a)
5051
4876
  });
5052
4877
  },
5053
4878
  afterReady: async () => {
5054
- log14("after space ready", {
4879
+ log13("after space ready", {
5055
4880
  space: space.key,
5056
4881
  open: this._isOpen
5057
4882
  }, {
5058
- F: __dxlog_file17,
5059
- L: 352,
4883
+ F: __dxlog_file16,
4884
+ L: 319,
5060
4885
  S: this,
5061
4886
  C: (f, a) => f(...a)
5062
4887
  });
@@ -5071,11 +4896,11 @@ var DataSpaceManager = class {
5071
4896
  }
5072
4897
  },
5073
4898
  beforeClose: async () => {
5074
- log14("before space close", {
4899
+ log13("before space close", {
5075
4900
  space: space.key
5076
4901
  }, {
5077
- F: __dxlog_file17,
5078
- L: 360,
4902
+ F: __dxlog_file16,
4903
+ L: 327,
5079
4904
  S: this,
5080
4905
  C: (f, a) => f(...a)
5081
4906
  });
@@ -5084,10 +4909,13 @@ var DataSpaceManager = class {
5084
4909
  cache: metadata.cache
5085
4910
  });
5086
4911
  presence.newPeer.on((peerState) => {
5087
- if (dataSpace.state === SpaceState3.READY) {
4912
+ if (dataSpace.state === SpaceState2.READY) {
5088
4913
  this._handleNewPeerConnected(space, peerState);
5089
4914
  }
5090
4915
  });
4916
+ if (metadata.state !== SpaceState2.INACTIVE) {
4917
+ await dataSpace.open();
4918
+ }
5091
4919
  if (metadata.controlTimeframe) {
5092
4920
  dataSpace.inner.controlPipeline.state.setTargetTimeframe(metadata.controlTimeframe);
5093
4921
  }
@@ -5106,17 +4934,17 @@ var DataSpaceManager = class {
5106
4934
  return (s && member.role === SpaceMember6.Role.REMOVED !== (s.authStatus === AuthStatus.FAILURE)) ?? false;
5107
4935
  });
5108
4936
  sessionsToClose.forEach((session) => {
5109
- void session.close().catch(log14.error);
4937
+ void session.close().catch(log13.error);
5110
4938
  });
5111
4939
  closedSessions += sessionsToClose.length;
5112
4940
  }
5113
- log14("processed member role changes", {
4941
+ log13("processed member role changes", {
5114
4942
  roleChangeCount: memberInfo.length,
5115
4943
  peersOnline: presence.getPeersOnline().length,
5116
4944
  closedSessions
5117
4945
  }, {
5118
- F: __dxlog_file17,
5119
- L: 396,
4946
+ F: __dxlog_file16,
4947
+ L: 367,
5120
4948
  S: this,
5121
4949
  C: (f, a) => f(...a)
5122
4950
  });
@@ -5127,20 +4955,20 @@ var DataSpaceManager = class {
5127
4955
  if (role === SpaceMember6.Role.REMOVED) {
5128
4956
  const session = peerState.peerId && space.protocol.sessions.get(peerState.peerId);
5129
4957
  if (session != null) {
5130
- log14("closing a session with a removed peer", {
4958
+ log13("closing a session with a removed peer", {
5131
4959
  peerId: peerState.peerId
5132
4960
  }, {
5133
- F: __dxlog_file17,
5134
- L: 410,
4961
+ F: __dxlog_file16,
4962
+ L: 381,
5135
4963
  S: this,
5136
4964
  C: (f, a) => f(...a)
5137
4965
  });
5138
- void session.close().catch(log14.error);
4966
+ void session.close().catch(log13.error);
5139
4967
  }
5140
4968
  }
5141
4969
  }
5142
4970
  async _handleInvitationStatusChange(dataSpace, delegatedInvitation, isActive) {
5143
- if (dataSpace?.state !== SpaceState3.READY) {
4971
+ if (dataSpace?.state !== SpaceState2.READY) {
5144
4972
  return;
5145
4973
  }
5146
4974
  if (isActive) {
@@ -5194,15 +5022,15 @@ DataSpaceManager = _ts_decorate5([
5194
5022
  // packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
5195
5023
  import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTask as scheduleTask6 } from "@dxos/async";
5196
5024
  import { Stream as Stream10 } from "@dxos/codec-protobuf";
5197
- import { createAdmissionCredentials as createAdmissionCredentials2, getCredentialAssertion as getCredentialAssertion4 } from "@dxos/credentials";
5025
+ import { createAdmissionCredentials as createAdmissionCredentials2, getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
5198
5026
  import { raise as raise2 } from "@dxos/debug";
5199
5027
  import { writeMessages as writeMessages3 } from "@dxos/feed-store";
5200
5028
  import { invariant as invariant15 } from "@dxos/invariant";
5201
- import { log as log15 } from "@dxos/log";
5029
+ import { log as log14 } from "@dxos/log";
5202
5030
  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";
5031
+ import { SpaceMember as SpaceMember7, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
5204
5032
  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";
5033
+ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
5206
5034
  var SpacesServiceImpl = class {
5207
5035
  constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
5208
5036
  this._identityManager = _identityManager;
@@ -5221,10 +5049,10 @@ var SpacesServiceImpl = class {
5221
5049
  const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError2(spaceKey));
5222
5050
  if (state) {
5223
5051
  switch (state) {
5224
- case SpaceState4.ACTIVE:
5052
+ case SpaceState3.ACTIVE:
5225
5053
  await space.activate();
5226
5054
  break;
5227
- case SpaceState4.INACTIVE:
5055
+ case SpaceState3.INACTIVE:
5228
5056
  await space.deactivate();
5229
5057
  break;
5230
5058
  default:
@@ -5246,7 +5074,7 @@ var SpacesServiceImpl = class {
5246
5074
  }
5247
5075
  const credentials = await createAdmissionCredentials2(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
5248
5076
  invariant15(credentials[0].credential, void 0, {
5249
- F: __dxlog_file18,
5077
+ F: __dxlog_file17,
5250
5078
  L: 97,
5251
5079
  S: this,
5252
5080
  A: [
@@ -5255,8 +5083,8 @@ var SpacesServiceImpl = class {
5255
5083
  ]
5256
5084
  });
5257
5085
  const spaceMemberCredential = credentials[0].credential.credential;
5258
- invariant15(getCredentialAssertion4(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
5259
- F: __dxlog_file18,
5086
+ invariant15(getCredentialAssertion3(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
5087
+ F: __dxlog_file17,
5260
5088
  L: 99,
5261
5089
  S: this,
5262
5090
  A: [
@@ -5271,10 +5099,10 @@ var SpacesServiceImpl = class {
5271
5099
  const scheduler = new UpdateScheduler(ctx, async () => {
5272
5100
  const dataSpaceManager = await this._getDataSpaceManager();
5273
5101
  const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
5274
- log15("update", {
5102
+ log14("update", {
5275
5103
  spaces
5276
5104
  }, {
5277
- F: __dxlog_file18,
5105
+ F: __dxlog_file17,
5278
5106
  L: 110,
5279
5107
  S: this,
5280
5108
  C: (f, a) => f(...a)
@@ -5358,7 +5186,7 @@ var SpacesServiceImpl = class {
5358
5186
  });
5359
5187
  } else {
5360
5188
  invariant15(!credential.id, "Id on unsigned credentials is not allowed", {
5361
- F: __dxlog_file18,
5189
+ F: __dxlog_file17,
5362
5190
  L: 198,
5363
5191
  S: this,
5364
5192
  A: [
@@ -5367,7 +5195,7 @@ var SpacesServiceImpl = class {
5367
5195
  ]
5368
5196
  });
5369
5197
  invariant15(this._identityManager.identity, "Identity is not available", {
5370
- F: __dxlog_file18,
5198
+ F: __dxlog_file17,
5371
5199
  L: 199,
5372
5200
  S: this,
5373
5201
  A: [
@@ -5377,7 +5205,7 @@ var SpacesServiceImpl = class {
5377
5205
  });
5378
5206
  const signer = this._identityManager.identity.getIdentityCredentialSigner();
5379
5207
  invariant15(credential.issuer.equals(signer.getIssuer()), void 0, {
5380
- F: __dxlog_file18,
5208
+ F: __dxlog_file17,
5381
5209
  L: 201,
5382
5210
  S: this,
5383
5211
  A: [
@@ -5467,8 +5295,8 @@ var getChannelId = (channel) => `user-channel/${channel}`;
5467
5295
 
5468
5296
  // packages/sdk/client-services/src/packlets/services/service-context.ts
5469
5297
  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";
5298
+ import { Context as Context10, Resource } from "@dxos/context";
5299
+ import { getCredentialAssertion as getCredentialAssertion4 } from "@dxos/credentials";
5472
5300
  import { failUndefined as failUndefined2 } from "@dxos/debug";
5473
5301
  import { EchoHost } from "@dxos/echo-db";
5474
5302
  import { MetadataStore, SnapshotStore, SpaceManager, valueEncoding } from "@dxos/echo-pipeline";
@@ -5476,7 +5304,7 @@ import { FeedFactory, FeedStore } from "@dxos/feed-store";
5476
5304
  import { invariant as invariant16 } from "@dxos/invariant";
5477
5305
  import { Keyring } from "@dxos/keyring";
5478
5306
  import { PublicKey as PublicKey12 } from "@dxos/keys";
5479
- import { log as log16 } from "@dxos/log";
5307
+ import { log as log15 } from "@dxos/log";
5480
5308
  import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace9 } from "@dxos/protocols";
5481
5309
  import { Invitation as Invitation8 } from "@dxos/protocols/proto/dxos/client/services";
5482
5310
  import { BlobStore } from "@dxos/teleport-extension-object-sync";
@@ -5492,8 +5320,8 @@ function _ts_decorate6(decorators, target, key, desc) {
5492
5320
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5493
5321
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5494
5322
  }
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 {
5323
+ var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
5324
+ var ServiceContext = class extends Resource {
5497
5325
  constructor(storage, level, networkManager, signalManager, _runtimeParams) {
5498
5326
  super();
5499
5327
  this.storage = storage;
@@ -5536,16 +5364,16 @@ var ServiceContext = class extends Resource2 {
5536
5364
  }
5537
5365
  async _open(ctx) {
5538
5366
  await this._checkStorageVersion();
5539
- log16("opening...", void 0, {
5540
- F: __dxlog_file19,
5367
+ log15("opening...", void 0, {
5368
+ F: __dxlog_file18,
5541
5369
  L: 152,
5542
5370
  S: this,
5543
5371
  C: (f, a) => f(...a)
5544
5372
  });
5545
- log16.trace("dxos.sdk.service-context.open", trace9.begin({
5373
+ log15.trace("dxos.sdk.service-context.open", trace9.begin({
5546
5374
  id: this._instanceId
5547
5375
  }), {
5548
- F: __dxlog_file19,
5376
+ F: __dxlog_file18,
5549
5377
  L: 153,
5550
5378
  S: this,
5551
5379
  C: (f, a) => f(...a)
@@ -5560,32 +5388,32 @@ var ServiceContext = class extends Resource2 {
5560
5388
  await this._initialize(ctx);
5561
5389
  }
5562
5390
  const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
5563
- log16("loaded persistent invitations", {
5391
+ log15("loaded persistent invitations", {
5564
5392
  count: loadedInvitations.invitations?.length
5565
5393
  }, {
5566
- F: __dxlog_file19,
5394
+ F: __dxlog_file18,
5567
5395
  L: 166,
5568
5396
  S: this,
5569
5397
  C: (f, a) => f(...a)
5570
5398
  });
5571
- log16.trace("dxos.sdk.service-context.open", trace9.end({
5399
+ log15.trace("dxos.sdk.service-context.open", trace9.end({
5572
5400
  id: this._instanceId
5573
5401
  }), {
5574
- F: __dxlog_file19,
5402
+ F: __dxlog_file18,
5575
5403
  L: 168,
5576
5404
  S: this,
5577
5405
  C: (f, a) => f(...a)
5578
5406
  });
5579
- log16("opened", void 0, {
5580
- F: __dxlog_file19,
5407
+ log15("opened", void 0, {
5408
+ F: __dxlog_file18,
5581
5409
  L: 169,
5582
5410
  S: this,
5583
5411
  C: (f, a) => f(...a)
5584
5412
  });
5585
5413
  }
5586
5414
  async _close(ctx) {
5587
- log16("closing...", void 0, {
5588
- F: __dxlog_file19,
5415
+ log15("closing...", void 0, {
5416
+ F: __dxlog_file18,
5589
5417
  L: 173,
5590
5418
  S: this,
5591
5419
  C: (f, a) => f(...a)
@@ -5601,8 +5429,8 @@ var ServiceContext = class extends Resource2 {
5601
5429
  await this.echoHost.close(ctx);
5602
5430
  await this.networkManager.close();
5603
5431
  await this.signalManager.close();
5604
- log16("closed", void 0, {
5605
- F: __dxlog_file19,
5432
+ log15("closed", void 0, {
5433
+ F: __dxlog_file18,
5606
5434
  L: 185,
5607
5435
  S: this,
5608
5436
  C: (f, a) => f(...a)
@@ -5616,7 +5444,7 @@ var ServiceContext = class extends Resource2 {
5616
5444
  getInvitationHandler(invitation) {
5617
5445
  const factory = this._handlerFactories.get(invitation.kind);
5618
5446
  invariant16(factory, `Unknown invitation kind: ${invitation.kind}`, {
5619
- F: __dxlog_file19,
5447
+ F: __dxlog_file18,
5620
5448
  L: 196,
5621
5449
  S: this,
5622
5450
  A: [
@@ -5647,8 +5475,8 @@ var ServiceContext = class extends Resource2 {
5647
5475
  }
5648
5476
  // Called when identity is created.
5649
5477
  async _initialize(ctx) {
5650
- log16("initializing spaces...", void 0, {
5651
- F: __dxlog_file19,
5478
+ log15("initializing spaces...", void 0, {
5479
+ F: __dxlog_file18,
5652
5480
  L: 227,
5653
5481
  S: this,
5654
5482
  C: (f, a) => f(...a)
@@ -5671,7 +5499,7 @@ var ServiceContext = class extends Resource2 {
5671
5499
  await this.dataSpaceManager.open();
5672
5500
  this._handlerFactories.set(Invitation8.Kind.SPACE, (invitation) => {
5673
5501
  invariant16(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
5674
- F: __dxlog_file19,
5502
+ F: __dxlog_file18,
5675
5503
  L: 252,
5676
5504
  S: this,
5677
5505
  A: [
@@ -5684,7 +5512,7 @@ var ServiceContext = class extends Resource2 {
5684
5512
  this.initialized.wake();
5685
5513
  this._deviceSpaceSync = {
5686
5514
  processCredential: async (credential) => {
5687
- const assertion = getCredentialAssertion5(credential);
5515
+ const assertion = getCredentialAssertion4(credential);
5688
5516
  if (assertion["@type"] !== "dxos.halo.credentials.SpaceMember") {
5689
5517
  return;
5690
5518
  }
@@ -5692,10 +5520,10 @@ var ServiceContext = class extends Resource2 {
5692
5520
  return;
5693
5521
  }
5694
5522
  if (!this.dataSpaceManager) {
5695
- log16("dataSpaceManager not initialized yet, ignoring space admission", {
5523
+ log15("dataSpaceManager not initialized yet, ignoring space admission", {
5696
5524
  details: assertion
5697
5525
  }, {
5698
- F: __dxlog_file19,
5526
+ F: __dxlog_file18,
5699
5527
  L: 268,
5700
5528
  S: this,
5701
5529
  C: (f, a) => f(...a)
@@ -5703,10 +5531,10 @@ var ServiceContext = class extends Resource2 {
5703
5531
  return;
5704
5532
  }
5705
5533
  if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
5706
- log16("space already exists, ignoring space admission", {
5534
+ log15("space already exists, ignoring space admission", {
5707
5535
  details: assertion
5708
5536
  }, {
5709
- F: __dxlog_file19,
5537
+ F: __dxlog_file18,
5710
5538
  L: 272,
5711
5539
  S: this,
5712
5540
  C: (f, a) => f(...a)
@@ -5714,10 +5542,10 @@ var ServiceContext = class extends Resource2 {
5714
5542
  return;
5715
5543
  }
5716
5544
  try {
5717
- log16("accepting space recorded in halo", {
5545
+ log15("accepting space recorded in halo", {
5718
5546
  details: assertion
5719
5547
  }, {
5720
- F: __dxlog_file19,
5548
+ F: __dxlog_file18,
5721
5549
  L: 277,
5722
5550
  S: this,
5723
5551
  C: (f, a) => f(...a)
@@ -5727,8 +5555,8 @@ var ServiceContext = class extends Resource2 {
5727
5555
  genesisFeedKey: assertion.genesisFeedKey
5728
5556
  });
5729
5557
  } catch (err) {
5730
- log16.catch(err, void 0, {
5731
- F: __dxlog_file19,
5558
+ log15.catch(err, void 0, {
5559
+ F: __dxlog_file18,
5732
5560
  L: 283,
5733
5561
  S: this,
5734
5562
  C: (f, a) => f(...a)
@@ -5777,7 +5605,7 @@ var ServiceRegistry = class {
5777
5605
  // packages/sdk/client-services/src/packlets/locks/browser.ts
5778
5606
  import { asyncTimeout as asyncTimeout3, Trigger as Trigger8 } from "@dxos/async";
5779
5607
  import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
5780
- import { log as log17, logInfo } from "@dxos/log";
5608
+ import { log as log16, logInfo } from "@dxos/log";
5781
5609
  function _ts_decorate7(decorators, target, key, desc) {
5782
5610
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5783
5611
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -5788,7 +5616,7 @@ function _ts_decorate7(decorators, target, key, desc) {
5788
5616
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5789
5617
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5790
5618
  }
5791
- var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/browser.ts";
5619
+ var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/browser.ts";
5792
5620
  var Message;
5793
5621
  (function(Message2) {
5794
5622
  Message2["ACQUIRING"] = "acquiring";
@@ -5810,29 +5638,29 @@ var Lock = class {
5810
5638
  message: "acquiring"
5811
5639
  });
5812
5640
  try {
5813
- log17("aquiring lock...", void 0, {
5814
- F: __dxlog_file20,
5641
+ log16("aquiring lock...", void 0, {
5642
+ F: __dxlog_file19,
5815
5643
  L: 42,
5816
5644
  S: this,
5817
5645
  C: (f, a) => f(...a)
5818
5646
  });
5819
5647
  await asyncTimeout3(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
5820
- log17("acquired lock", void 0, {
5821
- F: __dxlog_file20,
5648
+ log16("acquired lock", void 0, {
5649
+ F: __dxlog_file19,
5822
5650
  L: 44,
5823
5651
  S: this,
5824
5652
  C: (f, a) => f(...a)
5825
5653
  });
5826
5654
  } catch {
5827
- log17("stealing lock...", void 0, {
5828
- F: __dxlog_file20,
5655
+ log16("stealing lock...", void 0, {
5656
+ F: __dxlog_file19,
5829
5657
  L: 46,
5830
5658
  S: this,
5831
5659
  C: (f, a) => f(...a)
5832
5660
  });
5833
5661
  await this._requestLock(true);
5834
- log17("stolen lock", void 0, {
5835
- F: __dxlog_file20,
5662
+ log16("stolen lock", void 0, {
5663
+ F: __dxlog_file19,
5836
5664
  L: 48,
5837
5665
  S: this,
5838
5666
  C: (f, a) => f(...a)
@@ -5848,10 +5676,10 @@ var Lock = class {
5848
5676
  }
5849
5677
  }
5850
5678
  async _requestLock(steal = false) {
5851
- log17("requesting lock...", {
5679
+ log16("requesting lock...", {
5852
5680
  steal
5853
5681
  }, {
5854
- F: __dxlog_file20,
5682
+ F: __dxlog_file19,
5855
5683
  L: 63,
5856
5684
  S: this,
5857
5685
  C: (f, a) => f(...a)
@@ -5864,15 +5692,15 @@ var Lock = class {
5864
5692
  acquired.wake();
5865
5693
  this._releaseTrigger = new Trigger8();
5866
5694
  await this._releaseTrigger.wait();
5867
- log17("releasing lock...", void 0, {
5868
- F: __dxlog_file20,
5695
+ log16("releasing lock...", void 0, {
5696
+ F: __dxlog_file19,
5869
5697
  L: 72,
5870
5698
  S: this,
5871
5699
  C: (f, a) => f(...a)
5872
5700
  });
5873
5701
  await this._onRelease?.();
5874
- log17("released lock", void 0, {
5875
- F: __dxlog_file20,
5702
+ log16("released lock", void 0, {
5703
+ F: __dxlog_file19,
5876
5704
  L: 74,
5877
5705
  S: this,
5878
5706
  C: (f, a) => f(...a)
@@ -5881,10 +5709,10 @@ var Lock = class {
5881
5709
  await this._onRelease?.();
5882
5710
  });
5883
5711
  await acquired.wait();
5884
- log17("recieved lock", {
5712
+ log16("recieved lock", {
5885
5713
  steal
5886
5714
  }, {
5887
- F: __dxlog_file20,
5715
+ F: __dxlog_file19,
5888
5716
  L: 81,
5889
5717
  S: this,
5890
5718
  C: (f, a) => f(...a)
@@ -5974,16 +5802,19 @@ var createLevel = async (config) => {
5974
5802
 
5975
5803
  // packages/sdk/client-services/src/packlets/services/service-host.ts
5976
5804
  import { Event as Event9, synchronized as synchronized3 } from "@dxos/async";
5977
- import { clientServiceBundle } from "@dxos/client-protocol";
5805
+ import { clientServiceBundle, defaultKey, PropertiesType } from "@dxos/client-protocol";
5978
5806
  import { Context as Context11 } from "@dxos/context";
5807
+ import { encodeReference } from "@dxos/echo-protocol";
5808
+ import { getTypeReference } from "@dxos/echo-schema";
5979
5809
  import { invariant as invariant18 } from "@dxos/invariant";
5980
5810
  import { PublicKey as PublicKey16 } from "@dxos/keys";
5981
- import { log as log19 } from "@dxos/log";
5811
+ import { log as log18 } from "@dxos/log";
5982
5812
  import { WebsocketSignalManager } from "@dxos/messaging";
5983
5813
  import { SwarmNetworkManager, createSimplePeerTransportFactory } from "@dxos/network-manager";
5984
5814
  import { trace as trace10 } from "@dxos/protocols";
5985
5815
  import { SystemStatus } from "@dxos/protocols/proto/dxos/client/services";
5986
5816
  import { TRACE_PROCESSOR as TRACE_PROCESSOR3, trace as Trace4 } from "@dxos/tracing";
5817
+ import { assignDeep as assignDeep2 } from "@dxos/util";
5987
5818
  import { WebsocketRpcClient } from "@dxos/websocket-rpc";
5988
5819
 
5989
5820
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
@@ -5991,7 +5822,7 @@ import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
5991
5822
  import { Stream as Stream11 } from "@dxos/codec-protobuf";
5992
5823
  import { invariant as invariant17 } from "@dxos/invariant";
5993
5824
  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";
5825
+ var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
5995
5826
  var DevicesServiceImpl = class {
5996
5827
  constructor(_identityManager) {
5997
5828
  this._identityManager = _identityManager;
@@ -6009,7 +5840,7 @@ var DevicesServiceImpl = class {
6009
5840
  });
6010
5841
  } else {
6011
5842
  invariant17(this._identityManager.identity?.presence, "presence not present", {
6012
- F: __dxlog_file21,
5843
+ F: __dxlog_file20,
6013
5844
  L: 32,
6014
5845
  S: this,
6015
5846
  A: [
@@ -6119,7 +5950,7 @@ var findConfigs = () => {
6119
5950
  import { Event as Event8 } from "@dxos/async";
6120
5951
  import { Stream as Stream12 } from "@dxos/codec-protobuf";
6121
5952
  import { PublicKey as PublicKey15 } from "@dxos/keys";
6122
- import { getContextFromEntry, log as log18 } from "@dxos/log";
5953
+ import { getContextFromEntry, log as log17 } from "@dxos/log";
6123
5954
  import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
6124
5955
  import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
6125
5956
  var LoggingServiceImpl = class {
@@ -6132,11 +5963,11 @@ var LoggingServiceImpl = class {
6132
5963
  };
6133
5964
  }
6134
5965
  async open() {
6135
- log18.runtimeConfig.processors.push(this._logProcessor);
5966
+ log17.runtimeConfig.processors.push(this._logProcessor);
6136
5967
  }
6137
5968
  async close() {
6138
- const index = log18.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
6139
- log18.runtimeConfig.processors.splice(index, 1);
5969
+ const index = log17.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
5970
+ log17.runtimeConfig.processors.splice(index, 1);
6140
5971
  }
6141
5972
  async controlMetrics({ reset, record }) {
6142
5973
  if (reset) {
@@ -6340,7 +6171,7 @@ function _ts_decorate8(decorators, target, key, desc) {
6340
6171
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6341
6172
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6342
6173
  }
6343
- var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
6174
+ var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
6344
6175
  var ClientServicesHost = class {
6345
6176
  constructor({
6346
6177
  config,
@@ -6360,7 +6191,7 @@ var ClientServicesHost = class {
6360
6191
  this._storage = storage;
6361
6192
  this._level = level;
6362
6193
  this._callbacks = callbacks;
6363
- this._runtimeParams = runtimeParams ?? {};
6194
+ this._runtimeParams = runtimeParams;
6364
6195
  if (config) {
6365
6196
  this.initialize({
6366
6197
  config,
@@ -6429,24 +6260,24 @@ var ClientServicesHost = class {
6429
6260
  */
6430
6261
  initialize({ config, ...options }) {
6431
6262
  invariant18(!this._open, "service host is open", {
6432
- F: __dxlog_file22,
6433
- L: 186,
6263
+ F: __dxlog_file21,
6264
+ L: 189,
6434
6265
  S: this,
6435
6266
  A: [
6436
6267
  "!this._open",
6437
6268
  "'service host is open'"
6438
6269
  ]
6439
6270
  });
6440
- log19("initializing...", void 0, {
6441
- F: __dxlog_file22,
6442
- L: 187,
6271
+ log18("initializing...", void 0, {
6272
+ F: __dxlog_file21,
6273
+ L: 190,
6443
6274
  S: this,
6444
6275
  C: (f, a) => f(...a)
6445
6276
  });
6446
6277
  if (config) {
6447
6278
  invariant18(!this._config, "config already set", {
6448
- F: __dxlog_file22,
6449
- L: 190,
6279
+ F: __dxlog_file21,
6280
+ L: 193,
6450
6281
  S: this,
6451
6282
  A: [
6452
6283
  "!this._config",
@@ -6459,9 +6290,9 @@ var ClientServicesHost = class {
6459
6290
  }
6460
6291
  }
6461
6292
  if (!options.signalManager) {
6462
- log19.warn("running signaling without telemetry metadata.", void 0, {
6463
- F: __dxlog_file22,
6464
- L: 198,
6293
+ log18.warn("running signaling without telemetry metadata.", void 0, {
6294
+ F: __dxlog_file21,
6295
+ L: 201,
6465
6296
  S: this,
6466
6297
  C: (f, a) => f(...a)
6467
6298
  });
@@ -6471,8 +6302,8 @@ var ClientServicesHost = class {
6471
6302
  }), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
6472
6303
  this._signalManager = signalManager;
6473
6304
  invariant18(!this._networkManager, "network manager already set", {
6474
- F: __dxlog_file22,
6475
- L: 209,
6305
+ F: __dxlog_file21,
6306
+ L: 212,
6476
6307
  S: this,
6477
6308
  A: [
6478
6309
  "!this._networkManager",
@@ -6484,9 +6315,9 @@ var ClientServicesHost = class {
6484
6315
  transportFactory,
6485
6316
  signalManager
6486
6317
  });
6487
- log19("initialized", void 0, {
6488
- F: __dxlog_file22,
6489
- L: 216,
6318
+ log18("initialized", void 0, {
6319
+ F: __dxlog_file21,
6320
+ L: 219,
6490
6321
  S: this,
6491
6322
  C: (f, a) => f(...a)
6492
6323
  });
@@ -6496,17 +6327,17 @@ var ClientServicesHost = class {
6496
6327
  return;
6497
6328
  }
6498
6329
  const traceId = PublicKey16.random().toHex();
6499
- log19.trace("dxos.client-services.host.open", trace10.begin({
6330
+ log18.trace("dxos.client-services.host.open", trace10.begin({
6500
6331
  id: traceId
6501
6332
  }), {
6502
- F: __dxlog_file22,
6503
- L: 227,
6333
+ F: __dxlog_file21,
6334
+ L: 230,
6504
6335
  S: this,
6505
6336
  C: (f, a) => f(...a)
6506
6337
  });
6507
6338
  invariant18(this._config, "config not set", {
6508
- F: __dxlog_file22,
6509
- L: 229,
6339
+ F: __dxlog_file21,
6340
+ L: 232,
6510
6341
  S: this,
6511
6342
  A: [
6512
6343
  "this._config",
@@ -6514,8 +6345,8 @@ var ClientServicesHost = class {
6514
6345
  ]
6515
6346
  });
6516
6347
  invariant18(this._storage, "storage not set", {
6517
- F: __dxlog_file22,
6518
- L: 230,
6348
+ F: __dxlog_file21,
6349
+ L: 233,
6519
6350
  S: this,
6520
6351
  A: [
6521
6352
  "this._storage",
@@ -6523,8 +6354,8 @@ var ClientServicesHost = class {
6523
6354
  ]
6524
6355
  });
6525
6356
  invariant18(this._signalManager, "signal manager not set", {
6526
- F: __dxlog_file22,
6527
- L: 231,
6357
+ F: __dxlog_file21,
6358
+ L: 234,
6528
6359
  S: this,
6529
6360
  A: [
6530
6361
  "this._signalManager",
@@ -6532,8 +6363,8 @@ var ClientServicesHost = class {
6532
6363
  ]
6533
6364
  });
6534
6365
  invariant18(this._networkManager, "network manager not set", {
6535
- F: __dxlog_file22,
6536
- L: 232,
6366
+ F: __dxlog_file21,
6367
+ L: 235,
6537
6368
  S: this,
6538
6369
  A: [
6539
6370
  "this._networkManager",
@@ -6541,11 +6372,11 @@ var ClientServicesHost = class {
6541
6372
  ]
6542
6373
  });
6543
6374
  this._opening = true;
6544
- log19("opening...", {
6375
+ log18("opening...", {
6545
6376
  lockKey: this._resourceLock?.lockKey
6546
6377
  }, {
6547
- F: __dxlog_file22,
6548
- L: 235,
6378
+ F: __dxlog_file21,
6379
+ L: 238,
6549
6380
  S: this,
6550
6381
  C: (f, a) => f(...a)
6551
6382
  });
@@ -6556,10 +6387,9 @@ var ClientServicesHost = class {
6556
6387
  await this._level.open();
6557
6388
  await this._loggingService.open();
6558
6389
  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
6390
  this._serviceRegistry.setServices({
6561
6391
  SystemService: this._systemService,
6562
- IdentityService: identityService,
6392
+ IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
6563
6393
  InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
6564
6394
  DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
6565
6395
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, async () => {
@@ -6579,7 +6409,6 @@ var ClientServicesHost = class {
6579
6409
  })
6580
6410
  });
6581
6411
  await this._serviceContext.open(ctx);
6582
- await identityService.open();
6583
6412
  const devtoolsProxy = this._config?.get("runtime.client.devtoolsProxy");
6584
6413
  if (devtoolsProxy) {
6585
6414
  this._devtoolsProxy = new WebsocketRpcClient({
@@ -6595,18 +6424,18 @@ var ClientServicesHost = class {
6595
6424
  this._open = true;
6596
6425
  this._statusUpdate.emit();
6597
6426
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
6598
- log19("opened", {
6427
+ log18("opened", {
6599
6428
  deviceKey
6600
6429
  }, {
6601
- F: __dxlog_file22,
6430
+ F: __dxlog_file21,
6602
6431
  L: 314,
6603
6432
  S: this,
6604
6433
  C: (f, a) => f(...a)
6605
6434
  });
6606
- log19.trace("dxos.client-services.host.open", trace10.end({
6435
+ log18.trace("dxos.client-services.host.open", trace10.end({
6607
6436
  id: traceId
6608
6437
  }), {
6609
- F: __dxlog_file22,
6438
+ F: __dxlog_file21,
6610
6439
  L: 315,
6611
6440
  S: this,
6612
6441
  C: (f, a) => f(...a)
@@ -6617,10 +6446,10 @@ var ClientServicesHost = class {
6617
6446
  return;
6618
6447
  }
6619
6448
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
6620
- log19("closing...", {
6449
+ log18("closing...", {
6621
6450
  deviceKey
6622
6451
  }, {
6623
- F: __dxlog_file22,
6452
+ F: __dxlog_file21,
6624
6453
  L: 326,
6625
6454
  S: this,
6626
6455
  C: (f, a) => f(...a)
@@ -6635,10 +6464,10 @@ var ClientServicesHost = class {
6635
6464
  await this._level?.close();
6636
6465
  this._open = false;
6637
6466
  this._statusUpdate.emit();
6638
- log19("closed", {
6467
+ log18("closed", {
6639
6468
  deviceKey
6640
6469
  }, {
6641
- F: __dxlog_file22,
6470
+ F: __dxlog_file21,
6642
6471
  L: 335,
6643
6472
  S: this,
6644
6473
  C: (f, a) => f(...a)
@@ -6646,32 +6475,32 @@ var ClientServicesHost = class {
6646
6475
  }
6647
6476
  async reset() {
6648
6477
  const traceId = PublicKey16.random().toHex();
6649
- log19.trace("dxos.sdk.client-services-host.reset", trace10.begin({
6478
+ log18.trace("dxos.sdk.client-services-host.reset", trace10.begin({
6650
6479
  id: traceId
6651
6480
  }), {
6652
- F: __dxlog_file22,
6481
+ F: __dxlog_file21,
6653
6482
  L: 340,
6654
6483
  S: this,
6655
6484
  C: (f, a) => f(...a)
6656
6485
  });
6657
- log19.info("resetting...", void 0, {
6658
- F: __dxlog_file22,
6486
+ log18.info("resetting...", void 0, {
6487
+ F: __dxlog_file21,
6659
6488
  L: 342,
6660
6489
  S: this,
6661
6490
  C: (f, a) => f(...a)
6662
6491
  });
6663
6492
  await this._serviceContext?.close();
6664
6493
  await this._storage.reset();
6665
- log19.info("reset", void 0, {
6666
- F: __dxlog_file22,
6494
+ log18.info("reset", void 0, {
6495
+ F: __dxlog_file21,
6667
6496
  L: 345,
6668
6497
  S: this,
6669
6498
  C: (f, a) => f(...a)
6670
6499
  });
6671
- log19.trace("dxos.sdk.client-services-host.reset", trace10.end({
6500
+ log18.trace("dxos.sdk.client-services-host.reset", trace10.end({
6672
6501
  id: traceId
6673
6502
  }), {
6674
- F: __dxlog_file22,
6503
+ F: __dxlog_file21,
6675
6504
  L: 346,
6676
6505
  S: this,
6677
6506
  C: (f, a) => f(...a)
@@ -6681,6 +6510,38 @@ var ClientServicesHost = class {
6681
6510
  async _createIdentity(params) {
6682
6511
  const identity = await this._serviceContext.createIdentity(params);
6683
6512
  await this._serviceContext.initialized.wait();
6513
+ const space = await this._serviceContext.dataSpaceManager.createSpace();
6514
+ const automergeIndex = space.automergeSpaceState.rootUrl;
6515
+ invariant18(automergeIndex, void 0, {
6516
+ F: __dxlog_file21,
6517
+ L: 358,
6518
+ S: this,
6519
+ A: [
6520
+ "automergeIndex",
6521
+ ""
6522
+ ]
6523
+ });
6524
+ const document = this._serviceContext.echoHost.automergeRepo.find(automergeIndex);
6525
+ await document.whenReady();
6526
+ const properties = {
6527
+ system: {
6528
+ type: encodeReference(getTypeReference(PropertiesType))
6529
+ },
6530
+ data: {
6531
+ [defaultKey]: identity.identityKey.toHex()
6532
+ },
6533
+ meta: {
6534
+ keys: []
6535
+ }
6536
+ };
6537
+ const propertiesId = PublicKey16.random().toHex();
6538
+ document.change((doc) => {
6539
+ assignDeep2(doc, [
6540
+ "objects",
6541
+ propertiesId
6542
+ ], properties);
6543
+ });
6544
+ await this._serviceContext.echoHost.flush();
6684
6545
  return identity;
6685
6546
  }
6686
6547
  };
@@ -6743,4 +6604,4 @@ export {
6743
6604
  ClientServicesProviderResource,
6744
6605
  DiagnosticsCollector
6745
6606
  };
6746
- //# sourceMappingURL=chunk-6Y4QMNUK.mjs.map
6607
+ //# sourceMappingURL=chunk-QWL2M4EU.mjs.map