@dxos/client-services 0.4.10-main.e158b1a → 0.4.10-main.e9f9c10

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 (81) hide show
  1. package/dist/lib/browser/{chunk-VIHM6GWA.mjs → chunk-4GN43XQ4.mjs} +744 -559
  2. package/dist/lib/browser/chunk-4GN43XQ4.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +11 -3
  4. package/dist/lib/browser/index.mjs.map +1 -1
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs +11 -5
  7. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/{chunk-52FE74JI.cjs → chunk-V7W7YK6W.cjs} +688 -591
  9. package/dist/lib/node/chunk-V7W7YK6W.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +46 -38
  11. package/dist/lib/node/index.cjs.map +1 -1
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/packlets/testing/index.cjs +15 -9
  14. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  15. package/dist/types/src/index.d.ts +1 -0
  16. package/dist/types/src/index.d.ts.map +1 -1
  17. package/dist/types/src/packlets/diagnostics/browser-diagnostics-broadcast.d.ts +5 -0
  18. package/dist/types/src/packlets/diagnostics/browser-diagnostics-broadcast.d.ts.map +1 -0
  19. package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts +5 -0
  20. package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts.map +1 -0
  21. package/dist/types/src/packlets/diagnostics/diagnostics-collector.d.ts +15 -0
  22. package/dist/types/src/packlets/diagnostics/diagnostics-collector.d.ts.map +1 -0
  23. package/dist/types/src/packlets/{services → diagnostics}/diagnostics.d.ts +1 -1
  24. package/dist/types/src/packlets/diagnostics/diagnostics.d.ts.map +1 -0
  25. package/dist/types/src/packlets/diagnostics/index.d.ts +4 -0
  26. package/dist/types/src/packlets/diagnostics/index.d.ts.map +1 -0
  27. package/dist/types/src/packlets/invitations/invitations-handler.d.ts +0 -1
  28. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  29. package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
  30. package/dist/types/src/packlets/services/index.d.ts +1 -1
  31. package/dist/types/src/packlets/services/index.d.ts.map +1 -1
  32. package/dist/types/src/packlets/services/service-context.d.ts +7 -5
  33. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  34. package/dist/types/src/packlets/services/service-host.d.ts +5 -1
  35. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  36. package/dist/types/src/packlets/services/util.d.ts +1 -0
  37. package/dist/types/src/packlets/services/util.d.ts.map +1 -1
  38. package/dist/types/src/packlets/storage/index.d.ts +1 -0
  39. package/dist/types/src/packlets/storage/index.d.ts.map +1 -1
  40. package/dist/types/src/packlets/storage/level.d.ts +4 -0
  41. package/dist/types/src/packlets/storage/level.d.ts.map +1 -0
  42. package/dist/types/src/packlets/storage/storage.d.ts.map +1 -1
  43. package/dist/types/src/packlets/storage/util.d.ts +4 -0
  44. package/dist/types/src/packlets/storage/util.d.ts.map +1 -0
  45. package/dist/types/src/packlets/system/system-service.d.ts +1 -1
  46. package/dist/types/src/packlets/system/system-service.d.ts.map +1 -1
  47. package/dist/types/src/packlets/testing/test-builder.d.ts +5 -2
  48. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  49. package/dist/types/src/version.d.ts +1 -1
  50. package/package.json +36 -34
  51. package/src/index.ts +1 -0
  52. package/src/packlets/devices/devices-service.test.ts +1 -1
  53. package/src/packlets/diagnostics/browser-diagnostics-broadcast.ts +94 -0
  54. package/src/packlets/diagnostics/diagnostics-broadcast.ts +20 -0
  55. package/src/packlets/diagnostics/diagnostics-collector.ts +65 -0
  56. package/src/packlets/{services → diagnostics}/diagnostics.ts +2 -2
  57. package/src/packlets/diagnostics/index.ts +7 -0
  58. package/src/packlets/identity/identity-service.test.ts +1 -1
  59. package/src/packlets/invitations/device-invitation-protocol.test.ts +1 -1
  60. package/src/packlets/invitations/invitations-handler.ts +5 -12
  61. package/src/packlets/invitations/invitations-service.ts +5 -5
  62. package/src/packlets/network/network-service.test.ts +1 -1
  63. package/src/packlets/services/automerge-host.test.ts +9 -3
  64. package/src/packlets/services/index.ts +1 -1
  65. package/src/packlets/services/service-context.test.ts +9 -6
  66. package/src/packlets/services/service-context.ts +12 -5
  67. package/src/packlets/services/service-host.ts +49 -13
  68. package/src/packlets/services/service-registry.test.ts +1 -1
  69. package/src/packlets/services/util.ts +2 -0
  70. package/src/packlets/spaces/data-space-manager.test.ts +4 -4
  71. package/src/packlets/spaces/spaces-service.test.ts +1 -1
  72. package/src/packlets/storage/index.ts +1 -0
  73. package/src/packlets/storage/level.ts +19 -0
  74. package/src/packlets/storage/storage.ts +3 -9
  75. package/src/packlets/storage/util.ts +19 -0
  76. package/src/packlets/system/system-service.ts +1 -1
  77. package/src/packlets/testing/test-builder.ts +23 -5
  78. package/src/version.ts +1 -1
  79. package/dist/lib/browser/chunk-VIHM6GWA.mjs.map +0 -7
  80. package/dist/lib/node/chunk-52FE74JI.cjs.map +0 -7
  81. package/dist/types/src/packlets/services/diagnostics.d.ts.map +0 -1
@@ -1639,11 +1639,11 @@ var InvitationsHandler = class {
1639
1639
  this._networkManager = _networkManager;
1640
1640
  }
1641
1641
  createInvitation(protocol, options) {
1642
- const { invitationId = PublicKey6.random().toHex(), type = Invitation3.Type.INTERACTIVE, authMethod = Invitation3.AuthMethod.SHARED_SECRET, state = Invitation3.State.INIT, timeout = INVITATION_TIMEOUT, swarmKey = PublicKey6.random(), persistent = true, created = /* @__PURE__ */ new Date(), lifetime = 86400 } = options ?? {};
1642
+ const { invitationId = PublicKey6.random().toHex(), type = Invitation3.Type.INTERACTIVE, authMethod = Invitation3.AuthMethod.SHARED_SECRET, state = Invitation3.State.INIT, timeout = INVITATION_TIMEOUT, swarmKey = PublicKey6.random(), persistent = true, created = /* @__PURE__ */ new Date(), lifetime = 86400, multiUse = false } = options ?? {};
1643
1643
  const authCode = options?.authCode ?? (authMethod === Invitation3.AuthMethod.SHARED_SECRET ? generatePasscode(AUTHENTICATION_CODE_LENGTH) : void 0);
1644
1644
  invariant6(protocol, void 0, {
1645
1645
  F: __dxlog_file7,
1646
- L: 84,
1646
+ L: 85,
1647
1647
  S: this,
1648
1648
  A: [
1649
1649
  "protocol",
@@ -1658,9 +1658,10 @@ var InvitationsHandler = class {
1658
1658
  swarmKey,
1659
1659
  authCode,
1660
1660
  timeout,
1661
- persistent,
1661
+ persistent: persistent && type !== Invitation3.Type.OFFLINE,
1662
1662
  created,
1663
1663
  lifetime,
1664
+ multiUse,
1664
1665
  ...protocol.getInvitationContext()
1665
1666
  };
1666
1667
  const stream = new PushStream();
@@ -1675,7 +1676,7 @@ var InvitationsHandler = class {
1675
1676
  ...protocol.toJSON()
1676
1677
  }, {
1677
1678
  F: __dxlog_file7,
1678
- L: 109,
1679
+ L: 111,
1679
1680
  S: this,
1680
1681
  C: (f, a) => f(...a)
1681
1682
  });
@@ -1700,7 +1701,7 @@ var InvitationsHandler = class {
1700
1701
  const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
1701
1702
  invariant6(deviceKey, void 0, {
1702
1703
  F: __dxlog_file7,
1703
- L: 130,
1704
+ L: 132,
1704
1705
  S: this,
1705
1706
  A: [
1706
1707
  "deviceKey",
@@ -1723,7 +1724,7 @@ var InvitationsHandler = class {
1723
1724
  id: traceId
1724
1725
  }), {
1725
1726
  F: __dxlog_file7,
1726
- L: 148,
1727
+ L: 150,
1727
1728
  S: this,
1728
1729
  C: (f, a) => f(...a)
1729
1730
  });
@@ -1731,7 +1732,7 @@ var InvitationsHandler = class {
1731
1732
  ...protocol.toJSON()
1732
1733
  }, {
1733
1734
  F: __dxlog_file7,
1734
- L: 149,
1735
+ L: 151,
1735
1736
  S: this,
1736
1737
  C: (f, a) => f(...a)
1737
1738
  });
@@ -1747,7 +1748,7 @@ var InvitationsHandler = class {
1747
1748
  ...protocol.toJSON()
1748
1749
  }, {
1749
1750
  F: __dxlog_file7,
1750
- L: 152,
1751
+ L: 154,
1751
1752
  S: this,
1752
1753
  C: (f, a) => f(...a)
1753
1754
  });
@@ -1759,7 +1760,7 @@ var InvitationsHandler = class {
1759
1760
  id: traceId
1760
1761
  }), {
1761
1762
  F: __dxlog_file7,
1762
- L: 154,
1763
+ L: 156,
1763
1764
  S: this,
1764
1765
  C: (f, a) => f(...a)
1765
1766
  });
@@ -1769,7 +1770,7 @@ var InvitationsHandler = class {
1769
1770
  ...protocol.toJSON()
1770
1771
  }, {
1771
1772
  F: __dxlog_file7,
1772
- L: 157,
1773
+ L: 159,
1773
1774
  S: this,
1774
1775
  C: (f, a) => f(...a)
1775
1776
  });
@@ -1780,7 +1781,7 @@ var InvitationsHandler = class {
1780
1781
  } else {
1781
1782
  log5.error("failed", err, {
1782
1783
  F: __dxlog_file7,
1783
- L: 160,
1784
+ L: 162,
1784
1785
  S: this,
1785
1786
  C: (f, a) => f(...a)
1786
1787
  });
@@ -1791,12 +1792,12 @@ var InvitationsHandler = class {
1791
1792
  error: err
1792
1793
  }), {
1793
1794
  F: __dxlog_file7,
1794
- L: 163,
1795
+ L: 165,
1795
1796
  S: this,
1796
1797
  C: (f, a) => f(...a)
1797
1798
  });
