@dxos/client-services 0.6.13-main.548ca8d → 0.6.13-main.ed424a1

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 (70) hide show
  1. package/dist/lib/browser/{chunk-UEQIHAL2.mjs → chunk-IPWEAPT2.mjs} +728 -379
  2. package/dist/lib/browser/chunk-IPWEAPT2.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +5 -1
  4. package/dist/lib/browser/index.mjs.map +1 -1
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +5 -1
  7. package/dist/lib/browser/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/{chunk-MA5EWTRH.cjs → chunk-DJIOUOAF.cjs} +769 -422
  9. package/dist/lib/node/chunk-DJIOUOAF.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +49 -45
  11. package/dist/lib/node/index.cjs.map +1 -1
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/testing/index.cjs +12 -8
  14. package/dist/lib/node/testing/index.cjs.map +3 -3
  15. package/dist/lib/node-esm/{chunk-AIBLDI4U.mjs → chunk-MMU5KC57.mjs} +728 -379
  16. package/dist/lib/node-esm/chunk-MMU5KC57.mjs.map +7 -0
  17. package/dist/lib/node-esm/index.mjs +5 -1
  18. package/dist/lib/node-esm/index.mjs.map +1 -1
  19. package/dist/lib/node-esm/meta.json +1 -1
  20. package/dist/lib/node-esm/testing/index.mjs +5 -1
  21. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  22. package/dist/types/src/index.d.ts +1 -0
  23. package/dist/types/src/index.d.ts.map +1 -1
  24. package/dist/types/src/packlets/agents/edge-agent-manager.d.ts +35 -0
  25. package/dist/types/src/packlets/agents/edge-agent-manager.d.ts.map +1 -0
  26. package/dist/types/src/packlets/agents/edge-agent-service.d.ts +10 -0
  27. package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -0
  28. package/dist/types/src/packlets/agents/index.d.ts +3 -0
  29. package/dist/types/src/packlets/agents/index.d.ts.map +1 -0
  30. package/dist/types/src/packlets/identity/identity-manager.d.ts +11 -7
  31. package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
  32. package/dist/types/src/packlets/identity/identity.d.ts +4 -2
  33. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  34. package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
  35. package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts.map +1 -1
  36. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  37. package/dist/types/src/packlets/services/service-context.d.ts +4 -1
  38. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  39. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  40. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +1 -0
  41. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  42. package/dist/types/src/packlets/spaces/data-space.d.ts +1 -0
  43. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  44. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +4 -0
  45. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
  46. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  47. package/dist/types/src/version.d.ts +1 -1
  48. package/package.json +38 -38
  49. package/src/index.ts +1 -0
  50. package/src/packlets/agents/edge-agent-manager.ts +163 -0
  51. package/src/packlets/agents/edge-agent-service.ts +42 -0
  52. package/src/packlets/agents/index.ts +6 -0
  53. package/src/packlets/identity/identity-manager.test.ts +26 -10
  54. package/src/packlets/identity/identity-manager.ts +19 -19
  55. package/src/packlets/identity/identity.test.ts +2 -0
  56. package/src/packlets/identity/identity.ts +21 -12
  57. package/src/packlets/invitations/device-invitation-protocol.ts +5 -1
  58. package/src/packlets/invitations/edge-invitation-handler.ts +6 -5
  59. package/src/packlets/invitations/invitations-handler.ts +1 -2
  60. package/src/packlets/services/service-context.ts +75 -45
  61. package/src/packlets/services/service-host.ts +8 -0
  62. package/src/packlets/spaces/data-space-manager.ts +4 -2
  63. package/src/packlets/spaces/data-space.ts +3 -0
  64. package/src/packlets/spaces/edge-feed-replicator.test.ts +5 -6
  65. package/src/packlets/spaces/notarization-plugin.ts +27 -0
  66. package/src/packlets/testing/test-builder.ts +4 -0
  67. package/src/version.ts +1 -1
  68. package/dist/lib/browser/chunk-UEQIHAL2.mjs.map +0 -7
  69. package/dist/lib/node/chunk-MA5EWTRH.cjs.map +0 -7
  70. package/dist/lib/node-esm/chunk-AIBLDI4U.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.6.13-main.548ca8d";
400
+ var DXOS_VERSION = "0.6.13-main.ed424a1";
401
401
 
402
402
  // packages/sdk/client-services/src/packlets/services/platform.ts
403
403
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -1473,6 +1473,7 @@ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/sr
1473
1473
  var DEFAULT_RETRY_TIMEOUT = 1e3;
1474
1474
  var DEFAULT_SUCCESS_DELAY = 1e3;
1475
1475
  var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
1476
+ var DEFAULT_ACTIVE_EDGE_POLLING_INTERVAL = 3e3;
1476
1477
  var MAX_EDGE_RETRIES = 2;
1477
1478
  var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
1478
1479
  var credentialCodec = schema2.getCodecForType("dxos.halo.credentials.Credential");
@@ -1483,11 +1484,44 @@ var NotarizationPlugin = class extends Resource3 {
1483
1484
  this._extensions = /* @__PURE__ */ new Set();
1484
1485
  this._processedCredentials = new ComplexSet(PublicKey4.hash);
1485
1486
  this._processCredentialsTriggers = new ComplexMap3(PublicKey4.hash);
1487
+ this._activeEdgePollingIntervalHandle = void 0;
1486
1488
  this._spaceId = params.spaceId;
1489
+ this._activeEdgePollingInterval = params.activeEdgePollingInterval ?? DEFAULT_ACTIVE_EDGE_POLLING_INTERVAL;
1487
1490
  if (params.edgeClient && params.edgeFeatures?.feedReplicator) {
1488
1491
  this._edgeClient = params.edgeClient;
1489
1492
  }
1490
1493
  }
1494
+ setActiveEdgePollingEnabled(enabled) {
1495
+ invariant4(this.isOpen, void 0, {
1496
+ F: __dxlog_file7,
1497
+ L: 109,
1498
+ S: this,
1499
+ A: [
1500
+ "this.isOpen",
1501
+ ""
1502
+ ]
1503
+ });
1504
+ const client = this._edgeClient;
1505
+ invariant4(client, void 0, {
1506
+ F: __dxlog_file7,
1507
+ L: 111,
1508
+ S: this,
1509
+ A: [
1510
+ "client",
1511
+ ""
1512
+ ]
1513
+ });
1514
+ if (enabled && !this._activeEdgePollingIntervalHandle) {
1515
+ this._activeEdgePollingIntervalHandle = setInterval(() => {
1516
+ if (this._writer) {
1517
+ this._notarizePendingEdgeCredentials(client, this._writer);
1518
+ }
1519
+ }, this._activeEdgePollingInterval);
1520
+ } else if (!enabled && this._activeEdgePollingIntervalHandle) {
1521
+ clearInterval(this._activeEdgePollingIntervalHandle);
1522
+ this._activeEdgePollingIntervalHandle = void 0;
1523
+ }
1524
+ }
1491
1525
  get hasWriter() {
1492
1526
  return !!this._writer;
1493
1527
  }
@@ -1497,6 +1531,10 @@ var NotarizationPlugin = class extends Resource3 {
1497
1531
  }
1498
1532
  }
1499
1533
  async _close() {
1534
+ if (this._activeEdgePollingIntervalHandle) {
1535
+ clearInterval(this._activeEdgePollingIntervalHandle);
1536
+ this._activeEdgePollingIntervalHandle = void 0;
1537
+ }
1500
1538
  await this._ctx.dispose();
1501
1539
  }
