@dxos/client-services 0.7.4 → 0.7.5-labs.5f04cf6

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 (75) hide show
  1. package/dist/lib/browser/{chunk-423GRVVV.mjs → chunk-EVMMT65L.mjs} +147 -104
  2. package/dist/lib/browser/chunk-EVMMT65L.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-ZS24HRVA.cjs → chunk-LXXOZWCX.cjs} +182 -139
  7. package/dist/lib/node/chunk-LXXOZWCX.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-OQOXRHWF.mjs → chunk-74ZMFWJS.mjs} +147 -104
  12. package/dist/lib/node-esm/chunk-74ZMFWJS.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-service.d.ts +1 -1
  17. package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -1
  18. package/dist/types/src/packlets/devices/devices-service.d.ts +1 -1
  19. package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
  20. package/dist/types/src/packlets/devtools/devtools.d.ts +1 -1
  21. package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
  22. package/dist/types/src/packlets/devtools/feeds.d.ts +1 -1
  23. package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
  24. package/dist/types/src/packlets/devtools/keys.d.ts +1 -1
  25. package/dist/types/src/packlets/devtools/keys.d.ts.map +1 -1
  26. package/dist/types/src/packlets/devtools/metadata.d.ts +1 -1
  27. package/dist/types/src/packlets/devtools/metadata.d.ts.map +1 -1
  28. package/dist/types/src/packlets/devtools/network.d.ts +1 -1
  29. package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
  30. package/dist/types/src/packlets/devtools/spaces.d.ts +1 -1
  31. package/dist/types/src/packlets/devtools/spaces.d.ts.map +1 -1
  32. package/dist/types/src/packlets/identity/contacts-service.d.ts +1 -1
  33. package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -1
  34. package/dist/types/src/packlets/identity/identity-service.d.ts +1 -1
  35. package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
  36. package/dist/types/src/packlets/invitations/invitations-service.d.ts +1 -1
  37. package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
  38. package/dist/types/src/packlets/logging/logging-service.d.ts +1 -1
  39. package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
  40. package/dist/types/src/packlets/network/network-service.d.ts +9 -2
  41. package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
  42. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  43. package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
  44. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +3 -0
  45. package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
  46. package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
  47. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  48. package/dist/types/src/packlets/system/system-service.d.ts +1 -1
  49. package/dist/types/src/packlets/system/system-service.d.ts.map +1 -1
  50. package/dist/types/src/version.d.ts +1 -1
  51. package/dist/types/src/version.d.ts.map +1 -1
  52. package/dist/types/tsconfig.tsbuildinfo +1 -0
  53. package/package.json +38 -38
  54. package/src/packlets/agents/edge-agent-service.ts +1 -1
  55. package/src/packlets/devices/devices-service.ts +1 -1
  56. package/src/packlets/devtools/devtools.ts +1 -1
  57. package/src/packlets/devtools/feeds.ts +1 -1
  58. package/src/packlets/devtools/keys.ts +1 -1
  59. package/src/packlets/devtools/metadata.ts +1 -1
  60. package/src/packlets/devtools/network.ts +1 -1
  61. package/src/packlets/devtools/spaces.ts +1 -1
  62. package/src/packlets/identity/contacts-service.ts +1 -1
  63. package/src/packlets/identity/identity-service.ts +1 -1
  64. package/src/packlets/invitations/invitations-service.ts +1 -1
  65. package/src/packlets/logging/logging-service.ts +1 -1
  66. package/src/packlets/network/network-service.ts +39 -1
  67. package/src/packlets/services/service-context.ts +3 -1
  68. package/src/packlets/spaces/edge-feed-replicator.ts +11 -5
  69. package/src/packlets/spaces/notarization-plugin.ts +32 -17
  70. package/src/packlets/spaces/spaces-service.ts +1 -1
  71. package/src/packlets/system/system-service.ts +1 -1
  72. package/src/version.ts +1 -5
  73. package/dist/lib/browser/chunk-423GRVVV.mjs.map +0 -7
  74. package/dist/lib/node/chunk-ZS24HRVA.cjs.map +0 -7
  75. package/dist/lib/node-esm/chunk-OQOXRHWF.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_ZS24HRVA_exports = {};
