@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
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_IFHGVXW2_exports = {};
30
- __export(chunk_IFHGVXW2_exports, {
29
+ var chunk_DJIOUOAF_exports = {};
30
+ __export(chunk_DJIOUOAF_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -36,6 +36,8 @@ __export(chunk_IFHGVXW2_exports, {
36
36
  DevtoolsHostEvents: () => DevtoolsHostEvents,
37
37
  DevtoolsServiceImpl: () => DevtoolsServiceImpl,
38
38
  DiagnosticsCollector: () => DiagnosticsCollector,
39
+ EdgeAgentManager: () => EdgeAgentManager,
40
+ EdgeAgentServiceImpl: () => EdgeAgentServiceImpl,
39
41
  EdgeFeedReplicator: () => EdgeFeedReplicator,
40
42
  Identity: () => Identity,
41
43
  IdentityManager: () => IdentityManager,
@@ -70,7 +72,7 @@ __export(chunk_IFHGVXW2_exports, {
70
72
  subscribeToSpaces: () => subscribeToSpaces,
71
73
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
72
74
  });
73
- module.exports = __toCommonJS(chunk_IFHGVXW2_exports);
75
+ module.exports = __toCommonJS(chunk_DJIOUOAF_exports);
74
76
  var import_async = require("@dxos/async");
75
77
  var import_codec_protobuf = require("@dxos/codec-protobuf");
76
78
  var import_feed_store = require("@dxos/feed-store");
@@ -302,64 +304,74 @@ var import_rpc = require("@dxos/rpc");
302
304
  var import_tracing9 = require("@dxos/tracing");
303
305
  var import_async21 = require("@dxos/async");
304
306
  var import_context15 = require("@dxos/context");
307
+ var import_invariant20 = require("@dxos/invariant");
308
+ var import_keys15 = require("@dxos/keys");
309
+ var import_log22 = require("@dxos/log");
310
+ var import_protocols14 = require("@dxos/protocols");
311
+ var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
312
+ var import_codec_protobuf12 = require("@dxos/codec-protobuf");
313
+ var import_protocols15 = require("@dxos/protocols");
314
+ var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
315
+ var import_async22 = require("@dxos/async");
316
+ var import_context16 = require("@dxos/context");
305
317
  var import_credentials22 = require("@dxos/credentials");
306
318
  var import_debug6 = require("@dxos/debug");
307
319
  var import_echo_pipeline5 = require("@dxos/echo-pipeline");
308
320
  var import_edge_client2 = require("@dxos/edge-client");
309
321
  var import_feed_store6 = require("@dxos/feed-store");
310
- var import_invariant20 = require("@dxos/invariant");
322
+ var import_invariant21 = require("@dxos/invariant");
311
323
  var import_keyring = require("@dxos/keyring");
312
- var import_keys15 = require("@dxos/keys");
313
- var import_log22 = require("@dxos/log");
314
- var import_protocols14 = require("@dxos/protocols");
315
- var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
324
+ var import_keys16 = require("@dxos/keys");
325
+ var import_log23 = require("@dxos/log");
326
+ var import_protocols16 = require("@dxos/protocols");
327
+ var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
316
328
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
317
329
  var import_tracing10 = require("@dxos/tracing");
318
330
  var import_util12 = require("@dxos/util");
319
- var import_protocols15 = require("@dxos/protocols");
331
+ var import_protocols17 = require("@dxos/protocols");
320
332
  var import_config2 = require("@dxos/protocols/proto/dxos/config");
321
333
  var import_random_access_storage = require("@dxos/random-access-storage");
322
334
  var import_client_protocol7 = require("@dxos/client-protocol");
323
335
  var import_config3 = require("@dxos/protocols/proto/dxos/config");
324
336
  var import_util13 = require("@dxos/util");
325
337
  var import_node_path = __toESM(require("node:path"));
326
- var import_keys16 = require("@dxos/keys");
338
+ var import_keys17 = require("@dxos/keys");
327
339
  var import_kv_store = require("@dxos/kv-store");
328
340
  var import_automerge_repo = require("@dxos/automerge/automerge-repo");
329
- var import_invariant21 = require("@dxos/invariant");
330
- var import_log23 = require("@dxos/log");
331
- var import_protocols16 = require("@dxos/protocols");
341
+ var import_invariant22 = require("@dxos/invariant");
342
+ var import_log24 = require("@dxos/log");
343
+ var import_protocols18 = require("@dxos/protocols");
332
344
  var import_util14 = require("@dxos/util");
333
- var import_async22 = require("@dxos/async");
345
+ var import_async23 = require("@dxos/async");
334
346
  var import_client_protocol8 = require("@dxos/client-protocol");
335
- var import_context16 = require("@dxos/context");
347
+ var import_context17 = require("@dxos/context");
336
348
  var import_edge_client3 = require("@dxos/edge-client");
337
- var import_invariant22 = require("@dxos/invariant");
338
- var import_keys17 = require("@dxos/keys");
339
- var import_log24 = require("@dxos/log");
349
+ var import_invariant23 = require("@dxos/invariant");
350
+ var import_keys18 = require("@dxos/keys");
351
+ var import_log25 = require("@dxos/log");
340
352
  var import_messaging = require("@dxos/messaging");
341
353
  var import_network_manager2 = require("@dxos/network-manager");
342
- var import_protocols17 = require("@dxos/protocols");
343
- var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
354
+ var import_protocols19 = require("@dxos/protocols");
355
+ var import_services22 = require("@dxos/protocols/proto/dxos/client/services");
344
356
  var import_tracing11 = require("@dxos/tracing");
345
357
  var import_websocket_rpc = require("@dxos/websocket-rpc");
346
- var import_async23 = require("@dxos/async");
347
- var import_codec_protobuf12 = require("@dxos/codec-protobuf");
348
- var import_invariant23 = require("@dxos/invariant");
349
- var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
350
358
  var import_async24 = require("@dxos/async");
351
359
  var import_codec_protobuf13 = require("@dxos/codec-protobuf");
352
- var import_keys18 = require("@dxos/keys");
353
- var import_util15 = require("@dxos/util");
360
+ var import_invariant24 = require("@dxos/invariant");
361
+ var import_services23 = require("@dxos/protocols/proto/dxos/client/services");
354
362
  var import_async25 = require("@dxos/async");
355
363
  var import_codec_protobuf14 = require("@dxos/codec-protobuf");
356
364
  var import_keys19 = require("@dxos/keys");
357
- var import_log25 = require("@dxos/log");
358
- var import_services22 = require("@dxos/protocols/proto/dxos/client/services");
359
- var import_util16 = require("@dxos/util");
365
+ var import_util15 = require("@dxos/util");
366
+ var import_async26 = require("@dxos/async");
360
367
  var import_codec_protobuf15 = require("@dxos/codec-protobuf");
368
+ var import_keys20 = require("@dxos/keys");
369
+ var import_log26 = require("@dxos/log");
370
+ var import_services24 = require("@dxos/protocols/proto/dxos/client/services");
371
+ var import_util16 = require("@dxos/util");
361
372
  var import_codec_protobuf16 = require("@dxos/codec-protobuf");
362
- var import_services23 = require("@dxos/protocols/proto/dxos/client/services");
373
+ var import_codec_protobuf17 = require("@dxos/codec-protobuf");
374
+ var import_services25 = require("@dxos/protocols/proto/dxos/client/services");
363
375
  var import_util17 = require("@dxos/util");
364
376
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/feeds.ts";
365
377
  var subscribeToFeeds = ({ feedStore, spaceManager }, { feedKeys }) => {
@@ -719,7 +731,7 @@ var DevtoolsServiceImpl = class {
719
731
  });
720
732
  }
721
733
  };
722
- var DXOS_VERSION = "0.6.13-main.09887cd";
734
+ var DXOS_VERSION = "0.6.13-main.ed424a1";
723
735
  var getPlatform = () => {
724
736
  if (process.browser) {
725
737
  if (typeof window !== "undefined") {
@@ -1712,6 +1724,7 @@ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/sr
1712
1724
  var DEFAULT_RETRY_TIMEOUT = 1e3;
1713
1725
  var DEFAULT_SUCCESS_DELAY = 1e3;
1714
1726
  var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
1727
+ var DEFAULT_ACTIVE_EDGE_POLLING_INTERVAL = 3e3;
1715
1728
  var MAX_EDGE_RETRIES = 2;
1716
1729
  var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
1717
1730
  var credentialCodec = import_proto2.schema.getCodecForType("dxos.halo.credentials.Credential");
@@ -1722,11 +1735,44 @@ var NotarizationPlugin = class extends import_context6.Resource {
1722
1735
  this._extensions = /* @__PURE__ */ new Set();
1723
1736
  this._processedCredentials = new import_util5.ComplexSet(import_keys5.PublicKey.hash);
1724
1737
  this._processCredentialsTriggers = new import_util5.ComplexMap(import_keys5.PublicKey.hash);
1738
+ this._activeEdgePollingIntervalHandle = void 0;
1725
1739
  this._spaceId = params.spaceId;
1740
+ this._activeEdgePollingInterval = params.activeEdgePollingInterval ?? DEFAULT_ACTIVE_EDGE_POLLING_INTERVAL;
1726
1741
  if (params.edgeClient && params.edgeFeatures?.feedReplicator) {
1727
1742
  this._edgeClient = params.edgeClient;
1728
1743
  }
1729
1744
  }
1745
+ setActiveEdgePollingEnabled(enabled) {
1746
+ (0, import_invariant5.invariant)(this.isOpen, void 0, {
1747
+ F: __dxlog_file7,
1748
+ L: 109,
1749
+ S: this,
1750
+ A: [
1751
+ "this.isOpen",
1752
+ ""
1753
+ ]
1754
+ });
1755
+ const client = this._edgeClient;
1756
+ (0, import_invariant5.invariant)(client, void 0, {
1757
+ F: __dxlog_file7,
1758
+ L: 111,
1759
+ S: this,
1760
+ A: [
1761
+ "client",
1762
+ ""
1763
+ ]
1764
+ });
1765
+ if (enabled && !this._activeEdgePollingIntervalHandle) {
1766
+ this._activeEdgePollingIntervalHandle = setInterval(() => {
1767
+ if (this._writer) {
1768
+ this._notarizePendingEdgeCredentials(client, this._writer);
1769
+ }
1770
+ }, this._activeEdgePollingInterval);
1771
+ } else if (!enabled && this._activeEdgePollingIntervalHandle) {
1772
+ clearInterval(this._activeEdgePollingIntervalHandle);
1773
+ this._activeEdgePollingIntervalHandle = void 0;
1774
+ }
1775
+ }
1730
1776
  get hasWriter() {
1731
1777
  return !!this._writer;
1732
1778
  }
@@ -1736,6 +1782,10 @@ var NotarizationPlugin = class extends import_context6.Resource {
1736
1782
  }
1737
1783
  }
1738
1784
  async _close() {
1785
+ if (this._activeEdgePollingIntervalHandle) {
1786
+ clearInterval(this._activeEdgePollingIntervalHandle);
1787
+ this._activeEdgePollingIntervalHandle = void 0;
1788
+ }
1739
1789
  await this._ctx.dispose();
1740
1790
  }
1741
1791
  /**
@@ -1746,13 +1796,13 @@ var NotarizationPlugin = class extends import_context6.Resource {
1746
1796
  credentials
1747
1797
  }, {
1748
1798
  F: __dxlog_file7,
1749
- L: 126,
1799
+ L: 153,
1750
1800
  S: this,
1751
1801
  C: (f, a) => f(...a)
1752
1802
  });
1753
1803
  (0, import_invariant5.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
1754
1804
  F: __dxlog_file7,
1755
- L: 127,
1805
+ L: 154,
1756
1806
  S: this,
1757
1807
  A: [
1758
1808
  "credentials.every((credential) => credential.id)",
@@ -1766,7 +1816,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1766
1816
  err
1767
1817
  }, {
1768
1818
  F: __dxlog_file7,
1769
- L: 135,
1819
+ L: 162,
1770
1820
  S: this,
1771
1821
  C: (f, a) => f(...a)
1772
1822
  });
@@ -1798,7 +1848,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1798
1848
  ]);
1799
1849
  (0, import_log6.log)("done", void 0, {
1800
1850
  F: __dxlog_file7,
1801
- L: 160,
1851
+ L: 187,
1802
1852
  S: this,
1803
1853
  C: (f, a) => f(...a)
1804
1854
  });
@@ -1821,7 +1871,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1821
1871
  retryIn: retryTimeout
1822
1872
  }, {
1823
1873
  F: __dxlog_file7,
1824
- L: 183,
1874
+ L: 210,
1825
1875
  S: this,
1826
1876
  C: (f, a) => f(...a)
1827
1877
  });
@@ -1835,7 +1885,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1835
1885
  credentialId: credentials.map((credential) => credential.id)
1836
1886
  }, {
1837
1887
  F: __dxlog_file7,
1838
- L: 190,
1888
+ L: 217,
1839
1889
  S: this,
1840
1890
  C: (f, a) => f(...a)
1841
1891
  });
@@ -1844,7 +1894,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1844
1894
  });
1845
1895
  (0, import_log6.log)("success", void 0, {
1846
1896
  F: __dxlog_file7,
1847
- L: 194,
1897
+ L: 221,
1848
1898
  S: this,
1849
1899
  C: (f, a) => f(...a)
1850
1900
  });
@@ -1853,7 +1903,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1853
1903
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
1854
1904
  import_log6.log.info("error notarizing (recoverable)", err, {
1855
1905
  F: __dxlog_file7,
1856
- L: 199,
1906
+ L: 226,
1857
1907
  S: this,
1858
1908
  C: (f, a) => f(...a)
1859
1909
  });
@@ -1882,7 +1932,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1882
1932
  });
1883
1933
  (0, import_log6.log)("edge notarization success", void 0, {
1884
1934
  F: __dxlog_file7,
1885
- L: 227,
1935
+ L: 254,
1886
1936
  S: this,
1887
1937
  C: (f, a) => f(...a)
1888
1938
  });
@@ -1905,7 +1955,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1905
1955
  setWriter(writer) {
1906
1956
  (0, import_invariant5.invariant)(!this._writer, "Writer already set.", {
1907
1957
  F: __dxlog_file7,
1908
- L: 247,
1958
+ L: 274,
1909
1959
  S: this,
1910
1960
  A: [
1911
1961
  "!this._writer",
@@ -1935,7 +1985,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1935
1985
  if (!credentials.length) {
1936
1986
  (0, import_log6.log)("edge did not return credentials for notarization", void 0, {
1937
1987
  F: __dxlog_file7,
1938
- L: 269,
1988
+ L: 296,
1939
1989
  S: this,
1940
1990
  C: (f, a) => f(...a)
1941
1991
  });
@@ -1945,7 +1995,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1945
1995
  count: credentials.length
1946
1996
  }, {
1947
1997
  F: __dxlog_file7,
1948
- L: 273,
1998
+ L: 300,
1949
1999
  S: this,
1950
2000
  C: (f, a) => f(...a)
1951
2001
  });
@@ -1958,7 +2008,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1958
2008
  count: decodedCredentials.length
1959
2009
  }, {
1960
2010
  F: __dxlog_file7,
1961
- L: 282,
2011
+ L: 309,
1962
2012
  S: this,
1963
2013
  C: (f, a) => f(...a)
1964
2014
  });
@@ -1986,7 +2036,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1986
2036
  for (const credential of credentials) {
1987
2037
  (0, import_invariant5.invariant)(credential.id, "Credential must have an id", {
1988
2038
  F: __dxlog_file7,
1989
- L: 308,
2039
+ L: 335,
1990
2040
  S: this,
1991
2041
  A: [
1992
2042
  "credential.id",
@@ -2010,7 +2060,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
2010
2060
  peer: extension.localPeerId
2011
2061
  }, {
2012
2062
  F: __dxlog_file7,
2013
- L: 323,
2063
+ L: 350,
2014
2064
  S: this,
2015
2065
  C: (f, a) => f(...a)
2016
2066
  });
@@ -2022,7 +2072,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
2022
2072
  peer: extension.localPeerId
2023
2073
  }, {
2024
2074
  F: __dxlog_file7,
2025
- L: 328,
2075
+ L: 355,
2026
2076
  S: this,
2027
2077
  C: (f, a) => f(...a)
2028
2078
  });
@@ -2039,7 +2089,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
2039
2089
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
2040
2090
  }, {
2041
2091
  F: __dxlog_file7,
2042
- L: 340,
2092
+ L: 367,
2043
2093
  S: this,
2044
2094
  C: (f, a) => f(...a)
2045
2095
  });
@@ -2055,7 +2105,7 @@ var handleEdgeError = (error) => {
2055
2105
  if (!(error instanceof import_protocols4.EdgeCallFailedError) || error.errorData) {
2056
2106
  import_log6.log.catch(error, void 0, {
2057
2107
  F: __dxlog_file7,
2058
- L: 354,
2108
+ L: 381,
2059
2109
  S: void 0,
2060
2110
  C: (f, a) => f(...a)
2061
2111
  });
@@ -2064,7 +2114,7 @@ var handleEdgeError = (error) => {
2064
2114
  reason: error.reason
2065
2115
  }, {
2066
2116
  F: __dxlog_file7,
2067
- L: 356,
2117
+ L: 383,
2068
2118
  S: void 0,
2069
2119
  C: (f, a) => f(...a)
2070
2120
  });
@@ -2270,7 +2320,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2270
2320
  async _open() {
2271
2321
  (0, import_log9.log)("open", void 0, {
2272
2322
  F: __dxlog_file9,
2273
- L: 198,
2323
+ L: 199,
2274
2324
  S: this,
2275
2325
  C: (f, a) => f(...a)
2276
2326
  });
@@ -2278,7 +2328,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2278
2328
  id: this._instanceId
2279
2329
  }), {
2280
2330
  F: __dxlog_file9,
2281
- L: 199,
2331
+ L: 200,
2282
2332
  S: this,
2283
2333
  C: (f, a) => f(...a)
2284
2334
  });
@@ -2286,7 +2336,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2286
2336
  spaces: this._metadataStore.spaces.length
2287
2337
  }, {
2288
2338
  F: __dxlog_file9,
2289
- L: 200,
2339
+ L: 201,
2290
2340
  S: this,
2291
2341
  C: (f, a) => f(...a)
2292
2342
  });
@@ -2296,7 +2346,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2296
2346
  spaceMetadata
2297
2347
  }, {
2298
2348
  F: __dxlog_file9,
2299
- L: 204,
2349
+ L: 205,
2300
2350
  S: this,
2301
2351
  C: (f, a) => f(...a)
2302
2352
  });
@@ -2307,7 +2357,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2307
2357
  err
2308
2358
  }, {
2309
2359
  F: __dxlog_file9,
2310
- L: 207,
2360
+ L: 208,
2311
2361
  S: this,
2312
2362
  C: (f, a) => f(...a)
2313
2363
  });
@@ -2318,7 +2368,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2318
2368
  id: this._instanceId
2319
2369
  }), {
2320
2370
  F: __dxlog_file9,
2321
- L: 213,
2371
+ L: 214,
2322
2372
  S: this,
2323
2373
  C: (f, a) => f(...a)
2324
2374
  });
@@ -2326,7 +2376,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2326
2376
  async _close() {
2327
2377
  (0, import_log9.log)("close", void 0, {
2328
2378
  F: __dxlog_file9,
2329
- L: 218,
2379
+ L: 219,
2330
2380
  S: this,
2331
2381
  C: (f, a) => f(...a)
2332
2382
  });
@@ -2341,7 +2391,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2341
2391
  async createSpace() {
2342
2392
  (0, import_invariant7.invariant)(this._lifecycleState === import_context7.LifecycleState.OPEN, "Not open.", {
2343
2393
  F: __dxlog_file9,
2344
- L: 230,
2394
+ L: 231,
2345
2395
  S: this,
2346
2396
  A: [
2347
2397
  "this._lifecycleState === LifecycleState.OPEN",
@@ -2362,7 +2412,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2362
2412
  spaceKey
2363
2413
  }, {
2364
2414
  F: __dxlog_file9,
2365
- L: 242,
2415
+ L: 243,
2366
2416
  S: this,
2367
2417
  C: (f, a) => f(...a)
2368
2418
  });
@@ -2374,7 +2424,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2374
2424
  const memberCredential = credentials[1];
2375
2425
  (0, import_invariant7.invariant)((0, import_credentials9.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2376
2426
  F: __dxlog_file9,
2377
- L: 252,
2427
+ L: 253,
2378
2428
  S: this,
2379
2429
  A: [
2380
2430
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2406,7 +2456,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2406
2456
  spaceId: space.id
2407
2457
  }, {
2408
2458
  F: __dxlog_file9,
2409
- L: 277,
2459
+ L: 278,
2410
2460
  S: this,
2411
2461
  C: (f, a) => f(...a)
2412
2462
  });
@@ -2427,7 +2477,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2427
2477
  keys: []
2428
2478
  }
2429
2479
  };
2430
- const propertiesId = (0, import_echo_schema2.generateEchoId)();
2480
+ const propertiesId = (0, import_echo_schema2.createObjectId)();
2431
2481
  document.change((doc) => {
2432
2482
  (0, import_util7.setDeep)(doc, [
2433
2483
  "objects",
@@ -2441,7 +2491,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2441
2491
  const automergeIndex = space.automergeSpaceState.rootUrl;
2442
2492
  (0, import_invariant7.invariant)(automergeIndex, void 0, {
2443
2493
  F: __dxlog_file9,
2444
- L: 310,
2494
+ L: 311,
2445
2495
  S: this,
2446
2496
  A: [
2447
2497
  "automergeIndex",
@@ -2458,13 +2508,13 @@ var DataSpaceManager = class extends import_context7.Resource {
2458
2508
  opts
2459
2509
  }, {
2460
2510
  F: __dxlog_file9,
2461
- L: 319,
2511
+ L: 320,
2462
2512
  S: this,
2463
2513
  C: (f, a) => f(...a)
2464
2514
  });
2465
2515
  (0, import_invariant7.invariant)(this._lifecycleState === import_context7.LifecycleState.OPEN, "Not open.", {
2466
2516
  F: __dxlog_file9,
2467
- L: 320,
2517
+ L: 321,
2468
2518
  S: this,
2469
2519
  A: [
2470
2520
  "this._lifecycleState === LifecycleState.OPEN",
@@ -2473,7 +2523,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2473
2523
  });
2474
2524
  (0, import_invariant7.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
2475
2525
  F: __dxlog_file9,
2476
- L: 321,
2526
+ L: 322,
2477
2527
  S: this,
2478
2528
  A: [
2479
2529
  "!this._spaces.has(opts.spaceKey)",
@@ -2497,7 +2547,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2497
2547
  const space = this._spaceManager.spaces.get(options.spaceKey);
2498
2548
  (0, import_invariant7.invariant)(space, void 0, {
2499
2549
  F: __dxlog_file9,
2500
- L: 341,
2550
+ L: 342,
2501
2551
  S: this,
2502
2552
  A: [
2503
2553
  "space",
@@ -2510,7 +2560,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2510
2560
  const credentials = await (0, import_credentials9.createAdmissionCredentials)(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
2511
2561
  (0, import_invariant7.invariant)(credentials[0].credential, void 0, {
2512
2562
  F: __dxlog_file9,
2513
- L: 360,
2563
+ L: 361,
2514
2564
  S: this,
2515
2565
  A: [
2516
2566
  "credentials[0].credential",
@@ -2520,7 +2570,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2520
2570
  const spaceMemberCredential = credentials[0].credential.credential;
2521
2571
  (0, import_invariant7.invariant)((0, import_credentials9.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2522
2572
  F: __dxlog_file9,
2523
- L: 362,
2573
+ L: 363,
2524
2574
  S: this,
2525
2575
  A: [
2526
2576
  "getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2558,7 +2608,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2558
2608
  const space = this._spaces.get(spaceKey);
2559
2609
  (0, import_invariant7.invariant)(space, "Space not found.", {
2560
2610
  F: __dxlog_file9,
2561
- L: 399,
2611
+ L: 400,
2562
2612
  S: this,
2563
2613
  A: [
2564
2614
  "space",
@@ -2583,7 +2633,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2583
2633
  metadata
2584
2634
  }, {
2585
2635
  F: __dxlog_file9,
2586
- L: 418,
2636
+ L: 419,
2587
2637
  S: this,
2588
2638
  C: (f, a) => f(...a)
2589
2639
  });
@@ -2627,7 +2677,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2627
2677
  err
2628
2678
  }, {
2629
2679
  F: __dxlog_file9,
2630
- L: 460,
2680
+ L: 461,
2631
2681
  S: this,
2632
2682
  C: (f, a) => f(...a)
2633
2683
  });
@@ -2637,7 +2687,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2637
2687
  onAuthFailure: () => {
2638
2688
  import_log9.log.warn("auth failure", void 0, {
2639
2689
  F: __dxlog_file9,
2640
- L: 465,
2690
+ L: 466,
2641
2691
  S: this,
2642
2692
  C: (f, a) => f(...a)
2643
2693
  });
@@ -2670,7 +2720,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2670
2720
  space: space.key
2671
2721
  }, {
2672
2722
  F: __dxlog_file9,
2673
- L: 492,
2723
+ L: 493,
2674
2724
  S: this,
2675
2725
  C: (f, a) => f(...a)
2676
2726
  });
@@ -2681,7 +2731,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2681
2731
  open: this._lifecycleState === import_context7.LifecycleState.OPEN
2682
2732
  }, {
2683
2733
  F: __dxlog_file9,
2684
- L: 495,
2734
+ L: 496,
2685
2735
  S: this,
2686
2736
  C: (f, a) => f(...a)
2687
2737
  });
@@ -2700,7 +2750,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2700
2750
  space: space.key
2701
2751
  }, {
2702
2752
  F: __dxlog_file9,
2703
- L: 503,
2753
+ L: 504,
2704
2754
  S: this,
2705
2755
  C: (f, a) => f(...a)
2706
2756
  });
@@ -2709,7 +2759,8 @@ var DataSpaceManager = class extends import_context7.Resource {
2709
2759
  cache: metadata.cache,
2710
2760
  edgeConnection: this._edgeConnection,
2711
2761
  edgeHttpClient: this._edgeHttpClient,
2712
- edgeFeatures: this._edgeFeatures
2762
+ edgeFeatures: this._edgeFeatures,
2763
+ activeEdgeNotarizationPollingInterval: this._runtimeParams?.activeEdgeNotarizationPollingInterval
2713
2764
  });
2714
2765
  dataSpace.postOpen.append(async () => {
2715
2766
  const setting = dataSpace.getEdgeReplicationSetting();
@@ -2720,7 +2771,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2720
2771
  spaceId: dataSpace.id
2721
2772
  }, {
2722
2773
  F: __dxlog_file9,
2723
- L: 516,
2774
+ L: 518,
2724
2775
  S: this,
2725
2776
  C: (f, a) => f(...a)
2726
2777
  });
@@ -2750,7 +2801,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2750
2801
  space: space.key
2751
2802
  }, {
2752
2803
  F: __dxlog_file9,
2753
- L: 543,
2804
+ L: 545,
2754
2805
  S: this,
2755
2806
  C: (f, a) => f(...a)
2756
2807
  });
@@ -2783,7 +2834,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2783
2834
  closedSessions
2784
2835
  }, {
2785
2836
  F: __dxlog_file9,
2786
- L: 569,
2837
+ L: 571,
2787
2838
  S: this,
2788
2839
  C: (f, a) => f(...a)
2789
2840
  });
@@ -2798,7 +2849,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2798
2849
  peerId: peerState.peerId
2799
2850
  }, {
2800
2851
  F: __dxlog_file9,
2801
- L: 583,
2852
+ L: 585,
2802
2853
  S: this,
2803
2854
  C: (f, a) => f(...a)
2804
2855
  });
@@ -3289,6 +3340,9 @@ var Identity = class {
3289
3340
  get controlPipeline() {
3290
3341
  return this.space.controlPipeline;
3291
3342
  }
3343
+ get haloSpaceId() {
3344
+ return this.space.id;
3345
+ }
3292
3346
  get haloSpaceKey() {
3293
3347
  return this.space.key;
3294
3348
  }
@@ -3311,7 +3365,7 @@ var Identity = class {
3311
3365
  getIdentityCredentialSigner() {
3312
3366
  (0, import_invariant6.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
3313
3367
  F: __dxlog_file11,
3314
- L: 191,
3368
+ L: 195,
3315
3369
  S: this,
3316
3370
  A: [
3317
3371
  "this._deviceStateMachine.deviceCredentialChain",
@@ -3355,7 +3409,7 @@ var Identity = class {
3355
3409
  dataFeedKey
3356
3410
  }, {
3357
3411
  F: __dxlog_file11,
3358
- L: 216,
3412
+ L: 220,
3359
3413
  S: this,
3360
3414
  C: (f, a) => f(...a)
3361
3415
  });
@@ -4089,7 +4143,7 @@ var DataSpace = class {
4089
4143
  constructor(params) {
4090
4144
  this._ctx = new import_context4.Context(void 0, {
4091
4145
  F: __dxlog_file14,
4092
- L: 95
4146
+ L: 96
4093
4147
  });
4094
4148
  this._cache = void 0;
4095
4149
  this._edgeFeedReplicator = void 0;
@@ -4118,7 +4172,8 @@ var DataSpace = class {
4118
4172
  this._notarizationPlugin = new NotarizationPlugin({
4119
4173
  spaceId: this._inner.id,
4120
4174
  edgeClient: params.edgeHttpClient,
4121
- edgeFeatures: params.edgeFeatures
4175
+ edgeFeatures: params.edgeFeatures,
4176
+ activeEdgePollingInterval: params.activeEdgeNotarizationPollingInterval
4122
4177
  });
4123
4178
  this.authVerifier = new TrustedKeySetAuthVerifier({
4124
4179
  trustedKeysProvider: () => new import_util4.ComplexSet(import_keys4.PublicKey.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => member.role !== import_credentials3.SpaceMember.Role.REMOVED).map((member) => member.key)),
@@ -4137,7 +4192,7 @@ var DataSpace = class {
4137
4192
  state: import_services4.SpaceState[this._state]
4138
4193
  }, {
4139
4194
  F: __dxlog_file14,
4140
- L: 170,
4195
+ L: 172,
4141
4196
  S: this,
4142
4197
  C: (f, a) => f(...a)
4143
4198
  });
@@ -4196,7 +4251,7 @@ var DataSpace = class {
4196
4251
  }
4197
4252
  await this._inner.open(new import_context4.Context(void 0, {
4198
4253
  F: __dxlog_file14,
4199
- L: 244
4254
+ L: 246
4200
4255
  }));
4201
4256
  await this._inner.startProtocol();
4202
4257
  await this._edgeFeedReplicator?.open();
@@ -4205,7 +4260,7 @@ var DataSpace = class {
4205
4260
  state: import_services4.SpaceState[this._state]
4206
4261
  }, {
4207
4262
  F: __dxlog_file14,
4208
- L: 250,
4263
+ L: 252,
4209
4264
  S: this,
4210
4265
  C: (f, a) => f(...a)
4211
4266
  });
@@ -4225,14 +4280,14 @@ var DataSpace = class {
4225
4280
  state: import_services4.SpaceState[this._state]
4226
4281
  }, {
4227
4282
  F: __dxlog_file14,
4228
- L: 269,
4283
+ L: 271,
4229
4284
  S: this,
4230
4285
  C: (f, a) => f(...a)
4231
4286
  });
4232
4287
  await this._ctx.dispose();
4233
4288
  this._ctx = new import_context4.Context(void 0, {
4234
4289
  F: __dxlog_file14,
4235
- L: 271
4290
+ L: 273
4236
4291
  });
4237
4292
  if (this._edgeFeedReplicator) {
4238
4293
  this.inner.protocol.feedAdded.remove(this._onFeedAdded);
@@ -4265,7 +4320,7 @@ var DataSpace = class {
4265
4320
  if (err instanceof import_protocols3.CancelledError || err instanceof import_context4.ContextDisposedError) {
4266
4321
  (0, import_log4.log)("data pipeline initialization cancelled", err, {
4267
4322
  F: __dxlog_file14,
4268
- L: 309,
4323
+ L: 311,
4269
4324
  S: this,
4270
4325
  C: (f, a) => f(...a)
4271
4326
  });
@@ -4273,7 +4328,7 @@ var DataSpace = class {
4273
4328
  }
4274
4329
  import_log4.log.error("Error initializing data pipeline", err, {
4275
4330
  F: __dxlog_file14,
4276
- L: 313,
4331
+ L: 315,
4277
4332
  S: this,
4278
4333
  C: (f, a) => f(...a)
4279
4334
  });
@@ -4282,7 +4337,7 @@ var DataSpace = class {
4282
4337
  state: import_services4.SpaceState[this._state]
4283
4338
  }, {
4284
4339
  F: __dxlog_file14,
4285
- L: 315,
4340
+ L: 317,
4286
4341
  S: this,
4287
4342
  C: (f, a) => f(...a)
4288
4343
  });
@@ -4302,13 +4357,13 @@ var DataSpace = class {
4302
4357
  state: import_services4.SpaceState[this._state]
4303
4358
  }, {
4304
4359
  F: __dxlog_file14,
4305
- L: 331,
4360
+ L: 333,
4306
4361
  S: this,
4307
4362
  C: (f, a) => f(...a)
4308
4363
  });
4309
4364
  (0, import_log4.log)("initializing control pipeline", void 0, {
4310
4365
  F: __dxlog_file14,
4311
- L: 333,
4366
+ L: 335,
4312
4367
  S: this,
4313
4368
  C: (f, a) => f(...a)
4314
4369
  });
@@ -4317,21 +4372,21 @@ var DataSpace = class {
4317
4372
  const ready = this.stateUpdate.waitForCondition(() => this._state === import_services4.SpaceState.SPACE_READY);
4318
4373
  (0, import_log4.log)("initializing automerge root", void 0, {
4319
4374
  F: __dxlog_file14,
4320
- L: 341,
4375
+ L: 343,
4321
4376
  S: this,
4322
4377
  C: (f, a) => f(...a)
4323
4378
  });
4324
4379
  this._automergeSpaceState.startProcessingRootDocs();
4325
4380
  (0, import_log4.log)("waiting for space to be ready", void 0, {
4326
4381
  F: __dxlog_file14,
4327
- L: 345,
4382
+ L: 347,
4328
4383
  S: this,
4329
4384
  C: (f, a) => f(...a)
4330
4385
  });
4331
4386
  await ready;
4332
4387
  (0, import_log4.log)("space is ready", void 0, {
4333
4388
  F: __dxlog_file14,
4334
- L: 347,
4389
+ L: 349,
4335
4390
  S: this,
4336
4391
  C: (f, a) => f(...a)
4337
4392
  });
@@ -4343,7 +4398,7 @@ var DataSpace = class {
4343
4398
  state: import_services4.SpaceState[this._state]
4344
4399
  }, {
4345
4400
  F: __dxlog_file14,
4346
- L: 354,
4401
+ L: 356,
4347
4402
  S: this,
4348
4403
  C: (f, a) => f(...a)
4349
4404
  });
@@ -4360,7 +4415,7 @@ var DataSpace = class {
4360
4415
  await this._createWritableFeeds();
4361
4416
  (0, import_log4.log)("writable feeds created", void 0, {
4362
4417
  F: __dxlog_file14,
4363
- L: 371,
4418
+ L: 373,
4364
4419
  S: this,
4365
4420
  C: (f, a) => f(...a)
4366
4421
  });
@@ -4414,7 +4469,7 @@ var DataSpace = class {
4414
4469
  count: credentials.length
4415
4470
  }, {
4416
4471
  F: __dxlog_file14,
4417
- L: 429,
4472
+ L: 431,
4418
4473
  S: this,
4419
4474
  C: (f, a) => f(...a)
4420
4475
  });
@@ -4425,14 +4480,14 @@ var DataSpace = class {
4425
4480
  });
4426
4481
  (0, import_log4.log)("credentials notarized", void 0, {
4427
4482
  F: __dxlog_file14,
4428
- L: 433,
4483
+ L: 435,
4429
4484
  S: this,
4430
4485
  C: (f, a) => f(...a)
4431
4486
  });
4432
4487
  } catch (err) {
4433
4488
  import_log4.log.error("error notarizing credentials for feed admission", err, {
4434
4489
  F: __dxlog_file14,
4435
- L: 435,
4490
+ L: 437,
4436
4491
  S: this,
4437
4492
  C: (f, a) => f(...a)
4438
4493
  });
@@ -4447,7 +4502,7 @@ var DataSpace = class {
4447
4502
  rootUrl
4448
4503
  }, {
4449
4504
  F: __dxlog_file14,
4450
- L: 445,
4505
+ L: 447,
4451
4506
  S: this,
4452
4507
  C: (f, a) => f(...a)
4453
4508
  });
@@ -4499,7 +4554,7 @@ var DataSpace = class {
4499
4554
  err
4500
4555
  }, {
4501
4556
  F: __dxlog_file14,
4502
- L: 488,
4557
+ L: 490,
4503
4558
  S: this,
4504
4559
  C: (f, a) => f(...a)
4505
4560
  });
@@ -4589,7 +4644,7 @@ var DataSpace = class {
4589
4644
  state: import_services4.SpaceState[this._state]
4590
4645
  }, {
4591
4646
  F: __dxlog_file14,
4592
- L: 570,
4647
+ L: 572,
4593
4648
  S: this,
4594
4649
  C: (f, a) => f(...a)
4595
4650
  });
@@ -4908,15 +4963,16 @@ var EdgeInvitationHandler = class {
4908
4963
  return await this._client.joinSpaceByInvitation(spaceId, request);
4909
4964
  } catch (error) {
4910
4965
  if (error instanceof import_protocols10.EdgeAuthChallengeError) {
4911
- guardedState.set(this, import_services12.Invitation.State.AUTHENTICATING);
4912
4966
  const publicKey = guardedState.current.guestKeypair?.publicKey;
4913
4967
  const privateKey = guardedState.current.guestKeypair?.privateKey;
4914
4968
  if (!privateKey || !publicKey) {
4915
4969
  throw error;
4916
4970
  }
4917
- const signature = await (0, import_crypto2.ed25519Signature)(privateKey, Buffer.from(error.challenge, "base64"));
4918
- request.signature = Buffer.from(signature).toString("base64");
4919
- return this._client.joinSpaceByInvitation(spaceId, request);
4971
+ const signature = (0, import_crypto2.sign)(Buffer.from(error.challenge, "base64"), privateKey);
4972
+ return this._client.joinSpaceByInvitation(spaceId, {
4973
+ ...request,
4974
+ signature: Buffer.from(signature).toString("base64")
4975
+ });
4920
4976
  } else {
4921
4977
  throw error;
4922
4978
  }
@@ -5954,7 +6010,7 @@ var InvitationsHandler = class {
5954
6010
  const edgeInvitationHandler = new EdgeInvitationHandler(this._connectionParams?.edgeInvitations, this._edgeClient, {
5955
6011
  onInvitationSuccess: async (admissionResponse, admissionRequest) => {
5956
6012
  const result = await protocol.accept(admissionResponse, admissionRequest);
5957
- (0, import_log13.log)("admitted by edge", {
6013
+ import_log13.log.info("admitted by edge", {
5958
6014
  ...protocol.toJSON()
5959
6015
  }, {
5960
6016
  F: __dxlog_file21,
@@ -6071,7 +6127,6 @@ var InvitationsHandler = class {
6071
6127
  S: this,
6072
6128
  C: (f, a) => f(...a)
6073
6129
  });
6074
- setState(import_services11.Invitation.State.AUTHENTICATING);
6075
6130
  const signature = (0, import_crypto.sign)(Buffer.from(introductionResponse.challenge), invitation.guestKeypair.privateKey);
6076
6131
  const response = await extension.rpc.InvitationHostService.authenticate({
6077
6132
  signedChallenge: signature
@@ -6939,6 +6994,250 @@ function _ts_decorate9(decorators, target, key, desc) {
6939
6994
  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;
6940
6995
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6941
6996
  }
6997
+ var __dxlog_file25 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/agents/edge-agent-manager.ts";
6998
+ var AGENT_STATUS_QUERY_RETRY_INTERVAL = 5e3;
6999
+ var AGENT_STATUS_QUERY_RETRY_JITTER = 1e3;
7000
+ var EdgeAgentManager = class extends import_context15.Resource {
7001
+ constructor(_edgeFeatures, _edgeHttpClient, _dataSpaceManager, _identity) {
7002
+ super();
7003
+ this._edgeFeatures = _edgeFeatures;
7004
+ this._edgeHttpClient = _edgeHttpClient;
7005
+ this._dataSpaceManager = _dataSpaceManager;
7006
+ this._identity = _identity;
7007
+ this.agentStatusChanged = new import_async21.Event();
7008
+ this._lastKnownDeviceCount = 0;
7009
+ }
7010
+ get agentStatus() {
7011
+ return this._agentStatus;
7012
+ }
7013
+ get agentExists() {
7014
+ return this._agentStatus && this._agentStatus !== import_protocols14.EdgeAgentStatus.NOT_FOUND;
7015
+ }
7016
+ async createAgent() {
7017
+ (0, import_invariant20.invariant)(this.isOpen, void 0, {
7018
+ F: __dxlog_file25,
7019
+ L: 52,
7020
+ S: this,
7021
+ A: [
7022
+ "this.isOpen",
7023
+ ""
7024
+ ]
7025
+ });
7026
+ (0, import_invariant20.invariant)(this._edgeHttpClient, void 0, {
7027
+ F: __dxlog_file25,
7028
+ L: 53,
7029
+ S: this,
7030
+ A: [
7031
+ "this._edgeHttpClient",
7032
+ ""
7033
+ ]
7034
+ });
7035
+ (0, import_invariant20.invariant)(this._edgeFeatures?.agents, void 0, {
7036
+ F: __dxlog_file25,
7037
+ L: 54,
7038
+ S: this,
7039
+ A: [
7040
+ "this._edgeFeatures?.agents",
7041
+ ""
7042
+ ]
7043
+ });
7044
+ const response = await this._edgeHttpClient.createAgent({
7045
+ identityKey: this._identity.identityKey.toHex(),
7046
+ haloSpaceId: this._identity.haloSpaceId,
7047
+ haloSpaceKey: this._identity.haloSpaceKey.toHex()
7048
+ });
7049
+ const deviceKey = import_keys15.PublicKey.fromHex(response.deviceKey);
7050
+ await this._identity.admitDevice({
7051
+ deviceKey,
7052
+ controlFeedKey: import_keys15.PublicKey.fromHex(response.feedKey),
7053
+ // TODO: agents don't have data feed, should be removed
7054
+ dataFeedKey: import_keys15.PublicKey.random()
7055
+ });
7056
+ (0, import_log22.log)("agent created", response, {
7057
+ F: __dxlog_file25,
7058
+ L: 71,
7059
+ S: this,
7060
+ C: (f, a) => f(...a)
7061
+ });
7062
+ this._updateStatus(import_protocols14.EdgeAgentStatus.ACTIVE, deviceKey);
7063
+ }
7064
+ async _open() {
7065
+ const isEnabled = this._edgeHttpClient && this._edgeFeatures?.agents;
7066
+ (0, import_log22.log)("edge agent manager open", {
7067
+ isEnabled
7068
+ }, {
7069
+ F: __dxlog_file25,
7070
+ L: 79,
7071
+ S: this,
7072
+ C: (f, a) => f(...a)
7073
+ });
7074
+ if (!isEnabled) {
7075
+ return;
7076
+ }
7077
+ this._lastKnownDeviceCount = this._identity.authorizedDeviceKeys.size;
7078
+ this._fetchAgentStatusTask = new import_async21.DeferredTask(this._ctx, async () => {
7079
+ await this._fetchAgentStatus();
7080
+ });
7081
+ this._fetchAgentStatusTask.schedule();
7082
+ this._dataSpaceManager.updated.on(this._ctx, () => {
7083
+ if (this._agentDeviceKey) {
7084
+ this._ensureAgentIsInSpaces(this._agentDeviceKey);
7085
+ }
7086
+ });
7087
+ this._identity.stateUpdate.on(this._ctx, () => {
7088
+ const maybeAgentWasCreated = this._identity.authorizedDeviceKeys.size > this._lastKnownDeviceCount;
7089
+ if (this.agentExists || !maybeAgentWasCreated) {
7090
+ return;
7091
+ }
7092
+ this._lastKnownDeviceCount = this._identity.authorizedDeviceKeys.size;
7093
+ this._fetchAgentStatusTask?.schedule();
7094
+ });
7095
+ }
7096
+ async _close() {
7097
+ this._fetchAgentStatusTask = void 0;
7098
+ this._lastKnownDeviceCount = 0;
7099
+ }
7100
+ async _fetchAgentStatus() {
7101
+ (0, import_invariant20.invariant)(this._edgeHttpClient, void 0, {
7102
+ F: __dxlog_file25,
7103
+ L: 113,
7104
+ S: this,
7105
+ A: [
7106
+ "this._edgeHttpClient",
7107
+ ""
7108
+ ]
7109
+ });
7110
+ try {
7111
+ (0, import_log22.log)("fetching agent status", void 0, {
7112
+ F: __dxlog_file25,
7113
+ L: 115,
7114
+ S: this,
7115
+ C: (f, a) => f(...a)
7116
+ });
7117
+ const { agent } = await this._edgeHttpClient.getAgentStatus({
7118
+ ownerIdentityKey: this._identity.identityKey
7119
+ });
7120
+ const wasAgentCreatedDuringQuery = this._agentStatus === import_protocols14.EdgeAgentStatus.ACTIVE;
7121
+ if (!wasAgentCreatedDuringQuery) {
7122
+ const deviceKey = agent.deviceKey ? import_keys15.PublicKey.fromHex(agent.deviceKey) : void 0;
7123
+ this._updateStatus(agent.status, deviceKey);
7124
+ }
7125
+ } catch (err) {
7126
+ if (err instanceof import_protocols14.EdgeCallFailedError) {
7127
+ if (!err.isRetryable) {
7128
+ import_log22.log.warn("non retryable error on agent status fetch attempt", {
7129
+ err
7130
+ }, {
7131
+ F: __dxlog_file25,
7132
+ L: 125,
7133
+ S: this,
7134
+ C: (f, a) => f(...a)
7135
+ });
7136
+ return;
7137
+ }
7138
+ }
7139
+ const retryAfterMs = AGENT_STATUS_QUERY_RETRY_INTERVAL + Math.random() * AGENT_STATUS_QUERY_RETRY_JITTER;
7140
+ import_log22.log.info("agent status fetching failed", {
7141
+ err,
7142
+ retryAfterMs
7143
+ }, {
7144
+ F: __dxlog_file25,
7145
+ L: 130,
7146
+ S: this,
7147
+ C: (f, a) => f(...a)
7148
+ });
7149
+ (0, import_async21.scheduleTask)(this._ctx, () => this._fetchAgentStatusTask?.schedule(), retryAfterMs);
7150
+ }
7151
+ }
7152
+ /**
7153
+ * We don't want notarization plugin to always actively poll edge looking for credentials to notarize,
7154
+ * because most of the time we'll be getting an empty response.
7155
+ * Instead, we stay in active polling mode while there are spaces where we don't see our agent's feed.
7156
+ */
7157
+ _ensureAgentIsInSpaces(agentDeviceKey) {
7158
+ for (const space of this._dataSpaceManager.spaces.values()) {
7159
+ if ([
7160
+ import_services19.SpaceState.SPACE_INACTIVE,
7161
+ import_services19.SpaceState.SPACE_CLOSED
7162
+ ].includes(space.state)) {
7163
+ continue;
7164
+ }
7165
+ const agentFeedNeedsNotarization = !space.inner.spaceState.feeds.values().some((feed) => feed.assertion.deviceKey.equals(agentDeviceKey));
7166
+ space.notarizationPlugin.setActiveEdgePollingEnabled(agentFeedNeedsNotarization);
7167
+ import_log22.log.info("set active edge polling", {
7168
+ enabled: agentFeedNeedsNotarization,
7169
+ spaceId: space.id
7170
+ }, {
7171
+ F: __dxlog_file25,
7172
+ L: 150,
7173
+ S: this,
7174
+ C: (f, a) => f(...a)
7175
+ });
7176
+ }
7177
+ }
7178
+ _updateStatus(status, deviceKey) {
7179
+ this._agentStatus = status;
7180
+ this._agentDeviceKey = deviceKey;
7181
+ this.agentStatusChanged.emit(status);
7182
+ if (deviceKey) {
7183
+ this._ensureAgentIsInSpaces(deviceKey);
7184
+ }
7185
+ import_log22.log.info("agent status update", {
7186
+ status
7187
+ }, {
7188
+ F: __dxlog_file25,
7189
+ L: 161,
7190
+ S: this,
7191
+ C: (f, a) => f(...a)
7192
+ });
7193
+ }
7194
+ };
7195
+ _ts_decorate9([
7196
+ import_async21.synchronized
7197
+ ], EdgeAgentManager.prototype, "createAgent", null);
7198
+ var EdgeAgentServiceImpl = class {
7199
+ constructor(_agentManagerProvider) {
7200
+ this._agentManagerProvider = _agentManagerProvider;
7201
+ }
7202
+ async createAgent() {
7203
+ return (await this._agentManagerProvider()).createAgent();
7204
+ }
7205
+ queryAgentStatus() {
7206
+ return new import_codec_protobuf12.Stream(({ ctx, next }) => {
7207
+ next({
7208
+ status: import_services20.QueryAgentStatusResponse.AgentStatus.UNKNOWN
7209
+ });
7210
+ void this._agentManagerProvider().then((agentManager) => {
7211
+ next({
7212
+ status: mapStatus(agentManager.agentStatus)
7213
+ });
7214
+ agentManager.agentStatusChanged.on(ctx, (newStatus) => {
7215
+ next({
7216
+ status: mapStatus(newStatus)
7217
+ });
7218
+ });
7219
+ });
7220
+ });
7221
+ }
7222
+ };
7223
+ var mapStatus = (agentStatus) => {
7224
+ switch (agentStatus) {
7225
+ case import_protocols15.EdgeAgentStatus.ACTIVE:
7226
+ return import_services20.QueryAgentStatusResponse.AgentStatus.ACTIVE;
7227
+ case import_protocols15.EdgeAgentStatus.INACTIVE:
7228
+ return import_services20.QueryAgentStatusResponse.AgentStatus.INACTIVE;
7229
+ case import_protocols15.EdgeAgentStatus.NOT_FOUND:
7230
+ return import_services20.QueryAgentStatusResponse.AgentStatus.NOT_FOUND;
7231
+ case void 0:
7232
+ return import_services20.QueryAgentStatusResponse.AgentStatus.UNKNOWN;
7233
+ }
7234
+ };
7235
+ function _ts_decorate10(decorators, target, key, desc) {
7236
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7237
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7238
+ 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;
7239
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7240
+ }
6942
7241
  function _using_ctx3() {
6943
7242
  var _disposeSuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed) {
6944
7243
  var err = new Error();
@@ -7001,8 +7300,8 @@ function _using_ctx3() {
7001
7300
  }
7002
7301
  };
7003
7302
  }
7004
- var __dxlog_file25 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
7005
- var ServiceContext = class extends import_context15.Resource {
7303
+ var __dxlog_file26 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
7304
+ var ServiceContext = class extends import_context16.Resource {
7006
7305
  constructor(storage, level, networkManager, signalManager, _edgeConnection, _edgeHttpClient, _runtimeParams, _edgeFeatures) {
7007
7306
  super();
7008
7307
  this.storage = storage;
@@ -7013,12 +7312,12 @@ var ServiceContext = class extends import_context15.Resource {
7013
7312
  this._edgeHttpClient = _edgeHttpClient;
7014
7313
  this._runtimeParams = _runtimeParams;
7015
7314
  this._edgeFeatures = _edgeFeatures;
7016
- this._edgeIdentityUpdateMutex = new import_async21.Mutex();
7017
- this.initialized = new import_async21.Trigger();
7315
+ this._edgeIdentityUpdateMutex = new import_async22.Mutex();
7316
+ this.initialized = new import_async22.Trigger();
7018
7317
  this._meshReplicator = void 0;
7019
7318
  this._echoEdgeReplicator = void 0;
7020
7319
  this._handlerFactories = /* @__PURE__ */ new Map();
7021
- this._instanceId = import_keys15.PublicKey.random().toHex();
7320
+ this._instanceId = import_keys16.PublicKey.random().toHex();
7022
7321
  this.metadataStore = new import_echo_pipeline5.MetadataStore(storage.createDirectory("metadata"));
7023
7322
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
7024
7323
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
@@ -7055,7 +7354,7 @@ var ServiceContext = class extends import_context15.Resource {
7055
7354
  this._meshReplicator = new import_echo_pipeline5.MeshEchoReplicator();
7056
7355
  this.invitations = new InvitationsHandler(this.networkManager, this._edgeHttpClient, _runtimeParams?.invitationConnectionDefaultParams);
7057
7356
  this.invitationsManager = new InvitationsManager(this.invitations, (invitation) => this.getInvitationHandler(invitation), this.metadataStore);
7058
- this._handlerFactories.set(import_services19.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
7357
+ this._handlerFactories.set(import_services21.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
7059
7358
  if (!this._runtimeParams?.disableP2pReplication) {
7060
7359
  this._meshReplicator = new import_echo_pipeline5.MeshEchoReplicator();
7061
7360
  }
@@ -7067,17 +7366,17 @@ var ServiceContext = class extends import_context15.Resource {
7067
7366
  }
7068
7367
  async _open(ctx) {
7069
7368
  await this._checkStorageVersion();
7070
- (0, import_log22.log)("opening...", void 0, {
7071
- F: __dxlog_file25,
7072
- L: 184,
7369
+ (0, import_log23.log)("opening...", void 0, {
7370
+ F: __dxlog_file26,
7371
+ L: 186,
7073
7372
  S: this,
7074
7373
  C: (f, a) => f(...a)
7075
7374
  });
7076
- import_log22.log.trace("dxos.sdk.service-context.open", import_protocols14.trace.begin({
7375
+ import_log23.log.trace("dxos.sdk.service-context.open", import_protocols16.trace.begin({
7077
7376
  id: this._instanceId
7078
7377
  }), {
7079
- F: __dxlog_file25,
7080
- L: 185,
7378
+ F: __dxlog_file26,
7379
+ L: 187,
7081
7380
  S: this,
7082
7381
  C: (f, a) => f(...a)
7083
7382
  });
@@ -7100,33 +7399,33 @@ var ServiceContext = class extends import_context15.Resource {
7100
7399
  await this._initialize(ctx);
7101
7400
  }
7102
7401
  const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
7103
- (0, import_log22.log)("loaded persistent invitations", {
7402
+ (0, import_log23.log)("loaded persistent invitations", {
7104
7403
  count: loadedInvitations.invitations?.length
7105
7404
  }, {
7106
- F: __dxlog_file25,
7107
- L: 213,
7405
+ F: __dxlog_file26,
7406
+ L: 215,
7108
7407
  S: this,
7109
7408
  C: (f, a) => f(...a)
7110
7409
  });
7111
- import_log22.log.trace("dxos.sdk.service-context.open", import_protocols14.trace.end({
7410
+ import_log23.log.trace("dxos.sdk.service-context.open", import_protocols16.trace.end({
7112
7411
  id: this._instanceId
7113
7412
  }), {
7114
- F: __dxlog_file25,
7115
- L: 215,
7413
+ F: __dxlog_file26,
7414
+ L: 217,
7116
7415
  S: this,
7117
7416
  C: (f, a) => f(...a)
7118
7417
  });
7119
- (0, import_log22.log)("opened", void 0, {
7120
- F: __dxlog_file25,
7121
- L: 216,
7418
+ (0, import_log23.log)("opened", void 0, {
7419
+ F: __dxlog_file26,
7420
+ L: 218,
7122
7421
  S: this,
7123
7422
  C: (f, a) => f(...a)
7124
7423
  });
7125
7424
  }
7126
7425
  async _close(ctx) {
7127
- (0, import_log22.log)("closing...", void 0, {
7128
- F: __dxlog_file25,
7129
- L: 220,
7426
+ (0, import_log23.log)("closing...", void 0, {
7427
+ F: __dxlog_file26,
7428
+ L: 222,
7130
7429
  S: this,
7131
7430
  C: (f, a) => f(...a)
7132
7431
  });
@@ -7134,6 +7433,7 @@ var ServiceContext = class extends import_context15.Resource {
7134
7433
  await this.identityManager.identity.space.spaceState.removeCredentialProcessor(this._deviceSpaceSync);
7135
7434
  }
7136
7435
  await this.dataSpaceManager?.close();
7436
+ await this.edgeAgentManager?.close();
7137
7437
  await this.identityManager.close();
7138
7438
  await this.spaceManager.close();
7139
7439
  await this.feedStore.close();
@@ -7142,9 +7442,9 @@ var ServiceContext = class extends import_context15.Resource {
7142
7442
  await this.networkManager.close();
7143
7443
  await this.signalManager.close();
7144
7444
  await this._edgeConnection?.close();
7145
- (0, import_log22.log)("closed", void 0, {
7146
- F: __dxlog_file25,
7147
- L: 235,
7445
+ (0, import_log23.log)("closed", void 0, {
7446
+ F: __dxlog_file26,
7447
+ L: 238,
7148
7448
  S: this,
7149
7449
  C: (f, a) => f(...a)
7150
7450
  });
@@ -7153,17 +7453,17 @@ var ServiceContext = class extends import_context15.Resource {
7153
7453
  const identity = await this.identityManager.createIdentity(params);
7154
7454
  await this._setNetworkIdentity();
7155
7455
  await identity.joinNetwork();
7156
- await this._initialize(new import_context15.Context(void 0, {
7157
- F: __dxlog_file25,
7158
- L: 242
7456
+ await this._initialize(new import_context16.Context(void 0, {
7457
+ F: __dxlog_file26,
7458
+ L: 245
7159
7459
  }));
7160
7460
  return identity;
7161
7461
  }
7162
7462
  getInvitationHandler(invitation) {
7163
7463
  const factory = this._handlerFactories.get(invitation.kind);
7164
- (0, import_invariant20.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
7165
- F: __dxlog_file25,
7166
- L: 248,
7464
+ (0, import_invariant21.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
7465
+ F: __dxlog_file26,
7466
+ L: 251,
7167
7467
  S: this,
7168
7468
  A: [
7169
7469
  "factory",
@@ -7187,23 +7487,23 @@ var ServiceContext = class extends import_context15.Resource {
7187
7487
  });
7188
7488
  await identity.joinNetwork();
7189
7489
  await this.identityManager.acceptIdentity(identity, identityRecord, params.deviceProfile);
7190
- await this._initialize(new import_context15.Context(void 0, {
7191
- F: __dxlog_file25,
7192
- L: 267
7490
+ await this._initialize(new import_context16.Context(void 0, {
7491
+ F: __dxlog_file26,
7492
+ L: 270
7193
7493
  }));
7194
7494
  return identity;
7195
7495
  }
7196
7496
  async _checkStorageVersion() {
7197
7497
  await this.metadataStore.load();
7198
- if (this.metadataStore.version !== import_protocols14.STORAGE_VERSION) {
7199
- throw new import_protocols14.InvalidStorageVersionError(import_protocols14.STORAGE_VERSION, this.metadataStore.version);
7498
+ if (this.metadataStore.version !== import_protocols16.STORAGE_VERSION) {
7499
+ throw new import_protocols16.InvalidStorageVersionError(import_protocols16.STORAGE_VERSION, this.metadataStore.version);
7200
7500
  }
7201
7501
  }
7202
7502
  // Called when identity is created.
7203
7503
  async _initialize(ctx) {
7204
- (0, import_log22.log)("initializing spaces...", void 0, {
7205
- F: __dxlog_file25,
7206
- L: 282,
7504
+ (0, import_log23.log)("initializing spaces...", void 0, {
7505
+ F: __dxlog_file26,
7506
+ L: 285,
7207
7507
  S: this,
7208
7508
  C: (f, a) => f(...a)
7209
7509
  });
@@ -7237,10 +7537,12 @@ var ServiceContext = class extends import_context15.Resource {
7237
7537
  edgeFeatures: this._edgeFeatures
7238
7538
  });
7239
7539
  await this.dataSpaceManager.open();
7240
- this._handlerFactories.set(import_services19.Invitation.Kind.SPACE, (invitation) => {
7241
- (0, import_invariant20.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
7242
- F: __dxlog_file25,
7243
- L: 312,
7540
+ this.edgeAgentManager = new EdgeAgentManager(this._edgeFeatures, this._edgeHttpClient, this.dataSpaceManager, identity);
7541
+ await this.edgeAgentManager.open();
7542
+ this._handlerFactories.set(import_services21.Invitation.Kind.SPACE, (invitation) => {
7543
+ (0, import_invariant21.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
7544
+ F: __dxlog_file26,
7545
+ L: 323,
7244
7546
  S: this,
7245
7547
  A: [
7246
7548
  "this.dataSpaceManager",
@@ -7260,33 +7562,33 @@ var ServiceContext = class extends import_context15.Resource {
7260
7562
  return;
7261
7563
  }
7262
7564
  if (!this.dataSpaceManager) {
7263
- (0, import_log22.log)("dataSpaceManager not initialized yet, ignoring space admission", {
7565
+ (0, import_log23.log)("dataSpaceManager not initialized yet, ignoring space admission", {
7264
7566
  details: assertion
7265
7567
  }, {
7266
- F: __dxlog_file25,
7267
- L: 328,
7568
+ F: __dxlog_file26,
7569
+ L: 339,
7268
7570
  S: this,
7269
7571
  C: (f, a) => f(...a)
7270
7572
  });
7271
7573
  return;
7272
7574
  }
7273
7575
  if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
7274
- (0, import_log22.log)("space already exists, ignoring space admission", {
7576
+ (0, import_log23.log)("space already exists, ignoring space admission", {
7275
7577
  details: assertion
7276
7578
  }, {
7277
- F: __dxlog_file25,
7278
- L: 332,
7579
+ F: __dxlog_file26,
7580
+ L: 343,
7279
7581
  S: this,
7280
7582
  C: (f, a) => f(...a)
7281
7583
  });
7282
7584
  return;
7283
7585
  }
7284
7586
  try {
7285
- (0, import_log22.log)("accepting space recorded in halo", {
7587
+ (0, import_log23.log)("accepting space recorded in halo", {
7286
7588
  details: assertion
7287
7589
  }, {
7288
- F: __dxlog_file25,
7289
- L: 337,
7590
+ F: __dxlog_file26,
7591
+ L: 348,
7290
7592
  S: this,
7291
7593
  C: (f, a) => f(...a)
7292
7594
  });
@@ -7295,9 +7597,9 @@ var ServiceContext = class extends import_context15.Resource {
7295
7597
  genesisFeedKey: assertion.genesisFeedKey
7296
7598
  });
7297
7599
  } catch (err) {
7298
- import_log22.log.catch(err, void 0, {
7299
- F: __dxlog_file25,
7300
- L: 343,
7600
+ import_log23.log.catch(err, void 0, {
7601
+ F: __dxlog_file26,
7602
+ L: 354,
7301
7603
  S: this,
7302
7604
  C: (f, a) => f(...a)
7303
7605
  });
@@ -7313,12 +7615,12 @@ var ServiceContext = class extends import_context15.Resource {
7313
7615
  let edgeIdentity;
7314
7616
  const identity = this.identityManager.identity;
7315
7617
  if (identity) {
7316
- import_log22.log.info("Setting identity on edge connection", {
7618
+ import_log23.log.info("Setting identity on edge connection", {
7317
7619
  identity: identity.identityKey.toHex(),
7318
7620
  swarms: this.networkManager.topics
7319
7621
  }, {
7320
- F: __dxlog_file25,
7321
- L: 357,
7622
+ F: __dxlog_file26,
7623
+ L: 368,
7322
7624
  S: this,
7323
7625
  C: (f, a) => f(...a)
7324
7626
  });
@@ -7330,9 +7632,9 @@ var ServiceContext = class extends import_context15.Resource {
7330
7632
  await (0, import_debug6.warnAfterTimeout)(1e4, "Waiting for identity to be ready for edge connection", async () => {
7331
7633
  await identity.ready();
7332
7634
  });
7333
- (0, import_invariant20.invariant)(identity.deviceCredentialChain, void 0, {
7334
- F: __dxlog_file25,
7335
- L: 375,
7635
+ (0, import_invariant21.invariant)(identity.deviceCredentialChain, void 0, {
7636
+ F: __dxlog_file26,
7637
+ L: 386,
7336
7638
  S: this,
7337
7639
  A: [
7338
7640
  "identity.deviceCredentialChain",
@@ -7358,13 +7660,13 @@ var ServiceContext = class extends import_context15.Resource {
7358
7660
  }
7359
7661
  }
7360
7662
  };
7361
- _ts_decorate9([
7663
+ _ts_decorate10([
7362
7664
  import_tracing10.trace.span()
7363
7665
  ], ServiceContext.prototype, "_open", null);
7364
- _ts_decorate9([
7666
+ _ts_decorate10([
7365
7667
  import_tracing10.trace.span()
7366
7668
  ], ServiceContext.prototype, "_initialize", null);
7367
- ServiceContext = _ts_decorate9([
7669
+ ServiceContext = _ts_decorate10([
7368
7670
  (0, import_util12.safeInstanceof)("dxos.client-services.ServiceContext"),
7369
7671
  import_tracing10.trace.resource()
7370
7672
  ], ServiceContext);
@@ -7402,16 +7704,16 @@ var StorageDriver = import_config2.Runtime.Client.Storage.StorageDriver;
7402
7704
  var createStorageObjects = (config) => {
7403
7705
  const { persistent = false, keyStore, dataStore } = config ?? {};
7404
7706
  if (persistent && dataStore === StorageDriver.RAM) {
7405
- throw new import_protocols15.InvalidConfigError("RAM storage cannot be used in persistent mode.");
7707
+ throw new import_protocols17.InvalidConfigError("RAM storage cannot be used in persistent mode.");
7406
7708
  }
7407
7709
  if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
7408
- throw new import_protocols15.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
7710
+ throw new import_protocols17.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
7409
7711
  }
7410
7712
  if (persistent && keyStore === StorageDriver.RAM) {
7411
- throw new import_protocols15.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
7713
+ throw new import_protocols17.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
7412
7714
  }
7413
7715
  if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
7414
- throw new import_protocols15.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
7716
+ throw new import_protocols17.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
7415
7717
  }
7416
7718
  return {
7417
7719
  storage: (0, import_random_access_storage.createStorage)({
@@ -7442,12 +7744,12 @@ var toStorageType = (type) => {
7442
7744
  };
7443
7745
  var createLevel = async (config) => {
7444
7746
  const persistent = isPersistent(config);
7445
- const storagePath = persistent ? import_node_path.default.join(getRootPath(config), "level") : `/tmp/dxos-${import_keys16.PublicKey.random().toHex()}`;
7747
+ const storagePath = persistent ? import_node_path.default.join(getRootPath(config), "level") : `/tmp/dxos-${import_keys17.PublicKey.random().toHex()}`;
7446
7748
  const level = (0, import_kv_store.createLevel)(storagePath);
7447
7749
  await level.open();
7448
7750
  return level;
7449
7751
  };
7450
- var __dxlog_file26 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
7752
+ var __dxlog_file27 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
7451
7753
  var encodeProfileArchive = (profile) => import_automerge_repo.cbor.encode(profile);
7452
7754
  var decodeProfileArchive = (data) => import_automerge_repo.cbor.decode(data);
7453
7755
  var exportProfileData = async ({ storage, level }) => {
@@ -7460,10 +7762,10 @@ var exportProfileData = async ({ storage, level }) => {
7460
7762
  {
7461
7763
  const directory = await storage.createDirectory();
7462
7764
  const files = await directory.list();
7463
- import_log23.log.info("begin exporting files", {
7765
+ import_log24.log.info("begin exporting files", {
7464
7766
  count: files.length
7465
7767
  }, {
7466
- F: __dxlog_file26,
7768
+ F: __dxlog_file27,
7467
7769
  L: 30,
7468
7770
  S: void 0,
7469
7771
  C: (f, a) => f(...a)
@@ -7473,23 +7775,23 @@ var exportProfileData = async ({ storage, level }) => {
7473
7775
  const { size } = await file.stat();
7474
7776
  const data = await file.read(0, size);
7475
7777
  archive.storage.push({
7476
- type: import_protocols16.ProfileArchiveEntryType.FILE,
7778
+ type: import_protocols18.ProfileArchiveEntryType.FILE,
7477
7779
  key: filename,
7478
7780
  value: data
7479
7781
  });
7480
7782
  }
7481
- import_log23.log.info("done exporting files", {
7783
+ import_log24.log.info("done exporting files", {
7482
7784
  count: files.length
7483
7785
  }, {
7484
- F: __dxlog_file26,
7786
+ F: __dxlog_file27,
7485
7787
  L: 41,
7486
7788
  S: void 0,
7487
7789
  C: (f, a) => f(...a)
7488
7790
  });
7489
7791
  }
7490
7792
  {
7491
- import_log23.log.info("begin exporting kv pairs", void 0, {
7492
- F: __dxlog_file26,
7793
+ import_log24.log.info("begin exporting kv pairs", void 0, {
7794
+ F: __dxlog_file27,
7493
7795
  L: 45,
7494
7796
  S: void 0,
7495
7797
  C: (f, a) => f(...a)
@@ -7501,16 +7803,16 @@ var exportProfileData = async ({ storage, level }) => {
7501
7803
  let count = 0;
7502
7804
  for await (const [key, value] of iter) {
7503
7805
  archive.storage.push({
7504
- type: import_protocols16.ProfileArchiveEntryType.KEY_VALUE,
7806
+ type: import_protocols18.ProfileArchiveEntryType.KEY_VALUE,
7505
7807
  key,
7506
7808
  value
7507
7809
  });
7508
7810
  count++;
7509
7811
  }
7510
- import_log23.log.info("done exporting kv pairs", {
7812
+ import_log24.log.info("done exporting kv pairs", {
7511
7813
  count
7512
7814
  }, {
7513
- F: __dxlog_file26,
7815
+ F: __dxlog_file27,
7514
7816
  L: 56,
7515
7817
  S: void 0,
7516
7818
  C: (f, a) => f(...a)
@@ -7523,10 +7825,10 @@ var importProfileData = async ({ storage, level }, archive) => {
7523
7825
  let count = 0;
7524
7826
  for (const entry2 of archive.storage) {
7525
7827
  switch (entry2.type) {
7526
- case import_protocols16.ProfileArchiveEntryType.FILE: {
7828
+ case import_protocols18.ProfileArchiveEntryType.FILE: {
7527
7829
  const directory = await storage.createDirectory();
7528
- (0, import_invariant21.invariant)(typeof entry2.key === "string", "Invalid key type", {
7529
- F: __dxlog_file26,
7830
+ (0, import_invariant22.invariant)(typeof entry2.key === "string", "Invalid key type", {
7831
+ F: __dxlog_file27,
7530
7832
  L: 79,
7531
7833
  S: void 0,
7532
7834
  A: [
@@ -7535,8 +7837,8 @@ var importProfileData = async ({ storage, level }, archive) => {
7535
7837
  ]
7536
7838
  });
7537
7839
  const file = await directory.getOrCreateFile(entry2.key);
7538
- (0, import_invariant21.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
7539
- F: __dxlog_file26,
7840
+ (0, import_invariant22.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
7841
+ F: __dxlog_file27,
7540
7842
  L: 81,
7541
7843
  S: void 0,
7542
7844
  A: [
@@ -7548,9 +7850,9 @@ var importProfileData = async ({ storage, level }, archive) => {
7548
7850
  await file.close();
7549
7851
  break;
7550
7852
  }
7551
- case import_protocols16.ProfileArchiveEntryType.KEY_VALUE: {
7552
- (0, import_invariant21.invariant)(entry2.key instanceof Uint8Array, "Invalid key type", {
7553
- F: __dxlog_file26,
7853
+ case import_protocols18.ProfileArchiveEntryType.KEY_VALUE: {
7854
+ (0, import_invariant22.invariant)(entry2.key instanceof Uint8Array, "Invalid key type", {
7855
+ F: __dxlog_file27,
7554
7856
  L: 87,
7555
7857
  S: void 0,
7556
7858
  A: [
@@ -7558,8 +7860,8 @@ var importProfileData = async ({ storage, level }, archive) => {
7558
7860
  "'Invalid key type'"
7559
7861
  ]
7560
7862
  });
7561
- (0, import_invariant21.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
7562
- F: __dxlog_file26,
7863
+ (0, import_invariant22.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
7864
+ F: __dxlog_file27,
7563
7865
  L: 88,
7564
7866
  S: void 0,
7565
7867
  A: [
@@ -7579,27 +7881,27 @@ var importProfileData = async ({ storage, level }, archive) => {
7579
7881
  if (++count % 1e3 === 0) {
7580
7882
  await batch.write();
7581
7883
  batch = level.batch();
7582
- import_log23.log.info("importing", {
7884
+ import_log24.log.info("importing", {
7583
7885
  count,
7584
7886
  total: archive.storage.length,
7585
7887
  progress: `${(count / archive.storage.length * 100).toFixed()}%`
7586
7888
  }, {
7587
- F: __dxlog_file26,
7889
+ F: __dxlog_file27,
7588
7890
  L: 101,
7589
7891
  S: void 0,
7590
7892
  C: (f, a) => f(...a)
7591
7893
  });
7592
7894
  }
7593
7895
  }
7594
- import_log23.log.info("committing changes..", void 0, {
7595
- F: __dxlog_file26,
7896
+ import_log24.log.info("committing changes..", void 0, {
7897
+ F: __dxlog_file27,
7596
7898
  L: 109,
7597
7899
  S: void 0,
7598
7900
  C: (f, a) => f(...a)
7599
7901
  });
7600
7902
  await batch.write();
7601
7903
  };
7602
- var __dxlog_file27 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
7904
+ var __dxlog_file28 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
7603
7905
  var DevicesServiceImpl = class {
7604
7906
  constructor(_identityManager) {
7605
7907
  this._identityManager = _identityManager;
@@ -7608,7 +7910,7 @@ var DevicesServiceImpl = class {
7608
7910
  return this._identityManager.updateDeviceProfile(profile);
7609
7911
  }
7610
7912
  queryDevices() {
7611
- return new import_codec_protobuf12.Stream(({ next }) => {
7913
+ return new import_codec_protobuf13.Stream(({ next }) => {
7612
7914
  const update = () => {
7613
7915
  const deviceKeys = this._identityManager.identity?.authorizedDeviceKeys;
7614
7916
  if (!deviceKeys) {
@@ -7616,8 +7918,8 @@ var DevicesServiceImpl = class {
7616
7918
  devices: []
7617
7919
  });
7618
7920
  } else {
7619
- (0, import_invariant23.invariant)(this._identityManager.identity?.presence, "presence not present", {
7620
- F: __dxlog_file27,
7921
+ (0, import_invariant24.invariant)(this._identityManager.identity?.presence, "presence not present", {
7922
+ F: __dxlog_file28,
7621
7923
  L: 32,
7622
7924
  S: this,
7623
7925
  A: [
@@ -7632,9 +7934,9 @@ var DevicesServiceImpl = class {
7632
7934
  const peerState = peers.find((peer) => peer.identityKey.equals(key));
7633
7935
  return {
7634
7936
  deviceKey: key,
7635
- kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services21.DeviceKind.CURRENT : import_services21.DeviceKind.TRUSTED,
7937
+ kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services23.DeviceKind.CURRENT : import_services23.DeviceKind.TRUSTED,
7636
7938
  profile,
7637
- presence: isMe ? import_services21.Device.PresenceState.ONLINE : peerState ? import_services21.Device.PresenceState.ONLINE : import_services21.Device.PresenceState.OFFLINE
7939
+ presence: isMe ? import_services23.Device.PresenceState.ONLINE : peerState ? import_services23.Device.PresenceState.ONLINE : import_services23.Device.PresenceState.OFFLINE
7638
7940
  };
7639
7941
  })
7640
7942
  });
@@ -7658,7 +7960,7 @@ var DevicesServiceImpl = class {
7658
7960
  presenceSubscribed = true;
7659
7961
  }
7660
7962
  };
7661
- const subscriptions = new import_async23.EventSubscriptions();
7963
+ const subscriptions = new import_async24.EventSubscriptions();
7662
7964
  if (this._identityManager.identity) {
7663
7965
  subscribeIdentity();
7664
7966
  subscribePresence();
@@ -7714,7 +8016,7 @@ var ContactsServiceImpl = class {
7714
8016
  });
7715
8017
  }
7716
8018
  return acc;
7717
- }, new import_util15.ComplexMap(import_keys18.PublicKey.hash));
8019
+ }, new import_util15.ComplexMap(import_keys19.PublicKey.hash));
7718
8020
  return {
7719
8021
  contacts: [
7720
8022
  ...contacts.values()
@@ -7722,16 +8024,16 @@ var ContactsServiceImpl = class {
7722
8024
  };
7723
8025
  }
7724
8026
  queryContacts() {
7725
- const subscribedSpaceKeySet = new import_util15.ComplexSet(import_keys18.PublicKey.hash);
7726
- return new import_codec_protobuf13.Stream(({ next, ctx }) => {
7727
- const pushUpdateTask = new import_async24.UpdateScheduler(ctx, async () => {
8027
+ const subscribedSpaceKeySet = new import_util15.ComplexSet(import_keys19.PublicKey.hash);
8028
+ return new import_codec_protobuf14.Stream(({ next, ctx }) => {
8029
+ const pushUpdateTask = new import_async25.UpdateScheduler(ctx, async () => {
7728
8030
  const contacts = await this.getContacts();
7729
8031
  next(contacts);
7730
8032
  }, {
7731
8033
  maxFrequency: 2
7732
8034
  });
7733
- (0, import_async24.scheduleTask)(ctx, async () => {
7734
- const subscriptions = new import_async24.EventSubscriptions();
8035
+ (0, import_async25.scheduleTask)(ctx, async () => {
8036
+ const subscriptions = new import_async25.EventSubscriptions();
7735
8037
  ctx.onDispose(() => subscriptions.clear());
7736
8038
  const subscribeToSpaceAndUpdate = () => {
7737
8039
  const oldSetSize = subscribedSpaceKeySet.size;
@@ -7754,19 +8056,19 @@ var ContactsServiceImpl = class {
7754
8056
  };
7755
8057
  var LoggingServiceImpl = class {
7756
8058
  constructor() {
7757
- this._logs = new import_async25.Event();
8059
+ this._logs = new import_async26.Event();
7758
8060
  this._started = Date.now();
7759
- this._sessionId = import_keys19.PublicKey.random().toHex();
8061
+ this._sessionId = import_keys20.PublicKey.random().toHex();
7760
8062
  this._logProcessor = (_config, entry2) => {
7761
8063
  this._logs.emit(entry2);
7762
8064
  };
7763
8065
  }
7764
8066
  async open() {
7765
- import_log25.log.runtimeConfig.processors.push(this._logProcessor);
8067
+ import_log26.log.runtimeConfig.processors.push(this._logProcessor);
7766
8068
  }
7767
8069
  async close() {
7768
- const index = import_log25.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
7769
- import_log25.log.runtimeConfig.processors.splice(index, 1);
8070
+ const index = import_log26.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
8071
+ import_log26.log.runtimeConfig.processors.splice(index, 1);
7770
8072
  }
7771
8073
  async controlMetrics({ reset, record }) {
7772
8074
  if (reset) {
@@ -7792,7 +8094,7 @@ var LoggingServiceImpl = class {
7792
8094
  stats: (0, import_util16.numericalValues)(events, "duration")
7793
8095
  };
7794
8096
  };
7795
- return new import_codec_protobuf14.Stream(({ next }) => {
8097
+ return new import_codec_protobuf15.Stream(({ next }) => {
7796
8098
  const update = () => {
7797
8099
  const metrics2 = {
7798
8100
  timestamp: /* @__PURE__ */ new Date(),
@@ -7814,7 +8116,7 @@ var LoggingServiceImpl = class {
7814
8116
  });
7815
8117
  }
7816
8118
  queryLogs(request) {
7817
- return new import_codec_protobuf14.Stream(({ ctx, next }) => {
8119
+ return new import_codec_protobuf15.Stream(({ ctx, next }) => {
7818
8120
  const handler = (entry2) => {
7819
8121
  if (LOG_PROCESSING > 0) {
7820
8122
  return;
@@ -7827,7 +8129,7 @@ var LoggingServiceImpl = class {
7827
8129
  }
7828
8130
  const record = {
7829
8131
  ...entry2,
7830
- context: (0, import_util16.jsonify)((0, import_log25.getContextFromEntry)(entry2)),
8132
+ context: (0, import_util16.jsonify)((0, import_log26.getContextFromEntry)(entry2)),
7831
8133
  timestamp: /* @__PURE__ */ new Date(),
7832
8134
  meta: {
7833
8135
  // TODO(dmaretskyi): Fix proto.
@@ -7853,16 +8155,16 @@ var LoggingServiceImpl = class {
7853
8155
  };
7854
8156
  var matchFilter = (filter, level, path2, options) => {
7855
8157
  switch (options) {
7856
- case import_services22.QueryLogsRequest.MatchingOptions.INCLUSIVE:
8158
+ case import_services24.QueryLogsRequest.MatchingOptions.INCLUSIVE:
7857
8159
  return level >= filter.level && (!filter.pattern || path2.includes(filter.pattern));
7858
- case import_services22.QueryLogsRequest.MatchingOptions.EXPLICIT:
8160
+ case import_services24.QueryLogsRequest.MatchingOptions.EXPLICIT:
7859
8161
  return level === filter.level && (!filter.pattern || path2.includes(filter.pattern));
7860
8162
  }
7861
8163
  };
7862
8164
  var shouldLog = (entry2, request) => {
7863
- const options = request.options ?? import_services22.QueryLogsRequest.MatchingOptions.INCLUSIVE;
8165
+ const options = request.options ?? import_services24.QueryLogsRequest.MatchingOptions.INCLUSIVE;
7864
8166
  if (request.filters === void 0) {
7865
- return options === import_services22.QueryLogsRequest.MatchingOptions.INCLUSIVE;
8167
+ return options === import_services24.QueryLogsRequest.MatchingOptions.INCLUSIVE;
7866
8168
  } else {
7867
8169
  return request.filters.some((filter) => matchFilter(filter, entry2.level, entry2.meta?.F ?? "", options));
7868
8170
  }
@@ -7874,7 +8176,7 @@ var NetworkServiceImpl = class {
7874
8176
  this.signalManager = signalManager;
7875
8177
  }
7876
8178
  queryStatus() {
7877
- return new import_codec_protobuf15.Stream(({ next }) => {
8179
+ return new import_codec_protobuf16.Stream(({ next }) => {
7878
8180
  const update = () => {
7879
8181
  next({
7880
8182
  swarm: this.networkManager.connectionState,
@@ -7918,8 +8220,8 @@ var SystemServiceImpl = class {
7918
8220
  return {
7919
8221
  timestamp: /* @__PURE__ */ new Date(),
7920
8222
  diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util17.jsonKeyReplacer)({
7921
- truncate: keys === import_services23.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
7922
- humanize: keys === import_services23.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
8223
+ truncate: keys === import_services25.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
8224
+ humanize: keys === import_services25.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
7923
8225
  })))
7924
8226
  };
7925
8227
  }
@@ -7931,7 +8233,7 @@ var SystemServiceImpl = class {
7931
8233
  }
7932
8234
  // TODO(burdon): Standardize interval option in stream request?
7933
8235
  queryStatus({ interval = 3e3 } = {}) {
7934
- return new import_codec_protobuf16.Stream(({ next }) => {
8236
+ return new import_codec_protobuf17.Stream(({ next }) => {
7935
8237
  const update = () => {
7936
8238
  next({
7937
8239
  status: this._getCurrentStatus()
@@ -7950,13 +8252,13 @@ var SystemServiceImpl = class {
7950
8252
  await this._onReset();
7951
8253
  }
7952
8254
  };
7953
- function _ts_decorate10(decorators, target, key, desc) {
8255
+ function _ts_decorate11(decorators, target, key, desc) {
7954
8256
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7955
8257
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7956
8258
  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;
7957
8259
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7958
8260
  }
7959
- var __dxlog_file28 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
8261
+ var __dxlog_file29 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
7960
8262
  var ClientServicesHost = class {
7961
8263
  constructor({
7962
8264
  config,
@@ -7970,7 +8272,7 @@ var ClientServicesHost = class {
7970
8272
  runtimeParams
7971
8273
  } = {}) {
7972
8274
  this._tracingService = import_tracing11.TRACE_PROCESSOR.createTraceSender();
7973
- this._statusUpdate = new import_async22.Event();
8275
+ this._statusUpdate = new import_async23.Event();
7974
8276
  this._edgeConnection = void 0;
7975
8277
  this._edgeHttpClient = void 0;
7976
8278
  this._opening = false;
@@ -7994,9 +8296,9 @@ var ClientServicesHost = class {
7994
8296
  lockKey,
7995
8297
  onAcquire: () => {
7996
8298
  if (!this._opening) {
7997
- void this.open(new import_context16.Context(void 0, {
7998
- F: __dxlog_file28,
7999
- L: 133
8299
+ void this.open(new import_context17.Context(void 0, {
8300
+ F: __dxlog_file29,
8301
+ L: 134
8000
8302
  }));
8001
8303
  }
8002
8304
  },
@@ -8006,14 +8308,14 @@ var ClientServicesHost = class {
8006
8308
  this._systemService = new SystemServiceImpl({
8007
8309
  config: () => this._config,
8008
8310
  statusUpdate: this._statusUpdate,
8009
- getCurrentStatus: () => this.isOpen ? import_services20.SystemStatus.ACTIVE : import_services20.SystemStatus.INACTIVE,
8311
+ getCurrentStatus: () => this.isOpen ? import_services22.SystemStatus.ACTIVE : import_services22.SystemStatus.INACTIVE,
8010
8312
  getDiagnostics: () => {
8011
8313
  return createDiagnostics(this._serviceRegistry.services, this._serviceContext, this._config);
8012
8314
  },
8013
8315
  onUpdateStatus: async (status) => {
8014
- if (!this.isOpen && status === import_services20.SystemStatus.ACTIVE) {
8316
+ if (!this.isOpen && status === import_services22.SystemStatus.ACTIVE) {
8015
8317
  await this._resourceLock?.acquire();
8016
- } else if (this.isOpen && status === import_services20.SystemStatus.INACTIVE) {
8318
+ } else if (this.isOpen && status === import_services22.SystemStatus.INACTIVE) {
8017
8319
  await this._resourceLock?.release();
8018
8320
  }
8019
8321
  },
@@ -8052,25 +8354,25 @@ var ClientServicesHost = class {
8052
8354
  * Can only be called once.
8053
8355
  */
8054
8356
  initialize({ config, ...options }) {
8055
- (0, import_invariant22.invariant)(!this._open, "service host is open", {
8056
- F: __dxlog_file28,
8057
- L: 199,
8357
+ (0, import_invariant23.invariant)(!this._open, "service host is open", {
8358
+ F: __dxlog_file29,
8359
+ L: 200,
8058
8360
  S: this,
8059
8361
  A: [
8060
8362
  "!this._open",
8061
8363
  "'service host is open'"
8062
8364
  ]
8063
8365
  });
8064
- (0, import_log24.log)("initializing...", void 0, {
8065
- F: __dxlog_file28,
8066
- L: 200,
8366
+ (0, import_log25.log)("initializing...", void 0, {
8367
+ F: __dxlog_file29,
8368
+ L: 201,
8067
8369
  S: this,
8068
8370
  C: (f, a) => f(...a)
8069
8371
  });
8070
8372
  if (config) {
8071
- (0, import_invariant22.invariant)(!this._config, "config already set", {
8072
- F: __dxlog_file28,
8073
- L: 203,
8373
+ (0, import_invariant23.invariant)(!this._config, "config already set", {
8374
+ F: __dxlog_file29,
8375
+ L: 204,
8074
8376
  S: this,
8075
8377
  A: [
8076
8378
  "!this._config",
@@ -8083,9 +8385,9 @@ var ClientServicesHost = class {
8083
8385
  }
8084
8386
  }
8085
8387
  if (!options.signalManager) {
8086
- import_log24.log.warn("running signaling without telemetry metadata.", void 0, {
8087
- F: __dxlog_file28,
8088
- L: 211,
8388
+ import_log25.log.warn("running signaling without telemetry metadata.", void 0, {
8389
+ F: __dxlog_file29,
8390
+ L: 212,
8089
8391
  S: this,
8090
8392
  C: (f, a) => f(...a)
8091
8393
  });
@@ -8103,9 +8405,9 @@ var ClientServicesHost = class {
8103
8405
  edgeConnection: this._edgeConnection
8104
8406
  }) : new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
8105
8407
  this._signalManager = signalManager;
8106
- (0, import_invariant22.invariant)(!this._networkManager, "network manager already set", {
8107
- F: __dxlog_file28,
8108
- L: 233,
8408
+ (0, import_invariant23.invariant)(!this._networkManager, "network manager already set", {
8409
+ F: __dxlog_file29,
8410
+ L: 234,
8109
8411
  S: this,
8110
8412
  A: [
8111
8413
  "!this._networkManager",
@@ -8121,9 +8423,9 @@ var ClientServicesHost = class {
8121
8423
  peerKey: this._edgeConnection.peerKey
8122
8424
  } : void 0
8123
8425
  });
8124
- (0, import_log24.log)("initialized", void 0, {
8125
- F: __dxlog_file28,
8126
- L: 246,
8426
+ (0, import_log25.log)("initialized", void 0, {
8427
+ F: __dxlog_file29,
8428
+ L: 247,
8127
8429
  S: this,
8128
8430
  C: (f, a) => f(...a)
8129
8431
  });
@@ -8132,45 +8434,45 @@ var ClientServicesHost = class {
8132
8434
  if (this._open) {
8133
8435
  return;
8134
8436
  }
8135
- const traceId = import_keys17.PublicKey.random().toHex();
8136
- import_log24.log.trace("dxos.client-services.host.open", import_protocols17.trace.begin({
8437
+ const traceId = import_keys18.PublicKey.random().toHex();
8438
+ import_log25.log.trace("dxos.client-services.host.open", import_protocols19.trace.begin({
8137
8439
  id: traceId
8138
8440
  }), {
8139
- F: __dxlog_file28,
8140
- L: 257,
8441
+ F: __dxlog_file29,
8442
+ L: 258,
8141
8443
  S: this,
8142
8444
  C: (f, a) => f(...a)
8143
8445
  });
8144
- (0, import_invariant22.invariant)(this._config, "config not set", {
8145
- F: __dxlog_file28,
8146
- L: 259,
8446
+ (0, import_invariant23.invariant)(this._config, "config not set", {
8447
+ F: __dxlog_file29,
8448
+ L: 260,
8147
8449
  S: this,
8148
8450
  A: [
8149
8451
  "this._config",
8150
8452
  "'config not set'"
8151
8453
  ]
8152
8454
  });
8153
- (0, import_invariant22.invariant)(this._storage, "storage not set", {
8154
- F: __dxlog_file28,
8155
- L: 260,
8455
+ (0, import_invariant23.invariant)(this._storage, "storage not set", {
8456
+ F: __dxlog_file29,
8457
+ L: 261,
8156
8458
  S: this,
8157
8459
  A: [
8158
8460
  "this._storage",
8159
8461
  "'storage not set'"
8160
8462
  ]
8161
8463
  });
8162
- (0, import_invariant22.invariant)(this._signalManager, "signal manager not set", {
8163
- F: __dxlog_file28,
8164
- L: 261,
8464
+ (0, import_invariant23.invariant)(this._signalManager, "signal manager not set", {
8465
+ F: __dxlog_file29,
8466
+ L: 262,
8165
8467
  S: this,
8166
8468
  A: [
8167
8469
  "this._signalManager",
8168
8470
  "'signal manager not set'"
8169
8471
  ]
8170
8472
  });
8171
- (0, import_invariant22.invariant)(this._networkManager, "network manager not set", {
8172
- F: __dxlog_file28,
8173
- L: 262,
8473
+ (0, import_invariant23.invariant)(this._networkManager, "network manager not set", {
8474
+ F: __dxlog_file29,
8475
+ L: 263,
8174
8476
  S: this,
8175
8477
  A: [
8176
8478
  "this._networkManager",
@@ -8178,11 +8480,11 @@ var ClientServicesHost = class {
8178
8480
  ]
8179
8481
  });
8180
8482
  this._opening = true;
8181
- (0, import_log24.log)("opening...", {
8483
+ (0, import_log25.log)("opening...", {
8182
8484
  lockKey: this._resourceLock?.lockKey
8183
8485
  }, {
8184
- F: __dxlog_file28,
8185
- L: 265,
8486
+ F: __dxlog_file29,
8487
+ L: 266,
8186
8488
  S: this,
8187
8489
  C: (f, a) => f(...a)
8188
8490
  });
@@ -8197,6 +8499,10 @@ var ClientServicesHost = class {
8197
8499
  await this._serviceContext.initialized.wait();
8198
8500
  return this._serviceContext.dataSpaceManager;
8199
8501
  };
8502
+ const agentManagerProvider = async () => {
8503
+ await this._serviceContext.initialized.wait();
8504
+ return this._serviceContext.edgeAgentManager;
8505
+ };
8200
8506
  const identityService = new IdentityServiceImpl(this._serviceContext.identityManager, this._serviceContext.keyring, () => this._serviceContext.dataSpaceManager, (params) => this._createIdentity(params), (profile) => this._serviceContext.broadcastProfileUpdate(profile));
8201
8507
  this._serviceRegistry.setServices({
8202
8508
  SystemService: this._systemService,
@@ -8215,7 +8521,8 @@ var ClientServicesHost = class {
8215
8521
  events: new DevtoolsHostEvents(),
8216
8522
  config: this._config,
8217
8523
  context: this._serviceContext
8218
- })
8524
+ }),
8525
+ EdgeAgentService: new EdgeAgentServiceImpl(agentManagerProvider)
8219
8526
  });
8220
8527
  await this._serviceContext.open(ctx);
8221
8528
  await identityService.open();
@@ -8234,19 +8541,19 @@ var ClientServicesHost = class {
8234
8541
  this._open = true;
8235
8542
  this._statusUpdate.emit();
8236
8543
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
8237
- (0, import_log24.log)("opened", {
8544
+ (0, import_log25.log)("opened", {
8238
8545
  deviceKey
8239
8546
  }, {
8240
- F: __dxlog_file28,
8241
- L: 354,
8547
+ F: __dxlog_file29,
8548
+ L: 362,
8242
8549
  S: this,
8243
8550
  C: (f, a) => f(...a)
8244
8551
  });
8245
- import_log24.log.trace("dxos.client-services.host.open", import_protocols17.trace.end({
8552
+ import_log25.log.trace("dxos.client-services.host.open", import_protocols19.trace.end({
8246
8553
  id: traceId
8247
8554
  }), {
8248
- F: __dxlog_file28,
8249
- L: 355,
8555
+ F: __dxlog_file29,
8556
+ L: 363,
8250
8557
  S: this,
8251
8558
  C: (f, a) => f(...a)
8252
8559
  });
@@ -8256,11 +8563,11 @@ var ClientServicesHost = class {
8256
8563
  return;
8257
8564
  }
8258
8565
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
8259
- (0, import_log24.log)("closing...", {
8566
+ (0, import_log25.log)("closing...", {
8260
8567
  deviceKey
8261
8568
  }, {
8262
- F: __dxlog_file28,
8263
- L: 366,
8569
+ F: __dxlog_file29,
8570
+ L: 374,
8264
8571
  S: this,
8265
8572
  C: (f, a) => f(...a)
8266
8573
  });
@@ -8274,44 +8581,44 @@ var ClientServicesHost = class {
8274
8581
  await this._level?.close();
8275
8582
  this._open = false;
8276
8583
  this._statusUpdate.emit();
8277
- (0, import_log24.log)("closed", {
8584
+ (0, import_log25.log)("closed", {
8278
8585
  deviceKey
8279
8586
  }, {
8280
- F: __dxlog_file28,
8281
- L: 375,
8587
+ F: __dxlog_file29,
8588
+ L: 383,
8282
8589
  S: this,
8283
8590
  C: (f, a) => f(...a)
8284
8591
  });
8285
8592
  }
8286
8593
  async reset() {
8287
- const traceId = import_keys17.PublicKey.random().toHex();
8288
- import_log24.log.trace("dxos.sdk.client-services-host.reset", import_protocols17.trace.begin({
8594
+ const traceId = import_keys18.PublicKey.random().toHex();
8595
+ import_log25.log.trace("dxos.sdk.client-services-host.reset", import_protocols19.trace.begin({
8289
8596
  id: traceId
8290
8597
  }), {
8291
- F: __dxlog_file28,
8292
- L: 380,
8598
+ F: __dxlog_file29,
8599
+ L: 388,
8293
8600
  S: this,
8294
8601
  C: (f, a) => f(...a)
8295
8602
  });
8296
- import_log24.log.info("resetting...", void 0, {
8297
- F: __dxlog_file28,
8298
- L: 382,
8603
+ import_log25.log.info("resetting...", void 0, {
8604
+ F: __dxlog_file29,
8605
+ L: 390,
8299
8606
  S: this,
8300
8607
  C: (f, a) => f(...a)
8301
8608
  });
8302
8609
  await this._serviceContext?.close();
8303
8610
  await this._storage.reset();
8304
- import_log24.log.info("reset", void 0, {
8305
- F: __dxlog_file28,
8306
- L: 385,
8611
+ import_log25.log.info("reset", void 0, {
8612
+ F: __dxlog_file29,
8613
+ L: 393,
8307
8614
  S: this,
8308
8615
  C: (f, a) => f(...a)
8309
8616
  });
8310
- import_log24.log.trace("dxos.sdk.client-services-host.reset", import_protocols17.trace.end({
8617
+ import_log25.log.trace("dxos.sdk.client-services-host.reset", import_protocols19.trace.end({
8311
8618
  id: traceId
8312
8619
  }), {
8313
- F: __dxlog_file28,
8314
- L: 386,
8620
+ F: __dxlog_file29,
8621
+ L: 394,
8315
8622
  S: this,
8316
8623
  C: (f, a) => f(...a)
8317
8624
  });
@@ -8323,21 +8630,21 @@ var ClientServicesHost = class {
8323
8630
  return identity;
8324
8631
  }
8325
8632
  };
8326
- _ts_decorate10([
8633
+ _ts_decorate11([
8327
8634
  import_tracing11.trace.info()
8328
8635
  ], ClientServicesHost.prototype, "_opening", void 0);
8329
- _ts_decorate10([
8636
+ _ts_decorate11([
8330
8637
  import_tracing11.trace.info()
8331
8638
  ], ClientServicesHost.prototype, "_open", void 0);
8332
- _ts_decorate10([
8333
- import_async22.synchronized,
8639
+ _ts_decorate11([
8640
+ import_async23.synchronized,
8334
8641
  import_tracing11.trace.span()
8335
8642
  ], ClientServicesHost.prototype, "open", null);
8336
- _ts_decorate10([
8337
- import_async22.synchronized,
8643
+ _ts_decorate11([
8644
+ import_async23.synchronized,
8338
8645
  import_tracing11.trace.span()
8339
8646
  ], ClientServicesHost.prototype, "close", null);
8340
- ClientServicesHost = _ts_decorate10([
8647
+ ClientServicesHost = _ts_decorate11([
8341
8648
  import_tracing11.trace.resource()
8342
8649
  ], ClientServicesHost);
8343
8650
  // Annotate the CommonJS export names for ESM import in node:
@@ -8350,6 +8657,8 @@ ClientServicesHost = _ts_decorate10([
8350
8657
  DevtoolsHostEvents,
8351
8658
  DevtoolsServiceImpl,
8352
8659
  DiagnosticsCollector,
8660
+ EdgeAgentManager,
8661
+ EdgeAgentServiceImpl,
8353
8662
  EdgeFeedReplicator,
8354
8663
  Identity,
8355
8664
  IdentityManager,
@@ -8384,4 +8693,4 @@ ClientServicesHost = _ts_decorate10([
8384
8693
  subscribeToSpaces,
8385
8694
  subscribeToSwarmInfo
8386
8695
  });
8387
- //# sourceMappingURL=chunk-IFHGVXW2.cjs.map
8696
+ //# sourceMappingURL=chunk-DJIOUOAF.cjs.map