Skip to content

Graph: use Curiosity Engine's viewer only (0.14.0) - #16

Merged
benjsmith merged 3 commits into
mainfrom
feat/graph-ce-only
Oct 8, 2026
Merged

benjsmith merged 3 commits into
mainfrom
feat/graph-ce-only

Conversation

@benjsmith

@benjsmith benjsmith commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Switchbay drops its built-in Graph viewer and uses Curiosity Engine's viewer only (via /embed/ce, CEEmbed.create).

What changes

  • Graph = CE. The Graph tab, the wiki page list in the shell's left column and the Zen graph all mount CE's viewer through one shared CeEmbedSession.
  • No CE: GET /api/settings → ce_graph: {installed, has_wiki}. If CE isn't installed, the Graph tab is hidden and graph shortcuts fall back to the Editor. If there's no wiki/ yet, the Graph tab shows a placeholder. The Files uploader (/api/upload-vault + UploadVaultDialog), RAG, Agents (okstratr) and Library don't depend on CE.
  • Settings: proxied_skill_embeds is kept, because it still chooses okstratr observer vs the built-in Agents dashboard. Graph ignores it now. The UI label is now "Agents: okstratr observer". The key is unchanged, so no migration is needed.
  • Switchbay shims on CE's viewer (ceHostBridge.ts, ceEmbedShell.html, CeAtlasEmbed.tsx):
    • Page HTML is sanitized before CE's modal renders it. CE renders body_html raw, so before this an <img onerror> in a wiki page ran on the daemon origin.
    • CE's modal gains KaTeX, table → Sheet / Plot, and the slideshow button.
    • CE's split panel is routed to /api/workspaces/split.
    • Procedure / Execution label-type rows.
    • Atlas ⇄ Classic switches in place. CE's chooser reloads the page, which would reload the whole app.
    • The sidebar + still opens UploadVaultDialog.
    • The {{WORKSPACE}} header substitution is kept, factored into ceSidebarHeader.ts.
  • Removed:
    • GraphTab.tsx, CurationReplay.tsx, sidebar/WikiPane.tsx
    • the fork's static/edit.js and static/sidebar.js
    • e2e graph-search, atlas-search, atlas-select, minimap-zoom
    • The theme / type palette moved to palette.css.
  • Kept on purpose: the rest of frontend/src/widgets/graph/ (graph.js, modal.js, subgraph.js, atlas.ts, init.ts, ce-graph.css, …). The VS Code extension's graph webview (src/webview-graph.ts, build:webview) still uses it, and the PWA no longer imports it. Its MIT notice stays.
  • The Graph and page list update when the wiki changes. A workspace that changed while inactive comes back current. Loading while CE restarts waits instead of erroring.
  • Version 0.14.0.

Tests

  • tests/unit/test_ce_graph_availability.py (3 tests). The test_upload_vault.py and test_procedure_execution_palette.py tests were updated.
  • Node: ceSidebarHeader.test.ts (5), ceHostBridge.test.ts (4), plus the existing embedMount.test.ts: 21/21.
  • tests/unit/test_ce_bundle_freshness.py (4): the Graph is rebuilt for a workspace that changed while inactive, or that lost a page.
  • Playwright: graph-ce-embed.spec.ts (3) against the mock backend. It checks that:
    • Graph is hidden without CE, and the Files uploader still works.
    • The CE sidebar header shows the workspace name and never the raw {{WORKSPACE}}.
    • + opens the upload dialog.
    • The Graph tab mounts.
    • The Procedure and Execution rows are present.
  • CI wiring for the new Node and Playwright tests is in a follow-up workflow patch. The bot token can't push .github/workflows.

Parity gate

See the comment below.

Drop Switchbay's built-in Graph viewer from the PWA. The Graph tab, the
wiki page list and the Zen graph now mount Curiosity Engine's own viewer
through /embed/ce (CEEmbed.create, shared sidebar + canvas session).

- GET /api/settings reports ce_graph {installed, has_wiki}; without CE
  the Graph tab is hidden and graph shortcuts fall back to the Editor,
  with no wiki a placeholder is shown. Files uploader, RAG, Agents and
  Library do not depend on CE.
- proxied_skill_embeds now only picks the Agents surface (okstratr
  observer vs built-in dashboard); Graph ignores it. Settings copy
  renamed "Agents: okstratr observer". No settings migration needed.
- Host shims on the CE embed: page HTML sanitized before CE's modal
  renders it; KaTeX, table -> Sheet/Plot and slideshow in CE's modal;
  CE split panel routed to /api/workspaces/split; Procedure/Execution
  label-type rows; in-place Atlas/Classic switch (no app reload);
  sidebar + keeps opening UploadVaultDialog (/api/upload-vault).
