nebula-notebook 0.1.1 → 0.2.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.
Files changed (142) hide show
  1. package/README.md +110 -16
  2. package/dist/assets/errorwidget-Wy5ajPiM.js +5 -0
  3. package/dist/assets/fa-brands-400-CEJbCg16.woff +0 -0
  4. package/dist/assets/fa-brands-400-CSYNqBb_.ttf +0 -0
  5. package/dist/assets/fa-brands-400-DnkPfk3o.eot +0 -0
  6. package/dist/assets/fa-brands-400-UxlILjvJ.woff2 +0 -0
  7. package/dist/assets/fa-brands-400-cH1MgKbP.svg +3717 -0
  8. package/dist/assets/fa-regular-400-BhTwtT8w.eot +0 -0
  9. package/dist/assets/fa-regular-400-D1vz6WBx.ttf +0 -0
  10. package/dist/assets/fa-regular-400-DFnMcJPd.woff +0 -0
  11. package/dist/assets/fa-regular-400-DGzu1beS.woff2 +0 -0
  12. package/dist/assets/fa-regular-400-gwj8Pxq-.svg +801 -0
  13. package/dist/assets/fa-solid-900-B4ZZ7kfP.svg +5034 -0
  14. package/dist/assets/fa-solid-900-B6Axprfb.eot +0 -0
  15. package/dist/assets/fa-solid-900-BUswJgRo.woff2 +0 -0
  16. package/dist/assets/fa-solid-900-DOXgCApm.woff +0 -0
  17. package/dist/assets/fa-solid-900-mxuxnBEa.ttf +0 -0
  18. package/dist/assets/index-B_Bs5koo.js +1 -0
  19. package/dist/assets/index-BtWv4MIT.css +7 -0
  20. package/dist/assets/index-DK4nS74r.js +829 -0
  21. package/dist/assets/index-DeQN03nW.js +81 -0
  22. package/dist/assets/index-DzjpmUak.css +32 -0
  23. package/dist/assets/index-g6MjT-VG.js +1 -0
  24. package/dist/assets/services-shim-BirHVsih.js +33 -0
  25. package/dist/assets/viewlist-uomDf7I7.js +1 -0
  26. package/dist/assets/widgets-X7J3NxEn.css +1 -0
  27. package/dist/index.html +2 -2
  28. package/node-server/dist/auth/auth-middleware.js +22 -4
  29. package/node-server/dist/auth/auth-service.js +37 -7
  30. package/node-server/dist/cluster/client-registration.d.ts +12 -1
  31. package/node-server/dist/cluster/client-registration.js +38 -2
  32. package/node-server/dist/cluster/kernel-proxy.js +43 -12
  33. package/node-server/dist/cluster/server-registry.d.ts +17 -0
  34. package/node-server/dist/cluster/server-registry.js +57 -7
  35. package/node-server/dist/discovery/conda-locations.d.ts +73 -0
  36. package/node-server/dist/discovery/conda-locations.js +427 -0
  37. package/node-server/dist/discovery/discovery-service.d.ts +73 -4
  38. package/node-server/dist/discovery/discovery-service.js +211 -127
  39. package/node-server/dist/discovery/types.d.ts +0 -1
  40. package/node-server/dist/discovery/types.js +1 -2
  41. package/node-server/dist/environment.d.ts +12 -0
  42. package/node-server/dist/environment.js +104 -0
  43. package/node-server/dist/fs/fs-service.d.ts +86 -8
  44. package/node-server/dist/fs/fs-service.js +640 -99
  45. package/node-server/dist/fs/notebook-formats/percent.d.ts +25 -0
  46. package/node-server/dist/fs/notebook-formats/percent.js +286 -0
  47. package/node-server/dist/fs/notebook-formats/qmd.d.ts +29 -0
  48. package/node-server/dist/fs/notebook-formats/qmd.js +307 -0
  49. package/node-server/dist/fs/notebook-formats/registry.d.ts +12 -0
  50. package/node-server/dist/fs/notebook-formats/registry.js +77 -0
  51. package/node-server/dist/fs/notebook-formats/types.d.ts +37 -0
  52. package/node-server/dist/fs/notebook-formats/types.js +13 -0
  53. package/node-server/dist/fs/types.d.ts +9 -0
  54. package/node-server/dist/fs/types.js +8 -0
  55. package/node-server/dist/idle-exit.d.ts +52 -0
  56. package/node-server/dist/idle-exit.js +83 -0
  57. package/node-server/dist/index.js +198 -8
  58. package/node-server/dist/kernel/kernel-service.d.ts +130 -2
  59. package/node-server/dist/kernel/kernel-service.js +834 -64
  60. package/node-server/dist/kernel/kernelspec.d.ts +27 -0
  61. package/node-server/dist/kernel/kernelspec.js +75 -4
  62. package/node-server/dist/notebook/headless-handler.d.ts +12 -0
  63. package/node-server/dist/notebook/headless-handler.js +125 -29
  64. package/node-server/dist/notebook/operation-router.js +7 -2
  65. package/node-server/dist/notebook/undoRedoManager.d.ts +12 -1
  66. package/node-server/dist/notebook/undoRedoManager.js +49 -18
  67. package/node-server/dist/output/display-data.js +2 -0
  68. package/node-server/dist/private-tmp.d.ts +14 -0
  69. package/node-server/dist/private-tmp.js +70 -0
  70. package/node-server/dist/routes/autocomplete.d.ts +19 -0
  71. package/node-server/dist/routes/autocomplete.js +294 -0
  72. package/node-server/dist/routes/cluster.js +2 -2
  73. package/node-server/dist/routes/compute.d.ts +8 -0
  74. package/node-server/dist/routes/compute.js +136 -0
  75. package/node-server/dist/routes/fs.js +23 -6
  76. package/node-server/dist/routes/kernel.js +156 -3
  77. package/node-server/dist/routes/notebook.js +37 -3
  78. package/node-server/dist/routes/python.d.ts +1 -2
  79. package/node-server/dist/routes/python.js +139 -3
  80. package/node-server/dist/scheduler/allocation-service.d.ts +63 -0
  81. package/node-server/dist/scheduler/allocation-service.js +285 -0
  82. package/node-server/dist/scheduler/job-template.d.ts +30 -0
  83. package/node-server/dist/scheduler/job-template.js +85 -0
  84. package/node-server/dist/scheduler/mock-scheduler.d.ts +30 -0
  85. package/node-server/dist/scheduler/mock-scheduler.js +125 -0
  86. package/node-server/dist/scheduler/slurm-scheduler.d.ts +31 -0
  87. package/node-server/dist/scheduler/slurm-scheduler.js +406 -0
  88. package/node-server/dist/scheduler/types.d.ts +118 -0
  89. package/node-server/dist/scheduler/types.js +8 -0
  90. package/node-server/dist/scheduler/util.d.ts +7 -0
  91. package/node-server/dist/scheduler/util.js +20 -0
  92. package/node-server/dist/terminal/agent-registry.d.ts +87 -0
  93. package/node-server/dist/terminal/agent-registry.js +246 -0
  94. package/node-server/dist/terminal/binding-store.d.ts +57 -0
  95. package/node-server/dist/terminal/binding-store.js +0 -0
  96. package/node-server/dist/terminal/pty-manager.d.ts +23 -6
  97. package/node-server/dist/terminal/pty-manager.js +138 -19
  98. package/node-server/dist/terminal/server.js +155 -23
  99. package/node-server/dist/terminal/types.d.ts +2 -0
  100. package/node-server/dist/update-check.d.ts +20 -0
  101. package/node-server/dist/update-check.js +114 -0
  102. package/node-server/package.json +2 -0
  103. package/node_modules/nebula-autocomplete/README.md +145 -0
  104. package/node_modules/nebula-autocomplete/dist/backends/claude.d.ts +69 -0
  105. package/node_modules/nebula-autocomplete/dist/backends/claude.js +449 -0
  106. package/node_modules/nebula-autocomplete/dist/backends/codex.d.ts +45 -0
  107. package/node_modules/nebula-autocomplete/dist/backends/codex.js +108 -0
  108. package/node_modules/nebula-autocomplete/dist/client/fetcher.d.ts +16 -0
  109. package/node_modules/nebula-autocomplete/dist/client/fetcher.js +41 -0
  110. package/node_modules/nebula-autocomplete/dist/codemirror/ghostText.d.ts +43 -0
  111. package/node_modules/nebula-autocomplete/dist/codemirror/ghostText.js +175 -0
  112. package/node_modules/nebula-autocomplete/dist/core/engine.d.ts +17 -0
  113. package/node_modules/nebula-autocomplete/dist/core/engine.js +135 -0
  114. package/node_modules/nebula-autocomplete/dist/core/lru.d.ts +7 -0
  115. package/node_modules/nebula-autocomplete/dist/core/lru.js +26 -0
  116. package/node_modules/nebula-autocomplete/dist/core/prompt.d.ts +12 -0
  117. package/node_modules/nebula-autocomplete/dist/core/prompt.js +0 -0
  118. package/node_modules/nebula-autocomplete/dist/core/text.d.ts +53 -0
  119. package/node_modules/nebula-autocomplete/dist/core/text.js +169 -0
  120. package/node_modules/nebula-autocomplete/dist/index.d.ts +7 -0
  121. package/node_modules/nebula-autocomplete/dist/index.js +5 -0
  122. package/node_modules/nebula-autocomplete/dist/server/fastify.d.ts +40 -0
  123. package/node_modules/nebula-autocomplete/dist/server/fastify.js +52 -0
  124. package/node_modules/nebula-autocomplete/dist/transport.d.ts +55 -0
  125. package/node_modules/nebula-autocomplete/dist/transport.js +66 -0
  126. package/node_modules/nebula-autocomplete/dist/types.d.ts +103 -0
  127. package/node_modules/nebula-autocomplete/dist/types.js +1 -0
  128. package/node_modules/nebula-autocomplete/package.json +58 -0
  129. package/node_modules/nebula-autocomplete/server.d.ts +3 -0
  130. package/node_modules/nebula-autocomplete/server.js +3 -0
  131. package/package.json +18 -5
  132. package/scripts/postinstall.cjs +25 -5
  133. package/dist/assets/index-BvrHu37J.js +0 -648
  134. package/dist/assets/index-Dfj_xsKU.css +0 -32
  135. package/node-server/dist/llm/index.d.ts +0 -5
  136. package/node-server/dist/llm/index.js +0 -21
  137. package/node-server/dist/llm/llm-service.d.ts +0 -77
  138. package/node-server/dist/llm/llm-service.js +0 -454
  139. package/node-server/dist/llm/types.d.ts +0 -40
  140. package/node-server/dist/llm/types.js +0 -15
  141. package/node-server/dist/routes/llm.d.ts +0 -8
  142. package/node-server/dist/routes/llm.js +0 -105
