@dxos/client-services 0.3.2-main.48c28c7 → 0.3.2-main.988f99c

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.
@@ -52,7 +52,7 @@ var createMockCredential = async ({ signer, issuer }) => (0, import_credentials.
52
52
 
53
53
  // packages/sdk/client-services/src/packlets/testing/invitation-utils.ts
54
54
  var import_async18 = require("@dxos/async");
55
- var import_invariant16 = require("@dxos/invariant");
55
+ var import_invariant17 = require("@dxos/invariant");
56
56
  var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
57
57
 
58
58
  // packages/sdk/client-services/src/packlets/services/client-rpc-server.ts
@@ -99,7 +99,7 @@ var getPlatform = () => {
99
99
  };
100
100
 
101
101
  // packages/sdk/client-services/src/version.ts
102
- var DXOS_VERSION = "0.3.2-main.48c28c7";
102
+ var DXOS_VERSION = "0.3.2-main.988f99c";
103
103
 
104
104
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
105
105
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
@@ -228,13 +228,13 @@ var import_echo_pipeline2 = require("@dxos/echo-pipeline");
228
228
  var import_feed_store3 = require("@dxos/feed-store");
229
229
  var import_invariant13 = require("@dxos/invariant");
230
230
  var import_keyring = require("@dxos/keyring");
231
- var import_keys8 = require("@dxos/keys");
231
+ var import_keys9 = require("@dxos/keys");
232
232
  var import_log13 = require("@dxos/log");
233
233
  var import_protocols10 = require("@dxos/protocols");
234
234
  var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
235
235
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
236
236
  var import_tracing4 = require("@dxos/tracing");
237
- var import_util5 = require("@dxos/util");
237
+ var import_util6 = require("@dxos/util");
238
238
 
239
239
  // packages/sdk/client-services/src/packlets/identity/authenticator.ts
240
240
  var import_async = require("@dxos/async");
@@ -358,9 +358,11 @@ var import_credentials4 = require("@dxos/credentials");
358
358
  var import_debug2 = require("@dxos/debug");
359
359
  var import_feed_store = require("@dxos/feed-store");
360
360
  var import_invariant2 = require("@dxos/invariant");
361
+ var import_keys2 = require("@dxos/keys");
361
362
  var import_log3 = require("@dxos/log");
362
363
  var import_credentials5 = require("@dxos/protocols/proto/dxos/halo/credentials");
363
364
  var import_tracing = require("@dxos/tracing");
365
+ var import_util = require("@dxos/util");
364
366
  function _ts_decorate(decorators, target, key, desc) {
365
367
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
366
368
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -379,6 +381,14 @@ var Identity = class Identity2 {
379
381
  this._signer = signer;
380
382
  this.identityKey = identityKey;
381
383
  this.deviceKey = deviceKey;
384
+ import_log3.log.trace("dxos.halo.device", {
385
+ deviceKey
386
+ }, {
387
+ F: __dxlog_file3,
388
+ L: 60,
389
+ S: this,
390
+ C: (f, a) => f(...a)
391
+ });
382
392
  this._deviceStateMachine = new import_credentials4.DeviceStateMachine({
383
393
  identityKey: this.identityKey,
384
394
  deviceKey: this.deviceKey,
@@ -389,7 +399,7 @@ var Identity = class Identity2 {
389
399
  onUpdate: () => this.stateUpdate.emit()
390
400
  });
391
401
  this.authVerifier = new TrustedKeySetAuthVerifier({
392
- trustedKeysProvider: () => this.authorizedDeviceKeys,
402
+ trustedKeysProvider: () => new import_util.ComplexSet(import_keys2.PublicKey.hash, this.authorizedDeviceKeys.keys()),
393
403
  update: this.stateUpdate,
394
404
  authTimeout: import_client_protocol.AUTH_TIMEOUT
395
405
  });
@@ -447,7 +457,7 @@ var Identity = class Identity2 {
447
457
  getIdentityCredentialSigner() {
448
458
  (0, import_invariant2.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
449
459
  F: __dxlog_file3,
450
- L: 139,
460
+ L: 141,
451
461
  S: this,
452
462
  A: [
453
463
  "this._deviceStateMachine.deviceCredentialChain",
@@ -471,7 +481,7 @@ var Identity = class Identity2 {
471
481
  dataFeedKey
472
482
  }, {
473
483
  F: __dxlog_file3,
474
- L: 155,
484
+ L: 157,
475
485
  S: this,
476
486
  C: (f, a) => f(...a)
477
487
  });
@@ -527,13 +537,13 @@ var import_async3 = require("@dxos/async");
527
537
  var import_context2 = require("@dxos/context");
528
538
  var import_credentials6 = require("@dxos/credentials");
529
539
  var import_invariant3 = require("@dxos/invariant");
530
- var import_keys2 = require("@dxos/keys");
540
+ var import_keys3 = require("@dxos/keys");
531
541
  var import_log4 = require("@dxos/log");
532
542
  var import_protocols3 = require("@dxos/protocols");
533
543
  var import_credentials7 = require("@dxos/protocols/proto/dxos/halo/credentials");
534
544
  var import_timeframe = require("@dxos/timeframe");
535
545
  var import_tracing2 = require("@dxos/tracing");
536
- var import_util = require("@dxos/util");
546
+ var import_util2 = require("@dxos/util");
537
547
  function _ts_decorate2(decorators, target, key, desc) {
538
548
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
539
549
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -559,7 +569,7 @@ var IdentityManager = class IdentityManager2 {
559
569
  return this._identity;
560
570
  }
561
571
  async open(ctx) {
562
- const traceId = import_keys2.PublicKey.random().toHex();
572
+ const traceId = import_keys3.PublicKey.random().toHex();
563
573
  import_log4.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.begin({
564
574
  id: traceId
565
575
  }), {
@@ -789,10 +799,51 @@ var IdentityManager = class IdentityManager2 {
789
799
  this.stateUpdate.emit();
790
800
  return profile;
791
801
  }
802
+ async updateDevice({ deviceKey, profile }) {
803
+ (0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
804
+ F: __dxlog_file4,
805
+ L: 216,
806
+ S: this,
807
+ A: [
808
+ "this._identity",
809
+ "'Identity not initialized.'"
810
+ ]
811
+ });
812
+ (0, import_invariant3.invariant)(this._identity.authorizedDeviceKeys.has(deviceKey), "Device not authorized.", {
813
+ F: __dxlog_file4,
814
+ L: 218,
815
+ S: this,
816
+ A: [
817
+ "this._identity.authorizedDeviceKeys.has(deviceKey)",
818
+ "'Device not authorized.'"
819
+ ]
820
+ });
821
+ const credential = await this._identity.getIdentityCredentialSigner().createCredential({
822
+ subject: this._identity.identityKey,
823
+ assertion: {
824
+ "@type": "dxos.halo.credentials.DeviceProfile",
825
+ deviceKey,
826
+ profile
827
+ }
828
+ });
829
+ const receipt = await this._identity.controlPipeline.writer.write({
830
+ credential: {
831
+ credential
832
+ }
833
+ });
834
+ await this._identity.controlPipeline.state.waitUntilTimeframe(new import_timeframe.Timeframe([
835
+ [
836
+ receipt.feedKey,
837
+ receipt.seq
838
+ ]
839
+ ]));
840
+ this.stateUpdate.emit();
841
+ return profile;
842
+ }
792
843
  async _constructIdentity(identityRecord) {
793
844
  (0, import_invariant3.invariant)(!this._identity, void 0, {
794
845
  F: __dxlog_file4,
795
- L: 216,
846
+ L: 236,
796
847
  S: this,
797
848
  A: [
798
849
  "!this._identity",
@@ -803,13 +854,13 @@ var IdentityManager = class IdentityManager2 {
803
854
  identityRecord
804
855
  }, {
805
856
  F: __dxlog_file4,
806
- L: 217,
857
+ L: 237,
807
858
  S: this,
808
859
  C: (f, a) => f(...a)
809
860
  });
810
861
  (0, import_invariant3.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
811
862
  F: __dxlog_file4,
812
- L: 220,
863
+ L: 240,
813
864
  S: this,
814
865
  A: [
815
866
  "identityRecord.haloSpace.controlFeedKey",
@@ -821,7 +872,7 @@ var IdentityManager = class IdentityManager2 {
821
872
  });
822
873
  (0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
823
874
  F: __dxlog_file4,
824
- L: 224,
875
+ L: 244,
825
876
  S: this,
826
877
  A: [
827
878
  "identityRecord.haloSpace.dataFeedKey",
@@ -837,7 +888,7 @@ var IdentityManager = class IdentityManager2 {
837
888
  swarmIdentity: {
838
889
  peerKey: identityRecord.deviceKey,
839
890
  credentialProvider: createAuthProvider((0, import_credentials6.createCredentialSignerWithKey)(this._keyring, identityRecord.deviceKey)),
840
- credentialAuthenticator: (0, import_util.deferFunction)(() => identity.authVerifier.verifier)
891
+ credentialAuthenticator: (0, import_util2.deferFunction)(() => identity.authVerifier.verifier)
841
892
  },
842
893
  identityKey: identityRecord.identityKey
843
894
  });
@@ -853,7 +904,7 @@ var IdentityManager = class IdentityManager2 {
853
904
  identityKey: identityRecord.identityKey
854
905
  }, {
855
906
  F: __dxlog_file4,
856
- L: 248,
907
+ L: 268,
857
908
  S: this,
858
909
  C: (f, a) => f(...a)
859
910
  });
@@ -874,7 +925,7 @@ var IdentityManager = class IdentityManager2 {
874
925
  onAuthFailure: () => {
875
926
  import_log4.log.warn("auth failure", void 0, {
876
927
  F: __dxlog_file4,
877
- L: 267,
928
+ L: 287,
878
929
  S: this,
879
930
  C: (f, a) => f(...a)
880
931
  });
@@ -1059,7 +1110,7 @@ var import_client_protocol2 = require("@dxos/client-protocol");
1059
1110
  var import_context4 = require("@dxos/context");
1060
1111
  var import_credentials9 = require("@dxos/credentials");
1061
1112
  var import_invariant7 = require("@dxos/invariant");
1062
- var import_keys4 = require("@dxos/keys");
1113
+ var import_keys5 = require("@dxos/keys");
1063
1114
  var import_log6 = require("@dxos/log");
1064
1115
  var import_network_manager = require("@dxos/network-manager");
1065
1116
  var import_protocols5 = require("@dxos/protocols");
@@ -1070,7 +1121,7 @@ var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations")
1070
1121
  var import_async4 = require("@dxos/async");
1071
1122
  var import_context3 = require("@dxos/context");
1072
1123
  var import_invariant6 = require("@dxos/invariant");
1073
- var import_keys3 = require("@dxos/keys");
1124
+ var import_keys4 = require("@dxos/keys");
1074
1125
  var import_log5 = require("@dxos/log");
1075
1126
  var import_protocols4 = require("@dxos/protocols");
1076
1127
  var import_services3 = require("@dxos/protocols/proto/dxos/client/services");
@@ -1118,7 +1169,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1118
1169
  },
1119
1170
  introduce: async (request) => {
1120
1171
  const { profile, invitationId } = request;
1121
- const traceId = import_keys3.PublicKey.random().toHex();
1172
+ const traceId = import_keys4.PublicKey.random().toHex();
1122
1173
  import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols4.trace.begin({
1123
1174
  id: traceId
1124
1175
  }), {
@@ -1170,7 +1221,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1170
1221
  };
1171
1222
  },
1172
1223
  authenticate: async ({ authCode: code }) => {
1173
- const traceId = import_keys3.PublicKey.random().toHex();
1224
+ const traceId = import_keys4.PublicKey.random().toHex();
1174
1225
  import_log5.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols4.trace.begin({
1175
1226
  id: traceId
1176
1227
  }), {
@@ -1250,7 +1301,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1250
1301
  };
1251
1302
  },
1252
1303
  admit: async (request) => {
1253
- const traceId = import_keys3.PublicKey.random().toHex();
1304
+ const traceId = import_keys4.PublicKey.random().toHex();
1254
1305
  import_log5.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols4.trace.begin({
1255
1306
  id: traceId
1256
1307
  }), {
@@ -1416,7 +1467,7 @@ var InvitationsHandler = class {
1416
1467
  this._networkManager = _networkManager;
1417
1468
  }
1418
1469
  createInvitation(protocol, options) {
1419
- const { invitationId = import_keys4.PublicKey.random().toHex(), type = import_services4.Invitation.Type.INTERACTIVE, authMethod = import_services4.Invitation.AuthMethod.SHARED_SECRET, state = import_services4.Invitation.State.INIT, timeout = import_client_protocol2.INVITATION_TIMEOUT, swarmKey = import_keys4.PublicKey.random() } = options ?? {};
1470
+ const { invitationId = import_keys5.PublicKey.random().toHex(), type = import_services4.Invitation.Type.INTERACTIVE, authMethod = import_services4.Invitation.AuthMethod.SHARED_SECRET, state = import_services4.Invitation.State.INIT, timeout = import_client_protocol2.INVITATION_TIMEOUT, swarmKey = import_keys5.PublicKey.random() } = options ?? {};
1420
1471
  const authCode = options?.authCode ?? (authMethod === import_services4.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials9.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0);
1421
1472
  (0, import_invariant7.invariant)(protocol, void 0, {
1422
1473
  F: __dxlog_file8,
@@ -1491,7 +1542,7 @@ var InvitationsHandler = class {
1491
1542
  },
1492
1543
  onOpen: () => {
1493
1544
  (0, import_async5.scheduleTask)(ctx, async () => {
1494
- const traceId = import_keys4.PublicKey.random().toHex();
1545
+ const traceId = import_keys5.PublicKey.random().toHex();
1495
1546
  try {
1496
1547
  import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.begin({
1497
1548
  id: traceId
@@ -1724,7 +1775,7 @@ var InvitationsHandler = class {
1724
1775
  }
1725
1776
  });
1726
1777
  (0, import_async5.scheduleTask)(ctx, async () => {
1727
- const traceId = import_keys4.PublicKey.random().toHex();
1778
+ const traceId = import_keys5.PublicKey.random().toHex();
1728
1779
  try {
1729
1780
  import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.begin({
1730
1781
  id: traceId
@@ -1931,7 +1982,7 @@ var InvitationsHandler = class {
1931
1982
  const topic = invitation.swarmKey;
1932
1983
  const swarmConnection = await this._networkManager.joinSwarm({
1933
1984
  topic,
1934
- peerId: import_keys4.PublicKey.random(),
1985
+ peerId: import_keys5.PublicKey.random(),
1935
1986
  protocolProvider: (0, import_network_manager.createTeleportProtocolFactory)(async (teleport) => {
1936
1987
  teleport.addExtension("dxos.halo.invitations", createExtension());
1937
1988
  }),
@@ -2310,12 +2361,12 @@ var import_async9 = require("@dxos/async");
2310
2361
  var import_context7 = require("@dxos/context");
2311
2362
  var import_credentials14 = require("@dxos/credentials");
2312
2363
  var import_invariant11 = require("@dxos/invariant");
2313
- var import_keys7 = require("@dxos/keys");
2364
+ var import_keys8 = require("@dxos/keys");
2314
2365
  var import_log11 = require("@dxos/log");
2315
2366
  var import_protocols8 = require("@dxos/protocols");
2316
2367
  var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
2317
2368
  var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
2318
- var import_util4 = require("@dxos/util");
2369
+ var import_util5 = require("@dxos/util");
2319
2370
 
2320
2371
  // packages/sdk/client-services/src/packlets/spaces/data-space.ts
2321
2372
  var import_async8 = require("@dxos/async");
@@ -2323,24 +2374,24 @@ var import_client_protocol3 = require("@dxos/client-protocol");
2323
2374
  var import_context6 = require("@dxos/context");
2324
2375
  var import_debug4 = require("@dxos/debug");
2325
2376
  var import_echo_pipeline = require("@dxos/echo-pipeline");
2326
- var import_keys6 = require("@dxos/keys");
2377
+ var import_keys7 = require("@dxos/keys");
2327
2378
  var import_log10 = require("@dxos/log");
2328
2379
  var import_protocols7 = require("@dxos/protocols");
2329
2380
  var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
2330
2381
  var import_credentials11 = require("@dxos/protocols/proto/dxos/halo/credentials");
2331
2382
  var import_timeframe2 = require("@dxos/timeframe");
2332
2383
  var import_tracing3 = require("@dxos/tracing");
2333
- var import_util3 = require("@dxos/util");
2384
+ var import_util4 = require("@dxos/util");
2334
2385
 
2335
2386
  // packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
2336
2387
  var import_async7 = require("@dxos/async");
2337
2388
  var import_context5 = require("@dxos/context");
2338
2389
  var import_invariant10 = require("@dxos/invariant");
2339
- var import_keys5 = require("@dxos/keys");
2390
+ var import_keys6 = require("@dxos/keys");
2340
2391
  var import_log9 = require("@dxos/log");
2341
2392
  var import_protocols6 = require("@dxos/protocols");
2342
2393
  var import_teleport2 = require("@dxos/teleport");
2343
- var import_util2 = require("@dxos/util");
2394
+ var import_util3 = require("@dxos/util");
2344
2395
  var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
2345
2396
  var DEFAULT_RETRY_TIMEOUT = 1e3;
2346
2397
  var DEFAULT_SUCCESS_DELAY = 1e3;
@@ -2351,8 +2402,8 @@ var NotarizationPlugin = class {
2351
2402
  this._ctx = new import_context5.Context();
2352
2403
  this._extensionOpened = new import_async7.Event();
2353
2404
  this._extensions = /* @__PURE__ */ new Set();
2354
- this._processedCredentials = new import_util2.ComplexSet(import_keys5.PublicKey.hash);
2355
- this._processCredentialsTriggers = new import_util2.ComplexMap(import_keys5.PublicKey.hash);
2405
+ this._processedCredentials = new import_util3.ComplexSet(import_keys6.PublicKey.hash);
2406
+ this._processCredentialsTriggers = new import_util3.ComplexMap(import_keys6.PublicKey.hash);
2356
2407
  }
2357
2408
  get hasWriter() {
2358
2409
  return !!this._writer;
@@ -2514,7 +2565,7 @@ var NotarizationPlugin = class {
2514
2565
  if (this._processedCredentials.has(id)) {
2515
2566
  return;
2516
2567
  }
2517
- await (0, import_util2.entry)(this._processCredentialsTriggers, id).orInsert(new import_async7.Trigger()).value.wait();
2568
+ await (0, import_util3.entry)(this._processCredentialsTriggers, id).orInsert(new import_async7.Trigger()).value.wait();
2518
2569
  }
2519
2570
  /**
2520
2571
  * Requests from other peers to notarize credentials.
@@ -2634,7 +2685,7 @@ var DataSpace = class DataSpace2 {
2634
2685
  this._signingContext = params.signingContext;
2635
2686
  this._callbacks = params.callbacks ?? {};
2636
2687
  this.authVerifier = new TrustedKeySetAuthVerifier({
2637
- trustedKeysProvider: () => new import_util3.ComplexSet(import_keys6.PublicKey.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => !member.removed).map((member) => member.key)),
2688
+ trustedKeysProvider: () => new import_util4.ComplexSet(import_keys7.PublicKey.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => !member.removed).map((member) => member.key)),
2638
2689
  update: this._inner.stateUpdate,
2639
2690
  authTimeout: import_client_protocol3.AUTH_TIMEOUT
2640
2691
  });
@@ -3053,9 +3104,9 @@ var DataSpaceManager = class DataSpaceManager2 {
3053
3104
  this._feedStore = _feedStore;
3054
3105
  this._ctx = new import_context7.Context();
3055
3106
  this.updated = new import_async9.Event();
3056
- this._spaces = new import_util4.ComplexMap(import_keys7.PublicKey.hash);
3107
+ this._spaces = new import_util5.ComplexMap(import_keys8.PublicKey.hash);
3057
3108
  this._isOpen = false;
3058
- this._instanceId = import_keys7.PublicKey.random().toHex();
3109
+ this._instanceId = import_keys8.PublicKey.random().toHex();
3059
3110
  }
3060
3111
  // TODO(burdon): Remove.
3061
3112
  get spaces() {
@@ -3084,7 +3135,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3084
3135
  S: this,
3085
3136
  C: (f, a) => f(...a)
3086
3137
  });
3087
- await (0, import_util4.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
3138
+ await (0, import_util5.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
3088
3139
  try {
3089
3140
  (0, import_log11.log)("load space", {
3090
3141
  spaceMetadata
@@ -3266,7 +3317,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3266
3317
  swarmIdentity: {
3267
3318
  peerKey: this._signingContext.deviceKey,
3268
3319
  credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
3269
- credentialAuthenticator: (0, import_util4.deferFunction)(() => dataSpace.authVerifier.verifier)
3320
+ credentialAuthenticator: (0, import_util5.deferFunction)(() => dataSpace.authVerifier.verifier)
3270
3321
  },
3271
3322
  onNetworkConnection: (session) => {
3272
3323
  session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
@@ -3606,7 +3657,7 @@ var ServiceContext = class ServiceContext2 {
3606
3657
  this.initialized = new import_async11.Trigger();
3607
3658
  this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
3608
3659
  this._handlerFactories = /* @__PURE__ */ new Map();
3609
- this._instanceId = import_keys8.PublicKey.random().toHex();
3660
+ this._instanceId = import_keys9.PublicKey.random().toHex();
3610
3661
  this.metadataStore = new import_echo_pipeline2.MetadataStore(storage.createDirectory("metadata"));
3611
3662
  this.snapshotStore = new import_echo_pipeline2.SnapshotStore(storage.createDirectory("snapshots"));
3612
3663
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
@@ -3827,7 +3878,7 @@ _ts_decorate5([
3827
3878
  import_tracing4.trace.span()
3828
3879
  ], ServiceContext.prototype, "_initialize", null);
3829
3880
  ServiceContext = _ts_decorate5([
3830
- (0, import_util5.safeInstanceof)("dxos.client-services.ServiceContext"),
3881
+ (0, import_util6.safeInstanceof)("dxos.client-services.ServiceContext"),
3831
3882
  import_tracing4.trace.resource()
3832
3883
  ], ServiceContext);
3833
3884
 
@@ -3838,8 +3889,8 @@ var import_context10 = require("@dxos/context");
3838
3889
  var import_document_model2 = require("@dxos/document-model");
3839
3890
  var import_echo_pipeline3 = require("@dxos/echo-pipeline");
3840
3891
  var import_echo_schema = require("@dxos/echo-schema");
3841
- var import_invariant15 = require("@dxos/invariant");
3842
- var import_keys12 = require("@dxos/keys");
3892
+ var import_invariant16 = require("@dxos/invariant");
3893
+ var import_keys13 = require("@dxos/keys");
3843
3894
  var import_log16 = require("@dxos/log");
3844
3895
  var import_messaging = require("@dxos/messaging");
3845
3896
  var import_model_factory = require("@dxos/model-factory");
@@ -3877,13 +3928,33 @@ var ServiceRegistry = class {
3877
3928
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
3878
3929
  var import_async12 = require("@dxos/async");
3879
3930
  var import_codec_protobuf6 = require("@dxos/codec-protobuf");
3931
+ var import_invariant14 = require("@dxos/invariant");
3880
3932
  var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
3933
+ var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
3881
3934
  var DevicesServiceImpl = class {
3882
3935
  constructor(_identityManager) {
3883
3936
  this._identityManager = _identityManager;
3884
3937
  }
3885
- updateDevice(request) {
3886
- throw new Error("Method not implemented.");
3938
+ async updateDevice(profile) {
3939
+ (0, import_invariant14.invariant)(this._identityManager.identity, "Identity not initialized", {
3940
+ F: __dxlog_file16,
3941
+ L: 17,
3942
+ S: this,
3943
+ A: [
3944
+ "this._identityManager.identity",
3945
+ "'Identity not initialized'"
3946
+ ]
3947
+ });
3948
+ const deviceKey = this._identityManager.identity.deviceKey;
3949
+ await this._identityManager.updateDevice({
3950
+ deviceKey,
3951
+ profile
3952
+ });
3953
+ return {
3954
+ deviceKey,
3955
+ kind: import_services11.DeviceKind.CURRENT,
3956
+ profile
3957
+ };
3887
3958
  }
3888
3959
  queryDevices() {
3889
3960
  return new import_codec_protobuf6.Stream(({ next }) => {
@@ -3895,9 +3966,10 @@ var DevicesServiceImpl = class {
3895
3966
  });
3896
3967
  } else {
3897
3968
  next({
3898
- devices: Array.from(deviceKeys.values()).map((key) => ({
3969
+ devices: Array.from(deviceKeys.entries()).map(([key, profile]) => ({
3899
3970
  deviceKey: key,
3900
- kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services11.DeviceKind.CURRENT : import_services11.DeviceKind.TRUSTED
3971
+ kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services11.DeviceKind.CURRENT : import_services11.DeviceKind.TRUSTED,
3972
+ profile
3901
3973
  }))
3902
3974
  });
3903
3975
  }
@@ -3925,12 +3997,12 @@ var import_codec_protobuf12 = require("@dxos/codec-protobuf");
3925
3997
  var import_async13 = require("@dxos/async");
3926
3998
  var import_codec_protobuf7 = require("@dxos/codec-protobuf");
3927
3999
  var import_feed_store4 = require("@dxos/feed-store");
3928
- var import_keys9 = require("@dxos/keys");
3929
- var import_util6 = require("@dxos/util");
4000
+ var import_keys10 = require("@dxos/keys");
4001
+ var import_util7 = require("@dxos/util");
3930
4002
  var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
3931
4003
  return new import_codec_protobuf7.Stream(({ next }) => {
3932
4004
  const subscriptions = new import_async13.EventSubscriptions();
3933
- const feedMap = new import_util6.ComplexMap(import_keys9.PublicKey.hash);
4005
+ const feedMap = new import_util7.ComplexMap(import_keys10.PublicKey.hash);
3934
4006
  const update = () => {
3935
4007
  const { feeds } = feedStore;
3936
4008
  feeds.filter((feed) => !feedKeys?.length || feedKeys.some((feedKey) => feedKey.equals(feed.key))).forEach((feed) => {
@@ -4022,7 +4094,7 @@ var subscribeToMetadata = ({ context }) => new import_codec_protobuf9.Stream(({
4022
4094
  // packages/sdk/client-services/src/packlets/devtools/network.ts
4023
4095
  var import_codec_protobuf10 = require("@dxos/codec-protobuf");
4024
4096
  var import_context9 = require("@dxos/context");
4025
- var import_keys10 = require("@dxos/keys");
4097
+ var import_keys11 = require("@dxos/keys");
4026
4098
  var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf10.Stream(({ next, close }) => {
4027
4099
  const update = () => {
4028
4100
  try {
@@ -4226,7 +4298,7 @@ var DevtoolsServiceImpl = class {
4226
4298
  };
4227
4299
 
4228
4300
  // packages/sdk/client-services/src/packlets/locks/node.ts
4229
- var import_invariant14 = require("@dxos/invariant");
4301
+ var import_invariant15 = require("@dxos/invariant");
4230
4302
  var import_lock_file = require("@dxos/lock-file");
4231
4303
  var import_log14 = require("@dxos/log");
4232
4304
  function _ts_decorate6(decorators, target, key, desc) {
@@ -4239,7 +4311,7 @@ function _ts_decorate6(decorators, target, key, desc) {
4239
4311
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4240
4312
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4241
4313
  }
4242
- var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
4314
+ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
4243
4315
  var Lock = class {
4244
4316
  constructor({ lockKey: lockPath, onAcquire, onRelease }) {
4245
4317
  this._lockPath = lockPath;
@@ -4251,7 +4323,7 @@ var Lock = class {
4251
4323
  }
4252
4324
  async acquire() {
4253
4325
  (0, import_log14.log)("acquiring lock...", void 0, {
4254
- F: __dxlog_file16,
4326
+ F: __dxlog_file17,
4255
4327
  L: 32,
4256
4328
  S: this,
4257
4329
  C: (f, a) => f(...a)
@@ -4259,7 +4331,7 @@ var Lock = class {
4259
4331
  this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
4260
4332
  await this._onAcquire?.();
4261
4333
  (0, import_log14.log)("acquired lock", void 0, {
4262
- F: __dxlog_file16,
4334
+ F: __dxlog_file17,
4263
4335
  L: 37,
4264
4336
  S: this,
4265
4337
  C: (f, a) => f(...a)
@@ -4267,8 +4339,8 @@ var Lock = class {
4267
4339
  }
4268
4340
  async release() {
4269
4341
  await this._onRelease?.();
4270
- (0, import_invariant14.invariant)(this._fileHandle, "Lock is not acquired", {
4271
- F: __dxlog_file16,
4342
+ (0, import_invariant15.invariant)(this._fileHandle, "Lock is not acquired", {
4343
+ F: __dxlog_file17,
4272
4344
  L: 42,
4273
4345
  S: this,
4274
4346
  A: [
@@ -4288,7 +4360,7 @@ var import_async16 = require("@dxos/async");
4288
4360
  var import_codec_protobuf13 = require("@dxos/codec-protobuf");
4289
4361
  var import_log15 = require("@dxos/log");
4290
4362
  var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
4291
- var import_util7 = require("@dxos/util");
4363
+ var import_util8 = require("@dxos/util");
4292
4364
  var LoggingServiceImpl = class {
4293
4365
  constructor() {
4294
4366
  this._logs = new import_async16.Event();
@@ -4306,15 +4378,15 @@ var LoggingServiceImpl = class {
4306
4378
  }
4307
4379
  async controlMetrics({ reset, record }) {
4308
4380
  if (reset) {
4309
- import_util7.tracer.clear();
4381
+ import_util8.tracer.clear();
4310
4382
  }
4311
4383
  if (record === true) {
4312
- import_util7.tracer.start();
4384
+ import_util8.tracer.start();
4313
4385
  } else if (record === false) {
4314
- import_util7.tracer.stop();
4386
+ import_util8.tracer.stop();
4315
4387
  }
4316
4388
  return {
4317
- recording: import_util7.tracer.recording
4389
+ recording: import_util8.tracer.recording
4318
4390
  };
4319
4391
  }
4320
4392
  /**
@@ -4322,10 +4394,10 @@ var LoggingServiceImpl = class {
4322
4394
  */
4323
4395
  queryMetrics({ interval = 5e3 }) {
4324
4396
  const getNumericalValues = (key) => {
4325
- const events = import_util7.tracer.get(key) ?? [];
4397
+ const events = import_util8.tracer.get(key) ?? [];
4326
4398
  return {
4327
4399
  key,
4328
- stats: (0, import_util7.numericalValues)(events, "duration")
4400
+ stats: (0, import_util8.numericalValues)(events, "duration")
4329
4401
  };
4330
4402
  };
4331
4403
  return new import_codec_protobuf13.Stream(({ next }) => {
@@ -4363,7 +4435,7 @@ var LoggingServiceImpl = class {
4363
4435
  }
4364
4436
  const record = {
4365
4437
  ...entry2,
4366
- context: (0, import_util7.jsonify)((0, import_log15.getContextFromEntry)(entry2)),
4438
+ context: (0, import_util8.jsonify)((0, import_log15.getContextFromEntry)(entry2)),
4367
4439
  timestamp: /* @__PURE__ */ new Date(),
4368
4440
  meta: {
4369
4441
  // TODO(dmaretskyi): Fix proto.
@@ -4437,10 +4509,10 @@ var import_client_protocol4 = require("@dxos/client-protocol");
4437
4509
  var import_protocols11 = require("@dxos/protocols");
4438
4510
  var import_config = require("@dxos/protocols/proto/dxos/config");
4439
4511
  var import_random_access_storage = require("@dxos/random-access-storage");
4440
- var import_util8 = require("@dxos/util");
4512
+ var import_util9 = require("@dxos/util");
4441
4513
  var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
4442
4514
  var createStorageObjects = (config) => {
4443
- const { persistent = false, keyStore, dataStore, dataRoot = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
4515
+ const { persistent = false, keyStore, dataStore, dataRoot = (0, import_util9.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
4444
4516
  if (persistent && dataStore === StorageDriver.RAM) {
4445
4517
  throw new import_protocols11.InvalidConfigError("RAM storage cannot be used in persistent mode.");
4446
4518
  }
@@ -4484,7 +4556,7 @@ var toStorageType = (type) => {
4484
4556
  // packages/sdk/client-services/src/packlets/system/system-service.ts
4485
4557
  var import_codec_protobuf15 = require("@dxos/codec-protobuf");
4486
4558
  var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
4487
- var import_util9 = require("@dxos/util");
4559
+ var import_util10 = require("@dxos/util");
4488
4560
  var SystemServiceImpl = class {
4489
4561
  constructor({ config, statusUpdate, getDiagnostics, onUpdateStatus, getCurrentStatus, onReset }) {
4490
4562
  this._config = config;
@@ -4504,7 +4576,7 @@ var SystemServiceImpl = class {
4504
4576
  const diagnostics = await this._getDiagnostics();
4505
4577
  return {
4506
4578
  timestamp: /* @__PURE__ */ new Date(),
4507
- diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util9.jsonKeyReplacer)({
4579
+ diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util10.jsonKeyReplacer)({
4508
4580
  truncate: keys === import_services13.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
4509
4581
  humanize: keys === import_services13.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
4510
4582
  })))
@@ -4546,7 +4618,7 @@ function _ts_decorate7(decorators, target, key, desc) {
4546
4618
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4547
4619
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4548
4620
  }
4549
- var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
4621
+ var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
4550
4622
  var createDefaultModelFactory = () => {
4551
4623
  return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
4552
4624
  };
@@ -4646,8 +4718,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4646
4718
  * Can only be called once.
4647
4719
  */
4648
4720
  initialize({ config, ...options }) {
4649
- (0, import_invariant15.invariant)(!this._open, "service host is open", {
4650
- F: __dxlog_file17,
4721
+ (0, import_invariant16.invariant)(!this._open, "service host is open", {
4722
+ F: __dxlog_file18,
4651
4723
  L: 201,
4652
4724
  S: this,
4653
4725
  A: [
@@ -4656,14 +4728,14 @@ var ClientServicesHost = class ClientServicesHost2 {
4656
4728
  ]
4657
4729
  });
4658
4730
  (0, import_log16.log)("initializing...", void 0, {
4659
- F: __dxlog_file17,
4731
+ F: __dxlog_file18,
4660
4732
  L: 202,
4661
4733
  S: this,
4662
4734
  C: (f, a) => f(...a)
4663
4735
  });
4664
4736
  if (config) {
4665
- (0, import_invariant15.invariant)(!this._config, "config already set", {
4666
- F: __dxlog_file17,
4737
+ (0, import_invariant16.invariant)(!this._config, "config already set", {
4738
+ F: __dxlog_file18,
4667
4739
  L: 205,
4668
4740
  S: this,
4669
4741
  A: [
@@ -4680,8 +4752,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4680
4752
  iceServers: this._config?.get("runtime.services.ice")
4681
4753
  }), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
4682
4754
  this._signalManager = signalManager;
4683
- (0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
4684
- F: __dxlog_file17,
4755
+ (0, import_invariant16.invariant)(!this._networkManager, "network manager already set", {
4756
+ F: __dxlog_file18,
4685
4757
  L: 221,
4686
4758
  S: this,
4687
4759
  A: [
@@ -4695,7 +4767,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4695
4767
  signalManager
4696
4768
  });
4697
4769
  (0, import_log16.log)("initialized", void 0, {
4698
- F: __dxlog_file17,
4770
+ F: __dxlog_file18,
4699
4771
  L: 228,
4700
4772
  S: this,
4701
4773
  C: (f, a) => f(...a)
@@ -4705,17 +4777,17 @@ var ClientServicesHost = class ClientServicesHost2 {
4705
4777
  if (this._open) {
4706
4778
  return;
4707
4779
  }
4708
- const traceId = import_keys12.PublicKey.random().toHex();
4780
+ const traceId = import_keys13.PublicKey.random().toHex();
4709
4781
  import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.begin({
4710
4782
  id: traceId
4711
4783
  }), {
4712
- F: __dxlog_file17,
4784
+ F: __dxlog_file18,
4713
4785
  L: 239,
4714
4786
  S: this,
4715
4787
  C: (f, a) => f(...a)
4716
4788
  });
4717
- (0, import_invariant15.invariant)(this._config, "config not set", {
4718
- F: __dxlog_file17,
4789
+ (0, import_invariant16.invariant)(this._config, "config not set", {
4790
+ F: __dxlog_file18,
4719
4791
  L: 241,
4720
4792
  S: this,
4721
4793
  A: [
@@ -4723,8 +4795,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4723
4795
  "'config not set'"
4724
4796
  ]
4725
4797
  });
4726
- (0, import_invariant15.invariant)(this._storage, "storage not set", {
4727
- F: __dxlog_file17,
4798
+ (0, import_invariant16.invariant)(this._storage, "storage not set", {
4799
+ F: __dxlog_file18,
4728
4800
  L: 242,
4729
4801
  S: this,
4730
4802
  A: [
@@ -4732,8 +4804,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4732
4804
  "'storage not set'"
4733
4805
  ]
4734
4806
  });
4735
- (0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
4736
- F: __dxlog_file17,
4807
+ (0, import_invariant16.invariant)(this._signalManager, "signal manager not set", {
4808
+ F: __dxlog_file18,
4737
4809
  L: 243,
4738
4810
  S: this,
4739
4811
  A: [
@@ -4741,8 +4813,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4741
4813
  "'signal manager not set'"
4742
4814
  ]
4743
4815
  });
4744
- (0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
4745
- F: __dxlog_file17,
4816
+ (0, import_invariant16.invariant)(this._networkManager, "network manager not set", {
4817
+ F: __dxlog_file18,
4746
4818
  L: 244,
4747
4819
  S: this,
4748
4820
  A: [
@@ -4754,7 +4826,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4754
4826
  (0, import_log16.log)("opening...", {
4755
4827
  lockKey: this._resourceLock?.lockKey
4756
4828
  }, {
4757
- F: __dxlog_file17,
4829
+ F: __dxlog_file18,
4758
4830
  L: 247,
4759
4831
  S: this,
4760
4832
  C: (f, a) => f(...a)
@@ -4800,7 +4872,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4800
4872
  (0, import_log16.log)("opened", {
4801
4873
  deviceKey
4802
4874
  }, {
4803
- F: __dxlog_file17,
4875
+ F: __dxlog_file18,
4804
4876
  L: 316,
4805
4877
  S: this,
4806
4878
  C: (f, a) => f(...a)
@@ -4808,7 +4880,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4808
4880
  import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.end({
4809
4881
  id: traceId
4810
4882
  }), {
4811
- F: __dxlog_file17,
4883
+ F: __dxlog_file18,
4812
4884
  L: 317,
4813
4885
  S: this,
4814
4886
  C: (f, a) => f(...a)
@@ -4822,7 +4894,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4822
4894
  (0, import_log16.log)("closing...", {
4823
4895
  deviceKey
4824
4896
  }, {
4825
- F: __dxlog_file17,
4897
+ F: __dxlog_file18,
4826
4898
  L: 328,
4827
4899
  S: this,
4828
4900
  C: (f, a) => f(...a)
@@ -4838,24 +4910,24 @@ var ClientServicesHost = class ClientServicesHost2 {
4838
4910
  (0, import_log16.log)("closed", {
4839
4911
  deviceKey
4840
4912
  }, {
4841
- F: __dxlog_file17,
4913
+ F: __dxlog_file18,
4842
4914
  L: 335,
4843
4915
  S: this,
4844
4916
  C: (f, a) => f(...a)
4845
4917
  });
4846
4918
  }
4847
4919
  async reset() {
4848
- const traceId = import_keys12.PublicKey.random().toHex();
4920
+ const traceId = import_keys13.PublicKey.random().toHex();
4849
4921
  import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.begin({
4850
4922
  id: traceId
4851
4923
  }), {
4852
- F: __dxlog_file17,
4924
+ F: __dxlog_file18,
4853
4925
  L: 340,
4854
4926
  S: this,
4855
4927
  C: (f, a) => f(...a)
4856
4928
  });
4857
4929
  (0, import_log16.log)("resetting...", void 0, {
4858
- F: __dxlog_file17,
4930
+ F: __dxlog_file18,
4859
4931
  L: 342,
4860
4932
  S: this,
4861
4933
  C: (f, a) => f(...a)
@@ -4863,7 +4935,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4863
4935
  await this._serviceContext?.close();
4864
4936
  await this._storage.reset();
4865
4937
  (0, import_log16.log)("reset", void 0, {
4866
- F: __dxlog_file17,
4938
+ F: __dxlog_file18,
4867
4939
  L: 345,
4868
4940
  S: this,
4869
4941
  C: (f, a) => f(...a)
@@ -4871,7 +4943,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4871
4943
  import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.end({
4872
4944
  id: traceId
4873
4945
  }), {
4874
- F: __dxlog_file17,
4946
+ F: __dxlog_file18,
4875
4947
  L: 346,
4876
4948
  S: this,
4877
4949
  C: (f, a) => f(...a)
@@ -4917,7 +4989,7 @@ ClientServicesHost = _ts_decorate7([
4917
4989
  ], ClientServicesHost);
4918
4990
 
4919
4991
  // packages/sdk/client-services/src/packlets/testing/invitation-utils.ts
4920
- var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/testing/invitation-utils.ts";
4992
+ var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/testing/invitation-utils.ts";
4921
4993
  var sanitizeInvitation = (invitation) => {
4922
4994
  return {
4923
4995
  invitationId: invitation.invitationId,
@@ -4947,8 +5019,8 @@ var performInvitation = ({ host, guest, options, hooks }) => {
4947
5019
  if (hooks?.guest?.onConnecting?.(guestObservable)) {
4948
5020
  break;
4949
5021
  }
4950
- (0, import_invariant16.invariant)(hostInvitation.swarmKey.equals(guestInvitation.swarmKey), void 0, {
4951
- F: __dxlog_file18,
5022
+ (0, import_invariant17.invariant)(hostInvitation.swarmKey.equals(guestInvitation.swarmKey), void 0, {
5023
+ F: __dxlog_file19,
4952
5024
  L: 84,
4953
5025
  S: void 0,
4954
5026
  A: [