@dxos/client-services 0.6.13-main.09887cd → 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 (58) hide show
  1. package/dist/lib/browser/{chunk-XOKN3TE7.mjs → chunk-IPWEAPT2.mjs} +593 -282
  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 +1 -1
  7. package/dist/lib/node/{chunk-IFHGVXW2.cjs → chunk-DJIOUOAF.cjs} +626 -317
  8. package/dist/lib/node/chunk-DJIOUOAF.cjs.map +7 -0
  9. package/dist/lib/node/index.cjs +49 -45
  10. package/dist/lib/node/index.cjs.map +1 -1
  11. package/dist/lib/node/meta.json +1 -1
  12. package/dist/lib/node/testing/index.cjs +8 -8
  13. package/dist/lib/node-esm/{chunk-FTEPRZ23.mjs → chunk-MMU5KC57.mjs} +593 -282
  14. package/dist/lib/node-esm/chunk-MMU5KC57.mjs.map +7 -0
  15. package/dist/lib/node-esm/index.mjs +5 -1
  16. package/dist/lib/node-esm/index.mjs.map +1 -1
  17. package/dist/lib/node-esm/meta.json +1 -1
  18. package/dist/lib/node-esm/testing/index.mjs +1 -1
  19. package/dist/types/src/index.d.ts +1 -0
  20. package/dist/types/src/index.d.ts.map +1 -1
  21. package/dist/types/src/packlets/agents/edge-agent-manager.d.ts +35 -0
  22. package/dist/types/src/packlets/agents/edge-agent-manager.d.ts.map +1 -0
  23. package/dist/types/src/packlets/agents/edge-agent-service.d.ts +10 -0
  24. package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -0
  25. package/dist/types/src/packlets/agents/index.d.ts +3 -0
  26. package/dist/types/src/packlets/agents/index.d.ts.map +1 -0
  27. package/dist/types/src/packlets/identity/identity.d.ts +1 -0
  28. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  29. package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts.map +1 -1
  30. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  31. package/dist/types/src/packlets/services/service-context.d.ts +2 -0
  32. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  33. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  34. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +1 -0
  35. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  36. package/dist/types/src/packlets/spaces/data-space.d.ts +1 -0
  37. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  38. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +4 -0
  39. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
  40. package/dist/types/src/version.d.ts +1 -1
  41. package/package.json +38 -38
  42. package/src/index.ts +1 -0
  43. package/src/packlets/agents/edge-agent-manager.ts +163 -0
  44. package/src/packlets/agents/edge-agent-service.ts +42 -0
  45. package/src/packlets/agents/index.ts +6 -0
  46. package/src/packlets/identity/identity.ts +4 -0
  47. package/src/packlets/invitations/edge-invitation-handler.ts +6 -5
  48. package/src/packlets/invitations/invitations-handler.ts +1 -2
  49. package/src/packlets/services/service-context.ts +11 -0
  50. package/src/packlets/services/service-host.ts +8 -0
  51. package/src/packlets/spaces/data-space-manager.ts +4 -2
  52. package/src/packlets/spaces/data-space.ts +2 -0
  53. package/src/packlets/spaces/edge-feed-replicator.test.ts +5 -6
  54. package/src/packlets/spaces/notarization-plugin.ts +27 -0
  55. package/src/version.ts +1 -1
  56. package/dist/lib/browser/chunk-XOKN3TE7.mjs.map +0 -7
  57. package/dist/lib/node/chunk-IFHGVXW2.cjs.map +0 -7
  58. package/dist/lib/node-esm/chunk-FTEPRZ23.mjs.map +0 -7
@@ -404,7 +404,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
404
404
  import { TRACE_PROCESSOR } from "@dxos/tracing";
405
405
 
406
406
  // packages/sdk/client-services/src/version.ts
407
- var DXOS_VERSION = "0.6.13-main.09887cd";
407
+ var DXOS_VERSION = "0.6.13-main.ed424a1";
408
408
 
409
409
  // packages/sdk/client-services/src/packlets/services/platform.ts
410
410
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -1558,6 +1558,7 @@ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/sr
1558
1558
  var DEFAULT_RETRY_TIMEOUT = 1e3;
1559
1559
  var DEFAULT_SUCCESS_DELAY = 1e3;
1560
1560
  var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
1561
+ var DEFAULT_ACTIVE_EDGE_POLLING_INTERVAL = 3e3;
1561
1562
  var MAX_EDGE_RETRIES = 2;
1562
1563
  var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
1563
1564
  var credentialCodec = schema2.getCodecForType("dxos.halo.credentials.Credential");
@@ -1568,11 +1569,44 @@ var NotarizationPlugin = class extends Resource3 {
1568
1569
  this._extensions = /* @__PURE__ */ new Set();
1569
1570
  this._processedCredentials = new ComplexSet(PublicKey4.hash);
1570
1571
  this._processCredentialsTriggers = new ComplexMap3(PublicKey4.hash);
1572
+ this._activeEdgePollingIntervalHandle = void 0;
1571
1573
  this._spaceId = params.spaceId;
1574
+ this._activeEdgePollingInterval = params.activeEdgePollingInterval ?? DEFAULT_ACTIVE_EDGE_POLLING_INTERVAL;
1572
1575
  if (params.edgeClient && params.edgeFeatures?.feedReplicator) {
1573
1576
  this._edgeClient = params.edgeClient;
1574
1577
  }
1575
1578
  }
1579
+ setActiveEdgePollingEnabled(enabled) {
1580
+ invariant4(this.isOpen, void 0, {
1581
+ F: __dxlog_file8,
1582
+ L: 109,
1583
+ S: this,
1584
+ A: [
1585
+ "this.isOpen",
1586
+ ""
1587
+ ]
1588
+ });
1589
+ const client = this._edgeClient;
1590
+ invariant4(client, void 0, {
1591
+ F: __dxlog_file8,
1592
+ L: 111,
1593
+ S: this,
1594
+ A: [
1595
+ "client",
1596
+ ""
1597
+ ]
1598
+ });
1599
+ if (enabled && !this._activeEdgePollingIntervalHandle) {
1600
+ this._activeEdgePollingIntervalHandle = setInterval(() => {
1601
+ if (this._writer) {
1602
+ this._notarizePendingEdgeCredentials(client, this._writer);
1603
+ }
1604
+ }, this._activeEdgePollingInterval);
1605
+ } else if (!enabled && this._activeEdgePollingIntervalHandle) {
1606
+ clearInterval(this._activeEdgePollingIntervalHandle);
1607
+ this._activeEdgePollingIntervalHandle = void 0;
1608
+ }
1609
+ }
1576
1610
  get hasWriter() {
1577
1611
  return !!this._writer;
1578
1612
  }
@@ -1582,6 +1616,10 @@ var NotarizationPlugin = class extends Resource3 {
1582
1616
  }
1583
1617
  }
1584
1618
  async _close() {
1619
+ if (this._activeEdgePollingIntervalHandle) {
1620
+ clearInterval(this._activeEdgePollingIntervalHandle);
1621
+ this._activeEdgePollingIntervalHandle = void 0;
1622
+ }
1585
1623
  await this._ctx.dispose();
1586
1624
  }
