@dxos/client-services 0.7.2 → 0.7.3-staging.0905f03

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 (37) hide show
  1. package/dist/lib/browser/{chunk-K5O5LV2R.mjs → chunk-UZZHGRIU.mjs} +363 -433
  2. package/dist/lib/browser/chunk-UZZHGRIU.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/testing/index.mjs +1 -1
  6. package/dist/lib/node/{chunk-SPLKKUM4.cjs → chunk-DVPAB6LZ.cjs} +352 -422
  7. package/dist/lib/node/chunk-DVPAB6LZ.cjs.map +7 -0
  8. package/dist/lib/node/index.cjs +47 -47
  9. package/dist/lib/node/meta.json +1 -1
  10. package/dist/lib/node/testing/index.cjs +8 -8
  11. package/dist/lib/node-esm/{chunk-NSCBFSXO.mjs → chunk-6BGB6XSS.mjs} +357 -427
  12. package/dist/lib/node-esm/chunk-6BGB6XSS.mjs.map +7 -0
  13. package/dist/lib/node-esm/index.mjs +1 -1
  14. package/dist/lib/node-esm/meta.json +1 -1
  15. package/dist/lib/node-esm/testing/index.mjs +1 -1
  16. package/dist/types/src/packlets/agents/edge-agent-manager.d.ts.map +1 -1
  17. package/dist/types/src/packlets/agents/edge-agent-service.d.ts +5 -2
  18. package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -1
  19. package/dist/types/src/packlets/identity/identity-service.d.ts +1 -0
  20. package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
  21. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  22. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  23. package/dist/types/src/packlets/spaces/epoch-migrations.d.ts.map +1 -1
  24. package/dist/types/src/version.d.ts +1 -1
  25. package/dist/types/src/version.d.ts.map +1 -1
  26. package/package.json +38 -38
  27. package/src/packlets/agents/edge-agent-manager.ts +14 -0
  28. package/src/packlets/agents/edge-agent-service.ts +28 -3
  29. package/src/packlets/identity/identity-service.ts +16 -1
  30. package/src/packlets/services/service-context.ts +4 -1
  31. package/src/packlets/services/service-host.ts +1 -1
  32. package/src/packlets/spaces/data-space-manager.ts +4 -13
  33. package/src/packlets/spaces/epoch-migrations.ts +3 -84
  34. package/src/version.ts +1 -5
  35. package/dist/lib/browser/chunk-K5O5LV2R.mjs.map +0 -7
  36. package/dist/lib/node/chunk-SPLKKUM4.cjs.map +0 -7
  37. package/dist/lib/node-esm/chunk-NSCBFSXO.mjs.map +0 -7
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_SPLKKUM4_exports = {};
30
- __export(chunk_SPLKKUM4_exports, {
29
+ var chunk_DVPAB6LZ_exports = {};
30
+ __export(chunk_DVPAB6LZ_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -72,7 +72,7 @@ __export(chunk_SPLKKUM4_exports, {
72
72
  subscribeToSpaces: () => subscribeToSpaces,
73
73
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
74
74
  });
75
- module.exports = __toCommonJS(chunk_SPLKKUM4_exports);
75
+ module.exports = __toCommonJS(chunk_DVPAB6LZ_exports);
76
76
  var import_async = require("@dxos/async");
77
77
  var import_codec_protobuf = require("@dxos/codec-protobuf");
78
78
  var import_feed_store = require("@dxos/feed-store");
@@ -135,19 +135,14 @@ var import_util4 = require("@dxos/util");
135
135
  var import_async8 = require("@dxos/async");
136
136
  var import_context5 = require("@dxos/context");
137
137
  var import_credentials4 = require("@dxos/credentials");
138
- var import_echo_db = require("@dxos/echo-db");
139
- var import_echo_pipeline2 = require("@dxos/echo-pipeline");
140
- var import_echo_protocol2 = require("@dxos/echo-protocol");
141
- var import_echo_schema = require("@dxos/echo-schema");
142
138
  var import_invariant4 = require("@dxos/invariant");
143
- var import_log5 = require("@dxos/log");
144
139
  var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
145
140
  var import_async9 = require("@dxos/async");
146
141
  var import_context6 = require("@dxos/context");
147
142
  var import_credentials5 = require("@dxos/credentials");
148
143
  var import_invariant5 = require("@dxos/invariant");
149
144
  var import_keys5 = require("@dxos/keys");
150
- var import_log6 = require("@dxos/log");
145
+ var import_log5 = require("@dxos/log");
151
146
  var import_protocols4 = require("@dxos/protocols");
152
147
  var import_proto2 = require("@dxos/protocols/proto");
153
148
  var import_teleport = require("@dxos/teleport");
@@ -158,25 +153,25 @@ var import_credentials6 = require("@dxos/credentials");
158
153
  var import_feed_store2 = require("@dxos/feed-store");
159
154
  var import_invariant6 = require("@dxos/invariant");
160
155
  var import_keys6 = require("@dxos/keys");
161
- var import_log7 = require("@dxos/log");
156
+ var import_log6 = require("@dxos/log");
162
157
  var import_credentials7 = require("@dxos/protocols/proto/dxos/halo/credentials");
163
158
  var import_timeframe2 = require("@dxos/timeframe");
164
159
  var import_tracing4 = require("@dxos/tracing");
165
160
  var import_util6 = require("@dxos/util");
166
161
  var import_credentials8 = require("@dxos/credentials");
167
162
  var import_keys7 = require("@dxos/keys");
168
- var import_log8 = require("@dxos/log");
163
+ var import_log7 = require("@dxos/log");
169
164
  var import_async11 = require("@dxos/async");
170
165
  var import_client_protocol4 = require("@dxos/client-protocol");
171
166
  var import_context7 = require("@dxos/context");
172
167
  var import_credentials9 = require("@dxos/credentials");
173
- var import_echo_pipeline3 = require("@dxos/echo-pipeline");
174
- var import_echo_protocol3 = require("@dxos/echo-protocol");
175
- var import_echo_schema2 = require("@dxos/echo-schema");
168
+ var import_echo_pipeline2 = require("@dxos/echo-pipeline");
169
+ var import_echo_protocol2 = require("@dxos/echo-protocol");
170
+ var import_echo_schema = require("@dxos/echo-schema");
176
171
  var import_feed_store3 = require("@dxos/feed-store");
177
172
  var import_invariant7 = require("@dxos/invariant");
178
173
  var import_keys8 = require("@dxos/keys");
179
- var import_log9 = require("@dxos/log");
174
+ var import_log8 = require("@dxos/log");
180
175
  var import_protocols5 = require("@dxos/protocols");
181
176
  var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
182
177
  var import_metadata = require("@dxos/protocols/proto/dxos/echo/metadata");
@@ -194,7 +189,7 @@ var import_credentials13 = require("@dxos/credentials");
194
189
  var import_debug3 = require("@dxos/debug");
195
190
  var import_feed_store4 = require("@dxos/feed-store");
196
191
  var import_invariant8 = require("@dxos/invariant");
197
- var import_log10 = require("@dxos/log");
192
+ var import_log9 = require("@dxos/log");
198
193
  var import_protocols6 = require("@dxos/protocols");
199
194
  var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
200
195
  var import_tracing6 = require("@dxos/tracing");
@@ -204,7 +199,7 @@ var import_context8 = require("@dxos/context");
204
199
  var import_credentials14 = require("@dxos/credentials");
205
200
  var import_invariant9 = require("@dxos/invariant");
206
201
  var import_keys9 = require("@dxos/keys");
207
- var import_log11 = require("@dxos/log");
202
+ var import_log10 = require("@dxos/log");
208
203
  var import_protocols7 = require("@dxos/protocols");
209
204
  var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
210
205
  var import_credentials15 = require("@dxos/protocols/proto/dxos/halo/credentials");
@@ -217,7 +212,7 @@ var import_codec_protobuf9 = require("@dxos/codec-protobuf");
217
212
  var import_context9 = require("@dxos/context");
218
213
  var import_credentials16 = require("@dxos/credentials");
219
214
  var import_invariant10 = require("@dxos/invariant");
220
- var import_log12 = require("@dxos/log");
215
+ var import_log11 = require("@dxos/log");
221
216
  var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
222
217
  var import_util9 = require("@dxos/util");
223
218
  var import_credentials17 = require("@dxos/credentials");
@@ -230,7 +225,7 @@ var import_context10 = require("@dxos/context");
230
225
  var import_crypto = require("@dxos/crypto");
231
226
  var import_invariant12 = require("@dxos/invariant");
232
227
  var import_keys10 = require("@dxos/keys");
233
- var import_log13 = require("@dxos/log");
228
+ var import_log12 = require("@dxos/log");
234
229
  var import_network_manager = require("@dxos/network-manager");
235
230
  var import_protocols9 = require("@dxos/protocols");
236
231
  var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
@@ -242,7 +237,7 @@ var import_async16 = require("@dxos/async");
242
237
  var import_crypto2 = require("@dxos/crypto");
243
238
  var import_invariant13 = require("@dxos/invariant");
244
239
  var import_keys11 = require("@dxos/keys");
245
- var import_log14 = require("@dxos/log");
240
+ var import_log13 = require("@dxos/log");
246
241
  var import_protocols10 = require("@dxos/protocols");
247
242
  var import_proto3 = require("@dxos/protocols/proto");
248
243
  var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
@@ -251,7 +246,7 @@ var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
251
246
  var import_async17 = require("@dxos/async");
252
247
  var import_context12 = require("@dxos/context");
253
248
  var import_invariant14 = require("@dxos/invariant");
254
- var import_log15 = require("@dxos/log");
249
+ var import_log14 = require("@dxos/log");
255
250
  var import_protocols11 = require("@dxos/protocols");
256
251
  var import_proto4 = require("@dxos/protocols/proto");
257
252
  var import_invitations3 = require("@dxos/protocols/proto/dxos/halo/invitations");
@@ -261,18 +256,18 @@ var import_context13 = require("@dxos/context");
261
256
  var import_crypto3 = require("@dxos/crypto");
262
257
  var import_invariant15 = require("@dxos/invariant");
263
258
  var import_keys12 = require("@dxos/keys");
264
- var import_log16 = require("@dxos/log");
259
+ var import_log15 = require("@dxos/log");
265
260
  var import_protocols12 = require("@dxos/protocols");
266
261
  var import_proto5 = require("@dxos/protocols/proto");
267
262
  var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
268
263
  var import_invitations4 = require("@dxos/protocols/proto/dxos/halo/invitations");
269
264
  var import_teleport3 = require("@dxos/teleport");
270
265
  var import_async19 = require("@dxos/async");
271
- var import_log17 = require("@dxos/log");
266
+ var import_log16 = require("@dxos/log");
272
267
  var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
273
268
  var import_invariant16 = require("@dxos/invariant");
274
269
  var import_keys13 = require("@dxos/keys");
275
- var import_log18 = require("@dxos/log");
270
+ var import_log17 = require("@dxos/log");
276
271
  var import_invitations5 = require("@dxos/protocols/proto/dxos/halo/invitations");
277
272
  var import_util11 = require("@dxos/util");
278
273
  var import_codec_protobuf10 = require("@dxos/codec-protobuf");
@@ -281,7 +276,7 @@ var import_tracing9 = require("@dxos/tracing");
281
276
  var import_credentials18 = require("@dxos/credentials");
282
277
  var import_feed_store5 = require("@dxos/feed-store");
283
278
  var import_invariant17 = require("@dxos/invariant");
284
- var import_log19 = require("@dxos/log");
279
+ var import_log18 = require("@dxos/log");
285
280
  var import_protocols13 = require("@dxos/protocols");
286
281
  var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
287
282
  var import_credentials19 = require("@dxos/protocols/proto/dxos/halo/credentials");
@@ -289,15 +284,15 @@ var import_async20 = require("@dxos/async");
289
284
  var import_client_protocol6 = require("@dxos/client-protocol");
290
285
  var import_context14 = require("@dxos/context");
291
286
  var import_credentials20 = require("@dxos/credentials");
292
- var import_echo_pipeline4 = require("@dxos/echo-pipeline");
287
+ var import_echo_pipeline3 = require("@dxos/echo-pipeline");
293
288
  var import_invariant18 = require("@dxos/invariant");
294
289
  var import_keys14 = require("@dxos/keys");
295
- var import_log20 = require("@dxos/log");
290
+ var import_log19 = require("@dxos/log");
296
291
  var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
297
292
  var import_credentials21 = require("@dxos/protocols/proto/dxos/halo/credentials");
298
293
  var import_invariant19 = require("@dxos/invariant");
299
294
  var import_lock_file = require("@dxos/lock-file");
300
- var import_log21 = require("@dxos/log");
295
+ var import_log20 = require("@dxos/log");
301
296
  var import_codec_protobuf11 = require("@dxos/codec-protobuf");
302
297
  var import_debug4 = require("@dxos/debug");
303
298
  var import_rpc = require("@dxos/rpc");
@@ -306,9 +301,10 @@ var import_async21 = require("@dxos/async");
306
301
  var import_context15 = require("@dxos/context");
307
302
  var import_invariant20 = require("@dxos/invariant");
308
303
  var import_keys15 = require("@dxos/keys");
309
- var import_log22 = require("@dxos/log");
304
+ var import_log21 = require("@dxos/log");
310
305
  var import_protocols14 = require("@dxos/protocols");
311
306
  var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
307
+ var import_metadata2 = require("@dxos/protocols/proto/dxos/echo/metadata");
312
308
  var import_codec_protobuf12 = require("@dxos/codec-protobuf");
313
309
  var import_protocols15 = require("@dxos/protocols");
314
310
  var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
@@ -316,13 +312,13 @@ var import_async22 = require("@dxos/async");
316
312
  var import_context16 = require("@dxos/context");
317
313
  var import_credentials22 = require("@dxos/credentials");
318
314
  var import_debug5 = require("@dxos/debug");
319
- var import_echo_pipeline5 = require("@dxos/echo-pipeline");
315
+ var import_echo_pipeline4 = require("@dxos/echo-pipeline");
320
316
  var import_edge_client2 = require("@dxos/edge-client");
321
317
  var import_feed_store6 = require("@dxos/feed-store");
322
318
  var import_invariant21 = require("@dxos/invariant");
323
319
  var import_keyring = require("@dxos/keyring");
324
320
  var import_keys16 = require("@dxos/keys");
325
- var import_log23 = require("@dxos/log");
321
+ var import_log22 = require("@dxos/log");
326
322
  var import_protocols16 = require("@dxos/protocols");
327
323
  var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
328
324
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
@@ -332,7 +328,7 @@ var import_credentials23 = require("@dxos/credentials");
332
328
  var import_crypto4 = require("@dxos/crypto");
333
329
  var import_invariant22 = require("@dxos/invariant");
334
330
  var import_keys17 = require("@dxos/keys");
335
- var import_log24 = require("@dxos/log");
331
+ var import_log23 = require("@dxos/log");
336
332
  var import_protocols17 = require("@dxos/protocols");
337
333
  var import_proto6 = require("@dxos/protocols/proto");
338
334
  var import_timeframe5 = require("@dxos/timeframe");
@@ -347,7 +343,7 @@ var import_keys18 = require("@dxos/keys");
347
343
  var import_kv_store = require("@dxos/kv-store");
348
344
  var import_automerge_repo = require("@dxos/automerge/automerge-repo");
349
345
  var import_invariant23 = require("@dxos/invariant");
350
- var import_log25 = require("@dxos/log");
346
+ var import_log24 = require("@dxos/log");
351
347
  var import_protocols19 = require("@dxos/protocols");
352
348
  var import_util14 = require("@dxos/util");
353
349
  var import_async23 = require("@dxos/async");
@@ -356,7 +352,7 @@ var import_context17 = require("@dxos/context");
356
352
  var import_edge_client3 = require("@dxos/edge-client");
357
353
  var import_invariant24 = require("@dxos/invariant");
358
354
  var import_keys19 = require("@dxos/keys");
359
- var import_log26 = require("@dxos/log");
355
+ var import_log25 = require("@dxos/log");
360
356
  var import_messaging = require("@dxos/messaging");
361
357
  var import_network_manager2 = require("@dxos/network-manager");
362
358
  var import_protocols20 = require("@dxos/protocols");
@@ -374,7 +370,7 @@ var import_util15 = require("@dxos/util");
374
370
  var import_async26 = require("@dxos/async");
375
371
  var import_codec_protobuf15 = require("@dxos/codec-protobuf");
376
372
  var import_keys21 = require("@dxos/keys");
377
- var import_log27 = require("@dxos/log");
373
+ var import_log26 = require("@dxos/log");
378
374
  var import_services24 = require("@dxos/protocols/proto/dxos/client/services");
379
375
  var import_util16 = require("@dxos/util");
380
376
  var import_codec_protobuf16 = require("@dxos/codec-protobuf");
@@ -739,7 +735,7 @@ var DevtoolsServiceImpl = class {
739
735
  });
740
736
  }
741
737
  };
