@jupyterlite/kernel 0.6.0-alpha.3 → 0.6.0-alpha.5
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/lib/index.d.ts +1 -2
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib/kernelspecclient.d.ts +39 -0
- package/lib/kernelspecclient.js +37 -0
- package/lib/kernelspecclient.js.map +1 -0
- package/lib/tokens.d.ts +9 -0
- package/lib/tokens.js +4 -0
- package/lib/tokens.js.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +1 -2
- package/src/kernelspecclient.ts +64 -0
- package/src/tokens.ts +12 -0
- package/lib/connection.d.ts +0 -35
- package/lib/connection.js +0 -40
- package/lib/connection.js.map +0 -1
- package/lib/kernelspecsmanager.d.ts +0 -59
- package/lib/kernelspecsmanager.js +0 -58
- package/lib/kernelspecsmanager.js.map +0 -1
- package/lib/manager.d.ts +0 -40
- package/lib/manager.js +0 -56
- package/lib/manager.js.map +0 -1
- package/src/connection.ts +0 -68
- package/src/kernelspecsmanager.ts +0 -88
- package/src/manager.ts +0 -86
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
3
|
export * from './base';
|
|
4
|
-
export * from './manager';
|
|
5
4
|
export * from './kernelspecs';
|
|
6
|
-
export * from './
|
|
5
|
+
export * from './kernelspecclient';
|
|
7
6
|
export * from './client';
|
|
8
7
|
export * from './tokens';
|
|
9
8
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,cAAc,QAAQ,CAAC;AACvB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { KernelSpec, ServerConnection } from '@jupyterlab/services';
|
|
2
|
+
import { IKernelSpecs } from './tokens';
|
|
3
|
+
/**
|
|
4
|
+
* An in-browser client for the kernel spec API.
|
|
5
|
+
*/
|
|
6
|
+
export declare class LiteKernelSpecClient implements KernelSpec.IKernelSpecAPIClient {
|
|
7
|
+
/**
|
|
8
|
+
* Construct a new kernel spec client.
|
|
9
|
+
*/
|
|
10
|
+
constructor(options: LiteKernelSpecClient.IOptions);
|
|
11
|
+
/**
|
|
12
|
+
* The server settings used by the client.
|
|
13
|
+
*/
|
|
14
|
+
get serverSettings(): ServerConnection.ISettings;
|
|
15
|
+
/**
|
|
16
|
+
* Get the kernel specs.
|
|
17
|
+
*/
|
|
18
|
+
get(): Promise<KernelSpec.ISpecModels>;
|
|
19
|
+
private _kernelspecs;
|
|
20
|
+
private _serverSettings;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A namespace for LiteKernelSpecClient statics.
|
|
24
|
+
*/
|
|
25
|
+
export declare namespace LiteKernelSpecClient {
|
|
26
|
+
/**
|
|
27
|
+
* The options used to create a kernel spec client.
|
|
28
|
+
*/
|
|
29
|
+
interface IOptions {
|
|
30
|
+
/**
|
|
31
|
+
* The in-browser kernel specs.
|
|
32
|
+
*/
|
|
33
|
+
kernelSpecs: IKernelSpecs;
|
|
34
|
+
/**
|
|
35
|
+
* The server settings used by the client.
|
|
36
|
+
*/
|
|
37
|
+
serverSettings?: ServerConnection.ISettings;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
3
|
+
import { ServerConnection } from '@jupyterlab/services';
|
|
4
|
+
/**
|
|
5
|
+
* Placeholder for the kernel specs.
|
|
6
|
+
*/
|
|
7
|
+
const EMPTY_KERNELSPECS = {
|
|
8
|
+
default: '',
|
|
9
|
+
kernelspecs: {},
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* An in-browser client for the kernel spec API.
|
|
13
|
+
*/
|
|
14
|
+
export class LiteKernelSpecClient {
|
|
15
|
+
/**
|
|
16
|
+
* Construct a new kernel spec client.
|
|
17
|
+
*/
|
|
18
|
+
constructor(options) {
|
|
19
|
+
var _a;
|
|
20
|
+
this._kernelspecs = options.kernelSpecs;
|
|
21
|
+
this._serverSettings = (_a = options.serverSettings) !== null && _a !== void 0 ? _a : ServerConnection.makeSettings();
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The server settings used by the client.
|
|
25
|
+
*/
|
|
26
|
+
get serverSettings() {
|
|
27
|
+
return this._serverSettings;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get the kernel specs.
|
|
31
|
+
*/
|
|
32
|
+
async get() {
|
|
33
|
+
var _a;
|
|
34
|
+
return Promise.resolve((_a = this._kernelspecs.specs) !== null && _a !== void 0 ? _a : EMPTY_KERNELSPECS);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=kernelspecclient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kernelspecclient.js","sourceRoot":"","sources":["../src/kernelspecclient.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAc,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAIpE;;GAEG;AACH,MAAM,iBAAiB,GAA2B;IAChD,OAAO,EAAE,EAAE;IACX,WAAW,EAAE,EAAE;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAC/B;;OAEG;IACH,YAAY,OAAsC;;QAChD,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;QACxC,IAAI,CAAC,eAAe,GAAG,MAAA,OAAO,CAAC,cAAc,mCAAI,gBAAgB,CAAC,YAAY,EAAE,CAAC;IACnF,CAAC;IAED;;OAEG;IACH,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG;;QACP,OAAO,OAAO,CAAC,OAAO,CAAC,MAAA,IAAI,CAAC,YAAY,CAAC,KAAK,mCAAI,iBAAiB,CAAC,CAAC;IACvE,CAAC;CAIF"}
|
package/lib/tokens.d.ts
CHANGED
|
@@ -26,6 +26,15 @@ export interface IKernelClient extends Kernel.IKernelAPIClient {
|
|
|
26
26
|
*/
|
|
27
27
|
shutdownAll: () => Promise<void>;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* The token for the kernel spec client.
|
|
31
|
+
*/
|
|
32
|
+
export declare const IKernelSpecClient: Token<IKernelSpecClient>;
|
|
33
|
+
/**
|
|
34
|
+
* An interface for the kernel spec client.
|
|
35
|
+
*/
|
|
36
|
+
export interface IKernelSpecClient extends KernelSpec.IKernelSpecAPIClient {
|
|
37
|
+
}
|
|
29
38
|
/**
|
|
30
39
|
* An interface for a kernel running in the browser.
|
|
31
40
|
*/
|
package/lib/tokens.js
CHANGED
|
@@ -9,6 +9,10 @@ export const FALLBACK_KERNEL = 'javascript';
|
|
|
9
9
|
* The token for the kernel client.
|
|
10
10
|
*/
|
|
11
11
|
export const IKernelClient = new Token('@jupyterlite/kernel:IKernelClient');
|
|
12
|
+
/**
|
|
13
|
+
* The token for the kernel spec client.
|
|
14
|
+
*/
|
|
15
|
+
export const IKernelSpecClient = new Token('@jupyterlite/kernel:IKernelSpecClient');
|
|
12
16
|
/**
|
|
13
17
|
* The token for the kernel spec service.
|
|
14
18
|
*/
|
package/lib/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAQ3D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAQ1C;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,KAAK,CACpC,mCAAmC,CACpC,CAAC;
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAQ3D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAQ1C;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,KAAK,CACpC,mCAAmC,CACpC,CAAC;AAiBF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,KAAK,CACxC,uCAAuC,CACxC,CAAC;AA0EF;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,KAAK,CAAe,kCAAkC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyterlite/kernel",
|
|
3
|
-
"version": "0.6.0-alpha.
|
|
3
|
+
"version": "0.6.0-alpha.5",
|
|
4
4
|
"description": "JupyterLite - Kernel",
|
|
5
5
|
"homepage": "https://github.com/jupyterlite/jupyterlite",
|
|
6
6
|
"bugs": {
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"watch": "tsc -b --watch"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@jupyterlab/coreutils": "~6.4.0-beta.
|
|
47
|
-
"@jupyterlab/observables": "~5.4.0-beta.
|
|
48
|
-
"@jupyterlab/services": "~7.4.0-beta.
|
|
46
|
+
"@jupyterlab/coreutils": "~6.4.0-beta.2",
|
|
47
|
+
"@jupyterlab/observables": "~5.4.0-beta.2",
|
|
48
|
+
"@jupyterlab/services": "~7.4.0-beta.2",
|
|
49
49
|
"@lumino/coreutils": "^2.2.0",
|
|
50
50
|
"@lumino/disposable": "^2.1.3",
|
|
51
51
|
"@lumino/signaling": "^2.1.3",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@babel/core": "^7.11.6",
|
|
58
58
|
"@babel/preset-env": "^7.12.1",
|
|
59
|
-
"@jupyterlab/testutils": "~4.4.0-beta.
|
|
59
|
+
"@jupyterlab/testutils": "~4.4.0-beta.2",
|
|
60
60
|
"@types/jest": "^29.5.3",
|
|
61
61
|
"jest": "^29.6.2",
|
|
62
62
|
"rimraf": "~5.0.1",
|
package/src/index.ts
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
3
|
|
|
4
4
|
export * from './base';
|
|
5
|
-
export * from './manager';
|
|
6
5
|
export * from './kernelspecs';
|
|
7
|
-
export * from './
|
|
6
|
+
export * from './kernelspecclient';
|
|
8
7
|
export * from './client';
|
|
9
8
|
export * from './tokens';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Copyright (c) Jupyter Development Team.
|
|
2
|
+
// Distributed under the terms of the Modified BSD License.
|
|
3
|
+
|
|
4
|
+
import { KernelSpec, ServerConnection } from '@jupyterlab/services';
|
|
5
|
+
|
|
6
|
+
import { IKernelSpecs } from './tokens';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Placeholder for the kernel specs.
|
|
10
|
+
*/
|
|
11
|
+
const EMPTY_KERNELSPECS: KernelSpec.ISpecModels = {
|
|
12
|
+
default: '',
|
|
13
|
+
kernelspecs: {},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* An in-browser client for the kernel spec API.
|
|
18
|
+
*/
|
|
19
|
+
export class LiteKernelSpecClient implements KernelSpec.IKernelSpecAPIClient {
|
|
20
|
+
/**
|
|
21
|
+
* Construct a new kernel spec client.
|
|
22
|
+
*/
|
|
23
|
+
constructor(options: LiteKernelSpecClient.IOptions) {
|
|
24
|
+
this._kernelspecs = options.kernelSpecs;
|
|
25
|
+
this._serverSettings = options.serverSettings ?? ServerConnection.makeSettings();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The server settings used by the client.
|
|
30
|
+
*/
|
|
31
|
+
get serverSettings(): ServerConnection.ISettings {
|
|
32
|
+
return this._serverSettings;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get the kernel specs.
|
|
37
|
+
*/
|
|
38
|
+
async get(): Promise<KernelSpec.ISpecModels> {
|
|
39
|
+
return Promise.resolve(this._kernelspecs.specs ?? EMPTY_KERNELSPECS);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private _kernelspecs: IKernelSpecs;
|
|
43
|
+
private _serverSettings: ServerConnection.ISettings;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A namespace for LiteKernelSpecClient statics.
|
|
48
|
+
*/
|
|
49
|
+
export namespace LiteKernelSpecClient {
|
|
50
|
+
/**
|
|
51
|
+
* The options used to create a kernel spec client.
|
|
52
|
+
*/
|
|
53
|
+
export interface IOptions {
|
|
54
|
+
/**
|
|
55
|
+
* The in-browser kernel specs.
|
|
56
|
+
*/
|
|
57
|
+
kernelSpecs: IKernelSpecs;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The server settings used by the client.
|
|
61
|
+
*/
|
|
62
|
+
serverSettings?: ServerConnection.ISettings;
|
|
63
|
+
}
|
|
64
|
+
}
|
package/src/tokens.ts
CHANGED
|
@@ -42,6 +42,18 @@ export interface IKernelClient extends Kernel.IKernelAPIClient {
|
|
|
42
42
|
shutdownAll: () => Promise<void>;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* The token for the kernel spec client.
|
|
47
|
+
*/
|
|
48
|
+
export const IKernelSpecClient = new Token<IKernelSpecClient>(
|
|
49
|
+
'@jupyterlite/kernel:IKernelSpecClient',
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* An interface for the kernel spec client.
|
|
54
|
+
*/
|
|
55
|
+
export interface IKernelSpecClient extends KernelSpec.IKernelSpecAPIClient {}
|
|
56
|
+
|
|
45
57
|
/**
|
|
46
58
|
* An interface for a kernel running in the browser.
|
|
47
59
|
*/
|
package/lib/connection.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Kernel, KernelConnection, KernelSpec } from '@jupyterlab/services';
|
|
2
|
-
import { IKernelSpecs } from './tokens';
|
|
3
|
-
/**
|
|
4
|
-
* Custom KernelConnection class for use in JupyterLite.
|
|
5
|
-
*
|
|
6
|
-
* TODO: remove the entire file after https://github.com/jupyterlab/jupyterlab/pull/17395
|
|
7
|
-
*/
|
|
8
|
-
export declare class LiteKernelConnection extends KernelConnection implements Kernel.IKernelConnection {
|
|
9
|
-
constructor(options: LiteKernelConnection.IOptions);
|
|
10
|
-
/**
|
|
11
|
-
* The kernel spec.
|
|
12
|
-
*
|
|
13
|
-
* @returns A promise that resolves to the kernel spec.
|
|
14
|
-
*/
|
|
15
|
-
get spec(): Promise<KernelSpec.ISpecModel | undefined>;
|
|
16
|
-
/**
|
|
17
|
-
* Clone the current kernel with a new clientId.
|
|
18
|
-
*/
|
|
19
|
-
clone(options?: Pick<Kernel.IKernelConnection.IOptions, 'clientId' | 'username' | 'handleComms'>): Kernel.IKernelConnection;
|
|
20
|
-
private _kernelSpecs;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* A namespace for LiteKernelConnection statics.
|
|
24
|
-
*/
|
|
25
|
-
export declare namespace LiteKernelConnection {
|
|
26
|
-
/**
|
|
27
|
-
* The options used to create a LiteKernelConnection.
|
|
28
|
-
*/
|
|
29
|
-
interface IOptions extends Kernel.IKernelConnection.IOptions {
|
|
30
|
-
/**
|
|
31
|
-
* The kernel specs.
|
|
32
|
-
*/
|
|
33
|
-
kernelSpecs: IKernelSpecs;
|
|
34
|
-
}
|
|
35
|
-
}
|
package/lib/connection.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Jupyter Development Team.
|
|
2
|
-
// Distributed under the terms of the Modified BSD License.
|
|
3
|
-
import { KernelConnection } from '@jupyterlab/services';
|
|
4
|
-
/**
|
|
5
|
-
* Custom KernelConnection class for use in JupyterLite.
|
|
6
|
-
*
|
|
7
|
-
* TODO: remove the entire file after https://github.com/jupyterlab/jupyterlab/pull/17395
|
|
8
|
-
*/
|
|
9
|
-
export class LiteKernelConnection extends KernelConnection {
|
|
10
|
-
constructor(options) {
|
|
11
|
-
super(options);
|
|
12
|
-
this._kernelSpecs = options.kernelSpecs;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* The kernel spec.
|
|
16
|
-
*
|
|
17
|
-
* @returns A promise that resolves to the kernel spec.
|
|
18
|
-
*/
|
|
19
|
-
get spec() {
|
|
20
|
-
var _a;
|
|
21
|
-
const spec = (_a = this._kernelSpecs.specs) === null || _a === void 0 ? void 0 : _a.kernelspecs[this.model.name];
|
|
22
|
-
return Promise.resolve(spec);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Clone the current kernel with a new clientId.
|
|
26
|
-
*/
|
|
27
|
-
clone(options = {}) {
|
|
28
|
-
return new LiteKernelConnection({
|
|
29
|
-
model: this.model,
|
|
30
|
-
username: this.username,
|
|
31
|
-
serverSettings: this.serverSettings,
|
|
32
|
-
// handleComms defaults to false since that is safer
|
|
33
|
-
handleComms: false,
|
|
34
|
-
kernelSpecs: this._kernelSpecs,
|
|
35
|
-
kernelAPIClient: this['_kernelAPIClient'],
|
|
36
|
-
...options,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=connection.js.map
|
package/lib/connection.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAU,gBAAgB,EAAc,MAAM,sBAAsB,CAAC;AAG5E;;;;GAIG;AACH,MAAM,OAAO,oBACX,SAAQ,gBAAgB;IAGxB,YAAY,OAAsC;QAChD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAC1C,CAAC;IAED;;;;OAIG;IACH,IAAI,IAAI;;QACN,MAAM,IAAI,GAAG,MAAA,IAAI,CAAC,YAAY,CAAC,KAAK,0CAAE,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACnE,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,KAAK,CACH,UAGI,EAAE;QAEN,OAAO,IAAI,oBAAoB,CAAC;YAC9B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,oDAAoD;YACpD,WAAW,EAAE,KAAK;YAClB,WAAW,EAAE,IAAI,CAAC,YAAY;YAC9B,eAAe,EAAE,IAAI,CAAC,kBAAkB,CAAC;YACzC,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;CAGF"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { BaseManager, KernelSpec, ServerConnection } from '@jupyterlab/services';
|
|
2
|
-
import { ISignal } from '@lumino/signaling';
|
|
3
|
-
import { IKernelSpecs } from './tokens';
|
|
4
|
-
/**
|
|
5
|
-
* A class to manage in-browser kernel specs.
|
|
6
|
-
*/
|
|
7
|
-
export declare class LiteKernelSpecs extends BaseManager implements KernelSpec.IManager {
|
|
8
|
-
/**
|
|
9
|
-
* Construct a new kernel specs manager.
|
|
10
|
-
*/
|
|
11
|
-
constructor(options: LiteKernelSpecs.IOptions);
|
|
12
|
-
/**
|
|
13
|
-
* A signal emitted when there is a connection failure.
|
|
14
|
-
*/
|
|
15
|
-
get connectionFailure(): ISignal<this, Error>;
|
|
16
|
-
/**
|
|
17
|
-
* Test whether the manager is ready.
|
|
18
|
-
*/
|
|
19
|
-
get isReady(): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* A promise that fulfills when the manager is ready.
|
|
22
|
-
*/
|
|
23
|
-
get ready(): Promise<void>;
|
|
24
|
-
/**
|
|
25
|
-
* Get the kernel specs.
|
|
26
|
-
*/
|
|
27
|
-
get specs(): KernelSpec.ISpecModels | null;
|
|
28
|
-
/**
|
|
29
|
-
* A signal emitted when the specs change.
|
|
30
|
-
*/
|
|
31
|
-
get specsChanged(): ISignal<this, KernelSpec.ISpecModels>;
|
|
32
|
-
/**
|
|
33
|
-
* Force a refresh of the specs from the server.
|
|
34
|
-
*/
|
|
35
|
-
refreshSpecs(): Promise<void>;
|
|
36
|
-
private _kernelSpecs;
|
|
37
|
-
private _isReady;
|
|
38
|
-
private _connectionFailure;
|
|
39
|
-
private _ready;
|
|
40
|
-
private _specsChanged;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* The namespace for `LiteKernelSpecs` class statics.
|
|
44
|
-
*/
|
|
45
|
-
export declare namespace LiteKernelSpecs {
|
|
46
|
-
/**
|
|
47
|
-
* The instantiation options for a kernel specs manager.
|
|
48
|
-
*/
|
|
49
|
-
interface IOptions {
|
|
50
|
-
/**
|
|
51
|
-
* The in-browser kernel specs.
|
|
52
|
-
*/
|
|
53
|
-
kernelSpecs: IKernelSpecs;
|
|
54
|
-
/**
|
|
55
|
-
* The server settings.
|
|
56
|
-
*/
|
|
57
|
-
serverSettings?: ServerConnection.ISettings;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Jupyter Development Team.
|
|
2
|
-
// Distributed under the terms of the Modified BSD License.
|
|
3
|
-
import { BaseManager } from '@jupyterlab/services';
|
|
4
|
-
import { Signal } from '@lumino/signaling';
|
|
5
|
-
/**
|
|
6
|
-
* A class to manage in-browser kernel specs.
|
|
7
|
-
*/
|
|
8
|
-
export class LiteKernelSpecs extends BaseManager {
|
|
9
|
-
/**
|
|
10
|
-
* Construct a new kernel specs manager.
|
|
11
|
-
*/
|
|
12
|
-
constructor(options) {
|
|
13
|
-
super(options);
|
|
14
|
-
this._isReady = false;
|
|
15
|
-
this._connectionFailure = new Signal(this);
|
|
16
|
-
this._ready = Promise.resolve(void 0);
|
|
17
|
-
this._specsChanged = new Signal(this);
|
|
18
|
-
this._kernelSpecs = options.kernelSpecs;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* A signal emitted when there is a connection failure.
|
|
22
|
-
*/
|
|
23
|
-
get connectionFailure() {
|
|
24
|
-
return this._connectionFailure;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Test whether the manager is ready.
|
|
28
|
-
*/
|
|
29
|
-
get isReady() {
|
|
30
|
-
return this._isReady;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* A promise that fulfills when the manager is ready.
|
|
34
|
-
*/
|
|
35
|
-
get ready() {
|
|
36
|
-
return this._ready;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Get the kernel specs.
|
|
40
|
-
*/
|
|
41
|
-
get specs() {
|
|
42
|
-
return this._kernelSpecs.specs;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* A signal emitted when the specs change.
|
|
46
|
-
*/
|
|
47
|
-
get specsChanged() {
|
|
48
|
-
return this._specsChanged;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Force a refresh of the specs from the server.
|
|
52
|
-
*/
|
|
53
|
-
async refreshSpecs() {
|
|
54
|
-
// no-op
|
|
55
|
-
return Promise.resolve(void 0);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=kernelspecsmanager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kernelspecsmanager.js","sourceRoot":"","sources":["../src/kernelspecsmanager.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,WAAW,EAAgC,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGpD;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,WAAW;IAC9C;;OAEG;IACH,YAAY,OAAiC;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAC;QAgDT,aAAQ,GAAG,KAAK,CAAC;QACjB,uBAAkB,GAAG,IAAI,MAAM,CAAc,IAAI,CAAC,CAAC;QACnD,WAAM,GAAkB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QAChD,kBAAa,GAAG,IAAI,MAAM,CAA+B,IAAI,CAAC,CAAC;QAlDrE,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY;QAChB,QAAQ;QACR,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IACjC,CAAC;CAOF"}
|
package/lib/manager.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { BaseManager, Kernel, KernelManager } from '@jupyterlab/services';
|
|
2
|
-
import { IKernelSpecs, IKernelClient } from './tokens';
|
|
3
|
-
/**
|
|
4
|
-
* A custom kernel manager for JupyterLite, to be able to override the default
|
|
5
|
-
* `KernelConnection` and use of the Jupyter Server Kernel API.
|
|
6
|
-
*
|
|
7
|
-
* TODO: remove the entire the file after https://github.com/jupyterlab/jupyterlab/pull/17395.
|
|
8
|
-
*/
|
|
9
|
-
export declare class LiteKernelManager extends KernelManager implements Kernel.IManager {
|
|
10
|
-
/**
|
|
11
|
-
* Construct a new Kernels
|
|
12
|
-
*
|
|
13
|
-
* @param options The instantiation options
|
|
14
|
-
*/
|
|
15
|
-
constructor(options: LiteKernelManager.IOptions);
|
|
16
|
-
/**
|
|
17
|
-
* Connect to an existing kernel.
|
|
18
|
-
*/
|
|
19
|
-
connectTo(options: Omit<Kernel.IKernelConnection.IOptions, 'serverSettings'>): Kernel.IKernelConnection;
|
|
20
|
-
private _kernelSpecs;
|
|
21
|
-
private _kernelClient;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* A namespace for Kernels statics.
|
|
25
|
-
*/
|
|
26
|
-
export declare namespace LiteKernelManager {
|
|
27
|
-
/**
|
|
28
|
-
* The options used to initialize a LiteKernelManager.
|
|
29
|
-
*/
|
|
30
|
-
interface IOptions extends BaseManager.IOptions {
|
|
31
|
-
/**
|
|
32
|
-
* The in-browser kernel specs service.
|
|
33
|
-
*/
|
|
34
|
-
kernelSpecs: IKernelSpecs;
|
|
35
|
-
/**
|
|
36
|
-
* The kernel client.
|
|
37
|
-
*/
|
|
38
|
-
kernelClient: IKernelClient;
|
|
39
|
-
}
|
|
40
|
-
}
|
package/lib/manager.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Jupyter Development Team.
|
|
2
|
-
// Distributed under the terms of the Modified BSD License.
|
|
3
|
-
import { KernelManager } from '@jupyterlab/services';
|
|
4
|
-
import { LiteKernelConnection } from './connection';
|
|
5
|
-
/**
|
|
6
|
-
* A custom kernel manager for JupyterLite, to be able to override the default
|
|
7
|
-
* `KernelConnection` and use of the Jupyter Server Kernel API.
|
|
8
|
-
*
|
|
9
|
-
* TODO: remove the entire the file after https://github.com/jupyterlab/jupyterlab/pull/17395.
|
|
10
|
-
*/
|
|
11
|
-
export class LiteKernelManager extends KernelManager {
|
|
12
|
-
/**
|
|
13
|
-
* Construct a new Kernels
|
|
14
|
-
*
|
|
15
|
-
* @param options The instantiation options
|
|
16
|
-
*/
|
|
17
|
-
constructor(options) {
|
|
18
|
-
super({
|
|
19
|
-
...options,
|
|
20
|
-
kernelAPIClient: options.kernelClient,
|
|
21
|
-
});
|
|
22
|
-
const { kernelSpecs, kernelClient } = options;
|
|
23
|
-
this._kernelSpecs = kernelSpecs;
|
|
24
|
-
this._kernelClient = kernelClient;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Connect to an existing kernel.
|
|
28
|
-
*/
|
|
29
|
-
connectTo(options) {
|
|
30
|
-
var _a;
|
|
31
|
-
const { id } = options.model;
|
|
32
|
-
let handleComms = (_a = options.handleComms) !== null && _a !== void 0 ? _a : true;
|
|
33
|
-
// By default, handle comms only if no other kernel connection is.
|
|
34
|
-
if (options.handleComms === undefined) {
|
|
35
|
-
for (const kc of this['_kernelConnections']) {
|
|
36
|
-
if (kc.id === id && kc.handleComms) {
|
|
37
|
-
handleComms = false;
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const kernelConnection = new LiteKernelConnection({
|
|
43
|
-
handleComms,
|
|
44
|
-
...options,
|
|
45
|
-
serverSettings: this.serverSettings,
|
|
46
|
-
kernelSpecs: this._kernelSpecs,
|
|
47
|
-
kernelAPIClient: this._kernelClient,
|
|
48
|
-
});
|
|
49
|
-
this['_onStarted'](kernelConnection);
|
|
50
|
-
void this.refreshRunning().catch(() => {
|
|
51
|
-
/* no-op */
|
|
52
|
-
});
|
|
53
|
-
return kernelConnection;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=manager.js.map
|
package/lib/manager.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../src/manager.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAuB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAIpD;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,aAAa;IAClD;;;;OAIG;IACH,YAAY,OAAmC;QAC7C,KAAK,CAAC;YACJ,GAAG,OAAO;YACV,eAAe,EAAE,OAAO,CAAC,YAAY;SACtC,CAAC,CAAC;QACH,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;QAC9C,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,SAAS,CACP,OAAkE;;QAElE,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC;QAE7B,IAAI,WAAW,GAAG,MAAA,OAAO,CAAC,WAAW,mCAAI,IAAI,CAAC;QAC9C,kEAAkE;QAClE,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,EAAE;YACrC,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,oBAAoB,CAAC,EAAE;gBAC3C,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE;oBAClC,WAAW,GAAG,KAAK,CAAC;oBACpB,MAAM;iBACP;aACF;SACF;QACD,MAAM,gBAAgB,GAAG,IAAI,oBAAoB,CAAC;YAChD,WAAW;YACX,GAAG,OAAO;YACV,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,WAAW,EAAE,IAAI,CAAC,YAAY;YAC9B,eAAe,EAAE,IAAI,CAAC,aAAa;SACpC,CAAC,CAAC;QACH,IAAI,CAAC,YAAY,CAAC,CAAC,gBAAgB,CAAC,CAAC;QACrC,KAAK,IAAI,CAAC,cAAc,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE;YACpC,WAAW;QACb,CAAC,CAAC,CAAC;QACH,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CAIF"}
|
package/src/connection.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Jupyter Development Team.
|
|
2
|
-
// Distributed under the terms of the Modified BSD License.
|
|
3
|
-
|
|
4
|
-
import { Kernel, KernelConnection, KernelSpec } from '@jupyterlab/services';
|
|
5
|
-
import { IKernelSpecs } from './tokens';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Custom KernelConnection class for use in JupyterLite.
|
|
9
|
-
*
|
|
10
|
-
* TODO: remove the entire file after https://github.com/jupyterlab/jupyterlab/pull/17395
|
|
11
|
-
*/
|
|
12
|
-
export class LiteKernelConnection
|
|
13
|
-
extends KernelConnection
|
|
14
|
-
implements Kernel.IKernelConnection
|
|
15
|
-
{
|
|
16
|
-
constructor(options: LiteKernelConnection.IOptions) {
|
|
17
|
-
super(options);
|
|
18
|
-
this._kernelSpecs = options.kernelSpecs;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* The kernel spec.
|
|
23
|
-
*
|
|
24
|
-
* @returns A promise that resolves to the kernel spec.
|
|
25
|
-
*/
|
|
26
|
-
get spec(): Promise<KernelSpec.ISpecModel | undefined> {
|
|
27
|
-
const spec = this._kernelSpecs.specs?.kernelspecs[this.model.name];
|
|
28
|
-
return Promise.resolve(spec);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Clone the current kernel with a new clientId.
|
|
33
|
-
*/
|
|
34
|
-
clone(
|
|
35
|
-
options: Pick<
|
|
36
|
-
Kernel.IKernelConnection.IOptions,
|
|
37
|
-
'clientId' | 'username' | 'handleComms'
|
|
38
|
-
> = {},
|
|
39
|
-
): Kernel.IKernelConnection {
|
|
40
|
-
return new LiteKernelConnection({
|
|
41
|
-
model: this.model,
|
|
42
|
-
username: this.username,
|
|
43
|
-
serverSettings: this.serverSettings,
|
|
44
|
-
// handleComms defaults to false since that is safer
|
|
45
|
-
handleComms: false,
|
|
46
|
-
kernelSpecs: this._kernelSpecs,
|
|
47
|
-
kernelAPIClient: this['_kernelAPIClient'],
|
|
48
|
-
...options,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
private _kernelSpecs: IKernelSpecs;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* A namespace for LiteKernelConnection statics.
|
|
57
|
-
*/
|
|
58
|
-
export namespace LiteKernelConnection {
|
|
59
|
-
/**
|
|
60
|
-
* The options used to create a LiteKernelConnection.
|
|
61
|
-
*/
|
|
62
|
-
export interface IOptions extends Kernel.IKernelConnection.IOptions {
|
|
63
|
-
/**
|
|
64
|
-
* The kernel specs.
|
|
65
|
-
*/
|
|
66
|
-
kernelSpecs: IKernelSpecs;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Jupyter Development Team.
|
|
2
|
-
// Distributed under the terms of the Modified BSD License.
|
|
3
|
-
|
|
4
|
-
import { BaseManager, KernelSpec, ServerConnection } from '@jupyterlab/services';
|
|
5
|
-
import { ISignal, Signal } from '@lumino/signaling';
|
|
6
|
-
import { IKernelSpecs } from './tokens';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* A class to manage in-browser kernel specs.
|
|
10
|
-
*/
|
|
11
|
-
export class LiteKernelSpecs extends BaseManager implements KernelSpec.IManager {
|
|
12
|
-
/**
|
|
13
|
-
* Construct a new kernel specs manager.
|
|
14
|
-
*/
|
|
15
|
-
constructor(options: LiteKernelSpecs.IOptions) {
|
|
16
|
-
super(options);
|
|
17
|
-
this._kernelSpecs = options.kernelSpecs;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* A signal emitted when there is a connection failure.
|
|
22
|
-
*/
|
|
23
|
-
get connectionFailure(): ISignal<this, Error> {
|
|
24
|
-
return this._connectionFailure;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Test whether the manager is ready.
|
|
29
|
-
*/
|
|
30
|
-
get isReady(): boolean {
|
|
31
|
-
return this._isReady;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* A promise that fulfills when the manager is ready.
|
|
36
|
-
*/
|
|
37
|
-
get ready(): Promise<void> {
|
|
38
|
-
return this._ready;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Get the kernel specs.
|
|
43
|
-
*/
|
|
44
|
-
get specs(): KernelSpec.ISpecModels | null {
|
|
45
|
-
return this._kernelSpecs.specs;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* A signal emitted when the specs change.
|
|
50
|
-
*/
|
|
51
|
-
get specsChanged(): ISignal<this, KernelSpec.ISpecModels> {
|
|
52
|
-
return this._specsChanged;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Force a refresh of the specs from the server.
|
|
57
|
-
*/
|
|
58
|
-
async refreshSpecs(): Promise<void> {
|
|
59
|
-
// no-op
|
|
60
|
-
return Promise.resolve(void 0);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
private _kernelSpecs: IKernelSpecs;
|
|
64
|
-
private _isReady = false;
|
|
65
|
-
private _connectionFailure = new Signal<this, Error>(this);
|
|
66
|
-
private _ready: Promise<void> = Promise.resolve(void 0);
|
|
67
|
-
private _specsChanged = new Signal<this, KernelSpec.ISpecModels>(this);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* The namespace for `LiteKernelSpecs` class statics.
|
|
72
|
-
*/
|
|
73
|
-
export namespace LiteKernelSpecs {
|
|
74
|
-
/**
|
|
75
|
-
* The instantiation options for a kernel specs manager.
|
|
76
|
-
*/
|
|
77
|
-
export interface IOptions {
|
|
78
|
-
/**
|
|
79
|
-
* The in-browser kernel specs.
|
|
80
|
-
*/
|
|
81
|
-
kernelSpecs: IKernelSpecs;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* The server settings.
|
|
85
|
-
*/
|
|
86
|
-
serverSettings?: ServerConnection.ISettings;
|
|
87
|
-
}
|
|
88
|
-
}
|
package/src/manager.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Jupyter Development Team.
|
|
2
|
-
// Distributed under the terms of the Modified BSD License.
|
|
3
|
-
|
|
4
|
-
import { BaseManager, Kernel, KernelManager } from '@jupyterlab/services';
|
|
5
|
-
|
|
6
|
-
import { LiteKernelConnection } from './connection';
|
|
7
|
-
|
|
8
|
-
import { IKernelSpecs, IKernelClient } from './tokens';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* A custom kernel manager for JupyterLite, to be able to override the default
|
|
12
|
-
* `KernelConnection` and use of the Jupyter Server Kernel API.
|
|
13
|
-
*
|
|
14
|
-
* TODO: remove the entire the file after https://github.com/jupyterlab/jupyterlab/pull/17395.
|
|
15
|
-
*/
|
|
16
|
-
export class LiteKernelManager extends KernelManager implements Kernel.IManager {
|
|
17
|
-
/**
|
|
18
|
-
* Construct a new Kernels
|
|
19
|
-
*
|
|
20
|
-
* @param options The instantiation options
|
|
21
|
-
*/
|
|
22
|
-
constructor(options: LiteKernelManager.IOptions) {
|
|
23
|
-
super({
|
|
24
|
-
...options,
|
|
25
|
-
kernelAPIClient: options.kernelClient,
|
|
26
|
-
});
|
|
27
|
-
const { kernelSpecs, kernelClient } = options;
|
|
28
|
-
this._kernelSpecs = kernelSpecs;
|
|
29
|
-
this._kernelClient = kernelClient;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Connect to an existing kernel.
|
|
34
|
-
*/
|
|
35
|
-
connectTo(
|
|
36
|
-
options: Omit<Kernel.IKernelConnection.IOptions, 'serverSettings'>,
|
|
37
|
-
): Kernel.IKernelConnection {
|
|
38
|
-
const { id } = options.model;
|
|
39
|
-
|
|
40
|
-
let handleComms = options.handleComms ?? true;
|
|
41
|
-
// By default, handle comms only if no other kernel connection is.
|
|
42
|
-
if (options.handleComms === undefined) {
|
|
43
|
-
for (const kc of this['_kernelConnections']) {
|
|
44
|
-
if (kc.id === id && kc.handleComms) {
|
|
45
|
-
handleComms = false;
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
const kernelConnection = new LiteKernelConnection({
|
|
51
|
-
handleComms,
|
|
52
|
-
...options,
|
|
53
|
-
serverSettings: this.serverSettings,
|
|
54
|
-
kernelSpecs: this._kernelSpecs,
|
|
55
|
-
kernelAPIClient: this._kernelClient,
|
|
56
|
-
});
|
|
57
|
-
this['_onStarted'](kernelConnection);
|
|
58
|
-
void this.refreshRunning().catch(() => {
|
|
59
|
-
/* no-op */
|
|
60
|
-
});
|
|
61
|
-
return kernelConnection;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
private _kernelSpecs: IKernelSpecs;
|
|
65
|
-
private _kernelClient: IKernelClient;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* A namespace for Kernels statics.
|
|
70
|
-
*/
|
|
71
|
-
export namespace LiteKernelManager {
|
|
72
|
-
/**
|
|
73
|
-
* The options used to initialize a LiteKernelManager.
|
|
74
|
-
*/
|
|
75
|
-
export interface IOptions extends BaseManager.IOptions {
|
|
76
|
-
/**
|
|
77
|
-
* The in-browser kernel specs service.
|
|
78
|
-
*/
|
|
79
|
-
kernelSpecs: IKernelSpecs;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* The kernel client.
|
|
83
|
-
*/
|
|
84
|
-
kernelClient: IKernelClient;
|
|
85
|
-
}
|
|
86
|
-
}
|