1587
1625
  /**
@@ -1592,13 +1630,13 @@ var NotarizationPlugin = class extends Resource3 {
1592
1630
  credentials
1593
1631
  }, {
1594
1632
  F: __dxlog_file8,
1595
- L: 126,
1633
+ L: 153,
1596
1634
  S: this,
1597
1635
  C: (f, a) => f(...a)
1598
1636
  });
1599
1637
  invariant4(credentials.every((credential) => credential.id), "Credentials must have an id", {
1600
1638
  F: __dxlog_file8,
1601
- L: 127,
1639
+ L: 154,
1602
1640
  S: this,
1603
1641
  A: [
1604
1642
  "credentials.every((credential) => credential.id)",
@@ -1612,7 +1650,7 @@ var NotarizationPlugin = class extends Resource3 {
1612
1650
  err
1613
1651
  }, {
1614
1652
  F: __dxlog_file8,
1615
- L: 135,
1653
+ L: 162,
1616
1654
  S: this,
1617
1655
  C: (f, a) => f(...a)
1618
1656
  });
@@ -1644,7 +1682,7 @@ var NotarizationPlugin = class extends Resource3 {
1644
1682
  ]);
1645
1683
  log6("done", void 0, {
1646
1684
  F: __dxlog_file8,
1647
- L: 160,
1685
+ L: 187,
1648
1686
  S: this,
1649
1687
  C: (f, a) => f(...a)
1650
1688
  });
@@ -1667,7 +1705,7 @@ var NotarizationPlugin = class extends Resource3 {
1667
1705
  retryIn: retryTimeout
1668
1706
  }, {
1669
1707
  F: __dxlog_file8,
1670
- L: 183,
1708
+ L: 210,
1671
1709
  S: this,
1672
1710
  C: (f, a) => f(...a)
1673
1711
  });
@@ -1681,7 +1719,7 @@ var NotarizationPlugin = class extends Resource3 {
1681
1719
  credentialId: credentials.map((credential) => credential.id)
1682
1720
  }, {
1683
1721
  F: __dxlog_file8,
1684
- L: 190,
1722
+ L: 217,
1685
1723
  S: this,
1686
1724
  C: (f, a) => f(...a)
1687
1725
  });
@@ -1690,7 +1728,7 @@ var NotarizationPlugin = class extends Resource3 {
1690
1728
  });
1691
1729
  log6("success", void 0, {
1692
1730
  F: __dxlog_file8,
1693
- L: 194,
1731
+ L: 221,
1694
1732
  S: this,
1695
1733
  C: (f, a) => f(...a)
1696
1734
  });
@@ -1699,7 +1737,7 @@ var NotarizationPlugin = class extends Resource3 {
1699
1737
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
1700
1738
  log6.info("error notarizing (recoverable)", err, {
1701
1739
  F: __dxlog_file8,
1702
- L: 199,
1740
+ L: 226,
1703
1741
  S: this,
1704
1742
  C: (f, a) => f(...a)
1705
1743
  });
@@ -1728,7 +1766,7 @@ var NotarizationPlugin = class extends Resource3 {
1728
1766
  });
1729
1767
  log6("edge notarization success", void 0, {
1730
1768
  F: __dxlog_file8,
1731
- L: 227,
1769
+ L: 254,
1732
1770
  S: this,
1733
1771
  C: (f, a) => f(...a)
1734
1772
  });
@@ -1751,7 +1789,7 @@ var NotarizationPlugin = class extends Resource3 {
1751
1789
  setWriter(writer) {
1752
1790
  invariant4(!this._writer, "Writer already set.", {
1753
1791
  F: __dxlog_file8,
1754
- L: 247,
1792
+ L: 274,
1755
1793
  S: this,
1756
1794
  A: [
1757
1795
  "!this._writer",
@@ -1781,7 +1819,7 @@ var NotarizationPlugin = class extends Resource3 {
1781
1819
  if (!credentials.length) {
1782
1820
  log6("edge did not return credentials for notarization", void 0, {
1783
1821
  F: __dxlog_file8,
1784
- L: 269,
1822
+ L: 296,
1785
1823
  S: this,
1786
1824
  C: (f, a) => f(...a)
1787
1825
  });
@@ -1791,7 +1829,7 @@ var NotarizationPlugin = class extends Resource3 {
1791
1829
  count: credentials.length
1792
1830
  }, {
1793
1831
  F: __dxlog_file8,
1794
- L: 273,
1832
+ L: 300,
1795
1833
  S: this,
1796
1834
  C: (f, a) => f(...a)
1797
1835
  });
@@ -1804,7 +1842,7 @@ var NotarizationPlugin = class extends Resource3 {
1804
1842
  count: decodedCredentials.length
1805
1843
  }, {
1806
1844
  F: __dxlog_file8,
1807
- L: 282,
1845
+ L: 309,
1808
1846
  S: this,
1809
1847
  C: (f, a) => f(...a)
1810
1848
  });
@@ -1832,7 +1870,7 @@ var NotarizationPlugin = class extends Resource3 {
1832
1870
  for (const credential of credentials) {
1833
1871
  invariant4(credential.id, "Credential must have an id", {
1834
1872
  F: __dxlog_file8,
1835
- L: 308,
1873
+ L: 335,
1836
1874
  S: this,
1837
1875
  A: [
1838
1876
  "credential.id",
@@ -1856,7 +1894,7 @@ var NotarizationPlugin = class extends Resource3 {
1856
1894
  peer: extension.localPeerId
1857
1895
  }, {
1858
1896
  F: __dxlog_file8,
1859
- L: 323,
1897
+ L: 350,
1860
1898
  S: this,
1861
1899
  C: (f, a) => f(...a)
1862
1900
  });
@@ -1868,7 +1906,7 @@ var NotarizationPlugin = class extends Resource3 {
1868
1906
  peer: extension.localPeerId
1869
1907
  }, {
1870
1908
  F: __dxlog_file8,
1871
- L: 328,
1909
+ L: 355,
1872
1910
  S: this,
1873
1911
  C: (f, a) => f(...a)
1874
1912
  });
@@ -1885,7 +1923,7 @@ var NotarizationPlugin = class extends Resource3 {
1885
1923
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
1886
1924
  }, {
1887
1925
  F: __dxlog_file8,
1888
- L: 340,
1926
+ L: 367,
1889
1927
  S: this,
1890
1928
  C: (f, a) => f(...a)
1891
1929
  });
@@ -1901,7 +1939,7 @@ var handleEdgeError = (error) => {
1901
1939
  if (!(error instanceof EdgeCallFailedError) || error.errorData) {
1902
1940
  log6.catch(error, void 0, {
1903
1941
  F: __dxlog_file8,
1904
- L: 354,
1942
+ L: 381,
1905
1943
  S: void 0,
1906
1944
  C: (f, a) => f(...a)
1907
1945
  });
@@ -1910,7 +1948,7 @@ var handleEdgeError = (error) => {
1910
1948
  reason: error.reason
1911
1949
  }, {
1912
1950
  F: __dxlog_file8,
1913
- L: 356,
1951
+ L: 383,
1914
1952
  S: void 0,
1915
1953
  C: (f, a) => f(...a)
1916
1954
  });
@@ -2013,7 +2051,7 @@ import { LifecycleState, Resource as Resource4, cancelWithContext } from "@dxos/
2013
2051
  import { createAdmissionCredentials, getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
2014
2052
  import { convertLegacyReferences as convertLegacyReferences2, findInlineObjectOfType as findInlineObjectOfType2, AuthStatus, CredentialServerExtension } from "@dxos/echo-pipeline";
2015
2053
  import { LEGACY_TYPE_PROPERTIES, SpaceDocVersion as SpaceDocVersion2, encodeReference } from "@dxos/echo-protocol";
2016
- import { TYPE_PROPERTIES as TYPE_PROPERTIES2, generateEchoId, getTypeReference } from "@dxos/echo-schema";
2054
+ import { TYPE_PROPERTIES as TYPE_PROPERTIES2, createObjectId, getTypeReference } from "@dxos/echo-schema";
2017
2055
  import { writeMessages } from "@dxos/feed-store";
2018
2056
  import { invariant as invariant5 } from "@dxos/invariant";
2019
2057
  import { PublicKey as PublicKey5 } from "@dxos/keys";
@@ -2162,7 +2200,7 @@ var DataSpaceManager = class extends Resource4 {
2162
2200
  async _open() {
2163
2201
  log8("open", void 0, {
2164
2202
  F: __dxlog_file10,
2165
- L: 198,
2203
+ L: 199,
2166
2204
  S: this,
2167
2205
  C: (f, a) => f(...a)
2168
2206
  });
@@ -2170,7 +2208,7 @@ var DataSpaceManager = class extends Resource4 {
2170
2208
  id: this._instanceId
2171
2209
  }), {
2172
2210
  F: __dxlog_file10,
2173
- L: 199,
2211
+ L: 200,
2174
2212
  S: this,
2175
2213
  C: (f, a) => f(...a)
2176
2214
  });
@@ -2178,7 +2216,7 @@ var DataSpaceManager = class extends Resource4 {
2178
2216
  spaces: this._metadataStore.spaces.length
2179
2217
  }, {
2180
2218
  F: __dxlog_file10,
2181
- L: 200,
2219
+ L: 201,
2182
2220
  S: this,
2183
2221
  C: (f, a) => f(...a)
2184
2222
  });
@@ -2188,7 +2226,7 @@ var DataSpaceManager = class extends Resource4 {
2188
2226
  spaceMetadata
2189
2227
  }, {
2190
2228
  F: __dxlog_file10,
2191
- L: 204,
2229
+ L: 205,
2192
2230
  S: this,
2193
2231
  C: (f, a) => f(...a)
2194
2232
  });
@@ -2199,7 +2237,7 @@ var DataSpaceManager = class extends Resource4 {
2199
2237
  err
2200
2238
  }, {
2201
2239
  F: __dxlog_file10,
2202
- L: 207,
2240
+ L: 208,
2203
2241
  S: this,
2204
2242
  C: (f, a) => f(...a)
2205
2243
  });
@@ -2210,7 +2248,7 @@ var DataSpaceManager = class extends Resource4 {
2210
2248
  id: this._instanceId
2211
2249
  }), {
2212
2250
  F: __dxlog_file10,
2213
- L: 213,
2251
+ L: 214,
2214
2252
  S: this,
2215
2253
  C: (f, a) => f(...a)
2216
2254
  });
@@ -2218,7 +2256,7 @@ var DataSpaceManager = class extends Resource4 {
2218
2256
  async _close() {
2219
2257
  log8("close", void 0, {
2220
2258
  F: __dxlog_file10,
2221
- L: 218,
2259
+ L: 219,
2222
2260
  S: this,
2223
2261
  C: (f, a) => f(...a)
2224
2262
  });
@@ -2233,7 +2271,7 @@ var DataSpaceManager = class extends Resource4 {
2233
2271
  async createSpace() {
2234
2272
  invariant5(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
2235
2273
  F: __dxlog_file10,
2236
- L: 230,
2274
+ L: 231,
2237
2275
  S: this,
2238
2276
  A: [
2239
2277
  "this._lifecycleState === LifecycleState.OPEN",
@@ -2254,7 +2292,7 @@ var DataSpaceManager = class extends Resource4 {
2254
2292
  spaceKey
2255
2293
  }, {
2256
2294
  F: __dxlog_file10,
2257
- L: 242,
2295
+ L: 243,
2258
2296
  S: this,
2259
2297
  C: (f, a) => f(...a)
2260
2298
  });
@@ -2266,7 +2304,7 @@ var DataSpaceManager = class extends Resource4 {
2266
2304
  const memberCredential = credentials[1];
2267
2305
  invariant5(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2268
2306
  F: __dxlog_file10,
2269
- L: 252,
2307
+ L: 253,
2270
2308
  S: this,
2271
2309
  A: [
2272
2310
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2298,7 +2336,7 @@ var DataSpaceManager = class extends Resource4 {
2298
2336
  spaceId: space.id
2299
2337
  }, {
2300
2338
  F: __dxlog_file10,
2301
- L: 277,
2339
+ L: 278,
2302
2340
  S: this,
2303
2341
  C: (f, a) => f(...a)
2304
2342
  });
@@ -2319,7 +2357,7 @@ var DataSpaceManager = class extends Resource4 {
2319
2357
  keys: []
2320
2358
  }
2321
2359
  };
2322
- const propertiesId = generateEchoId();
2360
+ const propertiesId = createObjectId();
2323
2361
  document.change((doc) => {
2324
2362
  setDeep(doc, [
2325
2363
  "objects",
@@ -2333,7 +2371,7 @@ var DataSpaceManager = class extends Resource4 {
2333
2371
  const automergeIndex = space.automergeSpaceState.rootUrl;
2334
2372
  invariant5(automergeIndex, void 0, {
2335
2373
  F: __dxlog_file10,
2336
- L: 310,
2374
+ L: 311,
2337
2375
  S: this,
2338
2376
  A: [
2339
2377
  "automergeIndex",
@@ -2350,13 +2388,13 @@ var DataSpaceManager = class extends Resource4 {
2350
2388
  opts
2351
2389
  }, {
2352
2390
  F: __dxlog_file10,
2353
- L: 319,
2391
+ L: 320,
2354
2392
  S: this,
2355
2393
  C: (f, a) => f(...a)
2356
2394
  });
2357
2395
  invariant5(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
2358
2396
  F: __dxlog_file10,
2359
- L: 320,
2397
+ L: 321,
2360
2398
  S: this,
2361
2399
  A: [
2362
2400
  "this._lifecycleState === LifecycleState.OPEN",
@@ -2365,7 +2403,7 @@ var DataSpaceManager = class extends Resource4 {
2365
2403
  });
2366
2404
  invariant5(!this._spaces.has(opts.spaceKey), "Space already exists.", {
2367
2405
  F: __dxlog_file10,
2368
- L: 321,
2406
+ L: 322,
2369
2407
  S: this,
2370
2408
  A: [
2371
2409
  "!this._spaces.has(opts.spaceKey)",
@@ -2389,7 +2427,7 @@ var DataSpaceManager = class extends Resource4 {
2389
2427
  const space = this._spaceManager.spaces.get(options.spaceKey);
2390
2428
  invariant5(space, void 0, {
2391
2429
  F: __dxlog_file10,
2392
- L: 341,
2430
+ L: 342,
2393
2431
  S: this,
2394
2432
  A: [
2395
2433
  "space",
@@ -2402,7 +2440,7 @@ var DataSpaceManager = class extends Resource4 {
2402
2440
  const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
2403
2441
  invariant5(credentials[0].credential, void 0, {
2404
2442
  F: __dxlog_file10,
2405
- L: 360,
2443
+ L: 361,
2406
2444
  S: this,
2407
2445
  A: [
2408
2446
  "credentials[0].credential",
@@ -2412,7 +2450,7 @@ var DataSpaceManager = class extends Resource4 {
2412
2450
  const spaceMemberCredential = credentials[0].credential.credential;
2413
2451
  invariant5(getCredentialAssertion2(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2414
2452
  F: __dxlog_file10,
2415
- L: 362,
2453
+ L: 363,
2416
2454
  S: this,
2417
2455
  A: [
2418
2456
  "getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2450,7 +2488,7 @@ var DataSpaceManager = class extends Resource4 {
2450
2488
  const space = this._spaces.get(spaceKey);
2451
2489
  invariant5(space, "Space not found.", {
2452
2490
  F: __dxlog_file10,
2453
- L: 399,
2491
+ L: 400,
2454
2492
  S: this,
2455
2493
  A: [
2456
2494
  "space",
@@ -2475,7 +2513,7 @@ var DataSpaceManager = class extends Resource4 {
2475
2513
  metadata
2476
2514
  }, {
2477
2515
  F: __dxlog_file10,
2478
- L: 418,
2516
+ L: 419,
2479
2517
  S: this,
2480
2518
  C: (f, a) => f(...a)
2481
2519
  });
@@ -2519,7 +2557,7 @@ var DataSpaceManager = class extends Resource4 {
2519
2557
  err
2520
2558
  }, {
2521
2559
  F: __dxlog_file10,
2522
- L: 460,
2560
+ L: 461,
2523
2561
  S: this,
2524
2562
  C: (f, a) => f(...a)
2525
2563
  });
@@ -2529,7 +2567,7 @@ var DataSpaceManager = class extends Resource4 {
2529
2567
  onAuthFailure: () => {
2530
2568
  log8.warn("auth failure", void 0, {
2531
2569
  F: __dxlog_file10,
2532
- L: 465,
2570
+ L: 466,
2533
2571
  S: this,
2534
2572
  C: (f, a) => f(...a)
2535
2573
  });
@@ -2562,7 +2600,7 @@ var DataSpaceManager = class extends Resource4 {
2562
2600
  space: space.key
2563
2601
  }, {
2564
2602
  F: __dxlog_file10,
2565
- L: 492,
2603
+ L: 493,
2566
2604
  S: this,
2567
2605
  C: (f, a) => f(...a)
2568
2606
  });
@@ -2573,7 +2611,7 @@ var DataSpaceManager = class extends Resource4 {
2573
2611
  open: this._lifecycleState === LifecycleState.OPEN
2574
2612
  }, {
2575
2613
  F: __dxlog_file10,
2576
- L: 495,
2614
+ L: 496,
2577
2615
  S: this,
2578
2616
  C: (f, a) => f(...a)
2579
2617
  });
@@ -2592,7 +2630,7 @@ var DataSpaceManager = class extends Resource4 {
2592
2630
  space: space.key
2593
2631
  }, {
2594
2632
  F: __dxlog_file10,
2595
- L: 503,
2633
+ L: 504,
2596
2634
  S: this,
2597
2635
  C: (f, a) => f(...a)
2598
2636
  });
@@ -2601,7 +2639,8 @@ var DataSpaceManager = class extends Resource4 {
2601
2639
  cache: metadata.cache,
2602
2640
  edgeConnection: this._edgeConnection,
2603
2641
  edgeHttpClient: this._edgeHttpClient,
2604
- edgeFeatures: this._edgeFeatures
2642
+ edgeFeatures: this._edgeFeatures,
2643
+ activeEdgeNotarizationPollingInterval: this._runtimeParams?.activeEdgeNotarizationPollingInterval
2605
2644
  });
2606
2645
  dataSpace.postOpen.append(async () => {
2607
2646
  const setting = dataSpace.getEdgeReplicationSetting();
@@ -2612,7 +2651,7 @@ var DataSpaceManager = class extends Resource4 {
2612
2651
  spaceId: dataSpace.id
2613
2652
  }, {
2614
2653
  F: __dxlog_file10,
2615
- L: 516,
2654
+ L: 518,
2616
2655
  S: this,
2617
2656
  C: (f, a) => f(...a)
2618
2657
  });
@@ -2642,7 +2681,7 @@ var DataSpaceManager = class extends Resource4 {
2642
2681
  space: space.key
2643
2682
  }, {
2644
2683
  F: __dxlog_file10,
2645
- L: 543,
2684
+ L: 545,
2646
2685
  S: this,
2647
2686
  C: (f, a) => f(...a)
2648
2687
  });
@@ -2675,7 +2714,7 @@ var DataSpaceManager = class extends Resource4 {
2675
2714
  closedSessions
2676
2715
  }, {
2677
2716
  F: __dxlog_file10,
2678
- L: 569,
2717
+ L: 571,
2679
2718
  S: this,
2680
2719
  C: (f, a) => f(...a)
2681
2720
  });
@@ -2690,7 +2729,7 @@ var DataSpaceManager = class extends Resource4 {
2690
2729
  peerId: peerState.peerId
2691
2730
  }, {
2692
2731
  F: __dxlog_file10,
2693
- L: 583,
2732
+ L: 585,
2694
2733
  S: this,
2695
2734
  C: (f, a) => f(...a)
2696
2735
  });
@@ -3195,6 +3234,9 @@ var Identity = class {
3195
3234
  get controlPipeline() {
3196
3235
  return this.space.controlPipeline;
3197
3236
  }
3237
+ get haloSpaceId() {
3238
+ return this.space.id;
3239
+ }
3198
3240
  get haloSpaceKey() {
3199
3241
  return this.space.key;
3200
3242
  }
@@ -3217,7 +3259,7 @@ var Identity = class {
3217
3259
  getIdentityCredentialSigner() {
3218
3260
  invariant7(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
3219
3261
  F: __dxlog_file12,
3220
- L: 191,
3262
+ L: 195,
3221
3263
  S: this,
3222
3264
  A: [
3223
3265
  "this._deviceStateMachine.deviceCredentialChain",
@@ -3261,7 +3303,7 @@ var Identity = class {
3261
3303
  dataFeedKey
3262
3304
  }, {
3263
3305
  F: __dxlog_file12,
3264
- L: 216,
3306
+ L: 220,
3265
3307
  S: this,
3266
3308
  C: (f, a) => f(...a)
3267
3309
  });
@@ -4024,7 +4066,7 @@ var DataSpace = class {
4024
4066
  constructor(params) {
4025
4067
  this._ctx = new Context5(void 0, {
4026
4068
  F: __dxlog_file15,
4027
- L: 95
4069
+ L: 96
4028
4070
  });
4029
4071
  this._cache = void 0;
4030
4072
  this._edgeFeedReplicator = void 0;
@@ -4057,7 +4099,8 @@ var DataSpace = class {
4057
4099
  this._notarizationPlugin = new NotarizationPlugin({
4058
4100
  spaceId: this._inner.id,
4059
4101
  edgeClient: params.edgeHttpClient,
4060
- edgeFeatures: params.edgeFeatures
4102
+ edgeFeatures: params.edgeFeatures,
4103
+ activeEdgePollingInterval: params.activeEdgeNotarizationPollingInterval
4061
4104
  });
4062
4105
  this.authVerifier = new TrustedKeySetAuthVerifier({
4063
4106
  trustedKeysProvider: () => new ComplexSet3(PublicKey8.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => member.role !== SpaceMember5.Role.REMOVED).map((member) => member.key)),
@@ -4076,7 +4119,7 @@ var DataSpace = class {
4076
4119
  state: SpaceState4[this._state]
4077
4120
  }, {
4078
4121
  F: __dxlog_file15,
4079
- L: 170,
4122
+ L: 172,
4080
4123
  S: this,
4081
4124
  C: (f, a) => f(...a)
4082
4125
  });
@@ -4135,7 +4178,7 @@ var DataSpace = class {
4135
4178
  }
4136
4179
  await this._inner.open(new Context5(void 0, {
4137
4180
  F: __dxlog_file15,
4138
- L: 244
4181
+ L: 246
4139
4182
  }));
4140
4183
  await this._inner.startProtocol();
4141
4184
  await this._edgeFeedReplicator?.open();
@@ -4144,7 +4187,7 @@ var DataSpace = class {
4144
4187
  state: SpaceState4[this._state]
4145
4188
  }, {
4146
4189
  F: __dxlog_file15,
4147
- L: 250,
4190
+ L: 252,
4148
4191
  S: this,
4149
4192
  C: (f, a) => f(...a)
4150
4193
  });
@@ -4164,14 +4207,14 @@ var DataSpace = class {
4164
4207
  state: SpaceState4[this._state]
4165
4208
  }, {
4166
4209
  F: __dxlog_file15,
4167
- L: 269,
4210
+ L: 271,
4168
4211
  S: this,
4169
4212
  C: (f, a) => f(...a)
4170
4213
  });
4171
4214
  await this._ctx.dispose();
4172
4215
  this._ctx = new Context5(void 0, {
4173
4216
  F: __dxlog_file15,
4174
- L: 271
4217
+ L: 273
4175
4218
  });
4176
4219
  if (this._edgeFeedReplicator) {
4177
4220
  this.inner.protocol.feedAdded.remove(this._onFeedAdded);
@@ -4204,7 +4247,7 @@ var DataSpace = class {
4204
4247
  if (err instanceof CancelledError || err instanceof ContextDisposedError) {
4205
4248
  log13("data pipeline initialization cancelled", err, {
4206
4249
  F: __dxlog_file15,
4207
- L: 309,
4250
+ L: 311,
4208
4251
  S: this,
4209
4252
  C: (f, a) => f(...a)
4210
4253
  });
@@ -4212,7 +4255,7 @@ var DataSpace = class {
4212
4255
  }
4213
4256
  log13.error("Error initializing data pipeline", err, {
4214
4257
  F: __dxlog_file15,
4215
- L: 313,
4258
+ L: 315,
4216
4259
  S: this,
4217
4260
  C: (f, a) => f(...a)
4218
4261
  });
@@ -4221,7 +4264,7 @@ var DataSpace = class {
4221
4264
  state: SpaceState4[this._state]
4222
4265
  }, {
4223
4266
  F: __dxlog_file15,
4224
- L: 315,
4267
+ L: 317,
4225
4268
  S: this,
4226
4269
  C: (f, a) => f(...a)
4227
4270
  });
@@ -4241,13 +4284,13 @@ var DataSpace = class {
4241
4284
  state: SpaceState4[this._state]
4242
4285
  }, {
4243
4286
  F: __dxlog_file15,
4244
- L: 331,
4287
+ L: 333,
4245
4288
  S: this,
4246
4289
  C: (f, a) => f(...a)
4247
4290
  });
4248
4291
  log13("initializing control pipeline", void 0, {
4249
4292
  F: __dxlog_file15,
4250
- L: 333,
4293
+ L: 335,
4251
4294
  S: this,
4252
4295
  C: (f, a) => f(...a)
4253
4296
  });
@@ -4256,21 +4299,21 @@ var DataSpace = class {
4256
4299
  const ready = this.stateUpdate.waitForCondition(() => this._state === SpaceState4.SPACE_READY);
4257
4300
  log13("initializing automerge root", void 0, {
4258
4301
  F: __dxlog_file15,
4259
- L: 341,
4302
+ L: 343,
4260
4303
  S: this,
4261
4304
  C: (f, a) => f(...a)
4262
4305
  });
4263
4306
  this._automergeSpaceState.startProcessingRootDocs();
4264
4307
  log13("waiting for space to be ready", void 0, {
4265
4308
  F: __dxlog_file15,
4266
- L: 345,
4309
+ L: 347,
4267
4310
  S: this,
4268
4311
  C: (f, a) => f(...a)
4269
4312
  });
4270
4313
  await ready;
4271
4314
  log13("space is ready", void 0, {
4272
4315
  F: __dxlog_file15,
4273
- L: 347,
4316
+ L: 349,
4274
4317
  S: this,
4275
4318
  C: (f, a) => f(...a)
4276
4319
  });
@@ -4282,7 +4325,7 @@ var DataSpace = class {
4282
4325
  state: SpaceState4[this._state]
4283
4326
  }, {
4284
4327
  F: __dxlog_file15,
4285
- L: 354,
4328
+ L: 356,
4286
4329
  S: this,
4287
4330
  C: (f, a) => f(...a)
4288
4331
  });
@@ -4299,7 +4342,7 @@ var DataSpace = class {
4299
4342
  await this._createWritableFeeds();
4300
4343
  log13("writable feeds created", void 0, {
4301
4344
  F: __dxlog_file15,
4302
- L: 371,
4345
+ L: 373,
4303
4346
  S: this,
4304
4347
  C: (f, a) => f(...a)
4305
4348
  });
@@ -4353,7 +4396,7 @@ var DataSpace = class {
4353
4396
  count: credentials.length
4354
4397
  }, {
4355
4398
  F: __dxlog_file15,
4356
- L: 429,
4399
+ L: 431,
4357
4400
  S: this,
4358
4401
  C: (f, a) => f(...a)
4359
4402
  });
@@ -4364,14 +4407,14 @@ var DataSpace = class {
4364
4407
  });
4365
4408
  log13("credentials notarized", void 0, {
4366
4409
  F: __dxlog_file15,
4367
- L: 433,
4410
+ L: 435,
4368
4411
  S: this,
4369
4412
  C: (f, a) => f(...a)
4370
4413
  });
4371
4414
  } catch (err) {
4372
4415
  log13.error("error notarizing credentials for feed admission", err, {
4373
4416
  F: __dxlog_file15,
4374
- L: 435,
4417
+ L: 437,
4375
4418
  S: this,
4376
4419
  C: (f, a) => f(...a)
4377
4420
  });
@@ -4386,7 +4429,7 @@ var DataSpace = class {
4386
4429
  rootUrl
4387
4430
  }, {
4388
4431
  F: __dxlog_file15,
4389
- L: 445,
4432
+ L: 447,
4390
4433
  S: this,
4391
4434
  C: (f, a) => f(...a)
4392
4435
  });
@@ -4438,7 +4481,7 @@ var DataSpace = class {
4438
4481
  err
4439
4482
  }, {
4440
4483
  F: __dxlog_file15,
4441
- L: 488,
4484
+ L: 490,
4442
4485
  S: this,
4443
4486
  C: (f, a) => f(...a)
4444
4487
  });
@@ -4528,7 +4571,7 @@ var DataSpace = class {
4528
4571
  state: SpaceState4[this._state]
4529
4572
  }, {
4530
4573
  F: __dxlog_file15,
4531
- L: 570,
4574
+ L: 572,
4532
4575
  S: this,
4533
4576
  C: (f, a) => f(...a)
4534
4577
  });
@@ -4714,7 +4757,7 @@ var DeviceInvitationProtocol = class {
4714
4757
  import { scheduleTask as scheduleTask7, TimeoutError as TimeoutError2 } from "@dxos/async";
4715
4758
  import { INVITATION_TIMEOUT } from "@dxos/client-protocol";
4716
4759
  import { ContextDisposedError as ContextDisposedError3 } from "@dxos/context";
4717
- import { createKeyPair, sign } from "@dxos/crypto";
4760
+ import { createKeyPair, sign as sign2 } from "@dxos/crypto";
4718
4761
  import { invariant as invariant15 } from "@dxos/invariant";
4719
4762
  import { PublicKey as PublicKey11 } from "@dxos/keys";
4720
4763
  import { log as log19 } from "@dxos/log";
@@ -4728,7 +4771,7 @@ import { ComplexSet as ComplexSet5 } from "@dxos/util";
4728
4771
 
4729
4772
  // packages/sdk/client-services/src/packlets/invitations/edge-invitation-handler.ts
4730
4773
  import { scheduleMicroTask as scheduleMicroTask3, scheduleTask as scheduleTask5 } from "@dxos/async";
4731
- import { ed25519Signature } from "@dxos/crypto";
4774
+ import { sign } from "@dxos/crypto";
4732
4775
  import { invariant as invariant11 } from "@dxos/invariant";
4733
4776
  import { SpaceId as SpaceId2 } from "@dxos/keys";
4734
4777
  import { log as log14 } from "@dxos/log";
@@ -4885,15 +4928,16 @@ var EdgeInvitationHandler = class {
4885
4928
  return await this._client.joinSpaceByInvitation(spaceId, request);
4886
4929
  } catch (error) {
4887
4930
  if (error instanceof EdgeAuthChallengeError) {
4888
- guardedState.set(this, Invitation4.State.AUTHENTICATING);
4889
4931
  const publicKey = guardedState.current.guestKeypair?.publicKey;
4890
4932
  const privateKey = guardedState.current.guestKeypair?.privateKey;
4891
4933
  if (!privateKey || !publicKey) {
4892
4934
  throw error;
4893
4935
  }
4894
- const signature = await ed25519Signature(privateKey, Buffer.from(error.challenge, "base64"));
4895
- request.signature = Buffer.from(signature).toString("base64");
4896
- return this._client.joinSpaceByInvitation(spaceId, request);
4936
+ const signature = sign(Buffer.from(error.challenge, "base64"), privateKey);
4937
+ return this._client.joinSpaceByInvitation(spaceId, {
4938
+ ...request,
4939
+ signature: Buffer.from(signature).toString("base64")
4940
+ });
4897
4941
  } else {
4898
4942
  throw error;
4899
4943
  }
@@ -5968,7 +6012,7 @@ var InvitationsHandler = class {
5968
6012
  const edgeInvitationHandler = new EdgeInvitationHandler(this._connectionParams?.edgeInvitations, this._edgeClient, {
5969
6013
  onInvitationSuccess: async (admissionResponse, admissionRequest) => {
5970
6014
  const result = await protocol.accept(admissionResponse, admissionRequest);
5971
- log19("admitted by edge", {
6015
+ log19.info("admitted by edge", {
5972
6016
  ...protocol.toJSON()
5973
6017
  }, {
5974
6018
  F: __dxlog_file22,
@@ -6085,8 +6129,7 @@ var InvitationsHandler = class {
6085
6129
  S: this,
6086
6130
  C: (f, a) => f(...a)
6087
6131
  });
6088
- setState(Invitation7.State.AUTHENTICATING);
6089
- const signature = sign(Buffer.from(introductionResponse.challenge), invitation.guestKeypair.privateKey);
6132
+ const signature = sign2(Buffer.from(introductionResponse.challenge), invitation.guestKeypair.privateKey);
6090
6133
  const response = await extension.rpc.InvitationHostService.authenticate({
6091
6134
  signedChallenge: signature
6092
6135
  });
@@ -7049,24 +7092,282 @@ ClientRpcServer = _ts_decorate8([
7049
7092
  trace8.resource()
7050
7093
  ], ClientRpcServer);
7051
7094
 
7095
+ // packages/sdk/client-services/src/packlets/agents/edge-agent-manager.ts
7096
+ import { DeferredTask as DeferredTask2, Event as Event9, scheduleTask as scheduleTask8, synchronized as synchronized3 } from "@dxos/async";
7097
+ import { Resource as Resource6 } from "@dxos/context";
7098
+ import { invariant as invariant18 } from "@dxos/invariant";
7099
+ import { PublicKey as PublicKey13 } from "@dxos/keys";
7100
+ import { log as log23 } from "@dxos/log";
7101
+ import { EdgeAgentStatus, EdgeCallFailedError as EdgeCallFailedError3 } from "@dxos/protocols";
7102
+ import { SpaceState as SpaceState5 } from "@dxos/protocols/proto/dxos/client/services";
7103
+ function _ts_decorate9(decorators, target, key, desc) {
7104
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7105
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7106
+ 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;
7107
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7108
+ }
7109
+ var __dxlog_file26 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/agents/edge-agent-manager.ts";
7110
+ var AGENT_STATUS_QUERY_RETRY_INTERVAL = 5e3;
7111
+ var AGENT_STATUS_QUERY_RETRY_JITTER = 1e3;
7112
+ var EdgeAgentManager = class extends Resource6 {
7113
+ constructor(_edgeFeatures, _edgeHttpClient, _dataSpaceManager, _identity) {
7114
+ super();
7115
+ this._edgeFeatures = _edgeFeatures;
7116
+ this._edgeHttpClient = _edgeHttpClient;
7117
+ this._dataSpaceManager = _dataSpaceManager;
7118
+ this._identity = _identity;
7119
+ this.agentStatusChanged = new Event9();
7120
+ this._lastKnownDeviceCount = 0;
7121
+ }
7122
+ get agentStatus() {
7123
+ return this._agentStatus;
7124
+ }
7125
+ get agentExists() {
7126
+ return this._agentStatus && this._agentStatus !== EdgeAgentStatus.NOT_FOUND;
7127
+ }
7128
+ async createAgent() {
7129
+ invariant18(this.isOpen, void 0, {
7130
+ F: __dxlog_file26,
7131
+ L: 52,
7132
+ S: this,
7133
+ A: [
7134
+ "this.isOpen",
7135
+ ""
7136
+ ]
7137
+ });
7138
+ invariant18(this._edgeHttpClient, void 0, {
7139
+ F: __dxlog_file26,
7140
+ L: 53,
7141
+ S: this,
7142
+ A: [
7143
+ "this._edgeHttpClient",
7144
+ ""
7145
+ ]
7146
+ });
7147
+ invariant18(this._edgeFeatures?.agents, void 0, {
7148
+ F: __dxlog_file26,
7149
+ L: 54,
7150
+ S: this,
7151
+ A: [
7152
+ "this._edgeFeatures?.agents",
7153
+ ""
7154
+ ]
7155
+ });
7156
+ const response = await this._edgeHttpClient.createAgent({
7157
+ identityKey: this._identity.identityKey.toHex(),
7158
+ haloSpaceId: this._identity.haloSpaceId,
7159
+ haloSpaceKey: this._identity.haloSpaceKey.toHex()
7160
+ });
7161
+ const deviceKey = PublicKey13.fromHex(response.deviceKey);
7162
+ await this._identity.admitDevice({
7163
+ deviceKey,
7164
+ controlFeedKey: PublicKey13.fromHex(response.feedKey),
7165
+ // TODO: agents don't have data feed, should be removed
7166
+ dataFeedKey: PublicKey13.random()
7167
+ });
7168
+ log23("agent created", response, {
7169
+ F: __dxlog_file26,
7170
+ L: 71,
7171
+ S: this,
7172
+ C: (f, a) => f(...a)
7173
+ });
7174
+ this._updateStatus(EdgeAgentStatus.ACTIVE, deviceKey);
7175
+ }
7176
+ async _open() {
7177
+ const isEnabled = this._edgeHttpClient && this._edgeFeatures?.agents;
7178
+ log23("edge agent manager open", {
7179
+ isEnabled
7180
+ }, {
7181
+ F: __dxlog_file26,
7182
+ L: 79,
7183
+ S: this,
7184
+ C: (f, a) => f(...a)
7185
+ });
7186
+ if (!isEnabled) {
7187
+ return;
7188
+ }
7189
+ this._lastKnownDeviceCount = this._identity.authorizedDeviceKeys.size;
7190
+ this._fetchAgentStatusTask = new DeferredTask2(this._ctx, async () => {
7191
+ await this._fetchAgentStatus();
7192
+ });
7193
+ this._fetchAgentStatusTask.schedule();
7194
+ this._dataSpaceManager.updated.on(this._ctx, () => {
7195
+ if (this._agentDeviceKey) {
7196
+ this._ensureAgentIsInSpaces(this._agentDeviceKey);
7197
+ }
7198
+ });
7199
+ this._identity.stateUpdate.on(this._ctx, () => {
7200
+ const maybeAgentWasCreated = this._identity.authorizedDeviceKeys.size > this._lastKnownDeviceCount;
7201
+ if (this.agentExists || !maybeAgentWasCreated) {
7202
+ return;
7203
+ }
7204
+ this._lastKnownDeviceCount = this._identity.authorizedDeviceKeys.size;
7205
+ this._fetchAgentStatusTask?.schedule();
7206
+ });
7207
+ }
7208
+ async _close() {
7209
+ this._fetchAgentStatusTask = void 0;
7210
+ this._lastKnownDeviceCount = 0;
7211
+ }
7212
+ async _fetchAgentStatus() {
7213
+ invariant18(this._edgeHttpClient, void 0, {
7214
+ F: __dxlog_file26,
7215
+ L: 113,
7216
+ S: this,
7217
+ A: [
7218
+ "this._edgeHttpClient",
7219
+ ""
7220
+ ]
7221
+ });
7222
+ try {
7223
+ log23("fetching agent status", void 0, {
7224
+ F: __dxlog_file26,
7225
+ L: 115,
7226
+ S: this,
7227
+ C: (f, a) => f(...a)
7228
+ });
7229
+ const { agent } = await this._edgeHttpClient.getAgentStatus({
7230
+ ownerIdentityKey: this._identity.identityKey
7231
+ });
7232
+ const wasAgentCreatedDuringQuery = this._agentStatus === EdgeAgentStatus.ACTIVE;
7233
+ if (!wasAgentCreatedDuringQuery) {
7234
+ const deviceKey = agent.deviceKey ? PublicKey13.fromHex(agent.deviceKey) : void 0;
7235
+ this._updateStatus(agent.status, deviceKey);
7236
+ }
7237
+ } catch (err) {
7238
+ if (err instanceof EdgeCallFailedError3) {
7239
+ if (!err.isRetryable) {
7240
+ log23.warn("non retryable error on agent status fetch attempt", {
7241
+ err
7242
+ }, {
7243
+ F: __dxlog_file26,
7244
+ L: 125,
7245
+ S: this,
7246
+ C: (f, a) => f(...a)
7247
+ });
7248
+ return;
7249
+ }
7250
+ }
7251
+ const retryAfterMs = AGENT_STATUS_QUERY_RETRY_INTERVAL + Math.random() * AGENT_STATUS_QUERY_RETRY_JITTER;
7252
+ log23.info("agent status fetching failed", {
7253
+ err,
7254
+ retryAfterMs
7255
+ }, {
7256
+ F: __dxlog_file26,
7257
+ L: 130,
7258
+ S: this,
7259
+ C: (f, a) => f(...a)
7260
+ });
7261
+ scheduleTask8(this._ctx, () => this._fetchAgentStatusTask?.schedule(), retryAfterMs);
7262
+ }
7263
+ }
7264
+ /**
7265
+ * We don't want notarization plugin to always actively poll edge looking for credentials to notarize,
7266
+ * because most of the time we'll be getting an empty response.
7267
+ * Instead, we stay in active polling mode while there are spaces where we don't see our agent's feed.
7268
+ */
7269
+ _ensureAgentIsInSpaces(agentDeviceKey) {
7270
+ for (const space of this._dataSpaceManager.spaces.values()) {
7271
+ if ([
7272
+ SpaceState5.SPACE_INACTIVE,
7273
+ SpaceState5.SPACE_CLOSED
7274
+ ].includes(space.state)) {
7275
+ continue;
7276
+ }
7277
+ const agentFeedNeedsNotarization = !space.inner.spaceState.feeds.values().some((feed) => feed.assertion.deviceKey.equals(agentDeviceKey));
7278
+ space.notarizationPlugin.setActiveEdgePollingEnabled(agentFeedNeedsNotarization);
7279
+ log23.info("set active edge polling", {
7280
+ enabled: agentFeedNeedsNotarization,
7281
+ spaceId: space.id
7282
+ }, {
7283
+ F: __dxlog_file26,
7284
+ L: 150,
7285
+ S: this,
7286
+ C: (f, a) => f(...a)
7287
+ });
7288
+ }
7289
+ }
7290
+ _updateStatus(status, deviceKey) {
7291
+ this._agentStatus = status;
7292
+ this._agentDeviceKey = deviceKey;
7293
+ this.agentStatusChanged.emit(status);
7294
+ if (deviceKey) {
7295
+ this._ensureAgentIsInSpaces(deviceKey);
7296
+ }
7297
+ log23.info("agent status update", {
7298
+ status
7299
+ }, {
7300
+ F: __dxlog_file26,
7301
+ L: 161,
7302
+ S: this,
7303
+ C: (f, a) => f(...a)
7304
+ });
7305
+ }
7306
+ };
7307
+ _ts_decorate9([
7308
+ synchronized3
7309
+ ], EdgeAgentManager.prototype, "createAgent", null);
7310
+
7311
+ // packages/sdk/client-services/src/packlets/agents/edge-agent-service.ts
7312
+ import { Stream as Stream11 } from "@dxos/codec-protobuf";
7313
+ import { EdgeAgentStatus as EdgeAgentStatus2 } from "@dxos/protocols";
7314
+ import { QueryAgentStatusResponse } from "@dxos/protocols/proto/dxos/client/services";
7315
+ var EdgeAgentServiceImpl = class {
7316
+ constructor(_agentManagerProvider) {
7317
+ this._agentManagerProvider = _agentManagerProvider;
7318
+ }
7319
+ async createAgent() {
7320
+ return (await this._agentManagerProvider()).createAgent();
7321
+ }
7322
+ queryAgentStatus() {
7323
+ return new Stream11(({ ctx, next }) => {
7324
+ next({
7325
+ status: QueryAgentStatusResponse.AgentStatus.UNKNOWN
7326
+ });
7327
+ void this._agentManagerProvider().then((agentManager) => {
7328
+ next({
7329
+ status: mapStatus(agentManager.agentStatus)
7330
+ });
7331
+ agentManager.agentStatusChanged.on(ctx, (newStatus) => {
7332
+ next({
7333
+ status: mapStatus(newStatus)
7334
+ });
7335
+ });
7336
+ });
7337
+ });
7338
+ }
7339
+ };
7340
+ var mapStatus = (agentStatus) => {
7341
+ switch (agentStatus) {
7342
+ case EdgeAgentStatus2.ACTIVE:
7343
+ return QueryAgentStatusResponse.AgentStatus.ACTIVE;
7344
+ case EdgeAgentStatus2.INACTIVE:
7345
+ return QueryAgentStatusResponse.AgentStatus.INACTIVE;
7346
+ case EdgeAgentStatus2.NOT_FOUND:
7347
+ return QueryAgentStatusResponse.AgentStatus.NOT_FOUND;
7348
+ case void 0:
7349
+ return QueryAgentStatusResponse.AgentStatus.UNKNOWN;
7350
+ }
7351
+ };
7352
+
7052
7353
  // packages/sdk/client-services/src/packlets/services/service-context.ts
