@dxos/client-services 0.13.0 → 0.14.0

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.
@@ -59,6 +59,7 @@ import platform from "platform";
59
59
  import { Gossip, Presence } from "@dxos/teleport-extension-gossip";
60
60
  import { Directory, StorageType, wrapFile } from "@dxos/random-access-storage";
61
61
  import { Message, SpaceInvitationMessage } from "@dxos/types";
62
+ import * as SpanAttributes from "@dxos/effect/SpanAttributes";
62
63
  import { LayerStack } from "@dxos/compute-runtime";
63
64
  import { ConfigSchema, Runtime_Client_QueryExecutor } from "@dxos/protocols/buf/dxos/config_pb";
64
65
  import * as LayerSpec from "@dxos/compute/LayerSpec";
@@ -3336,7 +3337,7 @@ var getPlatform = () => {
3336
3337
  };
3337
3338
  //#endregion
3338
3339
  //#region src/version.ts
3339
- var DXOS_VERSION = "0.13.0";
3340
+ var DXOS_VERSION = "0.14.0";
3340
3341
  //#endregion
3341
3342
  //#region src/internal/diagnostics/diagnostics.ts
3342
3343
  var __dxlog_file$35 = "/__w/dxos/dxos/packages/sdk/client-services/src/internal/diagnostics/diagnostics.ts";
@@ -7195,7 +7196,7 @@ var InvitationsHandler = class {
7195
7196
  }, {
7196
7197
  "~LogMeta": "~LogMeta",
7197
7198
  F: __dxlog_file$17,
7198
- L: 119,
7199
+ L: 120,
7199
7200
  S: this
7200
7201
  });