@@ -41,6 +41,19 @@ export declare class FilesystemService {
41
41
  */
42
42
  private atomicWriteFileSync;
43
43
  private writeJsonAtomicSync;
44
+ /**
45
+ * Async variant of atomicWriteFileSync (write temp, fsync, rename, fsync dir).
46
+ * Used on hot notebook-save paths so large writes never block the event loop.
47
+ *
48
+ * `durable: false` skips both fsyncs while keeping the tmp+rename atomicity.
49
+ * Use it for auxiliary files (history/session/journal/lastsave): on network
50
+ * filesystems (GPFS) each fsync can take seconds, and a save doing ~10 of
51
+ * them was observed at 20-27s. A crash can lose the last few seconds of an
52
+ * auxiliary file, but never corrupt it — the rename is still atomic. The
53
+ * notebook file itself stays fully durable.
54
+ */
55
+ private atomicWriteFile;
56
+ private writeJsonAtomic;
44
57
  /**
45
58
  * Format file size for display
46
59
  */
@@ -53,6 +66,9 @@ export declare class FilesystemService {
53
66
  * Get file info for a path
54
67
  */
55
68
  private getFileInfo;
69
+ /** Async, non-blocking variant of getFileInfo (one `fsp.stat`). Used by
70
+ * listDirectory so a folder's entries stat in parallel off the event loop. */
71
+ private getFileInfoAsync;
56
72
  /**
57
73
  * Convert FileInfo to FileInfoResponse for API
58
74
  */
@@ -64,15 +80,15 @@ export declare class FilesystemService {
64
80
  /**
65
81
  * Get file modification time
66
82
  */
67
- getFileMtime(filePath: string): MtimeResponse;
83
+ getFileMtime(filePath: string): Promise<MtimeResponse>;
68
84
  /**
69
85
  * List contents of a directory
70
86
  */
71
- listDirectory(dirPath: string): DirectoryListing;
87
+ listDirectory(dirPath: string): Promise<DirectoryListing>;
72
88
  /**
73
89
  * Read a file's contents
74
90
  */
75
- readFile(filePath: string): ReadFileResponse;
91
+ readFile(filePath: string): Promise<ReadFileResponse>;
76
92
  /**
77
93
  * Write content to a file
78
94
  */
@@ -87,6 +103,16 @@ export declare class FilesystemService {
87
103
  * Get the history file path for a notebook
88
104
  */
89
105
  private getHistoryPath;
106
+ /**
107
+ * Last-Nebula-save record for text-format notebooks: the canonical cell
108
+ * state (id/type/content) as of the last save THROUGH Nebula. At history
109
+ * load, divergence between this record and the file means the notebook was
110
+ * edited externally (vim, git checkout, ...) — the difference is
111
+ * reconciled into history as a synthesized external-edit operation so
112
+ * undo/redo stays infinite across external edits.
113
+ */
114
+ private getLastSavePath;
115
+ private writeTextNotebookLastSave;
90
116
  /**
91
117
  * Get the session state file path for a notebook
92
118
  */
@@ -147,9 +173,19 @@ export declare class FilesystemService {
147
173
  */
148
174
  private convertOutputsToJupyter;
149
175
  /**
150
- * Read a notebook and convert to internal cell format
176
+ * Read a notebook and convert to internal cell format (async; hot path for
177
+ * notebook load — large .ipynb reads must not block the event loop)
178
+ */
179
+ getNotebookCells(notebookPath: string): Promise<NotebookCellsResponse>;
180
+ /**
181
+ * Sync variant of getNotebookCells. Kept for cold callers that need a
182
+ * synchronous read (headless cache warm-up, initial-history bootstrap).
151
183
  */
152
- getNotebookCells(notebookPath: string): NotebookCellsResponse;
184
+ getNotebookCellsSync(notebookPath: string): NotebookCellsResponse;
185
+ /**
186
+ * Convert raw notebook file content to the internal cell format (CPU only).
187
+ */
188
+ private buildNotebookCellsResponse;
153
189
  /**
154
190
  * Read a notebook and convert to internal cell format, resolving default kernel if needed
155
191
  */
@@ -157,16 +193,27 @@ export declare class FilesystemService {
157
193
  /**
158
194
  * Save cells to a notebook file
159
195
  */
160
- saveNotebookCells(notebookPath: string, cells: NebulaCell[], kernelName?: string, notebookMetadata?: Record<string, unknown>): SaveNotebookResult;
196
+ saveNotebookCells(notebookPath: string, cells: NebulaCell[], kernelName?: string, notebookMetadata?: Record<string, unknown>): Promise<SaveNotebookResult>;
161
197
  /**
162
198
  * Save notebook cells and history in a single crash-safe commit.
163
199
  * Uses a small journal + atomic writes to avoid partial files.
164
200
  */
165
201
  saveNotebookBundle(notebookPath: string, cells: NebulaCell[], kernelName?: string, history?: unknown[], session?: Record<string, unknown>, notebookMetadata?: Record<string, unknown>): Promise<SaveNotebookResult>;
202
+ /**
203
+ * Save cells to a text-format notebook (.py percent / .qmd).
204
+ * Outputs and execution counts are never serialized — by format design.
205
+ */
206
+ private saveTextNotebookCells;
166
207
  /**
167
208
  * Get notebook-level metadata
168
209
  */
169
210
  getNotebookMetadata(notebookPath: string): Record<string, unknown>;
211
+ /**
212
+ * Async variant of getNotebookMetadata. Nebula-written notebooks put
213
+ * `metadata` first, so the head-bytes scan avoids reading and parsing the
214
+ * whole file; externally written notebooks fall back to a full async read.
215
+ */
216
+ getNotebookMetadataAsync(notebookPath: string): Promise<Record<string, unknown>>;
170
217
  /**
171
218
  * Update notebook-level metadata without modifying cells
172
219
  */
@@ -185,11 +232,20 @@ export declare class FilesystemService {
185
232
  success: boolean;
186
233
  error?: string;
187
234
  status?: AgentPermissionSnapshot;
235
+ mtime?: number;
188
236
  }>;
189
237
  /**
190
238
  * Derive agent permission status from persisted notebook metadata.
191
239
  */
192
240
  getAgentPermissionStatus(notebookPath: string): AgentPermissionSnapshot;
241
+ /**
242
+ * Async variant of getAgentPermissionStatus for hot request paths (it runs
243
+ * on every agent write operation). Reads metadata via the head-bytes fast
244
+ * path and checks history without parsing it, so the per-operation gate
245
+ * never blocks the event loop on a slow network filesystem.
246
+ */
247
+ getAgentPermissionStatusAsync(notebookPath: string): Promise<AgentPermissionSnapshot>;
248
+ private deriveAgentPermission;
193
249
  /**
194
250
  * Check if a notebook is permitted for agent modifications
195
251
  */
@@ -198,14 +254,36 @@ export declare class FilesystemService {
198
254
  * Check if a notebook has history tracking enabled
199
255
  */
200
256
  hasHistory(notebookPath: string): boolean;
257
+ /**
258
+ * Async variant of hasHistory that only parses small files: history journals
259
+ * grow to hundreds of KB, and this check runs on every agent operation — a
260
+ * file that large necessarily has entries, so its size alone answers.
261
+ */
262
+ hasHistoryAsync(notebookPath: string): Promise<boolean>;
201
263
  /**
202
264
  * Save operation history for a notebook
203
265
  */
204
266
  saveHistory(notebookPath: string, history: unknown[]): Promise<boolean>;
205
267
  /**
206
- * Load operation history for a notebook
268
+ * Load operation history for a notebook (async; history files can be many MB)
269
+ */
270
+ loadHistory(notebookPath: string): Promise<unknown[]>;
271
+ /**
272
+ * Sync variant of loadHistory. Kept for cold callers that need a
273
+ * synchronous read (headless undo/redo state bootstrap).
274
+ */
275
+ loadHistorySync(notebookPath: string): unknown[];
276
+ /**
277
+ * Compare the file's current cells against the last-Nebula-save record.
278
+ * On divergence, append ONE synthesized batch operation describing the
279
+ * external edit (updateContent / insertCell / deleteCell, source
280
+ * 'external') — both undo systems replay these, so a single undo step
281
+ * reverts the external edit and redo reapplies it. Falls back to a plain
282
+ * snapshot entry if synthesis fails (undo then bottoms out there instead
283
+ * of corrupting).
207
284
  */
208
- loadHistory(notebookPath: string): unknown[];
285
+ private reconcileExternalTextEdits;
286
+ private synthesizeExternalEditOps;
209
287
  /**
210
288
  * Save session state for a notebook
211
289
  */