7053
7354
  import { Mutex as Mutex4, Trigger as Trigger9 } from "@dxos/async";
7054
- import { Context as Context9, Resource as Resource6 } from "@dxos/context";
7355
+ import { Context as Context9, Resource as Resource7 } from "@dxos/context";
7055
7356
  import { getCredentialAssertion as getCredentialAssertion6 } from "@dxos/credentials";
7056
7357
  import { failUndefined as failUndefined2, warnAfterTimeout as warnAfterTimeout2 } from "@dxos/debug";
7057
7358
  import { EchoEdgeReplicator, EchoHost, MeshEchoReplicator, MetadataStore, SpaceManager, valueEncoding } from "@dxos/echo-pipeline";
7058
7359
  import { createChainEdgeIdentity, createEphemeralEdgeIdentity } from "@dxos/edge-client";
7059
7360
  import { FeedFactory, FeedStore } from "@dxos/feed-store";
7060
- import { invariant as invariant18 } from "@dxos/invariant";
7361
+ import { invariant as invariant19 } from "@dxos/invariant";
7061
7362
  import { Keyring } from "@dxos/keyring";
7062
- import { PublicKey as PublicKey13 } from "@dxos/keys";
7063
- import { log as log23 } from "@dxos/log";
7363
+ import { PublicKey as PublicKey14 } from "@dxos/keys";
7364
+ import { log as log24 } from "@dxos/log";
7064
7365
  import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace9 } from "@dxos/protocols";
