Repository navigation
Conversation
There was a problem hiding this comment.
I couldn't verify the sidebar end to end. VS Code isn't available here, and starting the background server from source in this sandbox failed for a setup reason unrelated to this PR. What passed: packages/app and packages/vscode-webview type-check (tsc -b), the webview build writes to sdks/vscode/dist/webview, check-types and lint pass in sdks/vscode, and machine.test.ts passes. In the code, opencode service start and opencode service get password exist on dev and print the URL and password the extension expects. Everything new in the app checks capabilities (project, openSettings, omitPlugins, fonts) that only the ide platform sets, so web and desktop should behave as before. The security setup looks reasonable: the proxy only forwards to the server's origin and the password stays in the extension; the asset server listens only on 127.0.0.1, serves files only from dist/webview and answers only GET; the CSP gets a new nonce on each render.
Public API: the plugin API's App.platform changes from "web" | "desktop" to "web" | "desktop" | "ide". Existing plugins keep compiling, but code that assumes "not web means desktop" will treat the IDE as desktop, so this needs a release note. VS Code settings (opencode.*), the opencode.openSettings command and the engines.vscode bump to ^1.106.0 are additions to the extension and break nothing, though users on VS Code below 1.106 won't get updates of the extension. No HTTP, SDK or CLI changes.
Two things worth fixing:
sdks/vscode/package-lock.json(3,300 lines) adds a second lockfile next to the existingsdks/vscode/bun.lock. Please remove it.- The gui-plugins submenu
overlapchange and the removed eslintsemirule are outside this feature. Please mention them in the description or split them out.
The remote-window notice and the palette's project filtering are untested, as you noted. A screenshot of the palette in a project with sessions from other projects would help.
sdks/vscode/package-lock.json:1: This adds an npm lockfile next to the existingsdks/vscode/bun.lock. The extension is installed and built with bun, so the two will drift apart. Please remove this file.
There was a problem hiding this comment.
Thanks for the update. The extra sdks/vscode/package-lock.json is gone, which addresses my earlier lockfile point.
The new-session changes are redone cleanly on top of the latest dev: a fixed project now has no projects step to go back to, from either the worktrees step or the new branches step, and the updated test covers both. packages/app and packages/vscode-webview type-check (tsc -b) and the location machine tests pass. I still couldn't run the sidebar itself, because there's no VS Code here.
The plugin API change is the same as before: App.platform gains "ide", so the release-note thread stays open.
Nothing new to flag in these commits.
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Totally your call, but this could be a good time to publish a new VS Code extension under the Anomaly publisher ID. You could then get Anomaly verified as a publisher, so people installing it know it’s the official one. It might also be worth using the pre-release channel to test new changes before they go out to everyone. |
There was a problem hiding this comment.
The only new commit is a merge of dev. It doesn't change this PR's own diff. packages/app and packages/vscode-webview still type-check (tsc -b), and the location machine tests pass. I still couldn't run the sidebar itself, because VS Code isn't available here. The public API impact is unchanged: App.platform gains "ide", and the description now has a note about it. Nothing new to flag.
feat(vscode): open the app in VS Code's secondary sidebar
Issue for this PR
Closes #11176
Type of change
What does this PR do?
The VS Code extension gets an OpenCode view in the secondary sidebar that runs the real app (
packages/app), not a copy. It works in the folder open in that window and talks to the same background server the TUI and desktop app share.Extension (
sdks/vscode)sidebar.tsfinds or starts the background server withopencode service startand reads its password withopencode service get password.dist/webviewread-only on a localhost port for them. Paths aren't decoded, and anything outside the folder gets a 404.opencode.*), which the webview picks up as they change. Reduce motion followsworkbench.reduceMotion, and the fonts follow VS Code's.engines.vscodeis now^1.106.0, for the secondary sidebar view container.Webview (
packages/vscode-webview)A small Vite entry that builds the app into
sdks/vscode/dist/webview. It contains the platform object, the message bridge, the worker shim and settings sync.App
The
Platformunion gets anidevariant for editor extensions.App code never checks for
ide. What an editor does differently comes from optional capabilities on the platform:project: the folder the app is locked toopenSettingsomitPluginsfontswindowIDAnother editor's extension would get the same behavior without changing the app.
When
projectis set:Settings links go to the host's settings.
The terminal and updater plugins are left out in the editor: VS Code has its own terminal, and the marketplace updates the extension.
Window-scoped storage uses the workspace folder as its window ID, so each VS Code window keeps its own tabs.
The error page says "Reload" outside desktop.
Other
App.platformgains"ide". This is a public API change and needs a release note.No feature flag. Everything new in the app only runs when the host sets
platform.project, which only the IDE platform does, so web and desktop behave as before. The extension ships separately through its ownvscode-v*tags.Not covered yet
sdks/vscodeisn't part ofbun run check, so CI doesn't type-check or lint it.Note
This adds "ide" to a public plugin API type. Existing plugins still compile, but a plugin that checks platform === "web" and treats everything else as desktop will now take the desktop path inside VS Code.
How did you verify your code works?
bun run checkpasses for the whole repo (35 tasks).bun typecheckpasses inpackages/vscode-webview.bun run compileinsdks/vscodepasses: type check, lint, webview build and esbuild...paths.Screenshots / recordings
Checklist
Added by the opencode bot (AI-generated).
Public API: plugin API: App.platform gains "ide" ("web" | "desktop" → "web" | "desktop" | "ide"); compiles for existing plugins, but code that treats "not web" as desktop needs a check