@dxos/client-services 0.1.53-main.e7b89d1 → 0.1.53-main.f5aedb7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/lib/browser/{chunk-BSRQYPXL.mjs → chunk-PWZ2J6KS.mjs} +650 -626
  2. package/dist/lib/browser/chunk-PWZ2J6KS.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +101 -120
  4. package/dist/lib/browser/index.mjs.map +3 -3
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs +6 -6
  7. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/index.cjs +720 -717
  9. package/dist/lib/node/index.cjs.map +3 -3
  10. package/dist/lib/node/meta.json +1 -1
  11. package/dist/lib/node/packlets/testing/index.cjs +624 -602
  12. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  13. package/dist/types/src/packlets/services/service-host.d.ts +7 -1
  14. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  15. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  16. package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts +1 -1
  17. package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
  18. package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts +1 -1
  19. package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts.map +1 -1
  20. package/dist/types/src/packlets/vault/shell-runtime.d.ts +1 -21
  21. package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +1 -1
  22. package/package.json +33 -32
  23. package/src/packlets/identity/identity-manager.test.ts +1 -1
  24. package/src/packlets/identity/identity-manager.ts +8 -8
  25. package/src/packlets/identity/identity-service.ts +2 -2
  26. package/src/packlets/identity/identity.test.ts +1 -1
  27. package/src/packlets/identity/identity.ts +2 -2
  28. package/src/packlets/invitations/device-invitation-protocol.ts +4 -4
  29. package/src/packlets/invitations/invitation-extension.ts +5 -5
  30. package/src/packlets/invitations/invitations-handler.ts +6 -6
  31. package/src/packlets/invitations/invitations-service.ts +3 -3
  32. package/src/packlets/invitations/space-invitation-protocol.ts +9 -9
  33. package/src/packlets/locks/node.ts +2 -2
  34. package/src/packlets/logging/logging-service.ts +4 -4
  35. package/src/packlets/services/service-context.test.ts +1 -1
  36. package/src/packlets/services/service-context.ts +3 -3
  37. package/src/packlets/services/service-host.test.ts +50 -2
  38. package/src/packlets/services/service-host.ts +25 -9
  39. package/src/packlets/spaces/data-space-manager.ts +5 -5
  40. package/src/packlets/spaces/notarization-plugin.ts +4 -4
  41. package/src/packlets/testing/invitation-utils.ts +2 -2
  42. package/src/packlets/testing/test-builder.ts +1 -2
  43. package/src/packlets/vault/iframe-host-runtime.ts +2 -2
  44. package/src/packlets/vault/iframe-proxy-runtime.ts +2 -2
  45. package/src/packlets/vault/shell-runtime.ts +3 -49
  46. package/src/packlets/vault/worker-runtime.ts +1 -1
  47. package/src/packlets/vault/worker-session.ts +2 -2
  48. package/dist/lib/browser/chunk-BSRQYPXL.mjs.map +0 -7
@@ -61,12 +61,12 @@ var createMockCredential = async ({ signer, issuer }) => (0, import_credentials.
61
61
  });
62
62
 
63
63
  // packages/sdk/client-services/src/packlets/testing/invitation-utils.ts
64
- var import_node_assert14 = __toESM(require("node:assert"));
64
+ var import_tiny_invariant14 = __toESM(require("tiny-invariant"));
65
65
  var import_async18 = require("@dxos/async");
66
66
  var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
67
67
 
68
68
  // packages/sdk/client-services/src/packlets/services/service-context.ts
69
- var import_node_assert11 = __toESM(require("node:assert"));
69
+ var import_tiny_invariant11 = __toESM(require("tiny-invariant"));
70
70
  var import_async11 = require("@dxos/async");
71
71
  var import_credentials14 = require("@dxos/credentials");
72
72
  var import_debug6 = require("@dxos/debug");
@@ -85,6 +85,7 @@ var import_context = require("@dxos/context");
85
85
  var import_credentials2 = require("@dxos/credentials");
86
86
  var import_log = require("@dxos/log");
87
87
  var import_protocols = require("@dxos/protocols");
