@difizen/libro-kernel 0.0.2-alpha.0
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/LICENSE +21 -0
- package/README.md +1 -0
- package/es/basemanager.d.ts +94 -0
- package/es/basemanager.d.ts.map +1 -0
- package/es/basemanager.js +110 -0
- package/es/contents/contents-drive.d.ts +189 -0
- package/es/contents/contents-drive.d.ts.map +1 -0
- package/es/contents/contents-drive.js +792 -0
- package/es/contents/contents-manager.d.ts +229 -0
- package/es/contents/contents-manager.d.ts.map +1 -0
- package/es/contents/contents-manager.js +551 -0
- package/es/contents/contents-module.d.ts +3 -0
- package/es/contents/contents-module.d.ts.map +1 -0
- package/es/contents/contents-module.js +4 -0
- package/es/contents/contents-protocol.d.ts +487 -0
- package/es/contents/contents-protocol.d.ts.map +1 -0
- package/es/contents/contents-protocol.js +1 -0
- package/es/contents/index.d.ts +6 -0
- package/es/contents/index.d.ts.map +1 -0
- package/es/contents/index.js +5 -0
- package/es/contents/validate.d.ts +10 -0
- package/es/contents/validate.d.ts.map +1 -0
- package/es/contents/validate.js +22 -0
- package/es/index.d.ts +10 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +9 -0
- package/es/index.less +0 -0
- package/es/kernel/comm.d.ts +92 -0
- package/es/kernel/comm.d.ts.map +1 -0
- package/es/kernel/comm.js +216 -0
- package/es/kernel/future.d.ts +178 -0
- package/es/kernel/future.d.ts.map +1 -0
- package/es/kernel/future.js +587 -0
- package/es/kernel/index.d.ts +8 -0
- package/es/kernel/index.d.ts.map +1 -0
- package/es/kernel/index.js +8 -0
- package/es/kernel/kernel-connection.d.ts +550 -0
- package/es/kernel/kernel-connection.d.ts.map +1 -0
- package/es/kernel/kernel-connection.js +1957 -0
- package/es/kernel/kernel-module.d.ts +3 -0
- package/es/kernel/kernel-module.d.ts.map +1 -0
- package/es/kernel/kernel-module.js +32 -0
- package/es/kernel/libro-kernel-manager.d.ts +69 -0
- package/es/kernel/libro-kernel-manager.d.ts.map +1 -0
- package/es/kernel/libro-kernel-manager.js +349 -0
- package/es/kernel/libro-kernel-protocol.d.ts +675 -0
- package/es/kernel/libro-kernel-protocol.d.ts.map +1 -0
- package/es/kernel/libro-kernel-protocol.js +60 -0
- package/es/kernel/libro-kernel-utils.d.ts +95 -0
- package/es/kernel/libro-kernel-utils.d.ts.map +1 -0
- package/es/kernel/libro-kernel-utils.js +130 -0
- package/es/kernel/libro-kernel.d.ts +14 -0
- package/es/kernel/libro-kernel.d.ts.map +1 -0
- package/es/kernel/libro-kernel.js +54 -0
- package/es/kernel/messages.d.ts +845 -0
- package/es/kernel/messages.d.ts.map +1 -0
- package/es/kernel/messages.js +457 -0
- package/es/kernel/restapi.d.ts +78 -0
- package/es/kernel/restapi.d.ts.map +1 -0
- package/es/kernel/restapi.js +367 -0
- package/es/kernel/serialize.d.ts +10 -0
- package/es/kernel/serialize.d.ts.map +1 -0
- package/es/kernel/serialize.js +214 -0
- package/es/kernel/validate.d.ts +15 -0
- package/es/kernel/validate.d.ts.map +1 -0
- package/es/kernel/validate.js +125 -0
- package/es/kernelspec/index.d.ts +5 -0
- package/es/kernelspec/index.d.ts.map +1 -0
- package/es/kernelspec/index.js +4 -0
- package/es/kernelspec/kernelspec-module.d.ts +3 -0
- package/es/kernelspec/kernelspec-module.d.ts.map +1 -0
- package/es/kernelspec/kernelspec-module.js +4 -0
- package/es/kernelspec/kernelspec.d.ts +33 -0
- package/es/kernelspec/kernelspec.d.ts.map +1 -0
- package/es/kernelspec/kernelspec.js +1 -0
- package/es/kernelspec/manager.d.ts +81 -0
- package/es/kernelspec/manager.d.ts.map +1 -0
- package/es/kernelspec/manager.js +248 -0
- package/es/kernelspec/restapi.d.ts +71 -0
- package/es/kernelspec/restapi.d.ts.map +1 -0
- package/es/kernelspec/restapi.js +107 -0
- package/es/kernelspec/validate.d.ts +10 -0
- package/es/kernelspec/validate.d.ts.map +1 -0
- package/es/kernelspec/validate.js +69 -0
- package/es/libro-kernel-connection-manager.d.ts +19 -0
- package/es/libro-kernel-connection-manager.d.ts.map +1 -0
- package/es/libro-kernel-connection-manager.js +142 -0
- package/es/module.d.ts +3 -0
- package/es/module.d.ts.map +1 -0
- package/es/module.js +9 -0
- package/es/page-config.d.ts +36 -0
- package/es/page-config.d.ts.map +1 -0
- package/es/page-config.js +129 -0
- package/es/protocol.d.ts +13 -0
- package/es/protocol.d.ts.map +1 -0
- package/es/protocol.js +8 -0
- package/es/server/connection-error.d.ts +36 -0
- package/es/server/connection-error.d.ts.map +1 -0
- package/es/server/connection-error.js +109 -0
- package/es/server/index.d.ts +6 -0
- package/es/server/index.d.ts.map +1 -0
- package/es/server/index.js +5 -0
- package/es/server/server-connection-protocol.d.ts +49 -0
- package/es/server/server-connection-protocol.d.ts.map +1 -0
- package/es/server/server-connection-protocol.js +0 -0
- package/es/server/server-connection.d.ts +25 -0
- package/es/server/server-connection.d.ts.map +1 -0
- package/es/server/server-connection.js +159 -0
- package/es/server/server-manager.d.ts +22 -0
- package/es/server/server-manager.d.ts.map +1 -0
- package/es/server/server-manager.js +163 -0
- package/es/server/server-module.d.ts +3 -0
- package/es/server/server-module.d.ts.map +1 -0
- package/es/server/server-module.js +4 -0
- package/es/session/index.d.ts +5 -0
- package/es/session/index.d.ts.map +1 -0
- package/es/session/index.js +4 -0
- package/es/session/libro-session-manager.d.ts +71 -0
- package/es/session/libro-session-manager.d.ts.map +1 -0
- package/es/session/libro-session-manager.js +539 -0
- package/es/session/libro-session-protocol.d.ts +50 -0
- package/es/session/libro-session-protocol.d.ts.map +1 -0
- package/es/session/libro-session-protocol.js +21 -0
- package/es/session/libro-session.d.ts +12 -0
- package/es/session/libro-session.d.ts.map +1 -0
- package/es/session/libro-session.js +19 -0
- package/es/session/restapi.d.ts +28 -0
- package/es/session/restapi.d.ts.map +1 -0
- package/es/session/restapi.js +214 -0
- package/es/session/session-module.d.ts +3 -0
- package/es/session/session-module.d.ts.map +1 -0
- package/es/session/session-module.js +18 -0
- package/es/session/validate.d.ts +14 -0
- package/es/session/validate.d.ts.map +1 -0
- package/es/session/validate.js +37 -0
- package/es/utils.d.ts +4 -0
- package/es/utils.d.ts.map +1 -0
- package/es/utils.js +29 -0
- package/es/validate-property.d.ts +2 -0
- package/es/validate-property.d.ts.map +1 -0
- package/es/validate-property.js +35 -0
- package/package.json +62 -0
- package/src/basemanager.ts +133 -0
- package/src/contents/contents-drive.ts +495 -0
- package/src/contents/contents-manager.ts +465 -0
- package/src/contents/contents-module.ts +6 -0
- package/src/contents/contents-protocol.ts +604 -0
- package/src/contents/index.ts +5 -0
- package/src/contents/validate.ts +29 -0
- package/src/index.tsx +9 -0
- package/src/kernel/comm.ts +220 -0
- package/src/kernel/future.ts +474 -0
- package/src/kernel/index.ts +7 -0
- package/src/kernel/kernel-connection.ts +1770 -0
- package/src/kernel/kernel-module.ts +50 -0
- package/src/kernel/libro-kernel-manager.ts +199 -0
- package/src/kernel/libro-kernel-protocol.ts +858 -0
- package/src/kernel/libro-kernel-utils.ts +152 -0
- package/src/kernel/libro-kernel.ts +39 -0
- package/src/kernel/messages.ts +1104 -0
- package/src/kernel/restapi.ts +183 -0
- package/src/kernel/serialize.ts +262 -0
- package/src/kernel/validate.ts +101 -0
- package/src/kernelspec/index.ts +5 -0
- package/src/kernelspec/kernelspec-module.ts +9 -0
- package/src/kernelspec/kernelspec.ts +37 -0
- package/src/kernelspec/manager.ts +173 -0
- package/src/kernelspec/restapi.ts +104 -0
- package/src/kernelspec/validate.ts +80 -0
- package/src/libro-kernel-connection-manager.ts +73 -0
- package/src/module.ts +19 -0
- package/src/page-config.ts +106 -0
- package/src/protocol.ts +24 -0
- package/src/server/connection-error.ts +60 -0
- package/src/server/index.ts +5 -0
- package/src/server/server-connection-protocol.ts +57 -0
- package/src/server/server-connection.ts +144 -0
- package/src/server/server-manager.ts +76 -0
- package/src/server/server-module.ts +9 -0
- package/src/session/index.ts +4 -0
- package/src/session/libro-session-manager.ts +377 -0
- package/src/session/libro-session-protocol.ts +61 -0
- package/src/session/libro-session.ts +33 -0
- package/src/session/restapi.ts +126 -0
- package/src/session/session-module.ts +26 -0
- package/src/session/validate.ts +39 -0
- package/src/utils.ts +28 -0
- package/src/validate-property.ts +38 -0
|
@@ -0,0 +1,1104 @@
|
|
|
1
|
+
import type * as nbformat from '@difizen/libro-common';
|
|
2
|
+
import type { ILanguageInfoMetadata, JSONObject } from '@difizen/libro-common';
|
|
3
|
+
import { v4 } from 'uuid';
|
|
4
|
+
|
|
5
|
+
export interface IMessageOptions<T extends Message> {
|
|
6
|
+
session: string;
|
|
7
|
+
channel: T['channel'];
|
|
8
|
+
msgType: T['header']['msg_type'];
|
|
9
|
+
content: T['content'];
|
|
10
|
+
buffers?: (ArrayBuffer | ArrayBufferView)[];
|
|
11
|
+
metadata?: JSONObject;
|
|
12
|
+
msgId?: string;
|
|
13
|
+
username?: string;
|
|
14
|
+
parentHeader?: T['parent_header'];
|
|
15
|
+
}
|
|
16
|
+
export function createMessage<T extends IClearOutputMsg>(
|
|
17
|
+
options: IMessageOptions<T>,
|
|
18
|
+
): T;
|
|
19
|
+
export function createMessage<T extends ICommCloseMsg<'iopub'>>(
|
|
20
|
+
options: IMessageOptions<T>,
|
|
21
|
+
): T;
|
|
22
|
+
export function createMessage<T extends ICommCloseMsg<'shell'>>(
|
|
23
|
+
options: IMessageOptions<T>,
|
|
24
|
+
): T;
|
|
25
|
+
export function createMessage<T extends ICommInfoReplyMsg>(
|
|
26
|
+
options: IMessageOptions<T>,
|
|
27
|
+
): T;
|
|
28
|
+
export function createMessage<T extends ICommInfoRequestMsg>(
|
|
29
|
+
options: IMessageOptions<T>,
|
|
30
|
+
): T;
|
|
31
|
+
export function createMessage<T extends ICommMsgMsg<'iopub'>>(
|
|
32
|
+
options: IMessageOptions<T>,
|
|
33
|
+
): T;
|
|
34
|
+
export function createMessage<T extends ICommMsgMsg<'shell'>>(
|
|
35
|
+
options: IMessageOptions<T>,
|
|
36
|
+
): T;
|
|
37
|
+
export function createMessage<T extends ICommOpenMsg<'iopub'>>(
|
|
38
|
+
options: IMessageOptions<T>,
|
|
39
|
+
): T;
|
|
40
|
+
export function createMessage<T extends ICommOpenMsg<'shell'>>(
|
|
41
|
+
options: IMessageOptions<T>,
|
|
42
|
+
): T;
|
|
43
|
+
export function createMessage<T extends ICompleteReplyMsg>(
|
|
44
|
+
options: IMessageOptions<T>,
|
|
45
|
+
): T;
|
|
46
|
+
export function createMessage<T extends ICompleteRequestMsg>(
|
|
47
|
+
options: IMessageOptions<T>,
|
|
48
|
+
): T;
|
|
49
|
+
export function createMessage<T extends IDisplayDataMsg>(
|
|
50
|
+
options: IMessageOptions<T>,
|
|
51
|
+
): T;
|
|
52
|
+
export function createMessage<T extends IErrorMsg>(options: IMessageOptions<T>): T;
|
|
53
|
+
export function createMessage<T extends IExecuteInputMsg>(
|
|
54
|
+
options: IMessageOptions<T>,
|
|
55
|
+
): T;
|
|
56
|
+
export function createMessage<T extends IExecuteReplyMsg>(
|
|
57
|
+
options: IMessageOptions<T>,
|
|
58
|
+
): T;
|
|
59
|
+
export function createMessage<T extends IExecuteRequestMsg>(
|
|
60
|
+
options: IMessageOptions<T>,
|
|
61
|
+
): T;
|
|
62
|
+
export function createMessage<T extends IExecuteResultMsg>(
|
|
63
|
+
options: IMessageOptions<T>,
|
|
64
|
+
): T;
|
|
65
|
+
export function createMessage<T extends IHistoryReplyMsg>(
|
|
66
|
+
options: IMessageOptions<T>,
|
|
67
|
+
): T;
|
|
68
|
+
export function createMessage<T extends IHistoryRequestMsg>(
|
|
69
|
+
options: IMessageOptions<T>,
|
|
70
|
+
): T;
|
|
71
|
+
export function createMessage<T extends IInfoReplyMsg>(options: IMessageOptions<T>): T;
|
|
72
|
+
export function createMessage<T extends IInfoRequestMsg>(
|
|
73
|
+
options: IMessageOptions<T>,
|
|
74
|
+
): T;
|
|
75
|
+
export function createMessage<T extends IInputReplyMsg>(options: IMessageOptions<T>): T;
|
|
76
|
+
export function createMessage<T extends IInputRequestMsg>(
|
|
77
|
+
options: IMessageOptions<T>,
|
|
78
|
+
): T;
|
|
79
|
+
export function createMessage<T extends IInspectReplyMsg>(
|
|
80
|
+
options: IMessageOptions<T>,
|
|
81
|
+
): T;
|
|
82
|
+
export function createMessage<T extends IInspectRequestMsg>(
|
|
83
|
+
options: IMessageOptions<T>,
|
|
84
|
+
): T;
|
|
85
|
+
export function createMessage<T extends IIsCompleteReplyMsg>(
|
|
86
|
+
options: IMessageOptions<T>,
|
|
87
|
+
): T;
|
|
88
|
+
export function createMessage<T extends IIsCompleteRequestMsg>(
|
|
89
|
+
options: IMessageOptions<T>,
|
|
90
|
+
): T;
|
|
91
|
+
export function createMessage<T extends IStatusMsg>(options: IMessageOptions<T>): T;
|
|
92
|
+
export function createMessage<T extends IStreamMsg>(options: IMessageOptions<T>): T;
|
|
93
|
+
export function createMessage<T extends IUpdateDisplayDataMsg>(
|
|
94
|
+
options: IMessageOptions<T>,
|
|
95
|
+
): T;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @hidden
|
|
99
|
+
* #### Notes
|
|
100
|
+
* Debug messages are experimental messages that are not in the official
|
|
101
|
+
* kernel message specification. As such, this function is *NOT* considered
|
|
102
|
+
* part of the public API, and may change without notice.
|
|
103
|
+
*/
|
|
104
|
+
export function createMessage<T extends IDebugRequestMsg>(
|
|
105
|
+
options: IMessageOptions<T>,
|
|
106
|
+
): T;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @hidden
|
|
110
|
+
* #### Notes
|
|
111
|
+
* Debug messages are experimental messages that are not in the official
|
|
112
|
+
* kernel message specification. As such, this function is *NOT* considered
|
|
113
|
+
* part of the public API, and may change without notice.
|
|
114
|
+
*/
|
|
115
|
+
export function createMessage<T extends IDebugReplyMsg>(options: IMessageOptions<T>): T;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @hidden
|
|
119
|
+
* #### Notes
|
|
120
|
+
* Debug messages are experimental messages that are not in the official
|
|
121
|
+
* kernel message specification. As such, this function is *NOT* considered
|
|
122
|
+
* part of the public API, and may change without notice.
|
|
123
|
+
*/
|
|
124
|
+
export function createMessage<T extends IDebugEventMsg>(options: IMessageOptions<T>): T;
|
|
125
|
+
|
|
126
|
+
export function createMessage<T extends Message>(options: IMessageOptions<T>): T {
|
|
127
|
+
return {
|
|
128
|
+
buffers: options.buffers ?? [],
|
|
129
|
+
channel: options.channel,
|
|
130
|
+
content: options.content,
|
|
131
|
+
header: {
|
|
132
|
+
date: new Date().toISOString(),
|
|
133
|
+
msg_id: options.msgId ?? v4(),
|
|
134
|
+
msg_type: options.msgType,
|
|
135
|
+
session: options.session,
|
|
136
|
+
username: options.username ?? '',
|
|
137
|
+
version: '5.2',
|
|
138
|
+
},
|
|
139
|
+
metadata: options.metadata ?? {},
|
|
140
|
+
parent_header: options.parentHeader ?? {},
|
|
141
|
+
} as T;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Shell message types.
|
|
146
|
+
*/
|
|
147
|
+
export type ShellMessageType =
|
|
148
|
+
| 'comm_close'
|
|
149
|
+
| 'comm_info_reply'
|
|
150
|
+
| 'comm_info_request'
|
|
151
|
+
| 'comm_msg'
|
|
152
|
+
| 'comm_open'
|
|
153
|
+
| 'complete_reply'
|
|
154
|
+
| 'complete_request'
|
|
155
|
+
| 'execute_reply'
|
|
156
|
+
| 'execute_request'
|
|
157
|
+
| 'history_reply'
|
|
158
|
+
| 'history_request'
|
|
159
|
+
| 'inspect_reply'
|
|
160
|
+
| 'inspect_request'
|
|
161
|
+
| 'interrupt_reply'
|
|
162
|
+
| 'interrupt_request'
|
|
163
|
+
| 'is_complete_reply'
|
|
164
|
+
| 'is_complete_request'
|
|
165
|
+
| 'kernel_info_reply'
|
|
166
|
+
| 'kernel_info_request'
|
|
167
|
+
| 'shutdown_reply'
|
|
168
|
+
| 'shutdown_request';
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Control message types.
|
|
172
|
+
*
|
|
173
|
+
* #### Notes
|
|
174
|
+
* Debug messages are experimental messages that are not in the official
|
|
175
|
+
* kernel message specification. As such, debug message types are *NOT*
|
|
176
|
+
* considered part of the public API, and may change without notice.
|
|
177
|
+
*/
|
|
178
|
+
export type ControlMessageType = 'debug_request' | 'debug_reply';
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* IOPub message types.
|
|
182
|
+
*
|
|
183
|
+
* #### Notes
|
|
184
|
+
* Debug messages are experimental messages that are not in the official
|
|
185
|
+
* kernel message specification. As such, debug message types are *NOT*
|
|
186
|
+
* considered part of the public API, and may change without notice.
|
|
187
|
+
*/
|
|
188
|
+
export type IOPubMessageType =
|
|
189
|
+
| 'clear_output'
|
|
190
|
+
| 'comm_close'
|
|
191
|
+
| 'comm_msg'
|
|
192
|
+
| 'comm_open'
|
|
193
|
+
| 'display_data'
|
|
194
|
+
| 'error'
|
|
195
|
+
| 'execute_input'
|
|
196
|
+
| 'execute_result'
|
|
197
|
+
| 'shutdown_reply'
|
|
198
|
+
| 'status'
|
|
199
|
+
| 'stream'
|
|
200
|
+
| 'update_display_data'
|
|
201
|
+
| 'debug_event';
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Stdin message types.
|
|
205
|
+
*/
|
|
206
|
+
export type StdinMessageType = 'input_request' | 'input_reply';
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Jupyter message types.
|
|
210
|
+
*/
|
|
211
|
+
export type MessageType =
|
|
212
|
+
| IOPubMessageType
|
|
213
|
+
| ShellMessageType
|
|
214
|
+
| ControlMessageType
|
|
215
|
+
| StdinMessageType;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* The valid Jupyter channel names in a message to a frontend.
|
|
219
|
+
*/
|
|
220
|
+
export type Channel = 'shell' | 'control' | 'iopub' | 'stdin';
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Kernel message header content.
|
|
224
|
+
*
|
|
225
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#general-message-format).
|
|
226
|
+
*
|
|
227
|
+
* **See also:** [[IMessage]]
|
|
228
|
+
*/
|
|
229
|
+
export interface IHeader<T extends MessageType = MessageType> {
|
|
230
|
+
/**
|
|
231
|
+
* ISO 8601 timestamp for when the message is created
|
|
232
|
+
*/
|
|
233
|
+
date: string;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Message id, typically UUID, must be unique per message
|
|
237
|
+
*/
|
|
238
|
+
msg_id: string;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Message type
|
|
242
|
+
*/
|
|
243
|
+
msg_type: T;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Session id, typically UUID, should be unique per session.
|
|
247
|
+
*/
|
|
248
|
+
session: string;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* The user sending the message
|
|
252
|
+
*/
|
|
253
|
+
username: string;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* The message protocol version, should be 5.1, 5.2, 5.3, etc.
|
|
257
|
+
*/
|
|
258
|
+
version: string;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Kernel message specification.
|
|
263
|
+
*
|
|
264
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#general-message-format).
|
|
265
|
+
*/
|
|
266
|
+
export interface IMessage<MSGTYPE extends MessageType = MessageType> {
|
|
267
|
+
/**
|
|
268
|
+
* An optional list of binary buffers.
|
|
269
|
+
*/
|
|
270
|
+
buffers?: (ArrayBuffer | ArrayBufferView)[];
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* The channel on which the message is transmitted.
|
|
274
|
+
*/
|
|
275
|
+
channel: Channel;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* The content of the message.
|
|
279
|
+
*/
|
|
280
|
+
content: Message['content'];
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* The message header.
|
|
284
|
+
*/
|
|
285
|
+
header: IHeader<MSGTYPE>;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Metadata associated with the message.
|
|
289
|
+
*/
|
|
290
|
+
metadata: JSONObject;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* The parent message
|
|
294
|
+
*/
|
|
295
|
+
parent_header: IHeader | Record<string, never>;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* A kernel message on the `'shell'` channel.
|
|
300
|
+
*/
|
|
301
|
+
export interface IShellMessage<T extends ShellMessageType = ShellMessageType>
|
|
302
|
+
extends IMessage<T> {
|
|
303
|
+
channel: 'shell';
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* A kernel message on the `'control'` channel.
|
|
308
|
+
*/
|
|
309
|
+
export interface IControlMessage<T extends ControlMessageType = ControlMessageType>
|
|
310
|
+
extends IMessage<T> {
|
|
311
|
+
channel: 'control';
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* A message type for shell or control messages.
|
|
316
|
+
*
|
|
317
|
+
* #### Notes
|
|
318
|
+
* This convenience is so we can use it as a generic type constraint.
|
|
319
|
+
*/
|
|
320
|
+
export type IShellControlMessage = IShellMessage | IControlMessage;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* A kernel message on the `'iopub'` channel.
|
|
324
|
+
*/
|
|
325
|
+
export interface IIOPubMessage<T extends IOPubMessageType = IOPubMessageType>
|
|
326
|
+
extends IMessage<T> {
|
|
327
|
+
channel: 'iopub';
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* A kernel message on the `'stdin'` channel.
|
|
332
|
+
*/
|
|
333
|
+
export interface IStdinMessage<T extends StdinMessageType = StdinMessageType>
|
|
334
|
+
extends IMessage<T> {
|
|
335
|
+
channel: 'stdin';
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Message types.
|
|
340
|
+
*
|
|
341
|
+
* #### Notes
|
|
342
|
+
* Debug messages are experimental messages that are not in the official
|
|
343
|
+
* kernel message specification. As such, debug message types are *NOT*
|
|
344
|
+
* considered part of the public API, and may change without notice.
|
|
345
|
+
*/
|
|
346
|
+
export type Message =
|
|
347
|
+
| IClearOutputMsg
|
|
348
|
+
| ICommCloseMsg<'iopub'>
|
|
349
|
+
| ICommCloseMsg<'shell'>
|
|
350
|
+
| ICommInfoReplyMsg
|
|
351
|
+
| ICommInfoRequestMsg
|
|
352
|
+
| ICommMsgMsg<'iopub'>
|
|
353
|
+
| ICommMsgMsg<'shell'>
|
|
354
|
+
| ICommOpenMsg<'iopub'>
|
|
355
|
+
| ICommOpenMsg<'shell'>
|
|
356
|
+
| ICompleteReplyMsg
|
|
357
|
+
| ICompleteRequestMsg
|
|
358
|
+
| IDisplayDataMsg
|
|
359
|
+
| IErrorMsg
|
|
360
|
+
| IExecuteInputMsg
|
|
361
|
+
| IExecuteReplyMsg
|
|
362
|
+
| IExecuteRequestMsg
|
|
363
|
+
| IExecuteResultMsg
|
|
364
|
+
| IHistoryReplyMsg
|
|
365
|
+
| IHistoryRequestMsg
|
|
366
|
+
| IInfoReplyMsg
|
|
367
|
+
| IInfoRequestMsg
|
|
368
|
+
| IInputReplyMsg
|
|
369
|
+
| IInputRequestMsg
|
|
370
|
+
| IInspectReplyMsg
|
|
371
|
+
| IInspectRequestMsg
|
|
372
|
+
| IIsCompleteReplyMsg
|
|
373
|
+
| IIsCompleteRequestMsg
|
|
374
|
+
| IStatusMsg
|
|
375
|
+
| IStreamMsg
|
|
376
|
+
| IUpdateDisplayDataMsg
|
|
377
|
+
| IDebugRequestMsg
|
|
378
|
+
| IDebugReplyMsg
|
|
379
|
+
| IDebugEventMsg;
|
|
380
|
+
|
|
381
|
+
// ////////////////////////////////////////////////
|
|
382
|
+
// IOPub Messages
|
|
383
|
+
// ///////////////////////////////////////////////
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* A `'stream'` message on the `'iopub'` channel.
|
|
387
|
+
*
|
|
388
|
+
* See [Streams](https://jupyter-client.readthedocs.io/en/latest/messaging.html#streams-stdout-stderr-etc).
|
|
389
|
+
*/
|
|
390
|
+
export interface IStreamMsg extends IIOPubMessage<'stream'> {
|
|
391
|
+
content: {
|
|
392
|
+
name: 'stdout' | 'stderr';
|
|
393
|
+
text: string;
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* A `'display_data'` message on the `'iopub'` channel.
|
|
399
|
+
*
|
|
400
|
+
* See [Display data](https://jupyter-client.readthedocs.io/en/latest/messaging.html#display-data).
|
|
401
|
+
*/
|
|
402
|
+
export interface IDisplayDataMsg extends IIOPubMessage<'display_data'> {
|
|
403
|
+
content: {
|
|
404
|
+
data: nbformat.IMimeBundle;
|
|
405
|
+
metadata: nbformat.OutputMetadata;
|
|
406
|
+
transient?: { display_id?: string };
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* An `'update_display_data'` message on the `'iopub'` channel.
|
|
412
|
+
*
|
|
413
|
+
* See [Update Display data](https://jupyter-client.readthedocs.io/en/latest/messaging.html#update-display-data).
|
|
414
|
+
*/
|
|
415
|
+
export interface IUpdateDisplayDataMsg extends IIOPubMessage<'update_display_data'> {
|
|
416
|
+
content: IDisplayDataMsg['content'] & {
|
|
417
|
+
// display_id is a required field in update_display_data
|
|
418
|
+
transient: { display_id: string };
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* An `'execute_input'` message on the `'iopub'` channel.
|
|
424
|
+
*
|
|
425
|
+
* See [Code inputs](https://jupyter-client.readthedocs.io/en/latest/messaging.html#code-inputs).
|
|
426
|
+
*/
|
|
427
|
+
export interface IExecuteInputMsg extends IIOPubMessage<'execute_input'> {
|
|
428
|
+
content: {
|
|
429
|
+
code: string;
|
|
430
|
+
execution_count: nbformat.ExecutionCount;
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* An `'execute_result'` message on the `'iopub'` channel.
|
|
436
|
+
*
|
|
437
|
+
* See [Execution results](https://jupyter-client.readthedocs.io/en/latest/messaging.html#id4).
|
|
438
|
+
*/
|
|
439
|
+
export interface IExecuteResultMsg extends IIOPubMessage<'execute_result'> {
|
|
440
|
+
content: {
|
|
441
|
+
execution_count: nbformat.ExecutionCount;
|
|
442
|
+
data: nbformat.IMimeBundle;
|
|
443
|
+
metadata: nbformat.OutputMetadata;
|
|
444
|
+
transient?: { display_id?: string };
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* A `'error'` message on the `'iopub'` channel.
|
|
450
|
+
*
|
|
451
|
+
* See [Execution errors](https://jupyter-client.readthedocs.io/en/latest/messaging.html#execution-errors).
|
|
452
|
+
*/
|
|
453
|
+
export interface IErrorMsg extends IIOPubMessage<'error'> {
|
|
454
|
+
content: {
|
|
455
|
+
ename: string;
|
|
456
|
+
evalue: string;
|
|
457
|
+
traceback: string[];
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* The valid Kernel status states.
|
|
463
|
+
*
|
|
464
|
+
* #### Notes
|
|
465
|
+
* The status states are:
|
|
466
|
+
* * `unknown`: The kernel status is unknown, often because the connection
|
|
467
|
+
* is disconnected or connecting. This state is determined by the kernel
|
|
468
|
+
* connection status.
|
|
469
|
+
* * `autorestarting`: The kernel is restarting, initiated by the server.
|
|
470
|
+
* This state is set by the services library, not explicitly sent from the
|
|
471
|
+
* kernel.
|
|
472
|
+
* * `starting`: The kernel is starting
|
|
473
|
+
* * `idle`: The kernel has finished processing messages.
|
|
474
|
+
* * `busy`: The kernel is currently processing messages.
|
|
475
|
+
* * `restarting`: The kernel is restarting. This state is sent by the
|
|
476
|
+
* Jupyter server.
|
|
477
|
+
* * `dead`: The kernel is dead and will not be restarted. This state is set
|
|
478
|
+
* by the Jupyter server and is a final state.
|
|
479
|
+
*/
|
|
480
|
+
export type Status =
|
|
481
|
+
| 'unknown'
|
|
482
|
+
| 'starting'
|
|
483
|
+
| 'idle'
|
|
484
|
+
| 'busy'
|
|
485
|
+
| 'terminating'
|
|
486
|
+
| 'restarting'
|
|
487
|
+
| 'autorestarting'
|
|
488
|
+
| 'dead';
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* A `'status'` message on the `'iopub'` channel.
|
|
492
|
+
*
|
|
493
|
+
* See [Kernel status](https://jupyter-client.readthedocs.io/en/latest/messaging.html#kernel-status).
|
|
494
|
+
*/
|
|
495
|
+
export interface IStatusMsg extends IIOPubMessage<'status'> {
|
|
496
|
+
content: {
|
|
497
|
+
execution_state: Status;
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* A `'clear_output'` message on the `'iopub'` channel.
|
|
503
|
+
*
|
|
504
|
+
* See [Clear output](https://jupyter-client.readthedocs.io/en/latest/messaging.html#clear-output).
|
|
505
|
+
*/
|
|
506
|
+
export interface IClearOutputMsg extends IIOPubMessage<'clear_output'> {
|
|
507
|
+
content: {
|
|
508
|
+
wait: boolean;
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* An experimental `'debug_event'` message on the `'iopub'` channel
|
|
514
|
+
*
|
|
515
|
+
* @hidden
|
|
516
|
+
*
|
|
517
|
+
* #### Notes
|
|
518
|
+
* Debug messages are experimental messages that are not in the official
|
|
519
|
+
* kernel message specification. As such, this is *NOT* considered
|
|
520
|
+
* part of the public API, and may change without notice.
|
|
521
|
+
*/
|
|
522
|
+
export interface IDebugEventMsg extends IIOPubMessage<'debug_event'> {
|
|
523
|
+
content: {
|
|
524
|
+
seq: number;
|
|
525
|
+
type: 'event';
|
|
526
|
+
event: string;
|
|
527
|
+
body?: any;
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// ////////////////////////////////////////////////
|
|
532
|
+
// Comm Messages
|
|
533
|
+
// ///////////////////////////////////////////////
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* A `'comm_open'` message on the `'iopub'` channel.
|
|
537
|
+
*
|
|
538
|
+
* See [Comm open](https://jupyter-client.readthedocs.io/en/latest/messaging.html#opening-a-comm).
|
|
539
|
+
*/
|
|
540
|
+
export interface ICommOpenMsg<T extends 'shell' | 'iopub' = 'iopub' | 'shell'>
|
|
541
|
+
extends IMessage<'comm_open'> {
|
|
542
|
+
channel: T;
|
|
543
|
+
content: {
|
|
544
|
+
comm_id: string;
|
|
545
|
+
target_name: string;
|
|
546
|
+
data: JSONObject;
|
|
547
|
+
target_module?: string;
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* A `'comm_close'` message on the `'iopub'` channel.
|
|
553
|
+
*
|
|
554
|
+
* See [Comm close](https://jupyter-client.readthedocs.io/en/latest/messaging.html#opening-a-comm).
|
|
555
|
+
*/
|
|
556
|
+
export interface ICommCloseMsg<T extends 'iopub' | 'shell' = 'iopub' | 'shell'>
|
|
557
|
+
extends IMessage<'comm_close'> {
|
|
558
|
+
channel: T;
|
|
559
|
+
content: {
|
|
560
|
+
comm_id: string;
|
|
561
|
+
data: JSONObject;
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* A `'comm_msg'` message on the `'iopub'` channel.
|
|
567
|
+
*
|
|
568
|
+
* See [Comm msg](https://jupyter-client.readthedocs.io/en/latest/messaging.html#opening-a-comm).
|
|
569
|
+
*/
|
|
570
|
+
export interface ICommMsgMsg<T extends 'iopub' | 'shell' = 'iopub' | 'shell'>
|
|
571
|
+
extends IMessage<'comm_msg'> {
|
|
572
|
+
channel: T;
|
|
573
|
+
content: {
|
|
574
|
+
comm_id: string;
|
|
575
|
+
data: JSONObject;
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// ////////////////////////////////////////////////
|
|
580
|
+
// Shell Messages
|
|
581
|
+
// ///////////////////////////////////////////////
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Reply content indicating a successful request.
|
|
585
|
+
*/
|
|
586
|
+
export interface IReplyOkContent {
|
|
587
|
+
status: 'ok';
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Reply content indicating an error.
|
|
592
|
+
*
|
|
593
|
+
* See the [Message spec](https://jupyter-client.readthedocs.io/en/latest/messaging.html#request-reply) for details.
|
|
594
|
+
*/
|
|
595
|
+
export interface IReplyErrorContent {
|
|
596
|
+
status: 'error';
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Exception name
|
|
600
|
+
*/
|
|
601
|
+
ename: string;
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Exception value
|
|
605
|
+
*/
|
|
606
|
+
evalue: string;
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Traceback
|
|
610
|
+
*/
|
|
611
|
+
traceback: string[];
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Reply content indicating an aborted request.
|
|
616
|
+
*
|
|
617
|
+
* This is [deprecated](https://jupyter-client.readthedocs.io/en/latest/messaging.html#request-reply)
|
|
618
|
+
* in message spec 5.1. Kernels should send an 'error' reply instead.
|
|
619
|
+
*/
|
|
620
|
+
export interface IReplyAbortContent {
|
|
621
|
+
status: 'abort';
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* A convenience type for reply content.
|
|
626
|
+
*
|
|
627
|
+
* This automatically unions the necessary error and abort replies required in
|
|
628
|
+
* the [message spec](https://jupyter-client.readthedocs.io/en/latest/messaging.html#request-reply).
|
|
629
|
+
*/
|
|
630
|
+
type ReplyContent<T> = T | IReplyErrorContent | IReplyAbortContent;
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* A `'kernel_info_request'` message on the `'shell'` channel.
|
|
634
|
+
*
|
|
635
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#kernel-info).
|
|
636
|
+
*/
|
|
637
|
+
export interface IInfoRequestMsg extends IShellMessage<'kernel_info_request'> {
|
|
638
|
+
content: Record<string, never>;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* A `'kernel_info_reply'` message content.
|
|
643
|
+
*
|
|
644
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#kernel-info).
|
|
645
|
+
*/
|
|
646
|
+
export interface IInfoReply extends IReplyOkContent {
|
|
647
|
+
protocol_version: string;
|
|
648
|
+
implementation: string;
|
|
649
|
+
implementation_version: string;
|
|
650
|
+
language_info: ILanguageInfo;
|
|
651
|
+
banner: string;
|
|
652
|
+
help_links: { text: string; url: string }[];
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* The kernel language information specification.
|
|
657
|
+
*
|
|
658
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#kernel-info).
|
|
659
|
+
*/
|
|
660
|
+
export interface ILanguageInfo extends ILanguageInfoMetadata {
|
|
661
|
+
version: string;
|
|
662
|
+
nbconverter_exporter?: string;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* A `'kernel_info_reply'` message on the `'shell'` channel.
|
|
667
|
+
*
|
|
668
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#kernel-info).
|
|
669
|
+
*/
|
|
670
|
+
export interface IInfoReplyMsg extends IShellMessage<'kernel_info_reply'> {
|
|
671
|
+
parent_header: IHeader<'kernel_info_request'>;
|
|
672
|
+
content: ReplyContent<IInfoReply>;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* A `'complete_request'` message.
|
|
677
|
+
*
|
|
678
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#completion).
|
|
679
|
+
*
|
|
680
|
+
* **See also:** [[ICompleteReplyMsg]], [[IKernel.complete]]
|
|
681
|
+
*/
|
|
682
|
+
export interface ICompleteRequestMsg extends IShellMessage<'complete_request'> {
|
|
683
|
+
content: {
|
|
684
|
+
code: string;
|
|
685
|
+
cursor_pos: number;
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* A `'complete_reply'` message content.
|
|
691
|
+
*
|
|
692
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#completion).
|
|
693
|
+
*
|
|
694
|
+
* **See also:** [[ICompleteRequest]], [[IKernel.complete]]
|
|
695
|
+
*/
|
|
696
|
+
interface ICompleteReply extends IReplyOkContent {
|
|
697
|
+
matches: string[];
|
|
698
|
+
cursor_start: number;
|
|
699
|
+
cursor_end: number;
|
|
700
|
+
metadata: JSONObject;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* A `'complete_reply'` message on the `'shell'` channel.
|
|
705
|
+
*
|
|
706
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#completion).
|
|
707
|
+
*
|
|
708
|
+
* **See also:** [[ICompleteRequest]], [[IKernel.complete]]
|
|
709
|
+
*/
|
|
710
|
+
export interface ICompleteReplyMsg extends IShellMessage<'complete_reply'> {
|
|
711
|
+
parent_header: IHeader<'complete_request'>;
|
|
712
|
+
content: ReplyContent<ICompleteReply>;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* An `'inspect_request'` message.
|
|
717
|
+
*
|
|
718
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#introspection).
|
|
719
|
+
*
|
|
720
|
+
* **See also:** [[IInspectReplyMsg]], [[[IKernel.inspect]]]
|
|
721
|
+
*/
|
|
722
|
+
export interface IInspectRequestMsg extends IShellMessage<'inspect_request'> {
|
|
723
|
+
content: {
|
|
724
|
+
code: string;
|
|
725
|
+
cursor_pos: number;
|
|
726
|
+
detail_level: 0 | 1;
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
/**
|
|
731
|
+
* A `'inspect_reply'` message content.
|
|
732
|
+
*
|
|
733
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#introspection).
|
|
734
|
+
*
|
|
735
|
+
* **See also:** [[IInspectRequest]], [[IKernel.inspect]]
|
|
736
|
+
*/
|
|
737
|
+
|
|
738
|
+
export interface IInspectReply extends IReplyOkContent {
|
|
739
|
+
found: boolean;
|
|
740
|
+
data: JSONObject;
|
|
741
|
+
metadata: JSONObject;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* A `'inspect_reply'` message on the `'shell'` channel.
|
|
746
|
+
*
|
|
747
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#introspection).
|
|
748
|
+
*
|
|
749
|
+
* **See also:** [[IInspectRequest]], [[IKernel.inspect]]
|
|
750
|
+
*/
|
|
751
|
+
export interface IInspectReplyMsg extends IShellMessage<'inspect_reply'> {
|
|
752
|
+
parent_header: IHeader<'inspect_request'>;
|
|
753
|
+
content: ReplyContent<IInspectReply>;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* A `'history_request'` message.
|
|
758
|
+
*
|
|
759
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#history).
|
|
760
|
+
*
|
|
761
|
+
* **See also:** [[IHistoryReplyMsg]], [[[IKernel.history]]]
|
|
762
|
+
*/
|
|
763
|
+
export interface IHistoryRequestMsg extends IShellMessage<'history_request'> {
|
|
764
|
+
content: IHistoryRequestRange | IHistoryRequestSearch | IHistoryRequestTail;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* The content of a `'history_request'` range message.
|
|
769
|
+
*
|
|
770
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#history).
|
|
771
|
+
*
|
|
772
|
+
* **See also:** [[IHistoryReply]], [[[IKernel.history]]]
|
|
773
|
+
*/
|
|
774
|
+
export interface IHistoryRequestRange {
|
|
775
|
+
output: boolean;
|
|
776
|
+
raw: boolean;
|
|
777
|
+
hist_access_type: 'range';
|
|
778
|
+
session: number;
|
|
779
|
+
start: number;
|
|
780
|
+
stop: number;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* The content of a `'history_request'` search message.
|
|
785
|
+
*
|
|
786
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#history).
|
|
787
|
+
*
|
|
788
|
+
* **See also:** [[IHistoryReply]], [[[IKernel.history]]]
|
|
789
|
+
*/
|
|
790
|
+
export interface IHistoryRequestSearch {
|
|
791
|
+
output: boolean;
|
|
792
|
+
raw: boolean;
|
|
793
|
+
hist_access_type: 'search';
|
|
794
|
+
n: number;
|
|
795
|
+
pattern: string;
|
|
796
|
+
unique: boolean;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* The content of a `'history_request'` tail message.
|
|
801
|
+
*
|
|
802
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#history).
|
|
803
|
+
*
|
|
804
|
+
* **See also:** [[IHistoryReply]], [[[IKernel.history]]]
|
|
805
|
+
*/
|
|
806
|
+
export interface IHistoryRequestTail {
|
|
807
|
+
output: boolean;
|
|
808
|
+
raw: boolean;
|
|
809
|
+
hist_access_type: 'tail';
|
|
810
|
+
n: number;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* A `'history_reply'` message content.
|
|
815
|
+
*
|
|
816
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#history).
|
|
817
|
+
*
|
|
818
|
+
* **See also:** [[IHistoryRequest]], [[IKernel.history]]
|
|
819
|
+
*/
|
|
820
|
+
export interface IHistoryReply extends IReplyOkContent {
|
|
821
|
+
history: [number, number, string][] | [number, number, [string, string]][];
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* A `'history_reply'` message on the `'shell'` channel.
|
|
826
|
+
*
|
|
827
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#history).
|
|
828
|
+
*
|
|
829
|
+
* **See also:** [[IHistoryRequest]], [[IKernel.history]]
|
|
830
|
+
*/
|
|
831
|
+
export interface IHistoryReplyMsg extends IShellMessage<'history_reply'> {
|
|
832
|
+
parent_header: IHeader<'history_request'>;
|
|
833
|
+
content: ReplyContent<IHistoryReply>;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* An `'is_complete_request'` message.
|
|
838
|
+
*
|
|
839
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#code-completeness).
|
|
840
|
+
*
|
|
841
|
+
* **See also:** [[IIsCompleteReplyMsg]], [[IKernel.isComplete]]
|
|
842
|
+
*/
|
|
843
|
+
export interface IIsCompleteRequestMsg extends IShellMessage<'is_complete_request'> {
|
|
844
|
+
content: {
|
|
845
|
+
code: string;
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* An `'is_complete_reply'` message on the `'stream'` channel.
|
|
851
|
+
*
|
|
852
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#code-completeness).
|
|
853
|
+
*
|
|
854
|
+
* **See also:** [[IIsCompleteRequest]], [[IKernel.isComplete]]
|
|
855
|
+
*/
|
|
856
|
+
export interface IIsCompleteReplyMsg extends IShellMessage<'is_complete_reply'> {
|
|
857
|
+
parent_header: IHeader<'is_complete_request'>;
|
|
858
|
+
content: ReplyContent<IIsCompleteReplyIncomplete | IIsCompleteReplyOther>;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* An 'incomplete' completion reply
|
|
863
|
+
*/
|
|
864
|
+
export interface IIsCompleteReplyIncomplete {
|
|
865
|
+
status: 'incomplete';
|
|
866
|
+
indent: string;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* A completion reply for completion or invalid states.
|
|
871
|
+
*/
|
|
872
|
+
export interface IIsCompleteReplyOther {
|
|
873
|
+
status: 'complete' | 'invalid' | 'unknown';
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* An `execute_request` message on the `'shell'` channel.
|
|
878
|
+
*/
|
|
879
|
+
export interface IExecuteRequestMsg extends IShellMessage<'execute_request'> {
|
|
880
|
+
content: {
|
|
881
|
+
/**
|
|
882
|
+
* The code to execute.
|
|
883
|
+
*/
|
|
884
|
+
code: string;
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* Whether to execute the code as quietly as possible.
|
|
888
|
+
* The default is `false`.
|
|
889
|
+
*/
|
|
890
|
+
silent?: boolean;
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* Whether to store history of the execution.
|
|
894
|
+
* The default `true` if silent is False.
|
|
895
|
+
* It is forced to `false ` if silent is `true`.
|
|
896
|
+
*/
|
|
897
|
+
store_history?: boolean;
|
|
898
|
+
|
|
899
|
+
/**
|
|
900
|
+
* A mapping of names to expressions to be evaluated in the
|
|
901
|
+
* kernel's interactive namespace.
|
|
902
|
+
*/
|
|
903
|
+
user_expressions?: JSONObject;
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* Whether to allow stdin requests.
|
|
907
|
+
* The default is `true`.
|
|
908
|
+
*/
|
|
909
|
+
allow_stdin?: boolean;
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
* Whether to the abort execution queue on an error.
|
|
913
|
+
* The default is `false`.
|
|
914
|
+
*/
|
|
915
|
+
stop_on_error?: boolean;
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* The content of an `execute-reply` message.
|
|
921
|
+
*
|
|
922
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#execution-results).
|
|
923
|
+
*/
|
|
924
|
+
export interface IExecuteCount {
|
|
925
|
+
execution_count: nbformat.ExecutionCount;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
* A convenience type for a base for an execute reply content.
|
|
930
|
+
*/
|
|
931
|
+
type IExecuteReplyBase = IExecuteCount & IReplyOkContent;
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* The `'execute_reply'` contents for an `'ok'` status.
|
|
935
|
+
*
|
|
936
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#execution-results).
|
|
937
|
+
*/
|
|
938
|
+
export interface IExecuteReply extends IExecuteReplyBase {
|
|
939
|
+
/**
|
|
940
|
+
* A list of payload objects.
|
|
941
|
+
* Payloads are considered deprecated.
|
|
942
|
+
* The only requirement of each payload object is that it have a 'source'
|
|
943
|
+
* key, which is a string classifying the payload (e.g. 'page').
|
|
944
|
+
*/
|
|
945
|
+
payload?: JSONObject[];
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* Results for the user_expressions.
|
|
949
|
+
*/
|
|
950
|
+
user_expressions: JSONObject;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* An `'execute_reply'` message on the `'stream'` channel.
|
|
955
|
+
*
|
|
956
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#execution-results).
|
|
957
|
+
*
|
|
958
|
+
* **See also:** [[IExecuteRequest]], [[IKernel.execute]]
|
|
959
|
+
*/
|
|
960
|
+
export interface IExecuteReplyMsg extends IShellMessage<'execute_reply'> {
|
|
961
|
+
parent_header: IHeader<'execute_request'>;
|
|
962
|
+
content: ReplyContent<IExecuteReply> & IExecuteCount;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* A `'comm_info_request'` message on the `'shell'` channel.
|
|
967
|
+
*
|
|
968
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#comm-info).
|
|
969
|
+
*
|
|
970
|
+
* **See also:** [[ICommInfoReplyMsg]], [[IKernel.commInfo]]
|
|
971
|
+
*/
|
|
972
|
+
export interface ICommInfoRequestMsg extends IShellMessage<'comm_info_request'> {
|
|
973
|
+
content: {
|
|
974
|
+
/**
|
|
975
|
+
* The comm target name to filter returned comms
|
|
976
|
+
*/
|
|
977
|
+
target_name?: string;
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* A `'comm_info_reply'` message content.
|
|
983
|
+
*
|
|
984
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#comm-info).
|
|
985
|
+
*
|
|
986
|
+
* **See also:** [[ICommInfoRequest]], [[IKernel.commInfo]]
|
|
987
|
+
*/
|
|
988
|
+
export interface ICommInfoReply extends IReplyOkContent {
|
|
989
|
+
/**
|
|
990
|
+
* Mapping of comm ids to target names.
|
|
991
|
+
*/
|
|
992
|
+
comms: Record<string, { target_name: string }>;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
/**
|
|
996
|
+
* A `'comm_info_reply'` message on the `'shell'` channel.
|
|
997
|
+
*
|
|
998
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#comm-info).
|
|
999
|
+
*
|
|
1000
|
+
* **See also:** [[ICommInfoRequestMsg]], [[IKernel.commInfo]]
|
|
1001
|
+
*/
|
|
1002
|
+
export interface ICommInfoReplyMsg extends IShellMessage<'comm_info_reply'> {
|
|
1003
|
+
parent_header: IHeader<'comm_info_request'>;
|
|
1004
|
+
content: ReplyContent<ICommInfoReply>;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
// ///////////////////////////////////////////////
|
|
1008
|
+
// Control Messages
|
|
1009
|
+
// ///////////////////////////////////////////////
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* An experimental `'debug_request'` message on the `'control'` channel.
|
|
1013
|
+
*
|
|
1014
|
+
* @hidden
|
|
1015
|
+
*
|
|
1016
|
+
* #### Notes
|
|
1017
|
+
* Debug messages are experimental messages that are not in the official
|
|
1018
|
+
* kernel message specification. As such, this function is *NOT* considered
|
|
1019
|
+
* part of the public API, and may change without notice.
|
|
1020
|
+
*/
|
|
1021
|
+
export interface IDebugRequestMsg extends IControlMessage<'debug_request'> {
|
|
1022
|
+
content: {
|
|
1023
|
+
seq: number;
|
|
1024
|
+
type: 'request';
|
|
1025
|
+
command: string;
|
|
1026
|
+
arguments?: any;
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
/**
|
|
1031
|
+
* An experimental `'debug_reply'` message on the `'control'` channel.
|
|
1032
|
+
*
|
|
1033
|
+
* @hidden
|
|
1034
|
+
*
|
|
1035
|
+
* #### Notes
|
|
1036
|
+
* Debug messages are experimental messages that are not in the official
|
|
1037
|
+
* kernel message specification. As such, this is *NOT* considered
|
|
1038
|
+
* part of the public API, and may change without notice.
|
|
1039
|
+
*/
|
|
1040
|
+
export interface IDebugReplyMsg extends IControlMessage<'debug_reply'> {
|
|
1041
|
+
content: {
|
|
1042
|
+
seq: number;
|
|
1043
|
+
type: 'response';
|
|
1044
|
+
request_seq: number;
|
|
1045
|
+
success: boolean;
|
|
1046
|
+
command: string;
|
|
1047
|
+
message?: string;
|
|
1048
|
+
body?: any;
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
// ////////////////////////////////////////////////
|
|
1053
|
+
// Stdin Messages
|
|
1054
|
+
// ///////////////////////////////////////////////
|
|
1055
|
+
|
|
1056
|
+
/**
|
|
1057
|
+
* An `'input_request'` message on the `'stdin'` channel.
|
|
1058
|
+
*
|
|
1059
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#messages-on-the-stdin-router-dealer-sockets).
|
|
1060
|
+
*/
|
|
1061
|
+
export interface IInputRequestMsg extends IStdinMessage<'input_request'> {
|
|
1062
|
+
content: {
|
|
1063
|
+
/**
|
|
1064
|
+
* The text to show at the prompt.
|
|
1065
|
+
*/
|
|
1066
|
+
prompt: string;
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* Whether the request is for a password.
|
|
1070
|
+
* If so, the frontend shouldn't echo input.
|
|
1071
|
+
*/
|
|
1072
|
+
password: boolean;
|
|
1073
|
+
};
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* An `'input_reply'` message content.
|
|
1078
|
+
*
|
|
1079
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#messages-on-the-stdin-router-dealer-sockets).
|
|
1080
|
+
*/
|
|
1081
|
+
export interface IInputReply extends IReplyOkContent {
|
|
1082
|
+
value: string;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
* An `'input_reply'` message on the `'stdin'` channel.
|
|
1087
|
+
*
|
|
1088
|
+
* See [Messaging in Jupyter](https://jupyter-client.readthedocs.io/en/latest/messaging.html#messages-on-the-stdin-router-dealer-sockets).
|
|
1089
|
+
*/
|
|
1090
|
+
export interface IInputReplyMsg extends IStdinMessage<'input_reply'> {
|
|
1091
|
+
parent_header: IHeader<'input_request'>;
|
|
1092
|
+
content: ReplyContent<IInputReply>;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
// ///////////////////////////////////////////////
|
|
1096
|
+
// Message (de)serialization
|
|
1097
|
+
// ///////////////////////////////////////////////
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* The list of supported kernel wire protocols over websocket.
|
|
1101
|
+
*/
|
|
1102
|
+
export enum supportedKernelWebSocketProtocols {
|
|
1103
|
+
v1KernelWebsocketJupyterOrg = 'v1.kernel.websocket.jupyter.org',
|
|
1104
|
+
}
|