1502
1540
  /**
@@ -1507,13 +1545,13 @@ var NotarizationPlugin = class extends Resource3 {
1507
1545
  credentials
1508
1546
  }, {
1509
1547
  F: __dxlog_file7,
1510
- L: 126,
1548
+ L: 153,
1511
1549
  S: this,
1512
1550
  C: (f, a) => f(...a)
1513
1551
  });
1514
1552
  invariant4(credentials.every((credential) => credential.id), "Credentials must have an id", {
1515
1553
  F: __dxlog_file7,
1516
- L: 127,
1554
+ L: 154,
1517
1555
  S: this,
1518
1556
  A: [
1519
1557
  "credentials.every((credential) => credential.id)",
@@ -1527,7 +1565,7 @@ var NotarizationPlugin = class extends Resource3 {
1527
1565
  err
1528
1566
  }, {
1529
1567
  F: __dxlog_file7,
1530
- L: 135,
1568
+ L: 162,
1531
1569
  S: this,
1532
1570
  C: (f, a) => f(...a)
1533
1571
  });
@@ -1559,7 +1597,7 @@ var NotarizationPlugin = class extends Resource3 {
1559
1597
  ]);
1560
1598
  log5("done", void 0, {
1561
1599
  F: __dxlog_file7,
1562
- L: 160,
1600
+ L: 187,
1563
1601
  S: this,
1564
1602
  C: (f, a) => f(...a)
1565
1603
  });
@@ -1582,7 +1620,7 @@ var NotarizationPlugin = class extends Resource3 {
1582
1620
  retryIn: retryTimeout
1583
1621
  }, {
1584
1622
  F: __dxlog_file7,
1585
- L: 183,
1623
+ L: 210,
1586
1624
  S: this,
1587
1625
  C: (f, a) => f(...a)
1588
1626
  });
@@ -1596,7 +1634,7 @@ var NotarizationPlugin = class extends Resource3 {
1596
1634
  credentialId: credentials.map((credential) => credential.id)
1597
1635
  }, {
1598
1636
  F: __dxlog_file7,
1599
- L: 190,
1637
+ L: 217,
1600
1638
  S: this,
1601
1639
  C: (f, a) => f(...a)
1602
1640
  });
@@ -1605,7 +1643,7 @@ var NotarizationPlugin = class extends Resource3 {
1605
1643
  });
1606
1644
  log5("success", void 0, {
1607
1645
  F: __dxlog_file7,
1608
- L: 194,
1646
+ L: 221,
1609
1647
  S: this,
1610
1648
  C: (f, a) => f(...a)
1611
1649
  });
@@ -1614,7 +1652,7 @@ var NotarizationPlugin = class extends Resource3 {
1614
1652
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
1615
1653
  log5.info("error notarizing (recoverable)", err, {
1616
1654
  F: __dxlog_file7,
1617
- L: 199,
1655
+ L: 226,
1618
1656
  S: this,
1619
1657
  C: (f, a) => f(...a)
1620
1658
  });
@@ -1643,7 +1681,7 @@ var NotarizationPlugin = class extends Resource3 {
1643
1681
  });
1644
1682
  log5("edge notarization success", void 0, {
1645
1683
  F: __dxlog_file7,
1646
- L: 227,
1684
+ L: 254,
1647
1685
  S: this,
1648
1686
  C: (f, a) => f(...a)
1649
1687
  });
@@ -1666,7 +1704,7 @@ var NotarizationPlugin = class extends Resource3 {
1666
1704
  setWriter(writer) {
1667
1705
  invariant4(!this._writer, "Writer already set.", {
1668
1706
  F: __dxlog_file7,
1669
- L: 247,
1707
+ L: 274,
1670
1708
  S: this,
1671
1709
  A: [
1672
1710
  "!this._writer",
@@ -1696,7 +1734,7 @@ var NotarizationPlugin = class extends Resource3 {
1696
1734
  if (!credentials.length) {
1697
1735
  log5("edge did not return credentials for notarization", void 0, {
1698
1736
  F: __dxlog_file7,
1699
- L: 269,
1737
+ L: 296,
1700
1738
  S: this,
1701
1739
  C: (f, a) => f(...a)
1702
1740
  });
@@ -1706,7 +1744,7 @@ var NotarizationPlugin = class extends Resource3 {
1706
1744
  count: credentials.length
1707
1745
  }, {
1708
1746
  F: __dxlog_file7,
1709
- L: 273,
1747
+ L: 300,
1710
1748
  S: this,
1711
1749
  C: (f, a) => f(...a)
1712
1750
  });
@@ -1719,7 +1757,7 @@ var NotarizationPlugin = class extends Resource3 {
1719
1757
  count: decodedCredentials.length
1720
1758
  }, {
1721
1759
  F: __dxlog_file7,
1722
- L: 282,
1760
+ L: 309,
1723
1761
  S: this,
1724
1762
  C: (f, a) => f(...a)
1725
1763
  });
@@ -1747,7 +1785,7 @@ var NotarizationPlugin = class extends Resource3 {
1747
1785
  for (const credential of credentials) {
1748
1786
  invariant4(credential.id, "Credential must have an id", {
1749
1787
  F: __dxlog_file7,
1750
- L: 308,
1788
+ L: 335,
1751
1789
  S: this,
1752
1790
  A: [
1753
1791
  "credential.id",
@@ -1771,7 +1809,7 @@ var NotarizationPlugin = class extends Resource3 {
1771
1809
  peer: extension.localPeerId
1772
1810
  }, {
1773
1811
  F: __dxlog_file7,
1774
- L: 323,
1812
+ L: 350,
1775
1813
  S: this,
1776
1814
  C: (f, a) => f(...a)
1777
1815
  });
@@ -1783,7 +1821,7 @@ var NotarizationPlugin = class extends Resource3 {
1783
1821
  peer: extension.localPeerId
1784
1822
  }, {
1785
1823
  F: __dxlog_file7,
1786
- L: 328,
1824
+ L: 355,
1787
1825
  S: this,
1788
1826
  C: (f, a) => f(...a)
1789
1827
  });
@@ -1800,7 +1838,7 @@ var NotarizationPlugin = class extends Resource3 {
1800
1838
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
1801
1839
  }, {
1802
1840
  F: __dxlog_file7,
1803
- L: 340,
1841
+ L: 367,
1804
1842
  S: this,
1805
1843
  C: (f, a) => f(...a)
1806
1844
  });
@@ -1816,7 +1854,7 @@ var handleEdgeError = (error) => {
1816
1854
  if (!(error instanceof EdgeCallFailedError) || error.errorData) {
1817
1855
  log5.catch(error, void 0, {
1818
1856
  F: __dxlog_file7,
1819
- L: 354,
1857
+ L: 381,
1820
1858
  S: void 0,
1821
1859
  C: (f, a) => f(...a)
1822
1860
  });
@@ -1825,7 +1863,7 @@ var handleEdgeError = (error) => {
1825
1863
  reason: error.reason
1826
1864
  }, {
1827
1865
  F: __dxlog_file7,
1828
- L: 356,
1866
+ L: 383,
1829
1867
  S: void 0,
1830
1868
  C: (f, a) => f(...a)
1831
1869
  });
@@ -1928,7 +1966,7 @@ import { LifecycleState, Resource as Resource4, cancelWithContext } from "@dxos/
1928
1966
  import { createAdmissionCredentials, getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
1929
1967
  import { convertLegacyReferences as convertLegacyReferences2, findInlineObjectOfType as findInlineObjectOfType2, AuthStatus, CredentialServerExtension } from "@dxos/echo-pipeline";
1930
1968
  import { LEGACY_TYPE_PROPERTIES, SpaceDocVersion as SpaceDocVersion2, encodeReference } from "@dxos/echo-protocol";
1931
- import { TYPE_PROPERTIES as TYPE_PROPERTIES2, generateEchoId, getTypeReference } from "@dxos/echo-schema";
1969
+ import { TYPE_PROPERTIES as TYPE_PROPERTIES2, createObjectId, getTypeReference } from "@dxos/echo-schema";
1932
1970
  import { writeMessages } from "@dxos/feed-store";
1933
1971
  import { invariant as invariant5 } from "@dxos/invariant";
1934
1972
  import { PublicKey as PublicKey5 } from "@dxos/keys";
@@ -2077,7 +2115,7 @@ var DataSpaceManager = class extends Resource4 {
2077
2115
  async _open() {
2078
2116
  log7("open", void 0, {
2079
2117
  F: __dxlog_file9,
2080
- L: 198,
2118
+ L: 199,
2081
2119
  S: this,
2082
2120
  C: (f, a) => f(...a)
2083
2121
  });
@@ -2085,7 +2123,7 @@ var DataSpaceManager = class extends Resource4 {
2085
2123
  id: this._instanceId
2086
2124
  }), {
2087
2125
  F: __dxlog_file9,
2088
- L: 199,
2126
+ L: 200,
2089
2127
  S: this,
2090
2128
  C: (f, a) => f(...a)
2091
2129
  });
@@ -2093,7 +2131,7 @@ var DataSpaceManager = class extends Resource4 {
2093
2131
  spaces: this._metadataStore.spaces.length
2094
2132
  }, {
2095
2133
  F: __dxlog_file9,
2096
- L: 200,
2134
+ L: 201,
2097
2135
  S: this,
2098
2136
  C: (f, a) => f(...a)
2099
2137
  });
@@ -2103,7 +2141,7 @@ var DataSpaceManager = class extends Resource4 {
2103
2141
  spaceMetadata
2104
2142
  }, {
2105
2143
  F: __dxlog_file9,
2106
- L: 204,
2144
+ L: 205,
2107
2145
  S: this,
2108
2146
  C: (f, a) => f(...a)
2109
2147
  });
@@ -2114,7 +2152,7 @@ var DataSpaceManager = class extends Resource4 {
2114
2152
  err
2115
2153
  }, {
2116
2154
  F: __dxlog_file9,
2117
- L: 207,
2155
+ L: 208,
2118
2156
  S: this,
2119
2157
  C: (f, a) => f(...a)
2120
2158
  });
@@ -2125,7 +2163,7 @@ var DataSpaceManager = class extends Resource4 {
2125
2163
  id: this._instanceId
2126
2164
  }), {
2127
2165
  F: __dxlog_file9,
2128
- L: 213,
2166
+ L: 214,
2129
2167
  S: this,
2130
2168
  C: (f, a) => f(...a)
2131
2169
  });
@@ -2133,7 +2171,7 @@ var DataSpaceManager = class extends Resource4 {
2133
2171
  async _close() {
2134
2172
  log7("close", void 0, {
2135
2173
  F: __dxlog_file9,
2136
- L: 218,
2174
+ L: 219,
2137
2175
  S: this,
2138
2176
  C: (f, a) => f(...a)
2139
2177
  });
@@ -2148,7 +2186,7 @@ var DataSpaceManager = class extends Resource4 {
2148
2186
  async createSpace() {
2149
2187
  invariant5(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
2150
2188
  F: __dxlog_file9,
2151
- L: 230,
2189
+ L: 231,
2152
2190
  S: this,
2153
2191
  A: [
2154
2192
  "this._lifecycleState === LifecycleState.OPEN",
@@ -2169,7 +2207,7 @@ var DataSpaceManager = class extends Resource4 {
2169
2207
  spaceKey
2170
2208
  }, {
2171
2209
  F: __dxlog_file9,
2172
- L: 242,
2210
+ L: 243,
2173
2211
  S: this,
2174
2212
  C: (f, a) => f(...a)
2175
2213
  });
@@ -2181,7 +2219,7 @@ var DataSpaceManager = class extends Resource4 {
2181
2219
  const memberCredential = credentials[1];
2182
2220
  invariant5(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2183
2221
  F: __dxlog_file9,
2184
- L: 252,
2222
+ L: 253,
2185
2223
  S: this,
2186
2224
  A: [
2187
2225
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2213,7 +2251,7 @@ var DataSpaceManager = class extends Resource4 {
2213
2251
  spaceId: space.id
2214
2252
  }, {
2215
2253
  F: __dxlog_file9,
2216
- L: 277,
2254
+ L: 278,
2217
2255
  S: this,
2218
2256
  C: (f, a) => f(...a)
2219
2257
  });
@@ -2234,7 +2272,7 @@ var DataSpaceManager = class extends Resource4 {
2234
2272
  keys: []
2235
2273
  }
2236
2274
  };
2237
- const propertiesId = generateEchoId();
2275
+ const propertiesId = createObjectId();
2238
2276
  document.change((doc) => {
2239
2277
  setDeep(doc, [
2240
2278
  "objects",
@@ -2248,7 +2286,7 @@ var DataSpaceManager = class extends Resource4 {
2248
2286
  const automergeIndex = space.automergeSpaceState.rootUrl;
2249
2287
  invariant5(automergeIndex, void 0, {
2250
2288
  F: __dxlog_file9,
2251
- L: 310,
2289
+ L: 311,
2252
2290
  S: this,
2253
2291
  A: [
2254
2292
  "automergeIndex",
@@ -2265,13 +2303,13 @@ var DataSpaceManager = class extends Resource4 {
2265
2303
  opts
2266
2304
  }, {
2267
2305
  F: __dxlog_file9,
2268
- L: 319,
2306
+ L: 320,
2269
2307
  S: this,
2270
2308
  C: (f, a) => f(...a)
2271
2309
  });
2272
2310
  invariant5(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
2273
2311
  F: __dxlog_file9,
2274
- L: 320,
2312
+ L: 321,
2275
2313
  S: this,
2276
2314
  A: [
2277
2315
  "this._lifecycleState === LifecycleState.OPEN",
@@ -2280,7 +2318,7 @@ var DataSpaceManager = class extends Resource4 {
2280
2318
  });
2281
2319
  invariant5(!this._spaces.has(opts.spaceKey), "Space already exists.", {
2282
2320
  F: __dxlog_file9,
2283
- L: 321,
2321
+ L: 322,
2284
2322
  S: this,
2285
2323
  A: [
2286
2324
  "!this._spaces.has(opts.spaceKey)",
@@ -2304,7 +2342,7 @@ var DataSpaceManager = class extends Resource4 {
2304
2342
  const space = this._spaceManager.spaces.get(options.spaceKey);
2305
2343
  invariant5(space, void 0, {
2306
2344
  F: __dxlog_file9,
2307
- L: 341,
2345
+ L: 342,
2308
2346
  S: this,
2309
2347
  A: [
2310
2348
  "space",
@@ -2317,7 +2355,7 @@ var DataSpaceManager = class extends Resource4 {
2317
2355
  const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
2318
2356
  invariant5(credentials[0].credential, void 0, {
2319
2357
  F: __dxlog_file9,
2320
- L: 360,
2358
+ L: 361,
2321
2359
  S: this,
2322
2360
  A: [
2323
2361
  "credentials[0].credential",
@@ -2327,7 +2365,7 @@ var DataSpaceManager = class extends Resource4 {
2327
2365
  const spaceMemberCredential = credentials[0].credential.credential;
2328
2366
  invariant5(getCredentialAssertion2(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2329
2367
  F: __dxlog_file9,
2330
- L: 362,
2368
+ L: 363,
2331
2369
  S: this,
2332
2370
  A: [
2333
2371
  "getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2365,7 +2403,7 @@ var DataSpaceManager = class extends Resource4 {
2365
2403
  const space = this._spaces.get(spaceKey);
2366
2404
  invariant5(space, "Space not found.", {
2367
2405
  F: __dxlog_file9,
2368
- L: 399,
2406
+ L: 400,
2369
2407
  S: this,
2370
2408
  A: [
2371
2409
  "space",
@@ -2390,7 +2428,7 @@ var DataSpaceManager = class extends Resource4 {
2390
2428
  metadata
2391
2429
  }, {
2392
2430
  F: __dxlog_file9,
2393
- L: 418,
2431
+ L: 419,
2394
2432
  S: this,
2395
2433
  C: (f, a) => f(...a)
2396
2434
  });
@@ -2434,7 +2472,7 @@ var DataSpaceManager = class extends Resource4 {
2434
2472
  err
2435
2473
  }, {
2436
2474
  F: __dxlog_file9,
2437
- L: 460,
2475
+ L: 461,
2438
2476
  S: this,
2439
2477
  C: (f, a) => f(...a)
2440
2478
  });
@@ -2444,7 +2482,7 @@ var DataSpaceManager = class extends Resource4 {
2444
2482
  onAuthFailure: () => {
2445
2483
  log7.warn("auth failure", void 0, {
2446
2484
  F: __dxlog_file9,
2447
- L: 465,
2485
+ L: 466,
2448
2486
  S: this,
2449
2487
  C: (f, a) => f(...a)
2450
2488
  });
@@ -2477,7 +2515,7 @@ var DataSpaceManager = class extends Resource4 {
2477
2515
  space: space.key
2478
2516
  }, {
2479
2517
  F: __dxlog_file9,
2480
- L: 492,
2518
+ L: 493,
2481
2519
  S: this,
2482
2520
  C: (f, a) => f(...a)
2483
2521
  });
@@ -2488,7 +2526,7 @@ var DataSpaceManager = class extends Resource4 {
2488
2526
  open: this._lifecycleState === LifecycleState.OPEN
2489
2527
  }, {
2490
2528
  F: __dxlog_file9,
2491
- L: 495,
2529
+ L: 496,
2492
2530
  S: this,
2493
2531
  C: (f, a) => f(...a)
2494
2532
  });
@@ -2507,7 +2545,7 @@ var DataSpaceManager = class extends Resource4 {
2507
2545
  space: space.key
2508
2546
  }, {
2509
2547
  F: __dxlog_file9,
2510
- L: 503,
2548
+ L: 504,
2511
2549
  S: this,
2512
2550
  C: (f, a) => f(...a)
2513
2551
  });
@@ -2516,7 +2554,8 @@ var DataSpaceManager = class extends Resource4 {
2516
2554
  cache: metadata.cache,
2517
2555
  edgeConnection: this._edgeConnection,
2518
2556
  edgeHttpClient: this._edgeHttpClient,
2519
- edgeFeatures: this._edgeFeatures
2557
+ edgeFeatures: this._edgeFeatures,
2558
+ activeEdgeNotarizationPollingInterval: this._runtimeParams?.activeEdgeNotarizationPollingInterval
2520
2559
  });
2521
2560
  dataSpace.postOpen.append(async () => {
2522
2561
  const setting = dataSpace.getEdgeReplicationSetting();
@@ -2527,7 +2566,7 @@ var DataSpaceManager = class extends Resource4 {
2527
2566
  spaceId: dataSpace.id
2528
2567
  }, {
2529
2568
  F: __dxlog_file9,
2530
- L: 516,
2569
+ L: 518,
2531
2570
  S: this,
2532
2571
  C: (f, a) => f(...a)
2533
2572
  });
@@ -2557,7 +2596,7 @@ var DataSpaceManager = class extends Resource4 {
2557
2596
  space: space.key
2558
2597
  }, {
2559
2598
  F: __dxlog_file9,
2560
- L: 543,
2599
+ L: 545,
2561
2600
  S: this,
2562
2601
  C: (f, a) => f(...a)
2563
2602
  });
@@ -2590,7 +2629,7 @@ var DataSpaceManager = class extends Resource4 {
2590
2629
  closedSessions
2591
2630
  }, {
2592
2631
  F: __dxlog_file9,
2593
- L: 569,
2632
+ L: 571,
2594
2633
  S: this,
2595
2634
  C: (f, a) => f(...a)
2596
2635
  });
@@ -2605,7 +2644,7 @@ var DataSpaceManager = class extends Resource4 {
2605
2644
  peerId: peerState.peerId
2606
2645
  }, {
2607
2646
  F: __dxlog_file9,
2608
- L: 583,
2647
+ L: 585,
2609
2648
  S: this,
2610
2649
  C: (f, a) => f(...a)
2611
2650
  });
@@ -3033,7 +3072,7 @@ var Identity = class {
3033
3072
  deviceKey: params.deviceKey
3034
3073
  }, {
3035
3074
  F: __dxlog_file11,
3036
- L: 78,
3075
+ L: 79,
3037
3076
  S: this,
3038
3077
  C: (f, a) => f(...a)
3039
3078
  });
@@ -3074,10 +3113,13 @@ var Identity = class {
3074
3113
  await this.space.spaceState.addCredentialProcessor(this._deviceStateMachine);
3075
3114
  await this.space.spaceState.addCredentialProcessor(this._profileStateMachine);
3076
3115
  await this.space.spaceState.addCredentialProcessor(this._defaultSpaceStateMachine);
3116
+ await this.space.open(ctx);
3117
+ }
3118
+ async joinNetwork() {
3077
3119
  if (this._edgeFeedReplicator) {
3078
3120
  this.space.protocol.feedAdded.append(this._onFeedAdded);
3079
3121
  }
3080
- await this.space.open(ctx);
3122
+ await this.space.startProtocol();
3081
3123
  await this._edgeFeedReplicator?.open();
3082
3124
  }
3083
3125
  async close(ctx) {
@@ -3107,6 +3149,9 @@ var Identity = class {
3107
3149
  get controlPipeline() {
3108
3150
  return this.space.controlPipeline;
3109
3151
  }
3152
+ get haloSpaceId() {
3153
+ return this.space.id;
3154
+ }
3110
3155
  get haloSpaceKey() {
3111
3156
  return this.space.key;
3112
3157
  }
@@ -3129,7 +3174,7 @@ var Identity = class {
3129
3174
  getIdentityCredentialSigner() {
3130
3175
  invariant7(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
3131
3176
  F: __dxlog_file11,
3132
- L: 189,
3177
+ L: 195,
3133
3178
  S: this,
3134
3179
  A: [
3135
3180
  "this._deviceStateMachine.deviceCredentialChain",
@@ -3173,20 +3218,21 @@ var Identity = class {
3173
3218
  dataFeedKey
3174
3219
  }, {
3175
3220
  F: __dxlog_file11,
3176
- L: 214,
3221
+ L: 220,
3177
3222
  S: this,
3178
3223
  C: (f, a) => f(...a)
3179
3224
  });
3180
3225
  const signer = this.getIdentityCredentialSigner();
3226
+ const deviceCredential = await signer.createCredential({
3227
+ subject: deviceKey,
3228
+ assertion: {
3229
+ "@type": "dxos.halo.credentials.AuthorizedDevice",
3230
+ identityKey: this.identityKey,
3231
+ deviceKey
3232
+ }
3233
+ });
3181
3234
  await writeMessages3(this.controlPipeline.writer, [
3182
- await signer.createCredential({
3183
- subject: deviceKey,
3184
- assertion: {
3185
- "@type": "dxos.halo.credentials.AuthorizedDevice",
3186
- identityKey: this.identityKey,
3187
- deviceKey
3188
- }
3189
- }),
3235
+ deviceCredential,
3190
3236
  await signer.createCredential({
3191
3237
  subject: controlFeedKey,
3192
3238
  assertion: {
@@ -3212,6 +3258,7 @@ var Identity = class {
3212
3258
  credential
3213
3259
  }
3214
3260
  })));
3261
+ return deviceCredential;
3215
3262
  }
3216
3263
  };
3217
3264
  _ts_decorate4([
@@ -3260,7 +3307,6 @@ var IdentityManager = class {
3260
3307
  this._edgeFeatures = params.edgeFeatures;
3261
3308
  this._devicePresenceAnnounceInterval = params.devicePresenceAnnounceInterval ?? DEVICE_PRESENCE_ANNOUNCE_INTERVAL;
3262
3309
  this._devicePresenceOfflineTimeout = params.devicePresenceOfflineTimeout ?? DEVICE_PRESENCE_OFFLINE_TIMEOUT;
3263
- this._callbacks = params.callbacks;
3264
3310
  }
3265
3311
  get identity() {
3266
3312
  return this._identity;
@@ -3271,7 +3317,7 @@ var IdentityManager = class {
3271
3317
  id: traceId
3272
3318
  }), {
3273
3319
  F: __dxlog_file12,
3274
- L: 121,
3320
+ L: 116,
3275
3321
  S: this,
3276
3322
  C: (f, a) => f(...a)
3277
3323
  });
@@ -3280,7 +3326,7 @@ var IdentityManager = class {
3280
3326
  identityRecord
3281
3327
  }, {
3282
3328
  F: __dxlog_file12,
3283
- L: 124,
3329
+ L: 119,
3284
3330
  S: this,
3285
3331
  C: (f, a) => f(...a)
3286
3332
  });
@@ -3293,7 +3339,7 @@ var IdentityManager = class {
3293
3339
  displayName: this._identity.profileDocument?.displayName
3294
3340
  }, {
3295
3341
  F: __dxlog_file12,
3296
- L: 129,
3342
+ L: 124,
3297
3343
  S: this,
3298
3344
  C: (f, a) => f(...a)
3299
3345
  });
@@ -3303,7 +3349,7 @@ var IdentityManager = class {
3303
3349
  id: traceId
3304
3350
  }), {
3305
3351
  F: __dxlog_file12,
3306
- L: 136,
3352
+ L: 131,
3307
3353
  S: this,
3308
3354
  C: (f, a) => f(...a)
3309
3355
  });
@@ -3311,13 +3357,13 @@ var IdentityManager = class {
3311
3357
  async close() {
3312
3358
  await this._identity?.close(new Context4(void 0, {
3313
3359
  F: __dxlog_file12,
3314
- L: 140
3360
+ L: 135
3315
3361
  }));
3316
3362
  }
3317
3363
  async createIdentity({ displayName, deviceProfile } = {}) {
3318
3364
  invariant8(!this._identity, "Identity already exists.", {
3319
3365
  F: __dxlog_file12,
3320
- L: 145,
3366
+ L: 140,
3321
3367
  S: this,
3322
3368
  A: [
3323
3369
  "!this._identity",
@@ -3326,7 +3372,7 @@ var IdentityManager = class {
3326
3372
  });
3327
3373
  log10("creating identity...", void 0, {
3328
3374
  F: __dxlog_file12,
3329
- L: 146,
3375
+ L: 141,
3330
3376
  S: this,
3331
3377
  C: (f, a) => f(...a)
3332
3378
  });
@@ -3344,13 +3390,13 @@ var IdentityManager = class {
3344
3390
  const identity = await this._constructIdentity(identityRecord);
3345
3391
  await identity.open(new Context4(void 0, {
3346
3392
  F: __dxlog_file12,
3347
- L: 161
3393
+ L: 156
3348
3394
  }));
3349
3395
  {
3350
3396
  const generator = new CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
3351
3397
  invariant8(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
3352
3398
  F: __dxlog_file12,
3353
- L: 165,
3399
+ L: 160,
3354
3400
  S: this,
3355
3401
  A: [
3356
3402
  "identityRecord.haloSpace.genesisFeedKey",
@@ -3359,7 +3405,7 @@ var IdentityManager = class {
3359
3405
  });
3360
3406
  invariant8(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
3361
3407
  F: __dxlog_file12,
3362
- L: 166,
3408
+ L: 161,
3363
3409
  S: this,
3364
3410
  A: [
3365
3411
  "identityRecord.haloSpace.dataFeedKey",
@@ -3398,7 +3444,7 @@ var IdentityManager = class {
3398
3444
  displayName: this._identity.profileDocument?.displayName
3399
3445
  }, {
3400
3446
  F: __dxlog_file12,
3401
- L: 208,
3447
+ L: 199,
3402
3448
  S: this,
3403
3449
  C: (f, a) => f(...a)
3404
3450
  });
@@ -3409,7 +3455,7 @@ var IdentityManager = class {
3409
3455
  profile: identity.profileDocument
3410
3456
  }, {
3411
3457
  F: __dxlog_file12,
3412
- L: 214,
3458
+ L: 205,
3413
3459
  S: this,
3414
3460
  C: (f, a) => f(...a)
3415
3461
  });
@@ -3439,20 +3485,20 @@ var IdentityManager = class {
3439
3485
  };
3440
3486
  }
3441
3487
  /**
3442
- * Accept an existing identity. Expects its device key to be authorized (now or later).
3488
+ * Prepare an identity object as the first step of acceptIdentity flow.
3443
3489
  */