742
- var DXOS_VERSION = "0.7.2";
738
+ var DXOS_VERSION = "0.7.3-staging.0905f03";
743
739
  var getPlatform = () => {
744
740
  if (process.browser) {
745
741
  if (typeof window !== "undefined") {
@@ -1583,133 +1579,16 @@ var runEpochMigration = async (ctx, context) => {
1583
1579
  };
1584
1580
  }
1585
1581
  case import_services5.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
1586
- import_log5.log.info("Fragmenting", void 0, {
1587
- F: __dxlog_file6,
1588
- L: 64,
1589
- S: void 0,
1590
- C: (f, a) => f(...a)
1591
- });
1592
- const currentRootUrl = context.currentRoot;
1593
- const rootHandle = await context.echoHost.loadDoc(ctx, currentRootUrl, {
1594
- timeout: LOAD_DOC_TIMEOUT
1595
- });
1596
- const objects = Object.entries(rootHandle.docSync().objects);
1597
- const properties = (0, import_echo_pipeline2.findInlineObjectOfType)(rootHandle.docSync(), import_echo_schema.TYPE_PROPERTIES);
1598
- const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
1599
- (0, import_invariant4.invariant)(properties, "Properties not found", {
1600
- F: __dxlog_file6,
1601
- L: 75,
1602
- S: void 0,
1603
- A: [
1604
- "properties",
1605
- "'Properties not found'"
1606
- ]
1607
- });
1608
- const newRoot = context.echoHost.createDoc({
1609
- ...rootHandle.docSync(),
1610
- objects: Object.fromEntries([
1611
- properties
1612
- ])
1613
- });
1614
- (0, import_invariant4.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
1615
- F: __dxlog_file6,
1616
- L: 82,
1617
- S: void 0,
1618
- A: [
1619
- "typeof newRoot.url === 'string' && newRoot.url.length > 0",
1620
- ""
1621
- ]
1622
- });
1623
- const newLinks = [];
1624
- for (const [id, objData] of otherObjects) {
1625
- const handle = context.echoHost.createDoc({
1626
- version: import_echo_protocol2.SpaceDocVersion.CURRENT,
1627
- access: {
1628
- spaceKey: context.spaceKey.toHex()
1629
- },
1630
- objects: {
1631
- [id]: objData
1632
- }
1633
- });
1634
- newLinks.push([
1635
- id,
1636
- handle.url
1637
- ]);
1638
- }
1639
- newRoot.change((doc) => {
1640
- doc.links ??= {};
1641
- for (const [id, url] of newLinks) {
1642
- doc.links[id] = url;
1643
- }
1644
- });
1645
- await context.echoHost.flush();
1646
- return {
1647
- newRoot: newRoot.url
1648
- };
1582
+ throw new Error("Migration not available");
1649
1583
  }
1650
1584
  case import_services5.CreateEpochRequest.Migration.MIGRATE_REFERENCES_TO_DXN: {
1651
- const currentRootUrl = context.currentRoot;
1652
- const rootHandle = await context.echoHost.loadDoc(ctx, currentRootUrl, {
1653
- timeout: LOAD_DOC_TIMEOUT
1654
- });
1655
- (0, import_invariant4.invariant)(rootHandle.docSync(), "Root doc not found", {
1656
- F: __dxlog_file6,
1657
- L: 115,
1658
- S: void 0,
1659
- A: [
1660
- "rootHandle.docSync()",
1661
- "'Root doc not found'"
1662
- ]
1663
- });
1664
- const newRootContent = await (0, import_echo_pipeline2.convertLegacySpaceRootDoc)(structuredClone(rootHandle.docSync()));
1665
- for (const [id, url] of Object.entries(newRootContent.links ?? {})) {
1666
- try {
1667
- const handle = await context.echoHost.loadDoc(ctx, url, {
1668
- timeout: LOAD_DOC_TIMEOUT
1669
- });
1670
- (0, import_invariant4.invariant)(handle.docSync(), void 0, {
1671
- F: __dxlog_file6,
1672
- L: 122,
1673
- S: void 0,
1674
- A: [
1675
- "handle.docSync()",
1676
- ""
1677
- ]
1678
- });
1679
- const newDoc = await (0, import_echo_pipeline2.convertLegacyReferences)(structuredClone(handle.docSync()));
1680
- const migratedDoc = (0, import_echo_db.migrateDocument)(handle.docSync(), newDoc);
1681
- const newHandle = context.echoHost.createDoc(migratedDoc, {
1682
- preserveHistory: true
1683
- });
1684
- newRootContent.links[id] = newHandle.url;
1685
- } catch (err) {
1686
- import_log5.log.warn("Failed to migrate reference", {
1687
- id,
1688
- url,
1689
- error: err
1690
- }, {
1691
- F: __dxlog_file6,
1692
- L: 128,
1693
- S: void 0,
1694
- C: (f, a) => f(...a)
1695
- });
1696
- delete newRootContent.links[id];
1697
- }
1698
- }
1699
- const migratedRoot = (0, import_echo_db.migrateDocument)(rootHandle.docSync(), newRootContent);
1700
- const newRoot = context.echoHost.createDoc(migratedRoot, {
1701
- preserveHistory: true
1702
- });
1703
- await context.echoHost.flush();
1704
- return {
1705
- newRoot: newRoot.url
1706
- };
1585
+ throw new Error("Migration not available");
1707
1586
  }
1708
1587
  // TODO(dmaretskyi): This path doesn't seem to fit here. This is not a migration.
1709
1588
  case import_services5.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
