@runtimed/node 0.2.7 → 0.3.1
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/README.md +12 -5
- package/package.json +7 -7
- package/src/binding.cjs +52 -52
- package/src/binding.d.ts +27 -1
- package/src/index.d.ts +55 -2
- package/src/session.cjs +87 -1
package/README.md
CHANGED
|
@@ -87,21 +87,28 @@ sessions.
|
|
|
87
87
|
- `Session.listCells()` and `Session.getCell(cellId)` inspect notebook cells.
|
|
88
88
|
- `Session.createCell(source, options)`, `Session.setCell(cellId, options)`,
|
|
89
89
|
`Session.deleteCell(cellId)`, and `Session.moveCell(cellId, options)` provide
|
|
90
|
-
direct notebook editing without MCP JSON round-trips.
|
|
90
|
+
direct notebook editing without MCP JSON round-trips. `createCell()` appends
|
|
91
|
+
by default; pass `index: 0` to prepend or `afterCellId` to insert after
|
|
92
|
+
another cell.
|
|
91
93
|
- `Session.executeCell(cellId, options)` runs an existing code cell.
|
|
92
94
|
- `Session.showNotebook()` opens the session in nteract Desktop when a display
|
|
93
95
|
is available.
|
|
94
96
|
- `Session.interruptKernel()`, `Session.shutdownKernel()`, and
|
|
95
97
|
`Session.restartKernel()` manage the running kernel.
|
|
96
98
|
- `Session.shutdownNotebook()` shuts down this notebook room and closes the session.
|
|
97
|
-
- `Session.runCell(source, options)`
|
|
98
|
-
- `Session.queueCell(source, options)`
|
|
99
|
+
- `Session.runCell(source, options)` appends, runs, and waits for a cell.
|
|
100
|
+
- `Session.queueCell(source, options)` appends a cell, queues it, and returns IDs.
|
|
99
101
|
- `Session.waitForExecution(executionId, options)` waits for queued work.
|
|
100
102
|
Pass `onUpdate(progress)` to receive resolved output snapshots while the
|
|
101
103
|
execution is still running.
|
|
102
104
|
- `Session.runtimeState$`, `Session.executionTransitions$`,
|
|
103
|
-
`Session.
|
|
104
|
-
expose the same projected event families used by
|
|
105
|
+
`Session.executionViewChanges$`, `Session.cellChanges$`, `Session.broadcasts$`,
|
|
106
|
+
and `Session.sessionStatus$` expose the same projected event families used by
|
|
107
|
+
the browser sync engine.
|
|
108
|
+
- `Session.getExecutionView()` returns the current materialized execution view:
|
|
109
|
+
non-null notebook cell pointers, execution snapshots keyed by `execution_id`,
|
|
110
|
+
and the execution-ID-first queue projection. Use this for status surfaces;
|
|
111
|
+
use `executionViewChanges$` when you need every pointer-clear transition.
|
|
105
112
|
- `Session.addDependency(spec, { packageManager })` /
|
|
106
113
|
`Session.addDependencies(specs, { packageManager })` and
|
|
107
114
|
`Session.removeDependency(spec, { packageManager })` /
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runtimed/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Node.js bindings for controlling nteract runtimed notebooks and Python kernels.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/nteract/
|
|
9
|
+
"url": "git+https://github.com/nteract/nteract.git",
|
|
10
10
|
"directory": "packages/runtimed-node"
|
|
11
11
|
},
|
|
12
|
-
"homepage": "https://github.com/nteract/
|
|
12
|
+
"homepage": "https://github.com/nteract/nteract/tree/main/packages/runtimed-node#readme",
|
|
13
13
|
"bugs": {
|
|
14
|
-
"url": "https://github.com/nteract/
|
|
14
|
+
"url": "https://github.com/nteract/nteract/issues"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [
|
|
17
17
|
"nteract",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"rxjs": "^7.8.2"
|
|
53
53
|
},
|
|
54
54
|
"optionalDependencies": {
|
|
55
|
-
"@runtimed/node-
|
|
56
|
-
"@runtimed/node-win32-x64-msvc": "0.
|
|
57
|
-
"@runtimed/node-
|
|
55
|
+
"@runtimed/node-linux-x64-gnu": "0.3.1",
|
|
56
|
+
"@runtimed/node-win32-x64-msvc": "0.3.1",
|
|
57
|
+
"@runtimed/node-darwin-arm64": "0.3.1"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
package/src/binding.cjs
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('@runtimed/node-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@runtimed/node-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '0.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
80
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('@runtimed/node-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('@runtimed/node-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '0.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
96
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('@runtimed/node-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('@runtimed/node-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '0.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
117
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('@runtimed/node-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('@runtimed/node-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '0.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
133
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('@runtimed/node-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('@runtimed/node-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
150
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('@runtimed/node-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('@runtimed/node-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '0.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
166
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('@runtimed/node-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('@runtimed/node-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '0.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
185
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('@runtimed/node-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('@runtimed/node-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '0.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
201
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('@runtimed/node-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('@runtimed/node-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '0.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
217
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('@runtimed/node-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('@runtimed/node-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '0.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
237
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('@runtimed/node-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('@runtimed/node-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '0.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
253
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('@runtimed/node-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('@runtimed/node-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '0.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
274
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('@runtimed/node-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('@runtimed/node-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '0.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
290
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('@runtimed/node-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('@runtimed/node-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '0.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
308
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('@runtimed/node-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('@runtimed/node-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '0.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
324
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('@runtimed/node-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('@runtimed/node-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '0.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
342
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('@runtimed/node-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('@runtimed/node-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '0.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
358
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('@runtimed/node-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('@runtimed/node-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '0.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
376
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('@runtimed/node-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('@runtimed/node-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '0.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
392
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('@runtimed/node-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('@runtimed/node-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
410
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('@runtimed/node-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('@runtimed/node-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '0.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
426
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('@runtimed/node-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('@runtimed/node-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
443
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('@runtimed/node-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('@runtimed/node-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
459
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('@runtimed/node-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('@runtimed/node-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '0.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
479
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('@runtimed/node-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('@runtimed/node-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '0.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
495
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('@runtimed/node-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('@runtimed/node-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '0.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
511
|
+
if (bindingPackageVersion !== '0.3.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 0.3.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
package/src/binding.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export declare class Session {
|
|
|
14
14
|
onRuntimeState(callback: (arg0: string) => void): EventSubscription
|
|
15
15
|
/** Subscribe to execution lifecycle transitions. Callback receives a JSON string. */
|
|
16
16
|
onExecutionTransition(callback: (arg0: string) => void): EventSubscription
|
|
17
|
+
/** Subscribe to shared execution-view changes. Callback receives a JSON string. */
|
|
18
|
+
onExecutionViewChange(callback: (arg0: string) => void): EventSubscription
|
|
17
19
|
/**
|
|
18
20
|
* Subscribe to resolved progress snapshots for one execution.
|
|
19
21
|
*
|
|
@@ -39,6 +41,14 @@ export declare class Session {
|
|
|
39
41
|
* (creating the file if needed). Otherwise saves to the original location.
|
|
40
42
|
*/
|
|
41
43
|
saveNotebook(path?: string | undefined | null): Promise<void>
|
|
44
|
+
/**
|
|
45
|
+
* Export the live synced notebook and runtime-state documents.
|
|
46
|
+
*
|
|
47
|
+
* This waits for both document channels to converge with the daemon
|
|
48
|
+
* before serializing, so hosted publish clients can upload a coherent
|
|
49
|
+
* `NotebookDoc` + `RuntimeStateDoc` snapshot pair.
|
|
50
|
+
*/
|
|
51
|
+
exportSnapshotPair(): Promise<SnapshotPair>
|
|
42
52
|
/** Close the session and release the underlying connection. */
|
|
43
53
|
close(): Promise<void>
|
|
44
54
|
/**
|
|
@@ -160,8 +170,13 @@ export interface CondaDependencyStatus {
|
|
|
160
170
|
export interface CreateCellOptions {
|
|
161
171
|
/** Cell source type: `"code"` (default), `"markdown"`, or `"raw"`. */
|
|
162
172
|
cellType?: string
|
|
163
|
-
/** Insert after this cell, or omit to
|
|
173
|
+
/** Insert after this cell, or omit to append at the end. */
|
|
164
174
|
afterCellId?: string
|
|
175
|
+
/**
|
|
176
|
+
* Position to insert at. Omit to append; 0 prepends; out-of-range appends.
|
|
177
|
+
* Cannot be combined with `afterCellId`.
|
|
178
|
+
*/
|
|
179
|
+
index?: number
|
|
165
180
|
}
|
|
166
181
|
|
|
167
182
|
/** Create a new (ephemeral) notebook against the daemon. */
|
|
@@ -433,6 +448,17 @@ export interface ShutdownNotebookOptions {
|
|
|
433
448
|
socketPath?: string
|
|
434
449
|
}
|
|
435
450
|
|
|
451
|
+
/** Serialized notebook + runtime-state snapshots for hosted publishing. */
|
|
452
|
+
export interface SnapshotPair {
|
|
453
|
+
notebookId: string
|
|
454
|
+
notebookBytes: Buffer
|
|
455
|
+
runtimeStateBytes: Buffer
|
|
456
|
+
notebookHeads: Array<string>
|
|
457
|
+
runtimeStateHeads: Array<string>
|
|
458
|
+
blobBaseUrl?: string
|
|
459
|
+
blobStorePath?: string
|
|
460
|
+
}
|
|
461
|
+
|
|
436
462
|
/**
|
|
437
463
|
* Return the daemon socket path for a specific channel ("stable" or
|
|
438
464
|
* "nightly"). Ignores `RUNTIMED_SOCKET_PATH`.
|
package/src/index.d.ts
CHANGED
|
@@ -17,11 +17,46 @@ export interface SessionStatus {
|
|
|
17
17
|
|
|
18
18
|
export interface ExecutionTransition {
|
|
19
19
|
execution_id: string;
|
|
20
|
-
cell_id: string;
|
|
21
20
|
kind: "started" | "done" | "error";
|
|
22
21
|
execution_count: number | null;
|
|
23
22
|
}
|
|
24
23
|
|
|
24
|
+
export interface ExecutionViewSnapshot {
|
|
25
|
+
execution_count: number | null;
|
|
26
|
+
status: "queued" | "running" | "done" | "error" | (string & {});
|
|
27
|
+
success: boolean | null;
|
|
28
|
+
output_ids: string[];
|
|
29
|
+
submitted_by_actor_label?: string | null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ExecutionQueueProjection {
|
|
33
|
+
executing_execution_id?: string | null;
|
|
34
|
+
queued_execution_ids: string[];
|
|
35
|
+
notebook?: {
|
|
36
|
+
executing_cell_id?: string | null;
|
|
37
|
+
queued_cell_ids: string[];
|
|
38
|
+
} | null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface ExecutionViewChangeset {
|
|
42
|
+
cell_pointer_changes?: Array<[cell_id: string, execution_id: string | null]>;
|
|
43
|
+
execution_upserts?: Array<[execution_id: string, snapshot: ExecutionViewSnapshot]>;
|
|
44
|
+
removed_execution_ids?: string[];
|
|
45
|
+
queue?: ExecutionQueueProjection;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface ExecutionView {
|
|
49
|
+
/**
|
|
50
|
+
* Current non-null NotebookDoc cell -> execution_id pointers.
|
|
51
|
+
*
|
|
52
|
+
* Cleared or deleted cells are omitted. Subscribe to `executionViewChanges$`
|
|
53
|
+
* when null pointer transitions matter.
|
|
54
|
+
*/
|
|
55
|
+
cell_execution_ids: Record<string, string>;
|
|
56
|
+
executions: Record<string, ExecutionViewSnapshot>;
|
|
57
|
+
queue: ExecutionQueueProjection | null;
|
|
58
|
+
}
|
|
59
|
+
|
|
25
60
|
export type RuntimeState = Record<string, unknown>;
|
|
26
61
|
|
|
27
62
|
export type RuntimeKind = "python" | "deno" | (string & {});
|
|
@@ -114,6 +149,16 @@ export interface CellResult {
|
|
|
114
149
|
outputs: JsOutput[];
|
|
115
150
|
}
|
|
116
151
|
|
|
152
|
+
export interface SnapshotPair {
|
|
153
|
+
notebookId: string;
|
|
154
|
+
notebookBytes: Uint8Array;
|
|
155
|
+
runtimeStateBytes: Uint8Array;
|
|
156
|
+
notebookHeads: string[];
|
|
157
|
+
runtimeStateHeads: string[];
|
|
158
|
+
blobBaseUrl?: string | null;
|
|
159
|
+
blobStorePath?: string | null;
|
|
160
|
+
}
|
|
161
|
+
|
|
117
162
|
export interface EventSubscription {
|
|
118
163
|
dispose(): void;
|
|
119
164
|
}
|
|
@@ -129,7 +174,12 @@ export interface CellSnapshot {
|
|
|
129
174
|
|
|
130
175
|
export interface CreateCellOptions {
|
|
131
176
|
cellType?: "code" | "markdown" | "raw";
|
|
132
|
-
|
|
177
|
+
/** Omit to append at the end. 0 prepends; out-of-range values append. */
|
|
178
|
+
index?: number;
|
|
179
|
+
/**
|
|
180
|
+
* Insert after this cell. Cannot be combined with index.
|
|
181
|
+
*/
|
|
182
|
+
afterCellId?: string;
|
|
133
183
|
}
|
|
134
184
|
|
|
135
185
|
export interface SetCellOptions {
|
|
@@ -174,6 +224,7 @@ export class Session {
|
|
|
174
224
|
readonly notebookId: string;
|
|
175
225
|
readonly runtimeState$: Observable<RuntimeState>;
|
|
176
226
|
readonly executionTransitions$: Observable<ExecutionTransition>;
|
|
227
|
+
readonly executionViewChanges$: Observable<ExecutionViewChangeset>;
|
|
177
228
|
readonly cellChanges$: Observable<null>;
|
|
178
229
|
readonly broadcasts$: Observable<unknown>;
|
|
179
230
|
readonly sessionStatus$: Observable<SessionStatus>;
|
|
@@ -182,6 +233,7 @@ export class Session {
|
|
|
182
233
|
waitForExecution(executionId: string, options?: WaitExecutionOptions): Promise<CellResult>;
|
|
183
234
|
runCell(source: string, options?: RunCellOptions): Promise<CellResult>;
|
|
184
235
|
saveNotebook(path?: string): Promise<void>;
|
|
236
|
+
exportSnapshotPair(): Promise<SnapshotPair>;
|
|
185
237
|
listCells(): Promise<CellSnapshot[]>;
|
|
186
238
|
getCell(cellId: string): Promise<CellSnapshot | null>;
|
|
187
239
|
createCell(source: string, options?: CreateCellOptions): Promise<string>;
|
|
@@ -200,6 +252,7 @@ export class Session {
|
|
|
200
252
|
removeDependencies(packages: string[], options?: DependencyEditOptions): Promise<number>;
|
|
201
253
|
getDependencyStatus(): Promise<DependencyStatus>;
|
|
202
254
|
getRuntimeStatus(): Promise<RuntimeStatus>;
|
|
255
|
+
getExecutionView(): ExecutionView;
|
|
203
256
|
dependencyFingerprint(): Promise<string | null>;
|
|
204
257
|
approveTrust(observedHeads?: string[]): Promise<void>;
|
|
205
258
|
syncEnvironment(): Promise<void>;
|
package/src/session.cjs
CHANGED
|
@@ -7,13 +7,16 @@ class Session {
|
|
|
7
7
|
constructor(nativeSession) {
|
|
8
8
|
this._native = nativeSession;
|
|
9
9
|
this._subscriptions = [];
|
|
10
|
+
this._executionView = emptyExecutionView();
|
|
10
11
|
this._runtimeStateSubject = new Subject();
|
|
11
12
|
this._executionTransitionsSubject = new Subject();
|
|
13
|
+
this._executionViewChangesSubject = new Subject();
|
|
12
14
|
this._cellChangesSubject = new Subject();
|
|
13
15
|
this._broadcastsSubject = new Subject();
|
|
14
16
|
this._sessionStatusSubject = new Subject();
|
|
15
17
|
this.runtimeState$ = this._runtimeStateSubject.asObservable();
|
|
16
18
|
this.executionTransitions$ = this._executionTransitionsSubject.asObservable();
|
|
19
|
+
this.executionViewChanges$ = this._executionViewChangesSubject.asObservable();
|
|
17
20
|
this.cellChanges$ = this._cellChangesSubject.asObservable();
|
|
18
21
|
this.broadcasts$ = this._broadcastsSubject.asObservable();
|
|
19
22
|
this.sessionStatus$ = this._sessionStatusSubject.asObservable();
|
|
@@ -49,6 +52,15 @@ class Session {
|
|
|
49
52
|
),
|
|
50
53
|
);
|
|
51
54
|
}
|
|
55
|
+
if (typeof nativeSession.onExecutionViewChange === "function") {
|
|
56
|
+
this._subscriptions.push(
|
|
57
|
+
nativeSession.onExecutionViewChange((json) => {
|
|
58
|
+
const changeset = parseJsonEvent(json);
|
|
59
|
+
applyExecutionViewChangeset(this._executionView, changeset);
|
|
60
|
+
this._executionViewChangesSubject.next(changeset);
|
|
61
|
+
}),
|
|
62
|
+
);
|
|
63
|
+
}
|
|
52
64
|
}
|
|
53
65
|
|
|
54
66
|
get notebookId() {
|
|
@@ -95,6 +107,10 @@ class Session {
|
|
|
95
107
|
return this._native.saveNotebook(path);
|
|
96
108
|
}
|
|
97
109
|
|
|
110
|
+
exportSnapshotPair() {
|
|
111
|
+
return this._native.exportSnapshotPair();
|
|
112
|
+
}
|
|
113
|
+
|
|
98
114
|
listCells() {
|
|
99
115
|
return this._native.listCells();
|
|
100
116
|
}
|
|
@@ -116,7 +132,7 @@ class Session {
|
|
|
116
132
|
}
|
|
117
133
|
|
|
118
134
|
moveCell(cellId, afterCellId) {
|
|
119
|
-
return this._native.moveCell(cellId,
|
|
135
|
+
return this._native.moveCell(cellId, afterCellId == null ? undefined : { afterCellId });
|
|
120
136
|
}
|
|
121
137
|
|
|
122
138
|
executeCell(cellId, options) {
|
|
@@ -185,12 +201,17 @@ class Session {
|
|
|
185
201
|
return this._native.syncEnvironment();
|
|
186
202
|
}
|
|
187
203
|
|
|
204
|
+
getExecutionView() {
|
|
205
|
+
return cloneExecutionView(this._executionView);
|
|
206
|
+
}
|
|
207
|
+
|
|
188
208
|
close() {
|
|
189
209
|
for (const subscription of this._subscriptions.splice(0)) {
|
|
190
210
|
subscription?.dispose?.();
|
|
191
211
|
}
|
|
192
212
|
this._runtimeStateSubject.complete();
|
|
193
213
|
this._executionTransitionsSubject.complete();
|
|
214
|
+
this._executionViewChangesSubject.complete();
|
|
194
215
|
this._cellChangesSubject.complete();
|
|
195
216
|
this._broadcastsSubject.complete();
|
|
196
217
|
this._sessionStatusSubject.complete();
|
|
@@ -212,6 +233,71 @@ function normalizeDependencyOptions(options) {
|
|
|
212
233
|
return { packageManager: options.packageManager };
|
|
213
234
|
}
|
|
214
235
|
|
|
236
|
+
function emptyExecutionView() {
|
|
237
|
+
return {
|
|
238
|
+
cell_execution_ids: {},
|
|
239
|
+
executions: {},
|
|
240
|
+
queue: null,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function applyExecutionViewChangeset(view, changeset) {
|
|
245
|
+
for (const [cellId, executionId] of changeset?.cell_pointer_changes ?? []) {
|
|
246
|
+
if (executionId == null) {
|
|
247
|
+
delete view.cell_execution_ids[cellId];
|
|
248
|
+
} else {
|
|
249
|
+
view.cell_execution_ids[cellId] = executionId;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
for (const [executionId, snapshot] of changeset?.execution_upserts ?? []) {
|
|
254
|
+
view.executions[executionId] = cloneExecutionSnapshot(snapshot);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
for (const executionId of changeset?.removed_execution_ids ?? []) {
|
|
258
|
+
delete view.executions[executionId];
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (Object.hasOwn(changeset ?? {}, "queue")) {
|
|
262
|
+
view.queue = cloneQueueProjection(changeset.queue ?? null);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function cloneExecutionView(view) {
|
|
267
|
+
return {
|
|
268
|
+
cell_execution_ids: { ...view.cell_execution_ids },
|
|
269
|
+
executions: Object.fromEntries(
|
|
270
|
+
Object.entries(view.executions).map(([executionId, snapshot]) => [
|
|
271
|
+
executionId,
|
|
272
|
+
cloneExecutionSnapshot(snapshot),
|
|
273
|
+
]),
|
|
274
|
+
),
|
|
275
|
+
queue: cloneQueueProjection(view.queue),
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function cloneExecutionSnapshot(snapshot) {
|
|
280
|
+
return {
|
|
281
|
+
...snapshot,
|
|
282
|
+
output_ids: Array.from(snapshot?.output_ids ?? []),
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function cloneQueueProjection(queue) {
|
|
287
|
+
if (queue == null) return null;
|
|
288
|
+
return {
|
|
289
|
+
executing_execution_id: queue.executing_execution_id ?? null,
|
|
290
|
+
queued_execution_ids: Array.from(queue.queued_execution_ids ?? []),
|
|
291
|
+
notebook:
|
|
292
|
+
queue.notebook == null
|
|
293
|
+
? queue.notebook
|
|
294
|
+
: {
|
|
295
|
+
executing_cell_id: queue.notebook.executing_cell_id ?? null,
|
|
296
|
+
queued_cell_ids: Array.from(queue.notebook.queued_cell_ids ?? []),
|
|
297
|
+
},
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
|
|
215
301
|
module.exports = {
|
|
216
302
|
Session,
|
|
217
303
|
};
|