Commit 2c7faba
authored
AppKernel and Google Drive Libraries (#119)
## Summary
This PR advances the Google Drive import/copy workflow by introducing an
AppKernel-based JavaScript notebook runner path (browser-local execution
via `JSKernel`), a user-facing Google Drive cookbook notebook, and a
`Save As` flow that correctly rebinds the current notebook to a newly
created Drive-backed mirror.
## Motivation
We want a better story for Google Drive manipulation from in-app
scripting (App Console and executable notebook cells), including a clear
path for users to:
- copy the current notebook to Google Drive
- continue editing the copied notebook with normal autosave behavior
- learn and validate Drive operations using executable documentation
notebooks
The existing architecture mirrors Drive files into IndexedDB
(`local://file/...`) and treats the local mirror URI as the active
notebook identity. That means a correct `Save As` implementation cannot
simply change the remote target in place; it must create a new local
mirrored notebook identity and switch the UI to it.
## What Changed
### 1. AppKernel notebook execution (JavaScript-only, browser-local)
- Added an AppKernel runner option for notebook cells using browser-side
`JSKernel` execution.
- AppKernel captures `stdout/stderr` and writes notebook `CellOutput[]`
so outputs render in the notebook UI.
- Added CUJ coverage and browser artifacts to verify rendered outputs
(not just notebook model state).
- Removed reliance on the legacy `WebContainer` path for this work.
### 2. App Console / AppKernel helper surface improvements
- Exposed AppConsole-style helper namespaces in AppKernel JS cells
(`runme`, `drive`, `googleClientManager`, `oidc`, `app`, etc.).
- Improved `JSKernel` logging/error visibility and BigInt-safe output
formatting for `console.log(...)`.
- Added structured logging (`appLogger`) for AppKernel execution and
Drive helper operations.
### 3. Google Drive `Save As` for mirrored notebooks
- Added `drive.saveAsCurrentNotebook(folderIdOrUri, fileName)` helper.
- Implementation creates a new Drive file, uploads the current notebook
JSON, creates a new local mirrored record, and switches the current UI
notebook to the new local URI.
- Added `app.openNotebook(localUri)` helper and app-state wiring to
switch the active notebook from runtime helpers.
This matches the current architecture where the active document is the
local mirror (`local://file/...`) and `CurrentDocContext` derives the
URL `?doc=` from the mirror's `remoteUri`.
### 4. User-facing executable documentation notebook
- Added a JSON Runme notebook under `docs/` (user-facing docs location)
with executable AppKernel JS cells demonstrating Google Drive
operations.
- Includes a “How to use this notebook” / `Save As` cell so users can
create and edit their own Drive-backed copy.
- SaveAs filename timestamp is optional and disabled by default.
### 5. Design documentation
- Added `docs-dev/design/appkernel.md` for the AppKernel runner approach
- Added `docs-dev/design/saveas.md` describing the mirrored-notebook
`Save As` / rename design and why URI rekeying is not the right v1
implementation
## Testing
### Automated
- Targeted Vitest coverage for:
- `driveTransfer` save-as helper behavior
- `NotebookData` AppKernel execution and helper availability
- `JSKernel` output formatting / logging behavior
- `Actions` output rendering behavior
- `runme run build test` passes
### Browser CUJ
- Added/updated AppKernel JavaScript notebook CUJ that verifies:
- AppKernel cell execution
- rendered notebook output visibility (UI-level assertions)
- rerun output replacement semantics
- Video artifact generated during local validation (not committed)
## Notes / Follow-ups
- Explorer tree refresh after `Save As` may not immediately show the new
file under a mounted mirrored folder until refresh/resync; the helper
creates the local mirrored file record and switches tabs, but does not
yet insert into the mirrored folder children list.
- `app.runners.*` parity in AppKernel cells remains a follow-up.
Fix #115
---------
Signed-off-by: Jeremy lewi <jeremy@lewi.us>1 parent 02e723b commit 2c7faba
File tree
30 files changed
+3376
-323
lines changed- app
- src
- components
- Actions
- AppConsole
- contexts
- lib
- runtime
- test
- browser
- fixtures/notebooks
- docs-dev
- CUJs
- cujs
- design
- docs
30 files changed
+3376
-323
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
74 | 78 | | |
75 | 79 | | |
76 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
107 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
108 | 124 | | |
109 | 125 | | |
110 | 126 | | |
| |||
215 | 231 | | |
216 | 232 | | |
217 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
218 | 258 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
108 | 111 | | |
109 | 112 | | |
110 | 113 | | |
111 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
112 | 119 | | |
113 | 120 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
| 121 | + | |
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
| |||
237 | 240 | | |
238 | 241 | | |
239 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
240 | 247 | | |
241 | 248 | | |
242 | 249 | | |
243 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
244 | 261 | | |
245 | 262 | | |
246 | 263 | | |
| |||
423 | 440 | | |
424 | 441 | | |
425 | 442 | | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
476 | 448 | | |
477 | 449 | | |
478 | 450 | | |
| |||
696 | 668 | | |
697 | 669 | | |
698 | 670 | | |
699 | | - | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
700 | 676 | | |
701 | 677 | | |
702 | 678 | | |
| |||
706 | 682 | | |
707 | 683 | | |
708 | 684 | | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
709 | 688 | | |
710 | 689 | | |
711 | 690 | | |
| |||
942 | 921 | | |
943 | 922 | | |
944 | 923 | | |
945 | | - | |
946 | | - | |
947 | | - | |
948 | | - | |
949 | | - | |
950 | | - | |
951 | | - | |
952 | | - | |
953 | | - | |
954 | | - | |
955 | | - | |
956 | | - | |
957 | | - | |
958 | | - | |
959 | | - | |
960 | | - | |
961 | | - | |
962 | | - | |
963 | | - | |
964 | | - | |
965 | 924 | | |
966 | 925 | | |
967 | 926 | | |
| |||
0 commit comments