30
- __export(chunk_ZS24HRVA_exports, {
29
+ var chunk_LXXOZWCX_exports = {};
30
+ __export(chunk_LXXOZWCX_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  DataSpace: () => DataSpace,
@@ -72,24 +72,24 @@ __export(chunk_ZS24HRVA_exports, {
72
72
  subscribeToSpaces: () => subscribeToSpaces,
73
73
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
74
74
  });
75
- module.exports = __toCommonJS(chunk_ZS24HRVA_exports);
75
+ module.exports = __toCommonJS(chunk_LXXOZWCX_exports);
76
76
  var import_async = require("@dxos/async");
77
- var import_codec_protobuf = require("@dxos/codec-protobuf");
77
+ var import_stream = require("@dxos/codec-protobuf/stream");
78
78
  var import_feed_store = require("@dxos/feed-store");
79
79
  var import_keys = require("@dxos/keys");
80
80
  var import_log = require("@dxos/log");
81
81
  var import_util = require("@dxos/util");
82
- var import_codec_protobuf2 = require("@dxos/codec-protobuf");
82
+ var import_stream2 = require("@dxos/codec-protobuf/stream");
83
83
  var import_context = require("@dxos/context");
84
84
  var import_keys2 = require("@dxos/keys");
85
- var import_codec_protobuf3 = require("@dxos/codec-protobuf");
85
+ var import_stream3 = require("@dxos/codec-protobuf/stream");
86
86
  var import_async2 = require("@dxos/async");
87
- var import_codec_protobuf4 = require("@dxos/codec-protobuf");
87
+ var import_stream4 = require("@dxos/codec-protobuf/stream");
88
88
  var import_async3 = require("@dxos/async");
89
- var import_codec_protobuf5 = require("@dxos/codec-protobuf");
90
- var import_codec_protobuf6 = require("@dxos/codec-protobuf");
89
+ var import_stream5 = require("@dxos/codec-protobuf/stream");
90
+ var import_stream6 = require("@dxos/codec-protobuf/stream");
91
91
  var import_async4 = require("@dxos/async");
92
- var import_codec_protobuf7 = require("@dxos/codec-protobuf");
92
+ var import_codec_protobuf = require("@dxos/codec-protobuf");
93
93
  var import_credentials = require("@dxos/credentials");
94
94
  var import_invariant = require("@dxos/invariant");
95
95
  var import_protocols = require("@dxos/protocols");
@@ -184,7 +184,7 @@ var import_debug2 = require("@dxos/debug");
184
184
  var import_credentials12 = require("@dxos/protocols/proto/dxos/halo/credentials");
185
185
  var import_timeframe3 = require("@dxos/timeframe");
186
186
  var import_async12 = require("@dxos/async");
187
- var import_codec_protobuf8 = require("@dxos/codec-protobuf");
187
+ var import_stream7 = require("@dxos/codec-protobuf/stream");
188
188
  var import_credentials13 = require("@dxos/credentials");
189
189
  var import_debug3 = require("@dxos/debug");
190
190
  var import_feed_store4 = require("@dxos/feed-store");
@@ -208,7 +208,7 @@ var import_timeframe4 = require("@dxos/timeframe");
208
208
  var import_tracing7 = require("@dxos/tracing");
209
209
  var import_util8 = require("@dxos/util");
210
210
  var import_async14 = require("@dxos/async");
211
- var import_codec_protobuf9 = require("@dxos/codec-protobuf");
211
+ var import_stream8 = require("@dxos/codec-protobuf/stream");
212
212
  var import_context9 = require("@dxos/context");
213
213
  var import_credentials16 = require("@dxos/credentials");
214
214
  var import_invariant10 = require("@dxos/invariant");
@@ -270,7 +270,7 @@ var import_keys13 = require("@dxos/keys");
270
270
  var import_log17 = require("@dxos/log");
271
271
  var import_invitations5 = require("@dxos/protocols/proto/dxos/halo/invitations");
272
272
  var import_util11 = require("@dxos/util");
273
- var import_codec_protobuf10 = require("@dxos/codec-protobuf");
273
+ var import_stream9 = require("@dxos/codec-protobuf/stream");
274
274
  var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
275
275
  var import_tracing9 = require("@dxos/tracing");
276
276
  var import_credentials18 = require("@dxos/credentials");
@@ -293,7 +293,7 @@ var import_credentials21 = require("@dxos/protocols/proto/dxos/halo/credentials"
293
293
  var import_invariant19 = require("@dxos/invariant");
294
294
  var import_lock_file = require("@dxos/lock-file");
295
295
  var import_log20 = require("@dxos/log");
296
- var import_codec_protobuf11 = require("@dxos/codec-protobuf");
296
+ var import_codec_protobuf2 = require("@dxos/codec-protobuf");
297
297
  var import_debug4 = require("@dxos/debug");
298
298
  var import_rpc = require("@dxos/rpc");
299
299
  var import_tracing10 = require("@dxos/tracing");
@@ -305,7 +305,7 @@ var import_log21 = require("@dxos/log");
305
305
  var import_protocols14 = require("@dxos/protocols");
306
306
  var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
307
307
  var import_metadata2 = require("@dxos/protocols/proto/dxos/echo/metadata");
308
- var import_codec_protobuf12 = require("@dxos/codec-protobuf");
308
+ var import_stream10 = require("@dxos/codec-protobuf/stream");
309
309
  var import_protocols15 = require("@dxos/protocols");
310
310
  var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
311
311
  var import_async22 = require("@dxos/async");
@@ -360,26 +360,26 @@ var import_services22 = require("@dxos/protocols/proto/dxos/client/services");
360
360
  var import_tracing12 = require("@dxos/tracing");
361
361
  var import_websocket_rpc = require("@dxos/websocket-rpc");
362
362
  var import_async24 = require("@dxos/async");
363
- var import_codec_protobuf13 = require("@dxos/codec-protobuf");
363
+ var import_stream11 = require("@dxos/codec-protobuf/stream");
364
364
  var import_invariant25 = require("@dxos/invariant");
365
365
  var import_services23 = require("@dxos/protocols/proto/dxos/client/services");
366
366
  var import_async25 = require("@dxos/async");
367
- var import_codec_protobuf14 = require("@dxos/codec-protobuf");
367
+ var import_stream12 = require("@dxos/codec-protobuf/stream");
368
368
  var import_keys20 = require("@dxos/keys");
369
369
  var import_util15 = require("@dxos/util");
370
370
  var import_async26 = require("@dxos/async");
371
- var import_codec_protobuf15 = require("@dxos/codec-protobuf");
371
+ var import_stream13 = require("@dxos/codec-protobuf/stream");
372
372
  var import_keys21 = require("@dxos/keys");
373
373
  var import_log26 = require("@dxos/log");
374
374
  var import_services24 = require("@dxos/protocols/proto/dxos/client/services");
375
375
  var import_util16 = require("@dxos/util");
376
- var import_codec_protobuf16 = require("@dxos/codec-protobuf");
377
- var import_codec_protobuf17 = require("@dxos/codec-protobuf");
376
+ var import_stream14 = require("@dxos/codec-protobuf/stream");
377
+ var import_stream15 = require("@dxos/codec-protobuf/stream");
378
378
  var import_services25 = require("@dxos/protocols/proto/dxos/client/services");
379
379
  var import_util17 = require("@dxos/util");
380
380
  var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/feeds.ts";
381
381
  var subscribeToFeeds = ({ feedStore, spaceManager }, { feedKeys }) => {
382
- return new import_codec_protobuf.Stream(({ next }) => {
382
+ return new import_stream.Stream(({ next }) => {
383
383
  const subscriptions = new import_async.EventSubscriptions();
384
384
  const feedMap = new import_util.ComplexMap(import_keys.PublicKey.hash);
385
385
  const update = () => {
@@ -438,7 +438,7 @@ var findFeedOwner = (spaceManager, feedKey) => {
438
438
  };
439
439
  };
440
440
  var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
441
- return new import_codec_protobuf.Stream(({ next }) => {
441
+ return new import_stream.Stream(({ next }) => {
442
442
  if (!feedKey) {
443
443
  return;
444
444
  }
@@ -482,7 +482,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
482
482
  });
483
483
  };
484
484
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/network.ts";
485
- var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2.Stream(({ next, close }) => {
485
+ var subscribeToNetworkStatus = ({ signalManager }) => new import_stream2.Stream(({ next, close }) => {
486
486
  const update = () => {
487
487
  try {
488
488
  const status = signalManager.getStatus?.();
@@ -496,7 +496,7 @@ var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2
496
496
  signalManager.statusChanged?.on(() => update());
497
497
  update();
498
498
  });
499
- var subscribeToSignal = ({ signalManager }) => new import_codec_protobuf2.Stream(({ next }) => {
499
+ var subscribeToSignal = ({ signalManager }) => new import_stream2.Stream(({ next }) => {
500
500
  const ctx = new import_context.Context(void 0, {
501
501
  F: __dxlog_file2,
502
502
  L: 36
@@ -531,7 +531,7 @@ var subscribeToSignal = ({ signalManager }) => new import_codec_protobuf2.Stream
531
531
  return ctx.dispose();
532
532
  };
533
533
  });
534
- var subscribeToNetworkTopics = ({ networkManager }) => new import_codec_protobuf2.Stream(({ next, close }) => {
534
+ var subscribeToNetworkTopics = ({ networkManager }) => new import_stream2.Stream(({ next, close }) => {
535
535
  const update = () => {
536
536
  try {
537
537
  const topics = networkManager.topics;
@@ -549,7 +549,7 @@ var subscribeToNetworkTopics = ({ networkManager }) => new import_codec_protobuf
549
549
  networkManager.topicsUpdated.on(update);
550
550
  update();
551
551
  });
552
- var subscribeToSwarmInfo = ({ networkManager }) => new import_codec_protobuf2.Stream(({ next }) => {
552
+ var subscribeToSwarmInfo = ({ networkManager }) => new import_stream2.Stream(({ next }) => {
553
553
  const update = () => {
554
554
  const info = networkManager.connectionLog?.swarms;
555
555
  if (info) {
@@ -574,7 +574,7 @@ var getNetworkPeers = ({ networkManager }, request) => {
574
574
  };
575
575
  };
576
576
  var subscribeToSpaces = (context, { spaceKeys = [] }) => {
577
- return new import_codec_protobuf3.Stream(({ next }) => {
577
+ return new import_stream3.Stream(({ next }) => {
578
578
  let unsubscribe;
579
579
  const update = async () => {
580
580
  const spaces = [
@@ -606,7 +606,7 @@ var subscribeToSpaces = (context, { spaceKeys = [] }) => {
606
606
  };
607
607
  });
608
608
  };
609
- var subscribeToKeyringKeys = ({ keyring }) => new import_codec_protobuf5.Stream(({ next, ctx }) => {
609
+ var subscribeToKeyringKeys = ({ keyring }) => new import_stream5.Stream(({ next, ctx }) => {
610
610
  const update = async () => {
611
611
  next({
612
612
  keys: await keyring.list()
@@ -615,7 +615,7 @@ var subscribeToKeyringKeys = ({ keyring }) => new import_codec_protobuf5.Stream(
615
615
  keyring.keysUpdate.on(ctx, update);
616
616
  (0, import_async3.scheduleTask)(ctx, update);
617
617
  });
618
- var subscribeToMetadata = ({ context }) => new import_codec_protobuf6.Stream(({ next, ctx }) => {
618
+ var subscribeToMetadata = ({ context }) => new import_stream6.Stream(({ next, ctx }) => {
619
619
  context.metadataStore.update.on(ctx, (data) => next({
620
620
  metadata: data
621
621
  }));
@@ -633,7 +633,7 @@ var DevtoolsServiceImpl = class {
633
633
  this.params = params;
634
634
  }
635
635
  events(request) {
636
- return new import_codec_protobuf4.Stream(({ next }) => {
636
+ return new import_stream4.Stream(({ next }) => {
637
637
  this.params.events.ready.on(() => {
638
638
  next({
639
639
  ready: {}
@@ -735,7 +735,7 @@ var DevtoolsServiceImpl = class {
735
735
  });
736
736
  }
737
737
  };
738
- var DXOS_VERSION = "0.7.4";
738
+ var DXOS_VERSION = "0.7.5-labs.5f04cf6";
739
739
  var getPlatform = () => {
740
740
  if (process.browser) {
741
741
  if (typeof window !== "undefined") {
@@ -788,7 +788,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
788
788
  "'SystemService is not available.'"
789
789
  ]
790
790
  });
791
- diagnostics.metrics = await (0, import_codec_protobuf7.getFirstStreamValue)(clientServices.LoggingService.queryMetrics({}), {
791
+ diagnostics.metrics = await (0, import_codec_protobuf.getFirstStreamValue)(clientServices.LoggingService.queryMetrics({}), {
792
792
  timeout: DEFAULT_TIMEOUT
793
793
  }).catch(() => void 0);
794
794
  })(),
@@ -803,14 +803,14 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
803
803
  spaceKey: identity.space.key,
804
804
  profile: identity.profileDocument
805
805
  };
806
- const { devices } = await (0, import_codec_protobuf7.getFirstStreamValue)(clientServices.DevicesService.queryDevices(), {
806
+ const { devices } = await (0, import_codec_protobuf.getFirstStreamValue)(clientServices.DevicesService.queryDevices(), {
807
807
  timeout: DEFAULT_TIMEOUT
808
808
  }).catch(() => void 0) ?? {};
809
809
  diagnostics.devices = devices;
810
810
  if (serviceContext.dataSpaceManager) {
811
811
  diagnostics.spaces = await Promise.all(Array.from(serviceContext.dataSpaceManager.spaces.values()).map((space) => getSpaceStats(space)) ?? []);
812
812
  }
813
- const { feeds = [] } = await (0, import_codec_protobuf7.getFirstStreamValue)(clientServices.DevtoolsHost.subscribeToFeeds({}), {
813
+ const { feeds = [] } = await (0, import_codec_protobuf.getFirstStreamValue)(clientServices.DevtoolsHost.subscribeToFeeds({}), {
814
814
  timeout: DEFAULT_TIMEOUT
815
815
  }).catch(() => void 0) ?? {};
816
816
  diagnostics.feeds = feeds.map(({ feedKey, bytes, length }) => ({
@@ -818,7 +818,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
818
818
  bytes,
819
819
  length
820
820
  }));
821
- const status = await (0, import_codec_protobuf7.getFirstStreamValue)(clientServices.NetworkService.queryStatus(), {
821
+ const status = await (0, import_codec_protobuf.getFirstStreamValue)(clientServices.NetworkService.queryStatus(), {
822
822
  timeout: DEFAULT_TIMEOUT
823
823
  }).catch(() => void 0);
824
824
  diagnostics.networkStatus = status;
@@ -1256,21 +1256,20 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1256
1256
  });
1257
1257
  return;
1258
1258
  }
1259
- const logPayload = message.type === "data" ? {
1260
- feedKey: message.feedKey,
1261
- blocks: message.blocks.map((b) => b.index)
1262
- } : {
1263
- message
1264
- };
1265
- import_log3.log.info("sending message", logPayload, {
1266
- F: __dxlog_file5,
1267
- L: 152,
1268
- S: this,
1269
- C: (f, a) => f(...a)
1270
- });
1259
+ if (message.type === "data") {
1260
+ import_log3.log.info("sending blocks", {
1261
+ feedKey: message.feedKey,
1262
+ blocks: message.blocks.map((b) => b.index)
1263
+ }, {
1264
+ F: __dxlog_file5,
1265
+ L: 151,
1266
+ S: this,
1267
+ C: (f, a) => f(...a)
1268
+ });
1269
+ }
1271
1270
  (0, import_invariant2.invariant)(message.feedKey, void 0, {
1272
1271
  F: __dxlog_file5,
1273
- L: 154,
1272
+ L: 157,
1274
1273
  S: this,
1275
1274
  A: [
1276
1275
  "message.feedKey",
@@ -1282,7 +1281,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1282
1281
  type: message.type
1283
1282
  }, {
1284
1283
  F: __dxlog_file5,
1285
- L: 157,
1284
+ L: 160,
1286
1285
  S: this,
1287
1286
  C: (f, a) => f(...a)
1288
1287
  });
@@ -1301,7 +1300,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1301
1300
  if (!this._connectionCtx) {
1302
1301
  import_log3.log.warn("received message after connection context was disposed", void 0, {
1303
1302
  F: __dxlog_file5,
1304
- L: 172,
1303
+ L: 175,
1305
1304
  S: this,
1306
1305
  C: (f, a) => f(...a)
1307
1306
  });
@@ -1312,14 +1311,6 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1312
1311
  case "metadata": {
1313
1312
  try {
1314
1313
  var _usingCtx = _using_ctx();
1315
- import_log3.log.info("received metadata", {
1316
- message
1317
- }, {
1318
- F: __dxlog_file5,
1319
- L: 178,
1320
- S: this,
1321
- C: (f, a) => f(...a)
1322
- });
1323
1314
  const feedKey = import_keys3.PublicKey.fromHex(message.feedKey);
1324
1315
  const feed = this._feeds.get(feedKey);
1325
1316
  if (!feed) {
@@ -1327,7 +1318,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1327
1318
  feedKey
1328
1319
  }, {
1329
1320
  F: __dxlog_file5,
1330
- L: 183,
1321
+ L: 184,
1331
1322
  S: this,
1332
1323
  C: (f, a) => f(...a)
1333
1324
  });
@@ -1335,7 +1326,18 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1335
1326
  }
1336
1327
  const _guard = _usingCtx.u(await this._getPushMutex(feed.key).acquire());
1337
1328
  this._remoteLength.set(feedKey, message.length);
1329
+ const logMeta = {
1330
+ localLength: feed.length,
1331
+ remoteLength: message.length,
1332
+ feedKey
1333
+ };
1338
1334
  if (message.length > feed.length) {
1335
+ import_log3.log.info("requesting missing blocks", logMeta, {
1336
+ F: __dxlog_file5,
1337
+ L: 194,
1338
+ S: this,
1339
+ C: (f, a) => f(...a)
1340
+ });
1339
1341
  await this._sendMessage({
1340
1342
  type: "request",
1341
1343
  feedKey: feedKey.toHex(),
@@ -1345,6 +1347,12 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1345
1347
  }
1346
1348
  });
1347
1349
  } else if (message.length < feed.length) {
1350
+ import_log3.log.info("pushing blocks to remote", logMeta, {
1351
+ F: __dxlog_file5,
1352
+ L: 202,
1353
+ S: this,
1354
+ C: (f, a) => f(...a)
1355
+ });
1348
1356
  await this._pushBlocks(feed, message.length, feed.length);
1349
1357
  }
1350
1358
  break;
@@ -1360,7 +1368,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1360
1368
  blocks: message.blocks.map((b) => b.index)
1361
1369
  }, {
1362
1370
  F: __dxlog_file5,
1363
- L: 205,
1371
+ L: 211,
1364
1372
  S: this,
1365
1373
  C: (f, a) => f(...a)
1366
1374
  });
@@ -1371,7 +1379,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1371
1379
  feedKey
1372
1380
  }, {
1373
1381
  F: __dxlog_file5,
1374
- L: 210,
1382
+ L: 216,
1375
1383
  S: this,
1376
1384
  C: (f, a) => f(...a)
1377
1385
  });
@@ -1385,7 +1393,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1385
1393
  ...message
1386
1394
  }, {
1387
1395
  F: __dxlog_file5,
1388
- L: 219,
1396
+ L: 225,
1389
1397
  S: this,
1390
1398
  C: (f, a) => f(...a)
1391
1399
  });
@@ -1400,7 +1408,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1400
1408
  to
1401
1409
  }, {
1402
1410
  F: __dxlog_file5,
1403
- L: 226,
1411
+ L: 232,
1404
1412
  S: this,
1405
1413
  C: (f, a) => f(...a)
1406
1414
  });
@@ -1410,7 +1418,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1410
1418
  });
1411
1419
  (0, import_invariant2.invariant)(data instanceof Uint8Array, void 0, {
1412
1420
  F: __dxlog_file5,
1413
- L: 231,
1421
+ L: 237,
1414
1422
  S: this,
1415
1423
  A: [
1416
1424
  "data instanceof Uint8Array",
@@ -1438,7 +1446,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1438
1446
  blocks: blocks.length
1439
1447
  }, {
1440
1448
  F: __dxlog_file5,
1441
- L: 252,
1449
+ L: 258,
1442
1450
  S: this,
1443
1451
  C: (f, a) => f(...a)
1444
1452
  });
@@ -1460,7 +1468,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1460
1468
  if (!this._remoteLength.has(feed.key)) {
1461
1469
  (0, import_log3.log)("blocks not pushed because remote length is unknown", void 0, {
1462
1470
  F: __dxlog_file5,
1463
- L: 273,
1471
+ L: 279,
1464
1472
  S: this,
1465
1473
  C: (f, a) => f(...a)
1466
1474
  });
@@ -1485,7 +1493,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1485
1493
  if (err instanceof import_edge_client.EdgeIdentityChangedError || err instanceof import_edge_client.EdgeConnectionClosedError) {
1486
1494
  (0, import_log3.log)("resetting on reconnect", void 0, {
1487
1495
  F: __dxlog_file5,
1488
- L: 290,
1496
+ L: 296,
1489
1497
  S: this,
1490
1498
  C: (f, a) => f(...a)
1491
1499
  });
@@ -1496,7 +1504,7 @@ var EdgeFeedReplicator = class extends import_context3.Resource {
1496
1504
  }
1497
1505
  }, {
1498
1506
  F: __dxlog_file5,
1499
- L: 284
1507
+ L: 290
1500
1508
  });
1501
1509
  return connectionCtx;
1502
1510
  }
@@ -1625,6 +1633,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1625
1633
  this._processedCredentials = new import_util5.ComplexSet(import_keys5.PublicKey.hash);
1626
1634
  this._processCredentialsTriggers = new import_util5.ComplexMap(import_keys5.PublicKey.hash);
1627
1635
  this._activeEdgePollingIntervalHandle = void 0;
1636
+ this._activeEdgePollingEnabled = false;
1628
1637
  this._spaceId = params.spaceId;
1629
1638
  this._activeEdgePollingInterval = params.activeEdgePollingInterval ?? DEFAULT_ACTIVE_EDGE_POLLING_INTERVAL;
1630
1639
  if (params.edgeClient && params.edgeFeatures?.feedReplicator) {
@@ -1632,15 +1641,6 @@ var NotarizationPlugin = class extends import_context6.Resource {
1632
1641
  }
1633
1642
  }
1634
1643
  setActiveEdgePollingEnabled(enabled) {
1635
- (0, import_invariant5.invariant)(this.isOpen, void 0, {
1636
- F: __dxlog_file7,
1637
- L: 109,
1638
- S: this,
1639
- A: [
1640
- "this.isOpen",
1641
- ""
1642
- ]
1643
- });
1644
1644
  const client = this._edgeClient;
1645
1645
  (0, import_invariant5.invariant)(client, void 0, {
1646
1646
  F: __dxlog_file7,
@@ -1651,30 +1651,30 @@ var NotarizationPlugin = class extends import_context6.Resource {
1651
1651
  ""
1652
1652
  ]
1653
1653
  });
1654
- if (enabled && !this._activeEdgePollingIntervalHandle) {
1655
- this._activeEdgePollingIntervalHandle = setInterval(() => {
1656
- if (this._writer) {
1657
- this._notarizePendingEdgeCredentials(client, this._writer);
1658
- }
1659
- }, this._activeEdgePollingInterval);
1660
- } else if (!enabled && this._activeEdgePollingIntervalHandle) {
1661
- clearInterval(this._activeEdgePollingIntervalHandle);
1662
- this._activeEdgePollingIntervalHandle = void 0;
1654
+ this._activeEdgePollingEnabled = enabled;
1655
+ if (this.isOpen) {
1656
+ if (enabled && !this._activeEdgePollingIntervalHandle) {
1657
+ this._startPeriodicEdgePolling(client);
1658
+ } else if (!enabled && this._activeEdgePollingIntervalHandle) {
1659
+ this._stopPeriodicEdgePolling();
1660
+ }
1663
1661
  }
1664
1662
  }
1665
1663
  get hasWriter() {
1666
1664
  return !!this._writer;
1667
1665
  }
1668
1666
  async _open() {
1669
- if (this._edgeClient && this._writer) {
1670
- this._notarizePendingEdgeCredentials(this._edgeClient, this._writer);
1667
+ if (this._edgeClient) {
1668
+ if (this._activeEdgePollingEnabled) {
1669
+ this._startPeriodicEdgePolling(this._edgeClient);
1670
+ }
1671
+ if (this._writer) {
1672
+ this._notarizePendingEdgeCredentials(this._edgeClient, this._writer);
1673
+ }
1671
1674
  }
1672
1675
  }
1673
1676
  async _close() {
1674
- if (this._activeEdgePollingIntervalHandle) {
1675
- clearInterval(this._activeEdgePollingIntervalHandle);
1676
- this._activeEdgePollingIntervalHandle = void 0;
1677
- }
1677
+ this._stopPeriodicEdgePolling();
1678
1678
  await this._ctx.dispose();
1679
1679
  }
1680
1680
  /**
@@ -1852,10 +1852,23 @@ var NotarizationPlugin = class extends import_context6.Resource {
1852
1852
  ]
1853
1853
  });
1854
1854
  this._writer = writer;
1855
- if (this._edgeClient) {
1855
+ if (this._edgeClient && this.isOpen) {
1856
1856
  this._notarizePendingEdgeCredentials(this._edgeClient, writer);
1857
1857
  }
1858
1858
  }
1859
+ _startPeriodicEdgePolling(client) {
1860
+ this._activeEdgePollingIntervalHandle = setInterval(() => {
1861
+ if (this._writer) {
1862
+ this._notarizePendingEdgeCredentials(client, this._writer);
1863
+ }
1864
+ }, this._activeEdgePollingInterval);
1865
+ }
1866
+ _stopPeriodicEdgePolling() {
1867
+ if (this._activeEdgePollingIntervalHandle) {
1868
+ clearInterval(this._activeEdgePollingIntervalHandle);
1869
+ this._activeEdgePollingIntervalHandle = void 0;
1870
+ }
1871
+ }
1859
1872
  /**
1860
1873
  * The method is used only for adding agent feeds to spaces.
1861
1874
  * When an agent is created we can admit them into all the existing spaces. In case the operation fails
@@ -1874,7 +1887,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1874
1887
  if (!credentials.length) {
1875
1888
  (0, import_log5.log)("edge did not return credentials for notarization", void 0, {
1876
1889
  F: __dxlog_file7,
1877
- L: 296,
1890
+ L: 311,
1878
1891
  S: this,
1879
1892
  C: (f, a) => f(...a)
1880
1893
  });
@@ -1884,7 +1897,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1884
1897
  count: credentials.length
1885
1898
  }, {
1886
1899
  F: __dxlog_file7,
1887
- L: 300,
1900
+ L: 315,
1888
1901
  S: this,
1889
1902
  C: (f, a) => f(...a)
1890
1903
  });
@@ -1897,7 +1910,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1897
1910
  count: decodedCredentials.length
1898
1911
  }, {
1899
1912
  F: __dxlog_file7,
1900
- L: 309,
1913
+ L: 324,
1901
1914
  S: this,
1902
1915
  C: (f, a) => f(...a)
1903
1916
  });
@@ -1925,7 +1938,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1925
1938
  for (const credential of credentials) {
1926
1939
  (0, import_invariant5.invariant)(credential.id, "Credential must have an id", {
1927
1940
  F: __dxlog_file7,
1928
- L: 335,
1941
+ L: 350,
1929
1942
  S: this,
1930
1943
  A: [
1931
1944
  "credential.id",
@@ -1949,7 +1962,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1949
1962
  peer: extension.localPeerId
1950
1963
  }, {
1951
1964
  F: __dxlog_file7,
1952
- L: 350,
1965
+ L: 365,
1953
1966
  S: this,
1954
1967
  C: (f, a) => f(...a)
1955
1968
  });
@@ -1961,7 +1974,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1961
1974
  peer: extension.localPeerId
1962
1975
  }, {
1963
1976
  F: __dxlog_file7,
1964
- L: 355,
1977
+ L: 370,
1965
1978
  S: this,
1966
1979
  C: (f, a) => f(...a)
1967
1980
  });
@@ -1978,7 +1991,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
1978
1991
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
1979
1992
  }, {
1980
1993
  F: __dxlog_file7,
1981
- L: 367,
1994
+ L: 382,
1982
1995
  S: this,
1983
1996
  C: (f, a) => f(...a)
1984
1997
  });
@@ -1994,7 +2007,7 @@ var handleEdgeError = (error) => {
1994
2007
  if (!(error instanceof import_protocols4.EdgeCallFailedError) || error.errorData) {
1995
2008
  import_log5.log.catch(error, void 0, {
1996
2009
  F: __dxlog_file7,
1997
- L: 381,
2010
+ L: 396,
1998
2011
  S: void 0,
1999
2012
  C: (f, a) => f(...a)
2000
2013
  });
@@ -2003,7 +2016,7 @@ var handleEdgeError = (error) => {
2003
2016
  reason: error.reason
2004
2017
  }, {
2005
2018
  F: __dxlog_file7,
2006
- L: 383,
2019
+ L: 398,
2007
2020
  S: void 0,
2008
2021
  C: (f, a) => f(...a)
2009
2022
  });
@@ -2863,7 +2876,7 @@ var SpacesServiceImpl = class {
2863
2876
  await (0, import_feed_store4.writeMessages)(space.controlPipeline.writer, credentials);
2864
2877
  }
2865
2878
  querySpaces() {
2866
- return new import_codec_protobuf8.Stream(({ next, ctx }) => {
2879
+ return new import_stream7.Stream(({ next, ctx }) => {
2867
2880
  const scheduler = new import_async12.UpdateScheduler(ctx, async () => {
2868
2881
  const dataSpaceManager = await this._getDataSpaceManager();
2869
2882
  const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
@@ -2923,7 +2936,7 @@ var SpacesServiceImpl = class {
2923
2936
  await space.postMessage(getChannelId(channel), message);
2924
2937
  }
2925
2938
  subscribeMessages({ spaceKey, channel }) {
2926
- return new import_codec_protobuf8.Stream(({ ctx, next }) => {
2939
+ return new import_stream7.Stream(({ ctx, next }) => {
2927
2940
  (0, import_async12.scheduleTask)(ctx, async () => {
2928
2941
  const dataSpaceManager = await this._getDataSpaceManager();
2929
2942
  const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug3.raise)(new import_protocols6.SpaceNotFoundError(spaceKey));
@@ -2935,7 +2948,7 @@ var SpacesServiceImpl = class {
2935
2948
  });
2936
2949
  }
2937
2950
  queryCredentials({ spaceKey, noTail }) {
2938
- return new import_codec_protobuf8.Stream(({ ctx, next, close }) => {
2951
+ return new import_stream7.Stream(({ ctx, next, close }) => {
2939
2952
  const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug3.raise)(new import_protocols6.SpaceNotFoundError(spaceKey));
2940
2953
  const processor = {
2941
2954
  processCredential: async (credential) => {
@@ -3893,7 +3906,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
3893
3906
  await identity.updateDefaultSpace(space.id);
3894
3907
  }
3895
3908
  queryIdentity() {
3896
- return new import_codec_protobuf9.Stream(({ next }) => {
3909
+ return new import_stream8.Stream(({ next }) => {
3897
3910
  const emitNext = () => next({
3898
3911
  identity: this._getIdentity()
3899
3912
  });
@@ -6154,7 +6167,7 @@ var InvitationsServiceImpl = class {
6154
6167
  return {};
6155
6168
  }
6156
6169
  createInvitation(options) {
6157
- return new import_codec_protobuf10.Stream(({ next, close }) => {
6170
+ return new import_stream9.Stream(({ next, close }) => {
6158
6171
  void this._invitationsManager.createInvitation(options).then((invitation) => {
6159
6172
  import_tracing9.trace.metrics.increment("dxos.invitation.created");
6160
6173
  invitation.subscribe(next, close, close);
@@ -6163,7 +6176,7 @@ var InvitationsServiceImpl = class {
6163
6176
  }
6164
6177
  acceptInvitation(request) {
6165
6178
  const invitation = this._invitationsManager.acceptInvitation(request);
6166
- return new import_codec_protobuf10.Stream(({ next, close }) => {
6179
+ return new import_stream9.Stream(({ next, close }) => {
6167
6180
  invitation.subscribe(next, close, close);
6168
6181
  });
6169
6182
  }
@@ -6174,7 +6187,7 @@ var InvitationsServiceImpl = class {
6174
6187
  return this._invitationsManager.cancelInvitation(request);
6175
6188
  }
6176
6189
  queryInvitations() {
6177
- return new import_codec_protobuf10.Stream(({ next, ctx }) => {
6190
+ return new import_stream9.Stream(({ next, ctx }) => {
6178
6191
  this._invitationsManager.invitationCreated.on(ctx, (invitation) => {
6179
6192
  next({
6180
6193
  action: import_services16.QueryInvitationsResponse.Action.ADDED,
@@ -6955,7 +6968,7 @@ var ClientRpcServer = class {
6955
6968
  const handler = (method2, params3) => this._getServiceHandler(serviceName).callStream(method2, params3);
6956
6969
  this._callMetrics.inc(`${serviceName}.${methodName} request stream`);
6957
6970
  if (this._handleStream) {
6958
- return import_codec_protobuf11.Stream.map(import_codec_protobuf11.Stream.unwrapPromise(this._handleStream(methodName, params2, handler)), (data) => {
6971
+ return import_codec_protobuf2.Stream.map(import_codec_protobuf2.Stream.unwrapPromise(this._handleStream(methodName, params2, handler)), (data) => {
6959
6972
  this._callMetrics.inc(`${serviceName}.${methodName} response stream`);
6960
6973
  return data;
6961
6974
  });
@@ -7221,7 +7234,7 @@ var EdgeAgentServiceImpl = class {
7221
7234
  this._edgeConnection = _edgeConnection;
7222
7235
  }
7223
7236
  queryEdgeStatus() {
7224
- return new import_codec_protobuf12.Stream(({ ctx, next }) => {
7237
+ return new import_stream10.Stream(({ ctx, next }) => {
7225
7238
  next({
7226
7239
  status: import_services20.QueryEdgeStatusResponse.EdgeStatus.NOT_CONNECTED
7227
7240
  });
@@ -7242,7 +7255,7 @@ var EdgeAgentServiceImpl = class {
7242
7255
  return (await this._agentManagerProvider()).createAgent();
7243
7256
  }
7244
7257
  queryAgentStatus() {
7245
- return new import_codec_protobuf12.Stream(({ ctx, next }) => {
7258
+ return new import_stream10.Stream(({ ctx, next }) => {
7246
7259
  next({
7247
7260
  status: import_services20.QueryAgentStatusResponse.AgentStatus.UNKNOWN
7248
7261
  });
@@ -7490,7 +7503,8 @@ var ServiceContext = class extends import_context16.Resource {
7490
7503
  this.recoveryManager = new EdgeIdentityRecoveryManager(this.keyring, this._edgeHttpClient, () => this.identityManager.identity, this._acceptIdentity.bind(this));
7491
7504
  this.echoHost = new import_echo_pipeline4.EchoHost({
7492
7505
  kv: this.level,
7493
- peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex()
7506
+ peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex(),
7507
+ getSpaceKeyByRootDocumentId: (documentId) => this.spaceManager.findSpaceByRootDocumentId(documentId)?.key
7494
7508
  });
7495
7509
  this._meshReplicator = new import_echo_pipeline4.MeshEchoReplicator();
7496
7510
  this.invitations = new InvitationsHandler(this.networkManager, this._edgeHttpClient, _runtimeParams?.invitationConnectionDefaultParams);
@@ -7509,7 +7523,7 @@ var ServiceContext = class extends import_context16.Resource {
7509
7523
  await this._checkStorageVersion();
7510
7524
  (0, import_log22.log)("opening...", void 0, {
7511
7525
  F: __dxlog_file27,
7512
- L: 198,
7526
+ L: 199,
7513
7527
  S: this,
7514
7528
  C: (f, a) => f(...a)
7515
7529
  });
@@ -7517,7 +7531,7 @@ var ServiceContext = class extends import_context16.Resource {
7517
7531
  id: this._instanceId
7518
7532
  }), {
7519
7533
  F: __dxlog_file27,
7520
- L: 199,
7534
+ L: 200,
7521
7535
  S: this,
7522
7536
  C: (f, a) => f(...a)
7523
7537
  });
@@ -7544,7 +7558,7 @@ var ServiceContext = class extends import_context16.Resource {
7544
7558
  count: loadedInvitations.invitations?.length
7545
7559
  }, {
7546
7560
  F: __dxlog_file27,
7547
- L: 227,
7561
+ L: 228,
7548
7562
  S: this,
7549
7563
  C: (f, a) => f(...a)
7550
7564
  });
@@ -7552,13 +7566,13 @@ var ServiceContext = class extends import_context16.Resource {
7552
7566
  id: this._instanceId
7553
7567
  }), {
7554
7568
  F: __dxlog_file27,
7555
- L: 229,
7569
+ L: 230,
7556
7570
  S: this,
7557
7571
  C: (f, a) => f(...a)
7558
7572
  });
7559
7573
  (0, import_log22.log)("opened", void 0, {
7560
7574
  F: __dxlog_file27,
7561
- L: 230,
7575
+ L: 231,
7562
7576
  S: this,
7563
7577
  C: (f, a) => f(...a)
7564
7578
  });
@@ -7566,7 +7580,7 @@ var ServiceContext = class extends import_context16.Resource {
7566
7580
  async _close(ctx) {
7567
7581
  (0, import_log22.log)("closing...", void 0, {
7568
7582
  F: __dxlog_file27,
7569
- L: 234,
7583
+ L: 235,
7570
7584
  S: this,
7571
7585
  C: (f, a) => f(...a)
7572
7586
  });
@@ -7585,7 +7599,7 @@ var ServiceContext = class extends import_context16.Resource {
7585
7599
  await this._edgeConnection?.close();
7586
7600
  (0, import_log22.log)("closed", void 0, {
7587
7601
  F: __dxlog_file27,
7588
- L: 250,
7602
+ L: 251,
7589
7603
  S: this,
7590
7604
  C: (f, a) => f(...a)
7591
7605
  });
@@ -7596,7 +7610,7 @@ var ServiceContext = class extends import_context16.Resource {
7596
7610
  await identity.joinNetwork();
7597
7611
  await this._initialize(new import_context16.Context(void 0, {
7598
7612
  F: __dxlog_file27,
7599
- L: 257
7613
+ L: 258
7600
7614
  }));
7601
7615
  return identity;
7602
7616
  }
@@ -7607,7 +7621,7 @@ var ServiceContext = class extends import_context16.Resource {
7607
7621
  const factory = this._handlerFactories.get(invitation.kind);
7608
7622
  (0, import_invariant21.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
7609
7623
  F: __dxlog_file27,
7610
- L: 266,
7624
+ L: 267,
7611
7625
  S: this,
7612
7626
  A: [
7613
7627
  "factory",
@@ -7633,7 +7647,7 @@ var ServiceContext = class extends import_context16.Resource {
7633
7647
  await this.identityManager.acceptIdentity(identity, identityRecord, params.deviceProfile);
7634
7648
  await this._initialize(new import_context16.Context(void 0, {
7635
7649
  F: __dxlog_file27,
7636
- L: 285
7650
+ L: 286
7637
7651
  }));
7638
7652
  return identity;
7639
7653
  }
@@ -7647,7 +7661,7 @@ var ServiceContext = class extends import_context16.Resource {
7647
7661
  async _initialize(ctx) {
7648
7662
  (0, import_log22.log)("initializing spaces...", void 0, {
7649
7663
  F: __dxlog_file27,
7650
- L: 300,
7664
+ L: 301,
7651
7665
  S: this,
7652
7666
  C: (f, a) => f(...a)
7653
7667
  });
@@ -7686,7 +7700,7 @@ var ServiceContext = class extends import_context16.Resource {
7686
7700
  this._handlerFactories.set(import_services21.Invitation.Kind.SPACE, (invitation) => {
7687
7701
  (0, import_invariant21.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
7688
7702
  F: __dxlog_file27,
7689
- L: 338,
7703
+ L: 339,
7690
7704
  S: this,
7691
7705
  A: [
7692
7706
  "this.dataSpaceManager",
@@ -7710,7 +7724,7 @@ var ServiceContext = class extends import_context16.Resource {
7710
7724
  details: assertion
7711
7725
  }, {
7712
7726
  F: __dxlog_file27,
7713
- L: 354,
7727
+ L: 355,
7714
7728
  S: this,
7715
7729
  C: (f, a) => f(...a)
7716
7730
  });
@@ -7721,7 +7735,7 @@ var ServiceContext = class extends import_context16.Resource {
7721
7735
  details: assertion
7722
7736
  }, {
7723
7737
  F: __dxlog_file27,
7724
- L: 358,
7738
+ L: 359,
7725
7739
  S: this,
7726
7740
  C: (f, a) => f(...a)
7727
7741
  });
@@ -7732,7 +7746,7 @@ var ServiceContext = class extends import_context16.Resource {
7732
7746
  details: assertion
7733
7747
  }, {
7734
7748
  F: __dxlog_file27,
7735
- L: 363,
7749
+ L: 364,
7736
7750
  S: this,
7737
7751
  C: (f, a) => f(...a)
7738
7752
  });
@@ -7743,7 +7757,7 @@ var ServiceContext = class extends import_context16.Resource {
7743
7757
  } catch (err) {
7744
7758
  import_log22.log.catch(err, void 0, {
7745
7759
  F: __dxlog_file27,
7746
- L: 369,
7760
+ L: 370,
7747
7761
  S: this,
7748
7762
  C: (f, a) => f(...a)
7749
7763
  });
@@ -7759,12 +7773,12 @@ var ServiceContext = class extends import_context16.Resource {
7759
7773
  let edgeIdentity;
7760
7774
  const identity = this.identityManager.identity;
7761
7775
  if (identity) {
7762
- import_log22.log.info("Setting identity on edge connection", {
7776
+ (0, import_log22.log)("setting identity on edge connection", {
7763
7777
  identity: identity.identityKey.toHex(),
7764
7778
  swarms: this.networkManager.topics
7765
7779
  }, {
7766
7780
  F: __dxlog_file27,
7767
- L: 383,
7781
+ L: 384,
7768
7782
  S: this,
7769
7783
  C: (f, a) => f(...a)
7770
7784
  });
@@ -7778,7 +7792,7 @@ var ServiceContext = class extends import_context16.Resource {
7778
7792
  });
7779
7793
  (0, import_invariant21.invariant)(identity.deviceCredentialChain, void 0, {
7780
7794
  F: __dxlog_file27,
7781
- L: 401,
7795
+ L: 403,
7782
7796
  S: this,
7783
7797
  A: [
7784
7798
  "identity.deviceCredentialChain",
@@ -8054,7 +8068,7 @@ var DevicesServiceImpl = class {
8054
8068
  return this._identityManager.updateDeviceProfile(profile);
8055
8069
  }
8056
8070
  queryDevices() {
8057
- return new import_codec_protobuf13.Stream(({ next }) => {
8071
+ return new import_stream11.Stream(({ next }) => {
8058
8072
  const update = () => {
8059
8073
  const deviceKeys = this._identityManager.identity?.authorizedDeviceKeys;
8060
8074
  if (!deviceKeys) {
@@ -8176,7 +8190,7 @@ var ContactsServiceImpl = class {
8176
8190
  }
8177
8191
  queryContacts() {
8178
8192
  const subscribedSpaceKeySet = new import_util15.ComplexSet(import_keys20.PublicKey.hash);
8179
- return new import_codec_protobuf14.Stream(({ next, ctx }) => {
8193
+ return new import_stream12.Stream(({ next, ctx }) => {
8180
8194
  const pushUpdateTask = new import_async25.UpdateScheduler(ctx, async () => {
8181
8195
  const contacts = await this.getContacts();
8182
8196
  next(contacts);
@@ -8245,7 +8259,7 @@ var LoggingServiceImpl = class {
8245
8259
  stats: (0, import_util16.numericalValues)(events, "duration")
8246
8260
  };
8247
8261
  };
8248
- return new import_codec_protobuf15.Stream(({ next }) => {
8262
+ return new import_stream13.Stream(({ next }) => {
8249
8263
  const update = () => {
8250
8264
  const metrics2 = {
8251
8265
  timestamp: /* @__PURE__ */ new Date(),
@@ -8267,7 +8281,7 @@ var LoggingServiceImpl = class {
8267
8281
  });
8268
8282
  }
8269
8283
  queryLogs(request) {
8270
- return new import_codec_protobuf15.Stream(({ ctx, next }) => {
8284
+ return new import_stream13.Stream(({ ctx, next }) => {
8271
8285
  const handler = (entry2) => {
8272
8286
  if (LOG_PROCESSING > 0) {
8273
8287
  return;
@@ -8327,7 +8341,7 @@ var NetworkServiceImpl = class {
8327
8341
  this.signalManager = signalManager;
8328
8342
  }
8329
8343
  queryStatus() {
8330
- return new import_codec_protobuf16.Stream(({ next }) => {
8344
+ return new import_stream14.Stream(({ next }) => {
8331
8345
  const update = () => {
8332
8346
  next({
8333
8347
  swarm: this.networkManager.connectionState,
@@ -8350,6 +8364,35 @@ var NetworkServiceImpl = class {
8350
8364
  async updateConfig(request) {
8351
8365
  await this.networkManager.setConnectionState(request.swarm);
8352
8366
  }
8367
+ async joinSwarm(request) {
8368
+ return this.signalManager.join(request);
8369
+ }
8370
+ async leaveSwarm(request) {
8371
+ return this.signalManager.leave(request);
8372
+ }
8373
+ subscribeSwarmState(request) {
8374
+ return new import_stream14.Stream(({ next }) => {
8375
+ const unsubscribe = this.signalManager.swarmState?.on((state) => {
8376
+ if (request.topic.equals(state.swarmKey)) {
8377
+ next(state);
8378
+ }
8379
+ });
8380
+ return unsubscribe;
8381
+ });
8382
+ }
8383
+ async sendMessage(message) {
8384
+ return this.signalManager.sendMessage(message);
8385
+ }
8386
+ subscribeMessages(peer) {
8387
+ return new import_stream14.Stream(({ next }) => {
8388
+ const unsubscribe = this.signalManager.onMessage.on((message) => {
8389
+ if (message.recipient.peerKey === peer.peerKey) {
8390
+ next(message);
8391
+ }
8392
+ });
8393
+ return unsubscribe;
8394
+ });
8395
+ }
8353
8396
  };
8354
8397
  var SystemServiceImpl = class {
8355
8398
  constructor({ config, statusUpdate, getDiagnostics, onUpdateStatus, getCurrentStatus, onReset }) {
@@ -8384,7 +8427,7 @@ var SystemServiceImpl = class {
8384
8427
  }
8385
8428
  // TODO(burdon): Standardize interval option in stream request?
8386
8429
  queryStatus({ interval = 3e3 } = {}) {
8387
- return new import_codec_protobuf17.Stream(({ next }) => {
8430
+ return new import_stream15.Stream(({ next }) => {
8388
8431
  const update = () => {
8389
8432
  next({
8390
8433
  status: this._getCurrentStatus()
@@ -8850,4 +8893,4 @@ ClientServicesHost = _ts_decorate11([
8850
8893
  subscribeToSpaces,
8851
8894
  subscribeToSwarmInfo
8852
8895
  });
8853
- //# sourceMappingURL=chunk-ZS24HRVA.cjs.map
8896
+ //# sourceMappingURL=chunk-LXXOZWCX.cjs.map