@dxos/client-services 0.1.25-next.3c6b542 → 0.1.26

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 (70) hide show
  1. package/dist/lib/browser/{chunk-WF53R6F7.mjs → chunk-R2FEBB66.mjs} +95 -325
  2. package/dist/lib/browser/chunk-R2FEBB66.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -11
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/packlets/testing/index.mjs +3 -3
  6. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  7. package/dist/lib/node/index.cjs +111 -350
  8. package/dist/lib/node/index.cjs.map +4 -4
  9. package/dist/lib/node/meta.json +1 -1
  10. package/dist/lib/node/packlets/testing/index.cjs +110 -228
  11. package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
  12. package/dist/types/src/packlets/identity/authenticator.d.ts +1 -1
  13. package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
  14. package/dist/types/src/packlets/identity/identity-manager.d.ts +1 -1
  15. package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
  16. package/dist/types/src/packlets/identity/identity.d.ts +2 -2
  17. package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
  18. package/dist/types/src/packlets/invitations/space-invitations-handler.d.ts +1 -1
  19. package/dist/types/src/packlets/invitations/space-invitations-handler.d.ts.map +1 -1
  20. package/dist/types/src/packlets/services/service-context.d.ts +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 +1 -1
  23. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  24. package/dist/types/src/packlets/spaces/data-space.d.ts +1 -1
  25. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  26. package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
  27. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  28. package/dist/types/src/packlets/testing/test-builder.d.ts +1 -1
  29. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  30. package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts +4 -11
  31. package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
  32. package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts +1 -6
  33. package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts.map +1 -1
  34. package/dist/types/src/packlets/vault/index.d.ts +0 -2
  35. package/dist/types/src/packlets/vault/index.d.ts.map +1 -1
  36. package/dist/types/src/packlets/vault/services.d.ts +1 -9
  37. package/dist/types/src/packlets/vault/services.d.ts.map +1 -1
  38. package/dist/types/src/packlets/vault/worker-runtime.d.ts +1 -2
  39. package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +1 -1
  40. package/dist/types/src/packlets/vault/worker-session.d.ts +1 -4
  41. package/dist/types/src/packlets/vault/worker-session.d.ts.map +1 -1
  42. package/package.json +28 -29
  43. package/src/packlets/devtools/spaces.ts +1 -1
  44. package/src/packlets/identity/authenticator.ts +1 -1
  45. package/src/packlets/identity/identity-manager.test.ts +1 -1
  46. package/src/packlets/identity/identity-manager.ts +1 -1
  47. package/src/packlets/identity/identity.test.ts +1 -1
  48. package/src/packlets/identity/identity.ts +1 -1
  49. package/src/packlets/invitations/space-invitations-handler.test.ts +1 -1
  50. package/src/packlets/invitations/space-invitations-handler.ts +1 -1
  51. package/src/packlets/services/service-context.ts +2 -2
  52. package/src/packlets/services/service-host.ts +1 -1
  53. package/src/packlets/spaces/data-space-manager.test.ts +1 -1
  54. package/src/packlets/spaces/data-space-manager.ts +4 -4
  55. package/src/packlets/spaces/data-space.ts +3 -3
  56. package/src/packlets/spaces/spaces-service.ts +1 -1
  57. package/src/packlets/testing/test-builder.ts +3 -3
  58. package/src/packlets/vault/iframe-host-runtime.ts +7 -26
  59. package/src/packlets/vault/iframe-proxy-runtime.ts +1 -16
  60. package/src/packlets/vault/index.ts +0 -2
  61. package/src/packlets/vault/services.ts +1 -17
  62. package/src/packlets/vault/worker-runtime.ts +1 -3
  63. package/src/packlets/vault/worker-session.ts +19 -29
  64. package/dist/lib/browser/chunk-WF53R6F7.mjs.map +0 -7
  65. package/dist/types/src/packlets/vault/shell-controller.d.ts +0 -24
  66. package/dist/types/src/packlets/vault/shell-controller.d.ts.map +0 -1
  67. package/dist/types/src/packlets/vault/shell-runtime.d.ts +0 -45
  68. package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +0 -1
  69. package/src/packlets/vault/shell-controller.ts +0 -78
  70. package/src/packlets/vault/shell-runtime.ts +0 -133