7201
7202
  metrics.increment("dxos.invitation.host", 1, { tags: {
@@ -7212,14 +7213,15 @@ var InvitationsHandler = class {
7212
7213
  op: "invitation.host",
7213
7214
  attributes: {
7214
7215
  "ctx.dxos.invitation.id": invitation.invitationId,
7215
- "ctx.dxos.invitation.kind": Invitation_Kind[invitation.kind]
7216
+ "ctx.dxos.invitation.kind": Invitation_Kind[invitation.kind],
7217
+ [SpanAttributes.SAMPLING.keep]: true
7216
7218
  }
7217
7219
  }) ?? ctx;
7218
7220
  if (ctx !== invitationCtx) ctx.onDispose(() => {
7219
7221
  invitationCtx.dispose();
7220
7222
  });
7221
- ctx.onDispose(() => trace.spanEnd(hostSpanId));
7222
7223
  const guardedState = createGuardedInvitationState(ctx, invitation, stream);
7224
+ ctx.onDispose(() => trace.spanEnd(hostSpanId, { attributes: { outcome: getInvitationOutcome(guardedState.current.state) } }));
7223
7225
  const topology = new InvitationTopology(InvitationOptions_Role.HOST);
7224
7226
  const createExtension = (remotePeerId) => {
7225
7227
  const extension = new InvitationHostExtension(guardedState.mutex, {
@@ -7238,14 +7240,14 @@ var InvitationsHandler = class {
7238
7240
  }, {
7239
7241
  "~LogMeta": "~LogMeta",
7240
7242
  F: __dxlog_file$17,
7241
- L: 171,
7243
+ L: 176,
7242
7244
  S: this
7243
7245
  });
7244
7246
  const deviceKey = admissionRequest.kind.value?.deviceKey;
7245
7247
  invariant(deviceKey, "Admission request carries no device key.", {
7246
7248
  "~LogMeta": "~LogMeta",
7247
7249
  F: __dxlog_file$17,
7248
- L: 176,
7250
+ L: 181,
7249
7251
  S: this,
7250
7252
  A: ["deviceKey", "'Admission request carries no device key.'"]
7251
7253
  });
@@ -7267,13 +7269,13 @@ var InvitationsHandler = class {
7267
7269
  log("opening host invitation handler", void 0, {
7268
7270
  "~LogMeta": "~LogMeta",
7269
7271
  F: __dxlog_file$17,
7270
- L: 200,
7272
+ L: 205,
7271
7273
  S: this
7272
7274
  });
7273
7275
  log.verbose("connected", { ...protocol.toJSON() }, {
7274
7276
  "~LogMeta": "~LogMeta",
7275
7277
  F: __dxlog_file$17,
7276
- L: 201,
7278
+ L: 206,
7277
7279
  S: this
7278
7280
  });
7279
7281
  const deviceKey = await extension.completedTrigger.wait({ timeout: invitation.timeout });
@@ -7283,7 +7285,7 @@ var InvitationsHandler = class {
7283
7285
  }, {
7284
7286
  "~LogMeta": "~LogMeta",
7285
7287
  F: __dxlog_file$17,
7286
- L: 203,
7288
+ L: 208,
7287
7289
  S: this
7288
7290
  });
7289
7291
  guardedState.set(extension, Invitation_State.SUCCESS);
@@ -7295,7 +7297,7 @@ var InvitationsHandler = class {
7295
7297
  log("host invitation handler opened", void 0, {
7296
7298
  "~LogMeta": "~LogMeta",
7297
7299
  F: __dxlog_file$17,
7298
- L: 207,
7300
+ L: 212,
7299
7301
  S: this
7300
7302
  });
7301
7303
  admitted = true;
@@ -7312,7 +7314,7 @@ var InvitationsHandler = class {
7312
7314
  log.verbose("timeout", { ...protocol.toJSON() }, {
7313
7315
  "~LogMeta": "~LogMeta",
7314
7316
  F: __dxlog_file$17,
7315
- L: 219,
7317
+ L: 224,
7316
7318
  S: this
7317
7319
  });
7318
7320
  }
@@ -7324,7 +7326,7 @@ var InvitationsHandler = class {
7324
7326
  log.error("failed", err, {
7325
7327
  "~LogMeta": "~LogMeta",
7326
7328
  F: __dxlog_file$17,
7327
- L: 224,
7329
+ L: 229,
7328
7330
  S: this
7329
7331
  });
7330
7332
  }
@@ -7338,7 +7340,7 @@ var InvitationsHandler = class {
7338
7340
  log("invalid role", { ...err.context }, {
7339
7341
  "~LogMeta": "~LogMeta",
7340
7342
  F: __dxlog_file$17,
7341
- L: 235,
7343
+ L: 240,
7342
7344
  S: this
7343
7345
  });
7344
7346
  topology.retire(remotePeerId);
@@ -7353,7 +7355,7 @@ var InvitationsHandler = class {
7353
7355
  log.verbose("timeout", { err }, {
7354
7356
  "~LogMeta": "~LogMeta",
7355
7357
  F: __dxlog_file$17,
7356
- L: 242,
7358
+ L: 247,
7357
7359
  S: this
7358
7360
  });
7359
7361
  }
@@ -7365,7 +7367,7 @@ var InvitationsHandler = class {
7365
7367
  log.error("failed", err, {
7366
7368
  "~LogMeta": "~LogMeta",
7367
7369
  F: __dxlog_file$17,
7368
- L: 247,
7370
+ L: 252,
7369
7371
  S: this
7370
7372
  });
7371
7373
  }
@@ -7379,14 +7381,14 @@ var InvitationsHandler = class {
7379
7381
  log.warn("invitation has already expired", void 0, {
7380
7382
  "~LogMeta": "~LogMeta",
7381
7383
  F: __dxlog_file$17,
7382
- L: 259,
7384
+ L: 264,
7383
7385
  S: this
7384
7386
  });
7385
7387
  guardedState.set(null, Invitation_State.EXPIRED);
7386
7388
  ctx.dispose().catch((err) => log.catch(err, void 0, {
7387
7389
  "~LogMeta": "~LogMeta",
7388
7390
  F: __dxlog_file$17,
7389
- L: 261,
7391
+ L: 266,
7390
7392
  S: this
7391
7393
  }));
7392
7394
  return;
@@ -7416,7 +7418,7 @@ var InvitationsHandler = class {
7416
7418
  }, {
7417
7419
  "~LogMeta": "~LogMeta",
7418
7420
  F: __dxlog_file$17,
7419
- L: 292,
7421
+ L: 297,
7420
7422
  S: this
7421
7423
  });
7422
7424
  const { timeout = INVITATION_TIMEOUT } = invitation;
@@ -7432,7 +7434,8 @@ var InvitationsHandler = class {
7432
7434
  "ctx.dxos.invitation.id": invitation.invitationId,
7433
7435
  "ctx.dxos.invitation.kind": Invitation_Kind[invitation.kind],
7434
7436
  "ctx.dxos.invitation.type": Invitation_Type[invitation.type],
7435
- ...invitation.spaceId ? { "ctx.spaceId": invitation.spaceId } : {}
7437
+ ...invitation.spaceId ? { "ctx.spaceId": invitation.spaceId } : {},
7438
+ [SpanAttributes.SAMPLING.keep]: true
7436
7439
  }
7437
7440
  }) ?? ctx;
7438
7441
  if (ctx !== invitationCtx) ctx.onDispose(() => {
@@ -7441,7 +7444,7 @@ var InvitationsHandler = class {
7441
7444
  if (deviceProfile) invariant(invitation.kind === Invitation_Kind.DEVICE, "deviceProfile provided for non-device invitation", {
7442
7445
  "~LogMeta": "~LogMeta",
7443
7446
  F: __dxlog_file$17,
7444
- L: 332,
7447
+ L: 338,
7445
7448
  S: this,
7446
7449
  A: ["invitation.kind === Invitation_Kind.DEVICE", "'deviceProfile provided for non-device invitation'"]
7447
7450
  });
@@ -7461,7 +7464,7 @@ var InvitationsHandler = class {
7461
7464
  }, {
7462
7465
  "~LogMeta": "~LogMeta",
7463
7466
  F: __dxlog_file$17,
7464
- L: 350,
7467
+ L: 356,
7465
7468
  S: this
7466
7469
  });
7467
7470
  if (isLockedByAnotherConnection) return false;
@@ -7486,7 +7489,7 @@ var InvitationsHandler = class {
7486
7489
  }, {
7487
7490
  "~LogMeta": "~LogMeta",
7488
7491
  F: __dxlog_file$17,
7489
- L: 378,
7492
+ L: 384,
7490
7493
  S: this
7491
7494
  });
7492
7495
  if (!admitted) {
@@ -7499,7 +7502,7 @@ var InvitationsHandler = class {
7499
7502
  log("opening guest invitation handler", void 0, {
7500
7503
  "~LogMeta": "~LogMeta",
7501
7504
  F: __dxlog_file$17,
7502
- L: 389,
7505
+ L: 395,
7503
7506
  S: this
7504
7507
  });
7505
7508
  scheduleTask(connectionCtx, () => {
@@ -7509,7 +7512,7 @@ var InvitationsHandler = class {
7509
7512
  log.verbose("dxos.sdk.invitations-handler.guest.connected", { ...protocol.toJSON() }, {
7510
7513
  "~LogMeta": "~LogMeta",
7511
7514
  F: __dxlog_file$17,
7512
- L: 400,
7515
+ L: 406,
7513
7516
  S: this
7514
7517
  });
7515
7518
  guardedState.set(extension, Invitation_State.CONNECTED);
@@ -7519,7 +7522,7 @@ var InvitationsHandler = class {
7519
7522
  }, {
7520
7523
  "~LogMeta": "~LogMeta",
7521
7524
  F: __dxlog_file$17,
7522
- L: 404,
7525
+ L: 410,
7523
7526
  S: this
7524
7527
  });
7525
7528
  const introductionResponse = await extension.rpc.InvitationHostService.introduce({
@@ -7533,7 +7536,7 @@ var InvitationsHandler = class {
7533
7536
  }, {
7534
7537
  "~LogMeta": "~LogMeta",
7535
7538
  F: __dxlog_file$17,
7536
- L: 412,
7539
+ L: 418,
7537
7540
  S: this
7538
7541
  });
7539
7542
  invitation.authMethod = introductionResponse.authMethod;
@@ -7549,7 +7552,7 @@ var InvitationsHandler = class {
7549
7552
  }, {
7550
7553
  "~LogMeta": "~LogMeta",
7551
7554
  F: __dxlog_file$17,
7552
- L: 442,
7555
+ L: 448,
7553
7556
  S: this
7554
7557
  });
7555
7558
  const admissionRequest = await protocol.createAdmissionRequest(deviceProfile);
@@ -7562,7 +7565,7 @@ var InvitationsHandler = class {
7562
7565
  }, {
7563
7566
  "~LogMeta": "~LogMeta",
7564
7567
  F: __dxlog_file$17,
7565
- L: 456,
7568
+ L: 462,
7566
7569
  S: this
7567
7570
  });
7568
7571
  metrics.increment("dxos.invitation.success", 1, { tags: {
@@ -7580,7 +7583,7 @@ var InvitationsHandler = class {
7580
7583
  log("guest invitation handler opened", void 0, {
7581
7584
  "~LogMeta": "~LogMeta",
7582
7585
  F: __dxlog_file$17,
7583
- L: 471,
7586
+ L: 477,
7584
7587
  S: this
7585
7588
  });
7586
7589
  } catch (err) {
@@ -7588,7 +7591,7 @@ var InvitationsHandler = class {
7588
7591
  log.verbose("timeout", { ...protocol.toJSON() }, {
7589
7592
  "~LogMeta": "~LogMeta",
7590
7593
  F: __dxlog_file$17,
7591
- L: 474,
7594
+ L: 480,
7592
7595
  S: this
7593
7596
  });
7594
7597
  guardedState.set(extension, Invitation_State.TIMEOUT);
@@ -7596,7 +7599,7 @@ var InvitationsHandler = class {
7596
7599
  log.verbose("auth failed", err, {
7597
7600
  "~LogMeta": "~LogMeta",
7598
7601
  F: __dxlog_file$17,
7599
- L: 477,
7602
+ L: 483,
7600
7603
  S: this
7601
7604
  });
7602
7605
  guardedState.error(extension, err);
@@ -7611,7 +7614,7 @@ var InvitationsHandler = class {
7611
7614
  log.verbose("timeout", { ...protocol.toJSON() }, {
7612
7615
  "~LogMeta": "~LogMeta",
7613
7616
  F: __dxlog_file$17,
7614
- L: 489,
7617
+ L: 495,
7615
7618
  S: this
7616
7619
  });
7617
7620
  guardedState.set(extension, Invitation_State.TIMEOUT);
@@ -7619,7 +7622,7 @@ var InvitationsHandler = class {
7619
7622
  log.verbose("auth failed", err, {
7620
7623
  "~LogMeta": "~LogMeta",
7621
7624
  F: __dxlog_file$17,
7622
- L: 492,
7625
+ L: 498,
7623
7626
  S: this
7624
7627
  });
7625
7628
  guardedState.error(extension, err);
@@ -7633,7 +7636,7 @@ var InvitationsHandler = class {
7633
7636
  log.info("admitted by edge", { ...protocol.toJSON() }, {
7634
7637
  "~LogMeta": "~LogMeta",
7635
7638
  F: __dxlog_file$17,
7636
- L: 504,
7639
+ L: 510,
7637
7640
  S: this
7638
7641
  });
7639
7642
  metrics.increment("dxos.invitation.success", 1, { tags: {
@@ -7658,7 +7661,7 @@ var InvitationsHandler = class {
7658
7661
  invariant(invitation.swarmKey, void 0, {
7659
7662
  "~LogMeta": "~LogMeta",
7660
7663
  F: __dxlog_file$17,
7661
- L: 523,
7664
+ L: 529,
7662
7665
  S: this,
7663
7666
  A: ["invitation.swarmKey", ""]
7664
7667
  });
@@ -7681,7 +7684,7 @@ var InvitationsHandler = class {
7681
7684
  invariant(swarmKey, "swarmKey missing in the invitation", {
7682
7685
  "~LogMeta": "~LogMeta",
7683
7686
  F: __dxlog_file$17,
7684
- L: 564,
7687
+ L: 570,
7685
7688
  S: this,
7686
7689
  A: ["swarmKey", "'swarmKey missing in the invitation'"]
7687
7690
  });
@@ -7701,7 +7704,7 @@ var InvitationsHandler = class {
7701
7704
  log("guest waiting for authentication code...", void 0, {
7702
7705
  "~LogMeta": "~LogMeta",
7703
7706
  F: __dxlog_file$17,
7704
- L: 584,
7707
+ L: 590,
7705
7708
  S: this
7706
7709
  });
7707
7710
  setState(Invitation_State.READY_FOR_AUTHENTICATION);
@@ -7709,7 +7712,7 @@ var InvitationsHandler = class {
7709
7712
  log("sending authentication request", void 0, {
7710
7713
  "~LogMeta": "~LogMeta",
7711
7714
  F: __dxlog_file$17,
7712
- L: 588,
7715
+ L: 594,
7713
7716
  S: this
7714
7717
  });
7715
7718
  setState(Invitation_State.AUTHENTICATING);
@@ -7721,7 +7724,7 @@ var InvitationsHandler = class {
7721
7724
  log("retrying invalid code", { attempt }, {
7722
7725
  "~LogMeta": "~LogMeta",
7723
7726
  F: __dxlog_file$17,
7724
- L: 601,
7727
+ L: 607,
7725
7728
  S: this
7726
7729
  });
7727
7730
  authenticated.reset();
@@ -7736,7 +7739,7 @@ var InvitationsHandler = class {
7736
7739
  log("sending authentication request", void 0, {
7737
7740
  "~LogMeta": "~LogMeta",
7738
7741
  F: __dxlog_file$17,
7739
- L: 621,
7742
+ L: 627,
7740
7743
  S: this
7741
7744
  });
7742
7745
  const signature = sign(Buffer.from(introductionResponse.challenge), Buffer.from(guestPrivateKey));