@dxos/client-services 0.1.24 → 0.1.25-next.3c6b542
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.
- package/dist/lib/browser/{chunk-R2FEBB66.mjs → chunk-WF53R6F7.mjs} +325 -95
- package/dist/lib/browser/chunk-WF53R6F7.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +11 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +3 -3
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +350 -111
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +228 -110
- package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
- package/dist/types/src/packlets/identity/authenticator.d.ts +1 -1
- package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +2 -2
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitations-handler.d.ts +1 -1
- package/dist/types/src/packlets/invitations/space-invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts +11 -4
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts +6 -1
- package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/index.d.ts +2 -0
- package/dist/types/src/packlets/vault/index.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/services.d.ts +9 -1
- package/dist/types/src/packlets/vault/services.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/shell-controller.d.ts +24 -0
- package/dist/types/src/packlets/vault/shell-controller.d.ts.map +1 -0
- package/dist/types/src/packlets/vault/shell-runtime.d.ts +45 -0
- package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +1 -0
- package/dist/types/src/packlets/vault/worker-runtime.d.ts +2 -1
- package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/worker-session.d.ts +4 -1
- package/dist/types/src/packlets/vault/worker-session.d.ts.map +1 -1
- package/package.json +29 -28
- package/src/packlets/devtools/spaces.ts +1 -1
- package/src/packlets/identity/authenticator.ts +1 -1
- package/src/packlets/identity/identity-manager.test.ts +1 -1
- package/src/packlets/identity/identity-manager.ts +1 -1
- package/src/packlets/identity/identity.test.ts +1 -1
- package/src/packlets/identity/identity.ts +1 -1
- package/src/packlets/invitations/space-invitations-handler.test.ts +1 -1
- package/src/packlets/invitations/space-invitations-handler.ts +1 -1
- package/src/packlets/services/service-context.ts +2 -2
- package/src/packlets/services/service-host.ts +1 -1
- package/src/packlets/spaces/data-space-manager.test.ts +1 -1
- package/src/packlets/spaces/data-space-manager.ts +4 -4
- package/src/packlets/spaces/data-space.ts +3 -3
- package/src/packlets/spaces/spaces-service.ts +1 -1
- package/src/packlets/testing/test-builder.ts +3 -3
- package/src/packlets/vault/iframe-host-runtime.ts +26 -7
- package/src/packlets/vault/iframe-proxy-runtime.ts +16 -1
- package/src/packlets/vault/index.ts +2 -0
- package/src/packlets/vault/services.ts +17 -1
- package/src/packlets/vault/shell-controller.ts +78 -0
- package/src/packlets/vault/shell-runtime.ts +133 -0
- package/src/packlets/vault/worker-runtime.ts +3 -1
- package/src/packlets/vault/worker-session.ts +29 -19
- package/dist/lib/browser/chunk-R2FEBB66.mjs.map +0 -7
package/dist/lib/node/index.cjs
CHANGED
|
@@ -49,10 +49,13 @@ __export(src_exports, {
|
|
|
49
49
|
IdentityManager: () => IdentityManager,
|
|
50
50
|
InvitationEncoder: () => InvitationEncoder,
|
|
51
51
|
InvitationObservableProvider: () => InvitationObservableProvider,
|
|
52
|
+
MemoryShellRuntime: () => MemoryShellRuntime,
|
|
52
53
|
ON_CLOSE_DELAY: () => ON_CLOSE_DELAY,
|
|
53
54
|
ProfileServiceImpl: () => ProfileServiceImpl,
|
|
54
55
|
ServiceContext: () => ServiceContext,
|
|
55
56
|
ServiceRegistry: () => ServiceRegistry,
|
|
57
|
+
ShellController: () => ShellController,
|
|
58
|
+
ShellRuntimeImpl: () => ShellRuntimeImpl,
|
|
56
59
|
SpaceInvitationsHandler: () => SpaceInvitationsHandler,
|
|
57
60
|
SpaceInvitationsProxy: () => SpaceInvitationsProxy,
|
|
58
61
|
SpaceInvitationsServiceImpl: () => SpaceInvitationsServiceImpl,
|
|
@@ -63,12 +66,14 @@ __export(src_exports, {
|
|
|
63
66
|
VaultResourceLock: () => VaultResourceLock,
|
|
64
67
|
WorkerRuntime: () => WorkerRuntime,
|
|
65
68
|
WorkerSession: () => WorkerSession,
|
|
69
|
+
appServiceBundle: () => appServiceBundle,
|
|
66
70
|
clientServiceBundle: () => clientServiceBundle,
|
|
67
71
|
createAuthProvider: () => createAuthProvider,
|
|
68
72
|
createDefaultModelFactory: () => createDefaultModelFactory,
|
|
69
73
|
createStorageObjects: () => createStorageObjects,
|
|
70
74
|
getNetworkPeers: () => getNetworkPeers,
|
|
71
75
|
iframeServiceBundle: () => iframeServiceBundle,
|
|
76
|
+
shellServiceBundle: () => shellServiceBundle,
|
|
72
77
|
subscribeToFeedBlocks: () => subscribeToFeedBlocks,
|
|
73
78
|
subscribeToFeeds: () => subscribeToFeeds,
|
|
74
79
|
subscribeToNetworkStatus: () => subscribeToNetworkStatus,
|
|
@@ -2267,7 +2272,7 @@ var SpaceInvitationsServiceImpl = class extends AbstractInvitationsService {
|
|
|
2267
2272
|
var import_async13 = require("@dxos/async");
|
|
2268
2273
|
var import_credentials11 = require("@dxos/credentials");
|
|
2269
2274
|
var import_debug5 = require("@dxos/debug");
|
|
2270
|
-
var
|
|
2275
|
+
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
2271
2276
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
2272
2277
|
var import_keyring = require("@dxos/keyring");
|
|
2273
2278
|
var import_log11 = require("@dxos/log");
|
|
@@ -2277,7 +2282,7 @@ var import_node_assert12 = __toESM(require("node:assert"));
|
|
|
2277
2282
|
var import_async12 = require("@dxos/async");
|
|
2278
2283
|
var import_context7 = require("@dxos/context");
|
|
2279
2284
|
var import_credentials10 = require("@dxos/credentials");
|
|
2280
|
-
var
|
|
2285
|
+
var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
2281
2286
|
var import_keys8 = require("@dxos/keys");
|
|
2282
2287
|
var import_log10 = require("@dxos/log");
|
|
2283
2288
|
var import_teleport_extension_presence = require("@dxos/teleport-extension-presence");
|
|
@@ -2287,7 +2292,7 @@ var import_util6 = require("@dxos/util");
|
|
|
2287
2292
|
var import_async11 = require("@dxos/async");
|
|
2288
2293
|
var import_context6 = require("@dxos/context");
|
|
2289
2294
|
var import_debug4 = require("@dxos/debug");
|
|
2290
|
-
var
|
|
2295
|
+
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
2291
2296
|
var import_keys7 = require("@dxos/keys");
|
|
2292
2297
|
var import_credentials9 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
2293
2298
|
var import_util5 = require("@dxos/util");
|
|
@@ -2550,7 +2555,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2550
2555
|
this._feedStore = params.feedStore;
|
|
2551
2556
|
this._metadataStore = params.metadataStore;
|
|
2552
2557
|
this._signingContext = params.signingContext;
|
|
2553
|
-
this._dataPipelineController = new
|
|
2558
|
+
this._dataPipelineController = new import_echo_pipeline.DataPipelineControllerImpl({
|
|
2554
2559
|
modelFactory: params.modelFactory,
|
|
2555
2560
|
metadataStore: params.metadataStore,
|
|
2556
2561
|
snapshotManager: params.snapshotManager,
|
|
@@ -2606,7 +2611,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2606
2611
|
timeout: CONTROL_PIPELINE_READY_TIMEFRAME
|
|
2607
2612
|
});
|
|
2608
2613
|
await this._createWritableFeeds();
|
|
2609
|
-
this.notarizationPlugin.setWriter((0,
|
|
2614
|
+
this.notarizationPlugin.setWriter((0, import_echo_pipeline.createMappedFeedWriter)((credential) => ({
|
|
2610
2615
|
credential: {
|
|
2611
2616
|
credential
|
|
2612
2617
|
}
|
|
@@ -2756,7 +2761,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2756
2761
|
callSite: (f, a) => f(...a)
|
|
2757
2762
|
});
|
|
2758
2763
|
const space = await this._constructSpace(metadata);
|
|
2759
|
-
const credentials = await (0,
|
|
2764
|
+
const credentials = await (0, import_echo_pipeline2.spaceGenesis)(this._keyring, this._signingContext, space.inner);
|
|
2760
2765
|
await this._metadataStore.addSpace(metadata);
|
|
2761
2766
|
const memberCredential = credentials[1];
|
|
2762
2767
|
(0, import_node_assert12.default)((0, import_credentials10.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
|
|
@@ -2787,7 +2792,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2787
2792
|
offlineTimeout: 3e4,
|
|
2788
2793
|
identityKey: this._signingContext.identityKey
|
|
2789
2794
|
});
|
|
2790
|
-
const snapshotManager = new
|
|
2795
|
+
const snapshotManager = new import_echo_pipeline2.SnapshotManager(this._snapshotStore);
|
|
2791
2796
|
const controlFeed = metadata.controlFeedKey && await this._feedStore.openFeed(metadata.controlFeedKey, {
|
|
2792
2797
|
writable: true
|
|
2793
2798
|
});
|
|
@@ -2852,20 +2857,20 @@ var ServiceContext = class {
|
|
|
2852
2857
|
this.networkManager = networkManager;
|
|
2853
2858
|
this.modelFactory = modelFactory;
|
|
2854
2859
|
this.initialized = new import_async13.Trigger();
|
|
2855
|
-
this.dataServiceSubscriptions = new
|
|
2856
|
-
this.metadataStore = new
|
|
2857
|
-
this.snapshotStore = new
|
|
2860
|
+
this.dataServiceSubscriptions = new import_echo_pipeline3.DataServiceSubscriptions();
|
|
2861
|
+
this.metadataStore = new import_echo_pipeline3.MetadataStore(storage.createDirectory("metadata"));
|
|
2862
|
+
this.snapshotStore = new import_echo_pipeline3.SnapshotStore(storage.createDirectory("snapshots"));
|
|
2858
2863
|
this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
|
|
2859
2864
|
this.feedStore = new import_feed_store4.FeedStore({
|
|
2860
2865
|
factory: new import_feed_store4.FeedFactory({
|
|
2861
2866
|
root: storage.createDirectory("feeds"),
|
|
2862
2867
|
signer: this.keyring,
|
|
2863
2868
|
hypercore: {
|
|
2864
|
-
valueEncoding:
|
|
2869
|
+
valueEncoding: import_echo_pipeline3.valueEncoding
|
|
2865
2870
|
}
|
|
2866
2871
|
})
|
|
2867
2872
|
});
|
|
2868
|
-
this.spaceManager = new
|
|
2873
|
+
this.spaceManager = new import_echo_pipeline3.SpaceManager({
|
|
2869
2874
|
feedStore: this.feedStore,
|
|
2870
2875
|
networkManager: this.networkManager
|
|
2871
2876
|
});
|
|
@@ -3054,8 +3059,8 @@ var clientServiceBundle = (0, import_rpc.createServiceBundle)({
|
|
|
3054
3059
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
3055
3060
|
var import_debug7 = require("@dxos/debug");
|
|
3056
3061
|
var import_document_model = require("@dxos/document-model");
|
|
3057
|
-
var
|
|
3058
|
-
var
|
|
3062
|
+
var import_echo_pipeline5 = require("@dxos/echo-pipeline");
|
|
3063
|
+
var import_log17 = require("@dxos/log");
|
|
3059
3064
|
var import_model_factory = require("@dxos/model-factory");
|
|
3060
3065
|
var import_client2 = require("@dxos/protocols/proto/dxos/client");
|
|
3061
3066
|
var import_text_model = require("@dxos/text-model");
|
|
@@ -3128,7 +3133,7 @@ var NetworkServiceImpl = class {
|
|
|
3128
3133
|
var import_async15 = require("@dxos/async");
|
|
3129
3134
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
3130
3135
|
var import_debug6 = require("@dxos/debug");
|
|
3131
|
-
var
|
|
3136
|
+
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
3132
3137
|
var SpacesServiceImpl = class {
|
|
3133
3138
|
constructor(_spaceManager) {
|
|
3134
3139
|
this._spaceManager = _spaceManager;
|
|
@@ -3145,7 +3150,7 @@ var SpacesServiceImpl = class {
|
|
|
3145
3150
|
queryCredentials({ spaceKey }) {
|
|
3146
3151
|
return new import_codec_protobuf11.Stream(({ ctx, next }) => {
|
|
3147
3152
|
var _a;
|
|
3148
|
-
const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new
|
|
3153
|
+
const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_pipeline4.SpaceNotFoundError(spaceKey));
|
|
3149
3154
|
const processor = space.spaceState.registerProcessor({
|
|
3150
3155
|
process: async (credential) => {
|
|
3151
3156
|
next(credential);
|
|
@@ -3157,7 +3162,7 @@ var SpacesServiceImpl = class {
|
|
|
3157
3162
|
}
|
|
3158
3163
|
async writeCredentials({ spaceKey, credentials }) {
|
|
3159
3164
|
var _a;
|
|
3160
|
-
const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new
|
|
3165
|
+
const space = (_a = this._spaceManager.spaces.get(spaceKey)) != null ? _a : (0, import_debug6.raise)(new import_echo_pipeline4.SpaceNotFoundError(spaceKey));
|
|
3161
3166
|
for (const credential of credentials != null ? credentials : []) {
|
|
3162
3167
|
await space.controlPipeline.writer.write({
|
|
3163
3168
|
credential: {
|
|
@@ -3214,11 +3219,130 @@ var toStorageType = (type) => {
|
|
|
3214
3219
|
};
|
|
3215
3220
|
|
|
3216
3221
|
// packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
|
|
3217
|
-
var
|
|
3222
|
+
var import_async17 = require("@dxos/async");
|
|
3218
3223
|
var import_log12 = require("@dxos/log");
|
|
3219
3224
|
var import_messaging = require("@dxos/messaging");
|
|
3220
3225
|
var import_network_manager3 = require("@dxos/network-manager");
|
|
3226
|
+
var import_rpc3 = require("@dxos/rpc");
|
|
3227
|
+
var import_util7 = require("@dxos/util");
|
|
3228
|
+
|
|
3229
|
+
// packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
|
|
3230
|
+
var import_node_assert13 = __toESM(require("node:assert"));
|
|
3231
|
+
var import_async16 = require("@dxos/async");
|
|
3232
|
+
var import_iframe = require("@dxos/protocols/proto/dxos/iframe");
|
|
3221
3233
|
var import_rpc2 = require("@dxos/rpc");
|
|
3234
|
+
|
|
3235
|
+
// packages/sdk/client-services/src/packlets/vault/services.ts
|
|
3236
|
+
var import_protocols7 = require("@dxos/protocols");
|
|
3237
|
+
var iframeServiceBundle = {
|
|
3238
|
+
IframeService: import_protocols7.schema.getService("dxos.iframe.IframeService"),
|
|
3239
|
+
BridgeService: import_protocols7.schema.getService("dxos.mesh.bridge.BridgeService")
|
|
3240
|
+
};
|
|
3241
|
+
var workerServiceBundle = {
|
|
3242
|
+
WorkerService: import_protocols7.schema.getService("dxos.iframe.WorkerService")
|
|
3243
|
+
};
|
|
3244
|
+
var appServiceBundle = {
|
|
3245
|
+
AppService: import_protocols7.schema.getService("dxos.iframe.AppService")
|
|
3246
|
+
};
|
|
3247
|
+
var shellServiceBundle = {
|
|
3248
|
+
ShellService: import_protocols7.schema.getService("dxos.iframe.ShellService")
|
|
3249
|
+
};
|
|
3250
|
+
|
|
3251
|
+
// packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
|
|
3252
|
+
var ShellRuntimeImpl = class {
|
|
3253
|
+
constructor(_port) {
|
|
3254
|
+
this._port = _port;
|
|
3255
|
+
this.layoutUpdate = new import_async16.Event();
|
|
3256
|
+
this._layout = import_iframe.ShellLayout.DEFAULT;
|
|
3257
|
+
}
|
|
3258
|
+
get layout() {
|
|
3259
|
+
return this._layout;
|
|
3260
|
+
}
|
|
3261
|
+
get invitationCode() {
|
|
3262
|
+
return this._invitationCode;
|
|
3263
|
+
}
|
|
3264
|
+
get spaceKey() {
|
|
3265
|
+
return this._spaceKey;
|
|
3266
|
+
}
|
|
3267
|
+
setLayout(layout, options = {}) {
|
|
3268
|
+
this._layout = layout;
|
|
3269
|
+
this._invitationCode = options.invitationCode;
|
|
3270
|
+
this._spaceKey = options.spaceKey;
|
|
3271
|
+
this.layoutUpdate.emit({
|
|
3272
|
+
layout,
|
|
3273
|
+
...options
|
|
3274
|
+
});
|
|
3275
|
+
}
|
|
3276
|
+
async setAppContext(context) {
|
|
3277
|
+
(0, import_node_assert13.default)(this._appRpc, "runtime not open");
|
|
3278
|
+
if (context.spaceKey) {
|
|
3279
|
+
this._spaceKey = context.spaceKey;
|
|
3280
|
+
}
|
|
3281
|
+
if (context.invitationCode) {
|
|
3282
|
+
this._invitationCode = context.invitationCode;
|
|
3283
|
+
}
|
|
3284
|
+
await this._appRpc.rpc.AppService.setContext({
|
|
3285
|
+
...context,
|
|
3286
|
+
spaceKey: this._spaceKey,
|
|
3287
|
+
invitationCode: this._invitationCode
|
|
3288
|
+
});
|
|
3289
|
+
}
|
|
3290
|
+
async open() {
|
|
3291
|
+
this._appRpc = (0, import_rpc2.createProtoRpcPeer)({
|
|
3292
|
+
requested: appServiceBundle,
|
|
3293
|
+
exposed: shellServiceBundle,
|
|
3294
|
+
handlers: {
|
|
3295
|
+
ShellService: {
|
|
3296
|
+
setLayout: async (request) => {
|
|
3297
|
+
this._layout = request.layout;
|
|
3298
|
+
this._invitationCode = request.invitationCode;
|
|
3299
|
+
this._spaceKey = request.spaceKey;
|
|
3300
|
+
this.layoutUpdate.emit(request);
|
|
3301
|
+
}
|
|
3302
|
+
}
|
|
3303
|
+
},
|
|
3304
|
+
port: this._port
|
|
3305
|
+
});
|
|
3306
|
+
await this._appRpc.open();
|
|
3307
|
+
}
|
|
3308
|
+
async close() {
|
|
3309
|
+
var _a;
|
|
3310
|
+
await ((_a = this._appRpc) == null ? void 0 : _a.close());
|
|
3311
|
+
this._appRpc = void 0;
|
|
3312
|
+
}
|
|
3313
|
+
};
|
|
3314
|
+
var MemoryShellRuntime = class {
|
|
3315
|
+
constructor({ layout, invitationCode, spaceKey } = {}) {
|
|
3316
|
+
this.layoutUpdate = new import_async16.Event();
|
|
3317
|
+
this.contextUpdate = new import_async16.Event();
|
|
3318
|
+
this._layout = layout != null ? layout : import_iframe.ShellLayout.DEFAULT;
|
|
3319
|
+
this._invitationCode = invitationCode;
|
|
3320
|
+
this._spaceKey = spaceKey;
|
|
3321
|
+
}
|
|
3322
|
+
get layout() {
|
|
3323
|
+
return this._layout;
|
|
3324
|
+
}
|
|
3325
|
+
get invitationCode() {
|
|
3326
|
+
return this._invitationCode;
|
|
3327
|
+
}
|
|
3328
|
+
get spaceKey() {
|
|
3329
|
+
return this._spaceKey;
|
|
3330
|
+
}
|
|
3331
|
+
setLayout(layout, options = {}) {
|
|
3332
|
+
this._layout = layout;
|
|
3333
|
+
this._invitationCode = options.invitationCode;
|
|
3334
|
+
this._spaceKey = options.spaceKey;
|
|
3335
|
+
this.layoutUpdate.emit({
|
|
3336
|
+
layout,
|
|
3337
|
+
...options
|
|
3338
|
+
});
|
|
3339
|
+
}
|
|
3340
|
+
async setAppContext(context) {
|
|
3341
|
+
this.contextUpdate.emit(context);
|
|
3342
|
+
}
|
|
3343
|
+
};
|
|
3344
|
+
|
|
3345
|
+
// packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
|
|
3222
3346
|
var __decorate3 = function(decorators, target, key, desc) {
|
|
3223
3347
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3224
3348
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -3231,11 +3355,12 @@ var __decorate3 = function(decorators, target, key, desc) {
|
|
|
3231
3355
|
};
|
|
3232
3356
|
var LOCK_KEY = "DXOS_RESOURCE_LOCK";
|
|
3233
3357
|
var IFrameHostRuntime = class {
|
|
3234
|
-
constructor({ configProvider, appPort }) {
|
|
3358
|
+
constructor({ configProvider, appPort, shellPort }) {
|
|
3235
3359
|
this._transportFactory = (0, import_network_manager3.createWebRTCTransportFactory)();
|
|
3236
|
-
this._ready = new
|
|
3360
|
+
this._ready = new import_async17.Trigger();
|
|
3237
3361
|
this._configProvider = configProvider;
|
|
3238
3362
|
this._appPort = appPort;
|
|
3363
|
+
this._shellPort = shellPort;
|
|
3239
3364
|
this._getService = async (find) => {
|
|
3240
3365
|
const error = await this._ready.wait();
|
|
3241
3366
|
if (error) {
|
|
@@ -3247,16 +3372,26 @@ var IFrameHostRuntime = class {
|
|
|
3247
3372
|
}
|
|
3248
3373
|
return service;
|
|
3249
3374
|
};
|
|
3375
|
+
if (this._shellPort) {
|
|
3376
|
+
this._shellRuntime = new ShellRuntimeImpl(this._shellPort);
|
|
3377
|
+
}
|
|
3378
|
+
}
|
|
3379
|
+
get services() {
|
|
3380
|
+
return this._clientServices;
|
|
3381
|
+
}
|
|
3382
|
+
get shell() {
|
|
3383
|
+
return this._shellRuntime;
|
|
3250
3384
|
}
|
|
3251
3385
|
async start() {
|
|
3386
|
+
var _a;
|
|
3252
3387
|
(0, import_log12.log)("starting...", {}, {
|
|
3253
3388
|
file: "iframe-host-runtime.ts",
|
|
3254
|
-
line:
|
|
3389
|
+
line: 81,
|
|
3255
3390
|
scope: this,
|
|
3256
3391
|
callSite: (f, a) => f(...a)
|
|
3257
3392
|
});
|
|
3258
3393
|
try {
|
|
3259
|
-
this._config = await this._configProvider
|
|
3394
|
+
this._config = await (0, import_util7.getAsyncValue)(this._configProvider);
|
|
3260
3395
|
const signalServer = this._config.get("runtime.services.signal.server");
|
|
3261
3396
|
this._clientServices = new ClientServicesHost({
|
|
3262
3397
|
lockKey: LOCK_KEY,
|
|
@@ -3269,7 +3404,7 @@ var IFrameHostRuntime = class {
|
|
|
3269
3404
|
transportFactory: this._transportFactory
|
|
3270
3405
|
})
|
|
3271
3406
|
});
|
|
3272
|
-
this._clientRpc = (0,
|
|
3407
|
+
this._clientRpc = (0, import_rpc3.createProtoRpcPeer)({
|
|
3273
3408
|
exposed: clientServiceBundle,
|
|
3274
3409
|
handlers: {
|
|
3275
3410
|
DataService: async () => await this._getService((services) => services.DataService),
|
|
@@ -3288,12 +3423,13 @@ var IFrameHostRuntime = class {
|
|
|
3288
3423
|
});
|
|
3289
3424
|
await Promise.all([
|
|
3290
3425
|
this._clientServices.open(),
|
|
3291
|
-
this._clientRpc.open()
|
|
3426
|
+
this._clientRpc.open(),
|
|
3427
|
+
(_a = this._shellRuntime) == null ? void 0 : _a.open()
|
|
3292
3428
|
]);
|
|
3293
3429
|
this._ready.wake(void 0);
|
|
3294
3430
|
(0, import_log12.log)("started", {}, {
|
|
3295
3431
|
file: "iframe-host-runtime.ts",
|
|
3296
|
-
line:
|
|
3432
|
+
line: 117,
|
|
3297
3433
|
scope: this,
|
|
3298
3434
|
callSite: (f, a) => f(...a)
|
|
3299
3435
|
});
|
|
@@ -3301,24 +3437,26 @@ var IFrameHostRuntime = class {
|
|
|
3301
3437
|
this._ready.wake(err);
|
|
3302
3438
|
import_log12.log.catch(err, {}, {
|
|
3303
3439
|
file: "iframe-host-runtime.ts",
|
|
3304
|
-
line:
|
|
3440
|
+
line: 120,
|
|
3305
3441
|
scope: this,
|
|
3306
3442
|
callSite: (f, a) => f(...a)
|
|
3307
3443
|
});
|
|
3308
3444
|
}
|
|
3309
3445
|
}
|
|
3310
3446
|
async stop() {
|
|
3447
|
+
var _a;
|
|
3311
3448
|
(0, import_log12.log)("stopping...", {}, {
|
|
3312
3449
|
file: "iframe-host-runtime.ts",
|
|
3313
|
-
line:
|
|
3450
|
+
line: 125,
|
|
3314
3451
|
scope: this,
|
|
3315
3452
|
callSite: (f, a) => f(...a)
|
|
3316
3453
|
});
|
|
3317
3454
|
await this._clientRpc.close();
|
|
3318
3455
|
await this._clientServices.close();
|
|
3456
|
+
await ((_a = this._shellRuntime) == null ? void 0 : _a.close());
|
|
3319
3457
|
(0, import_log12.log)("stopped", {}, {
|
|
3320
3458
|
file: "iframe-host-runtime.ts",
|
|
3321
|
-
line:
|
|
3459
|
+
line: 129,
|
|
3322
3460
|
scope: this,
|
|
3323
3461
|
callSite: (f, a) => f(...a)
|
|
3324
3462
|
});
|
|
@@ -3330,26 +3468,15 @@ __decorate3([
|
|
|
3330
3468
|
|
|
3331
3469
|
// packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts
|
|
3332
3470
|
var import_network_manager4 = require("@dxos/network-manager");
|
|
3333
|
-
var
|
|
3334
|
-
|
|
3335
|
-
// packages/sdk/client-services/src/packlets/vault/services.ts
|
|
3336
|
-
var import_protocols7 = require("@dxos/protocols");
|
|
3337
|
-
var iframeServiceBundle = {
|
|
3338
|
-
IframeService: import_protocols7.schema.getService("dxos.iframe.IframeService"),
|
|
3339
|
-
BridgeService: import_protocols7.schema.getService("dxos.mesh.bridge.BridgeService")
|
|
3340
|
-
};
|
|
3341
|
-
var workerServiceBundle = {
|
|
3342
|
-
WorkerService: import_protocols7.schema.getService("dxos.iframe.WorkerService")
|
|
3343
|
-
};
|
|
3344
|
-
|
|
3345
|
-
// packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts
|
|
3471
|
+
var import_rpc4 = require("@dxos/rpc");
|
|
3346
3472
|
var IFrameProxyRuntime = class {
|
|
3347
|
-
constructor({ systemPort, workerAppPort, windowAppPort }) {
|
|
3473
|
+
constructor({ systemPort, workerAppPort, windowAppPort, shellPort }) {
|
|
3348
3474
|
this._transportService = new import_network_manager4.WebRTCTransportService();
|
|
3349
3475
|
this._systemPort = systemPort;
|
|
3350
3476
|
this._windowAppPort = windowAppPort;
|
|
3351
3477
|
this._workerAppPort = workerAppPort;
|
|
3352
|
-
this.
|
|
3478
|
+
this._shellPort = shellPort;
|
|
3479
|
+
this._systemRpc = (0, import_rpc4.createProtoRpcPeer)({
|
|
3353
3480
|
requested: workerServiceBundle,
|
|
3354
3481
|
exposed: iframeServiceBundle,
|
|
3355
3482
|
handlers: {
|
|
@@ -3364,22 +3491,109 @@ var IFrameProxyRuntime = class {
|
|
|
3364
3491
|
});
|
|
3365
3492
|
this._workerAppPort.subscribe((msg) => this._windowAppPort.send(msg));
|
|
3366
3493
|
this._windowAppPort.subscribe((msg) => this._workerAppPort.send(msg));
|
|
3494
|
+
if (this._shellPort) {
|
|
3495
|
+
this._shellRuntime = new ShellRuntimeImpl(this._shellPort);
|
|
3496
|
+
}
|
|
3497
|
+
}
|
|
3498
|
+
get shell() {
|
|
3499
|
+
return this._shellRuntime;
|
|
3367
3500
|
}
|
|
3368
3501
|
async open(origin) {
|
|
3502
|
+
var _a;
|
|
3369
3503
|
await this._systemRpc.open();
|
|
3370
3504
|
await this._systemRpc.rpc.WorkerService.start({
|
|
3371
3505
|
origin
|
|
3372
3506
|
});
|
|
3507
|
+
await ((_a = this._shellRuntime) == null ? void 0 : _a.open());
|
|
3373
3508
|
}
|
|
3374
3509
|
async close() {
|
|
3510
|
+
var _a;
|
|
3511
|
+
await ((_a = this._shellRuntime) == null ? void 0 : _a.close());
|
|
3375
3512
|
await this._systemRpc.rpc.WorkerService.stop();
|
|
3376
3513
|
await this._systemRpc.close();
|
|
3377
3514
|
}
|
|
3378
3515
|
};
|
|
3379
3516
|
|
|
3380
|
-
// packages/sdk/client-services/src/packlets/vault/
|
|
3381
|
-
var
|
|
3517
|
+
// packages/sdk/client-services/src/packlets/vault/shell-controller.ts
|
|
3518
|
+
var import_async18 = require("@dxos/async");
|
|
3382
3519
|
var import_log13 = require("@dxos/log");
|
|
3520
|
+
var import_iframe2 = require("@dxos/protocols/proto/dxos/iframe");
|
|
3521
|
+
var import_rpc5 = require("@dxos/rpc");
|
|
3522
|
+
var ShellController = class {
|
|
3523
|
+
constructor(_port) {
|
|
3524
|
+
this._port = _port;
|
|
3525
|
+
this.contextUpdate = new import_async18.Event();
|
|
3526
|
+
this._display = import_iframe2.ShellDisplay.NONE;
|
|
3527
|
+
}
|
|
3528
|
+
get display() {
|
|
3529
|
+
return this._display;
|
|
3530
|
+
}
|
|
3531
|
+
get spaceKey() {
|
|
3532
|
+
return this._spaceKey;
|
|
3533
|
+
}
|
|
3534
|
+
setSpace(key) {
|
|
3535
|
+
this._spaceKey = key;
|
|
3536
|
+
this._emitUpdate();
|
|
3537
|
+
}
|
|
3538
|
+
async setLayout(layout, options = {}) {
|
|
3539
|
+
var _a;
|
|
3540
|
+
(0, import_log13.log)("set layout", {
|
|
3541
|
+
layout,
|
|
3542
|
+
...options
|
|
3543
|
+
}, {
|
|
3544
|
+
file: "shell-controller.ts",
|
|
3545
|
+
line: 39,
|
|
3546
|
+
scope: this,
|
|
3547
|
+
callSite: (f, a) => f(...a)
|
|
3548
|
+
});
|
|
3549
|
+
this._display = import_iframe2.ShellDisplay.FULLSCREEN;
|
|
3550
|
+
this._emitUpdate();
|
|
3551
|
+
await ((_a = this._shellRpc) == null ? void 0 : _a.rpc.ShellService.setLayout({
|
|
3552
|
+
layout,
|
|
3553
|
+
...options
|
|
3554
|
+
}));
|
|
3555
|
+
}
|
|
3556
|
+
async open() {
|
|
3557
|
+
this._shellRpc = (0, import_rpc5.createProtoRpcPeer)({
|
|
3558
|
+
requested: shellServiceBundle,
|
|
3559
|
+
exposed: appServiceBundle,
|
|
3560
|
+
handlers: {
|
|
3561
|
+
AppService: {
|
|
3562
|
+
setContext: async (request) => {
|
|
3563
|
+
(0, import_log13.log)("set context", request, {
|
|
3564
|
+
file: "shell-controller.ts",
|
|
3565
|
+
line: 52,
|
|
3566
|
+
scope: this,
|
|
3567
|
+
callSite: (f, a) => f(...a)
|
|
3568
|
+
});
|
|
3569
|
+
this._display = request.display;
|
|
3570
|
+
this._spaceKey = request.spaceKey;
|
|
3571
|
+
this._invitationCode = request.invitationCode;
|
|
3572
|
+
this.contextUpdate.emit(request);
|
|
3573
|
+
}
|
|
3574
|
+
}
|
|
3575
|
+
},
|
|
3576
|
+
port: this._port
|
|
3577
|
+
});
|
|
3578
|
+
await this._shellRpc.open();
|
|
3579
|
+
}
|
|
3580
|
+
async close() {
|
|
3581
|
+
var _a;
|
|
3582
|
+
await ((_a = this._shellRpc) == null ? void 0 : _a.close());
|
|
3583
|
+
this._shellRpc = void 0;
|
|
3584
|
+
}
|
|
3585
|
+
_emitUpdate() {
|
|
3586
|
+
this.contextUpdate.emit({
|
|
3587
|
+
display: this._display,
|
|
3588
|
+
spaceKey: this._spaceKey,
|
|
3589
|
+
invitationCode: this._invitationCode
|
|
3590
|
+
});
|
|
3591
|
+
}
|
|
3592
|
+
};
|
|
3593
|
+
|
|
3594
|
+
// packages/sdk/client-services/src/packlets/vault/vault-resource-lock.ts
|
|
3595
|
+
var import_async19 = require("@dxos/async");
|
|
3596
|
+
var import_log14 = require("@dxos/log");
|
|
3383
3597
|
var Message;
|
|
3384
3598
|
(function(Message2) {
|
|
3385
3599
|
Message2["ACQUIRING"] = "acquiring";
|
|
@@ -3387,7 +3601,7 @@ var Message;
|
|
|
3387
3601
|
var VaultResourceLock = class {
|
|
3388
3602
|
constructor({ lockKey, onAcquire, onRelease }) {
|
|
3389
3603
|
this._broadcastChannel = new BroadcastChannel("vault-resource-lock");
|
|
3390
|
-
this._releaseTrigger = new
|
|
3604
|
+
this._releaseTrigger = new import_async19.Trigger();
|
|
3391
3605
|
this._lockKey = lockKey;
|
|
3392
3606
|
this._onAcquire = onAcquire;
|
|
3393
3607
|
this._onRelease = onRelease;
|
|
@@ -3398,7 +3612,7 @@ var VaultResourceLock = class {
|
|
|
3398
3612
|
message: Message.ACQUIRING
|
|
3399
3613
|
});
|
|
3400
3614
|
try {
|
|
3401
|
-
await (0,
|
|
3615
|
+
await (0, import_async19.asyncTimeout)(this._requestLock(), 3e3);
|
|
3402
3616
|
} catch (e) {
|
|
3403
3617
|
await this._requestLock(true);
|
|
3404
3618
|
}
|
|
@@ -3412,7 +3626,7 @@ var VaultResourceLock = class {
|
|
|
3412
3626
|
}
|
|
3413
3627
|
}
|
|
3414
3628
|
async _requestLock(steal = false) {
|
|
3415
|
-
(0,
|
|
3629
|
+
(0, import_log14.log)("requesting lock...", {
|
|
3416
3630
|
steal
|
|
3417
3631
|
}, {
|
|
3418
3632
|
file: "vault-resource-lock.ts",
|
|
@@ -3420,23 +3634,23 @@ var VaultResourceLock = class {
|
|
|
3420
3634
|
scope: this,
|
|
3421
3635
|
callSite: (f, a) => f(...a)
|
|
3422
3636
|
});
|
|
3423
|
-
const acquired = new
|
|
3637
|
+
const acquired = new import_async19.Trigger();
|
|
3424
3638
|
void navigator.locks.request(this._lockKey, {
|
|
3425
3639
|
steal
|
|
3426
3640
|
}, async () => {
|
|
3427
3641
|
var _a, _b;
|
|
3428
3642
|
await ((_a = this._onAcquire) == null ? void 0 : _a.call(this));
|
|
3429
3643
|
acquired.wake();
|
|
3430
|
-
this._releaseTrigger = new
|
|
3644
|
+
this._releaseTrigger = new import_async19.Trigger();
|
|
3431
3645
|
await this._releaseTrigger.wait();
|
|
3432
|
-
(0,
|
|
3646
|
+
(0, import_log14.log)("releasing lock...", {}, {
|
|
3433
3647
|
file: "vault-resource-lock.ts",
|
|
3434
3648
|
line: 65,
|
|
3435
3649
|
scope: this,
|
|
3436
3650
|
callSite: (f, a) => f(...a)
|
|
3437
3651
|
});
|
|
3438
3652
|
await ((_b = this._onRelease) == null ? void 0 : _b.call(this));
|
|
3439
|
-
(0,
|
|
3653
|
+
(0, import_log14.log)("released lock", {}, {
|
|
3440
3654
|
file: "vault-resource-lock.ts",
|
|
3441
3655
|
line: 67,
|
|
3442
3656
|
scope: this,
|
|
@@ -3447,7 +3661,7 @@ var VaultResourceLock = class {
|
|
|
3447
3661
|
await ((_a = this._onRelease) == null ? void 0 : _a.call(this));
|
|
3448
3662
|
});
|
|
3449
3663
|
await acquired.wait();
|
|
3450
|
-
(0,
|
|
3664
|
+
(0, import_log14.log)("recieved lock", {
|
|
3451
3665
|
steal
|
|
3452
3666
|
}, {
|
|
3453
3667
|
file: "vault-resource-lock.ts",
|
|
@@ -3459,17 +3673,17 @@ var VaultResourceLock = class {
|
|
|
3459
3673
|
};
|
|
3460
3674
|
|
|
3461
3675
|
// packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
|
|
3462
|
-
var
|
|
3463
|
-
var
|
|
3676
|
+
var import_async21 = require("@dxos/async");
|
|
3677
|
+
var import_log16 = require("@dxos/log");
|
|
3464
3678
|
var import_messaging2 = require("@dxos/messaging");
|
|
3465
3679
|
var import_network_manager5 = require("@dxos/network-manager");
|
|
3466
3680
|
|
|
3467
3681
|
// packages/sdk/client-services/src/packlets/vault/worker-session.ts
|
|
3468
|
-
var
|
|
3469
|
-
var
|
|
3470
|
-
var
|
|
3471
|
-
var
|
|
3472
|
-
var
|
|
3682
|
+
var import_node_assert14 = __toESM(require("node:assert"));
|
|
3683
|
+
var import_async20 = require("@dxos/async");
|
|
3684
|
+
var import_log15 = require("@dxos/log");
|
|
3685
|
+
var import_rpc6 = require("@dxos/rpc");
|
|
3686
|
+
var import_util8 = require("@dxos/util");
|
|
3473
3687
|
var __decorate4 = function(decorators, target, key, desc) {
|
|
3474
3688
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3475
3689
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -3481,33 +3695,39 @@ var __decorate4 = function(decorators, target, key, desc) {
|
|
|
3481
3695
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3482
3696
|
};
|
|
3483
3697
|
var WorkerSession = class {
|
|
3484
|
-
constructor({ getService, systemPort, appPort, options = {
|
|
3698
|
+
constructor({ getService, systemPort, appPort, shellPort, options = {
|
|
3485
3699
|
heartbeatInterval: 1e3
|
|
3486
3700
|
} }) {
|
|
3487
|
-
this._startTrigger = new
|
|
3488
|
-
this.onClose = new
|
|
3489
|
-
(0,
|
|
3490
|
-
(0,
|
|
3701
|
+
this._startTrigger = new import_async20.Trigger();
|
|
3702
|
+
this.onClose = new import_util8.Callback();
|
|
3703
|
+
(0, import_node_assert14.default)(options);
|
|
3704
|
+
(0, import_node_assert14.default)(getService);
|
|
3491
3705
|
this._options = options;
|
|
3492
3706
|
this._getService = getService;
|
|
3493
|
-
|
|
3707
|
+
const handlers = {
|
|
3708
|
+
DataService: async () => await this._getService((services) => services.DataService),
|
|
3709
|
+
DevicesService: async () => await this._getService((services) => services.DevicesService),
|
|
3710
|
+
DevtoolsHost: async () => await this._getService((services) => services.DevtoolsHost),
|
|
3711
|
+
HaloInvitationsService: async () => await this._getService((services) => services.HaloInvitationsService),
|
|
3712
|
+
NetworkService: async () => await this._getService((services) => services.NetworkService),
|
|
3713
|
+
ProfileService: async () => await this._getService((services) => services.ProfileService),
|
|
3714
|
+
SpaceInvitationsService: async () => await this._getService((services) => services.SpaceInvitationsService),
|
|
3715
|
+
SpaceService: async () => await this._getService((services) => services.SpaceService),
|
|
3716
|
+
SpacesService: async () => await this._getService((services) => services.SpacesService),
|
|
3717
|
+
SystemService: async () => await this._getService((services) => services.SystemService),
|
|
3718
|
+
TracingService: async () => await this._getService((services) => services.TracingService)
|
|
3719
|
+
};
|
|
3720
|
+
this._clientRpc = (0, import_rpc6.createProtoRpcPeer)({
|
|
3494
3721
|
exposed: clientServiceBundle,
|
|
3495
|
-
handlers
|
|
3496
|
-
DataService: async () => await this._getService((services) => services.DataService),
|
|
3497
|
-
DevicesService: async () => await this._getService((services) => services.DevicesService),
|
|
3498
|
-
DevtoolsHost: async () => await this._getService((services) => services.DevtoolsHost),
|
|
3499
|
-
HaloInvitationsService: async () => await this._getService((services) => services.HaloInvitationsService),
|
|
3500
|
-
NetworkService: async () => await this._getService((services) => services.NetworkService),
|
|
3501
|
-
ProfileService: async () => await this._getService((services) => services.ProfileService),
|
|
3502
|
-
SpaceInvitationsService: async () => await this._getService((services) => services.SpaceInvitationsService),
|
|
3503
|
-
SpaceService: async () => await this._getService((services) => services.SpaceService),
|
|
3504
|
-
SpacesService: async () => await this._getService((services) => services.SpacesService),
|
|
3505
|
-
SystemService: async () => await this._getService((services) => services.SystemService),
|
|
3506
|
-
TracingService: async () => await this._getService((services) => services.TracingService)
|
|
3507
|
-
},
|
|
3722
|
+
handlers,
|
|
3508
3723
|
port: appPort
|
|
3509
3724
|
});
|
|
3510
|
-
this.
|
|
3725
|
+
this._shellClientRpc = (0, import_rpc6.createProtoRpcPeer)({
|
|
3726
|
+
exposed: clientServiceBundle,
|
|
3727
|
+
handlers,
|
|
3728
|
+
port: shellPort
|
|
3729
|
+
});
|
|
3730
|
+
this._iframeRpc = (0, import_rpc6.createProtoRpcPeer)({
|
|
3511
3731
|
requested: iframeServiceBundle,
|
|
3512
3732
|
exposed: workerServiceBundle,
|
|
3513
3733
|
handlers: {
|
|
@@ -3521,9 +3741,9 @@ var WorkerSession = class {
|
|
|
3521
3741
|
try {
|
|
3522
3742
|
await this.close();
|
|
3523
3743
|
} catch (err) {
|
|
3524
|
-
|
|
3744
|
+
import_log15.log.catch(err, {}, {
|
|
3525
3745
|
file: "worker-session.ts",
|
|
3526
|
-
line:
|
|
3746
|
+
line: 92,
|
|
3527
3747
|
scope: this,
|
|
3528
3748
|
callSite: (f, a) => f(...a)
|
|
3529
3749
|
});
|
|
@@ -3539,15 +3759,16 @@ var WorkerSession = class {
|
|
|
3539
3759
|
this.bridgeService = this._iframeRpc.rpc.BridgeService;
|
|
3540
3760
|
}
|
|
3541
3761
|
async open() {
|
|
3542
|
-
|
|
3762
|
+
import_log15.log.info("opening..", {}, {
|
|
3543
3763
|
file: "worker-session.ts",
|
|
3544
|
-
line:
|
|
3764
|
+
line: 106,
|
|
3545
3765
|
scope: this,
|
|
3546
3766
|
callSite: (f, a) => f(...a)
|
|
3547
3767
|
});
|
|
3548
3768
|
await Promise.all([
|
|
3549
3769
|
this._clientRpc.open(),
|
|
3550
|
-
this._iframeRpc.open()
|
|
3770
|
+
this._iframeRpc.open(),
|
|
3771
|
+
this._maybeOpenShell()
|
|
3551
3772
|
]);
|
|
3552
3773
|
await this._startTrigger.wait({
|
|
3553
3774
|
timeout: 3e3
|
|
@@ -3556,20 +3777,20 @@ var WorkerSession = class {
|
|
|
3556
3777
|
try {
|
|
3557
3778
|
await this._iframeRpc.rpc.IframeService.heartbeat();
|
|
3558
3779
|
} catch (err1) {
|
|
3559
|
-
|
|
3780
|
+
import_log15.log.warn("Heartbeat failed", {
|
|
3560
3781
|
err: err1
|
|
3561
3782
|
}, {
|
|
3562
3783
|
file: "worker-session.ts",
|
|
3563
|
-
line:
|
|
3784
|
+
line: 118,
|
|
3564
3785
|
scope: this,
|
|
3565
3786
|
callSite: (f, a) => f(...a)
|
|
3566
3787
|
});
|
|
3567
3788
|
try {
|
|
3568
3789
|
await this.close();
|
|
3569
3790
|
} catch (err) {
|
|
3570
|
-
|
|
3791
|
+
import_log15.log.catch(err, {}, {
|
|
3571
3792
|
file: "worker-session.ts",
|
|
3572
|
-
line:
|
|
3793
|
+
line: 122,
|
|
3573
3794
|
scope: this,
|
|
3574
3795
|
callSite: (f, a) => f(...a)
|
|
3575
3796
|
});
|
|
@@ -3578,18 +3799,18 @@ var WorkerSession = class {
|
|
|
3578
3799
|
}, this._options.heartbeatInterval);
|
|
3579
3800
|
}
|
|
3580
3801
|
async close() {
|
|
3581
|
-
|
|
3802
|
+
import_log15.log.info("closing..", {}, {
|
|
3582
3803
|
file: "worker-session.ts",
|
|
3583
|
-
line:
|
|
3804
|
+
line: 129,
|
|
3584
3805
|
scope: this,
|
|
3585
3806
|
callSite: (f, a) => f(...a)
|
|
3586
3807
|
});
|
|
3587
3808
|
try {
|
|
3588
3809
|
await this.onClose.callIfSet();
|
|
3589
3810
|
} catch (err) {
|
|
3590
|
-
|
|
3811
|
+
import_log15.log.catch(err, {}, {
|
|
3591
3812
|
file: "worker-session.ts",
|
|
3592
|
-
line:
|
|
3813
|
+
line: 133,
|
|
3593
3814
|
scope: this,
|
|
3594
3815
|
callSite: (f, a) => f(...a)
|
|
3595
3816
|
});
|
|
@@ -3602,9 +3823,21 @@ var WorkerSession = class {
|
|
|
3602
3823
|
this._iframeRpc.close()
|
|
3603
3824
|
]);
|
|
3604
3825
|
}
|
|
3826
|
+
async _maybeOpenShell() {
|
|
3827
|
+
try {
|
|
3828
|
+
await (0, import_async20.asyncTimeout)(this._shellClientRpc.open(), 1e3);
|
|
3829
|
+
} catch (e) {
|
|
3830
|
+
import_log15.log.info("No shell connected.", {}, {
|
|
3831
|
+
file: "worker-session.ts",
|
|
3832
|
+
line: 147,
|
|
3833
|
+
scope: this,
|
|
3834
|
+
callSite: (f, a) => f(...a)
|
|
3835
|
+
});
|
|
3836
|
+
}
|
|
3837
|
+
}
|
|
3605
3838
|
};
|
|
3606
3839
|
__decorate4([
|
|
3607
|
-
|
|
3840
|
+
import_log15.logInfo
|
|
3608
3841
|
], WorkerSession.prototype, "origin", void 0);
|
|
3609
3842
|
|
|
3610
3843
|
// packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
|
|
@@ -3613,13 +3846,13 @@ var WorkerRuntime = class {
|
|
|
3613
3846
|
constructor(_configProvider) {
|
|
3614
3847
|
this._configProvider = _configProvider;
|
|
3615
3848
|
this._transportFactory = new import_network_manager5.WebRTCTransportProxyFactory();
|
|
3616
|
-
this._ready = new
|
|
3849
|
+
this._ready = new import_async21.Trigger();
|
|
3617
3850
|
this.sessions = /* @__PURE__ */ new Set();
|
|
3618
3851
|
}
|
|
3619
3852
|
async start() {
|
|
3620
|
-
(0,
|
|
3853
|
+
(0, import_log16.log)("starting...", {}, {
|
|
3621
3854
|
file: "worker-runtime.ts",
|
|
3622
|
-
line:
|
|
3855
|
+
line: 42,
|
|
3623
3856
|
scope: this,
|
|
3624
3857
|
callSite: (f, a) => f(...a)
|
|
3625
3858
|
});
|
|
@@ -3638,17 +3871,17 @@ var WorkerRuntime = class {
|
|
|
3638
3871
|
});
|
|
3639
3872
|
await this._clientServices.open();
|
|
3640
3873
|
this._ready.wake(void 0);
|
|
3641
|
-
(0,
|
|
3874
|
+
(0, import_log16.log)("started", {}, {
|
|
3642
3875
|
file: "worker-runtime.ts",
|
|
3643
|
-
line:
|
|
3876
|
+
line: 59,
|
|
3644
3877
|
scope: this,
|
|
3645
3878
|
callSite: (f, a) => f(...a)
|
|
3646
3879
|
});
|
|
3647
3880
|
} catch (err) {
|
|
3648
3881
|
this._ready.wake(err);
|
|
3649
|
-
|
|
3882
|
+
import_log16.log.catch(err, {}, {
|
|
3650
3883
|
file: "worker-runtime.ts",
|
|
3651
|
-
line:
|
|
3884
|
+
line: 62,
|
|
3652
3885
|
scope: this,
|
|
3653
3886
|
callSite: (f, a) => f(...a)
|
|
3654
3887
|
});
|
|
@@ -3660,7 +3893,7 @@ var WorkerRuntime = class {
|
|
|
3660
3893
|
/**
|
|
3661
3894
|
* Create a new session.
|
|
3662
3895
|
*/
|
|
3663
|
-
async createSession({ appPort, systemPort }) {
|
|
3896
|
+
async createSession({ appPort, systemPort, shellPort }) {
|
|
3664
3897
|
const session = new WorkerSession({
|
|
3665
3898
|
getService: async (find) => {
|
|
3666
3899
|
const error = await this._ready.wait();
|
|
@@ -3675,6 +3908,7 @@ var WorkerRuntime = class {
|
|
|
3675
3908
|
},
|
|
3676
3909
|
appPort,
|
|
3677
3910
|
systemPort,
|
|
3911
|
+
shellPort,
|
|
3678
3912
|
readySignal: this._ready
|
|
3679
3913
|
});
|
|
3680
3914
|
session.onClose.set(async () => {
|
|
@@ -3786,7 +4020,7 @@ var ClientServicesHost = class {
|
|
|
3786
4020
|
if (this._open) {
|
|
3787
4021
|
return;
|
|
3788
4022
|
}
|
|
3789
|
-
(0,
|
|
4023
|
+
(0, import_log17.log)("opening...", {}, {
|
|
3790
4024
|
file: "service-host.ts",
|
|
3791
4025
|
line: 125,
|
|
3792
4026
|
scope: this,
|
|
@@ -3806,7 +4040,7 @@ var ClientServicesHost = class {
|
|
|
3806
4040
|
return (_a2 = this._serviceContext.dataSpaceManager) != null ? _a2 : (0, import_debug7.raise)(new Error("SpaceManager not initialized"));
|
|
3807
4041
|
}),
|
|
3808
4042
|
SpacesService: new SpacesServiceImpl(this._serviceContext.spaceManager),
|
|
3809
|
-
DataService: new
|
|
4043
|
+
DataService: new import_echo_pipeline5.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
|
|
3810
4044
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager),
|
|
3811
4045
|
// TODO(burdon): Move to new protobuf definitions.
|
|
3812
4046
|
ProfileService: new ProfileServiceImpl(this._serviceContext),
|
|
@@ -3822,7 +4056,7 @@ var ClientServicesHost = class {
|
|
|
3822
4056
|
await this._serviceContext.open();
|
|
3823
4057
|
this._open = true;
|
|
3824
4058
|
const deviceKey = (_a = this._serviceContext.identityManager.identity) == null ? void 0 : _a.deviceKey;
|
|
3825
|
-
(0,
|
|
4059
|
+
(0, import_log17.log)("opened", {
|
|
3826
4060
|
deviceKey
|
|
3827
4061
|
}, {
|
|
3828
4062
|
file: "service-host.ts",
|
|
@@ -3837,7 +4071,7 @@ var ClientServicesHost = class {
|
|
|
3837
4071
|
return;
|
|
3838
4072
|
}
|
|
3839
4073
|
const deviceKey = (_a = this._serviceContext.identityManager.identity) == null ? void 0 : _a.deviceKey;
|
|
3840
|
-
(0,
|
|
4074
|
+
(0, import_log17.log)("closing...", {
|
|
3841
4075
|
deviceKey
|
|
3842
4076
|
}, {
|
|
3843
4077
|
file: "service-host.ts",
|
|
@@ -3850,7 +4084,7 @@ var ClientServicesHost = class {
|
|
|
3850
4084
|
});
|
|
3851
4085
|
await this._serviceContext.close();
|
|
3852
4086
|
this._open = false;
|
|
3853
|
-
(0,
|
|
4087
|
+
(0, import_log17.log)("closed", {
|
|
3854
4088
|
deviceKey
|
|
3855
4089
|
}, {
|
|
3856
4090
|
file: "service-host.ts",
|
|
@@ -3862,14 +4096,14 @@ var ClientServicesHost = class {
|
|
|
3862
4096
|
};
|
|
3863
4097
|
|
|
3864
4098
|
// packages/sdk/client-services/src/packlets/services/service-proxy.ts
|
|
3865
|
-
var
|
|
4099
|
+
var import_async22 = require("@dxos/async");
|
|
3866
4100
|
var import_errors2 = require("@dxos/errors");
|
|
3867
|
-
var
|
|
4101
|
+
var import_rpc7 = require("@dxos/rpc");
|
|
3868
4102
|
var ClientServicesProxy = class {
|
|
3869
4103
|
// prettier-ignore
|
|
3870
4104
|
constructor(port, _timeout = 3e4) {
|
|
3871
4105
|
this._timeout = _timeout;
|
|
3872
|
-
this._proxy = (0,
|
|
4106
|
+
this._proxy = (0, import_rpc7.createProtoRpcPeer)({
|
|
3873
4107
|
requested: clientServiceBundle,
|
|
3874
4108
|
exposed: {},
|
|
3875
4109
|
handlers: {},
|
|
@@ -3886,7 +4120,7 @@ var ClientServicesProxy = class {
|
|
|
3886
4120
|
return this._proxy.rpc;
|
|
3887
4121
|
}
|
|
3888
4122
|
async open() {
|
|
3889
|
-
await (0,
|
|
4123
|
+
await (0, import_async22.asyncTimeout)(this._proxy.open(), this._timeout, new import_errors2.RemoteServiceConnectionTimeout());
|
|
3890
4124
|
}
|
|
3891
4125
|
async close() {
|
|
3892
4126
|
await this._proxy.close();
|
|
@@ -3913,10 +4147,13 @@ var ClientServicesProxy = class {
|
|
|
3913
4147
|
IdentityManager,
|
|
3914
4148
|
InvitationEncoder,
|
|
3915
4149
|
InvitationObservableProvider,
|
|
4150
|
+
MemoryShellRuntime,
|
|
3916
4151
|
ON_CLOSE_DELAY,
|
|
3917
4152
|
ProfileServiceImpl,
|
|
3918
4153
|
ServiceContext,
|
|
3919
4154
|
ServiceRegistry,
|
|
4155
|
+
ShellController,
|
|
4156
|
+
ShellRuntimeImpl,
|
|
3920
4157
|
SpaceInvitationsHandler,
|
|
3921
4158
|
SpaceInvitationsProxy,
|
|
3922
4159
|
SpaceInvitationsServiceImpl,
|
|
@@ -3927,12 +4164,14 @@ var ClientServicesProxy = class {
|
|
|
3927
4164
|
VaultResourceLock,
|
|
3928
4165
|
WorkerRuntime,
|
|
3929
4166
|
WorkerSession,
|
|
4167
|
+
appServiceBundle,
|
|
3930
4168
|
clientServiceBundle,
|
|
3931
4169
|
createAuthProvider,
|
|
3932
4170
|
createDefaultModelFactory,
|
|
3933
4171
|
createStorageObjects,
|
|
3934
4172
|
getNetworkPeers,
|
|
3935
4173
|
iframeServiceBundle,
|
|
4174
|
+
shellServiceBundle,
|
|
3936
4175
|
subscribeToFeedBlocks,
|
|
3937
4176
|
subscribeToFeeds,
|
|
3938
4177
|
subscribeToNetworkStatus,
|