Skip to content

IDE: webviews for VS Code extensions, and the Code-XR extension running inside the IDE (#261 part 2, #262) - #295

Merged
aMonteSl merged 2 commits into
idefrom
claude/project-thread-keii8k
Nov 27, 2026
Merged

aMonteSl merged 2 commits into
idefrom
claude/project-thread-keii8k

Conversation

@aMonteSl

@aMonteSl aMonteSl commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Adrián · project thread

Finishes #261 (part 1 was #294) and does #262 (epic #251).

Webviews (#261)

  • window.createWebviewPanel opens an editor tab; registerWebviewViewProvider fills a contributed view of type: "webview" the first time it is shown.
  • Each webview is a sandboxed <iframe> on its own origin codexr-webview://<32 random hex>/, served by the main process (webviewRegistry.ts + webviewServer.ts) with VS Code's default styles and a bootstrap: acquireVsCodeApi() (postMessage, getState, setState), --vscode-* theme variables and vscode-light/dark body class updated live, workbench shortcuts forwarded.
  • asWebviewUri serves files only from localResourceRoots (links followed); command: links run only as enableCommandUris allows (checked again in main); http(s)/mailto open outside through the usual consent.
  • Frames live in one layer over the workbench, laid over their slot, so hidden tabs and rebuilt views never reload the page.
  • Security: frames get no preload (no window.codexr), no popups, no top navigation, no permission; workbench CSP frame-src codexr-webview: only; the workbench's own webview frames cannot navigate off that scheme, while a frame a webview embeds itself (a local server) may.

Code-XR inside the IDE (#262)

  • The Code-XR .vsix installs from file and runs unchanged: container and full tree, Python environment, LivePanel analyses (browser or webview panel with the local server), XR analyses, servers, examples. No missing API at start-up.
  • apps/ide/scripts/vsixE2e.mjs (Playwright against the built IDE) + new CI job Code-XR extension in the IDE on the .vsix the package job builds.
  • Known gaps documented in docs/ide/extensions.md (XR scene in a webview needs the CDNs; no WebXR permission in webviews; ViewColumn.Beside).

Testing

  • npm test in apps/ide: 856 tests, typecheck and lint clean; new test/extensionWebviews.test.ts (protocol, event checks, resource rules incl. encoded .., links out of a root and other windows' webviews, CSP, a real host with a panel, messages, view state, a webview view).
  • npm run ide:smoke passes.
  • In Electron with a sample extension: messages both ways, setState, an allowed and a refused command: link, popup blocked, 404 outside the roots, no window.codexr, parent unreachable, frame kept across tab switches, live theme change, webview view in its own container. With the Code-XR .vsix: the tree, the Python env, a LivePanel in a webview panel.

- window.createWebviewPanel opens an editor tab, registerWebviewViewProvider
  fills a contributed view of type webview (activating onView first)
- Each webview is a sandboxed iframe on its own origin
  codexr-webview://<random id>/, served by the main process with VS Code's
  default styles and a bootstrap: acquireVsCodeApi (postMessage, getState,
  setState), --vscode-* theme variables updated live, workbench shortcuts
- asWebviewUri files only from localResourceRoots (links followed); command:
  links only as enableCommandUris allows, checked in the main process;
  http(s)/mailto open outside; frame navigation off the scheme is blocked
- Frames live in one layer over the workbench and keep running while their
  tab or view is hidden
- CSP frame-src codexr-webview: only
)

- The Code-XR .vsix installs from file and runs unchanged: its container
  and tree, Python environment, LivePanel (browser or webview panel), XR
  analyses, servers and examples
- apps/ide/scripts/vsixE2e.mjs: Playwright installs the .vsix in the built
  IDE and checks activation, the tree and that no API is missing
- CI job 'Code-XR extension in the IDE' runs it on the package job's .vsix
- Known gaps documented in docs/ide/extensions.md
@aMonteSl aMonteSl self-assigned this Nov 27, 2026
@aMonteSl
aMonteSl merged commit 073cbbf into ide Nov 27, 2026
12 checks passed
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.

2 participants