@jupyterlite/kernel 0.1.0-beta.1 → 0.1.0-beta.10

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/kernel.d.ts CHANGED
@@ -31,6 +31,10 @@ export declare abstract class BaseKernel implements IKernel {
31
31
  * Get the name of the kernel
32
32
  */
33
33
  get name(): string;
34
+ /**
35
+ * The location in the virtual filesystem from which the kernel was started.
36
+ */
37
+ get location(): string;
34
38
  /**
35
39
  * The current execution count
36
40
  */
@@ -230,6 +234,7 @@ export declare abstract class BaseKernel implements IKernel {
230
234
  private _isCompleteRequest;
231
235
  private _id;
232
236
  private _name;
237
+ private _location;
233
238
  private _history;
234
239
  private _executionCount;
235
240
  private _isDisposed;
package/lib/kernel.js CHANGED
@@ -16,9 +16,10 @@ export class BaseKernel {
16
16
  this._disposed = new Signal(this);
17
17
  this._parentHeader = undefined;
18
18
  this._parent = undefined;
19
- const { id, name, sendMessage } = options;
19
+ const { id, name, location, sendMessage } = options;
20
20
  this._id = id;
21
21
  this._name = name;
22
+ this._location = location;
22
23
  this._sendMessage = sendMessage;
23
24
  }
24
25
  /**
@@ -51,6 +52,12 @@ export class BaseKernel {
51
52
  get name() {
52
53
  return this._name;
53
54
  }
55
+ /**
56
+ * The location in the virtual filesystem from which the kernel was started.
57
+ */
58
+ get location() {
59
+ return this._location;
60
+ }
54
61
  /**
55
62
  * The current execution count
56
63
  */
package/lib/kernels.d.ts CHANGED
@@ -58,6 +58,10 @@ export declare namespace Kernels {
58
58
  * The kernel name.
59
59
  */
60
60
  name: string;
61
+ /**
62
+ * The location in the virtual filesystem from which the kernel was started.
63
+ */
64
+ location: string;
61
65
  }
62
66
  /**
63
67
  * The base url for the Kernels manager
package/lib/kernels.js CHANGED
@@ -26,7 +26,7 @@ export class Kernels {
26
26
  * @param options The kernel start options.
27
27
  */
28
28
  async startNew(options) {
29
- const { id, name } = options;
29
+ const { id, name, location } = options;
30
30
  const factory = this._kernelspecs.factories.get(name);
31
31
  // bail if there is no factory associated with the requested kernel
32
32
  if (!factory) {
@@ -116,6 +116,7 @@ export class Kernels {
116
116
  id: kernelId,
117
117
  sendMessage,
118
118
  name,
119
+ location,
119
120
  });
120
121
  await kernel.ready;
121
122
  this._kernels.set(kernelId, kernel);
@@ -160,9 +161,9 @@ export class Kernels {
160
161
  if (!kernel) {
161
162
  throw Error(`Kernel ${kernelId} does not exist`);
162
163
  }
163
- const { id, name } = kernel;
164
+ const { id, name, location } = kernel;
164
165
  kernel.dispose();
165
- return this.startNew({ id, name });
166
+ return this.startNew({ id, name, location });
166
167
  }
167
168
  /**
168
169
  * Shut down a kernel.
@@ -4,12 +4,6 @@ import { IKernel, IKernelSpecs } from './tokens';
4
4
  * A class to handle requests to /api/kernelspecs
5
5
  */
6
6
  export declare class KernelSpecs implements IKernelSpecs {
7
- /**
8
- * Construct a new KernelSpecs.
9
- *
10
- * @param options The instantiation options.
11
- */
12
- constructor(options: KernelSpecs.IOptions);
13
7
  /**
14
8
  * Get the kernel specs.
15
9
  */
@@ -31,11 +25,6 @@ export declare class KernelSpecs implements IKernelSpecs {
31
25
  * A namespace for KernelSpecs statics.
32
26
  */
33
27
  export declare namespace KernelSpecs {
34
- /**
35
- * The instantiation options for a KernelSpecs
36
- */
37
- interface IOptions {
38
- }
39
28
  /**
40
29
  * Registration options for a new kernel.
41
30
  */
@@ -2,15 +2,9 @@
2
2
  * A class to handle requests to /api/kernelspecs
3
3
  */
4
4
  export class KernelSpecs {
5
- /**
6
- * Construct a new KernelSpecs.
7
- *
8
- * @param options The instantiation options.
9
- */
10
- constructor(options) {
5
+ constructor() {
11
6
  this._specs = new Map();
12
7
  this._factories = new Map();
13
- // no-op
14
8
  }
15
9
  /**
16
10
  * Get the kernel specs.
package/lib/tokens.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Remote } from 'comlink';
1
2
  import { Kernel, KernelMessage, KernelSpec } from '@jupyterlab/services';
2
3
  import { Token } from '@lumino/coreutils';
3
4
  import { IObservableDisposable } from '@lumino/disposable';
@@ -42,6 +43,10 @@ export interface IKernel extends IObservableDisposable {
42
43
  * The name of the server-side kernel.
43
44
  */
44
45
  readonly name: string;
46
+ /**
47
+ * The location in the virtual filesystem from which the kernel was started.
48
+ */
49
+ readonly location: string;
45
50
  /**
46
51
  * A promise that is fulfilled when the kernel is ready.
47
52
  */
@@ -73,6 +78,10 @@ export declare namespace IKernel {
73
78
  * The name of the kernel.
74
79
  */
75
80
  name: string;
81
+ /**
82
+ * The location in the virtual filesystem from which the kernel was started.
83
+ */
84
+ location: string;
76
85
  /**
77
86
  * The method to send messages back to the server.
78
87
  */
@@ -102,3 +111,34 @@ export interface IKernelSpecs {
102
111
  */
103
112
  register: (options: KernelSpecs.IKernelOptions) => void;
104
113
  }
114
+ /**
115
+ * An interface for a comlink-based worker kernel
116
+ */
117
+ export interface IWorkerKernel {
118
+ /**
119
+ * Handle any lazy setup activities.
120
+ */
121
+ initialize(options: IWorkerKernel.IOptions): Promise<void>;
122
+ execute(content: KernelMessage.IExecuteRequestMsg['content'], parent: any): Promise<KernelMessage.IExecuteReplyMsg['content']>;
123
+ complete(content: KernelMessage.ICompleteRequestMsg['content'], parent: any): Promise<KernelMessage.ICompleteReplyMsg['content']>;
124
+ inspect(content: KernelMessage.IInspectRequestMsg['content'], parent: any): Promise<KernelMessage.IInspectReplyMsg['content']>;
125
+ isComplete(content: KernelMessage.IIsCompleteRequestMsg['content'], parent: any): Promise<KernelMessage.IIsCompleteReplyMsg['content']>;
126
+ commInfo(content: KernelMessage.ICommInfoRequestMsg['content'], parent: any): Promise<KernelMessage.ICommInfoReplyMsg['content']>;
127
+ commOpen(content: KernelMessage.ICommOpenMsg, parent: any): Promise<void>;
128
+ commMsg(content: KernelMessage.ICommMsgMsg, parent: any): Promise<void>;
129
+ commClose(content: KernelMessage.ICommCloseMsg, parent: any): Promise<void>;
130
+ inputReply(content: KernelMessage.IInputReplyMsg['content'], parent: any): Promise<void>;
131
+ }
132
+ /**
133
+ * A namespace for worker kernels.
134
+ **/
135
+ export declare namespace IWorkerKernel {
136
+ /**
137
+ * Common values likely to be required by all kernels.
138
+ */
139
+ interface IOptions {
140
+ baseUrl: string;
141
+ }
142
+ }
143
+ export interface IRemoteKernel extends Remote<IWorkerKernel> {
144
+ }
package/lib/tokens.js CHANGED
@@ -1,3 +1,5 @@
1
+ // Copyright (c) Jupyter Development Team.
2
+ // Distributed under the terms of the Modified BSD License.
1
3
  import { Token } from '@lumino/coreutils';
2
4
  /**
3
5
  * The token for the kernels service.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlite/kernel",
3
- "version": "0.1.0-beta.1",
3
+ "version": "0.1.0-beta.10",
4
4
  "description": "JupyterLite - Kernel",
5
5
  "homepage": "https://github.com/jupyterlite/jupyterlite",
6
6
  "bugs": {
@@ -42,18 +42,19 @@
42
42
  "watch": "tsc -b --watch"
43
43
  },
44
44
  "dependencies": {
45
- "@jupyterlab/observables": "~4.3.0",
46
- "@jupyterlab/services": "~6.3.0",
45
+ "@jupyterlab/observables": "~4.4.3",
46
+ "@jupyterlab/services": "~6.4.3",
47
47
  "@lumino/coreutils": "^1.12.0",
48
48
  "@lumino/disposable": "^1.10.1",
49
49
  "@lumino/signaling": "^1.10.1",
50
50
  "async-mutex": "^0.3.1",
51
+ "comlink": "^4.3.1",
51
52
  "mock-socket": "^9.1.0"
52
53
  },
53
54
  "devDependencies": {
54
55
  "@babel/core": "^7.11.6",
55
56
  "@babel/preset-env": "^7.12.1",
56
- "@jupyterlab/testutils": "~3.3.0",
57
+ "@jupyterlab/testutils": "~3.4.3",
57
58
  "@types/jest": "^26.0.10",
58
59
  "jest": "^26.4.2",
59
60
  "rimraf": "~3.0.0",