1798
1799
  } finally {
1799
- if (type !== Invitation3.Type.MULTIUSE) {
1800
+ if (!multiUse) {
1800
1801
  await swarmConnection.close();
1801
1802
  await ctx.dispose();
1802
1803
  }
@@ -1812,7 +1813,7 @@ var InvitationsHandler = class {
1812
1813
  ...protocol.toJSON()
1813
1814
  }, {
1814
1815
  F: __dxlog_file7,
1815
- L: 178,
1816
+ L: 180,
1816
1817
  S: this,
1817
1818
  C: (f, a) => f(...a)
1818
1819
  });
@@ -1823,7 +1824,7 @@ var InvitationsHandler = class {
1823
1824
  } else {
1824
1825
  log5.error("failed", err, {
1825
1826
  F: __dxlog_file7,
1826
- L: 181,
1827
+ L: 183,
1827
1828
  S: this,
1828
1829
  C: (f, a) => f(...a)
1829
1830
  });
@@ -1837,7 +1838,7 @@ var InvitationsHandler = class {
1837
1838
  if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
1838
1839
  log5.warn("invitation has already expired", void 0, {
1839
1840
  F: __dxlog_file7,
1840
- L: 192,
1841
+ L: 194,
1841
1842
  S: this,
1842
1843
  C: (f, a) => f(...a)
1843
1844
  });
@@ -1888,7 +1889,7 @@ var InvitationsHandler = class {
1888
1889
  const { timeout = INVITATION_TIMEOUT } = invitation;
1889
1890
  invariant6(protocol, void 0, {
1890
1891
  F: __dxlog_file7,
1891
- L: 246,
1892
+ L: 248,
1892
1893
  S: this,
1893
1894
  A: [
1894
1895
  "protocol",
@@ -1898,7 +1899,7 @@ var InvitationsHandler = class {
1898
1899
  if (deviceProfile) {
1899
1900
  invariant6(invitation.kind === Invitation3.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
1900
1901
  F: __dxlog_file7,
1901
- L: 250,
1902
+ L: 252,
1902
1903
  S: this,
1903
1904
  A: [
1904
1905
  "invitation.kind === Invitation.Kind.DEVICE",
@@ -1913,7 +1914,7 @@ var InvitationsHandler = class {
1913
1914
  const setState = (newData) => {
1914
1915
  invariant6(newData.state !== void 0, void 0, {
1915
1916
  F: __dxlog_file7,
1916
- L: 261,
1917
+ L: 263,
1917
1918
  S: this,
1918
1919
  A: [
1919
1920
  "newData.state !== undefined",
@@ -1933,7 +1934,7 @@ var InvitationsHandler = class {
1933
1934
  ...protocol.toJSON()
1934
1935
  }, {
1935
1936
  F: __dxlog_file7,
1936
- L: 269,
1937
+ L: 271,
1937
1938
  S: this,
1938
1939
  C: (f, a) => f(...a)
1939
1940
  });
@@ -1943,7 +1944,7 @@ var InvitationsHandler = class {
1943
1944
  } else {
1944
1945
  log5.warn("auth failed", err, {
1945
1946
  F: __dxlog_file7,
1946
- L: 272,
1947
+ L: 274,
1947
1948
  S: this,
1948
1949
  C: (f, a) => f(...a)
1949
1950
  });
@@ -1957,7 +1958,7 @@ var InvitationsHandler = class {
1957
1958
  ...protocol.toJSON()
1958
1959
  }, {
1959
1960
  F: __dxlog_file7,
1960
- L: 280,
1961
+ L: 282,
1961
1962
  S: this,
1962
1963
  C: (f, a) => f(...a)
1963
1964
  });
@@ -1972,7 +1973,7 @@ var InvitationsHandler = class {
1972
1973
  currentState
1973
1974
  }, {
1974
1975
  F: __dxlog_file7,
1975
- L: 290,
1976
+ L: 292,
1976
1977
  S: this,
1977
1978
  C: (f, a) => f(...a)
1978
1979
  });
@@ -1987,7 +1988,7 @@ var InvitationsHandler = class {
1987
1988
  id: traceId
1988
1989
  }), {
1989
1990
  F: __dxlog_file7,
1990
- L: 299,
1991
+ L: 301,
1991
1992
  S: this,
1992
1993
  C: (f, a) => f(...a)
1993
1994
  });
@@ -1999,7 +2000,7 @@ var InvitationsHandler = class {
1999
2000
  ...protocol.toJSON()
2000
2001
  }, {
2001
2002
  F: __dxlog_file7,
2002
- L: 307,
2003
+ L: 309,
2003
2004
  S: this,
2004
2005
  C: (f, a) => f(...a)
2005
2006
  });
@@ -2010,7 +2011,7 @@ var InvitationsHandler = class {
2010
2011
  ...protocol.toJSON()
2011
2012
  }, {
2012
2013
  F: __dxlog_file7,
2013
- L: 311,
2014
+ L: 313,
2014
2015
  S: this,
2015
2016
  C: (f, a) => f(...a)
2016
2017
  });
@@ -2020,7 +2021,7 @@ var InvitationsHandler = class {
2020
2021
  response: introductionResponse
2021
2022
  }, {
2022
2023
  F: __dxlog_file7,
2023
- L: 315,
2024
+ L: 317,
2024
2025
  S: this,
2025
2026
  C: (f, a) => f(...a)
2026
2027
  });
@@ -2029,7 +2030,7 @@ var InvitationsHandler = class {
2029
2030
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
2030
2031
  log5("guest waiting for authentication code...", void 0, {
2031
2032
  F: __dxlog_file7,
2032
- L: 321,
2033
+ L: 323,
2033
2034
  S: this,
2034
2035
  C: (f, a) => f(...a)
2035
2036
  });
@@ -2041,7 +2042,7 @@ var InvitationsHandler = class {
2041
2042
  });
2042
2043
  log5("sending authentication request", void 0, {
2043
2044
  F: __dxlog_file7,
2044
- L: 325,
2045
+ L: 327,
2045
2046
  S: this,
2046
2047
  C: (f, a) => f(...a)
2047
2048
  });
@@ -2062,7 +2063,7 @@ var InvitationsHandler = class {
2062
2063
  attempt
2063
2064
  }, {
2064
2065
  F: __dxlog_file7,
2065
- L: 336,
2066
+ L: 338,
2066
2067
  S: this,
2067
2068
  C: (f, a) => f(...a)
2068
2069
  });
@@ -2075,7 +2076,7 @@ var InvitationsHandler = class {
2075
2076
  ...protocol.toJSON()
2076
2077
  }, {
2077
2078
  F: __dxlog_file7,
2078
- L: 344,
2079
+ L: 346,
2079
2080
  S: this,
2080
2081
  C: (f, a) => f(...a)
2081
2082
  });
@@ -2087,7 +2088,7 @@ var InvitationsHandler = class {
2087
2088
  ...protocol.toJSON()
2088
2089
  }, {
2089
2090
  F: __dxlog_file7,
2090
- L: 355,
2091
+ L: 357,
2091
2092
  S: this,
2092
2093
  C: (f, a) => f(...a)
2093
2094
  });
@@ -2100,7 +2101,7 @@ var InvitationsHandler = class {
2100
2101
  id: traceId
2101
2102
  }), {
2102
2103
  F: __dxlog_file7,
2103
- L: 357,
2104
+ L: 359,
2104
2105
  S: this,
2105
2106
  C: (f, a) => f(...a)
2106
2107
  });
@@ -2110,7 +2111,7 @@ var InvitationsHandler = class {
2110
2111
  ...protocol.toJSON()
2111
2112
  }, {
2112
2113
  F: __dxlog_file7,
2113
- L: 360,
2114
+ L: 362,
2114
2115
  S: this,
2115
2116
  C: (f, a) => f(...a)
2116
2117
  });
@@ -2120,7 +2121,7 @@ var InvitationsHandler = class {
2120
2121
  } else {
2121
2122
  log5("auth failed", err, {
2122
2123
  F: __dxlog_file7,
2123
- L: 363,
2124
+ L: 365,
2124
2125
  S: this,
2125
2126
  C: (f, a) => f(...a)
2126
2127
  });
@@ -2131,7 +2132,7 @@ var InvitationsHandler = class {
2131
2132
  error: err
2132
2133
  }), {
2133
2134
  F: __dxlog_file7,
2134
- L: 366,
2135
+ L: 368,
2135
2136
  S: this,
2136
2137
  C: (f, a) => f(...a)
2137
2138
  });
@@ -2149,7 +2150,7 @@ var InvitationsHandler = class {
2149
2150
  ...protocol.toJSON()
2150
2151
  }, {
2151
2152
  F: __dxlog_file7,
2152
- L: 377,
2153
+ L: 379,
2153
2154
  S: this,
2154
2155
  C: (f, a) => f(...a)
2155
2156
  });
@@ -2159,7 +2160,7 @@ var InvitationsHandler = class {
2159
2160
  } else {
2160
2161
  log5("auth failed", err, {
2161
2162
  F: __dxlog_file7,
2162
- L: 380,
2163
+ L: 382,
2163
2164
  S: this,
2164
2165
  C: (f, a) => f(...a)
2165
2166
  });
@@ -2176,7 +2177,7 @@ var InvitationsHandler = class {
2176
2177
  } else {
2177
2178
  invariant6(invitation.swarmKey, void 0, {
2178
2179
  F: __dxlog_file7,
2179
- L: 394,
2180
+ L: 396,
2180
2181
  S: this,
2181
2182
  A: [
2182
2183
  "invitation.swarmKey",
@@ -2215,14 +2216,12 @@ var InvitationsHandler = class {
2215
2216
  return observable;
2216
2217
  }
2217
2218
  };
2218
- var invitationExpired = (invitation) => {
2219
- return invitation.created && invitation.lifetime && invitation.lifetime !== 0 && invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now();
2220
- };
2221
2219
 
2222
2220
  // packages/sdk/client-services/src/packlets/invitations/invitations-service.ts
2223
2221
  import { Event as Event3, scheduleTask as scheduleTask3 } from "@dxos/async";
2224
2222
  import { Stream as Stream8 } from "@dxos/codec-protobuf";
2225
2223
  import { Context as Context6 } from "@dxos/context";
2224
+ import { hasInvitationExpired } from "@dxos/echo-pipeline";
2226
2225
  import { invariant as invariant7 } from "@dxos/invariant";
2227
2226
  import { log as log6 } from "@dxos/log";
2228
2227
  import { Invitation as Invitation4, QueryInvitationsResponse } from "@dxos/protocols/proto/dxos/client/services";
@@ -2281,7 +2280,7 @@ var InvitationsServiceImpl = class {
2281
2280
  await this._metadataStore.removeInvitation(invitation.get().invitationId);
2282
2281
  }
2283
2282
  this._createInvitations.delete(invitation.get().invitationId);
2284
- if (invitation.get().type !== Invitation4.Type.MULTIUSE) {
2283
+ if (!invitation.get().multiUse) {
2285
2284
  this._removedCreated.emit(invitation.get());
2286
2285
  }
2287
2286
  });
@@ -2289,7 +2288,7 @@ var InvitationsServiceImpl = class {
2289
2288
  }
2290
2289
  async loadPersistentInvitations() {
2291
2290
  const persistentInvitations = this._metadataStore.getInvitations();
2292
- const freshInvitations = persistentInvitations.filter(async (invitation) => !invitationExpired(invitation));
2291
+ const freshInvitations = persistentInvitations.filter(async (invitation) => !hasInvitationExpired(invitation));
2293
2292
  const cInvitations = freshInvitations.map((persistentInvitation) => {
2294
2293
  invariant7(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
2295
2294
  F: __dxlog_file8,
@@ -2342,7 +2341,7 @@ var InvitationsServiceImpl = class {
2342
2341
  }, () => {
2343
2342
  close();
2344
2343
  this._acceptInvitations.delete(invitation.get().invitationId);
2345
- if (invitation.get().type !== Invitation4.Type.MULTIUSE) {
2344
+ if (!invitation.get().multiUse) {
2346
2345
  this._removedAccepted.emit(invitation.get());
2347
2346
  }
2348
2347
  });
@@ -2730,156 +2729,6 @@ ClientRpcServer = _ts_decorate3([
2730
2729
  trace5.resource()
2731
2730
  ], ClientRpcServer);
2732
2731
 
2733
- // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2734
- import { getFirstStreamValue } from "@dxos/codec-protobuf";
2735
- import { credentialTypeFilter } from "@dxos/credentials";
2736
- import { invariant as invariant9 } from "@dxos/invariant";
2737
- import { STORAGE_VERSION } from "@dxos/protocols";
2738
- import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
2739
- import { TRACE_PROCESSOR } from "@dxos/tracing";
2740
-
2741
- // packages/sdk/client-services/src/packlets/services/platform.ts
2742
- import { Platform } from "@dxos/protocols/proto/dxos/client/services";
2743
- var getPlatform = () => {
2744
- if (process.browser) {
2745
- if (typeof window !== "undefined") {
2746
- const { userAgent } = window.navigator;
2747
- return {
2748
- type: Platform.PLATFORM_TYPE.BROWSER,
2749
- userAgent,
2750
- uptime: Math.floor((Date.now() - window.performance.timeOrigin) / 1e3)
2751
- };
2752
- } else {
2753
- return {
2754
- type: Platform.PLATFORM_TYPE.SHARED_WORKER,
2755
- uptime: Math.floor((Date.now() - performance.timeOrigin) / 1e3)
2756
- };
2757
- }
2758
- } else {
2759
- const { platform: platform2, version, arch } = process;
2760
- return {
2761
- type: Platform.PLATFORM_TYPE.NODE,
2762
- platform: platform2,
2763
- arch,
2764
- runtime: version,
2765
- uptime: Math.floor(process.uptime()),
2766
- memory: process.memoryUsage()
2767
- };
2768
- }
2769
- };
2770
-
2771
- // packages/sdk/client-services/src/version.ts
2772
- var DXOS_VERSION = "0.4.10-main.e158b1a";
2773
-
2774
- // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2775
- var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
2776
- var DEFAULT_TIMEOUT = 1e3;
2777
- var createDiagnostics = async (clientServices, serviceContext, config) => {
2778
- const diagnostics = {
2779
- created: (/* @__PURE__ */ new Date()).toISOString(),
2780
- platform: getPlatform(),
2781
- client: {
2782
- version: DXOS_VERSION,
2783
- storage: {
2784
- version: STORAGE_VERSION
2785
- }
2786
- },
2787
- trace: TRACE_PROCESSOR.getDiagnostics()
2788
- };
2789
- {
2790
- invariant9(clientServices.LoggingService, "SystemService is not available.", {
2791
- F: __dxlog_file10,
2792
- L: 108,
2793
- S: void 0,
2794
- A: [
2795
- "clientServices.LoggingService",
2796
- "'SystemService is not available.'"
2797
- ]
2798
- });
2799
- diagnostics.metrics = await getFirstStreamValue(clientServices.LoggingService.queryMetrics({}), {
2800
- timeout: DEFAULT_TIMEOUT
2801
- }).catch(() => void 0);
2802
- }
2803
- if (typeof navigator !== "undefined" && navigator.storage) {
2804
- const map = /* @__PURE__ */ new Map();
2805
- const dir = await navigator.storage.getDirectory();
2806
- for await (const filename of dir?.keys()) {
2807
- const idx = filename.indexOf("-", filename.indexOf("-") + 1);
2808
- if (idx === -1) {
2809
- continue;
2810
- }
2811
- map.set(filename.slice(0, idx), (map.get(filename.slice(0, idx)) ?? 0) + 1);
2812
- }
2813
- diagnostics.storage = Array.from(map.entries()).sort((a, b) => b[1] - a[1]).map(([file, count]) => ({
2814
- file,
2815
- count
2816
- }));
2817
- }
2818
- const identity = serviceContext.identityManager.identity;
2819
- if (identity) {
2820
- diagnostics.identity = {
2821
- identityKey: identity.identityKey,
2822
- spaceKey: identity.space.key,
2823
- profile: identity.profileDocument
2824
- };
2825
- const { devices } = await getFirstStreamValue(clientServices.DevicesService.queryDevices(), {
2826
- timeout: DEFAULT_TIMEOUT
2827
- }).catch(() => void 0) ?? {};
2828
- diagnostics.devices = devices;
2829
- if (serviceContext.dataSpaceManager) {
2830
- diagnostics.spaces = await Promise.all(Array.from(serviceContext.dataSpaceManager.spaces.values()).map((space) => getSpaceStats(space)) ?? []);
2831
- }
2832
- const { feeds = [] } = await getFirstStreamValue(clientServices.DevtoolsHost.subscribeToFeeds({}), {
2833
- timeout: DEFAULT_TIMEOUT
2834
- }).catch(() => void 0) ?? {};
2835
- diagnostics.feeds = feeds.map(({ feedKey, bytes, length }) => ({
2836
- feedKey,
2837
- bytes,
2838
- length
2839
- }));
2840
- const status = await getFirstStreamValue(clientServices.NetworkService.queryStatus(), {
2841
- timeout: DEFAULT_TIMEOUT
2842
- }).catch(() => void 0);
2843
- diagnostics.networkStatus = status;
2844
- diagnostics.swarms = serviceContext.networkManager.connectionLog?.swarms;
2845
- }
2846
- diagnostics.config = config.values;
2847
- return diagnostics;
2848
- };
2849
- var getSpaceStats = async (space) => {
2850
- const stats = {
2851
- key: space.key,
2852
- metrics: space.metrics,
2853
- epochs: space.inner.spaceState.credentials.filter(credentialTypeFilter("dxos.halo.credentials.Epoch")).map((credential) => ({
2854
- ...credential.subject.assertion,
2855
- id: credential.id
2856
- })),
2857
- members: Array.from(space.inner.spaceState.members.values()).map((member) => ({
2858
- identity: {
2859
- identityKey: member.key,
2860
- profile: {
2861
- displayName: member.assertion.profile?.displayName
2862
- }
2863
- },
2864
- presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? SpaceMember.PresenceState.ONLINE : SpaceMember.PresenceState.OFFLINE
2865
- })),
2866
- pipeline: {
2867
- // TODO(burdon): Pick properties from credentials if needed.
2868
- currentEpoch: space.automergeSpaceState.lastEpoch,
2869
- appliedEpoch: space.automergeSpaceState.lastEpoch,
2870
- controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
2871
- currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
2872
- targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
2873
- totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe
2874
- }
2875
- };
2876
- if (stats.metrics) {
2877
- const { open, ready } = stats.metrics;
2878
- stats.metrics.startupTime = open && ready && ready.getTime() - open.getTime();
2879
- }
2880
- return stats;
2881
- };
2882
-
2883
2732
  // packages/sdk/client-services/src/packlets/spaces/data-space.ts
2884
2733
  import { Event as Event6, asyncTimeout, scheduleTask as scheduleTask5, sleep as sleep2, synchronized, trackLeaks } from "@dxos/async";
2885
2734
  import { AUTH_TIMEOUT as AUTH_TIMEOUT2 } from "@dxos/client-protocol";
@@ -2888,7 +2737,7 @@ import { timed, warnAfterTimeout } from "@dxos/debug";
2888
2737
  import { TYPE_PROPERTIES } from "@dxos/echo-db";
2889
2738
  import { createMappedFeedWriter } from "@dxos/echo-pipeline";
2890
2739
  import { AutomergeDocumentLoaderImpl } from "@dxos/echo-pipeline";
2891
- import { failedInvariant, invariant as invariant11 } from "@dxos/invariant";
2740
+ import { failedInvariant, invariant as invariant10 } from "@dxos/invariant";
2892
2741
  import { PublicKey as PublicKey8 } from "@dxos/keys";
2893
2742
  import { log as log9 } from "@dxos/log";
2894
2743
  import { CancelledError, SystemError } from "@dxos/protocols";
@@ -2939,13 +2788,13 @@ var AutomergeSpaceState = class {
2939
2788
  // packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
2940
2789
  import { DeferredTask, Event as Event5, scheduleTask as scheduleTask4, sleep, TimeoutError as TimeoutError2, Trigger as Trigger4 } from "@dxos/async";
2941
2790
  import { Context as Context7, rejectOnDispose } from "@dxos/context";
2942
- import { invariant as invariant10 } from "@dxos/invariant";
2791
+ import { invariant as invariant9 } from "@dxos/invariant";
2943
2792
  import { PublicKey as PublicKey7 } from "@dxos/keys";
2944
2793
  import { log as log8 } from "@dxos/log";
2945
2794
  import { schema as schema3 } from "@dxos/protocols";
2946
2795
  import { RpcExtension as RpcExtension2 } from "@dxos/teleport";
2947
2796
  import { ComplexMap as ComplexMap2, ComplexSet as ComplexSet2, entry } from "@dxos/util";
2948
- var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
2797
+ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
2949
2798
  var DEFAULT_RETRY_TIMEOUT = 1e3;
2950
2799
  var DEFAULT_SUCCESS_DELAY = 1e3;
2951
2800
  var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
@@ -2973,13 +2822,13 @@ var NotarizationPlugin = class {
2973
2822
  log8("notarize", {
2974
2823
  credentials
2975
2824
  }, {
2976
- F: __dxlog_file11,
2825
+ F: __dxlog_file10,
2977
2826
  L: 90,
2978
2827
  S: this,
2979
2828
  C: (f, a) => f(...a)
2980
2829
  });
2981
- invariant10(credentials.every((credential) => credential.id), "Credentials must have an id", {
2982
- F: __dxlog_file11,
2830
+ invariant9(credentials.every((credential) => credential.id), "Credentials must have an id", {
2831
+ F: __dxlog_file10,
2983
2832
  L: 91,
2984
2833
  S: this,
2985
2834
  A: [
@@ -2993,7 +2842,7 @@ var NotarizationPlugin = class {
2993
2842
  log8.warn("Notarization error", {
2994
2843
  err
2995
2844
  }, {
2996
- F: __dxlog_file11,
2845
+ F: __dxlog_file10,
2997
2846
  L: 99,
2998
2847
  S: this,
2999
2848
  C: (f, a) => f(...a)
@@ -3009,7 +2858,7 @@ var NotarizationPlugin = class {
3009
2858
  timeout,
3010
2859
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
3011
2860
  }, {
3012
- F: __dxlog_file11,
2861
+ F: __dxlog_file10,
3013
2862
  L: 111,
3014
2863
  S: this,
3015
2864
  C: (f, a) => f(...a)
@@ -3032,7 +2881,7 @@ var NotarizationPlugin = class {
3032
2881
  log8.info("Exhausted all peers to notarize with", {
3033
2882
  retryIn: retryTimeout
3034
2883
  }, {
3035
- F: __dxlog_file11,
2884
+ F: __dxlog_file10,
3036
2885
  L: 136,
3037
2886
  S: this,
3038
2887
  C: (f, a) => f(...a)
@@ -3046,7 +2895,7 @@ var NotarizationPlugin = class {
3046
2895
  peer: peer.localPeerId,
3047
2896
  credentialId: credentials.map((credential) => credential.id)
3048
2897
  }, {
3049
- F: __dxlog_file11,
2898
+ F: __dxlog_file10,
3050
2899
  L: 143,
3051
2900
  S: this,
3052
2901
  C: (f, a) => f(...a)
@@ -3055,7 +2904,7 @@ var NotarizationPlugin = class {
3055
2904
  credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
3056
2905
  });
3057
2906
  log8("success", void 0, {
3058
- F: __dxlog_file11,
2907
+ F: __dxlog_file10,
3059
2908
  L: 147,
3060
2909
  S: this,
3061
2910
  C: (f, a) => f(...a)
@@ -3064,7 +2913,7 @@ var NotarizationPlugin = class {
3064
2913
  } catch (err) {
3065
2914
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
3066
2915
  log8.info("error notarizing (recoverable)", err, {
3067
- F: __dxlog_file11,
2916
+ F: __dxlog_file10,
3068
2917
  L: 151,
3069
2918
  S: this,
3070
2919
  C: (f, a) => f(...a)
@@ -3082,7 +2931,7 @@ var NotarizationPlugin = class {
3082
2931
  errors.wait()
3083
2932
  ]);
3084
2933
  log8("done", void 0, {
3085
- F: __dxlog_file11,
2934
+ F: __dxlog_file10,
3086
2935
  L: 162,
3087
2936
  S: this,
3088
2937
  C: (f, a) => f(...a)
@@ -3103,8 +2952,8 @@ var NotarizationPlugin = class {
3103
2952
  this._processCredentialsTriggers.delete(credential.id);
3104
2953
  }
3105
2954
  setWriter(writer) {
3106
- invariant10(!this._writer, "Writer already set.", {
3107
- F: __dxlog_file11,
2955
+ invariant9(!this._writer, "Writer already set.", {
2956
+ F: __dxlog_file10,
3108
2957
  L: 181,
3109
2958
  S: this,
3110
2959
  A: [
@@ -3128,8 +2977,8 @@ var NotarizationPlugin = class {
3128
2977
  throw new Error(WRITER_NOT_SET_ERROR_CODE);
3129
2978
  }
3130
2979
  for (const credential of request.credentials ?? []) {
3131
- invariant10(credential.id, "Credential must have an id", {
3132
- F: __dxlog_file11,
2980
+ invariant9(credential.id, "Credential must have an id", {
2981
+ F: __dxlog_file10,
3133
2982
  L: 200,
3134
2983
  S: this,
3135
2984
  A: [
@@ -3149,7 +2998,7 @@ var NotarizationPlugin = class {
3149
2998
  log8("extension opened", {
3150
2999
  peer: extension.localPeerId
3151
3000
  }, {
3152
- F: __dxlog_file11,
3001
+ F: __dxlog_file10,
3153
3002
  L: 211,
3154
3003
  S: this,
3155
3004
  C: (f, a) => f(...a)
@@ -3161,7 +3010,7 @@ var NotarizationPlugin = class {
3161
3010
  log8("extension closed", {
3162
3011
  peer: extension.localPeerId
3163
3012
  }, {
3164
- F: __dxlog_file11,
3013
+ F: __dxlog_file10,
3165
3014
  L: 216,
3166
3015
  S: this,
3167
3016
  C: (f, a) => f(...a)
@@ -3215,7 +3064,7 @@ function _ts_decorate4(decorators, target, key, desc) {
3215
3064
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3216
3065
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3217
3066
  }
3218
- var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
3067
+ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
3219
3068
  var DataSpace = class {
3220
3069
  constructor(params) {
3221
3070
  this._ctx = new Context8();
@@ -3250,7 +3099,7 @@ var DataSpace = class {
3250
3099
  log9("new state", {
3251
3100
  state: SpaceState[this._state]
3252
3101
  }, {
3253
- F: __dxlog_file12,
3102
+ F: __dxlog_file11,
3254
3103
  L: 140,
3255
3104
  S: this,
3256
3105
  C: (f, a) => f(...a)
@@ -3300,7 +3149,7 @@ var DataSpace = class {
3300
3149
  log9("new state", {
3301
3150
  state: SpaceState[this._state]
3302
3151
  }, {
3303
- F: __dxlog_file12,
3152
+ F: __dxlog_file11,
3304
3153
  L: 198,
3305
3154
  S: this,
3306
3155
  C: (f, a) => f(...a)
@@ -3318,7 +3167,7 @@ var DataSpace = class {
3318
3167
  log9("new state", {
3319
3168
  state: SpaceState[this._state]
3320
3169
  }, {
3321
- F: __dxlog_file12,
3170
+ F: __dxlog_file11,
3322
3171
  L: 212,
3323
3172
  S: this,
3324
3173
  C: (f, a) => f(...a)
@@ -3350,7 +3199,7 @@ var DataSpace = class {
3350
3199
  } catch (err) {
3351
3200
  if (err instanceof CancelledError || err instanceof ContextDisposedError) {
3352
3201
  log9("data pipeline initialization cancelled", err, {
3353
- F: __dxlog_file12,
3202
+ F: __dxlog_file11,
3354
3203
  L: 245,
3355
3204
  S: this,
3356
3205
  C: (f, a) => f(...a)
@@ -3358,7 +3207,7 @@ var DataSpace = class {
3358
3207
  return;
3359
3208
  }
3360
3209
  log9.error("Error initializing data pipeline", err, {
3361
- F: __dxlog_file12,
3210
+ F: __dxlog_file11,
3362
3211
  L: 249,
3363
3212
  S: this,
3364
3213
  C: (f, a) => f(...a)
@@ -3367,7 +3216,7 @@ var DataSpace = class {
3367
3216
  log9("new state", {
3368
3217
  state: SpaceState[this._state]
3369
3218
  }, {
3370
- F: __dxlog_file12,
3219
+ F: __dxlog_file11,
3371
3220
  L: 251,
3372
3221
  S: this,
3373
3222
  C: (f, a) => f(...a)
@@ -3387,7 +3236,7 @@ var DataSpace = class {
3387
3236
  log9("new state", {
3388
3237
  state: SpaceState[this._state]
3389
3238
  }, {
3390
- F: __dxlog_file12,
3239
+ F: __dxlog_file11,
3391
3240
  L: 267,
3392
3241
  S: this,
3393
3242
  C: (f, a) => f(...a)
@@ -3397,7 +3246,7 @@ var DataSpace = class {
3397
3246
  this._automergeSpaceState.startProcessingRootDocs();
3398
3247
  await cancelWithContext2(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
3399
3248
  log9("data pipeline ready", void 0, {
3400
- F: __dxlog_file12,
3249
+ F: __dxlog_file11,
3401
3250
  L: 279,
3402
3251
  S: this,
3403
3252
  C: (f, a) => f(...a)
@@ -3407,7 +3256,7 @@ var DataSpace = class {
3407
3256
  log9("new state", {
3408
3257
  state: SpaceState[this._state]
3409
3258
  }, {
3410
- F: __dxlog_file12,
3259
+ F: __dxlog_file11,
3411
3260
  L: 283,
3412
3261
  S: this,
3413
3262
  C: (f, a) => f(...a)
@@ -3423,7 +3272,7 @@ var DataSpace = class {
3423
3272
  this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
3424
3273
  await this._createWritableFeeds();
3425
3274
  log9("writable feeds created", void 0, {
3426
- F: __dxlog_file12,
3275
+ F: __dxlog_file11,
3427
3276
  L: 299,
3428
3277
  S: this,
3429
3278
  C: (f, a) => f(...a)
@@ -3486,7 +3335,7 @@ var DataSpace = class {
3486
3335
  space: this.key,
3487
3336
  rootUrl
3488
3337
  }, {
3489
- F: __dxlog_file12,
3338
+ F: __dxlog_file11,
3490
3339
  L: 365,
3491
3340
  S: this,
3492
3341
  C: (f, a) => f(...a)
@@ -3518,7 +3367,7 @@ var DataSpace = class {
3518
3367
  rootUrl,
3519
3368
  err
3520
3369
  }, {
3521
- F: __dxlog_file12,
3370
+ F: __dxlog_file11,
3522
3371
  L: 388,
3523
3372
  S: this,
3524
3373
  C: (f, a) => f(...a)
@@ -3572,8 +3421,8 @@ var DataSpace = class {
3572
3421
  const rootHandle = this._automergeHost.repo.find(currentRootUrl);
3573
3422
  await cancelWithContext2(this._ctx, asyncTimeout(rootHandle.whenReady(), 1e4));
3574
3423
  const newRoot = this._automergeHost.repo.create(rootHandle.docSync());
3575
- invariant11(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
3576
- F: __dxlog_file12,
3424
+ invariant10(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
3425
+ F: __dxlog_file11,
3577
3426
  L: 438,
3578
3427
  S: this,
3579
3428
  A: [
@@ -3592,7 +3441,7 @@ var DataSpace = class {
3592
3441
  case CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT:
3593
3442
  {
3594
3443
  log9.info("Fragmenting", void 0, {
3595
- F: __dxlog_file12,
3444
+ F: __dxlog_file11,
3596
3445
  L: 450,
3597
3446
  S: this,
3598
3447
  C: (f, a) => f(...a)
@@ -3603,8 +3452,8 @@ var DataSpace = class {
3603
3452
  const objects = Object.entries(rootHandle.docSync().objects);
3604
3453
  const properties = objects.find(([_, value]) => value.system.type?.itemId === TYPE_PROPERTIES);
3605
3454
  const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
3606
- invariant11(properties, "Properties not found", {
3607
- F: __dxlog_file12,
3455
+ invariant10(properties, "Properties not found", {
3456
+ F: __dxlog_file11,
3608
3457
  L: 460,
3609
3458
  S: this,
3610
3459
  A: [
@@ -3619,8 +3468,8 @@ var DataSpace = class {
3619
3468
  ])
3620
3469
  };
3621
3470
  const newRoot = this._automergeHost.repo.create(newSpaceDoc);
3622
- invariant11(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
3623
- F: __dxlog_file12,
3471
+ invariant10(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
3472
+ F: __dxlog_file11,
3624
3473
  L: 465,
3625
3474
  S: this,
3626
3475
  A: [
@@ -3689,7 +3538,7 @@ var DataSpace = class {
3689
3538
  log9("new state", {
3690
3539
  state: SpaceState[this._state]
3691
3540
  }, {
3692
- F: __dxlog_file12,
3541
+ F: __dxlog_file11,
3693
3542
  L: 531,
3694
3543
  S: this,
3695
3544
  C: (f, a) => f(...a)
@@ -3747,7 +3596,7 @@ DataSpace = _ts_decorate4([
3747
3596
  import { Event as Event7, synchronized as synchronized2, trackLeaks as trackLeaks2 } from "@dxos/async";
3748
3597
  import { Context as Context9, cancelWithContext as cancelWithContext3 } from "@dxos/context";
3749
3598
  import { getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
3750
- import { invariant as invariant12 } from "@dxos/invariant";
3599
+ import { invariant as invariant11 } from "@dxos/invariant";
3751
3600
  import { PublicKey as PublicKey9 } from "@dxos/keys";
3752
3601
  import { log as log10 } from "@dxos/log";
3753
3602
  import { trace as trace7 } from "@dxos/protocols";
@@ -3758,7 +3607,7 @@ import { ComplexMap as ComplexMap3, deferFunction as deferFunction2, forEachAsyn
3758
3607
  // packages/sdk/client-services/src/packlets/spaces/genesis.ts
3759
3608
  import { createCredential } from "@dxos/credentials";
3760
3609
  import { failUndefined } from "@dxos/debug";
3761
- import { AdmittedFeed as AdmittedFeed4, SpaceMember as SpaceMember2 } from "@dxos/protocols/proto/dxos/halo/credentials";
3610
+ import { AdmittedFeed as AdmittedFeed4, SpaceMember } from "@dxos/protocols/proto/dxos/halo/credentials";
3762
3611
  import { Timeframe as Timeframe3 } from "@dxos/timeframe";
3763
3612
  var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
3764
3613
  const credentials = [
@@ -3778,7 +3627,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
3778
3627
  assertion: {
3779
3628
  "@type": "dxos.halo.credentials.SpaceMember",
3780
3629
  spaceKey: space.key,
3781
- role: SpaceMember2.Role.ADMIN,
3630
+ role: SpaceMember.Role.ADMIN,
3782
3631
  profile: signingContext.getProfile(),
3783
3632
  genesisFeedKey: space.controlFeedKey ?? failUndefined()
3784
3633
  }
@@ -3836,7 +3685,7 @@ function _ts_decorate5(decorators, target, key, desc) {
3836
3685
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3837
3686
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3838
3687
  }
3839
- var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
3688
+ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
3840
3689
  var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
3841
3690
  var PRESENCE_OFFLINE_TIMEOUT = 2e4;
3842
3691
  var DataSpaceManager = class {
@@ -3862,7 +3711,7 @@ var DataSpaceManager = class {
3862
3711
  }
3863
3712
  async open() {
3864
3713
  log10("open", void 0, {
3865
- F: __dxlog_file13,
3714
+ F: __dxlog_file12,
3866
3715
  L: 98,
3867
3716
  S: this,
3868
3717
  C: (f, a) => f(...a)
@@ -3870,7 +3719,7 @@ var DataSpaceManager = class {
3870
3719
  log10.trace("dxos.echo.data-space-manager.open", trace7.begin({
3871
3720
  id: this._instanceId
3872
3721
  }), {
3873
- F: __dxlog_file13,
3722
+ F: __dxlog_file12,
3874
3723
  L: 99,
3875
3724
  S: this,
3876
3725
  C: (f, a) => f(...a)
@@ -3878,7 +3727,7 @@ var DataSpaceManager = class {
3878
3727
  log10("metadata loaded", {
3879
3728
  spaces: this._metadataStore.spaces.length
3880
3729
  }, {
3881
- F: __dxlog_file13,
3730
+ F: __dxlog_file12,
3882
3731
  L: 100,
3883
3732
  S: this,
3884
3733
  C: (f, a) => f(...a)
@@ -3888,7 +3737,7 @@ var DataSpaceManager = class {
3888
3737
  log10("load space", {
3889
3738
  spaceMetadata
3890
3739
  }, {
3891
- F: __dxlog_file13,
3740
+ F: __dxlog_file12,
3892
3741
  L: 104,
3893
3742
  S: this,
3894
3743
  C: (f, a) => f(...a)
@@ -3899,7 +3748,7 @@ var DataSpaceManager = class {
3899
3748
  spaceMetadata,
3900
3749
  err
3901
3750
  }, {
3902
- F: __dxlog_file13,
3751
+ F: __dxlog_file12,
3903
3752
  L: 107,
3904
3753
  S: this,
3905
3754
  C: (f, a) => f(...a)
@@ -3916,7 +3765,7 @@ var DataSpaceManager = class {
3916
3765
  log10.trace("dxos.echo.data-space-manager.open", trace7.end({
3917
3766
  id: this._instanceId
3918
3767
  }), {
3919
- F: __dxlog_file13,
3768
+ F: __dxlog_file12,
3920
3769
  L: 120,
3921
3770
  S: this,
3922
3771
  C: (f, a) => f(...a)
@@ -3924,7 +3773,7 @@ var DataSpaceManager = class {
3924
3773
  }
3925
3774
  async close() {
3926
3775
  log10("close", void 0, {
3927
- F: __dxlog_file13,
3776
+ F: __dxlog_file12,
3928
3777
  L: 125,
3929
3778
  S: this,
3930
3779
  C: (f, a) => f(...a)
@@ -3939,8 +3788,8 @@ var DataSpaceManager = class {
3939
3788
  * Creates a new space writing the genesis credentials to the control feed.
3940
3789
  */
3941
3790
  async createSpace() {
3942
- invariant12(this._isOpen, "Not open.", {
3943
- F: __dxlog_file13,
3791
+ invariant11(this._isOpen, "Not open.", {
3792
+ F: __dxlog_file12,
3944
3793
  L: 138,
3945
3794
  S: this,
3946
3795
  A: [
@@ -3961,7 +3810,7 @@ var DataSpaceManager = class {
3961
3810
  log10("creating space...", {
3962
3811
  spaceKey
3963
3812
  }, {
3964
- F: __dxlog_file13,
3813
+ F: __dxlog_file12,
3965
3814
  L: 150,
3966
3815
  S: this,
3967
3816
  C: (f, a) => f(...a)
@@ -3976,8 +3825,8 @@ var DataSpaceManager = class {
3976
3825
  const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, automergeRoot.url);
3977
3826
  await this._metadataStore.addSpace(metadata);
3978
3827
  const memberCredential = credentials[1];
3979
- invariant12(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3980
- F: __dxlog_file13,
3828
+ invariant11(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3829
+ F: __dxlog_file12,
3981
3830
  L: 163,
3982
3831
  S: this,
3983
3832
  A: [
@@ -3995,13 +3844,13 @@ var DataSpaceManager = class {
3995
3844
  log10("accept space", {
3996
3845
  opts
3997
3846
  }, {
3998
- F: __dxlog_file13,
3847
+ F: __dxlog_file12,
3999
3848
  L: 175,
4000
3849
  S: this,
4001
3850
  C: (f, a) => f(...a)
4002
3851
  });
4003
- invariant12(this._isOpen, "Not open.", {
4004
- F: __dxlog_file13,
3852
+ invariant11(this._isOpen, "Not open.", {
3853
+ F: __dxlog_file12,
4005
3854
  L: 176,
4006
3855
  S: this,
4007
3856
  A: [
@@ -4009,8 +3858,8 @@ var DataSpaceManager = class {
4009
3858
  "'Not open.'"
4010
3859
  ]
4011
3860
  });
4012
- invariant12(!this._spaces.has(opts.spaceKey), "Space already exists.", {
4013
- F: __dxlog_file13,
3861
+ invariant11(!this._spaces.has(opts.spaceKey), "Space already exists.", {
3862
+ F: __dxlog_file12,
4014
3863
  L: 177,
4015
3864
  S: this,
4016
3865
  A: [
@@ -4045,7 +3894,7 @@ var DataSpaceManager = class {
4045
3894
  log10("construct space", {
4046
3895
  metadata
4047
3896
  }, {
4048
- F: __dxlog_file13,
3897
+ F: __dxlog_file12,
4049
3898
  L: 210,
4050
3899
  S: this,
4051
3900
  C: (f, a) => f(...a)
@@ -4083,7 +3932,7 @@ var DataSpaceManager = class {
4083
3932
  },
4084
3933
  onAuthFailure: () => {
4085
3934
  log10.warn("auth failure", void 0, {
4086
- F: __dxlog_file13,
3935
+ F: __dxlog_file12,
4087
3936
  L: 247,
4088
3937
  S: this,
4089
3938
  C: (f, a) => f(...a)
@@ -4107,7 +3956,7 @@ var DataSpaceManager = class {
4107
3956
  log10("before space ready", {
4108
3957
  space: space.key
4109
3958
  }, {
4110
- F: __dxlog_file13,
3959
+ F: __dxlog_file12,
4111
3960
  L: 265,
4112
3961
  S: this,
4113
3962
  C: (f, a) => f(...a)
@@ -4118,7 +3967,7 @@ var DataSpaceManager = class {
4118
3967
  space: space.key,
4119
3968
  open: this._isOpen
4120
3969
  }, {
4121
- F: __dxlog_file13,
3970
+ F: __dxlog_file12,
4122
3971
  L: 268,
4123
3972
  S: this,
4124
3973
  C: (f, a) => f(...a)
@@ -4131,7 +3980,7 @@ var DataSpaceManager = class {
4131
3980
  log10("before space close", {
4132
3981
  space: space.key
4133
3982
  }, {
4134
- F: __dxlog_file13,
3983
+ F: __dxlog_file12,
4135
3984
  L: 274,
4136
3985
  S: this,
4137
3986
  C: (f, a) => f(...a)
@@ -4171,11 +4020,11 @@ DataSpaceManager = _ts_decorate5([
4171
4020
  import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTask as scheduleTask6 } from "@dxos/async";
4172
4021
  import { Stream as Stream10 } from "@dxos/codec-protobuf";
4173
4022
  import { raise as raise2 } from "@dxos/debug";
4174
- import { invariant as invariant13 } from "@dxos/invariant";
4023
+ import { invariant as invariant12 } from "@dxos/invariant";
4175
4024
  import { log as log11 } from "@dxos/log";
4176
4025
  import { ApiError, SpaceNotFoundError, encodeError } from "@dxos/protocols";
4177
- import { SpaceMember as SpaceMember3, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
4178
- var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
4026
+ import { SpaceMember as SpaceMember2, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
4027
+ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
4179
4028
  var SpacesServiceImpl = class {
4180
4029
  constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
4181
4030
  this._identityManager = _identityManager;
@@ -4214,7 +4063,7 @@ var SpacesServiceImpl = class {
4214
4063
  log11("update", {
4215
4064
  spaces
4216
4065
  }, {
4217
- F: __dxlog_file14,
4066
+ F: __dxlog_file13,
4218
4067
  L: 77,
4219
4068
  S: this,
4220
4069
  C: (f, a) => f(...a)
@@ -4296,8 +4145,8 @@ var SpacesServiceImpl = class {
4296
4145
  }
4297
4146
  });
4298
4147
  } else {
4299
- invariant13(!credential.id, "Id on unsigned credentials is not allowed", {
4300
- F: __dxlog_file14,
4148
+ invariant12(!credential.id, "Id on unsigned credentials is not allowed", {
4149
+ F: __dxlog_file13,
4301
4150
  L: 164,
4302
4151
  S: this,
4303
4152
  A: [
@@ -4305,8 +4154,8 @@ var SpacesServiceImpl = class {
4305
4154
  "'Id on unsigned credentials is not allowed'"
4306
4155
  ]
4307
4156
  });
4308
- invariant13(this._identityManager.identity, "Identity is not available", {
4309
- F: __dxlog_file14,
4157
+ invariant12(this._identityManager.identity, "Identity is not available", {
4158
+ F: __dxlog_file13,
4310
4159
  L: 165,
4311
4160
  S: this,
4312
4161
  A: [
@@ -4315,8 +4164,8 @@ var SpacesServiceImpl = class {
4315
4164
  ]
4316
4165
  });
4317
4166
  const signer = this._identityManager.identity.getIdentityCredentialSigner();
4318
- invariant13(credential.issuer.equals(signer.getIssuer()), void 0, {
4319
- F: __dxlog_file14,
4167
+ invariant12(credential.issuer.equals(signer.getIssuer()), void 0, {
4168
+ F: __dxlog_file13,
4320
4169
  L: 167,
4321
4170
  S: this,
4322
4171
  A: [
@@ -4372,7 +4221,7 @@ var SpacesServiceImpl = class {
4372
4221
  identityKey: member.key,
4373
4222
  profile: member.profile ?? {}
4374
4223
  },
4375
- presence: member.removed ? SpaceMember3.PresenceState.REMOVED : isMe || peers.length > 0 ? SpaceMember3.PresenceState.ONLINE : SpaceMember3.PresenceState.OFFLINE,
4224
+ presence: member.removed ? SpaceMember2.PresenceState.REMOVED : isMe || peers.length > 0 ? SpaceMember2.PresenceState.ONLINE : SpaceMember2.PresenceState.OFFLINE,
4376
4225
  peerStates: peers
4377
4226
  };
4378
4227
  }),
@@ -4386,17 +4235,17 @@ var getChannelId = (channel) => `user-channel/${channel}`;
4386
4235
 
4387
4236
  // packages/sdk/client-services/src/packlets/services/service-context.ts
4388
4237
  import { Trigger as Trigger5 } from "@dxos/async";
4389
- import { Context as Context10 } from "@dxos/context";
4238
+ import { Context as Context10, Resource } from "@dxos/context";
4390
4239
  import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
4391
4240
  import { failUndefined as failUndefined2 } from "@dxos/debug";
4392
4241
  import { AutomergeHost, MetadataStore, SnapshotStore, SpaceManager, valueEncoding } from "@dxos/echo-pipeline";
4393
4242
  import { FeedFactory, FeedStore } from "@dxos/feed-store";
4394
4243
  import { IndexMetadataStore, IndexStore, Indexer } from "@dxos/indexing";
4395
- import { invariant as invariant14 } from "@dxos/invariant";
4244
+ import { invariant as invariant13 } from "@dxos/invariant";
4396
4245
  import { Keyring } from "@dxos/keyring";
4397
4246
  import { PublicKey as PublicKey10 } from "@dxos/keys";
4398
4247
  import { log as log12 } from "@dxos/log";
4399
- import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace8 } from "@dxos/protocols";
4248
+ import { InvalidStorageVersionError, STORAGE_VERSION, trace as trace8 } from "@dxos/protocols";
4400
4249
  import { Invitation as Invitation6 } from "@dxos/protocols/proto/dxos/client/services";
4401
4250
  import { BlobStore } from "@dxos/teleport-extension-object-sync";
4402
4251
  import { trace as Trace2 } from "@dxos/tracing";
@@ -4492,10 +4341,12 @@ function _ts_decorate6(decorators, target, key, desc) {
4492
4341
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4493
4342
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4494
4343
  }
4495
- var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
4496
- var ServiceContext = class {
4497
- constructor(storage, networkManager, signalManager, _runtimeParams) {
4344
+ var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
4345
+ var ServiceContext = class extends Resource {
4346
+ constructor(storage, level, networkManager, signalManager, _runtimeParams) {
4347
+ super();
4498
4348
  this.storage = storage;
4349
+ this.level = level;
4499
4350
  this.networkManager = networkManager;
4500
4351
  this.signalManager = signalManager;
4501
4352
  this._runtimeParams = _runtimeParams;
@@ -4525,10 +4376,11 @@ var ServiceContext = class {
4525
4376
  });
4526
4377
  this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
4527
4378
  this.indexMetadata = new IndexMetadataStore({
4528
- directory: storage.createDirectory("index-metadata")
4379
+ db: level.sublevel("index-metadata")
4529
4380
  });
4530
4381
  this.automergeHost = new AutomergeHost({
4531
4382
  directory: storage.createDirectory("automerge"),
4383
+ db: level.sublevel("automerge"),
4532
4384
  metadata: this.indexMetadata
4533
4385
  });
4534
4386
  this.indexer = new Indexer({
@@ -4542,24 +4394,25 @@ var ServiceContext = class {
4542
4394
  this.invitations = new InvitationsHandler(this.networkManager);
4543
4395
  this._handlerFactories.set(Invitation6.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? failUndefined2(), this._acceptIdentity.bind(this)));
4544
4396
  }
4545
- async open(ctx) {
4397
+ async _open(ctx) {
4546
4398
  await this._checkStorageVersion();
4547
4399
  log12("opening...", void 0, {
4548
- F: __dxlog_file15,
4549
- L: 151,
4400
+ F: __dxlog_file14,
4401
+ L: 157,
4550
4402
  S: this,
4551
4403
  C: (f, a) => f(...a)
4552
4404
  });
4553
4405
  log12.trace("dxos.sdk.service-context.open", trace8.begin({
4554
4406
  id: this._instanceId
4555
4407
  }), {
4556
- F: __dxlog_file15,
4557
- L: 152,
4408
+ F: __dxlog_file14,
4409
+ L: 158,
4558
4410
  S: this,
4559
4411
  C: (f, a) => f(...a)
4560
4412
  });
4561
4413
  await this.signalManager.open();
4562
4414
  await this.networkManager.open();
4415
+ await this.automergeHost.open();
4563
4416
  await this.metadataStore.load();
4564
4417
  await this.spaceManager.open();
4565
4418
  await this.identityManager.open(ctx);
@@ -4569,22 +4422,22 @@ var ServiceContext = class {
4569
4422
  log12.trace("dxos.sdk.service-context.open", trace8.end({
4570
4423
  id: this._instanceId
4571
4424
  }), {
4572
- F: __dxlog_file15,
4573
- L: 162,
4425
+ F: __dxlog_file14,
4426
+ L: 169,
4574
4427
  S: this,
4575
4428
  C: (f, a) => f(...a)
4576
4429
  });
4577
4430
  log12("opened", void 0, {
4578
- F: __dxlog_file15,
4579
- L: 163,
4431
+ F: __dxlog_file14,
4432
+ L: 170,
4580
4433
  S: this,
4581
4434
  C: (f, a) => f(...a)
4582
4435
  });
4583
4436
  }
4584
- async close() {
4437
+ async _close() {
4585
4438
  log12("closing...", void 0, {
4586
- F: __dxlog_file15,
4587
- L: 167,
4439
+ F: __dxlog_file14,
4440
+ L: 174,
4588
4441
  S: this,
4589
4442
  C: (f, a) => f(...a)
4590
4443
  });
@@ -4601,8 +4454,8 @@ var ServiceContext = class {
4601
4454
  await this.metadataStore.close();
4602
4455
  await this.indexer.destroy();
4603
4456
  log12("closed", void 0, {
4604
- F: __dxlog_file15,
4605
- L: 180,
4457
+ F: __dxlog_file14,
4458
+ L: 187,
4606
4459
  S: this,
4607
4460
  C: (f, a) => f(...a)
4608
4461
  });
@@ -4614,9 +4467,9 @@ var ServiceContext = class {
4614
4467
  }
4615
4468
  getInvitationHandler(invitation) {
4616
4469
  const factory = this._handlerFactories.get(invitation.kind);
4617
- invariant14(factory, `Unknown invitation kind: ${invitation.kind}`, {
4618
- F: __dxlog_file15,
4619
- L: 191,
4470
+ invariant13(factory, `Unknown invitation kind: ${invitation.kind}`, {
4471
+ F: __dxlog_file14,
4472
+ L: 198,
4620
4473
  S: this,
4621
4474
  A: [
4622
4475
  "factory",
@@ -4640,15 +4493,15 @@ var ServiceContext = class {
4640
4493
  }
4641
4494
  async _checkStorageVersion() {
4642
4495
  await this.metadataStore.load();
4643
- if (this.metadataStore.version !== STORAGE_VERSION2) {
4644
- throw new InvalidStorageVersionError(STORAGE_VERSION2, this.metadataStore.version);
4496
+ if (this.metadataStore.version !== STORAGE_VERSION) {
4497
+ throw new InvalidStorageVersionError(STORAGE_VERSION, this.metadataStore.version);
4645
4498
  }
4646
4499
  }
4647
4500
  // Called when identity is created.
4648
4501
  async _initialize(ctx) {
4649
4502
  log12("initializing spaces...", void 0, {
4650
- F: __dxlog_file15,
4651
- L: 222,
4503
+ F: __dxlog_file14,
4504
+ L: 229,
4652
4505
  S: this,
4653
4506
  C: (f, a) => f(...a)
4654
4507
  });
@@ -4669,9 +4522,9 @@ var ServiceContext = class {
4669
4522
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.keyring, signingContext, this.feedStore, this.automergeHost, this._runtimeParams);
4670
4523
  await this.dataSpaceManager.open();
4671
4524
  this._handlerFactories.set(Invitation6.Kind.SPACE, (invitation) => {
4672
- invariant14(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4673
- F: __dxlog_file15,
4674
- L: 246,
4525
+ invariant13(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4526
+ F: __dxlog_file14,
4527
+ L: 253,
4675
4528
  S: this,
4676
4529
  A: [
4677
4530
  "this.dataSpaceManager",
@@ -4694,8 +4547,8 @@ var ServiceContext = class {
4694
4547
  log12("dataSpaceManager not initialized yet, ignoring space admission", {
4695
4548
  details: assertion
4696
4549
  }, {
4697
- F: __dxlog_file15,
4698
- L: 262,
4550
+ F: __dxlog_file14,
4551
+ L: 269,
4699
4552
  S: this,
4700
4553
  C: (f, a) => f(...a)
4701
4554
  });
@@ -4705,8 +4558,8 @@ var ServiceContext = class {
4705
4558
  log12("space already exists, ignoring space admission", {
4706
4559
  details: assertion
4707
4560
  }, {
4708
- F: __dxlog_file15,
4709
- L: 266,
4561
+ F: __dxlog_file14,
4562
+ L: 273,
4710
4563
  S: this,
4711
4564
  C: (f, a) => f(...a)
4712
4565
  });
@@ -4716,8 +4569,8 @@ var ServiceContext = class {
4716
4569
  log12("accepting space recorded in halo", {
4717
4570
  details: assertion
4718
4571
  }, {
4719
- F: __dxlog_file15,
4720
- L: 271,
4572
+ F: __dxlog_file14,
4573
+ L: 278,
4721
4574
  S: this,
4722
4575
  C: (f, a) => f(...a)
4723
4576
  });
@@ -4727,8 +4580,8 @@ var ServiceContext = class {
4727
4580
  });
4728
4581
  } catch (err) {
4729
4582
  log12.catch(err, void 0, {
4730
- F: __dxlog_file15,
4731
- L: 277,
4583
+ F: __dxlog_file14,
4584
+ L: 284,
4732
4585
  S: this,
4733
4586
  C: (f, a) => f(...a)
4734
4587
  });
@@ -4740,7 +4593,7 @@ var ServiceContext = class {
4740
4593
  };
4741
4594
  _ts_decorate6([
4742
4595
  Trace2.span()
4743
- ], ServiceContext.prototype, "open", null);
4596
+ ], ServiceContext.prototype, "_open", null);
4744
4597
  _ts_decorate6([
4745
4598
  Trace2.span()
4746
4599
  ], ServiceContext.prototype, "_initialize", null);
@@ -4773,190 +4626,265 @@ var ServiceRegistry = class {
4773
4626
  }
4774
4627
  };
4775
4628
 
4776
- // packages/sdk/client-services/src/packlets/locks/browser.ts
4777
- import { asyncTimeout as asyncTimeout2, Trigger as Trigger6 } from "@dxos/async";
4778
- import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
4779
- import { log as log13, logInfo } from "@dxos/log";
4780
- function _ts_decorate7(decorators, target, key, desc) {
4781
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4782
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4783
- r = Reflect.decorate(decorators, target, key, desc);
4784
- else
4785
- for (var i = decorators.length - 1; i >= 0; i--)
4786
- if (d = decorators[i])
4787
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4788
- return c > 3 && r && Object.defineProperty(target, key, r), r;
4789
- }
4790
- var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/browser.ts";
4791
- var Message;
4792
- (function(Message2) {
4793
- Message2["ACQUIRING"] = "acquiring";
4794
- })(Message || (Message = {}));
4795
- var Lock = class {
4796
- constructor({ lockKey, onAcquire, onRelease }) {
4797
- this._broadcastChannel = new BroadcastChannel("vault-resource-lock");
4798
- this._releaseTrigger = new Trigger6();
4799
- this._lockKey = lockKey;
4800
- this._onAcquire = onAcquire;
4801
- this._onRelease = onRelease;
4802
- this._broadcastChannel.onmessage = this._onMessage.bind(this);
4803
- }
4804
- get lockKey() {
4805
- return this._lockKey;
4806
- }
4807
- async acquire() {
4808
- this._broadcastChannel.postMessage({
4809
- message: "acquiring"
4810
- });
4811
- try {
4812
- log13("aquiring lock...", void 0, {
4813
- F: __dxlog_file16,
4814
- L: 42,
4815
- S: this,
4816
- C: (f, a) => f(...a)
4817
- });
4818
- await asyncTimeout2(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
4819
- log13("acquired lock", void 0, {
4820
- F: __dxlog_file16,
4821
- L: 44,
4822
- S: this,
4823
- C: (f, a) => f(...a)
4824
- });
4825
- } catch {
4826
- log13("stealing lock...", void 0, {
4827
- F: __dxlog_file16,
4828
- L: 46,
4829
- S: this,
4830
- C: (f, a) => f(...a)
4831
- });
4832
- await this._requestLock(true);
4833
- log13("stolen lock", void 0, {
4834
- F: __dxlog_file16,
4835
- L: 48,
4836
- S: this,
4837
- C: (f, a) => f(...a)
4838
- });
4629
+ // packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts
4630
+ import { getFirstStreamValue } from "@dxos/codec-protobuf";
4631
+ import { credentialTypeFilter } from "@dxos/credentials";
4632
+ import { invariant as invariant14 } from "@dxos/invariant";
4633
+ import { STORAGE_VERSION as STORAGE_VERSION2 } from "@dxos/protocols";
4634
+ import { SpaceMember as SpaceMember3 } from "@dxos/protocols/proto/dxos/client/services";
4635
+ import { TRACE_PROCESSOR } from "@dxos/tracing";
4636
+
4637
+ // packages/sdk/client-services/src/version.ts
4638
+ var DXOS_VERSION = "0.4.10-main.e9f9c10";
4639
+
4640
+ // packages/sdk/client-services/src/packlets/services/platform.ts
4641
+ import { Platform } from "@dxos/protocols/proto/dxos/client/services";
4642
+ var getPlatform = () => {
4643
+ if (process.browser) {
4644
+ if (typeof window !== "undefined") {
4645
+ const { userAgent } = window.navigator;
4646
+ return {
4647
+ type: Platform.PLATFORM_TYPE.BROWSER,
4648
+ userAgent,
4649
+ uptime: Math.floor((Date.now() - window.performance.timeOrigin) / 1e3)
4650
+ };
4651
+ } else {
4652
+ return {
4653
+ type: Platform.PLATFORM_TYPE.SHARED_WORKER,
4654
+ uptime: Math.floor((Date.now() - performance.timeOrigin) / 1e3)
4655
+ };
4839
4656
  }
4657
+ } else {
4658
+ const { platform: platform2, version, arch } = process;
4659
+ return {
4660
+ type: Platform.PLATFORM_TYPE.NODE,
4661
+ platform: platform2,
4662
+ arch,
4663
+ runtime: version,
4664
+ uptime: Math.floor(process.uptime()),
4665
+ memory: process.memoryUsage()
4666
+ };
4840
4667
  }
4841
- async release() {
4842
- this._releaseTrigger.wake();
4668
+ };
4669
+
4670
+ // packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts
4671
+ var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts";
4672
+ var DEFAULT_TIMEOUT = 1e3;
4673
+ var createDiagnostics = async (clientServices, serviceContext, config) => {
4674
+ const diagnostics = {
4675
+ created: (/* @__PURE__ */ new Date()).toISOString(),
4676
+ platform: getPlatform(),
4677
+ client: {
4678
+ version: DXOS_VERSION,
4679
+ storage: {
4680
+ version: STORAGE_VERSION2
4681
+ }
4682
+ },
4683
+ trace: TRACE_PROCESSOR.getDiagnostics()
4684
+ };
4685
+ {
4686
+ invariant14(clientServices.LoggingService, "SystemService is not available.", {
4687
+ F: __dxlog_file15,
4688
+ L: 108,
4689
+ S: void 0,
4690
+ A: [
4691
+ "clientServices.LoggingService",
4692
+ "'SystemService is not available.'"
4693
+ ]
4694
+ });
4695
+ diagnostics.metrics = await getFirstStreamValue(clientServices.LoggingService.queryMetrics({}), {
4696
+ timeout: DEFAULT_TIMEOUT
4697
+ }).catch(() => void 0);
4843
4698
  }
4844
- _onMessage(event) {
4845
- if (event.data.message === "acquiring") {
4846
- this._releaseTrigger.wake();
4699
+ if (typeof navigator !== "undefined" && navigator.storage) {
4700
+ const map = /* @__PURE__ */ new Map();
4701
+ const dir = await navigator.storage.getDirectory();
4702
+ for await (const filename of dir?.keys()) {
4703
+ const idx = filename.indexOf("-", filename.indexOf("-") + 1);
4704
+ if (idx === -1) {
4705
+ continue;
4706
+ }
4707
+ map.set(filename.slice(0, idx), (map.get(filename.slice(0, idx)) ?? 0) + 1);
4847
4708
  }
4709
+ diagnostics.storage = Array.from(map.entries()).sort((a, b) => b[1] - a[1]).map(([file, count]) => ({
4710
+ file,
4711
+ count
4712
+ }));
4848
4713
  }
4849
- async _requestLock(steal = false) {
4850
- log13("requesting lock...", {
4851
- steal
4852
- }, {
4853
- F: __dxlog_file16,
4854
- L: 63,
4855
- S: this,
4856
- C: (f, a) => f(...a)
4857
- });
4858
- const acquired = new Trigger6();
4859
- void navigator.locks.request(this._lockKey, {
4860
- steal
4861
- }, async () => {
4862
- await this._onAcquire?.();
4863
- acquired.wake();
4864
- this._releaseTrigger = new Trigger6();
4865
- await this._releaseTrigger.wait();
4866
- log13("releasing lock...", void 0, {
4867
- F: __dxlog_file16,
4868
- L: 72,
4869
- S: this,
4870
- C: (f, a) => f(...a)
4871
- });
4872
- await this._onRelease?.();
4873
- log13("released lock", void 0, {
4874
- F: __dxlog_file16,
4875
- L: 74,
4876
- S: this,
4877
- C: (f, a) => f(...a)
4878
- });
4879
- }).catch(async () => {
4880
- await this._onRelease?.();
4881
- });
4882
- await acquired.wait();
4883
- log13("recieved lock", {
4884
- steal
4885
- }, {
4886
- F: __dxlog_file16,
4887
- L: 81,
4888
- S: this,
4889
- C: (f, a) => f(...a)
4890
- });
4714
+ const identity = serviceContext.identityManager.identity;
4715
+ if (identity) {
4716
+ diagnostics.identity = {
4717
+ identityKey: identity.identityKey,
4718
+ spaceKey: identity.space.key,
4719
+ profile: identity.profileDocument
4720
+ };
4721
+ const { devices } = await getFirstStreamValue(clientServices.DevicesService.queryDevices(), {
4722
+ timeout: DEFAULT_TIMEOUT
4723
+ }).catch(() => void 0) ?? {};
4724
+ diagnostics.devices = devices;
4725
+ if (serviceContext.dataSpaceManager) {
4726
+ diagnostics.spaces = await Promise.all(Array.from(serviceContext.dataSpaceManager.spaces.values()).map((space) => getSpaceStats(space)) ?? []);
4727
+ }
4728
+ const { feeds = [] } = await getFirstStreamValue(clientServices.DevtoolsHost.subscribeToFeeds({}), {
4729
+ timeout: DEFAULT_TIMEOUT
4730
+ }).catch(() => void 0) ?? {};
4731
+ diagnostics.feeds = feeds.map(({ feedKey, bytes, length }) => ({
4732
+ feedKey,
4733
+ bytes,
4734
+ length
4735
+ }));
4736
+ const status = await getFirstStreamValue(clientServices.NetworkService.queryStatus(), {
4737
+ timeout: DEFAULT_TIMEOUT
4738
+ }).catch(() => void 0);
4739
+ diagnostics.networkStatus = status;
4740
+ diagnostics.swarms = serviceContext.networkManager.connectionLog?.swarms;
4891
4741
  }
4742
+ diagnostics.config = config.values;
4743
+ return diagnostics;
4892
4744
  };
4893
- _ts_decorate7([
4894
- logInfo
4895
- ], Lock.prototype, "lockKey", null);
4896
- var isLocked = (lockPath) => {
4897
- throw new Error("Not implemented");
4745
+ var getSpaceStats = async (space) => {
4746
+ const stats = {
4747
+ key: space.key,
4748
+ metrics: space.metrics,
4749
+ epochs: space.inner.spaceState.credentials.filter(credentialTypeFilter("dxos.halo.credentials.Epoch")).map((credential) => ({
4750
+ ...credential.subject.assertion,
4751
+ id: credential.id
4752
+ })),
4753
+ members: Array.from(space.inner.spaceState.members.values()).map((member) => ({
4754
+ identity: {
4755
+ identityKey: member.key,
4756
+ profile: {
4757
+ displayName: member.assertion.profile?.displayName
4758
+ }
4759
+ },
4760
+ presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? SpaceMember3.PresenceState.ONLINE : SpaceMember3.PresenceState.OFFLINE
4761
+ })),
4762
+ pipeline: {
4763
+ // TODO(burdon): Pick properties from credentials if needed.
4764
+ currentEpoch: space.automergeSpaceState.lastEpoch,
4765
+ appliedEpoch: space.automergeSpaceState.lastEpoch,
4766
+ controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
4767
+ currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
4768
+ targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
4769
+ totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe
4770
+ }
4771
+ };
4772
+ if (stats.metrics) {
4773
+ const { open, ready } = stats.metrics;
4774
+ stats.metrics.startupTime = open && ready && ready.getTime() - open.getTime();
4775
+ }
4776
+ return stats;
4898
4777
  };
4899
4778
 
4900
- // packages/sdk/client-services/src/packlets/storage/storage.ts
4901
- import { DX_DATA } from "@dxos/client-protocol";
4902
- import { InvalidConfigError } from "@dxos/protocols";
4903
- import { Runtime } from "@dxos/protocols/proto/dxos/config";
4904
- import { createStorage, StorageType } from "@dxos/random-access-storage";
4905
- import { isNode as isNode2 } from "@dxos/util";
4906
- var StorageDriver = Runtime.Client.Storage.StorageDriver;
4907
- var createStorageObjects = (config) => {
4908
- const { persistent = false, keyStore, dataStore, dataRoot = isNode2() ? DX_DATA : "dxos/storage" } = config ?? {};
4909
- if (persistent && dataStore === StorageDriver.RAM) {
4910
- throw new InvalidConfigError("RAM storage cannot be used in persistent mode.");
4911
- }
4912
- if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
4913
- throw new InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
4914
- }
4915
- if (persistent && keyStore === StorageDriver.RAM) {
4916
- throw new InvalidConfigError("RAM key storage cannot be used in persistent mode.");
4917
- }
4918
- if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
4919
- throw new InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
4920
- }
4779
+ // packages/sdk/client-services/src/packlets/diagnostics/browser-diagnostics-broadcast.ts
4780
+ import { Trigger as Trigger6 } from "@dxos/async";
4781
+ import { log as log13 } from "@dxos/log";
4782
+ var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/browser-diagnostics-broadcast.ts";
4783
+ var CHANNEL_NAME = "dxos.diagnostics.broadcast";
4784
+ var MessageType;
4785
+ (function(MessageType2) {
4786
+ MessageType2["PROBE"] = "probe";
4787
+ MessageType2["PROBE_ACK"] = "probe-ack";
4788
+ MessageType2["REQUEST_DIAGNOSTICS"] = "request-diagnostics";
4789
+ MessageType2["RECEIVE_DIAGNOSTICS"] = "receive-diagnostics";
4790
+ })(MessageType || (MessageType = {}));
4791
+ var createCollectDiagnosticsBroadcastSender = () => {
4921
4792
  return {
4922
- storage: createStorage({
4923
- type: persistent ? toStorageType(dataStore) : StorageType.RAM,
4924
- root: `${dataRoot}/`
4925
- })
4793
+ broadcastDiagnosticsRequest: async () => {
4794
+ let expectedResponse = "probe-ack";
4795
+ let channel;
4796
+ try {
4797
+ const trigger = new Trigger6();
4798
+ channel = new BroadcastChannel(CHANNEL_NAME);
4799
+ channel.onmessage = (msg) => {
4800
+ if (expectedResponse === msg.data.type) {
4801
+ trigger.wake(msg.data);
4802
+ }
4803
+ };
4804
+ channel.postMessage({
4805
+ type: "probe"
4806
+ });
4807
+ await trigger.wait({
4808
+ timeout: 200
4809
+ });
4810
+ expectedResponse = "receive-diagnostics";
4811
+ trigger.reset();
4812
+ channel.postMessage({
4813
+ type: "request-diagnostics"
4814
+ });
4815
+ const diagnostics = await trigger.wait({
4816
+ timeout: 5e3
4817
+ });
4818
+ return diagnostics.payload;
4819
+ } catch (e) {
4820
+ const errorDescription = e instanceof Error ? e.message : JSON.stringify(e);
4821
+ return {
4822
+ expectedResponse,
4823
+ errorDescription
4824
+ };
4825
+ } finally {
4826
+ safeClose(channel);
4827
+ }
4828
+ }
4926
4829
  };
4927
4830
  };
4928
- var toStorageType = (type) => {
4929
- switch (type) {
4930
- case void 0:
4931
- return void 0;
4932
- case StorageDriver.RAM:
4933
- return StorageType.RAM;
4934
- case StorageDriver.CHROME:
4935
- return StorageType.CHROME;
4936
- case StorageDriver.FIREFOX:
4937
- return StorageType.FIREFOX;
4938
- case StorageDriver.IDB:
4939
- return StorageType.IDB;
4940
- case StorageDriver.NODE:
4941
- return StorageType.NODE;
4942
- case StorageDriver.WEBFS:
4943
- return StorageType.WEBFS;
4944
- default:
4945
- throw new Error(`Invalid storage type: ${StorageDriver[type]}`);
4831
+ var createCollectDiagnosticsBroadcastHandler = (systemService) => {
4832
+ let channel;
4833
+ return {
4834
+ start: () => {
4835
+ channel = new BroadcastChannel(CHANNEL_NAME);
4836
+ channel.onmessage = async (message) => {
4837
+ try {
4838
+ if (message.data.type === "probe") {
4839
+ channel?.postMessage({
4840
+ type: "probe-ack"
4841
+ });
4842
+ } else if (message.data.type === "request-diagnostics") {
4843
+ const diagnostics = await systemService.getDiagnostics({});
4844
+ channel?.postMessage({
4845
+ type: "receive-diagnostics",
4846
+ payload: diagnostics
4847
+ });
4848
+ }
4849
+ } catch (error) {
4850
+ log13.catch(error, void 0, {
4851
+ F: __dxlog_file16,
4852
+ L: 77,
4853
+ S: void 0,
4854
+ C: (f, a) => f(...a)
4855
+ });
4856
+ }
4857
+ };
4858
+ },
4859
+ stop: () => {
4860
+ safeClose(channel);
4861
+ channel = void 0;
4862
+ }
4863
+ };
4864
+ };
4865
+ var safeClose = (channel) => {
4866
+ try {
4867
+ channel?.close();
4868
+ } catch (e) {
4946
4869
  }
4947
4870
  };
4948
4871
 
4872
+ // packages/sdk/client-services/src/packlets/diagnostics/diagnostics-collector.ts
4873
+ import { ConfigResource } from "@dxos/config";
4874
+ import { GetDiagnosticsRequest as GetDiagnosticsRequest2 } from "@dxos/protocols/proto/dxos/client/services";
4875
+ import { TRACE_PROCESSOR as TRACE_PROCESSOR3 } from "@dxos/tracing";
4876
+ import { jsonKeyReplacer as jsonKeyReplacer2, nonNullable } from "@dxos/util";
4877
+
4949
4878
  // packages/sdk/client-services/src/packlets/services/service-host.ts
4950
- import { Event as Event9, sleep as sleep3, synchronized as synchronized3 } from "@dxos/async";
4951
- import { clientServiceBundle, defaultKey, PropertiesSchema } from "@dxos/client-protocol";
4879
+ import { Event as Event9, synchronized as synchronized3 } from "@dxos/async";
4880
+ import { clientServiceBundle, defaultKey, Properties } from "@dxos/client-protocol";
4952
4881
  import { Context as Context11 } from "@dxos/context";
4953
- import { DataServiceImpl } from "@dxos/echo-pipeline";
4882
+ import { DataServiceImpl, encodeReference } from "@dxos/echo-pipeline";
4954
4883
  import * as E from "@dxos/echo-schema";
4955
- import { createRawObjectDoc } from "@dxos/echo-schema";
4956
4884
  import { IndexServiceImpl } from "@dxos/indexing";
4957
4885
  import { invariant as invariant16 } from "@dxos/invariant";
4958
- import { PublicKey as PublicKey12 } from "@dxos/keys";
4959
- import { log as log15 } from "@dxos/log";
4886
+ import { PublicKey as PublicKey13 } from "@dxos/keys";
4887
+ import { log as log16 } from "@dxos/log";
4960
4888
  import { WebsocketSignalManager } from "@dxos/messaging";
4961
4889
  import { NetworkManager, createSimplePeerTransportFactory } from "@dxos/network-manager";
4962
4890
  import { trace as trace9 } from "@dxos/protocols";
@@ -5047,11 +4975,135 @@ var DevicesServiceImpl = class {
5047
4975
  }
5048
4976
  };
5049
4977
 
4978
+ // packages/sdk/client-services/src/packlets/locks/browser.ts
4979
+ import { asyncTimeout as asyncTimeout2, Trigger as Trigger7 } from "@dxos/async";
4980
+ import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
4981
+ import { log as log14, logInfo } from "@dxos/log";
4982
+ function _ts_decorate7(decorators, target, key, desc) {
4983
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4984
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4985
+ r = Reflect.decorate(decorators, target, key, desc);
4986
+ else
4987
+ for (var i = decorators.length - 1; i >= 0; i--)
4988
+ if (d = decorators[i])
4989
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
4990
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
4991
+ }
4992
+ var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/browser.ts";
4993
+ var Message;
4994
+ (function(Message2) {
4995
+ Message2["ACQUIRING"] = "acquiring";
4996
+ })(Message || (Message = {}));
4997
+ var Lock = class {
4998
+ constructor({ lockKey, onAcquire, onRelease }) {
4999
+ this._broadcastChannel = new BroadcastChannel("vault-resource-lock");
5000
+ this._releaseTrigger = new Trigger7();
5001
+ this._lockKey = lockKey;
5002
+ this._onAcquire = onAcquire;
5003
+ this._onRelease = onRelease;
5004
+ this._broadcastChannel.onmessage = this._onMessage.bind(this);
5005
+ }
5006
+ get lockKey() {
5007
+ return this._lockKey;
5008
+ }
5009
+ async acquire() {
5010
+ this._broadcastChannel.postMessage({
5011
+ message: "acquiring"
5012
+ });
5013
+ try {
5014
+ log14("aquiring lock...", void 0, {
5015
+ F: __dxlog_file18,
5016
+ L: 42,
5017
+ S: this,
5018
+ C: (f, a) => f(...a)
5019
+ });
5020
+ await asyncTimeout2(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
5021
+ log14("acquired lock", void 0, {
5022
+ F: __dxlog_file18,
5023
+ L: 44,
5024
+ S: this,
5025
+ C: (f, a) => f(...a)
5026
+ });
5027
+ } catch {
5028
+ log14("stealing lock...", void 0, {
5029
+ F: __dxlog_file18,
5030
+ L: 46,
5031
+ S: this,
5032
+ C: (f, a) => f(...a)
5033
+ });
5034
+ await this._requestLock(true);
5035
+ log14("stolen lock", void 0, {
5036
+ F: __dxlog_file18,
5037
+ L: 48,
5038
+ S: this,
5039
+ C: (f, a) => f(...a)
5040
+ });
5041
+ }
5042
+ }
5043
+ async release() {
5044
+ this._releaseTrigger.wake();
5045
+ }
5046
+ _onMessage(event) {
5047
+ if (event.data.message === "acquiring") {
5048
+ this._releaseTrigger.wake();
5049
+ }
5050
+ }
5051
+ async _requestLock(steal = false) {
5052
+ log14("requesting lock...", {
5053
+ steal
5054
+ }, {
5055
+ F: __dxlog_file18,
5056
+ L: 63,
5057
+ S: this,
5058
+ C: (f, a) => f(...a)
5059
+ });
5060
+ const acquired = new Trigger7();
5061
+ void navigator.locks.request(this._lockKey, {
5062
+ steal
5063
+ }, async () => {
5064
+ await this._onAcquire?.();
5065
+ acquired.wake();
5066
+ this._releaseTrigger = new Trigger7();
5067
+ await this._releaseTrigger.wait();
5068
+ log14("releasing lock...", void 0, {
5069
+ F: __dxlog_file18,
5070
+ L: 72,
5071
+ S: this,
5072
+ C: (f, a) => f(...a)
5073
+ });
5074
+ await this._onRelease?.();
5075
+ log14("released lock", void 0, {
5076
+ F: __dxlog_file18,
5077
+ L: 74,
5078
+ S: this,
5079
+ C: (f, a) => f(...a)
5080
+ });
5081
+ }).catch(async () => {
5082
+ await this._onRelease?.();
5083
+ });
5084
+ await acquired.wait();
5085
+ log14("recieved lock", {
5086
+ steal
5087
+ }, {
5088
+ F: __dxlog_file18,
5089
+ L: 81,
5090
+ S: this,
5091
+ C: (f, a) => f(...a)
5092
+ });
5093
+ }
5094
+ };
5095
+ _ts_decorate7([
5096
+ logInfo
5097
+ ], Lock.prototype, "lockKey", null);
5098
+ var isLocked = (lockPath) => {
5099
+ throw new Error("Not implemented");
5100
+ };
5101
+
5050
5102
  // packages/sdk/client-services/src/packlets/logging/logging-service.ts
5051
5103
  import { Event as Event8 } from "@dxos/async";
5052
5104
  import { Stream as Stream12 } from "@dxos/codec-protobuf";
5053
5105
  import { PublicKey as PublicKey11 } from "@dxos/keys";
5054
- import { getContextFromEntry, log as log14 } from "@dxos/log";
5106
+ import { getContextFromEntry, log as log15 } from "@dxos/log";
5055
5107
  import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
5056
5108
  import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
5057
5109
  var LoggingServiceImpl = class {
@@ -5064,11 +5116,11 @@ var LoggingServiceImpl = class {
5064
5116
  };
5065
5117
  }
5066
5118
  async open() {
5067
- log14.runtimeConfig.processors.push(this._logProcessor);
5119
+ log15.runtimeConfig.processors.push(this._logProcessor);
5068
5120
  }
5069
5121
  async close() {
5070
- const index = log14.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
5071
- log14.runtimeConfig.processors.splice(index, 1);
5122
+ const index = log15.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
5123
+ log15.runtimeConfig.processors.splice(index, 1);
5072
5124
  }
5073
5125
  async controlMetrics({ reset, record }) {
5074
5126
  if (reset) {
@@ -5153,12 +5205,12 @@ var LoggingServiceImpl = class {
5153
5205
  });
5154
5206
  }
5155
5207
  };
5156
- var matchFilter = (filter, level, path, options) => {
5208
+ var matchFilter = (filter, level, path2, options) => {
5157
5209
  switch (options) {
5158
5210
  case QueryLogsRequest.MatchingOptions.INCLUSIVE:
5159
- return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
5211
+ return level >= filter.level && (!filter.pattern || path2.includes(filter.pattern));
5160
5212
  case QueryLogsRequest.MatchingOptions.EXPLICIT:
5161
- return level === filter.level && (!filter.pattern || path.includes(filter.pattern));
5213
+ return level === filter.level && (!filter.pattern || path2.includes(filter.pattern));
5162
5214
  }
5163
5215
  };
5164
5216
  var shouldLog = (entry2, request) => {
@@ -5204,6 +5256,80 @@ var NetworkServiceImpl = class {
5204
5256
  }
5205
5257
  };
5206
5258
 
5259
+ // packages/sdk/client-services/src/packlets/storage/storage.ts
5260
+ import { InvalidConfigError } from "@dxos/protocols";
5261
+ import { Runtime as Runtime2 } from "@dxos/protocols/proto/dxos/config";
5262
+ import { createStorage, StorageType } from "@dxos/random-access-storage";
5263
+
5264
+ // packages/sdk/client-services/src/packlets/storage/util.ts
5265
+ import { DX_DATA } from "@dxos/client-protocol";
5266
+ import { Runtime } from "@dxos/protocols/proto/dxos/config";
5267
+ import { isNode as isNode2 } from "@dxos/util";
5268
+ var getRootPath = (config) => {
5269
+ const { dataRoot = isNode2() ? DX_DATA : "dxos/storage" } = config ?? {};
5270
+ return `${dataRoot}/`;
5271
+ };
5272
+ var isPersistent = (config) => {
5273
+ const { persistent = false } = config ?? {};
5274
+ return config.dataStore !== void 0 && config.dataStore !== Runtime.Client.Storage.StorageDriver.RAM || persistent;
5275
+ };
5276
+
5277
+ // packages/sdk/client-services/src/packlets/storage/storage.ts
5278
+ var StorageDriver = Runtime2.Client.Storage.StorageDriver;
5279
+ var createStorageObjects = (config) => {
5280
+ const { persistent = false, keyStore, dataStore } = config ?? {};
5281
+ if (persistent && dataStore === StorageDriver.RAM) {
5282
+ throw new InvalidConfigError("RAM storage cannot be used in persistent mode.");
5283
+ }
5284
+ if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
5285
+ throw new InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
5286
+ }
5287
+ if (persistent && keyStore === StorageDriver.RAM) {
5288
+ throw new InvalidConfigError("RAM key storage cannot be used in persistent mode.");
5289
+ }
5290
+ if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
5291
+ throw new InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
5292
+ }
5293
+ return {
5294
+ storage: createStorage({
5295
+ type: persistent ? toStorageType(dataStore) : StorageType.RAM,
5296
+ root: getRootPath(config)
5297
+ })
5298
+ };
5299
+ };
5300
+ var toStorageType = (type) => {
5301
+ switch (type) {
5302
+ case void 0:
5303
+ return void 0;
5304
+ case StorageDriver.RAM:
5305
+ return StorageType.RAM;
5306
+ case StorageDriver.CHROME:
5307
+ return StorageType.CHROME;
5308
+ case StorageDriver.FIREFOX:
5309
+ return StorageType.FIREFOX;
5310
+ case StorageDriver.IDB:
5311
+ return StorageType.IDB;
5312
+ case StorageDriver.NODE:
5313
+ return StorageType.NODE;
5314
+ case StorageDriver.WEBFS:
5315
+ return StorageType.WEBFS;
5316
+ default:
5317
+ throw new Error(`Invalid storage type: ${StorageDriver[type]}`);
5318
+ }
5319
+ };
5320
+
5321
+ // packages/sdk/client-services/src/packlets/storage/level.ts
5322
+ import { Level } from "level";
5323
+ import path from "@dxos/node-std/path";
5324
+ import { PublicKey as PublicKey12 } from "@dxos/keys";
5325
+ var createLevel = async (config) => {
5326
+ const persistent = isPersistent(config);
5327
+ const storagePath = persistent ? path.join(getRootPath(config), "level") : `/tmp/dxos-${PublicKey12.random().toHex()}`;
5328
+ const level = new Level(storagePath);
5329
+ await level.open();
5330
+ return level;
5331
+ };
5332
+
5207
5333
  // packages/sdk/client-services/src/packlets/system/system-service.ts
5208
5334
  import { Stream as Stream14 } from "@dxos/codec-protobuf";
5209
5335
  import { GetDiagnosticsRequest } from "@dxos/protocols/proto/dxos/client/services";
@@ -5272,13 +5398,14 @@ function _ts_decorate8(decorators, target, key, desc) {
5272
5398
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5273
5399
  return c > 3 && r && Object.defineProperty(target, key, r), r;
5274
5400
  }
5275
- var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
5401
+ var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
5276
5402
  var ClientServicesHost = class {
5277
5403
  constructor({
5278
5404
  config,
5279
5405
  transportFactory,
5280
5406
  signalManager,
5281
5407
  storage,
5408
+ level,
5282
5409
  // TODO(wittjosiah): Turn this on by default.
5283
5410
  lockKey,
5284
5411
  callbacks,
@@ -5289,6 +5416,7 @@ var ClientServicesHost = class {
5289
5416
  this._opening = false;
5290
5417
  this._open = false;
5291
5418
  this._storage = storage;
5419
+ this._level = level;
5292
5420
  this._callbacks = callbacks;
5293
5421
  this._runtimeParams = runtimeParams;
5294
5422
  if (config) {
@@ -5327,6 +5455,7 @@ var ClientServicesHost = class {
5327
5455
  await this.reset();
5328
5456
  }
5329
5457
  });
5458
+ this.diagnosticsBroadcastHandler = createCollectDiagnosticsBroadcastHandler(this._systemService);
5330
5459
  this._loggingService = new LoggingServiceImpl();
5331
5460
  this._serviceRegistry = new ServiceRegistry(clientServiceBundle, {
5332
5461
  SystemService: this._systemService,
@@ -5358,24 +5487,24 @@ var ClientServicesHost = class {
5358
5487
  */
5359
5488
  initialize({ config, ...options }) {
5360
5489
  invariant16(!this._open, "service host is open", {
5361
- F: __dxlog_file18,
5362
- L: 180,
5490
+ F: __dxlog_file19,
5491
+ L: 197,
5363
5492
  S: this,
5364
5493
  A: [
5365
5494
  "!this._open",
5366
5495
  "'service host is open'"
5367
5496
  ]
5368
5497
  });
5369
- log15("initializing...", void 0, {
5370
- F: __dxlog_file18,
5371
- L: 181,
5498
+ log16("initializing...", void 0, {
5499
+ F: __dxlog_file19,
5500
+ L: 198,
5372
5501
  S: this,
5373
5502
  C: (f, a) => f(...a)
5374
5503
  });
5375
5504
  if (config) {
5376
5505
  invariant16(!this._config, "config already set", {
5377
- F: __dxlog_file18,
5378
- L: 184,
5506
+ F: __dxlog_file19,
5507
+ L: 201,
5379
5508
  S: this,
5380
5509
  A: [
5381
5510
  "!this._config",
@@ -5388,9 +5517,9 @@ var ClientServicesHost = class {
5388
5517
  }
5389
5518
  }
5390
5519
  if (!options.signalManager) {
5391
- log15.warn("running signaling without telemetry metadata.", void 0, {
5392
- F: __dxlog_file18,
5393
- L: 192,
5520
+ log16.warn("running signaling without telemetry metadata.", void 0, {
5521
+ F: __dxlog_file19,
5522
+ L: 209,
5394
5523
  S: this,
5395
5524
  C: (f, a) => f(...a)
5396
5525
  });
@@ -5400,8 +5529,8 @@ var ClientServicesHost = class {
5400
5529
  }), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
5401
5530
  this._signalManager = signalManager;
5402
5531
  invariant16(!this._networkManager, "network manager already set", {
5403
- F: __dxlog_file18,
5404
- L: 203,
5532
+ F: __dxlog_file19,
5533
+ L: 220,
5405
5534
  S: this,
5406
5535
  A: [
5407
5536
  "!this._networkManager",
@@ -5413,9 +5542,9 @@ var ClientServicesHost = class {
5413
5542
  transportFactory,
5414
5543
  signalManager
5415
5544
  });
5416
- log15("initialized", void 0, {
5417
- F: __dxlog_file18,
5418
- L: 210,
5545
+ log16("initialized", void 0, {
5546
+ F: __dxlog_file19,
5547
+ L: 227,
5419
5548
  S: this,
5420
5549
  C: (f, a) => f(...a)
5421
5550
  });
@@ -5424,18 +5553,18 @@ var ClientServicesHost = class {
5424
5553
  if (this._open) {
5425
5554
  return;
5426
5555
  }
5427
- const traceId = PublicKey12.random().toHex();
5428
- log15.trace("dxos.client-services.host.open", trace9.begin({
5556
+ const traceId = PublicKey13.random().toHex();
5557
+ log16.trace("dxos.client-services.host.open", trace9.begin({
5429
5558
  id: traceId
5430
5559
  }), {
5431
- F: __dxlog_file18,
5432
- L: 221,
5560
+ F: __dxlog_file19,
5561
+ L: 238,
5433
5562
  S: this,
5434
5563
  C: (f, a) => f(...a)
5435
5564
  });
5436
5565
  invariant16(this._config, "config not set", {
5437
- F: __dxlog_file18,
5438
- L: 223,
5566
+ F: __dxlog_file19,
5567
+ L: 240,
5439
5568
  S: this,
5440
5569
  A: [
5441
5570
  "this._config",
@@ -5443,8 +5572,8 @@ var ClientServicesHost = class {
5443
5572
  ]
5444
5573
  });
5445
5574
  invariant16(this._storage, "storage not set", {
5446
- F: __dxlog_file18,
5447
- L: 224,
5575
+ F: __dxlog_file19,
5576
+ L: 241,
5448
5577
  S: this,
5449
5578
  A: [
5450
5579
  "this._storage",
@@ -5452,8 +5581,8 @@ var ClientServicesHost = class {
5452
5581
  ]
5453
5582
  });
5454
5583
  invariant16(this._signalManager, "signal manager not set", {
5455
- F: __dxlog_file18,
5456
- L: 225,
5584
+ F: __dxlog_file19,
5585
+ L: 242,
5457
5586
  S: this,
5458
5587
  A: [
5459
5588
  "this._signalManager",
@@ -5461,8 +5590,8 @@ var ClientServicesHost = class {
5461
5590
  ]
5462
5591
  });
5463
5592
  invariant16(this._networkManager, "network manager not set", {
5464
- F: __dxlog_file18,
5465
- L: 226,
5593
+ F: __dxlog_file19,
5594
+ L: 243,
5466
5595
  S: this,
5467
5596
  A: [
5468
5597
  "this._networkManager",
@@ -5470,17 +5599,21 @@ var ClientServicesHost = class {
5470
5599
  ]
5471
5600
  });
5472
5601
  this._opening = true;
5473
- log15("opening...", {
5602
+ log16("opening...", {
5474
5603
  lockKey: this._resourceLock?.lockKey
5475
5604
  }, {
5476
- F: __dxlog_file18,
5477
- L: 229,
5605
+ F: __dxlog_file19,
5606
+ L: 246,
5478
5607
  S: this,
5479
5608
  C: (f, a) => f(...a)
5480
5609
  });
5610
+ if (!this._level) {
5611
+ this._level = await createLevel(this._config.get("runtime.client.storage", {}));
5612
+ }
5613
+ await this._level.open();
5481
5614
  await this._resourceLock?.acquire();
5482
5615
  await this._loggingService.open();
5483
- this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._runtimeParams);
5616
+ this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
5484
5617
  this._serviceRegistry.setServices({
5485
5618
  SystemService: this._systemService,
5486
5619
  IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
@@ -5507,8 +5640,8 @@ var ClientServicesHost = class {
5507
5640
  });
5508
5641
  await this._serviceContext.open(ctx);
5509
5642
  invariant16(this.serviceRegistry.services.InvitationsService, void 0, {
5510
- F: __dxlog_file18,
5511
- L: 290,
5643
+ F: __dxlog_file19,
5644
+ L: 314,
5512
5645
  S: this,
5513
5646
  A: [
5514
5647
  "this.serviceRegistry.services.InvitationsService",
@@ -5516,11 +5649,11 @@ var ClientServicesHost = class {
5516
5649
  ]
5517
5650
  });
5518
5651
  const loadedInvitations = await this.serviceRegistry.services.InvitationsService.loadPersistentInvitations();
5519
- log15("loaded persistent invitations", {
5652
+ log16("loaded persistent invitations", {
5520
5653
  count: loadedInvitations.invitations?.length
5521
5654
  }, {
5522
- F: __dxlog_file18,
5523
- L: 293,
5655
+ F: __dxlog_file19,
5656
+ L: 317,
5524
5657
  S: this,
5525
5658
  C: (f, a) => f(...a)
5526
5659
  });
@@ -5534,23 +5667,24 @@ var ClientServicesHost = class {
5534
5667
  });
5535
5668
  void this._devtoolsProxy.open();
5536
5669
  }
5670
+ this.diagnosticsBroadcastHandler.start();
5537
5671
  this._opening = false;
5538
5672
  this._open = true;
5539
5673
  this._statusUpdate.emit();
5540
5674
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
5541
- log15("opened", {
5675
+ log16("opened", {
5542
5676
  deviceKey
5543
5677
  }, {
5544
- F: __dxlog_file18,
5545
- L: 310,
5678
+ F: __dxlog_file19,
5679
+ L: 335,
5546
5680
  S: this,
5547
5681
  C: (f, a) => f(...a)
5548
5682
  });
5549
- log15.trace("dxos.client-services.host.open", trace9.end({
5683
+ log16.trace("dxos.client-services.host.open", trace9.end({
5550
5684
  id: traceId
5551
5685
  }), {
5552
- F: __dxlog_file18,
5553
- L: 311,
5686
+ F: __dxlog_file19,
5687
+ L: 336,
5554
5688
  S: this,
5555
5689
  C: (f, a) => f(...a)
5556
5690
  });
@@ -5560,60 +5694,62 @@ var ClientServicesHost = class {
5560
5694
  return;
5561
5695
  }
5562
5696
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
5563
- log15("closing...", {
5697
+ log16("closing...", {
5564
5698
  deviceKey
5565
5699
  }, {
5566
- F: __dxlog_file18,
5567
- L: 322,
5700
+ F: __dxlog_file19,
5701
+ L: 347,
5568
5702
  S: this,
5569
5703
  C: (f, a) => f(...a)
5570
5704
  });
5705
+ this.diagnosticsBroadcastHandler.stop();
5571
5706
  await this._devtoolsProxy?.close();
5572
5707
  this._serviceRegistry.setServices({
5573
5708
  SystemService: this._systemService
5574
5709
  });
5575
5710
  await this._loggingService.close();
5576
5711
  await this._serviceContext.close();
5712
+ await this._level?.close();
5577
5713
  this._open = false;
5578
5714
  this._statusUpdate.emit();
5579
- log15("closed", {
5715
+ log16("closed", {
5580
5716
  deviceKey
5581
5717
  }, {
5582
- F: __dxlog_file18,
5583
- L: 329,
5718
+ F: __dxlog_file19,
5719
+ L: 356,
5584
5720
  S: this,
5585
5721
  C: (f, a) => f(...a)
5586
5722
  });
5587
5723
  }
5588
5724
  async reset() {
5589
- const traceId = PublicKey12.random().toHex();
5590
- log15.trace("dxos.sdk.client-services-host.reset", trace9.begin({
5725
+ const traceId = PublicKey13.random().toHex();
5726
+ log16.trace("dxos.sdk.client-services-host.reset", trace9.begin({
5591
5727
  id: traceId
5592
5728
  }), {
5593
- F: __dxlog_file18,
5594
- L: 334,
5729
+ F: __dxlog_file19,
5730
+ L: 361,
5595
5731
  S: this,
5596
5732
  C: (f, a) => f(...a)
5597
5733
  });
5598
- log15("resetting...", void 0, {
5599
- F: __dxlog_file18,
5600
- L: 336,
5734
+ log16("resetting...", void 0, {
5735
+ F: __dxlog_file19,
5736
+ L: 363,
5601
5737
  S: this,
5602
5738
  C: (f, a) => f(...a)
5603
5739
  });
5604
5740
  await this._serviceContext?.close();
5605
5741
  await this._storage.reset();
5606
- log15("reset", void 0, {
5607
- F: __dxlog_file18,
5608
- L: 339,
5742
+ log16("reset", void 0, {
5743
+ F: __dxlog_file19,
5744
+ L: 366,
5609
5745
  S: this,
5610
5746
  C: (f, a) => f(...a)
5611
5747
  });
5612
- log15.trace("dxos.sdk.client-services-host.reset", trace9.end({
5748
+ log16.trace("dxos.sdk.client-services-host.reset", trace9.end({
5613
5749
  id: traceId
5614
5750
  }), {
5615
- F: __dxlog_file18,
5616
- L: 340,
5751
+ F: __dxlog_file19,
5752
+ L: 367,
5617
5753
  S: this,
5618
5754
  C: (f, a) => f(...a)
5619
5755
  });
@@ -5625,8 +5761,8 @@ var ClientServicesHost = class {
5625
5761
  const space = await this._serviceContext.dataSpaceManager.createSpace();
5626
5762
  const automergeIndex = space.automergeSpaceState.rootUrl;
5627
5763
  invariant16(automergeIndex, void 0, {
5628
- F: __dxlog_file18,
5629
- L: 352,
5764
+ F: __dxlog_file19,
5765
+ L: 379,
5630
5766
  S: this,
5631
5767
  A: [
5632
5768
  "automergeIndex",
@@ -5635,18 +5771,25 @@ var ClientServicesHost = class {
5635
5771
  });
5636
5772
  const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
5637
5773
  await document.whenReady();
5638
- const objectDocument = createRawObjectDoc({
5639
- [defaultKey]: identity.identityKey.toHex()
5640
- }, {
5641
- type: E.getTypeReference(PropertiesSchema)
5642
- });
5774
+ const properties = {
5775
+ system: {
5776
+ type: encodeReference(E.getTypeReference(Properties))
5777
+ },
5778
+ data: {
5779
+ [defaultKey]: identity.identityKey.toHex()
5780
+ },
5781
+ meta: {
5782
+ keys: []
5783
+ }
5784
+ };
5785
+ const propertiesId = PublicKey13.random().toHex();
5643
5786
  document.change((doc) => {
5644
5787
  assignDeep2(doc, [
5645
5788
  "objects",
5646
- objectDocument.id
5647
- ], objectDocument.handle.docSync());
5789
+ propertiesId
5790
+ ], properties);
5648
5791
  });
5649
- await sleep3(200);
5792
+ await this._serviceContext.automergeHost.repo.flush();
5650
5793
  return identity;
5651
5794
  }
5652
5795
  };
@@ -5668,6 +5811,44 @@ ClientServicesHost = _ts_decorate8([
5668
5811
  Trace3.resource()
5669
5812
  ], ClientServicesHost);
5670
5813
 
5814
+ // packages/sdk/client-services/src/packlets/services/util.ts
5815
+ import { PublicKey as PublicKey14 } from "@dxos/keys";
5816
+ import { humanize } from "@dxos/util";
5817
+ var ClientServicesProviderResource = Symbol.for("dxos.resource.ClientServices");
5818
+
5819
+ // packages/sdk/client-services/src/packlets/diagnostics/diagnostics-collector.ts
5820
+ var DiagnosticsCollector = class {
5821
+ static {
5822
+ this.broadcastSender = createCollectDiagnosticsBroadcastSender();
5823
+ }
5824
+ static async collect(config = findConfigs(), services = findSystemServiceProvider(), options = {}) {
5825
+ const serviceDiagnostics = await services?.services?.SystemService?.getDiagnostics({
5826
+ keys: options.humanize ? GetDiagnosticsRequest2.KEY_OPTION.HUMANIZE : options.truncate ? GetDiagnosticsRequest2.KEY_OPTION.TRUNCATE : void 0
5827
+ });
5828
+ const clientDiagnostics = {
5829
+ config,
5830
+ trace: TRACE_PROCESSOR3.getDiagnostics()
5831
+ };
5832
+ const diagnostics = serviceDiagnostics != null ? {
5833
+ client: clientDiagnostics,
5834
+ services: serviceDiagnostics
5835
+ } : {
5836
+ client: clientDiagnostics,
5837
+ broadcast: await this.broadcastSender.broadcastDiagnosticsRequest()
5838
+ };
5839
+ return JSON.parse(JSON.stringify(diagnostics, jsonKeyReplacer2(options)));
5840
+ }
5841
+ };
5842
+ var findSystemServiceProvider = () => {
5843
+ const serviceProviders = TRACE_PROCESSOR3.findByAnnotation(ClientServicesProviderResource);
5844
+ const providerResource = serviceProviders.find((r) => r.instance.deref()?.services?.SystemService != null);
5845
+ return providerResource?.instance?.deref() ?? null;
5846
+ };
5847
+ var findConfigs = () => {
5848
+ const configs = TRACE_PROCESSOR3.findByAnnotation(ConfigResource);
5849
+ return configs.map((r) => r.instance.deref()).filter(nonNullable);
5850
+ };
5851
+
5671
5852
  export {
5672
5853
  Buffer,
5673
5854
  subscribeToFeeds,
@@ -5687,19 +5868,23 @@ export {
5687
5868
  IdentityServiceImpl,
5688
5869
  DeviceInvitationProtocol,
5689
5870
  InvitationsHandler,
5690
- invitationExpired,
5691
5871
  InvitationsServiceImpl,
5692
5872
  SpaceInvitationProtocol,
5693
5873
  ClientRpcServer,
5694
- createDiagnostics,
5695
5874
  DataSpace,
5696
5875
  DataSpaceManager,
5697
5876
  SpacesServiceImpl,
5698
5877
  ServiceContext,
5699
5878
  ServiceRegistry,
5879
+ createDiagnostics,
5880
+ createCollectDiagnosticsBroadcastSender,
5881
+ createCollectDiagnosticsBroadcastHandler,
5882
+ DiagnosticsCollector,
5700
5883
  Lock,
5701
5884
  isLocked,
5702
5885
  createStorageObjects,
5703
- ClientServicesHost
5886
+ createLevel,
5887
+ ClientServicesHost,
5888
+ ClientServicesProviderResource
5704
5889
  };
5705
- //# sourceMappingURL=chunk-VIHM6GWA.mjs.map
5890
+ //# sourceMappingURL=chunk-4GN43XQ4.mjs.map