@dxos/client-services 0.4.7-main.7b31910 → 0.4.7-main.83fe62c

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 (46) hide show
  1. package/dist/lib/browser/{chunk-AK5GNRMW.mjs → chunk-AQWJRYXB.mjs} +325 -153
  2. package/dist/lib/browser/chunk-AQWJRYXB.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +6 -2
  4. package/dist/lib/browser/index.mjs.map +2 -2
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs +4 -2
  7. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  8. package/dist/lib/node/{chunk-F5T3QHFI.cjs → chunk-VRIYH223.cjs} +298 -125
  9. package/dist/lib/node/chunk-VRIYH223.cjs.map +7 -0
  10. package/dist/lib/node/index.cjs +42 -38
  11. package/dist/lib/node/index.cjs.map +2 -2
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/packlets/testing/index.cjs +11 -9
  14. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  15. package/dist/types/src/packlets/invitations/invitations-handler.d.ts +1 -0
  16. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  17. package/dist/types/src/packlets/invitations/invitations-service.d.ts +9 -1
  18. package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
  19. package/dist/types/src/packlets/logging/logging-service.d.ts +1 -0
  20. package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
  21. package/dist/types/src/packlets/services/service-context.d.ts +2 -0
  22. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  23. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  24. package/dist/types/src/packlets/spaces/automerge-space-state.d.ts +2 -0
  25. package/dist/types/src/packlets/spaces/automerge-space-state.d.ts.map +1 -1
  26. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  27. package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
  28. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  29. package/dist/types/src/packlets/vault/shared-worker-connection.d.ts.map +1 -1
  30. package/dist/types/src/version.d.ts +1 -1
  31. package/package.json +35 -35
  32. package/src/packlets/identity/identity-manager.ts +1 -1
  33. package/src/packlets/invitations/invitations-handler.ts +37 -2
  34. package/src/packlets/invitations/invitations-service.ts +83 -5
  35. package/src/packlets/logging/logging-service.ts +9 -2
  36. package/src/packlets/services/automerge-host.test.ts +1 -1
  37. package/src/packlets/services/service-context.ts +7 -1
  38. package/src/packlets/services/service-host.ts +9 -2
  39. package/src/packlets/spaces/automerge-space-state.ts +15 -0
  40. package/src/packlets/spaces/data-space.ts +33 -11
  41. package/src/packlets/spaces/spaces-service.ts +3 -5
  42. package/src/packlets/testing/test-builder.ts +1 -1
  43. package/src/packlets/vault/shared-worker-connection.ts +2 -0
  44. package/src/version.ts +1 -1
  45. package/dist/lib/browser/chunk-AK5GNRMW.mjs.map +0 -7
  46. package/dist/lib/node/chunk-F5T3QHFI.cjs.map +0 -7
@@ -1043,7 +1043,7 @@ var IdentityManager = class {
1043
1043
  identityKey: identityRecord.identityKey
1044
1044
  });
1045
1045
  await space.setControlFeed(controlFeed);
