@dxos/client-services 0.7.2-staging.6d26b2a → 0.7.3-main.2dd075e

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 (35) hide show
  1. package/dist/lib/browser/{chunk-YSHSPXSP.mjs → chunk-5GKWY67F.mjs} +340 -422
  2. package/dist/lib/browser/chunk-5GKWY67F.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/testing/index.mjs +1 -1
  6. package/dist/lib/node/{chunk-KFFRXEM2.cjs → chunk-RVO5327U.cjs} +329 -411
  7. package/dist/lib/node/chunk-RVO5327U.cjs.map +7 -0
  8. package/dist/lib/node/index.cjs +47 -47
  9. package/dist/lib/node/meta.json +1 -1
  10. package/dist/lib/node/testing/index.cjs +8 -8
  11. package/dist/lib/node-esm/{chunk-QTMSCDQF.mjs → chunk-LMUKPYXE.mjs} +334 -416
  12. package/dist/lib/node-esm/chunk-LMUKPYXE.mjs.map +7 -0
  13. package/dist/lib/node-esm/index.mjs +1 -1
  14. package/dist/lib/node-esm/meta.json +1 -1
  15. package/dist/lib/node-esm/testing/index.mjs +1 -1
  16. package/dist/types/src/packlets/agents/edge-agent-service.d.ts +5 -2
  17. package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -1
  18. package/dist/types/src/packlets/identity/identity-service.d.ts +1 -0
  19. package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
  20. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  21. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  22. package/dist/types/src/packlets/spaces/epoch-migrations.d.ts.map +1 -1
  23. package/dist/types/src/version.d.ts +1 -1
  24. package/dist/types/src/version.d.ts.map +1 -1
  25. package/package.json +38 -38
  26. package/src/packlets/agents/edge-agent-service.ts +28 -3
  27. package/src/packlets/identity/identity-service.ts +16 -1
  28. package/src/packlets/services/service-context.ts +4 -1
  29. package/src/packlets/services/service-host.ts +1 -1
  30. package/src/packlets/spaces/data-space-manager.ts +4 -13
  31. package/src/packlets/spaces/epoch-migrations.ts +3 -84
  32. package/src/version.ts +1 -1
  33. package/dist/lib/browser/chunk-YSHSPXSP.mjs.map +0 -7
  34. package/dist/lib/node/chunk-KFFRXEM2.cjs.map +0 -7
  35. package/dist/lib/node-esm/chunk-QTMSCDQF.mjs.map +0 -7
@@ -397,7 +397,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
397
397
  import { TRACE_PROCESSOR } from "@dxos/tracing";
398
398
 
399
399
  // packages/sdk/client-services/src/version.ts
400
- var DXOS_VERSION = "0.7.2-staging.6d26b2a";
400
+ var DXOS_VERSION = "0.7.3-main.2dd075e";
401
401
 
402
402
  // packages/sdk/client-services/src/packlets/services/platform.ts
403
403
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -1301,10 +1301,10 @@ import { AUTH_TIMEOUT as AUTH_TIMEOUT2 } from "@dxos/client-protocol";
1301
1301
  import { Context as Context5, ContextDisposedError, cancelWithContext as cancelWithContext2 } from "@dxos/context";
1302
1302
  import { timed, warnAfterTimeout } from "@dxos/debug";
1303
1303
  import { createMappedFeedWriter } from "@dxos/echo-pipeline";
1304
- import { SpaceDocVersion as SpaceDocVersion3 } from "@dxos/echo-protocol";
1304
+ import { SpaceDocVersion as SpaceDocVersion2 } from "@dxos/echo-protocol";
1305
1305
  import { failedInvariant } from "@dxos/invariant";
1306
1306
  import { PublicKey as PublicKey8 } from "@dxos/keys";
1307
- import { log as log13 } from "@dxos/log";
1307
+ import { log as log12 } from "@dxos/log";
1308
1308
  import { CancelledError, SystemError } from "@dxos/protocols";
1309
1309
  import { SpaceState as SpaceState4 } from "@dxos/protocols/proto/dxos/client/services";
1310
1310
  import { AdmittedFeed as AdmittedFeed4, SpaceMember as SpaceMember5 } from "@dxos/protocols/proto/dxos/halo/credentials";
@@ -1358,12 +1358,7 @@ var AutomergeSpaceState = class extends Resource2 {
1358
1358
  };
1359
1359
 
1360
1360
  // packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts
1361
- import { migrateDocument } from "@dxos/echo-db";
1362
- import { convertLegacyReferences, convertLegacySpaceRootDoc, findInlineObjectOfType } from "@dxos/echo-pipeline";
1363
- import { SpaceDocVersion } from "@dxos/echo-protocol";
1364
- import { TYPE_PROPERTIES } from "@dxos/echo-schema";
1365
1361
  import { invariant as invariant3 } from "@dxos/invariant";
1366
- import { log as log5 } from "@dxos/log";
1367
1362
  import { CreateEpochRequest } from "@dxos/protocols/proto/dxos/client/services";
1368
1363
  var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
1369
1364
  var LOAD_DOC_TIMEOUT = 1e4;
@@ -1390,133 +1385,16 @@ var runEpochMigration = async (ctx, context) => {
1390
1385
  };
1391
1386
  }
1392
1387
  case CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
1393
- log5.info("Fragmenting", void 0, {
1394
- F: __dxlog_file7,
1395
- L: 64,
1396
- S: void 0,
1397
- C: (f, a) => f(...a)
1398
- });
1399
- const currentRootUrl = context.currentRoot;
1400
- const rootHandle = await context.echoHost.loadDoc(ctx, currentRootUrl, {
1401
- timeout: LOAD_DOC_TIMEOUT
1402
- });
1403
- const objects = Object.entries(rootHandle.docSync().objects);
1404
- const properties = findInlineObjectOfType(rootHandle.docSync(), TYPE_PROPERTIES);
1405
- const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
1406
- invariant3(properties, "Properties not found", {
1407
- F: __dxlog_file7,
1408
- L: 75,
1409
- S: void 0,
1410
- A: [
1411
- "properties",
1412
- "'Properties not found'"
1413
- ]
1414
- });
1415
- const newRoot = context.echoHost.createDoc({
1416
- ...rootHandle.docSync(),
1417
- objects: Object.fromEntries([
1418
- properties
1419
- ])
1420
- });
1421
- invariant3(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
1422
- F: __dxlog_file7,
1423
- L: 82,
1424
- S: void 0,
1425
- A: [
1426
- "typeof newRoot.url === 'string' && newRoot.url.length > 0",
1427
- ""
1428
- ]
1429
- });
1430
- const newLinks = [];
1431
- for (const [id, objData] of otherObjects) {
1432
- const handle = context.echoHost.createDoc({
1433
- version: SpaceDocVersion.CURRENT,
1434
- access: {
1435
- spaceKey: context.spaceKey.toHex()
1436
- },
1437
- objects: {
1438
- [id]: objData
1439
- }
1440
- });
1441
- newLinks.push([
1442
- id,
1443
- handle.url
1444
- ]);
1445
- }
1446
- newRoot.change((doc) => {
1447
- doc.links ??= {};
1448
- for (const [id, url] of newLinks) {
1449
- doc.links[id] = url;
1450
- }
1451
- });
1452
- await context.echoHost.flush();
1453
- return {
1454
- newRoot: newRoot.url
1455
- };
1388
+ throw new Error("Migration not available");
1456
1389
  }
1457
1390
  case CreateEpochRequest.Migration.MIGRATE_REFERENCES_TO_DXN: {
1458
- const currentRootUrl = context.currentRoot;
1459
- const rootHandle = await context.echoHost.loadDoc(ctx, currentRootUrl, {
1460
- timeout: LOAD_DOC_TIMEOUT
1461
- });
1462
- invariant3(rootHandle.docSync(), "Root doc not found", {
1463
- F: __dxlog_file7,
1464
- L: 115,
1465
- S: void 0,
1466
- A: [
1467
- "rootHandle.docSync()",
1468
- "'Root doc not found'"
1469
- ]
1470
- });
1471
- const newRootContent = await convertLegacySpaceRootDoc(structuredClone(rootHandle.docSync()));
1472
- for (const [id, url] of Object.entries(newRootContent.links ?? {})) {
1473
- try {
1474
- const handle = await context.echoHost.loadDoc(ctx, url, {
1475
- timeout: LOAD_DOC_TIMEOUT
1476
- });
1477
- invariant3(handle.docSync(), void 0, {
1478
- F: __dxlog_file7,
1479
- L: 122,
1480
- S: void 0,
1481
- A: [
1482
- "handle.docSync()",
1483
- ""
1484
- ]
1485
- });
1486
- const newDoc = await convertLegacyReferences(structuredClone(handle.docSync()));
1487
- const migratedDoc = migrateDocument(handle.docSync(), newDoc);
1488
- const newHandle = context.echoHost.createDoc(migratedDoc, {
1489
- preserveHistory: true
1490
- });
1491
- newRootContent.links[id] = newHandle.url;
1492
- } catch (err) {
1493
- log5.warn("Failed to migrate reference", {
1494
- id,
1495
- url,
1496
- error: err
1497
- }, {
1498
- F: __dxlog_file7,
1499
- L: 128,
1500
- S: void 0,
1501
- C: (f, a) => f(...a)
1502
- });
1503
- delete newRootContent.links[id];
1504
- }
1505
- }
1506
- const migratedRoot = migrateDocument(rootHandle.docSync(), newRootContent);
1507
- const newRoot = context.echoHost.createDoc(migratedRoot, {
1508
- preserveHistory: true
1509
- });
1510
- await context.echoHost.flush();
1511
- return {
1512
- newRoot: newRoot.url
1513
- };
1391
+ throw new Error("Migration not available");
1514
1392
  }
1515
1393
  // TODO(dmaretskyi): This path doesn't seem to fit here. This is not a migration.
1516
1394
  case CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