7065
7366
  import { Invitation as Invitation10 } from "@dxos/protocols/proto/dxos/client/services";
7066
7367
  import { BlobStore } from "@dxos/teleport-extension-object-sync";
7067
7368
  import { trace as Trace3 } from "@dxos/tracing";
7068
7369
  import { safeInstanceof } from "@dxos/util";
7069
- function _ts_decorate9(decorators, target, key, desc) {
7370
+ function _ts_decorate10(decorators, target, key, desc) {
7070
7371
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7071
7372
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7072
7373
  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;
@@ -7134,8 +7435,8 @@ function _using_ctx3() {
7134
7435
  }
7135
7436
  };
7136
7437
  }
7137
- var __dxlog_file26 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
7138
- var ServiceContext = class extends Resource6 {
7438
+ var __dxlog_file27 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
7439
+ var ServiceContext = class extends Resource7 {
7139
7440
  constructor(storage, level, networkManager, signalManager, _edgeConnection, _edgeHttpClient, _runtimeParams, _edgeFeatures) {
7140
7441
  super();
7141
7442
  this.storage = storage;
@@ -7151,7 +7452,7 @@ var ServiceContext = class extends Resource6 {
7151
7452
  this._meshReplicator = void 0;
7152
7453
  this._echoEdgeReplicator = void 0;
7153
7454
  this._handlerFactories = /* @__PURE__ */ new Map();
7154
- this._instanceId = PublicKey13.random().toHex();
7455
+ this._instanceId = PublicKey14.random().toHex();
7155
7456
  this.metadataStore = new MetadataStore(storage.createDirectory("metadata"));
7156
7457
  this.blobStore = new BlobStore(storage.createDirectory("blobs"));
7157
7458
  this.keyring = new Keyring(storage.createDirectory("keyring"));
@@ -7200,17 +7501,17 @@ var ServiceContext = class extends Resource6 {
7200
7501
  }
7201
7502
  async _open(ctx) {
7202
7503
  await this._checkStorageVersion();
7203
- log23("opening...", void 0, {
7204
- F: __dxlog_file26,
7205
- L: 184,
7504
+ log24("opening...", void 0, {
7505
+ F: __dxlog_file27,
7506
+ L: 186,
7206
7507
  S: this,
7207
7508
  C: (f, a) => f(...a)
7208
7509
  });
7209
- log23.trace("dxos.sdk.service-context.open", trace9.begin({
7510
+ log24.trace("dxos.sdk.service-context.open", trace9.begin({
7210
7511
  id: this._instanceId
7211
7512
  }), {
7212
- F: __dxlog_file26,
7213
- L: 185,
7513
+ F: __dxlog_file27,
7514
+ L: 187,
7214
7515
  S: this,
7215
7516
  C: (f, a) => f(...a)
7216
7517
  });
@@ -7233,33 +7534,33 @@ var ServiceContext = class extends Resource6 {
7233
7534
  await this._initialize(ctx);
7234
7535
  }
7235
7536
  const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
7236
- log23("loaded persistent invitations", {
7537
+ log24("loaded persistent invitations", {
7237
7538
  count: loadedInvitations.invitations?.length
7238
7539
  }, {
7239
- F: __dxlog_file26,
7240
- L: 213,
7540
+ F: __dxlog_file27,
7541
+ L: 215,
7241
7542
  S: this,
7242
7543
  C: (f, a) => f(...a)
7243
7544
  });
7244
- log23.trace("dxos.sdk.service-context.open", trace9.end({
7545
+ log24.trace("dxos.sdk.service-context.open", trace9.end({
7245
7546
  id: this._instanceId
7246
7547
  }), {
7247
- F: __dxlog_file26,
7248
- L: 215,
7548
+ F: __dxlog_file27,
7549
+ L: 217,
7249
7550
  S: this,
7250
7551
  C: (f, a) => f(...a)
7251
7552
  });
7252
- log23("opened", void 0, {
7253
- F: __dxlog_file26,
7254
- L: 216,
7553
+ log24("opened", void 0, {
7554
+ F: __dxlog_file27,
7555
+ L: 218,
7255
7556
  S: this,
7256
7557
  C: (f, a) => f(...a)
7257
7558
  });
7258
7559
  }
7259
7560
  async _close(ctx) {
7260
- log23("closing...", void 0, {
7261
- F: __dxlog_file26,
7262
- L: 220,
7561
+ log24("closing...", void 0, {
7562
+ F: __dxlog_file27,
7563
+ L: 222,
7263
7564
  S: this,
7264
7565
  C: (f, a) => f(...a)
7265
7566
  });
@@ -7267,6 +7568,7 @@ var ServiceContext = class extends Resource6 {
7267
7568
  await this.identityManager.identity.space.spaceState.removeCredentialProcessor(this._deviceSpaceSync);
7268
7569
  }
7269
7570
  await this.dataSpaceManager?.close();
7571
+ await this.edgeAgentManager?.close();
7270
7572
  await this.identityManager.close();
7271
7573
  await this.spaceManager.close();
7272
7574
  await this.feedStore.close();
@@ -7275,9 +7577,9 @@ var ServiceContext = class extends Resource6 {
7275
7577
  await this.networkManager.close();
7276
7578
  await this.signalManager.close();
7277
7579
  await this._edgeConnection?.close();
7278
- log23("closed", void 0, {
7279
- F: __dxlog_file26,
7280
- L: 235,
7580
+ log24("closed", void 0, {
7581
+ F: __dxlog_file27,
7582
+ L: 238,
7281
7583
  S: this,
7282
7584
  C: (f, a) => f(...a)
7283
7585
  });
@@ -7287,16 +7589,16 @@ var ServiceContext = class extends Resource6 {
7287
7589
  await this._setNetworkIdentity();
7288
7590
  await identity.joinNetwork();
7289
7591
  await this._initialize(new Context9(void 0, {
7290
- F: __dxlog_file26,
7291
- L: 242
7592
+ F: __dxlog_file27,
7593
+ L: 245
7292
7594
  }));
7293
7595
  return identity;
7294
7596
  }
7295
7597
  getInvitationHandler(invitation) {
7296
7598
  const factory = this._handlerFactories.get(invitation.kind);
7297
- invariant18(factory, `Unknown invitation kind: ${invitation.kind}`, {
7298
- F: __dxlog_file26,
7299
- L: 248,
7599
+ invariant19(factory, `Unknown invitation kind: ${invitation.kind}`, {
7600
+ F: __dxlog_file27,
7601
+ L: 251,
7300
7602
  S: this,
7301
7603
  A: [
7302
7604
  "factory",
@@ -7321,8 +7623,8 @@ var ServiceContext = class extends Resource6 {
7321
7623
  await identity.joinNetwork();
7322
7624
  await this.identityManager.acceptIdentity(identity, identityRecord, params.deviceProfile);
7323
7625
  await this._initialize(new Context9(void 0, {
7324
- F: __dxlog_file26,
7325
- L: 267
7626
+ F: __dxlog_file27,
7627
+ L: 270
7326
7628
  }));
7327
7629
  return identity;
7328
7630
  }
@@ -7334,9 +7636,9 @@ var ServiceContext = class extends Resource6 {
7334
7636
  }
7335
7637
  // Called when identity is created.
7336
7638
  async _initialize(ctx) {
7337
- log23("initializing spaces...", void 0, {
7338
- F: __dxlog_file26,
7339
- L: 282,
7639
+ log24("initializing spaces...", void 0, {
7640
+ F: __dxlog_file27,
7641
+ L: 285,
7340
7642
  S: this,
7341
7643
  C: (f, a) => f(...a)
7342
7644
  });
@@ -7370,10 +7672,12 @@ var ServiceContext = class extends Resource6 {
7370
7672
  edgeFeatures: this._edgeFeatures
7371
7673
  });
7372
7674
  await this.dataSpaceManager.open();
7675
+ this.edgeAgentManager = new EdgeAgentManager(this._edgeFeatures, this._edgeHttpClient, this.dataSpaceManager, identity);
7676
+ await this.edgeAgentManager.open();
7373
7677
  this._handlerFactories.set(Invitation10.Kind.SPACE, (invitation) => {
7374
- invariant18(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
7375
- F: __dxlog_file26,
7376
- L: 312,
7678
+ invariant19(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
7679
+ F: __dxlog_file27,
7680
+ L: 323,
7377
7681
  S: this,
7378
7682
  A: [
7379
7683
  "this.dataSpaceManager",
@@ -7393,33 +7697,33 @@ var ServiceContext = class extends Resource6 {
7393
7697
  return;
7394
7698
  }
7395
7699
  if (!this.dataSpaceManager) {
7396
- log23("dataSpaceManager not initialized yet, ignoring space admission", {
7700
+ log24("dataSpaceManager not initialized yet, ignoring space admission", {
7397
7701
  details: assertion
7398
7702
  }, {
7399
- F: __dxlog_file26,
7400
- L: 328,
7703
+ F: __dxlog_file27,
7704
+ L: 339,
7401
7705
  S: this,
7402
7706
  C: (f, a) => f(...a)
7403
7707
  });
7404
7708
  return;
7405
7709
  }
7406
7710
  if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
7407
- log23("space already exists, ignoring space admission", {
7711
+ log24("space already exists, ignoring space admission", {
7408
7712
  details: assertion
7409
7713
  }, {
7410
- F: __dxlog_file26,
7411
- L: 332,
7714
+ F: __dxlog_file27,
7715
+ L: 343,
7412
7716
  S: this,
7413
7717
  C: (f, a) => f(...a)
7414
7718
  });
7415
7719
  return;
7416
7720
  }
7417
7721
  try {
7418
- log23("accepting space recorded in halo", {
7722
+ log24("accepting space recorded in halo", {
7419
7723
  details: assertion
7420
7724
  }, {
7421
- F: __dxlog_file26,
7422
- L: 337,
7725
+ F: __dxlog_file27,
7726
+ L: 348,
7423
7727
  S: this,
7424
7728
  C: (f, a) => f(...a)
7425
7729
  });
@@ -7428,9 +7732,9 @@ var ServiceContext = class extends Resource6 {
7428
7732
  genesisFeedKey: assertion.genesisFeedKey
7429
7733
  });
7430
7734
  } catch (err) {
7431
- log23.catch(err, void 0, {
7432
- F: __dxlog_file26,
7433
- L: 343,
7735
+ log24.catch(err, void 0, {
7736
+ F: __dxlog_file27,
7737
+ L: 354,
7434
7738
  S: this,
7435
7739
  C: (f, a) => f(...a)
7436
7740
  });
@@ -7446,12 +7750,12 @@ var ServiceContext = class extends Resource6 {
7446
7750
  let edgeIdentity;
7447
7751
  const identity = this.identityManager.identity;
7448
7752
  if (identity) {
7449
- log23.info("Setting identity on edge connection", {
7753
+ log24.info("Setting identity on edge connection", {
7450
7754
  identity: identity.identityKey.toHex(),
7451
7755
  swarms: this.networkManager.topics
7452
7756
  }, {
7453
- F: __dxlog_file26,
7454
- L: 357,
7757
+ F: __dxlog_file27,
7758
+ L: 368,
7455
7759
  S: this,
7456
7760
  C: (f, a) => f(...a)
7457
7761
  });
@@ -7463,9 +7767,9 @@ var ServiceContext = class extends Resource6 {
7463
7767
  await warnAfterTimeout2(1e4, "Waiting for identity to be ready for edge connection", async () => {
7464
7768
  await identity.ready();
7465
7769
  });
7466
- invariant18(identity.deviceCredentialChain, void 0, {
7467
- F: __dxlog_file26,
7468
- L: 375,
7770
+ invariant19(identity.deviceCredentialChain, void 0, {
7771
+ F: __dxlog_file27,
7772
+ L: 386,
7469
7773
  S: this,
7470
7774
  A: [
7471
7775
  "identity.deviceCredentialChain",
@@ -7491,13 +7795,13 @@ var ServiceContext = class extends Resource6 {
7491
7795
  }
7492
7796
  }
7493
7797
  };
7494
- _ts_decorate9([
7798
+ _ts_decorate10([
7495
7799
  Trace3.span()
7496
7800
  ], ServiceContext.prototype, "_open", null);
7497
- _ts_decorate9([
7801
+ _ts_decorate10([
7498
7802
  Trace3.span()
7499
7803
  ], ServiceContext.prototype, "_initialize", null);
7500
- ServiceContext = _ts_decorate9([
7804
+ ServiceContext = _ts_decorate10([
7501
7805
  safeInstanceof("dxos.client-services.ServiceContext"),
7502
7806
  Trace3.resource()
7503
7807
  ], ServiceContext);
@@ -7590,11 +7894,11 @@ var toStorageType = (type) => {
7590
7894
 
7591
7895
  // packages/sdk/client-services/src/packlets/storage/level.ts
7592
7896
  import path from "@dxos/node-std/path";
7593
- import { PublicKey as PublicKey14 } from "@dxos/keys";
7897
+ import { PublicKey as PublicKey15 } from "@dxos/keys";
7594
7898
  import { createLevel as createKV } from "@dxos/kv-store";
7595
7899
  var createLevel = async (config) => {
7596
7900
  const persistent = isPersistent(config);
7597
- const storagePath = persistent ? path.join(getRootPath(config), "level") : `/tmp/dxos-${PublicKey14.random().toHex()}`;
7901
+ const storagePath = persistent ? path.join(getRootPath(config), "level") : `/tmp/dxos-${PublicKey15.random().toHex()}`;
7598
7902
  const level = createKV(storagePath);
7599
7903
  await level.open();
7600
7904
  return level;
@@ -7602,11 +7906,11 @@ var createLevel = async (config) => {
7602
7906
 
7603
7907
  // packages/sdk/client-services/src/packlets/storage/profile-archive.ts
7604
7908
  import { cbor } from "@dxos/automerge/automerge-repo";
7605
- import { invariant as invariant19 } from "@dxos/invariant";
7606
- import { log as log24 } from "@dxos/log";
7909
+ import { invariant as invariant20 } from "@dxos/invariant";
7910
+ import { log as log25 } from "@dxos/log";
7607
7911
  import { ProfileArchiveEntryType } from "@dxos/protocols";
7608
7912
  import { arrayToBuffer as arrayToBuffer2 } from "@dxos/util";
7609
- var __dxlog_file27 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
7913
+ var __dxlog_file28 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
7610
7914
  var encodeProfileArchive = (profile) => cbor.encode(profile);
7611
7915
  var decodeProfileArchive = (data) => cbor.decode(data);
7612
7916
  var exportProfileData = async ({ storage, level }) => {
@@ -7619,10 +7923,10 @@ var exportProfileData = async ({ storage, level }) => {
7619
7923
  {
7620
7924
  const directory = await storage.createDirectory();
7621
7925
  const files = await directory.list();
7622
- log24.info("begin exporting files", {
7926
+ log25.info("begin exporting files", {
7623
7927
  count: files.length
7624
7928
  }, {
7625
- F: __dxlog_file27,
7929
+ F: __dxlog_file28,
7626
7930
  L: 30,
7627
7931
  S: void 0,
7628
7932
  C: (f, a) => f(...a)
@@ -7637,18 +7941,18 @@ var exportProfileData = async ({ storage, level }) => {
7637
7941
  value: data
7638
7942
  });
7639
7943
  }
7640
- log24.info("done exporting files", {
7944
+ log25.info("done exporting files", {
7641
7945
  count: files.length
7642
7946
  }, {
7643
- F: __dxlog_file27,
7947
+ F: __dxlog_file28,
7644
7948
  L: 41,
7645
7949
  S: void 0,
7646
7950
  C: (f, a) => f(...a)
7647
7951
  });
7648
7952
  }
7649
7953
  {
7650
- log24.info("begin exporting kv pairs", void 0, {
7651
- F: __dxlog_file27,
7954
+ log25.info("begin exporting kv pairs", void 0, {
7955
+ F: __dxlog_file28,
7652
7956
  L: 45,
7653
7957
  S: void 0,
7654
7958
  C: (f, a) => f(...a)
@@ -7666,10 +7970,10 @@ var exportProfileData = async ({ storage, level }) => {
7666
7970
  });
7667
7971
  count++;
7668
7972
  }
7669
- log24.info("done exporting kv pairs", {
7973
+ log25.info("done exporting kv pairs", {
7670
7974
  count
7671
7975
  }, {
7672
- F: __dxlog_file27,
7976
+ F: __dxlog_file28,
7673
7977
  L: 56,
7674
7978
  S: void 0,
7675
7979
  C: (f, a) => f(...a)
@@ -7684,8 +7988,8 @@ var importProfileData = async ({ storage, level }, archive) => {
7684
7988
  switch (entry2.type) {
7685
7989
  case ProfileArchiveEntryType.FILE: {
7686
7990
  const directory = await storage.createDirectory();
7687
- invariant19(typeof entry2.key === "string", "Invalid key type", {
7688
- F: __dxlog_file27,
7991
+ invariant20(typeof entry2.key === "string", "Invalid key type", {
7992
+ F: __dxlog_file28,
7689
7993
  L: 79,
7690
7994
  S: void 0,
7691
7995
  A: [
@@ -7694,8 +7998,8 @@ var importProfileData = async ({ storage, level }, archive) => {
7694
7998
  ]
7695
7999
  });
7696
8000
  const file = await directory.getOrCreateFile(entry2.key);
7697
- invariant19(entry2.value instanceof Uint8Array, "Invalid value type", {
7698
- F: __dxlog_file27,
8001
+ invariant20(entry2.value instanceof Uint8Array, "Invalid value type", {
8002
+ F: __dxlog_file28,
7699
8003
  L: 81,
7700
8004
  S: void 0,
7701
8005
  A: [
@@ -7708,8 +8012,8 @@ var importProfileData = async ({ storage, level }, archive) => {
7708
8012
  break;
7709
8013
  }
7710
8014
  case ProfileArchiveEntryType.KEY_VALUE: {
7711
- invariant19(entry2.key instanceof Uint8Array, "Invalid key type", {
7712
- F: __dxlog_file27,
8015
+ invariant20(entry2.key instanceof Uint8Array, "Invalid key type", {
8016
+ F: __dxlog_file28,
7713
8017
  L: 87,
7714
8018
  S: void 0,
7715
8019
  A: [
@@ -7717,8 +8021,8 @@ var importProfileData = async ({ storage, level }, archive) => {
7717
8021
  "'Invalid key type'"
7718
8022
  ]
7719
8023
  });
7720
- invariant19(entry2.value instanceof Uint8Array, "Invalid value type", {
7721
- F: __dxlog_file27,
8024
+ invariant20(entry2.value instanceof Uint8Array, "Invalid value type", {
8025
+ F: __dxlog_file28,
7722
8026
  L: 88,
7723
8027
  S: void 0,
7724
8028
  A: [
@@ -7738,20 +8042,20 @@ var importProfileData = async ({ storage, level }, archive) => {
7738
8042
  if (++count % 1e3 === 0) {
7739
8043
  await batch.write();
7740
8044
  batch = level.batch();
7741
- log24.info("importing", {
8045
+ log25.info("importing", {
7742
8046
  count,
7743
8047
  total: archive.storage.length,
7744
8048
  progress: `${(count / archive.storage.length * 100).toFixed()}%`
7745
8049
  }, {
7746
- F: __dxlog_file27,
8050
+ F: __dxlog_file28,
7747
8051
  L: 101,
7748
8052
  S: void 0,
7749
8053
  C: (f, a) => f(...a)
7750
8054
  });
7751
8055
  }
7752
8056
  }
7753
- log24.info("committing changes..", void 0, {
7754
- F: __dxlog_file27,
8057
+ log25.info("committing changes..", void 0, {
8058
+ F: __dxlog_file28,
7755
8059
  L: 109,
7756
8060
  S: void 0,
7757
8061
  C: (f, a) => f(...a)
@@ -7760,13 +8064,13 @@ var importProfileData = async ({ storage, level }, archive) => {
7760
8064
  };
7761
8065
 
7762
8066
  // packages/sdk/client-services/src/packlets/services/service-host.ts
7763
- import { Event as Event10, synchronized as synchronized3 } from "@dxos/async";
8067
+ import { Event as Event11, synchronized as synchronized4 } from "@dxos/async";
7764
8068
  import { clientServiceBundle } from "@dxos/client-protocol";
7765
8069
  import { Context as Context10 } from "@dxos/context";
7766
8070
  import { EdgeClient, EdgeHttpClient, createStubEdgeIdentity } from "@dxos/edge-client";
7767
- import { invariant as invariant21 } from "@dxos/invariant";
7768
- import { PublicKey as PublicKey17 } from "@dxos/keys";
7769
- import { log as log26 } from "@dxos/log";
8071
+ import { invariant as invariant22 } from "@dxos/invariant";
8072
+ import { PublicKey as PublicKey18 } from "@dxos/keys";
8073
+ import { log as log27 } from "@dxos/log";
7770
8074
  import { EdgeSignalManager, WebsocketSignalManager } from "@dxos/messaging";
7771
8075
  import { SwarmNetworkManager, createIceProvider, createRtcTransportFactory } from "@dxos/network-manager";
7772
8076
  import { trace as trace10 } from "@dxos/protocols";
@@ -7776,10 +8080,10 @@ import { WebsocketRpcClient } from "@dxos/websocket-rpc";
7776
8080
 
7777
8081
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
7778
8082
  import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
7779
- import { Stream as Stream11 } from "@dxos/codec-protobuf";
7780
- import { invariant as invariant20 } from "@dxos/invariant";
8083
+ import { Stream as Stream12 } from "@dxos/codec-protobuf";
8084
+ import { invariant as invariant21 } from "@dxos/invariant";
7781
8085
  import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
7782
- var __dxlog_file28 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
8086
+ var __dxlog_file29 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
7783
8087
  var DevicesServiceImpl = class {
7784
8088
  constructor(_identityManager) {
7785
8089
  this._identityManager = _identityManager;
@@ -7788,7 +8092,7 @@ var DevicesServiceImpl = class {
7788
8092
  return this._identityManager.updateDeviceProfile(profile);
7789
8093
  }
7790
8094
  queryDevices() {
7791
- return new Stream11(({ next }) => {
8095
+ return new Stream12(({ next }) => {
7792
8096
  const update = () => {
7793
8097
  const deviceKeys = this._identityManager.identity?.authorizedDeviceKeys;
7794
8098
  if (!deviceKeys) {
@@ -7796,8 +8100,8 @@ var DevicesServiceImpl = class {
7796
8100
  devices: []
7797
8101
  });
7798
8102
  } else {
7799
- invariant20(this._identityManager.identity?.presence, "presence not present", {
7800
- F: __dxlog_file28,
8103
+ invariant21(this._identityManager.identity?.presence, "presence not present", {
8104
+ F: __dxlog_file29,
7801
8105
  L: 32,
7802
8106
  S: this,
7803
8107
  A: [
@@ -7857,9 +8161,9 @@ var DevicesServiceImpl = class {
7857
8161
  };
7858
8162
 
7859
8163
  // packages/sdk/client-services/src/packlets/identity/contacts-service.ts
7860
- import { EventSubscriptions as EventSubscriptions4, scheduleTask as scheduleTask8, UpdateScheduler as UpdateScheduler2 } from "@dxos/async";
7861
- import { Stream as Stream12 } from "@dxos/codec-protobuf";
7862
- import { PublicKey as PublicKey15 } from "@dxos/keys";
8164
+ import { EventSubscriptions as EventSubscriptions4, scheduleTask as scheduleTask9, UpdateScheduler as UpdateScheduler2 } from "@dxos/async";
8165
+ import { Stream as Stream13 } from "@dxos/codec-protobuf";
8166
+ import { PublicKey as PublicKey16 } from "@dxos/keys";
7863
8167
  import { ComplexMap as ComplexMap5, ComplexSet as ComplexSet6 } from "@dxos/util";
7864
8168
  var ContactsServiceImpl = class {
7865
8169
  constructor(_identityManager, _spaceManager, _dataSpaceManagerProvider) {
@@ -7900,7 +8204,7 @@ var ContactsServiceImpl = class {
7900
8204
  });
7901
8205
  }
7902
8206
  return acc;
7903
- }, new ComplexMap5(PublicKey15.hash));
8207
+ }, new ComplexMap5(PublicKey16.hash));
7904
8208
  return {
7905
8209
  contacts: [
7906
8210
  ...contacts.values()
@@ -7908,15 +8212,15 @@ var ContactsServiceImpl = class {
7908
8212
  };
7909
8213
  }
7910
8214
  queryContacts() {
7911
- const subscribedSpaceKeySet = new ComplexSet6(PublicKey15.hash);
7912
- return new Stream12(({ next, ctx }) => {
8215
+ const subscribedSpaceKeySet = new ComplexSet6(PublicKey16.hash);
8216
+ return new Stream13(({ next, ctx }) => {
7913
8217
  const pushUpdateTask = new UpdateScheduler2(ctx, async () => {
7914
8218
  const contacts = await this.getContacts();
7915
8219
  next(contacts);
7916
8220
  }, {
7917
8221
  maxFrequency: 2
7918
8222
  });
7919
- scheduleTask8(ctx, async () => {
8223
+ scheduleTask9(ctx, async () => {
7920
8224
  const subscriptions = new EventSubscriptions4();
7921
8225
  ctx.onDispose(() => subscriptions.clear());
7922
8226
  const subscribeToSpaceAndUpdate = () => {
@@ -7940,27 +8244,27 @@ var ContactsServiceImpl = class {
7940
8244
  };
7941
8245
 
7942
8246
  // packages/sdk/client-services/src/packlets/logging/logging-service.ts
7943
- import { Event as Event9 } from "@dxos/async";
7944
- import { Stream as Stream13 } from "@dxos/codec-protobuf";
7945
- import { PublicKey as PublicKey16 } from "@dxos/keys";
7946
- import { getContextFromEntry, log as log25 } from "@dxos/log";
8247
+ import { Event as Event10 } from "@dxos/async";
8248
+ import { Stream as Stream14 } from "@dxos/codec-protobuf";
8249
+ import { PublicKey as PublicKey17 } from "@dxos/keys";
8250
+ import { getContextFromEntry, log as log26 } from "@dxos/log";
7947
8251
  import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
7948
8252
  import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
7949
8253
  var LoggingServiceImpl = class {
7950
8254
  constructor() {
7951
- this._logs = new Event9();
8255
+ this._logs = new Event10();
7952
8256
  this._started = Date.now();
7953
- this._sessionId = PublicKey16.random().toHex();
8257
+ this._sessionId = PublicKey17.random().toHex();
7954
8258
  this._logProcessor = (_config, entry2) => {
7955
8259
  this._logs.emit(entry2);
7956
8260
  };
7957
8261
  }
7958
8262
  async open() {
7959
- log25.runtimeConfig.processors.push(this._logProcessor);
8263
+ log26.runtimeConfig.processors.push(this._logProcessor);
7960
8264
  }
7961
8265
  async close() {
7962
- const index = log25.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
7963
- log25.runtimeConfig.processors.splice(index, 1);
8266
+ const index = log26.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
8267
+ log26.runtimeConfig.processors.splice(index, 1);
7964
8268
  }
7965
8269
  async controlMetrics({ reset, record }) {
7966
8270
  if (reset) {
@@ -7986,7 +8290,7 @@ var LoggingServiceImpl = class {
7986
8290
  stats: numericalValues(events, "duration")
7987
8291
  };
7988
8292
  };
7989
- return new Stream13(({ next }) => {
8293
+ return new Stream14(({ next }) => {
7990
8294
  const update = () => {
7991
8295
  const metrics2 = {
7992
8296
  timestamp: /* @__PURE__ */ new Date(),
@@ -8008,7 +8312,7 @@ var LoggingServiceImpl = class {
8008
8312
  });
8009
8313
  }
8010
8314
  queryLogs(request) {
8011
- return new Stream13(({ ctx, next }) => {
8315
+ return new Stream14(({ ctx, next }) => {
8012
8316
  const handler = (entry2) => {
8013
8317
  if (LOG_PROCESSING > 0) {
8014
8318
  return;
@@ -8064,14 +8368,14 @@ var shouldLog = (entry2, request) => {
8064
8368
  var LOG_PROCESSING = 0;
8065
8369
 
8066
8370
  // packages/sdk/client-services/src/packlets/network/network-service.ts
8067
- import { Stream as Stream14 } from "@dxos/codec-protobuf";
8371
+ import { Stream as Stream15 } from "@dxos/codec-protobuf";
8068
8372
  var NetworkServiceImpl = class {
8069
8373
  constructor(networkManager, signalManager) {
8070
8374
  this.networkManager = networkManager;
8071
8375
  this.signalManager = signalManager;
8072
8376
  }
8073
8377
  queryStatus() {
8074
- return new Stream14(({ next }) => {
8378
+ return new Stream15(({ next }) => {
8075
8379
  const update = () => {
8076
8380
  next({
8077
8381
  swarm: this.networkManager.connectionState,
@@ -8097,7 +8401,7 @@ var NetworkServiceImpl = class {
8097
8401
  };
8098
8402
 
8099
8403
  // packages/sdk/client-services/src/packlets/system/system-service.ts
8100
- import { Stream as Stream15 } from "@dxos/codec-protobuf";
8404
+ import { Stream as Stream16 } from "@dxos/codec-protobuf";
8101
8405
  import { GetDiagnosticsRequest as GetDiagnosticsRequest2 } from "@dxos/protocols/proto/dxos/client/services";
8102
8406
  import { jsonKeyReplacer as jsonKeyReplacer2 } from "@dxos/util";
8103
8407
  var SystemServiceImpl = class {
@@ -8133,7 +8437,7 @@ var SystemServiceImpl = class {
8133
8437
  }
8134
8438
  // TODO(burdon): Standardize interval option in stream request?
8135
8439
  queryStatus({ interval = 3e3 } = {}) {
8136
- return new Stream15(({ next }) => {
8440
+ return new Stream16(({ next }) => {
8137
8441
  const update = () => {
8138
8442
  next({
8139
8443
  status: this._getCurrentStatus()
@@ -8154,13 +8458,13 @@ var SystemServiceImpl = class {
8154
8458
  };
8155
8459
 
8156
8460
  // packages/sdk/client-services/src/packlets/services/service-host.ts
8157
- function _ts_decorate10(decorators, target, key, desc) {
8461
+ function _ts_decorate11(decorators, target, key, desc) {
8158
8462
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8159
8463
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
8160
8464
  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;
8161
8465
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8162
8466
  }
8163
- var __dxlog_file29 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
8467
+ var __dxlog_file30 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
8164
8468
  var ClientServicesHost = class {
8165
8469
  constructor({
8166
8470
  config,
@@ -8174,7 +8478,7 @@ var ClientServicesHost = class {
8174
8478
  runtimeParams
8175
8479
  } = {}) {
8176
8480
  this._tracingService = TRACE_PROCESSOR3.createTraceSender();
8177
- this._statusUpdate = new Event10();
8481
+ this._statusUpdate = new Event11();
8178
8482
  this._edgeConnection = void 0;
8179
8483
  this._edgeHttpClient = void 0;
8180
8484
  this._opening = false;
@@ -8199,8 +8503,8 @@ var ClientServicesHost = class {
8199
8503
  onAcquire: () => {
8200
8504
  if (!this._opening) {
8201
8505
  void this.open(new Context10(void 0, {
8202
- F: __dxlog_file29,
8203
- L: 133
8506
+ F: __dxlog_file30,
8507
+ L: 134
8204
8508
  }));
8205
8509
  }
8206
8510
  },
@@ -8256,25 +8560,25 @@ var ClientServicesHost = class {
8256
8560
  * Can only be called once.
8257
8561
  */
8258
8562
  initialize({ config, ...options }) {
8259
- invariant21(!this._open, "service host is open", {
8260
- F: __dxlog_file29,
8261
- L: 199,
8563
+ invariant22(!this._open, "service host is open", {
8564
+ F: __dxlog_file30,
8565
+ L: 200,
8262
8566
  S: this,
8263
8567
  A: [
8264
8568
  "!this._open",
8265
8569
  "'service host is open'"
8266
8570
  ]
8267
8571
  });
8268
- log26("initializing...", void 0, {
8269
- F: __dxlog_file29,
8270
- L: 200,
8572
+ log27("initializing...", void 0, {
8573
+ F: __dxlog_file30,
8574
+ L: 201,
8271
8575
  S: this,
8272
8576
  C: (f, a) => f(...a)
8273
8577
  });
8274
8578
  if (config) {
8275
- invariant21(!this._config, "config already set", {
8276
- F: __dxlog_file29,
8277
- L: 203,
8579
+ invariant22(!this._config, "config already set", {
8580
+ F: __dxlog_file30,
8581
+ L: 204,
8278
8582
  S: this,
8279
8583
  A: [
8280
8584
  "!this._config",
@@ -8287,9 +8591,9 @@ var ClientServicesHost = class {
8287
8591
  }
8288
8592
  }
8289
8593
  if (!options.signalManager) {
8290
- log26.warn("running signaling without telemetry metadata.", void 0, {
8291
- F: __dxlog_file29,
8292
- L: 211,
8594
+ log27.warn("running signaling without telemetry metadata.", void 0, {
8595
+ F: __dxlog_file30,
8596
+ L: 212,
8293
8597
  S: this,
8294
8598
  C: (f, a) => f(...a)
8295
8599
  });
@@ -8307,9 +8611,9 @@ var ClientServicesHost = class {
8307
8611
  edgeConnection: this._edgeConnection
8308
8612
  }) : new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
8309
8613
  this._signalManager = signalManager;
8310
- invariant21(!this._networkManager, "network manager already set", {
8311
- F: __dxlog_file29,
8312
- L: 233,
8614
+ invariant22(!this._networkManager, "network manager already set", {
8615
+ F: __dxlog_file30,
8616
+ L: 234,
8313
8617
  S: this,
8314
8618
  A: [
8315
8619
  "!this._networkManager",
@@ -8325,9 +8629,9 @@ var ClientServicesHost = class {
8325
8629
  peerKey: this._edgeConnection.peerKey
8326
8630
  } : void 0
8327
8631
  });
8328
- log26("initialized", void 0, {
8329
- F: __dxlog_file29,
8330
- L: 246,
8632
+ log27("initialized", void 0, {
8633
+ F: __dxlog_file30,
8634
+ L: 247,
8331
8635
  S: this,
8332
8636
  C: (f, a) => f(...a)
8333
8637
  });
@@ -8336,45 +8640,45 @@ var ClientServicesHost = class {
8336
8640
  if (this._open) {
8337
8641
  return;
8338
8642
  }
8339
- const traceId = PublicKey17.random().toHex();
8340
- log26.trace("dxos.client-services.host.open", trace10.begin({
8643
+ const traceId = PublicKey18.random().toHex();
8644
+ log27.trace("dxos.client-services.host.open", trace10.begin({
8341
8645
  id: traceId
8342
8646
  }), {
8343
- F: __dxlog_file29,
8344
- L: 257,
8647
+ F: __dxlog_file30,
8648
+ L: 258,
8345
8649
  S: this,
8346
8650
  C: (f, a) => f(...a)
8347
8651
  });
8348
- invariant21(this._config, "config not set", {
8349
- F: __dxlog_file29,
8350
- L: 259,
8652
+ invariant22(this._config, "config not set", {
8653
+ F: __dxlog_file30,
8654
+ L: 260,
8351
8655
  S: this,
8352
8656
  A: [
8353
8657
  "this._config",
8354
8658
  "'config not set'"
8355
8659
  ]
8356
8660
  });
8357
- invariant21(this._storage, "storage not set", {
8358
- F: __dxlog_file29,
8359
- L: 260,
8661
+ invariant22(this._storage, "storage not set", {
8662
+ F: __dxlog_file30,
8663
+ L: 261,
8360
8664
  S: this,
8361
8665
  A: [
8362
8666
  "this._storage",
8363
8667
  "'storage not set'"
8364
8668
  ]
8365
8669
  });
8366
- invariant21(this._signalManager, "signal manager not set", {
8367
- F: __dxlog_file29,
8368
- L: 261,
8670
+ invariant22(this._signalManager, "signal manager not set", {
8671
+ F: __dxlog_file30,
8672
+ L: 262,
8369
8673
  S: this,
8370
8674
  A: [
8371
8675
  "this._signalManager",
8372
8676
  "'signal manager not set'"
8373
8677
  ]
8374
8678
  });
8375
- invariant21(this._networkManager, "network manager not set", {
8376
- F: __dxlog_file29,
8377
- L: 262,
8679
+ invariant22(this._networkManager, "network manager not set", {
8680
+ F: __dxlog_file30,
8681
+ L: 263,
8378
8682
  S: this,
8379
8683
  A: [
8380
8684
  "this._networkManager",
@@ -8382,11 +8686,11 @@ var ClientServicesHost = class {
8382
8686
  ]
8383
8687
  });
8384
8688
  this._opening = true;
8385
- log26("opening...", {
8689
+ log27("opening...", {
8386
8690
  lockKey: this._resourceLock?.lockKey
8387
8691
  }, {
8388
- F: __dxlog_file29,
8389
- L: 265,
8692
+ F: __dxlog_file30,
8693
+ L: 266,
8390
8694
  S: this,
8391
8695
  C: (f, a) => f(...a)
8392
8696
  });
@@ -8401,6 +8705,10 @@ var ClientServicesHost = class {
8401
8705
  await this._serviceContext.initialized.wait();
8402
8706
  return this._serviceContext.dataSpaceManager;
8403
8707
  };
8708
+ const agentManagerProvider = async () => {
8709
+ await this._serviceContext.initialized.wait();
8710
+ return this._serviceContext.edgeAgentManager;
8711
+ };
8404
8712
  const identityService = new IdentityServiceImpl(this._serviceContext.identityManager, this._serviceContext.keyring, () => this._serviceContext.dataSpaceManager, (params) => this._createIdentity(params), (profile) => this._serviceContext.broadcastProfileUpdate(profile));
8405
8713
  this._serviceRegistry.setServices({
8406
8714
  SystemService: this._systemService,
@@ -8419,7 +8727,8 @@ var ClientServicesHost = class {
8419
8727
  events: new DevtoolsHostEvents(),
8420
8728
  config: this._config,
8421
8729
  context: this._serviceContext
8422
- })
8730
+ }),
8731
+ EdgeAgentService: new EdgeAgentServiceImpl(agentManagerProvider)
8423
8732
  });
8424
8733
  await this._serviceContext.open(ctx);
8425
8734
  await identityService.open();
@@ -8438,19 +8747,19 @@ var ClientServicesHost = class {
8438
8747
  this._open = true;
8439
8748
  this._statusUpdate.emit();
8440
8749
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
8441
- log26("opened", {
8750
+ log27("opened", {
8442
8751
  deviceKey
8443
8752
  }, {
8444
- F: __dxlog_file29,
8445
- L: 354,
8753
+ F: __dxlog_file30,
8754
+ L: 362,
8446
8755
  S: this,
8447
8756
  C: (f, a) => f(...a)
8448
8757
  });
8449
- log26.trace("dxos.client-services.host.open", trace10.end({
8758
+ log27.trace("dxos.client-services.host.open", trace10.end({
8450
8759
  id: traceId
8451
8760
  }), {
8452
- F: __dxlog_file29,
8453
- L: 355,
8761
+ F: __dxlog_file30,
8762
+ L: 363,
8454
8763
  S: this,
8455
8764
  C: (f, a) => f(...a)
8456
8765
  });
@@ -8460,11 +8769,11 @@ var ClientServicesHost = class {
8460
8769
  return;
8461
8770
  }
8462
8771
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
8463
- log26("closing...", {
8772
+ log27("closing...", {
8464
8773
  deviceKey
8465
8774
  }, {
8466
- F: __dxlog_file29,
8467
- L: 366,
8775
+ F: __dxlog_file30,
8776
+ L: 374,
8468
8777
  S: this,
8469
8778
  C: (f, a) => f(...a)
8470
8779
  });
@@ -8478,44 +8787,44 @@ var ClientServicesHost = class {
8478
8787
  await this._level?.close();
8479
8788
  this._open = false;
8480
8789
  this._statusUpdate.emit();
8481
- log26("closed", {
8790
+ log27("closed", {
8482
8791
  deviceKey
8483
8792
  }, {
8484
- F: __dxlog_file29,
8485
- L: 375,
8793
+ F: __dxlog_file30,
8794
+ L: 383,
8486
8795
  S: this,
8487
8796
  C: (f, a) => f(...a)
8488
8797
  });
8489
8798
  }
8490
8799
  async reset() {
8491
- const traceId = PublicKey17.random().toHex();
8492
- log26.trace("dxos.sdk.client-services-host.reset", trace10.begin({
8800
+ const traceId = PublicKey18.random().toHex();
8801
+ log27.trace("dxos.sdk.client-services-host.reset", trace10.begin({
8493
8802
  id: traceId
8494
8803
  }), {
8495
- F: __dxlog_file29,
8496
- L: 380,
8804
+ F: __dxlog_file30,
8805
+ L: 388,
8497
8806
  S: this,
8498
8807
  C: (f, a) => f(...a)
8499
8808
  });
8500
- log26.info("resetting...", void 0, {
8501
- F: __dxlog_file29,
8502
- L: 382,
8809
+ log27.info("resetting...", void 0, {
8810
+ F: __dxlog_file30,
8811
+ L: 390,
8503
8812
  S: this,
8504
8813
  C: (f, a) => f(...a)
8505
8814
  });
8506
8815
  await this._serviceContext?.close();
8507
8816
  await this._storage.reset();
8508
- log26.info("reset", void 0, {
8509
- F: __dxlog_file29,
8510
- L: 385,
8817
+ log27.info("reset", void 0, {
8818
+ F: __dxlog_file30,
8819
+ L: 393,
8511
8820
  S: this,
8512
8821
  C: (f, a) => f(...a)
8513
8822
  });
8514
- log26.trace("dxos.sdk.client-services-host.reset", trace10.end({
8823
+ log27.trace("dxos.sdk.client-services-host.reset", trace10.end({
8515
8824
  id: traceId
8516
8825
  }), {
8517
- F: __dxlog_file29,
8518
- L: 386,
8826
+ F: __dxlog_file30,
8827
+ L: 394,
8519
8828
  S: this,
8520
8829
  C: (f, a) => f(...a)
8521
8830
  });
@@ -8527,21 +8836,21 @@ var ClientServicesHost = class {
8527
8836
  return identity;
8528
8837
  }
8529
8838
  };
8530
- _ts_decorate10([
8839
+ _ts_decorate11([
8531
8840
  Trace4.info()
8532
8841
  ], ClientServicesHost.prototype, "_opening", void 0);
8533
- _ts_decorate10([
8842
+ _ts_decorate11([
8534
8843
  Trace4.info()
8535
8844
  ], ClientServicesHost.prototype, "_open", void 0);
8536
- _ts_decorate10([
8537
- synchronized3,
8845
+ _ts_decorate11([
8846
+ synchronized4,
8538
8847
  Trace4.span()
8539
8848
  ], ClientServicesHost.prototype, "open", null);
8540
- _ts_decorate10([
8541
- synchronized3,
8849
+ _ts_decorate11([
8850
+ synchronized4,
8542
8851
  Trace4.span()
8543
8852
  ], ClientServicesHost.prototype, "close", null);
8544
- ClientServicesHost = _ts_decorate10([
8853
+ ClientServicesHost = _ts_decorate11([
8545
8854
  Trace4.resource()
8546
8855
  ], ClientServicesHost);
8547
8856
 
@@ -8579,6 +8888,8 @@ export {
8579
8888
  Lock,
8580
8889
  isLocked,
8581
8890
  ClientRpcServer,
8891
+ EdgeAgentManager,
8892
+ EdgeAgentServiceImpl,
8582
8893
  ServiceContext,
8583
8894
  ServiceRegistry,
8584
8895
  createStorageObjects,
@@ -8589,4 +8900,4 @@ export {
8589
8900
  importProfileData,
8590
8901
  ClientServicesHost
8591
8902
  };
8592
- //# sourceMappingURL=chunk-XOKN3TE7.mjs.map
8903
+ //# sourceMappingURL=chunk-IPWEAPT2.mjs.map