@dxos/client-services 0.7.3-main.2dd075e → 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.
@@ -32,7 +32,7 @@ __export(testing_exports, {
32
32
  sanitizeInvitation: () => sanitizeInvitation
33
33
  });
34
34
  module.exports = __toCommonJS(testing_exports);
35
- var import_chunk_RVO5327U = require("../chunk-RVO5327U.cjs");
35
+ var import_chunk_DVPAB6LZ = require("../chunk-DVPAB6LZ.cjs");
36
36
  var import_credentials = require("@dxos/credentials");
37
37
  var import_keys = require("@dxos/keys");
38
38
  var import_async = require("@dxos/async");
@@ -235,7 +235,7 @@ var createInvitation = async (host, options) => {
235
235
  authMethod: import_services.Invitation.AuthMethod.NONE,
236
236
  ...options ?? {}
237
237
  };
238
- if (host instanceof import_chunk_RVO5327U.ServiceContext) {
238
+ if (host instanceof import_chunk_DVPAB6LZ.ServiceContext) {
239
239
  return host.invitationsManager.createInvitation({
240
240
  kind: import_services.Invitation.Kind.SPACE,
241
241
  ...options
@@ -245,7 +245,7 @@ var createInvitation = async (host, options) => {
245
245
  };
246
246
  var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
247
247
  invitation = sanitizeInvitation(invitation);
248
- if (guest instanceof import_chunk_RVO5327U.ServiceContext) {
248
+ if (guest instanceof import_chunk_DVPAB6LZ.ServiceContext) {
249
249
  return guest.invitationsManager.acceptInvitation({
250
250
  invitation,
251
251
  deviceProfile: guestDeviceProfile
@@ -255,7 +255,7 @@ var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
255
255
  };
256
256
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/testing/test-builder.ts";
257
257
  var createServiceHost = (config, signalManagerContext) => {
258
- return new import_chunk_RVO5327U.ClientServicesHost({
258
+ return new import_chunk_DVPAB6LZ.ClientServicesHost({
259
259
  config,
260
260
  signalManager: new import_messaging.MemorySignalManager(signalManagerContext),
261
261
  transportFactory: import_network_manager.MemoryTransportFactory
@@ -274,7 +274,7 @@ var createServiceContext = async ({ signalManagerFactory = async () => {
274
274
  });
275
275
  const level = (0, import_testing.createTestLevel)();
276
276
  await level.open();
277
- return new import_chunk_RVO5327U.ServiceContext(storage, level, networkManager, signalManager, void 0, void 0, {
277
+ return new import_chunk_DVPAB6LZ.ServiceContext(storage, level, networkManager, signalManager, void 0, void 0, {
278
278
  invitationConnectionDefaultParams: {
279
279
  teleport: {
280
280
  controlHeartbeatInterval: 200
@@ -385,7 +385,7 @@ var TestPeer = class {
385
385
  return this._props.meshEchoReplicator ??= new import_echo_pipeline.MeshEchoReplicator();
386
386
  }
387
387
  get dataSpaceManager() {
388
- return this._props.dataSpaceManager ??= new import_chunk_RVO5327U.DataSpaceManager({
388
+ return this._props.dataSpaceManager ??= new import_chunk_DVPAB6LZ.DataSpaceManager({
389
389
  spaceManager: this.spaceManager,
390
390
  metadataStore: this.metadataStore,
391
391
  keyring: this.keyring,
@@ -400,9 +400,9 @@ var TestPeer = class {
400
400
  });
401
401
  }
402
402
  get invitationsManager() {
403
- return this._props.invitationsManager ??= new import_chunk_RVO5327U.InvitationsManager(new import_chunk_RVO5327U.InvitationsHandler(this.networkManager), (invitation) => {
403
+ return this._props.invitationsManager ??= new import_chunk_DVPAB6LZ.InvitationsManager(new import_chunk_DVPAB6LZ.InvitationsHandler(this.networkManager), (invitation) => {
404
404
  if (invitation.kind === import_services2.Invitation.Kind.SPACE) {
405
- return new import_chunk_RVO5327U.SpaceInvitationProtocol(this.dataSpaceManager, this.identity, this.keyring, invitation.spaceKey);
405
+ return new import_chunk_DVPAB6LZ.SpaceInvitationProtocol(this.dataSpaceManager, this.identity, this.keyring, invitation.spaceKey);
406
406
  } else {
407
407
  throw new Error("not implemented");
408
408
  }
@@ -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.3-main.2dd075e";
400
+ var DXOS_VERSION = "0.7.3-staging.0905f03";
401
401
 
402
402
  // packages/sdk/client-services/src/packlets/services/platform.ts
403
403
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -6948,6 +6948,7 @@ import { PublicKey as PublicKey13 } from "@dxos/keys";
6948
6948
  import { log as log21 } from "@dxos/log";
6949
6949
  import { EdgeAgentStatus, EdgeCallFailedError as EdgeCallFailedError3 } from "@dxos/protocols";
6950
6950
  import { SpaceState as SpaceState5 } from "@dxos/protocols/proto/dxos/client/services";
6951
+ import { EdgeReplicationSetting as EdgeReplicationSetting2 } from "@dxos/protocols/proto/dxos/echo/metadata";
6951
6952
  function _ts_decorate9(decorators, target, key, desc) {
6952
6953
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6953
6954
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -6957,6 +6958,7 @@ function _ts_decorate9(decorators, target, key, desc) {
6957
6958
  var __dxlog_file25 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/agents/edge-agent-manager.ts";
6958
6959
  var AGENT_STATUS_QUERY_RETRY_INTERVAL = 5e3;
6959
6960
  var AGENT_STATUS_QUERY_RETRY_JITTER = 1e3;
6961
+ var AGENT_FEED_ADDED_CHECK_INTERVAL_MS = 3e3;
6960
6962
  var EdgeAgentManager = class extends Resource6 {
6961
6963
  constructor(_edgeFeatures, _edgeHttpClient, _dataSpaceManager, _identity) {
6962
6964
  super();
@@ -6976,7 +6978,7 @@ var EdgeAgentManager = class extends Resource6 {
6976
6978
  async createAgent() {
6977
6979
  invariant19(this.isOpen, void 0, {
6978
6980
  F: __dxlog_file25,
6979
- L: 52,
6981
+ L: 54,
6980
6982
  S: this,
6981
6983
  A: [
6982
6984
  "this.isOpen",
@@ -6985,7 +6987,7 @@ var EdgeAgentManager = class extends Resource6 {
6985
6987
  });
6986
6988
  invariant19(this._edgeHttpClient, void 0, {
6987
6989
  F: __dxlog_file25,
6988
- L: 53,
6990
+ L: 55,
6989
6991
  S: this,
6990
6992
  A: [
6991
6993
  "this._edgeHttpClient",
@@ -6994,7 +6996,7 @@ var EdgeAgentManager = class extends Resource6 {
6994
6996
  });
6995
6997
  invariant19(this._edgeFeatures?.agents, void 0, {
6996
6998
  F: __dxlog_file25,
6997
- L: 54,
6999
+ L: 56,
6998
7000
  S: this,
6999
7001
  A: [
7000
7002
  "this._edgeFeatures?.agents",
@@ -7015,7 +7017,7 @@ var EdgeAgentManager = class extends Resource6 {
7015
7017
  });
7016
7018
  log21("agent created", response, {
7017
7019
  F: __dxlog_file25,
7018
- L: 71,
7020
+ L: 73,
7019
7021
  S: this,
7020
7022
  C: (f, a) => f(...a)
7021
7023
  });
@@ -7027,7 +7029,7 @@ var EdgeAgentManager = class extends Resource6 {
7027
7029
  isEnabled
7028
7030
  }, {
7029
7031
  F: __dxlog_file25,
7030
- L: 79,
7032
+ L: 81,
7031
7033
  S: this,
7032
7034
  C: (f, a) => f(...a)
7033
7035
  });
@@ -7060,7 +7062,7 @@ var EdgeAgentManager = class extends Resource6 {
7060
7062
  async _fetchAgentStatus() {
7061
7063
  invariant19(this._edgeHttpClient, void 0, {
7062
7064
  F: __dxlog_file25,
7063
- L: 113,
7065
+ L: 115,
7064
7066
  S: this,
7065
7067
  A: [
7066
7068
  "this._edgeHttpClient",
@@ -7070,7 +7072,7 @@ var EdgeAgentManager = class extends Resource6 {
7070
7072
  try {
7071
7073
  log21("fetching agent status", void 0, {
7072
7074
  F: __dxlog_file25,
7073
- L: 115,
7075
+ L: 117,
7074
7076
  S: this,
7075
7077
  C: (f, a) => f(...a)
7076
7078
  });
@@ -7089,7 +7091,7 @@ var EdgeAgentManager = class extends Resource6 {
7089
7091
  err
7090
7092
  }, {
7091
7093
  F: __dxlog_file25,
7092
- L: 125,
7094
+ L: 127,
7093
7095
  S: this,
7094
7096
  C: (f, a) => f(...a)
7095
7097
  });
@@ -7102,7 +7104,7 @@ var EdgeAgentManager = class extends Resource6 {
7102
7104
  retryAfterMs
7103
7105
  }, {
7104
7106
  F: __dxlog_file25,
7105
- L: 130,
7107
+ L: 132,
7106
7108
  S: this,
7107
7109
  C: (f, a) => f(...a)
7108
7110
  });
@@ -7115,27 +7117,37 @@ var EdgeAgentManager = class extends Resource6 {
7115
7117
  * Instead, we stay in active polling mode while there are spaces where we don't see our agent's feed.
7116
7118
  */
7117
7119
  _ensureAgentIsInSpaces(agentDeviceKey) {
7120
+ let activePollingEnabled = false;
7118
7121
  for (const space of this._dataSpaceManager.spaces.values()) {
7122
+ if (space.getEdgeReplicationSetting() === EdgeReplicationSetting2.DISABLED) {
7123
+ space.notarizationPlugin.setActiveEdgePollingEnabled(false);
7124
+ continue;
7125
+ }
7119
7126
  if ([
7120
7127
  SpaceState5.SPACE_INACTIVE,
7121
7128
  SpaceState5.SPACE_CLOSED
7122
7129
  ].includes(space.state)) {
7130
+ space.notarizationPlugin.setActiveEdgePollingEnabled(false);
7123
7131
  continue;
7124
7132
  }
7125
7133
  const agentFeedNeedsNotarization = ![
7126
7134
  ...space.inner.spaceState.feeds.values()
7127
7135
  ].some((feed) => feed.assertion.deviceKey.equals(agentDeviceKey));
7128
7136
  space.notarizationPlugin.setActiveEdgePollingEnabled(agentFeedNeedsNotarization);
7137
+ activePollingEnabled = activePollingEnabled || agentFeedNeedsNotarization;
7129
7138
  log21.info("set active edge polling", {
7130
7139
  enabled: agentFeedNeedsNotarization,
7131
7140
  spaceId: space.id
7132
7141
  }, {
7133
7142
  F: __dxlog_file25,
7134
- L: 150,
7143
+ L: 159,
7135
7144
  S: this,
7136
7145
  C: (f, a) => f(...a)
7137
7146
  });
7138
7147
  }
7148
+ if (activePollingEnabled) {
7149
+ scheduleTask8(this._ctx, () => this._ensureAgentIsInSpaces(agentDeviceKey), AGENT_FEED_ADDED_CHECK_INTERVAL_MS);
7150
+ }
7139
7151
  }
7140
7152
  _updateStatus(status, deviceKey) {
7141
7153
  this._agentStatus = status;
@@ -7148,7 +7160,7 @@ var EdgeAgentManager = class extends Resource6 {
7148
7160
  status
7149
7161
  }, {
7150
7162
  F: __dxlog_file25,
7151
- L: 161,
7163
+ L: 175,
7152
7164
  S: this,
7153
7165
  C: (f, a) => f(...a)
7154
7166
  });
@@ -8898,4 +8910,4 @@ export {
8898
8910
  importProfileData,
8899
8911
  ClientServicesHost
8900
8912
  };
8901
- //# sourceMappingURL=chunk-LMUKPYXE.mjs.map
8913
+ //# sourceMappingURL=chunk-6BGB6XSS.mjs.map