@@ -61,8 +61,8 @@ var createMockCredential = async ({ signer, issuer }) => (0, import_credentials.
61
61
 
62
62
  // packages/sdk/client-services/src/packlets/testing/test-builder.ts
63
63
  var import_credentials13 = require("@dxos/credentials");
64
- var import_echo_pipeline6 = require("@dxos/echo-pipeline");
65
- var import_testing = require("@dxos/echo-pipeline/testing");
64
+ var import_echo_db6 = require("@dxos/echo-db");
65
+ var import_testing = require("@dxos/echo-db/testing");
66
66
  var import_feed_store5 = require("@dxos/feed-store");
67
67
  var import_keyring2 = require("@dxos/keyring");
68
68
  var import_messaging3 = require("@dxos/messaging");
@@ -73,7 +73,7 @@ var import_random_access_storage2 = require("@dxos/random-access-storage");
73
73
  var import_async11 = require("@dxos/async");
74
74
  var import_credentials11 = require("@dxos/credentials");
75
75
  var import_debug3 = require("@dxos/debug");
76
- var import_echo_pipeline3 = require("@dxos/echo-pipeline");
76
+ var import_echo_db3 = require("@dxos/echo-db");
77
77
  var import_feed_store3 = require("@dxos/feed-store");
78
78
  var import_keyring = require("@dxos/keyring");
79
79
  var import_log10 = require("@dxos/log");
@@ -1582,7 +1582,7 @@ var import_node_assert8 = __toESM(require("node:assert"));
1582
1582
  var import_async10 = require("@dxos/async");
1583
1583
  var import_context6 = require("@dxos/context");
1584
1584
  var import_credentials10 = require("@dxos/credentials");
1585
- var import_echo_pipeline2 = require("@dxos/echo-pipeline");
1585
+ var import_echo_db2 = require("@dxos/echo-db");
1586
1586
  var import_keys6 = require("@dxos/keys");
1587
1587
  var import_log9 = require("@dxos/log");
1588
1588
  var import_teleport_extension_presence = require("@dxos/teleport-extension-presence");
@@ -1592,7 +1592,7 @@ var import_util4 = require("@dxos/util");
1592
1592
  var import_async9 = require("@dxos/async");
1593
1593
  var import_context5 = require("@dxos/context");
1594
1594
  var import_debug2 = require("@dxos/debug");
1595
- var import_echo_pipeline = require("@dxos/echo-pipeline");
1595
+ var import_echo_db = require("@dxos/echo-db");
1596
1596
  var import_keys5 = require("@dxos/keys");
1597
1597
  var import_credentials9 = require("@dxos/protocols/proto/dxos/halo/credentials");
1598
1598
  var import_util3 = require("@dxos/util");
@@ -1855,7 +1855,7 @@ var DataSpace = class DataSpace2 {
1855
1855
  this._feedStore = params.feedStore;
1856
1856
  this._metadataStore = params.metadataStore;
1857
1857
  this._signingContext = params.signingContext;
1858
- this._dataPipelineController = new import_echo_pipeline.DataPipelineControllerImpl({
1858
+ this._dataPipelineController = new import_echo_db.DataPipelineControllerImpl({
1859
1859
  modelFactory: params.modelFactory,
1860
1860
  metadataStore: params.metadataStore,
1861
1861
  snapshotManager: params.snapshotManager,
@@ -1911,7 +1911,7 @@ var DataSpace = class DataSpace2 {
1911
1911
  timeout: CONTROL_PIPELINE_READY_TIMEFRAME
1912
1912
  });
1913
1913
  await this._createWritableFeeds();
1914
- this.notarizationPlugin.setWriter((0, import_echo_pipeline.createMappedFeedWriter)((credential) => ({
1914
+ this.notarizationPlugin.setWriter((0, import_echo_db.createMappedFeedWriter)((credential) => ({
1915
1915
  credential: {
1916
1916
  credential
1917
1917
  }
@@ -2061,7 +2061,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2061
2061
  callSite: (f, a) => f(...a)
2062
2062
  });
2063
2063
  const space = await this._constructSpace(metadata);
2064
- const credentials = await (0, import_echo_pipeline2.spaceGenesis)(this._keyring, this._signingContext, space.inner);
2064
+ const credentials = await (0, import_echo_db2.spaceGenesis)(this._keyring, this._signingContext, space.inner);
2065
2065
  await this._metadataStore.addSpace(metadata);
2066
2066
  const memberCredential = credentials[1];
2067
2067
  (0, import_node_assert8.default)((0, import_credentials10.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
@@ -2092,7 +2092,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2092
2092
  offlineTimeout: 3e4,
2093
2093
  identityKey: this._signingContext.identityKey
2094
2094
  });
2095
- const snapshotManager = new import_echo_pipeline2.SnapshotManager(this._snapshotStore);
2095
+ const snapshotManager = new import_echo_db2.SnapshotManager(this._snapshotStore);
2096
2096
  const controlFeed = metadata.controlFeedKey && await this._feedStore.openFeed(metadata.controlFeedKey, {
2097
2097
  writable: true
2098
2098
  });
@@ -2157,20 +2157,20 @@ var ServiceContext = class {
2157
2157
  this.networkManager = networkManager;
2158
2158
  this.modelFactory = modelFactory;
2159
2159
  this.initialized = new import_async11.Trigger();
2160
- this.dataServiceSubscriptions = new import_echo_pipeline3.DataServiceSubscriptions();
2161
- this.metadataStore = new import_echo_pipeline3.MetadataStore(storage.createDirectory("metadata"));
2162
- this.snapshotStore = new import_echo_pipeline3.SnapshotStore(storage.createDirectory("snapshots"));
2160
+ this.dataServiceSubscriptions = new import_echo_db3.DataServiceSubscriptions();
2161
+ this.metadataStore = new import_echo_db3.MetadataStore(storage.createDirectory("metadata"));
2162
+ this.snapshotStore = new import_echo_db3.SnapshotStore(storage.createDirectory("snapshots"));
2163
2163
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
2164
2164
  this.feedStore = new import_feed_store3.FeedStore({
2165
2165
  factory: new import_feed_store3.FeedFactory({
2166
2166
  root: storage.createDirectory("feeds"),
2167
2167
  signer: this.keyring,
2168
2168
  hypercore: {
2169
- valueEncoding: import_echo_pipeline3.valueEncoding
2169
+ valueEncoding: import_echo_db3.valueEncoding
2170
2170
  }
2171
2171
  })
2172
2172
  });
2173
- this.spaceManager = new import_echo_pipeline3.SpaceManager({
2173
+ this.spaceManager = new import_echo_db3.SpaceManager({
2174
2174
  feedStore: this.feedStore,
2175
2175
  networkManager: this.networkManager
2176
2176
  });
@@ -2359,8 +2359,8 @@ var clientServiceBundle = (0, import_rpc.createServiceBundle)({
2359
2359
  // packages/sdk/client-services/src/packlets/services/service-host.ts
2360
2360
  var import_debug7 = require("@dxos/debug");
2361
2361
  var import_document_model = require("@dxos/document-model");
2362
- var import_echo_pipeline5 = require("@dxos/echo-pipeline");
2363
- var import_log17 = require("@dxos/log");
2362
+ var import_echo_db5 = require("@dxos/echo-db");
2363
+ var import_log16 = require("@dxos/log");
2364
2364
  var import_model_factory = require("@dxos/model-factory");
2365
2365
  var import_client2 = require("@dxos/protocols/proto/dxos/client");
2366
2366
  var import_text_model = require("@dxos/text-model");
@@ -2914,7 +2914,7 @@ var NetworkServiceImpl = class {
2914
2914
  var import_async15 = require("@dxos/async");
2915
2915
  var import_codec_protobuf11 = require("@dxos/codec-protobuf");
2916
2916
  var import_debug6 = require("@dxos/debug");
2917
- var import_echo_pipeline4 = require("@dxos/echo-pipeline");
2917
+ var import_echo_db4 = require("@dxos/echo-db");
2918
2918
  var SpacesServiceImpl = class {
2919
2919
  constructor(_spaceManager) {
2920
2920
  this._spaceManager = _spaceManager;
@@ -2931,7 +2931,7 @@ var SpacesServiceImpl = class {
2931
2931
  queryCredentials({ spaceKey }) {
2932
2932
  return new import_codec_protobuf11.Stream(({ ctx, next }) => {
2933
2933
  var _a;
2934
- const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_pipeline4.SpaceNotFoundError(spaceKey));
2934
+ const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_db4.SpaceNotFoundError(spaceKey));
2935
2935
  const processor = space.spaceState.registerProcessor({
2936
2936
  process: async (credential) => {
2937
2937
  next(credential);
@@ -2943,7 +2943,7 @@ var SpacesServiceImpl = class {
2943
2943
  }
2944
2944
  async writeCredentials({ spaceKey, credentials }) {
2945
2945
  var _a;
2946
- const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_pipeline4.SpaceNotFoundError(spaceKey));
2946
+ const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_db4.SpaceNotFoundError(spaceKey));
2947
2947
  for (const credential of credentials != null ? credentials : []) {
2948
2948
  await space.controlPipeline.writer.write({
2949
2949
  credential: {
@@ -3000,100 +3000,11 @@ var toStorageType = (type) => {
3000
3000
  };
3001
3001
 
3002
3002
  // packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
3003
- var import_async17 = require("@dxos/async");
3003
+ var import_async16 = require("@dxos/async");
3004
3004
  var import_log12 = require("@dxos/log");
3005
3005
  var import_messaging = require("@dxos/messaging");
3006
3006
  var import_network_manager3 = require("@dxos/network-manager");
3007
- var import_rpc3 = require("@dxos/rpc");
3008
- var import_util7 = require("@dxos/util");
3009
-
3010
- // packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
3011
- var import_node_assert11 = __toESM(require("node:assert"));
3012
- var import_async16 = require("@dxos/async");
3013
- var import_iframe = require("@dxos/protocols/proto/dxos/iframe");
3014
3007
  var import_rpc2 = require("@dxos/rpc");
3015
-
3016
- // packages/sdk/client-services/src/packlets/vault/services.ts
3017
- var import_protocols7 = require("@dxos/protocols");
3018
- var iframeServiceBundle = {
3019
- IframeService: import_protocols7.schema.getService("dxos.iframe.IframeService"),
3020
- BridgeService: import_protocols7.schema.getService("dxos.mesh.bridge.BridgeService")
3021
- };
3022
- var workerServiceBundle = {
3023
- WorkerService: import_protocols7.schema.getService("dxos.iframe.WorkerService")
3024
- };
3025
- var appServiceBundle = {
3026
- AppService: import_protocols7.schema.getService("dxos.iframe.AppService")
3027
- };
3028
- var shellServiceBundle = {
3029
- ShellService: import_protocols7.schema.getService("dxos.iframe.ShellService")
3030
- };
3031
-
3032
- // packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
3033
- var ShellRuntimeImpl = class {
3034
- constructor(_port) {
3035
- this._port = _port;
3036
- this.layoutUpdate = new import_async16.Event();
3037
- this._layout = import_iframe.ShellLayout.DEFAULT;
3038
- }
3039
- get layout() {
3040
- return this._layout;
3041
- }
3042
- get invitationCode() {
3043
- return this._invitationCode;
3044
- }
3045
- get spaceKey() {
3046
- return this._spaceKey;
3047
- }
3048
- setLayout(layout, options = {}) {
3049
- this._layout = layout;
3050
- this._invitationCode = options.invitationCode;
3051
- this._spaceKey = options.spaceKey;
3052
- this.layoutUpdate.emit({
3053
- layout,
3054
- ...options
3055
- });
3056
- }
3057
- async setAppContext(context) {
3058
- (0, import_node_assert11.default)(this._appRpc, "runtime not open");
3059
- if (context.spaceKey) {
3060
- this._spaceKey = context.spaceKey;
3061
- }
3062
- if (context.invitationCode) {
3063
- this._invitationCode = context.invitationCode;
3064
- }
3065
- await this._appRpc.rpc.AppService.setContext({
3066
- ...context,
3067
- spaceKey: this._spaceKey,
3068
- invitationCode: this._invitationCode
3069
- });
3070
- }
3071
- async open() {
3072
- this._appRpc = (0, import_rpc2.createProtoRpcPeer)({
3073
- requested: appServiceBundle,
3074
- exposed: shellServiceBundle,
3075
- handlers: {
3076
- ShellService: {
3077
- setLayout: async (request) => {
3078
- this._layout = request.layout;
3079
- this._invitationCode = request.invitationCode;
3080
- this._spaceKey = request.spaceKey;
3081
- this.layoutUpdate.emit(request);
3082
- }
3083
- }
3084
- },
3085
- port: this._port
3086
- });
3087
- await this._appRpc.open();
3088
- }
3089
- async close() {
3090
- var _a;
3091
- await ((_a = this._appRpc) == null ? void 0 : _a.close());
3092
- this._appRpc = void 0;
3093
- }
3094
- };
3095
-
3096
- // packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
3097
3008
  var __decorate3 = function(decorators, target, key, desc) {
3098
3009
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3099
3010
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -3106,12 +3017,11 @@ var __decorate3 = function(decorators, target, key, desc) {
3106
3017
  };
3107
3018
  var LOCK_KEY = "DXOS_RESOURCE_LOCK";
3108
3019
  var IFrameHostRuntime = class {
3109
- constructor({ configProvider, appPort, shellPort }) {
3020
+ constructor({ configProvider, appPort }) {
3110
3021
  this._transportFactory = (0, import_network_manager3.createWebRTCTransportFactory)();
3111
- this._ready = new import_async17.Trigger();
3022
+ this._ready = new import_async16.Trigger();
3112
3023
  this._configProvider = configProvider;
3113
3024
  this._appPort = appPort;
3114
- this._shellPort = shellPort;
3115
3025
  this._getService = async (find) => {
3116
3026
  const error = await this._ready.wait();
3117
3027
  if (error) {
@@ -3123,26 +3033,16 @@ var IFrameHostRuntime = class {
3123
3033
  }
3124
3034
  return service;
3125
3035
  };
3126
- if (this._shellPort) {
3127
- this._shellRuntime = new ShellRuntimeImpl(this._shellPort);
3128
- }
3129
- }
3130
- get services() {
3131
- return this._clientServices;
3132
- }
3133
- get shell() {
3134
- return this._shellRuntime;
3135
3036
  }
3136
3037
  async start() {
3137
- var _a;
3138
3038
  (0, import_log12.log)("starting...", {}, {
3139
3039
  file: "iframe-host-runtime.ts",
3140
- line: 81,
3040
+ line: 63,
3141
3041
  scope: this,
3142
3042
  callSite: (f, a) => f(...a)
3143
3043
  });
3144
3044
  try {
3145
- this._config = await (0, import_util7.getAsyncValue)(this._configProvider);
3045
+ this._config = await this._configProvider();
3146
3046
  const signalServer = this._config.get("runtime.services.signal.server");
3147
3047
  this._clientServices = new ClientServicesHost({
3148
3048
  lockKey: LOCK_KEY,
@@ -3155,7 +3055,7 @@ var IFrameHostRuntime = class {
3155
3055
  transportFactory: this._transportFactory
3156
3056
  })
3157
3057
  });
3158
- this._clientRpc = (0, import_rpc3.createProtoRpcPeer)({
3058
+ this._clientRpc = (0, import_rpc2.createProtoRpcPeer)({
3159
3059
  exposed: clientServiceBundle,
3160
3060
  handlers: {
3161
3061
  DataService: async () => await this._getService((services) => services.DataService),
@@ -3174,13 +3074,12 @@ var IFrameHostRuntime = class {
3174
3074
  });
3175
3075
  await Promise.all([
3176
3076
  this._clientServices.open(),
3177
- this._clientRpc.open(),
3178
- (_a = this._shellRuntime) == null ? void 0 : _a.open()
3077
+ this._clientRpc.open()
3179
3078
  ]);
3180
3079
  this._ready.wake(void 0);
3181
3080
  (0, import_log12.log)("started", {}, {
3182
3081
  file: "iframe-host-runtime.ts",
3183
- line: 117,
3082
+ line: 99,
3184
3083
  scope: this,
3185
3084
  callSite: (f, a) => f(...a)
3186
3085
  });
@@ -3188,26 +3087,24 @@ var IFrameHostRuntime = class {
3188
3087
  this._ready.wake(err);
3189
3088
  import_log12.log.catch(err, {}, {
3190
3089
  file: "iframe-host-runtime.ts",
3191
- line: 120,
3090
+ line: 102,
3192
3091
  scope: this,
3193
3092
  callSite: (f, a) => f(...a)
3194
3093
  });
3195
3094
  }
3196
3095
  }
3197
3096
  async stop() {
3198
- var _a;
3199
3097
  (0, import_log12.log)("stopping...", {}, {
3200
3098
  file: "iframe-host-runtime.ts",
3201
- line: 125,
3099
+ line: 107,
3202
3100
  scope: this,
3203
3101
  callSite: (f, a) => f(...a)
3204
3102
  });
3205
3103
  await this._clientRpc.close();
3206
3104
  await this._clientServices.close();
3207
- await ((_a = this._shellRuntime) == null ? void 0 : _a.close());
3208
3105
  (0, import_log12.log)("stopped", {}, {
3209
3106
  file: "iframe-host-runtime.ts",
3210
- line: 129,
3107
+ line: 110,
3211
3108
  scope: this,
3212
3109
  callSite: (f, a) => f(...a)
3213
3110
  });
@@ -3219,17 +3116,21 @@ __decorate3([
3219
3116
 
3220
3117
  // packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts
3221
3118
  var import_network_manager4 = require("@dxos/network-manager");
3222
- var import_rpc4 = require("@dxos/rpc");
3119
+ var import_rpc3 = require("@dxos/rpc");
3223
3120
 
3224
- // packages/sdk/client-services/src/packlets/vault/shell-controller.ts
3225
- var import_async18 = require("@dxos/async");
3226
- var import_log13 = require("@dxos/log");
3227
- var import_iframe2 = require("@dxos/protocols/proto/dxos/iframe");
3228
- var import_rpc5 = require("@dxos/rpc");
3121
+ // packages/sdk/client-services/src/packlets/vault/services.ts
3122
+ var import_protocols7 = require("@dxos/protocols");
3123
+ var iframeServiceBundle = {
3124
+ IframeService: import_protocols7.schema.getService("dxos.iframe.IframeService"),
3125
+ BridgeService: import_protocols7.schema.getService("dxos.mesh.bridge.BridgeService")
3126
+ };
3127
+ var workerServiceBundle = {
3128
+ WorkerService: import_protocols7.schema.getService("dxos.iframe.WorkerService")
3129
+ };
3229
3130
 
3230
3131
  // packages/sdk/client-services/src/packlets/vault/vault-resource-lock.ts
3231
- var import_async19 = require("@dxos/async");
3232
- var import_log14 = require("@dxos/log");
3132
+ var import_async17 = require("@dxos/async");
3133
+ var import_log13 = require("@dxos/log");
3233
3134
  var Message;
3234
3135
  (function(Message2) {
3235
3136
  Message2["ACQUIRING"] = "acquiring";
@@ -3237,7 +3138,7 @@ var Message;
3237
3138
  var VaultResourceLock = class {
3238
3139
  constructor({ lockKey, onAcquire, onRelease }) {
3239
3140
  this._broadcastChannel = new BroadcastChannel("vault-resource-lock");
3240
- this._releaseTrigger = new import_async19.Trigger();
3141
+ this._releaseTrigger = new import_async17.Trigger();
3241
3142
  this._lockKey = lockKey;
3242
3143
  this._onAcquire = onAcquire;
3243
3144
  this._onRelease = onRelease;
@@ -3248,7 +3149,7 @@ var VaultResourceLock = class {
3248
3149
  message: Message.ACQUIRING
3249
3150
  });
3250
3151
  try {
3251
- await (0, import_async19.asyncTimeout)(this._requestLock(), 3e3);
3152
+ await (0, import_async17.asyncTimeout)(this._requestLock(), 3e3);
3252
3153
  } catch (e) {
3253
3154
  await this._requestLock(true);
3254
3155
  }
@@ -3262,7 +3163,7 @@ var VaultResourceLock = class {
3262
3163
  }
3263
3164
  }
3264
3165
  async _requestLock(steal = false) {
3265
- (0, import_log14.log)("requesting lock...", {
3166
+ (0, import_log13.log)("requesting lock...", {
3266
3167
  steal
3267
3168
  }, {
3268
3169
  file: "vault-resource-lock.ts",
@@ -3270,23 +3171,23 @@ var VaultResourceLock = class {
3270
3171
  scope: this,
3271
3172
  callSite: (f, a) => f(...a)
3272
3173
  });
3273
- const acquired = new import_async19.Trigger();
3174
+ const acquired = new import_async17.Trigger();
3274
3175
  void navigator.locks.request(this._lockKey, {
3275
3176
  steal
3276
3177
  }, async () => {
3277
3178
  var _a, _b;
3278
3179
  await ((_a = this._onAcquire) == null ? void 0 : _a.call(this));
3279
3180
  acquired.wake();
3280
- this._releaseTrigger = new import_async19.Trigger();
3181
+ this._releaseTrigger = new import_async17.Trigger();
3281
3182
  await this._releaseTrigger.wait();
3282
- (0, import_log14.log)("releasing lock...", {}, {
3183
+ (0, import_log13.log)("releasing lock...", {}, {
3283
3184
  file: "vault-resource-lock.ts",
3284
3185
  line: 65,
3285
3186
  scope: this,
3286
3187
  callSite: (f, a) => f(...a)
3287
3188
  });
3288
3189
  await ((_b = this._onRelease) == null ? void 0 : _b.call(this));
3289
- (0, import_log14.log)("released lock", {}, {
3190
+ (0, import_log13.log)("released lock", {}, {
3290
3191
  file: "vault-resource-lock.ts",
3291
3192
  line: 67,
3292
3193
  scope: this,
@@ -3297,7 +3198,7 @@ var VaultResourceLock = class {
3297
3198
  await ((_a = this._onRelease) == null ? void 0 : _a.call(this));
3298
3199
  });
3299
3200
  await acquired.wait();
3300
- (0, import_log14.log)("recieved lock", {
3201
+ (0, import_log13.log)("recieved lock", {
3301
3202
  steal
3302
3203
  }, {
3303
3204
  file: "vault-resource-lock.ts",
@@ -3309,17 +3210,17 @@ var VaultResourceLock = class {
3309
3210
  };
3310
3211
 
3311
3212
  // packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
3312
- var import_async21 = require("@dxos/async");
3313
- var import_log16 = require("@dxos/log");
3213
+ var import_async19 = require("@dxos/async");
3214
+ var import_log15 = require("@dxos/log");
3314
3215
  var import_messaging2 = require("@dxos/messaging");
3315
3216
  var import_network_manager5 = require("@dxos/network-manager");
3316
3217
 
3317
3218
  // packages/sdk/client-services/src/packlets/vault/worker-session.ts
3318
- var import_node_assert12 = __toESM(require("node:assert"));
3319
- var import_async20 = require("@dxos/async");
3320
- var import_log15 = require("@dxos/log");
3321
- var import_rpc6 = require("@dxos/rpc");
3322
- var import_util8 = require("@dxos/util");
3219
+ var import_node_assert11 = __toESM(require("node:assert"));
3220
+ var import_async18 = require("@dxos/async");
3221
+ var import_log14 = require("@dxos/log");
3222
+ var import_rpc4 = require("@dxos/rpc");
3223
+ var import_util7 = require("@dxos/util");
3323
3224
  var __decorate4 = function(decorators, target, key, desc) {
3324
3225
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3325
3226
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -3331,39 +3232,33 @@ var __decorate4 = function(decorators, target, key, desc) {
3331
3232
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3332
3233
  };
3333
3234
  var WorkerSession = class {
3334
- constructor({ getService, systemPort, appPort, shellPort, options = {
3235
+ constructor({ getService, systemPort, appPort, options = {
3335
3236
  heartbeatInterval: 1e3
3336
3237
  } }) {
3337
- this._startTrigger = new import_async20.Trigger();
3338
- this.onClose = new import_util8.Callback();
3339
- (0, import_node_assert12.default)(options);
3340
- (0, import_node_assert12.default)(getService);
3238
+ this._startTrigger = new import_async18.Trigger();
3239
+ this.onClose = new import_util7.Callback();
3240
+ (0, import_node_assert11.default)(options);
3241
+ (0, import_node_assert11.default)(getService);
3341
3242
  this._options = options;
3342
3243
  this._getService = getService;
3343
- const handlers = {
3344
- DataService: async () => await this._getService((services) => services.DataService),
3345
- DevicesService: async () => await this._getService((services) => services.DevicesService),
3346
- DevtoolsHost: async () => await this._getService((services) => services.DevtoolsHost),
3347
- HaloInvitationsService: async () => await this._getService((services) => services.HaloInvitationsService),
3348
- NetworkService: async () => await this._getService((services) => services.NetworkService),
3349
- ProfileService: async () => await this._getService((services) => services.ProfileService),
3350
- SpaceInvitationsService: async () => await this._getService((services) => services.SpaceInvitationsService),
3351
- SpaceService: async () => await this._getService((services) => services.SpaceService),
3352
- SpacesService: async () => await this._getService((services) => services.SpacesService),
3353
- SystemService: async () => await this._getService((services) => services.SystemService),
3354
- TracingService: async () => await this._getService((services) => services.TracingService)
3355
- };
3356
- this._clientRpc = (0, import_rpc6.createProtoRpcPeer)({
3244
+ this._clientRpc = (0, import_rpc4.createProtoRpcPeer)({
3357
3245
  exposed: clientServiceBundle,
3358
- handlers,
3246
+ handlers: {
3247
+ DataService: async () => await this._getService((services) => services.DataService),
3248
+ DevicesService: async () => await this._getService((services) => services.DevicesService),
3249
+ DevtoolsHost: async () => await this._getService((services) => services.DevtoolsHost),
3250
+ HaloInvitationsService: async () => await this._getService((services) => services.HaloInvitationsService),
3251
+ NetworkService: async () => await this._getService((services) => services.NetworkService),
3252
+ ProfileService: async () => await this._getService((services) => services.ProfileService),
3253
+ SpaceInvitationsService: async () => await this._getService((services) => services.SpaceInvitationsService),
3254
+ SpaceService: async () => await this._getService((services) => services.SpaceService),
3255
+ SpacesService: async () => await this._getService((services) => services.SpacesService),
3256
+ SystemService: async () => await this._getService((services) => services.SystemService),
3257
+ TracingService: async () => await this._getService((services) => services.TracingService)
3258
+ },
3359
3259
  port: appPort
3360
3260
  });
3361
- this._shellClientRpc = (0, import_rpc6.createProtoRpcPeer)({
3362
- exposed: clientServiceBundle,
3363
- handlers,
3364
- port: shellPort
3365
- });
3366
- this._iframeRpc = (0, import_rpc6.createProtoRpcPeer)({
3261
+ this._iframeRpc = (0, import_rpc4.createProtoRpcPeer)({
3367
3262
  requested: iframeServiceBundle,
3368
3263
  exposed: workerServiceBundle,
3369
3264
  handlers: {
@@ -3377,9 +3272,9 @@ var WorkerSession = class {
3377
3272
  try {
3378
3273
  await this.close();
3379
3274
  } catch (err) {
3380
- import_log15.log.catch(err, {}, {
3275
+ import_log14.log.catch(err, {}, {
3381
3276
  file: "worker-session.ts",
3382
- line: 92,
3277
+ line: 90,
3383
3278
  scope: this,
3384
3279
  callSite: (f, a) => f(...a)
3385
3280
  });
@@ -3395,16 +3290,15 @@ var WorkerSession = class {
3395
3290
  this.bridgeService = this._iframeRpc.rpc.BridgeService;
3396
3291
  }
3397
3292
  async open() {
3398
- import_log15.log.info("opening..", {}, {
3293
+ import_log14.log.info("opening..", {}, {
3399
3294
  file: "worker-session.ts",
3400
- line: 106,
3295
+ line: 104,
3401
3296
  scope: this,
3402
3297
  callSite: (f, a) => f(...a)
3403
3298
  });
3404
3299
  await Promise.all([
3405
3300
  this._clientRpc.open(),
3406
- this._iframeRpc.open(),
3407
- this._maybeOpenShell()
3301
+ this._iframeRpc.open()
3408
3302
  ]);
3409
3303
  await this._startTrigger.wait({
3410
3304
  timeout: 3e3
@@ -3413,20 +3307,20 @@ var WorkerSession = class {
3413
3307
  try {
3414
3308
  await this._iframeRpc.rpc.IframeService.heartbeat();
3415
3309
  } catch (err1) {
3416
- import_log15.log.warn("Heartbeat failed", {
3310
+ import_log14.log.warn("Heartbeat failed", {
3417
3311
  err: err1
3418
3312
  }, {
3419
3313
  file: "worker-session.ts",
3420
- line: 118,
3314
+ line: 116,
3421
3315
  scope: this,
3422
3316
  callSite: (f, a) => f(...a)
3423
3317
  });
3424
3318
  try {
3425
3319
  await this.close();
3426
3320
  } catch (err) {
3427
- import_log15.log.catch(err, {}, {
3321
+ import_log14.log.catch(err, {}, {
3428
3322
  file: "worker-session.ts",
3429
- line: 122,
3323
+ line: 120,
3430
3324
  scope: this,
3431
3325
  callSite: (f, a) => f(...a)
3432
3326
  });
@@ -3435,18 +3329,18 @@ var WorkerSession = class {
3435
3329
  }, this._options.heartbeatInterval);
3436
3330
  }
3437
3331
  async close() {
3438
- import_log15.log.info("closing..", {}, {
3332
+ import_log14.log.info("closing..", {}, {
3439
3333
  file: "worker-session.ts",
3440
- line: 129,
3334
+ line: 127,
3441
3335
  scope: this,
3442
3336
  callSite: (f, a) => f(...a)
3443
3337
  });
3444
3338
  try {
3445
3339
  await this.onClose.callIfSet();
3446
3340
  } catch (err) {
3447
- import_log15.log.catch(err, {}, {
3341
+ import_log14.log.catch(err, {}, {
3448
3342
  file: "worker-session.ts",
3449
- line: 133,
3343
+ line: 131,
3450
3344
  scope: this,
3451
3345
  callSite: (f, a) => f(...a)
3452
3346
  });
@@ -3459,21 +3353,9 @@ var WorkerSession = class {
3459
3353
  this._iframeRpc.close()
3460
3354
  ]);
3461
3355
  }
3462
- async _maybeOpenShell() {
3463
- try {
3464
- await (0, import_async20.asyncTimeout)(this._shellClientRpc.open(), 1e3);
3465
- } catch (e) {
3466
- import_log15.log.info("No shell connected.", {}, {
3467
- file: "worker-session.ts",
3468
- line: 147,
3469
- scope: this,
3470
- callSite: (f, a) => f(...a)
3471
- });
3472
- }
3473
- }
3474
3356
  };
3475
3357
  __decorate4([
3476
- import_log15.logInfo
3358
+ import_log14.logInfo
3477
3359
  ], WorkerSession.prototype, "origin", void 0);
3478
3360
 
3479
3361
  // packages/sdk/client-services/src/packlets/services/service-registry.ts
@@ -3556,7 +3438,7 @@ var ClientServicesHost = class {
3556
3438
  if (this._open) {
3557
3439
  return;
3558
3440
  }
3559
- (0, import_log17.log)("opening...", {}, {
3441
+ (0, import_log16.log)("opening...", {}, {
3560
3442
  file: "service-host.ts",
3561
3443
  line: 125,
3562
3444
  scope: this,
@@ -3576,7 +3458,7 @@ var ClientServicesHost = class {
3576
3458
  return (_a2 = this._serviceContext.dataSpaceManager) != null ? _a2 : (0, import_debug7.raise)(new Error("SpaceManager not initialized"));
3577
3459
  }),
3578
3460
  SpacesService: new SpacesServiceImpl(this._serviceContext.spaceManager),
3579
- DataService: new import_echo_pipeline5.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
3461
+ DataService: new import_echo_db5.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
3580
3462
  NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager),
3581
3463
  // TODO(burdon): Move to new protobuf definitions.
3582
3464
  ProfileService: new ProfileServiceImpl(this._serviceContext),
@@ -3592,7 +3474,7 @@ var ClientServicesHost = class {
3592
3474
  await this._serviceContext.open();
3593
3475
  this._open = true;
3594
3476
  const deviceKey = (_a = this._serviceContext.identityManager.identity) == null ? void 0 : _a.deviceKey;
3595
- (0, import_log17.log)("opened", {
3477
+ (0, import_log16.log)("opened", {
3596
3478
  deviceKey
3597
3479
  }, {
3598
3480
  file: "service-host.ts",
@@ -3607,7 +3489,7 @@ var ClientServicesHost = class {
3607
3489
  return;
3608
3490
  }
3609
3491
  const deviceKey = (_a = this._serviceContext.identityManager.identity) == null ? void 0 : _a.deviceKey;
3610
- (0, import_log17.log)("closing...", {
3492
+ (0, import_log16.log)("closing...", {
3611
3493
  deviceKey
3612
3494
  }, {
3613
3495
  file: "service-host.ts",
@@ -3620,7 +3502,7 @@ var ClientServicesHost = class {
3620
3502
  });
3621
3503
  await this._serviceContext.close();
3622
3504
  this._open = false;
3623
- (0, import_log17.log)("closed", {
3505
+ (0, import_log16.log)("closed", {
3624
3506
  deviceKey
3625
3507
  }, {
3626
3508
  file: "service-host.ts",
@@ -3632,9 +3514,9 @@ var ClientServicesHost = class {
3632
3514
  };
3633
3515
 
3634
3516
  // packages/sdk/client-services/src/packlets/services/service-proxy.ts
3635
- var import_async22 = require("@dxos/async");
3517
+ var import_async20 = require("@dxos/async");
3636
3518
  var import_errors2 = require("@dxos/errors");
3637
- var import_rpc7 = require("@dxos/rpc");
3519
+ var import_rpc5 = require("@dxos/rpc");
3638
3520
 
3639
3521
  // packages/sdk/client-services/src/packlets/testing/test-builder.ts
3640
3522
  var createServiceHost = (config, signalManagerContext) => {
@@ -3705,18 +3587,18 @@ var TestPeer = class {
3705
3587
  root: this.storage.createDirectory("feeds"),
3706
3588
  signer: this.keyring,
3707
3589
  hypercore: {
3708
- valueEncoding: import_echo_pipeline6.valueEncoding
3590
+ valueEncoding: import_echo_db6.valueEncoding
3709
3591
  }
3710
3592
  })
3711
3593
  });
3712
3594
  }
3713
3595
  get metadataStore() {
3714
3596
  var _a, _b;
3715
- return (_b = (_a = this._props).metadataStore) != null ? _b : _a.metadataStore = new import_echo_pipeline6.MetadataStore(this.storage.createDirectory("metadata"));
3597
+ return (_b = (_a = this._props).metadataStore) != null ? _b : _a.metadataStore = new import_echo_db6.MetadataStore(this.storage.createDirectory("metadata"));
3716
3598
  }
3717
3599
  get snapshotStore() {
3718
3600
  var _a, _b;
3719
- return (_b = (_a = this._props).snapshotStore) != null ? _b : _a.snapshotStore = new import_echo_pipeline6.SnapshotStore(this.storage.createDirectory("snapshots"));
3601
+ return (_b = (_a = this._props).snapshotStore) != null ? _b : _a.snapshotStore = new import_echo_db6.SnapshotStore(this.storage.createDirectory("snapshots"));
3720
3602
  }
3721
3603
  get networkManager() {
3722
3604
  var _a, _b;
@@ -3727,7 +3609,7 @@ var TestPeer = class {
3727
3609
  }
3728
3610
  get spaceManager() {
3729
3611
  var _a, _b;
3730
- return (_b = (_a = this._props).spaceManager) != null ? _b : _a.spaceManager = new import_echo_pipeline6.SpaceManager({
3612
+ return (_b = (_a = this._props).spaceManager) != null ? _b : _a.spaceManager = new import_echo_db6.SpaceManager({
3731
3613
  feedStore: this.feedStore,
3732
3614
  networkManager: this.networkManager
3733
3615
  });
@@ -3749,24 +3631,24 @@ var createSigningContext = async (keyring) => {
3749
3631
  };
3750
3632
 
3751
3633
  // packages/sdk/client-services/src/packlets/testing/invitation-utils.ts
3752
- var import_node_assert13 = __toESM(require("node:assert"));
3753
- var import_async23 = require("@dxos/async");
3634
+ var import_node_assert12 = __toESM(require("node:assert"));
3635
+ var import_async21 = require("@dxos/async");
3754
3636
  var import_debug8 = require("@dxos/debug");
3755
- var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
3637
+ var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
3756
3638
  var performInvitation = async (host, guest, context) => {
3757
- const done1 = new import_async23.Trigger();
3758
- const done2 = new import_async23.Trigger();
3639
+ const done1 = new import_async21.Trigger();
3640
+ const done2 = new import_async21.Trigger();
3759
3641
  const observable1 = await host.createInvitation(context, {
3760
- type: import_services14.Invitation.Type.INTERACTIVE_TESTING
3642
+ type: import_services12.Invitation.Type.INTERACTIVE_TESTING
3761
3643
  });
3762
3644
  observable1.subscribe({
3763
3645
  onConnecting: async (invitation1) => {
3764
3646
  const observable2 = await guest.acceptInvitation(invitation1, {
3765
- type: import_services14.Invitation.Type.INTERACTIVE_TESTING
3647
+ type: import_services12.Invitation.Type.INTERACTIVE_TESTING
3766
3648
  });
3767
3649
  observable2.subscribe({
3768
3650
  onConnecting: async (invitation2) => {
3769
- (0, import_node_assert13.default)(invitation1.swarmKey.equals(invitation2.swarmKey));
3651
+ (0, import_node_assert12.default)(invitation1.swarmKey.equals(invitation2.swarmKey));
3770
3652
  },
3771
3653
  onConnected: async (invitation2) => {
3772
3654
  },