@dxos/client-services 0.3.3-main.e0ded2e → 0.3.3-main.f990aad

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.
@@ -2489,9 +2489,21 @@ var SpaceInvitationProtocol = class {
2489
2489
  var import_codec_protobuf9 = require("@dxos/codec-protobuf");
2490
2490
  var import_debug3 = require("@dxos/debug");
2491
2491
  var import_rpc = require("@dxos/rpc");
2492
- var ClientRpcServer = class {
2492
+ var import_tracing3 = require("@dxos/tracing");
2493
+ function _ts_decorate3(decorators, target, key, desc) {
2494
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2495
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2496
+ r = Reflect.decorate(decorators, target, key, desc);
2497
+ else
2498
+ for (var i = decorators.length - 1; i >= 0; i--)
2499
+ if (d = decorators[i])
2500
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2501
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2502
+ }
2503
+ var ClientRpcServer = class ClientRpcServer2 {
2493
2504
  constructor(params) {
2494
2505
  this._handlerCache = /* @__PURE__ */ new Map();
2506
+ this._callMetrics = new import_tracing3.MapCounter();
2495
2507
  const { serviceRegistry, handleCall, handleStream, ...rpcOptions } = params;
2496
2508
  this._handleCall = handleCall;
2497
2509
  this._handleStream = handleStream;
@@ -2501,6 +2513,7 @@ var ClientRpcServer = class {
2501
2513
  callHandler: (method, params2) => {
2502
2514
  const [serviceName, methodName] = (0, import_rpc.parseMethodName)(method);
2503
2515
  const handler = (method2, params3) => this._getServiceHandler(serviceName).call(method2, params3);
2516
+ this._callMetrics.inc(`${serviceName}.${methodName} request`);
2504
2517
  if (this._handleCall) {
2505
2518
  return this._handleCall(methodName, params2, handler);
2506
2519
  } else {
@@ -2510,14 +2523,21 @@ var ClientRpcServer = class {
2510
2523
  streamHandler: (method, params2) => {
2511
2524
  const [serviceName, methodName] = (0, import_rpc.parseMethodName)(method);
2512
2525
  const handler = (method2, params3) => this._getServiceHandler(serviceName).callStream(method2, params3);
2526
+ this._callMetrics.inc(`${serviceName}.${methodName} request stream`);
2513
2527
  if (this._handleStream) {
2514
- return import_codec_protobuf9.Stream.unwrapPromise(this._handleStream(methodName, params2, handler));
2528
+ return import_codec_protobuf9.Stream.map(import_codec_protobuf9.Stream.unwrapPromise(this._handleStream(methodName, params2, handler)), (data) => {
2529
+ this._callMetrics.inc(`${serviceName}.${methodName} response stream`);
2530
+ return data;
2531
+ });
2515
2532
  } else {
2516
2533
  return handler(methodName, params2);
2517
2534
  }
2518
2535
  }
2519
2536
  });
2520
2537
  }
2538
+ get _services() {
2539
+ return Object.keys(this._serviceRegistry.services);
2540
+ }
2521
2541
  async open() {
2522
2542
  await this._rpcPeer.open();
2523
2543
  }
@@ -2536,8 +2556,18 @@ var ClientRpcServer = class {
2536
2556
  return this._handlerCache.get(serviceName);
2537
2557
  }
2538
2558
  };
2559
+ _ts_decorate3([
2560
+ import_tracing3.trace.metricsCounter()
2561
+ ], ClientRpcServer.prototype, "_callMetrics", void 0);
2562
+ _ts_decorate3([
2563
+ import_tracing3.trace.info()
2564
+ ], ClientRpcServer.prototype, "_services", null);
2565
+ ClientRpcServer = _ts_decorate3([
2566
+ import_tracing3.trace.resource()
2567
+ ], ClientRpcServer);
2539
2568
 
2540
2569
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2570
+ var import_async10 = require("@dxos/async");
2541
2571
  var import_codec_protobuf10 = require("@dxos/codec-protobuf");
2542
2572
  var import_credentials9 = require("@dxos/credentials");
2543
2573
  var import_document_model = require("@dxos/document-model");
@@ -2576,7 +2606,7 @@ var getPlatform = () => {
2576
2606
  };
2577
2607
 
2578
2608
  // packages/sdk/client-services/src/version.ts
2579
- var DXOS_VERSION = "0.3.3-main.e0ded2e";
2609
+ var DXOS_VERSION = "0.3.3-main.f990aad";
2580
2610
 
2581
2611
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2582
2612
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
@@ -2595,7 +2625,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
2595
2625
  {
2596
2626
  (0, import_invariant9.invariant)(clientServices.LoggingService, "SystemService is not available.", {
2597
2627
  F: __dxlog_file10,
2598
- L: 88,
2628
+ L: 93,
2599
2629
  S: void 0,
2600
2630
  A: [
2601
2631
  "clientServices.LoggingService",
@@ -2628,6 +2658,19 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
2628
2658
  bytes,
2629
2659
  length
2630
2660
  }));
2661
+ const status = await (0, import_codec_protobuf10.getFirstStreamValue)(clientServices.NetworkService.queryStatus(), {
2662
+ timeout: DEFAULT_TIMEOUT
2663
+ }).catch(() => void 0);
2664
+ diagnostics.networkStatus = status;
2665
+ const swarmInfoDone = new import_async10.Trigger();
2666
+ serviceContext.networkManager.connectionLog?.update.on(async () => {
2667
+ const swarms = serviceContext.networkManager.connectionLog?.swarms;
2668
+ diagnostics.swarms = swarms;
2669
+ await swarmInfoDone.wake();
2670
+ });
2671
+ await swarmInfoDone.wait({
2672
+ timeout: DEFAULT_TIMEOUT
2673
+ });
2631
2674
  }
2632
2675
  diagnostics.config = config.values;
2633
2676
  return diagnostics;
@@ -2641,7 +2684,7 @@ var getProperties = (space) => {
2641
2684
  } catch (err) {
2642
2685
  import_log8.log.warn(err.message, void 0, {
2643
2686
  F: __dxlog_file10,
2644
- L: 145,
2687
+ L: 168,
2645
2688
  S: void 0,
2646
2689
  C: (f, a) => f(...a)
2647
2690
  });
@@ -2697,7 +2740,7 @@ var getSpaceStats = async (space) => {
2697
2740
  };
2698
2741
 
2699
2742
  // packages/sdk/client-services/src/packlets/services/service-context.ts
2700
- var import_async14 = require("@dxos/async");
2743
+ var import_async15 = require("@dxos/async");
2701
2744
  var import_context9 = require("@dxos/context");
2702
2745
  var import_credentials14 = require("@dxos/credentials");
2703
2746
  var import_debug7 = require("@dxos/debug");
@@ -2710,11 +2753,11 @@ var import_log13 = require("@dxos/log");
2710
2753
  var import_protocols10 = require("@dxos/protocols");
2711
2754
  var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
2712
2755
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
2713
- var import_tracing4 = require("@dxos/tracing");
2756
+ var import_tracing5 = require("@dxos/tracing");
2714
2757
  var import_util7 = require("@dxos/util");
2715
2758
 
2716
2759
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
2717
- var import_async12 = require("@dxos/async");
2760
+ var import_async13 = require("@dxos/async");
2718
2761
  var import_context8 = require("@dxos/context");
2719
2762
  var import_credentials13 = require("@dxos/credentials");
2720
2763
  var import_invariant11 = require("@dxos/invariant");
@@ -2726,7 +2769,7 @@ var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip"
2726
2769
  var import_util6 = require("@dxos/util");
2727
2770
 
2728
2771
  // packages/sdk/client-services/src/packlets/spaces/data-space.ts
2729
- var import_async11 = require("@dxos/async");
2772
+ var import_async12 = require("@dxos/async");
2730
2773
  var import_client_protocol3 = require("@dxos/client-protocol");
2731
2774
  var import_context7 = require("@dxos/context");
2732
2775
  var import_debug4 = require("@dxos/debug");
@@ -2737,11 +2780,11 @@ var import_protocols7 = require("@dxos/protocols");
2737
2780
  var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
2738
2781
  var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
2739
2782
  var import_timeframe2 = require("@dxos/timeframe");
2740
- var import_tracing3 = require("@dxos/tracing");
2783
+ var import_tracing4 = require("@dxos/tracing");
2741
2784
  var import_util5 = require("@dxos/util");
2742
2785
 
2743
2786
  // packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
2744
- var import_async10 = require("@dxos/async");
2787
+ var import_async11 = require("@dxos/async");
2745
2788
  var import_context6 = require("@dxos/context");
2746
2789
  var import_invariant10 = require("@dxos/invariant");
2747
2790
  var import_keys8 = require("@dxos/keys");
@@ -2757,7 +2800,7 @@ var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
2757
2800
  var NotarizationPlugin = class {
2758
2801
  constructor() {
2759
2802
  this._ctx = new import_context6.Context();
2760
- this._extensionOpened = new import_async10.Event();
2803
+ this._extensionOpened = new import_async11.Event();
2761
2804
  this._extensions = /* @__PURE__ */ new Set();
2762
2805
  this._processedCredentials = new import_util4.ComplexSet(import_keys8.PublicKey.hash);
2763
2806
  this._processCredentialsTriggers = new import_util4.ComplexMap(import_keys8.PublicKey.hash);
@@ -2791,7 +2834,7 @@ var NotarizationPlugin = class {
2791
2834
  "'Credentials must have an id'"
2792
2835
  ]
2793
2836
  });
2794
- const errors = new import_async10.Trigger();
2837
+ const errors = new import_async11.Trigger();
2795
2838
  const ctx = this._ctx.derive({
2796
2839
  onError: (err) => {
2797
2840
  import_log9.log.warn("Notarization error", {
@@ -2808,7 +2851,7 @@ var NotarizationPlugin = class {
2808
2851
  });
2809
2852
  opCtx?.onDispose(() => ctx.dispose());
2810
2853
  if (timeout !== 0) {
2811
- (0, import_async10.scheduleTask)(ctx, () => {
2854
+ (0, import_async11.scheduleTask)(ctx, () => {
2812
2855
  import_log9.log.warn("Notarization timeout", {
2813
2856
  timeout,
2814
2857
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
@@ -2819,12 +2862,12 @@ var NotarizationPlugin = class {
2819
2862
  C: (f, a) => f(...a)
2820
2863
  });
2821
2864
  void ctx.dispose();
2822
- errors.throw(new import_async10.TimeoutError(timeout, "Notarization timed out"));
2865
+ errors.throw(new import_async11.TimeoutError(timeout, "Notarization timed out"));
2823
2866
  }, timeout);
2824
2867
  }
2825
2868
  const allNotarized = Promise.all(credentials.map((credential) => this._waitUntilProcessed(credential.id)));
2826
2869
  const peersTried = /* @__PURE__ */ new Set();
2827
- const notarizeTask = new import_async10.DeferredTask(ctx, async () => {
2870
+ const notarizeTask = new import_async11.DeferredTask(ctx, async () => {
2828
2871
  try {
2829
2872
  if (this._extensions.size === 0) {
2830
2873
  return;
@@ -2842,7 +2885,7 @@ var NotarizationPlugin = class {
2842
2885
  C: (f, a) => f(...a)
2843
2886
  });
2844
2887
  peersTried.clear();
2845
- (0, import_async10.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
2888
+ (0, import_async11.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
2846
2889
  return;
2847
2890
  }
2848
2891
  peersTried.add(peer);
@@ -2864,7 +2907,7 @@ var NotarizationPlugin = class {
2864
2907
  S: this,
2865
2908
  C: (f, a) => f(...a)
2866
2909
  });
2867
- await (0, import_async10.sleep)(successDelay);
2910
+ await (0, import_async11.sleep)(successDelay);
2868
2911
  } catch (err) {
2869
2912
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
2870
2913
  import_log9.log.warn("error notarizing (recoverable)", err, {
@@ -2922,7 +2965,7 @@ var NotarizationPlugin = class {
2922
2965
  if (this._processedCredentials.has(id)) {
2923
2966
  return;
2924
2967
  }
2925
- await (0, import_util4.entry)(this._processCredentialsTriggers, id).orInsert(new import_async10.Trigger()).value.wait();
2968
+ await (0, import_util4.entry)(this._processCredentialsTriggers, id).orInsert(new import_async11.Trigger()).value.wait();
2926
2969
  }
2927
2970
  /**
2928
2971
  * Requests from other peers to notarize credentials.
@@ -3009,7 +3052,7 @@ var NotarizationTeleportExtension = class extends import_teleport2.RpcExtension
3009
3052
  };
3010
3053
 
3011
3054
  // packages/sdk/client-services/src/packlets/spaces/data-space.ts
3012
- function _ts_decorate3(decorators, target, key, desc) {
3055
+ function _ts_decorate4(decorators, target, key, desc) {
3013
3056
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3014
3057
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3015
3058
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3030,7 +3073,7 @@ var DataSpace = class DataSpace2 {
3030
3073
  * Error for _state === SpaceState.ERROR.
3031
3074
  */
3032
3075
  this.error = void 0;
3033
- this.stateUpdate = new import_async11.Event();
3076
+ this.stateUpdate = new import_async12.Event();
3034
3077
  this.metrics = {};
3035
3078
  this._inner = params.inner;
3036
3079
  this._inner.stateUpdate.on(this._ctx, () => this.stateUpdate.emit());
@@ -3136,7 +3179,7 @@ var DataSpace = class DataSpace2 {
3136
3179
  * Initialize the data pipeline in a separate task.
3137
3180
  */
3138
3181
  initializeDataPipelineAsync() {
3139
- (0, import_async11.scheduleTask)(this._ctx, async () => {
3182
+ (0, import_async12.scheduleTask)(this._ctx, async () => {
3140
3183
  try {
3141
3184
  this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
3142
3185
  await this.initializeDataPipeline();
@@ -3186,7 +3229,7 @@ var DataSpace = class DataSpace2 {
3186
3229
  C: (f, a) => f(...a)
3187
3230
  });
3188
3231
  await this._initializeAndReadControlPipeline();
3189
- await (0, import_async11.sleep)(1);
3232
+ await (0, import_async12.sleep)(1);
3190
3233
  await this._inner.initializeDataPipeline();
3191
3234
  this.metrics.dataPipelineOpen = /* @__PURE__ */ new Date();
3192
3235
  await (0, import_context7.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
@@ -3341,33 +3384,33 @@ var DataSpace = class DataSpace2 {
3341
3384
  this.stateUpdate.emit();
3342
3385
  }
3343
3386
  };
3344
- _ts_decorate3([
3345
- import_async11.synchronized
3387
+ _ts_decorate4([
3388
+ import_async12.synchronized
3346
3389
  ], DataSpace.prototype, "open", null);
3347
- _ts_decorate3([
3348
- import_async11.synchronized
3390
+ _ts_decorate4([
3391
+ import_async12.synchronized
3349
3392
  ], DataSpace.prototype, "close", null);
3350
- _ts_decorate3([
3351
- import_tracing3.trace.span({
3393
+ _ts_decorate4([
3394
+ import_tracing4.trace.span({
3352
3395
  showInBrowserTimeline: true
3353
3396
  })
3354
3397
  ], DataSpace.prototype, "initializeDataPipeline", null);
3355
- _ts_decorate3([
3356
- import_tracing3.trace.span({
3398
+ _ts_decorate4([
3399
+ import_tracing4.trace.span({
3357
3400
  showInBrowserTimeline: true
3358
3401
  })
3359
3402
  ], DataSpace.prototype, "_initializeAndReadControlPipeline", null);
3360
- _ts_decorate3([
3403
+ _ts_decorate4([
3361
3404
  (0, import_debug4.timed)(1e4)
3362
3405
  ], DataSpace.prototype, "_createWritableFeeds", null);
3363
- _ts_decorate3([
3364
- import_async11.synchronized
3406
+ _ts_decorate4([
3407
+ import_async12.synchronized
3365
3408
  ], DataSpace.prototype, "activate", null);
3366
- _ts_decorate3([
3367
- import_async11.synchronized
3409
+ _ts_decorate4([
3410
+ import_async12.synchronized
3368
3411
  ], DataSpace.prototype, "deactivate", null);
3369
- DataSpace = _ts_decorate3([
3370
- (0, import_async11.trackLeaks)("open", "close")
3412
+ DataSpace = _ts_decorate4([
3413
+ (0, import_async12.trackLeaks)("open", "close")
3371
3414
  ], DataSpace);
3372
3415
 
3373
3416
  // packages/sdk/client-services/src/packlets/spaces/genesis.ts
@@ -3440,7 +3483,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
3440
3483
  };
3441
3484
 
3442
3485
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
3443
- function _ts_decorate4(decorators, target, key, desc) {
3486
+ function _ts_decorate5(decorators, target, key, desc) {
3444
3487
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3445
3488
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3446
3489
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3460,7 +3503,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3460
3503
  this._signingContext = _signingContext;
3461
3504
  this._feedStore = _feedStore;
3462
3505
  this._ctx = new import_context8.Context();
3463
- this.updated = new import_async12.Event();
3506
+ this.updated = new import_async13.Event();
3464
3507
  this._spaces = new import_util6.ComplexMap(import_keys10.PublicKey.hash);
3465
3508
  this._isOpen = false;
3466
3509
  this._instanceId = import_keys10.PublicKey.random().toHex();
@@ -3756,24 +3799,24 @@ var DataSpaceManager = class DataSpaceManager2 {
3756
3799
  return dataSpace;
3757
3800
  }
3758
3801
  };
3759
- _ts_decorate4([
3760
- import_async12.synchronized
3802
+ _ts_decorate5([
3803
+ import_async13.synchronized
3761
3804
  ], DataSpaceManager.prototype, "open", null);
3762
- _ts_decorate4([
3763
- import_async12.synchronized
3805
+ _ts_decorate5([
3806
+ import_async13.synchronized
3764
3807
  ], DataSpaceManager.prototype, "close", null);
3765
- _ts_decorate4([
3766
- import_async12.synchronized
3808
+ _ts_decorate5([
3809
+ import_async13.synchronized
3767
3810
  ], DataSpaceManager.prototype, "createSpace", null);
3768
- _ts_decorate4([
3769
- import_async12.synchronized
3811
+ _ts_decorate5([
3812
+ import_async13.synchronized
3770
3813
  ], DataSpaceManager.prototype, "acceptSpace", null);
3771
- DataSpaceManager = _ts_decorate4([
3772
- (0, import_async12.trackLeaks)("open", "close")
3814
+ DataSpaceManager = _ts_decorate5([
3815
+ (0, import_async13.trackLeaks)("open", "close")
3773
3816
  ], DataSpaceManager);
3774
3817
 
3775
3818
  // packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
3776
- var import_async13 = require("@dxos/async");
3819
+ var import_async14 = require("@dxos/async");
3777
3820
  var import_codec_protobuf11 = require("@dxos/codec-protobuf");
3778
3821
  var import_debug6 = require("@dxos/debug");
3779
3822
  var import_invariant12 = require("@dxos/invariant");
@@ -3814,7 +3857,7 @@ var SpacesServiceImpl = class {
3814
3857
  }
3815
3858
  querySpaces() {
3816
3859
  return new import_codec_protobuf11.Stream(({ next, ctx }) => {
3817
- const scheduler = new import_async13.UpdateScheduler(ctx, async () => {
3860
+ const scheduler = new import_async14.UpdateScheduler(ctx, async () => {
3818
3861
  const dataSpaceManager = await this._getDataSpaceManager();
3819
3862
  const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
3820
3863
  (0, import_log12.log)("update", {
@@ -3831,9 +3874,9 @@ var SpacesServiceImpl = class {
3831
3874
  }, {
3832
3875
  maxFrequency: process.env.NODE_ENV === "test" ? void 0 : 2
3833
3876
  });
3834
- (0, import_async13.scheduleTask)(ctx, async () => {
3877
+ (0, import_async14.scheduleTask)(ctx, async () => {
3835
3878
  const dataSpaceManager = await this._getDataSpaceManager();
3836
- const subscriptions = new import_async13.EventSubscriptions();
3879
+ const subscriptions = new import_async14.EventSubscriptions();
3837
3880
  ctx.onDispose(() => subscriptions.clear());
3838
3881
  const subscribeSpaces = () => {
3839
3882
  subscriptions.clear();
@@ -3868,7 +3911,7 @@ var SpacesServiceImpl = class {
3868
3911
  }
3869
3912
  subscribeMessages({ spaceKey, channel }) {
3870
3913
  return new import_codec_protobuf11.Stream(({ ctx, next }) => {
3871
- (0, import_async13.scheduleTask)(ctx, async () => {
3914
+ (0, import_async14.scheduleTask)(ctx, async () => {
3872
3915
  const dataSpaceManager = await this._getDataSpaceManager();
3873
3916
  const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
3874
3917
  const handle = space.listen(getChannelId(channel), (message) => {
@@ -3887,7 +3930,7 @@ var SpacesServiceImpl = class {
3887
3930
  }
3888
3931
  };
3889
3932
  ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
3890
- (0, import_async13.scheduleTask)(ctx, async () => {
3933
+ (0, import_async14.scheduleTask)(ctx, async () => {
3891
3934
  await space.spaceState.addCredentialProcessor(processor);
3892
3935
  if (noTail) {
3893
3936
  close();
@@ -3994,7 +4037,7 @@ var SpacesServiceImpl = class {
3994
4037
  var getChannelId = (channel) => `user-channel/${channel}`;
3995
4038
 
3996
4039
  // packages/sdk/client-services/src/packlets/services/service-context.ts
3997
- function _ts_decorate5(decorators, target, key, desc) {
4040
+ function _ts_decorate6(decorators, target, key, desc) {
3998
4041
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3999
4042
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4000
4043
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4011,7 +4054,7 @@ var ServiceContext = class ServiceContext2 {
4011
4054
  this.networkManager = networkManager;
4012
4055
  this.signalManager = signalManager;
4013
4056
  this.modelFactory = modelFactory;
4014
- this.initialized = new import_async14.Trigger();
4057
+ this.initialized = new import_async15.Trigger();
4015
4058
  this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
4016
4059
  this._handlerFactories = /* @__PURE__ */ new Map();
4017
4060
  this._instanceId = import_keys11.PublicKey.random().toHex();
@@ -4228,19 +4271,19 @@ var ServiceContext = class ServiceContext2 {
4228
4271
  await identity.space.spaceState.addCredentialProcessor(this._deviceSpaceSync);
4229
4272
  }
4230
4273
  };
4231
- _ts_decorate5([
4232
- import_tracing4.trace.span()
4274
+ _ts_decorate6([
4275
+ import_tracing5.trace.span()
4233
4276
  ], ServiceContext.prototype, "open", null);
4234
- _ts_decorate5([
4235
- import_tracing4.trace.span()
4277
+ _ts_decorate6([
4278
+ import_tracing5.trace.span()
4236
4279
  ], ServiceContext.prototype, "_initialize", null);
4237
- ServiceContext = _ts_decorate5([
4280
+ ServiceContext = _ts_decorate6([
4238
4281
  (0, import_util7.safeInstanceof)("dxos.client-services.ServiceContext"),
4239
- import_tracing4.trace.resource()
4282
+ import_tracing5.trace.resource()
4240
4283
  ], ServiceContext);
4241
4284
 
4242
4285
  // packages/sdk/client-services/src/packlets/services/service-host.ts
4243
- var import_async17 = require("@dxos/async");
4286
+ var import_async18 = require("@dxos/async");
4244
4287
  var import_client_protocol5 = require("@dxos/client-protocol");
4245
4288
  var import_context10 = require("@dxos/context");
4246
4289
  var import_document_model2 = require("@dxos/document-model");
@@ -4255,7 +4298,7 @@ var import_network_manager2 = require("@dxos/network-manager");
4255
4298
  var import_protocols12 = require("@dxos/protocols");
4256
4299
  var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
4257
4300
  var import_text_model = require("@dxos/text-model");
4258
- var import_tracing5 = require("@dxos/tracing");
4301
+ var import_tracing6 = require("@dxos/tracing");
4259
4302
  var import_websocket_rpc = require("@dxos/websocket-rpc");
4260
4303
 
4261
4304
  // packages/sdk/client-services/src/packlets/services/service-registry.ts
@@ -4283,7 +4326,7 @@ var ServiceRegistry = class {
4283
4326
  };
4284
4327
 
4285
4328
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
4286
- var import_async15 = require("@dxos/async");
4329
+ var import_async16 = require("@dxos/async");
4287
4330
  var import_codec_protobuf12 = require("@dxos/codec-protobuf");
4288
4331
  var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
4289
4332
  var DevicesServiceImpl = class {
@@ -4311,7 +4354,7 @@ var DevicesServiceImpl = class {
4311
4354
  });
4312
4355
  }
4313
4356
  };
4314
- const subscriptions = new import_async15.EventSubscriptions();
4357
+ const subscriptions = new import_async16.EventSubscriptions();
4315
4358
  subscriptions.add(this._identityManager.stateUpdate.on(() => {
4316
4359
  update();
4317
4360
  if (this._identityManager.identity) {
@@ -4330,7 +4373,7 @@ var DevicesServiceImpl = class {
4330
4373
  var import_invariant14 = require("@dxos/invariant");
4331
4374
  var import_lock_file = require("@dxos/lock-file");
4332
4375
  var import_log14 = require("@dxos/log");
4333
- function _ts_decorate6(decorators, target, key, desc) {
4376
+ function _ts_decorate7(decorators, target, key, desc) {
4334
4377
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4335
4378
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4336
4379
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4380,20 +4423,20 @@ var Lock = class {
4380
4423
  await import_lock_file.LockFile.release(this._fileHandle);
4381
4424
  }
4382
4425
  };
4383
- _ts_decorate6([
4426
+ _ts_decorate7([
4384
4427
  import_log14.logInfo
4385
4428
  ], Lock.prototype, "lockKey", null);
4386
4429
  var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
4387
4430
 
4388
4431
  // packages/sdk/client-services/src/packlets/logging/logging-service.ts
4389
- var import_async16 = require("@dxos/async");
4432
+ var import_async17 = require("@dxos/async");
4390
4433
  var import_codec_protobuf13 = require("@dxos/codec-protobuf");
4391
4434
  var import_log15 = require("@dxos/log");
4392
4435
  var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
4393
4436
  var import_util8 = require("@dxos/util");
4394
4437
  var LoggingServiceImpl = class {
4395
4438
  constructor() {
4396
- this._logs = new import_async16.Event();
4439
+ this._logs = new import_async17.Event();
4397
4440
  this._started = /* @__PURE__ */ new Date();
4398
4441
  this._logProcessor = (_config, entry2) => {
4399
4442
  this._logs.emit(entry2);
@@ -4638,7 +4681,7 @@ var SystemServiceImpl = class {
4638
4681
  };
4639
4682
 
4640
4683
  // packages/sdk/client-services/src/packlets/services/service-host.ts
4641
- function _ts_decorate7(decorators, target, key, desc) {
4684
+ function _ts_decorate8(decorators, target, key, desc) {
4642
4685
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4643
4686
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4644
4687
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4675,8 +4718,8 @@ var ClientServicesHost = class ClientServicesHost2 {
4675
4718
  lockKey,
4676
4719
  callbacks
4677
4720
  } = {}) {
4678
- this._tracingService = import_tracing5.TRACE_PROCESSOR.createTraceSender();
4679
- this._statusUpdate = new import_async17.Event();
4721
+ this._tracingService = import_tracing6.TRACE_PROCESSOR.createTraceSender();
4722
+ this._statusUpdate = new import_async18.Event();
4680
4723
  this._opening = false;
4681
4724
  this._open = false;
4682
4725
  this._storage = storage;
@@ -5000,26 +5043,26 @@ var ClientServicesHost = class ClientServicesHost2 {
5000
5043
  return identity;
5001
5044
  }
5002
5045
  };
5003
- _ts_decorate7([
5004
- import_tracing5.trace.info()
5046
+ _ts_decorate8([
5047
+ import_tracing6.trace.info()
5005
5048
  ], ClientServicesHost.prototype, "_opening", void 0);
5006
- _ts_decorate7([
5007
- import_tracing5.trace.info()
5049
+ _ts_decorate8([
5050
+ import_tracing6.trace.info()
5008
5051
  ], ClientServicesHost.prototype, "_open", void 0);
5009
- _ts_decorate7([
5010
- import_async17.synchronized,
5011
- import_tracing5.trace.span()
5052
+ _ts_decorate8([
5053
+ import_async18.synchronized,
5054
+ import_tracing6.trace.span()
5012
5055
  ], ClientServicesHost.prototype, "open", null);
5013
- _ts_decorate7([
5014
- import_async17.synchronized,
5015
- import_tracing5.trace.span()
5056
+ _ts_decorate8([
5057
+ import_async18.synchronized,
5058
+ import_tracing6.trace.span()
5016
5059
  ], ClientServicesHost.prototype, "close", null);
5017
- ClientServicesHost = _ts_decorate7([
5018
- import_tracing5.trace.resource()
5060
+ ClientServicesHost = _ts_decorate8([
5061
+ import_tracing6.trace.resource()
5019
5062
  ], ClientServicesHost);
5020
5063
 
5021
5064
  // packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
5022
- var import_async19 = require("@dxos/async");
5065
+ var import_async20 = require("@dxos/async");
5023
5066
  var import_client_protocol7 = require("@dxos/client-protocol");
5024
5067
  var import_context11 = require("@dxos/context");
5025
5068
  var import_log17 = require("@dxos/log");
@@ -5028,7 +5071,7 @@ var import_network_manager3 = require("@dxos/network-manager");
5028
5071
  var import_util11 = require("@dxos/util");
5029
5072
 
5030
5073
  // packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
5031
- var import_async18 = require("@dxos/async");
5074
+ var import_async19 = require("@dxos/async");
5032
5075
  var import_client_protocol6 = require("@dxos/client-protocol");
5033
5076
  var import_invariant16 = require("@dxos/invariant");
5034
5077
  var import_iframe = require("@dxos/protocols/proto/dxos/iframe");
@@ -5037,7 +5080,7 @@ var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
5037
5080
  var ShellRuntimeImpl = class {
5038
5081
  constructor(_port) {
5039
5082
  this._port = _port;
5040
- this.layoutUpdate = new import_async18.Event();
5083
+ this.layoutUpdate = new import_async19.Event();
5041
5084
  this._layout = import_iframe.ShellLayout.DEFAULT;
5042
5085
  }
5043
5086
  get layout() {
@@ -5096,7 +5139,7 @@ var ShellRuntimeImpl = class {
5096
5139
  };
5097
5140
 
5098
5141
  // packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
5099
- function _ts_decorate8(decorators, target, key, desc) {
5142
+ function _ts_decorate9(decorators, target, key, desc) {
5100
5143
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5101
5144
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
5102
5145
  r = Reflect.decorate(decorators, target, key, desc);
@@ -5110,7 +5153,7 @@ var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
5110
5153
  var LOCK_KEY = "DXOS_RESOURCE_LOCK";
5111
5154
  var IFrameHostRuntime = class {
5112
5155
  constructor({ config, origin, appPort, shellPort }) {
5113
- this._ready = new import_async19.Trigger();
5156
+ this._ready = new import_async20.Trigger();
5114
5157
  this._configProvider = config;
5115
5158
  this.origin = origin;
5116
5159
  this._appPort = appPort;
@@ -5209,12 +5252,12 @@ var IFrameHostRuntime = class {
5209
5252
  });
5210
5253
  }
5211
5254
  };
5212
- _ts_decorate8([
5255
+ _ts_decorate9([
5213
5256
  import_log17.logInfo
5214
5257
  ], IFrameHostRuntime.prototype, "origin", void 0);
5215
5258
 
5216
5259
  // packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts
5217
- var import_async20 = require("@dxos/async");
5260
+ var import_async21 = require("@dxos/async");
5218
5261
  var import_client_protocol8 = require("@dxos/client-protocol");
5219
5262
  var import_log18 = require("@dxos/log");
5220
5263
  var import_network_manager4 = require("@dxos/network-manager");
@@ -5225,7 +5268,7 @@ var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
5225
5268
  var IFrameProxyRuntime = class {
5226
5269
  constructor({ config, systemPort, shellPort }) {
5227
5270
  this._id = String(Math.floor(Math.random() * 1e6));
5228
- this._release = new import_async20.Trigger();
5271
+ this._release = new import_async21.Trigger();
5229
5272
  this._configProvider = config;
5230
5273
  this._systemPort = systemPort;
5231
5274
  this._shellPort = shellPort;
@@ -5253,8 +5296,8 @@ var IFrameProxyRuntime = class {
5253
5296
  let lockKey;
5254
5297
  if (typeof navigator !== "undefined") {
5255
5298
  lockKey = this._lockKey(origin);
5256
- this._release = new import_async20.Trigger();
5257
- const ready = new import_async20.Trigger();
5299
+ this._release = new import_async21.Trigger();
5300
+ const ready = new import_async21.Trigger();
5258
5301
  void navigator.locks.request(lockKey, async () => {
5259
5302
  ready.wake();
5260
5303
  await this._release.wait();
@@ -5290,20 +5333,20 @@ var IFrameProxyRuntime = class {
5290
5333
  };
5291
5334
 
5292
5335
  // packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
5293
- var import_async22 = require("@dxos/async");
5336
+ var import_async23 = require("@dxos/async");
5294
5337
  var import_context12 = require("@dxos/context");
5295
5338
  var import_log20 = require("@dxos/log");
5296
5339
  var import_messaging3 = require("@dxos/messaging");
5297
5340
  var import_network_manager5 = require("@dxos/network-manager");
5298
5341
 
5299
5342
  // packages/sdk/client-services/src/packlets/vault/worker-session.ts
5300
- var import_async21 = require("@dxos/async");
5343
+ var import_async22 = require("@dxos/async");
5301
5344
  var import_client_protocol9 = require("@dxos/client-protocol");
5302
5345
  var import_invariant17 = require("@dxos/invariant");
5303
5346
  var import_log19 = require("@dxos/log");
5304
5347
  var import_rpc4 = require("@dxos/rpc");
5305
5348
  var import_util13 = require("@dxos/util");
5306
- function _ts_decorate9(decorators, target, key, desc) {
5349
+ function _ts_decorate10(decorators, target, key, desc) {
5307
5350
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5308
5351
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
5309
5352
  r = Reflect.decorate(decorators, target, key, desc);
@@ -5316,7 +5359,7 @@ function _ts_decorate9(decorators, target, key, desc) {
5316
5359
  var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-session.ts";
5317
5360
  var WorkerSession = class {
5318
5361
  constructor({ serviceHost, systemPort, appPort, shellPort, readySignal }) {
5319
- this._startTrigger = new import_async21.Trigger();
5362
+ this._startTrigger = new import_async22.Trigger();
5320
5363
  this.onClose = new import_util13.Callback();
5321
5364
  (0, import_invariant17.invariant)(serviceHost, void 0, {
5322
5365
  F: __dxlog_file21,
@@ -5444,7 +5487,7 @@ var WorkerSession = class {
5444
5487
  }
5445
5488
  async _maybeOpenShell() {
5446
5489
  try {
5447
- await (0, import_async21.asyncTimeout)(this._shellClientRpc.open(), 1e3);
5490
+ await (0, import_async22.asyncTimeout)(this._shellClientRpc.open(), 1e3);
5448
5491
  } catch {
5449
5492
  import_log19.log.info("No shell connected.", void 0, {
5450
5493
  F: __dxlog_file21,
@@ -5459,10 +5502,10 @@ var WorkerSession = class {
5459
5502
  }).then(callback);
5460
5503
  }
5461
5504
  };
5462
- _ts_decorate9([
5505
+ _ts_decorate10([
5463
5506
  import_log19.logInfo
5464
5507
  ], WorkerSession.prototype, "origin", void 0);
5465
- _ts_decorate9([
5508
+ _ts_decorate10([
5466
5509
  import_log19.logInfo
5467
5510
  ], WorkerSession.prototype, "lockKey", void 0);
5468
5511
 
@@ -5472,7 +5515,7 @@ var WorkerRuntime = class {
5472
5515
  constructor(_configProvider) {
5473
5516
  this._configProvider = _configProvider;
5474
5517
  this._transportFactory = new import_network_manager5.SimplePeerTransportProxyFactory();
5475
- this._ready = new import_async22.Trigger();
5518
+ this._ready = new import_async23.Trigger();
5476
5519
  this._sessions = /* @__PURE__ */ new Set();
5477
5520
  this._clientServices = new ClientServicesHost({
5478
5521
  callbacks: {