88
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
88
89
  var createAuthProvider = (signer) => async (nonce) => {
89
90
  const credential = await signer.createCredential({
90
91
  assertion: {
@@ -110,20 +111,20 @@ var TrustedKeySetAuthVerifier = class {
110
111
  (0, import_log.log)("authenticating...", {
111
112
  credential
112
113
  }, {
113
- file: "authenticator.ts",
114
- line: 57,
115
- scope: this,
116
- callSite: (f, a) => f(...a)
114
+ F: __dxlog_file,
115
+ L: 57,
116
+ S: this,
117
+ C: (f, a) => f(...a)
117
118
  });
118
119
  const result = await (0, import_credentials2.verifyCredential)(credential);
119
120
  if (result.kind === "fail") {
120
121
  (0, import_log.log)("Invalid credential", {
121
122
  result
122
123
  }, {
123
- file: "authenticator.ts",
124
- line: 61,
125
- scope: this,
126
- callSite: (f, a) => f(...a)
124
+ F: __dxlog_file,
125
+ L: 61,
126
+ S: this,
127
+ C: (f, a) => f(...a)
127
128
  });
128
129
  return false;
129
130
  }
@@ -132,10 +133,10 @@ var TrustedKeySetAuthVerifier = class {
132
133
  nonce,
133
134
  credential
134
135
  }, {
135
- file: "authenticator.ts",
136
- line: 66,
137
- scope: this,
138
- callSite: (f, a) => f(...a)
136
+ F: __dxlog_file,
137
+ L: 66,
138
+ S: this,
139
+ C: (f, a) => f(...a)
139
140
  });
140
141
  return false;
141
142
  }
@@ -143,10 +144,10 @@ var TrustedKeySetAuthVerifier = class {
143
144
  (0, import_log.log)("key is not currently in trusted set, waiting...", {
144
145
  key: credential.issuer
145
146
  }, {
146
- file: "authenticator.ts",
147
- line: 71,
148
- scope: this,
149
- callSite: (f, a) => f(...a)
147
+ F: __dxlog_file,
148
+ L: 71,
149
+ S: this,
150
+ C: (f, a) => f(...a)
150
151
  });
151
152
  return true;
152
153
  }
@@ -159,20 +160,20 @@ var TrustedKeySetAuthVerifier = class {
159
160
  (0, import_log.log)("auth success", {
160
161
  key: credential.issuer
161
162
  }, {
162
- file: "authenticator.ts",
163
- line: 82,
164
- scope: this,
165
- callSite: (f, a) => f(...a)
163
+ F: __dxlog_file,
164
+ L: 82,
165
+ S: this,
166
+ C: (f, a) => f(...a)
166
167
  });
167
168
  trigger.wake(true);
168
169
  } else {
169
170
  (0, import_log.log)("key is not currently in trusted set, waiting...", {
170
171
  key: credential.issuer
171
172
  }, {
172
- file: "authenticator.ts",
173
- line: 85,
174
- scope: this,
175
- callSite: (f, a) => f(...a)
173
+ F: __dxlog_file,
174
+ L: 85,
175
+ S: this,
176
+ C: (f, a) => f(...a)
176
177
  });
177
178
  }
178
179
  });
@@ -194,7 +195,7 @@ var TrustedKeySetAuthVerifier = class {
194
195
  };
195
196
 
196
197
  // packages/sdk/client-services/src/packlets/identity/identity.ts
197
- var import_node_assert = __toESM(require("node:assert"));
198
+ var import_tiny_invariant = __toESM(require("tiny-invariant"));
198
199
  var import_async2 = require("@dxos/async");
199
200
  var import_client_protocol = require("@dxos/client-protocol");
200
201
  var import_credentials3 = require("@dxos/credentials");
@@ -202,6 +203,7 @@ var import_debug = require("@dxos/debug");
202
203
  var import_feed_store = require("@dxos/feed-store");
203
204
  var import_log2 = require("@dxos/log");
204
205
  var import_credentials4 = require("@dxos/protocols/proto/dxos/halo/credentials");
206
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
205
207
  var Identity = class {
206
208
  constructor({ space, signer, identityKey, deviceKey }) {
207
209
  this.stateUpdate = new import_async2.Event();
@@ -276,7 +278,7 @@ var Identity = class {
276
278
  * Requires identity to be ready.
277
279
  */
278
280
  getIdentityCredentialSigner() {
279
- (0, import_node_assert.default)(this._deviceStateMachine.processor.deviceCredentialChain, "Device credential chain is not ready.");
281
+ (0, import_tiny_invariant.default)(this._deviceStateMachine.processor.deviceCredentialChain, "Device credential chain is not ready.");
280
282
  return (0, import_credentials3.createCredentialSignerWithChain)(this._signer, this._deviceStateMachine.processor.deviceCredentialChain, this.deviceKey);
281
283
  }
282
284
  /**
@@ -293,10 +295,10 @@ var Identity = class {
293
295
  controlFeedKey,
294
296
  dataFeedKey
295
297
  }, {
296
- file: "identity.ts",
297
- line: 156,
298
- scope: this,
299
- callSite: (f, a) => f(...a)
298
+ F: __dxlog_file2,
299
+ L: 156,
300
+ S: this,
301
+ C: (f, a) => f(...a)
300
302
  });
301
303
  const signer = this.getIdentityCredentialSigner();
302
304
  await (0, import_feed_store.writeMessages)(this.controlPipeline.writer, [
@@ -337,7 +339,7 @@ var Identity = class {
337
339
  };
338
340
 
339
341
  // packages/sdk/client-services/src/packlets/identity/identity-manager.ts
340
- var import_node_assert2 = __toESM(require("node:assert"));
342
+ var import_tiny_invariant2 = __toESM(require("tiny-invariant"));
341
343
  var import_async3 = require("@dxos/async");
342
344
  var import_credentials5 = require("@dxos/credentials");
343
345
  var import_keys2 = require("@dxos/keys");
@@ -345,6 +347,7 @@ var import_log3 = require("@dxos/log");
345
347
  var import_protocols2 = require("@dxos/protocols");
346
348
  var import_credentials6 = require("@dxos/protocols/proto/dxos/halo/credentials");
347
349
  var import_util = require("@dxos/util");
350
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
348
351
  var IdentityManager = class {
349
352
  // TODO(burdon): IdentityManagerParams.
350
353
  // TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
@@ -364,20 +367,20 @@ var IdentityManager = class {
364
367
  import_log3.log.trace("dxos.halo.identity-manager.open", import_protocols2.trace.begin({
365
368
  id: traceId
366
369
  }), {
367
- file: "identity-manager.ts",
368
- line: 70,
369
- scope: this,
370
- callSite: (f, a) => f(...a)
370
+ F: __dxlog_file3,
371
+ L: 70,
372
+ S: this,
373
+ C: (f, a) => f(...a)
371
374
  });
372
375
  await this._metadataStore.load();
373
376
  const identityRecord = this._metadataStore.getIdentityRecord();
374
377
  (0, import_log3.log)("identity record", {
375
378
  identityRecord
376
379
  }, {
377
- file: "identity-manager.ts",
378
- line: 74,
379
- scope: this,
380
- callSite: (f, a) => f(...a)
380
+ F: __dxlog_file3,
381
+ L: 74,
382
+ S: this,
383
+ C: (f, a) => f(...a)
381
384
  });
382
385
  if (identityRecord) {
383
386
  this._identity = await this._constructIdentity(identityRecord);
@@ -387,20 +390,20 @@ var IdentityManager = class {
387
390
  identityKey: identityRecord.identityKey,
388
391
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
389
392
  }, {
390
- file: "identity-manager.ts",
391
- line: 79,
392
- scope: this,
393
- callSite: (f, a) => f(...a)
393
+ F: __dxlog_file3,
394
+ L: 79,
395
+ S: this,
396
+ C: (f, a) => f(...a)
394
397
  });
395
398
  this.stateUpdate.emit();
396
399
  }
397
400
  import_log3.log.trace("dxos.halo.identity-manager.open", import_protocols2.trace.end({
398
401
  id: traceId
399
402
  }), {
400
- file: "identity-manager.ts",
401
- line: 85,
402
- scope: this,
403
- callSite: (f, a) => f(...a)
403
+ F: __dxlog_file3,
404
+ L: 85,
405
+ S: this,
406
+ C: (f, a) => f(...a)
404
407
  });
405
408
  }
406
409
  async close() {
@@ -409,12 +412,12 @@ var IdentityManager = class {
409
412
  }
410
413
  async createIdentity({ displayName } = {}) {
411
414
  var _a;
412
- (0, import_node_assert2.default)(!this._identity, "Identity already exists.");
413
- (0, import_log3.log)("creating identity...", {}, {
414
- file: "identity-manager.ts",
415
- line: 94,
416
- scope: this,
417
- callSite: (f, a) => f(...a)
415
+ (0, import_tiny_invariant2.default)(!this._identity, "Identity already exists.");
416
+ (0, import_log3.log)("creating identity...", void 0, {
417
+ F: __dxlog_file3,
418
+ L: 94,
419
+ S: this,
420
+ C: (f, a) => f(...a)
418
421
  });
419
422
  const controlFeedKey = await this._keyring.createKey();
420
423
  const identityRecord = {
@@ -431,8 +434,8 @@ var IdentityManager = class {
431
434
  await identity.open();
432
435
  {
433
436
  const generator = new import_credentials5.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
434
- (0, import_node_assert2.default)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.");
435
- (0, import_node_assert2.default)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.");
437
+ (0, import_tiny_invariant2.default)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.");
438
+ (0, import_tiny_invariant2.default)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.");
436
439
  const credentials = [
437
440
  // Space genesis.
438
441
  ...await generator.createSpaceGenesis(identityRecord.haloSpace.key, identityRecord.haloSpace.genesisFeedKey),
@@ -460,20 +463,20 @@ var IdentityManager = class {
460
463
  identityKey: identityRecord.identityKey,
461
464
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
462
465
  }, {
463
- file: "identity-manager.ts",
464
- line: 149,
465
- scope: this,
466
- callSite: (f, a) => f(...a)
466
+ F: __dxlog_file3,
467
+ L: 149,
468
+ S: this,
469
+ C: (f, a) => f(...a)
467
470
  });
468
471
  this.stateUpdate.emit();
469
472
  (0, import_log3.log)("created identity", {
470
473
  identityKey: identity.identityKey,
471
474
  deviceKey: identity.deviceKey
472
475
  }, {
473
- file: "identity-manager.ts",
474
- line: 155,
475
- scope: this,
476
- callSite: (f, a) => f(...a)
476
+ F: __dxlog_file3,
477
+ L: 155,
478
+ S: this,
479
+ C: (f, a) => f(...a)
477
480
  });
478
481
  return identity;
479
482
  }
@@ -485,12 +488,12 @@ var IdentityManager = class {
485
488
  (0, import_log3.log)("accepting identity", {
486
489
  params
487
490
  }, {
488
- file: "identity-manager.ts",
489
- line: 163,
490
- scope: this,
491
- callSite: (f, a) => f(...a)
491
+ F: __dxlog_file3,
492
+ L: 163,
493
+ S: this,
494
+ C: (f, a) => f(...a)
492
495
  });
493
- (0, import_node_assert2.default)(!this._identity, "Identity already exists.");
496
+ (0, import_tiny_invariant2.default)(!this._identity, "Identity already exists.");
494
497
  const identityRecord = {
495
498
  identityKey: params.identityKey,
496
499
  deviceKey: params.deviceKey,
@@ -511,38 +514,38 @@ var IdentityManager = class {
511
514
  identityKey: identityRecord.identityKey,
512
515
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
513
516
  }, {
514
- file: "identity-manager.ts",
515
- line: 183,
516
- scope: this,
517
- callSite: (f, a) => f(...a)
517
+ F: __dxlog_file3,
518
+ L: 183,
519
+ S: this,
520
+ C: (f, a) => f(...a)
518
521
  });
519
522
  this.stateUpdate.emit();
520
523
  (0, import_log3.log)("accepted identity", {
521
524
  identityKey: identity.identityKey,
522
525
  deviceKey: identity.deviceKey
523
526
  }, {
524
- file: "identity-manager.ts",
525
- line: 189,
526
- scope: this,
527
- callSite: (f, a) => f(...a)
527
+ F: __dxlog_file3,
528
+ L: 189,
529
+ S: this,
530
+ C: (f, a) => f(...a)
528
531
  });
529
532
  return identity;
530
533
  }
531
534
  async _constructIdentity(identityRecord) {
532
- (0, import_node_assert2.default)(!this._identity);
535
+ (0, import_tiny_invariant2.default)(!this._identity);
533
536
  (0, import_log3.log)("constructing identity", {
534
537
  identityRecord
535
538
  }, {
536
- file: "identity-manager.ts",
537
- line: 195,
538
- scope: this,
539
- callSite: (f, a) => f(...a)
539
+ F: __dxlog_file3,
540
+ L: 195,
541
+ S: this,
542
+ C: (f, a) => f(...a)
540
543
  });
541
- (0, import_node_assert2.default)(identityRecord.haloSpace.controlFeedKey);
544
+ (0, import_tiny_invariant2.default)(identityRecord.haloSpace.controlFeedKey);
542
545
  const controlFeed = await this._feedStore.openFeed(identityRecord.haloSpace.controlFeedKey, {
543
546
  writable: true
544
547
  });
545
- (0, import_node_assert2.default)(identityRecord.haloSpace.dataFeedKey);
548
+ (0, import_tiny_invariant2.default)(identityRecord.haloSpace.dataFeedKey);
546
549
  const dataFeed = await this._feedStore.openFeed(identityRecord.haloSpace.dataFeedKey, {
547
550
  writable: true,
548
551
  sparse: true
@@ -567,10 +570,10 @@ var IdentityManager = class {
567
570
  (0, import_log3.log)("done", {
568
571
  identityKey: identityRecord.identityKey
569
572
  }, {
570
- file: "identity-manager.ts",
571
- line: 226,
572
- scope: this,
573
- callSite: (f, a) => f(...a)
573
+ F: __dxlog_file3,
574
+ L: 226,
575
+ S: this,
576
+ C: (f, a) => f(...a)
574
577
  });
575
578
  if (identityRecord.haloSpace.controlTimeframe) {
576
579
  identity.controlPipeline.state.setTargetTimeframe(identityRecord.haloSpace.controlTimeframe);
@@ -587,11 +590,11 @@ var IdentityManager = class {
587
590
  onNetworkConnection: () => {
588
591
  },
589
592
  onAuthFailure: () => {
590
- import_log3.log.warn("auth failure", {}, {
591
- file: "identity-manager.ts",
592
- line: 245,
593
- scope: this,
594
- callSite: (f, a) => f(...a)
593
+ import_log3.log.warn("auth failure", void 0, {
594
+ F: __dxlog_file3,
595
+ L: 245,
596
+ S: this,
597
+ C: (f, a) => f(...a)
595
598
  });
596
599
  },
597
600
  memberKey: identityKey
@@ -600,7 +603,7 @@ var IdentityManager = class {
600
603
  };
601
604
 
602
605
  // packages/sdk/client-services/src/packlets/identity/identity-service.ts
603
- var import_node_assert3 = __toESM(require("node:assert"));
606
+ var import_tiny_invariant3 = __toESM(require("tiny-invariant"));
604
607
  var import_codec_protobuf = require("@dxos/codec-protobuf");
605
608
  var import_credentials7 = require("@dxos/credentials");
606
609
  var import_debug2 = require("@dxos/debug");
@@ -636,7 +639,7 @@ var IdentityServiceImpl = class {
636
639
  };
637
640
  }
638
641
  async signPresentation({ presentation, nonce }) {
639
- (0, import_node_assert3.default)(this._serviceContext.identityManager.identity, "Identity not initialized.");
642
+ (0, import_tiny_invariant3.default)(this._serviceContext.identityManager.identity, "Identity not initialized.");
640
643
  return await (0, import_credentials7.signPresentation)({
641
644
  presentation,
642
645
  signer: this._serviceContext.keyring,
@@ -648,7 +651,7 @@ var IdentityServiceImpl = class {
648
651
  };
649
652
 
650
653
  // packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts
651
- var import_node_assert4 = __toESM(require("node:assert"));
654
+ var import_tiny_invariant4 = __toESM(require("tiny-invariant"));
652
655
  var import_services = require("@dxos/protocols/proto/dxos/client/services");
653
656
  var DeviceInvitationProtocol = class {
654
657
  constructor(_keyring, _getIdentity, _acceptIdentity) {
@@ -665,7 +668,7 @@ var DeviceInvitationProtocol = class {
665
668
  };
666
669
  }
667
670
  async admit(request) {
668
- (0, import_node_assert4.default)(request.device);
671
+ (0, import_tiny_invariant4.default)(request.device);
669
672
  const identity = this._getIdentity();
670
673
  await identity.admitDevice(request.device);
671
674
  return {
@@ -693,9 +696,9 @@ var DeviceInvitationProtocol = class {
693
696
  };
694
697
  }
695
698
  async accept(response, request) {
696
- (0, import_node_assert4.default)(response.device);
699
+ (0, import_tiny_invariant4.default)(response.device);
697
700
  const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
698
- (0, import_node_assert4.default)(request.device);
701
+ (0, import_tiny_invariant4.default)(request.device);
699
702
  const { deviceKey, controlFeedKey, dataFeedKey } = request.device;
700
703
  await this._acceptIdentity({
701
704
  identityKey,
@@ -713,7 +716,7 @@ var DeviceInvitationProtocol = class {
713
716
  };
714
717
 
715
718
  // packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
716
- var import_node_assert6 = __toESM(require("node:assert"));
719
+ var import_tiny_invariant6 = __toESM(require("tiny-invariant"));
717
720
  var import_async5 = require("@dxos/async");
718
721
  var import_client_protocol2 = require("@dxos/client-protocol");
719
722
  var import_context3 = require("@dxos/context");
@@ -727,7 +730,7 @@ var import_services3 = require("@dxos/protocols/proto/dxos/client/services");
727
730
  var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
728
731
 
729
732
  // packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
730
- var import_node_assert5 = __toESM(require("node:assert"));
733
+ var import_tiny_invariant5 = __toESM(require("tiny-invariant"));
731
734
  var import_async4 = require("@dxos/async");
732
735
  var import_context2 = require("@dxos/context");
733
736
  var import_errors = require("@dxos/errors");
@@ -737,6 +740,7 @@ var import_protocols3 = require("@dxos/protocols");
737
740
  var import_services2 = require("@dxos/protocols/proto/dxos/client/services");
738
741
  var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
739
742
  var import_teleport = require("@dxos/teleport");
743
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts";
740
744
  var OPTIONS_TIMEOUT = 1e4;
741
745
  var MAX_OTP_ATTEMPTS = 3;
742
746
  var InvitationHostExtension = class extends import_teleport.RpcExtension {
@@ -764,7 +768,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
764
768
  // Perhaps in the future we will have more complex logic here.
765
769
  InvitationHostService: {
766
770
  options: async (options) => {
767
- (0, import_node_assert5.default)(!this._remoteOptions, "Remote options already set.");
771
+ (0, import_tiny_invariant5.default)(!this._remoteOptions, "Remote options already set.");
768
772
  this._remoteOptions = options;
769
773
  this._remoteOptionsTrigger.wake();
770
774
  },
@@ -774,20 +778,20 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
774
778
  import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.begin({
775
779
  id: traceId
776
780
  }), {
777
- file: "invitation-extension.ts",
778
- line: 98,
779
- scope: this,
780
- callSite: (f, a) => f(...a)
781
+ F: __dxlog_file4,
782
+ L: 98,
783
+ S: this,
784
+ C: (f, a) => f(...a)
781
785
  });
782
786
  const invitation = await this._callbacks.resolveInvitation(request);
783
787
  if (!invitation) {
784
788
  import_log4.log.warn("invitation not found", {
785
789
  invitationId
786
790
  }, {
787
- file: "invitation-extension.ts",
788
- line: 102,
789
- scope: this,
790
- callSite: (f, a) => f(...a)
791
+ F: __dxlog_file4,
792
+ L: 102,
793
+ S: this,
794
+ C: (f, a) => f(...a)
791
795
  });
792
796
  this._callbacks.onError(new Error("Invitation not found."));
793
797
  return {
@@ -798,10 +802,10 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
798
802
  (0, import_log4.log)("guest introduced itself", {
799
803
  guestProfile: profile
800
804
  }, {
801
- file: "invitation-extension.ts",
802
- line: 111,
803
- scope: this,
804
- callSite: (f, a) => f(...a)
805
+ F: __dxlog_file4,
806
+ L: 111,
807
+ S: this,
808
+ C: (f, a) => f(...a)
805
809
  });
806
810
  this.guestProfile = profile;
807
811
  this._callbacks.onStateUpdate({
@@ -811,10 +815,10 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
811
815
  import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.end({
812
816
  id: traceId
813
817
  }), {
814
- file: "invitation-extension.ts",
815
- line: 118,
816
- scope: this,
817
- callSite: (f, a) => f(...a)
818
+ F: __dxlog_file4,
819
+ L: 118,
820
+ S: this,
821
+ C: (f, a) => f(...a)
818
822
  });
819
823
  return {
820
824
  spaceKey: this.invitation.authMethod === import_services2.Invitation.AuthMethod.NONE ? this.invitation.spaceKey : void 0,
@@ -826,28 +830,28 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
826
830
  import_log4.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols3.trace.begin({
827
831
  id: traceId
828
832
  }), {
829
- file: "invitation-extension.ts",
830
- line: 127,
831
- scope: this,
832
- callSite: (f, a) => f(...a)
833
+ F: __dxlog_file4,
834
+ L: 127,
835
+ S: this,
836
+ C: (f, a) => f(...a)
833
837
  });
834
838
  (0, import_log4.log)("received authentication request", {
835
839
  authCode: code
836
840
  }, {
837
- file: "invitation-extension.ts",
838
- line: 128,
839
- scope: this,
840
- callSite: (f, a) => f(...a)
841
+ F: __dxlog_file4,
842
+ L: 128,
843
+ S: this,
844
+ C: (f, a) => f(...a)
841
845
  });
842
846
  let status = import_invitations.AuthenticationResponse.Status.OK;
843
- (0, import_node_assert5.default)(this.invitation, "Invitation is not set.");
847
+ (0, import_tiny_invariant5.default)(this.invitation, "Invitation is not set.");
844
848
  switch (this.invitation.authMethod) {
845
849
  case import_services2.Invitation.AuthMethod.NONE: {
846
- (0, import_log4.log)("authentication not required", {}, {
847
- file: "invitation-extension.ts",
848
- line: 134,
849
- scope: this,
850
- callSite: (f, a) => f(...a)
850
+ (0, import_log4.log)("authentication not required", void 0, {
851
+ F: __dxlog_file4,
852
+ L: 134,
853
+ S: this,
854
+ C: (f, a) => f(...a)
851
855
  });
852
856
  return {
853
857
  status: import_invitations.AuthenticationResponse.Status.OK
@@ -869,10 +873,10 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
869
873
  import_log4.log.error("invalid authentication method", {
870
874
  authMethod: this.invitation.authMethod
871
875
  }, {
872
- file: "invitation-extension.ts",
873
- line: 152,
874
- scope: this,
875
- callSite: (f, a) => f(...a)
876
+ F: __dxlog_file4,
877
+ L: 152,
878
+ S: this,
879
+ C: (f, a) => f(...a)
876
880
  });
877
881
  status = import_invitations.AuthenticationResponse.Status.INTERNAL_ERROR;
878
882
  break;
@@ -884,10 +888,10 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
884
888
  status
885
889
  }
886
890
  }), {
887
- file: "invitation-extension.ts",
888
- line: 158,
889
- scope: this,
890
- callSite: (f, a) => f(...a)
891
+ F: __dxlog_file4,
892
+ L: 158,
893
+ S: this,
894
+ C: (f, a) => f(...a)
891
895
  });
892
896
  return {
893
897
  status
@@ -898,13 +902,13 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
898
902
  import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.begin({
899
903
  id: traceId
900
904
  }), {
901
- file: "invitation-extension.ts",
902
- line: 164,
903
- scope: this,
904
- callSite: (f, a) => f(...a)
905
+ F: __dxlog_file4,
906
+ L: 164,
907
+ S: this,
908
+ C: (f, a) => f(...a)
905
909
  });
906
910
  try {
907
- (0, import_node_assert5.default)(this.invitation, "Invitation is not set.");
911
+ (0, import_tiny_invariant5.default)(this.invitation, "Invitation is not set.");
908
912
  if (isAuthenticationRequired(this.invitation) && !this.authenticationPassed) {
909
913
  throw new Error("Not authenticated");
910
914
  }
@@ -912,10 +916,10 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
912
916
  import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.end({
913
917
  id: traceId
914
918
  }), {
915
- file: "invitation-extension.ts",
916
- line: 175,
917
- scope: this,
918
- callSite: (f, a) => f(...a)
919
+ F: __dxlog_file4,
920
+ L: 175,
921
+ S: this,
922
+ C: (f, a) => f(...a)
919
923
  });
920
924
  return response;
921
925
  } catch (err) {
@@ -969,7 +973,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
969
973
  return {
970
974
  InvitationHostService: {
971
975
  options: async (options) => {
972
- (0, import_node_assert5.default)(!this._remoteOptions, "Remote options already set.");
976
+ (0, import_tiny_invariant5.default)(!this._remoteOptions, "Remote options already set.");
973
977
  this._remoteOptions = options;
974
978
  this._remoteOptionsTrigger.wake();
975
979
  },
@@ -989,11 +993,11 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
989
993
  var _a;
990
994
  await super.onOpen(context);
991
995
  try {
992
- (0, import_log4.log)("begin options", {}, {
993
- file: "invitation-extension.ts",
994
- line: 263,
995
- scope: this,
996
- callSite: (f, a) => f(...a)
996
+ (0, import_log4.log)("begin options", void 0, {
997
+ F: __dxlog_file4,
998
+ L: 263,
999
+ S: this,
1000
+ C: (f, a) => f(...a)
997
1001
  });
998
1002
  await (0, import_context2.cancelWithContext)(this._ctx, this.rpc.InvitationHostService.options({
999
1003
  role: import_invitations.Options.Role.GUEST
@@ -1001,11 +1005,11 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1001
1005
  await (0, import_context2.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
1002
1006
  timeout: OPTIONS_TIMEOUT
1003
1007
  }));
1004
- (0, import_log4.log)("end options", {}, {
1005
- file: "invitation-extension.ts",
1006
- line: 266,
1007
- scope: this,
1008
- callSite: (f, a) => f(...a)
1008
+ (0, import_log4.log)("end options", void 0, {
1009
+ F: __dxlog_file4,
1010
+ L: 266,
1011
+ S: this,
1012
+ C: (f, a) => f(...a)
1009
1013
  });
1010
1014
  if (((_a = this._remoteOptions) == null ? void 0 : _a.role) !== import_invitations.Options.Role.HOST) {
1011
1015
  throw new import_errors.InvalidInvitationExtensionRoleError(void 0, {
@@ -1016,20 +1020,20 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1016
1020
  this._callbacks.onOpen(this._ctx);
1017
1021
  } catch (err) {
1018
1022
  (0, import_log4.log)("openError", err, {
1019
- file: "invitation-extension.ts",
1020
- line: 276,
1021
- scope: this,
1022
- callSite: (f, a) => f(...a)
1023
+ F: __dxlog_file4,
1024
+ L: 276,
1025
+ S: this,
1026
+ C: (f, a) => f(...a)
1023
1027
  });
1024
1028
  this._callbacks.onError(err);
1025
1029
  }
1026
1030
  }
1027
1031
  async onClose() {
1028
- (0, import_log4.log)("onClose", {}, {
1029
- file: "invitation-extension.ts",
1030
- line: 282,
1031
- scope: this,
1032
- callSite: (f, a) => f(...a)
1032
+ (0, import_log4.log)("onClose", void 0, {
1033
+ F: __dxlog_file4,
1034
+ L: 282,
1035
+ S: this,
1036
+ C: (f, a) => f(...a)
1033
1037
  });
1034
1038
  await this._ctx.dispose();
1035
1039
  }
@@ -1037,6 +1041,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
1037
1041
  var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services2.Invitation.AuthMethod.NONE;
1038
1042
 
1039
1043
  // packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
1044
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
1040
1045
  var InvitationsHandler = class {
1041
1046
  /**
1042
1047
  * @internal
@@ -1048,7 +1053,7 @@ var InvitationsHandler = class {
1048
1053
  var _a;
1049
1054
  const { invitationId = import_keys4.PublicKey.random().toHex(), type = import_services3.Invitation.Type.INTERACTIVE, authMethod = import_services3.Invitation.AuthMethod.SHARED_SECRET, state = import_services3.Invitation.State.INIT, timeout = import_client_protocol2.INVITATION_TIMEOUT, swarmKey = import_keys4.PublicKey.random() } = options != null ? options : {};
1050
1055
  const authCode = (_a = options == null ? void 0 : options.authCode) != null ? _a : authMethod === import_services3.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials8.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0;
1051
- (0, import_node_assert6.default)(protocol);
1056
+ (0, import_tiny_invariant6.default)(protocol);
1052
1057
  const invitation = {
1053
1058
  invitationId,
1054
1059
  type,
@@ -1070,10 +1075,10 @@ var InvitationsHandler = class {
1070
1075
  (0, import_log5.log)("complete", {
1071
1076
  ...protocol.toJSON()
1072
1077
  }, {
1073
- file: "invitations-handler.ts",
1074
- line: 99,
1075
- scope: this,
1076
- callSite: (f, a) => f(...a)
1078
+ F: __dxlog_file5,
1079
+ L: 99,
1080
+ S: this,
1081
+ C: (f, a) => f(...a)
1077
1082
  });
1078
1083
  stream.complete();
1079
1084
  });
@@ -1095,7 +1100,7 @@ var InvitationsHandler = class {
1095
1100
  var _a2, _b, _c;
1096
1101
  try {
1097
1102
  const deviceKey = (_c = (_a2 = admissionRequest.device) == null ? void 0 : _a2.deviceKey) != null ? _c : (_b = admissionRequest.space) == null ? void 0 : _b.deviceKey;
1098
- (0, import_node_assert6.default)(deviceKey);
1103
+ (0, import_tiny_invariant6.default)(deviceKey);
1099
1104
  const admissionResponse = await protocol.admit(admissionRequest, extension.guestProfile);
1100
1105
  extension.completedTrigger.wake(deviceKey);
1101
1106
  return admissionResponse;
@@ -1111,18 +1116,18 @@ var InvitationsHandler = class {
1111
1116
  import_log5.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.begin({
1112
1117
  id: traceId
1113
1118
  }), {
1114
- file: "invitations-handler.ts",
1115
- line: 138,
1116
- scope: this,
1117
- callSite: (f, a) => f(...a)
1119
+ F: __dxlog_file5,
1120
+ L: 138,
1121
+ S: this,
1122
+ C: (f, a) => f(...a)
1118
1123
  });
1119
1124
  (0, import_log5.log)("connected", {
1120
1125
  ...protocol.toJSON()
1121
1126
  }, {
1122
- file: "invitations-handler.ts",
1123
- line: 139,
1124
- scope: this,
1125
- callSite: (f, a) => f(...a)
1127
+ F: __dxlog_file5,
1128
+ L: 139,
1129
+ S: this,
1130
+ C: (f, a) => f(...a)
1126
1131
  });
1127
1132
  stream.next({
1128
1133
  ...invitation,
@@ -1135,10 +1140,10 @@ var InvitationsHandler = class {
1135
1140
  guest: deviceKey,
1136
1141
  ...protocol.toJSON()
1137
1142
  }, {
1138
- file: "invitations-handler.ts",
1139
- line: 142,
1140
- scope: this,
1141
- callSite: (f, a) => f(...a)
1143
+ F: __dxlog_file5,
1144
+ L: 142,
1145
+ S: this,
1146
+ C: (f, a) => f(...a)
1142
1147
  });
1143
1148
  stream.next({
1144
1149
  ...invitation,
@@ -1147,20 +1152,20 @@ var InvitationsHandler = class {
1147
1152
  import_log5.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.end({
1148
1153
  id: traceId
1149
1154
  }), {
1150
- file: "invitations-handler.ts",
1151
- line: 144,
1152
- scope: this,
1153
- callSite: (f, a) => f(...a)
1155
+ F: __dxlog_file5,
1156
+ L: 144,
1157
+ S: this,
1158
+ C: (f, a) => f(...a)
1154
1159
  });
1155
1160
  } catch (err) {
1156
1161
  if (err instanceof import_async5.TimeoutError) {
1157
1162
  (0, import_log5.log)("timeout", {
1158
1163
  ...protocol.toJSON()
1159
1164
  }, {
1160
- file: "invitations-handler.ts",
1161
- line: 147,
1162
- scope: this,
1163
- callSite: (f, a) => f(...a)
1165
+ F: __dxlog_file5,
1166
+ L: 147,
1167
+ S: this,
1168
+ C: (f, a) => f(...a)
1164
1169
  });
1165
1170
  stream.next({
1166
1171
  ...invitation,
@@ -1168,10 +1173,10 @@ var InvitationsHandler = class {
1168
1173
  });
1169
1174
  } else {
1170
1175
  import_log5.log.error("failed", err, {
1171
- file: "invitations-handler.ts",
1172
- line: 150,
1173
- scope: this,
1174
- callSite: (f, a) => f(...a)
1176
+ F: __dxlog_file5,
1177
+ L: 150,
1178
+ S: this,
1179
+ C: (f, a) => f(...a)
1175
1180
  });
1176
1181
  stream.error(err);
1177
1182
  }
@@ -1179,10 +1184,10 @@ var InvitationsHandler = class {
1179
1184
  id: traceId,
1180
1185
  error: err
1181
1186
  }), {
1182
- file: "invitations-handler.ts",
1183
- line: 153,
1184
- scope: this,
1185
- callSite: (f, a) => f(...a)
1187
+ F: __dxlog_file5,
1188
+ L: 153,
1189
+ S: this,
1190
+ C: (f, a) => f(...a)
1186
1191
  });
1187
1192
  } finally {
1188
1193
  if (type !== import_services3.Invitation.Type.MULTIUSE) {
@@ -1200,10 +1205,10 @@ var InvitationsHandler = class {
1200
1205
  (0, import_log5.log)("timeout", {
1201
1206
  ...protocol.toJSON()
1202
1207
  }, {
1203
- file: "invitations-handler.ts",
1204
- line: 168,
1205
- scope: this,
1206
- callSite: (f, a) => f(...a)
1208
+ F: __dxlog_file5,
1209
+ L: 168,
1210
+ S: this,
1211
+ C: (f, a) => f(...a)
1207
1212
  });
1208
1213
  stream.next({
1209
1214
  ...invitation,
@@ -1211,10 +1216,10 @@ var InvitationsHandler = class {
1211
1216
  });
1212
1217
  } else {
1213
1218
  import_log5.log.error("failed", err, {
1214
- file: "invitations-handler.ts",
1215
- line: 171,
1216
- scope: this,
1217
- callSite: (f, a) => f(...a)
1219
+ F: __dxlog_file5,
1220
+ L: 171,
1221
+ S: this,
1222
+ C: (f, a) => f(...a)
1218
1223
  });
1219
1224
  stream.error(err);
1220
1225
  }
@@ -1254,13 +1259,13 @@ var InvitationsHandler = class {
1254
1259
  }
1255
1260
  acceptInvitation(protocol, invitation) {
1256
1261
  const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
1257
- (0, import_node_assert6.default)(protocol);
1262
+ (0, import_tiny_invariant6.default)(protocol);
1258
1263
  const authenticated = new import_async5.Trigger();
1259
1264
  let admitted = false;
1260
1265
  let currentState;
1261
1266
  const stream = new import_async5.PushStream();
1262
1267
  const setState = (newData) => {
1263
- (0, import_node_assert6.default)(newData.state !== void 0);
1268
+ (0, import_tiny_invariant6.default)(newData.state !== void 0);
1264
1269
  currentState = newData.state;
1265
1270
  stream.next({
1266
1271
  ...invitation,
@@ -1273,20 +1278,20 @@ var InvitationsHandler = class {
1273
1278
  (0, import_log5.log)("timeout", {
1274
1279
  ...protocol.toJSON()
1275
1280
  }, {
1276
- file: "invitations-handler.ts",
1277
- line: 230,
1278
- scope: this,
1279
- callSite: (f, a) => f(...a)
1281
+ F: __dxlog_file5,
1282
+ L: 230,
1283
+ S: this,
1284
+ C: (f, a) => f(...a)
1280
1285
  });
1281
1286
  setState({
1282
1287
  state: import_services3.Invitation.State.TIMEOUT
1283
1288
  });
1284
1289
  } else {
1285
1290
  import_log5.log.warn("auth failed", err, {
1286
- file: "invitations-handler.ts",
1287
- line: 233,
1288
- scope: this,
1289
- callSite: (f, a) => f(...a)
1291
+ F: __dxlog_file5,
1292
+ L: 233,
1293
+ S: this,
1294
+ C: (f, a) => f(...a)
1290
1295
  });
1291
1296
  stream.error(err);
1292
1297
  }
@@ -1297,10 +1302,10 @@ var InvitationsHandler = class {
1297
1302
  (0, import_log5.log)("complete", {
1298
1303
  ...protocol.toJSON()
1299
1304
  }, {
1300
- file: "invitations-handler.ts",
1301
- line: 241,
1302
- scope: this,
1303
- callSite: (f, a) => f(...a)
1305
+ F: __dxlog_file5,
1306
+ L: 241,
1307
+ S: this,
1308
+ C: (f, a) => f(...a)
1304
1309
  });
1305
1310
  stream.complete();
1306
1311
  });
@@ -1312,10 +1317,10 @@ var InvitationsHandler = class {
1312
1317
  (0, import_log5.log)("extension disposed", {
1313
1318
  currentState
1314
1319
  }, {
1315
- file: "invitations-handler.ts",
1316
- line: 251,
1317
- scope: this,
1318
- callSite: (f, a) => f(...a)
1320
+ F: __dxlog_file5,
1321
+ L: 251,
1322
+ S: this,
1323
+ C: (f, a) => f(...a)
1319
1324
  });
1320
1325
  if (!admitted) {
1321
1326
  stream.error(new Error("Remote peer disconnected."));
@@ -1327,10 +1332,10 @@ var InvitationsHandler = class {
1327
1332
  import_log5.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.begin({
1328
1333
  id: traceId
1329
1334
  }), {
1330
- file: "invitations-handler.ts",
1331
- line: 260,
1332
- scope: this,
1333
- callSite: (f, a) => f(...a)
1335
+ F: __dxlog_file5,
1336
+ L: 260,
1337
+ S: this,
1338
+ C: (f, a) => f(...a)
1334
1339
  });
1335
1340
  if (++connectionCount > 1) {
1336
1341
  throw new Error(`multiple connections detected: ${connectionCount}`);
@@ -1339,10 +1344,10 @@ var InvitationsHandler = class {
1339
1344
  (0, import_log5.log)("connected", {
1340
1345
  ...protocol.toJSON()
1341
1346
  }, {
1342
- file: "invitations-handler.ts",
1343
- line: 268,
1344
- scope: this,
1345
- callSite: (f, a) => f(...a)
1347
+ F: __dxlog_file5,
1348
+ L: 268,
1349
+ S: this,
1350
+ C: (f, a) => f(...a)
1346
1351
  });
1347
1352
  setState({
1348
1353
  state: import_services3.Invitation.State.CONNECTED
@@ -1350,20 +1355,20 @@ var InvitationsHandler = class {
1350
1355
  (0, import_log5.log)("introduce", {
1351
1356
  ...protocol.toJSON()
1352
1357
  }, {
1353
- file: "invitations-handler.ts",
1354
- line: 272,
1355
- scope: this,
1356
- callSite: (f, a) => f(...a)
1358
+ F: __dxlog_file5,
1359
+ L: 272,
1360
+ S: this,
1361
+ C: (f, a) => f(...a)
1357
1362
  });
1358
1363
  const introductionResponse = await extension.rpc.InvitationHostService.introduce(protocol.createIntroduction());
1359
1364
  (0, import_log5.log)("introduce response", {
1360
1365
  ...protocol.toJSON(),
1361
1366
  response: introductionResponse
1362
1367
  }, {
1363
- file: "invitations-handler.ts",
1364
- line: 276,
1365
- scope: this,
1366
- callSite: (f, a) => f(...a)
1368
+ F: __dxlog_file5,
1369
+ L: 276,
1370
+ S: this,
1371
+ C: (f, a) => f(...a)
1367
1372
  });
1368
1373
  invitation.authMethod = introductionResponse.authMethod;
1369
1374
  if (introductionResponse.spaceKey) {
@@ -1371,11 +1376,11 @@ var InvitationsHandler = class {
1371
1376
  }
1372
1377
  if (isAuthenticationRequired(invitation)) {
1373
1378
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
1374
- (0, import_log5.log)("guest waiting for authentication code...", {}, {
1375
- file: "invitations-handler.ts",
1376
- line: 285,
1377
- scope: this,
1378
- callSite: (f, a) => f(...a)
1379
+ (0, import_log5.log)("guest waiting for authentication code...", void 0, {
1380
+ F: __dxlog_file5,
1381
+ L: 285,
1382
+ S: this,
1383
+ C: (f, a) => f(...a)
1379
1384
  });
1380
1385
  setState({
1381
1386
  state: import_services3.Invitation.State.READY_FOR_AUTHENTICATION
@@ -1383,11 +1388,11 @@ var InvitationsHandler = class {
1383
1388
  const authCode = await authenticated.wait({
1384
1389
  timeout
1385
1390
  });
1386
- (0, import_log5.log)("sending authentication request", {}, {
1387
- file: "invitations-handler.ts",
1388
- line: 289,
1389
- scope: this,
1390
- callSite: (f, a) => f(...a)
1391
+ (0, import_log5.log)("sending authentication request", void 0, {
1392
+ F: __dxlog_file5,
1393
+ L: 289,
1394
+ S: this,
1395
+ C: (f, a) => f(...a)
1391
1396
  });
1392
1397
  setState({
1393
1398
  state: import_services3.Invitation.State.AUTHENTICATING
@@ -1405,10 +1410,10 @@ var InvitationsHandler = class {
1405
1410
  (0, import_log5.log)("retrying invalid code", {
1406
1411
  attempt
1407
1412
  }, {
1408
- file: "invitations-handler.ts",
1409
- line: 300,
1410
- scope: this,
1411
- callSite: (f, a) => f(...a)
1413
+ F: __dxlog_file5,
1414
+ L: 300,
1415
+ S: this,
1416
+ C: (f, a) => f(...a)
1412
1417
  });
1413
1418
  authenticated.reset();
1414
1419
  }
@@ -1422,10 +1427,10 @@ var InvitationsHandler = class {
1422
1427
  (0, import_log5.log)("request admission", {
1423
1428
  ...protocol.toJSON()
1424
1429
  }, {
1425
- file: "invitations-handler.ts",
1426
- line: 311,
1427
- scope: this,
1428
- callSite: (f, a) => f(...a)
1430
+ F: __dxlog_file5,
1431
+ L: 311,
1432
+ S: this,
1433
+ C: (f, a) => f(...a)
1429
1434
  });
1430
1435
  const admissionRequest = await protocol.createAdmissionRequest();
1431
1436
  const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
@@ -1434,10 +1439,10 @@ var InvitationsHandler = class {
1434
1439
  (0, import_log5.log)("admitted by host", {
1435
1440
  ...protocol.toJSON()
1436
1441
  }, {
1437
- file: "invitations-handler.ts",
1438
- line: 322,
1439
- scope: this,
1440
- callSite: (f, a) => f(...a)
1442
+ F: __dxlog_file5,
1443
+ L: 322,
1444
+ S: this,
1445
+ C: (f, a) => f(...a)
1441
1446
  });
1442
1447
  setState({
1443
1448
  ...result,
@@ -1446,30 +1451,30 @@ var InvitationsHandler = class {
1446
1451
  import_log5.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.end({
1447
1452
  id: traceId
1448
1453
  }), {
1449
- file: "invitations-handler.ts",
1450
- line: 324,
1451
- scope: this,
1452
- callSite: (f, a) => f(...a)
1454
+ F: __dxlog_file5,
1455
+ L: 324,
1456
+ S: this,
1457
+ C: (f, a) => f(...a)
1453
1458
  });
1454
1459
  } catch (err) {
1455
1460
  if (err instanceof import_async5.TimeoutError) {
1456
1461
  (0, import_log5.log)("timeout", {
1457
1462
  ...protocol.toJSON()
1458
1463
  }, {
1459
- file: "invitations-handler.ts",
1460
- line: 327,
1461
- scope: this,
1462
- callSite: (f, a) => f(...a)
1464
+ F: __dxlog_file5,
1465
+ L: 327,
1466
+ S: this,
1467
+ C: (f, a) => f(...a)
1463
1468
  });
1464
1469
  setState({
1465
1470
  state: import_services3.Invitation.State.TIMEOUT
1466
1471
  });
1467
1472
  } else {
1468
1473
  (0, import_log5.log)("auth failed", err, {
1469
- file: "invitations-handler.ts",
1470
- line: 330,
1471
- scope: this,
1472
- callSite: (f, a) => f(...a)
1474
+ F: __dxlog_file5,
1475
+ L: 330,
1476
+ S: this,
1477
+ C: (f, a) => f(...a)
1473
1478
  });
1474
1479
  stream.error(err);
1475
1480
  }
@@ -1477,10 +1482,10 @@ var InvitationsHandler = class {
1477
1482
  id: traceId,
1478
1483
  error: err
1479
1484
  }), {
1480
- file: "invitations-handler.ts",
1481
- line: 333,
1482
- scope: this,
1483
- callSite: (f, a) => f(...a)
1485
+ F: __dxlog_file5,
1486
+ L: 333,
1487
+ S: this,
1488
+ C: (f, a) => f(...a)
1484
1489
  });
1485
1490
  } finally {
1486
1491
  await ctx.dispose();
@@ -1495,20 +1500,20 @@ var InvitationsHandler = class {
1495
1500
  (0, import_log5.log)("timeout", {
1496
1501
  ...protocol.toJSON()
1497
1502
  }, {
1498
- file: "invitations-handler.ts",
1499
- line: 344,
1500
- scope: this,
1501
- callSite: (f, a) => f(...a)
1503
+ F: __dxlog_file5,
1504
+ L: 344,
1505
+ S: this,
1506
+ C: (f, a) => f(...a)
1502
1507
  });
1503
1508
  setState({
1504
1509
  state: import_services3.Invitation.State.TIMEOUT
1505
1510
  });
1506
1511
  } else {
1507
1512
  (0, import_log5.log)("auth failed", err, {
1508
- file: "invitations-handler.ts",
1509
- line: 347,
1510
- scope: this,
1511
- callSite: (f, a) => f(...a)
1513
+ F: __dxlog_file5,
1514
+ L: 347,
1515
+ S: this,
1516
+ C: (f, a) => f(...a)
1512
1517
  });
1513
1518
  stream.error(err);
1514
1519
  }
@@ -1517,7 +1522,7 @@ var InvitationsHandler = class {
1517
1522
  return extension;
1518
1523
  };
1519
1524
  (0, import_async5.scheduleTask)(ctx, async () => {
1520
- (0, import_node_assert6.default)(invitation.swarmKey);
1525
+ (0, import_tiny_invariant6.default)(invitation.swarmKey);
1521
1526
  const topic = invitation.swarmKey;
1522
1527
  const swarmConnection = await this._networkManager.joinSwarm({
1523
1528
  topic,
@@ -1550,11 +1555,12 @@ var InvitationsHandler = class {
1550
1555
  };
1551
1556
 
1552
1557
  // packages/sdk/client-services/src/packlets/invitations/invitations-service.ts
1553
- var import_node_assert7 = __toESM(require("node:assert"));
1558
+ var import_tiny_invariant7 = __toESM(require("tiny-invariant"));
1554
1559
  var import_async6 = require("@dxos/async");
1555
1560
  var import_codec_protobuf2 = require("@dxos/codec-protobuf");
1556
1561
  var import_log6 = require("@dxos/log");
1557
1562
  var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
1563
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
1558
1564
  var InvitationsServiceImpl = class {
1559
1565
  constructor(_invitationsHandler, _getHandler) {
1560
1566
  this._invitationsHandler = _invitationsHandler;
@@ -1615,35 +1621,35 @@ var InvitationsServiceImpl = class {
1615
1621
  });
1616
1622
  }
1617
1623
  async authenticate({ invitationId, authCode }) {
1618
- (0, import_log6.log)("authenticating...", {}, {
1619
- file: "invitations-service.ts",
1620
- line: 103,
1621
- scope: this,
1622
- callSite: (f, a) => f(...a)
1624
+ (0, import_log6.log)("authenticating...", void 0, {
1625
+ F: __dxlog_file6,
1626
+ L: 103,
1627
+ S: this,
1628
+ C: (f, a) => f(...a)
1623
1629
  });
1624
- (0, import_node_assert7.default)(invitationId);
1630
+ (0, import_tiny_invariant7.default)(invitationId);
1625
1631
  const observable = this._acceptInvitations.get(invitationId);
1626
1632
  if (!observable) {
1627
1633
  import_log6.log.warn("invalid invitation", {
1628
1634
  invitationId
1629
1635
  }, {
1630
- file: "invitations-service.ts",
1631
- line: 107,
1632
- scope: this,
1633
- callSite: (f, a) => f(...a)
1636
+ F: __dxlog_file6,
1637
+ L: 107,
1638
+ S: this,
1639
+ C: (f, a) => f(...a)
1634
1640
  });
1635
1641
  } else {
1636
1642
  await observable.authenticate(authCode);
1637
1643
  }
1638
1644
  }
1639
1645
  async cancelInvitation({ invitationId }) {
1640
- (0, import_log6.log)("deleting...", {}, {
1641
- file: "invitations-service.ts",
1642
- line: 114,
1643
- scope: this,
1644
- callSite: (f, a) => f(...a)
1646
+ (0, import_log6.log)("deleting...", void 0, {
1647
+ F: __dxlog_file6,
1648
+ L: 114,
1649
+ S: this,
1650
+ C: (f, a) => f(...a)
1645
1651
  });
1646
- (0, import_node_assert7.default)(invitationId);
1652
+ (0, import_tiny_invariant7.default)(invitationId);
1647
1653
  const created = this._createInvitations.get(invitationId);
1648
1654
  const accepted = this._acceptInvitations.get(invitationId);
1649
1655
  if (created) {
@@ -1658,10 +1664,10 @@ var InvitationsServiceImpl = class {
1658
1664
  import_log6.log.warn("invalid invitation", {
1659
1665
  invitationId
1660
1666
  }, {
1661
- file: "invitations-service.ts",
1662
- line: 127,
1663
- scope: this,
1664
- callSite: (f, a) => f(...a)
1667
+ F: __dxlog_file6,
1668
+ L: 127,
1669
+ S: this,
1670
+ C: (f, a) => f(...a)
1665
1671
  });
1666
1672
  }
1667
1673
  }
@@ -1718,11 +1724,12 @@ var InvitationsServiceImpl = class {
1718
1724
  };
1719
1725
 
1720
1726
  // packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts
1721
- var import_node_assert8 = __toESM(require("node:assert"));
1727
+ var import_tiny_invariant8 = __toESM(require("tiny-invariant"));
1722
1728
  var import_credentials9 = require("@dxos/credentials");
1723
1729
  var import_feed_store2 = require("@dxos/feed-store");
1724
1730
  var import_log7 = require("@dxos/log");
1725
1731
  var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
1732
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
1726
1733
  var SpaceInvitationProtocol = class {
1727
1734
  constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
1728
1735
  this._spaceManager = _spaceManager;
@@ -1744,24 +1751,24 @@ var SpaceInvitationProtocol = class {
1744
1751
  }
1745
1752
  async admit(request, guestProfile) {
1746
1753
  var _a;
1747
- (0, import_node_assert8.default)(this._spaceKey);
1754
+ (0, import_tiny_invariant8.default)(this._spaceKey);
1748
1755
  const space = await this._spaceManager.spaces.get(this._spaceKey);
1749
- (0, import_node_assert8.default)(space);
1750
- (0, import_node_assert8.default)(request.space);
1756
+ (0, import_tiny_invariant8.default)(space);
1757
+ (0, import_tiny_invariant8.default)(request.space);
1751
1758
  const { identityKey, deviceKey } = request.space;
1752
1759
  (0, import_log7.log)("writing guest credentials", {
1753
1760
  host: this._signingContext.deviceKey,
1754
1761
  guest: deviceKey
1755
1762
  }, {
1756
- file: "space-invitation-protocol.ts",
1757
- line: 50,
1758
- scope: this,
1759
- callSite: (f, a) => f(...a)
1763
+ F: __dxlog_file7,
1764
+ L: 50,
1765
+ S: this,
1766
+ C: (f, a) => f(...a)
1760
1767
  });
1761
1768
  const credentials = await (0, import_credentials9.createAdmissionCredentials)(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, guestProfile);
1762
- (0, import_node_assert8.default)(credentials[0].credential);
1769
+ (0, import_tiny_invariant8.default)(credentials[0].credential);
1763
1770
  const spaceMemberCredential = credentials[0].credential.credential;
1764
- (0, import_node_assert8.default)((0, import_credentials9.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
1771
+ (0, import_tiny_invariant8.default)((0, import_credentials9.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
1765
1772
  await (0, import_feed_store2.writeMessages)(space.inner.controlPipeline.writer, credentials);
1766
1773
  return {
1767
1774
  space: {
@@ -1789,11 +1796,11 @@ var SpaceInvitationProtocol = class {
1789
1796
  };
1790
1797
  }
1791
1798
  async accept(response) {
1792
- (0, import_node_assert8.default)(response.space);
1799
+ (0, import_tiny_invariant8.default)(response.space);
1793
1800
  const { credential, controlTimeframe, dataTimeframe } = response.space;
1794
1801
  const assertion = (0, import_credentials9.getCredentialAssertion)(credential);
1795
- (0, import_node_assert8.default)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential");
1796
- (0, import_node_assert8.default)(credential.subject.id.equals(this._signingContext.identityKey));
1802
+ (0, import_tiny_invariant8.default)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential");
1803
+ (0, import_tiny_invariant8.default)(credential.subject.id.equals(this._signingContext.identityKey));
1797
1804
  await this._spaceManager.acceptSpace({
1798
1805
  spaceKey: assertion.spaceKey,
1799
1806
  genesisFeedKey: assertion.genesisFeedKey,
@@ -1808,7 +1815,7 @@ var SpaceInvitationProtocol = class {
1808
1815
  };
1809
1816
 
1810
1817
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
1811
- var import_node_assert10 = __toESM(require("node:assert"));
1818
+ var import_tiny_invariant10 = __toESM(require("tiny-invariant"));
1812
1819
  var import_async9 = require("@dxos/async");
1813
1820
  var import_context6 = require("@dxos/context");
1814
1821
  var import_credentials13 = require("@dxos/credentials");
@@ -1834,7 +1841,7 @@ var import_timeframe = require("@dxos/timeframe");
1834
1841
  var import_util3 = require("@dxos/util");
1835
1842
 
1836
1843
  // packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
1837
- var import_node_assert9 = __toESM(require("node:assert"));
1844
+ var import_tiny_invariant9 = __toESM(require("tiny-invariant"));
1838
1845
  var import_async7 = require("@dxos/async");
1839
1846
  var import_context4 = require("@dxos/context");
1840
1847
  var import_keys5 = require("@dxos/keys");
@@ -1842,6 +1849,7 @@ var import_log8 = require("@dxos/log");
1842
1849
  var import_protocols5 = require("@dxos/protocols");
1843
1850
  var import_teleport2 = require("@dxos/teleport");
1844
1851
  var import_util2 = require("@dxos/util");
1852
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
1845
1853
  var DEFAULT_RETRY_TIMEOUT = 1e3;
1846
1854
  var DEFAULT_SUCCESS_DELAY = 1e3;
1847
1855
  var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
@@ -1866,22 +1874,22 @@ var NotarizationPlugin = class {
1866
1874
  (0, import_log8.log)("notarize", {
1867
1875
  credentials
1868
1876
  }, {
1869
- file: "notarization-plugin.ts",
1870
- line: 87,
1871
- scope: this,
1872
- callSite: (f, a) => f(...a)
1877
+ F: __dxlog_file8,
1878
+ L: 87,
1879
+ S: this,
1880
+ C: (f, a) => f(...a)
1873
1881
  });
1874
- (0, import_node_assert9.default)(credentials.every((credential) => credential.id), "Credentials must have an id");
1882
+ (0, import_tiny_invariant9.default)(credentials.every((credential) => credential.id), "Credentials must have an id");
1875
1883
  const errors = new import_async7.Trigger();
1876
1884
  const ctx = this._ctx.derive({
1877
1885
  onError: (err) => {
1878
1886
  import_log8.log.warn("Notarization error", {
1879
1887
  err
1880
1888
  }, {
1881
- file: "notarization-plugin.ts",
1882
- line: 96,
1883
- scope: this,
1884
- callSite: (f, a) => f(...a)
1889
+ F: __dxlog_file8,
1890
+ L: 96,
1891
+ S: this,
1892
+ C: (f, a) => f(...a)
1885
1893
  });
1886
1894
  void ctx.dispose();
1887
1895
  errors.throw(err);
@@ -1894,10 +1902,10 @@ var NotarizationPlugin = class {
1894
1902
  timeout,
1895
1903
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
1896
1904
  }, {
1897
- file: "notarization-plugin.ts",
1898
- line: 108,
1899
- scope: this,
1900
- callSite: (f, a) => f(...a)
1905
+ F: __dxlog_file8,
1906
+ L: 108,
1907
+ S: this,
1908
+ C: (f, a) => f(...a)
1901
1909
  });
1902
1910
  void ctx.dispose();
1903
1911
  errors.throw(new import_async7.TimeoutError(timeout, "Notarization timed out"));
@@ -1917,10 +1925,10 @@ var NotarizationPlugin = class {
1917
1925
  import_log8.log.warn("Exhausted all peers to notarize with", {
1918
1926
  retryIn: retryTimeout
1919
1927
  }, {
1920
- file: "notarization-plugin.ts",
1921
- line: 133,
1922
- scope: this,
1923
- callSite: (f, a) => f(...a)
1928
+ F: __dxlog_file8,
1929
+ L: 133,
1930
+ S: this,
1931
+ C: (f, a) => f(...a)
1924
1932
  });
1925
1933
  peersTried.clear();
1926
1934
  (0, import_async7.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
@@ -1931,28 +1939,28 @@ var NotarizationPlugin = class {
1931
1939
  peer: peer.localPeerId,
1932
1940
  credentialId: credentials.map((credential) => credential.id)
1933
1941
  }, {
1934
- file: "notarization-plugin.ts",
1935
- line: 140,
1936
- scope: this,
1937
- callSite: (f, a) => f(...a)
1942
+ F: __dxlog_file8,
1943
+ L: 140,
1944
+ S: this,
1945
+ C: (f, a) => f(...a)
1938
1946
  });
1939
1947
  await peer.rpc.NotarizationService.notarize({
1940
1948
  credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
1941
1949
  });
1942
- (0, import_log8.log)("success", {}, {
1943
- file: "notarization-plugin.ts",
1944
- line: 144,
1945
- scope: this,
1946
- callSite: (f, a) => f(...a)
1950
+ (0, import_log8.log)("success", void 0, {
1951
+ F: __dxlog_file8,
1952
+ L: 144,
1953
+ S: this,
1954
+ C: (f, a) => f(...a)
1947
1955
  });
1948
1956
  await (0, import_async7.sleep)(successDelay);
1949
1957
  } catch (err) {
1950
1958
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
1951
1959
  import_log8.log.warn("error notarizing (recoverable)", err, {
1952
- file: "notarization-plugin.ts",
1953
- line: 148,
1954
- scope: this,
1955
- callSite: (f, a) => f(...a)
1960
+ F: __dxlog_file8,
1961
+ L: 148,
1962
+ S: this,
1963
+ C: (f, a) => f(...a)
1956
1964
  });
1957
1965
  }
1958
1966
  notarizeTask.schedule();
@@ -1966,11 +1974,11 @@ var NotarizationPlugin = class {
1966
1974
  allNotarized,
1967
1975
  errors.wait()
1968
1976
  ]);
1969
- (0, import_log8.log)("done", {}, {
1970
- file: "notarization-plugin.ts",
1971
- line: 159,
1972
- scope: this,
1973
- callSite: (f, a) => f(...a)
1977
+ (0, import_log8.log)("done", void 0, {
1978
+ F: __dxlog_file8,
1979
+ L: 159,
1980
+ S: this,
1981
+ C: (f, a) => f(...a)
1974
1982
  });
1975
1983
  } finally {
1976
1984
  await ctx.dispose();
@@ -1989,7 +1997,7 @@ var NotarizationPlugin = class {
1989
1997
  this._processCredentialsTriggers.delete(credential.id);
1990
1998
  }
1991
1999
  setWriter(writer) {
1992
- (0, import_node_assert9.default)(!this._writer, "Writer already set.");
2000
+ (0, import_tiny_invariant9.default)(!this._writer, "Writer already set.");
1993
2001
  this._writer = writer;
1994
2002
  }
1995
2003
  async _waitUntilProcessed(id) {
@@ -2007,7 +2015,7 @@ var NotarizationPlugin = class {
2007
2015
  throw new Error(WRITER_NOT_SET_ERROR_CODE);
2008
2016
  }
2009
2017
  for (const credential of (_a = request.credentials) != null ? _a : []) {
2010
- (0, import_node_assert9.default)(credential.id, "Credential must have an id");
2018
+ (0, import_tiny_invariant9.default)(credential.id, "Credential must have an id");
2011
2019
  if (this._processedCredentials.has(credential.id)) {
2012
2020
  continue;
2013
2021
  }
@@ -2020,10 +2028,10 @@ var NotarizationPlugin = class {
2020
2028
  (0, import_log8.log)("extension opened", {
2021
2029
  peer: extension.localPeerId
2022
2030
  }, {
2023
- file: "notarization-plugin.ts",
2024
- line: 208,
2025
- scope: this,
2026
- callSite: (f, a) => f(...a)
2031
+ F: __dxlog_file8,
2032
+ L: 208,
2033
+ S: this,
2034
+ C: (f, a) => f(...a)
2027
2035
  });
2028
2036
  this._extensions.add(extension);
2029
2037
  this._extensionOpened.emit();
@@ -2032,10 +2040,10 @@ var NotarizationPlugin = class {
2032
2040
  (0, import_log8.log)("extension closed", {
2033
2041
  peer: extension.localPeerId
2034
2042
  }, {
2035
- file: "notarization-plugin.ts",
2036
- line: 213,
2037
- scope: this,
2038
- callSite: (f, a) => f(...a)
2043
+ F: __dxlog_file8,
2044
+ L: 213,
2045
+ S: this,
2046
+ C: (f, a) => f(...a)
2039
2047
  });
2040
2048
  this._extensions.delete(extension);
2041
2049
  },
@@ -2076,7 +2084,7 @@ var NotarizationTeleportExtension = class extends import_teleport2.RpcExtension
2076
2084
  };
2077
2085
 
2078
2086
  // packages/sdk/client-services/src/packlets/spaces/data-space.ts
2079
- var __decorate = function(decorators, target, key, desc) {
2087
+ function _ts_decorate(decorators, target, key, desc) {
2080
2088
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2081
2089
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2082
2090
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2085,7 +2093,8 @@ var __decorate = function(decorators, target, key, desc) {
2085
2093
  if (d = decorators[i])
2086
2094
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2087
2095
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2088
- };
2096
+ }
2097
+ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
2089
2098
  var DataSpace = class DataSpace2 {
2090
2099
  constructor(params) {
2091
2100
  this._ctx = new import_context5.Context();
@@ -2172,18 +2181,18 @@ var DataSpace = class DataSpace2 {
2172
2181
  } catch (err) {
2173
2182
  if (err instanceof import_errors3.CancelledError) {
2174
2183
  (0, import_log9.log)("Data pipeline initialization cancelled", err, {
2175
- file: "data-space.ts",
2176
- line: 173,
2177
- scope: this,
2178
- callSite: (f, a) => f(...a)
2184
+ F: __dxlog_file9,
2185
+ L: 173,
2186
+ S: this,
2187
+ C: (f, a) => f(...a)
2179
2188
  });
2180
2189
  return;
2181
2190
  }
2182
2191
  import_log9.log.error("Error initializing data pipeline", err, {
2183
- file: "data-space.ts",
2184
- line: 177,
2185
- scope: this,
2186
- callSite: (f, a) => f(...a)
2192
+ F: __dxlog_file9,
2193
+ L: 177,
2194
+ S: this,
2195
+ C: (f, a) => f(...a)
2187
2196
  });
2188
2197
  this._state = import_services6.SpaceState.ERROR;
2189
2198
  this.error = err;
@@ -2205,11 +2214,11 @@ var DataSpace = class DataSpace2 {
2205
2214
  });
2206
2215
  this.metrics.controlPipelineReady = new Date();
2207
2216
  await this._createWritableFeeds();
2208
- (0, import_log9.log)("Writable feeds created", {}, {
2209
- file: "data-space.ts",
2210
- line: 201,
2211
- scope: this,
2212
- callSite: (f, a) => f(...a)
2217
+ (0, import_log9.log)("Writable feeds created", void 0, {
2218
+ F: __dxlog_file9,
2219
+ L: 201,
2220
+ S: this,
2221
+ C: (f, a) => f(...a)
2213
2222
  });
2214
2223
  this.stateUpdate.emit();
2215
2224
  this.notarizationPlugin.setWriter((0, import_echo_pipeline.createMappedFeedWriter)((credential) => ({
@@ -2220,22 +2229,22 @@ var DataSpace = class DataSpace2 {
2220
2229
  await this._inner.initializeDataPipeline();
2221
2230
  this.metrics.dataPipelineOpen = new Date();
2222
2231
  await (0, import_context5.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
2223
- (0, import_log9.log)("waiting for data pipeline to reach target timeframe", {}, {
2224
- file: "data-space.ts",
2225
- line: 220,
2226
- scope: this,
2227
- callSite: (f, a) => f(...a)
2232
+ (0, import_log9.log)("waiting for data pipeline to reach target timeframe", void 0, {
2233
+ F: __dxlog_file9,
2234
+ L: 220,
2235
+ S: this,
2236
+ C: (f, a) => f(...a)
2228
2237
  });
2229
2238
  await this._inner.dataPipeline.pipelineState.waitUntilReachedTargetTimeframe({
2230
2239
  ctx: this._ctx,
2231
2240
  breakOnStall: false
2232
2241
  });
2233
2242
  this.metrics.dataPipelineReady = new Date();
2234
- (0, import_log9.log)("data pipeline ready", {}, {
2235
- file: "data-space.ts",
2236
- line: 229,
2237
- scope: this,
2238
- callSite: (f, a) => f(...a)
2243
+ (0, import_log9.log)("data pipeline ready", void 0, {
2244
+ F: __dxlog_file9,
2245
+ L: 229,
2246
+ S: this,
2247
+ C: (f, a) => f(...a)
2239
2248
  });
2240
2249
  await ((_b = (_a = this._callbacks).beforeReady) == null ? void 0 : _b.call(_a));
2241
2250
  this._state = import_services6.SpaceState.READY;
@@ -2314,10 +2323,10 @@ var DataSpace = class DataSpace2 {
2314
2323
  }
2315
2324
  }
2316
2325
  };
2317
- __decorate([
2326
+ _ts_decorate([
2318
2327
  (0, import_debug3.timed)(1e4)
2319
2328
  ], DataSpace.prototype, "_createWritableFeeds", null);
2320
- DataSpace = __decorate([
2329
+ DataSpace = _ts_decorate([
2321
2330
  (0, import_async8.trackLeaks)("open", "close")
2322
2331
  ], DataSpace);
2323
2332
 
@@ -2392,7 +2401,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
2392
2401
  };
2393
2402
 
2394
2403
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
2395
- var __decorate2 = function(decorators, target, key, desc) {
2404
+ function _ts_decorate2(decorators, target, key, desc) {
2396
2405
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2397
2406
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2398
2407
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2401,7 +2410,8 @@ var __decorate2 = function(decorators, target, key, desc) {
2401
2410
  if (d = decorators[i])
2402
2411
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2403
2412
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2404
- };
2413
+ }
2414
+ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
2405
2415
  var DataSpaceManager = class DataSpaceManager2 {
2406
2416
  constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore) {
2407
2417
  this._spaceManager = _spaceManager;
@@ -2421,38 +2431,38 @@ var DataSpaceManager = class DataSpaceManager2 {
2421
2431
  return this._spaces;
2422
2432
  }
2423
2433
  async open() {
2424
- (0, import_log10.log)("open", {}, {
2425
- file: "data-space-manager.ts",
2426
- line: 80,
2427
- scope: this,
2428
- callSite: (f, a) => f(...a)
2434
+ (0, import_log10.log)("open", void 0, {
2435
+ F: __dxlog_file10,
2436
+ L: 80,
2437
+ S: this,
2438
+ C: (f, a) => f(...a)
2429
2439
  });
2430
2440
  import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols6.trace.begin({
2431
2441
  id: this._instanceId
2432
2442
  }), {
2433
- file: "data-space-manager.ts",
2434
- line: 81,
2435
- scope: this,
2436
- callSite: (f, a) => f(...a)
2443
+ F: __dxlog_file10,
2444
+ L: 81,
2445
+ S: this,
2446
+ C: (f, a) => f(...a)
2437
2447
  });
2438
2448
  await this._metadataStore.load();
2439
2449
  (0, import_log10.log)("metadata loaded", {
2440
2450
  spaces: this._metadataStore.spaces.length
2441
2451
  }, {
2442
- file: "data-space-manager.ts",
2443
- line: 83,
2444
- scope: this,
2445
- callSite: (f, a) => f(...a)
2452
+ F: __dxlog_file10,
2453
+ L: 83,
2454
+ S: this,
2455
+ C: (f, a) => f(...a)
2446
2456
  });
2447
2457
  for (const spaceMetadata of this._metadataStore.spaces) {
2448
2458
  try {
2449
2459
  (0, import_log10.log)("load space", {
2450
2460
  spaceMetadata
2451
2461
  }, {
2452
- file: "data-space-manager.ts",
2453
- line: 87,
2454
- scope: this,
2455
- callSite: (f, a) => f(...a)
2462
+ F: __dxlog_file10,
2463
+ L: 87,
2464
+ S: this,
2465
+ C: (f, a) => f(...a)
2456
2466
  });
2457
2467
  const space = await this._constructSpace(spaceMetadata);
2458
2468
  space.initializeDataPipelineAsync();
@@ -2461,10 +2471,10 @@ var DataSpaceManager = class DataSpaceManager2 {
2461
2471
  spaceMetadata,
2462
2472
  err
2463
2473
  }, {
2464
- file: "data-space-manager.ts",
2465
- line: 91,
2466
- scope: this,
2467
- callSite: (f, a) => f(...a)
2474
+ F: __dxlog_file10,
2475
+ L: 91,
2476
+ S: this,
2477
+ C: (f, a) => f(...a)
2468
2478
  });
2469
2479
  }
2470
2480
  }
@@ -2473,18 +2483,18 @@ var DataSpaceManager = class DataSpaceManager2 {
2473
2483
  import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols6.trace.end({
2474
2484
  id: this._instanceId
2475
2485
  }), {
2476
- file: "data-space-manager.ts",
2477
- line: 97,
2478
- scope: this,
2479
- callSite: (f, a) => f(...a)
2486
+ F: __dxlog_file10,
2487
+ L: 97,
2488
+ S: this,
2489
+ C: (f, a) => f(...a)
2480
2490
  });
2481
2491
  }
2482
2492
  async close() {
2483
- (0, import_log10.log)("close", {}, {
2484
- file: "data-space-manager.ts",
2485
- line: 102,
2486
- scope: this,
2487
- callSite: (f, a) => f(...a)
2493
+ (0, import_log10.log)("close", void 0, {
2494
+ F: __dxlog_file10,
2495
+ L: 102,
2496
+ S: this,
2497
+ C: (f, a) => f(...a)
2488
2498
  });
2489
2499
  this._isOpen = false;
2490
2500
  await this._ctx.dispose();
@@ -2496,7 +2506,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2496
2506
  * Creates a new space writing the genesis credentials to the control feed.
2497
2507
  */
2498
2508
  async createSpace() {
2499
- (0, import_node_assert10.default)(this._isOpen, "Not open.");
2509
+ (0, import_tiny_invariant10.default)(this._isOpen, "Not open.");
2500
2510
  const spaceKey = await this._keyring.createKey();
2501
2511
  const controlFeedKey = await this._keyring.createKey();
2502
2512
  const dataFeedKey = await this._keyring.createKey();
@@ -2509,16 +2519,16 @@ var DataSpaceManager = class DataSpaceManager2 {
2509
2519
  (0, import_log10.log)("creating space...", {
2510
2520
  spaceKey
2511
2521
  }, {
2512
- file: "data-space-manager.ts",
2513
- line: 126,
2514
- scope: this,
2515
- callSite: (f, a) => f(...a)
2522
+ F: __dxlog_file10,
2523
+ L: 126,
2524
+ S: this,
2525
+ C: (f, a) => f(...a)
2516
2526
  });
2517
2527
  const space = await this._constructSpace(metadata);
2518
2528
  const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner);
2519
2529
  await this._metadataStore.addSpace(metadata);
2520
2530
  const memberCredential = credentials[1];
2521
- (0, import_node_assert10.default)((0, import_credentials13.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
2531
+ (0, import_tiny_invariant10.default)((0, import_credentials13.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
2522
2532
  await this._signingContext.recordCredential(memberCredential);
2523
2533
  await space.initializeDataPipeline();
2524
2534
  this.updated.emit();
@@ -2529,13 +2539,13 @@ var DataSpaceManager = class DataSpaceManager2 {
2529
2539
  (0, import_log10.log)("accept space", {
2530
2540
  opts
2531
2541
  }, {
2532
- file: "data-space-manager.ts",
2533
- line: 145,
2534
- scope: this,
2535
- callSite: (f, a) => f(...a)
2542
+ F: __dxlog_file10,
2543
+ L: 145,
2544
+ S: this,
2545
+ C: (f, a) => f(...a)
2536
2546
  });
2537
- (0, import_node_assert10.default)(this._isOpen, "Not open.");
2538
- (0, import_node_assert10.default)(!this._spaces.has(opts.spaceKey), "Space already exists.");
2547
+ (0, import_tiny_invariant10.default)(this._isOpen, "Not open.");
2548
+ (0, import_tiny_invariant10.default)(!this._spaces.has(opts.spaceKey), "Space already exists.");
2539
2549
  const metadata = {
2540
2550
  key: opts.spaceKey,
2541
2551
  genesisFeedKey: opts.genesisFeedKey,
@@ -2563,10 +2573,10 @@ var DataSpaceManager = class DataSpaceManager2 {
2563
2573
  (0, import_log10.log)("construct space", {
2564
2574
  metadata
2565
2575
  }, {
2566
- file: "data-space-manager.ts",
2567
- line: 180,
2568
- scope: this,
2569
- callSite: (f, a) => f(...a)
2576
+ F: __dxlog_file10,
2577
+ L: 180,
2578
+ S: this,
2579
+ C: (f, a) => f(...a)
2570
2580
  });
2571
2581
  const gossip = new import_teleport_extension_gossip.Gossip({
2572
2582
  localPeerId: this._signingContext.deviceKey
@@ -2598,11 +2608,11 @@ var DataSpaceManager = class DataSpaceManager2 {
2598
2608
  session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
2599
2609
  },
2600
2610
  onAuthFailure: () => {
2601
- import_log10.log.warn("auth failure", {}, {
2602
- file: "data-space-manager.ts",
2603
- line: 211,
2604
- scope: this,
2605
- callSite: (f, a) => f(...a)
2611
+ import_log10.log.warn("auth failure", void 0, {
2612
+ F: __dxlog_file10,
2613
+ L: 211,
2614
+ S: this,
2615
+ C: (f, a) => f(...a)
2606
2616
  });
2607
2617
  },
2608
2618
  memberKey: this._signingContext.identityKey
@@ -2622,10 +2632,10 @@ var DataSpaceManager = class DataSpaceManager2 {
2622
2632
  (0, import_log10.log)("before space ready", {
2623
2633
  space: space.key
2624
2634
  }, {
2625
- file: "data-space-manager.ts",
2626
- line: 228,
2627
- scope: this,
2628
- callSite: (f, a) => f(...a)
2635
+ F: __dxlog_file10,
2636
+ L: 228,
2637
+ S: this,
2638
+ C: (f, a) => f(...a)
2629
2639
  });
2630
2640
  this._dataServiceSubscriptions.registerSpace(space.key, dataSpace.dataPipeline.databaseHost.createDataServiceHost());
2631
2641
  },
@@ -2634,10 +2644,10 @@ var DataSpaceManager = class DataSpaceManager2 {
2634
2644
  space: space.key,
2635
2645
  open: this._isOpen
2636
2646
  }, {
2637
- file: "data-space-manager.ts",
2638
- line: 235,
2639
- scope: this,
2640
- callSite: (f, a) => f(...a)
2647
+ F: __dxlog_file10,
2648
+ L: 235,
2649
+ S: this,
2650
+ C: (f, a) => f(...a)
2641
2651
  });
2642
2652
  if (this._isOpen) {
2643
2653
  this.updated.emit();
@@ -2657,19 +2667,19 @@ var DataSpaceManager = class DataSpaceManager2 {
2657
2667
  return dataSpace;
2658
2668
  }
2659
2669
  };
2660
- __decorate2([
2670
+ _ts_decorate2([
2661
2671
  import_async9.synchronized
2662
2672
  ], DataSpaceManager.prototype, "open", null);
2663
- __decorate2([
2673
+ _ts_decorate2([
2664
2674
  import_async9.synchronized
2665
2675
  ], DataSpaceManager.prototype, "close", null);
2666
- __decorate2([
2676
+ _ts_decorate2([
2667
2677
  import_async9.synchronized
2668
2678
  ], DataSpaceManager.prototype, "createSpace", null);
2669
- __decorate2([
2679
+ _ts_decorate2([
2670
2680
  import_async9.synchronized
2671
2681
  ], DataSpaceManager.prototype, "acceptSpace", null);
2672
- DataSpaceManager = __decorate2([
2682
+ DataSpaceManager = _ts_decorate2([
2673
2683
  (0, import_async9.trackLeaks)("open", "close")
2674
2684
  ], DataSpaceManager);
2675
2685
 
@@ -2682,6 +2692,7 @@ var import_log11 = require("@dxos/log");
2682
2692
  var import_protocols7 = require("@dxos/protocols");
2683
2693
  var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
2684
2694
  var import_util5 = require("@dxos/util");
2695
+ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
2685
2696
  var SpacesServiceImpl = class {
2686
2697
  constructor(_identityManager, _spaceManager, _dataServiceSubscriptions, _getDataSpaceManager) {
2687
2698
  this._identityManager = _identityManager;
@@ -2708,10 +2719,10 @@ var SpacesServiceImpl = class {
2708
2719
  (0, import_log11.log)("update", {
2709
2720
  spaces
2710
2721
  }, {
2711
- file: "spaces-service.ts",
2712
- line: 60,
2713
- scope: this,
2714
- callSite: (f, a) => f(...a)
2722
+ F: __dxlog_file11,
2723
+ L: 60,
2724
+ S: this,
2725
+ C: (f, a) => f(...a)
2715
2726
  });
2716
2727
  next({
2717
2728
  spaces
@@ -2838,6 +2849,7 @@ var SpacesServiceImpl = class {
2838
2849
  var getChannelId = (channel) => `user-channel/${channel}`;
2839
2850
 
2840
2851
  // packages/sdk/client-services/src/packlets/services/service-context.ts
2852
+ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
2841
2853
  var ServiceContext = class {
2842
2854
  // prettier-ignore
2843
2855
  constructor(storage, networkManager, signalManager, modelFactory) {
@@ -2881,17 +2893,17 @@ var ServiceContext = class {
2881
2893
  import_log12.log.trace("dxos.sdk.service-context.open", import_protocols8.trace.begin({
2882
2894
  id: this._instanceId
2883
2895
  }), {
2884
- file: "service-context.ts",
2885
- line: 126,
2886
- scope: this,
2887
- callSite: (f, a) => f(...a)
2896
+ F: __dxlog_file12,
2897
+ L: 126,
2898
+ S: this,
2899
+ C: (f, a) => f(...a)
2888
2900
  });
2889
2901
  await this._checkStorageVersion();
2890
- (0, import_log12.log)("opening...", {}, {
2891
- file: "service-context.ts",
2892
- line: 130,
2893
- scope: this,
2894
- callSite: (f, a) => f(...a)
2902
+ (0, import_log12.log)("opening...", void 0, {
2903
+ F: __dxlog_file12,
2904
+ L: 130,
2905
+ S: this,
2906
+ C: (f, a) => f(...a)
2895
2907
  });
2896
2908
  await this.signalManager.open();
2897
2909
  await this.networkManager.open();
@@ -2900,28 +2912,28 @@ var ServiceContext = class {
2900
2912
  if (this.identityManager.identity) {
2901
2913
  await this._initialize();
2902
2914
  }
2903
- (0, import_log12.log)("opened", {}, {
2904
- file: "service-context.ts",
2905
- line: 138,
2906
- scope: this,
2907
- callSite: (f, a) => f(...a)
2915
+ (0, import_log12.log)("opened", void 0, {
2916
+ F: __dxlog_file12,
2917
+ L: 138,
2918
+ S: this,
2919
+ C: (f, a) => f(...a)
2908
2920
  });
2909
2921
  import_log12.log.trace("dxos.sdk.service-context.open", import_protocols8.trace.end({
2910
2922
  id: this._instanceId
2911
2923
  }), {
2912
- file: "service-context.ts",
2913
- line: 139,
2914
- scope: this,
2915
- callSite: (f, a) => f(...a)
2924
+ F: __dxlog_file12,
2925
+ L: 139,
2926
+ S: this,
2927
+ C: (f, a) => f(...a)
2916
2928
  });
2917
2929
  }
2918
2930
  async close() {
2919
2931
  var _a, _b;
2920
- (0, import_log12.log)("closing...", {}, {
2921
- file: "service-context.ts",
2922
- line: 143,
2923
- scope: this,
2924
- callSite: (f, a) => f(...a)
2932
+ (0, import_log12.log)("closing...", void 0, {
2933
+ F: __dxlog_file12,
2934
+ L: 143,
2935
+ S: this,
2936
+ C: (f, a) => f(...a)
2925
2937
  });
2926
2938
  await ((_a = this._deviceSpaceSync) == null ? void 0 : _a.close());
2927
2939
  await ((_b = this.dataSpaceManager) == null ? void 0 : _b.close());
@@ -2931,11 +2943,11 @@ var ServiceContext = class {
2931
2943
  await this.networkManager.close();
2932
2944
  await this.signalManager.close();
2933
2945
  this.dataServiceSubscriptions.clear();
2934
- (0, import_log12.log)("closed", {}, {
2935
- file: "service-context.ts",
2936
- line: 152,
2937
- scope: this,
2938
- callSite: (f, a) => f(...a)
2946
+ (0, import_log12.log)("closed", void 0, {
2947
+ F: __dxlog_file12,
2948
+ L: 152,
2949
+ S: this,
2950
+ C: (f, a) => f(...a)
2939
2951
  });
2940
2952
  }
2941
2953
  async createIdentity(params = {}) {
@@ -2945,7 +2957,7 @@ var ServiceContext = class {
2945
2957
  }
2946
2958
  getInvitationHandler(invitation) {
2947
2959
  const factory = this._handlerFactories.get(invitation.kind);
2948
- (0, import_node_assert11.default)(factory, `Unknown invitation kind: ${invitation.kind}`);
2960
+ (0, import_tiny_invariant11.default)(factory, `Unknown invitation kind: ${invitation.kind}`);
2949
2961
  return factory(invitation);
2950
2962
  }
2951
2963
  async _acceptIdentity(params) {
@@ -2962,11 +2974,11 @@ var ServiceContext = class {
2962
2974
  // Called when identity is created.
2963
2975
  async _initialize() {
2964
2976
  var _a;
2965
- (0, import_log12.log)("initializing spaces...", {}, {
2966
- file: "service-context.ts",
2967
- line: 185,
2968
- scope: this,
2969
- callSite: (f, a) => f(...a)
2977
+ (0, import_log12.log)("initializing spaces...", void 0, {
2978
+ F: __dxlog_file12,
2979
+ L: 185,
2980
+ S: this,
2981
+ C: (f, a) => f(...a)
2970
2982
  });
2971
2983
  const identity = (_a = this.identityManager.identity) != null ? _a : (0, import_debug6.failUndefined)();
2972
2984
  const signingContext = {
@@ -2985,7 +2997,7 @@ var ServiceContext = class {
2985
2997
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
2986
2998
  await this.dataSpaceManager.open();
2987
2999
  this._handlerFactories.set(import_services9.Invitation.Kind.SPACE, (invitation) => {
2988
- (0, import_node_assert11.default)(this.dataSpaceManager, "dataSpaceManager not initialized yet");
3000
+ (0, import_tiny_invariant11.default)(this.dataSpaceManager, "dataSpaceManager not initialized yet");
2989
3001
  return new SpaceInvitationProtocol(this.dataSpaceManager, signingContext, this.keyring, invitation.spaceKey);
2990
3002
  });
2991
3003
  this.initialized.wake();
@@ -3002,10 +3014,10 @@ var ServiceContext = class {
3002
3014
  (0, import_log12.log)("dataSpaceManager not initialized yet, ignoring space admission", {
3003
3015
  details: assertion
3004
3016
  }, {
3005
- file: "service-context.ts",
3006
- line: 224,
3007
- scope: this,
3008
- callSite: (f, a) => f(...a)
3017
+ F: __dxlog_file12,
3018
+ L: 224,
3019
+ S: this,
3020
+ C: (f, a) => f(...a)
3009
3021
  });
3010
3022
  return;
3011
3023
  }
@@ -3013,10 +3025,10 @@ var ServiceContext = class {
3013
3025
  (0, import_log12.log)("space already exists, ignoring space admission", {
3014
3026
  details: assertion
3015
3027
  }, {
3016
- file: "service-context.ts",
3017
- line: 228,
3018
- scope: this,
3019
- callSite: (f, a) => f(...a)
3028
+ F: __dxlog_file12,
3029
+ L: 228,
3030
+ S: this,
3031
+ C: (f, a) => f(...a)
3020
3032
  });
3021
3033
  return;
3022
3034
  }
@@ -3024,21 +3036,21 @@ var ServiceContext = class {
3024
3036
  (0, import_log12.log)("accepting space recorded in halo", {
3025
3037
  details: assertion
3026
3038
  }, {
3027
- file: "service-context.ts",
3028
- line: 233,
3029
- scope: this,
3030
- callSite: (f, a) => f(...a)
3039
+ F: __dxlog_file12,
3040
+ L: 233,
3041
+ S: this,
3042
+ C: (f, a) => f(...a)
3031
3043
  });
3032
3044
  await this.dataSpaceManager.acceptSpace({
3033
3045
  spaceKey: assertion.spaceKey,
3034
3046
  genesisFeedKey: assertion.genesisFeedKey
3035
3047
  });
3036
3048
  } catch (err) {
3037
- import_log12.log.catch(err, {}, {
3038
- file: "service-context.ts",
3039
- line: 239,
3040
- scope: this,
3041
- callSite: (f, a) => f(...a)
3049
+ import_log12.log.catch(err, void 0, {
3050
+ F: __dxlog_file12,
3051
+ L: 239,
3052
+ S: this,
3053
+ C: (f, a) => f(...a)
3042
3054
  });
3043
3055
  }
3044
3056
  }
@@ -3048,16 +3060,19 @@ var ServiceContext = class {
3048
3060
  };
3049
3061
 
3050
3062
  // packages/sdk/client-services/src/packlets/services/service-host.ts
3051
- var import_node_assert13 = __toESM(require("node:assert"));
3063
+ var import_tiny_invariant13 = __toESM(require("tiny-invariant"));
3052
3064
  var import_async17 = require("@dxos/async");
3053
3065
  var import_client_protocol5 = require("@dxos/client-protocol");
3066
+ var import_document_model = require("@dxos/document-model");
3054
3067
  var import_echo_pipeline4 = require("@dxos/echo-pipeline");
3055
3068
  var import_keys12 = require("@dxos/keys");
3056
3069
  var import_log15 = require("@dxos/log");
3057
3070
  var import_messaging = require("@dxos/messaging");
3071
+ var import_model_factory = require("@dxos/model-factory");
3058
3072
  var import_network_manager2 = require("@dxos/network-manager");
3059
3073
  var import_protocols9 = require("@dxos/protocols");
3060
3074
  var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
3075
+ var import_text_model = require("@dxos/text-model");
3061
3076
 
3062
3077
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
3063
3078
  var import_async12 = require("@dxos/async");
@@ -3420,10 +3435,10 @@ var DevtoolsServiceImpl = class {
3420
3435
  };
3421
3436
 
3422
3437
  // packages/sdk/client-services/src/packlets/locks/node.ts
3423
- var import_node_assert12 = __toESM(require("node:assert"));
3438
+ var import_tiny_invariant12 = __toESM(require("tiny-invariant"));
3424
3439
  var import_lock_file = require("@dxos/lock-file");
3425
3440
  var import_log13 = require("@dxos/log");
3426
- var __decorate3 = function(decorators, target, key, desc) {
3441
+ function _ts_decorate3(decorators, target, key, desc) {
3427
3442
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3428
3443
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3429
3444
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3432,7 +3447,8 @@ var __decorate3 = function(decorators, target, key, desc) {
3432
3447
  if (d = decorators[i])
3433
3448
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3434
3449
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3435
- };
3450
+ }
3451
+ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
3436
3452
  var Lock = class {
3437
3453
  constructor({ lockKey: lockPath, onAcquire, onRelease }) {
3438
3454
  this._lockPath = lockPath;
@@ -3444,29 +3460,29 @@ var Lock = class {
3444
3460
  }
3445
3461
  async acquire() {
3446
3462
  var _a;
3447
- (0, import_log13.log)("acquiring lock...", {}, {
3448
- file: "node.ts",
3449
- line: 32,
3450
- scope: this,
3451
- callSite: (f, a) => f(...a)
3463
+ (0, import_log13.log)("acquiring lock...", void 0, {
3464
+ F: __dxlog_file13,
3465
+ L: 32,
3466
+ S: this,
3467
+ C: (f, a) => f(...a)
3452
3468
  });
3453
3469
  this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
3454
3470
  await ((_a = this._onAcquire) == null ? void 0 : _a.call(this));
3455
- (0, import_log13.log)("acquired lock", {}, {
3456
- file: "node.ts",
3457
- line: 37,
3458
- scope: this,
3459
- callSite: (f, a) => f(...a)
3471
+ (0, import_log13.log)("acquired lock", void 0, {
3472
+ F: __dxlog_file13,
3473
+ L: 37,
3474
+ S: this,
3475
+ C: (f, a) => f(...a)
3460
3476
  });
3461
3477
  }
3462
3478
  async release() {
3463
3479
  var _a;
3464
3480
  await ((_a = this._onRelease) == null ? void 0 : _a.call(this));
3465
- (0, import_node_assert12.default)(this._fileHandle, "Lock is not acquired");
3481
+ (0, import_tiny_invariant12.default)(this._fileHandle, "Lock is not acquired");
3466
3482
  await import_lock_file.LockFile.release(this._fileHandle);
3467
3483
  }
3468
3484
  };
3469
- __decorate3([
3485
+ _ts_decorate3([
3470
3486
  import_log13.logInfo
3471
3487
  ], Lock.prototype, "lockKey", null);
3472
3488
 
@@ -3497,7 +3513,7 @@ var LoggingServiceImpl = class {
3497
3513
  if (LOG_PROCESSING > 0) {
3498
3514
  return;
3499
3515
  }
3500
- if (((_a = entry2.meta) == null ? void 0 : _a.file.includes("logging-service")) || entry2.context && Object.values(entry2.context).some((value) => typeof value === "string" && value.includes("LoggingService"))) {
3516
+ if (((_a = entry2.meta) == null ? void 0 : _a.F.includes("logging-service")) || entry2.context && Object.values(entry2.context).some((value) => typeof value === "string" && value.includes("LoggingService"))) {
3501
3517
  return;
3502
3518
  }
3503
3519
  if (!shouldLog(entry2, request)) {
@@ -3509,8 +3525,8 @@ var LoggingServiceImpl = class {
3509
3525
  timestamp: new Date(),
3510
3526
  meta: {
3511
3527
  // TODO(dmaretskyi): Fix proto.
3512
- file: (_c = (_b = entry2.meta) == null ? void 0 : _b.file) != null ? _c : "",
3513
- line: (_e = (_d = entry2.meta) == null ? void 0 : _d.line) != null ? _e : 0
3528
+ file: (_c = (_b = entry2.meta) == null ? void 0 : _b.F) != null ? _c : "",
3529
+ line: (_e = (_d = entry2.meta) == null ? void 0 : _d.L) != null ? _e : 0
3514
3530
  }
3515
3531
  };
3516
3532
  try {
@@ -3540,7 +3556,7 @@ var shouldLog = (entry2, request) => {
3540
3556
  } else {
3541
3557
  return request.filters.some((filter) => {
3542
3558
  var _a2, _b;
3543
- return matchFilter(filter, entry2.level, (_b = (_a2 = entry2.meta) == null ? void 0 : _a2.file) != null ? _b : "", options);
3559
+ return matchFilter(filter, entry2.level, (_b = (_a2 = entry2.meta) == null ? void 0 : _a2.F) != null ? _b : "", options);
3544
3560
  });
3545
3561
  }
3546
3562
  };
@@ -3690,7 +3706,7 @@ var ServiceRegistry = class {
3690
3706
  };
3691
3707
 
3692
3708
  // packages/sdk/client-services/src/packlets/services/service-host.ts
3693
- var __decorate4 = function(decorators, target, key, desc) {
3709
+ function _ts_decorate4(decorators, target, key, desc) {
3694
3710
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3695
3711
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3696
3712
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3699,24 +3715,30 @@ var __decorate4 = function(decorators, target, key, desc) {
3699
3715
  if (d = decorators[i])
3700
3716
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3701
3717
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3718
+ }
3719
+ var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
3720
+ var createDefaultModelFactory = () => {
3721
+ return new import_model_factory.ModelFactory().registerModel(import_document_model.DocumentModel).registerModel(import_text_model.TextModel);
3702
3722
  };
3703
3723
  var ClientServicesHost = class {
3704
3724
  constructor({
3705
3725
  config,
3706
- modelFactory = (0, import_client_protocol5.createDefaultModelFactory)(),
3726
+ modelFactory = createDefaultModelFactory(),
3707
3727
  // TODO(burdon): Create ApolloLink abstraction (see Client).
3708
3728
  transportFactory,
3709
3729
  signalManager,
3710
3730
  connectionLog,
3711
3731
  storage,
3712
3732
  // TODO(wittjosiah): Turn this on by default.
3713
- lockKey
3733
+ lockKey,
3734
+ callbacks
3714
3735
  } = {}) {
3715
3736
  this._statusUpdate = new import_async17.Event();
3716
3737
  this._opening = false;
3717
3738
  this._open = false;
3718
3739
  this._storage = storage;
3719
3740
  this._modelFactory = modelFactory;
3741
+ this._callbacks = callbacks;
3720
3742
  if (config) {
3721
3743
  this.initialize({
3722
3744
  config,
@@ -3775,9 +3797,9 @@ var ClientServicesHost = class {
3775
3797
  */
3776
3798
  initialize({ config, ...options }) {
3777
3799
  var _a, _b, _c;
3778
- (0, import_node_assert13.default)(!this._open, "service host is open");
3800
+ (0, import_tiny_invariant13.default)(!this._open, "service host is open");
3779
3801
  if (config) {
3780
- (0, import_node_assert13.default)(!this._config, "config already set");
3802
+ (0, import_tiny_invariant13.default)(!this._config, "config already set");
3781
3803
  this._config = config;
3782
3804
  if (!this._storage) {
3783
3805
  this._storage = createStorageObjects(config.get("runtime.client.storage", {})).storage;
@@ -3787,7 +3809,7 @@ var ClientServicesHost = class {
3787
3809
  iceServers: (_a = this._config) == null ? void 0 : _a.get("runtime.services.ice")
3788
3810
  }), signalManager = new import_messaging.WebsocketSignalManager((_c = (_b = this._config) == null ? void 0 : _b.get("runtime.services.signaling")) != null ? _c : []) } = options;
3789
3811
  this._signalManager = signalManager;
3790
- (0, import_node_assert13.default)(!this._networkManager, "network manager already set");
3812
+ (0, import_tiny_invariant13.default)(!this._networkManager, "network manager already set");
3791
3813
  this._networkManager = new import_network_manager2.NetworkManager({
3792
3814
  log: connectionLog,
3793
3815
  transportFactory,
@@ -3803,23 +3825,23 @@ var ClientServicesHost = class {
3803
3825
  import_log15.log.trace("dxos.sdk.client-services-host.open", import_protocols9.trace.begin({
3804
3826
  id: traceId
3805
3827
  }), {
3806
- file: "service-host.ts",
3807
- line: 188,
3808
- scope: this,
3809
- callSite: (f, a) => f(...a)
3828
+ F: __dxlog_file14,
3829
+ L: 203,
3830
+ S: this,
3831
+ C: (f, a) => f(...a)
3810
3832
  });
3811
- (0, import_node_assert13.default)(this._config, "config not set");
3812
- (0, import_node_assert13.default)(this._storage, "storage not set");
3813
- (0, import_node_assert13.default)(this._signalManager, "signal manager not set");
3814
- (0, import_node_assert13.default)(this._networkManager, "network manager not set");
3833
+ (0, import_tiny_invariant13.default)(this._config, "config not set");
3834
+ (0, import_tiny_invariant13.default)(this._storage, "storage not set");
3835
+ (0, import_tiny_invariant13.default)(this._signalManager, "signal manager not set");
3836
+ (0, import_tiny_invariant13.default)(this._networkManager, "network manager not set");
3815
3837
  this._opening = true;
3816
3838
  (0, import_log15.log)("opening...", {
3817
3839
  lockKey: (_a = this._resourceLock) == null ? void 0 : _a.lockKey
3818
3840
  }, {
3819
- file: "service-host.ts",
3820
- line: 196,
3821
- scope: this,
3822
- callSite: (f, a) => f(...a)
3841
+ F: __dxlog_file14,
3842
+ L: 211,
3843
+ S: this,
3844
+ C: (f, a) => f(...a)
3823
3845
  });
3824
3846
  await ((_b = this._resourceLock) == null ? void 0 : _b.acquire());
3825
3847
  await this._loggingService.open();
@@ -3851,18 +3873,18 @@ var ClientServicesHost = class {
3851
3873
  (0, import_log15.log)("opened", {
3852
3874
  deviceKey
3853
3875
  }, {
3854
- file: "service-host.ts",
3855
- line: 251,
3856
- scope: this,
3857
- callSite: (f, a) => f(...a)
3876
+ F: __dxlog_file14,
3877
+ L: 266,
3878
+ S: this,
3879
+ C: (f, a) => f(...a)
3858
3880
  });
3859
3881
  import_log15.log.trace("dxos.sdk.client-services-host.open", import_protocols9.trace.end({
3860
3882
  id: traceId
3861
3883
  }), {
3862
- file: "service-host.ts",
3863
- line: 252,
3864
- scope: this,
3865
- callSite: (f, a) => f(...a)
3884
+ F: __dxlog_file14,
3885
+ L: 267,
3886
+ S: this,
3887
+ C: (f, a) => f(...a)
3866
3888
  });
3867
3889
  }
3868
3890
  async close() {
@@ -3874,10 +3896,10 @@ var ClientServicesHost = class {
3874
3896
  (0, import_log15.log)("closing...", {
3875
3897
  deviceKey
3876
3898
  }, {
3877
- file: "service-host.ts",
3878
- line: 262,
3879
- scope: this,
3880
- callSite: (f, a) => f(...a)
3899
+ F: __dxlog_file14,
3900
+ L: 277,
3901
+ S: this,
3902
+ C: (f, a) => f(...a)
3881
3903
  });
3882
3904
  this._serviceRegistry.setServices({
3883
3905
  SystemService: this._systemService
@@ -3889,51 +3911,52 @@ var ClientServicesHost = class {
3889
3911
  (0, import_log15.log)("closed", {
3890
3912
  deviceKey
3891
3913
  }, {
3892
- file: "service-host.ts",
3893
- line: 268,
3894
- scope: this,
3895
- callSite: (f, a) => f(...a)
3914
+ F: __dxlog_file14,
3915
+ L: 283,
3916
+ S: this,
3917
+ C: (f, a) => f(...a)
3896
3918
  });
3897
3919
  }
3898
3920
  async reset() {
3899
- var _a;
3921
+ var _a, _b, _c;
3900
3922
  const traceId = import_keys12.PublicKey.random().toHex();
3901
3923
  import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols9.trace.begin({
3902
3924
  id: traceId
3903
3925
  }), {
3904
- file: "service-host.ts",
3905
- line: 273,
3906
- scope: this,
3907
- callSite: (f, a) => f(...a)
3926
+ F: __dxlog_file14,
3927
+ L: 288,
3928
+ S: this,
3929
+ C: (f, a) => f(...a)
3908
3930
  });
3909
- (0, import_log15.log)("resetting...", {}, {
3910
- file: "service-host.ts",
3911
- line: 275,
3912
- scope: this,
3913
- callSite: (f, a) => f(...a)
3931
+ (0, import_log15.log)("resetting...", void 0, {
3932
+ F: __dxlog_file14,
3933
+ L: 290,
3934
+ S: this,
3935
+ C: (f, a) => f(...a)
3914
3936
  });
3915
3937
  await ((_a = this._serviceContext) == null ? void 0 : _a.close());
3916
3938
  await this._storage.reset();
3917
- (0, import_log15.log)("reset", {}, {
3918
- file: "service-host.ts",
3919
- line: 278,
3920
- scope: this,
3921
- callSite: (f, a) => f(...a)
3939
+ (0, import_log15.log)("reset", void 0, {
3940
+ F: __dxlog_file14,
3941
+ L: 293,
3942
+ S: this,
3943
+ C: (f, a) => f(...a)
3922
3944
  });
3923
3945
  import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols9.trace.end({
3924
3946
  id: traceId
3925
3947
  }), {
3926
- file: "service-host.ts",
3927
- line: 279,
3928
- scope: this,
3929
- callSite: (f, a) => f(...a)
3948
+ F: __dxlog_file14,
3949
+ L: 294,
3950
+ S: this,
3951
+ C: (f, a) => f(...a)
3930
3952
  });
3953
+ await ((_c = (_b = this._callbacks) == null ? void 0 : _b.onReset) == null ? void 0 : _c.call(_b));
3931
3954
  }
3932
3955
  };
3933
- __decorate4([
3956
+ _ts_decorate4([
3934
3957
  import_async17.synchronized
3935
3958
  ], ClientServicesHost.prototype, "open", null);
3936
- __decorate4([
3959
+ _ts_decorate4([
3937
3960
  import_async17.synchronized
3938
3961
  ], ClientServicesHost.prototype, "close", null);
3939
3962
 
@@ -3969,7 +3992,7 @@ var performInvitation = ({ host, guest, options, hooks }) => {
3969
3992
  if ((_b2 = (_a2 = hooks == null ? void 0 : hooks.guest) == null ? void 0 : _a2.onConnecting) == null ? void 0 : _b2.call(_a2, guestObservable)) {
3970
3993
  break;
3971
3994
  }
3972
- (0, import_node_assert14.default)(hostInvitation.swarmKey.equals(guestInvitation.swarmKey));
3995
+ (0, import_tiny_invariant14.default)(hostInvitation.swarmKey.equals(guestInvitation.swarmKey));
3973
3996
  break;
3974
3997
  }
3975
3998
  case import_services13.Invitation.State.CONNECTED: {
@@ -4110,7 +4133,6 @@ var acceptInvitation = (guest, invitation) => {
4110
4133
  };
4111
4134
 
4112
4135
  // packages/sdk/client-services/src/packlets/testing/test-builder.ts
4113
- var import_client_protocol6 = require("@dxos/client-protocol");
4114
4136
  var import_context8 = require("@dxos/context");
4115
4137
  var import_credentials15 = require("@dxos/credentials");
4116
4138
  var import_echo_pipeline5 = require("@dxos/echo-pipeline");
@@ -4136,7 +4158,7 @@ var createServiceContext = ({ signalContext = new import_messaging2.MemorySignal
4136
4158
  signalManager,
4137
4159
  transportFactory: import_network_manager3.MemoryTransportFactory
4138
4160
  });
4139
- const modelFactory = (0, import_client_protocol6.createDefaultModelFactory)();
4161
+ const modelFactory = createDefaultModelFactory();
4140
4162
  return new ServiceContext(storage, networkManager, signalManager, modelFactory);
4141
4163
  };
4142
4164
  var createPeers = async (numPeers) => {
@@ -4226,7 +4248,7 @@ var TestPeer = class {
4226
4248
  feedStore: this.feedStore,
4227
4249
  networkManager: this.networkManager,
4228
4250
  metadataStore: this.metadataStore,
4229
- modelFactory: (0, import_client_protocol6.createDefaultModelFactory)(),
4251
+ modelFactory: createDefaultModelFactory(),
4230
4252
  snapshotStore: this.snapshotStore,
4231
4253
  blobStore: this.blobStore
4232
4254
  });