@dxos/client-services 0.4.6-main.aeca3cc → 0.4.6-main.c12c15b

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 (44) hide show
  1. package/dist/lib/browser/{chunk-FDDHW2PI.mjs → chunk-TBQFPJWZ.mjs} +164 -115
  2. package/dist/lib/browser/chunk-TBQFPJWZ.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 +7 -7
  6. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  7. package/dist/lib/node/{chunk-PZGADVCE.cjs → chunk-WB7KSXSI.cjs} +177 -128
  8. package/dist/lib/node/chunk-WB7KSXSI.cjs.map +7 -0
  9. package/dist/lib/node/index.cjs +37 -37
  10. package/dist/lib/node/meta.json +1 -1
  11. package/dist/lib/node/packlets/testing/index.cjs +14 -14
  12. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  13. package/dist/types/src/packlets/identity/identity-manager.d.ts +5 -2
  14. package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
  15. package/dist/types/src/packlets/identity/identity.d.ts +0 -1
  16. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  17. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +2 -1
  18. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
  19. package/dist/types/src/packlets/invitations/invitation-protocol.d.ts +2 -2
  20. package/dist/types/src/packlets/invitations/invitation-protocol.d.ts.map +1 -1
  21. package/dist/types/src/packlets/invitations/invitations-handler.d.ts +2 -1
  22. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  23. package/dist/types/src/packlets/invitations/invitations-service.d.ts +2 -2
  24. package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
  25. package/dist/types/src/packlets/testing/invitation-utils.d.ts +4 -2
  26. package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
  27. package/dist/types/src/version.d.ts +1 -1
  28. package/package.json +35 -35
  29. package/src/packlets/identity/identity-manager.test.ts +1 -0
  30. package/src/packlets/identity/identity-manager.ts +50 -12
  31. package/src/packlets/identity/identity-service.ts +1 -1
  32. package/src/packlets/identity/identity.test.ts +9 -9
  33. package/src/packlets/identity/identity.ts +0 -9
  34. package/src/packlets/invitations/device-invitation-protocol.ts +5 -2
  35. package/src/packlets/invitations/invitation-protocol.ts +2 -2
  36. package/src/packlets/invitations/invitations-handler.ts +11 -2
  37. package/src/packlets/invitations/invitations-service.ts +8 -2
  38. package/src/packlets/services/service-host.ts +3 -3
  39. package/src/packlets/spaces/data-space-manager.ts +3 -3
  40. package/src/packlets/spaces/data-space.ts +4 -4
  41. package/src/packlets/testing/invitation-utils.ts +8 -4
  42. package/src/version.ts +1 -1
  43. package/dist/lib/browser/chunk-FDDHW2PI.mjs.map +0 -7
  44. package/dist/lib/node/chunk-PZGADVCE.cjs.map +0 -7
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_PZGADVCE_exports = {};
30
- __export(chunk_PZGADVCE_exports, {
29
+ var chunk_WB7KSXSI_exports = {};
30
+ __export(chunk_WB7KSXSI_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -60,7 +60,7 @@ __export(chunk_PZGADVCE_exports, {
60
60
  subscribeToSpaces: () => subscribeToSpaces,
61
61
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
62
62
  });
63
- module.exports = __toCommonJS(chunk_PZGADVCE_exports);
63
+ module.exports = __toCommonJS(chunk_WB7KSXSI_exports);
64
64
  var import_async = require("@dxos/async");
65
65
  var import_codec_protobuf = require("@dxos/codec-protobuf");
66
66
  var import_feed_store = require("@dxos/feed-store");
@@ -83,7 +83,6 @@ var import_protocols = require("@dxos/protocols");
83
83
  var import_async5 = require("@dxos/async");
84
84
  var import_client_protocol = require("@dxos/client-protocol");
85
85
  var import_credentials2 = require("@dxos/credentials");
86
- var import_debug = require("@dxos/debug");
87
86
  var import_feed_store2 = require("@dxos/feed-store");
88
87
  var import_invariant = require("@dxos/invariant");
89
88
  var import_keys3 = require("@dxos/keys");
@@ -106,7 +105,7 @@ var import_tracing2 = require("@dxos/tracing");
106
105
  var import_util3 = require("@dxos/util");
107
106
  var import_codec_protobuf7 = require("@dxos/codec-protobuf");
108
107
  var import_credentials6 = require("@dxos/credentials");
109
- var import_debug2 = require("@dxos/debug");
108
+ var import_debug = require("@dxos/debug");
110
109
  var import_invariant3 = require("@dxos/invariant");
111
110
  var import_invariant4 = require("@dxos/invariant");
112
111
  var import_protocols3 = require("@dxos/protocols");
@@ -143,7 +142,7 @@ var import_log7 = require("@dxos/log");
143
142
  var import_protocols6 = require("@dxos/protocols");
144
143
  var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
145
144
  var import_codec_protobuf9 = require("@dxos/codec-protobuf");
146
- var import_debug3 = require("@dxos/debug");
145
+ var import_debug2 = require("@dxos/debug");
147
146
  var import_rpc = require("@dxos/rpc");
148
147
  var import_tracing3 = require("@dxos/tracing");
149
148
  var import_codec_protobuf10 = require("@dxos/codec-protobuf");
@@ -159,7 +158,7 @@ var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
159
158
  var import_async10 = require("@dxos/async");
160
159
  var import_client_protocol3 = require("@dxos/client-protocol");
161
160
  var import_context6 = require("@dxos/context");
162
- var import_debug4 = require("@dxos/debug");
161
+ var import_debug3 = require("@dxos/debug");
163
162
  var import_echo_pipeline = require("@dxos/echo-pipeline");
164
163
  var import_invariant10 = require("@dxos/invariant");
165
164
  var import_keys7 = require("@dxos/keys");
@@ -190,12 +189,12 @@ var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
190
189
  var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
191
190
  var import_util6 = require("@dxos/util");
192
191
  var import_credentials13 = require("@dxos/credentials");
193
- var import_debug5 = require("@dxos/debug");
192
+ var import_debug4 = require("@dxos/debug");
194
193
  var import_credentials14 = require("@dxos/protocols/proto/dxos/halo/credentials");
195
194
  var import_timeframe3 = require("@dxos/timeframe");
196
195
  var import_async13 = require("@dxos/async");
197
196
  var import_codec_protobuf11 = require("@dxos/codec-protobuf");
198
- var import_debug6 = require("@dxos/debug");
197
+ var import_debug5 = require("@dxos/debug");
199
198
  var import_invariant13 = require("@dxos/invariant");
200
199
  var import_log12 = require("@dxos/log");
201
200
  var import_protocols11 = require("@dxos/protocols");
@@ -203,7 +202,7 @@ var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
203
202
  var import_async14 = require("@dxos/async");
204
203
  var import_context9 = require("@dxos/context");
205
204
  var import_credentials15 = require("@dxos/credentials");
206
- var import_debug7 = require("@dxos/debug");
205
+ var import_debug6 = require("@dxos/debug");
207
206
  var import_echo_pipeline2 = require("@dxos/echo-pipeline");
208
207
  var import_feed_store4 = require("@dxos/feed-store");
209
208
  var import_invariant14 = require("@dxos/invariant");
@@ -693,7 +692,7 @@ var Identity = class {
693
692
  deviceKey
694
693
  }, {
695
694
  F: __dxlog_file2,
696
- L: 64,
695
+ L: 63,
697
696
  S: this,
698
697
  C: (f, a) => f(...a)
699
698
  });
@@ -751,13 +750,6 @@ var Identity = class {
751
750
  get deviceCredentialChain() {
752
751
  return this._deviceStateMachine.deviceCredentialChain;
753
752
  }
754
- getAdmissionCredentials() {
755
- return {
756
- deviceKey: this.deviceKey,
757
- controlFeedKey: this.space.controlFeedKey ?? (0, import_debug.failUndefined)(),
758
- dataFeedKey: this.space.dataFeedKey ?? (0, import_debug.failUndefined)()
759
- };
760
- }
761
753
  /**
762
754
  * Issues credentials as identity.
763
755
  * Requires identity to be ready.
@@ -765,7 +757,7 @@ var Identity = class {
765
757
  getIdentityCredentialSigner() {
766
758
  (0, import_invariant.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
767
759
  F: __dxlog_file2,
768
- L: 145,
760
+ L: 136,
769
761
  S: this,
770
762
  A: [
771
763
  "this._deviceStateMachine.deviceCredentialChain",
@@ -789,7 +781,7 @@ var Identity = class {
789
781
  dataFeedKey
790
782
  }, {
791
783
  F: __dxlog_file2,
792
- L: 161,
784
+ L: 152,
793
785
  S: this,
794
786
  C: (f, a) => f(...a)
795
787
  });
@@ -869,7 +861,7 @@ var IdentityManager = class {
869
861
  id: traceId
870
862
  }), {
871
863
  F: __dxlog_file3,
872
- L: 80,
864
+ L: 84,
873
865
  S: this,
874
866
  C: (f, a) => f(...a)
875
867
  });
@@ -878,7 +870,7 @@ var IdentityManager = class {
878
870
  identityRecord
879
871
  }, {
880
872
  F: __dxlog_file3,
881
- L: 83,
873
+ L: 87,
882
874
  S: this,
883
875
  C: (f, a) => f(...a)
884
876
  });
@@ -891,7 +883,7 @@ var IdentityManager = class {
891
883
  displayName: this._identity.profileDocument?.displayName
892
884
  }, {
893
885
  F: __dxlog_file3,
894
- L: 88,
886
+ L: 92,
895
887
  S: this,
896
888
  C: (f, a) => f(...a)
897
889
  });
@@ -901,7 +893,7 @@ var IdentityManager = class {
901
893
  id: traceId
902
894
  }), {
903
895
  F: __dxlog_file3,
904
- L: 94,
896
+ L: 99,
905
897
  S: this,
906
898
  C: (f, a) => f(...a)
907
899
  });
@@ -909,10 +901,10 @@ var IdentityManager = class {
909
901
  async close() {
910
902
  await this._identity?.close(new import_context3.Context());
911
903
  }
912
- async createIdentity({ displayName } = {}) {
904
+ async createIdentity({ displayName, deviceProfile } = {}) {
913
905
  (0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
914
906
  F: __dxlog_file3,
915
- L: 102,
907
+ L: 108,
916
908
  S: this,
917
909
  A: [
918
910
  "!this._identity",
@@ -921,7 +913,7 @@ var IdentityManager = class {
921
913
  });
922
914
  (0, import_log3.log)("creating identity...", void 0, {
923
915
  F: __dxlog_file3,
924
- L: 103,
916
+ L: 109,
925
917
  S: this,
926
918
  C: (f, a) => f(...a)
927
919
  });
@@ -942,7 +934,7 @@ var IdentityManager = class {
942
934
  const generator = new import_credentials4.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
943
935
  (0, import_invariant2.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
944
936
  F: __dxlog_file3,
945
- L: 122,
937
+ L: 128,
946
938
  S: this,
947
939
  A: [
948
940
  "identityRecord.haloSpace.genesisFeedKey",
@@ -951,7 +943,7 @@ var IdentityManager = class {
951
943
  });
952
944
  (0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
953
945
  F: __dxlog_file3,
954
- L: 123,
946
+ L: 129,
955
947
  S: this,
956
948
  A: [
957
949
  "identityRecord.haloSpace.dataFeedKey",
@@ -971,11 +963,8 @@ var IdentityManager = class {
971
963
  }
972
964
  credentials.push(await generator.createDeviceAuthorization(identityRecord.deviceKey));
973
965
  credentials.push(await generator.createDeviceProfile({
974
- platform: import_platform.default.name,
975
- platformVersion: import_platform.default.version,
976
- architecture: typeof import_platform.default.os?.architecture === "number" ? String(import_platform.default.os.architecture) : void 0,
977
- os: import_platform.default.os?.family,
978
- osVersion: import_platform.default.os?.version
966
+ ...this.createDefaultDeviceProfile(),
967
+ ...deviceProfile
979
968
  }));
980
969
  for (const credential of credentials) {
981
970
  await identity.controlPipeline.writer.write({
@@ -993,37 +982,61 @@ var IdentityManager = class {
993
982
  displayName: this._identity.profileDocument?.displayName
994
983
  }, {
995
984
  F: __dxlog_file3,
996
- L: 168,
985
+ L: 171,
997
986
  S: this,
998
987
  C: (f, a) => f(...a)
999
988
  });
1000
989
  this.stateUpdate.emit();
1001
990
  (0, import_log3.log)("created identity", {
1002
991
  identityKey: identity.identityKey,
1003
- deviceKey: identity.deviceKey
992
+ deviceKey: identity.deviceKey,
993
+ profile: identity.profileDocument
1004
994
  }, {
1005
995
  F: __dxlog_file3,
1006
- L: 174,
996
+ L: 177,
1007
997
  S: this,
1008
998
  C: (f, a) => f(...a)
1009
999
  });
1010
1000
  return identity;
1011
1001
  }
1002
+ // TODO(nf): receive platform info rather than generating it here.
1003
+ createDefaultDeviceProfile() {
1004
+ let type;
1005
+ if ((0, import_util3.isNode)()) {
1006
+ type = import_credentials5.DeviceType.AGENT;
1007
+ } else {
1008
+ if (import_platform.default.name?.startsWith("iOS") || import_platform.default.name?.startsWith("Android")) {
1009
+ type = import_credentials5.DeviceType.MOBILE;
1010
+ } else if (globalThis.__args) {
1011
+ type = import_credentials5.DeviceType.NATIVE;
1012
+ } else {
1013
+ type = import_credentials5.DeviceType.BROWSER;
1014
+ }
1015
+ }
1016
+ return {
1017
+ type,
1018
+ platform: import_platform.default.name,
1019
+ platformVersion: import_platform.default.version,
1020
+ architecture: typeof import_platform.default.os?.architecture === "number" ? String(import_platform.default.os.architecture) : void 0,
1021
+ os: import_platform.default.os?.family,
1022
+ osVersion: import_platform.default.os?.version
1023
+ };
1024
+ }
1012
1025
  /**
1013
- * Accept an existing identity. Expects it's device key to be authorized (now or later).
1026
+ * Accept an existing identity. Expects its device key to be authorized (now or later).
1014
1027
  */
1015
1028
  async acceptIdentity(params) {
1016
1029
  (0, import_log3.log)("accepting identity", {
1017
1030
  params
1018
1031
  }, {
1019
1032
  F: __dxlog_file3,
1020
- L: 182,
1033
+ L: 215,
1021
1034
  S: this,
1022
1035
  C: (f, a) => f(...a)
1023
1036
  });
1024
1037
  (0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
1025
1038
  F: __dxlog_file3,
1026
- L: 183,
1039
+ L: 216,
1027
1040
  S: this,
1028
1041
  A: [
1029
1042
  "!this._identity",
@@ -1051,17 +1064,21 @@ var IdentityManager = class {
1051
1064
  displayName: this._identity.profileDocument?.displayName
1052
1065
  }, {
1053
1066
  F: __dxlog_file3,
1054
- L: 202,
1067
+ L: 235,
1055
1068
  S: this,
1056
1069
  C: (f, a) => f(...a)
1057
1070
  });
1071
+ await this.updateDeviceProfile({
1072
+ ...this.createDefaultDeviceProfile(),
1073
+ ...params.deviceProfile
1074
+ });
1058
1075
  this.stateUpdate.emit();
1059
1076
  (0, import_log3.log)("accepted identity", {
1060
1077
  identityKey: identity.identityKey,
1061
1078
  deviceKey: identity.deviceKey
1062
1079
  }, {
1063
1080
  F: __dxlog_file3,
1064
- L: 208,
1081
+ L: 245,
1065
1082
  S: this,
1066
1083
  C: (f, a) => f(...a)
1067
1084
  });
@@ -1073,7 +1090,7 @@ var IdentityManager = class {
1073
1090
  async updateProfile(profile) {
1074
1091
  (0, import_invariant2.invariant)(this._identity, "Identity not initialized.", {
1075
1092
  F: __dxlog_file3,
1076
- L: 216,
1093
+ L: 253,
1077
1094
  S: this,
1078
1095
  A: [
1079
1096
  "this._identity",
@@ -1104,14 +1121,14 @@ var IdentityManager = class {
1104
1121
  async updateDeviceProfile(profile) {
1105
1122
  (0, import_invariant2.invariant)(this._identity, "Identity not initialized.", {
1106
1123
  F: __dxlog_file3,
1107
- L: 233,
1124
+ L: 270,
1108
1125
  S: this,
1109
1126
  A: [
1110
1127
  "this._identity",
1111
1128
  "'Identity not initialized.'"
1112
1129
  ]
1113
1130
  });
1114
- const credential = await this._identity.getIdentityCredentialSigner().createCredential({
1131
+ const credential = await this._identity.getDeviceCredentialSigner().createCredential({
1115
1132
  subject: this._identity.deviceKey,
1116
1133
  assertion: {
1117
1134
  "@type": "dxos.halo.credentials.DeviceProfile",
@@ -1139,7 +1156,7 @@ var IdentityManager = class {
1139
1156
  async _constructIdentity(identityRecord) {
1140
1157
  (0, import_invariant2.invariant)(!this._identity, void 0, {
1141
1158
  F: __dxlog_file3,
1142
- L: 254,
1159
+ L: 291,
1143
1160
  S: this,
1144
1161
  A: [
1145
1162
  "!this._identity",
@@ -1150,13 +1167,13 @@ var IdentityManager = class {
1150
1167
  identityRecord
1151
1168
  }, {
1152
1169
  F: __dxlog_file3,
1153
- L: 255,
1170
+ L: 292,
1154
1171
  S: this,
1155
1172
  C: (f, a) => f(...a)
1156
1173
  });
1157
1174
  (0, import_invariant2.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
1158
1175
  F: __dxlog_file3,
1159
- L: 258,
1176
+ L: 295,
1160
1177
  S: this,
1161
1178
  A: [
1162
1179
  "identityRecord.haloSpace.controlFeedKey",
@@ -1168,7 +1185,7 @@ var IdentityManager = class {
1168
1185
  });
1169
1186
  (0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
1170
1187
  F: __dxlog_file3,
1171
- L: 262,
1188
+ L: 299,
1172
1189
  S: this,
1173
1190
  A: [
1174
1191
  "identityRecord.haloSpace.dataFeedKey",
@@ -1188,7 +1205,7 @@ var IdentityManager = class {
1188
1205
  },
1189
1206
  identityKey: identityRecord.identityKey
1190
1207
  });
1191
- space.setControlFeed(controlFeed);
1208
+ await space.setControlFeed(controlFeed);
1192
1209
  space.setDataFeed(dataFeed);
1193
1210
  const identity = new Identity({
1194
1211
  space,
@@ -1200,13 +1217,14 @@ var IdentityManager = class {
1200
1217
  identityKey: identityRecord.identityKey
1201
1218
  }, {
1202
1219
  F: __dxlog_file3,
1203
- L: 286,
1220
+ L: 323,
1204
1221
  S: this,
1205
1222
  C: (f, a) => f(...a)
1206
1223
  });
1207
1224
  if (identityRecord.haloSpace.controlTimeframe) {
1208
1225
  identity.controlPipeline.state.setTargetTimeframe(identityRecord.haloSpace.controlTimeframe);
1209
1226
  }
1227
+ identity.stateUpdate.on(() => this.stateUpdate.emit());
1210
1228
  return identity;
1211
1229
  }
1212
1230
  async _constructSpace({ spaceRecord, swarmIdentity, identityKey }) {
@@ -1221,7 +1239,7 @@ var IdentityManager = class {
1221
1239
  onAuthFailure: () => {
1222
1240
  import_log3.log.warn("auth failure", void 0, {
1223
1241
  F: __dxlog_file3,
1224
- L: 305,
1242
+ L: 343,
1225
1243
  S: this,
1226
1244
  C: (f, a) => f(...a)
1227
1245
  });
@@ -1247,11 +1265,14 @@ var IdentityServiceImpl = class {
1247
1265
  this._onProfileUpdate = _onProfileUpdate;
1248
1266
  }
1249
1267
  async createIdentity(request) {
1250
- await this._createIdentity(request.profile ?? {});
1268
+ await this._createIdentity({
1269
+ displayName: request.profile?.displayName,
1270
+ deviceProfile: request.deviceProfile
1271
+ });
1251
1272
  return this._getIdentity();
1252
1273
  }
1253
1274
  async recoverIdentity(request) {
1254
- return (0, import_debug2.todo)();
1275
+ return (0, import_debug.todo)();
1255
1276
  }
1256
1277
  queryIdentity() {
1257
1278
  return new import_codec_protobuf7.Stream(({ next }) => {
@@ -1323,7 +1344,7 @@ var DeviceInvitationProtocol = class {
1323
1344
  async admit(request) {
1324
1345
  (0, import_invariant4.invariant)(request.device, void 0, {
1325
1346
  F: __dxlog_file5,
1326
- L: 36,
1347
+ L: 37,
1327
1348
  S: this,
1328
1349
  A: [
1329
1350
  "request.device",
@@ -1353,7 +1374,7 @@ var DeviceInvitationProtocol = class {
1353
1374
  createIntroduction() {
1354
1375
  return {};
1355
1376
  }
1356
- async createAdmissionRequest() {
1377
+ async createAdmissionRequest(deviceProfile) {
1357
1378
  const deviceKey = await this._keyring.createKey();
1358
1379
  const controlFeedKey = await this._keyring.createKey();
1359
1380
  const dataFeedKey = await this._keyring.createKey();
@@ -1361,14 +1382,15 @@ var DeviceInvitationProtocol = class {
1361
1382
  device: {
1362
1383
  deviceKey,
1363
1384
  controlFeedKey,
1364
- dataFeedKey
1385
+ dataFeedKey,
1386
+ profile: deviceProfile
1365
1387
  }
1366
1388
  };
1367
1389
  }
1368
1390
  async accept(response, request) {
1369
1391
  (0, import_invariant4.invariant)(response.device, void 0, {
1370
1392
  F: __dxlog_file5,
1371
- L: 80,
1393
+ L: 82,
1372
1394
  S: this,
1373
1395
  A: [
1374
1396
  "response.device",
@@ -1378,14 +1400,14 @@ var DeviceInvitationProtocol = class {
1378
1400
  const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
1379
1401
  (0, import_invariant4.invariant)(request.device, void 0, {
1380
1402
  F: __dxlog_file5,
1381
- L: 83,
1403
+ L: 85,
1382
1404
  S: this,
1383
1405
  A: [
1384
1406
  "request.device",
1385
1407
  ""
1386
1408
  ]
1387
1409
  });
1388
- const { deviceKey, controlFeedKey, dataFeedKey } = request.device;
1410
+ const { deviceKey, controlFeedKey, dataFeedKey, profile } = request.device;
1389
1411
  await this._acceptIdentity({
1390
1412
  identityKey,
1391
1413
  deviceKey,
@@ -1393,7 +1415,8 @@ var DeviceInvitationProtocol = class {
1393
1415
  haloGenesisFeedKey: genesisFeedKey,
1394
1416
  controlFeedKey,
1395
1417
  dataFeedKey,
1396
- controlTimeframe
1418
+ controlTimeframe,
1419
+ deviceProfile: profile
1397
1420
  });
1398
1421
  return {
1399
1422
  identityKey
@@ -1741,7 +1764,7 @@ var InvitationsHandler = class {
1741
1764
  const authCode = options?.authCode ?? (authMethod === import_services3.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials7.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0);
1742
1765
  (0, import_invariant5.invariant)(protocol, void 0, {
1743
1766
  F: __dxlog_file7,
1744
- L: 80,
1767
+ L: 81,
1745
1768
  S: this,
1746
1769
  A: [
1747
1770
  "protocol",
@@ -1770,7 +1793,7 @@ var InvitationsHandler = class {
1770
1793
  ...protocol.toJSON()
1771
1794
  }, {
1772
1795
  F: __dxlog_file7,
1773
- L: 102,
1796
+ L: 103,
1774
1797
  S: this,
1775
1798
  C: (f, a) => f(...a)
1776
1799
  });
@@ -1795,7 +1818,7 @@ var InvitationsHandler = class {
1795
1818
  const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
1796
1819
  (0, import_invariant5.invariant)(deviceKey, void 0, {
1797
1820
  F: __dxlog_file7,
1798
- L: 123,
1821
+ L: 124,
1799
1822
  S: this,
1800
1823
  A: [
1801
1824
  "deviceKey",
@@ -1818,7 +1841,7 @@ var InvitationsHandler = class {
1818
1841
  id: traceId
1819
1842
  }), {
1820
1843
  F: __dxlog_file7,
1821
- L: 141,
1844
+ L: 142,
1822
1845
  S: this,
1823
1846
  C: (f, a) => f(...a)
1824
1847
  });
@@ -1826,7 +1849,7 @@ var InvitationsHandler = class {
1826
1849
  ...protocol.toJSON()
1827
1850
  }, {
1828
1851
  F: __dxlog_file7,
1829
- L: 142,
1852
+ L: 143,
1830
1853
  S: this,
1831
1854
  C: (f, a) => f(...a)
1832
1855
  });
@@ -1842,7 +1865,7 @@ var InvitationsHandler = class {
1842
1865
  ...protocol.toJSON()
1843
1866
  }, {
1844
1867
  F: __dxlog_file7,
1845
- L: 145,
1868
+ L: 146,
1846
1869
  S: this,
1847
1870
  C: (f, a) => f(...a)
1848
1871
  });
@@ -1854,7 +1877,7 @@ var InvitationsHandler = class {
1854
1877
  id: traceId
1855
1878
  }), {
1856
1879
  F: __dxlog_file7,
1857
- L: 147,
1880
+ L: 148,
1858
1881
  S: this,
1859
1882
  C: (f, a) => f(...a)
1860
1883
  });
@@ -1864,7 +1887,7 @@ var InvitationsHandler = class {
1864
1887
  ...protocol.toJSON()
1865
1888
  }, {
1866
1889
  F: __dxlog_file7,
1867
- L: 150,
1890
+ L: 151,
1868
1891
  S: this,
1869
1892
  C: (f, a) => f(...a)
1870
1893
  });
@@ -1875,7 +1898,7 @@ var InvitationsHandler = class {
1875
1898
  } else {
1876
1899
  import_log4.log.error("failed", err, {
1877
1900
  F: __dxlog_file7,
1878
- L: 153,
1901
+ L: 154,
1879
1902
  S: this,
1880
1903
  C: (f, a) => f(...a)
1881
1904
  });
@@ -1886,7 +1909,7 @@ var InvitationsHandler = class {
1886
1909
  error: err
1887
1910
  }), {
1888
1911
  F: __dxlog_file7,
1889
- L: 156,
1912
+ L: 157,
1890
1913
  S: this,
1891
1914
  C: (f, a) => f(...a)
1892
1915
  });
@@ -1907,7 +1930,7 @@ var InvitationsHandler = class {
1907
1930
  ...protocol.toJSON()
1908
1931
  }, {
1909
1932
  F: __dxlog_file7,
1910
- L: 171,
1933
+ L: 172,
1911
1934
  S: this,
1912
1935
  C: (f, a) => f(...a)
1913
1936
  });
@@ -1918,7 +1941,7 @@ var InvitationsHandler = class {
1918
1941
  } else {
1919
1942
  import_log4.log.error("failed", err, {
1920
1943
  F: __dxlog_file7,
1921
- L: 174,
1944
+ L: 175,
1922
1945
  S: this,
1923
1946
  C: (f, a) => f(...a)
1924
1947
  });
@@ -1959,17 +1982,28 @@ var InvitationsHandler = class {
1959
1982
  });
1960
1983
  return observable;
1961
1984
  }
1962
- acceptInvitation(protocol, invitation) {
1985
+ acceptInvitation(protocol, invitation, deviceProfile) {
1963
1986
  const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
1964
1987
  (0, import_invariant5.invariant)(protocol, void 0, {
1965
1988
  F: __dxlog_file7,
1966
- L: 215,
1989
+ L: 220,
1967
1990
  S: this,
1968
1991
  A: [
1969
1992
  "protocol",
1970
1993
  ""
1971
1994
  ]
1972
1995
  });
1996
+ if (deviceProfile) {
1997
+ (0, import_invariant5.invariant)(invitation.kind === import_services3.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
1998
+ F: __dxlog_file7,
1999
+ L: 224,
2000
+ S: this,
2001
+ A: [
2002
+ "invitation.kind === Invitation.Kind.DEVICE",
2003
+ "'deviceProfile provided for non-device invitation'"
2004
+ ]
2005
+ });
2006
+ }
1973
2007
  const authenticated = new import_async7.Trigger();
1974
2008
  let admitted = false;
1975
2009
  let currentState;
@@ -1977,7 +2011,7 @@ var InvitationsHandler = class {
1977
2011
  const setState = (newData) => {
1978
2012
  (0, import_invariant5.invariant)(newData.state !== void 0, void 0, {
1979
2013
  F: __dxlog_file7,
1980
- L: 226,
2014
+ L: 235,
1981
2015
  S: this,
1982
2016
  A: [
1983
2017
  "newData.state !== undefined",
@@ -1997,7 +2031,7 @@ var InvitationsHandler = class {
1997
2031
  ...protocol.toJSON()
1998
2032
  }, {
1999
2033
  F: __dxlog_file7,
2000
- L: 234,
2034
+ L: 243,
2001
2035
  S: this,
2002
2036
  C: (f, a) => f(...a)
2003
2037
  });
@@ -2007,7 +2041,7 @@ var InvitationsHandler = class {
2007
2041
  } else {
2008
2042
  import_log4.log.warn("auth failed", err, {
2009
2043
  F: __dxlog_file7,
2010
- L: 237,
2044
+ L: 246,
2011
2045
  S: this,
2012
2046
  C: (f, a) => f(...a)
2013
2047
  });
@@ -2021,7 +2055,7 @@ var InvitationsHandler = class {
2021
2055
  ...protocol.toJSON()
2022
2056
  }, {
2023
2057
  F: __dxlog_file7,
2024
- L: 245,
2058
+ L: 254,
2025
2059
  S: this,
2026
2060
  C: (f, a) => f(...a)
2027
2061
  });
@@ -2036,7 +2070,7 @@ var InvitationsHandler = class {
2036
2070
  currentState
2037
2071
  }, {
2038
2072
  F: __dxlog_file7,
2039
- L: 255,
2073
+ L: 264,
2040
2074
  S: this,
2041
2075
  C: (f, a) => f(...a)
2042
2076
  });
@@ -2051,7 +2085,7 @@ var InvitationsHandler = class {
2051
2085
  id: traceId
2052
2086
  }), {
2053
2087
  F: __dxlog_file7,
2054
- L: 264,
2088
+ L: 273,
2055
2089
  S: this,
2056
2090
  C: (f, a) => f(...a)
2057
2091
  });
@@ -2063,7 +2097,7 @@ var InvitationsHandler = class {
2063
2097
  ...protocol.toJSON()
2064
2098
  }, {
2065
2099
  F: __dxlog_file7,
2066
- L: 272,
2100
+ L: 281,
2067
2101
  S: this,
2068
2102
  C: (f, a) => f(...a)
2069
2103
  });
@@ -2074,7 +2108,7 @@ var InvitationsHandler = class {
2074
2108
  ...protocol.toJSON()
2075
2109
  }, {
2076
2110
  F: __dxlog_file7,
2077
- L: 276,
2111
+ L: 285,
2078
2112
  S: this,
2079
2113
  C: (f, a) => f(...a)
2080
2114
  });
@@ -2084,7 +2118,7 @@ var InvitationsHandler = class {
2084
2118
  response: introductionResponse
2085
2119
  }, {
2086
2120
  F: __dxlog_file7,
2087
- L: 280,
2121
+ L: 289,
2088
2122
  S: this,
2089
2123
  C: (f, a) => f(...a)
2090
2124
  });
@@ -2093,7 +2127,7 @@ var InvitationsHandler = class {
2093
2127
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
2094
2128
  (0, import_log4.log)("guest waiting for authentication code...", void 0, {
2095
2129
  F: __dxlog_file7,
2096
- L: 286,
2130
+ L: 295,
2097
2131
  S: this,
2098
2132
  C: (f, a) => f(...a)
2099
2133
  });
@@ -2105,7 +2139,7 @@ var InvitationsHandler = class {
2105
2139
  });
2106
2140
  (0, import_log4.log)("sending authentication request", void 0, {
2107
2141
  F: __dxlog_file7,
2108
- L: 290,
2142
+ L: 299,
2109
2143
  S: this,
2110
2144
  C: (f, a) => f(...a)
2111
2145
  });
@@ -2126,7 +2160,7 @@ var InvitationsHandler = class {
2126
2160
  attempt
2127
2161
  }, {
2128
2162
  F: __dxlog_file7,
2129
- L: 301,
2163
+ L: 310,
2130
2164
  S: this,
2131
2165
  C: (f, a) => f(...a)
2132
2166
  });
@@ -2139,11 +2173,11 @@ var InvitationsHandler = class {
2139
2173
  ...protocol.toJSON()
2140
2174
  }, {
2141
2175
  F: __dxlog_file7,
2142
- L: 309,
2176
+ L: 318,
2143
2177
  S: this,
2144
2178
  C: (f, a) => f(...a)
2145
2179
  });
2146
- const admissionRequest = await protocol.createAdmissionRequest();
2180
+ const admissionRequest = await protocol.createAdmissionRequest(deviceProfile);
2147
2181
  const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
2148
2182
  admitted = true;
2149
2183
  const result = await protocol.accept(admissionResponse, admissionRequest);
@@ -2151,7 +2185,7 @@ var InvitationsHandler = class {
2151
2185
  ...protocol.toJSON()
2152
2186
  }, {
2153
2187
  F: __dxlog_file7,
2154
- L: 320,
2188
+ L: 329,
2155
2189
  S: this,
2156
2190
  C: (f, a) => f(...a)
2157
2191
  });
@@ -2164,7 +2198,7 @@ var InvitationsHandler = class {
2164
2198
  id: traceId
2165
2199
  }), {
2166
2200
  F: __dxlog_file7,
2167
- L: 322,
2201
+ L: 331,
2168
2202
  S: this,
2169
2203
  C: (f, a) => f(...a)
2170
2204
  });
@@ -2174,7 +2208,7 @@ var InvitationsHandler = class {
2174
2208
  ...protocol.toJSON()
2175
2209
  }, {
2176
2210
  F: __dxlog_file7,
2177
- L: 325,
2211
+ L: 334,
2178
2212
  S: this,
2179
2213
  C: (f, a) => f(...a)
2180
2214
  });
@@ -2184,7 +2218,7 @@ var InvitationsHandler = class {
2184
2218
  } else {
2185
2219
  (0, import_log4.log)("auth failed", err, {
2186
2220
  F: __dxlog_file7,
2187
- L: 328,
2221
+ L: 337,
2188
2222
  S: this,
2189
2223
  C: (f, a) => f(...a)
2190
2224
  });
@@ -2195,7 +2229,7 @@ var InvitationsHandler = class {
2195
2229
  error: err
2196
2230
  }), {
2197
2231
  F: __dxlog_file7,
2198
- L: 331,
2232
+ L: 340,
2199
2233
  S: this,
2200
2234
  C: (f, a) => f(...a)
2201
2235
  });
@@ -2213,7 +2247,7 @@ var InvitationsHandler = class {
2213
2247
  ...protocol.toJSON()
2214
2248
  }, {
2215
2249
  F: __dxlog_file7,
2216
- L: 342,
2250
+ L: 351,
2217
2251
  S: this,
2218
2252
  C: (f, a) => f(...a)
2219
2253
  });
@@ -2223,7 +2257,7 @@ var InvitationsHandler = class {
2223
2257
  } else {
2224
2258
  (0, import_log4.log)("auth failed", err, {
2225
2259
  F: __dxlog_file7,
2226
- L: 345,
2260
+ L: 354,
2227
2261
  S: this,
2228
2262
  C: (f, a) => f(...a)
2229
2263
  });
@@ -2240,7 +2274,7 @@ var InvitationsHandler = class {
2240
2274
  } else {
2241
2275
  (0, import_invariant5.invariant)(invitation.swarmKey, void 0, {
2242
2276
  F: __dxlog_file7,
2243
- L: 359,
2277
+ L: 368,
2244
2278
  S: this,
2245
2279
  A: [
2246
2280
  "invitation.swarmKey",
@@ -2320,14 +2354,25 @@ var InvitationsServiceImpl = class {
2320
2354
  });
2321
2355
  });
2322
2356
  }
2323
- acceptInvitation(options) {
2357
+ acceptInvitation({ invitation: options, deviceProfile }) {
2324
2358
  let invitation;
2359
+ if (deviceProfile) {
2360
+ (0, import_invariant7.invariant)(options.kind === import_services5.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
2361
+ F: __dxlog_file8,
2362
+ L: 81,
2363
+ S: this,
2364
+ A: [
2365
+ "options.kind === Invitation.Kind.DEVICE",
2366
+ "'deviceProfile provided for non-device invitation'"
2367
+ ]
2368
+ });
2369
+ }
2325
2370
  const existingInvitation = this._acceptInvitations.get(options.invitationId);
2326
2371
  if (existingInvitation) {
2327
2372
  invitation = existingInvitation;
2328
2373
  } else {
2329
2374
  const handler = this._getHandler(options);
2330
- invitation = this._invitationsHandler.acceptInvitation(handler, options);
2375
+ invitation = this._invitationsHandler.acceptInvitation(handler, options, deviceProfile);
2331
2376
  this._acceptInvitations.set(invitation.get().invitationId, invitation);
2332
2377
  this._invitationAccepted.emit(invitation.get());
2333
2378
  }
@@ -2348,13 +2393,13 @@ var InvitationsServiceImpl = class {
2348
2393
  async authenticate({ invitationId, authCode }) {
2349
2394
  (0, import_log6.log)("authenticating...", void 0, {
2350
2395
  F: __dxlog_file8,
2351
- L: 108,
2396
+ L: 114,
2352
2397
  S: this,
2353
2398
  C: (f, a) => f(...a)
2354
2399
  });
2355
2400
  (0, import_invariant7.invariant)(invitationId, void 0, {
2356
2401
  F: __dxlog_file8,
2357
- L: 109,
2402
+ L: 115,
2358
2403
  S: this,
2359
2404
  A: [
2360
2405
  "invitationId",
@@ -2367,7 +2412,7 @@ var InvitationsServiceImpl = class {
2367
2412
  invitationId
2368
2413
  }, {
2369
2414
  F: __dxlog_file8,
2370
- L: 112,
2415
+ L: 118,
2371
2416
  S: this,
2372
2417
  C: (f, a) => f(...a)
2373
2418
  });
@@ -2378,13 +2423,13 @@ var InvitationsServiceImpl = class {
2378
2423
  async cancelInvitation({ invitationId }) {
2379
2424
  (0, import_log6.log)("deleting...", void 0, {
2380
2425
  F: __dxlog_file8,
2381
- L: 119,
2426
+ L: 125,
2382
2427
  S: this,
2383
2428
  C: (f, a) => f(...a)
2384
2429
  });
2385
2430
  (0, import_invariant7.invariant)(invitationId, void 0, {
2386
2431
  F: __dxlog_file8,
2387
- L: 120,
2432
+ L: 126,
2388
2433
  S: this,
2389
2434
  A: [
2390
2435
  "invitationId",
@@ -2665,7 +2710,7 @@ var ClientRpcServer = class {
2665
2710
  }
2666
2711
  _getServiceHandler(serviceName) {
2667
2712
  if (!this._handlerCache.has(serviceName)) {
2668
- const [key, descriptor] = Object.entries(this._serviceRegistry.descriptors).find(([key2, descriptor2]) => descriptor2.name === serviceName) ?? (0, import_debug3.raise)(new Error(`Service not available: ${serviceName}`));
2713
+ const [key, descriptor] = Object.entries(this._serviceRegistry.descriptors).find(([key2, descriptor2]) => descriptor2.name === serviceName) ?? (0, import_debug2.raise)(new Error(`Service not available: ${serviceName}`));
2669
2714
  const service = this._serviceRegistry.services[key];
2670
2715
  if (!service) {
2671
2716
  throw new Error(`Service not available: ${serviceName}`);
@@ -2711,7 +2756,7 @@ var getPlatform = () => {
2711
2756
  };
2712
2757
  }
2713
2758
  };
2714
- var DXOS_VERSION = "0.4.6-main.aeca3cc";
2759
+ var DXOS_VERSION = "0.4.6-main.c12c15b";
2715
2760
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
2716
2761
  var DEFAULT_TIMEOUT = 1e3;
2717
2762
  var createDiagnostics = async (clientServices, serviceContext, config) => {
@@ -3374,7 +3419,7 @@ var DataSpace = class {
3374
3419
  const controlFeed = await this._feedStore.openFeed(await this._keyring.createKey(), {
3375
3420
  writable: true
3376
3421
  });
3377
- this.inner.setControlFeed(controlFeed);
3422
+ await this.inner.setControlFeed(controlFeed);
3378
3423
  credentials.push(await this._signingContext.credentialSigner.createCredential({
3379
3424
  subject: controlFeed.key,
3380
3425
  assertion: {
@@ -3391,7 +3436,7 @@ var DataSpace = class {
3391
3436
  writable: true,
3392
3437
  sparse: true
3393
3438
  });
3394
- this.inner.setDataFeed(dataFeed);
3439
+ await this.inner.setDataFeed(dataFeed);
3395
3440
  credentials.push(await this._signingContext.credentialSigner.createCredential({
3396
3441
  subject: dataFeed.key,
3397
3442
  assertion: {
@@ -3426,16 +3471,18 @@ var DataSpace = class {
3426
3471
  const handle = this._automergeHost.repo.find(rootUrl);
3427
3472
  queueMicrotask(async () => {
3428
3473
  try {
3429
- await (0, import_debug4.warnAfterTimeout)(5e3, "Automerge root doc load timeout (DataSpace)", async () => {
3474
+ await (0, import_debug3.warnAfterTimeout)(5e3, "Automerge root doc load timeout (DataSpace)", async () => {
3430
3475
  await (0, import_context6.cancelWithContext)(this._ctx, handle.whenReady());
3431
3476
  });
3432
3477
  if (this._ctx.disposed) {
3433
3478
  return;
3434
3479
  }
3435
3480
  const doc = handle.docSync() ?? (0, import_invariant10.failedInvariant)();
3436
- if (!doc.experimental_spaceKey) {
3481
+ if (!doc.access?.spaceKey) {
3437
3482
  handle.change((doc2) => {
3438
- doc2.experimental_spaceKey = this.key.toHex();
3483
+ doc2.access = {
3484
+ spaceKey: this.key.toHex()
3485
+ };
3439
3486
  });
3440
3487
  }
3441
3488
  } catch (err) {
@@ -3578,7 +3625,7 @@ _ts_decorate4([
3578
3625
  })
3579
3626
  ], DataSpace.prototype, "_initializeAndReadControlPipeline", null);
3580
3627
  _ts_decorate4([
3581
- (0, import_debug4.timed)(1e4)
3628
+ (0, import_debug3.timed)(1e4)
3582
3629
  ], DataSpace.prototype, "_createWritableFeeds", null);
3583
3630
  _ts_decorate4([
3584
3631
  import_async10.synchronized
@@ -3610,11 +3657,11 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
3610
3657
  spaceKey: space.key,
3611
3658
  role: import_credentials14.SpaceMember.Role.ADMIN,
3612
3659
  profile: signingContext.getProfile(),
3613
- genesisFeedKey: space.controlFeedKey ?? (0, import_debug5.failUndefined)()
3660
+ genesisFeedKey: space.controlFeedKey ?? (0, import_debug4.failUndefined)()
3614
3661
  }
3615
3662
  }),
3616
3663
  await signingContext.credentialSigner.createCredential({
3617
- subject: space.controlFeedKey ?? (0, import_debug5.failUndefined)(),
3664
+ subject: space.controlFeedKey ?? (0, import_debug4.failUndefined)(),
3618
3665
  assertion: {
3619
3666
  "@type": "dxos.halo.credentials.AdmittedFeed",
3620
3667
  spaceKey: space.key,
@@ -3624,7 +3671,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
3624
3671
  }
3625
3672
  }),
3626
3673
  await signingContext.credentialSigner.createCredential({
3627
- subject: space.dataFeedKey ?? (0, import_debug5.failUndefined)(),
3674
+ subject: space.dataFeedKey ?? (0, import_debug4.failUndefined)(),
3628
3675
  assertion: {
3629
3676
  "@type": "dxos.halo.credentials.AdmittedFeed",
3630
3677
  spaceKey: space.key,
@@ -3634,7 +3681,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
3634
3681
  }
3635
3682
  }),
3636
3683
  await signingContext.credentialSigner.createCredential({
3637
- subject: space.key ?? (0, import_debug5.failUndefined)(),
3684
+ subject: space.key ?? (0, import_debug4.failUndefined)(),
3638
3685
  assertion: {
3639
3686
  "@type": "dxos.halo.credentials.Epoch",
3640
3687
  number: 0,
@@ -3794,7 +3841,9 @@ var DataSpaceManager = class {
3794
3841
  });
3795
3842
  const automergeRoot = this._automergeHost.repo.create();
3796
3843
  automergeRoot.change((doc) => {
3797
- doc.experimental_spaceKey = spaceKey.toHex();
3844
+ doc.access = {
3845
+ spaceKey: spaceKey.toHex()
3846
+ };
3798
3847
  });
3799
3848
  const space = await this._constructSpace(metadata);
3800
3849
  const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, automergeRoot.url);
@@ -3915,8 +3964,8 @@ var DataSpaceManager = class {
3915
3964
  },
3916
3965
  memberKey: this._signingContext.identityKey
3917
3966
  });
3918
- controlFeed && space.setControlFeed(controlFeed);
3919
- dataFeed && space.setDataFeed(dataFeed);
3967
+ controlFeed && await space.setControlFeed(controlFeed);
3968
+ dataFeed && await space.setDataFeed(dataFeed);
3920
3969
  const dataSpace = new DataSpace({
3921
3970
  inner: space,
3922
3971
  initialState: metadata.state === import_services10.SpaceState.INACTIVE ? import_services10.SpaceState.INACTIVE : import_services10.SpaceState.CLOSED,
@@ -4013,7 +4062,7 @@ var SpacesServiceImpl = class {
4013
4062
  }
4014
4063
  async updateSpace({ spaceKey, state }) {
4015
4064
  const dataSpaceManager = await this._getDataSpaceManager();
4016
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
4065
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
4017
4066
  if (state) {
4018
4067
  switch (state) {
4019
4068
  case import_services11.SpaceState.ACTIVE:
@@ -4078,14 +4127,14 @@ var SpacesServiceImpl = class {
4078
4127
  }
4079
4128
  async postMessage({ spaceKey, channel, message }) {
4080
4129
  const dataSpaceManager = await this._getDataSpaceManager();
4081
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
4130
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
4082
4131
  await space.postMessage(getChannelId(channel), message);
4083
4132
  }
4084
4133
  subscribeMessages({ spaceKey, channel }) {
4085
4134
  return new import_codec_protobuf11.Stream(({ ctx, next }) => {
4086
4135
  (0, import_async13.scheduleTask)(ctx, async () => {
4087
4136
  const dataSpaceManager = await this._getDataSpaceManager();
4088
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
4137
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
4089
4138
  const handle = space.listen(getChannelId(channel), (message) => {
4090
4139
  next(message);
4091
4140
  });
@@ -4095,7 +4144,7 @@ var SpacesServiceImpl = class {
4095
4144
  }
4096
4145
  queryCredentials({ spaceKey, noTail }) {
4097
4146
  return new import_codec_protobuf11.Stream(({ ctx, next, close }) => {
4098
- const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
4147
+ const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
4099
4148
  const processor = {
4100
4149
  processCredential: async (credential) => {
4101
4150
  next(credential);
@@ -4111,7 +4160,7 @@ var SpacesServiceImpl = class {
4111
4160
  });
4112
4161
  }
4113
4162
  async writeCredentials({ spaceKey, credentials }) {
4114
- const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
4163
+ const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
4115
4164
  for (const credential of credentials ?? []) {
4116
4165
  if (credential.proof) {
4117
4166
  await space.controlPipeline.writer.write({
@@ -4162,7 +4211,7 @@ var SpacesServiceImpl = class {
4162
4211
  }
4163
4212
  async createEpoch({ spaceKey }) {
4164
4213
  const dataSpaceManager = await this._getDataSpaceManager();
4165
- const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
4214
+ const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
4166
4215
  await space.createEpoch();
4167
4216
  }
4168
4217
  _serializeSpace(space) {
@@ -4253,7 +4302,7 @@ var ServiceContext = class {
4253
4302
  this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
4254
4303
  this.automergeHost = new import_echo_pipeline2.AutomergeHost(storage.createDirectory("automerge"));
4255
4304
  this.invitations = new InvitationsHandler(this.networkManager);
4256
- this._handlerFactories.set(import_services12.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug7.failUndefined)(), this._acceptIdentity.bind(this)));
4305
+ this._handlerFactories.set(import_services12.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
4257
4306
  }
4258
4307
  async open(ctx) {
4259
4308
  await this._checkStorageVersion();
@@ -4365,7 +4414,7 @@ var ServiceContext = class {
4365
4414
  S: this,
4366
4415
  C: (f, a) => f(...a)
4367
4416
  });
4368
- const identity = this.identityManager.identity ?? (0, import_debug7.failUndefined)();
4417
+ const identity = this.identityManager.identity ?? (0, import_debug6.failUndefined)();
4369
4418
  const signingContext = {
4370
4419
  credentialSigner: identity.getIdentityCredentialSigner(),
4371
4420
  identityKey: identity.identityKey,
@@ -5218,4 +5267,4 @@ ClientServicesHost = _ts_decorate8([
5218
5267
  subscribeToSpaces,
5219
5268
  subscribeToSwarmInfo
5220
5269
  });
5221
- //# sourceMappingURL=chunk-PZGADVCE.cjs.map
5270
+ //# sourceMappingURL=chunk-WB7KSXSI.cjs.map