1710
1589
  (0, import_invariant4.invariant)(context.newAutomergeRoot, void 0, {
1711
1590
  F: __dxlog_file6,
1712
- L: 143,
1591
+ L: 62,
1713
1592
  S: void 0,
1714
1593
  A: [
1715
1594
  "context.newAutomergeRoot",
@@ -1802,7 +1681,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1802
1681
  * Request credentials to be notarized.
1803
1682
  */
1804
1683
  async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY, edgeRetryJitter }) {
1805
- (0, import_log6.log)("notarize", {
1684
+ (0, import_log5.log)("notarize", {
1806
1685
  credentials
1807
1686
  }, {
1808
1687
  F: __dxlog_file7,
@@ -1822,7 +1701,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1822
1701
  const errors = new import_async9.Trigger();
1823
1702
  const ctx = this._ctx.derive({
1824
1703
  onError: (err) => {
1825
- import_log6.log.warn("Notarization error", {
1704
+ import_log5.log.warn("Notarization error", {
1826
1705
  err
1827
1706
  }, {
1828
1707
  F: __dxlog_file7,
@@ -1856,7 +1735,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1856
1735
  allNotarized,
1857
1736
  errors.wait()
1858
1737
  ]);
1859
- (0, import_log6.log)("done", void 0, {
1738
+ (0, import_log5.log)("done", void 0, {
1860
1739
  F: __dxlog_file7,
1861
1740
  L: 187,
1862
1741
  S: this,
@@ -1877,7 +1756,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1877
1756
  ...this._extensions
1878
1757
  ].find((peer2) => !peersTried.has(peer2));
1879
1758
  if (!peer) {
1880
- import_log6.log.info("Exhausted all peers to notarize with", {
1759
+ import_log5.log.info("Exhausted all peers to notarize with", {
1881
1760
  retryIn: retryTimeout
1882
1761
  }, {
1883
1762
  F: __dxlog_file7,
@@ -1890,7 +1769,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1890
1769
  return;
1891
1770
  }
1892
1771
  peersTried.add(peer);
1893
- (0, import_log6.log)("try notarizing", {
1772
+ (0, import_log5.log)("try notarizing", {
1894
1773
  peer: peer.localPeerId,
1895
1774
  credentialId: credentials.map((credential) => credential.id)
1896
1775
  }, {
@@ -1902,7 +1781,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1902
1781
  await peer.rpc.NotarizationService.notarize({
1903
1782
  credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
1904
1783
  });
1905
- (0, import_log6.log)("success", void 0, {
1784
+ (0, import_log5.log)("success", void 0, {
1906
1785
  F: __dxlog_file7,
1907
1786
  L: 221,
1908
1787
  S: this,
@@ -1911,7 +1790,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1911
1790
  await (0, import_async9.sleep)(successDelay);
1912
1791
  } catch (err) {
1913
1792
  if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
1914
- import_log6.log.info("error notarizing (recoverable)", err, {
1793
+ import_log5.log.info("error notarizing (recoverable)", err, {
1915
1794
  F: __dxlog_file7,
1916
1795
  L: 226,
1917
1796
  S: this,
@@ -1940,7 +1819,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1940
1819
  jitter: timeouts.jitter
1941
1820
  }
1942
1821
  });
1943
- (0, import_log6.log)("edge notarization success", void 0, {
1822
+ (0, import_log5.log)("edge notarization success", void 0, {
1944
1823
  F: __dxlog_file7,
1945
1824
  L: 254,
1946
1825
  S: this,
@@ -1993,7 +1872,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1993
1872
  });
1994
1873
  const credentials = response.awaitingNotarization.credentials;
1995
1874
  if (!credentials.length) {
1996
- (0, import_log6.log)("edge did not return credentials for notarization", void 0, {
1875
+ (0, import_log5.log)("edge did not return credentials for notarization", void 0, {
1997
1876
  F: __dxlog_file7,
1998
1877
  L: 296,
1999
1878
  S: this,
@@ -2001,7 +1880,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
2001
1880
  });
2002
1881
  return;
2003
1882
  }
2004
- (0, import_log6.log)("got edge credentials for notarization", {
1883
+ (0, import_log5.log)("got edge credentials for notarization", {
2005
1884
  count: credentials.length
2006
1885
  }, {
2007
1886
  F: __dxlog_file7,
@@ -2014,7 +1893,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
2014
1893
  return credentialCodec.decode(binary);
2015
1894
  });
2016
1895
  await this._notarizeCredentials(writer, decodedCredentials);
2017
- import_log6.log.info("notarized edge credentials", {
1896
+ import_log5.log.info("notarized edge credentials", {
2018
1897
  count: decodedCredentials.length
2019
1898
  }, {
2020
1899
  F: __dxlog_file7,
@@ -2066,7 +1945,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
2066
1945
  createExtension() {
2067
1946
  const extension = new NotarizationTeleportExtension({
2068
1947
  onOpen: async () => {
2069
- (0, import_log6.log)("extension opened", {
1948
+ (0, import_log5.log)("extension opened", {
2070
1949
  peer: extension.localPeerId
2071
1950
  }, {
2072
1951
  F: __dxlog_file7,
@@ -2078,7 +1957,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
2078
1957
  this._extensionOpened.emit();
2079
1958
  },
2080
1959
  onClose: async () => {
2081
- (0, import_log6.log)("extension closed", {
1960
+ (0, import_log5.log)("extension closed", {
2082
1961
  peer: extension.localPeerId
2083
1962
  }, {
2084
1963
  F: __dxlog_file7,
@@ -2094,7 +1973,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
2094
1973
  }
2095
1974
  _scheduleTimeout(ctx, errors, timeout) {
2096
1975
  (0, import_async9.scheduleTask)(ctx, () => {
2097
- import_log6.log.warn("Notarization timeout", {
1976
+ import_log5.log.warn("Notarization timeout", {
2098
1977
  timeout,
2099
1978
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
2100
1979
  }, {
@@ -2109,18 +1988,18 @@ var NotarizationPlugin = class extends import_context6.Resource {
2109
1988
  }
2110
1989
  };
2111
1990
  _ts_decorate2([
2112
- import_log6.logInfo
1991
+ import_log5.logInfo
2113
1992
  ], NotarizationPlugin.prototype, "_spaceId", void 0);
2114
1993
  var handleEdgeError = (error) => {
2115
1994
  if (!(error instanceof import_protocols4.EdgeCallFailedError) || error.errorData) {
2116
- import_log6.log.catch(error, void 0, {
1995
+ import_log5.log.catch(error, void 0, {
2117
1996
  F: __dxlog_file7,
2118
1997
  L: 381,
2119
1998
  S: void 0,
2120
1999
  C: (f, a) => f(...a)
2121
2000
  });
2122
2001
  } else {
2123
- import_log6.log.info("Edge notarization failure", {
2002
+ import_log5.log.info("Edge notarization failure", {
2124
2003
  reason: error.reason
2125
2004
  }, {
2126
2005
  F: __dxlog_file7,
@@ -2173,7 +2052,7 @@ var DefaultSpaceStateMachine = class {
2173
2052
  switch (assertion["@type"]) {
2174
2053
  case "dxos.halo.credentials.DefaultSpace": {
2175
2054
  if (!credential.subject.id.equals(this._params.identityKey)) {
2176
- import_log8.log.warn("Invalid default space credential", {
2055
+ import_log7.log.warn("Invalid default space credential", {
2177
2056
  expectedIdentity: this._params.identityKey,
2178
2057
  credential
2179
2058
  }, {
@@ -2185,7 +2064,7 @@ var DefaultSpaceStateMachine = class {
2185
2064
  return;
2186
2065
  }
2187
2066
  if (!import_keys7.SpaceId.isValid(assertion.spaceId)) {
2188
- import_log8.log.warn("Invalid default space id", {
2067
+ import_log7.log.warn("Invalid default space id", {
2189
2068
  id: assertion.spaceId
2190
2069
  }, {
2191
2070
  F: __dxlog_file8,
@@ -2308,7 +2187,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2308
2187
  const rootUrl = space.automergeSpaceState.rootUrl;
2309
2188
  const rootHandle = rootUrl ? this._echoHost.automergeRepo.find(rootUrl) : void 0;
2310
2189
  const rootDoc = rootHandle?.docSync();
2311
- const properties = rootDoc && (0, import_echo_pipeline3.findInlineObjectOfType)(rootDoc, import_echo_schema2.TYPE_PROPERTIES);
2190
+ const properties = rootDoc && (0, import_echo_pipeline2.findInlineObjectOfType)(rootDoc, import_client_protocol4.TYPE_PROPERTIES);
2312
2191
  return {
2313
2192
  key: space.key.toHex(),
2314
2193
  state: import_services6.SpaceState[space.state],
@@ -2328,65 +2207,65 @@ var DataSpaceManager = class extends import_context7.Resource {
2328
2207
  return this._spaces;
2329
2208
  }
2330
2209
  async _open() {
2331
- (0, import_log9.log)("open", void 0, {
2210
+ (0, import_log8.log)("open", void 0, {
2332
2211
  F: __dxlog_file9,
2333
- L: 199,
2212
+ L: 192,
2334
2213
  S: this,
2335
2214
  C: (f, a) => f(...a)
2336
2215
  });
2337
- import_log9.log.trace("dxos.echo.data-space-manager.open", import_protocols5.trace.begin({
2216
+ import_log8.log.trace("dxos.echo.data-space-manager.open", import_protocols5.trace.begin({
2338
2217
  id: this._instanceId
2339
2218
  }), {
2340
2219
  F: __dxlog_file9,
2341
- L: 200,
2220
+ L: 193,
2342
2221
  S: this,
2343
2222
  C: (f, a) => f(...a)
2344
2223
  });
2345
- (0, import_log9.log)("metadata loaded", {
2224
+ (0, import_log8.log)("metadata loaded", {
2346
2225
  spaces: this._metadataStore.spaces.length
2347
2226
  }, {
2348
2227
  F: __dxlog_file9,
2349
- L: 201,
2228
+ L: 194,
2350
2229
  S: this,
2351
2230
  C: (f, a) => f(...a)
2352
2231
  });
2353
2232
  await (0, import_util7.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
2354
2233
  try {
2355
- (0, import_log9.log)("load space", {
2234
+ (0, import_log8.log)("load space", {
2356
2235
  spaceMetadata
2357
2236
  }, {
2358
2237
  F: __dxlog_file9,
2359
- L: 205,
2238
+ L: 198,
2360
2239
  S: this,
2361
2240
  C: (f, a) => f(...a)
2362
2241
  });
2363
2242
  await this._constructSpace(spaceMetadata);
2364
2243
  } catch (err) {
2365
- import_log9.log.error("Error loading space", {
2244
+ import_log8.log.error("Error loading space", {
2366
2245
  spaceMetadata,
2367
2246
  err
2368
2247
  }, {
2369
2248
  F: __dxlog_file9,
2370
- L: 208,
2249
+ L: 201,
2371
2250
  S: this,
2372
2251
  C: (f, a) => f(...a)
2373
2252
  });
2374
2253
  }
2375
2254
  });
2376
2255
  this.updated.emit();
2377
- import_log9.log.trace("dxos.echo.data-space-manager.open", import_protocols5.trace.end({
2256
+ import_log8.log.trace("dxos.echo.data-space-manager.open", import_protocols5.trace.end({
2378
2257
  id: this._instanceId
2379
2258
  }), {
2380
2259
  F: __dxlog_file9,
2381
- L: 214,
2260
+ L: 207,
2382
2261
  S: this,
2383
2262
  C: (f, a) => f(...a)
2384
2263
  });
2385
2264
  }
2386
2265
  async _close() {
2387
- (0, import_log9.log)("close", void 0, {
2266
+ (0, import_log8.log)("close", void 0, {
2388
2267
  F: __dxlog_file9,
2389
- L: 219,
2268
+ L: 212,
2390
2269
  S: this,
2391
2270
  C: (f, a) => f(...a)
2392
2271
  });
@@ -2401,7 +2280,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2401
2280
  async createSpace() {
2402
2281
  (0, import_invariant7.invariant)(this._lifecycleState === import_context7.LifecycleState.OPEN, "Not open.", {
2403
2282
  F: __dxlog_file9,
2404
- L: 231,
2283
+ L: 224,
2405
2284
  S: this,
2406
2285
  A: [
2407
2286
  "this._lifecycleState === LifecycleState.OPEN",
@@ -2418,11 +2297,11 @@ var DataSpaceManager = class extends import_context7.Resource {
2418
2297
  dataFeedKey,
2419
2298
  state: import_services6.SpaceState.SPACE_ACTIVE
2420
2299
  };
2421
- (0, import_log9.log)("creating space...", {
2300
+ (0, import_log8.log)("creating space...", {
2422
2301
  spaceKey
2423
2302
  }, {
2424
2303
  F: __dxlog_file9,
2425
- L: 243,
2304
+ L: 236,
2426
2305
  S: this,
2427
2306
  C: (f, a) => f(...a)
2428
2307
  });
@@ -2434,7 +2313,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2434
2313
  const memberCredential = credentials[1];
2435
2314
  (0, import_invariant7.invariant)((0, import_credentials9.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2436
2315
  F: __dxlog_file9,
2437
- L: 253,
2316
+ L: 246,
2438
2317
  S: this,
2439
2318
  A: [
2440
2319
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2451,22 +2330,20 @@ var DataSpaceManager = class extends import_context7.Resource {
2451
2330
  return false;
2452
2331
  }
2453
2332
  switch (space.databaseRoot.getVersion()) {
2454
- case import_echo_protocol3.SpaceDocVersion.CURRENT: {
2455
- const [_, properties] = (0, import_echo_pipeline3.findInlineObjectOfType)(space.databaseRoot.docSync(), import_echo_schema2.TYPE_PROPERTIES) ?? [];
2333
+ case import_echo_protocol2.SpaceDocVersion.CURRENT: {
2334
+ const [_, properties] = (0, import_echo_pipeline2.findInlineObjectOfType)(space.databaseRoot.docSync(), import_client_protocol4.TYPE_PROPERTIES) ?? [];
2456
2335
  return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
2457
2336
  }
2458
- case import_echo_protocol3.SpaceDocVersion.LEGACY: {
2459
- const convertedDoc = await (0, import_echo_pipeline3.convertLegacyReferences)(space.databaseRoot.docSync());
2460
- const [_, properties] = (0, import_echo_pipeline3.findInlineObjectOfType)(convertedDoc, import_echo_protocol3.LEGACY_TYPE_PROPERTIES) ?? [];
2461
- return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
2337
+ case import_echo_protocol2.SpaceDocVersion.LEGACY: {
2338
+ throw new Error("Legacy space version is not supported");
2462
2339
  }
2463
2340
  default:
2464
- import_log9.log.warn("unknown space version", {
2341
+ import_log8.log.warn("unknown space version", {
2465
2342
  version: space.databaseRoot.getVersion(),
2466
2343
  spaceId: space.id
2467
2344
  }, {
2468
2345
  F: __dxlog_file9,
2469
- L: 278,
2346
+ L: 269,
2470
2347
  S: this,
2471
2348
  C: (f, a) => f(...a)
2472
2349
  });
@@ -2478,7 +2355,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2478
2355
  const document = await this._getSpaceRootDocument(space);
2479
2356
  const properties = {
2480
2357
  system: {
2481
- type: (0, import_echo_protocol3.encodeReference)((0, import_echo_schema2.getTypeReference)(import_client_protocol4.PropertiesType))
2358
+ type: (0, import_echo_protocol2.encodeReference)((0, import_echo_schema.getTypeReference)(import_client_protocol4.PropertiesType))
2482
2359
  },
2483
2360
  data: {
2484
2361
  [DEFAULT_SPACE_KEY]: this._signingContext.identityKey.toHex()
@@ -2487,7 +2364,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2487
2364
  keys: []
2488
2365
  }
2489
2366
  };
2490
- const propertiesId = (0, import_echo_schema2.createObjectId)();
2367
+ const propertiesId = (0, import_echo_schema.createObjectId)();
2491
2368
  document.change((doc) => {
2492
2369
  (0, import_util7.setDeep)(doc, [
2493
2370
  "objects",
@@ -2501,7 +2378,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2501
2378
  const automergeIndex = space.automergeSpaceState.rootUrl;
2502
2379
  (0, import_invariant7.invariant)(automergeIndex, void 0, {
2503
2380
  F: __dxlog_file9,
2504
- L: 311,
2381
+ L: 302,
2505
2382
  S: this,
2506
2383
  A: [
2507
2384
  "automergeIndex",
@@ -2514,17 +2391,17 @@ var DataSpaceManager = class extends import_context7.Resource {
2514
2391
  }
2515
2392
  // TODO(burdon): Rename join space.
2516
2393
  async acceptSpace(opts) {
2517
- (0, import_log9.log)("accept space", {
2394
+ (0, import_log8.log)("accept space", {
2518
2395
  opts
2519
2396
  }, {
2520
2397
  F: __dxlog_file9,
2521
- L: 320,
2398
+ L: 311,
2522
2399
  S: this,
2523
2400
  C: (f, a) => f(...a)
2524
2401
  });
2525
2402
  (0, import_invariant7.invariant)(this._lifecycleState === import_context7.LifecycleState.OPEN, "Not open.", {
2526
2403
  F: __dxlog_file9,
2527
- L: 321,
2404
+ L: 312,
2528
2405
  S: this,
2529
2406
  A: [
2530
2407
  "this._lifecycleState === LifecycleState.OPEN",
@@ -2533,7 +2410,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2533
2410
  });
2534
2411
  (0, import_invariant7.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
2535
2412
  F: __dxlog_file9,
2536
- L: 322,
2413
+ L: 313,
2537
2414
  S: this,
2538
2415
  A: [
2539
2416
  "!this._spaces.has(opts.spaceKey)",
@@ -2557,7 +2434,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2557
2434
  const space = this._spaceManager.spaces.get(options.spaceKey);
2558
2435
  (0, import_invariant7.invariant)(space, void 0, {
2559
2436
  F: __dxlog_file9,
2560
- L: 342,
2437
+ L: 333,
2561
2438
  S: this,
2562
2439
  A: [
2563
2440
  "space",
@@ -2570,7 +2447,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2570
2447
  const credentials = await (0, import_credentials9.createAdmissionCredentials)(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
2571
2448
  (0, import_invariant7.invariant)(credentials[0].credential, void 0, {
2572
2449
  F: __dxlog_file9,
2573
- L: 361,
2450
+ L: 352,
2574
2451
  S: this,
2575
2452
  A: [
2576
2453
  "credentials[0].credential",
@@ -2580,7 +2457,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2580
2457
  const spaceMemberCredential = credentials[0].credential.credential;
2581
2458
  (0, import_invariant7.invariant)((0, import_credentials9.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2582
2459
  F: __dxlog_file9,
2583
- L: 363,
2460
+ L: 354,
2584
2461
  S: this,
2585
2462
  A: [
2586
2463
  "getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2618,7 +2495,7 @@ var DataSpaceManager = class extends import_context7.Resource {
2618
2495
  const space = this._spaces.get(spaceKey);
2619
2496
  (0, import_invariant7.invariant)(space, "Space not found.", {
2620
2497
  F: __dxlog_file9,
2621
- L: 400,
2498
+ L: 391,
2622
2499
  S: this,
2623
2500
  A: [
2624
2501
  "space",
@@ -2639,11 +2516,11 @@ var DataSpaceManager = class extends import_context7.Resource {
2639
2516
  space.stateUpdate.emit();
2640
2517
  }
2641
2518
  async _constructSpace(metadata) {
2642
- (0, import_log9.log)("construct space", {
2519
+ (0, import_log8.log)("construct space", {
2643
2520
  metadata
2644
2521
  }, {
2645
2522
  F: __dxlog_file9,
2646
- L: 419,
2523
+ L: 410,
2647
2524
  S: this,
2648
2525
  C: (f, a) => f(...a)
2649
2526
  });
@@ -2676,18 +2553,18 @@ var DataSpaceManager = class extends import_context7.Resource {
2676
2553
  if (!session.isOpen) {
2677
2554
  return;
2678
2555
  }
2679
- session.addExtension("dxos.mesh.teleport.admission-discovery", new import_echo_pipeline3.CredentialServerExtension(space));
2556
+ session.addExtension("dxos.mesh.teleport.admission-discovery", new import_echo_pipeline2.CredentialServerExtension(space));
2680
2557
  session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
2681
2558
  remotePeerId: session.remotePeerId
2682
2559
  }));
2683
2560
  session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
2684
2561
  await this._connectEchoMeshReplicator(space, session);
2685
2562
  } catch (err) {
2686
- import_log9.log.warn("error on authorized connection", {
2563
+ import_log8.log.warn("error on authorized connection", {
2687
2564
  err
2688
2565
  }, {
2689
2566
  F: __dxlog_file9,
2690
- L: 461,
2567
+ L: 452,
2691
2568
  S: this,
2692
2569
  C: (f, a) => f(...a)
2693
2570
  });
@@ -2695,9 +2572,9 @@ var DataSpaceManager = class extends import_context7.Resource {
2695
2572
  }
2696
2573
  }),
2697
2574
  onAuthFailure: () => {
2698
- import_log9.log.warn("auth failure", void 0, {
2575
+ import_log8.log.warn("auth failure", void 0, {
2699
2576
  F: __dxlog_file9,
2700
- L: 466,
2577
+ L: 457,
2701
2578
  S: this,
2702
2579
  C: (f, a) => f(...a)
2703
2580
  });
@@ -2726,22 +2603,22 @@ var DataSpaceManager = class extends import_context7.Resource {
2726
2603
  signingContext: this._signingContext,
2727
2604
  callbacks: {
2728
2605
  beforeReady: async () => {
2729
- (0, import_log9.log)("before space ready", {
2606
+ (0, import_log8.log)("before space ready", {
2730
2607
  space: space.key
2731
2608
  }, {
2732
2609
  F: __dxlog_file9,
2733
- L: 493,
2610
+ L: 484,
2734
2611
  S: this,
2735
2612
  C: (f, a) => f(...a)
2736
2613
  });
2737
2614
  },
2738
2615
  afterReady: async () => {
2739
- (0, import_log9.log)("after space ready", {
2616
+ (0, import_log8.log)("after space ready", {
2740
2617
  space: space.key,
2741
2618
  open: this._lifecycleState === import_context7.LifecycleState.OPEN
2742
2619
  }, {
2743
2620
  F: __dxlog_file9,
2744
- L: 496,
2621
+ L: 487,
2745
2622
  S: this,
2746
2623
  C: (f, a) => f(...a)
2747
2624
  });
@@ -2756,11 +2633,11 @@ var DataSpaceManager = class extends import_context7.Resource {
2756
2633
  }
2757
2634
  },
2758
2635
  beforeClose: async () => {
2759
- (0, import_log9.log)("before space close", {
2636
+ (0, import_log8.log)("before space close", {
2760
2637
  space: space.key
2761
2638
  }, {
2762
2639
  F: __dxlog_file9,
2763
- L: 504,
2640
+ L: 495,
2764
2641
  S: this,
2765
2642
  C: (f, a) => f(...a)
2766
2643
  });
@@ -2777,11 +2654,11 @@ var DataSpaceManager = class extends import_context7.Resource {
2777
2654
  if (setting === import_metadata.EdgeReplicationSetting.ENABLED) {
2778
2655
  await this._echoEdgeReplicator?.connectToSpace(dataSpace.id);
2779
2656
  } else if (this._echoEdgeReplicator) {
2780
- (0, import_log9.log)("not connecting EchoEdgeReplicator because of EdgeReplicationSetting", {
2657
+ (0, import_log8.log)("not connecting EchoEdgeReplicator because of EdgeReplicationSetting", {
2781
2658
  spaceId: dataSpace.id
2782
2659
  }, {
2783
2660
  F: __dxlog_file9,
2784
- L: 518,
2661
+ L: 509,
2785
2662
  S: this,
2786
2663
  C: (f, a) => f(...a)
2787
2664
  });
@@ -2807,11 +2684,11 @@ var DataSpaceManager = class extends import_context7.Resource {
2807
2684
  async _connectEchoMeshReplicator(space, session) {
2808
2685
  const replicator = this._meshReplicator;
2809
2686
  if (!replicator) {
2810
- import_log9.log.warn("p2p automerge replication disabled", {
2687
+ import_log8.log.warn("p2p automerge replication disabled", {
2811
2688
  space: space.key
2812
2689
  }, {
2813
2690
  F: __dxlog_file9,
2814
- L: 545,
2691
+ L: 536,
2815
2692
  S: this,
2816
2693
  C: (f, a) => f(...a)
2817
2694
  });
@@ -2831,20 +2708,20 @@ var DataSpaceManager = class extends import_context7.Resource {
2831
2708
  const peers = presence.getPeersByIdentityKey(member.key);
2832
2709
  const sessions = peers.map((p) => p.peerId && spaceProtocol.sessions.get(p.peerId));
2833
2710
  const sessionsToClose = sessions.filter((s) => {
2834
- return (s && member.role === import_credentials10.SpaceMember.Role.REMOVED !== (s.authStatus === import_echo_pipeline3.AuthStatus.FAILURE)) ?? false;
2711
+ return (s && member.role === import_credentials10.SpaceMember.Role.REMOVED !== (s.authStatus === import_echo_pipeline2.AuthStatus.FAILURE)) ?? false;
2835
2712
  });
2836
2713
  sessionsToClose.forEach((session) => {
2837
- void session.close().catch(import_log9.log.error);
2714
+ void session.close().catch(import_log8.log.error);
2838
2715
  });
2839
2716
  closedSessions += sessionsToClose.length;
2840
2717
  }
2841
- (0, import_log9.log)("processed member role changes", {
2718
+ (0, import_log8.log)("processed member role changes", {
2842
2719
  roleChangeCount: memberInfo.length,
2843
2720
  peersOnline: presence.getPeersOnline().length,
2844
2721
  closedSessions
2845
2722
  }, {
2846
2723
  F: __dxlog_file9,
2847
- L: 571,
2724
+ L: 562,
2848
2725
  S: this,
2849
2726
  C: (f, a) => f(...a)
2850
2727
  });
@@ -2855,15 +2732,15 @@ var DataSpaceManager = class extends import_context7.Resource {
2855
2732
  if (role === import_credentials10.SpaceMember.Role.REMOVED) {
2856
2733
  const session = peerState.peerId && space.protocol.sessions.get(peerState.peerId);
2857
2734
  if (session != null) {
2858
- (0, import_log9.log)("closing a session with a removed peer", {
2735
+ (0, import_log8.log)("closing a session with a removed peer", {
2859
2736
  peerId: peerState.peerId
2860
2737
  }, {
2861
2738
  F: __dxlog_file9,
2862
- L: 585,
2739
+ L: 576,
2863
2740
  S: this,
2864
2741
  C: (f, a) => f(...a)
2865
2742
  });
2866
- void session.close().catch(import_log9.log.error);
2743
+ void session.close().catch(import_log8.log.error);
2867
2744
  }
2868
2745
  }
2869
2746
  }
@@ -2990,7 +2867,7 @@ var SpacesServiceImpl = class {
2990
2867
  const scheduler = new import_async12.UpdateScheduler(ctx, async () => {
2991
2868
  const dataSpaceManager = await this._getDataSpaceManager();
2992
2869
  const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
2993
- (0, import_log10.log)("update", () => ({
2870
+ (0, import_log9.log)("update", () => ({
2994
2871
  ids: spaces.map((space) => space.id)
2995
2872
  }), {
2996
2873
  F: __dxlog_file10,
@@ -3269,7 +3146,7 @@ var Identity = class {
3269
3146
  this._presence = params.presence;
3270
3147
  this.identityKey = params.identityKey;
3271
3148
  this.deviceKey = params.deviceKey;
3272
- import_log7.log.trace("dxos.halo.device", {
3149
+ import_log6.log.trace("dxos.halo.device", {
3273
3150
  deviceKey: params.deviceKey
3274
3151
  }, {
3275
3152
  F: __dxlog_file11,
@@ -3411,7 +3288,7 @@ var Identity = class {
3411
3288
  ]));
3412
3289
  }
3413
3290
  async admitDevice({ deviceKey, controlFeedKey, dataFeedKey }) {
3414
- (0, import_log7.log)("Admitting device:", {
3291
+ (0, import_log6.log)("Admitting device:", {
3415
3292
  identityKey: this.identityKey,
3416
3293
  hostDevice: this.deviceKey,
3417
3294
  deviceKey,
@@ -3498,7 +3375,7 @@ var IdentityManager = class {
3498
3375
  }
3499
3376
  async open(ctx) {
3500
3377
  const traceId = import_keys9.PublicKey.random().toHex();
3501
- import_log11.log.trace("dxos.halo.identity-manager.open", import_protocols7.trace.begin({
3378
+ import_log10.log.trace("dxos.halo.identity-manager.open", import_protocols7.trace.begin({
3502
3379
  id: traceId
3503
3380
  }), {
3504
3381
  F: __dxlog_file12,
@@ -3507,7 +3384,7 @@ var IdentityManager = class {
3507
3384
  C: (f, a) => f(...a)
3508
3385
  });
3509
3386
  const identityRecord = this._metadataStore.getIdentityRecord();
3510
- (0, import_log11.log)("identity record", {
3387
+ (0, import_log10.log)("identity record", {
3511
3388
  identityRecord
3512
3389
  }, {
3513
3390
  F: __dxlog_file12,
@@ -3519,7 +3396,7 @@ var IdentityManager = class {
3519
3396
  this._identity = await this._constructIdentity(identityRecord);
3520
3397
  await this._identity.open(ctx);
3521
3398
  await this._identity.ready();
3522
- import_log11.log.trace("dxos.halo.identity", {
3399
+ import_log10.log.trace("dxos.halo.identity", {
3523
3400
  identityKey: identityRecord.identityKey,
3524
3401
  displayName: this._identity.profileDocument?.displayName
3525
3402
  }, {
@@ -3530,7 +3407,7 @@ var IdentityManager = class {
3530
3407
  });
3531
3408
  this.stateUpdate.emit();
3532
3409
  }
3533
- import_log11.log.trace("dxos.halo.identity-manager.open", import_protocols7.trace.end({
3410
+ import_log10.log.trace("dxos.halo.identity-manager.open", import_protocols7.trace.end({
3534
3411
  id: traceId
3535
3412
  }), {
3536
3413
  F: __dxlog_file12,
@@ -3555,7 +3432,7 @@ var IdentityManager = class {
3555
3432
  "'Identity already exists.'"
3556
3433
  ]
3557
3434
  });
3558
- (0, import_log11.log)("creating identity...", void 0, {
3435
+ (0, import_log10.log)("creating identity...", void 0, {
3559
3436
  F: __dxlog_file12,
3560
3437
  L: 146,
3561
3438
  S: this,
@@ -3624,7 +3501,7 @@ var IdentityManager = class {
3624
3501
  await this._metadataStore.setIdentityRecord(identityRecord);
3625
3502
  this._identity = identity;
3626
3503
  await this._identity.ready();
3627
- import_log11.log.trace("dxos.halo.identity", {
3504
+ import_log10.log.trace("dxos.halo.identity", {
3628
3505
  identityKey: identityRecord.identityKey,
3629
3506
  displayName: this._identity.profileDocument?.displayName
3630
3507
  }, {
@@ -3634,7 +3511,7 @@ var IdentityManager = class {
3634
3511
  C: (f, a) => f(...a)
3635
3512
  });
3636
3513
  this.stateUpdate.emit();
3637
- (0, import_log11.log)("created identity", {
3514
+ (0, import_log10.log)("created identity", {
3638
3515
  identityKey: identity.identityKey,
3639
3516
  deviceKey: identity.deviceKey,
3640
3517
  profile: identity.profileDocument
@@ -3673,7 +3550,7 @@ var IdentityManager = class {
3673
3550
  * Prepare an identity object as the first step of acceptIdentity flow.
3674
3551
  */
3675
3552
  async prepareIdentity(params) {
3676
- (0, import_log11.log)("accepting identity", {
3553
+ (0, import_log10.log)("accepting identity", {
3677
3554
  params
3678
3555
  }, {
3679
3556
  F: __dxlog_file12,
@@ -3718,7 +3595,7 @@ var IdentityManager = class {
3718
3595
  this._identity = identity;
3719
3596
  await this._identity.ready();
3720
3597
  await this._metadataStore.setIdentityRecord(identityRecord);
3721
- import_log11.log.trace("dxos.halo.identity", {
3598
+ import_log10.log.trace("dxos.halo.identity", {
3722
3599
  identityKey: this._identity.identityKey,
3723
3600
  displayName: this._identity.profileDocument?.displayName
3724
3601
  }, {
@@ -3732,7 +3609,7 @@ var IdentityManager = class {
3732
3609
  ...profile
3733
3610
  });
3734
3611
  this.stateUpdate.emit();
3735
- (0, import_log11.log)("accepted identity", {
3612
+ (0, import_log10.log)("accepted identity", {
3736
3613
  identityKey: identity.identityKey,
3737
3614
  deviceKey: identity.deviceKey
3738
3615
  }, {
@@ -3860,7 +3737,7 @@ var IdentityManager = class {
3860
3737
  ""
3861
3738
  ]
3862
3739
  });
3863
- (0, import_log11.log)("constructing identity", {
3740
+ (0, import_log10.log)("constructing identity", {
3864
3741
  identityRecord
3865
3742
  }, {
3866
3743
  F: __dxlog_file12,
@@ -3924,7 +3801,7 @@ var IdentityManager = class {
3924
3801
  edgeConnection: this._edgeConnection,
3925
3802
  edgeFeatures: this._edgeFeatures
3926
3803
  });
3927
- (0, import_log11.log)("done", {
3804
+ (0, import_log10.log)("done", {
3928
3805
  identityKey: identityRecord.identityKey
3929
3806
  }, {
3930
3807
  F: __dxlog_file12,
@@ -3951,7 +3828,7 @@ var IdentityManager = class {
3951
3828
  }));
3952
3829
  },
3953
3830
  onAuthFailure: () => {
3954
- import_log11.log.warn("auth failure", void 0, {
3831
+ import_log10.log.warn("auth failure", void 0, {
3955
3832
  F: __dxlog_file12,
3956
3833
  L: 434,
3957
3834
  S: this,
@@ -4074,6 +3951,28 @@ var IdentityServiceImpl = class extends import_context9.Resource {
4074
3951
  nonce
4075
3952
  });
4076
3953
  }
3954
+ async createAuthCredential() {
3955
+ const identity = this._identityManager.identity;
3956
+ (0, import_invariant10.invariant)(identity, "Identity not initialized.", {
3957
+ F: __dxlog_file13,
3958
+ L: 117,
3959
+ S: this,
3960
+ A: [
3961
+ "identity",
3962
+ "'Identity not initialized.'"
3963
+ ]
3964
+ });
3965
+ return await (0, import_credentials16.createCredential)({
3966
+ assertion: {
3967
+ "@type": "dxos.halo.credentials.Auth"
3968
+ },
3969
+ issuer: identity.identityKey,
3970
+ subject: identity.identityKey,
3971
+ chain: identity.deviceCredentialChain,
3972
+ signingKey: identity.deviceKey,
3973
+ signer: this._keyring
3974
+ });
3975
+ }
4077
3976
  async _fixIdentityWithoutDefaultSpace(identity) {
4078
3977
  let recodedDefaultSpace = false;
4079
3978
  let foundDefaultSpace = false;
@@ -4090,11 +3989,11 @@ var IdentityServiceImpl = class extends import_context9.Resource {
4090
3989
  }
4091
3990
  if (await dataSpaceManager.isDefaultSpace(space)) {
4092
3991
  if (foundDefaultSpace) {
4093
- import_log12.log.warn("Multiple default spaces found. Using the first one.", {
3992
+ import_log11.log.warn("Multiple default spaces found. Using the first one.", {
4094
3993
  duplicate: space.id
4095
3994
  }, {
4096
3995
  F: __dxlog_file13,
4097
- L: 136,
3996
+ L: 151,
4098
3997
  S: this,
4099
3998
  C: (f, a) => f(...a)
4100
3999
  });
@@ -4106,9 +4005,9 @@ var IdentityServiceImpl = class extends import_context9.Resource {
4106
4005
  recordedDefaultSpaceTrigger.wake();
4107
4006
  }
4108
4007
  }, (err) => {
4109
- import_log12.log.catch(err, void 0, {
4008
+ import_log11.log.catch(err, void 0, {
4110
4009
  F: __dxlog_file13,
4111
- L: 147,
4010
+ L: 162,
4112
4011
  S: this,
4113
4012
  C: (f, a) => f(...a)
4114
4013
  });
@@ -4902,7 +4801,7 @@ var EdgeInvitationHandler = class {
4902
4801
  }
4903
4802
  handle(ctx, guardedState, protocol, deviceProfile) {
4904
4803
  if (!this._client) {
4905
- (0, import_log14.log)("edge disabled", void 0, {
4804
+ (0, import_log13.log)("edge disabled", void 0, {
4906
4805
  F: __dxlog_file16,
4907
4806
  L: 66,
4908
4807
  S: this,
@@ -4914,7 +4813,7 @@ var EdgeInvitationHandler = class {
4914
4813
  const spaceId = invitation.spaceId;
4915
4814
  const canBeHandledByEdge = invitation.authMethod !== import_services12.Invitation.AuthMethod.SHARED_SECRET && invitation.type === import_services12.Invitation.Type.DELEGATED && invitation.kind === import_services12.Invitation.Kind.SPACE && spaceId != null && import_keys11.SpaceId.isValid(spaceId);
4916
4815
  if (!canBeHandledByEdge) {
4917
- (0, import_log14.log)("invitation could not be handled by edge", {
4816
+ (0, import_log13.log)("invitation could not be handled by edge", {
4918
4817
  invitation
4919
4818
  }, {
4920
4819
  F: __dxlog_file16,
@@ -4937,7 +4836,7 @@ var EdgeInvitationHandler = class {
4937
4836
  await this._handleSpaceInvitationFlow(ctx, guardedState, admissionRequest.space, spaceId);
4938
4837
  } catch (error) {
4939
4838
  if (error instanceof import_protocols10.EdgeCallFailedError) {
4940
- import_log14.log.info("join space with edge unsuccessful", {
4839
+ import_log13.log.info("join space with edge unsuccessful", {
4941
4840
  reason: error.message,
4942
4841
  retryable: error.isRetryable,
4943
4842
  after: error.retryAfterMs ?? this._calculateNextRetryMs()
@@ -4951,7 +4850,7 @@ var EdgeInvitationHandler = class {
4951
4850
  (0, import_async16.scheduleTask)(ctx, tryHandleInvitation, error.retryAfterMs ?? this._calculateNextRetryMs());
4952
4851
  }
4953
4852
  } else if (requestCount < MAX_RETRIES_PER_INVITATION) {
4954
- import_log14.log.info("failed to handle invitation with edge", {
4853
+ import_log13.log.info("failed to handle invitation with edge", {
4955
4854
  error
4956
4855
  }, {
4957
4856
  F: __dxlog_file16,
@@ -4968,14 +4867,14 @@ var EdgeInvitationHandler = class {
4968
4867
  }
4969
4868
  async _handleSpaceInvitationFlow(ctx, guardedState, admissionRequest, spaceId) {
4970
4869
  try {
4971
- (0, import_log14.log)("edge invitation flow", void 0, {
4870
+ (0, import_log13.log)("edge invitation flow", void 0, {
4972
4871
  F: __dxlog_file16,
4973
4872
  L: 123,
4974
4873
  S: this,
4975
4874
  C: (f, a) => f(...a)
4976
4875
  });
4977
4876
  this._flowLock = await tryAcquireBeforeContextDisposed(ctx, guardedState.mutex);
4978
- import_log14.log.verbose("edge invitation flow acquired the lock", void 0, {
4877
+ import_log13.log.verbose("edge invitation flow acquired the lock", void 0, {
4979
4878
  F: __dxlog_file16,
4980
4879
  L: 125,
4981
4880
  S: this,
@@ -5098,14 +4997,14 @@ var InvitationGuestExtension = class extends import_teleport2.RpcExtension {
5098
4997
  async onOpen(context) {
5099
4998
  await super.onOpen(context);
5100
4999
  try {
5101
- import_log15.log.verbose("guest acquire lock", void 0, {
5000
+ import_log14.log.verbose("guest acquire lock", void 0, {
5102
5001
  F: __dxlog_file17,
5103
5002
  L: 89,
5104
5003
  S: this,
5105
5004
  C: (f, a) => f(...a)
5106
5005
  });
5107
5006
  this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
5108
- import_log15.log.verbose("guest lock acquired", void 0, {
5007
+ import_log14.log.verbose("guest lock acquired", void 0, {
5109
5008
  F: __dxlog_file17,
5110
5009
  L: 91,
5111
5010
  S: this,
@@ -5114,7 +5013,7 @@ var InvitationGuestExtension = class extends import_teleport2.RpcExtension {
5114
5013
  await (0, import_context12.cancelWithContext)(this._ctx, this.rpc.InvitationHostService.options({
5115
5014
  role: import_invitations3.InvitationOptions.Role.GUEST
5116
5015
  }));
5117
- import_log15.log.verbose("options sent", void 0, {
5016
+ import_log14.log.verbose("options sent", void 0, {
5118
5017
  F: __dxlog_file17,
5119
5018
  L: 96,
5120
5019
  S: this,
@@ -5123,7 +5022,7 @@ var InvitationGuestExtension = class extends import_teleport2.RpcExtension {
5123
5022
  await (0, import_context12.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
5124
5023
  timeout: OPTIONS_TIMEOUT
5125
5024
  }));
5126
- import_log15.log.verbose("options received", void 0, {
5025
+ import_log14.log.verbose("options received", void 0, {
5127
5026
  F: __dxlog_file17,
5128
5027
  L: 98,
5129
5028
  S: this,
@@ -5157,7 +5056,7 @@ var InvitationGuestExtension = class extends import_teleport2.RpcExtension {
5157
5056
  if (this._invitationFlowLock != null) {
5158
5057
  this._invitationFlowLock.release();
5159
5058
  this._invitationFlowLock = null;
5160
- import_log15.log.verbose("invitation flow lock released", void 0, {
5059
+ import_log14.log.verbose("invitation flow lock released", void 0, {
5161
5060
  F: __dxlog_file17,
5162
5061
  L: 131,
5163
5062
  S: this,
@@ -5217,7 +5116,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5217
5116
  introduce: async (request) => {
5218
5117
  const { profile, invitationId } = request;
5219
5118
  const traceId = import_keys12.PublicKey.random().toHex();
5220
- import_log16.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols12.trace.begin({
5119
+ import_log15.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols12.trace.begin({
5221
5120
  id: traceId
5222
5121
  }), {
5223
5122
  F: __dxlog_file18,
@@ -5228,7 +5127,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5228
5127
  const invitation = this._requireActiveInvitation();
5229
5128
  this._assertInvitationState(import_services14.Invitation.State.CONNECTED);
5230
5129
  if (invitationId !== invitation?.invitationId) {
5231
- import_log16.log.warn("incorrect invitationId", {
5130
+ import_log15.log.warn("incorrect invitationId", {
5232
5131
  expected: invitation.invitationId,
5233
5132
  actual: invitationId
5234
5133
  }, {
@@ -5243,7 +5142,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5243
5142
  authMethod: import_services14.Invitation.AuthMethod.NONE
5244
5143
  };
5245
5144
  }
5246
- import_log16.log.verbose("guest introduced themselves", {
5145
+ import_log15.log.verbose("guest introduced themselves", {
5247
5146
  guestProfile: profile
5248
5147
  }, {
5249
5148
  F: __dxlog_file18,
@@ -5254,7 +5153,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5254
5153
  this.guestProfile = profile;
5255
5154
  this._callbacks.onStateUpdate(import_services14.Invitation.State.READY_FOR_AUTHENTICATION);
5256
5155
  this._challenge = invitation.authMethod === import_services14.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? (0, import_crypto3.randomBytes)(32) : void 0;
5257
- import_log16.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols12.trace.end({
5156
+ import_log15.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols12.trace.end({
5258
5157
  id: traceId
5259
5158
  }), {
5260
5159
  F: __dxlog_file18,
@@ -5269,7 +5168,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5269
5168
  },
5270
5169
  authenticate: async ({ authCode: code, signedChallenge }) => {
5271
5170
  const traceId = import_keys12.PublicKey.random().toHex();
5272
- import_log16.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols12.trace.begin({
5171
+ import_log15.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols12.trace.begin({
5273
5172
  id: traceId
5274
5173
  }), {
5275
5174
  F: __dxlog_file18,
@@ -5278,7 +5177,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5278
5177
  C: (f, a) => f(...a)
5279
5178
  });
5280
5179
  const invitation = this._requireActiveInvitation();
5281
- import_log16.log.verbose("received authentication request", {
5180
+ import_log15.log.verbose("received authentication request", {
5282
5181
  authCode: code
5283
5182
  }, {
5284
5183
  F: __dxlog_file18,
@@ -5294,7 +5193,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5294
5193
  this._callbacks.onStateUpdate(import_services14.Invitation.State.AUTHENTICATING);
5295
5194
  switch (invitation.authMethod) {
5296
5195
  case import_services14.Invitation.AuthMethod.NONE: {
5297
- (0, import_log16.log)("authentication not required", void 0, {
5196
+ (0, import_log15.log)("authentication not required", void 0, {
5298
5197
  F: __dxlog_file18,
5299
5198
  L: 154,
5300
5199
  S: this,
@@ -5330,7 +5229,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5330
5229
  break;
5331
5230
  }
5332
5231
  default: {
5333
- import_log16.log.error("invalid authentication method", {
5232
+ import_log15.log.error("invalid authentication method", {
5334
5233
  authMethod: invitation.authMethod
5335
5234
  }, {
5336
5235
  F: __dxlog_file18,
@@ -5352,7 +5251,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5352
5251
  status
5353
5252
  };
5354
5253
  }
5355
- import_log16.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols12.trace.end({
5254
+ import_log15.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols12.trace.end({
5356
5255
  id: traceId,
5357
5256
  data: {
5358
5257
  status
@@ -5369,7 +5268,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5369
5268
  },
5370
5269
  admit: async (request) => {
5371
5270
  const traceId = import_keys12.PublicKey.random().toHex();
5372
- import_log16.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols12.trace.begin({
5271
+ import_log15.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols12.trace.begin({
5373
5272
  id: traceId
5374
5273
  }), {
5375
5274
  F: __dxlog_file18,
@@ -5386,7 +5285,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5386
5285
  }
5387
5286
  }
5388
5287
  const response = await this._callbacks.admit(request);
5389
- import_log16.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols12.trace.end({
5288
+ import_log15.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols12.trace.end({
5390
5289
  id: traceId
5391
5290
  }), {
5392
5291
  F: __dxlog_file18,
@@ -5406,14 +5305,14 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5406
5305
  async onOpen(context) {
5407
5306
  await super.onOpen(context);
5408
5307
  try {
5409
- import_log16.log.verbose("host acquire lock", void 0, {
5308
+ import_log15.log.verbose("host acquire lock", void 0, {
5410
5309
  F: __dxlog_file18,
5411
5310
  L: 239,
5412
5311
  S: this,
5413
5312
  C: (f, a) => f(...a)
5414
5313
  });
5415
5314
  this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
5416
- import_log16.log.verbose("host lock acquired", void 0, {
5315
+ import_log15.log.verbose("host lock acquired", void 0, {
5417
5316
  F: __dxlog_file18,
5418
5317
  L: 241,
5419
5318
  S: this,
@@ -5423,7 +5322,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5423
5322
  await this.rpc.InvitationHostService.options({
5424
5323
  role: import_invitations4.InvitationOptions.Role.HOST
5425
5324
  });
5426
- import_log16.log.verbose("options sent", void 0, {
5325
+ import_log15.log.verbose("options sent", void 0, {
5427
5326
  F: __dxlog_file18,
5428
5327
  L: 244,
5429
5328
  S: this,
@@ -5432,7 +5331,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5432
5331
  await (0, import_context13.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
5433
5332
  timeout: OPTIONS_TIMEOUT2
5434
5333
  }));
5435
- import_log16.log.verbose("options received", void 0, {
5334
+ import_log15.log.verbose("options received", void 0, {
5436
5335
  F: __dxlog_file18,
5437
5336
  L: 246,
5438
5337
  S: this,
@@ -5485,7 +5384,7 @@ var InvitationHostExtension = class extends import_teleport3.RpcExtension {
5485
5384
  if (this._invitationFlowLock != null) {
5486
5385
  this._invitationFlowLock?.release();
5487
5386
  this._invitationFlowLock = null;
5488
- import_log16.log.verbose("invitation flow lock released", void 0, {
5387
+ import_log15.log.verbose("invitation flow lock released", void 0, {
5489
5388
  F: __dxlog_file18,
5490
5389
  L: 299,
5491
5390
  S: this,
@@ -5562,14 +5461,14 @@ var logStateUpdate = (invitation, actor, newState, error) => {
5562
5461
  errorStack: error?.stack
5563
5462
  };
5564
5463
  if (isNonTerminalState(newState)) {
5565
- import_log17.log.verbose("dxos.sdk.invitations-handler.state.update", logContext, {
5464
+ import_log16.log.verbose("dxos.sdk.invitations-handler.state.update", logContext, {
5566
5465
  F: __dxlog_file19,
5567
5466
  L: 98,
5568
5467
  S: void 0,
5569
5468
  C: (f, a) => f(...a)
5570
5469
  });
5571
5470
  } else {
5572
- import_log17.log.info("dxos.sdk.invitations-handler.state.update", logContext, {
5471
+ import_log16.log.info("dxos.sdk.invitations-handler.state.update", logContext, {
5573
5472
  F: __dxlog_file19,
5574
5473
  L: 100,
5575
5474
  S: void 0,
@@ -5625,7 +5524,7 @@ var InvitationTopology = class {
5625
5524
  const firstUnknownPeer = candidates.find((peerId) => !this._seenPeers.has(peerId));
5626
5525
  this._seenPeers = new import_util11.ComplexSet(import_keys13.PublicKey.hash, allPeers.filter((peerId) => this._seenPeers.has(peerId)));
5627
5526
  if (firstUnknownPeer != null) {
5628
- (0, import_log18.log)("invitation connect", {
5527
+ (0, import_log17.log)("invitation connect", {
5629
5528
  ownPeerId,
5630
5529
  remotePeerId: firstUnknownPeer
5631
5530
  }, {
@@ -5670,7 +5569,7 @@ var InvitationsHandler = class {
5670
5569
  this._connectionParams = _connectionParams;
5671
5570
  }
5672
5571
  handleInvitationFlow(ctx, stream, protocol, invitation) {
5673
- import_log13.log.verbose("dxos.sdk.invitations-handler.handleInvitationFlow", {
5572
+ import_log12.log.verbose("dxos.sdk.invitations-handler.handleInvitationFlow", {
5674
5573
  state: invitation.state,
5675
5574
  invitationId: invitation.invitationId,
5676
5575
  kind: invitation.kind,
@@ -5696,7 +5595,7 @@ var InvitationsHandler = class {
5696
5595
  },
5697
5596
  admit: async (admissionRequest) => {
5698
5597
  try {
5699
- import_log13.log.verbose("dxos.sdk.invitations-handler.host.admit", {
5598
+ import_log12.log.verbose("dxos.sdk.invitations-handler.host.admit", {
5700
5599
  invitationId: invitation.invitationId,
5701
5600
  ...protocol.toJSON()
5702
5601
  }, {
@@ -5733,7 +5632,7 @@ var InvitationsHandler = class {
5733
5632
  (0, import_async15.scheduleTask)(connectionCtx, async () => {
5734
5633
  const traceId = import_keys10.PublicKey.random().toHex();
5735
5634
  try {
5736
- import_log13.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols9.trace.begin({
5635
+ import_log12.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols9.trace.begin({
5737
5636
  id: traceId
5738
5637
  }), {
5739
5638
  F: __dxlog_file21,
@@ -5741,7 +5640,7 @@ var InvitationsHandler = class {
5741
5640
  S: this,
5742
5641
  C: (f, a) => f(...a)
5743
5642
  });
5744
- import_log13.log.verbose("connected", {
5643
+ import_log12.log.verbose("connected", {
5745
5644
  ...protocol.toJSON()
5746
5645
  }, {
5747
5646
  F: __dxlog_file21,
@@ -5752,7 +5651,7 @@ var InvitationsHandler = class {
5752
5651
  const deviceKey = await extension.completedTrigger.wait({
5753
5652
  timeout: invitation.timeout
5754
5653
  });
5755
- import_log13.log.verbose("admitted guest", {
5654
+ import_log12.log.verbose("admitted guest", {
5756
5655
  guest: deviceKey,
5757
5656
  ...protocol.toJSON()
5758
5657
  }, {
@@ -5763,7 +5662,7 @@ var InvitationsHandler = class {
5763
5662
  });
5764
5663
  guardedState.set(extension, import_services11.Invitation.State.SUCCESS);
5765
5664
  metrics.increment("dxos.invitation.success");
5766
- import_log13.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols9.trace.end({
5665
+ import_log12.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols9.trace.end({
5767
5666
  id: traceId
5768
5667
  }), {
5769
5668
  F: __dxlog_file21,
@@ -5780,7 +5679,7 @@ var InvitationsHandler = class {
5780
5679
  if (err instanceof import_async15.TimeoutError) {
5781
5680
  if (stateChanged) {
5782
5681
  metrics.increment("dxos.invitation.timeout");
5783
- import_log13.log.verbose("timeout", {
5682
+ import_log12.log.verbose("timeout", {
5784
5683
  ...protocol.toJSON()
5785
5684
  }, {
5786
5685
  F: __dxlog_file21,
@@ -5792,7 +5691,7 @@ var InvitationsHandler = class {
5792
5691
  } else {
5793
5692
  if (stateChanged) {
5794
5693
  metrics.increment("dxos.invitation.failed");
5795
- import_log13.log.error("failed", err, {
5694
+ import_log12.log.error("failed", err, {
5796
5695
  F: __dxlog_file21,
5797
5696
  L: 159,
5798
5697
  S: this,
@@ -5800,7 +5699,7 @@ var InvitationsHandler = class {
5800
5699
  });
5801
5700
  }
5802
5701
  }
5803
- import_log13.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols9.trace.error({
5702
+ import_log12.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols9.trace.error({
5804
5703
  id: traceId,
5805
5704
  error: err
5806
5705
  }), {
@@ -5816,7 +5715,7 @@ var InvitationsHandler = class {
5816
5715
  onError: (err) => {
5817
5716
  const stateChanged = guardedState.set(extension, import_services11.Invitation.State.CONNECTING);
5818
5717
  if (err instanceof import_protocols9.InvalidInvitationExtensionRoleError) {
5819
- (0, import_log13.log)("invalid role", {
5718
+ (0, import_log12.log)("invalid role", {
5820
5719
  ...err.context
5821
5720
  }, {
5822
5721
  F: __dxlog_file21,
@@ -5829,7 +5728,7 @@ var InvitationsHandler = class {
5829
5728
  if (err instanceof import_async15.TimeoutError) {
5830
5729
  if (stateChanged) {
5831
5730
  metrics.increment("dxos.invitation.timeout");
5832
- import_log13.log.verbose("timeout", {
5731
+ import_log12.log.verbose("timeout", {
5833
5732
  err
5834
5733
  }, {
5835
5734
  F: __dxlog_file21,
@@ -5841,7 +5740,7 @@ var InvitationsHandler = class {
5841
5740
  } else {
5842
5741
  if (stateChanged) {
5843
5742
  metrics.increment("dxos.invitation.failed");
5844
- import_log13.log.error("failed", err, {
5743
+ import_log12.log.error("failed", err, {
5845
5744
  F: __dxlog_file21,
5846
5745
  L: 182,
5847
5746
  S: this,
@@ -5855,14 +5754,14 @@ var InvitationsHandler = class {
5855
5754
  };
5856
5755
  if (invitation.lifetime && invitation.created) {
5857
5756
  if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
5858
- import_log13.log.warn("invitation has already expired", void 0, {
5757
+ import_log12.log.warn("invitation has already expired", void 0, {
5859
5758
  F: __dxlog_file21,
5860
5759
  L: 193,
5861
5760
  S: this,
5862
5761
  C: (f, a) => f(...a)
5863
5762
  });
5864
5763
  guardedState.set(null, import_services11.Invitation.State.EXPIRED);
5865
- void ctx.dispose().catch((err) => import_log13.log.catch(err, void 0, {
5764
+ void ctx.dispose().catch((err) => import_log12.log.catch(err, void 0, {
5866
5765
  F: __dxlog_file21,
5867
5766
  L: 195,
5868
5767
  S: this,
@@ -5884,7 +5783,7 @@ var InvitationsHandler = class {
5884
5783
  });
5885
5784
  }
5886
5785
  acceptInvitation(ctx, stream, protocol, invitation, otpEnteredTrigger, deviceProfile) {
5887
- import_log13.log.verbose("dxos.sdk.invitations-handler.acceptInvitation", {
5786
+ import_log12.log.verbose("dxos.sdk.invitations-handler.acceptInvitation", {
5888
5787
  state: invitation.state,
5889
5788
  invitationId: invitation.invitationId,
5890
5789
  kind: invitation.kind,
@@ -5911,7 +5810,7 @@ var InvitationsHandler = class {
5911
5810
  const guardedState = createGuardedInvitationState(ctx, invitation, stream);
5912
5811
  const shouldCancelInvitationFlow = (extension) => {
5913
5812
  const isLockedByAnotherConnection = guardedState.mutex.isLocked() && !extension.hasFlowLock();
5914
- (0, import_log13.log)("should cancel invitation flow", {
5813
+ (0, import_log12.log)("should cancel invitation flow", {
5915
5814
  isLockedByAnotherConnection,
5916
5815
  invitationType: import_services11.Invitation.Type.DELEGATED,
5917
5816
  triedPeers: triedPeersIds.size
@@ -5939,7 +5838,7 @@ var InvitationsHandler = class {
5939
5838
  return;
5940
5839
  }
5941
5840
  connectionCtx.onDispose(async () => {
5942
- import_log13.log.verbose("extension disposed", {
5841
+ import_log12.log.verbose("extension disposed", {
5943
5842
  admitted,
5944
5843
  currentState: guardedState.current.state
5945
5844
  }, {
@@ -5958,7 +5857,7 @@ var InvitationsHandler = class {
5958
5857
  (0, import_async15.scheduleTask)(connectionCtx, async () => {
5959
5858
  const traceId = import_keys10.PublicKey.random().toHex();
5960
5859
  try {
5961
- import_log13.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols9.trace.begin({
5860
+ import_log12.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols9.trace.begin({
5962
5861
  id: traceId
5963
5862
  }), {
5964
5863
  F: __dxlog_file21,
@@ -5970,7 +5869,7 @@ var InvitationsHandler = class {
5970
5869
  guardedState.set(extension, import_services11.Invitation.State.TIMEOUT);
5971
5870
  extensionCtx.close();
5972
5871
  }, timeout);
5973
- import_log13.log.verbose("dxos.sdk.invitations-handler.guest.connected", {
5872
+ import_log12.log.verbose("dxos.sdk.invitations-handler.guest.connected", {
5974
5873
  ...protocol.toJSON()
5975
5874
  }, {
5976
5875
  F: __dxlog_file21,
@@ -5979,7 +5878,7 @@ var InvitationsHandler = class {
5979
5878
  C: (f, a) => f(...a)
5980
5879
  });
5981
5880
  guardedState.set(extension, import_services11.Invitation.State.CONNECTED);
5982
- import_log13.log.verbose("dxos.sdk.invitations-handler.guest.introduce", {
5881
+ import_log12.log.verbose("dxos.sdk.invitations-handler.guest.introduce", {
5983
5882
  invitationId: invitation.invitationId,
5984
5883
  ...protocol.toJSON()
5985
5884
  }, {
@@ -5992,7 +5891,7 @@ var InvitationsHandler = class {
5992
5891
  invitationId: invitation.invitationId,
5993
5892
  ...protocol.createIntroduction()
5994
5893
  });
5995
- import_log13.log.verbose("dxos.sdk.invitations-handler.guest.introduce-response", {
5894
+ import_log12.log.verbose("dxos.sdk.invitations-handler.guest.introduce-response", {
5996
5895
  invitationId: invitation.invitationId,
5997
5896
  ...protocol.toJSON(),
5998
5897
  authMethod: introductionResponse.authMethod
@@ -6015,7 +5914,7 @@ var InvitationsHandler = class {
6015
5914
  break;
6016
5915
  }
6017
5916
  }
6018
- import_log13.log.verbose("dxos.sdk.invitations-handler.guest.request-admission", {
5917
+ import_log12.log.verbose("dxos.sdk.invitations-handler.guest.request-admission", {
6019
5918
  invitationId: invitation.invitationId,
6020
5919
  ...protocol.toJSON()
6021
5920
  }, {
@@ -6028,7 +5927,7 @@ var InvitationsHandler = class {
6028
5927
  const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
6029
5928
  admitted = true;
6030
5929
  const result = await protocol.accept(admissionResponse, admissionRequest);
6031
- import_log13.log.verbose("dxos.sdk.invitations-handler.guest.admitted-by-host", {
5930
+ import_log12.log.verbose("dxos.sdk.invitations-handler.guest.admitted-by-host", {
6032
5931
  invitationId: invitation.invitationId,
6033
5932
  ...protocol.toJSON()
6034
5933
  }, {
@@ -6042,7 +5941,7 @@ var InvitationsHandler = class {
6042
5941
  ...result,
6043
5942
  state: import_services11.Invitation.State.SUCCESS
6044
5943
  });
6045
- import_log13.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols9.trace.end({
5944
+ import_log12.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols9.trace.end({
6046
5945
  id: traceId
6047
5946
  }), {
6048
5947
  F: __dxlog_file21,
@@ -6052,7 +5951,7 @@ var InvitationsHandler = class {
6052
5951
  });
6053
5952
  } catch (err) {
6054
5953
  if (err instanceof import_async15.TimeoutError) {
6055
- import_log13.log.verbose("timeout", {
5954
+ import_log12.log.verbose("timeout", {
6056
5955
  ...protocol.toJSON()
6057
5956
  }, {
6058
5957
  F: __dxlog_file21,
@@ -6062,7 +5961,7 @@ var InvitationsHandler = class {
6062
5961
  });
6063
5962
  guardedState.set(extension, import_services11.Invitation.State.TIMEOUT);
6064
5963
  } else {
6065
- import_log13.log.verbose("auth failed", err, {
5964
+ import_log12.log.verbose("auth failed", err, {
6066
5965
  F: __dxlog_file21,
6067
5966
  L: 365,
6068
5967
  S: this,
@@ -6071,7 +5970,7 @@ var InvitationsHandler = class {
6071
5970
  guardedState.error(extension, err);
6072
5971
  }
6073
5972
  extensionCtx.close(err);
6074
- import_log13.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols9.trace.error({
5973
+ import_log12.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols9.trace.error({
6075
5974
  id: traceId,
6076
5975
  error: err
6077
5976
  }), {
@@ -6088,7 +5987,7 @@ var InvitationsHandler = class {
6088
5987
  return;
6089
5988
  }
6090
5989
  if (err instanceof import_async15.TimeoutError) {
6091
- import_log13.log.verbose("timeout", {
5990
+ import_log12.log.verbose("timeout", {
6092
5991
  ...protocol.toJSON()
6093
5992
  }, {
6094
5993
  F: __dxlog_file21,
@@ -6098,7 +5997,7 @@ var InvitationsHandler = class {
6098
5997
  });
6099
5998
  guardedState.set(extension, import_services11.Invitation.State.TIMEOUT);
6100
5999
  } else {
6101
- import_log13.log.verbose("auth failed", err, {
6000
+ import_log12.log.verbose("auth failed", err, {
6102
6001
  F: __dxlog_file21,
6103
6002
  L: 381,
6104
6003
  S: this,
@@ -6113,7 +6012,7 @@ var InvitationsHandler = class {
6113
6012
  const edgeInvitationHandler = new EdgeInvitationHandler(this._connectionParams?.edgeInvitations, this._edgeClient, {
6114
6013
  onInvitationSuccess: async (admissionResponse, admissionRequest) => {
6115
6014
  const result = await protocol.accept(admissionResponse, admissionRequest);
6116
- import_log13.log.info("admitted by edge", {
6015
+ import_log12.log.info("admitted by edge", {
6117
6016
  ...protocol.toJSON()
6118
6017
  }, {
6119
6018
  F: __dxlog_file21,
@@ -6179,7 +6078,7 @@ var InvitationsHandler = class {
6179
6078
  }
6180
6079
  async _handleGuestOtpAuth(extension, setState, authenticated, options) {
6181
6080
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
6182
- (0, import_log13.log)("guest waiting for authentication code...", void 0, {
6081
+ (0, import_log12.log)("guest waiting for authentication code...", void 0, {
6183
6082
  F: __dxlog_file21,
6184
6083
  L: 457,
6185
6084
  S: this,
@@ -6187,7 +6086,7 @@ var InvitationsHandler = class {
6187
6086
  });
6188
6087
  setState(import_services11.Invitation.State.READY_FOR_AUTHENTICATION);
6189
6088
  const authCode = await authenticated.wait(options);
6190
- (0, import_log13.log)("sending authentication request", void 0, {
6089
+ (0, import_log12.log)("sending authentication request", void 0, {
6191
6090
  F: __dxlog_file21,
6192
6091
  L: 461,
6193
6092
  S: this,
@@ -6204,7 +6103,7 @@ var InvitationsHandler = class {
6204
6103
  if (attempt === MAX_OTP_ATTEMPTS) {
6205
6104
  throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
6206
6105
  } else {
6207
- (0, import_log13.log)("retrying invalid code", {
6106
+ (0, import_log12.log)("retrying invalid code", {
6208
6107
  attempt
6209
6108
  }, {
6210
6109
  F: __dxlog_file21,
@@ -6224,7 +6123,7 @@ var InvitationsHandler = class {
6224
6123
  if (introductionResponse.challenge == null) {
6225
6124
  throw new Error("challenge missing in the introduction");
6226
6125
  }
6227
- (0, import_log13.log)("sending authentication request", void 0, {
6126
+ (0, import_log12.log)("sending authentication request", void 0, {
6228
6127
  F: __dxlog_file21,
6229
6128
  L: 491,
6230
6129
  S: this,
@@ -6406,7 +6305,7 @@ var SpaceInvitationProtocol = class {
6406
6305
  ""
6407
6306
  ]
6408
6307
  });
6409
- (0, import_log19.log)("writing guest credentials", {
6308
+ (0, import_log18.log)("writing guest credentials", {
6410
6309
  host: this._signingContext.deviceKey,
6411
6310
  guest: request.space.deviceKey
6412
6311
  }, {
@@ -6461,7 +6360,7 @@ var SpaceInvitationProtocol = class {
6461
6360
  ]
6462
6361
  });
6463
6362
  }
6464
- (0, import_log19.log)("writing delegate space invitation", {
6363
+ (0, import_log18.log)("writing delegate space invitation", {
6465
6364
  host: this._signingContext.deviceKey,
6466
6365
  id: invitation.invitationId
6467
6366
  }, {
@@ -6522,7 +6421,7 @@ var SpaceInvitationProtocol = class {
6522
6421
  ""
6523
6422
  ]
6524
6423
  });
6525
- (0, import_log19.log)("cancelling delegated space invitation", {
6424
+ (0, import_log18.log)("cancelling delegated space invitation", {
6526
6425
  host: this._signingContext.deviceKey,
6527
6426
  id: invitation.invitationId
6528
6427
  }, {
@@ -6657,7 +6556,7 @@ var InvitationsManager = class {
6657
6556
  try {
6658
6557
  await this._persistIfRequired(handler, stream, invitation);
6659
6558
  } catch (err) {
6660
- import_log20.log.catch(err, void 0, {
6559
+ import_log19.log.catch(err, void 0, {
6661
6560
  F: __dxlog_file23,
6662
6561
  L: 82,
6663
6562
  S: this,
@@ -6678,7 +6577,7 @@ var InvitationsManager = class {
6678
6577
  }
6679
6578
  try {
6680
6579
  const persistentInvitations = this._metadataStore.getInvitations();
6681
- const freshInvitations = persistentInvitations.filter((invitation) => !(0, import_echo_pipeline4.hasInvitationExpired)(invitation));
6580
+ const freshInvitations = persistentInvitations.filter((invitation) => !(0, import_echo_pipeline3.hasInvitationExpired)(invitation));
6682
6581
  const loadTasks = freshInvitations.map((persistentInvitation) => {
6683
6582
  (0, import_invariant18.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
6684
6583
  F: __dxlog_file23,
@@ -6699,7 +6598,7 @@ var InvitationsManager = class {
6699
6598
  invitations: cInvitations.map((invitation) => invitation.get())
6700
6599
  };
6701
6600
  } catch (err) {
6702
- import_log20.log.catch(err, void 0, {
6601
+ import_log19.log.catch(err, void 0, {
6703
6602
  F: __dxlog_file23,
6704
6603
  L: 110,
6705
6604
  S: this,
@@ -6731,7 +6630,7 @@ var InvitationsManager = class {
6731
6630
  return invitation;
6732
6631
  }
6733
6632
  async authenticate({ invitationId, authCode }) {
6734
- (0, import_log20.log)("authenticating...", void 0, {
6633
+ (0, import_log19.log)("authenticating...", void 0, {
6735
6634
  F: __dxlog_file23,
6736
6635
  L: 140,
6737
6636
  S: this,
@@ -6748,7 +6647,7 @@ var InvitationsManager = class {
6748
6647
  });
6749
6648
  const observable = this._acceptInvitations.get(invitationId);
6750
6649
  if (!observable) {
6751
- import_log20.log.warn("invalid invitation", {
6650
+ import_log19.log.warn("invalid invitation", {
6752
6651
  invitationId
6753
6652
  }, {
6754
6653
  F: __dxlog_file23,
@@ -6761,7 +6660,7 @@ var InvitationsManager = class {
6761
6660
  }
6762
6661
  }
6763
6662
  async cancelInvitation({ invitationId }) {
6764
- (0, import_log20.log)("cancelInvitation...", {
6663
+ (0, import_log19.log)("cancelInvitation...", {
6765
6664
  invitationId
6766
6665
  }, {
6767
6666
  F: __dxlog_file23,
@@ -6850,7 +6749,7 @@ var InvitationsManager = class {
6850
6749
  L: 236
6851
6750
  });
6852
6751
  ctx.onDispose(() => {
6853
- (0, import_log20.log)("complete", {
6752
+ (0, import_log19.log)("complete", {
6854
6753
  ...handler.toJSON()
6855
6754
  }, {
6856
6755
  F: __dxlog_file23,
@@ -6883,7 +6782,7 @@ var InvitationsManager = class {
6883
6782
  const ctx = new import_context14.Context({
6884
6783
  onError: (err) => {
6885
6784
  if (err instanceof import_async20.TimeoutError) {
6886
- (0, import_log20.log)("timeout", {
6785
+ (0, import_log19.log)("timeout", {
6887
6786
  ...handler.toJSON()
6888
6787
  }, {
6889
6788
  F: __dxlog_file23,
@@ -6896,7 +6795,7 @@ var InvitationsManager = class {
6896
6795
  state: import_services18.Invitation.State.TIMEOUT
6897
6796
  });
6898
6797
  } else {
6899
- import_log20.log.warn("auth failed", err, {
6798
+ import_log19.log.warn("auth failed", err, {
6900
6799
  F: __dxlog_file23,
6901
6800
  L: 266,
6902
6801
  S: this,
@@ -6914,7 +6813,7 @@ var InvitationsManager = class {
6914
6813
  L: 260
6915
6814
  });
6916
6815
  ctx.onDispose(() => {
6917
- (0, import_log20.log)("complete", {
6816
+ (0, import_log19.log)("complete", {
6918
6817
  ...handler.toJSON()
6919
6818
  }, {
6920
6819
  F: __dxlog_file23,
@@ -6961,7 +6860,7 @@ var InvitationsManager = class {
6961
6860
  try {
6962
6861
  await this._metadataStore.removeInvitation(invitation.invitationId);
6963
6862
  } catch (err) {
6964
- import_log20.log.catch(err, void 0, {
6863
+ import_log19.log.catch(err, void 0, {
6965
6864
  F: __dxlog_file23,
6966
6865
  L: 309,
6967
6866
  S: this,
@@ -6992,7 +6891,7 @@ var Lock = class {
6992
6891
  return this._lockPath;
6993
6892
  }
6994
6893
  async acquire() {
6995
- (0, import_log21.log)("acquiring lock...", void 0, {
6894
+ (0, import_log20.log)("acquiring lock...", void 0, {
6996
6895
  F: __dxlog_file24,
6997
6896
  L: 32,
6998
6897
  S: this,
@@ -7000,7 +6899,7 @@ var Lock = class {
7000
6899
  });
7001
6900
  this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
7002
6901
  await this._onAcquire?.();
7003
- (0, import_log21.log)("acquired lock", void 0, {
6902
+ (0, import_log20.log)("acquired lock", void 0, {
7004
6903
  F: __dxlog_file24,
7005
6904
  L: 37,
7006
6905
  S: this,
@@ -7022,7 +6921,7 @@ var Lock = class {
7022
6921
  }
7023
6922
  };
7024
6923
  _ts_decorate7([
7025
- import_log21.logInfo
6924
+ import_log20.logInfo
7026
6925
  ], Lock.prototype, "lockKey", null);
7027
6926
  var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
7028
6927
  function _ts_decorate8(decorators, target, key, desc) {
@@ -7105,6 +7004,7 @@ function _ts_decorate9(decorators, target, key, desc) {
7105
7004
  var __dxlog_file25 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/agents/edge-agent-manager.ts";
7106
7005
  var AGENT_STATUS_QUERY_RETRY_INTERVAL = 5e3;
7107
7006
  var AGENT_STATUS_QUERY_RETRY_JITTER = 1e3;
7007
+ var AGENT_FEED_ADDED_CHECK_INTERVAL_MS = 3e3;
7108
7008
  var EdgeAgentManager = class extends import_context15.Resource {
7109
7009
  constructor(_edgeFeatures, _edgeHttpClient, _dataSpaceManager, _identity) {
7110
7010
  super();
@@ -7124,7 +7024,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
7124
7024
  async createAgent() {
7125
7025
  (0, import_invariant20.invariant)(this.isOpen, void 0, {
7126
7026
  F: __dxlog_file25,
7127
- L: 52,
7027
+ L: 54,
7128
7028
  S: this,
7129
7029
  A: [
7130
7030
  "this.isOpen",
@@ -7133,7 +7033,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
7133
7033
  });
7134
7034
  (0, import_invariant20.invariant)(this._edgeHttpClient, void 0, {
7135
7035
  F: __dxlog_file25,
7136
- L: 53,
7036
+ L: 55,
7137
7037
  S: this,
7138
7038
  A: [
7139
7039
  "this._edgeHttpClient",
@@ -7142,7 +7042,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
7142
7042
  });
7143
7043
  (0, import_invariant20.invariant)(this._edgeFeatures?.agents, void 0, {
7144
7044
  F: __dxlog_file25,
7145
- L: 54,
7045
+ L: 56,
7146
7046
  S: this,
7147
7047
  A: [
7148
7048
  "this._edgeFeatures?.agents",
@@ -7161,9 +7061,9 @@ var EdgeAgentManager = class extends import_context15.Resource {
7161
7061
  // TODO: agents don't have data feed, should be removed
7162
7062
  dataFeedKey: import_keys15.PublicKey.random()
7163
7063
  });
7164
- (0, import_log22.log)("agent created", response, {
7064
+ (0, import_log21.log)("agent created", response, {
7165
7065
  F: __dxlog_file25,
7166
- L: 71,
7066
+ L: 73,
7167
7067
  S: this,
7168
7068
  C: (f, a) => f(...a)
7169
7069
  });
@@ -7171,11 +7071,11 @@ var EdgeAgentManager = class extends import_context15.Resource {
7171
7071
  }
7172
7072
  async _open() {
7173
7073
  const isEnabled = this._edgeHttpClient && this._edgeFeatures?.agents;
7174
- (0, import_log22.log)("edge agent manager open", {
7074
+ (0, import_log21.log)("edge agent manager open", {
7175
7075
  isEnabled
7176
7076
  }, {
7177
7077
  F: __dxlog_file25,
7178
- L: 79,
7078
+ L: 81,
7179
7079
  S: this,
7180
7080
  C: (f, a) => f(...a)
7181
7081
  });
@@ -7208,7 +7108,7 @@ var EdgeAgentManager = class extends import_context15.Resource {
7208
7108
  async _fetchAgentStatus() {
7209
7109
  (0, import_invariant20.invariant)(this._edgeHttpClient, void 0, {
7210
7110
  F: __dxlog_file25,
7211
- L: 113,
7111
+ L: 115,
7212
7112
  S: this,
7213
7113
  A: [
7214
7114
  "this._edgeHttpClient",
@@ -7216,9 +7116,9 @@ var EdgeAgentManager = class extends import_context15.Resource {
7216
7116
  ]
7217
7117
  });
7218
7118
  try {
7219
- (0, import_log22.log)("fetching agent status", void 0, {
7119
+ (0, import_log21.log)("fetching agent status", void 0, {
7220
7120
  F: __dxlog_file25,
7221
- L: 115,
7121
+ L: 117,
7222
7122
  S: this,
7223
7123
  C: (f, a) => f(...a)
7224
7124
  });
@@ -7233,11 +7133,11 @@ var EdgeAgentManager = class extends import_context15.Resource {
7233
7133
  } catch (err) {
7234
7134
  if (err instanceof import_protocols14.EdgeCallFailedError) {
7235
7135
  if (!err.isRetryable) {
7236
- import_log22.log.warn("non retryable error on agent status fetch attempt", {
7136
+ import_log21.log.warn("non retryable error on agent status fetch attempt", {
7237
7137
  err
7238
7138
  }, {
7239
7139
  F: __dxlog_file25,
7240
- L: 125,
7140
+ L: 127,
7241
7141
  S: this,
7242
7142
  C: (f, a) => f(...a)
7243
7143
  });
@@ -7245,12 +7145,12 @@ var EdgeAgentManager = class extends import_context15.Resource {
7245
7145
  }
7246
7146
  }
7247
7147
  const retryAfterMs = AGENT_STATUS_QUERY_RETRY_INTERVAL + Math.random() * AGENT_STATUS_QUERY_RETRY_JITTER;
7248
- import_log22.log.info("agent status fetching failed", {
7148
+ import_log21.log.info("agent status fetching failed", {
7249
7149
  err,
7250
7150
  retryAfterMs
7251
7151
  }, {
7252
7152
  F: __dxlog_file25,
7253
- L: 130,
7153
+ L: 132,
7254
7154
  S: this,
7255
7155
  C: (f, a) => f(...a)
7256
7156
  });
@@ -7263,27 +7163,37 @@ var EdgeAgentManager = class extends import_context15.Resource {
7263
7163
  * Instead, we stay in active polling mode while there are spaces where we don't see our agent's feed.
7264
7164
  */
7265
7165
  _ensureAgentIsInSpaces(agentDeviceKey) {
7166
+ let activePollingEnabled = false;
7266
7167
  for (const space of this._dataSpaceManager.spaces.values()) {
7168
+ if (space.getEdgeReplicationSetting() === import_metadata2.EdgeReplicationSetting.DISABLED) {
7169
+ space.notarizationPlugin.setActiveEdgePollingEnabled(false);
7170
+ continue;
7171
+ }
7267
7172
  if ([
7268
7173
  import_services19.SpaceState.SPACE_INACTIVE,
7269
7174
  import_services19.SpaceState.SPACE_CLOSED
7270
7175
  ].includes(space.state)) {
7176
+ space.notarizationPlugin.setActiveEdgePollingEnabled(false);
7271
7177
  continue;
7272
7178
  }
7273
7179
  const agentFeedNeedsNotarization = ![
7274
7180
  ...space.inner.spaceState.feeds.values()
7275
7181
  ].some((feed) => feed.assertion.deviceKey.equals(agentDeviceKey));
7276
7182
  space.notarizationPlugin.setActiveEdgePollingEnabled(agentFeedNeedsNotarization);
7277
- import_log22.log.info("set active edge polling", {
7183
+ activePollingEnabled = activePollingEnabled || agentFeedNeedsNotarization;
7184
+ import_log21.log.info("set active edge polling", {
7278
7185
  enabled: agentFeedNeedsNotarization,
7279
7186
  spaceId: space.id
7280
7187
  }, {
7281
7188
  F: __dxlog_file25,
7282
- L: 150,
7189
+ L: 159,
7283
7190
  S: this,
7284
7191
  C: (f, a) => f(...a)
7285
7192
  });
7286
7193
  }
7194
+ if (activePollingEnabled) {
7195
+ (0, import_async21.scheduleTask)(this._ctx, () => this._ensureAgentIsInSpaces(agentDeviceKey), AGENT_FEED_ADDED_CHECK_INTERVAL_MS);
7196
+ }
7287
7197
  }
7288
7198
  _updateStatus(status, deviceKey) {
7289
7199
  this._agentStatus = status;
@@ -7292,11 +7202,11 @@ var EdgeAgentManager = class extends import_context15.Resource {
7292
7202
  if (deviceKey) {
7293
7203
  this._ensureAgentIsInSpaces(deviceKey);
7294
7204
  }
7295
- import_log22.log.info("agent status update", {
7205
+ import_log21.log.info("agent status update", {
7296
7206
  status
7297
7207
  }, {
7298
7208
  F: __dxlog_file25,
7299
- L: 161,
7209
+ L: 175,
7300
7210
  S: this,
7301
7211
  C: (f, a) => f(...a)
7302
7212
  });
@@ -7306,8 +7216,27 @@ _ts_decorate9([
7306
7216
  import_async21.synchronized
7307
7217
  ], EdgeAgentManager.prototype, "createAgent", null);
7308
7218
  var EdgeAgentServiceImpl = class {
7309
- constructor(_agentManagerProvider) {
7219
+ constructor(_agentManagerProvider, _edgeConnection) {
7310
7220
  this._agentManagerProvider = _agentManagerProvider;
7221
+ this._edgeConnection = _edgeConnection;
7222
+ }
7223
+ queryEdgeStatus() {
7224
+ return new import_codec_protobuf12.Stream(({ ctx, next }) => {
7225
+ next({
7226
+ status: import_services20.QueryEdgeStatusResponse.EdgeStatus.NOT_CONNECTED
7227
+ });
7228
+ if (!this._edgeConnection) {
7229
+ return;
7230
+ }
7231
+ ctx.onDispose(
7232
+ // TODO(wittjosiah): EdgeConnection should include a disconnected event as well.
7233
+ this._edgeConnection.onReconnected(() => {
7234
+ next({
7235
+ status: import_services20.QueryEdgeStatusResponse.EdgeStatus.CONNECTED
7236
+ });
7237
+ })
7238
+ );
7239
+ });
7311
7240
  }
7312
7241
  async createAgent() {
7313
7242
  return (await this._agentManagerProvider()).createAgent();
@@ -7420,7 +7349,7 @@ var EdgeIdentityRecoveryManager = class {
7420
7349
  signature: Buffer.from(signature).toString("base64")
7421
7350
  });
7422
7351
  }
7423
- import_log24.log.info("recovering identity", response, {
7352
+ import_log23.log.info("recovering identity", response, {
7424
7353
  F: __dxlog_file26,
7425
7354
  L: 77,
7426
7355
  S: this,
@@ -7528,7 +7457,7 @@ var ServiceContext = class extends import_context16.Resource {
7528
7457
  this._echoEdgeReplicator = void 0;
7529
7458
  this._handlerFactories = /* @__PURE__ */ new Map();
7530
7459
  this._instanceId = import_keys16.PublicKey.random().toHex();
7531
- this.metadataStore = new import_echo_pipeline5.MetadataStore(storage.createDirectory("metadata"));
7460
+ this.metadataStore = new import_echo_pipeline4.MetadataStore(storage.createDirectory("metadata"));
7532
7461
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
7533
7462
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
7534
7463
  this.feedStore = new import_feed_store6.FeedStore({
@@ -7536,12 +7465,12 @@ var ServiceContext = class extends import_context16.Resource {
7536
7465
  root: storage.createDirectory("feeds"),
7537
7466
  signer: this.keyring,
7538
7467
  hypercore: {
7539
- valueEncoding: import_echo_pipeline5.valueEncoding,
7468
+ valueEncoding: import_echo_pipeline4.valueEncoding,
7540
7469
  stats: true
7541
7470
  }
7542
7471
  })
7543
7472
  });
7544
- this.spaceManager = new import_echo_pipeline5.SpaceManager({
7473
+ this.spaceManager = new import_echo_pipeline4.SpaceManager({
7545
7474
  feedStore: this.feedStore,
7546
7475
  networkManager: this.networkManager,
7547
7476
  blobStore: this.blobStore,
@@ -7559,35 +7488,36 @@ var ServiceContext = class extends import_context16.Resource {
7559
7488
  edgeFeatures: this._edgeFeatures
7560
7489
  });
7561
7490
  this.recoveryManager = new EdgeIdentityRecoveryManager(this.keyring, this._edgeHttpClient, () => this.identityManager.identity, this._acceptIdentity.bind(this));
7562
- this.echoHost = new import_echo_pipeline5.EchoHost({
7563
- kv: this.level
7491
+ this.echoHost = new import_echo_pipeline4.EchoHost({
7492
+ kv: this.level,
7493
+ peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex()
7564
7494
  });
7565
- this._meshReplicator = new import_echo_pipeline5.MeshEchoReplicator();
7495
+ this._meshReplicator = new import_echo_pipeline4.MeshEchoReplicator();
7566
7496
  this.invitations = new InvitationsHandler(this.networkManager, this._edgeHttpClient, _runtimeParams?.invitationConnectionDefaultParams);
7567
7497
  this.invitationsManager = new InvitationsManager(this.invitations, (invitation) => this.getInvitationHandler(invitation), this.metadataStore);
7568
7498
  this._handlerFactories.set(import_services21.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug5.failUndefined)(), this._acceptIdentity.bind(this)));
7569
7499
  if (!this._runtimeParams?.disableP2pReplication) {
7570
- this._meshReplicator = new import_echo_pipeline5.MeshEchoReplicator();
7500
+ this._meshReplicator = new import_echo_pipeline4.MeshEchoReplicator();
7571
7501
  }
7572
7502
  if (this._edgeConnection && this._edgeFeatures?.echoReplicator) {
7573
- this._echoEdgeReplicator = new import_echo_pipeline5.EchoEdgeReplicator({
7503
+ this._echoEdgeReplicator = new import_echo_pipeline4.EchoEdgeReplicator({
7574
7504
  edgeConnection: this._edgeConnection
7575
7505
  });
7576
7506
  }
7577
7507
  }
7578
7508
  async _open(ctx) {
7579
7509
  await this._checkStorageVersion();
7580
- (0, import_log23.log)("opening...", void 0, {
7510
+ (0, import_log22.log)("opening...", void 0, {
7581
7511
  F: __dxlog_file27,
7582
- L: 195,
7512
+ L: 198,
7583
7513
  S: this,
7584
7514
  C: (f, a) => f(...a)
7585
7515
  });
7586
- import_log23.log.trace("dxos.sdk.service-context.open", import_protocols16.trace.begin({
7516
+ import_log22.log.trace("dxos.sdk.service-context.open", import_protocols16.trace.begin({
7587
7517
  id: this._instanceId
7588
7518
  }), {
7589
7519
  F: __dxlog_file27,
7590
- L: 196,
7520
+ L: 199,
7591
7521
  S: this,
7592
7522
  C: (f, a) => f(...a)
7593
7523
  });
@@ -7610,33 +7540,33 @@ var ServiceContext = class extends import_context16.Resource {
7610
7540
  await this._initialize(ctx);
7611
7541
  }
7612
7542
  const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
7613
- (0, import_log23.log)("loaded persistent invitations", {
7543
+ (0, import_log22.log)("loaded persistent invitations", {
7614
7544
  count: loadedInvitations.invitations?.length
7615
7545
  }, {
7616
7546
  F: __dxlog_file27,
7617
- L: 224,
7547
+ L: 227,
7618
7548
  S: this,
7619
7549
  C: (f, a) => f(...a)
7620
7550
  });
7621
- import_log23.log.trace("dxos.sdk.service-context.open", import_protocols16.trace.end({
7551
+ import_log22.log.trace("dxos.sdk.service-context.open", import_protocols16.trace.end({
7622
7552
  id: this._instanceId
7623
7553
  }), {
7624
7554
  F: __dxlog_file27,
7625
- L: 226,
7555
+ L: 229,
7626
7556
  S: this,
7627
7557
  C: (f, a) => f(...a)
7628
7558
  });
7629
- (0, import_log23.log)("opened", void 0, {
7559
+ (0, import_log22.log)("opened", void 0, {
7630
7560
  F: __dxlog_file27,
7631
- L: 227,
7561
+ L: 230,
7632
7562
  S: this,
7633
7563
  C: (f, a) => f(...a)
7634
7564
  });
7635
7565
  }
7636
7566
  async _close(ctx) {
7637
- (0, import_log23.log)("closing...", void 0, {
7567
+ (0, import_log22.log)("closing...", void 0, {
7638
7568
  F: __dxlog_file27,
7639
- L: 231,
7569
+ L: 234,
7640
7570
  S: this,
7641
7571
  C: (f, a) => f(...a)
7642
7572
  });
@@ -7653,9 +7583,9 @@ var ServiceContext = class extends import_context16.Resource {
7653
7583
  await this.networkManager.close();
7654
7584
  await this.signalManager.close();
7655
7585
  await this._edgeConnection?.close();
7656
- (0, import_log23.log)("closed", void 0, {
7586
+ (0, import_log22.log)("closed", void 0, {
7657
7587
  F: __dxlog_file27,
7658
- L: 247,
7588
+ L: 250,
7659
7589
  S: this,
7660
7590
  C: (f, a) => f(...a)
7661
7591
  });
@@ -7666,7 +7596,7 @@ var ServiceContext = class extends import_context16.Resource {
7666
7596
  await identity.joinNetwork();
7667
7597
  await this._initialize(new import_context16.Context(void 0, {
7668
7598
  F: __dxlog_file27,
7669
- L: 254
7599
+ L: 257
7670
7600
  }));
7671
7601
  return identity;
7672
7602
  }
@@ -7677,7 +7607,7 @@ var ServiceContext = class extends import_context16.Resource {
7677
7607
  const factory = this._handlerFactories.get(invitation.kind);
7678
7608
  (0, import_invariant21.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
7679
7609
  F: __dxlog_file27,
7680
- L: 263,
7610
+ L: 266,
7681
7611
  S: this,
7682
7612
  A: [
7683
7613
  "factory",
@@ -7703,7 +7633,7 @@ var ServiceContext = class extends import_context16.Resource {
7703
7633
  await this.identityManager.acceptIdentity(identity, identityRecord, params.deviceProfile);
7704
7634
  await this._initialize(new import_context16.Context(void 0, {
7705
7635
  F: __dxlog_file27,
7706
- L: 282
7636
+ L: 285
7707
7637
  }));
7708
7638
  return identity;
7709
7639
  }
@@ -7715,9 +7645,9 @@ var ServiceContext = class extends import_context16.Resource {
7715
7645
  }
7716
7646
  // Called when identity is created.
7717
7647
  async _initialize(ctx) {
7718
- (0, import_log23.log)("initializing spaces...", void 0, {
7648
+ (0, import_log22.log)("initializing spaces...", void 0, {
7719
7649
  F: __dxlog_file27,
7720
- L: 297,
7650
+ L: 300,
7721
7651
  S: this,
7722
7652
  C: (f, a) => f(...a)
7723
7653
  });
@@ -7756,7 +7686,7 @@ var ServiceContext = class extends import_context16.Resource {
7756
7686
  this._handlerFactories.set(import_services21.Invitation.Kind.SPACE, (invitation) => {
7757
7687
  (0, import_invariant21.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
7758
7688
  F: __dxlog_file27,
7759
- L: 335,
7689
+ L: 338,
7760
7690
  S: this,
7761
7691
  A: [
7762
7692
  "this.dataSpaceManager",
@@ -7776,33 +7706,33 @@ var ServiceContext = class extends import_context16.Resource {
7776
7706
  return;
7777
7707
  }
7778
7708
  if (!this.dataSpaceManager) {
7779
- (0, import_log23.log)("dataSpaceManager not initialized yet, ignoring space admission", {
7709
+ (0, import_log22.log)("dataSpaceManager not initialized yet, ignoring space admission", {
7780
7710
  details: assertion
7781
7711
  }, {
7782
7712
  F: __dxlog_file27,
7783
- L: 351,
7713
+ L: 354,
7784
7714
  S: this,
7785
7715
  C: (f, a) => f(...a)
7786
7716
  });
7787
7717
  return;
7788
7718
  }
7789
7719
  if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
7790
- (0, import_log23.log)("space already exists, ignoring space admission", {
7720
+ (0, import_log22.log)("space already exists, ignoring space admission", {
7791
7721
  details: assertion
7792
7722
  }, {
7793
7723
  F: __dxlog_file27,
7794
- L: 355,
7724
+ L: 358,
7795
7725
  S: this,
7796
7726
  C: (f, a) => f(...a)
7797
7727
  });
7798
7728
  return;
7799
7729
  }
7800
7730
  try {
7801
- (0, import_log23.log)("accepting space recorded in halo", {
7731
+ (0, import_log22.log)("accepting space recorded in halo", {
7802
7732
  details: assertion
7803
7733
  }, {
7804
7734
  F: __dxlog_file27,
7805
- L: 360,
7735
+ L: 363,
7806
7736
  S: this,
7807
7737
  C: (f, a) => f(...a)
7808
7738
  });
@@ -7811,9 +7741,9 @@ var ServiceContext = class extends import_context16.Resource {
7811
7741
  genesisFeedKey: assertion.genesisFeedKey
7812
7742
  });
7813
7743
  } catch (err) {
7814
- import_log23.log.catch(err, void 0, {
7744
+ import_log22.log.catch(err, void 0, {
7815
7745
  F: __dxlog_file27,
7816
- L: 366,
7746
+ L: 369,
7817
7747
  S: this,
7818
7748
  C: (f, a) => f(...a)
7819
7749
  });
@@ -7829,12 +7759,12 @@ var ServiceContext = class extends import_context16.Resource {
7829
7759
  let edgeIdentity;
7830
7760
  const identity = this.identityManager.identity;
7831
7761
  if (identity) {
7832
- import_log23.log.info("Setting identity on edge connection", {
7762
+ import_log22.log.info("Setting identity on edge connection", {
7833
7763
  identity: identity.identityKey.toHex(),
7834
7764
  swarms: this.networkManager.topics
7835
7765
  }, {
7836
7766
  F: __dxlog_file27,
7837
- L: 380,
7767
+ L: 383,
7838
7768
  S: this,
7839
7769
  C: (f, a) => f(...a)
7840
7770
  });
@@ -7848,7 +7778,7 @@ var ServiceContext = class extends import_context16.Resource {
7848
7778
  });
7849
7779
  (0, import_invariant21.invariant)(identity.deviceCredentialChain, void 0, {
7850
7780
  F: __dxlog_file27,
7851
- L: 398,
7781
+ L: 401,
7852
7782
  S: this,
7853
7783
  A: [
7854
7784
  "identity.deviceCredentialChain",
@@ -7975,7 +7905,7 @@ var exportProfileData = async ({ storage, level }) => {
7975
7905
  {
7976
7906
  const directory = await storage.createDirectory();
7977
7907
  const files = await directory.list();
7978
- import_log25.log.info("begin exporting files", {
7908
+ import_log24.log.info("begin exporting files", {
7979
7909
  count: files.length
7980
7910
  }, {
7981
7911
  F: __dxlog_file28,
@@ -7993,7 +7923,7 @@ var exportProfileData = async ({ storage, level }) => {
7993
7923
  value: data
7994
7924
  });
7995
7925
  }
7996
- import_log25.log.info("done exporting files", {
7926
+ import_log24.log.info("done exporting files", {
7997
7927
  count: files.length
7998
7928
  }, {
7999
7929
  F: __dxlog_file28,
@@ -8003,7 +7933,7 @@ var exportProfileData = async ({ storage, level }) => {
8003
7933
  });
8004
7934
  }
8005
7935
  {
8006
- import_log25.log.info("begin exporting kv pairs", void 0, {
7936
+ import_log24.log.info("begin exporting kv pairs", void 0, {
8007
7937
  F: __dxlog_file28,
8008
7938
  L: 45,
8009
7939
  S: void 0,
@@ -8022,7 +7952,7 @@ var exportProfileData = async ({ storage, level }) => {
8022
7952
  });
8023
7953
  count++;
8024
7954
  }
8025
- import_log25.log.info("done exporting kv pairs", {
7955
+ import_log24.log.info("done exporting kv pairs", {
8026
7956
  count
8027
7957
  }, {
8028
7958
  F: __dxlog_file28,
@@ -8094,7 +8024,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8094
8024
  if (++count % 1e3 === 0) {
8095
8025
  await batch.write();
8096
8026
  batch = level.batch();
8097
- import_log25.log.info("importing", {
8027
+ import_log24.log.info("importing", {
8098
8028
  count,
8099
8029
  total: archive.storage.length,
8100
8030
  progress: `${(count / archive.storage.length * 100).toFixed()}%`
@@ -8106,7 +8036,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8106
8036
  });
8107
8037
  }
8108
8038
  }
8109
- import_log25.log.info("committing changes..", void 0, {
8039
+ import_log24.log.info("committing changes..", void 0, {
8110
8040
  F: __dxlog_file28,
8111
8041
  L: 109,
8112
8042
  S: void 0,
@@ -8285,11 +8215,11 @@ var LoggingServiceImpl = class {
8285
8215
  };
8286
8216
  }
8287
8217
  async open() {
8288
- import_log27.log.runtimeConfig.processors.push(this._logProcessor);
8218
+ import_log26.log.runtimeConfig.processors.push(this._logProcessor);
8289
8219
  }
8290
8220
  async close() {
8291
- const index = import_log27.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
8292
- import_log27.log.runtimeConfig.processors.splice(index, 1);
8221
+ const index = import_log26.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
8222
+ import_log26.log.runtimeConfig.processors.splice(index, 1);
8293
8223
  }
8294
8224
  async controlMetrics({ reset, record }) {
8295
8225
  if (reset) {
@@ -8350,7 +8280,7 @@ var LoggingServiceImpl = class {
8350
8280
  }
8351
8281
  const record = {
8352
8282
  ...entry2,
8353
- context: (0, import_util16.jsonify)((0, import_log27.getContextFromEntry)(entry2)),
8283
+ context: (0, import_util16.jsonify)((0, import_log26.getContextFromEntry)(entry2)),
8354
8284
  timestamp: /* @__PURE__ */ new Date(),
8355
8285
  meta: {
8356
8286
  // TODO(dmaretskyi): Fix proto.
@@ -8585,7 +8515,7 @@ var ClientServicesHost = class {
8585
8515
  "'service host is open'"
8586
8516
  ]
8587
8517
  });
8588
- (0, import_log26.log)("initializing...", void 0, {
8518
+ (0, import_log25.log)("initializing...", void 0, {
8589
8519
  F: __dxlog_file30,
8590
8520
  L: 204,
8591
8521
  S: this,
@@ -8607,7 +8537,7 @@ var ClientServicesHost = class {
8607
8537
  }
8608
8538
  }
8609
8539
  if (!options.signalManager) {
8610
- import_log26.log.warn("running signaling without telemetry metadata.", void 0, {
8540
+ import_log25.log.warn("running signaling without telemetry metadata.", void 0, {
8611
8541
  F: __dxlog_file30,
8612
8542
  L: 215,
8613
8543
  S: this,
@@ -8645,7 +8575,7 @@ var ClientServicesHost = class {
8645
8575
  peerKey: this._edgeConnection.peerKey
8646
8576
  } : void 0
8647
8577
  });
8648
- (0, import_log26.log)("initialized", void 0, {
8578
+ (0, import_log25.log)("initialized", void 0, {
8649
8579
  F: __dxlog_file30,
8650
8580
  L: 250,
8651
8581
  S: this,
@@ -8657,7 +8587,7 @@ var ClientServicesHost = class {
8657
8587
  return;
8658
8588
  }
8659
8589
  const traceId = import_keys19.PublicKey.random().toHex();
8660
- import_log26.log.trace("dxos.client-services.host.open", import_protocols20.trace.begin({
8590
+ import_log25.log.trace("dxos.client-services.host.open", import_protocols20.trace.begin({
8661
8591
  id: traceId
8662
8592
  }), {
8663
8593
  F: __dxlog_file30,
@@ -8702,7 +8632,7 @@ var ClientServicesHost = class {
8702
8632
  ]
8703
8633
  });
8704
8634
  this._opening = true;
8705
- (0, import_log26.log)("opening...", {
8635
+ (0, import_log25.log)("opening...", {
8706
8636
  lockKey: this._resourceLock?.lockKey
8707
8637
  }, {
8708
8638
  F: __dxlog_file30,
@@ -8744,7 +8674,7 @@ var ClientServicesHost = class {
8744
8674
  config: this._config,
8745
8675
  context: this._serviceContext
8746
8676
  }),
8747
- EdgeAgentService: new EdgeAgentServiceImpl(agentManagerProvider)
8677
+ EdgeAgentService: new EdgeAgentServiceImpl(agentManagerProvider, this._edgeConnection)
8748
8678
  });
8749
8679
  await this._serviceContext.open(ctx);
8750
8680
  await identityService.open();
@@ -8763,7 +8693,7 @@ var ClientServicesHost = class {
8763
8693
  this._open = true;
8764
8694
  this._statusUpdate.emit();
8765
8695
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
8766
- (0, import_log26.log)("opened", {
8696
+ (0, import_log25.log)("opened", {
8767
8697
  deviceKey
8768
8698
  }, {
8769
8699
  F: __dxlog_file30,
@@ -8771,7 +8701,7 @@ var ClientServicesHost = class {
8771
8701
  S: this,
8772
8702
  C: (f, a) => f(...a)
8773
8703
  });
8774
- import_log26.log.trace("dxos.client-services.host.open", import_protocols20.trace.end({
8704
+ import_log25.log.trace("dxos.client-services.host.open", import_protocols20.trace.end({
8775
8705
  id: traceId
8776
8706
  }), {
8777
8707
  F: __dxlog_file30,
@@ -8785,7 +8715,7 @@ var ClientServicesHost = class {
8785
8715
  return;
8786
8716
  }
8787
8717
  const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
8788
- (0, import_log26.log)("closing...", {
8718
+ (0, import_log25.log)("closing...", {
8789
8719
  deviceKey
8790
8720
  }, {
8791
8721
  F: __dxlog_file30,
@@ -8803,7 +8733,7 @@ var ClientServicesHost = class {
8803
8733
  await this._level?.close();
8804
8734
  this._open = false;
8805
8735
  this._statusUpdate.emit();
8806
- (0, import_log26.log)("closed", {
8736
+ (0, import_log25.log)("closed", {
8807
8737
  deviceKey
8808
8738
  }, {
8809
8739
  F: __dxlog_file30,
@@ -8814,7 +8744,7 @@ var ClientServicesHost = class {
8814
8744
  }
8815
8745
  async reset() {
8816
8746
  const traceId = import_keys19.PublicKey.random().toHex();
8817
- import_log26.log.trace("dxos.sdk.client-services-host.reset", import_protocols20.trace.begin({
8747
+ import_log25.log.trace("dxos.sdk.client-services-host.reset", import_protocols20.trace.begin({
8818
8748
  id: traceId
8819
8749
  }), {
8820
8750
  F: __dxlog_file30,
@@ -8822,7 +8752,7 @@ var ClientServicesHost = class {
8822
8752
  S: this,
8823
8753
  C: (f, a) => f(...a)
8824
8754
  });
8825
- import_log26.log.info("resetting...", void 0, {
8755
+ import_log25.log.info("resetting...", void 0, {
8826
8756
  F: __dxlog_file30,
8827
8757
  L: 394,
8828
8758
  S: this,
@@ -8832,13 +8762,13 @@ var ClientServicesHost = class {
8832
8762
  this._statusUpdate.emit();
8833
8763
  await this._serviceContext?.close();
8834
8764
  await this._storage.reset();
8835
- import_log26.log.info("reset", void 0, {
8765
+ import_log25.log.info("reset", void 0, {
8836
8766
  F: __dxlog_file30,
8837
8767
  L: 401,
8838
8768
  S: this,
8839
8769
  C: (f, a) => f(...a)
8840
8770
  });
8841
- import_log26.log.trace("dxos.sdk.client-services-host.reset", import_protocols20.trace.end({
8771
+ import_log25.log.trace("dxos.sdk.client-services-host.reset", import_protocols20.trace.end({
8842
8772
  id: traceId
8843
8773
  }), {
8844
8774
  F: __dxlog_file30,
@@ -8920,4 +8850,4 @@ ClientServicesHost = _ts_decorate11([
8920
8850
  subscribeToSpaces,
8921
8851
  subscribeToSwarmInfo
8922
8852
  });
8923
- //# sourceMappingURL=chunk-SPLKKUM4.cjs.map
8853
+ //# sourceMappingURL=chunk-DVPAB6LZ.cjs.map