@dxos/client-services 0.3.2-main.de57e73 → 0.3.2-main.ec06501

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.
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // packages/sdk/client-services/src/packlets/testing/index.ts
@@ -87,10 +97,10 @@ var getPlatform = () => {
87
97
  };
88
98
  }
89
99
  } else {
90
- const { platform, version, arch } = process;
100
+ const { platform: platform2, version, arch } = process;
91
101
  return {
92
102
  type: "node",
93
- platform: `${platform} ${version} ${arch}`,
103
+ platform: `${platform2} ${version} ${arch}`,
94
104
  runtime: process.version,
95
105
  uptime: Math.floor(process.uptime()),
96
106
  memory: process.memoryUsage()
@@ -99,7 +109,7 @@ var getPlatform = () => {
99
109
  };
100
110
 
101
111
  // packages/sdk/client-services/src/version.ts
102
- var DXOS_VERSION = "0.3.2-main.de57e73";
112
+ var DXOS_VERSION = "0.3.2-main.ec06501";
103
113
 
104
114
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
105
115
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
@@ -228,13 +238,13 @@ var import_echo_pipeline2 = require("@dxos/echo-pipeline");
228
238
  var import_feed_store3 = require("@dxos/feed-store");
229
239
  var import_invariant13 = require("@dxos/invariant");
230
240
  var import_keyring = require("@dxos/keyring");
231
- var import_keys8 = require("@dxos/keys");
241
+ var import_keys9 = require("@dxos/keys");
232
242
  var import_log13 = require("@dxos/log");
233
243
  var import_protocols10 = require("@dxos/protocols");
234
244
  var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
235
245
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
236
246
  var import_tracing4 = require("@dxos/tracing");
237
- var import_util5 = require("@dxos/util");
247
+ var import_util6 = require("@dxos/util");
238
248
 
239
249
  // packages/sdk/client-services/src/packlets/identity/authenticator.ts
240
250
  var import_async = require("@dxos/async");
@@ -358,9 +368,11 @@ var import_credentials4 = require("@dxos/credentials");
358
368
  var import_debug2 = require("@dxos/debug");
359
369
  var import_feed_store = require("@dxos/feed-store");
360
370
  var import_invariant2 = require("@dxos/invariant");
371
+ var import_keys2 = require("@dxos/keys");
361
372
  var import_log3 = require("@dxos/log");
362
373
  var import_credentials5 = require("@dxos/protocols/proto/dxos/halo/credentials");
363
374
  var import_tracing = require("@dxos/tracing");
375
+ var import_util = require("@dxos/util");
364
376
  function _ts_decorate(decorators, target, key, desc) {
365
377
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
366
378
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -379,6 +391,14 @@ var Identity = class Identity2 {
379
391
  this._signer = signer;
380
392
  this.identityKey = identityKey;
381
393
  this.deviceKey = deviceKey;
394
+ import_log3.log.trace("dxos.halo.device", {
395
+ deviceKey
396
+ }, {
397
+ F: __dxlog_file3,
398
+ L: 60,
399
+ S: this,
400
+ C: (f, a) => f(...a)
401
+ });
382
402
  this._deviceStateMachine = new import_credentials4.DeviceStateMachine({
383
403
  identityKey: this.identityKey,
384
404
  deviceKey: this.deviceKey,
@@ -389,7 +409,7 @@ var Identity = class Identity2 {
389
409
  onUpdate: () => this.stateUpdate.emit()
390
410
  });
391
411
  this.authVerifier = new TrustedKeySetAuthVerifier({
392
- trustedKeysProvider: () => this.authorizedDeviceKeys,
412
+ trustedKeysProvider: () => new import_util.ComplexSet(import_keys2.PublicKey.hash, this.authorizedDeviceKeys.keys()),
393
413
  update: this.stateUpdate,
394
414
  authTimeout: import_client_protocol.AUTH_TIMEOUT
395
415
  });
@@ -447,7 +467,7 @@ var Identity = class Identity2 {
447
467
  getIdentityCredentialSigner() {
448
468
  (0, import_invariant2.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
449
469
  F: __dxlog_file3,
450
- L: 139,
470
+ L: 141,
451
471
  S: this,
452
472
  A: [
453
473
  "this._deviceStateMachine.deviceCredentialChain",
@@ -471,7 +491,7 @@ var Identity = class Identity2 {
471
491
  dataFeedKey
472
492
  }, {
473
493
  F: __dxlog_file3,
474
- L: 155,
494
+ L: 157,
475
495
  S: this,
476
496
  C: (f, a) => f(...a)
477
497
  });
@@ -523,17 +543,18 @@ Identity = _ts_decorate([
523
543
  ], Identity);
524
544
 
525
545
  // packages/sdk/client-services/src/packlets/identity/identity-manager.ts
546
+ var import_platform2 = __toESM(require("platform"));
526
547
  var import_async3 = require("@dxos/async");
527
548
  var import_context2 = require("@dxos/context");
528
549
  var import_credentials6 = require("@dxos/credentials");
529
550
  var import_invariant3 = require("@dxos/invariant");
530
- var import_keys2 = require("@dxos/keys");
551
+ var import_keys3 = require("@dxos/keys");
531
552
  var import_log4 = require("@dxos/log");
532
553
  var import_protocols3 = require("@dxos/protocols");
533
554
  var import_credentials7 = require("@dxos/protocols/proto/dxos/halo/credentials");
534
555
  var import_timeframe = require("@dxos/timeframe");
535
556
  var import_tracing2 = require("@dxos/tracing");
536
- var import_util = require("@dxos/util");
557
+ var import_util2 = require("@dxos/util");
537
558
  function _ts_decorate2(decorators, target, key, desc) {
538
559
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
539
560
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -559,12 +580,12 @@ var IdentityManager = class IdentityManager2 {
559
580
  return this._identity;
560
581
  }
561
582
  async open(ctx) {
562
- const traceId = import_keys2.PublicKey.random().toHex();
583
+ const traceId = import_keys3.PublicKey.random().toHex();
563
584
  import_log4.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.begin({
564
585
  id: traceId
565
586
  }), {
566
587
  F: __dxlog_file4,
567
- L: 73,
588
+ L: 75,
568
589
  S: this,
569
590
  C: (f, a) => f(...a)
570
591
  });
@@ -573,7 +594,7 @@ var IdentityManager = class IdentityManager2 {
573
594
  identityRecord
574
595
  }, {
575
596
  F: __dxlog_file4,
576
- L: 76,
597
+ L: 78,
577
598
  S: this,
578
599
  C: (f, a) => f(...a)
579
600
  });
@@ -586,7 +607,7 @@ var IdentityManager = class IdentityManager2 {
586
607
  displayName: this._identity.profileDocument?.displayName
587
608
  }, {
588
609
  F: __dxlog_file4,
589
- L: 81,
610
+ L: 83,
590
611
  S: this,
591
612
  C: (f, a) => f(...a)
592
613
  });
@@ -596,7 +617,7 @@ var IdentityManager = class IdentityManager2 {
596
617
  id: traceId
597
618
  }), {
598
619
  F: __dxlog_file4,
599
- L: 87,
620
+ L: 89,
600
621
  S: this,
601
622
  C: (f, a) => f(...a)
602
623
  });
@@ -607,7 +628,7 @@ var IdentityManager = class IdentityManager2 {
607
628
  async createIdentity({ displayName } = {}) {
608
629
  (0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
609
630
  F: __dxlog_file4,
610
- L: 95,
631
+ L: 97,
611
632
  S: this,
612
633
  A: [
613
634
  "!this._identity",
@@ -616,7 +637,7 @@ var IdentityManager = class IdentityManager2 {
616
637
  });
617
638
  (0, import_log4.log)("creating identity...", void 0, {
618
639
  F: __dxlog_file4,
619
- L: 96,
640
+ L: 98,
620
641
  S: this,
621
642
  C: (f, a) => f(...a)
622
643
  });
@@ -637,7 +658,7 @@ var IdentityManager = class IdentityManager2 {
637
658
  const generator = new import_credentials6.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
638
659
  (0, import_invariant3.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
639
660
  F: __dxlog_file4,
640
- L: 115,
661
+ L: 117,
641
662
  S: this,
642
663
  A: [
643
664
  "identityRecord.haloSpace.genesisFeedKey",
@@ -646,7 +667,7 @@ var IdentityManager = class IdentityManager2 {
646
667
  });
647
668
  (0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
648
669
  F: __dxlog_file4,
649
- L: 116,
670
+ L: 118,
650
671
  S: this,
651
672
  A: [
652
673
  "identityRecord.haloSpace.dataFeedKey",
@@ -665,6 +686,13 @@ var IdentityManager = class IdentityManager2 {
665
686
  }));
666
687
  }
667
688
  credentials.push(await generator.createDeviceAuthorization(identityRecord.deviceKey));
689
+ credentials.push(await generator.createDeviceProfile({
690
+ platform: import_platform2.default.name,
691
+ platformVersion: import_platform2.default.version,
692
+ architecture: typeof import_platform2.default.os?.architecture === "number" ? String(import_platform2.default.os.architecture) : void 0,
693
+ os: import_platform2.default.os?.family,
694
+ osVersion: import_platform2.default.os?.version
695
+ }));
668
696
  for (const credential of credentials) {
669
697
  await identity.controlPipeline.writer.write({
670
698
  credential: {
@@ -681,7 +709,7 @@ var IdentityManager = class IdentityManager2 {
681
709
  displayName: this._identity.profileDocument?.displayName
682
710
  }, {
683
711
  F: __dxlog_file4,
684
- L: 151,
712
+ L: 163,
685
713
  S: this,
686
714
  C: (f, a) => f(...a)
687
715
  });
@@ -691,7 +719,7 @@ var IdentityManager = class IdentityManager2 {
691
719
  deviceKey: identity.deviceKey
692
720
  }, {
693
721
  F: __dxlog_file4,
694
- L: 157,
722
+ L: 169,
695
723
  S: this,
696
724
  C: (f, a) => f(...a)
697
725
  });
@@ -705,13 +733,13 @@ var IdentityManager = class IdentityManager2 {
705
733
  params
706
734
  }, {
707
735
  F: __dxlog_file4,
708
- L: 165,
736
+ L: 177,
709
737
  S: this,
710
738
  C: (f, a) => f(...a)
711
739
  });
712
740
  (0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
713
741
  F: __dxlog_file4,
714
- L: 166,
742
+ L: 178,
715
743
  S: this,
716
744
  A: [
717
745
  "!this._identity",
@@ -739,7 +767,7 @@ var IdentityManager = class IdentityManager2 {
739
767
  displayName: this._identity.profileDocument?.displayName
740
768
  }, {
741
769
  F: __dxlog_file4,
742
- L: 185,
770
+ L: 197,
743
771
  S: this,
744
772
  C: (f, a) => f(...a)
745
773
  });
@@ -749,7 +777,7 @@ var IdentityManager = class IdentityManager2 {
749
777
  deviceKey: identity.deviceKey
750
778
  }, {
751
779
  F: __dxlog_file4,
752
- L: 191,
780
+ L: 203,
753
781
  S: this,
754
782
  C: (f, a) => f(...a)
755
783
  });
@@ -761,7 +789,7 @@ var IdentityManager = class IdentityManager2 {
761
789
  async updateProfile(profile) {
762
790
  (0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
763
791
  F: __dxlog_file4,
764
- L: 199,
792
+ L: 211,
765
793
  S: this,
766
794
  A: [
767
795
  "this._identity",
@@ -792,7 +820,7 @@ var IdentityManager = class IdentityManager2 {
792
820
  async _constructIdentity(identityRecord) {
793
821
  (0, import_invariant3.invariant)(!this._identity, void 0, {
794
822
  F: __dxlog_file4,
795
- L: 216,
823
+ L: 228,
796
824
  S: this,
797
825
  A: [
798
826
  "!this._identity",
@@ -803,13 +831,13 @@ var IdentityManager = class IdentityManager2 {
803
831
  identityRecord
804
832
  }, {
805
833
  F: __dxlog_file4,
806
- L: 217,
834
+ L: 229,
807
835
  S: this,
808
836
  C: (f, a) => f(...a)
809
837
  });
810
838
  (0, import_invariant3.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
811
839
  F: __dxlog_file4,
812
- L: 220,
840
+ L: 232,
813
841
  S: this,
814
842
  A: [
815
843
  "identityRecord.haloSpace.controlFeedKey",
@@ -821,7 +849,7 @@ var IdentityManager = class IdentityManager2 {
821
849
  });
822
850
  (0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
823
851
  F: __dxlog_file4,
824
- L: 224,
852
+ L: 236,
825
853
  S: this,
826
854
  A: [
827
855
  "identityRecord.haloSpace.dataFeedKey",
@@ -837,7 +865,7 @@ var IdentityManager = class IdentityManager2 {
837
865
  swarmIdentity: {
838
866
  peerKey: identityRecord.deviceKey,
839
867
  credentialProvider: createAuthProvider((0, import_credentials6.createCredentialSignerWithKey)(this._keyring, identityRecord.deviceKey)),
840
- credentialAuthenticator: (0, import_util.deferFunction)(() => identity.authVerifier.verifier)
868
+ credentialAuthenticator: (0, import_util2.deferFunction)(() => identity.authVerifier.verifier)
841
869
  },
842
870
  identityKey: identityRecord.identityKey
843
871
  });
@@ -853,7 +881,7 @@ var IdentityManager = class IdentityManager2 {
853
881
  identityKey: identityRecord.identityKey
854
882
  }, {
855
883
  F: __dxlog_file4,
856
- L: 248,
884
+ L: 260,
857
885
  S: this,
858
886
  C: (f, a) => f(...a)
859
887
  });
@@ -874,7 +902,7 @@ var IdentityManager = class IdentityManager2 {
874
902
  onAuthFailure: () => {
875
903
  import_log4.log.warn("auth failure", void 0, {
876
904
  F: __dxlog_file4,
877
- L: 267,
905
+ L: 279,
878
906
  S: this,
879
907
  C: (f, a) => f(...a)
880
908
  });
@@ -1059,7 +1087,7 @@ var import_client_protocol2 = require("@dxos/client-protocol");
1059
1087
  var import_context4 = require("@dxos/context");
1060
1088
  var import_credentials9 = require("@dxos/credentials");
1061
1089
  var import_invariant7 = require("@dxos/invariant");
1062
- var import_keys4 = require("@dxos/keys");
1090
+ var import_keys5 = require("@dxos/keys");
1063
1091
  var import_log6 = require("@dxos/log");
1064
1092
  var import_network_manager = require("@dxos/network-manager");
1065
1093
  var import_protocols5 = require("@dxos/protocols");
@@ -1070,7 +1098,7 @@ var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations")
1070
1098
  var import_async4 = require("@dxos/async");
1071
1099
  var import_context3 = require("@dxos/context");
1072
1100
  var import_invariant6 = require("@dxos/invariant");
1073
- var import_keys3 = require("@dxos/keys");
1101
+ var import_keys4 = require("@dxos/keys");
1074
1102
  var import_log5 = require("@dxos/log");
1075
1103
  var import_protocols4 = require("@dxos/protocols");
1076
1104
  var import_services3 = require("@dxos/protocols/proto/dxos/client/services");
@@ -1118,7 +1146,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1118
1146
  },
1119
1147
  introduce: async (request) => {
1120
1148
  const { profile, invitationId } = request;
1121
- const traceId = import_keys3.PublicKey.random().toHex();
1149
+ const traceId = import_keys4.PublicKey.random().toHex();
1122
1150
  import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols4.trace.begin({
1123
1151
  id: traceId
1124
1152
  }), {
@@ -1170,7 +1198,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1170
1198
  };
1171
1199
  },
1172
1200
  authenticate: async ({ authCode: code }) => {
1173
- const traceId = import_keys3.PublicKey.random().toHex();
1201
+ const traceId = import_keys4.PublicKey.random().toHex();
1174
1202
  import_log5.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols4.trace.begin({
1175
1203
  id: traceId
1176
1204
  }), {
@@ -1250,7 +1278,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1250
1278
  };
1251
1279
  },
1252
1280
  admit: async (request) => {
1253
- const traceId = import_keys3.PublicKey.random().toHex();
1281
+ const traceId = import_keys4.PublicKey.random().toHex();
1254
1282
  import_log5.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols4.trace.begin({
1255
1283
  id: traceId
1256
1284
  }), {
@@ -1416,7 +1444,7 @@ var InvitationsHandler = class {
1416
1444
  this._networkManager = _networkManager;
1417
1445
  }
1418
1446
  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 ?? {};
1447
+ 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
1448
  const authCode = options?.authCode ?? (authMethod === import_services4.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials9.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0);
1421
1449
  (0, import_invariant7.invariant)(protocol, void 0, {
1422
1450
  F: __dxlog_file8,
@@ -1491,7 +1519,7 @@ var InvitationsHandler = class {
1491
1519
  },
1492
1520
  onOpen: () => {
1493
1521
  (0, import_async5.scheduleTask)(ctx, async () => {
1494
- const traceId = import_keys4.PublicKey.random().toHex();
1522
+ const traceId = import_keys5.PublicKey.random().toHex();
1495
1523
  try {
1496
1524
  import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.begin({
1497
1525
  id: traceId
@@ -1724,7 +1752,7 @@ var InvitationsHandler = class {
1724
1752
  }
1725
1753
  });
1726
1754
  (0, import_async5.scheduleTask)(ctx, async () => {
1727
- const traceId = import_keys4.PublicKey.random().toHex();
1755
+ const traceId = import_keys5.PublicKey.random().toHex();
1728
1756
  try {
1729
1757
  import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.begin({
1730
1758
  id: traceId
@@ -1931,7 +1959,7 @@ var InvitationsHandler = class {
1931
1959
  const topic = invitation.swarmKey;
1932
1960
  const swarmConnection = await this._networkManager.joinSwarm({
1933
1961
  topic,
1934
- peerId: import_keys4.PublicKey.random(),
1962
+ peerId: import_keys5.PublicKey.random(),
1935
1963
  protocolProvider: (0, import_network_manager.createTeleportProtocolFactory)(async (teleport) => {
1936
1964
  teleport.addExtension("dxos.halo.invitations", createExtension());
1937
1965
  }),
@@ -2088,15 +2116,6 @@ var InvitationsServiceImpl = class {
2088
2116
  await accepted.cancel();
2089
2117
  this._acceptInvitations.delete(invitationId);
2090
2118
  this._removedAccepted.emit(accepted.get());
2091
- } else {
2092
- import_log7.log.warn("invalid invitation", {
2093
- invitationId
2094
- }, {
2095
- F: __dxlog_file9,
2096
- L: 132,
2097
- S: this,
2098
- C: (f, a) => f(...a)
2099
- });
2100
2119
  }
2101
2120
  }
2102
2121
  queryInvitations() {
@@ -2310,12 +2329,12 @@ var import_async9 = require("@dxos/async");
2310
2329
  var import_context7 = require("@dxos/context");
2311
2330
  var import_credentials14 = require("@dxos/credentials");
2312
2331
  var import_invariant11 = require("@dxos/invariant");
2313
- var import_keys7 = require("@dxos/keys");
2332
+ var import_keys8 = require("@dxos/keys");
2314
2333
  var import_log11 = require("@dxos/log");
2315
2334
  var import_protocols8 = require("@dxos/protocols");
2316
2335
  var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
2317
2336
  var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
2318
- var import_util4 = require("@dxos/util");
2337
+ var import_util5 = require("@dxos/util");
2319
2338
 
2320
2339
  // packages/sdk/client-services/src/packlets/spaces/data-space.ts
2321
2340
  var import_async8 = require("@dxos/async");
@@ -2323,24 +2342,24 @@ var import_client_protocol3 = require("@dxos/client-protocol");
2323
2342
  var import_context6 = require("@dxos/context");
2324
2343
  var import_debug4 = require("@dxos/debug");
2325
2344
  var import_echo_pipeline = require("@dxos/echo-pipeline");
2326
- var import_keys6 = require("@dxos/keys");
2345
+ var import_keys7 = require("@dxos/keys");
2327
2346
  var import_log10 = require("@dxos/log");
2328
2347
  var import_protocols7 = require("@dxos/protocols");
2329
2348
  var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
2330
2349
  var import_credentials11 = require("@dxos/protocols/proto/dxos/halo/credentials");
2331
2350
  var import_timeframe2 = require("@dxos/timeframe");
2332
2351
  var import_tracing3 = require("@dxos/tracing");
2333
- var import_util3 = require("@dxos/util");
2352
+ var import_util4 = require("@dxos/util");
2334
2353
 
2335
2354
  // packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
2336
2355
  var import_async7 = require("@dxos/async");
2337
2356
  var import_context5 = require("@dxos/context");
2338
2357
  var import_invariant10 = require("@dxos/invariant");
2339
- var import_keys5 = require("@dxos/keys");
2358
+ var import_keys6 = require("@dxos/keys");
2340
2359
  var import_log9 = require("@dxos/log");
2341
2360
  var import_protocols6 = require("@dxos/protocols");
2342
2361
  var import_teleport2 = require("@dxos/teleport");
2343
- var import_util2 = require("@dxos/util");
2362
+ var import_util3 = require("@dxos/util");
2344
2363
  var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
2345
2364
  var DEFAULT_RETRY_TIMEOUT = 1e3;
2346
2365
  var DEFAULT_SUCCESS_DELAY = 1e3;
@@ -2351,8 +2370,8 @@ var NotarizationPlugin = class {
2351
2370
  this._ctx = new import_context5.Context();
2352
2371
  this._extensionOpened = new import_async7.Event();
2353
2372
  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);
2373
+ this._processedCredentials = new import_util3.ComplexSet(import_keys6.PublicKey.hash);
2374
+ this._processCredentialsTriggers = new import_util3.ComplexMap(import_keys6.PublicKey.hash);
2356
2375
  }
2357
2376
  get hasWriter() {
2358
2377
  return !!this._writer;
@@ -2514,7 +2533,7 @@ var NotarizationPlugin = class {
2514
2533
  if (this._processedCredentials.has(id)) {
2515
2534
  return;
2516
2535
  }
2517
- await (0, import_util2.entry)(this._processCredentialsTriggers, id).orInsert(new import_async7.Trigger()).value.wait();
2536
+ await (0, import_util3.entry)(this._processCredentialsTriggers, id).orInsert(new import_async7.Trigger()).value.wait();
2518
2537
  }
2519
2538
  /**
2520
2539
  * Requests from other peers to notarize credentials.
@@ -2634,7 +2653,7 @@ var DataSpace = class DataSpace2 {
2634
2653
  this._signingContext = params.signingContext;
2635
2654
  this._callbacks = params.callbacks ?? {};
2636
2655
  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)),
2656
+ 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
2657
  update: this._inner.stateUpdate,
2639
2658
  authTimeout: import_client_protocol3.AUTH_TIMEOUT
2640
2659
  });
@@ -3053,9 +3072,9 @@ var DataSpaceManager = class DataSpaceManager2 {
3053
3072
  this._feedStore = _feedStore;
3054
3073
  this._ctx = new import_context7.Context();
3055
3074
  this.updated = new import_async9.Event();
3056
- this._spaces = new import_util4.ComplexMap(import_keys7.PublicKey.hash);
3075
+ this._spaces = new import_util5.ComplexMap(import_keys8.PublicKey.hash);
3057
3076
  this._isOpen = false;
3058
- this._instanceId = import_keys7.PublicKey.random().toHex();
3077
+ this._instanceId = import_keys8.PublicKey.random().toHex();
3059
3078
  }
3060
3079
  // TODO(burdon): Remove.
3061
3080
  get spaces() {
@@ -3084,7 +3103,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3084
3103
  S: this,
3085
3104
  C: (f, a) => f(...a)
3086
3105
  });
3087
- await (0, import_util4.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
3106
+ await (0, import_util5.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
3088
3107
  try {
3089
3108
  (0, import_log11.log)("load space", {
3090
3109
  spaceMetadata
@@ -3266,7 +3285,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3266
3285
  swarmIdentity: {
3267
3286
  peerKey: this._signingContext.deviceKey,
3268
3287
  credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
3269
- credentialAuthenticator: (0, import_util4.deferFunction)(() => dataSpace.authVerifier.verifier)
3288
+ credentialAuthenticator: (0, import_util5.deferFunction)(() => dataSpace.authVerifier.verifier)
3270
3289
  },
3271
3290
  onNetworkConnection: (session) => {
3272
3291
  session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
@@ -3606,7 +3625,7 @@ var ServiceContext = class ServiceContext2 {
3606
3625
  this.initialized = new import_async11.Trigger();
3607
3626
  this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
3608
3627
  this._handlerFactories = /* @__PURE__ */ new Map();
3609
- this._instanceId = import_keys8.PublicKey.random().toHex();
3628
+ this._instanceId = import_keys9.PublicKey.random().toHex();
3610
3629
  this.metadataStore = new import_echo_pipeline2.MetadataStore(storage.createDirectory("metadata"));
3611
3630
  this.snapshotStore = new import_echo_pipeline2.SnapshotStore(storage.createDirectory("snapshots"));
3612
3631
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
@@ -3827,7 +3846,7 @@ _ts_decorate5([
3827
3846
  import_tracing4.trace.span()
3828
3847
  ], ServiceContext.prototype, "_initialize", null);
3829
3848
  ServiceContext = _ts_decorate5([
3830
- (0, import_util5.safeInstanceof)("dxos.client-services.ServiceContext"),
3849
+ (0, import_util6.safeInstanceof)("dxos.client-services.ServiceContext"),
3831
3850
  import_tracing4.trace.resource()
3832
3851
  ], ServiceContext);
3833
3852
 
@@ -3839,7 +3858,7 @@ var import_document_model2 = require("@dxos/document-model");
3839
3858
  var import_echo_pipeline3 = require("@dxos/echo-pipeline");
3840
3859
  var import_echo_schema = require("@dxos/echo-schema");
3841
3860
  var import_invariant15 = require("@dxos/invariant");
3842
- var import_keys12 = require("@dxos/keys");
3861
+ var import_keys13 = require("@dxos/keys");
3843
3862
  var import_log16 = require("@dxos/log");
3844
3863
  var import_messaging = require("@dxos/messaging");
3845
3864
  var import_model_factory = require("@dxos/model-factory");
@@ -3882,7 +3901,7 @@ var DevicesServiceImpl = class {
3882
3901
  constructor(_identityManager) {
3883
3902
  this._identityManager = _identityManager;
3884
3903
  }
3885
- updateDevice(request) {
3904
+ async updateDevice(profile) {
3886
3905
  throw new Error("Method not implemented.");
3887
3906
  }
3888
3907
  queryDevices() {
@@ -3895,9 +3914,10 @@ var DevicesServiceImpl = class {
3895
3914
  });
3896
3915
  } else {
3897
3916
  next({
3898
- devices: Array.from(deviceKeys.values()).map((key) => ({
3917
+ devices: Array.from(deviceKeys.entries()).map(([key, profile]) => ({
3899
3918
  deviceKey: key,
3900
- kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services11.DeviceKind.CURRENT : import_services11.DeviceKind.TRUSTED
3919
+ kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services11.DeviceKind.CURRENT : import_services11.DeviceKind.TRUSTED,
3920
+ profile
3901
3921
  }))
3902
3922
  });
3903
3923
  }
@@ -3925,12 +3945,12 @@ var import_codec_protobuf12 = require("@dxos/codec-protobuf");
3925
3945
  var import_async13 = require("@dxos/async");
3926
3946
  var import_codec_protobuf7 = require("@dxos/codec-protobuf");
3927
3947
  var import_feed_store4 = require("@dxos/feed-store");
3928
- var import_keys9 = require("@dxos/keys");
3929
- var import_util6 = require("@dxos/util");
3948
+ var import_keys10 = require("@dxos/keys");
3949
+ var import_util7 = require("@dxos/util");
3930
3950
  var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
3931
3951
  return new import_codec_protobuf7.Stream(({ next }) => {
3932
3952
  const subscriptions = new import_async13.EventSubscriptions();
3933
- const feedMap = new import_util6.ComplexMap(import_keys9.PublicKey.hash);
3953
+ const feedMap = new import_util7.ComplexMap(import_keys10.PublicKey.hash);
3934
3954
  const update = () => {
3935
3955
  const { feeds } = feedStore;
3936
3956
  feeds.filter((feed) => !feedKeys?.length || feedKeys.some((feedKey) => feedKey.equals(feed.key))).forEach((feed) => {
@@ -4022,7 +4042,7 @@ var subscribeToMetadata = ({ context }) => new import_codec_protobuf9.Stream(({
4022
4042
  // packages/sdk/client-services/src/packlets/devtools/network.ts
4023
4043
  var import_codec_protobuf10 = require("@dxos/codec-protobuf");
4024
4044
  var import_context9 = require("@dxos/context");
4025
- var import_keys10 = require("@dxos/keys");
4045
+ var import_keys11 = require("@dxos/keys");
4026
4046
  var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf10.Stream(({ next, close }) => {
4027
4047
  const update = () => {
4028
4048
  try {
@@ -4288,7 +4308,7 @@ var import_async16 = require("@dxos/async");
4288
4308
  var import_codec_protobuf13 = require("@dxos/codec-protobuf");
4289
4309
  var import_log15 = require("@dxos/log");
4290
4310
  var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
4291
- var import_util7 = require("@dxos/util");
4311
+ var import_util8 = require("@dxos/util");
4292
4312
  var LoggingServiceImpl = class {
4293
4313
  constructor() {
4294
4314
  this._logs = new import_async16.Event();
@@ -4306,15 +4326,15 @@ var LoggingServiceImpl = class {
4306
4326
  }
4307
4327
  async controlMetrics({ reset, record }) {
4308
4328
  if (reset) {
4309
- import_util7.tracer.clear();
4329
+ import_util8.tracer.clear();
4310
4330
  }
4311
4331
  if (record === true) {
4312
- import_util7.tracer.start();
4332
+ import_util8.tracer.start();
4313
4333
  } else if (record === false) {
4314
- import_util7.tracer.stop();
4334
+ import_util8.tracer.stop();
4315
4335
  }
4316
4336
  return {
4317
- recording: import_util7.tracer.recording
4337
+ recording: import_util8.tracer.recording
4318
4338
  };
4319
4339
  }
4320
4340
  /**
@@ -4322,10 +4342,10 @@ var LoggingServiceImpl = class {
4322
4342
  */
4323
4343
  queryMetrics({ interval = 5e3 }) {
4324
4344
  const getNumericalValues = (key) => {
4325
- const events = import_util7.tracer.get(key) ?? [];
4345
+ const events = import_util8.tracer.get(key) ?? [];
4326
4346
  return {
4327
4347
  key,
4328
- stats: (0, import_util7.numericalValues)(events, "duration")
4348
+ stats: (0, import_util8.numericalValues)(events, "duration")
4329
4349
  };
4330
4350
  };
4331
4351
  return new import_codec_protobuf13.Stream(({ next }) => {
@@ -4363,7 +4383,7 @@ var LoggingServiceImpl = class {
4363
4383
  }
4364
4384
  const record = {
4365
4385
  ...entry2,
4366
- context: (0, import_util7.jsonify)((0, import_log15.getContextFromEntry)(entry2)),
4386
+ context: (0, import_util8.jsonify)((0, import_log15.getContextFromEntry)(entry2)),
4367
4387
  timestamp: /* @__PURE__ */ new Date(),
4368
4388
  meta: {
4369
4389
  // TODO(dmaretskyi): Fix proto.
@@ -4437,10 +4457,10 @@ var import_client_protocol4 = require("@dxos/client-protocol");
4437
4457
  var import_protocols11 = require("@dxos/protocols");
4438
4458
  var import_config = require("@dxos/protocols/proto/dxos/config");
4439
4459
  var import_random_access_storage = require("@dxos/random-access-storage");
4440
- var import_util8 = require("@dxos/util");
4460
+ var import_util9 = require("@dxos/util");
4441
4461
  var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
4442
4462
  var createStorageObjects = (config) => {
4443
- const { persistent = false, keyStore, dataStore, dataRoot = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
4463
+ const { persistent = false, keyStore, dataStore, dataRoot = (0, import_util9.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
4444
4464
  if (persistent && dataStore === StorageDriver.RAM) {
4445
4465
  throw new import_protocols11.InvalidConfigError("RAM storage cannot be used in persistent mode.");
4446
4466
  }
@@ -4484,7 +4504,7 @@ var toStorageType = (type) => {
4484
4504
  // packages/sdk/client-services/src/packlets/system/system-service.ts
4485
4505
  var import_codec_protobuf15 = require("@dxos/codec-protobuf");
4486
4506
  var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
4487
- var import_util9 = require("@dxos/util");
4507
+ var import_util10 = require("@dxos/util");
4488
4508
  var SystemServiceImpl = class {
4489
4509
  constructor({ config, statusUpdate, getDiagnostics, onUpdateStatus, getCurrentStatus, onReset }) {
4490
4510
  this._config = config;
@@ -4504,7 +4524,7 @@ var SystemServiceImpl = class {
4504
4524
  const diagnostics = await this._getDiagnostics();
4505
4525
  return {
4506
4526
  timestamp: /* @__PURE__ */ new Date(),
4507
- diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util9.jsonKeyReplacer)({
4527
+ diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util10.jsonKeyReplacer)({
4508
4528
  truncate: keys === import_services13.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
4509
4529
  humanize: keys === import_services13.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
4510
4530
  })))
@@ -4705,7 +4725,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4705
4725
  if (this._open) {
4706
4726
  return;
4707
4727
  }
4708
- const traceId = import_keys12.PublicKey.random().toHex();
4728
+ const traceId = import_keys13.PublicKey.random().toHex();
4709
4729
  import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.begin({
4710
4730
  id: traceId
4711
4731
  }), {
@@ -4845,7 +4865,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4845
4865
  });
4846
4866
  }
4847
4867
  async reset() {
4848
- const traceId = import_keys12.PublicKey.random().toHex();
4868
+ const traceId = import_keys13.PublicKey.random().toHex();
4849
4869
  import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.begin({
4850
4870
  id: traceId
4851
4871
  }), {