@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
@@ -2,7 +2,7 @@ import { createRequire } from 'node:module';const require = createRequire(import
2
2
 
3
3
  // packages/sdk/client-services/src/packlets/devtools/feeds.ts
4
4
  import { EventSubscriptions } from "@dxos/async";
5
- import { Stream } from "@dxos/codec-protobuf";
5
+ import { Stream } from "@dxos/codec-protobuf/stream";
6
6
  import { FeedIterator } from "@dxos/feed-store";
7
7
  import { PublicKey } from "@dxos/keys";
8
8
  import { log } from "@dxos/log";
@@ -113,7 +113,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
113
113
  };
114
114
 
115
115
  // packages/sdk/client-services/src/packlets/devtools/network.ts
116
- import { Stream as Stream2 } from "@dxos/codec-protobuf";
116
+ import { Stream as Stream2 } from "@dxos/codec-protobuf/stream";
117
117
  import { Context } from "@dxos/context";
118
118
  import { PublicKey as PublicKey2 } from "@dxos/keys";
119
119
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/network.ts";
@@ -210,7 +210,7 @@ var getNetworkPeers = ({ networkManager }, request) => {
210
210
  };
211
211
 
212
212
  // packages/sdk/client-services/src/packlets/devtools/spaces.ts
213
- import { Stream as Stream3 } from "@dxos/codec-protobuf";
213
+ import { Stream as Stream3 } from "@dxos/codec-protobuf/stream";
214
214
  var subscribeToSpaces = (context, { spaceKeys = [] }) => {
215
215
  return new Stream3(({ next }) => {
216
216
  let unsubscribe;
@@ -247,11 +247,11 @@ var subscribeToSpaces = (context, { spaceKeys = [] }) => {
247
247
 
248
248
  // packages/sdk/client-services/src/packlets/devtools/devtools.ts
249
249
  import { Event as AsyncEvent } from "@dxos/async";
250
- import { Stream as Stream6 } from "@dxos/codec-protobuf";
250
+ import { Stream as Stream6 } from "@dxos/codec-protobuf/stream";
251
251
 
252
252
  // packages/sdk/client-services/src/packlets/devtools/keys.ts
253
253
  import { scheduleTask } from "@dxos/async";
254
- import { Stream as Stream4 } from "@dxos/codec-protobuf";
254
+ import { Stream as Stream4 } from "@dxos/codec-protobuf/stream";
255
255
  var subscribeToKeyringKeys = ({ keyring }) => new Stream4(({ next, ctx }) => {
256
256
  const update = async () => {
257
257
  next({
@@ -263,7 +263,7 @@ var subscribeToKeyringKeys = ({ keyring }) => new Stream4(({ next, ctx }) => {
263
263
  });
264
264
 
265
265
  // packages/sdk/client-services/src/packlets/devtools/metadata.ts
266
- import { Stream as Stream5 } from "@dxos/codec-protobuf";
266
+ import { Stream as Stream5 } from "@dxos/codec-protobuf/stream";
267
267
  var subscribeToMetadata = ({ context }) => new Stream5(({ next, ctx }) => {
268
268
  context.metadataStore.update.on(ctx, (data) => next({
269
269
  metadata: data
@@ -397,7 +397,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
397
397
  import { TRACE_PROCESSOR } from "@dxos/tracing";
398
398
 
399
399
  // packages/sdk/client-services/src/version.ts
400
- var DXOS_VERSION = "0.7.4";
400
+ var DXOS_VERSION = "0.7.5-labs.5f04cf6";
401
401
 
402
402
  // packages/sdk/client-services/src/packlets/services/platform.ts
403
403
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -958,21 +958,20 @@ var EdgeFeedReplicator = class extends Resource {
958
958
  });
959
959
  return;
960
960
  }
961
- const logPayload = message.type === "data" ? {
962
- feedKey: message.feedKey,
963
- blocks: message.blocks.map((b) => b.index)
964
- } : {
965
- message
966
- };
967
- log3.info("sending message", logPayload, {
968
- F: __dxlog_file5,
969
- L: 152,
970
- S: this,
971
- C: (f, a) => f(...a)
972
- });
961
+ if (message.type === "data") {
962
+ log3.info("sending blocks", {
963
+ feedKey: message.feedKey,
964
+ blocks: message.blocks.map((b) => b.index)
965
+ }, {
966
+ F: __dxlog_file5,
967
+ L: 151,
968
+ S: this,
969
+ C: (f, a) => f(...a)
970
+ });
971
+ }
973
972
  invariant2(message.feedKey, void 0, {
974
973
  F: __dxlog_file5,
975
- L: 154,
974
+ L: 157,
976
975
  S: this,
977
976
  A: [
978
977
  "message.feedKey",
@@ -984,7 +983,7 @@ var EdgeFeedReplicator = class extends Resource {
984
983
  type: message.type
985
984
  }, {
986
985
  F: __dxlog_file5,
987
- L: 157,
986
+ L: 160,
988
987
  S: this,
989
988
  C: (f, a) => f(...a)
990
989
  });
@@ -1003,7 +1002,7 @@ var EdgeFeedReplicator = class extends Resource {
1003
1002
  if (!this._connectionCtx) {
1004
1003
  log3.warn("received message after connection context was disposed", void 0, {
1005
1004
  F: __dxlog_file5,
1006
- L: 172,
1005
+ L: 175,
1007
1006
  S: this,
1008
1007
  C: (f, a) => f(...a)
1009
1008
  });
@@ -1014,14 +1013,6 @@ var EdgeFeedReplicator = class extends Resource {
1014
1013
  case "metadata": {
1015
1014
  try {
1016
1015
  var _usingCtx = _using_ctx();
1017
- log3.info("received metadata", {
1018
- message
1019
- }, {
1020
- F: __dxlog_file5,
1021
- L: 178,
1022
- S: this,
1023
- C: (f, a) => f(...a)
1024
- });
1025
1016
  const feedKey = PublicKey3.fromHex(message.feedKey);
1026
1017
  const feed = this._feeds.get(feedKey);
1027
1018
  if (!feed) {
@@ -1029,7 +1020,7 @@ var EdgeFeedReplicator = class extends Resource {
1029
1020
  feedKey
1030
1021
  }, {
1031
1022
  F: __dxlog_file5,
1032
- L: 183,
1023
+ L: 184,
1033
1024
  S: this,
1034
1025
  C: (f, a) => f(...a)
1035
1026
  });
@@ -1037,7 +1028,18 @@ var EdgeFeedReplicator = class extends Resource {
1037
1028
  }
1038
1029
  const _guard = _usingCtx.u(await this._getPushMutex(feed.key).acquire());
1039
1030
  this._remoteLength.set(feedKey, message.length);
1031
+ const logMeta = {
1032
+ localLength: feed.length,
1033
+ remoteLength: message.length,
1034
+ feedKey
1035
+ };
1040
1036
  if (message.length > feed.length) {
1037
+ log3.info("requesting missing blocks", logMeta, {
1038
+ F: __dxlog_file5,
1039
+ L: 194,
1040
+ S: this,
1041
+ C: (f, a) => f(...a)
1042
+ });
1041
1043
  await this._sendMessage({
1042
1044
  type: "request",
1043
1045
  feedKey: feedKey.toHex(),
@@ -1047,6 +1049,12 @@ var EdgeFeedReplicator = class extends Resource {
1047
1049
  }
1048
1050
  });
1049
1051
  } else if (message.length < feed.length) {
1052
+ log3.info("pushing blocks to remote", logMeta, {
1053
+ F: __dxlog_file5,
1054
+ L: 202,
1055
+ S: this,
1056
+ C: (f, a) => f(...a)
1057
+ });
1050
1058
  await this._pushBlocks(feed, message.length, feed.length);
1051
1059
  }
1052
1060
  break;
@@ -1062,7 +1070,7 @@ var EdgeFeedReplicator = class extends Resource {
1062
1070
  blocks: message.blocks.map((b) => b.index)
1063
1071
  }, {
1064
1072
  F: __dxlog_file5,
1065
- L: 205,
1073
+ L: 211,
1066
1074
  S: this,
1067
1075
  C: (f, a) => f(...a)
1068
1076
  });
@@ -1073,7 +1081,7 @@ var EdgeFeedReplicator = class extends Resource {
1073
1081
  feedKey
1074
1082
  }, {
1075
1083
  F: __dxlog_file5,
1076
- L: 210,
1084
+ L: 216,
1077
1085
  S: this,
1078
1086
  C: (f, a) => f(...a)
1079
1087
  });
@@ -1087,7 +1095,7 @@ var EdgeFeedReplicator = class extends Resource {
1087
1095
  ...message
1088
1096
  }, {
1089
1097
  F: __dxlog_file5,
1090
- L: 219,
1098
+ L: 225,
1091
1099
  S: this,
1092
1100
  C: (f, a) => f(...a)
1093
1101
  });
@@ -1102,7 +1110,7 @@ var EdgeFeedReplicator = class extends Resource {
1102
1110
  to
1103
1111
  }, {
1104
1112
  F: __dxlog_file5,
1105
- L: 226,
1113
+ L: 232,
1106
1114
  S: this,
1107
1115
  C: (f, a) => f(...a)
1108
1116
  });
@@ -1112,7 +1120,7 @@ var EdgeFeedReplicator = class extends Resource {
1112
1120
  });
1113
1121
  invariant2(data instanceof Uint8Array, void 0, {
1114
1122
  F: __dxlog_file5,
1115
- L: 231,
1123
+ L: 237,
1116
1124
  S: this,
1117
1125
  A: [
1118
1126
  "data instanceof Uint8Array",
@@ -1140,7 +1148,7 @@ var EdgeFeedReplicator = class extends Resource {
1140
1148
  blocks: blocks.length
1141
1149
  }, {
1142
1150
  F: __dxlog_file5,
1143
- L: 252,
1151
+ L: 258,
1144
1152
  S: this,
1145
1153
  C: (f, a) => f(...a)
1146
1154
  });
@@ -1162,7 +1170,7 @@ var EdgeFeedReplicator = class extends Resource {
1162
1170
  if (!this._remoteLength.has(feed.key)) {
1163
1171
  log3("blocks not pushed because remote length is unknown", void 0, {
1164
1172
  F: __dxlog_file5,
1165
- L: 273,
1173
+ L: 279,
1166
1174
  S: this,
1167
1175
  C: (f, a) => f(...a)
1168
1176
  });
@@ -1187,7 +1195,7 @@ var EdgeFeedReplicator = class extends Resource {
1187
1195
  if (err instanceof EdgeIdentityChangedError || err instanceof EdgeConnectionClosedError) {
1188
1196
  log3("resetting on reconnect", void 0, {
1189
1197
  F: __dxlog_file5,
1190
- L: 290,
1198
+ L: 296,
1191
1199
  S: this,
1192
1200
  C: (f, a) => f(...a)
1193
1201
  });
@@ -1198,7 +1206,7 @@ var EdgeFeedReplicator = class extends Resource {
1198
1206
  }
1199
1207
  }, {
1200
1208
  F: __dxlog_file5,
1201
- L: 284
1209
+ L: 290
1202
1210
  });
1203
1211
  return connectionCtx;
1204
1212
  }
@@ -1365,6 +1373,7 @@ var NotarizationPlugin = class extends Resource3 {
1365
1373
  this._processedCredentials = new ComplexSet(PublicKey4.hash);
1366
1374
  this._processCredentialsTriggers = new ComplexMap3(PublicKey4.hash);
1367
1375
  this._activeEdgePollingIntervalHandle = void 0;
1376
+ this._activeEdgePollingEnabled = false;
1368
1377
  this._spaceId = params.spaceId;
1369
1378
  this._activeEdgePollingInterval = params.activeEdgePollingInterval ?? DEFAULT_ACTIVE_EDGE_POLLING_INTERVAL;
1370
1379
  if (params.edgeClient && params.edgeFeatures?.feedReplicator) {
@@ -1372,15 +1381,6 @@ var NotarizationPlugin = class extends Resource3 {
1372
1381
  }
1373
1382
  }
1374
1383
  setActiveEdgePollingEnabled(enabled) {
1375
- invariant4(this.isOpen, void 0, {
1376
- F: __dxlog_file7,
1377
- L: 109,
1378
- S: this,
1379
- A: [
1380
- "this.isOpen",
1381
- ""
1382
- ]
1383
- });
1384
1384
  const client = this._edgeClient;
1385
1385
  invariant4(client, void 0, {
1386
1386
  F: __dxlog_file7,
@@ -1391,30 +1391,30 @@ var NotarizationPlugin = class extends Resource3 {
1391
1391
  ""
1392
1392
  ]
1393
1393
  });
1394
- if (enabled && !this._activeEdgePollingIntervalHandle) {
1395
- this._activeEdgePollingIntervalHandle = setInterval(() => {
1396
- if (this._writer) {
1397
- this._notarizePendingEdgeCredentials(client, this._writer);
1398
- }
1399
- }, this._activeEdgePollingInterval);
1400
- } else if (!enabled && this._activeEdgePollingIntervalHandle) {
1401
- clearInterval(this._activeEdgePollingIntervalHandle);
1402
- this._activeEdgePollingIntervalHandle = void 0;
1394
+ this._activeEdgePollingEnabled = enabled;
1395
+ if (this.isOpen) {
1396
+ if (enabled && !this._activeEdgePollingIntervalHandle) {
1397
+ this._startPeriodicEdgePolling(client);
1398
+ } else if (!enabled && this._activeEdgePollingIntervalHandle) {
1399
+ this._stopPeriodicEdgePolling();
1400
+ }
1403
1401
  }
1404
1402
  }
1405
1403
  get hasWriter() {
1406
1404
  return !!this._writer;
1407
1405
  }
1408
1406
  async _open() {
1409
- if (this._edgeClient && this._writer) {
1410
- this._notarizePendingEdgeCredentials(this._edgeClient, this._writer);
1407
+ if (this._edgeClient) {
1408
+ if (this._activeEdgePollingEnabled) {
1409
+ this._startPeriodicEdgePolling(this._edgeClient);
1410
+ }
1411
+ if (this._writer) {
1412
+ this._notarizePendingEdgeCredentials(this._edgeClient, this._writer);
1413
+ }
1411
1414
  }
1412
1415
  }
1413
1416
  async _close() {
1414
- if (this._activeEdgePollingIntervalHandle) {
1415
- clearInterval(this._activeEdgePollingIntervalHandle);
1416
- this._activeEdgePollingIntervalHandle = void 0;
1417
- }
1417
+ this._stopPeriodicEdgePolling();
1418
1418
  await this._ctx.dispose();
1419
1419
  }
1420
1420
  /**
@@ -1592,10 +1592,23 @@ var NotarizationPlugin = class extends Resource3 {
1592
1592
  ]
1593
1593
  });
1594
1594
  this._writer = writer;
1595
- if (this._edgeClient) {
1595
+ if (this._edgeClient && this.isOpen) {
1596
1596
  this._notarizePendingEdgeCredentials(this._edgeClient, writer);
1597
1597
  }
1598
1598
  }
1599
+ _startPeriodicEdgePolling(client) {
1600
+ this._activeEdgePollingIntervalHandle = setInterval(() => {
1601
+ if (this._writer) {
1602
+ this._notarizePendingEdgeCredentials(client, this._writer);
1603
+ }
1604
+ }, this._activeEdgePollingInterval);
1605
+ }
1606
+ _stopPeriodicEdgePolling() {
1607
+ if (this._activeEdgePollingIntervalHandle) {
1608
+ clearInterval(this._activeEdgePollingIntervalHandle);
1609
+ this._activeEdgePollingIntervalHandle = void 0;
1610
+ }
1611
+ }
1599
1612
  /**
1600
1613
  * The method is used only for adding agent feeds to spaces.
1601
1614
  * When an agent is created we can admit them into all the existing spaces. In case the operation fails
@@ -1614,7 +1627,7 @@ var NotarizationPlugin = class extends Resource3 {
1614
1627
  if (!credentials.length) {
1615
1628
  log4("edge did not return credentials for notarization", void 0, {
1616
1629
  F: __dxlog_file7,
1617
- L: 296,
1630
+ L: 311,
1618
1631
  S: this,
1619
1632
  C: (f, a) => f(...a)
1620
1633
  });
@@ -1624,7 +1637,7 @@ var NotarizationPlugin = class extends Resource3 {
1624
1637
  count: credentials.length
1625
1638
  }, {
1626
1639
  F: __dxlog_file7,
1627
- L: 300,
1640
+ L: 315,
1628
1641
  S: this,
1629
1642
  C: (f, a) => f(...a)
1630
1643
  });
@@ -1637,7 +1650,7 @@ var NotarizationPlugin = class extends Resource3 {
1637
1650
  count: decodedCredentials.length
1638
1651
  }, {
1639
1652
  F: __dxlog_file7,
1640
- L: 309,
1653
+ L: 324,
1641
1654
  S: this,
1642
1655
  C: (f, a) => f(...a)
1643
1656
  });
@@ -1665,7 +1678,7 @@ var NotarizationPlugin = class extends Resource3 {
1665
1678
  for (const credential of credentials) {
1666
1679
  invariant4(credential.id, "Credential must have an id", {
1667
1680
  F: __dxlog_file7,
1668
- L: 335,
1681
+ L: 350,
1669
1682
  S: this,
1670
1683
  A: [
1671
1684
  "credential.id",
@@ -1689,7 +1702,7 @@ var NotarizationPlugin = class extends Resource3 {
1689
1702
  peer: extension.localPeerId
1690
1703
  }, {
1691
1704
  F: __dxlog_file7,
1692
- L: 350,
1705
+ L: 365,
1693
1706
  S: this,
1694
1707
  C: (f, a) => f(...a)
1695
1708
  });
@@ -1701,7 +1714,7 @@ var NotarizationPlugin = class extends Resource3 {
1701
1714
  peer: extension.localPeerId
1702
1715
  }, {
1703
1716
  F: __dxlog_file7,
1704
- L: 355,
1717
+ L: 370,
1705
1718
  S: this,
1706
1719
  C: (f, a) => f(...a)
1707
1720
  });
@@ -1718,7 +1731,7 @@ var NotarizationPlugin = class extends Resource3 {
1718
1731
  peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
1719
1732
  }, {
1720
1733
  F: __dxlog_file7,
1721
- L: 367,
1734
+ L: 382,
1722
1735
  S: this,
1723
1736
  C: (f, a) => f(...a)
1724
1737
  });
@@ -1734,7 +1747,7 @@ var handleEdgeError = (error) => {
1734
1747
  if (!(error instanceof EdgeCallFailedError) || error.errorData) {
1735
1748
  log4.catch(error, void 0, {
1736
1749
  F: __dxlog_file7,
1737
- L: 381,
1750
+ L: 396,
1738
1751
  S: void 0,
1739
1752
  C: (f, a) => f(...a)
1740
1753
  });
@@ -1743,7 +1756,7 @@ var handleEdgeError = (error) => {
1743
1756
  reason: error.reason
1744
1757
  }, {
1745
1758
  F: __dxlog_file7,
1746
- L: 383,
1759
+ L: 398,
1747
1760
  S: void 0,
1748
1761
  C: (f, a) => f(...a)
1749
1762
  });
@@ -2584,7 +2597,7 @@ DataSpaceManager = _ts_decorate3([
2584
2597
 
2585
2598
  // packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
2586
2599
  import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTask as scheduleTask3 } from "@dxos/async";
2587
- import { Stream as Stream7 } from "@dxos/codec-protobuf";
2600
+ import { Stream as Stream7 } from "@dxos/codec-protobuf/stream";
2588
2601
  import { createAdmissionCredentials as createAdmissionCredentials2, getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
2589
2602
  import { raise } from "@dxos/debug";
2590
2603
  import { writeMessages as writeMessages2 } from "@dxos/feed-store";
@@ -3670,7 +3683,7 @@ IdentityManager = _ts_decorate5([
3670
3683
 
3671
3684
  // packages/sdk/client-services/src/packlets/identity/identity-service.ts
3672
3685
  import { Trigger as Trigger3, sleep as sleep2 } from "@dxos/async";
3673
- import { Stream as Stream8 } from "@dxos/codec-protobuf";
3686
+ import { Stream as Stream8 } from "@dxos/codec-protobuf/stream";
3674
3687
  import { Resource as Resource5 } from "@dxos/context";
3675
3688
  import { createCredential as createCredential2, signPresentation } from "@dxos/credentials";
3676
3689
  import { invariant as invariant9 } from "@dxos/invariant";
@@ -6054,7 +6067,7 @@ var createAdmissionKeypair = () => {
6054
6067
  };
6055
6068
 
6056
6069
  // packages/sdk/client-services/src/packlets/invitations/invitations-service.ts
6057
- import { Stream as Stream9 } from "@dxos/codec-protobuf";
6070
+ import { Stream as Stream9 } from "@dxos/codec-protobuf/stream";
6058
6071
  import { QueryInvitationsResponse } from "@dxos/protocols/proto/dxos/client/services";
6059
6072
  import { trace as trace8 } from "@dxos/tracing";
6060
6073
  var InvitationsServiceImpl = class {
@@ -7171,7 +7184,7 @@ _ts_decorate9([
7171
7184
  ], EdgeAgentManager.prototype, "createAgent", null);
7172
7185
 
7173
7186
  // packages/sdk/client-services/src/packlets/agents/edge-agent-service.ts
7174
- import { Stream as Stream11 } from "@dxos/codec-protobuf";
7187
+ import { Stream as Stream11 } from "@dxos/codec-protobuf/stream";
7175
7188
  import { EdgeAgentStatus as EdgeAgentStatus2 } from "@dxos/protocols";
7176
7189
  import { QueryAgentStatusResponse, QueryEdgeStatusResponse } from "@dxos/protocols/proto/dxos/client/services";
7177
7190
  var EdgeAgentServiceImpl = class {
@@ -7479,7 +7492,8 @@ var ServiceContext = class extends Resource7 {
7479
7492
  this.recoveryManager = new EdgeIdentityRecoveryManager(this.keyring, this._edgeHttpClient, () => this.identityManager.identity, this._acceptIdentity.bind(this));
7480
7493
  this.echoHost = new EchoHost({
7481
7494
  kv: this.level,
7482
- peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex()
7495
+ peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex(),
7496
+ getSpaceKeyByRootDocumentId: (documentId) => this.spaceManager.findSpaceByRootDocumentId(documentId)?.key
7483
7497
  });
7484
7498
  this._meshReplicator = new MeshEchoReplicator();
7485
7499
  this.invitations = new InvitationsHandler(this.networkManager, this._edgeHttpClient, _runtimeParams?.invitationConnectionDefaultParams);
@@ -7498,7 +7512,7 @@ var ServiceContext = class extends Resource7 {
7498
7512
  await this._checkStorageVersion();
7499
7513
  log23("opening...", void 0, {
7500
7514
  F: __dxlog_file27,
7501
- L: 198,
7515
+ L: 199,
7502
7516
  S: this,
7503
7517
  C: (f, a) => f(...a)
7504
7518
  });
@@ -7506,7 +7520,7 @@ var ServiceContext = class extends Resource7 {
7506
7520
  id: this._instanceId
7507
7521
  }), {
7508
7522
  F: __dxlog_file27,
7509
- L: 199,
7523
+ L: 200,
7510
7524
  S: this,
7511
7525
  C: (f, a) => f(...a)
7512
7526
  });
@@ -7533,7 +7547,7 @@ var ServiceContext = class extends Resource7 {
7533
7547
  count: loadedInvitations.invitations?.length
7534
7548
  }, {
7535
7549
  F: __dxlog_file27,
7536
- L: 227,
7550
+ L: 228,
7537
7551
  S: this,
7538
7552
  C: (f, a) => f(...a)
7539
7553
  });
@@ -7541,13 +7555,13 @@ var ServiceContext = class extends Resource7 {
7541
7555
  id: this._instanceId
7542
7556
  }), {
7543
7557
  F: __dxlog_file27,
7544
- L: 229,
7558
+ L: 230,
7545
7559
  S: this,
7546
7560
  C: (f, a) => f(...a)
7547
7561
  });
7548
7562
  log23("opened", void 0, {
7549
7563
  F: __dxlog_file27,
7550
- L: 230,
7564
+ L: 231,
7551
7565
  S: this,
7552
7566
  C: (f, a) => f(...a)
7553
7567
  });
@@ -7555,7 +7569,7 @@ var ServiceContext = class extends Resource7 {
7555
7569
  async _close(ctx) {
7556
7570
  log23("closing...", void 0, {
7557
7571
  F: __dxlog_file27,
7558
- L: 234,
7572
+ L: 235,
7559
7573
  S: this,
7560
7574
  C: (f, a) => f(...a)
7561
7575
  });
@@ -7574,7 +7588,7 @@ var ServiceContext = class extends Resource7 {
7574
7588
  await this._edgeConnection?.close();
7575
7589
  log23("closed", void 0, {
7576
7590
  F: __dxlog_file27,
7577
- L: 250,
7591
+ L: 251,
7578
7592
  S: this,
7579
7593
  C: (f, a) => f(...a)
7580
7594
  });
@@ -7585,7 +7599,7 @@ var ServiceContext = class extends Resource7 {
7585
7599
  await identity.joinNetwork();
7586
7600
  await this._initialize(new Context9(void 0, {
7587
7601
  F: __dxlog_file27,
7588
- L: 257
7602
+ L: 258
7589
7603
  }));
7590
7604
  return identity;
7591
7605
  }
@@ -7596,7 +7610,7 @@ var ServiceContext = class extends Resource7 {
7596
7610
  const factory = this._handlerFactories.get(invitation.kind);
7597
7611
  invariant21(factory, `Unknown invitation kind: ${invitation.kind}`, {
7598
7612
  F: __dxlog_file27,
7599
- L: 266,
7613
+ L: 267,
7600
7614
  S: this,
7601
7615
  A: [
7602
7616
  "factory",
@@ -7622,7 +7636,7 @@ var ServiceContext = class extends Resource7 {
7622
7636
  await this.identityManager.acceptIdentity(identity, identityRecord, params.deviceProfile);
7623
7637
  await this._initialize(new Context9(void 0, {
7624
7638
  F: __dxlog_file27,
7625
- L: 285
7639
+ L: 286
7626
7640
  }));
7627
7641
  return identity;
7628
7642
  }
@@ -7636,7 +7650,7 @@ var ServiceContext = class extends Resource7 {
7636
7650
  async _initialize(ctx) {
7637
7651
  log23("initializing spaces...", void 0, {
7638
7652
  F: __dxlog_file27,
7639
- L: 300,
7653
+ L: 301,
7640
7654
  S: this,
7641
7655
  C: (f, a) => f(...a)
7642
7656
  });
@@ -7675,7 +7689,7 @@ var ServiceContext = class extends Resource7 {
7675
7689
  this._handlerFactories.set(Invitation10.Kind.SPACE, (invitation) => {
7676
7690
  invariant21(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
7677
7691
  F: __dxlog_file27,
7678
- L: 338,
7692
+ L: 339,
7679
7693
  S: this,
7680
7694
  A: [
7681
7695
  "this.dataSpaceManager",
@@ -7699,7 +7713,7 @@ var ServiceContext = class extends Resource7 {
7699
7713
  details: assertion
7700
7714
  }, {
7701
7715
  F: __dxlog_file27,
7702
- L: 354,
7716
+ L: 355,
7703
7717
  S: this,
7704
7718
  C: (f, a) => f(...a)
7705
7719
  });
@@ -7710,7 +7724,7 @@ var ServiceContext = class extends Resource7 {
7710
7724
  details: assertion
7711
7725
  }, {
7712
7726
  F: __dxlog_file27,
7713
- L: 358,
7727
+ L: 359,
7714
7728
  S: this,
7715
7729
  C: (f, a) => f(...a)
7716
7730
  });
@@ -7721,7 +7735,7 @@ var ServiceContext = class extends Resource7 {
7721
7735
  details: assertion
7722
7736
  }, {
7723
7737
  F: __dxlog_file27,
7724
- L: 363,
7738
+ L: 364,
7725
7739
  S: this,
7726
7740
  C: (f, a) => f(...a)
7727
7741
  });
@@ -7732,7 +7746,7 @@ var ServiceContext = class extends Resource7 {
7732
7746
  } catch (err) {
7733
7747
  log23.catch(err, void 0, {
7734
7748
  F: __dxlog_file27,
7735
- L: 369,
7749
+ L: 370,
7736
7750
  S: this,
7737
7751
  C: (f, a) => f(...a)
7738
7752
  });
@@ -7748,12 +7762,12 @@ var ServiceContext = class extends Resource7 {
7748
7762
  let edgeIdentity;
7749
7763
  const identity = this.identityManager.identity;
7750
7764
  if (identity) {
7751
- log23.info("Setting identity on edge connection", {
7765
+ log23("setting identity on edge connection", {
7752
7766
  identity: identity.identityKey.toHex(),
7753
7767
  swarms: this.networkManager.topics
7754
7768
  }, {
7755
7769
  F: __dxlog_file27,
7756
- L: 383,
7770
+ L: 384,
7757
7771
  S: this,
7758
7772
  C: (f, a) => f(...a)
7759
7773
  });
@@ -7767,7 +7781,7 @@ var ServiceContext = class extends Resource7 {
7767
7781
  });
7768
7782
  invariant21(identity.deviceCredentialChain, void 0, {
7769
7783
  F: __dxlog_file27,
7770
- L: 401,
7784
+ L: 403,
7771
7785
  S: this,
7772
7786
  A: [
7773
7787
  "identity.deviceCredentialChain",
@@ -8077,7 +8091,7 @@ import { WebsocketRpcClient } from "@dxos/websocket-rpc";
8077
8091
 
8078
8092
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
8079
8093
  import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
8080
- import { Stream as Stream12 } from "@dxos/codec-protobuf";
8094
+ import { Stream as Stream12 } from "@dxos/codec-protobuf/stream";
8081
8095
  import { invariant as invariant23 } from "@dxos/invariant";
8082
8096
  import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
8083
8097
  var __dxlog_file29 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
@@ -8167,7 +8181,7 @@ var DevicesServiceImpl = class {
8167
8181
 
8168
8182
  // packages/sdk/client-services/src/packlets/identity/contacts-service.ts
8169
8183
  import { EventSubscriptions as EventSubscriptions4, scheduleTask as scheduleTask9, UpdateScheduler as UpdateScheduler2 } from "@dxos/async";
8170
- import { Stream as Stream13 } from "@dxos/codec-protobuf";
8184
+ import { Stream as Stream13 } from "@dxos/codec-protobuf/stream";
8171
8185
  import { PublicKey as PublicKey17 } from "@dxos/keys";
8172
8186
  import { ComplexMap as ComplexMap5, ComplexSet as ComplexSet6 } from "@dxos/util";
8173
8187
  var ContactsServiceImpl = class {
@@ -8250,7 +8264,7 @@ var ContactsServiceImpl = class {
8250
8264
 
8251
8265
  // packages/sdk/client-services/src/packlets/logging/logging-service.ts
8252
8266
  import { Event as Event10 } from "@dxos/async";
8253
- import { Stream as Stream14 } from "@dxos/codec-protobuf";
8267
+ import { Stream as Stream14 } from "@dxos/codec-protobuf/stream";
8254
8268
  import { PublicKey as PublicKey18 } from "@dxos/keys";
8255
8269
  import { getContextFromEntry, log as log25 } from "@dxos/log";
8256
8270
  import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
@@ -8373,7 +8387,7 @@ var shouldLog = (entry2, request) => {
8373
8387
  var LOG_PROCESSING = 0;
8374
8388
 
8375
8389
  // packages/sdk/client-services/src/packlets/network/network-service.ts
8376
- import { Stream as Stream15 } from "@dxos/codec-protobuf";
8390
+ import { Stream as Stream15 } from "@dxos/codec-protobuf/stream";
8377
8391
  var NetworkServiceImpl = class {
8378
8392
  constructor(networkManager, signalManager) {
8379
8393
  this.networkManager = networkManager;
@@ -8403,10 +8417,39 @@ var NetworkServiceImpl = class {
8403
8417
  async updateConfig(request) {
8404
8418
  await this.networkManager.setConnectionState(request.swarm);
8405
8419
  }
8420
+ async joinSwarm(request) {
8421
+ return this.signalManager.join(request);
8422
+ }
8423
+ async leaveSwarm(request) {
8424
+ return this.signalManager.leave(request);
8425
+ }
8426
+ subscribeSwarmState(request) {
8427
+ return new Stream15(({ next }) => {
8428
+ const unsubscribe = this.signalManager.swarmState?.on((state) => {
8429
+ if (request.topic.equals(state.swarmKey)) {
8430
+ next(state);
8431
+ }
8432
+ });
8433
+ return unsubscribe;
8434
+ });
8435
+ }
8436
+ async sendMessage(message) {
8437
+ return this.signalManager.sendMessage(message);
8438
+ }
8439
+ subscribeMessages(peer) {
8440
+ return new Stream15(({ next }) => {
8441
+ const unsubscribe = this.signalManager.onMessage.on((message) => {
8442
+ if (message.recipient.peerKey === peer.peerKey) {
8443
+ next(message);
8444
+ }
8445
+ });
8446
+ return unsubscribe;
8447
+ });
8448
+ }
8406
8449
  };
8407
8450
 
8408
8451
  // packages/sdk/client-services/src/packlets/system/system-service.ts
8409
- import { Stream as Stream16 } from "@dxos/codec-protobuf";
8452
+ import { Stream as Stream16 } from "@dxos/codec-protobuf/stream";
8410
8453
  import { GetDiagnosticsRequest as GetDiagnosticsRequest2 } from "@dxos/protocols/proto/dxos/client/services";
8411
8454
  import { jsonKeyReplacer as jsonKeyReplacer2 } from "@dxos/util";
8412
8455
  var SystemServiceImpl = class {
@@ -8910,4 +8953,4 @@ export {
8910
8953
  importProfileData,
8911
8954
  ClientServicesHost
8912
8955
  };
8913
- //# sourceMappingURL=chunk-OQOXRHWF.mjs.map
8956
+ //# sourceMappingURL=chunk-74ZMFWJS.mjs.map