3444
- async acceptIdentity(params) {
3490
+ async prepareIdentity(params) {
3445
3491
  log10("accepting identity", {
3446
3492
  params
3447
3493
  }, {
3448
3494
  F: __dxlog_file12,
3449
- L: 252,
3495
+ L: 244,
3450
3496
  S: this,
3451
3497
  C: (f, a) => f(...a)
3452
3498
  });
3453
3499
  invariant8(!this._identity, "Identity already exists.", {
3454
3500
  F: __dxlog_file12,
3455
- L: 253,
3501
+ L: 245,
3456
3502
  S: this,
3457
3503
  A: [
3458
3504
  "!this._identity",
@@ -3473,23 +3519,32 @@ var IdentityManager = class {
3473
3519
  const identity = await this._constructIdentity(identityRecord);
3474
3520
  await identity.open(new Context4(void 0, {
3475
3521
  F: __dxlog_file12,
3476
- L: 268
3522
+ L: 259
3477
3523
  }));
3524
+ return {
3525
+ identity,
3526
+ identityRecord
3527
+ };
3528
+ }
3529
+ /**
3530
+ * Accept an existing identity. Expects its device key to be authorized (now or later).
3531
+ */
3532
+ async acceptIdentity(identity, identityRecord, profile) {
3478
3533
  this._identity = identity;
3479
- await this._metadataStore.setIdentityRecord(identityRecord);
3480
3534
  await this._identity.ready();
3535
+ await this._metadataStore.setIdentityRecord(identityRecord);
3481
3536
  log10.trace("dxos.halo.identity", {
3482
- identityKey: identityRecord.identityKey,
3537
+ identityKey: this._identity.identityKey,
3483
3538
  displayName: this._identity.profileDocument?.displayName
3484
3539
  }, {
3485
3540
  F: __dxlog_file12,
3486
- L: 272,
3541
+ L: 273,
3487
3542
  S: this,
3488
3543
  C: (f, a) => f(...a)
3489
3544
  });
3490
3545
  await this.updateDeviceProfile({
3491
3546
  ...this.createDefaultDeviceProfile(),
3492
- ...params.deviceProfile
3547
+ ...profile
3493
3548
  });
3494
3549
  this.stateUpdate.emit();
3495
3550
  log10("accepted identity", {
@@ -3497,11 +3552,10 @@ var IdentityManager = class {
3497
3552
  deviceKey: identity.deviceKey
3498
3553
  }, {
3499
3554
  F: __dxlog_file12,
3500
- L: 282,
3555
+ L: 284,
3501
3556
  S: this,
3502
3557
  C: (f, a) => f(...a)
3503
3558
  });
3504
- return identity;
3505
3559
  }
3506
3560
  /**
3507
3561
  * Update the profile document of an existing identity.
@@ -3509,7 +3563,7 @@ var IdentityManager = class {
3509
3563
  async updateProfile(profile) {
3510
3564
  invariant8(this._identity, "Identity not initialized.", {
3511
3565
  F: __dxlog_file12,
3512
- L: 290,
3566
+ L: 291,
3513
3567
  S: this,
3514
3568
  A: [
3515
3569
  "this._identity",
@@ -3540,7 +3594,7 @@ var IdentityManager = class {
3540
3594
  async updateDeviceProfile(profile) {
3541
3595
  invariant8(this._identity, "Identity not initialized.", {
3542
3596
  F: __dxlog_file12,
3543
- L: 307,
3597
+ L: 308,
3544
3598
  S: this,
3545
3599
  A: [
3546
3600
  "this._identity",
@@ -3576,7 +3630,7 @@ var IdentityManager = class {
3576
3630
  async _constructIdentity(identityRecord) {
3577
3631
  invariant8(!this._identity, void 0, {
3578
3632
  F: __dxlog_file12,
3579
- L: 333,
3633
+ L: 334,
3580
3634
  S: this,
3581
3635
  A: [
3582
3636
  "!this._identity",
@@ -3587,7 +3641,7 @@ var IdentityManager = class {
3587
3641
  identityRecord
3588
3642
  }, {
3589
3643
  F: __dxlog_file12,
3590
- L: 334,
3644
+ L: 335,
3591
3645
  S: this,
3592
3646
  C: (f, a) => f(...a)
3593
3647
  });
@@ -3602,7 +3656,7 @@ var IdentityManager = class {
3602
3656
  });
3603
3657
  invariant8(identityRecord.haloSpace.controlFeedKey, void 0, {
3604
3658
  F: __dxlog_file12,
3605
- L: 347,
3659
+ L: 348,
3606
3660
  S: this,
3607
3661
  A: [
3608
3662
  "identityRecord.haloSpace.controlFeedKey",
@@ -3614,7 +3668,7 @@ var IdentityManager = class {
3614
3668
  });
3615
3669
  invariant8(identityRecord.haloSpace.dataFeedKey, void 0, {
3616
3670
  F: __dxlog_file12,
3617
- L: 351,
3671
+ L: 352,
3618
3672
  S: this,
3619
3673
  A: [
3620
3674
  "identityRecord.haloSpace.dataFeedKey",
@@ -3651,11 +3705,10 @@ var IdentityManager = class {
3651
3705
  identityKey: identityRecord.identityKey
3652
3706
  }, {
3653
3707
  F: __dxlog_file12,
3654
- L: 380,
3708
+ L: 381,
3655
3709
  S: this,
3656
3710
  C: (f, a) => f(...a)
3657
3711
  });
3658
- this._callbacks?.onIdentityConstruction?.(identity);
3659
3712
  if (identityRecord.haloSpace.controlTimeframe) {
3660
3713
  identity.controlPipeline.state.setTargetTimeframe(identityRecord.haloSpace.controlTimeframe);
3661
3714
  }
@@ -3928,7 +3981,7 @@ var DataSpace = class {
3928
3981
  constructor(params) {
3929
3982
  this._ctx = new Context5(void 0, {
3930
3983
  F: __dxlog_file14,
3931
- L: 95
3984
+ L: 96
3932
3985
  });
3933
3986
  this._cache = void 0;
3934
3987
  this._edgeFeedReplicator = void 0;
@@ -3961,7 +4014,8 @@ var DataSpace = class {
3961
4014
  this._notarizationPlugin = new NotarizationPlugin({
3962
4015
  spaceId: this._inner.id,
3963
4016
  edgeClient: params.edgeHttpClient,
3964
- edgeFeatures: params.edgeFeatures
4017
+ edgeFeatures: params.edgeFeatures,
4018
+ activeEdgePollingInterval: params.activeEdgeNotarizationPollingInterval
3965
4019
  });
3966
4020
  this.authVerifier = new TrustedKeySetAuthVerifier({
3967
4021
  trustedKeysProvider: () => new ComplexSet3(PublicKey8.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => member.role !== SpaceMember5.Role.REMOVED).map((member) => member.key)),
@@ -3980,7 +4034,7 @@ var DataSpace = class {
3980
4034
  state: SpaceState4[this._state]
3981
4035
  }, {
3982
4036
  F: __dxlog_file14,
3983
- L: 170,
4037
+ L: 172,
3984
4038
  S: this,
3985
4039
  C: (f, a) => f(...a)
3986
4040
  });
@@ -4039,15 +4093,16 @@ var DataSpace = class {
4039
4093
  }
4040
4094
  await this._inner.open(new Context5(void 0, {
4041
4095
  F: __dxlog_file14,
4042
- L: 244
4096
+ L: 246
4043
4097
  }));
4098
+ await this._inner.startProtocol();
4044
4099
  await this._edgeFeedReplicator?.open();
4045
4100
  this._state = SpaceState4.SPACE_CONTROL_ONLY;
4046
4101
  log12("new state", {
4047
4102
  state: SpaceState4[this._state]
4048
4103
  }, {
4049
4104
  F: __dxlog_file14,
4050
- L: 249,
4105
+ L: 252,
4051
4106
  S: this,
4052
4107
  C: (f, a) => f(...a)
4053
4108
  });
@@ -4067,14 +4122,14 @@ var DataSpace = class {
4067
4122
  state: SpaceState4[this._state]
4068
4123
  }, {
4069
4124
  F: __dxlog_file14,
4070
- L: 268,
4125
+ L: 271,
4071
4126
  S: this,
4072
4127
  C: (f, a) => f(...a)
4073
4128
  });
4074
4129
  await this._ctx.dispose();
4075
4130
  this._ctx = new Context5(void 0, {
4076
4131
  F: __dxlog_file14,
4077
- L: 270
4132
+ L: 273
4078
4133
  });
4079
4134
  if (this._edgeFeedReplicator) {
4080
4135
  this.inner.protocol.feedAdded.remove(this._onFeedAdded);
@@ -4107,7 +4162,7 @@ var DataSpace = class {
4107
4162
  if (err instanceof CancelledError || err instanceof ContextDisposedError) {
4108
4163
  log12("data pipeline initialization cancelled", err, {
4109
4164
  F: __dxlog_file14,
4110
- L: 308,
4165
+ L: 311,
4111
4166
  S: this,
4112
4167
  C: (f, a) => f(...a)
4113
4168
  });
@@ -4115,7 +4170,7 @@ var DataSpace = class {
4115
4170
  }
4116
4171
  log12.error("Error initializing data pipeline", err, {
4117
4172
  F: __dxlog_file14,
4118
- L: 312,
4173
+ L: 315,
4119
4174
  S: this,
4120
4175
  C: (f, a) => f(...a)
4121
4176
  });
@@ -4124,7 +4179,7 @@ var DataSpace = class {
4124
4179
  state: SpaceState4[this._state]
4125
4180
  }, {
4126
4181
  F: __dxlog_file14,
4127
- L: 314,
4182
+ L: 317,
4128
4183
  S: this,
4129
4184
  C: (f, a) => f(...a)
4130
4185
  });
@@ -4144,13 +4199,13 @@ var DataSpace = class {
4144
4199
  state: SpaceState4[this._state]
4145
4200
  }, {
4146
4201
  F: __dxlog_file14,
4147
- L: 330,
4202
+ L: 333,
4148
4203
  S: this,
4149
4204
  C: (f, a) => f(...a)
4150
4205
  });
4151
4206
  log12("initializing control pipeline", void 0, {
4152
4207
  F: __dxlog_file14,
4153
- L: 332,
4208
+ L: 335,
4154
4209
  S: this,
4155
4210
  C: (f, a) => f(...a)
4156
4211
  });
@@ -4159,21 +4214,21 @@ var DataSpace = class {
4159
4214
  const ready = this.stateUpdate.waitForCondition(() => this._state === SpaceState4.SPACE_READY);
4160
4215
  log12("initializing automerge root", void 0, {
4161
4216
  F: __dxlog_file14,
4162
- L: 340,
4217
+ L: 343,
4163
4218
  S: this,
4164
4219
  C: (f, a) => f(...a)
4165
4220
  });
4166
4221
  this._automergeSpaceState.startProcessingRootDocs();
4167
4222
  log12("waiting for space to be ready", void 0, {
4168
4223
  F: __dxlog_file14,
4169
- L: 344,
4224
+ L: 347,
4170
4225
  S: this,
4171
4226
  C: (f, a) => f(...a)
4172
4227
  });
4173
4228
  await ready;
4174
4229
  log12("space is ready", void 0, {
4175
4230
  F: __dxlog_file14,
4176
- L: 346,
4231
+ L: 349,
4177
4232
  S: this,
4178
4233
  C: (f, a) => f(...a)
4179
4234
  });
@@ -4185,7 +4240,7 @@ var DataSpace = class {
4185
4240
  state: SpaceState4[this._state]
4186
4241
  }, {
4187
4242
  F: __dxlog_file14,
4188
- L: 353,
4243
+ L: 356,
4189
4244
  S: this,
4190
4245
  C: (f, a) => f(...a)
4191
4246
  });
@@ -4202,7 +4257,7 @@ var DataSpace = class {
4202
4257
  await this._createWritableFeeds();
4203
4258
  log12("writable feeds created", void 0, {
4204
4259
  F: __dxlog_file14,
4205
- L: 370,
4260
+ L: 373,
4206
4261
  S: this,
4207
4262
  C: (f, a) => f(...a)
4208
4263
  });
@@ -4256,7 +4311,7 @@ var DataSpace = class {
4256
4311
  count: credentials.length
4257
4312
  }, {
4258
4313
  F: __dxlog_file14,
4259
- L: 428,
4314
+ L: 431,
4260
4315
  S: this,
4261
4316
  C: (f, a) => f(...a)
4262
4317
  });
@@ -4267,14 +4322,14 @@ var DataSpace = class {
4267
4322
  });
4268
4323
  log12("credentials notarized", void 0, {
4269
4324
  F: __dxlog_file14,
4270
- L: 432,
4325
+ L: 435,
4271
4326
  S: this,
4272
4327
  C: (f, a) => f(...a)
4273
4328
  });
4274
4329
  } catch (err) {
4275
4330
  log12.error("error notarizing credentials for feed admission", err, {
4276
4331
  F: __dxlog_file14,
4277
- L: 434,
4332
+ L: 437,
4278
4333
  S: this,
4279
4334
  C: (f, a) => f(...a)
4280
4335
  });
@@ -4289,7 +4344,7 @@ var DataSpace = class {
4289
4344
  rootUrl
4290
4345
  }, {
4291
4346
  F: __dxlog_file14,
4292
- L: 444,
4347
+ L: 447,
4293
4348
  S: this,
4294
4349
  C: (f, a) => f(...a)
4295
4350
  });
@@ -4341,7 +4396,7 @@ var DataSpace = class {
4341
4396
  err
4342
4397
  }, {
4343
4398
  F: __dxlog_file14,
4344
- L: 487,
4399
+ L: 490,
4345
4400
  S: this,
4346
4401
  C: (f, a) => f(...a)
4347
4402
  });
@@ -4431,7 +4486,7 @@ var DataSpace = class {
4431
4486
  state: SpaceState4[this._state]
4432
4487
  }, {
4433
4488
  F: __dxlog_file14,
4434
- L: 569,
4489
+ L: 572,
4435
4490
  S: this,
4436
4491
  C: (f, a) => f(...a)
4437
4492
  });
@@ -4491,6 +4546,7 @@ DataSpace = _ts_decorate6([
4491
4546
  ], DataSpace);
4492
4547
 
4493
4548
  // packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts
4549
+ import { getCredentialAssertion as getCredentialAssertion4 } from "@dxos/credentials";
4494
4550
  import { invariant as invariant10 } from "@dxos/invariant";
4495
4551
  import { AlreadyJoinedError as AlreadyJoinedError2 } from "@dxos/protocols";
4496
4552
  import { Invitation as Invitation2 } from "@dxos/protocols/proto/dxos/client/services";
@@ -4521,7 +4577,7 @@ var DeviceInvitationProtocol = class {
4521
4577
  async admit(_, request) {
4522
4578
  invariant10(request.device, void 0, {
4523
4579
  F: __dxlog_file15,
4524
- L: 50,
4580
+ L: 51,
4525
4581
  S: this,
4526
4582
  A: [
4527
4583
  "request.device",
@@ -4529,13 +4585,23 @@ var DeviceInvitationProtocol = class {
4529
4585
  ]
4530
4586
  });
4531
4587
  const identity = this._getIdentity();
4532
- await identity.admitDevice(request.device);
4588
+ const credential = await identity.admitDevice(request.device);
4589
+ invariant10(getCredentialAssertion4(credential)["@type"] === "dxos.halo.credentials.AuthorizedDevice", void 0, {
4590
+ F: __dxlog_file15,
4591
+ L: 54,
4592
+ S: this,
4593
+ A: [
4594
+ "getCredentialAssertion(credential)['@type'] === 'dxos.halo.credentials.AuthorizedDevice'",
4595
+ ""
4596
+ ]
4597
+ });
4533
4598
  return {
4534
4599
  device: {
4535
4600
  identityKey: identity.identityKey,
4536
4601
  haloSpaceKey: identity.haloSpaceKey,
4537
4602
  genesisFeedKey: identity.haloGenesisFeedKey,
4538
- controlTimeframe: identity.controlPipeline.state.timeframe
4603
+ controlTimeframe: identity.controlPipeline.state.timeframe,
4604
+ credential
4539
4605
  }
4540
4606
  };
4541
4607
  }
@@ -4567,7 +4633,7 @@ var DeviceInvitationProtocol = class {
4567
4633
  async accept(response, request) {
4568
4634
  invariant10(response.device, void 0, {
4569
4635
  F: __dxlog_file15,
4570
- L: 95,
4636
+ L: 98,
4571
4637
  S: this,
4572
4638
  A: [
4573
4639
  "response.device",
@@ -4577,7 +4643,7 @@ var DeviceInvitationProtocol = class {
4577
4643
  const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
4578
4644
  invariant10(request.device, void 0, {
4579
4645
  F: __dxlog_file15,
4580
- L: 98,
4646
+ L: 101,
4581
4647
  S: this,
4582
4648
  A: [
4583
4649
  "request.device",
@@ -4593,7 +4659,8 @@ var DeviceInvitationProtocol = class {
4593
4659
  controlFeedKey,
4594
4660
  dataFeedKey,
4595
4661
  controlTimeframe,
4596
- deviceProfile: profile
4662
+ deviceProfile: profile,
4663
+ authorizedDeviceCredential: response.device.credential
4597
4664
  });
4598
4665
  return {
4599
4666
  identityKey
@@ -4605,7 +4672,7 @@ var DeviceInvitationProtocol = class {
4605
4672
  import { scheduleTask as scheduleTask7, TimeoutError as TimeoutError2 } from "@dxos/async";
4606
4673
  import { INVITATION_TIMEOUT } from "@dxos/client-protocol";
4607
4674
  import { ContextDisposedError as ContextDisposedError3 } from "@dxos/context";
4608
- import { createKeyPair, sign } from "@dxos/crypto";
4675
+ import { createKeyPair, sign as sign2 } from "@dxos/crypto";
4609
4676
  import { invariant as invariant15 } from "@dxos/invariant";
4610
4677
  import { PublicKey as PublicKey11 } from "@dxos/keys";
4611
4678
  import { log as log18 } from "@dxos/log";
@@ -4619,7 +4686,7 @@ import { ComplexSet as ComplexSet5 } from "@dxos/util";
4619
4686
 
4620
4687
  // packages/sdk/client-services/src/packlets/invitations/edge-invitation-handler.ts
4621
4688
  import { scheduleMicroTask as scheduleMicroTask3, scheduleTask as scheduleTask5 } from "@dxos/async";
4622
- import { ed25519Signature } from "@dxos/crypto";
4689
+ import { sign } from "@dxos/crypto";
4623
4690
  import { invariant as invariant11 } from "@dxos/invariant";
4624
4691
  import { SpaceId as SpaceId2 } from "@dxos/keys";
4625
4692
  import { log as log13 } from "@dxos/log";
@@ -4776,15 +4843,16 @@ var EdgeInvitationHandler = class {
4776
4843
  return await this._client.joinSpaceByInvitation(spaceId, request);
4777
4844
  } catch (error) {
4778
4845
  if (error instanceof EdgeAuthChallengeError) {
4779
- guardedState.set(this, Invitation4.State.AUTHENTICATING);
4780
4846
  const publicKey = guardedState.current.guestKeypair?.publicKey;
4781
4847
  const privateKey = guardedState.current.guestKeypair?.privateKey;
4782
4848
  if (!privateKey || !publicKey) {
4783
4849
  throw error;
4784
4850
  }
4785
- const signature = await ed25519Signature(privateKey, Buffer.from(error.challenge, "base64"));
4786
- request.signature = Buffer.from(signature).toString("base64");
4787
- return this._client.joinSpaceByInvitation(spaceId, request);
4851
+ const signature = sign(Buffer.from(error.challenge, "base64"), privateKey);
4852
+ return this._client.joinSpaceByInvitation(spaceId, {
4853
+ ...request,
4854
+ signature: Buffer.from(signature).toString("base64")
4855
+ });
4788
4856
  } else {
4789
4857
  throw error;
4790
4858
  }
@@ -5859,7 +5927,7 @@ var InvitationsHandler = class {
5859
5927
  const edgeInvitationHandler = new EdgeInvitationHandler(this._connectionParams?.edgeInvitations, this._edgeClient, {
5860
5928
  onInvitationSuccess: async (admissionResponse, admissionRequest) => {
5861
5929
  const result = await protocol.accept(admissionResponse, admissionRequest);
5862
- log18("admitted by edge", {
5930
+ log18.info("admitted by edge", {
5863
5931
  ...protocol.toJSON()
5864
5932
  }, {
5865
5933
  F: __dxlog_file21,
@@ -5976,8 +6044,7 @@ var InvitationsHandler = class {
5976
6044
  S: this,
5977
6045
  C: (f, a) => f(...a)
5978
6046
  });
5979
- setState(Invitation7.State.AUTHENTICATING);
5980
- const signature = sign(Buffer.from(introductionResponse.challenge), invitation.guestKeypair.privateKey);
6047
+ const signature = sign2(Buffer.from(introductionResponse.challenge), invitation.guestKeypair.privateKey);
5981
6048
  const response = await extension.rpc.InvitationHostService.authenticate({
5982
6049
  signedChallenge: signature
5983
6050
  });
@@ -6092,7 +6159,7 @@ var InvitationsServiceImpl = class {
6092
6159
  };
6093
6160
 
6094
6161
  // packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts
6095
- import { createCancelDelegatedSpaceInvitationCredential, createDelegatedSpaceInvitationCredential, getCredentialAssertion as getCredentialAssertion4 } from "@dxos/credentials";
6162
+ import { createCancelDelegatedSpaceInvitationCredential, createDelegatedSpaceInvitationCredential, getCredentialAssertion as getCredentialAssertion5 } from "@dxos/credentials";
6096
6163
  import { writeMessages as writeMessages4 } from "@dxos/feed-store";
6097
6164
  import { invariant as invariant16 } from "@dxos/invariant";
6098
6165
  import { log as log19 } from "@dxos/log";
@@ -6337,7 +6404,7 @@ var SpaceInvitationProtocol = class {
6337
6404
  ]
6338
6405
  });
6339
6406
  const { credential, controlTimeframe, dataTimeframe } = response.space;
6340
- const assertion = getCredentialAssertion4(credential);
6407
+ const assertion = getCredentialAssertion5(credential);
6341
6408
  invariant16(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
6342
6409
  F: __dxlog_file22,
6343
6410
  L: 182,
@@ -6875,24 +6942,282 @@ ClientRpcServer = _ts_decorate8([
6875
6942
  trace8.resource()
6876
6943
  ], ClientRpcServer);
6877
6944
 
6945
+ // packages/sdk/client-services/src/packlets/agents/edge-agent-manager.ts
6946
+ import { DeferredTask as DeferredTask2, Event as Event9, scheduleTask as scheduleTask8, synchronized as synchronized3 } from "@dxos/async";
6947
+ import { Resource as Resource6 } from "@dxos/context";
6948
+ import { invariant as invariant19 } from "@dxos/invariant";
6949
+ import { PublicKey as PublicKey13 } from "@dxos/keys";
6950
+ import { log as log22 } from "@dxos/log";
6951
+ import { EdgeAgentStatus, EdgeCallFailedError as EdgeCallFailedError3 } from "@dxos/protocols";
6952
+ import { SpaceState as SpaceState5 } from "@dxos/protocols/proto/dxos/client/services";
6953
+ function _ts_decorate9(decorators, target, key, desc) {
6954
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6955
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6956
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6957
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6958
+ }
6959
+ var __dxlog_file25 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/agents/edge-agent-manager.ts";
6960
+ var AGENT_STATUS_QUERY_RETRY_INTERVAL = 5e3;
6961
+ var AGENT_STATUS_QUERY_RETRY_JITTER = 1e3;
6962
+ var EdgeAgentManager = class extends Resource6 {
6963
+ constructor(_edgeFeatures, _edgeHttpClient, _dataSpaceManager, _identity) {
6964
+ super();
6965
+ this._edgeFeatures = _edgeFeatures;
6966
+ this._edgeHttpClient = _edgeHttpClient;
6967
+ this._dataSpaceManager = _dataSpaceManager;
6968
+ this._identity = _identity;
6969
+ this.agentStatusChanged = new Event9();
6970
+ this._lastKnownDeviceCount = 0;
6971
+ }
6972
+ get agentStatus() {
6973
+ return this._agentStatus;
6974
+ }
6975
+ get agentExists() {
6976
+ return this._agentStatus && this._agentStatus !== EdgeAgentStatus.NOT_FOUND;
6977
+ }
6978
+ async createAgent() {
6979
+ invariant19(this.isOpen, void 0, {
6980
+ F: __dxlog_file25,
6981
+ L: 52,
6982
+ S: this,
6983
+ A: [
6984
+ "this.isOpen",
6985
+ ""
6986
+ ]
6987
+ });
6988
+ invariant19(this._edgeHttpClient, void 0, {
6989
+ F: __dxlog_file25,
6990
+ L: 53,
6991
+ S: this,
6992
+ A: [
6993
+ "this._edgeHttpClient",
6994
+ ""
6995
+ ]
6996
+ });
6997
+ invariant19(this._edgeFeatures?.agents, void 0, {
6998
+ F: __dxlog_file25,
6999
+ L: 54,
7000
+ S: this,
7001
+ A: [
7002
+ "this._edgeFeatures?.agents",
7003
+ ""
7004
+ ]
7005
+ });
7006
+ const response = await this._edgeHttpClient.createAgent({
7007
+ identityKey: this._identity.identityKey.toHex(),
7008
+ haloSpaceId: this._identity.haloSpaceId,
7009
+ haloSpaceKey: this._identity.haloSpaceKey.toHex()
7010
+ });
7011
+ const deviceKey = PublicKey13.fromHex(response.deviceKey);
7012
+ await this._identity.admitDevice({
7013
+ deviceKey,
7014
+ controlFeedKey: PublicKey13.fromHex(response.feedKey),
7015
+ // TODO: agents don't have data feed, should be removed
7016
+ dataFeedKey: PublicKey13.random()
7017
+ });
7018
+ log22("agent created", response, {
7019
+ F: __dxlog_file25,
7020
+ L: 71,
7021
+ S: this,
7022
+ C: (f, a) => f(...a)
7023
+ });
7024
+ this._updateStatus(EdgeAgentStatus.ACTIVE, deviceKey);
7025
+ }
7026
+ async _open() {
7027
+ const isEnabled = this._edgeHttpClient && this._edgeFeatures?.agents;
7028
+ log22("edge agent manager open", {
7029
+ isEnabled
7030
+ }, {
7031
+ F: __dxlog_file25,
7032
+ L: 79,
7033
+ S: this,
7034
+ C: (f, a) => f(...a)
7035
+ });
7036
+ if (!isEnabled) {
7037
+ return;
7038
+ }
7039
+ this._lastKnownDeviceCount = this._identity.authorizedDeviceKeys.size;
7040
+ this._fetchAgentStatusTask = new DeferredTask2(this._ctx, async () => {
7041
+ await this._fetchAgentStatus();
7042
+ });
7043
+ this._fetchAgentStatusTask.schedule();
7044
+ this._dataSpaceManager.updated.on(this._ctx, () => {
7045
+ if (this._agentDeviceKey) {
7046
+ this._ensureAgentIsInSpaces(this._agentDeviceKey);
7047
+ }
7048
+ });
7049
+ this._identity.stateUpdate.on(this._ctx, () => {
7050
+ const maybeAgentWasCreated = this._identity.authorizedDeviceKeys.size > this._lastKnownDeviceCount;
7051
+ if (this.agentExists || !maybeAgentWasCreated) {
7052
+ return;
7053
+ }
7054
+ this._lastKnownDeviceCount = this._identity.authorizedDeviceKeys.size;
7055
+ this._fetchAgentStatusTask?.schedule();
7056
+ });
7057
+ }
7058
+ async _close() {
7059
+ this._fetchAgentStatusTask = void 0;
7060
+ this._lastKnownDeviceCount = 0;
7061
+ }
7062
+ async _fetchAgentStatus() {
7063
+ invariant19(this._edgeHttpClient, void 0, {
7064
+ F: __dxlog_file25,
7065
+ L: 113,
7066
+ S: this,
7067
+ A: [
7068
+ "this._edgeHttpClient",
7069
+ ""
7070
+ ]
7071
+ });
7072
+ try {
7073
+ log22("fetching agent status", void 0, {
7074
+ F: __dxlog_file25,
7075
+ L: 115,
7076
+ S: this,
7077
+ C: (f, a) => f(...a)
7078
+ });
7079
+ const { agent } = await this._edgeHttpClient.getAgentStatus({
7080
+ ownerIdentityKey: this._identity.identityKey
7081
+ });
7082
+ const wasAgentCreatedDuringQuery = this._agentStatus === EdgeAgentStatus.ACTIVE;
7083
+ if (!wasAgentCreatedDuringQuery) {
7084
+ const deviceKey = agent.deviceKey ? PublicKey13.fromHex(agent.deviceKey) : void 0;
7085
+ this._updateStatus(agent.status, deviceKey);
7086
+ }
7087
+ } catch (err) {
7088
+ if (err instanceof EdgeCallFailedError3) {
7089
+ if (!err.isRetryable) {
7090
+ log22.warn("non retryable error on agent status fetch attempt", {
7091
+ err
7092
+ }, {
7093
+ F: __dxlog_file25,
7094
+ L: 125,
7095
+ S: this,
7096
+ C: (f, a) => f(...a)
7097
+ });
7098
+ return;
7099
+ }
7100
+ }
7101
+ const retryAfterMs = AGENT_STATUS_QUERY_RETRY_INTERVAL + Math.random() * AGENT_STATUS_QUERY_RETRY_JITTER;
7102
+ log22.info("agent status fetching failed", {
7103
+ err,
7104
+ retryAfterMs
7105
+ }, {
7106
+ F: __dxlog_file25,
7107
+ L: 130,
7108
+ S: this,
7109
+ C: (f, a) => f(...a)
7110
+ });
7111
+ scheduleTask8(this._ctx, () => this._fetchAgentStatusTask?.schedule(), retryAfterMs);
7112
+ }
7113
+ }
7114
+ /**
7115
+ * We don't want notarization plugin to always actively poll edge looking for credentials to notarize,
7116
+ * because most of the time we'll be getting an empty response.
7117
+ * Instead, we stay in active polling mode while there are spaces where we don't see our agent's feed.
7118
+ */
7119
+ _ensureAgentIsInSpaces(agentDeviceKey) {
7120
+ for (const space of this._dataSpaceManager.spaces.values()) {
7121
+ if ([
7122
+ SpaceState5.SPACE_INACTIVE,
7123
+ SpaceState5.SPACE_CLOSED
7124
+ ].includes(space.state)) {
7125
+ continue;
7126
+ }
7127
+ const agentFeedNeedsNotarization = !space.inner.spaceState.feeds.values().some((feed) => feed.assertion.deviceKey.equals(agentDeviceKey));
7128
+ space.notarizationPlugin.setActiveEdgePollingEnabled(agentFeedNeedsNotarization);
7129
+ log22.info("set active edge polling", {
7130
+ enabled: agentFeedNeedsNotarization,
7131
+ spaceId: space.id
7132
+ }, {
7133
+ F: __dxlog_file25,
7134
+ L: 150,
7135
+ S: this,
7136
+ C: (f, a) => f(...a)
7137
+ });
7138
+ }
7139
+ }
7140
+ _updateStatus(status, deviceKey) {
7141
+ this._agentStatus = status;
7142
+ this._agentDeviceKey = deviceKey;
7143
+ this.agentStatusChanged.emit(status);
7144
+ if (deviceKey) {
7145
+ this._ensureAgentIsInSpaces(deviceKey);
7146
+ }
7147
+ log22.info("agent status update", {
7148
+ status
7149
+ }, {
7150
+ F: __dxlog_file25,
7151
+ L: 161,
7152
+ S: this,
7153
+ C: (f, a) => f(...a)
7154
+ });
7155
+ }
7156
+ };
7157
+ _ts_decorate9([
7158
+ synchronized3
7159
+ ], EdgeAgentManager.prototype, "createAgent", null);
7160
+
7161
+ // packages/sdk/client-services/src/packlets/agents/edge-agent-service.ts
7162
+ import { Stream as Stream11 } from "@dxos/codec-protobuf";
7163
+ import { EdgeAgentStatus as EdgeAgentStatus2 } from "@dxos/protocols";
7164
+ import { QueryAgentStatusResponse } from "@dxos/protocols/proto/dxos/client/services";
7165
+ var EdgeAgentServiceImpl = class {
7166
+ constructor(_agentManagerProvider) {
7167
+ this._agentManagerProvider = _agentManagerProvider;
7168
+ }
7169
+ async createAgent() {
7170
+ return (await this._agentManagerProvider()).createAgent();
7171
+ }
7172
+ queryAgentStatus() {
7173
+ return new Stream11(({ ctx, next }) => {
7174
+ next({
7175
+ status: QueryAgentStatusResponse.AgentStatus.UNKNOWN
7176
+ });
7177
+ void this._agentManagerProvider().then((agentManager) => {
7178
+ next({
7179
+ status: mapStatus(agentManager.agentStatus)
7180
+ });
7181
+ agentManager.agentStatusChanged.on(ctx, (newStatus) => {
7182
+ next({
7183
+ status: mapStatus(newStatus)
7184
+ });
7185
+ });
7186
+ });
7187
+ });
7188
+ }
7189
+ };
7190
+ var mapStatus = (agentStatus) => {
7191
+ switch (agentStatus) {
7192
+ case EdgeAgentStatus2.ACTIVE:
7193
+ return QueryAgentStatusResponse.AgentStatus.ACTIVE;
7194
+ case EdgeAgentStatus2.INACTIVE:
7195
+ return QueryAgentStatusResponse.AgentStatus.INACTIVE;
7196
+ case EdgeAgentStatus2.NOT_FOUND:
7197
+ return QueryAgentStatusResponse.AgentStatus.NOT_FOUND;
7198
+ case void 0:
7199
+ return QueryAgentStatusResponse.AgentStatus.UNKNOWN;
7200
+ }
7201
+ };
7202
+
6878
7203
  // packages/sdk/client-services/src/packlets/services/service-context.ts
6879
- import { Mutex as Mutex4, scheduleMicroTask as scheduleMicroTask4, Trigger as Trigger7 } from "@dxos/async";
6880
- import { Context as Context9, Resource as Resource6 } from "@dxos/context";
6881
- import { getCredentialAssertion as getCredentialAssertion5 } from "@dxos/credentials";
7204
+ import { Mutex as Mutex4, Trigger as Trigger7 } from "@dxos/async";
7205
+ import { Context as Context9, Resource as Resource7 } from "@dxos/context";
7206
+ import { getCredentialAssertion as getCredentialAssertion6 } from "@dxos/credentials";
6882
7207
  import { failUndefined as failUndefined2, warnAfterTimeout as warnAfterTimeout2 } from "@dxos/debug";
6883
7208
  import { EchoEdgeReplicator, EchoHost, MeshEchoReplicator, MetadataStore, SpaceManager, valueEncoding } from "@dxos/echo-pipeline";
6884
7209
  import { createChainEdgeIdentity, createEphemeralEdgeIdentity } from "@dxos/edge-client";
6885
7210
  import { FeedFactory, FeedStore } from "@dxos/feed-store";
6886
- import { invariant as invariant19 } from "@dxos/invariant";
7211
+ import { invariant as invariant20 } from "@dxos/invariant";
6887
7212
  import { Keyring } from "@dxos/keyring";
6888
- import { PublicKey as PublicKey13 } from "@dxos/keys";
6889
- import { log as log22 } from "@dxos/log";
7213
+ import { PublicKey as PublicKey14 } from "@dxos/keys";
7214
+ import { log as log23 } from "@dxos/log";
6890
7215
  import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace9 } from "@dxos/protocols";
6891
7216
  import { Invitation as Invitation10 } from "@dxos/protocols/proto/dxos/client/services";
6892
7217
  import { BlobStore } from "@dxos/teleport-extension-object-sync";
6893
7218
  import { trace as Trace3 } from "@dxos/tracing";
6894
7219
  import { safeInstanceof } from "@dxos/util";
6895
- function _ts_decorate9(decorators, target, key, desc) {
7220
+ function _ts_decorate10(decorators, target, key, desc) {
6896
7221
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6897
7222
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
6898
7223
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
@@ -6960,8 +7285,8 @@ function _using_ctx3() {
6960
7285
  }
6961
7286
  };
6962
7287
  }
6963
- var __dxlog_file25 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
6964
- var ServiceContext = class extends Resource6 {
7288
+ var __dxlog_file26 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
7289
+ var ServiceContext = class extends Resource7 {
6965
7290
  constructor(storage, level, networkManager, signalManager, _edgeConnection, _edgeHttpClient, _runtimeParams, _edgeFeatures) {
6966
7291
  super();
6967
7292
  this.storage = storage;
@@ -6977,7 +7302,7 @@ var ServiceContext = class extends Resource6 {
6977
7302
  this._meshReplicator = void 0;
6978
7303
  this._echoEdgeReplicator = void 0;
6979
7304
  this._handlerFactories = /* @__PURE__ */ new Map();
6980
- this._instanceId = PublicKey13.random().toHex();
7305
+ this._instanceId = PublicKey14.random().toHex();
6981
7306
  this.metadataStore = new MetadataStore(storage.createDirectory("metadata"));
6982
7307
  this.blobStore = new BlobStore(storage.createDirectory("blobs"));
6983
7308
  this.keyring = new Keyring(storage.createDirectory("keyring"));
@@ -7006,50 +7331,7 @@ var ServiceContext = class extends Resource6 {
7006
7331
  devicePresenceOfflineTimeout: this._runtimeParams?.devicePresenceOfflineTimeout,
7007
7332
  devicePresenceAnnounceInterval: this._runtimeParams?.devicePresenceAnnounceInterval,
7008
7333
  edgeConnection: this._edgeConnection,
7009
- edgeFeatures: this._edgeFeatures,
7010
- callbacks: {
7011
- onIdentityConstruction: (identity) => {
7012
- if (this._edgeConnection) {
7013
- scheduleMicroTask4(this._ctx, async () => {
7014
- try {
7015
- var _usingCtx = _using_ctx3();
7016
- const _ = _usingCtx.u(await this._edgeIdentityUpdateMutex.acquire());
7017
- log22.info("Setting identity on edge connection", {
7018
- identity: identity.identityKey.toHex(),
7019
- oldIdentity: this._edgeConnection.identityKey,
7020
- swarms: this.networkManager.topics
7021
- }, {
7022
- F: __dxlog_file25,
7023
- L: 147,
7024
- S: this,
7025
- C: (f, a) => f(...a)
7026
- });
7027
- await warnAfterTimeout2(1e4, "Waiting for identity to be ready for edge connection", async () => {
7028
- await identity.ready();
7029
- });
7030
- invariant19(identity.deviceCredentialChain, void 0, {
7031
- F: __dxlog_file25,
7032
- L: 157,
7033
- S: this,
7034
- A: [
7035
- "identity.deviceCredentialChain",
7036
- ""
7037
- ]
7038
- });
7039
- this._edgeConnection.setIdentity(await createChainEdgeIdentity(identity.signer, identity.identityKey, identity.deviceKey, identity.deviceCredentialChain, []));
7040
- this.networkManager.setPeerInfo({
7041
- identityKey: identity.identityKey.toHex(),
7042
- peerKey: identity.deviceKey.toHex()
7043
- });
7044
- } catch (_) {
7045
- _usingCtx.e = _;
7046
- } finally {
7047
- _usingCtx.d();
7048
- }
7049
- });
7050
- }
7051
- }
7052
- }
7334
+ edgeFeatures: this._edgeFeatures
7053
7335
  });
7054
7336
  this.echoHost = new EchoHost({
7055
7337
  kv: this.level
@@ -7069,24 +7351,23 @@ var ServiceContext = class extends Resource6 {
7069
7351
  }
7070
7352
  async _open(ctx) {
7071
7353
  await this._checkStorageVersion();
7072
- log22("opening...", void 0, {
7073
- F: __dxlog_file25,
7074
- L: 218,
7354
+ log23("opening...", void 0, {
7355
+ F: __dxlog_file26,
7356
+ L: 186,
7075
7357
  S: this,
7076
7358
  C: (f, a) => f(...a)
7077
7359
  });
7078
- log22.trace("dxos.sdk.service-context.open", trace9.begin({
7360
+ log23.trace("dxos.sdk.service-context.open", trace9.begin({
7079
7361
  id: this._instanceId
7080
7362
  }), {
7081
- F: __dxlog_file25,
7082
- L: 219,
7363
+ F: __dxlog_file26,
7364
+ L: 187,
7083
7365
  S: this,
7084
7366
  C: (f, a) => f(...a)
7085
7367
  });
7086
- if (this._edgeConnection) {
7087
- this._edgeConnection.setIdentity(await createEphemeralEdgeIdentity());
7088
- await this._edgeConnection.open();
7089
- }
7368
+ await this.identityManager.open(ctx);
7369
+ await this._setNetworkIdentity();
7370
+ await this._edgeConnection?.open();
7090
7371
  await this.signalManager.open();
7091
7372
  await this.networkManager.open();
7092
7373
  await this.echoHost.open(ctx);
@@ -7098,38 +7379,38 @@ var ServiceContext = class extends Resource6 {
7098
7379
  }
7099
7380
  await this.metadataStore.load();
7100
7381
  await this.spaceManager.open();
7101
- await this.identityManager.open(ctx);
7102
7382
  if (this.identityManager.identity) {
7383
+ await this.identityManager.identity.joinNetwork();
7103
7384
  await this._initialize(ctx);
7104
7385
  }
7105
7386
  const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
7106
- log22("loaded persistent invitations", {
7387
+ log23("loaded persistent invitations", {
7107
7388
  count: loadedInvitations.invitations?.length
7108
7389
  }, {
7109
- F: __dxlog_file25,
7110
- L: 246,
7390
+ F: __dxlog_file26,
7391
+ L: 215,
7111
7392
  S: this,
7112
7393
  C: (f, a) => f(...a)
7113
7394
  });
7114
- log22.trace("dxos.sdk.service-context.open", trace9.end({
7395
+ log23.trace("dxos.sdk.service-context.open", trace9.end({
7115
7396
  id: this._instanceId
7116
7397
  }), {
7117
- F: __dxlog_file25,
7118
- L: 248,
7398
+ F: __dxlog_file26,
7399
+ L: 217,
7119
7400
  S: this,
7120
7401
  C: (f, a) => f(...a)
7121
7402
  });
7122
- log22("opened", void 0, {
7123
- F: __dxlog_file25,
7124
- L: 249,
7403
+ log23("opened", void 0, {
7404
+ F: __dxlog_file26,
7405
+ L: 218,
7125
7406
  S: this,
7126
7407
  C: (f, a) => f(...a)
7127
7408
  });
7128
7409
  }
7129
7410
  async _close(ctx) {
7130
- log22("closing...", void 0, {
7131
- F: __dxlog_file25,
7132
- L: 253,
7411
+ log23("closing...", void 0, {
7412
+ F: __dxlog_file26,
7413
+ L: 222,
7133
7414
  S: this,
7134
7415
  C: (f, a) => f(...a)
7135
7416
  });
@@ -7137,6 +7418,7 @@ var ServiceContext = class extends Resource6 {
7137
7418
  await this.identityManager.identity.space.spaceState.removeCredentialProcessor(this._deviceSpaceSync);
7138
7419
  }
7139
7420
  await this.dataSpaceManager?.close();
7421
+ await this.edgeAgentManager?.close();
7140
7422
  await this.identityManager.close();
7141
7423
  await this.spaceManager.close();
7142
7424
  await this.feedStore.close();
@@ -7145,26 +7427,28 @@ var ServiceContext = class extends Resource6 {
7145
7427
  await this.networkManager.close();
7146
7428
  await this.signalManager.close();
7147
7429
  await this._edgeConnection?.close();
7148
- log22("closed", void 0, {
7149
- F: __dxlog_file25,
7150
- L: 268,
7430
+ log23("closed", void 0, {
7431
+ F: __dxlog_file26,
7432
+ L: 238,
7151
7433
  S: this,
7152
7434
  C: (f, a) => f(...a)
7153
7435
  });
7154
7436
  }
7155
7437
  async createIdentity(params = {}) {
7156
7438
  const identity = await this.identityManager.createIdentity(params);
7439
+ await this._setNetworkIdentity();
7440
+ await identity.joinNetwork();
7157
7441
  await this._initialize(new Context9(void 0, {
7158
- F: __dxlog_file25,
7159
- L: 273
7442
+ F: __dxlog_file26,
7443
+ L: 245
7160
7444
  }));
7161
7445
  return identity;
7162
7446
  }
7163
7447
  getInvitationHandler(invitation) {
7164
7448
  const factory = this._handlerFactories.get(invitation.kind);
7165
- invariant19(factory, `Unknown invitation kind: ${invitation.kind}`, {
7166
- F: __dxlog_file25,
7167
- L: 279,
7449
+ invariant20(factory, `Unknown invitation kind: ${invitation.kind}`, {
7450
+ F: __dxlog_file26,
7451
+ L: 251,
7168
7452
  S: this,
7169
7453
  A: [
7170
7454
  "factory",
@@ -7182,10 +7466,15 @@ var ServiceContext = class extends Resource6 {
7182
7466
  }
7183
7467
  }
7184
7468
  async _acceptIdentity(params) {
7185
- const identity = await this.identityManager.acceptIdentity(params);
7469
+ const { identity, identityRecord } = await this.identityManager.prepareIdentity(params);
7470
+ await this._setNetworkIdentity({
7471
+ deviceCredential: params.authorizedDeviceCredential
7472
+ });
7473
+ await identity.joinNetwork();
7474
+ await this.identityManager.acceptIdentity(identity, identityRecord, params.deviceProfile);
7186
7475
  await this._initialize(new Context9(void 0, {
7187
- F: __dxlog_file25,
7188
- L: 295
7476
+ F: __dxlog_file26,
7477
+ L: 270
7189
7478
  }));
7190
7479
  return identity;
7191
7480
  }
@@ -7197,9 +7486,9 @@ var ServiceContext = class extends Resource6 {
7197
7486
  }
7198
7487
  // Called when identity is created.
7199
7488
  async _initialize(ctx) {
7200
- log22("initializing spaces...", void 0, {
7201
- F: __dxlog_file25,
7202
- L: 310,
7489
+ log23("initializing spaces...", void 0, {
7490
+ F: __dxlog_file26,
7491
+ L: 285,
7203
7492
  S: this,
7204
7493
  C: (f, a) => f(...a)
7205
7494
  });
@@ -7233,10 +7522,12 @@ var ServiceContext = class extends Resource6 {
7233
7522
  edgeFeatures: this._edgeFeatures
7234
7523
  });
7235
7524
  await this.dataSpaceManager.open();
7525
+ this.edgeAgentManager = new EdgeAgentManager(this._edgeFeatures, this._edgeHttpClient, this.dataSpaceManager, identity);
7526
+ await this.edgeAgentManager.open();
7236
7527
  this._handlerFactories.set(Invitation10.Kind.SPACE, (invitation) => {
7237
- invariant19(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
7238
- F: __dxlog_file25,
7239
- L: 340,
7528
+ invariant20(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
7529
+ F: __dxlog_file26,
7530
+ L: 323,
7240
7531
  S: this,
7241
7532
  A: [
7242
7533
  "this.dataSpaceManager",
@@ -7248,7 +7539,7 @@ var ServiceContext = class extends Resource6 {
7248
7539
  this.initialized.wake();
7249
7540
  this._deviceSpaceSync = {
7250
7541
  processCredential: async (credential) => {
7251
- const assertion = getCredentialAssertion5(credential);
7542
+ const assertion = getCredentialAssertion6(credential);
7252
7543
  if (assertion["@type"] !== "dxos.halo.credentials.SpaceMember") {
7253
7544
  return;
7254
7545
  }
@@ -7256,33 +7547,33 @@ var ServiceContext = class extends Resource6 {
7256
7547
  return;
7257
7548
  }
7258
7549
  if (!this.dataSpaceManager) {
7259
- log22("dataSpaceManager not initialized yet, ignoring space admission", {
7550
+ log23("dataSpaceManager not initialized yet, ignoring space admission", {
7260
7551
  details: assertion
7261
7552
  }, {
7262
- F: __dxlog_file25,
7263
- L: 356,
7553
+ F: __dxlog_file26,
7554
+ L: 339,
7264
7555
  S: this,
7265
7556
  C: (f, a) => f(...a)
7266
7557
  });
7267
7558
  return;
7268
7559
  }
7269
7560
  if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
7270
- log22("space already exists, ignoring space admission", {
7561
+ log23("space already exists, ignoring space admission", {
7271
7562
  details: assertion
7272
7563
  }, {
7273
- F: __dxlog_file25,
7274
- L: 360,
7564
+ F: __dxlog_file26,
7565
+ L: 343,
7275
7566
  S: this,
7276
7567
  C: (f, a) => f(...a)
7277
7568
  });
7278
7569
  return;
7279
7570
  }
7280
7571
  try {
7281
- log22("accepting space recorded in halo", {
7572
+ log23("accepting space recorded in halo", {
7282
7573
  details: assertion
7283
7574
  }, {
7284
- F: __dxlog_file25,
7285
- L: 365,
7575
+ F: __dxlog_file26,
7576
+ L: 348,
7286
7577
  S: this,
7287
7578
  C: (f, a) => f(...a)
7288
7579
  });
@@ -7291,9 +7582,9 @@ var ServiceContext = class extends Resource6 {
7291
7582
  genesisFeedKey: assertion.genesisFeedKey
7292
7583
  });
7293
7584
  } catch (err) {
7294
- log22.catch(err, void 0, {
7295
- F: __dxlog_file25,
7296
- L: 371,
7585
+ log23.catch(err, void 0, {
7586
+ F: __dxlog_file26,
7587
+ L: 354,
7297
7588
  S: this,
7298
7589
  C: (f, a) => f(...a)
7299
7590
  });
@@ -7302,14 +7593,65 @@ var ServiceContext = class extends Resource6 {
7302
7593
  };
7303
7594
  await identity.space.spaceState.addCredentialProcessor(this._deviceSpaceSync);
7304
7595
  }
7596
+ async _setNetworkIdentity(params) {
7597
+ try {
7598
+ var _usingCtx = _using_ctx3();
7599
+ const _ = _usingCtx.u(await this._edgeIdentityUpdateMutex.acquire());
7600
+ let edgeIdentity;
7601
+ const identity = this.identityManager.identity;
7602
+ if (identity) {
7603
+ log23.info("Setting identity on edge connection", {
7604
+ identity: identity.identityKey.toHex(),
7605
+ swarms: this.networkManager.topics
7606
+ }, {
7607
+ F: __dxlog_file26,
7608
+ L: 368,
7609
+ S: this,
7610
+ C: (f, a) => f(...a)
7611
+ });
7612
+ if (params?.deviceCredential) {
7613
+ edgeIdentity = await createChainEdgeIdentity(identity.signer, identity.identityKey, identity.deviceKey, {
7614
+ credential: params.deviceCredential
7615
+ }, []);
7616
+ } else {
7617
+ await warnAfterTimeout2(1e4, "Waiting for identity to be ready for edge connection", async () => {
7618
+ await identity.ready();
7619
+ });
7620
+ invariant20(identity.deviceCredentialChain, void 0, {
7621
+ F: __dxlog_file26,
7622
+ L: 386,
7623
+ S: this,
7624
+ A: [
7625
+ "identity.deviceCredentialChain",
7626
+ ""
7627
+ ]
7628
+ });
7629
+ edgeIdentity = await createChainEdgeIdentity(identity.signer, identity.identityKey, identity.deviceKey, identity.deviceCredentialChain, []);
7630
+ }
7631
+ } else {
7632
+ edgeIdentity = await createEphemeralEdgeIdentity();
7633
+ }
7634
+ if (this._edgeConnection) {
7635
+ this._edgeConnection.setIdentity(edgeIdentity);
7636
+ }
7637
+ this.networkManager.setPeerInfo({
7638
+ identityKey: edgeIdentity.identityKey,
7639
+ peerKey: edgeIdentity.peerKey
7640
+ });
7641
+ } catch (_) {
7642
+ _usingCtx.e = _;
7643
+ } finally {
7644
+ _usingCtx.d();
7645
+ }
7646
+ }
7305
7647
  };
7306
- _ts_decorate9([
7648
+ _ts_decorate10([
7307
7649
  Trace3.span()
7308
7650
  ], ServiceContext.prototype, "_open", null);
7309
- _ts_decorate9([
7651
+ _ts_decorate10([
7310
7652
  Trace3.span()
7311
7653
  ], ServiceContext.prototype, "_initialize", null);
7312
- ServiceContext = _ts_decorate9([
7654
+ ServiceContext = _ts_decorate10([
7313
7655
  safeInstanceof("dxos.client-services.ServiceContext"),
7314
7656
  Trace3.resource()
7315
7657
  ], ServiceContext);
@@ -7402,11 +7744,11 @@ var toStorageType = (type) => {
7402
7744
 
7403
7745
  // packages/sdk/client-services/src/packlets/storage/level.ts
7404
7746
  import path from "node:path";
7405
- import { PublicKey as PublicKey14 } from "@dxos/keys";
7747
+ import { PublicKey as PublicKey15 } from "@dxos/keys";
7406
7748
  import { createLevel as createKV } from "@dxos/kv-store";
7407
7749
  var createLevel = async (config) => {
7408
7750
  const persistent = isPersistent(config);
7409
- const storagePath = persistent ? path.join(getRootPath(config), "level") : `/tmp/dxos-${PublicKey14.random().toHex()}`;
7751
+ const storagePath = persistent ? path.join(getRootPath(config), "level") : `/tmp/dxos-${PublicKey15.random().toHex()}`;
7410
7752
  const level = createKV(storagePath);
7411
7753
  await level.open();
7412
7754
  return level;
@@ -7414,11 +7756,11 @@ var createLevel = async (config) => {
7414
7756
 
7415
7757
  // packages/sdk/client-services/src/packlets/storage/profile-archive.ts
7416
7758
  import { cbor } from "@dxos/automerge/automerge-repo";
7417
- import { invariant as invariant20 } from "@dxos/invariant";
7418
- import { log as log23 } from "@dxos/log";
7759
+ import { invariant as invariant21 } from "@dxos/invariant";
7760
+ import { log as log24 } from "@dxos/log";
7419
7761
  import { ProfileArchiveEntryType } from "@dxos/protocols";
7420
7762
  import { arrayToBuffer as arrayToBuffer2 } from "@dxos/util";
7421
- var __dxlog_file26 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
7763
+ var __dxlog_file27 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
7422
7764
  var encodeProfileArchive = (profile) => cbor.encode(profile);
7423
7765
  var decodeProfileArchive = (data) => cbor.decode(data);
7424
7766
  var exportProfileData = async ({ storage, level }) => {
@@ -7431,10 +7773,10 @@ var exportProfileData = async ({ storage, level }) => {
7431
7773
  {
7432
7774
  const directory = await storage.createDirectory();
7433
7775
  const files = await directory.list();
7434
- log23.info("begin exporting files", {
7776
+ log24.info("begin exporting files", {
7435
7777
  count: files.length
7436
7778
  }, {
7437
- F: __dxlog_file26,
7779
+ F: __dxlog_file27,
7438
7780
  L: 30,
7439
7781
  S: void 0,
7440
7782
  C: (f, a) => f(...a)
@@ -7449,18 +7791,18 @@ var exportProfileData = async ({ storage, level }) => {
7449
7791
  value: data
7450
7792
  });
7451
7793
  }
7452
- log23.info("done exporting files", {
7794
+ log24.info("done exporting files", {
7453
7795
  count: files.length
7454
7796
  }, {
7455
- F: __dxlog_file26,
7797
+ F: __dxlog_file27,
7456
7798
  L: 41,
7457
7799
  S: void 0,
7458
7800
  C: (f, a) => f(...a)
7459
7801
  });
7460
7802
  }
7461
7803
  {
7462
- log23.info("begin exporting kv pairs", void 0, {
7463
- F: __dxlog_file26,
7804
+ log24.info("begin exporting kv pairs", void 0, {
7805
+ F: __dxlog_file27,
7464
7806
  L: 45,
7465
7807
  S: void 0,
7466
7808
  C: (f, a) => f(...a)
@@ -7478,10 +7820,10 @@ var exportProfileData = async ({ storage, level }) => {
7478
7820
  });
7479
7821
  count++;
7480
7822
  }
7481
- log23.info("done exporting kv pairs", {
7823
+ log24.info("done exporting kv pairs", {
7482
7824
  count
7483
7825
  }, {
7484
- F: __dxlog_file26,
7826
+ F: __dxlog_file27,
7485
7827
  L: 56,
7486
7828
  S: void 0,
7487
7829
  C: (f, a) => f(...a)
@@ -7496,8 +7838,8 @@ var importProfileData = async ({ storage, level }, archive) => {
7496
7838
  switch (entry2.type) {
7497
7839
  case ProfileArchiveEntryType.FILE: {
7498
7840
  const directory = await storage.createDirectory();
7499
- invariant20(typeof entry2.key === "string", "Invalid key type", {
7500
- F: __dxlog_file26,
7841
+ invariant21(typeof entry2.key === "string", "Invalid key type", {
7842
+ F: __dxlog_file27,
7501
7843
  L: 79,
7502
7844
  S: void 0,
7503
7845
  A: [
@@ -7506,8 +7848,8 @@ var importProfileData = async ({ storage, level }, archive) => {
7506
7848
  ]
7507
7849
  });
7508
7850
  const file = await directory.getOrCreateFile(entry2.key);
7509
- invariant20(entry2.value instanceof Uint8Array, "Invalid value type", {
7510
- F: __dxlog_file26,
7851
+ invariant21(entry2.value instanceof Uint8Array, "Invalid value type", {
7852
+ F: __dxlog_file27,
7511
7853
  L: 81,
7512
7854
  S: void 0,
7513
7855
  A: [
@@ -7520,8 +7862,8 @@ var importProfileData = async ({ storage, level }, archive) => {
7520
7862
  break;
7521
7863
  }
7522
7864
  case ProfileArchiveEntryType.KEY_VALUE: {
7523
- invariant20(entry2.key instanceof Uint8Array, "Invalid key type", {
7524
- F: __dxlog_file26,
7865
+ invariant21(entry2.key instanceof Uint8Array, "Invalid key type", {
7866
+ F: __dxlog_file27,
7525
7867
  L: 87,
7526
7868
  S: void 0,
7527
7869
  A: [
@@ -7529,8 +7871,8 @@ var importProfileData = async ({ storage, level }, archive) => {
7529
7871
  "'Invalid key type'"
7530
7872
  ]
7531
7873
  });
7532
- invariant20(entry2.value instanceof Uint8Array, "Invalid value type", {
7533
- F: __dxlog_file26,
7874
+ invariant21(entry2.value instanceof Uint8Array, "Invalid value type", {
7875
+ F: __dxlog_file27,
7534
7876
  L: 88,
7535
7877
  S: void 0,
7536
7878
  A: [
@@ -7550,20 +7892,20 @@ var importProfileData = async ({ storage, level }, archive) => {
7550
7892
  if (++count % 1e3 === 0) {
7551
7893
  await batch.write();
7552
7894
  batch = level.batch();
7553
- log23.info("importing", {
7895
+ log24.info("importing", {
7554
7896
  count,
7555
7897
  total: archive.storage.length,
7556
7898
  progress: `${(count / archive.storage.length * 100).toFixed()}%`
7557
7899
  }, {
7558
- F: __dxlog_file26,
7900
+ F: __dxlog_file27,
7559
7901
  L: 101,
7560
7902
  S: void 0,
7561
7903
  C: (f, a) => f(...a)
7562
7904
  });
7563
7905
  }
7564
7906
  }
7565
- log23.info("committing changes..", void 0, {
7566
- F: __dxlog_file26,
7907
+ log24.info("committing changes..", void 0, {
7908
+ F: __dxlog_file27,
7567
7909
  L: 109,
7568
7910
  S: void 0,
7569
7911
  C: (f, a) => f(...a)
@@ -7572,13 +7914,13 @@ var importProfileData = async ({ storage, level }, archive) => {
7572
7914
  };
7573
7915
 
7574
7916
  // packages/sdk/client-services/src/packlets/services/service-host.ts
7575
- import { Event as Event10, synchronized as synchronized3 } from "@dxos/async";
7917
+ import { Event as Event11, synchronized as synchronized4 } from "@dxos/async";
7576
7918
  import { clientServiceBundle } from "@dxos/client-protocol";
7577
7919
  import { Context as Context10 } from "@dxos/context";
7578
7920
  import { EdgeClient, EdgeHttpClient, createStubEdgeIdentity } from "@dxos/edge-client";
7579
- import { invariant as invariant22 } from "@dxos/invariant";
7580
- import { PublicKey as PublicKey17 } from "@dxos/keys";
7581
- import { log as log25 } from "@dxos/log";
7921
+ import { invariant as invariant23 } from "@dxos/invariant";
7922
+ import { PublicKey as PublicKey18 } from "@dxos/keys";
7923
+ import { log as log26 } from "@dxos/log";
7582
7924
  import { EdgeSignalManager, WebsocketSignalManager } from "@dxos/messaging";
7583
7925
  import { SwarmNetworkManager, createIceProvider, createRtcTransportFactory } from "@dxos/network-manager";
7584
7926
  import { trace as trace10 } from "@dxos/protocols";
@@ -7588,10 +7930,10 @@ import { WebsocketRpcClient } from "@dxos/websocket-rpc";
7588
7930
 
7589
7931
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
7590
7932
  import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
7591
- import { Stream as Stream11 } from "@dxos/codec-protobuf";
7592
- import { invariant as invariant21 } from "@dxos/invariant";
7933
+ import { Stream as Stream12 } from "@dxos/codec-protobuf";
7934
+ import { invariant as invariant22 } from "@dxos/invariant";
7593
7935
  import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
7594
- var __dxlog_file27 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
7936
+ var __dxlog_file28 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
7595
7937
  var DevicesServiceImpl = class {
7596
7938
  constructor(_identityManager) {
7597
7939
  this._identityManager = _identityManager;
@@ -7600,7 +7942,7 @@ var DevicesServiceImpl = class {
7600
7942
  return this._identityManager.updateDeviceProfile(profile);
7601
7943
  }
7602
7944
  queryDevices() {
7603
- return new Stream11(({ next }) => {
7945
+ return new Stream12(({ next }) => {
7604
7946
  const update = () => {
7605
7947
  const deviceKeys = this._identityManager.identity?.authorizedDeviceKeys;
7606
7948
  if (!deviceKeys) {
@@ -7608,8 +7950,8 @@ var DevicesServiceImpl = class {
7608
7950
  devices: []
7609
7951
  });
7610
7952
  } else {
7611
- invariant21(this._identityManager.identity?.presence, "presence not present", {
7612
- F: __dxlog_file27,
7953
+ invariant22(this._identityManager.identity?.presence, "presence not present", {
7954
+ F: __dxlog_file28,
7613
7955
  L: 32,
7614
7956
  S: this,
7615
7957
  A: [
@@ -7669,9 +8011,9 @@ var DevicesServiceImpl = class {
7669
8011
  };
7670
8012
 
7671
8013
  // packages/sdk/client-services/src/packlets/identity/contacts-service.ts
7672
- import { EventSubscriptions as EventSubscriptions4, scheduleTask as scheduleTask8, UpdateScheduler as UpdateScheduler2 } from "@dxos/async";
7673
- import { Stream as Stream12 } from "@dxos/codec-protobuf";
7674
- import { PublicKey as PublicKey15 } from "@dxos/keys";
8014
+ import { EventSubscriptions as EventSubscriptions4, scheduleTask as scheduleTask9, UpdateScheduler as UpdateScheduler2 } from "@dxos/async";
8015
+ import { Stream as Stream13 } from "@dxos/codec-protobuf";
8016
+ import { PublicKey as PublicKey16 } from "@dxos/keys";
7675
8017
  import { ComplexMap as ComplexMap5, ComplexSet as ComplexSet6 } from "@dxos/util";
7676
8018
  var ContactsServiceImpl = class {
7677
8019
  constructor(_identityManager, _spaceManager, _dataSpaceManagerProvider) {
@@ -7712,7 +8054,7 @@ var ContactsServiceImpl = class {
7712
8054
  });
7713
8055
  }
7714
8056
  return acc;
7715
- }, new ComplexMap5(PublicKey15.hash));
8057
+ }, new ComplexMap5(PublicKey16.hash));
7716
8058
  return {
7717
8059
  contacts: [
7718
8060
  ...contacts.values()
@@ -7720,15 +8062,15 @@ var ContactsServiceImpl = class {
7720
8062
  };
7721
8063
  }
7722
8064
  queryContacts() {
7723
- const subscribedSpaceKeySet = new ComplexSet6(PublicKey15.hash);
7724
- return new Stream12(({ next, ctx }) => {
8065
+ const subscribedSpaceKeySet = new ComplexSet6(PublicKey16.hash);
8066
+ return new Stream13(({ next, ctx }) => {
7725
8067
  const pushUpdateTask = new UpdateScheduler2(ctx, async () => {
7726
8068
  const contacts = await this.getContacts();
7727
8069
  next(contacts);
7728
8070
  }, {
7729
8071
  maxFrequency: 2
7730
8072
  });
7731
- scheduleTask8(ctx, async () => {
8073
+ scheduleTask9(ctx, async () => {
7732
8074
  const subscriptions = new EventSubscriptions4();
7733
8075
  ctx.onDispose(() => subscriptions.clear());
7734
8076
  const subscribeToSpaceAndUpdate = () => {
@@ -7752,27 +8094,27 @@ var ContactsServiceImpl = class {
7752
8094
  };
7753
8095
 
7754
8096
  // packages/sdk/client-services/src/packlets/logging/logging-service.ts
7755
- import { Event as Event9 } from "@dxos/async";
7756
- import { Stream as Stream13 } from "@dxos/codec-protobuf";
7757
- import { PublicKey as PublicKey16 } from "@dxos/keys";
7758
- import { getContextFromEntry, log as log24 } from "@dxos/log";
8097
+ import { Event as Event10 } from "@dxos/async";
8098
+ import { Stream as Stream14 } from "@dxos/codec-protobuf";
8099
+ import { PublicKey as PublicKey17 } from "@dxos/keys";
8100
+ import { getContextFromEntry, log as log25 } from "@dxos/log";
7759
8101
  import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
7760
8102
  import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
7761
8103
  var LoggingServiceImpl = class {
7762
8104
  constructor() {
7763
- this._logs = new Event9();
8105
+ this._logs = new Event10();
7764
8106
  this._started = Date.now();
7765
- this._sessionId = PublicKey16.random().toHex();
8107
+ this._sessionId = PublicKey17.random().toHex();
7766
8108
  this._logProcessor = (_config, entry2) => {
7767
8109
  this._logs.emit(entry2);
7768
8110
  };
7769
8111
  }
7770
8112
  async open() {
7771
- log24.runtimeConfig.processors.push(this._logProcessor);
8113
+ log25.runtimeConfig.processors.push(this._logProcessor);
7772
8114
  }
7773
8115
  async close() {
7774
- const index = log24.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
7775
- log24.runtimeConfig.processors.splice(index, 1);
8116
+ const index = log25.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
8117
+ log25.runtimeConfig.processors.splice(index, 1);
7776
8118
  }
7777
8119
  async controlMetrics({ reset, record }) {
7778
8120
  if (reset) {
@@ -7798,7 +8140,7 @@ var LoggingServiceImpl = class {
7798
8140
  stats: numericalValues(events, "duration")
7799
8141
  };
7800
8142
  };
7801
- return new Stream13(({ next }) => {
8143
+ return new Stream14(({ next }) => {
7802
8144
  const update = () => {
7803
8145
  const metrics2 = {
7804
8146
  timestamp: /* @__PURE__ */ new Date(),
@@ -7820,7 +8162,7 @@ var LoggingServiceImpl = class {
7820
8162
  });
7821
8163
  }
7822
8164
  queryLogs(request) {
7823
- return new Stream13(({ ctx, next }) => {
8165
+ return new Stream14(({ ctx, next }) => {
7824
8166
  const handler = (entry2) => {
7825
8167
  if (LOG_PROCESSING > 0) {
7826
8168
  return;
@@ -7876,14 +8218,14 @@ var shouldLog = (entry2, request) => {
7876
8218
  var LOG_PROCESSING = 0;
7877
8219
 
7878
8220
  // packages/sdk/client-services/src/packlets/network/network-service.ts
7879
- import { Stream as Stream14 } from "@dxos/codec-protobuf";
8221
+ import { Stream as Stream15 } from "@dxos/codec-protobuf";
7880
8222
  var NetworkServiceImpl = class {
7881
8223
  constructor(networkManager, signalManager) {
7882
8224
  this.networkManager = networkManager;
7883
8225
  this.signalManager = signalManager;
7884
8226
  }
7885
8227
  queryStatus() {
7886
- return new Stream14(({ next }) => {
8228
+ return new Stream15(({ next }) => {
7887
8229
  const update = () => {
7888
8230
  next({
7889
8231
  swarm: this.networkManager.connectionState,
@@ -7909,7 +8251,7 @@ var NetworkServiceImpl = class {
7909
8251
  };
7910
8252
 
7911
8253
  // packages/sdk/client-services/src/packlets/system/system-service.ts
7912
- import { Stream as Stream15 } from "@dxos/codec-protobuf";
8254
+ import { Stream as Stream16 } from "@dxos/codec-protobuf";
7913
8255
  import { GetDiagnosticsRequest as GetDiagnosticsRequest2 } from "@dxos/protocols/proto/dxos/client/services";
7914
8256
  import { jsonKeyReplacer as jsonKeyReplacer2 } from "@dxos/util";
7915
8257
  var SystemServiceImpl = class {
@@ -7945,7 +8287,7 @@ var SystemServiceImpl = class {
7945
8287
  }
7946
8288
  // TODO(burdon): Standardize interval option in stream request?
7947
8289
  queryStatus({ interval = 3e3 } = {}) {
7948
- return new Stream15(({ next }) => {
8290
+ return new Stream16(({ next }) => {
7949
8291
  const update = () => {
7950
8292
  next({
7951
8293
  status: this._getCurrentStatus()
@@ -7966,13 +8308,13 @@ var SystemServiceImpl = class {
7966
8308
  };
7967
8309
 
7968
8310
  // packages/sdk/client-services/src/packlets/services/service-host.ts
7969
- function _ts_decorate10(decorators, target, key, desc) {
8311
+ function _ts_decorate11(decorators, target, key, desc) {
7970
8312
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7971
8313
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7972
8314
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7973
8315
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7974
8316
  }
7975
- var __dxlog_file28 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
8317
+ var __dxlog_file29 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
7976
8318
  var ClientServicesHost = class {
7977
8319
  constructor({
7978
8320
  config,
@@ -7986,7 +8328,7 @@ var ClientServicesHost = class {
7986
8328
  runtimeParams
7987
8329
  } = {}) {
7988
8330
  this._tracingService = TRACE_PROCESSOR3.createTraceSender();
7989
- this._statusUpdate = new Event10();
8331
+ this._statusUpdate = new Event11();
7990
8332
  this._edgeConnection = void 0;
7991
8333
  this._edgeHttpClient = void 0;
7992
8334
  this._opening = false;
@@ -8011,8 +8353,8 @@ var ClientServicesHost = class {
8011
8353
  onAcquire: () => {
8012
8354
  if (!this._opening) {
8013
8355
  void this.open(new Context10(void 0, {
8014
- F: __dxlog_file28,
8015
- L: 133
8356
+ F: __dxlog_file29,
8357
+ L: 134
8016
8358
  }));
8017
8359
  }
8018
8360
  },
@@ -8068,25 +8410,25 @@ var ClientServicesHost = class {
8068
8410
  * Can only be called once.
8069
8411
  */
8070
8412
  initialize({ config, ...options }) {
8071
- invariant22(!this._open, "service host is open", {
8072
- F: __dxlog_file28,
8073
- L: 199,
8413
+ invariant23(!this._open, "service host is open", {
8414
+ F: __dxlog_file29,
8415
+ L: 200,
8074
8416
  S: this,
8075
8417
  A: [
8076
8418
  "!this._open",
8077
8419
  "'service host is open'"
8078
8420
  ]
8079
8421
  });
8080
- log25("initializing...", void 0, {
8081
- F: __dxlog_file28,
8082
- L: 200,
8422
+ log26("initializing...", void 0, {
8423
+ F: __dxlog_file29,
8424
+ L: 201,
8083
8425
  S: this,
8084
8426
  C: (f, a) => f(...a)
8085
8427
  });
8086
8428
  if (config) {
8087
- invariant22(!this._config, "config already set", {
8088
- F: __dxlog_file28,
8089
- L: 203,
8429
+ invariant23(!this._config, "config already set", {
8430
+ F: __dxlog_file29,
8431
+ L: 204,
8090
8432
  S: this,
8091
8433
  A: [
8092
8434
  "!this._config",
@@ -8099,9 +8441,9 @@ var ClientServicesHost = class {
8099
8441
  }
8100
8442
  }
8101
8443
  if (!options.signalManager) {
8102
- log25.warn("running signaling without telemetry metadata.", void 0, {
8103
- F: __dxlog_file28,
8104
- L: 211,
8444
+ log26.warn("running signaling without telemetry metadata.", void 0, {
8445
+ F: __dxlog_file29,
8446
+ L: 212,
8105
8447
  S: this,
8106
8448
  C: (f, a) => f(...a)
8107
8449
  });
@@ -8119,9 +8461,9 @@ var ClientServicesHost = class {
8119
8461
  edgeConnection: this._edgeConnection
8120
8462
  }) : new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
8121
8463
  this._signalManager = signalManager;
8122
- invariant22(!this._networkManager, "network manager already set", {
8123
- F: __dxlog_file28,
8124
- L: 233,
8464
+ invariant23(!this._networkManager, "network manager already set", {
8465
+ F: __dxlog_file29,
8466
+ L: 234,
8125
8467
  S: this,
8126
8468
  A: [
8127
8469
  "!this._networkManager",
@@ -8137,9 +8479,9 @@ var ClientServicesHost = class {
8137
8479
  peerKey: this._edgeConnection.peerKey
8138
8480
  } : void 0
8139
8481
  });
8140
- log25("initialized", void 0, {
8141
- F: __dxlog_file28,
8142
- L: 246,
8482
+ log26("initialized", void 0, {
8483
+ F: __dxlog_file29,
8484
+ L: 247,
8143
8485
  S: this,
8144
8486
  C: (f, a) => f(...a)
8145
8487
  });
@@ -8148,45 +8490,45 @@ var ClientServicesHost = class {
8148
8490
  if (this._open) {
8149
8491
  return;
8150
8492
  }
8151
- const traceId = PublicKey17.random().toHex();
8152
- log25.trace("dxos.client-services.host.open", trace10.begin({
8493
+ const traceId = PublicKey18.random().toHex();
8494
+ log26.trace("dxos.client-services.host.open", trace10.begin({
8153
8495
  id: traceId
8154
8496
  }), {
8155
- F: __dxlog_file28,
8156
- L: 257,
8497
+ F: __dxlog_file29,
8498
+ L: 258,
8157
8499
  S: this,
8158
8500
  C: (f, a) => f(...a)
8159
8501
  });
8160
- invariant22(this._config, "config not set", {
8161
- F: __dxlog_file28,
8162
- L: 259,
8502
+ invariant23(this._config, "config not set", {
8503
+ F: __dxlog_file29,
8504
+ L: 260,
8163
8505
  S: this,
8164
8506
  A: [
8165
8507
  "this._config",
8166
8508
  "'config not set'"
8167
8509
  ]
8168
8510
  });
8169
- invariant22(this._storage, "storage not set", {
8170
- F: __dxlog_file28,
8171
- L: 260,
8511
+ invariant23(this._storage, "storage not set", {
8512
+ F: __dxlog_file29,
8513
+ L: 261,
8172
8514
  S: this,
8173
8515
  A: [
8174
8516
  "this._storage",
8175
8517
  "'storage not set'"
8176
8518
  ]
8177
8519
  });
8178
- invariant22(this._signalManager, "signal manager not set", {
8179
- F: __dxlog_file28,
8180
- L: 261,
8520
+ invariant23(this._signalManager, "signal manager not set", {
8521
+ F: __dxlog_file29,
8522
+ L: 262,
8181
8523
  S: this,
8182
8524
  A: [
8183
8525
  "this._signalManager",
8184
8526
  "'signal manager not set'"
8185
8527
  ]
8186
8528
  });
8187
- invariant22(this._networkManager, "network manager not set", {
8188
- F: __dxlog_file28,
8189
- L: 262,
8529
+ invariant23(this._networkManager, "network manager not set", {
8530
+ F: __dxlog_file29,
8531
+ L: 263,
8190
8532
  S: this,
8191
8533
  A: [
8192
8534
  "this._networkManager",
@@ -8194,11 +8536,11 @@ var ClientServicesHost = class {
8194
8536
  ]
8195
8537
  });
8196
8538
  this._opening = true;
8197
- log25("opening...", {
8539
+ log26("opening...", {
8198
8540
  lockKey: this._resourceLock?.lockKey
8199
8541
  }, {
8200
- F: __dxlog_file28,
8201
- L: 265,
8542
+ F: __dxlog_file29,
8543
+ L: 266,
8202
8544
  S: this,
8203
8545
  C: (f, a) => f(...a)
8204
8546
  });
@@ -8213,6 +8555,10 @@ var ClientServicesHost = class {
8213
8555
  await this._serviceContext.initialized.wait();
8214
8556
  return this._serviceContext.dataSpaceManager;
8215
8557
  };
8558
+ const agentManagerProvider = async () => {
8559
+ await this._serviceContext.initialized.wait();
8560
+ return this._serviceContext.edgeAgentManager;
8561
+ };
8216
8562
  const identityService = new IdentityServiceImpl(this._serviceContext.identityManager, this._serviceContext.keyring, () => this._serviceContext.dataSpaceManager, (params) => this._createIdentity(params), (profile) => this._serviceContext.broadcastProfileUpdate(profile));
8217
8563
  this._serviceRegistry.setServices({
8218
8564
  SystemService: this._systemService,
@@ -8231,7 +8577,8 @@ var ClientServicesHost = class {
8231
8577
  events: new DevtoolsHostEvents(),
8232
8578
  config: this._config,
8233
8579
  context: this._serviceContext
8234
- })
8580
+ }),
8581
+ EdgeAgentService: new EdgeAgentServiceImpl(agentManagerProvider)
8235
8582
  });
8236
8583
  await this._serviceContext.open(ctx);
8237
8584
  await identityService.open();
@@ -8250,19 +8597,19 @@ var ClientServicesHost = class {
8250
8597
  this._open = true;
8251
8598
  this._statusUpdate.emit();
8252
8599
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
8253
- log25("opened", {
8600
+ log26("opened", {
8254
8601
  deviceKey
8255
8602
  }, {
8256
- F: __dxlog_file28,
8257
- L: 354,
8603
+ F: __dxlog_file29,
8604
+ L: 362,
8258
8605
  S: this,
8259
8606
  C: (f, a) => f(...a)
8260
8607
  });
8261
- log25.trace("dxos.client-services.host.open", trace10.end({
8608
+ log26.trace("dxos.client-services.host.open", trace10.end({
8262
8609
  id: traceId
8263
8610
  }), {
8264
- F: __dxlog_file28,
8265
- L: 355,
8611
+ F: __dxlog_file29,
8612
+ L: 363,
8266
8613
  S: this,
8267
8614
  C: (f, a) => f(...a)
8268
8615
  });
@@ -8272,11 +8619,11 @@ var ClientServicesHost = class {
8272
8619
  return;
8273
8620
  }
8274
8621
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
8275
- log25("closing...", {
8622
+ log26("closing...", {
8276
8623
  deviceKey
8277
8624
  }, {
8278
- F: __dxlog_file28,
8279
- L: 366,
8625
+ F: __dxlog_file29,
8626
+ L: 374,
8280
8627
  S: this,
8281
8628
  C: (f, a) => f(...a)
8282
8629
  });
@@ -8290,44 +8637,44 @@ var ClientServicesHost = class {
8290
8637
  await this._level?.close();
8291
8638
  this._open = false;
8292
8639
  this._statusUpdate.emit();
8293
- log25("closed", {
8640
+ log26("closed", {
8294
8641
  deviceKey
8295
8642
  }, {
8296
- F: __dxlog_file28,
8297
- L: 375,
8643
+ F: __dxlog_file29,
8644
+ L: 383,
8298
8645
  S: this,
8299
8646
  C: (f, a) => f(...a)
8300
8647
  });
8301
8648
  }
8302
8649
  async reset() {
8303
- const traceId = PublicKey17.random().toHex();
8304
- log25.trace("dxos.sdk.client-services-host.reset", trace10.begin({
8650
+ const traceId = PublicKey18.random().toHex();
8651
+ log26.trace("dxos.sdk.client-services-host.reset", trace10.begin({
8305
8652
  id: traceId
8306
8653
  }), {
8307
- F: __dxlog_file28,
8308
- L: 380,
8654
+ F: __dxlog_file29,
8655
+ L: 388,
8309
8656
  S: this,
8310
8657
  C: (f, a) => f(...a)
8311
8658
  });
8312
- log25.info("resetting...", void 0, {
8313
- F: __dxlog_file28,
8314
- L: 382,
8659
+ log26.info("resetting...", void 0, {
8660
+ F: __dxlog_file29,
8661
+ L: 390,
8315
8662
  S: this,
8316
8663
  C: (f, a) => f(...a)
8317
8664
  });
8318
8665
  await this._serviceContext?.close();
8319
8666
  await this._storage.reset();
8320
- log25.info("reset", void 0, {
8321
- F: __dxlog_file28,
8322
- L: 385,
8667
+ log26.info("reset", void 0, {
8668
+ F: __dxlog_file29,
8669
+ L: 393,
8323
8670
  S: this,
8324
8671
  C: (f, a) => f(...a)
8325
8672
  });
8326
- log25.trace("dxos.sdk.client-services-host.reset", trace10.end({
8673
+ log26.trace("dxos.sdk.client-services-host.reset", trace10.end({
8327
8674
  id: traceId
8328
8675
  }), {
8329
- F: __dxlog_file28,
8330
- L: 386,
8676
+ F: __dxlog_file29,
8677
+ L: 394,
8331
8678
  S: this,
8332
8679
  C: (f, a) => f(...a)
8333
8680
  });
@@ -8339,21 +8686,21 @@ var ClientServicesHost = class {
8339
8686
  return identity;
8340
8687
  }
8341
8688
  };
8342
- _ts_decorate10([
8689
+ _ts_decorate11([
8343
8690
  Trace4.info()
8344
8691
  ], ClientServicesHost.prototype, "_opening", void 0);
8345
- _ts_decorate10([
8692
+ _ts_decorate11([
8346
8693
  Trace4.info()
8347
8694
  ], ClientServicesHost.prototype, "_open", void 0);
8348
- _ts_decorate10([
8349
- synchronized3,
8695
+ _ts_decorate11([
8696
+ synchronized4,
8350
8697
  Trace4.span()
8351
8698
  ], ClientServicesHost.prototype, "open", null);
8352
- _ts_decorate10([
8353
- synchronized3,
8699
+ _ts_decorate11([
8700
+ synchronized4,
8354
8701
  Trace4.span()
8355
8702
  ], ClientServicesHost.prototype, "close", null);
8356
- ClientServicesHost = _ts_decorate10([
8703
+ ClientServicesHost = _ts_decorate11([
8357
8704
  Trace4.resource()
8358
8705
  ], ClientServicesHost);
8359
8706
 
@@ -8390,6 +8737,8 @@ export {
8390
8737
  Lock,
8391
8738
  isLocked,
8392
8739
  ClientRpcServer,
8740
+ EdgeAgentManager,
8741
+ EdgeAgentServiceImpl,
8393
8742
  ServiceContext,
8394
8743
  ServiceRegistry,
8395
8744
  createStorageObjects,
@@ -8400,4 +8749,4 @@ export {
8400
8749
  importProfileData,
8401
8750
  ClientServicesHost
8402
8751
  };
8403
- //# sourceMappingURL=chunk-AIBLDI4U.mjs.map
8752
+ //# sourceMappingURL=chunk-MMU5KC57.mjs.map