- Keep the {{WORKSPACE}} sidebar-header substitution; factor it into
  ceSidebarHeader.ts with node tests and an e2e check that the header
  shows the workspace name, never the raw placeholder.
- Remove GraphTab, CurationReplay, WikiPane, the fork's edit.js and
  sidebar.js, and their e2e specs. The remaining fork under
  widgets/graph is kept only for the VS Code graph webview.
- Docs: architecture says Graph comes from CE; notices updated.
- Bump to 0.14.0.

Signed-off-by: benjsmith <benjamincharlessmith@gmail.com>
A workspace edited while another was active came back with its old
Graph, because the cached bundle was served as is on retarget. Treat
the bundle as ready only when it is at least as new as wiki/, and count
directory mtimes so deleting or renaming a page triggers a rebuild.

Signed-off-by: benjsmith <benjamincharlessmith@gmail.com>
- On files_changed, wait for CE's data refresh before remounting the
  canvas, re-render the page list and update the counts (the canvas used
  to remount on the old data). The page list refreshes while Graph is
  closed too.
- Wait for the CE viewer to report healthy before loading the embed and
  retry a load that raced a restart; failed script tags are dropped so
  the retry loads them again, and the fetch shim is released.
- Make CE's Sidebar.setActive/setSearchHits safe when the page list
  isn't mounted (Zen), so the node focus after #page= still runs.

Signed-off-by: benjsmith <benjamincharlessmith@gmail.com>
@benjsmith

Copy link
Copy Markdown
Owner Author

Parity gate

Every feature of the old built-in Graph was checked through Curiosity Engine's embedded viewer. The setup was a separate Switch Bay instance with a throwaway home, CE v1.9.2, the ml-walkthrough sample (231 pages, 622 links) and a second workspace. Results are for head d00e228.

Feature How it was checked Result
Sidebar header shows the workspace name Header reads "ml-walkthrough", and the raw {{WORKSPACE}} placeholder never appears on the page. Also covered by node tests and the mocked e2e spec. Pass
Graph availability Settings report CE as installed with a wiki, and the Graph tab mounts CE's viewer. Without CE the tab is hidden and Files upload still works (mocked e2e). Pass
Page and link counts "231 nodes · 622 edges" Pass
Upload The sidebar + opens Switch Bay's upload dialog, and the Files toolbar uploader is still there. Pass
Search "attention" highlights 4 pages, and Escape clears the box. Pass
Type labels and colours The Procedure row toggles (4/14 → 5/14), and the Execution row is present. Pass
Page window Opening a procedure page from its link shows it in CE's page window. Pass
Unsafe page HTML An <img onerror> in a wiki page is stripped before display and never runs. Pass
Maths KaTeX renders inline and display maths. Pass
Table → Sheet Opens the Sheet tab with the table. Pass
Table → Plot Sends the table's 4 rows, with the page as the origin. Pass
Slideshow The slideshow button asks for wiki/procedures/finetune-a-model.md. Pass
Open in Editor The ↗ Editor button is shown for the selected page. Pass
Selection kept across tabs Going to Agents and back reopens the same page. Pass
Escape closes the page window Pass
Note editing Padlock → edit → Save writes wiki/notes/new.md on disk, and the page shows the new text. Pass
Atlas ⇄ Classic The view switches in place, without reloading the app. Pass
Light / dark theme The sidebar and graph colours follow the theme toggle. Pass
Wiki changes A page added on disk appears in the graph (232 nodes) and in the page list without a reload. Pass
Replay and split buttons Both are present. Split goes through Switch Bay's workspace split. Pass
Workspace switching The header shows the other workspace, which shows its own pages (including one added while it was inactive) and none of the first workspace's. Switching back works too. Pass
Zen The graph is shown in Zen, with a + button. Picking a page focuses its node instead of opening the page window. Pass

All 27 checks passed.

Three gaps showed up during the check and are fixed in this PR:

  • Live updates: the graph and page list didn't update when the wiki changed.
  • Stale workspace: a workspace that changed while inactive came back with its old graph. Deleted pages weren't noticed either.
  • CE restarting: loading while Curiosity Engine was restarting ended on an error.

Separately, Zen no longer logs an error when a page is picked.

Not covered here: the VS Code extension's graph view still uses Switch Bay's own copy of the viewer, kept on purpose. It is built in CI.

@benjsmith
benjsmith merged commit 8fa89e7 into main Oct 8, 2026
7 checks passed
@benjsmith
benjsmith deleted the feat/graph-ce-only branch October 12, 2026 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant