@dxos/client-services 0.5.9-main.df0042a → 0.5.9-main.e9bab55

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.
@@ -355,7 +355,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
355
355
  import { TRACE_PROCESSOR } from "@dxos/tracing";
356
356
 
357
357
  // packages/sdk/client-services/src/version.ts
358
- var DXOS_VERSION = "0.5.9-main.df0042a";
358
+ var DXOS_VERSION = "0.5.9-main.e9bab55";
359
359
 
360
360
  // packages/sdk/client-services/src/packlets/services/platform.ts
361
361
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -1519,13 +1519,17 @@ IdentityManager = _ts_decorate3([
1519
1519
  ], IdentityManager);
1520
1520
 
1521
1521
  // packages/sdk/client-services/src/packlets/identity/identity-service.ts
1522
+ import { Trigger as Trigger3, sleep } from "@dxos/async";
1522
1523
  import { Stream as Stream8 } from "@dxos/codec-protobuf";
1523
1524
  import { Resource } from "@dxos/context";
1524
1525
  import { signPresentation } from "@dxos/credentials";
1525
1526
  import { todo } from "@dxos/debug";
1526
1527
  import { invariant as invariant4 } from "@dxos/invariant";
1528
+ import { log as log6 } from "@dxos/log";
1527
1529
  import { SpaceState } from "@dxos/protocols/proto/dxos/client/services";
1530
+ import { safeAwaitAll } from "@dxos/util";
1528
1531
  var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