1517
1395
  invariant3(context.newAutomergeRoot, void 0, {
1518
1396
  F: __dxlog_file7,
1519
- L: 143,
1397
+ L: 62,
1520
1398
  S: void 0,
1521
1399
  A: [
1522
1400
  "context.newAutomergeRoot",
@@ -1538,7 +1416,7 @@ import { rejectOnDispose, Resource as Resource3 } from "@dxos/context";
1538
1416
  import { verifyCredential as verifyCredential2 } from "@dxos/credentials";
1539
1417
  import { invariant as invariant4 } from "@dxos/invariant";
1540
1418
  import { PublicKey as PublicKey4 } from "@dxos/keys";
1541
- import { logInfo as logInfo2, log as log6 } from "@dxos/log";
1419
+ import { logInfo as logInfo2, log as log5 } from "@dxos/log";
1542
1420
  import { EdgeCallFailedError } from "@dxos/protocols";
1543
1421
  import { schema as schema2 } from "@dxos/protocols/proto";
1544
1422
  import { RpcExtension } from "@dxos/teleport";
@@ -1621,7 +1499,7 @@ var NotarizationPlugin = class extends Resource3 {
1621
1499
  * Request credentials to be notarized.
1622
1500
  */
1623
1501
  async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY, edgeRetryJitter }) {
1624
- log6("notarize", {
1502
+ log5("notarize", {
1625
1503
  credentials
1626
1504
  }, {
1627
1505
  F: __dxlog_file8,
@@ -1641,7 +1519,7 @@ var NotarizationPlugin = class extends Resource3 {
1641
1519
  const errors = new Trigger3();
1642
1520
  const ctx = this._ctx.derive({
1643
1521
  onError: (err) => {
1644
- log6.warn("Notarization error", {
1522
+ log5.warn("Notarization error", {
1645
1523
  err
1646
1524
  }, {
1647
1525
  F: __dxlog_file8,
@@ -1675,7 +1553,7 @@ var NotarizationPlugin = class extends Resource3 {
1675
1553
  allNotarized,
1676
1554
  errors.wait()
1677
1555
  ]);
1678
- log6("done", void 0, {
1556
+ log5("done", void 0, {
1679
1557
  F: __dxlog_file8,
1680
1558
  L: 187,
1681
1559
  S: this,
@@ -1696,7 +1574,7 @@ var NotarizationPlugin = class extends Resource3 {
1696
1574
  ...this._extensions
1697
1575
  ].find((peer2) => !peersTried.has(peer2));
1698
1576
  if (!peer) {
1699
- log6.info("Exhausted all peers to notarize with", {
1577
+ log5.info("Exhausted all peers to notarize with", {
1700
1578
  retryIn: retryTimeout
1701
1579
  }, {
1702
1580
  F: __dxlog_file8,
@@ -1709,7 +1587,7 @@ var NotarizationPlugin = class extends Resource3 {
1709
1587
  return;
1710
1588
  }
1711
1589
  peersTried.add(peer);
1712
- log6("try notarizing", {
1590
+ log5("try notarizing", {
1713
1591
  peer: peer.localPeerId,
1714
1592
  credentialId: credentials.map((credential) => credential.id)
1715
1593
  }, {
@@ -1721,7 +1599,7 @@ var NotarizationPlugin = class extends Resource3 {
1721
1599
  await peer.rpc.NotarizationService.notarize({
1722
1600
  credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
1723
1601
  });
1724
- log6("success", void 0, {
1602
+ log5("success", void 0, {
1725
1603
  F: __dxlog_file8,
1726
1604
  L: 221,
1727
1605
  S: this,
@@ -1730,7 +1608,7 @@ var NotarizationPlugin = class extends Resource3 {
1730
1608
  await sleep(successDelay);
1731
1609
  } catch (err) {
1732
1610
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
1733
- log6.info("error notarizing (recoverable)", err, {
1611
+ log5.info("error notarizing (recoverable)", err, {
1734
1612
  F: __dxlog_file8,
1735
1613
  L: 226,
1736
1614
  S: this,
@@ -1759,7 +1637,7 @@ var NotarizationPlugin = class extends Resource3 {
1759
1637
  jitter: timeouts.jitter
1760
1638
  }
1761
1639
  });
1762
- log6("edge notarization success", void 0, {
1640
+ log5("edge notarization success", void 0, {
1763
1641
  F: __dxlog_file8,
1764
1642
  L: 254,
1765
1643
  S: this,
@@ -1812,7 +1690,7 @@ var NotarizationPlugin = class extends Resource3 {
1812
1690
  });
1813
1691
  const credentials = response.awaitingNotarization.credentials;
1814
1692
  if (!credentials.length) {
1815
- log6("edge did not return credentials for notarization", void 0, {
1693
+ log5("edge did not return credentials for notarization", void 0, {
1816
1694
  F: __dxlog_file8,
1817
1695
  L: 296,
1818
1696
  S: this,
@@ -1820,7 +1698,7 @@ var NotarizationPlugin = class extends Resource3 {
1820
1698
  });
1821
1699
  return;
1822
1700
  }
1823
- log6("got edge credentials for notarization", {
1701
+ log5("got edge credentials for notarization", {
1824
1702
  count: credentials.length
1825
1703
  }, {
1826
1704
  F: __dxlog_file8,
@@ -1833,7 +1711,7 @@ var NotarizationPlugin = class extends Resource3 {
1833
1711
  return credentialCodec.decode(binary);
1834
1712
  });
1835
1713
  await this._notarizeCredentials(writer, decodedCredentials);
1836
- log6.info("notarized edge credentials", {
1714
+ log5.info("notarized edge credentials", {
1837
1715
  count: decodedCredentials.length
1838
1716
  }, {
1839
1717
  F: __dxlog_file8,
@@ -1885,7 +1763,7 @@ var NotarizationPlugin = class extends Resource3 {
1885
1763
  createExtension() {
1886
1764
  const extension = new NotarizationTeleportExtension({
1887
1765
  onOpen: async () => {
1888
- log6("extension opened", {
1766
+ log5("extension opened", {
1889
1767
  peer: extension.localPeerId
1890
1768
  }, {
1891
1769
  F: __dxlog_file8,
@@ -1897,7 +1775,7 @@ var NotarizationPlugin = class extends Resource3 {
1897
1775
  this._extensionOpened.emit();
1898
1776
  },
1899
1777
  onClose: async () => {
1900
- log6("extension closed", {
1778
+ log5("extension closed", {
1901
1779
  peer: extension.localPeerId
1902
1780
  }, {
1903
1781
  F: __dxlog_file8,
@@ -1913,7 +1791,7 @@ var NotarizationPlugin = class extends Resource3 {
1913
1791
  }
1914
1792
  _scheduleTimeout(ctx, errors, timeout) {
1915
1793
  scheduleTask2(ctx, () => {
1916
- log6.warn("Notarization timeout", {
1794
+ log5.warn("Notarization timeout", {
1917
1795
  timeout,
1918
1796
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
1919
1797
  }, {
@@ -1932,14 +1810,14 @@ _ts_decorate2([
1932
1810
  ], NotarizationPlugin.prototype, "_spaceId", void 0);
1933
1811
  var handleEdgeError = (error) => {
1934
1812
  if (!(error instanceof EdgeCallFailedError) || error.errorData) {
1935
- log6.catch(error, void 0, {
1813
+ log5.catch(error, void 0, {
1936
1814
  F: __dxlog_file8,
1937
1815
  L: 381,
1938
1816
  S: void 0,
1939
1817
  C: (f, a) => f(...a)
1940
1818
  });
1941
1819
  } else {
1942
- log6.info("Edge notarization failure", {
1820
+ log5.info("Edge notarization failure", {
1943
1821
  reason: error.reason
1944
1822
  }, {
1945
1823
  F: __dxlog_file8,
@@ -1987,7 +1865,7 @@ import { DeviceStateMachine, createCredentialSignerWithKey, createCredentialSign
1987
1865
  import { writeMessages as writeMessages3 } from "@dxos/feed-store";
1988
1866
  import { invariant as invariant7 } from "@dxos/invariant";
1989
1867
  import { PublicKey as PublicKey6 } from "@dxos/keys";
1990
- import { log as log10 } from "@dxos/log";
1868
+ import { log as log9 } from "@dxos/log";
1991
1869
  import { AdmittedFeed as AdmittedFeed2 } from "@dxos/protocols/proto/dxos/halo/credentials";
1992
1870
  import { Timeframe as Timeframe2 } from "@dxos/timeframe";
1993
1871
  import { trace as trace3 } from "@dxos/tracing";
@@ -1996,7 +1874,7 @@ import { ComplexSet as ComplexSet2 } from "@dxos/util";
1996
1874
  // packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts
1997
1875
  import { getCredentialAssertion } from "@dxos/credentials";
1998
1876
  import { SpaceId } from "@dxos/keys";
1999
- import { log as log7 } from "@dxos/log";
1877
+ import { log as log6 } from "@dxos/log";
2000
1878
  var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts";
2001
1879
  var DefaultSpaceStateMachine = class {
2002
1880
  constructor(_params) {
@@ -2010,7 +1888,7 @@ var DefaultSpaceStateMachine = class {
2010
1888
  switch (assertion["@type"]) {
2011
1889
  case "dxos.halo.credentials.DefaultSpace": {
2012
1890
  if (!credential.subject.id.equals(this._params.identityKey)) {
2013
- log7.warn("Invalid default space credential", {
1891
+ log6.warn("Invalid default space credential", {
2014
1892
  expectedIdentity: this._params.identityKey,
2015
1893
  credential
2016
1894
  }, {
@@ -2022,7 +1900,7 @@ var DefaultSpaceStateMachine = class {
2022
1900
  return;
2023
1901
  }
2024
1902
  if (!SpaceId.isValid(assertion.spaceId)) {
2025
- log7.warn("Invalid default space id", {
1903
+ log6.warn("Invalid default space id", {
2026
1904
  id: assertion.spaceId
2027
1905
  }, {
2028
1906
  F: __dxlog_file9,
@@ -2041,16 +1919,16 @@ var DefaultSpaceStateMachine = class {
2041
1919
 
2042
1920
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
2043
1921
  import { Event as Event4, synchronized, trackLeaks } from "@dxos/async";
2044
- import { PropertiesType } from "@dxos/client-protocol";
1922
+ import { PropertiesType, TYPE_PROPERTIES } from "@dxos/client-protocol";
2045
1923
  import { LifecycleState, Resource as Resource4, cancelWithContext } from "@dxos/context";
2046
1924
  import { createAdmissionCredentials, getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
2047
- import { convertLegacyReferences as convertLegacyReferences2, findInlineObjectOfType as findInlineObjectOfType2, AuthStatus, CredentialServerExtension } from "@dxos/echo-pipeline";
2048
- import { LEGACY_TYPE_PROPERTIES, SpaceDocVersion as SpaceDocVersion2, encodeReference } from "@dxos/echo-protocol";
2049
- import { TYPE_PROPERTIES as TYPE_PROPERTIES2, createObjectId, getTypeReference } from "@dxos/echo-schema";
1925
+ import { findInlineObjectOfType, AuthStatus, CredentialServerExtension } from "@dxos/echo-pipeline";
1926
+ import { SpaceDocVersion, encodeReference } from "@dxos/echo-protocol";
1927
+ import { createObjectId, getTypeReference } from "@dxos/echo-schema";
2050
1928
  import { writeMessages } from "@dxos/feed-store";
2051
1929
  import { invariant as invariant5 } from "@dxos/invariant";
2052
1930
  import { PublicKey as PublicKey5 } from "@dxos/keys";
2053
- import { log as log8 } from "@dxos/log";
1931
+ import { log as log7 } from "@dxos/log";
2054
1932
  import { AlreadyJoinedError, trace as Trace } from "@dxos/protocols";
2055
1933
  import { Invitation, SpaceState } from "@dxos/protocols/proto/dxos/client/services";
2056
1934
  import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
@@ -2173,7 +2051,7 @@ var DataSpaceManager = class extends Resource4 {
2173
2051
  const rootUrl = space.automergeSpaceState.rootUrl;
2174
2052
  const rootHandle = rootUrl ? this._echoHost.automergeRepo.find(rootUrl) : void 0;
2175
2053
  const rootDoc = rootHandle?.docSync();
2176
- const properties = rootDoc && findInlineObjectOfType2(rootDoc, TYPE_PROPERTIES2);
2054
+ const properties = rootDoc && findInlineObjectOfType(rootDoc, TYPE_PROPERTIES);
2177
2055
  return {
2178
2056
  key: space.key.toHex(),
2179
2057
  state: SpaceState[space.state],
@@ -2193,65 +2071,65 @@ var DataSpaceManager = class extends Resource4 {
2193
2071
  return this._spaces;
2194
2072
  }
2195
2073
  async _open() {
2196
- log8("open", void 0, {
2074
+ log7("open", void 0, {
2197
2075
  F: __dxlog_file10,
2198
- L: 199,
2076
+ L: 192,
2199
2077
  S: this,
2200
2078
  C: (f, a) => f(...a)
2201
2079
  });
2202
- log8.trace("dxos.echo.data-space-manager.open", Trace.begin({
2080
+ log7.trace("dxos.echo.data-space-manager.open", Trace.begin({
2203
2081
  id: this._instanceId
2204
2082
  }), {
2205
2083
  F: __dxlog_file10,
2206
- L: 200,
2084
+ L: 193,
2207
2085
  S: this,
2208
2086
  C: (f, a) => f(...a)
2209
2087
  });
2210
- log8("metadata loaded", {
2088
+ log7("metadata loaded", {
2211
2089
  spaces: this._metadataStore.spaces.length
2212
2090
  }, {
2213
2091
  F: __dxlog_file10,
2214
- L: 201,
2092
+ L: 194,
2215
2093
  S: this,
2216
2094
  C: (f, a) => f(...a)
2217
2095
  });
2218
2096
  await forEachAsync(this._metadataStore.spaces, async (spaceMetadata) => {
2219
2097
  try {
2220
- log8("load space", {
2098
+ log7("load space", {
2221
2099
  spaceMetadata
2222
2100
  }, {
2223
2101
  F: __dxlog_file10,
2224
- L: 205,
2102
+ L: 198,
2225
2103
  S: this,
2226
2104
  C: (f, a) => f(...a)
2227
2105
  });
2228
2106
  await this._constructSpace(spaceMetadata);
2229
2107
  } catch (err) {
2230
- log8.error("Error loading space", {
2108
+ log7.error("Error loading space", {
2231
2109
  spaceMetadata,
2232
2110
  err
2233
2111
  }, {
2234
2112
  F: __dxlog_file10,
2235
- L: 208,
2113
+ L: 201,
2236
2114
  S: this,
2237
2115
  C: (f, a) => f(...a)
2238
2116
  });
2239
2117
  }
2240
2118
  });
2241
2119
  this.updated.emit();
2242
- log8.trace("dxos.echo.data-space-manager.open", Trace.end({
2120
+ log7.trace("dxos.echo.data-space-manager.open", Trace.end({
2243
2121
  id: this._instanceId
2244
2122
  }), {
2245
2123
  F: __dxlog_file10,
2246
- L: 214,
2124
+ L: 207,
2247
2125
  S: this,
2248
2126
  C: (f, a) => f(...a)
2249
2127
  });
2250
2128
  }
2251
2129
  async _close() {
2252
- log8("close", void 0, {
2130
+ log7("close", void 0, {
2253
2131
  F: __dxlog_file10,
2254
- L: 219,
2132
+ L: 212,
2255
2133
  S: this,
2256
2134
  C: (f, a) => f(...a)
2257
2135
  });
@@ -2266,7 +2144,7 @@ var DataSpaceManager = class extends Resource4 {
2266
2144
  async createSpace() {
2267
2145
  invariant5(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
2268
2146
  F: __dxlog_file10,
2269
- L: 231,
2147
+ L: 224,
2270
2148
  S: this,
2271
2149
  A: [
2272
2150
  "this._lifecycleState === LifecycleState.OPEN",
@@ -2283,11 +2161,11 @@ var DataSpaceManager = class extends Resource4 {
2283
2161
  dataFeedKey,
2284
2162
  state: SpaceState.SPACE_ACTIVE
2285
2163
  };
2286
- log8("creating space...", {
2164
+ log7("creating space...", {
2287
2165
  spaceKey
2288
2166
  }, {
2289
2167
  F: __dxlog_file10,
2290
- L: 243,
2168
+ L: 236,
2291
2169
  S: this,
2292
2170
  C: (f, a) => f(...a)
2293
2171
  });
@@ -2299,7 +2177,7 @@ var DataSpaceManager = class extends Resource4 {
2299
2177
  const memberCredential = credentials[1];
2300
2178
  invariant5(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2301
2179
  F: __dxlog_file10,
2302
- L: 253,
2180
+ L: 246,
2303
2181
  S: this,
2304
2182
  A: [
2305
2183
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2316,22 +2194,20 @@ var DataSpaceManager = class extends Resource4 {
2316
2194
  return false;
2317
2195
  }
2318
2196
  switch (space.databaseRoot.getVersion()) {
2319
- case SpaceDocVersion2.CURRENT: {
2320
- const [_, properties] = findInlineObjectOfType2(space.databaseRoot.docSync(), TYPE_PROPERTIES2) ?? [];
2197
+ case SpaceDocVersion.CURRENT: {
2198
+ const [_, properties] = findInlineObjectOfType(space.databaseRoot.docSync(), TYPE_PROPERTIES) ?? [];
2321
2199
  return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
2322
2200
  }
2323
- case SpaceDocVersion2.LEGACY: {
2324
- const convertedDoc = await convertLegacyReferences2(space.databaseRoot.docSync());
2325
- const [_, properties] = findInlineObjectOfType2(convertedDoc, LEGACY_TYPE_PROPERTIES) ?? [];
2326
- return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
2201
+ case SpaceDocVersion.LEGACY: {
2202
+ throw new Error("Legacy space version is not supported");
2327
2203
  }
2328
2204
  default:
2329
- log8.warn("unknown space version", {
2205
+ log7.warn("unknown space version", {
2330
2206
  version: space.databaseRoot.getVersion(),
2331
2207
  spaceId: space.id
2332
2208
  }, {
2333
2209
  F: __dxlog_file10,
2334
- L: 278,
2210
+ L: 269,
2335
2211
  S: this,
2336
2212
  C: (f, a) => f(...a)
2337
2213
  });
@@ -2366,7 +2242,7 @@ var DataSpaceManager = class extends Resource4 {
2366
2242
  const automergeIndex = space.automergeSpaceState.rootUrl;
2367
2243
  invariant5(automergeIndex, void 0, {
2368
2244
  F: __dxlog_file10,
2369
- L: 311,
2245
+ L: 302,
2370
2246
  S: this,
2371
2247
  A: [
2372
2248
  "automergeIndex",
@@ -2379,17 +2255,17 @@ var DataSpaceManager = class extends Resource4 {
2379
2255
  }
2380
2256
  // TODO(burdon): Rename join space.
2381
2257
  async acceptSpace(opts) {
2382
- log8("accept space", {
2258
+ log7("accept space", {
2383
2259
  opts
2384
2260
  }, {
2385
2261
  F: __dxlog_file10,
2386
- L: 320,
2262
+ L: 311,
2387
2263
  S: this,
2388
2264
  C: (f, a) => f(...a)
2389
2265
  });
2390
2266
  invariant5(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
2391
2267
  F: __dxlog_file10,
2392
- L: 321,
2268
+ L: 312,
2393
2269
  S: this,
2394
2270
  A: [
2395
2271
  "this._lifecycleState === LifecycleState.OPEN",
@@ -2398,7 +2274,7 @@ var DataSpaceManager = class extends Resource4 {
2398
2274
  });
2399
2275
  invariant5(!this._spaces.has(opts.spaceKey), "Space already exists.", {
2400
2276
  F: __dxlog_file10,
2401
- L: 322,
2277
+ L: 313,
2402
2278
  S: this,
2403
2279
  A: [
2404
2280
  "!this._spaces.has(opts.spaceKey)",
@@ -2422,7 +2298,7 @@ var DataSpaceManager = class extends Resource4 {
2422
2298
  const space = this._spaceManager.spaces.get(options.spaceKey);
2423
2299
  invariant5(space, void 0, {
2424
2300
  F: __dxlog_file10,
2425
- L: 342,
2301
+ L: 333,
2426
2302
  S: this,
2427
2303
  A: [
2428
2304
  "space",
@@ -2435,7 +2311,7 @@ var DataSpaceManager = class extends Resource4 {
2435
2311
  const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
2436
2312
  invariant5(credentials[0].credential, void 0, {
2437
2313
  F: __dxlog_file10,
2438
- L: 361,
2314
+ L: 352,
2439
2315
  S: this,
2440
2316
  A: [
2441
2317
  "credentials[0].credential",
@@ -2445,7 +2321,7 @@ var DataSpaceManager = class extends Resource4 {
2445
2321
  const spaceMemberCredential = credentials[0].credential.credential;
2446
2322
  invariant5(getCredentialAssertion2(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2447
2323
  F: __dxlog_file10,
2448
- L: 363,
2324
+ L: 354,
2449
2325
  S: this,
2450
2326
  A: [
2451
2327
  "getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2483,7 +2359,7 @@ var DataSpaceManager = class extends Resource4 {
2483
2359
  const space = this._spaces.get(spaceKey);
2484
2360
  invariant5(space, "Space not found.", {
2485
2361
  F: __dxlog_file10,
2486
- L: 400,
2362
+ L: 391,
2487
2363
  S: this,
2488
2364
  A: [
2489
2365
  "space",
@@ -2504,11 +2380,11 @@ var DataSpaceManager = class extends Resource4 {
2504
2380
  space.stateUpdate.emit();
2505
2381
  }
2506
2382
  async _constructSpace(metadata) {
2507
- log8("construct space", {
2383
+ log7("construct space", {
2508
2384
  metadata
2509
2385
  }, {
2510
2386
  F: __dxlog_file10,
2511
- L: 419,
2387
+ L: 410,
2512
2388
  S: this,
2513
2389
  C: (f, a) => f(...a)
2514
2390
  });
@@ -2548,11 +2424,11 @@ var DataSpaceManager = class extends Resource4 {
2548
2424
  session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
2549
2425
  await this._connectEchoMeshReplicator(space, session);
2550
2426
  } catch (err) {
2551
- log8.warn("error on authorized connection", {
2427
+ log7.warn("error on authorized connection", {
2552
2428
  err
2553
2429
  }, {
2554
2430
  F: __dxlog_file10,
2555
- L: 461,
2431
+ L: 452,
2556
2432
  S: this,
2557
2433
  C: (f, a) => f(...a)
2558
2434
  });
@@ -2560,9 +2436,9 @@ var DataSpaceManager = class extends Resource4 {
2560
2436
  }
2561
2437
  }),
2562
2438
  onAuthFailure: () => {
2563
- log8.warn("auth failure", void 0, {
2439
+ log7.warn("auth failure", void 0, {
2564
2440
  F: __dxlog_file10,
2565
- L: 466,
2441
+ L: 457,
2566
2442
  S: this,
2567
2443
  C: (f, a) => f(...a)
2568
2444
  });
@@ -2591,22 +2467,22 @@ var DataSpaceManager = class extends Resource4 {
2591
2467
  signingContext: this._signingContext,
2592
2468
  callbacks: {
2593
2469
  beforeReady: async () => {
2594
- log8("before space ready", {
2470
+ log7("before space ready", {
2595
2471
  space: space.key
2596
2472
  }, {
2597
2473
  F: __dxlog_file10,
2598
- L: 493,
2474
+ L: 484,
2599
2475
  S: this,
2600
2476
  C: (f, a) => f(...a)
2601
2477
  });
2602
2478
  },
2603
2479
  afterReady: async () => {
2604
- log8("after space ready", {
2480
+ log7("after space ready", {
2605
2481
  space: space.key,
2606
2482
  open: this._lifecycleState === LifecycleState.OPEN
2607
2483
  }, {
2608
2484
  F: __dxlog_file10,
2609
- L: 496,
2485
+ L: 487,
2610
2486
  S: this,
2611
2487
  C: (f, a) => f(...a)
2612
2488
  });
@@ -2621,11 +2497,11 @@ var DataSpaceManager = class extends Resource4 {
2621
2497
  }
2622
2498
  },
2623
2499
  beforeClose: async () => {
2624
- log8("before space close", {
2500
+ log7("before space close", {
2625
2501
  space: space.key
2626
2502
  }, {
2627
2503
  F: __dxlog_file10,
2628
- L: 504,
2504
+ L: 495,
2629
2505
  S: this,
2630
2506
  C: (f, a) => f(...a)
2631
2507
  });
@@ -2642,11 +2518,11 @@ var DataSpaceManager = class extends Resource4 {
2642
2518
  if (setting === EdgeReplicationSetting.ENABLED) {
2643
2519
  await this._echoEdgeReplicator?.connectToSpace(dataSpace.id);
2644
2520
  } else if (this._echoEdgeReplicator) {
2645
- log8("not connecting EchoEdgeReplicator because of EdgeReplicationSetting", {
2521
+ log7("not connecting EchoEdgeReplicator because of EdgeReplicationSetting", {
2646
2522
  spaceId: dataSpace.id
2647
2523
  }, {
2648
2524
  F: __dxlog_file10,
2649
- L: 518,
2525
+ L: 509,
2650
2526
  S: this,
2651
2527
  C: (f, a) => f(...a)
2652
2528
  });
@@ -2672,11 +2548,11 @@ var DataSpaceManager = class extends Resource4 {
2672
2548
  async _connectEchoMeshReplicator(space, session) {
2673
2549
  const replicator = this._meshReplicator;
2674
2550
  if (!replicator) {
2675
- log8.warn("p2p automerge replication disabled", {
2551
+ log7.warn("p2p automerge replication disabled", {
2676
2552
  space: space.key
2677
2553
  }, {
2678
2554
  F: __dxlog_file10,
2679
- L: 545,
2555
+ L: 536,
2680
2556
  S: this,
2681
2557
  C: (f, a) => f(...a)
2682
2558
  });
@@ -2699,17 +2575,17 @@ var DataSpaceManager = class extends Resource4 {
2699
2575
  return (s && member.role === SpaceMember3.Role.REMOVED !== (s.authStatus === AuthStatus.FAILURE)) ?? false;
2700
2576
  });
2701
2577
  sessionsToClose.forEach((session) => {
2702
- void session.close().catch(log8.error);
2578
+ void session.close().catch(log7.error);
2703
2579
  });
2704
2580
  closedSessions += sessionsToClose.length;
2705
2581
  }
2706
- log8("processed member role changes", {
2582
+ log7("processed member role changes", {
2707
2583
  roleChangeCount: memberInfo.length,
2708
2584
  peersOnline: presence.getPeersOnline().length,
2709
2585
  closedSessions
2710
2586
  }, {
2711
2587
  F: __dxlog_file10,
2712
- L: 571,
2588
+ L: 562,
2713
2589
  S: this,
2714
2590
  C: (f, a) => f(...a)
2715
2591
  });
@@ -2720,15 +2596,15 @@ var DataSpaceManager = class extends Resource4 {
2720
2596
  if (role === SpaceMember3.Role.REMOVED) {
2721
2597
  const session = peerState.peerId && space.protocol.sessions.get(peerState.peerId);
2722
2598
  if (session != null) {
2723
- log8("closing a session with a removed peer", {
2599
+ log7("closing a session with a removed peer", {
2724
2600
  peerId: peerState.peerId
2725
2601
  }, {
2726
2602
  F: __dxlog_file10,
2727
- L: 585,
2603
+ L: 576,
2728
2604
  S: this,
2729
2605
  C: (f, a) => f(...a)
2730
2606
  });
2731
- void session.close().catch(log8.error);
2607
+ void session.close().catch(log7.error);
2732
2608
  }
2733
2609
  }
2734
2610
  }
@@ -2791,7 +2667,7 @@ import { createAdmissionCredentials as createAdmissionCredentials2, getCredentia
2791
2667
  import { raise } from "@dxos/debug";
2792
2668
  import { writeMessages as writeMessages2 } from "@dxos/feed-store";
2793
2669
  import { invariant as invariant6 } from "@dxos/invariant";
2794
- import { log as log9 } from "@dxos/log";
2670
+ import { log as log8 } from "@dxos/log";
2795
2671
  import { ApiError, SpaceNotFoundError, encodeError, IdentityNotInitializedError, AuthorizationError } from "@dxos/protocols";
2796
2672
  import { SpaceMember as SpaceMember4, SpaceState as SpaceState2 } from "@dxos/protocols/proto/dxos/client/services";
2797
2673
  import { trace as trace2 } from "@dxos/tracing";
@@ -2867,7 +2743,7 @@ var SpacesServiceImpl = class {
2867
2743
  const scheduler = new UpdateScheduler(ctx, async () => {
2868
2744
  const dataSpaceManager = await this._getDataSpaceManager();
2869
2745
  const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
2870
- log9("update", () => ({
2746
+ log8("update", () => ({
2871
2747
  ids: spaces.map((space) => space.id)
2872
2748
  }), {
2873
2749
  F: __dxlog_file11,
@@ -3148,7 +3024,7 @@ var Identity = class {
3148
3024
  this._presence = params.presence;
3149
3025
  this.identityKey = params.identityKey;
3150
3026
  this.deviceKey = params.deviceKey;
3151
- log10.trace("dxos.halo.device", {
3027
+ log9.trace("dxos.halo.device", {
3152
3028
  deviceKey: params.deviceKey
3153
3029
  }, {
3154
3030
  F: __dxlog_file12,
@@ -3290,7 +3166,7 @@ var Identity = class {
3290
3166
  ]));
3291
3167
  }
3292
3168
  async admitDevice({ deviceKey, controlFeedKey, dataFeedKey }) {
3293
- log10("Admitting device:", {
3169
+ log9("Admitting device:", {
3294
3170
  identityKey: this.identityKey,
3295
3171
  hostDevice: this.deviceKey,
3296
3172
  deviceKey,
@@ -3358,7 +3234,7 @@ import { Context as Context4 } from "@dxos/context";
3358
3234
  import { createCredentialSignerWithKey as createCredentialSignerWithKey2, CredentialGenerator, generateSeedPhrase, keyPairFromSeedPhrase } from "@dxos/credentials";
3359
3235
  import { invariant as invariant8 } from "@dxos/invariant";
3360
3236
  import { PublicKey as PublicKey7 } from "@dxos/keys";
3361
- import { log as log11 } from "@dxos/log";
3237
+ import { log as log10 } from "@dxos/log";
3362
3238
  import { trace as trace4 } from "@dxos/protocols";
3363
3239
  import { Device, DeviceKind } from "@dxos/protocols/proto/dxos/client/services";
3364
3240
  import { AdmittedFeed as AdmittedFeed3, DeviceType } from "@dxos/protocols/proto/dxos/halo/credentials";
@@ -3393,7 +3269,7 @@ var IdentityManager = class {
3393
3269
  }
3394
3270
  async open(ctx) {
3395
3271
  const traceId = PublicKey7.random().toHex();
3396
- log11.trace("dxos.halo.identity-manager.open", trace4.begin({
3272
+ log10.trace("dxos.halo.identity-manager.open", trace4.begin({
3397
3273
  id: traceId
3398
3274
  }), {
3399
3275
  F: __dxlog_file13,
@@ -3402,7 +3278,7 @@ var IdentityManager = class {
3402
3278
  C: (f, a) => f(...a)
3403
3279
  });
3404
3280
  const identityRecord = this._metadataStore.getIdentityRecord();
3405
- log11("identity record", {
3281
+ log10("identity record", {
3406
3282
  identityRecord
3407
3283
  }, {
3408
3284
  F: __dxlog_file13,
@@ -3414,7 +3290,7 @@ var IdentityManager = class {
3414
3290
  this._identity = await this._constructIdentity(identityRecord);
3415
3291
  await this._identity.open(ctx);
3416
3292
  await this._identity.ready();
3417
- log11.trace("dxos.halo.identity", {
3293
+ log10.trace("dxos.halo.identity", {
3418
3294
  identityKey: identityRecord.identityKey,
3419
3295
  displayName: this._identity.profileDocument?.displayName
3420
3296
  }, {
@@ -3425,7 +3301,7 @@ var IdentityManager = class {
3425
3301
  });
3426
3302
  this.stateUpdate.emit();
3427
3303
  }
3428
- log11.trace("dxos.halo.identity-manager.open", trace4.end({
3304
+ log10.trace("dxos.halo.identity-manager.open", trace4.end({
3429
3305
  id: traceId
3430
3306
  }), {
3431
3307
  F: __dxlog_file13,
@@ -3450,7 +3326,7 @@ var IdentityManager = class {
3450
3326
  "'Identity already exists.'"
3451
3327
  ]
3452
3328
  });
3453
- log11("creating identity...", void 0, {
3329
+ log10("creating identity...", void 0, {
3454
3330
  F: __dxlog_file13,
3455
3331
  L: 146,
3456
3332
  S: this,
@@ -3519,7 +3395,7 @@ var IdentityManager = class {
3519
3395
  await this._metadataStore.setIdentityRecord(identityRecord);
3520
3396
  this._identity = identity;
3521
3397
  await this._identity.ready();
3522
- log11.trace("dxos.halo.identity", {
3398
+ log10.trace("dxos.halo.identity", {
3523
3399
  identityKey: identityRecord.identityKey,
3524
3400
  displayName: this._identity.profileDocument?.displayName
3525
3401
  }, {
@@ -3529,7 +3405,7 @@ var IdentityManager = class {
3529
3405
  C: (f, a) => f(...a)
3530
3406
  });
3531
3407
  this.stateUpdate.emit();
3532
- log11("created identity", {
3408
+ log10("created identity", {
3533
3409
  identityKey: identity.identityKey,
3534
3410
  deviceKey: identity.deviceKey,
3535
3411
  profile: identity.profileDocument
@@ -3568,7 +3444,7 @@ var IdentityManager = class {
3568
3444
  * Prepare an identity object as the first step of acceptIdentity flow.
3569
3445
  */
3570
3446
  async prepareIdentity(params) {
3571
- log11("accepting identity", {
3447
+ log10("accepting identity", {
3572
3448
  params
3573
3449
  }, {
3574
3450
  F: __dxlog_file13,
@@ -3613,7 +3489,7 @@ var IdentityManager = class {
3613
3489
  this._identity = identity;
3614
3490
  await this._identity.ready();
3615
3491
  await this._metadataStore.setIdentityRecord(identityRecord);
3616
- log11.trace("dxos.halo.identity", {
3492
+ log10.trace("dxos.halo.identity", {
3617
3493
  identityKey: this._identity.identityKey,
3618
3494
  displayName: this._identity.profileDocument?.displayName
3619
3495
  }, {
@@ -3627,7 +3503,7 @@ var IdentityManager = class {
3627
3503
  ...profile
3628
3504
  });
3629
3505
  this.stateUpdate.emit();
3630
- log11("accepted identity", {
3506
+ log10("accepted identity", {
3631
3507
  identityKey: identity.identityKey,
3632
3508
  deviceKey: identity.deviceKey
3633
3509
  }, {
@@ -3755,7 +3631,7 @@ var IdentityManager = class {
3755
3631
  ""
3756
3632
  ]
3757
3633
  });
3758
- log11("constructing identity", {
3634
+ log10("constructing identity", {
3759
3635
  identityRecord
3760
3636
  }, {
3761
3637
  F: __dxlog_file13,
@@ -3819,7 +3695,7 @@ var IdentityManager = class {
3819
3695
  edgeConnection: this._edgeConnection,
3820
3696
  edgeFeatures: this._edgeFeatures
3821
3697
  });
3822
- log11("done", {
3698
+ log10("done", {
3823
3699
  identityKey: identityRecord.identityKey
3824
3700
  }, {
3825
3701
  F: __dxlog_file13,
@@ -3846,7 +3722,7 @@ var IdentityManager = class {
3846
3722
  }));
3847
3723
  },
3848
3724
  onAuthFailure: () => {
3849
- log11.warn("auth failure", void 0, {
3725
+ log10.warn("auth failure", void 0, {
3850
3726
  F: __dxlog_file13,
3851
3727
  L: 434,
3852
3728
  S: this,
@@ -3874,9 +3750,9 @@ IdentityManager = _ts_decorate5([
3874
3750
  import { Trigger as Trigger4, sleep as sleep2 } from "@dxos/async";
3875
3751
  import { Stream as Stream8 } from "@dxos/codec-protobuf";
3876
3752
  import { Resource as Resource5 } from "@dxos/context";
3877
- import { signPresentation } from "@dxos/credentials";
3753
+ import { createCredential as createCredential2, signPresentation } from "@dxos/credentials";
3878
3754
  import { invariant as invariant9 } from "@dxos/invariant";
3879
- import { log as log12 } from "@dxos/log";
3755
+ import { log as log11 } from "@dxos/log";
3880
3756
  import { SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
3881
3757
  import { safeAwaitAll } from "@dxos/util";
3882
3758
  var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
@@ -3979,6 +3855,28 @@ var IdentityServiceImpl = class extends Resource5 {
3979
3855
  nonce
3980
3856
  });
3981
3857
  }
3858
+ async createAuthCredential() {
3859
+ const identity = this._identityManager.identity;
3860
+ invariant9(identity, "Identity not initialized.", {
3861
+ F: __dxlog_file14,
3862
+ L: 117,
3863
+ S: this,
3864
+ A: [
3865
+ "identity",
3866
+ "'Identity not initialized.'"
3867
+ ]
3868
+ });
3869
+ return await createCredential2({
3870
+ assertion: {
3871
+ "@type": "dxos.halo.credentials.Auth"
3872
+ },
3873
+ issuer: identity.identityKey,
3874
+ subject: identity.identityKey,
3875
+ chain: identity.deviceCredentialChain,
3876
+ signingKey: identity.deviceKey,
3877
+ signer: this._keyring
3878
+ });
3879
+ }
3982
3880
  async _fixIdentityWithoutDefaultSpace(identity) {
3983
3881
  let recodedDefaultSpace = false;
3984
3882
  let foundDefaultSpace = false;
@@ -3995,11 +3893,11 @@ var IdentityServiceImpl = class extends Resource5 {
3995
3893
  }
3996
3894
  if (await dataSpaceManager.isDefaultSpace(space)) {
3997
3895
  if (foundDefaultSpace) {
3998
- log12.warn("Multiple default spaces found. Using the first one.", {
3896
+ log11.warn("Multiple default spaces found. Using the first one.", {
3999
3897
  duplicate: space.id
4000
3898
  }, {
4001
3899
  F: __dxlog_file14,
4002
- L: 136,
3900
+ L: 151,
4003
3901
  S: this,
4004
3902
  C: (f, a) => f(...a)
4005
3903
  });
@@ -4011,9 +3909,9 @@ var IdentityServiceImpl = class extends Resource5 {
4011
3909
  recordedDefaultSpaceTrigger.wake();
4012
3910
  }
4013
3911
  }, (err) => {
4014
- log12.catch(err, void 0, {
3912
+ log11.catch(err, void 0, {
4015
3913
  F: __dxlog_file14,
4016
- L: 147,
3914
+ L: 162,
4017
3915
  S: this,
4018
3916
  C: (f, a) => f(...a)
4019
3917
  });
@@ -4152,7 +4050,7 @@ var DataSpace = class {
4152
4050
  });
4153
4051
  }
4154
4052
  this._state = params.initialState;
4155
- log13("new state", {
4053
+ log12("new state", {
4156
4054
  state: SpaceState4[this._state]
4157
4055
  }, {
4158
4056
  F: __dxlog_file15,
@@ -4220,7 +4118,7 @@ var DataSpace = class {
4220
4118
  await this._inner.startProtocol();
4221
4119
  await this._edgeFeedReplicator?.open();
4222
4120
  this._state = SpaceState4.SPACE_CONTROL_ONLY;
4223
- log13("new state", {
4121
+ log12("new state", {
4224
4122
  state: SpaceState4[this._state]
4225
4123
  }, {
4226
4124
  F: __dxlog_file15,
@@ -4240,7 +4138,7 @@ var DataSpace = class {
4240
4138
  await this._callbacks.beforeClose?.();
4241
4139
  await this.preClose.callSerial();
4242
4140
  this._state = SpaceState4.SPACE_CLOSED;
4243
- log13("new state", {
4141
+ log12("new state", {
4244
4142
  state: SpaceState4[this._state]
4245
4143
  }, {
4246
4144
  F: __dxlog_file15,
@@ -4282,7 +4180,7 @@ var DataSpace = class {
4282
4180
  await this.initializeDataPipeline();
4283
4181
  } catch (err) {
4284
4182
  if (err instanceof CancelledError || err instanceof ContextDisposedError) {
4285
- log13("data pipeline initialization cancelled", err, {
4183
+ log12("data pipeline initialization cancelled", err, {
4286
4184
  F: __dxlog_file15,
4287
4185
  L: 311,
4288
4186
  S: this,
@@ -4290,14 +4188,14 @@ var DataSpace = class {
4290
4188
  });
4291
4189
  return;
4292
4190
  }
4293
- log13.error("Error initializing data pipeline", err, {
4191
+ log12.error("Error initializing data pipeline", err, {
4294
4192
  F: __dxlog_file15,
4295
4193
  L: 315,
4296
4194
  S: this,
4297
4195
  C: (f, a) => f(...a)
4298
4196
  });
4299
4197
  this._state = SpaceState4.SPACE_ERROR;
4300
- log13("new state", {
4198
+ log12("new state", {
4301
4199
  state: SpaceState4[this._state]
4302
4200
  }, {
4303
4201
  F: __dxlog_file15,
@@ -4317,7 +4215,7 @@ var DataSpace = class {
4317
4215
  throw new SystemError("Invalid operation");
4318
4216
  }
4319
4217
  this._state = SpaceState4.SPACE_INITIALIZING;
4320
- log13("new state", {
4218
+ log12("new state", {
4321
4219
  state: SpaceState4[this._state]
4322
4220
  }, {
4323
4221
  F: __dxlog_file15,
@@ -4325,7 +4223,7 @@ var DataSpace = class {
4325
4223
  S: this,
4326
4224
  C: (f, a) => f(...a)
4327
4225
  });
4328
- log13("initializing control pipeline", void 0, {
4226
+ log12("initializing control pipeline", void 0, {
4329
4227
  F: __dxlog_file15,
4330
4228
  L: 335,
4331
4229
  S: this,
@@ -4334,21 +4232,21 @@ var DataSpace = class {
4334
4232
  await this._initializeAndReadControlPipeline();
4335
4233
  await sleep3(1);
4336
4234
  const ready = this.stateUpdate.waitForCondition(() => this._state === SpaceState4.SPACE_READY);
4337
- log13("initializing automerge root", void 0, {
4235
+ log12("initializing automerge root", void 0, {
4338
4236
  F: __dxlog_file15,
4339
4237
  L: 343,
4340
4238
  S: this,
4341
4239
  C: (f, a) => f(...a)
4342
4240
  });
4343
4241
  this._automergeSpaceState.startProcessingRootDocs();
4344
- log13("waiting for space to be ready", void 0, {
4242
+ log12("waiting for space to be ready", void 0, {
4345
4243
  F: __dxlog_file15,
4346
4244
  L: 347,
4347
4245
  S: this,
4348
4246
  C: (f, a) => f(...a)
4349
4247
  });
4350
4248
  await ready;
4351
- log13("space is ready", void 0, {
4249
+ log12("space is ready", void 0, {
4352
4250
  F: __dxlog_file15,
4353
4251
  L: 349,
4354
4252
  S: this,
@@ -4358,7 +4256,7 @@ var DataSpace = class {
4358
4256
  async _enterReadyState() {
4359
4257
  await this._callbacks.beforeReady?.();
4360
4258
  this._state = SpaceState4.SPACE_READY;
4361
- log13("new state", {
4259
+ log12("new state", {
4362
4260
  state: SpaceState4[this._state]
4363
4261
  }, {
4364
4262
  F: __dxlog_file15,
@@ -4377,7 +4275,7 @@ var DataSpace = class {
4377
4275
  });
4378
4276
  this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
4379
4277
  await this._createWritableFeeds();
4380
- log13("writable feeds created", void 0, {
4278
+ log12("writable feeds created", void 0, {
4381
4279
  F: __dxlog_file15,
4382
4280
  L: 373,
4383
4281
  S: this,
@@ -4429,7 +4327,7 @@ var DataSpace = class {
4429
4327
  }
4430
4328
  if (credentials.length > 0) {
4431
4329
  try {
4432
- log13("will notarize credentials for feed admission", {
4330
+ log12("will notarize credentials for feed admission", {
4433
4331
  count: credentials.length
4434
4332
  }, {
4435
4333
  F: __dxlog_file15,
@@ -4442,14 +4340,14 @@ var DataSpace = class {
4442
4340
  credentials,
4443
4341
  timeout: 0
4444
4342
  });
4445
- log13("credentials notarized", void 0, {
4343
+ log12("credentials notarized", void 0, {
4446
4344
  F: __dxlog_file15,
4447
4345
  L: 435,
4448
4346
  S: this,
4449
4347
  C: (f, a) => f(...a)
4450
4348
  });
4451
4349
  } catch (err) {
4452
- log13.error("error notarizing credentials for feed admission", err, {
4350
+ log12.error("error notarizing credentials for feed admission", err, {
4453
4351
  F: __dxlog_file15,
4454
4352
  L: 437,
4455
4353
  S: this,
@@ -4461,7 +4359,7 @@ var DataSpace = class {
4461
4359
  }
4462
4360
  }
4463
4361
  _onNewAutomergeRoot(rootUrl) {
4464
- log13("loading automerge root doc for space", {
4362
+ log12("loading automerge root doc for space", {
4465
4363
  space: this.key,
4466
4364
  rootUrl
4467
4365
  }, {
@@ -4495,7 +4393,7 @@ var DataSpace = class {
4495
4393
  }
4496
4394
  const root = await this._echoHost.openSpaceRoot(this.id, handle.url);
4497
4395
  this._databaseRoot = root;
4498
- if (root.getVersion() !== SpaceDocVersion3.CURRENT) {
4396
+ if (root.getVersion() !== SpaceDocVersion2.CURRENT) {
4499
4397
  this._state = SpaceState4.SPACE_REQUIRES_MIGRATION;
4500
4398
  this.stateUpdate.emit();
4501
4399
  } else if (this._state !== SpaceState4.SPACE_READY) {
@@ -4512,7 +4410,7 @@ var DataSpace = class {
4512
4410
  if (err instanceof ContextDisposedError) {
4513
4411
  return;
4514
4412
  }
4515
- log13.warn("error loading automerge root doc", {
4413
+ log12.warn("error loading automerge root doc", {
4516
4414
  space: this.key,
4517
4415
  rootUrl,
4518
4416
  err
@@ -4604,7 +4502,7 @@ var DataSpace = class {
4604
4502
  await this._close();
4605
4503
  }
4606
4504
  this._state = SpaceState4.SPACE_INACTIVE;
4607
- log13("new state", {
4505
+ log12("new state", {
4608
4506
  state: SpaceState4[this._state]
4609
4507
  }, {
4610
4508
  F: __dxlog_file15,
@@ -4799,7 +4697,7 @@ import { ContextDisposedError as ContextDisposedError3 } from "@dxos/context";
4799
4697
  import { createKeyPair, sign as sign2 } from "@dxos/crypto";
4800
4698
  import { invariant as invariant15 } from "@dxos/invariant";
4801
4699
  import { PublicKey as PublicKey11 } from "@dxos/keys";
4802
- import { log as log19 } from "@dxos/log";
4700
+ import { log as log18 } from "@dxos/log";
4803
4701
  import { createTeleportProtocolFactory } from "@dxos/network-manager";
4804
4702
  import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError3, trace as trace7 } from "@dxos/protocols";
4805
4703
  import { Invitation as Invitation7 } from "@dxos/protocols/proto/dxos/client/services";
@@ -4813,7 +4711,7 @@ import { scheduleMicroTask as scheduleMicroTask3, scheduleTask as scheduleTask5
4813
4711
  import { sign } from "@dxos/crypto";
4814
4712
  import { invariant as invariant11 } from "@dxos/invariant";
4815
4713
  import { SpaceId as SpaceId2 } from "@dxos/keys";
4816
- import { log as log14 } from "@dxos/log";
4714
+ import { log as log13 } from "@dxos/log";
4817
4715
  import { EdgeAuthChallengeError, EdgeCallFailedError as EdgeCallFailedError2 } from "@dxos/protocols";
4818
4716
  import { schema as schema3 } from "@dxos/protocols/proto";
4819
4717
  import { Invitation as Invitation4 } from "@dxos/protocols/proto/dxos/client/services";
@@ -4851,7 +4749,7 @@ var EdgeInvitationHandler = class {
4851
4749
  }
4852
4750
  handle(ctx, guardedState, protocol, deviceProfile) {
4853
4751
  if (!this._client) {
4854
- log14("edge disabled", void 0, {
4752
+ log13("edge disabled", void 0, {
4855
4753
  F: __dxlog_file17,
4856
4754
  L: 66,
4857
4755
  S: this,
@@ -4863,7 +4761,7 @@ var EdgeInvitationHandler = class {
4863
4761
  const spaceId = invitation.spaceId;
4864
4762
  const canBeHandledByEdge = invitation.authMethod !== Invitation4.AuthMethod.SHARED_SECRET && invitation.type === Invitation4.Type.DELEGATED && invitation.kind === Invitation4.Kind.SPACE && spaceId != null && SpaceId2.isValid(spaceId);
4865
4763
  if (!canBeHandledByEdge) {
4866
- log14("invitation could not be handled by edge", {
4764
+ log13("invitation could not be handled by edge", {
4867
4765
  invitation
4868
4766
  }, {
4869
4767
  F: __dxlog_file17,
@@ -4886,7 +4784,7 @@ var EdgeInvitationHandler = class {
4886
4784
  await this._handleSpaceInvitationFlow(ctx, guardedState, admissionRequest.space, spaceId);
4887
4785
  } catch (error) {
4888
4786
  if (error instanceof EdgeCallFailedError2) {
4889
- log14.info("join space with edge unsuccessful", {
4787
+ log13.info("join space with edge unsuccessful", {
4890
4788
  reason: error.message,
4891
4789
  retryable: error.isRetryable,
4892
4790
  after: error.retryAfterMs ?? this._calculateNextRetryMs()
@@ -4900,7 +4798,7 @@ var EdgeInvitationHandler = class {
4900
4798
  scheduleTask5(ctx, tryHandleInvitation, error.retryAfterMs ?? this._calculateNextRetryMs());
4901
4799
  }
4902
4800
  } else if (requestCount < MAX_RETRIES_PER_INVITATION) {
4903
- log14.info("failed to handle invitation with edge", {
4801
+ log13.info("failed to handle invitation with edge", {
4904
4802
  error
4905
4803
  }, {
4906
4804
  F: __dxlog_file17,
@@ -4917,14 +4815,14 @@ var EdgeInvitationHandler = class {
4917
4815
  }
4918
4816
  async _handleSpaceInvitationFlow(ctx, guardedState, admissionRequest, spaceId) {
4919
4817
  try {
4920
- log14("edge invitation flow", void 0, {
4818
+ log13("edge invitation flow", void 0, {
4921
4819
  F: __dxlog_file17,
4922
4820
  L: 123,
4923
4821
  S: this,
4924
4822
  C: (f, a) => f(...a)
4925
4823
  });
4926
4824
  this._flowLock = await tryAcquireBeforeContextDisposed(ctx, guardedState.mutex);
4927
- log14.verbose("edge invitation flow acquired the lock", void 0, {
4825
+ log13.verbose("edge invitation flow acquired the lock", void 0, {
4928
4826
  F: __dxlog_file17,
4929
4827
  L: 125,
4930
4828
  S: this,
@@ -4997,7 +4895,7 @@ var EdgeInvitationHandler = class {
4997
4895
  import { Trigger as Trigger5 } from "@dxos/async";
4998
4896
  import { cancelWithContext as cancelWithContext4, Context as Context6 } from "@dxos/context";
4999
4897
  import { invariant as invariant12 } from "@dxos/invariant";
5000
- import { log as log15 } from "@dxos/log";
4898
+ import { log as log14 } from "@dxos/log";
5001
4899
  import { InvalidInvitationExtensionRoleError } from "@dxos/protocols";
5002
4900
  import { schema as schema4 } from "@dxos/protocols/proto";
5003
4901
  import { InvitationOptions } from "@dxos/protocols/proto/dxos/halo/invitations";
@@ -5057,14 +4955,14 @@ var InvitationGuestExtension = class extends RpcExtension2 {
5057
4955
  async onOpen(context) {
5058
4956
  await super.onOpen(context);
5059
4957
  try {
5060
- log15.verbose("guest acquire lock", void 0, {
4958
+ log14.verbose("guest acquire lock", void 0, {
5061
4959
  F: __dxlog_file18,
5062
4960
  L: 89,
5063
4961
  S: this,
5064
4962
  C: (f, a) => f(...a)
5065
4963
  });
5066
4964
  this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
5067
- log15.verbose("guest lock acquired", void 0, {
4965
+ log14.verbose("guest lock acquired", void 0, {
5068
4966
  F: __dxlog_file18,
5069
4967
  L: 91,
5070
4968
  S: this,
@@ -5073,7 +4971,7 @@ var InvitationGuestExtension = class extends RpcExtension2 {
5073
4971
  await cancelWithContext4(this._ctx, this.rpc.InvitationHostService.options({
5074
4972
  role: InvitationOptions.Role.GUEST
5075
4973
  }));
5076
- log15.verbose("options sent", void 0, {
4974
+ log14.verbose("options sent", void 0, {
5077
4975
  F: __dxlog_file18,
5078
4976
  L: 96,
5079
4977
  S: this,
@@ -5082,7 +4980,7 @@ var InvitationGuestExtension = class extends RpcExtension2 {
5082
4980
  await cancelWithContext4(this._ctx, this._remoteOptionsTrigger.wait({
5083
4981
  timeout: OPTIONS_TIMEOUT
5084
4982
  }));
5085
- log15.verbose("options received", void 0, {
4983
+ log14.verbose("options received", void 0, {
5086
4984
  F: __dxlog_file18,
5087
4985
  L: 98,
5088
4986
  S: this,
@@ -5116,7 +5014,7 @@ var InvitationGuestExtension = class extends RpcExtension2 {
5116
5014
  if (this._invitationFlowLock != null) {
5117
5015
  this._invitationFlowLock.release();
5118
5016
  this._invitationFlowLock = null;
5119
- log15.verbose("invitation flow lock released", void 0, {
5017
+ log14.verbose("invitation flow lock released", void 0, {
5120
5018
  F: __dxlog_file18,
5121
5019
  L: 131,
5122
5020
  S: this,
@@ -5132,7 +5030,7 @@ import { cancelWithContext as cancelWithContext5, Context as Context7 } from "@d
5132
5030
  import { randomBytes, verify } from "@dxos/crypto";
5133
5031
  import { invariant as invariant13, InvariantViolation } from "@dxos/invariant";
5134
5032
  import { PublicKey as PublicKey9 } from "@dxos/keys";
5135
- import { log as log16 } from "@dxos/log";
5033
+ import { log as log15 } from "@dxos/log";
5136
5034
  import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError2, trace as trace6 } from "@dxos/protocols";
5137
5035
  import { schema as schema5 } from "@dxos/protocols/proto";
5138
5036
  import { Invitation as Invitation5 } from "@dxos/protocols/proto/dxos/client/services";
@@ -5189,7 +5087,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
5189
5087
  introduce: async (request) => {
5190
5088
  const { profile, invitationId } = request;
5191
5089
  const traceId = PublicKey9.random().toHex();
5192
- log16.trace("dxos.sdk.invitation-handler.host.introduce", trace6.begin({
5090
+ log15.trace("dxos.sdk.invitation-handler.host.introduce", trace6.begin({
5193
5091
  id: traceId
5194
5092
  }), {
5195
5093
  F: __dxlog_file19,
@@ -5200,7 +5098,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
5200
5098
  const invitation = this._requireActiveInvitation();
5201
5099
  this._assertInvitationState(Invitation5.State.CONNECTED);
5202
5100
  if (invitationId !== invitation?.invitationId) {
5203
- log16.warn("incorrect invitationId", {
5101
+ log15.warn("incorrect invitationId", {
5204
5102
  expected: invitation.invitationId,
5205
5103
  actual: invitationId
5206
5104
  }, {
@@ -5215,7 +5113,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
5215
5113
  authMethod: Invitation5.AuthMethod.NONE
5216
5114
  };
5217
5115
  }
5218
- log16.verbose("guest introduced themselves", {
5116
+ log15.verbose("guest introduced themselves", {
5219
5117
  guestProfile: profile
5220
5118
  }, {
5221
5119
  F: __dxlog_file19,
@@ -5226,7 +5124,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
5226
5124
  this.guestProfile = profile;
5227
5125
  this._callbacks.onStateUpdate(Invitation5.State.READY_FOR_AUTHENTICATION);
5228
5126
  this._challenge = invitation.authMethod === Invitation5.AuthMethod.KNOWN_PUBLIC_KEY ? randomBytes(32) : void 0;
5229
- log16.trace("dxos.sdk.invitation-handler.host.introduce", trace6.end({
5127
+ log15.trace("dxos.sdk.invitation-handler.host.introduce", trace6.end({
5230
5128
  id: traceId
5231
5129
  }), {
5232
5130
  F: __dxlog_file19,
@@ -5241,7 +5139,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
5241
5139
  },
5242
5140
  authenticate: async ({ authCode: code, signedChallenge }) => {
5243
5141
  const traceId = PublicKey9.random().toHex();
5244
- log16.trace("dxos.sdk.invitation-handler.host.authenticate", trace6.begin({
5142
+ log15.trace("dxos.sdk.invitation-handler.host.authenticate", trace6.begin({
5245
5143
  id: traceId
5246
5144
  }), {
5247
5145
  F: __dxlog_file19,
@@ -5250,7 +5148,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
5250
5148
  C: (f, a) => f(...a)
5251
5149
  });
5252
5150
  const invitation = this._requireActiveInvitation();
5253
- log16.verbose("received authentication request", {
5151
+ log15.verbose("received authentication request", {
5254
5152
  authCode: code
5255
5153
  }, {
5256
5154
  F: __dxlog_file19,
@@ -5266,7 +5164,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
5266
5164
  this._callbacks.onStateUpdate(Invitation5.State.AUTHENTICATING);
5267
5165
  switch (invitation.authMethod) {
5268
5166
  case Invitation5.AuthMethod.NONE: {
5269
- log16("authentication not required", void 0, {
5167
+ log15("authentication not required", void 0, {
5270
5168
  F: __dxlog_file19,
5271
5169
  L: 154,
5272
5170
  S: this,
@@ -5302,7 +5200,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
5302
5200
  break;
5303
5201
  }
5304
5202
  default: {
5305
- log16.error("invalid authentication method", {
5203
+ log15.error("invalid authentication method", {
5306
5204
  authMethod: invitation.authMethod
5307
5205
  }, {
5308
5206
  F: __dxlog_file19,
@@ -5324,7 +5222,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
5324
5222
  status
5325
5223
  };
5326
5224
  }
5327
- log16.trace("dxos.sdk.invitation-handler.host.authenticate", trace6.end({
5225
+ log15.trace("dxos.sdk.invitation-handler.host.authenticate", trace6.end({
5328
5226
  id: traceId,
5329
5227
  data: {
5330
5228
  status
@@ -5341,7 +5239,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
5341
5239
  },
5342
5240
  admit: async (request) => {
5343
5241
  const traceId = PublicKey9.random().toHex();
5344
- log16.trace("dxos.sdk.invitation-handler.host.admit", trace6.begin({
5242
+ log15.trace("dxos.sdk.invitation-handler.host.admit", trace6.begin({
5345
5243
  id: traceId
5346
5244
  }), {
5347
5245
  F: __dxlog_file19,
@@ -5358,7 +5256,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
5358
5256
  }
5359
5257
  }
5360
5258
  const response = await this._callbacks.admit(request);
5361
- log16.trace("dxos.sdk.invitation-handler.host.admit", trace6.end({
5259
+ log15.trace("dxos.sdk.invitation-handler.host.admit", trace6.end({
5362
5260
  id: traceId
5363
5261
  }), {
5364
5262
  F: __dxlog_file19,
@@ -5378,14 +5276,14 @@ var InvitationHostExtension = class extends RpcExtension3 {
5378
5276
  async onOpen(context) {
5379
5277
  await super.onOpen(context);
5380
5278
  try {
5381
- log16.verbose("host acquire lock", void 0, {
5279
+ log15.verbose("host acquire lock", void 0, {
5382
5280
  F: __dxlog_file19,
5383
5281
  L: 239,
5384
5282
  S: this,
5385
5283
  C: (f, a) => f(...a)
5386
5284
  });
5387
5285
  this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
5388
- log16.verbose("host lock acquired", void 0, {
5286
+ log15.verbose("host lock acquired", void 0, {
5389
5287
  F: __dxlog_file19,
5390
5288
  L: 241,
5391
5289
  S: this,
@@ -5395,7 +5293,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
5395
5293
  await this.rpc.InvitationHostService.options({
5396
5294
  role: InvitationOptions2.Role.HOST
5397
5295
  });
5398
- log16.verbose("options sent", void 0, {
5296
+ log15.verbose("options sent", void 0, {
5399
5297
  F: __dxlog_file19,
5400
5298
  L: 244,
5401
5299
  S: this,
@@ -5404,7 +5302,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
5404
5302
  await cancelWithContext5(this._ctx, this._remoteOptionsTrigger.wait({
5405
5303
  timeout: OPTIONS_TIMEOUT2
5406
5304
  }));
5407
- log16.verbose("options received", void 0, {
5305
+ log15.verbose("options received", void 0, {
5408
5306
  F: __dxlog_file19,
5409
5307
  L: 246,
5410
5308
  S: this,
@@ -5457,7 +5355,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
5457
5355
  if (this._invitationFlowLock != null) {
5458
5356
  this._invitationFlowLock?.release();
5459
5357
  this._invitationFlowLock = null;
5460
- log16.verbose("invitation flow lock released", void 0, {
5358
+ log15.verbose("invitation flow lock released", void 0, {
5461
5359
  F: __dxlog_file19,
5462
5360
  L: 299,
5463
5361
  S: this,
@@ -5470,7 +5368,7 @@ var isAuthenticationRequired = (invitation) => invitation.authMethod !== Invitat
5470
5368
 
5471
5369
  // packages/sdk/client-services/src/packlets/invitations/invitation-state.ts
5472
5370
  import { Mutex as Mutex3 } from "@dxos/async";
5473
- import { log as log17 } from "@dxos/log";
5371
+ import { log as log16 } from "@dxos/log";
5474
5372
  import { Invitation as Invitation6 } from "@dxos/protocols/proto/dxos/client/services";
5475
5373
  var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-state.ts";
5476
5374
  var createGuardedInvitationState = (ctx, invitation, stream) => {
@@ -5539,14 +5437,14 @@ var logStateUpdate = (invitation, actor, newState, error) => {
5539
5437
  errorStack: error?.stack
5540
5438
  };
5541
5439
  if (isNonTerminalState(newState)) {
5542
- log17.verbose("dxos.sdk.invitations-handler.state.update", logContext, {
5440
+ log16.verbose("dxos.sdk.invitations-handler.state.update", logContext, {
5543
5441
  F: __dxlog_file20,
5544
5442
  L: 98,
5545
5443
  S: void 0,
5546
5444
  C: (f, a) => f(...a)
5547
5445
  });
5548
5446
  } else {
5549
- log17.info("dxos.sdk.invitations-handler.state.update", logContext, {
5447
+ log16.info("dxos.sdk.invitations-handler.state.update", logContext, {
5550
5448
  F: __dxlog_file20,
5551
5449
  L: 100,
5552
5450
  S: void 0,
@@ -5567,7 +5465,7 @@ var isNonTerminalState = (currentState) => {
5567
5465
  // packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts
5568
5466
  import { invariant as invariant14 } from "@dxos/invariant";
5569
5467
  import { PublicKey as PublicKey10 } from "@dxos/keys";
5570
- import { log as log18 } from "@dxos/log";
5468
+ import { log as log17 } from "@dxos/log";
5571
5469
  import { InvitationOptions as InvitationOptions3 } from "@dxos/protocols/proto/dxos/halo/invitations";
5572
5470
  import { ComplexSet as ComplexSet4 } from "@dxos/util";
5573
5471
  var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
@@ -5609,7 +5507,7 @@ var InvitationTopology = class {
5609
5507
  const firstUnknownPeer = candidates.find((peerId) => !this._seenPeers.has(peerId));
5610
5508
  this._seenPeers = new ComplexSet4(PublicKey10.hash, allPeers.filter((peerId) => this._seenPeers.has(peerId)));
5611
5509
  if (firstUnknownPeer != null) {
5612
- log18("invitation connect", {
5510
+ log17("invitation connect", {
5613
5511
  ownPeerId,
5614
5512
  remotePeerId: firstUnknownPeer
5615
5513
  }, {
@@ -5656,7 +5554,7 @@ var InvitationsHandler = class {
5656
5554
  this._connectionParams = _connectionParams;
5657
5555
  }
5658
5556
  handleInvitationFlow(ctx, stream, protocol, invitation) {
5659
- log19.verbose("dxos.sdk.invitations-handler.handleInvitationFlow", {
5557
+ log18.verbose("dxos.sdk.invitations-handler.handleInvitationFlow", {
5660
5558
  state: invitation.state,
5661
5559
  invitationId: invitation.invitationId,
5662
5560
  kind: invitation.kind,
@@ -5682,7 +5580,7 @@ var InvitationsHandler = class {
5682
5580
  },
5683
5581
  admit: async (admissionRequest) => {
5684
5582
  try {
5685
- log19.verbose("dxos.sdk.invitations-handler.host.admit", {
5583
+ log18.verbose("dxos.sdk.invitations-handler.host.admit", {
5686
5584
  invitationId: invitation.invitationId,
5687
5585
  ...protocol.toJSON()
5688
5586
  }, {
@@ -5719,7 +5617,7 @@ var InvitationsHandler = class {
5719
5617
  scheduleTask7(connectionCtx, async () => {
5720
5618
  const traceId = PublicKey11.random().toHex();
5721
5619
  try {
5722
- log19.trace("dxos.sdk.invitations-handler.host.onOpen", trace7.begin({
5620
+ log18.trace("dxos.sdk.invitations-handler.host.onOpen", trace7.begin({
5723
5621
  id: traceId
5724
5622
  }), {
5725
5623
  F: __dxlog_file22,
@@ -5727,7 +5625,7 @@ var InvitationsHandler = class {
5727
5625
  S: this,
5728
5626
  C: (f, a) => f(...a)
5729
5627
  });
5730
- log19.verbose("connected", {
5628
+ log18.verbose("connected", {
5731
5629
  ...protocol.toJSON()
5732
5630
  }, {
5733
5631
  F: __dxlog_file22,
@@ -5738,7 +5636,7 @@ var InvitationsHandler = class {
5738
5636
  const deviceKey = await extension.completedTrigger.wait({
5739
5637
  timeout: invitation.timeout
5740
5638
  });
5741
- log19.verbose("admitted guest", {
5639
+ log18.verbose("admitted guest", {
5742
5640
  guest: deviceKey,
5743
5641
  ...protocol.toJSON()
5744
5642
  }, {
@@ -5749,7 +5647,7 @@ var InvitationsHandler = class {
5749
5647
  });
5750
5648
  guardedState.set(extension, Invitation7.State.SUCCESS);
5751
5649
  metrics.increment("dxos.invitation.success");
5752
- log19.trace("dxos.sdk.invitations-handler.host.onOpen", trace7.end({
5650
+ log18.trace("dxos.sdk.invitations-handler.host.onOpen", trace7.end({
5753
5651
  id: traceId
5754
5652
  }), {
5755
5653
  F: __dxlog_file22,
@@ -5766,7 +5664,7 @@ var InvitationsHandler = class {
5766
5664
  if (err instanceof TimeoutError2) {
5767
5665
  if (stateChanged) {
5768
5666
  metrics.increment("dxos.invitation.timeout");
5769
- log19.verbose("timeout", {
5667
+ log18.verbose("timeout", {
5770
5668
  ...protocol.toJSON()
5771
5669
  }, {
5772
5670
  F: __dxlog_file22,
@@ -5778,7 +5676,7 @@ var InvitationsHandler = class {
5778
5676
  } else {
5779
5677
  if (stateChanged) {
5780
5678
  metrics.increment("dxos.invitation.failed");
5781
- log19.error("failed", err, {
5679
+ log18.error("failed", err, {
5782
5680
  F: __dxlog_file22,
5783
5681
  L: 159,
5784
5682
  S: this,
@@ -5786,7 +5684,7 @@ var InvitationsHandler = class {
5786
5684
  });
5787
5685
  }
5788
5686
  }
5789
- log19.trace("dxos.sdk.invitations-handler.host.onOpen", trace7.error({
5687
+ log18.trace("dxos.sdk.invitations-handler.host.onOpen", trace7.error({
5790
5688
  id: traceId,
5791
5689
  error: err
5792
5690
  }), {
@@ -5802,7 +5700,7 @@ var InvitationsHandler = class {
5802
5700
  onError: (err) => {
5803
5701
  const stateChanged = guardedState.set(extension, Invitation7.State.CONNECTING);
5804
5702
  if (err instanceof InvalidInvitationExtensionRoleError3) {
5805
- log19("invalid role", {
5703
+ log18("invalid role", {
5806
5704
  ...err.context
5807
5705
  }, {
5808
5706
  F: __dxlog_file22,
@@ -5815,7 +5713,7 @@ var InvitationsHandler = class {
5815
5713
  if (err instanceof TimeoutError2) {
5816
5714
  if (stateChanged) {
5817
5715
  metrics.increment("dxos.invitation.timeout");
5818
- log19.verbose("timeout", {
5716
+ log18.verbose("timeout", {
5819
5717
  err
5820
5718
  }, {
5821
5719
  F: __dxlog_file22,
@@ -5827,7 +5725,7 @@ var InvitationsHandler = class {
5827
5725
  } else {
5828
5726
  if (stateChanged) {
5829
5727
  metrics.increment("dxos.invitation.failed");
5830
- log19.error("failed", err, {
5728
+ log18.error("failed", err, {
5831
5729
  F: __dxlog_file22,
5832
5730
  L: 182,
5833
5731
  S: this,
@@ -5841,14 +5739,14 @@ var InvitationsHandler = class {
5841
5739
  };
5842
5740
  if (invitation.lifetime && invitation.created) {
5843
5741
  if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
5844
- log19.warn("invitation has already expired", void 0, {
5742
+ log18.warn("invitation has already expired", void 0, {
5845
5743
  F: __dxlog_file22,
5846
5744
  L: 193,
5847
5745
  S: this,
5848
5746
  C: (f, a) => f(...a)
5849
5747
  });
5850
5748
  guardedState.set(null, Invitation7.State.EXPIRED);
5851
- void ctx.dispose().catch((err) => log19.catch(err, void 0, {
5749
+ void ctx.dispose().catch((err) => log18.catch(err, void 0, {
5852
5750
  F: __dxlog_file22,
5853
5751
  L: 195,
5854
5752
  S: this,
@@ -5870,7 +5768,7 @@ var InvitationsHandler = class {
5870
5768
  });
5871
5769
  }
5872
5770
  acceptInvitation(ctx, stream, protocol, invitation, otpEnteredTrigger, deviceProfile) {
5873
- log19.verbose("dxos.sdk.invitations-handler.acceptInvitation", {
5771
+ log18.verbose("dxos.sdk.invitations-handler.acceptInvitation", {
5874
5772
  state: invitation.state,
5875
5773
  invitationId: invitation.invitationId,
5876
5774
  kind: invitation.kind,
@@ -5897,7 +5795,7 @@ var InvitationsHandler = class {
5897
5795
  const guardedState = createGuardedInvitationState(ctx, invitation, stream);
5898
5796
  const shouldCancelInvitationFlow = (extension) => {
5899
5797
  const isLockedByAnotherConnection = guardedState.mutex.isLocked() && !extension.hasFlowLock();
5900
- log19("should cancel invitation flow", {
5798
+ log18("should cancel invitation flow", {
5901
5799
  isLockedByAnotherConnection,
5902
5800
  invitationType: Invitation7.Type.DELEGATED,
5903
5801
  triedPeers: triedPeersIds.size
@@ -5925,7 +5823,7 @@ var InvitationsHandler = class {
5925
5823
  return;
5926
5824
  }
5927
5825
  connectionCtx.onDispose(async () => {
5928
- log19.verbose("extension disposed", {
5826
+ log18.verbose("extension disposed", {
5929
5827
  admitted,
5930
5828
  currentState: guardedState.current.state
5931
5829
  }, {
@@ -5944,7 +5842,7 @@ var InvitationsHandler = class {
5944
5842
  scheduleTask7(connectionCtx, async () => {
5945
5843
  const traceId = PublicKey11.random().toHex();
5946
5844
  try {
5947
- log19.trace("dxos.sdk.invitations-handler.guest.onOpen", trace7.begin({
5845
+ log18.trace("dxos.sdk.invitations-handler.guest.onOpen", trace7.begin({
5948
5846
  id: traceId
5949
5847
  }), {
5950
5848
  F: __dxlog_file22,
@@ -5956,7 +5854,7 @@ var InvitationsHandler = class {
5956
5854
  guardedState.set(extension, Invitation7.State.TIMEOUT);
5957
5855
  extensionCtx.close();
5958
5856
  }, timeout);
5959
- log19.verbose("dxos.sdk.invitations-handler.guest.connected", {
5857
+ log18.verbose("dxos.sdk.invitations-handler.guest.connected", {
5960
5858
  ...protocol.toJSON()
5961
5859
  }, {
5962
5860
  F: __dxlog_file22,
@@ -5965,7 +5863,7 @@ var InvitationsHandler = class {
5965
5863
  C: (f, a) => f(...a)
5966
5864
  });
5967
5865
  guardedState.set(extension, Invitation7.State.CONNECTED);
5968
- log19.verbose("dxos.sdk.invitations-handler.guest.introduce", {
5866
+ log18.verbose("dxos.sdk.invitations-handler.guest.introduce", {
5969
5867
  invitationId: invitation.invitationId,
5970
5868
  ...protocol.toJSON()
5971
5869
  }, {
@@ -5978,7 +5876,7 @@ var InvitationsHandler = class {
5978
5876
  invitationId: invitation.invitationId,
5979
5877
  ...protocol.createIntroduction()
5980
5878
  });
5981
- log19.verbose("dxos.sdk.invitations-handler.guest.introduce-response", {
5879
+ log18.verbose("dxos.sdk.invitations-handler.guest.introduce-response", {
5982
5880
  invitationId: invitation.invitationId,
5983
5881
  ...protocol.toJSON(),
5984
5882
  authMethod: introductionResponse.authMethod
@@ -6001,7 +5899,7 @@ var InvitationsHandler = class {
6001
5899
  break;
6002
5900
  }
6003
5901
  }
6004
- log19.verbose("dxos.sdk.invitations-handler.guest.request-admission", {
5902
+ log18.verbose("dxos.sdk.invitations-handler.guest.request-admission", {
6005
5903
  invitationId: invitation.invitationId,
6006
5904
  ...protocol.toJSON()
6007
5905
  }, {
@@ -6014,7 +5912,7 @@ var InvitationsHandler = class {
6014
5912
  const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
6015
5913
  admitted = true;
6016
5914
  const result = await protocol.accept(admissionResponse, admissionRequest);
6017
- log19.verbose("dxos.sdk.invitations-handler.guest.admitted-by-host", {
5915
+ log18.verbose("dxos.sdk.invitations-handler.guest.admitted-by-host", {
6018
5916
  invitationId: invitation.invitationId,
6019
5917
  ...protocol.toJSON()
6020
5918
  }, {
@@ -6028,7 +5926,7 @@ var InvitationsHandler = class {
6028
5926
  ...result,
6029
5927
  state: Invitation7.State.SUCCESS
6030
5928
  });
6031
- log19.trace("dxos.sdk.invitations-handler.guest.onOpen", trace7.end({
5929
+ log18.trace("dxos.sdk.invitations-handler.guest.onOpen", trace7.end({
6032
5930
  id: traceId
6033
5931
  }), {
6034
5932
  F: __dxlog_file22,
@@ -6038,7 +5936,7 @@ var InvitationsHandler = class {
6038
5936
  });
6039
5937
  } catch (err) {
6040
5938
  if (err instanceof TimeoutError2) {
6041
- log19.verbose("timeout", {
5939
+ log18.verbose("timeout", {
6042
5940
  ...protocol.toJSON()
6043
5941
  }, {
6044
5942
  F: __dxlog_file22,
@@ -6048,7 +5946,7 @@ var InvitationsHandler = class {
6048
5946
  });
6049
5947
  guardedState.set(extension, Invitation7.State.TIMEOUT);
6050
5948
  } else {
6051
- log19.verbose("auth failed", err, {
5949
+ log18.verbose("auth failed", err, {
6052
5950
  F: __dxlog_file22,
6053
5951
  L: 365,
6054
5952
  S: this,
@@ -6057,7 +5955,7 @@ var InvitationsHandler = class {
6057
5955
  guardedState.error(extension, err);
6058
5956
  }
6059
5957
  extensionCtx.close(err);
6060
- log19.trace("dxos.sdk.invitations-handler.guest.onOpen", trace7.error({
5958
+ log18.trace("dxos.sdk.invitations-handler.guest.onOpen", trace7.error({
6061
5959
  id: traceId,
6062
5960
  error: err
6063
5961
  }), {
@@ -6074,7 +5972,7 @@ var InvitationsHandler = class {
6074
5972
  return;
6075
5973
  }
6076
5974
  if (err instanceof TimeoutError2) {
6077
- log19.verbose("timeout", {
5975
+ log18.verbose("timeout", {
6078
5976
  ...protocol.toJSON()
6079
5977
  }, {
6080
5978
  F: __dxlog_file22,
@@ -6084,7 +5982,7 @@ var InvitationsHandler = class {
6084
5982
  });
6085
5983
  guardedState.set(extension, Invitation7.State.TIMEOUT);
6086
5984
  } else {
6087
- log19.verbose("auth failed", err, {
5985
+ log18.verbose("auth failed", err, {
6088
5986
  F: __dxlog_file22,
6089
5987
  L: 381,
6090
5988
  S: this,
@@ -6099,7 +5997,7 @@ var InvitationsHandler = class {
6099
5997
  const edgeInvitationHandler = new EdgeInvitationHandler(this._connectionParams?.edgeInvitations, this._edgeClient, {
6100
5998
  onInvitationSuccess: async (admissionResponse, admissionRequest) => {
6101
5999
  const result = await protocol.accept(admissionResponse, admissionRequest);
6102
- log19.info("admitted by edge", {
6000
+ log18.info("admitted by edge", {
6103
6001
  ...protocol.toJSON()
6104
6002
  }, {
6105
6003
  F: __dxlog_file22,
@@ -6165,7 +6063,7 @@ var InvitationsHandler = class {
6165
6063
  }
6166
6064
  async _handleGuestOtpAuth(extension, setState, authenticated, options) {
6167
6065
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
6168
- log19("guest waiting for authentication code...", void 0, {
6066
+ log18("guest waiting for authentication code...", void 0, {
6169
6067
  F: __dxlog_file22,
6170
6068
  L: 457,
6171
6069
  S: this,
@@ -6173,7 +6071,7 @@ var InvitationsHandler = class {
6173
6071
  });
6174
6072
  setState(Invitation7.State.READY_FOR_AUTHENTICATION);
6175
6073
  const authCode = await authenticated.wait(options);
6176
- log19("sending authentication request", void 0, {
6074
+ log18("sending authentication request", void 0, {
6177
6075
  F: __dxlog_file22,
6178
6076
  L: 461,
6179
6077
  S: this,
@@ -6190,7 +6088,7 @@ var InvitationsHandler = class {
6190
6088
  if (attempt === MAX_OTP_ATTEMPTS) {
6191
6089
  throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
6192
6090
  } else {
6193
- log19("retrying invalid code", {
6091
+ log18("retrying invalid code", {
6194
6092
  attempt
6195
6093
  }, {
6196
6094
  F: __dxlog_file22,
@@ -6210,7 +6108,7 @@ var InvitationsHandler = class {
6210
6108
  if (introductionResponse.challenge == null) {
6211
6109
  throw new Error("challenge missing in the introduction");
6212
6110
  }
6213
- log19("sending authentication request", void 0, {
6111
+ log18("sending authentication request", void 0, {
6214
6112
  F: __dxlog_file22,
6215
6113
  L: 491,
6216
6114
  S: this,
@@ -6338,7 +6236,7 @@ var InvitationsServiceImpl = class {
6338
6236
  import { createCancelDelegatedSpaceInvitationCredential, createDelegatedSpaceInvitationCredential, getCredentialAssertion as getCredentialAssertion5 } from "@dxos/credentials";
6339
6237
  import { writeMessages as writeMessages4 } from "@dxos/feed-store";
6340
6238
  import { invariant as invariant16 } from "@dxos/invariant";
6341
- import { log as log20 } from "@dxos/log";
6239
+ import { log as log19 } from "@dxos/log";
6342
6240
  import { AlreadyJoinedError as AlreadyJoinedError3, AuthorizationError as AuthorizationError2, InvalidInvitationError, SpaceNotFoundError as SpaceNotFoundError2 } from "@dxos/protocols";
6343
6241
  import { Invitation as Invitation8 } from "@dxos/protocols/proto/dxos/client/services";
6344
6242
  import { SpaceMember as SpaceMember6 } from "@dxos/protocols/proto/dxos/halo/credentials";
@@ -6406,7 +6304,7 @@ var SpaceInvitationProtocol = class {
6406
6304
  ""
6407
6305
  ]
6408
6306
  });
6409
- log20("writing guest credentials", {
6307
+ log19("writing guest credentials", {
6410
6308
  host: this._signingContext.deviceKey,
6411
6309
  guest: request.space.deviceKey
6412
6310
  }, {
@@ -6461,7 +6359,7 @@ var SpaceInvitationProtocol = class {
6461
6359
  ]
6462
6360
  });
6463
6361
  }
6464
- log20("writing delegate space invitation", {
6362
+ log19("writing delegate space invitation", {
6465
6363
  host: this._signingContext.deviceKey,
6466
6364
  id: invitation.invitationId
6467
6365
  }, {
@@ -6522,7 +6420,7 @@ var SpaceInvitationProtocol = class {
6522
6420
  ""
6523
6421
  ]
6524
6422
  });
6525
- log20("cancelling delegated space invitation", {
6423
+ log19("cancelling delegated space invitation", {
6526
6424
  host: this._signingContext.deviceKey,
6527
6425
  id: invitation.invitationId
6528
6426
  }, {
@@ -6624,7 +6522,7 @@ import { generatePasscode } from "@dxos/credentials";
6624
6522
  import { hasInvitationExpired } from "@dxos/echo-pipeline";
6625
6523
  import { invariant as invariant17 } from "@dxos/invariant";
6626
6524
  import { PublicKey as PublicKey12 } from "@dxos/keys";
6627
- import { log as log21 } from "@dxos/log";
6525
+ import { log as log20 } from "@dxos/log";
6628
6526
  import { Invitation as Invitation9 } from "@dxos/protocols/proto/dxos/client/services";
6629
6527
  import { SpaceMember as SpaceMember7 } from "@dxos/protocols/proto/dxos/halo/credentials";
6630
6528
  var __dxlog_file24 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
@@ -6669,7 +6567,7 @@ var InvitationsManager = class {
6669
6567
  try {
6670
6568
  await this._persistIfRequired(handler, stream, invitation);
6671
6569
  } catch (err) {
6672
- log21.catch(err, void 0, {
6570
+ log20.catch(err, void 0, {
6673
6571
  F: __dxlog_file24,
6674
6572
  L: 82,
6675
6573
  S: this,
@@ -6711,7 +6609,7 @@ var InvitationsManager = class {
6711
6609
  invitations: cInvitations.map((invitation) => invitation.get())
6712
6610
  };
6713
6611
  } catch (err) {
6714
- log21.catch(err, void 0, {
6612
+ log20.catch(err, void 0, {
6715
6613
  F: __dxlog_file24,
6716
6614
  L: 110,
6717
6615
  S: this,
@@ -6743,7 +6641,7 @@ var InvitationsManager = class {
6743
6641
  return invitation;
6744
6642
  }
6745
6643
  async authenticate({ invitationId, authCode }) {
6746
- log21("authenticating...", void 0, {
6644
+ log20("authenticating...", void 0, {
6747
6645
  F: __dxlog_file24,
6748
6646
  L: 140,
6749
6647
  S: this,
@@ -6760,7 +6658,7 @@ var InvitationsManager = class {
6760
6658
  });
6761
6659
  const observable = this._acceptInvitations.get(invitationId);
6762
6660
  if (!observable) {
6763
- log21.warn("invalid invitation", {
6661
+ log20.warn("invalid invitation", {
6764
6662
  invitationId
6765
6663
  }, {
6766
6664
  F: __dxlog_file24,
@@ -6773,7 +6671,7 @@ var InvitationsManager = class {
6773
6671
  }
6774
6672
  }
6775
6673
  async cancelInvitation({ invitationId }) {
6776
- log21("cancelInvitation...", {
6674
+ log20("cancelInvitation...", {
6777
6675
  invitationId
6778
6676
  }, {
6779
6677
  F: __dxlog_file24,
@@ -6862,7 +6760,7 @@ var InvitationsManager = class {
6862
6760
  L: 236
6863
6761
  });
6864
6762
  ctx.onDispose(() => {
6865
- log21("complete", {
6763
+ log20("complete", {
6866
6764
  ...handler.toJSON()
6867
6765
  }, {
6868
6766
  F: __dxlog_file24,
@@ -6895,7 +6793,7 @@ var InvitationsManager = class {
6895
6793
  const ctx = new Context8({
6896
6794
  onError: (err) => {
6897
6795
  if (err instanceof TimeoutError3) {
6898
- log21("timeout", {
6796
+ log20("timeout", {
6899
6797
  ...handler.toJSON()
6900
6798
  }, {
6901
6799
  F: __dxlog_file24,
@@ -6908,7 +6806,7 @@ var InvitationsManager = class {
6908
6806
  state: Invitation9.State.TIMEOUT
6909
6807
  });
6910
6808
  } else {
6911
- log21.warn("auth failed", err, {
6809
+ log20.warn("auth failed", err, {
6912
6810
  F: __dxlog_file24,
6913
6811
  L: 266,
6914
6812
  S: this,
@@ -6926,7 +6824,7 @@ var InvitationsManager = class {
6926
6824
  L: 260
6927
6825
  });
6928
6826
  ctx.onDispose(() => {
6929
- log21("complete", {
6827
+ log20("complete", {
6930
6828
  ...handler.toJSON()
6931
6829
  }, {
6932
6830
  F: __dxlog_file24,
@@ -6973,7 +6871,7 @@ var InvitationsManager = class {
6973
6871
  try {
6974
6872
  await this._metadataStore.removeInvitation(invitation.invitationId);
6975
6873
  } catch (err) {
6976
- log21.catch(err, void 0, {
6874
+ log20.catch(err, void 0, {
6977
6875
  F: __dxlog_file24,
6978
6876
  L: 309,
6979
6877
  S: this,
@@ -6991,7 +6889,7 @@ var InvitationsManager = class {
6991
6889
  // packages/sdk/client-services/src/packlets/locks/browser.ts
6992
6890
  import { asyncTimeout as asyncTimeout2, Trigger as Trigger8 } from "@dxos/async";
6993
6891
  import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
6994
- import { log as log22, logInfo as logInfo3 } from "@dxos/log";
6892
+ import { log as log21, logInfo as logInfo3 } from "@dxos/log";
6995
6893
  function _ts_decorate7(decorators, target, key, desc) {
6996
6894
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6997
6895
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -7020,28 +6918,28 @@ var Lock = class {
7020
6918
  message: "acquiring"
7021
6919
  });
7022
6920
  try {
7023
- log22("aquiring lock...", void 0, {
6921
+ log21("aquiring lock...", void 0, {
7024
6922
  F: __dxlog_file25,
7025
6923
  L: 42,
7026
6924
  S: this,
7027
6925
  C: (f, a) => f(...a)
7028
6926
  });
7029
6927
  await asyncTimeout2(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
7030
- log22("acquired lock", void 0, {
6928
+ log21("acquired lock", void 0, {
7031
6929
  F: __dxlog_file25,
7032
6930
  L: 44,
7033
6931
  S: this,
7034
6932
  C: (f, a) => f(...a)
7035
6933
  });
7036
6934
  } catch {
7037
- log22("stealing lock...", void 0, {
6935
+ log21("stealing lock...", void 0, {
7038
6936
  F: __dxlog_file25,
7039
6937
  L: 46,
7040
6938
  S: this,
7041
6939
  C: (f, a) => f(...a)
7042
6940
  });
7043
6941
  await this._requestLock(true);
7044
- log22("stolen lock", void 0, {
6942
+ log21("stolen lock", void 0, {
7045
6943
  F: __dxlog_file25,
7046
6944
  L: 48,
7047
6945
  S: this,
@@ -7058,7 +6956,7 @@ var Lock = class {
7058
6956
  }
7059
6957
  }
7060
6958
  async _requestLock(steal = false) {
7061
- log22("requesting lock...", {
6959
+ log21("requesting lock...", {
7062
6960
  steal
7063
6961
  }, {
7064
6962
  F: __dxlog_file25,
@@ -7074,14 +6972,14 @@ var Lock = class {
7074
6972
  acquired.wake();
7075
6973
  this._releaseTrigger = new Trigger8();
7076
6974
  await this._releaseTrigger.wait();
7077
- log22("releasing lock...", void 0, {
6975
+ log21("releasing lock...", void 0, {
7078
6976
  F: __dxlog_file25,
7079
6977
  L: 72,
7080
6978
  S: this,
7081
6979
  C: (f, a) => f(...a)
7082
6980
  });
7083
6981
  await this._onRelease?.();
7084
- log22("released lock", void 0, {
6982
+ log21("released lock", void 0, {
7085
6983
  F: __dxlog_file25,
7086
6984
  L: 74,
7087
6985
  S: this,
@@ -7091,7 +6989,7 @@ var Lock = class {
7091
6989
  await this._onRelease?.();
7092
6990
  });
7093
6991
  await acquired.wait();
7094
- log22("recieved lock", {
6992
+ log21("recieved lock", {
7095
6993
  steal
7096
6994
  }, {
7097
6995
  F: __dxlog_file25,
@@ -7190,7 +7088,7 @@ import { DeferredTask as DeferredTask2, Event as Event9, scheduleTask as schedul
7190
7088
  import { Resource as Resource6 } from "@dxos/context";
7191
7089
  import { invariant as invariant18 } from "@dxos/invariant";
7192
7090
  import { PublicKey as PublicKey13 } from "@dxos/keys";
7193
- import { log as log23 } from "@dxos/log";
7091
+ import { log as log22 } from "@dxos/log";
7194
7092
  import { EdgeAgentStatus, EdgeCallFailedError as EdgeCallFailedError3 } from "@dxos/protocols";
7195
7093
  import { SpaceState as SpaceState5 } from "@dxos/protocols/proto/dxos/client/services";
7196
7094
  function _ts_decorate9(decorators, target, key, desc) {
@@ -7258,7 +7156,7 @@ var EdgeAgentManager = class extends Resource6 {
7258
7156
  // TODO: agents don't have data feed, should be removed
7259
7157
  dataFeedKey: PublicKey13.random()
7260
7158
  });
7261
- log23("agent created", response, {
7159
+ log22("agent created", response, {
7262
7160
  F: __dxlog_file26,
7263
7161
  L: 71,
7264
7162
  S: this,
@@ -7268,7 +7166,7 @@ var EdgeAgentManager = class extends Resource6 {
7268
7166
  }
7269
7167
  async _open() {
7270
7168
  const isEnabled = this._edgeHttpClient && this._edgeFeatures?.agents;
7271
- log23("edge agent manager open", {
7169
+ log22("edge agent manager open", {
7272
7170
  isEnabled
7273
7171
  }, {
7274
7172
  F: __dxlog_file26,
@@ -7313,7 +7211,7 @@ var EdgeAgentManager = class extends Resource6 {
7313
7211
  ]
7314
7212
  });
7315
7213
  try {
7316
- log23("fetching agent status", void 0, {
7214
+ log22("fetching agent status", void 0, {
7317
7215
  F: __dxlog_file26,
7318
7216
  L: 115,
7319
7217
  S: this,
@@ -7330,7 +7228,7 @@ var EdgeAgentManager = class extends Resource6 {
7330
7228
  } catch (err) {
7331
7229
  if (err instanceof EdgeCallFailedError3) {
7332
7230
  if (!err.isRetryable) {
7333
- log23.warn("non retryable error on agent status fetch attempt", {
7231
+ log22.warn("non retryable error on agent status fetch attempt", {
7334
7232
  err
7335
7233
  }, {
7336
7234
  F: __dxlog_file26,
@@ -7342,7 +7240,7 @@ var EdgeAgentManager = class extends Resource6 {
7342
7240
  }
7343
7241
  }
7344
7242
  const retryAfterMs = AGENT_STATUS_QUERY_RETRY_INTERVAL + Math.random() * AGENT_STATUS_QUERY_RETRY_JITTER;
7345
- log23.info("agent status fetching failed", {
7243
+ log22.info("agent status fetching failed", {
7346
7244
  err,
7347
7245
  retryAfterMs
7348
7246
  }, {
@@ -7371,7 +7269,7 @@ var EdgeAgentManager = class extends Resource6 {
7371
7269
  ...space.inner.spaceState.feeds.values()
7372
7270
  ].some((feed) => feed.assertion.deviceKey.equals(agentDeviceKey));
7373
7271
  space.notarizationPlugin.setActiveEdgePollingEnabled(agentFeedNeedsNotarization);
7374
- log23.info("set active edge polling", {
7272
+ log22.info("set active edge polling", {
7375
7273
  enabled: agentFeedNeedsNotarization,
7376
7274
  spaceId: space.id
7377
7275
  }, {
@@ -7389,7 +7287,7 @@ var EdgeAgentManager = class extends Resource6 {
7389
7287
  if (deviceKey) {
7390
7288
  this._ensureAgentIsInSpaces(deviceKey);
7391
7289
  }
7392
- log23.info("agent status update", {
7290
+ log22.info("agent status update", {
7393
7291
  status
7394
7292
  }, {
7395
7293
  F: __dxlog_file26,
@@ -7406,10 +7304,29 @@ _ts_decorate9([
7406
7304
  // packages/sdk/client-services/src/packlets/agents/edge-agent-service.ts
7407
7305
  import { Stream as Stream11 } from "@dxos/codec-protobuf";
7408
7306
  import { EdgeAgentStatus as EdgeAgentStatus2 } from "@dxos/protocols";
7409
- import { QueryAgentStatusResponse } from "@dxos/protocols/proto/dxos/client/services";
7307
+ import { QueryAgentStatusResponse, QueryEdgeStatusResponse } from "@dxos/protocols/proto/dxos/client/services";
7410
7308
  var EdgeAgentServiceImpl = class {
7411
- constructor(_agentManagerProvider) {
7309
+ constructor(_agentManagerProvider, _edgeConnection) {
7412
7310
  this._agentManagerProvider = _agentManagerProvider;
7311
+ this._edgeConnection = _edgeConnection;
7312
+ }
7313
+ queryEdgeStatus() {
7314
+ return new Stream11(({ ctx, next }) => {
7315
+ next({
7316
+ status: QueryEdgeStatusResponse.EdgeStatus.NOT_CONNECTED
7317
+ });
7318
+ if (!this._edgeConnection) {
7319
+ return;
7320
+ }
7321
+ ctx.onDispose(
7322
+ // TODO(wittjosiah): EdgeConnection should include a disconnected event as well.
7323
+ this._edgeConnection.onReconnected(() => {
7324
+ next({
7325
+ status: QueryEdgeStatusResponse.EdgeStatus.CONNECTED
7326
+ });
7327
+ })
7328
+ );
7329
+ });
7413
7330
  }
7414
7331
  async createAgent() {
7415
7332
  return (await this._agentManagerProvider()).createAgent();
@@ -7456,7 +7373,7 @@ import { FeedFactory, FeedStore } from "@dxos/feed-store";
7456
7373
  import { invariant as invariant20 } from "@dxos/invariant";
7457
7374
  import { Keyring } from "@dxos/keyring";
7458
7375
  import { PublicKey as PublicKey15 } from "@dxos/keys";
7459
- import { log as log25 } from "@dxos/log";
7376
+ import { log as log24 } from "@dxos/log";
7460
7377
  import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace10 } from "@dxos/protocols";
7461
7378
  import { Invitation as Invitation10 } from "@dxos/protocols/proto/dxos/client/services";
7462
7379
  import { BlobStore } from "@dxos/teleport-extension-object-sync";
@@ -7468,7 +7385,7 @@ import { generateSeedPhrase as generateSeedPhrase2, keyPairFromSeedPhrase as key
7468
7385
  import { sign as sign3 } from "@dxos/crypto";
7469
7386
  import { invariant as invariant19 } from "@dxos/invariant";
7470
7387
  import { PublicKey as PublicKey14 } from "@dxos/keys";
7471
- import { log as log24 } from "@dxos/log";
7388
+ import { log as log23 } from "@dxos/log";
7472
7389
  import { EdgeAuthChallengeError as EdgeAuthChallengeError2 } from "@dxos/protocols";
7473
7390
  import { schema as schema6 } from "@dxos/protocols/proto";
7474
7391
  import { Timeframe as Timeframe5 } from "@dxos/timeframe";
@@ -7550,7 +7467,7 @@ var EdgeIdentityRecoveryManager = class {
7550
7467
  signature: Buffer.from(signature).toString("base64")
7551
7468
  });
7552
7469
  }
7553
- log24.info("recovering identity", response, {
7470
+ log23.info("recovering identity", response, {
7554
7471
  F: __dxlog_file27,
7555
7472
  L: 77,
7556
7473
  S: this,
@@ -7692,7 +7609,8 @@ var ServiceContext = class extends Resource7 {
7692
7609
  });
7693
7610
  this.recoveryManager = new EdgeIdentityRecoveryManager(this.keyring, this._edgeHttpClient, () => this.identityManager.identity, this._acceptIdentity.bind(this));
7694
7611
  this.echoHost = new EchoHost({
7695
- kv: this.level
7612
+ kv: this.level,
7613
+ peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex()
7696
7614
  });
7697
7615
  this._meshReplicator = new MeshEchoReplicator();
7698
7616
  this.invitations = new InvitationsHandler(this.networkManager, this._edgeHttpClient, _runtimeParams?.invitationConnectionDefaultParams);
@@ -7709,17 +7627,17 @@ var ServiceContext = class extends Resource7 {
7709
7627
  }
7710
7628
  async _open(ctx) {
7711
7629
  await this._checkStorageVersion();
7712
- log25("opening...", void 0, {
7630
+ log24("opening...", void 0, {
7713
7631
  F: __dxlog_file28,
7714
- L: 195,
7632
+ L: 198,
7715
7633
  S: this,
7716
7634
  C: (f, a) => f(...a)
7717
7635
  });
7718
- log25.trace("dxos.sdk.service-context.open", trace10.begin({
7636
+ log24.trace("dxos.sdk.service-context.open", trace10.begin({
7719
7637
  id: this._instanceId
7720
7638
  }), {
7721
7639
  F: __dxlog_file28,
7722
- L: 196,
7640
+ L: 199,
7723
7641
  S: this,
7724
7642
  C: (f, a) => f(...a)
7725
7643
  });
@@ -7742,33 +7660,33 @@ var ServiceContext = class extends Resource7 {
7742
7660
  await this._initialize(ctx);
7743
7661
  }
7744
7662
  const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
7745
- log25("loaded persistent invitations", {
7663
+ log24("loaded persistent invitations", {
7746
7664
  count: loadedInvitations.invitations?.length
7747
7665
  }, {
7748
7666
  F: __dxlog_file28,
7749
- L: 224,
7667
+ L: 227,
7750
7668
  S: this,
7751
7669
  C: (f, a) => f(...a)
7752
7670
  });
7753
- log25.trace("dxos.sdk.service-context.open", trace10.end({
7671
+ log24.trace("dxos.sdk.service-context.open", trace10.end({
7754
7672
  id: this._instanceId
7755
7673
  }), {
7756
7674
  F: __dxlog_file28,
7757
- L: 226,
7675
+ L: 229,
7758
7676
  S: this,
7759
7677
  C: (f, a) => f(...a)
7760
7678
  });
7761
- log25("opened", void 0, {
7679
+ log24("opened", void 0, {
7762
7680
  F: __dxlog_file28,
7763
- L: 227,
7681
+ L: 230,
7764
7682
  S: this,
7765
7683
  C: (f, a) => f(...a)
7766
7684
  });
7767
7685
  }
7768
7686
  async _close(ctx) {
7769
- log25("closing...", void 0, {
7687
+ log24("closing...", void 0, {
7770
7688
  F: __dxlog_file28,
7771
- L: 231,
7689
+ L: 234,
7772
7690
  S: this,
7773
7691
  C: (f, a) => f(...a)
7774
7692
  });
@@ -7785,9 +7703,9 @@ var ServiceContext = class extends Resource7 {
7785
7703
  await this.networkManager.close();
7786
7704
  await this.signalManager.close();
7787
7705
  await this._edgeConnection?.close();
7788
- log25("closed", void 0, {
7706
+ log24("closed", void 0, {
7789
7707
  F: __dxlog_file28,
7790
- L: 247,
7708
+ L: 250,
7791
7709
  S: this,
7792
7710
  C: (f, a) => f(...a)
7793
7711
  });
@@ -7798,7 +7716,7 @@ var ServiceContext = class extends Resource7 {
7798
7716
  await identity.joinNetwork();
7799
7717
  await this._initialize(new Context9(void 0, {
7800
7718
  F: __dxlog_file28,
7801
- L: 254
7719
+ L: 257
7802
7720
  }));
7803
7721
  return identity;
7804
7722
  }
@@ -7809,7 +7727,7 @@ var ServiceContext = class extends Resource7 {
7809
7727
  const factory = this._handlerFactories.get(invitation.kind);
7810
7728
  invariant20(factory, `Unknown invitation kind: ${invitation.kind}`, {
7811
7729
  F: __dxlog_file28,
7812
- L: 263,
7730
+ L: 266,
7813
7731
  S: this,
7814
7732
  A: [
7815
7733
  "factory",
@@ -7835,7 +7753,7 @@ var ServiceContext = class extends Resource7 {
7835
7753
  await this.identityManager.acceptIdentity(identity, identityRecord, params.deviceProfile);
7836
7754
  await this._initialize(new Context9(void 0, {
7837
7755
  F: __dxlog_file28,
7838
- L: 282
7756
+ L: 285
7839
7757
  }));
7840
7758
  return identity;
7841
7759
  }
@@ -7847,9 +7765,9 @@ var ServiceContext = class extends Resource7 {
7847
7765
  }
7848
7766
  // Called when identity is created.
7849
7767
  async _initialize(ctx) {
7850
- log25("initializing spaces...", void 0, {
7768
+ log24("initializing spaces...", void 0, {
7851
7769
  F: __dxlog_file28,
7852
- L: 297,
7770
+ L: 300,
7853
7771
  S: this,
7854
7772
  C: (f, a) => f(...a)
7855
7773
  });
@@ -7888,7 +7806,7 @@ var ServiceContext = class extends Resource7 {
7888
7806
  this._handlerFactories.set(Invitation10.Kind.SPACE, (invitation) => {
7889
7807
  invariant20(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
7890
7808
  F: __dxlog_file28,
7891
- L: 335,
7809
+ L: 338,
7892
7810
  S: this,
7893
7811
  A: [
7894
7812
  "this.dataSpaceManager",
@@ -7908,33 +7826,33 @@ var ServiceContext = class extends Resource7 {
7908
7826
  return;
7909
7827
  }
7910
7828
  if (!this.dataSpaceManager) {
7911
- log25("dataSpaceManager not initialized yet, ignoring space admission", {
7829
+ log24("dataSpaceManager not initialized yet, ignoring space admission", {
7912
7830
  details: assertion
7913
7831
  }, {
7914
7832
  F: __dxlog_file28,
7915
- L: 351,
7833
+ L: 354,
7916
7834
  S: this,
7917
7835
  C: (f, a) => f(...a)
7918
7836
  });
7919
7837
  return;
7920
7838
  }
7921
7839
  if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
7922
- log25("space already exists, ignoring space admission", {
7840
+ log24("space already exists, ignoring space admission", {
7923
7841
  details: assertion
7924
7842
  }, {
7925
7843
  F: __dxlog_file28,
7926
- L: 355,
7844
+ L: 358,
7927
7845
  S: this,
7928
7846
  C: (f, a) => f(...a)
7929
7847
  });
7930
7848
  return;
7931
7849
  }
7932
7850
  try {
7933
- log25("accepting space recorded in halo", {
7851
+ log24("accepting space recorded in halo", {
7934
7852
  details: assertion
7935
7853
  }, {
7936
7854
  F: __dxlog_file28,
7937
- L: 360,
7855
+ L: 363,
7938
7856
  S: this,
7939
7857
  C: (f, a) => f(...a)
7940
7858
  });
@@ -7943,9 +7861,9 @@ var ServiceContext = class extends Resource7 {
7943
7861
  genesisFeedKey: assertion.genesisFeedKey
7944
7862
  });
7945
7863
  } catch (err) {
7946
- log25.catch(err, void 0, {
7864
+ log24.catch(err, void 0, {
7947
7865
  F: __dxlog_file28,
7948
- L: 366,
7866
+ L: 369,
7949
7867
  S: this,
7950
7868
  C: (f, a) => f(...a)
7951
7869
  });
@@ -7961,12 +7879,12 @@ var ServiceContext = class extends Resource7 {
7961
7879
  let edgeIdentity;
7962
7880
  const identity = this.identityManager.identity;
7963
7881
  if (identity) {
7964
- log25.info("Setting identity on edge connection", {
7882
+ log24.info("Setting identity on edge connection", {
7965
7883
  identity: identity.identityKey.toHex(),
7966
7884
  swarms: this.networkManager.topics
7967
7885
  }, {
7968
7886
  F: __dxlog_file28,
7969
- L: 380,
7887
+ L: 383,
7970
7888
  S: this,
7971
7889
  C: (f, a) => f(...a)
7972
7890
  });
@@ -7980,7 +7898,7 @@ var ServiceContext = class extends Resource7 {
7980
7898
  });
7981
7899
  invariant20(identity.deviceCredentialChain, void 0, {
7982
7900
  F: __dxlog_file28,
7983
- L: 398,
7901
+ L: 401,
7984
7902
  S: this,
7985
7903
  A: [
7986
7904
  "identity.deviceCredentialChain",
@@ -8117,7 +8035,7 @@ var createLevel = async (config) => {
8117
8035
  // packages/sdk/client-services/src/packlets/storage/profile-archive.ts
8118
8036
  import { cbor } from "@dxos/automerge/automerge-repo";
8119
8037
  import { invariant as invariant21 } from "@dxos/invariant";
8120
- import { log as log26 } from "@dxos/log";
8038
+ import { log as log25 } from "@dxos/log";
8121
8039
  import { ProfileArchiveEntryType } from "@dxos/protocols";
8122
8040
  import { arrayToBuffer as arrayToBuffer2 } from "@dxos/util";
8123
8041
  var __dxlog_file29 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
@@ -8133,7 +8051,7 @@ var exportProfileData = async ({ storage, level }) => {
8133
8051
  {
8134
8052
  const directory = await storage.createDirectory();
8135
8053
  const files = await directory.list();
8136
- log26.info("begin exporting files", {
8054
+ log25.info("begin exporting files", {
8137
8055
  count: files.length
8138
8056
  }, {
8139
8057
  F: __dxlog_file29,
@@ -8151,7 +8069,7 @@ var exportProfileData = async ({ storage, level }) => {
8151
8069
  value: data
8152
8070
  });
8153
8071
  }
8154
- log26.info("done exporting files", {
8072
+ log25.info("done exporting files", {
8155
8073
  count: files.length
8156
8074
  }, {
8157
8075
  F: __dxlog_file29,
@@ -8161,7 +8079,7 @@ var exportProfileData = async ({ storage, level }) => {
8161
8079
  });
8162
8080
  }
8163
8081
  {
8164
- log26.info("begin exporting kv pairs", void 0, {
8082
+ log25.info("begin exporting kv pairs", void 0, {
8165
8083
  F: __dxlog_file29,
8166
8084
  L: 45,
8167
8085
  S: void 0,
@@ -8180,7 +8098,7 @@ var exportProfileData = async ({ storage, level }) => {
8180
8098
  });
8181
8099
  count++;
8182
8100
  }
8183
- log26.info("done exporting kv pairs", {
8101
+ log25.info("done exporting kv pairs", {
8184
8102
  count
8185
8103
  }, {
8186
8104
  F: __dxlog_file29,
@@ -8252,7 +8170,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8252
8170
  if (++count % 1e3 === 0) {
8253
8171
  await batch.write();
8254
8172
  batch = level.batch();
8255
- log26.info("importing", {
8173
+ log25.info("importing", {
8256
8174
  count,
8257
8175
  total: archive.storage.length,
8258
8176
  progress: `${(count / archive.storage.length * 100).toFixed()}%`
@@ -8264,7 +8182,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8264
8182
  });
8265
8183
  }
8266
8184
  }
8267
- log26.info("committing changes..", void 0, {
8185
+ log25.info("committing changes..", void 0, {
8268
8186
  F: __dxlog_file29,
8269
8187
  L: 109,
8270
8188
  S: void 0,
@@ -8280,7 +8198,7 @@ import { Context as Context10 } from "@dxos/context";
8280
8198
  import { EdgeClient, EdgeHttpClient, createStubEdgeIdentity } from "@dxos/edge-client";
8281
8199
  import { invariant as invariant23 } from "@dxos/invariant";
8282
8200
  import { PublicKey as PublicKey19 } from "@dxos/keys";
8283
- import { log as log28 } from "@dxos/log";
8201
+ import { log as log27 } from "@dxos/log";
8284
8202
  import { EdgeSignalManager, WebsocketSignalManager } from "@dxos/messaging";
8285
8203
  import { SwarmNetworkManager, createIceProvider, createRtcTransportFactory } from "@dxos/network-manager";
8286
8204
  import { trace as trace11 } from "@dxos/protocols";
@@ -8465,7 +8383,7 @@ var ContactsServiceImpl = class {
8465
8383
  import { Event as Event10 } from "@dxos/async";
8466
8384
  import { Stream as Stream14 } from "@dxos/codec-protobuf";
8467
8385
  import { PublicKey as PublicKey18 } from "@dxos/keys";
8468
- import { getContextFromEntry, log as log27 } from "@dxos/log";
8386
+ import { getContextFromEntry, log as log26 } from "@dxos/log";
8469
8387
  import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
8470
8388
  import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
8471
8389
  var LoggingServiceImpl = class {
@@ -8478,11 +8396,11 @@ var LoggingServiceImpl = class {
8478
8396
  };
8479
8397
  }
8480
8398
  async open() {
8481
- log27.runtimeConfig.processors.push(this._logProcessor);
8399
+ log26.runtimeConfig.processors.push(this._logProcessor);
8482
8400
  }
8483
8401
  async close() {
8484
- const index = log27.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
8485
- log27.runtimeConfig.processors.splice(index, 1);
8402
+ const index = log26.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
8403
+ log26.runtimeConfig.processors.splice(index, 1);
8486
8404
  }
8487
8405
  async controlMetrics({ reset, record }) {
8488
8406
  if (reset) {
@@ -8788,7 +8706,7 @@ var ClientServicesHost = class {
8788
8706
  "'service host is open'"
8789
8707
  ]
8790
8708
  });
8791
- log28("initializing...", void 0, {
8709
+ log27("initializing...", void 0, {
8792
8710
  F: __dxlog_file31,
8793
8711
  L: 204,
8794
8712
  S: this,
@@ -8810,7 +8728,7 @@ var ClientServicesHost = class {
8810
8728
  }
8811
8729
  }
8812
8730
  if (!options.signalManager) {
8813
- log28.warn("running signaling without telemetry metadata.", void 0, {
8731
+ log27.warn("running signaling without telemetry metadata.", void 0, {
8814
8732
  F: __dxlog_file31,
8815
8733
  L: 215,
8816
8734
  S: this,
@@ -8848,7 +8766,7 @@ var ClientServicesHost = class {
8848
8766
  peerKey: this._edgeConnection.peerKey
8849
8767
  } : void 0
8850
8768
  });
8851
- log28("initialized", void 0, {
8769
+ log27("initialized", void 0, {
8852
8770
  F: __dxlog_file31,
8853
8771
  L: 250,
8854
8772
  S: this,
@@ -8860,7 +8778,7 @@ var ClientServicesHost = class {
8860
8778
  return;
8861
8779
  }
8862
8780
  const traceId = PublicKey19.random().toHex();
8863
- log28.trace("dxos.client-services.host.open", trace11.begin({
8781
+ log27.trace("dxos.client-services.host.open", trace11.begin({
8864
8782
  id: traceId
8865
8783
  }), {
8866
8784
  F: __dxlog_file31,
@@ -8905,7 +8823,7 @@ var ClientServicesHost = class {
8905
8823
  ]
8906
8824
  });
8907
8825
  this._opening = true;
8908
- log28("opening...", {
8826
+ log27("opening...", {
8909
8827
  lockKey: this._resourceLock?.lockKey
8910
8828
  }, {
8911
8829
  F: __dxlog_file31,
@@ -8947,7 +8865,7 @@ var ClientServicesHost = class {
8947
8865
  config: this._config,
8948
8866
  context: this._serviceContext
8949
8867
  }),
8950
- EdgeAgentService: new EdgeAgentServiceImpl(agentManagerProvider)
8868
+ EdgeAgentService: new EdgeAgentServiceImpl(agentManagerProvider, this._edgeConnection)
8951
8869
  });
8952
8870
  await this._serviceContext.open(ctx);
8953
8871
  await identityService.open();
@@ -8966,7 +8884,7 @@ var ClientServicesHost = class {
8966
8884
  this._open = true;
8967
8885
  this._statusUpdate.emit();
8968
8886
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
8969
- log28("opened", {
8887
+ log27("opened", {
8970
8888
  deviceKey
8971
8889
  }, {
8972
8890
  F: __dxlog_file31,
@@ -8974,7 +8892,7 @@ var ClientServicesHost = class {
8974
8892
  S: this,
8975
8893
  C: (f, a) => f(...a)
8976
8894
  });
8977
- log28.trace("dxos.client-services.host.open", trace11.end({
8895
+ log27.trace("dxos.client-services.host.open", trace11.end({
8978
8896
  id: traceId
8979
8897
  }), {
8980
8898
  F: __dxlog_file31,
@@ -8988,7 +8906,7 @@ var ClientServicesHost = class {
8988
8906
  return;
8989
8907
  }
8990
8908
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
8991
- log28("closing...", {
8909
+ log27("closing...", {
8992
8910
  deviceKey
8993
8911
  }, {
8994
8912
  F: __dxlog_file31,
@@ -9006,7 +8924,7 @@ var ClientServicesHost = class {
9006
8924
  await this._level?.close();
9007
8925
  this._open = false;
9008
8926
  this._statusUpdate.emit();
9009
- log28("closed", {
8927
+ log27("closed", {
9010
8928
  deviceKey
9011
8929
  }, {
9012
8930
  F: __dxlog_file31,
@@ -9017,7 +8935,7 @@ var ClientServicesHost = class {
9017
8935
  }
9018
8936
  async reset() {
9019
8937
  const traceId = PublicKey19.random().toHex();
9020
- log28.trace("dxos.sdk.client-services-host.reset", trace11.begin({
8938
+ log27.trace("dxos.sdk.client-services-host.reset", trace11.begin({
9021
8939
  id: traceId
9022
8940
  }), {
9023
8941
  F: __dxlog_file31,
@@ -9025,7 +8943,7 @@ var ClientServicesHost = class {
9025
8943
  S: this,
9026
8944
  C: (f, a) => f(...a)
9027
8945
  });
9028
- log28.info("resetting...", void 0, {
8946
+ log27.info("resetting...", void 0, {
9029
8947
  F: __dxlog_file31,
9030
8948
  L: 394,
9031
8949
  S: this,
@@ -9035,13 +8953,13 @@ var ClientServicesHost = class {
9035
8953
  this._statusUpdate.emit();
9036
8954
  await this._serviceContext?.close();
9037
8955
  await this._storage.reset();
9038
- log28.info("reset", void 0, {
8956
+ log27.info("reset", void 0, {
9039
8957
  F: __dxlog_file31,
9040
8958
  L: 401,
9041
8959
  S: this,
9042
8960
  C: (f, a) => f(...a)
9043
8961
  });
9044
- log28.trace("dxos.sdk.client-services-host.reset", trace11.end({
8962
+ log27.trace("dxos.sdk.client-services-host.reset", trace11.end({
9045
8963
  id: traceId
9046
8964
  }), {
9047
8965
  F: __dxlog_file31,
@@ -9123,4 +9041,4 @@ export {
9123
9041
  importProfileData,
9124
9042
  ClientServicesHost
9125
9043
  };
9126
- //# sourceMappingURL=chunk-YSHSPXSP.mjs.map
9044
+ //# sourceMappingURL=chunk-5GKWY67F.mjs.map