Repository navigation
VS Code graph: use Curiosity Engine's viewer only (0.14.1) - #17
Conversation
The Switch Bay VS graph view now mounts CE's own viewer (CEEmbed), the same one the PWA Graph tab uses. The extension builds CE's wiki-view bundle with wiki_render.py, serves its scripts and figures as webview resources (CSP limited to the webview source, resource roots limited to media/graph and the bundle), and answers CE's API calls over postMessage: data.json (rebuilt when stale), /api/page for notes/todos with CE's own path rules, and curation history. The view keeps the old webview's features: open markdown / preview / reveal / plot / sketch / slideshow (page window and right-click), search hits marked in the Wiki and Files trees, VS Code light/dark theme. It also gains CE's page window and note editing, repaints on wiki changes, and reloads when the wiki root changes. Without a CE install it shows a message instead of a graph. Removes the remaining fork under frontend/src/widgets/graph (graph.js, modal.js, subgraph.js, knowledge-atlas.js, atlas.ts, init.ts, load.ts, template.ts, graphSearch, curationReplayAnim, ce-graph.css); GraphData types move to src/lib/graphTypes.ts. A unit test keeps the fork out. Also: wire CE's replay control (the embed never initialises it), and wait for CE's "Saved" toast before a canvas remount so it can't stick. Signed-off-by: benjsmith <benjamincharlessmith@gmail.com>
VS Code graph parity (CE viewer), commit be5da3bHow it was run. Headless Chromium against the built
Not exercised in a real VS Code. These steps ran in Chromium with the harness standing in for VS Code:
The extension-side logic for these is the unchanged handler code from before, plus Feature check vs the old VS Code webview: nothing lost. Every old action is still there: open, preview, reveal, plot, sketch, slideshow, search → trees, theme, replay. CE's split control is removed in VS Code because splitting needs Switch Bay's daemon; the old webview didn't offer split either. Clicking a node now opens CE's page window instead of jumping straight to the markdown. Open markdown is one click away in that window and on right-click. |
Switch Bay VS's Open Graph now mounts Curiosity Engine's own viewer (
CEEmbed), the same one the PWA Graph tab has used since 0.14.0. The last in-repo fork of CE's wiki-view is deleted.How it works
frontend/src/webview-graph.ts(built byvite.webview.config.tsintoextensions/switchbay-vs/media/graph/) is a thin host. It loads CE's scripts with the sharedloadCeModules, injects Switch Bay'sceEmbedShell.html, and mounts the canvas withCEEmbed.create.The extension builds CE's wiki-view bundle with
wiki_render.py, rebuilding it when it's older than the wiki or after a change. It serves the bundle'sstatic/and figures as webview resources. CSP:default-src 'none', scripts/styles/images/fonts fromwebview.cspSourceonly.localResourceRootsismedia/graph+ the bundle dir.CE's API calls go to a virtual
.invalidorigin viawindow.ceApi.vscodeGraphBridge.tsturns those fetches intopostMessageround-trips, andextensions/switchbay-vs/src/graphBundle.tsanswers them from disk:data.json/api/pageGET/POST, with CE's own rule: onlynotes/andtodos/.mdpagesEverything else returns 404, like CE's server.
If CE isn't installed (
ceViewerAvailable), the panel says "Graph needs Curiosity Engine" instead of breaking. This matches the PWA hiding its tab.File watchers call
refreshGraph(), which repaints an open graph on wiki-page or graph-db changes (debounced; bundle-build events are ignored). Aswitchbay.wikiRootor workspace-folder change re-renders the panel for the new workspace.Kept from the old webview:
New: CE's page window (properties, body, subgraph, KaTeX, DOMPurify-sanitised) and note editing.
Removed
frontend/src/widgets/graph/:static/graph.js,static/modal.js,static/subgraph.js,static/vendor/knowledge-atlas.js,atlas.ts,init.ts,init-globals.ts,load.ts,template.ts,graphSearch.ts+graphSearch.test.ts,curationReplayAnim.ts,ce-graph.css,static.d.ts.GraphDatamoved tosrc/lib/graphTypes.ts, and the CE window globals are now inwidgets/embed/ceGlobals.d.ts. The webview build no longer copies the PWA'spublic/(icons, service worker) into the extension.Also fixed (PWA too)
CurationReplay.init, so the replay button did nothing in the 0.14.0 Graph tab.bindCeReplaynow wires it after each fresh canvas shell.waitForCeToast).Tests
vscodeGraphBridge.test.ts(7), plus onebindCeReplaytest inceHostBridge.test.ts. CE embed Node tests: 29/29.graphBundle.test.ts(6).pnpm --dir extensions/switchbay-vs run testis 20/20.tests/unit/test_vscode_graph_ce_only.py(fork deleted, nothing referenceswidgets/graph, the webview mounts CE, the extension handles missing CE).test_procedure_execution_palette.pyno longer reads fork files.test_runtime.pyfailures are box-specific Node path resolution and also fail on main; they pass in CI.tsc -b, the PWAvite build,build:webview, and the Playwrightgraph-ce-embed.spec.ts(3/3) all pass.extensions/switchbay-vs/pnpm-workspace.yamlrecords explicitallowBuilds: falseforkeytar/@vscode/vsce-sign, sopnpm install --frozen-lockfile(pnpm 11) exits 0 formake vscode-compile.CI changes (extension tests, new Node tests,
graph-ce-embede2e) aren't in this PR because the token has noworkflowscope. A completeci.ymlis provided separately.Parity table is in the comment below.