1532
+ var DEFAULT_SPACE_SEARCH_TIMEOUT = 1e4;
1529
1533
  var IdentityServiceImpl = class extends Resource {
1530
1534
  constructor(_identityManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
1531
1535
  super();
@@ -1555,7 +1559,7 @@ var IdentityServiceImpl = class extends Resource {
1555
1559
  const identity = this._identityManager.identity;
1556
1560
  invariant4(identity, void 0, {
1557
1561
  F: __dxlog_file7,
1558
- L: 54,
1562
+ L: 59,
1559
1563
  S: this,
1560
1564
  A: [
1561
1565
  "identity",
@@ -1589,7 +1593,7 @@ var IdentityServiceImpl = class extends Resource {
1589
1593
  async updateProfile(profile) {
1590
1594
  invariant4(this._identityManager.identity, "Identity not initialized.", {
1591
1595
  F: __dxlog_file7,
1592
- L: 84,
1596
+ L: 89,
1593
1597
  S: this,
1594
1598
  A: [
1595
1599
  "this._identityManager.identity",
@@ -1603,7 +1607,7 @@ var IdentityServiceImpl = class extends Resource {
1603
1607
  async signPresentation({ presentation, nonce }) {
1604
1608
  invariant4(this._identityManager.identity, "Identity not initialized.", {
1605
1609
  F: __dxlog_file7,
1606
- L: 91,
1610
+ L: 96,
1607
1611
  S: this,
1608
1612
  A: [
1609
1613
  "this._identityManager.identity",
@@ -1619,9 +1623,11 @@ var IdentityServiceImpl = class extends Resource {
1619
1623
  });
1620
1624
  }
1621
1625
  async _fixIdentityWithoutDefaultSpace(identity) {
1622
- let hasDefaultSpace = false;
1626
+ let recodedDefaultSpace = false;
1627
+ let foundDefaultSpace = false;
1623
1628
  const dataSpaceManager = this._dataSpaceManagerProvider();
1624
- for (const space of dataSpaceManager.spaces.values()) {
1629
+ const recordedDefaultSpaceTrigger = new Trigger3();
1630
+ const allProcessed = safeAwaitAll(dataSpaceManager.spaces.values(), async (space) => {
1625
1631
  if (space.state === SpaceState.CLOSED) {
1626
1632
  await space.open();
1627
1633
  const requiresMigration = space.stateUpdate.waitForCondition(() => space.state === SpaceState.REQUIRES_MIGRATION);
@@ -1631,12 +1637,29 @@ var IdentityServiceImpl = class extends Resource {
1631
1637
  ]);
1632
1638
  }
1633
1639
  if (await dataSpaceManager.isDefaultSpace(space)) {
1640
+ if (foundDefaultSpace) {
1641
+ log6.warn("Multiple default spaces found. Using the first one.", {
1642
+ duplicate: space.id
1643
+ }, {
1644
+ F: __dxlog_file7,
1645
+ L: 127,
1646
+ S: this,
1647
+ C: (f, a) => f(...a)
1648
+ });
1649
+ return;
1650
+ }
1651
+ foundDefaultSpace = true;
1634
1652
  await identity.updateDefaultSpace(space.id);
1635
- hasDefaultSpace = true;
1636
- break;
1653
+ recodedDefaultSpace = true;
1654
+ recordedDefaultSpaceTrigger.wake();
1637
1655
  }
1638
- }
1639
- if (!hasDefaultSpace) {
1656
+ });
1657
+ await Promise.race([
1658
+ allProcessed,
1659
+ recordedDefaultSpaceTrigger.wait(),
1660
+ sleep(DEFAULT_SPACE_SEARCH_TIMEOUT)
1661
+ ]);
1662
+ if (!recodedDefaultSpace) {
1640
1663
  await this._createDefaultSpace(dataSpaceManager);
1641
1664
  }
1642
1665
  }
@@ -1760,7 +1783,7 @@ import { ContextDisposedError as ContextDisposedError2 } from "@dxos/context";
1760
1783
  import { createKeyPair, sign } from "@dxos/crypto";
1761
1784
  import { invariant as invariant9 } from "@dxos/invariant";
1762
1785
  import { PublicKey as PublicKey7 } from "@dxos/keys";
1763
- import { log as log9 } from "@dxos/log";
1786
+ import { log as log10 } from "@dxos/log";
1764
1787
  import { createTeleportProtocolFactory } from "@dxos/network-manager";
1765
1788
  import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError3, trace as trace5 } from "@dxos/protocols";
1766
1789
  import { Invitation as Invitation4 } from "@dxos/protocols/proto/dxos/client/services";
@@ -1769,10 +1792,10 @@ import { Options as Options4 } from "@dxos/protocols/proto/dxos/halo/invitations
1769
1792
  import { ComplexSet as ComplexSet3 } from "@dxos/util";
1770
1793
 
1771
1794
  // packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts
1772
- import { Trigger as Trigger3 } from "@dxos/async";
1795
+ import { Trigger as Trigger4 } from "@dxos/async";
1773
1796
  import { cancelWithContext as cancelWithContext2, Context as Context4 } from "@dxos/context";
1774
1797
  import { invariant as invariant6 } from "@dxos/invariant";
1775
- import { log as log6 } from "@dxos/log";
1798
+ import { log as log7 } from "@dxos/log";
1776
1799
  import { InvalidInvitationExtensionRoleError, schema as schema2 } from "@dxos/protocols";
1777
1800
  import { Options } from "@dxos/protocols/proto/dxos/halo/invitations";
1778
1801
  import { RpcExtension } from "@dxos/teleport";
@@ -1812,7 +1835,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1812
1835
  this._invitationFlowMutex = _invitationFlowMutex;
1813
1836
  this._callbacks = _callbacks;
1814
1837
  this._ctx = new Context4();
1815
- this._remoteOptionsTrigger = new Trigger3();
1838
+ this._remoteOptionsTrigger = new Trigger4();
1816
1839
  this._invitationFlowLock = null;
1817
1840
  }
1818
1841
  hasFlowLock() {
@@ -1849,14 +1872,14 @@ var InvitationGuestExtension = class extends RpcExtension {
1849
1872
  async onOpen(context) {
1850
1873
  await super.onOpen(context);
1851
1874
  try {
1852
- log6("guest acquire lock", void 0, {
1875
+ log7("guest acquire lock", void 0, {
1853
1876
  F: __dxlog_file9,
1854
1877
  L: 84,
1855
1878
  S: this,
1856
1879
  C: (f, a) => f(...a)
1857
1880
  });
1858
1881
  this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
1859
- log6("guest lock acquired", void 0, {
1882
+ log7("guest lock acquired", void 0, {
1860
1883
  F: __dxlog_file9,
1861
1884
  L: 86,
1862
1885
  S: this,
@@ -1865,7 +1888,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1865
1888
  await cancelWithContext2(this._ctx, this.rpc.InvitationHostService.options({
1866
1889
  role: Options.Role.GUEST
1867
1890
  }));
1868
- log6("options sent", void 0, {
1891
+ log7("options sent", void 0, {
1869
1892
  F: __dxlog_file9,
1870
1893
  L: 88,
1871
1894
  S: this,
@@ -1874,7 +1897,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1874
1897
  await cancelWithContext2(this._ctx, this._remoteOptionsTrigger.wait({
1875
1898
  timeout: OPTIONS_TIMEOUT
1876
1899
  }));
1877
- log6("options received", void 0, {
1900
+ log7("options received", void 0, {
1878
1901
  F: __dxlog_file9,
1879
1902
  L: 90,
1880
1903
  S: this,
@@ -1908,7 +1931,7 @@ var InvitationGuestExtension = class extends RpcExtension {
1908
1931
  if (this._invitationFlowLock != null) {
1909
1932
  this._invitationFlowLock.release();
1910
1933
  this._invitationFlowLock = null;
1911
- log6("invitation flow lock released", void 0, {
1934
+ log7("invitation flow lock released", void 0, {
1912
1935
  F: __dxlog_file9,
1913
1936
  L: 123,
1914
1937
  S: this,
@@ -1919,12 +1942,12 @@ var InvitationGuestExtension = class extends RpcExtension {
1919
1942
  };
1920
1943
 
1921
1944
  // packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts
1922
- import { Trigger as Trigger4, scheduleTask as scheduleTask2 } from "@dxos/async";
1945
+ import { Trigger as Trigger5, scheduleTask as scheduleTask2 } from "@dxos/async";
1923
1946
  import { cancelWithContext as cancelWithContext3, Context as Context5 } from "@dxos/context";
1924
1947
  import { randomBytes, verify } from "@dxos/crypto";
1925
1948
  import { invariant as invariant7, InvariantViolation } from "@dxos/invariant";
1926
1949
  import { PublicKey as PublicKey5 } from "@dxos/keys";
1927
- import { log as log7 } from "@dxos/log";
1950
+ import { log as log8 } from "@dxos/log";
1928
1951
  import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError2, schema as schema3, trace as trace4 } from "@dxos/protocols";
1929
1952
  import { Invitation as Invitation3 } from "@dxos/protocols/proto/dxos/client/services";
1930
1953
  import { AuthenticationResponse, Options as Options2 } from "@dxos/protocols/proto/dxos/halo/invitations";
@@ -1945,12 +1968,12 @@ var InvitationHostExtension = class extends RpcExtension2 {
1945
1968
  this._invitationFlowMutex = _invitationFlowMutex;
1946
1969
  this._callbacks = _callbacks;
1947
1970
  this._ctx = new Context5();
1948
- this._remoteOptionsTrigger = new Trigger4();
1971
+ this._remoteOptionsTrigger = new Trigger5();
1949
1972
  this._challenge = void 0;
1950
1973
  this.guestProfile = void 0;
1951
1974
  this.authenticationPassed = false;
1952
1975
  this.authenticationRetry = 0;
1953
- this.completedTrigger = new Trigger4();
1976
+ this.completedTrigger = new Trigger5();
1954
1977
  this._invitationFlowLock = null;
1955
1978
  }
1956
1979
  hasFlowLock() {
@@ -1977,7 +2000,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
1977
2000
  introduce: async (request) => {
1978
2001
  const { profile, invitationId } = request;
1979
2002
  const traceId = PublicKey5.random().toHex();
1980
- log7.trace("dxos.sdk.invitation-handler.host.introduce", trace4.begin({
2003
+ log8.trace("dxos.sdk.invitation-handler.host.introduce", trace4.begin({
1981
2004
  id: traceId
1982
2005
  }), {
1983
2006
  F: __dxlog_file10,
@@ -1988,7 +2011,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
1988
2011
  const invitation = this._requireActiveInvitation();
1989
2012
  this._assertInvitationState(Invitation3.State.CONNECTED);
1990
2013
  if (invitationId !== invitation?.invitationId) {
1991
- log7.warn("incorrect invitationId", {
2014
+ log8.warn("incorrect invitationId", {
1992
2015
  expected: invitation.invitationId,
1993
2016
  actual: invitationId
1994
2017
  }, {
@@ -2003,7 +2026,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
2003
2026
  authMethod: Invitation3.AuthMethod.NONE
2004
2027
  };
2005
2028
  }
2006
- log7("guest introduced themselves", {
2029
+ log8("guest introduced themselves", {
2007
2030
  guestProfile: profile
2008
2031
  }, {
2009
2032
  F: __dxlog_file10,
@@ -2014,7 +2037,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
2014
2037
  this.guestProfile = profile;
2015
2038
  this._callbacks.onStateUpdate(Invitation3.State.READY_FOR_AUTHENTICATION);
2016
2039
  this._challenge = invitation.authMethod === Invitation3.AuthMethod.KNOWN_PUBLIC_KEY ? randomBytes(32) : void 0;
2017
- log7.trace("dxos.sdk.invitation-handler.host.introduce", trace4.end({
2040
+ log8.trace("dxos.sdk.invitation-handler.host.introduce", trace4.end({
2018
2041
  id: traceId
2019
2042
  }), {
2020
2043
  F: __dxlog_file10,
@@ -2029,7 +2052,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
2029
2052
  },
2030
2053
  authenticate: async ({ authCode: code, signedChallenge }) => {
2031
2054
  const traceId = PublicKey5.random().toHex();
2032
- log7.trace("dxos.sdk.invitation-handler.host.authenticate", trace4.begin({
2055
+ log8.trace("dxos.sdk.invitation-handler.host.authenticate", trace4.begin({
2033
2056
  id: traceId
2034
2057
  }), {
2035
2058
  F: __dxlog_file10,
@@ -2038,7 +2061,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
2038
2061
  C: (f, a) => f(...a)
2039
2062
  });
2040
2063
  const invitation = this._requireActiveInvitation();
2041
- log7("received authentication request", {
2064
+ log8("received authentication request", {
2042
2065
  authCode: code
2043
2066
  }, {
2044
2067
  F: __dxlog_file10,
@@ -2054,7 +2077,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
2054
2077
  this._callbacks.onStateUpdate(Invitation3.State.AUTHENTICATING);
2055
2078
  switch (invitation.authMethod) {
2056
2079
  case Invitation3.AuthMethod.NONE: {
2057
- log7("authentication not required", void 0, {
2080
+ log8("authentication not required", void 0, {
2058
2081
  F: __dxlog_file10,
2059
2082
  L: 152,
2060
2083
  S: this,
@@ -2090,7 +2113,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
2090
2113
  break;
2091
2114
  }
2092
2115
  default: {
2093
- log7.error("invalid authentication method", {
2116
+ log8.error("invalid authentication method", {
2094
2117
  authMethod: invitation.authMethod
2095
2118
  }, {
2096
2119
  F: __dxlog_file10,
@@ -2112,7 +2135,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
2112
2135
  status
2113
2136
  };
2114
2137
  }
2115
- log7.trace("dxos.sdk.invitation-handler.host.authenticate", trace4.end({
2138
+ log8.trace("dxos.sdk.invitation-handler.host.authenticate", trace4.end({
2116
2139
  id: traceId,
2117
2140
  data: {
2118
2141
  status
@@ -2129,7 +2152,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
2129
2152
  },
2130
2153
  admit: async (request) => {
2131
2154
  const traceId = PublicKey5.random().toHex();
2132
- log7.trace("dxos.sdk.invitation-handler.host.admit", trace4.begin({
2155
+ log8.trace("dxos.sdk.invitation-handler.host.admit", trace4.begin({
2133
2156
  id: traceId
2134
2157
  }), {
2135
2158
  F: __dxlog_file10,
@@ -2146,7 +2169,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
2146
2169
  }
2147
2170
  }
2148
2171
  const response = await this._callbacks.admit(request);
2149
- log7.trace("dxos.sdk.invitation-handler.host.admit", trace4.end({
2172
+ log8.trace("dxos.sdk.invitation-handler.host.admit", trace4.end({
2150
2173
  id: traceId
2151
2174
  }), {
2152
2175
  F: __dxlog_file10,
@@ -2166,14 +2189,14 @@ var InvitationHostExtension = class extends RpcExtension2 {
2166
2189
  async onOpen(context) {
2167
2190
  await super.onOpen(context);
2168
2191
  try {
2169
- log7("host acquire lock", void 0, {
2192
+ log8("host acquire lock", void 0, {
2170
2193
  F: __dxlog_file10,
2171
2194
  L: 237,
2172
2195
  S: this,
2173
2196
  C: (f, a) => f(...a)
2174
2197
  });
2175
2198
  this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
2176
- log7("host lock acquired", void 0, {
2199
+ log8("host lock acquired", void 0, {
2177
2200
  F: __dxlog_file10,
2178
2201
  L: 239,
2179
2202
  S: this,
@@ -2184,7 +2207,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
2184
2207
  await this.rpc.InvitationHostService.options({
2185
2208
  role: Options2.Role.HOST
2186
2209
  });
2187
- log7("options sent", void 0, {
2210
+ log8("options sent", void 0, {
2188
2211
  F: __dxlog_file10,
2189
2212
  L: 243,
2190
2213
  S: this,
@@ -2193,7 +2216,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
2193
2216
  await cancelWithContext3(this._ctx, this._remoteOptionsTrigger.wait({
2194
2217
  timeout: OPTIONS_TIMEOUT2
2195
2218
  }));
2196
- log7("options received", void 0, {
2219
+ log8("options received", void 0, {
2197
2220
  F: __dxlog_file10,
2198
2221
  L: 245,
2199
2222
  S: this,
@@ -2247,7 +2270,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
2247
2270
  if (this._invitationFlowLock != null) {
2248
2271
  this._invitationFlowLock?.release();
2249
2272
  this._invitationFlowLock = null;
2250
- log7("invitation flow lock released", void 0, {
2273
+ log8("invitation flow lock released", void 0, {
2251
2274
  F: __dxlog_file10,
2252
2275
  L: 300,
2253
2276
  S: this,
@@ -2261,7 +2284,7 @@ var isAuthenticationRequired = (invitation) => invitation.authMethod !== Invitat
2261
2284
  // packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts
2262
2285
  import { invariant as invariant8 } from "@dxos/invariant";
2263
2286
  import { PublicKey as PublicKey6 } from "@dxos/keys";
2264
- import { log as log8 } from "@dxos/log";
2287
+ import { log as log9 } from "@dxos/log";
2265
2288
  import { Options as Options3 } from "@dxos/protocols/proto/dxos/halo/invitations";
2266
2289
  import { ComplexSet as ComplexSet2 } from "@dxos/util";
2267
2290
  var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
@@ -2303,7 +2326,7 @@ var InvitationTopology = class {
2303
2326
  const firstUnknownPeer = candidates.find((peerId) => !this._seenPeers.has(peerId));
2304
2327
  this._seenPeers = new ComplexSet2(PublicKey6.hash, allPeers.filter((peerId) => this._seenPeers.has(peerId)));
2305
2328
  if (firstUnknownPeer != null) {
2306
- log8("invitation connect", {
2329
+ log9("invitation connect", {
2307
2330
  ownPeerId,
2308
2331
  remotePeerId: firstUnknownPeer
2309
2332
  }, {
@@ -2388,7 +2411,7 @@ var InvitationsHandler = class {
2388
2411
  scheduleTask3(connectionCtx, async () => {
2389
2412
  const traceId = PublicKey7.random().toHex();
2390
2413
  try {
2391
- log9.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.begin({
2414
+ log10.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.begin({
2392
2415
  id: traceId
2393
2416
  }), {
2394
2417
  F: __dxlog_file12,
@@ -2396,7 +2419,7 @@ var InvitationsHandler = class {
2396
2419
  S: this,
2397
2420
  C: (f, a) => f(...a)
2398
2421
  });
2399
- log9("connected", {
2422
+ log10("connected", {
2400
2423
  ...protocol.toJSON()
2401
2424
  }, {
2402
2425
  F: __dxlog_file12,
@@ -2407,7 +2430,7 @@ var InvitationsHandler = class {
2407
2430
  const deviceKey = await extension.completedTrigger.wait({
2408
2431
  timeout: invitation.timeout
2409
2432
  });
2410
- log9("admitted guest", {
2433
+ log10("admitted guest", {
2411
2434
  guest: deviceKey,
2412
2435
  ...protocol.toJSON()
2413
2436
  }, {
@@ -2417,7 +2440,7 @@ var InvitationsHandler = class {
2417
2440
  C: (f, a) => f(...a)
2418
2441
  });
2419
2442
  guardedState.set(extension, Invitation4.State.SUCCESS);
2420
- log9.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.end({
2443
+ log10.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.end({
2421
2444
  id: traceId
2422
2445
  }), {
2423
2446
  F: __dxlog_file12,
@@ -2432,7 +2455,7 @@ var InvitationsHandler = class {
2432
2455
  } catch (err) {
2433
2456
  if (err instanceof TimeoutError) {
2434
2457
  if (guardedState.set(extension, Invitation4.State.TIMEOUT)) {
2435
- log9("timeout", {
2458
+ log10("timeout", {
2436
2459
  ...protocol.toJSON()
2437
2460
  }, {
2438
2461
  F: __dxlog_file12,
@@ -2443,7 +2466,7 @@ var InvitationsHandler = class {
2443
2466
  }
2444
2467
  } else {
2445
2468
  if (guardedState.error(extension, err)) {
2446
- log9.error("failed", err, {
2469
+ log10.error("failed", err, {
2447
2470
  F: __dxlog_file12,
2448
2471
  L: 133,
2449
2472
  S: this,
@@ -2451,7 +2474,7 @@ var InvitationsHandler = class {
2451
2474
  });
2452
2475
  }
2453
2476
  }
2454
- log9.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.error({
2477
+ log10.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.error({
2455
2478
  id: traceId,
2456
2479
  error: err
2457
2480
  }), {
@@ -2466,7 +2489,7 @@ var InvitationsHandler = class {
2466
2489
  },
2467
2490
  onError: (err) => {
2468
2491
  if (err instanceof InvalidInvitationExtensionRoleError3) {
2469
- log9("invalid role", {
2492
+ log10("invalid role", {
2470
2493
  ...err.context
2471
2494
  }, {
2472
2495
  F: __dxlog_file12,
@@ -2478,7 +2501,7 @@ var InvitationsHandler = class {
2478
2501
  }
2479
2502
  if (err instanceof TimeoutError) {
2480
2503
  if (guardedState.set(extension, Invitation4.State.TIMEOUT)) {
2481
- log9("timeout", {
2504
+ log10("timeout", {
2482
2505
  err
2483
2506
  }, {
2484
2507
  F: __dxlog_file12,
@@ -2489,7 +2512,7 @@ var InvitationsHandler = class {
2489
2512
  }
2490
2513
  } else {
2491
2514
  if (guardedState.error(extension, err)) {
2492
- log9.error("failed", err, {
2515
+ log10.error("failed", err, {
2493
2516
  F: __dxlog_file12,
2494
2517
  L: 153,
2495
2518
  S: this,
@@ -2503,7 +2526,7 @@ var InvitationsHandler = class {
2503
2526
  };
2504
2527
  if (invitation.lifetime && invitation.created) {
2505
2528
  if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
2506
- log9.warn("invitation has already expired", void 0, {
2529
+ log10.warn("invitation has already expired", void 0, {
2507
2530
  F: __dxlog_file12,
2508
2531
  L: 164,
2509
2532
  S: this,
@@ -2540,7 +2563,7 @@ var InvitationsHandler = class {
2540
2563
  const guardedState = this._createGuardedState(ctx, invitation, stream);
2541
2564
  const shouldCancelInvitationFlow = (extension) => {
2542
2565
  const isLockedByAnotherConnection = guardedState.mutex.isLocked() && !extension.hasFlowLock();
2543
- log9("should cancel invitation flow", {
2566
+ log10("should cancel invitation flow", {
2544
2567
  isLockedByAnotherConnection,
2545
2568
  invitationType: Invitation4.Type.DELEGATED,
2546
2569
  triedPeers: triedPeersIds.size
@@ -2568,7 +2591,7 @@ var InvitationsHandler = class {
2568
2591
  return;
2569
2592
  }
2570
2593
  connectionCtx.onDispose(async () => {
2571
- log9("extension disposed", {
2594
+ log10("extension disposed", {
2572
2595
  admitted,
2573
2596
  currentState: guardedState.current.state
2574
2597
  }, {
@@ -2587,7 +2610,7 @@ var InvitationsHandler = class {
2587
2610
  scheduleTask3(connectionCtx, async () => {
2588
2611
  const traceId = PublicKey7.random().toHex();
2589
2612
  try {
2590
- log9.trace("dxos.sdk.invitations-handler.guest.onOpen", trace5.begin({
2613
+ log10.trace("dxos.sdk.invitations-handler.guest.onOpen", trace5.begin({
2591
2614
  id: traceId
2592
2615
  }), {
2593
2616
  F: __dxlog_file12,
@@ -2599,7 +2622,7 @@ var InvitationsHandler = class {
2599
2622
  guardedState.set(extension, Invitation4.State.TIMEOUT);
2600
2623
  extensionCtx.close();
2601
2624
  }, timeout);
2602
- log9("connected", {
2625
+ log10("connected", {
2603
2626
  ...protocol.toJSON()
2604
2627
  }, {
2605
2628
  F: __dxlog_file12,
@@ -2608,7 +2631,7 @@ var InvitationsHandler = class {
2608
2631
  C: (f, a) => f(...a)
2609
2632
  });
2610
2633
  guardedState.set(extension, Invitation4.State.CONNECTED);
2611
- log9("introduce", {
2634
+ log10("introduce", {
2612
2635
  ...protocol.toJSON()
2613
2636
  }, {
2614
2637
  F: __dxlog_file12,
@@ -2620,7 +2643,7 @@ var InvitationsHandler = class {
2620
2643
  invitationId: invitation.invitationId,
2621
2644
  ...protocol.createIntroduction()
2622
2645
  });
2623
- log9("introduce response", {
2646
+ log10("introduce response", {
2624
2647
  ...protocol.toJSON(),
2625
2648
  response: introductionResponse
2626
2649
  }, {
@@ -2642,7 +2665,7 @@ var InvitationsHandler = class {
2642
2665
  break;
2643
2666
  }
2644
2667
  }
2645
- log9("request admission", {
2668
+ log10("request admission", {
2646
2669
  ...protocol.toJSON()
2647
2670
  }, {
2648
2671
  F: __dxlog_file12,
@@ -2654,7 +2677,7 @@ var InvitationsHandler = class {
2654
2677
  const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
2655
2678
  admitted = true;
2656
2679
  const result = await protocol.accept(admissionResponse, admissionRequest);
2657
- log9("admitted by host", {
2680
+ log10("admitted by host", {
2658
2681
  ...protocol.toJSON()
2659
2682
  }, {
2660
2683
  F: __dxlog_file12,
@@ -2667,7 +2690,7 @@ var InvitationsHandler = class {
2667
2690
  ...result,
2668
2691
  state: Invitation4.State.SUCCESS
2669
2692
  });
2670
- log9.trace("dxos.sdk.invitations-handler.guest.onOpen", trace5.end({
2693
+ log10.trace("dxos.sdk.invitations-handler.guest.onOpen", trace5.end({
2671
2694
  id: traceId
2672
2695
  }), {
2673
2696
  F: __dxlog_file12,
@@ -2677,7 +2700,7 @@ var InvitationsHandler = class {
2677
2700
  });
2678
2701
  } catch (err) {
2679
2702
  if (err instanceof TimeoutError) {
2680
- log9("timeout", {
2703
+ log10("timeout", {
2681
2704
  ...protocol.toJSON()
2682
2705
  }, {
2683
2706
  F: __dxlog_file12,
@@ -2687,7 +2710,7 @@ var InvitationsHandler = class {
2687
2710
  });
2688
2711
  guardedState.set(extension, Invitation4.State.TIMEOUT);
2689
2712
  } else {
2690
- log9("auth failed", err, {
2713
+ log10("auth failed", err, {
2691
2714
  F: __dxlog_file12,
2692
2715
  L: 314,
2693
2716
  S: this,
@@ -2696,7 +2719,7 @@ var InvitationsHandler = class {
2696
2719
  guardedState.error(extension, err);
2697
2720
  }
2698
2721
  extensionCtx.close(err);
2699
- log9.trace("dxos.sdk.invitations-handler.guest.onOpen", trace5.error({
2722
+ log10.trace("dxos.sdk.invitations-handler.guest.onOpen", trace5.error({
2700
2723
  id: traceId,
2701
2724
  error: err
2702
2725
  }), {
@@ -2713,7 +2736,7 @@ var InvitationsHandler = class {
2713
2736
  return;
2714
2737
  }
2715
2738
  if (err instanceof TimeoutError) {
2716
- log9("timeout", {
2739
+ log10("timeout", {
2717
2740
  ...protocol.toJSON()
2718
2741
  }, {
2719
2742
  F: __dxlog_file12,
@@ -2723,7 +2746,7 @@ var InvitationsHandler = class {
2723
2746
  });
2724
2747
  guardedState.set(extension, Invitation4.State.TIMEOUT);
2725
2748
  } else {
2726
- log9("auth failed", err, {
2749
+ log10("auth failed", err, {
2727
2750
  F: __dxlog_file12,
2728
2751
  L: 330,
2729
2752
  S: this,
@@ -2836,7 +2859,7 @@ var InvitationsHandler = class {
2836
2859
  };
2837
2860
  }
2838
2861
  _logStateUpdate(invitation, actor, newState) {
2839
- log9("invitation state update", {
2862
+ log10("invitation state update", {
2840
2863
  actor: actor?.constructor.name,
2841
2864
  newState: stateToString(newState),
2842
2865
  oldState: stateToString(invitation.state)
@@ -2858,7 +2881,7 @@ var InvitationsHandler = class {
2858
2881
  }
2859
2882
  async _handleGuestOtpAuth(extension, setState, authenticated, options) {
2860
2883
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
2861
- log9("guest waiting for authentication code...", void 0, {
2884
+ log10("guest waiting for authentication code...", void 0, {
2862
2885
  F: __dxlog_file12,
2863
2886
  L: 462,
2864
2887
  S: this,
@@ -2866,7 +2889,7 @@ var InvitationsHandler = class {
2866
2889
  });
2867
2890
  setState(Invitation4.State.READY_FOR_AUTHENTICATION);
2868
2891
  const authCode = await authenticated.wait(options);
2869
- log9("sending authentication request", void 0, {
2892
+ log10("sending authentication request", void 0, {
2870
2893
  F: __dxlog_file12,
2871
2894
  L: 466,
2872
2895
  S: this,
@@ -2883,7 +2906,7 @@ var InvitationsHandler = class {
2883
2906
  if (attempt === MAX_OTP_ATTEMPTS) {
2884
2907
  throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
2885
2908
  } else {
2886
- log9("retrying invalid code", {
2909
+ log10("retrying invalid code", {
2887
2910
  attempt
2888
2911
  }, {
2889
2912
  F: __dxlog_file12,
@@ -2903,7 +2926,7 @@ var InvitationsHandler = class {
2903
2926
  if (introductionResponse.challenge == null) {
2904
2927
  throw new Error("challenge missing in the introduction");
2905
2928
  }
2906
- log9("sending authentication request", void 0, {
2929
+ log10("sending authentication request", void 0, {
2907
2930
  F: __dxlog_file12,
2908
2931
  L: 496,
2909
2932
  S: this,
@@ -3028,7 +3051,7 @@ var InvitationsServiceImpl = class {
3028
3051
  import { createAdmissionCredentials, createCancelDelegatedSpaceInvitationCredential, createDelegatedSpaceInvitationCredential, getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
3029
3052
  import { writeMessages as writeMessages2 } from "@dxos/feed-store";
3030
3053
  import { invariant as invariant10 } from "@dxos/invariant";
3031
- import { log as log10 } from "@dxos/log";
3054
+ import { log as log11 } from "@dxos/log";
3032
3055
  import { AlreadyJoinedError as AlreadyJoinedError2, AuthorizationError, InvalidInvitationError, SpaceNotFoundError } from "@dxos/protocols";
3033
3056
  import { Invitation as Invitation5 } from "@dxos/protocols/proto/dxos/client/services";
3034
3057
  import { SpaceMember as SpaceMember2 } from "@dxos/protocols/proto/dxos/halo/credentials";
@@ -3098,7 +3121,7 @@ var SpaceInvitationProtocol = class {
3098
3121
  if (space.inner.spaceState.getMemberRole(identityKey) !== SpaceMember2.Role.REMOVED) {
3099
3122
  throw new AlreadyJoinedError2();
3100
3123
  }
3101
- log10("writing guest credentials", {
3124
+ log11("writing guest credentials", {
3102
3125
  host: this._signingContext.deviceKey,
3103
3126
  guest: deviceKey
3104
3127
  }, {
@@ -3166,7 +3189,7 @@ var SpaceInvitationProtocol = class {
3166
3189
  ]
3167
3190
  });
3168
3191
  }
3169
- log10("writing delegate space invitation", {
3192
+ log11("writing delegate space invitation", {
3170
3193
  host: this._signingContext.deviceKey,
3171
3194
  id: invitation.invitationId
3172
3195
  }, {
@@ -3227,7 +3250,7 @@ var SpaceInvitationProtocol = class {
3227
3250
  ""
3228
3251
  ]
3229
3252
  });
3230
- log10("cancelling delegated space invitation", {
3253
+ log11("cancelling delegated space invitation", {
3231
3254
  host: this._signingContext.deviceKey,
3232
3255
  id: invitation.invitationId
3233
3256
  }, {
@@ -3322,14 +3345,14 @@ var SpaceInvitationProtocol = class {
3322
3345
  };
3323
3346
 
3324
3347
  // packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts
3325
- import { Event as Event3, PushStream, TimeoutError as TimeoutError2, Trigger as Trigger5 } from "@dxos/async";
3348
+ import { Event as Event3, PushStream, TimeoutError as TimeoutError2, Trigger as Trigger6 } from "@dxos/async";
3326
3349
  import { AuthenticatingInvitation, AUTHENTICATION_CODE_LENGTH, CancellableInvitation, INVITATION_TIMEOUT as INVITATION_TIMEOUT2 } from "@dxos/client-protocol";
3327
3350
  import { Context as Context6 } from "@dxos/context";
3328
3351
  import { generatePasscode } from "@dxos/credentials";
3329
3352
  import { hasInvitationExpired } from "@dxos/echo-pipeline";
3330
3353
  import { invariant as invariant11 } from "@dxos/invariant";
3331
3354
  import { PublicKey as PublicKey8 } from "@dxos/keys";
3332
- import { log as log11 } from "@dxos/log";
3355
+ import { log as log12 } from "@dxos/log";
3333
3356
  import { Invitation as Invitation6 } from "@dxos/protocols/proto/dxos/client/services";
3334
3357
  import { SpaceMember as SpaceMember3 } from "@dxos/protocols/proto/dxos/halo/credentials";
3335
3358
  var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
@@ -3374,7 +3397,7 @@ var InvitationsManager = class {
3374
3397
  try {
3375
3398
  await this._persistIfRequired(handler, stream, invitation);
3376
3399
  } catch (err) {
3377
- log11.catch(err, void 0, {
3400
+ log12.catch(err, void 0, {
3378
3401
  F: __dxlog_file14,
3379
3402
  L: 82,
3380
3403
  S: this,
@@ -3416,7 +3439,7 @@ var InvitationsManager = class {
3416
3439
  invitations: cInvitations.map((invitation) => invitation.get())
3417
3440
  };
3418
3441
  } catch (err) {
3419
- log11.catch(err, void 0, {
3442
+ log12.catch(err, void 0, {
3420
3443
  F: __dxlog_file14,
3421
3444
  L: 110,
3422
3445
  S: this,
@@ -3448,7 +3471,7 @@ var InvitationsManager = class {
3448
3471
  return invitation;
3449
3472
  }
3450
3473
  async authenticate({ invitationId, authCode }) {
3451
- log11("authenticating...", void 0, {
3474
+ log12("authenticating...", void 0, {
3452
3475
  F: __dxlog_file14,
3453
3476
  L: 140,
3454
3477
  S: this,
@@ -3465,7 +3488,7 @@ var InvitationsManager = class {
3465
3488
  });
3466
3489
  const observable = this._acceptInvitations.get(invitationId);
3467
3490
  if (!observable) {
3468
- log11.warn("invalid invitation", {
3491
+ log12.warn("invalid invitation", {
3469
3492
  invitationId
3470
3493
  }, {
3471
3494
  F: __dxlog_file14,
@@ -3478,7 +3501,7 @@ var InvitationsManager = class {
3478
3501
  }
3479
3502
  }
3480
3503
  async cancelInvitation({ invitationId }) {
3481
- log11("cancelInvitation...", {
3504
+ log12("cancelInvitation...", {
3482
3505
  invitationId
3483
3506
  }, {
3484
3507
  F: __dxlog_file14,
@@ -3563,7 +3586,7 @@ var InvitationsManager = class {
3563
3586
  }
3564
3587
  });
3565
3588
  ctx.onDispose(() => {
3566
- log11("complete", {
3589
+ log12("complete", {
3567
3590
  ...handler.toJSON()
3568
3591
  }, {
3569
3592
  F: __dxlog_file14,
@@ -3591,12 +3614,12 @@ var InvitationsManager = class {
3591
3614
  };
3592
3615
  }
3593
3616
  _createObservableAcceptingInvitation(handler, initialState) {
3594
- const otpEnteredTrigger = new Trigger5();
3617
+ const otpEnteredTrigger = new Trigger6();
3595
3618
  const stream = new PushStream();
3596
3619
  const ctx = new Context6({
3597
3620
  onError: (err) => {
3598
3621
  if (err instanceof TimeoutError2) {
3599
- log11("timeout", {
3622
+ log12("timeout", {
3600
3623
  ...handler.toJSON()
3601
3624
  }, {
3602
3625
  F: __dxlog_file14,
@@ -3609,7 +3632,7 @@ var InvitationsManager = class {
3609
3632
  state: Invitation6.State.TIMEOUT
3610
3633
  });
3611
3634
  } else {
3612
- log11.warn("auth failed", err, {
3635
+ log12.warn("auth failed", err, {
3613
3636
  F: __dxlog_file14,
3614
3637
  L: 264,
3615
3638
  S: this,
@@ -3624,7 +3647,7 @@ var InvitationsManager = class {
3624
3647
  }
3625
3648
  });
3626
3649
  ctx.onDispose(() => {
3627
- log11("complete", {
3650
+ log12("complete", {
3628
3651
  ...handler.toJSON()
3629
3652
  }, {
3630
3653
  F: __dxlog_file14,
@@ -3671,7 +3694,7 @@ var InvitationsManager = class {
3671
3694
  try {
3672
3695
  await this._metadataStore.removeInvitation(invitation.invitationId);
3673
3696
  } catch (err) {
3674
- log11.catch(err, void 0, {
3697
+ log12.catch(err, void 0, {
3675
3698
  F: __dxlog_file14,
3676
3699
  L: 307,
3677
3700
  S: this,
@@ -3687,7 +3710,7 @@ var InvitationsManager = class {
3687
3710
  };
3688
3711
 
3689
3712
  // packages/sdk/client-services/src/packlets/spaces/data-space.ts
3690
- import { Event as Event6, Mutex as Mutex2, scheduleTask as scheduleTask5, sleep as sleep2, synchronized, trackLeaks } from "@dxos/async";
3713
+ import { Event as Event6, Mutex as Mutex2, scheduleTask as scheduleTask5, sleep as sleep3, synchronized, trackLeaks } from "@dxos/async";
3691
3714
  import { AUTH_TIMEOUT as AUTH_TIMEOUT2 } from "@dxos/client-protocol";
3692
3715
  import { Context as Context8, ContextDisposedError as ContextDisposedError3, cancelWithContext as cancelWithContext5 } from "@dxos/context";
3693
3716
  import { timed, warnAfterTimeout } from "@dxos/debug";
@@ -3695,7 +3718,7 @@ import { createMappedFeedWriter } from "@dxos/echo-pipeline";
3695
3718
  import { SpaceDocVersion } from "@dxos/echo-protocol";
3696
3719
  import { failedInvariant } from "@dxos/invariant";
3697
3720
  import { PublicKey as PublicKey10 } from "@dxos/keys";
3698
- import { log as log14 } from "@dxos/log";
3721
+ import { log as log15 } from "@dxos/log";
3699
3722
  import { CancelledError, SystemError } from "@dxos/protocols";
3700
3723
  import { SpaceState as SpaceState2 } from "@dxos/protocols/proto/dxos/client/services";
3701
3724
  import { AdmittedFeed as AdmittedFeed3, SpaceMember as SpaceMember4 } from "@dxos/protocols/proto/dxos/halo/credentials";
@@ -3756,7 +3779,7 @@ import { convertLegacyReferences, convertLegacySpaceRootDoc, findInlineObjectOfT
3756
3779
  import { AutomergeDocumentLoaderImpl } from "@dxos/echo-pipeline";
3757
3780
  import { TYPE_PROPERTIES } from "@dxos/echo-schema";
3758
3781
  import { invariant as invariant12 } from "@dxos/invariant";
3759
- import { log as log12 } from "@dxos/log";
3782
+ import { log as log13 } from "@dxos/log";
3760
3783
  import { CreateEpochRequest } from "@dxos/protocols/proto/dxos/client/services";
3761
3784
  import { assignDeep } from "@dxos/util";
3762
3785
  var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
@@ -3782,7 +3805,7 @@ var runEpochMigration = async (ctx, context) => {
3782
3805
  };
3783
3806
  }
3784
3807
  case CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
3785
- log12.info("Fragmenting", void 0, {
3808
+ log13.info("Fragmenting", void 0, {
3786
3809
  F: __dxlog_file15,
3787
3810
  L: 63,
3788
3811
  S: void 0,
@@ -3895,11 +3918,11 @@ var runEpochMigration = async (ctx, context) => {
3895
3918
  };
3896
3919
 
3897
3920
  // packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
3898
- import { DeferredTask, Event as Event5, scheduleTask as scheduleTask4, sleep, TimeoutError as TimeoutError3, Trigger as Trigger6 } from "@dxos/async";
3921
+ import { DeferredTask, Event as Event5, scheduleTask as scheduleTask4, sleep as sleep2, TimeoutError as TimeoutError3, Trigger as Trigger7 } from "@dxos/async";
3899
3922
  import { Context as Context7, rejectOnDispose } from "@dxos/context";
3900
3923
  import { invariant as invariant13 } from "@dxos/invariant";
3901
3924
  import { PublicKey as PublicKey9 } from "@dxos/keys";
3902
- import { log as log13 } from "@dxos/log";
3925
+ import { log as log14 } from "@dxos/log";
3903
3926
  import { schema as schema4 } from "@dxos/protocols";
3904
3927
  import { RpcExtension as RpcExtension3 } from "@dxos/teleport";
3905
3928
  import { ComplexMap as ComplexMap2, ComplexSet as ComplexSet4, entry } from "@dxos/util";
@@ -3928,7 +3951,7 @@ var NotarizationPlugin = class {
3928
3951
  * Request credentials to be notarized.
3929
3952
  */
3930
3953
  async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY }) {
3931
- log13("notarize", {
3954
+ log14("notarize", {
3932
3955
  credentials
3933
3956
  }, {
3934
3957
  F: __dxlog_file16,
@@ -3945,10 +3968,10 @@ var NotarizationPlugin = class {
3945
3968
  "'Credentials must have an id'"
3946
3969
  ]
3947
3970
  });
3948
- const errors = new Trigger6();
3971
+ const errors = new Trigger7();
3949
3972
  const ctx = this._ctx.derive({
3950
3973
  onError: (err) => {
3951
- log13.warn("Notarization error", {
3974
+ log14.warn("Notarization error", {
3952
3975
  err
3953
3976
  }, {
3954
3977
  F: __dxlog_file16,
@@ -3963,7 +3986,7 @@ var NotarizationPlugin = class {
3963
3986
  opCtx?.onDispose(() => ctx.dispose());
3964
3987
  if (timeout !== 0) {
3965
3988
  scheduleTask4(ctx, () => {
3966
- log13.warn("Notarization timeout", {
3989
+ log14.warn("Notarization timeout", {
3967
3990
  timeout,
3968
3991
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
3969
3992
  }, {
@@ -3987,7 +4010,7 @@ var NotarizationPlugin = class {
3987
4010
  ...this._extensions
3988
4011
  ].find((peer2) => !peersTried.has(peer2));
3989
4012
  if (!peer) {
3990
- log13.info("Exhausted all peers to notarize with", {
4013
+ log14.info("Exhausted all peers to notarize with", {
3991
4014
  retryIn: retryTimeout
3992
4015
  }, {
3993
4016
  F: __dxlog_file16,
@@ -4000,7 +4023,7 @@ var NotarizationPlugin = class {
4000
4023
  return;
4001
4024
  }
4002
4025
  peersTried.add(peer);
4003
- log13("try notarizing", {
4026
+ log14("try notarizing", {
4004
4027
  peer: peer.localPeerId,
4005
4028
  credentialId: credentials.map((credential) => credential.id)
4006
4029
  }, {
@@ -4012,16 +4035,16 @@ var NotarizationPlugin = class {
4012
4035
  await peer.rpc.NotarizationService.notarize({
4013
4036
  credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
4014
4037
  });
4015
- log13("success", void 0, {
4038
+ log14("success", void 0, {
4016
4039
  F: __dxlog_file16,
4017
4040
  L: 147,
4018
4041
  S: this,
4019
4042
  C: (f, a) => f(...a)
4020
4043
  });
4021
- await sleep(successDelay);
4044
+ await sleep2(successDelay);
4022
4045
  } catch (err) {
4023
4046
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
4024
- log13.info("error notarizing (recoverable)", err, {
4047
+ log14.info("error notarizing (recoverable)", err, {
4025
4048
  F: __dxlog_file16,
4026
4049
  L: 151,
4027
4050
  S: this,
@@ -4039,7 +4062,7 @@ var NotarizationPlugin = class {
4039
4062
  allNotarized,
4040
4063
  errors.wait()
4041
4064
  ]);
4042
- log13("done", void 0, {
4065
+ log14("done", void 0, {
4043
4066
  F: __dxlog_file16,
4044
4067
  L: 162,
4045
4068
  S: this,
@@ -4076,7 +4099,7 @@ var NotarizationPlugin = class {
4076
4099
  if (this._processedCredentials.has(id)) {
4077
4100
  return;
4078
4101
  }
4079
- await entry(this._processCredentialsTriggers, id).orInsert(new Trigger6()).value.wait();
4102
+ await entry(this._processCredentialsTriggers, id).orInsert(new Trigger7()).value.wait();
4080
4103
  }
4081
4104
  /**
4082
4105
  * Requests from other peers to notarize credentials.
@@ -4104,7 +4127,7 @@ var NotarizationPlugin = class {
4104
4127
  createExtension() {
4105
4128
  const extension = new NotarizationTeleportExtension({
4106
4129
  onOpen: async () => {
4107
- log13("extension opened", {
4130
+ log14("extension opened", {
4108
4131
  peer: extension.localPeerId
4109
4132
  }, {
4110
4133
  F: __dxlog_file16,
@@ -4116,7 +4139,7 @@ var NotarizationPlugin = class {
4116
4139
  this._extensionOpened.emit();
4117
4140
  },
4118
4141
  onClose: async () => {
4119
- log13("extension closed", {
4142
+ log14("extension closed", {
4120
4143
  peer: extension.localPeerId
4121
4144
  }, {
4122
4145
  F: __dxlog_file16,
@@ -4270,7 +4293,7 @@ var DataSpace = class {
4270
4293
  });
4271
4294
  this._cache = params.cache;
4272
4295
  this._state = params.initialState;
4273
- log14("new state", {
4296
+ log15("new state", {
4274
4297
  state: SpaceState2[this._state]
4275
4298
  }, {
4276
4299
  F: __dxlog_file17,
@@ -4330,7 +4353,7 @@ var DataSpace = class {
4330
4353
  await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
4331
4354
  await this._inner.open(new Context8());
4332
4355
  this._state = SpaceState2.CONTROL_ONLY;
4333
- log14("new state", {
4356
+ log15("new state", {
4334
4357
  state: SpaceState2[this._state]
4335
4358
  }, {
4336
4359
  F: __dxlog_file17,
@@ -4348,7 +4371,7 @@ var DataSpace = class {
4348
4371
  async _close() {
4349
4372
  await this._callbacks.beforeClose?.();
4350
4373
  this._state = SpaceState2.CLOSED;
4351
- log14("new state", {
4374
+ log15("new state", {
4352
4375
  state: SpaceState2[this._state]
4353
4376
  }, {
4354
4377
  F: __dxlog_file17,
@@ -4383,7 +4406,7 @@ var DataSpace = class {
4383
4406
  await this.initializeDataPipeline();
4384
4407
  } catch (err) {
4385
4408
  if (err instanceof CancelledError || err instanceof ContextDisposedError3) {
4386
- log14("data pipeline initialization cancelled", err, {
4409
+ log15("data pipeline initialization cancelled", err, {
4387
4410
  F: __dxlog_file17,
4388
4411
  L: 265,
4389
4412
  S: this,
@@ -4391,14 +4414,14 @@ var DataSpace = class {
4391
4414
  });
4392
4415
  return;
4393
4416
  }
4394
- log14.error("Error initializing data pipeline", err, {
4417
+ log15.error("Error initializing data pipeline", err, {
4395
4418
  F: __dxlog_file17,
4396
4419
  L: 269,
4397
4420
  S: this,
4398
4421
  C: (f, a) => f(...a)
4399
4422
  });
4400
4423
  this._state = SpaceState2.ERROR;
4401
- log14("new state", {
4424
+ log15("new state", {
4402
4425
  state: SpaceState2[this._state]
4403
4426
  }, {
4404
4427
  F: __dxlog_file17,
@@ -4418,7 +4441,7 @@ var DataSpace = class {
4418
4441
  throw new SystemError("Invalid operation");
4419
4442
  }
4420
4443
  this._state = SpaceState2.INITIALIZING;
4421
- log14("new state", {
4444
+ log15("new state", {
4422
4445
  state: SpaceState2[this._state]
4423
4446
  }, {
4424
4447
  F: __dxlog_file17,
@@ -4427,7 +4450,7 @@ var DataSpace = class {
4427
4450
  C: (f, a) => f(...a)
4428
4451
  });
4429
4452
  await this._initializeAndReadControlPipeline();
4430
- await sleep2(1);
4453
+ await sleep3(1);
4431
4454
  const ready = this.stateUpdate.waitForCondition(() => this._state === SpaceState2.READY);
4432
4455
  this._automergeSpaceState.startProcessingRootDocs();
4433
4456
  await ready;
@@ -4435,7 +4458,7 @@ var DataSpace = class {
4435
4458
  async _enterReadyState() {
4436
4459
  await this._callbacks.beforeReady?.();
4437
4460
  this._state = SpaceState2.READY;
4438
- log14("new state", {
4461
+ log15("new state", {
4439
4462
  state: SpaceState2[this._state]
4440
4463
  }, {
4441
4464
  F: __dxlog_file17,
@@ -4453,7 +4476,7 @@ var DataSpace = class {
4453
4476
  });
4454
4477
  this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
4455
4478
  await this._createWritableFeeds();
4456
- log14("writable feeds created", void 0, {
4479
+ log15("writable feeds created", void 0, {
4457
4480
  F: __dxlog_file17,
4458
4481
  L: 322,
4459
4482
  S: this,
@@ -4513,7 +4536,7 @@ var DataSpace = class {
4513
4536
  }
4514
4537
  }
4515
4538
  _onNewAutomergeRoot(rootUrl) {
4516
- log14("loading automerge root doc for space", {
4539
+ log15("loading automerge root doc for space", {
4517
4540
  space: this.key,
4518
4541
  rootUrl
4519
4542
  }, {
@@ -4522,7 +4545,6 @@ var DataSpace = class {
4522
4545
  S: this,
4523
4546
  C: (f, a) => f(...a)
4524
4547
  });
4525
- this._echoHost.replicateDocument(rootUrl);
4526
4548
  const handle = this._echoHost.automergeRepo.find(rootUrl);
4527
4549
  queueMicrotask(async () => {
4528
4550
  try {
@@ -4549,8 +4571,10 @@ var DataSpace = class {
4549
4571
  const root = await this._echoHost.openSpaceRoot(handle.url);
4550
4572
  this._databaseRoot = root;
4551
4573
  if (root.getVersion() !== SpaceDocVersion.CURRENT) {
4552
- this._state = SpaceState2.REQUIRES_MIGRATION;
4553
- this.stateUpdate.emit();
4574
+ if (this._state !== SpaceState2.REQUIRES_MIGRATION) {
4575
+ this._state = SpaceState2.REQUIRES_MIGRATION;
4576
+ this.stateUpdate.emit();
4577
+ }
4554
4578
  } else {
4555
4579
  if (this._state !== SpaceState2.READY) {
4556
4580
  await this._enterReadyState();
@@ -4565,7 +4589,7 @@ var DataSpace = class {
4565
4589
  if (err instanceof ContextDisposedError3) {
4566
4590
  return;
4567
4591
  }
4568
- log14.warn("error loading automerge root doc", {
4592
+ log15.warn("error loading automerge root doc", {
4569
4593
  space: this.key,
4570
4594
  rootUrl,
4571
4595
  err
@@ -4653,7 +4677,7 @@ var DataSpace = class {
4653
4677
  await this._close();
4654
4678
  }
4655
4679
  this._state = SpaceState2.INACTIVE;
4656
- log14("new state", {
4680
+ log15("new state", {
4657
4681
  state: SpaceState2[this._state]
4658
4682
  }, {
4659
4683
  F: __dxlog_file17,
@@ -4724,7 +4748,7 @@ import { LEGACY_TYPE_PROPERTIES, SpaceDocVersion as SpaceDocVersion2, encodeRefe
4724
4748
  import { TYPE_PROPERTIES as TYPE_PROPERTIES2, generateEchoId, getTypeReference } from "@dxos/echo-schema";
4725
4749
  import { invariant as invariant14 } from "@dxos/invariant";
4726
4750
  import { PublicKey as PublicKey11 } from "@dxos/keys";
4727
- import { log as log15 } from "@dxos/log";
4751
+ import { log as log16 } from "@dxos/log";
4728
4752
  import { trace as Trace2 } from "@dxos/protocols";
4729
4753
  import { Invitation as Invitation7, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
4730
4754
  import { SpaceMember as SpaceMember6 } from "@dxos/protocols/proto/dxos/halo/credentials";
@@ -4860,13 +4884,13 @@ var DataSpaceManager = class {
4860
4884
  return this._spaces;
4861
4885
  }
4862
4886
  async open() {
4863
- log15("open", void 0, {
4887
+ log16("open", void 0, {
4864
4888
  F: __dxlog_file18,
4865
4889
  L: 146,
4866
4890
  S: this,
4867
4891
  C: (f, a) => f(...a)
4868
4892
  });
4869
- log15.trace("dxos.echo.data-space-manager.open", Trace2.begin({
4893
+ log16.trace("dxos.echo.data-space-manager.open", Trace2.begin({
4870
4894
  id: this._instanceId
4871
4895
  }), {
4872
4896
  F: __dxlog_file18,
@@ -4874,7 +4898,7 @@ var DataSpaceManager = class {
4874
4898
  S: this,
4875
4899
  C: (f, a) => f(...a)
4876
4900
  });
4877
- log15("metadata loaded", {
4901
+ log16("metadata loaded", {
4878
4902
  spaces: this._metadataStore.spaces.length
4879
4903
  }, {
4880
4904
  F: __dxlog_file18,
@@ -4884,7 +4908,7 @@ var DataSpaceManager = class {
4884
4908
  });
4885
4909
  await forEachAsync(this._metadataStore.spaces, async (spaceMetadata) => {
4886
4910
  try {
4887
- log15("load space", {
4911
+ log16("load space", {
4888
4912
  spaceMetadata
4889
4913
  }, {
4890
4914
  F: __dxlog_file18,
@@ -4894,7 +4918,7 @@ var DataSpaceManager = class {
4894
4918
  });
4895
4919
  await this._constructSpace(spaceMetadata);
4896
4920
  } catch (err) {
4897
- log15.error("Error loading space", {
4921
+ log16.error("Error loading space", {
4898
4922
  spaceMetadata,
4899
4923
  err
4900
4924
  }, {
@@ -4907,7 +4931,7 @@ var DataSpaceManager = class {
4907
4931
  });
4908
4932
  this._isOpen = true;
4909
4933
  this.updated.emit();
4910
- log15.trace("dxos.echo.data-space-manager.open", Trace2.end({
4934
+ log16.trace("dxos.echo.data-space-manager.open", Trace2.end({
4911
4935
  id: this._instanceId
4912
4936
  }), {
4913
4937
  F: __dxlog_file18,
@@ -4917,7 +4941,7 @@ var DataSpaceManager = class {
4917
4941
  });
4918
4942
  }
4919
4943
  async close() {
4920
- log15("close", void 0, {
4944
+ log16("close", void 0, {
4921
4945
  F: __dxlog_file18,
4922
4946
  L: 167,
4923
4947
  S: this,
@@ -4953,7 +4977,7 @@ var DataSpaceManager = class {
4953
4977
  dataFeedKey,
4954
4978
  state: SpaceState3.ACTIVE
4955
4979
  };
4956
- log15("creating space...", {
4980
+ log16("creating space...", {
4957
4981
  spaceKey
4958
4982
  }, {
4959
4983
  F: __dxlog_file18,
@@ -4996,7 +5020,7 @@ var DataSpaceManager = class {
4996
5020
  return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
4997
5021
  }
4998
5022
  default:
4999
- log15.warn("unknown space version", {
5023
+ log16.warn("unknown space version", {
5000
5024
  version: space.databaseRoot.getVersion(),
5001
5025
  spaceId: space.id
5002
5026
  }, {
@@ -5049,7 +5073,7 @@ var DataSpaceManager = class {
5049
5073
  }
5050
5074
  // TODO(burdon): Rename join space.
5051
5075
  async acceptSpace(opts) {
5052
- log15("accept space", {
5076
+ log16("accept space", {
5053
5077
  opts
5054
5078
  }, {
5055
5079
  F: __dxlog_file18,
@@ -5100,7 +5124,7 @@ var DataSpaceManager = class {
5100
5124
  }));
5101
5125
  }
5102
5126
  async _constructSpace(metadata) {
5103
- log15("construct space", {
5127
+ log16("construct space", {
5104
5128
  metadata
5105
5129
  }, {
5106
5130
  F: __dxlog_file18,
@@ -5140,7 +5164,7 @@ var DataSpaceManager = class {
5140
5164
  session.addExtension("dxos.mesh.teleport.automerge", this._echoHost.createReplicationExtension());
5141
5165
  },
5142
5166
  onAuthFailure: () => {
5143
- log15.warn("auth failure", void 0, {
5167
+ log16.warn("auth failure", void 0, {
5144
5168
  F: __dxlog_file18,
5145
5169
  L: 343,
5146
5170
  S: this,
@@ -5171,7 +5195,7 @@ var DataSpaceManager = class {
5171
5195
  signingContext: this._signingContext,
5172
5196
  callbacks: {
5173
5197
  beforeReady: async () => {
5174
- log15("before space ready", {
5198
+ log16("before space ready", {
5175
5199
  space: space.key
5176
5200
  }, {
5177
5201
  F: __dxlog_file18,
@@ -5181,7 +5205,7 @@ var DataSpaceManager = class {
5181
5205
  });
5182
5206
  },
5183
5207
  afterReady: async () => {
5184
- log15("after space ready", {
5208
+ log16("after space ready", {
5185
5209
  space: space.key,
5186
5210
  open: this._isOpen
5187
5211
  }, {
@@ -5201,7 +5225,7 @@ var DataSpaceManager = class {
5201
5225
  }
5202
5226
  },
5203
5227
  beforeClose: async () => {
5204
- log15("before space close", {
5228
+ log16("before space close", {
5205
5229
  space: space.key
5206
5230
  }, {
5207
5231
  F: __dxlog_file18,
@@ -5236,11 +5260,11 @@ var DataSpaceManager = class {
5236
5260
  return (s && member.role === SpaceMember6.Role.REMOVED !== (s.authStatus === AuthStatus.FAILURE)) ?? false;
5237
5261
  });
5238
5262
  sessionsToClose.forEach((session) => {
5239
- void session.close().catch(log15.error);
5263
+ void session.close().catch(log16.error);
5240
5264
  });
5241
5265
  closedSessions += sessionsToClose.length;
5242
5266
  }
5243
- log15("processed member role changes", {
5267
+ log16("processed member role changes", {
5244
5268
  roleChangeCount: memberInfo.length,
5245
5269
  peersOnline: presence.getPeersOnline().length,
5246
5270
  closedSessions
@@ -5257,7 +5281,7 @@ var DataSpaceManager = class {
5257
5281
  if (role === SpaceMember6.Role.REMOVED) {
5258
5282
  const session = peerState.peerId && space.protocol.sessions.get(peerState.peerId);
5259
5283
  if (session != null) {
5260
- log15("closing a session with a removed peer", {
5284
+ log16("closing a session with a removed peer", {
5261
5285
  peerId: peerState.peerId
5262
5286
  }, {
5263
5287
  F: __dxlog_file18,
@@ -5265,7 +5289,7 @@ var DataSpaceManager = class {
5265
5289
  S: this,
5266
5290
  C: (f, a) => f(...a)
5267
5291
  });
5268
- void session.close().catch(log15.error);
5292
+ void session.close().catch(log16.error);
5269
5293
  }
5270
5294
  }
5271
5295
  }
@@ -5328,7 +5352,7 @@ import { createAdmissionCredentials as createAdmissionCredentials2, getCredentia
5328
5352
  import { raise as raise2 } from "@dxos/debug";
5329
5353
  import { writeMessages as writeMessages3 } from "@dxos/feed-store";
5330
5354
  import { invariant as invariant15 } from "@dxos/invariant";
5331
- import { log as log16 } from "@dxos/log";
5355
+ import { log as log17 } from "@dxos/log";
5332
5356
  import { ApiError, SpaceNotFoundError as SpaceNotFoundError2, encodeError, IdentityNotInitializedError, AuthorizationError as AuthorizationError2 } from "@dxos/protocols";
5333
5357
  import { SpaceMember as SpaceMember7, SpaceState as SpaceState4 } from "@dxos/protocols/proto/dxos/client/services";
5334
5358
  import { trace as trace8 } from "@dxos/tracing";
@@ -5401,7 +5425,7 @@ var SpacesServiceImpl = class {
5401
5425
  const scheduler = new UpdateScheduler(ctx, async () => {
5402
5426
  const dataSpaceManager = await this._getDataSpaceManager();
5403
5427
  const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
5404
- log16("update", {
5428
+ log17("update", {
5405
5429
  spaces
5406
5430
  }, {
5407
5431
  F: __dxlog_file19,
@@ -5423,7 +5447,15 @@ var SpacesServiceImpl = class {
5423
5447
  const subscribeSpaces = () => {
5424
5448
  subscriptions.clear();
5425
5449
  for (const space of dataSpaceManager.spaces.values()) {
5426
- subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.forceTrigger()));
5450
+ let lastState;
5451
+ subscriptions.add(space.stateUpdate.on(ctx, () => {
5452
+ if (space.state !== lastState) {
5453
+ scheduler.forceTrigger();
5454
+ } else {
5455
+ scheduler.trigger();
5456
+ }
5457
+ lastState = space.state;
5458
+ }));
5427
5459
  subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
5428
5460
  subscriptions.add(space.automergeSpaceState.onNewEpoch.on(ctx, () => scheduler.trigger()));
5429
5461
  subscriptions.add(space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger()));
@@ -5489,7 +5521,7 @@ var SpacesServiceImpl = class {
5489
5521
  } else {
5490
5522
  invariant15(!credential.id, "Id on unsigned credentials is not allowed", {
5491
5523
  F: __dxlog_file19,
5492
- L: 199,
5524
+ L: 209,
5493
5525
  S: this,
5494
5526
  A: [
5495
5527
  "!credential.id",
@@ -5498,7 +5530,7 @@ var SpacesServiceImpl = class {
5498
5530
  });
5499
5531
  invariant15(this._identityManager.identity, "Identity is not available", {
5500
5532
  F: __dxlog_file19,
5501
- L: 200,
5533
+ L: 210,
5502
5534
  S: this,
5503
5535
  A: [
5504
5536
  "this._identityManager.identity",
@@ -5508,7 +5540,7 @@ var SpacesServiceImpl = class {
5508
5540
  const signer = this._identityManager.identity.getIdentityCredentialSigner();
5509
5541
  invariant15(credential.issuer.equals(signer.getIssuer()), void 0, {
5510
5542
  F: __dxlog_file19,
5511
- L: 202,
5543
+ L: 212,
5512
5544
  S: this,
5513
5545
  A: [
5514
5546
  "credential.issuer.equals(signer.getIssuer())",
@@ -5599,7 +5631,7 @@ var SpacesServiceImpl = class {
5599
5631
  var getChannelId = (channel) => `user-channel/${channel}`;
5600
5632
 
5601
5633
  // packages/sdk/client-services/src/packlets/services/service-context.ts
5602
- import { Trigger as Trigger7 } from "@dxos/async";
5634
+ import { Trigger as Trigger8 } from "@dxos/async";
5603
5635
  import { Context as Context10, Resource as Resource3 } from "@dxos/context";
5604
5636
  import { getCredentialAssertion as getCredentialAssertion5 } from "@dxos/credentials";
5605
5637
  import { failUndefined as failUndefined2 } from "@dxos/debug";
@@ -5609,7 +5641,7 @@ import { FeedFactory, FeedStore } from "@dxos/feed-store";
5609
5641
  import { invariant as invariant16 } from "@dxos/invariant";
5610
5642
  import { Keyring } from "@dxos/keyring";
5611
5643
  import { PublicKey as PublicKey12 } from "@dxos/keys";
5612
- import { log as log17 } from "@dxos/log";
5644
+ import { log as log18 } from "@dxos/log";
5613
5645
  import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace9 } from "@dxos/protocols";
5614
5646
  import { Invitation as Invitation8 } from "@dxos/protocols/proto/dxos/client/services";
5615
5647
  import { BlobStore } from "@dxos/teleport-extension-object-sync";
@@ -5634,7 +5666,7 @@ var ServiceContext = class extends Resource3 {
5634
5666
  this.networkManager = networkManager;
5635
5667
  this.signalManager = signalManager;
5636
5668
  this._runtimeParams = _runtimeParams;
5637
- this.initialized = new Trigger7();
5669
+ this.initialized = new Trigger8();
5638
5670
  this._handlerFactories = /* @__PURE__ */ new Map();
5639
5671
  this._instanceId = PublicKey12.random().toHex();
5640
5672
  this.metadataStore = new MetadataStore(storage.createDirectory("metadata"));
@@ -5668,13 +5700,13 @@ var ServiceContext = class extends Resource3 {
5668
5700
  }
5669
5701
  async _open(ctx) {
5670
5702
  await this._checkStorageVersion();
5671
- log17("opening...", void 0, {
5703
+ log18("opening...", void 0, {
5672
5704
  F: __dxlog_file20,
5673
5705
  L: 149,
5674
5706
  S: this,
5675
5707
  C: (f, a) => f(...a)
5676
5708
  });
5677
- log17.trace("dxos.sdk.service-context.open", trace9.begin({
5709
+ log18.trace("dxos.sdk.service-context.open", trace9.begin({
5678
5710
  id: this._instanceId
5679
5711
  }), {
5680
5712
  F: __dxlog_file20,
@@ -5692,7 +5724,7 @@ var ServiceContext = class extends Resource3 {
5692
5724
  await this._initialize(ctx);
5693
5725
  }
5694
5726
  const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
5695
- log17("loaded persistent invitations", {
5727
+ log18("loaded persistent invitations", {
5696
5728
  count: loadedInvitations.invitations?.length
5697
5729
  }, {
5698
5730
  F: __dxlog_file20,
@@ -5700,7 +5732,7 @@ var ServiceContext = class extends Resource3 {
5700
5732
  S: this,
5701
5733
  C: (f, a) => f(...a)
5702
5734
  });
5703
- log17.trace("dxos.sdk.service-context.open", trace9.end({
5735
+ log18.trace("dxos.sdk.service-context.open", trace9.end({
5704
5736
  id: this._instanceId
5705
5737
  }), {
5706
5738
  F: __dxlog_file20,
@@ -5708,7 +5740,7 @@ var ServiceContext = class extends Resource3 {
5708
5740
  S: this,
5709
5741
  C: (f, a) => f(...a)
5710
5742
  });
5711
- log17("opened", void 0, {
5743
+ log18("opened", void 0, {
5712
5744
  F: __dxlog_file20,
5713
5745
  L: 166,
5714
5746
  S: this,
@@ -5716,7 +5748,7 @@ var ServiceContext = class extends Resource3 {
5716
5748
  });
5717
5749
  }
5718
5750
  async _close(ctx) {
5719
- log17("closing...", void 0, {
5751
+ log18("closing...", void 0, {
5720
5752
  F: __dxlog_file20,
5721
5753
  L: 170,
5722
5754
  S: this,
@@ -5733,7 +5765,7 @@ var ServiceContext = class extends Resource3 {
5733
5765
  await this.echoHost.close(ctx);
5734
5766
  await this.networkManager.close();
5735
5767
  await this.signalManager.close();
5736
- log17("closed", void 0, {
5768
+ log18("closed", void 0, {
5737
5769
  F: __dxlog_file20,
5738
5770
  L: 182,
5739
5771
  S: this,
@@ -5779,7 +5811,7 @@ var ServiceContext = class extends Resource3 {
5779
5811
  }
5780
5812
  // Called when identity is created.
5781
5813
  async _initialize(ctx) {
5782
- log17("initializing spaces...", void 0, {
5814
+ log18("initializing spaces...", void 0, {
5783
5815
  F: __dxlog_file20,
5784
5816
  L: 224,
5785
5817
  S: this,
@@ -5824,7 +5856,7 @@ var ServiceContext = class extends Resource3 {
5824
5856
  return;
5825
5857
  }
5826
5858
  if (!this.dataSpaceManager) {
5827
- log17("dataSpaceManager not initialized yet, ignoring space admission", {
5859
+ log18("dataSpaceManager not initialized yet, ignoring space admission", {
5828
5860
  details: assertion
5829
5861
  }, {
5830
5862
  F: __dxlog_file20,
@@ -5835,7 +5867,7 @@ var ServiceContext = class extends Resource3 {
5835
5867
  return;
5836
5868
  }
5837
5869
  if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
5838
- log17("space already exists, ignoring space admission", {
5870
+ log18("space already exists, ignoring space admission", {
5839
5871
  details: assertion
5840
5872
  }, {
5841
5873
  F: __dxlog_file20,
@@ -5846,7 +5878,7 @@ var ServiceContext = class extends Resource3 {
5846
5878
  return;
5847
5879
  }
5848
5880
  try {
5849
- log17("accepting space recorded in halo", {
5881
+ log18("accepting space recorded in halo", {
5850
5882
  details: assertion
5851
5883
  }, {
5852
5884
  F: __dxlog_file20,
@@ -5859,7 +5891,7 @@ var ServiceContext = class extends Resource3 {
5859
5891
  genesisFeedKey: assertion.genesisFeedKey
5860
5892
  });
5861
5893
  } catch (err) {
5862
- log17.catch(err, void 0, {
5894
+ log18.catch(err, void 0, {
5863
5895
  F: __dxlog_file20,
5864
5896
  L: 280,
5865
5897
  S: this,
@@ -5907,9 +5939,9 @@ var ServiceRegistry = class {
5907
5939
  };
5908
5940
 
5909
5941
  // packages/sdk/client-services/src/packlets/locks/browser.ts
5910
- import { asyncTimeout as asyncTimeout3, Trigger as Trigger8 } from "@dxos/async";
5942
+ import { asyncTimeout as asyncTimeout3, Trigger as Trigger9 } from "@dxos/async";
5911
5943
  import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
5912
- import { log as log18, logInfo } from "@dxos/log";
5944
+ import { log as log19, logInfo } from "@dxos/log";
5913
5945
  function _ts_decorate7(decorators, target, key, desc) {
5914
5946
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
5915
5947
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -5928,7 +5960,7 @@ var Message;
5928
5960
  var Lock = class {
5929
5961
  constructor({ lockKey, onAcquire, onRelease }) {
5930
5962
  this._broadcastChannel = new BroadcastChannel("vault-resource-lock");
5931
- this._releaseTrigger = new Trigger8();
5963
+ this._releaseTrigger = new Trigger9();
5932
5964
  this._lockKey = lockKey;
5933
5965
  this._onAcquire = onAcquire;
5934
5966
  this._onRelease = onRelease;
@@ -5942,28 +5974,28 @@ var Lock = class {
5942
5974
  message: "acquiring"
5943
5975
  });
5944
5976
  try {
5945
- log18("aquiring lock...", void 0, {
5977
+ log19("aquiring lock...", void 0, {
5946
5978
  F: __dxlog_file21,
5947
5979
  L: 42,
5948
5980
  S: this,
5949
5981
  C: (f, a) => f(...a)
5950
5982
  });
5951
5983
  await asyncTimeout3(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
5952
- log18("acquired lock", void 0, {
5984
+ log19("acquired lock", void 0, {
5953
5985
  F: __dxlog_file21,
5954
5986
  L: 44,
5955
5987
  S: this,
5956
5988
  C: (f, a) => f(...a)
5957
5989
  });
5958
5990
  } catch {
5959
- log18("stealing lock...", void 0, {
5991
+ log19("stealing lock...", void 0, {
5960
5992
  F: __dxlog_file21,
5961
5993
  L: 46,
5962
5994
  S: this,
5963
5995
  C: (f, a) => f(...a)
5964
5996
  });
5965
5997
  await this._requestLock(true);
5966
- log18("stolen lock", void 0, {
5998
+ log19("stolen lock", void 0, {
5967
5999
  F: __dxlog_file21,
5968
6000
  L: 48,
5969
6001
  S: this,
@@ -5980,7 +6012,7 @@ var Lock = class {
5980
6012
  }
5981
6013
  }
5982
6014
  async _requestLock(steal = false) {
5983
- log18("requesting lock...", {
6015
+ log19("requesting lock...", {
5984
6016
  steal
5985
6017
  }, {
5986
6018
  F: __dxlog_file21,
@@ -5988,22 +6020,22 @@ var Lock = class {
5988
6020
  S: this,
5989
6021
  C: (f, a) => f(...a)
5990
6022
  });
5991
- const acquired = new Trigger8();
6023
+ const acquired = new Trigger9();
5992
6024
  void navigator.locks.request(this._lockKey, {
5993
6025
  steal
5994
6026
  }, async () => {
5995
6027
  await this._onAcquire?.();
5996
6028
  acquired.wake();
5997
- this._releaseTrigger = new Trigger8();
6029
+ this._releaseTrigger = new Trigger9();
5998
6030
  await this._releaseTrigger.wait();
5999
- log18("releasing lock...", void 0, {
6031
+ log19("releasing lock...", void 0, {
6000
6032
  F: __dxlog_file21,
6001
6033
  L: 72,
6002
6034
  S: this,
6003
6035
  C: (f, a) => f(...a)
6004
6036
  });
6005
6037
  await this._onRelease?.();
6006
- log18("released lock", void 0, {
6038
+ log19("released lock", void 0, {
6007
6039
  F: __dxlog_file21,
6008
6040
  L: 74,
6009
6041
  S: this,
@@ -6013,7 +6045,7 @@ var Lock = class {
6013
6045
  await this._onRelease?.();
6014
6046
  });
6015
6047
  await acquired.wait();
6016
- log18("recieved lock", {
6048
+ log19("recieved lock", {
6017
6049
  steal
6018
6050
  }, {
6019
6051
  F: __dxlog_file21,
@@ -6110,7 +6142,7 @@ import { clientServiceBundle } from "@dxos/client-protocol";
6110
6142
  import { Context as Context11 } from "@dxos/context";
6111
6143
  import { invariant as invariant18 } from "@dxos/invariant";
6112
6144
  import { PublicKey as PublicKey16 } from "@dxos/keys";
6113
- import { log as log20 } from "@dxos/log";
6145
+ import { log as log21 } from "@dxos/log";
6114
6146
  import { WebsocketSignalManager } from "@dxos/messaging";
6115
6147
  import { SwarmNetworkManager, createSimplePeerTransportFactory } from "@dxos/network-manager";
6116
6148
  import { trace as trace10 } from "@dxos/protocols";
@@ -6251,7 +6283,7 @@ var findConfigs = () => {
6251
6283
  import { Event as Event8 } from "@dxos/async";
6252
6284
  import { Stream as Stream12 } from "@dxos/codec-protobuf";
6253
6285
  import { PublicKey as PublicKey15 } from "@dxos/keys";
6254
- import { getContextFromEntry, log as log19 } from "@dxos/log";
6286
+ import { getContextFromEntry, log as log20 } from "@dxos/log";
6255
6287
  import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
6256
6288
  import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
6257
6289
  var LoggingServiceImpl = class {
@@ -6264,11 +6296,11 @@ var LoggingServiceImpl = class {
6264
6296
  };
6265
6297
  }
6266
6298
  async open() {
6267
- log19.runtimeConfig.processors.push(this._logProcessor);
6299
+ log20.runtimeConfig.processors.push(this._logProcessor);
6268
6300
  }
6269
6301
  async close() {
6270
- const index = log19.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
6271
- log19.runtimeConfig.processors.splice(index, 1);
6302
+ const index = log20.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
6303
+ log20.runtimeConfig.processors.splice(index, 1);
6272
6304
  }
6273
6305
  async controlMetrics({ reset, record }) {
6274
6306
  if (reset) {
@@ -6569,7 +6601,7 @@ var ClientServicesHost = class {
6569
6601
  "'service host is open'"
6570
6602
  ]
6571
6603
  });
6572
- log20("initializing...", void 0, {
6604
+ log21("initializing...", void 0, {
6573
6605
  F: __dxlog_file23,
6574
6606
  L: 187,
6575
6607
  S: this,
@@ -6591,7 +6623,7 @@ var ClientServicesHost = class {
6591
6623
  }
6592
6624
  }
6593
6625
  if (!options.signalManager) {
6594
- log20.warn("running signaling without telemetry metadata.", void 0, {
6626
+ log21.warn("running signaling without telemetry metadata.", void 0, {
6595
6627
  F: __dxlog_file23,
6596
6628
  L: 198,
6597
6629
  S: this,
@@ -6616,7 +6648,7 @@ var ClientServicesHost = class {
6616
6648
  transportFactory,
6617
6649
  signalManager
6618
6650
  });
6619
- log20("initialized", void 0, {
6651
+ log21("initialized", void 0, {
6620
6652
  F: __dxlog_file23,
6621
6653
  L: 216,
6622
6654
  S: this,
@@ -6628,7 +6660,7 @@ var ClientServicesHost = class {
6628
6660
  return;
6629
6661
  }
6630
6662
  const traceId = PublicKey16.random().toHex();
6631
- log20.trace("dxos.client-services.host.open", trace10.begin({
6663
+ log21.trace("dxos.client-services.host.open", trace10.begin({
6632
6664
  id: traceId
6633
6665
  }), {
6634
6666
  F: __dxlog_file23,
@@ -6673,7 +6705,7 @@ var ClientServicesHost = class {
6673
6705
  ]
6674
6706
  });
6675
6707
  this._opening = true;
6676
- log20("opening...", {
6708
+ log21("opening...", {
6677
6709
  lockKey: this._resourceLock?.lockKey
6678
6710
  }, {
6679
6711
  F: __dxlog_file23,
@@ -6727,7 +6759,7 @@ var ClientServicesHost = class {
6727
6759
  this._open = true;
6728
6760
  this._statusUpdate.emit();
6729
6761
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
6730
- log20("opened", {
6762
+ log21("opened", {
6731
6763
  deviceKey
6732
6764
  }, {
6733
6765
  F: __dxlog_file23,
@@ -6735,7 +6767,7 @@ var ClientServicesHost = class {
6735
6767
  S: this,
6736
6768
  C: (f, a) => f(...a)
6737
6769
  });
6738
- log20.trace("dxos.client-services.host.open", trace10.end({
6770
+ log21.trace("dxos.client-services.host.open", trace10.end({
6739
6771
  id: traceId
6740
6772
  }), {
6741
6773
  F: __dxlog_file23,
@@ -6749,7 +6781,7 @@ var ClientServicesHost = class {
6749
6781
  return;
6750
6782
  }
6751
6783
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
6752
- log20("closing...", {
6784
+ log21("closing...", {
6753
6785
  deviceKey
6754
6786
  }, {
6755
6787
  F: __dxlog_file23,
@@ -6767,7 +6799,7 @@ var ClientServicesHost = class {
6767
6799
  await this._level?.close();
6768
6800
  this._open = false;
6769
6801
  this._statusUpdate.emit();
6770
- log20("closed", {
6802
+ log21("closed", {
6771
6803
  deviceKey
6772
6804
  }, {
6773
6805
  F: __dxlog_file23,
@@ -6778,7 +6810,7 @@ var ClientServicesHost = class {
6778
6810
  }
6779
6811
  async reset() {
6780
6812
  const traceId = PublicKey16.random().toHex();
6781
- log20.trace("dxos.sdk.client-services-host.reset", trace10.begin({
6813
+ log21.trace("dxos.sdk.client-services-host.reset", trace10.begin({
6782
6814
  id: traceId
6783
6815
  }), {
6784
6816
  F: __dxlog_file23,
@@ -6786,7 +6818,7 @@ var ClientServicesHost = class {
6786
6818
  S: this,
6787
6819
  C: (f, a) => f(...a)
6788
6820
  });
6789
- log20.info("resetting...", void 0, {
6821
+ log21.info("resetting...", void 0, {
6790
6822
  F: __dxlog_file23,
6791
6823
  L: 342,
6792
6824
  S: this,
@@ -6794,13 +6826,13 @@ var ClientServicesHost = class {
6794
6826
  });
6795
6827
  await this._serviceContext?.close();
6796
6828
  await this._storage.reset();
6797
- log20.info("reset", void 0, {
6829
+ log21.info("reset", void 0, {
6798
6830
  F: __dxlog_file23,
6799
6831
  L: 345,
6800
6832
  S: this,
6801
6833
  C: (f, a) => f(...a)
6802
6834
  });
6803
- log20.trace("dxos.sdk.client-services-host.reset", trace10.end({
6835
+ log21.trace("dxos.sdk.client-services-host.reset", trace10.end({
6804
6836
  id: traceId
6805
6837
  }), {
6806
6838
  F: __dxlog_file23,
@@ -6874,4 +6906,4 @@ export {
6874
6906
  ClientServicesProviderResource,
6875
6907
  DiagnosticsCollector
6876
6908
  };
6877
- //# sourceMappingURL=chunk-SLSPX47D.mjs.map
6909
+ //# sourceMappingURL=chunk-WRJ7HR47.mjs.map