1046
- void space.setDataFeed(dataFeed);
1046
+ await space.setDataFeed(dataFeed);
1047
1047
  const identity = new Identity({
1048
1048
  space,
1049
1049
  presence,
@@ -1638,11 +1638,11 @@ var InvitationsHandler = class {
1638
1638
  this._networkManager = _networkManager;
1639
1639
  }
1640
1640
  createInvitation(protocol, options) {
1641
- const { invitationId = PublicKey6.random().toHex(), type = Invitation3.Type.INTERACTIVE, authMethod = Invitation3.AuthMethod.SHARED_SECRET, state = Invitation3.State.INIT, timeout = INVITATION_TIMEOUT, swarmKey = PublicKey6.random() } = options ?? {};
1641
+ 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
1642
  const authCode = options?.authCode ?? (authMethod === Invitation3.AuthMethod.SHARED_SECRET ? generatePasscode(AUTHENTICATION_CODE_LENGTH) : void 0);
1643
1643
  invariant6(protocol, void 0, {
1644
1644
  F: __dxlog_file7,
1645
- L: 81,
1645
+ L: 84,
1646
1646
  S: this,
1647
1647
  A: [
1648
1648
  "protocol",
@@ -1657,13 +1657,16 @@ var InvitationsHandler = class {
1657
1657
  swarmKey,
1658
1658
  authCode,
1659
1659
  timeout,
1660
+ persistent,
1661
+ created,
1662
+ lifetime,
1660
1663
  ...protocol.getInvitationContext()
1661
1664
  };
1662
1665
  const stream = new PushStream();
1663
1666
  const ctx = new Context5({
1664
1667
  onError: (err) => {
1665
- void ctx.dispose();
1666
1668
  stream.error(err);
1669
+ void ctx.dispose();
1667
1670
  }
1668
1671
  });
1669
1672
  ctx.onDispose(() => {
@@ -1671,7 +1674,7 @@ var InvitationsHandler = class {
1671
1674
  ...protocol.toJSON()
1672
1675
  }, {
1673
1676
  F: __dxlog_file7,
1674
- L: 103,
1677
+ L: 109,
1675
1678
  S: this,
1676
1679
  C: (f, a) => f(...a)
1677
1680
  });
@@ -1696,7 +1699,7 @@ var InvitationsHandler = class {
1696
1699
  const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
1697
1700
  invariant6(deviceKey, void 0, {
1698
1701
  F: __dxlog_file7,
1699
- L: 124,
1702
+ L: 130,
1700
1703
  S: this,
1701
1704
  A: [
1702
1705
  "deviceKey",
@@ -1719,7 +1722,7 @@ var InvitationsHandler = class {
1719
1722
  id: traceId
1720
1723
  }), {
1721
1724
  F: __dxlog_file7,
1722
- L: 142,
1725
+ L: 148,
1723
1726
  S: this,
1724
1727
  C: (f, a) => f(...a)
1725
1728
  });
@@ -1727,7 +1730,7 @@ var InvitationsHandler = class {
1727
1730
  ...protocol.toJSON()
1728
1731
  }, {
1729
1732
  F: __dxlog_file7,
1730
- L: 143,
1733
+ L: 149,
1731
1734
  S: this,
1732
1735
  C: (f, a) => f(...a)
1733
1736
  });
@@ -1743,7 +1746,7 @@ var InvitationsHandler = class {
1743
1746
  ...protocol.toJSON()
1744
1747
  }, {
1745
1748
  F: __dxlog_file7,
1746
- L: 146,
1749
+ L: 152,
1747
1750
  S: this,
1748
1751
  C: (f, a) => f(...a)
1749
1752
  });
@@ -1755,7 +1758,7 @@ var InvitationsHandler = class {
1755
1758
  id: traceId
1756
1759
  }), {
1757
1760
  F: __dxlog_file7,
1758
- L: 148,
1761
+ L: 154,
1759
1762
  S: this,
1760
1763
  C: (f, a) => f(...a)
1761
1764
  });
@@ -1765,7 +1768,7 @@ var InvitationsHandler = class {
1765
1768
  ...protocol.toJSON()
1766
1769
  }, {
1767
1770
  F: __dxlog_file7,
1768
- L: 151,
1771
+ L: 157,
1769
1772
  S: this,
1770
1773
  C: (f, a) => f(...a)
1771
1774
  });
@@ -1776,7 +1779,7 @@ var InvitationsHandler = class {
1776
1779
  } else {
1777
1780
  log5.error("failed", err, {
1778
1781
  F: __dxlog_file7,
1779
- L: 154,
1782
+ L: 160,
1780
1783
  S: this,
1781
1784
  C: (f, a) => f(...a)
1782
1785
  });
@@ -1787,7 +1790,7 @@ var InvitationsHandler = class {
1787
1790
  error: err
1788
1791
  }), {
1789
1792
  F: __dxlog_file7,
1790
- L: 157,
1793
+ L: 163,
1791
1794
  S: this,
1792
1795
  C: (f, a) => f(...a)
1793
1796
  });
@@ -1808,7 +1811,7 @@ var InvitationsHandler = class {
1808
1811
  ...protocol.toJSON()
1809
1812
  }, {
1810
1813
  F: __dxlog_file7,
1811
- L: 172,
1814
+ L: 178,
1812
1815
  S: this,
1813
1816
  C: (f, a) => f(...a)
1814
1817
  });
@@ -1819,7 +1822,7 @@ var InvitationsHandler = class {
1819
1822
  } else {
1820
1823
  log5.error("failed", err, {
1821
1824
  F: __dxlog_file7,
1822
- L: 175,
1825
+ L: 181,
1823
1826
  S: this,
1824
1827
  C: (f, a) => f(...a)
1825
1828
  });
@@ -1829,7 +1832,27 @@ var InvitationsHandler = class {
1829
1832
  });
1830
1833
  return extension;
1831
1834
  };
1835
+ if (invitation.lifetime && invitation.created && invitation.lifetime !== 0) {
1836
+ invariant6(invitation.created.getTime() + invitation.lifetime * 1e3 > Date.now(), "invitation has already expired", {
1837
+ F: __dxlog_file7,
1838
+ L: 191,
1839
+ S: this,
1840
+ A: [
1841
+ "invitation.created.getTime() + invitation.lifetime * 1000 > Date.now()",
1842
+ "'invitation has already expired'"
1843
+ ]
1844
+ });
1845
+ scheduleTask2(ctx, async () => {
1846
+ await swarmConnection.close();
1847
+ stream.next({
1848
+ ...invitation,
1849
+ state: Invitation3.State.EXPIRED
1850
+ });
1851
+ await ctx.dispose();
1852
+ }, invitation.created.getTime() + invitation.lifetime * 1e3 - Date.now());
1853
+ }
1832
1854
  let swarmConnection;
1855
+ const invitationLabel = "invitation host for " + (invitation.kind === Invitation3.Kind.DEVICE ? "device" : `space ${invitation.spaceKey?.truncate()}`);
1833
1856
  scheduleTask2(ctx, async () => {
1834
1857
  const topic = invitation.swarmKey;
1835
1858
  swarmConnection = await this._networkManager.joinSwarm({
@@ -1839,7 +1862,7 @@ var InvitationsHandler = class {
1839
1862
  teleport.addExtension("dxos.halo.invitations", createExtension());
1840
1863
  }),
1841
1864
  topology: new StarTopology(topic),
1842
- label: "invitation host"
1865
+ label: invitationLabel
1843
1866
  });
1844
1867
  ctx.onDispose(() => swarmConnection.close());
1845
1868
  stream.next({
@@ -1864,7 +1887,7 @@ var InvitationsHandler = class {
1864
1887
  const { timeout = INVITATION_TIMEOUT } = invitation;
1865
1888
  invariant6(protocol, void 0, {
1866
1889
  F: __dxlog_file7,
1867
- L: 220,
1890
+ L: 246,
1868
1891
  S: this,
1869
1892
  A: [
1870
1893
  "protocol",
@@ -1874,7 +1897,7 @@ var InvitationsHandler = class {
1874
1897
  if (deviceProfile) {
1875
1898
  invariant6(invitation.kind === Invitation3.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
1876
1899
  F: __dxlog_file7,
1877
- L: 224,
1900
+ L: 250,
1878
1901
  S: this,
1879
1902
  A: [
1880
1903
  "invitation.kind === Invitation.Kind.DEVICE",
@@ -1889,7 +1912,7 @@ var InvitationsHandler = class {
1889
1912
  const setState = (newData) => {
1890
1913
  invariant6(newData.state !== void 0, void 0, {
1891
1914
  F: __dxlog_file7,
1892
- L: 235,
1915
+ L: 261,
1893
1916
  S: this,
1894
1917
  A: [
1895
1918
  "newData.state !== undefined",
@@ -1909,7 +1932,7 @@ var InvitationsHandler = class {
1909
1932
  ...protocol.toJSON()
1910
1933
  }, {
1911
1934
  F: __dxlog_file7,
1912
- L: 243,
1935
+ L: 269,
1913
1936
  S: this,
1914
1937
  C: (f, a) => f(...a)
1915
1938
  });
@@ -1919,7 +1942,7 @@ var InvitationsHandler = class {
1919
1942
  } else {
1920
1943
  log5.warn("auth failed", err, {
1921
1944
  F: __dxlog_file7,
1922
- L: 246,
1945
+ L: 272,
1923
1946
  S: this,
1924
1947
  C: (f, a) => f(...a)
1925
1948
  });
@@ -1933,7 +1956,7 @@ var InvitationsHandler = class {
1933
1956
  ...protocol.toJSON()
1934
1957
  }, {
1935
1958
  F: __dxlog_file7,
1936
- L: 254,
1959
+ L: 280,
1937
1960
  S: this,
1938
1961
  C: (f, a) => f(...a)
1939
1962
  });
@@ -1948,7 +1971,7 @@ var InvitationsHandler = class {
1948
1971
  currentState
1949
1972
  }, {
1950
1973
  F: __dxlog_file7,
1951
- L: 264,
1974
+ L: 290,
1952
1975
  S: this,
1953
1976
  C: (f, a) => f(...a)
1954
1977
  });
@@ -1963,7 +1986,7 @@ var InvitationsHandler = class {
1963
1986
  id: traceId
1964
1987
  }), {
1965
1988
  F: __dxlog_file7,
1966
- L: 273,
1989
+ L: 299,
1967
1990
  S: this,
1968
1991
  C: (f, a) => f(...a)
1969
1992
  });
@@ -1975,7 +1998,7 @@ var InvitationsHandler = class {
1975
1998
  ...protocol.toJSON()
1976
1999
  }, {
1977
2000
  F: __dxlog_file7,
1978
- L: 281,
2001
+ L: 307,
1979
2002
  S: this,
1980
2003
  C: (f, a) => f(...a)
1981
2004
  });
@@ -1986,7 +2009,7 @@ var InvitationsHandler = class {
1986
2009
  ...protocol.toJSON()
1987
2010
  }, {
1988
2011
  F: __dxlog_file7,
1989
- L: 285,
2012
+ L: 311,
1990
2013
  S: this,
1991
2014
  C: (f, a) => f(...a)
1992
2015
  });
@@ -1996,7 +2019,7 @@ var InvitationsHandler = class {
1996
2019
  response: introductionResponse
1997
2020
  }, {
1998
2021
  F: __dxlog_file7,
1999
- L: 289,
2022
+ L: 315,
2000
2023
  S: this,
2001
2024
  C: (f, a) => f(...a)
2002
2025
  });
@@ -2005,7 +2028,7 @@ var InvitationsHandler = class {
2005
2028
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
2006
2029
  log5("guest waiting for authentication code...", void 0, {
2007
2030
  F: __dxlog_file7,
2008
- L: 295,
2031
+ L: 321,
2009
2032
  S: this,
2010
2033
  C: (f, a) => f(...a)
2011
2034
  });
@@ -2017,7 +2040,7 @@ var InvitationsHandler = class {
2017
2040
  });
2018
2041
  log5("sending authentication request", void 0, {
2019
2042
  F: __dxlog_file7,
2020
- L: 299,
2043
+ L: 325,
2021
2044
  S: this,
2022
2045
  C: (f, a) => f(...a)
2023
2046
  });
@@ -2038,7 +2061,7 @@ var InvitationsHandler = class {
2038
2061
  attempt
2039
2062
  }, {
2040
2063
  F: __dxlog_file7,
2041
- L: 310,
2064
+ L: 336,
2042
2065
  S: this,
2043
2066
  C: (f, a) => f(...a)
2044
2067
  });
@@ -2051,7 +2074,7 @@ var InvitationsHandler = class {
2051
2074
  ...protocol.toJSON()
2052
2075
  }, {
2053
2076
  F: __dxlog_file7,
2054
- L: 318,
2077
+ L: 344,
2055
2078
  S: this,
2056
2079
  C: (f, a) => f(...a)
2057
2080
  });
@@ -2063,7 +2086,7 @@ var InvitationsHandler = class {
2063
2086
  ...protocol.toJSON()
2064
2087
  }, {
2065
2088
  F: __dxlog_file7,
2066
- L: 329,
2089
+ L: 355,
2067
2090
  S: this,
2068
2091
  C: (f, a) => f(...a)
2069
2092
  });
@@ -2076,7 +2099,7 @@ var InvitationsHandler = class {
2076
2099
  id: traceId
2077
2100
  }), {
2078
2101
  F: __dxlog_file7,
2079
- L: 331,
2102
+ L: 357,
2080
2103
  S: this,
2081
2104
  C: (f, a) => f(...a)
2082
2105
  });
@@ -2086,7 +2109,7 @@ var InvitationsHandler = class {
2086
2109
  ...protocol.toJSON()
2087
2110
  }, {
2088
2111
  F: __dxlog_file7,
2089
- L: 334,
2112
+ L: 360,
2090
2113
  S: this,
2091
2114
  C: (f, a) => f(...a)
2092
2115
  });
@@ -2096,7 +2119,7 @@ var InvitationsHandler = class {
2096
2119
  } else {
2097
2120
  log5("auth failed", err, {
2098
2121
  F: __dxlog_file7,
2099
- L: 337,
2122
+ L: 363,
2100
2123
  S: this,
2101
2124
  C: (f, a) => f(...a)
2102
2125
  });
@@ -2107,7 +2130,7 @@ var InvitationsHandler = class {
2107
2130
  error: err
2108
2131
  }), {
2109
2132
  F: __dxlog_file7,
2110
- L: 340,
2133
+ L: 366,
2111
2134
  S: this,
2112
2135
  C: (f, a) => f(...a)
2113
2136
  });
@@ -2125,7 +2148,7 @@ var InvitationsHandler = class {
2125
2148
  ...protocol.toJSON()
2126
2149
  }, {
2127
2150
  F: __dxlog_file7,
2128
- L: 351,
2151
+ L: 377,
2129
2152
  S: this,
2130
2153
  C: (f, a) => f(...a)
2131
2154
  });
@@ -2135,7 +2158,7 @@ var InvitationsHandler = class {
2135
2158
  } else {
2136
2159
  log5("auth failed", err, {
2137
2160
  F: __dxlog_file7,
2138
- L: 354,
2161
+ L: 380,
2139
2162
  S: this,
2140
2163
  C: (f, a) => f(...a)
2141
2164
  });
@@ -2152,7 +2175,7 @@ var InvitationsHandler = class {
2152
2175
  } else {
2153
2176
  invariant6(invitation.swarmKey, void 0, {
2154
2177
  F: __dxlog_file7,
2155
- L: 368,
2178
+ L: 394,
2156
2179
  S: this,
2157
2180
  A: [
2158
2181
  "invitation.swarmKey",
@@ -2191,24 +2214,32 @@ var InvitationsHandler = class {
2191
2214
  return observable;
2192
2215
  }
2193
2216
  };
2217
+ var invitationExpired = (invitation) => {
2218
+ return invitation.created && invitation.lifetime && invitation.lifetime !== 0 && invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now();
2219
+ };
2194
2220
 
2195
2221
  // packages/sdk/client-services/src/packlets/invitations/invitations-service.ts
2196
- import { Event as Event3 } from "@dxos/async";
2222
+ import { Event as Event3, scheduleTask as scheduleTask3 } from "@dxos/async";
2197
2223
  import { Stream as Stream8 } from "@dxos/codec-protobuf";
2224
+ import { Context as Context6 } from "@dxos/context";
2198
2225
  import { invariant as invariant7 } from "@dxos/invariant";
2199
2226
  import { log as log6 } from "@dxos/log";
2200
2227
  import { Invitation as Invitation4, QueryInvitationsResponse } from "@dxos/protocols/proto/dxos/client/services";
2201
2228
  var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
2202
2229
  var InvitationsServiceImpl = class {
2203
- constructor(_invitationsHandler, _getHandler) {
2230
+ constructor(_invitationsHandler, _getHandler, _metadataStore) {
2204
2231
  this._invitationsHandler = _invitationsHandler;
2205
2232
  this._getHandler = _getHandler;
2233
+ this._metadataStore = _metadataStore;
2206
2234
  this._createInvitations = /* @__PURE__ */ new Map();
2207
2235
  this._acceptInvitations = /* @__PURE__ */ new Map();
2208
2236
  this._invitationCreated = new Event3();
2209
2237
  this._invitationAccepted = new Event3();
2210
2238
  this._removedCreated = new Event3();
2211
2239
  this._removedAccepted = new Event3();
2240
+ this._saved = new Event3();
2241
+ this._persistentInvitationsLoadedEvent = new Event3();
2242
+ this._persistentInvitationsLoaded = false;
2212
2243
  }
2213
2244
  // TODO(burdon): Guest/host label.
2214
2245
  getLoggingContext() {
@@ -2216,6 +2247,7 @@ var InvitationsServiceImpl = class {
2216
2247
  }
2217
2248
  createInvitation(options) {
2218
2249
  let invitation;
2250
+ const savePersistentInvitationCtx = new Context6();
2219
2251
  const existingInvitation = this._createInvitations.get(options.invitationId);
2220
2252
  if (existingInvitation) {
2221
2253
  invitation = existingInvitation;
@@ -2226,12 +2258,27 @@ var InvitationsServiceImpl = class {
2226
2258
  this._invitationCreated.emit(invitation.get());
2227
2259
  }
2228
2260
  return new Stream8(({ next, close }) => {
2261
+ if (invitation.get().persistent) {
2262
+ scheduleTask3(savePersistentInvitationCtx, async () => {
2263
+ try {
2264
+ await this._metadataStore.addInvitation(invitation.get());
2265
+ this._saved.emit(invitation.get());
2266
+ } catch (err) {
2267
+ close(err);
2268
+ }
2269
+ });
2270
+ }
2229
2271
  invitation.subscribe((invitation2) => {
2230
2272
  next(invitation2);
2231
- }, (err) => {
2273
+ }, async (err) => {
2274
+ await savePersistentInvitationCtx.dispose();
2232
2275
  close(err);
2233
- }, () => {
2276
+ }, async () => {
2234
2277
  close();
2278
+ if (invitation.get().persistent) {
2279
+ await savePersistentInvitationCtx.dispose();
2280
+ await this._metadataStore.removeInvitation(invitation.get().invitationId);
2281
+ }
2235
2282
  this._createInvitations.delete(invitation.get().invitationId);
2236
2283
  if (invitation.get().type !== Invitation4.Type.MULTIUSE) {
2237
2284
  this._removedCreated.emit(invitation.get());
@@ -2239,12 +2286,37 @@ var InvitationsServiceImpl = class {
2239
2286
  });
2240
2287
  });
2241
2288
  }
2289
+ async loadPersistentInvitations() {
2290
+ const persistentInvitations = this._metadataStore.getInvitations();
2291
+ const freshInvitations = persistentInvitations.filter(async (invitation) => !invitationExpired(invitation));
2292
+ const cInvitations = freshInvitations.map((persistentInvitation) => {
2293
+ invariant7(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
2294
+ F: __dxlog_file8,
2295
+ L: 109,
2296
+ S: this,
2297
+ A: [
2298
+ "!this._createInvitations.get(persistentInvitation.invitationId)",
2299
+ "'invitation already exists'"
2300
+ ]
2301
+ });
2302
+ const handler = this._getHandler(persistentInvitation);
2303
+ const invitation = this._invitationsHandler.createInvitation(handler, persistentInvitation);
2304
+ this._createInvitations.set(invitation.get().invitationId, invitation);
2305
+ this._invitationCreated.emit(invitation.get());
2306
+ return persistentInvitation;
2307
+ });
2308
+ this._persistentInvitationsLoadedEvent.emit();
2309
+ this._persistentInvitationsLoaded = true;
2310
+ return {
2311
+ invitations: cInvitations
2312
+ };
2313
+ }
2242
2314
  acceptInvitation({ invitation: options, deviceProfile }) {
2243
2315
  let invitation;
2244
2316
  if (deviceProfile) {
2245
2317
  invariant7(options.kind === Invitation4.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
2246
2318
  F: __dxlog_file8,
2247
- L: 81,
2319
+ L: 127,
2248
2320
  S: this,
2249
2321
  A: [
2250
2322
  "options.kind === Invitation.Kind.DEVICE",
@@ -2278,13 +2350,13 @@ var InvitationsServiceImpl = class {
2278
2350
  async authenticate({ invitationId, authCode }) {
2279
2351
  log6("authenticating...", void 0, {
2280
2352
  F: __dxlog_file8,
2281
- L: 114,
2353
+ L: 160,
2282
2354
  S: this,
2283
2355
  C: (f, a) => f(...a)
2284
2356
  });
2285
2357
  invariant7(invitationId, void 0, {
2286
2358
  F: __dxlog_file8,
2287
- L: 115,
2359
+ L: 161,
2288
2360
  S: this,
2289
2361
  A: [
2290
2362
  "invitationId",
@@ -2297,7 +2369,7 @@ var InvitationsServiceImpl = class {
2297
2369
  invitationId
2298
2370
  }, {
2299
2371
  F: __dxlog_file8,
2300
- L: 118,
2372
+ L: 164,
2301
2373
  S: this,
2302
2374
  C: (f, a) => f(...a)
2303
2375
  });
@@ -2306,15 +2378,17 @@ var InvitationsServiceImpl = class {
2306
2378
  }
2307
2379
  }
2308
2380
  async cancelInvitation({ invitationId }) {
2309
- log6("deleting...", void 0, {
2381
+ log6("cancelInvitation...", {
2382
+ invitationId
2383
+ }, {
2310
2384
  F: __dxlog_file8,
2311
- L: 125,
2385
+ L: 171,
2312
2386
  S: this,
2313
2387
  C: (f, a) => f(...a)
2314
2388
  });
2315
2389
  invariant7(invitationId, void 0, {
2316
2390
  F: __dxlog_file8,
2317
- L: 126,
2391
+ L: 172,
2318
2392
  S: this,
2319
2393
  A: [
2320
2394
  "invitationId",
@@ -2327,6 +2401,9 @@ var InvitationsServiceImpl = class {
2327
2401
  await created.cancel();
2328
2402
  this._createInvitations.delete(invitationId);
2329
2403
  this._removedCreated.emit(created.get());
2404
+ if (created.get().persistent) {
2405
+ await this._metadataStore.removeInvitation(created.get().invitationId);
2406
+ }
2330
2407
  } else if (accepted) {
2331
2408
  await accepted.cancel();
2332
2409
  this._acceptInvitations.delete(invitationId);
@@ -2371,16 +2448,40 @@ var InvitationsServiceImpl = class {
2371
2448
  ]
2372
2449
  });
2373
2450
  });
2451
+ this._saved.on(ctx, (invitation) => {
2452
+ next({
2453
+ action: QueryInvitationsResponse.Action.SAVED,
2454
+ type: QueryInvitationsResponse.Type.CREATED,
2455
+ invitations: [
2456
+ invitation
2457
+ ]
2458
+ });
2459
+ });
2374
2460
  next({
2375
2461
  action: QueryInvitationsResponse.Action.ADDED,
2376
2462
  type: QueryInvitationsResponse.Type.CREATED,
2377
- invitations: Array.from(this._createInvitations.values()).map((invitation) => invitation.get())
2463
+ invitations: Array.from(this._createInvitations.values()).map((invitation) => invitation.get()),
2464
+ existing: true
2378
2465
  });
2379
2466
  next({
2380
2467
  action: QueryInvitationsResponse.Action.ADDED,
2381
2468
  type: QueryInvitationsResponse.Type.ACCEPTED,
2382
- invitations: Array.from(this._acceptInvitations.values()).map((invitation) => invitation.get())
2469
+ invitations: Array.from(this._acceptInvitations.values()).map((invitation) => invitation.get()),
2470
+ existing: true
2383
2471
  });
2472
+ if (this._persistentInvitationsLoaded) {
2473
+ next({
2474
+ action: QueryInvitationsResponse.Action.LOAD_COMPLETE,
2475
+ type: QueryInvitationsResponse.Type.CREATED
2476
+ });
2477
+ } else {
2478
+ this._persistentInvitationsLoadedEvent.on(ctx, () => {
2479
+ next({
2480
+ action: QueryInvitationsResponse.Action.LOAD_COMPLETE,
2481
+ type: QueryInvitationsResponse.Type.CREATED
2482
+ });
2483
+ });
2484
+ }
2384
2485
  });
2385
2486
  }
2386
2487
  };
@@ -2671,7 +2772,7 @@ var getPlatform = () => {
2671
2772
  };
2672
2773
 
2673
2774
  // packages/sdk/client-services/src/version.ts
2674
- var DXOS_VERSION = "0.4.7-main.7b31910";
2775
+ var DXOS_VERSION = "0.4.7-main.83fe62c";
2675
2776
 
2676
2777
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2677
2778
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
@@ -2813,12 +2914,12 @@ var getSpaceStats = async (space) => {
2813
2914
  };
2814
2915
 
2815
2916
  // packages/sdk/client-services/src/packlets/spaces/data-space.ts
2816
- import { Event as Event5, scheduleTask as scheduleTask4, sleep as sleep2, synchronized, trackLeaks } from "@dxos/async";
2917
+ import { Event as Event5, asyncTimeout, scheduleTask as scheduleTask5, sleep as sleep2, synchronized, trackLeaks } from "@dxos/async";
2817
2918
  import { AUTH_TIMEOUT as AUTH_TIMEOUT2 } from "@dxos/client-protocol";
2818
- import { cancelWithContext as cancelWithContext2, Context as Context7, ContextDisposedError } from "@dxos/context";
2919
+ import { cancelWithContext as cancelWithContext2, Context as Context8, ContextDisposedError } from "@dxos/context";
2819
2920
  import { timed, warnAfterTimeout } from "@dxos/debug";
2820
2921
  import { createMappedFeedWriter } from "@dxos/echo-pipeline";
2821
- import { failedInvariant } from "@dxos/invariant";
2922
+ import { failedInvariant, invariant as invariant11 } from "@dxos/invariant";
2822
2923
  import { PublicKey as PublicKey8 } from "@dxos/keys";
2823
2924
  import { log as log10 } from "@dxos/log";
2824
2925
  import { CancelledError, SystemError } from "@dxos/protocols";
@@ -2835,6 +2936,7 @@ var AutomergeSpaceState = class {
2835
2936
  this._onNewRoot = _onNewRoot;
2836
2937
  this.rootUrl = void 0;
2837
2938
  this.lastEpoch = void 0;
2939
+ this._isProcessingRootDocs = false;
2838
2940
  }
2839
2941
  async processCredential(credential) {
2840
2942
  if (!checkCredentialType(credential, "dxos.halo.credentials.Epoch")) {
@@ -2843,14 +2945,25 @@ var AutomergeSpaceState = class {
2843
2945
  this.lastEpoch = credential;
2844
2946
  if (credential.subject.assertion.automergeRoot) {
2845
2947
  this.rootUrl = credential.subject.assertion.automergeRoot;
2948
+ if (this._isProcessingRootDocs) {
2949
+ this._onNewRoot(this.rootUrl);
2950
+ }
2951
+ }
2952
+ }
2953
+ startProcessingRootDocs() {
2954
+ if (this._isProcessingRootDocs) {
2955
+ return;
2956
+ }
2957
+ if (this.rootUrl) {
2846
2958
  this._onNewRoot(this.rootUrl);
2847
2959
  }
2960
+ this._isProcessingRootDocs = true;
2848
2961
  }
2849
2962
  };
2850
2963
 
2851
2964
  // packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
2852
- import { DeferredTask, Event as Event4, scheduleTask as scheduleTask3, sleep, TimeoutError as TimeoutError2, Trigger as Trigger4 } from "@dxos/async";
2853
- import { Context as Context6, rejectOnDispose } from "@dxos/context";
2965
+ import { DeferredTask, Event as Event4, scheduleTask as scheduleTask4, sleep, TimeoutError as TimeoutError2, Trigger as Trigger4 } from "@dxos/async";
2966
+ import { Context as Context7, rejectOnDispose } from "@dxos/context";
2854
2967
  import { invariant as invariant10 } from "@dxos/invariant";
2855
2968
  import { PublicKey as PublicKey7 } from "@dxos/keys";
2856
2969
  import { log as log9 } from "@dxos/log";
@@ -2864,7 +2977,7 @@ var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
2864
2977
  var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
2865
2978
  var NotarizationPlugin = class {
2866
2979
  constructor() {
2867
- this._ctx = new Context6();
2980
+ this._ctx = new Context7();
2868
2981
  this._extensionOpened = new Event4();
2869
2982
  this._extensions = /* @__PURE__ */ new Set();
2870
2983
  this._processedCredentials = new ComplexSet2(PublicKey7.hash);
@@ -2916,7 +3029,7 @@ var NotarizationPlugin = class {
2916
3029
  });
2917
3030
  opCtx?.onDispose(() => ctx.dispose());
2918
3031
  if (timeout !== 0) {
2919
- scheduleTask3(ctx, () => {
3032
+ scheduleTask4(ctx, () => {
2920
3033
  log9.warn("Notarization timeout", {
2921
3034
  timeout,
2922
3035
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
@@ -2950,7 +3063,7 @@ var NotarizationPlugin = class {
2950
3063
  C: (f, a) => f(...a)
2951
3064
  });
2952
3065
  peersTried.clear();
2953
- scheduleTask3(ctx, () => notarizeTask.schedule(), retryTimeout);
3066
+ scheduleTask4(ctx, () => notarizeTask.schedule(), retryTimeout);
2954
3067
  return;
2955
3068
  }
2956
3069
  peersTried.add(peer);
@@ -3131,7 +3244,7 @@ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
3131
3244
  var ENABLE_FEED_PURGE = false;
3132
3245
  var DataSpace = class {
3133
3246
  constructor(params) {
3134
- this._ctx = new Context7();
3247
+ this._ctx = new Context8();
3135
3248
  this._notarizationPlugin = new NotarizationPlugin();
3136
3249
  this._cache = void 0;
3137
3250
  // TODO(dmaretskyi): Move into Space?
@@ -3211,7 +3324,7 @@ var DataSpace = class {
3211
3324
  await this._notarizationPlugin.open();
3212
3325
  await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
3213
3326
  await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
3214
- await this._inner.open(new Context7());
3327
+ await this._inner.open(new Context8());
3215
3328
  this._state = SpaceState.CONTROL_ONLY;
3216
3329
  log10("new state", {
3217
3330
  state: SpaceState[this._state]
@@ -3240,7 +3353,7 @@ var DataSpace = class {
3240
3353
  C: (f, a) => f(...a)
3241
3354
  });
3242
3355
  await this._ctx.dispose();
3243
- this._ctx = new Context7();
3356
+ this._ctx = new Context8();
3244
3357
  await this.authVerifier.close();
3245
3358
  await this._inner.close();
3246
3359
  await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
@@ -3259,7 +3372,7 @@ var DataSpace = class {
3259
3372
  * Initialize the data pipeline in a separate task.
3260
3373
  */
3261
3374
  initializeDataPipelineAsync() {
3262
- scheduleTask4(this._ctx, async () => {
3375
+ scheduleTask5(this._ctx, async () => {
3263
3376
  try {
3264
3377
  this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
3265
3378
  await this.initializeDataPipeline();
@@ -3310,12 +3423,13 @@ var DataSpace = class {
3310
3423
  });
3311
3424
  await this._initializeAndReadControlPipeline();
3312
3425
  await sleep2(1);
3426
+ this._automergeSpaceState.startProcessingRootDocs();
3313
3427
  await this._inner.initializeDataPipeline();
3314
3428
  this.metrics.dataPipelineOpen = /* @__PURE__ */ new Date();
3315
3429
  await cancelWithContext2(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
3316
3430
  log10("waiting for data pipeline to reach target timeframe", void 0, {
3317
3431
  F: __dxlog_file12,
3318
- L: 286,
3432
+ L: 288,
3319
3433
  S: this,
3320
3434
  C: (f, a) => f(...a)
3321
3435
  });
@@ -3326,7 +3440,7 @@ var DataSpace = class {
3326
3440
  this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
3327
3441
  log10("data pipeline ready", void 0, {
3328
3442
  F: __dxlog_file12,
3329
- L: 294,
3443
+ L: 296,
3330
3444
  S: this,
3331
3445
  C: (f, a) => f(...a)
3332
3446
  });
@@ -3336,7 +3450,7 @@ var DataSpace = class {
3336
3450
  state: SpaceState[this._state]
3337
3451
  }, {
3338
3452
  F: __dxlog_file12,
3339
- L: 298,
3453
+ L: 300,
3340
3454
  S: this,
3341
3455
  C: (f, a) => f(...a)
3342
3456
  });
@@ -3352,7 +3466,7 @@ var DataSpace = class {
3352
3466
  await this._createWritableFeeds();
3353
3467
  log10("writable feeds created", void 0, {
3354
3468
  F: __dxlog_file12,
3355
- L: 314,
3469
+ L: 316,
3356
3470
  S: this,
3357
3471
  C: (f, a) => f(...a)
3358
3472
  });
@@ -3415,7 +3529,7 @@ var DataSpace = class {
3415
3529
  rootUrl
3416
3530
  }, {
3417
3531
  F: __dxlog_file12,
3418
- L: 380,
3532
+ L: 382,
3419
3533
  S: this,
3420
3534
  C: (f, a) => f(...a)
3421
3535
  });
@@ -3447,7 +3561,7 @@ var DataSpace = class {
3447
3561
  err
3448
3562
  }, {
3449
3563
  F: __dxlog_file12,
3450
- L: 403,
3564
+ L: 405,
3451
3565
  S: this,
3452
3566
  C: (f, a) => f(...a)
3453
3567
  });
@@ -3478,15 +3592,40 @@ var DataSpace = class {
3478
3592
  epoch = await this.dataPipeline.createEpoch();
3479
3593
  }
3480
3594
  break;
3481
- case CreateEpochRequest.Migration.INIT_AUTOMERGE: {
3482
- const document = this._automergeHost.repo.create();
3483
- epoch = {
3484
- previousId: this._automergeSpaceState.lastEpoch?.id,
3485
- number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
3486
- timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe2(),
3487
- automergeRoot: document.url
3488
- };
3489
- }
3595
+ case CreateEpochRequest.Migration.INIT_AUTOMERGE:
3596
+ {
3597
+ const document = this._automergeHost.repo.create();
3598
+ epoch = {
3599
+ previousId: this._automergeSpaceState.lastEpoch?.id,
3600
+ number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
3601
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe2(),
3602
+ automergeRoot: document.url
3603
+ };
3604
+ }
3605
+ break;
3606
+ case CreateEpochRequest.Migration.PRUNE_AUTOMERGE_ROOT_HISTORY:
3607
+ {
3608
+ const currentRootUrl = this._automergeSpaceState.rootUrl;
3609
+ const rootHandle = this._automergeHost.repo.find(currentRootUrl);
3610
+ await cancelWithContext2(this._ctx, asyncTimeout(rootHandle.whenReady(), 1e4));
3611
+ const newRoot = this._automergeHost.repo.create(rootHandle.docSync());
3612
+ invariant11(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
3613
+ F: __dxlog_file12,
3614
+ L: 450,
3615
+ S: this,
3616
+ A: [
3617
+ "typeof newRoot.url === 'string' && newRoot.url.length > 0",
3618
+ ""
3619
+ ]
3620
+ });
3621
+ epoch = {
3622
+ previousId: this._automergeSpaceState.lastEpoch?.id,
3623
+ number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
3624
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe2(),
3625
+ automergeRoot: newRoot.url
3626
+ };
3627
+ }
3628
+ break;
3490
3629
  }
3491
3630
  if (!epoch) {
3492
3631
  return;
@@ -3537,7 +3676,7 @@ var DataSpace = class {
3537
3676
  state: SpaceState[this._state]
3538
3677
  }, {
3539
3678
  F: __dxlog_file12,
3540
- L: 492,
3679
+ L: 514,
3541
3680
  S: this,
3542
3681
  C: (f, a) => f(...a)
3543
3682
  });
@@ -3592,9 +3731,9 @@ DataSpace = _ts_decorate4([
3592
3731
 
3593
3732
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
3594
3733
  import { Event as Event6, synchronized as synchronized2, trackLeaks as trackLeaks2 } from "@dxos/async";
3595
- import { cancelWithContext as cancelWithContext3, Context as Context8 } from "@dxos/context";
3734
+ import { cancelWithContext as cancelWithContext3, Context as Context9 } from "@dxos/context";
3596
3735
  import { getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
3597
- import { invariant as invariant11 } from "@dxos/invariant";
3736
+ import { invariant as invariant12 } from "@dxos/invariant";
3598
3737
  import { PublicKey as PublicKey9 } from "@dxos/keys";
3599
3738
  import { log as log11 } from "@dxos/log";
3600
3739
  import { trace as trace7 } from "@dxos/protocols";
@@ -3695,7 +3834,7 @@ var DataSpaceManager = class {
3695
3834
  this._signingContext = _signingContext;
3696
3835
  this._feedStore = _feedStore;
3697
3836
  this._automergeHost = _automergeHost;
3698
- this._ctx = new Context8();
3837
+ this._ctx = new Context9();
3699
3838
  this.updated = new Event6();
3700
3839
  this._spaces = new ComplexMap3(PublicKey9.hash);
3701
3840
  this._isOpen = false;
@@ -3787,7 +3926,7 @@ var DataSpaceManager = class {
3787
3926
  * Creates a new space writing the genesis credentials to the control feed.
3788
3927
  */
3789
3928
  async createSpace() {
3790
- invariant11(this._isOpen, "Not open.", {
3929
+ invariant12(this._isOpen, "Not open.", {
3791
3930
  F: __dxlog_file13,
3792
3931
  L: 145,
3793
3932
  S: this,
@@ -3824,7 +3963,7 @@ var DataSpaceManager = class {
3824
3963
  const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, automergeRoot.url);
3825
3964
  await this._metadataStore.addSpace(metadata);
3826
3965
  const memberCredential = credentials[1];
3827
- invariant11(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3966
+ invariant12(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
3828
3967
  F: __dxlog_file13,
3829
3968
  L: 170,
3830
3969
  S: this,
@@ -3848,7 +3987,7 @@ var DataSpaceManager = class {
3848
3987
  S: this,
3849
3988
  C: (f, a) => f(...a)
3850
3989
  });
3851
- invariant11(this._isOpen, "Not open.", {
3990
+ invariant12(this._isOpen, "Not open.", {
3852
3991
  F: __dxlog_file13,
3853
3992
  L: 183,
3854
3993
  S: this,
@@ -3857,7 +3996,7 @@ var DataSpaceManager = class {
3857
3996
  "'Not open.'"
3858
3997
  ]
3859
3998
  });
3860
- invariant11(!this._spaces.has(opts.spaceKey), "Space already exists.", {
3999
+ invariant12(!this._spaces.has(opts.spaceKey), "Space already exists.", {
3861
4000
  F: __dxlog_file13,
3862
4001
  L: 184,
3863
4002
  S: this,
@@ -4021,10 +4160,10 @@ DataSpaceManager = _ts_decorate5([
4021
4160
  ], DataSpaceManager);
4022
4161
 
4023
4162
  // packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
4024
- import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTask as scheduleTask5 } from "@dxos/async";
4163
+ import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTask as scheduleTask6 } from "@dxos/async";
4025
4164
  import { Stream as Stream10 } from "@dxos/codec-protobuf";
4026
4165
  import { raise as raise2 } from "@dxos/debug";
4027
- import { invariant as invariant12 } from "@dxos/invariant";
4166
+ import { invariant as invariant13 } from "@dxos/invariant";
4028
4167
  import { log as log12 } from "@dxos/log";
4029
4168
  import { ApiError, SpaceNotFoundError, encodeError } from "@dxos/protocols";
4030
4169
  import { SpaceMember as SpaceMember3, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
@@ -4079,7 +4218,7 @@ var SpacesServiceImpl = class {
4079
4218
  }, {
4080
4219
  maxFrequency: false ? void 0 : 2
4081
4220
  });
4082
- scheduleTask5(ctx, async () => {
4221
+ scheduleTask6(ctx, async () => {
4083
4222
  const dataSpaceManager = await this._getDataSpaceManager();
4084
4223
  const subscriptions = new EventSubscriptions2();
4085
4224
  ctx.onDispose(() => subscriptions.clear());
@@ -4116,7 +4255,7 @@ var SpacesServiceImpl = class {
4116
4255
  }
4117
4256
  subscribeMessages({ spaceKey, channel }) {
4118
4257
  return new Stream10(({ ctx, next }) => {
4119
- scheduleTask5(ctx, async () => {
4258
+ scheduleTask6(ctx, async () => {
4120
4259
  const dataSpaceManager = await this._getDataSpaceManager();
4121
4260
  const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError(spaceKey));
4122
4261
  const handle = space.listen(getChannelId(channel), (message) => {
@@ -4135,7 +4274,7 @@ var SpacesServiceImpl = class {
4135
4274
  }
4136
4275
  };
4137
4276
  ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
4138
- scheduleTask5(ctx, async () => {
4277
+ scheduleTask6(ctx, async () => {
4139
4278
  await space.spaceState.addCredentialProcessor(processor);
4140
4279
  if (noTail) {
4141
4280
  close();
@@ -4153,7 +4292,7 @@ var SpacesServiceImpl = class {
4153
4292
  }
4154
4293
  });
4155
4294
  } else {
4156
- invariant12(!credential.id, "Id on unsigned credentials is not allowed", {
4295
+ invariant13(!credential.id, "Id on unsigned credentials is not allowed", {
4157
4296
  F: __dxlog_file14,
4158
4297
  L: 168,
4159
4298
  S: this,
@@ -4162,7 +4301,7 @@ var SpacesServiceImpl = class {
4162
4301
  "'Id on unsigned credentials is not allowed'"
4163
4302
  ]
4164
4303
  });
4165
- invariant12(this._identityManager.identity, "Identity is not available", {
4304
+ invariant13(this._identityManager.identity, "Identity is not available", {
4166
4305
  F: __dxlog_file14,
4167
4306
  L: 169,
4168
4307
  S: this,
@@ -4172,7 +4311,7 @@ var SpacesServiceImpl = class {
4172
4311
  ]
4173
4312
  });
4174
4313
  const signer = this._identityManager.identity.getIdentityCredentialSigner();
4175
- invariant12(credential.issuer.equals(signer.getIssuer()), void 0, {
4314
+ invariant13(credential.issuer.equals(signer.getIssuer()), void 0, {
4176
4315
  F: __dxlog_file14,
4177
4316
  L: 171,
4178
4317
  S: this,
@@ -4193,10 +4332,12 @@ var SpacesServiceImpl = class {
4193
4332
  }
4194
4333
  }
4195
4334
  }
4196
- async createEpoch({ spaceKey }) {
4335
+ async createEpoch({ spaceKey, migration }) {
4197
4336
  const dataSpaceManager = await this._getDataSpaceManager();
4198
4337
  const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError(spaceKey));
4199
- await space.createEpoch();
4338
+ await space.createEpoch({
4339
+ migration
4340
+ });
4200
4341
  }
4201
4342
  _serializeSpace(space) {
4202
4343
  return {
@@ -4225,9 +4366,7 @@ var SpacesServiceImpl = class {
4225
4366
  return {
4226
4367
  identity: {
4227
4368
  identityKey: member.key,
4228
- profile: {
4229
- displayName: member.profile?.displayName
4230
- }
4369
+ profile: member.profile ?? {}
4231
4370
  },
4232
4371
  presence: member.removed ? SpaceMember3.PresenceState.REMOVED : isMe || peers.length > 0 ? SpaceMember3.PresenceState.ONLINE : SpaceMember3.PresenceState.OFFLINE,
4233
4372
  peerStates: peers
@@ -4243,12 +4382,13 @@ var getChannelId = (channel) => `user-channel/${channel}`;
4243
4382
 
4244
4383
  // packages/sdk/client-services/src/packlets/services/service-context.ts
4245
4384
  import { Trigger as Trigger5 } from "@dxos/async";
4246
- import { Context as Context9 } from "@dxos/context";
4385
+ import { Context as Context10 } from "@dxos/context";
4247
4386
  import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
4248
4387
  import { failUndefined as failUndefined2 } from "@dxos/debug";
4249
4388
  import { valueEncoding, MetadataStore, SpaceManager, DataServiceSubscriptions, SnapshotStore, AutomergeHost } from "@dxos/echo-pipeline";
4389
+ import { IndexMetadataStore } from "@dxos/echo-schema";
4250
4390
  import { FeedFactory, FeedStore } from "@dxos/feed-store";
4251
- import { invariant as invariant13 } from "@dxos/invariant";
4391
+ import { invariant as invariant14 } from "@dxos/invariant";
4252
4392
  import { Keyring } from "@dxos/keyring";
4253
4393
  import { PublicKey as PublicKey10 } from "@dxos/keys";
4254
4394
  import { log as log13 } from "@dxos/log";
@@ -4280,6 +4420,9 @@ var ServiceContext = class {
4280
4420
  this._handlerFactories = /* @__PURE__ */ new Map();
4281
4421
  this._instanceId = PublicKey10.random().toHex();
4282
4422
  this.metadataStore = new MetadataStore(storage.createDirectory("metadata"));
4423
+ this.indexMetadata = new IndexMetadataStore({
4424
+ directory: storage.createDirectory("index-metadata")
4425
+ });
4283
4426
  this.snapshotStore = new SnapshotStore(storage.createDirectory("snapshots"));
4284
4427
  this.blobStore = new BlobStore(storage.createDirectory("blobs"));
4285
4428
  this.keyring = new Keyring(storage.createDirectory("keyring"));
@@ -4302,7 +4445,10 @@ var ServiceContext = class {
4302
4445
  snapshotStore: this.snapshotStore
4303
4446
  });
4304
4447
  this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
4305
- this.automergeHost = new AutomergeHost(storage.createDirectory("automerge"));
4448
+ this.automergeHost = new AutomergeHost({
4449
+ directory: storage.createDirectory("automerge"),
4450
+ metadata: this.indexMetadata
4451
+ });
4306
4452
  this.invitations = new InvitationsHandler(this.networkManager);
4307
4453
  this._handlerFactories.set(Invitation6.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? failUndefined2(), this._acceptIdentity.bind(this)));
4308
4454
  }
@@ -4310,7 +4456,7 @@ var ServiceContext = class {
4310
4456
  await this._checkStorageVersion();
4311
4457
  log13("opening...", void 0, {
4312
4458
  F: __dxlog_file15,
4313
- L: 146,
4459
+ L: 152,
4314
4460
  S: this,
4315
4461
  C: (f, a) => f(...a)
4316
4462
  });
@@ -4318,7 +4464,7 @@ var ServiceContext = class {
4318
4464
  id: this._instanceId
4319
4465
  }), {
4320
4466
  F: __dxlog_file15,
4321
- L: 147,
4467
+ L: 153,
4322
4468
  S: this,
4323
4469
  C: (f, a) => f(...a)
4324
4470
  });
@@ -4334,13 +4480,13 @@ var ServiceContext = class {
4334
4480
  id: this._instanceId
4335
4481
  }), {
4336
4482
  F: __dxlog_file15,
4337
- L: 157,
4483
+ L: 163,
4338
4484
  S: this,
4339
4485
  C: (f, a) => f(...a)
4340
4486
  });
4341
4487
  log13("opened", void 0, {
4342
4488
  F: __dxlog_file15,
4343
- L: 158,
4489
+ L: 164,
4344
4490
  S: this,
4345
4491
  C: (f, a) => f(...a)
4346
4492
  });
@@ -4348,7 +4494,7 @@ var ServiceContext = class {
4348
4494
  async close() {
4349
4495
  log13("closing...", void 0, {
4350
4496
  F: __dxlog_file15,
4351
- L: 162,
4497
+ L: 168,
4352
4498
  S: this,
4353
4499
  C: (f, a) => f(...a)
4354
4500
  });
@@ -4366,21 +4512,21 @@ var ServiceContext = class {
4366
4512
  await this.metadataStore.close();
4367
4513
  log13("closed", void 0, {
4368
4514
  F: __dxlog_file15,
4369
- L: 175,
4515
+ L: 181,
4370
4516
  S: this,
4371
4517
  C: (f, a) => f(...a)
4372
4518
  });
4373
4519
  }
4374
4520
  async createIdentity(params = {}) {
4375
4521
  const identity = await this.identityManager.createIdentity(params);
4376
- await this._initialize(new Context9());
4522
+ await this._initialize(new Context10());
4377
4523
  return identity;
4378
4524
  }
4379
4525
  getInvitationHandler(invitation) {
4380
4526
  const factory = this._handlerFactories.get(invitation.kind);
4381
- invariant13(factory, `Unknown invitation kind: ${invitation.kind}`, {
4527
+ invariant14(factory, `Unknown invitation kind: ${invitation.kind}`, {
4382
4528
  F: __dxlog_file15,
4383
- L: 186,
4529
+ L: 192,
4384
4530
  S: this,
4385
4531
  A: [
4386
4532
  "factory",
@@ -4399,7 +4545,7 @@ var ServiceContext = class {
4399
4545
  }
4400
4546
  async _acceptIdentity(params) {
4401
4547
  const identity = await this.identityManager.acceptIdentity(params);
4402
- await this._initialize(new Context9());
4548
+ await this._initialize(new Context10());
4403
4549
  return identity;
4404
4550
  }
4405
4551
  async _checkStorageVersion() {
@@ -4412,7 +4558,7 @@ var ServiceContext = class {
4412
4558
  async _initialize(ctx) {
4413
4559
  log13("initializing spaces...", void 0, {
4414
4560
  F: __dxlog_file15,
4415
- L: 217,
4561
+ L: 223,
4416
4562
  S: this,
4417
4563
  C: (f, a) => f(...a)
4418
4564
  });
@@ -4433,9 +4579,9 @@ var ServiceContext = class {
4433
4579
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost, this._runtimeParams);
4434
4580
  await this.dataSpaceManager.open();
4435
4581
  this._handlerFactories.set(Invitation6.Kind.SPACE, (invitation) => {
4436
- invariant13(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4582
+ invariant14(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
4437
4583
  F: __dxlog_file15,
4438
- L: 242,
4584
+ L: 248,
4439
4585
  S: this,
4440
4586
  A: [
4441
4587
  "this.dataSpaceManager",
@@ -4459,7 +4605,7 @@ var ServiceContext = class {
4459
4605
  details: assertion
4460
4606
  }, {
4461
4607
  F: __dxlog_file15,
4462
- L: 258,
4608
+ L: 264,
4463
4609
  S: this,
4464
4610
  C: (f, a) => f(...a)
4465
4611
  });
@@ -4470,7 +4616,7 @@ var ServiceContext = class {
4470
4616
  details: assertion
4471
4617
  }, {
4472
4618
  F: __dxlog_file15,
4473
- L: 262,
4619
+ L: 268,
4474
4620
  S: this,
4475
4621
  C: (f, a) => f(...a)
4476
4622
  });
@@ -4481,7 +4627,7 @@ var ServiceContext = class {
4481
4627
  details: assertion
4482
4628
  }, {
4483
4629
  F: __dxlog_file15,
4484
- L: 267,
4630
+ L: 273,
4485
4631
  S: this,
4486
4632
  C: (f, a) => f(...a)
4487
4633
  });
@@ -4492,7 +4638,7 @@ var ServiceContext = class {
4492
4638
  } catch (err) {
4493
4639
  log13.catch(err, void 0, {
4494
4640
  F: __dxlog_file15,
4495
- L: 273,
4641
+ L: 279,
4496
4642
  S: this,
4497
4643
  C: (f, a) => f(...a)
4498
4644
  });
@@ -4538,7 +4684,7 @@ var ServiceRegistry = class {
4538
4684
  };
4539
4685
 
4540
4686
  // packages/sdk/client-services/src/packlets/locks/browser.ts
4541
- import { asyncTimeout, Trigger as Trigger6 } from "@dxos/async";
4687
+ import { asyncTimeout as asyncTimeout2, Trigger as Trigger6 } from "@dxos/async";
4542
4688
  import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
4543
4689
  import { log as log14, logInfo } from "@dxos/log";
4544
4690
  function _ts_decorate7(decorators, target, key, desc) {
@@ -4579,7 +4725,7 @@ var Lock = class {
4579
4725
  S: this,
4580
4726
  C: (f, a) => f(...a)
4581
4727
  });
4582
- await asyncTimeout(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
4728
+ await asyncTimeout2(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
4583
4729
  log14("acquired lock", void 0, {
4584
4730
  F: __dxlog_file16,
4585
4731
  L: 44,
@@ -4713,12 +4859,12 @@ var toStorageType = (type) => {
4713
4859
  // packages/sdk/client-services/src/packlets/services/service-host.ts
4714
4860
  import { Event as Event8, synchronized as synchronized3 } from "@dxos/async";
4715
4861
  import { clientServiceBundle, defaultKey, Properties } from "@dxos/client-protocol";
4716
- import { Context as Context10 } from "@dxos/context";
4862
+ import { Context as Context11 } from "@dxos/context";
4717
4863
  import { DocumentModel as DocumentModel2 } from "@dxos/document-model";
4718
4864
  import { DataServiceImpl } from "@dxos/echo-pipeline";
4719
4865
  import { getRawDoc, getAutomergeObjectCore } from "@dxos/echo-schema";
4720
- import { invariant as invariant15 } from "@dxos/invariant";
4721
- import { PublicKey as PublicKey11 } from "@dxos/keys";
4866
+ import { invariant as invariant16 } from "@dxos/invariant";
4867
+ import { PublicKey as PublicKey12 } from "@dxos/keys";
4722
4868
  import { log as log16 } from "@dxos/log";
4723
4869
  import { WebsocketSignalManager } from "@dxos/messaging";
4724
4870
  import { ModelFactory } from "@dxos/model-factory";
@@ -4733,7 +4879,7 @@ import { WebsocketRpcClient } from "@dxos/websocket-rpc";
4733
4879
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
4734
4880
  import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
4735
4881
  import { Stream as Stream11 } from "@dxos/codec-protobuf";
4736
- import { invariant as invariant14 } from "@dxos/invariant";
4882
+ import { invariant as invariant15 } from "@dxos/invariant";
4737
4883
  import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
4738
4884
  var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
4739
4885
  var DevicesServiceImpl = class {
@@ -4752,7 +4898,7 @@ var DevicesServiceImpl = class {
4752
4898
  devices: []
4753
4899
  });
4754
4900
  } else {
4755
- invariant14(this._identityManager.identity?.presence, "presence not present", {
4901
+ invariant15(this._identityManager.identity?.presence, "presence not present", {
4756
4902
  F: __dxlog_file17,
4757
4903
  L: 32,
4758
4904
  S: this,
@@ -4815,13 +4961,15 @@ var DevicesServiceImpl = class {
4815
4961
  // packages/sdk/client-services/src/packlets/logging/logging-service.ts
4816
4962
  import { Event as Event7 } from "@dxos/async";
4817
4963
  import { Stream as Stream12 } from "@dxos/codec-protobuf";
4964
+ import { PublicKey as PublicKey11 } from "@dxos/keys";
4818
4965
  import { getContextFromEntry, log as log15 } from "@dxos/log";
4819
4966
  import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
4820
- import { jsonify, numericalValues, tracer } from "@dxos/util";
4967
+ import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
4821
4968
  var LoggingServiceImpl = class {
4822
4969
  constructor() {
4823
4970
  this._logs = new Event7();
4824
- this._started = /* @__PURE__ */ new Date();
4971
+ this._started = Date.now();
4972
+ this._sessionId = PublicKey11.random().toHex();
4825
4973
  this._logProcessor = (_config, entry2) => {
4826
4974
  this._logs.emit(entry2);
4827
4975
  };
@@ -4897,7 +5045,12 @@ var LoggingServiceImpl = class {
4897
5045
  meta: {
4898
5046
  // TODO(dmaretskyi): Fix proto.
4899
5047
  file: entry2.meta?.F ?? "",
4900
- line: entry2.meta?.L ?? 0
5048
+ line: entry2.meta?.L ?? 0,
5049
+ scope: {
5050
+ hostSessionId: this._sessionId,
5051
+ uptimeSeconds: (Date.now() - this._started) / 1e3,
5052
+ name: getDebugName(entry2.meta?.S)
5053
+ }
4901
5054
  }
4902
5055
  };
4903
5056
  try {
@@ -5066,7 +5219,7 @@ var ClientServicesHost = class {
5066
5219
  lockKey,
5067
5220
  onAcquire: () => {
5068
5221
  if (!this._opening) {
5069
- void this.open(new Context10());
5222
+ void this.open(new Context11());
5070
5223
  }
5071
5224
  },
5072
5225
  onRelease: () => this.close()
@@ -5120,7 +5273,7 @@ var ClientServicesHost = class {
5120
5273
  * Can only be called once.
5121
5274
  */
5122
5275
  initialize({ config, ...options }) {
5123
- invariant15(!this._open, "service host is open", {
5276
+ invariant16(!this._open, "service host is open", {
5124
5277
  F: __dxlog_file18,
5125
5278
  L: 190,
5126
5279
  S: this,
@@ -5136,7 +5289,7 @@ var ClientServicesHost = class {
5136
5289
  C: (f, a) => f(...a)
5137
5290
  });
5138
5291
  if (config) {
5139
- invariant15(!this._config, "config already set", {
5292
+ invariant16(!this._config, "config already set", {
5140
5293
  F: __dxlog_file18,
5141
5294
  L: 194,
5142
5295
  S: this,
@@ -5154,7 +5307,7 @@ var ClientServicesHost = class {
5154
5307
  iceServers: this._config?.get("runtime.services.ice")
5155
5308
  }), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
5156
5309
  this._signalManager = signalManager;
5157
- invariant15(!this._networkManager, "network manager already set", {
5310
+ invariant16(!this._networkManager, "network manager already set", {
5158
5311
  F: __dxlog_file18,
5159
5312
  L: 210,
5160
5313
  S: this,
@@ -5179,7 +5332,7 @@ var ClientServicesHost = class {
5179
5332
  if (this._open) {
5180
5333
  return;
5181
5334
  }
5182
- const traceId = PublicKey11.random().toHex();
5335
+ const traceId = PublicKey12.random().toHex();
5183
5336
  log16.trace("dxos.client-services.host.open", trace9.begin({
5184
5337
  id: traceId
5185
5338
  }), {
@@ -5188,7 +5341,7 @@ var ClientServicesHost = class {
5188
5341
  S: this,
5189
5342
  C: (f, a) => f(...a)
5190
5343
  });
5191
- invariant15(this._config, "config not set", {
5344
+ invariant16(this._config, "config not set", {
5192
5345
  F: __dxlog_file18,
5193
5346
  L: 230,
5194
5347
  S: this,
@@ -5197,7 +5350,7 @@ var ClientServicesHost = class {
5197
5350
  "'config not set'"
5198
5351
  ]
5199
5352
  });
5200
- invariant15(this._storage, "storage not set", {
5353
+ invariant16(this._storage, "storage not set", {
5201
5354
  F: __dxlog_file18,
5202
5355
  L: 231,
5203
5356
  S: this,
@@ -5206,7 +5359,7 @@ var ClientServicesHost = class {
5206
5359
  "'storage not set'"
5207
5360
  ]
5208
5361
  });
5209
- invariant15(this._signalManager, "signal manager not set", {
5362
+ invariant16(this._signalManager, "signal manager not set", {
5210
5363
  F: __dxlog_file18,
5211
5364
  L: 232,
5212
5365
  S: this,
@@ -5215,7 +5368,7 @@ var ClientServicesHost = class {
5215
5368
  "'signal manager not set'"
5216
5369
  ]
5217
5370
  });
5218
- invariant15(this._networkManager, "network manager not set", {
5371
+ invariant16(this._networkManager, "network manager not set", {
5219
5372
  F: __dxlog_file18,
5220
5373
  L: 233,
5221
5374
  S: this,
@@ -5239,7 +5392,7 @@ var ClientServicesHost = class {
5239
5392
  this._serviceRegistry.setServices({
5240
5393
  SystemService: this._systemService,
5241
5394
  IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
5242
- InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
5395
+ InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation), this._serviceContext.metadataStore),
5243
5396
  DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
5244
5397
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
5245
5398
  await this._serviceContext.initialized.wait();
@@ -5257,6 +5410,24 @@ var ClientServicesHost = class {
5257
5410
  })
5258
5411
  });
5259
5412
  await this._serviceContext.open(ctx);
5413
+ invariant16(this.serviceRegistry.services.InvitationsService, void 0, {
5414
+ F: __dxlog_file18,
5415
+ L: 297,
5416
+ S: this,
5417
+ A: [
5418
+ "this.serviceRegistry.services.InvitationsService",
5419
+ ""
5420
+ ]
5421
+ });
5422
+ const loadedInvitations = await this.serviceRegistry.services.InvitationsService.loadPersistentInvitations();
5423
+ log16("loaded persistent invitations", {
5424
+ count: loadedInvitations.invitations?.length
5425
+ }, {
5426
+ F: __dxlog_file18,
5427
+ L: 300,
5428
+ S: this,
5429
+ C: (f, a) => f(...a)
5430
+ });
5260
5431
  const devtoolsProxy = this._config?.get("runtime.client.devtoolsProxy");
5261
5432
  if (devtoolsProxy) {
5262
5433
  this._devtoolsProxy = new WebsocketRpcClient({
@@ -5275,7 +5446,7 @@ var ClientServicesHost = class {
5275
5446
  deviceKey
5276
5447
  }, {
5277
5448
  F: __dxlog_file18,
5278
- L: 310,
5449
+ L: 317,
5279
5450
  S: this,
5280
5451
  C: (f, a) => f(...a)
5281
5452
  });
@@ -5283,7 +5454,7 @@ var ClientServicesHost = class {
5283
5454
  id: traceId
5284
5455
  }), {
5285
5456
  F: __dxlog_file18,
5286
- L: 311,
5457
+ L: 318,
5287
5458
  S: this,
5288
5459
  C: (f, a) => f(...a)
5289
5460
  });
@@ -5297,7 +5468,7 @@ var ClientServicesHost = class {
5297
5468
  deviceKey
5298
5469
  }, {
5299
5470
  F: __dxlog_file18,
5300
- L: 322,
5471
+ L: 329,
5301
5472
  S: this,
5302
5473
  C: (f, a) => f(...a)
5303
5474
  });
@@ -5313,24 +5484,24 @@ var ClientServicesHost = class {
5313
5484
  deviceKey
5314
5485
  }, {
5315
5486
  F: __dxlog_file18,
5316
- L: 329,
5487
+ L: 336,
5317
5488
  S: this,
5318
5489
  C: (f, a) => f(...a)
5319
5490
  });
5320
5491
  }
5321
5492
  async reset() {
5322
- const traceId = PublicKey11.random().toHex();
5493
+ const traceId = PublicKey12.random().toHex();
5323
5494
  log16.trace("dxos.sdk.client-services-host.reset", trace9.begin({
5324
5495
  id: traceId
5325
5496
  }), {
5326
5497
  F: __dxlog_file18,
5327
- L: 334,
5498
+ L: 341,
5328
5499
  S: this,
5329
5500
  C: (f, a) => f(...a)
5330
5501
  });
5331
5502
  log16("resetting...", void 0, {
5332
5503
  F: __dxlog_file18,
5333
- L: 336,
5504
+ L: 343,
5334
5505
  S: this,
5335
5506
  C: (f, a) => f(...a)
5336
5507
  });
@@ -5338,7 +5509,7 @@ var ClientServicesHost = class {
5338
5509
  await this._storage.reset();
5339
5510
  log16("reset", void 0, {
5340
5511
  F: __dxlog_file18,
5341
- L: 339,
5512
+ L: 346,
5342
5513
  S: this,
5343
5514
  C: (f, a) => f(...a)
5344
5515
  });
@@ -5346,7 +5517,7 @@ var ClientServicesHost = class {
5346
5517
  id: traceId
5347
5518
  }), {
5348
5519
  F: __dxlog_file18,
5349
- L: 340,
5520
+ L: 347,
5350
5521
  S: this,
5351
5522
  C: (f, a) => f(...a)
5352
5523
  });
@@ -5359,9 +5530,9 @@ var ClientServicesHost = class {
5359
5530
  const obj = new Properties(void 0);
5360
5531
  obj[defaultKey] = identity.identityKey.toHex();
5361
5532
  const automergeIndex = space.automergeSpaceState.rootUrl;
5362
- invariant15(automergeIndex, void 0, {
5533
+ invariant16(automergeIndex, void 0, {
5363
5534
  F: __dxlog_file18,
5364
- L: 355,
5535
+ L: 362,
5365
5536
  S: this,
5366
5537
  A: [
5367
5538
  "automergeIndex",
@@ -5416,6 +5587,7 @@ export {
5416
5587
  IdentityServiceImpl,
5417
5588
  DeviceInvitationProtocol,
5418
5589
  InvitationsHandler,
5590
+ invitationExpired,
5419
5591
  InvitationsServiceImpl,
5420
5592
  SpaceInvitationProtocol,
5421
5593
  ClientRpcServer,
@@ -5431,4 +5603,4 @@ export {
5431
5603
  createDefaultModelFactory,
5432
5604
  ClientServicesHost
5433
5605
  };
5434
- //# sourceMappingURL=chunk-AK5GNRMW.mjs.map
5606
+ //# sourceMappingURL=chunk-AQWJRYXB.mjs.map