-
Notifications
You must be signed in to change notification settings - Fork 3.5k
fix(vscode): make the extension's send path work, and close the security holes #5987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Hmbown
wants to merge
2
commits into
main
Choose a base branch
from
pr/vscode-send-path
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+3,704
−371
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "name": "Run Extension", | ||
| "type": "extensionHost", | ||
| "request": "launch", | ||
| "args": ["--extensionDevelopmentPath=${workspaceFolder}"], | ||
| "outFiles": ["${workspaceFolder}/out/**/*.js"], | ||
| "preLaunchTask": "watch" | ||
| }, | ||
| { | ||
| "name": "Extension Tests", | ||
| "type": "node", | ||
| "request": "launch", | ||
| "runtimeArgs": ["--test", "out/test"], | ||
| "cwd": "${workspaceFolder}", | ||
| "outFiles": ["${workspaceFolder}/out/**/*.js"], | ||
| "console": "integratedTerminal", | ||
| "internalConsoleOptions": "neverOpen", | ||
| "preLaunchTask": "compile" | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "version": "2.0.0", | ||
| "tasks": [ | ||
| { | ||
| "label": "watch", | ||
| "detail": "tsc -p ./ --watch — background compile for the Run Extension launch config", | ||
| "type": "shell", | ||
| "command": "npx tsc -p ./ --watch", | ||
| "options": { "cwd": "${workspaceFolder}" }, | ||
| "isBackground": true, | ||
| "problemMatcher": "$tsc-watch", | ||
| "presentation": { "reveal": "never", "panel": "dedicated" }, | ||
| "group": { "kind": "build", "isDefault": true } | ||
| }, | ||
| { | ||
| "label": "compile", | ||
| "detail": "tsc -p ./ — one-shot build into out/", | ||
| "type": "shell", | ||
| "command": "npx tsc -p ./", | ||
| "options": { "cwd": "${workspaceFolder}" }, | ||
| "problemMatcher": "$tsc", | ||
| "presentation": { "reveal": "silent", "panel": "dedicated" }, | ||
| "group": "build" | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,6 @@ | ||||||||
| src/** | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exclude the dev-loop .vscode directory from the packaged VSIX.
Suggested change
|
||||||||
| node_modules/** | ||||||||
| out/test/** | ||||||||
| *.vsix | ||||||||
| tsconfig.json | ||||||||
| package-lock.json | ||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,68 @@ | ||
| # CodeWhale for VS Code | ||
|
|
||
| Official Codewhale extension scaffold for local development. | ||
| Official Codewhale extension: an agentic chat sidebar over the local Engine | ||
| Runtime API, with editor context, streaming turns, approvals, and terminal | ||
| parity. | ||
|
|
||
| This first slice is intentionally small: | ||
| ## What it does | ||
|
|
||
| - open Codewhale in an integrated terminal | ||
| - start `codewhale serve --http` in a visible terminal | ||
| - check a local runtime through `/health` and `/v1/runtime/info` | ||
| - show connection state in the status bar | ||
| - show a read-only Agent View with recent runtime thread summaries from | ||
| `/v1/threads/summary` | ||
| - show recent read-only restore points from `/v1/snapshots` | ||
| - refresh the read-only Agent View automatically so branch/workspace metadata | ||
| catches up while agents are working | ||
| **Chat sidebar** (primary view): | ||
|
|
||
| It does not expose the full chat webview, VS Code Agent View chat/editor | ||
| integration, inline edit application, marketplace publish workflow, or | ||
| retry/undo/snapshot GUI endpoints yet. | ||
| - create, switch, and resume Codewhale threads; every thread stays available | ||
| from the terminal and the embedded browser client | ||
| - stream turns live over the runtime's replayable SSE contract | ||
| (`GET /v1/threads/{id}/events?since_seq=…`) with automatic reconnection | ||
| - attach editor context as chips before sending: current selection, | ||
| active file, or Problems-panel diagnostics | ||
| - resolve tool approvals (allow / deny / remember) and clarification | ||
| questions inline, hydrated from the thread-detail snapshot so a reload | ||
| never strands pending work | ||
| - steer a running turn or stop it | ||
| - render agent replies as a safe Markdown subset; every code block gets | ||
| Copy and Insert-at-cursor actions | ||
| - open changed files from `file_change` items when the runtime includes a path | ||
|
|
||
| ## Local Use | ||
| **Runtime view** (secondary): connection state, recent thread summaries, | ||
| restore points, and the original terminal launch helpers. | ||
|
|
||
| **Connection**: the extension attaches to `codewhale serve --http` on | ||
| `127.0.0.1:7878` by default, starts it in a visible terminal on request, and | ||
| never runs its own agent engine — the runtime is the single turn/event owner. | ||
|
|
||
| ## Security posture | ||
|
|
||
| - Runtime bearer tokens are stored in VS Code SecretStorage via | ||
| **CodeWhale: Set Runtime Token**; the legacy `codewhale.runtimeToken` | ||
| setting still works and is migrated into secret storage on first use. | ||
| - The webview renders with a strict CSP (`default-src 'none'`), and all | ||
| model output is HTML-escaped before any Markdown transform runs; links | ||
| must be http(s). | ||
| - The chat webview script is a static string — no runtime data is | ||
| interpolated into it. | ||
|
|
||
| ## Local use | ||
|
|
||
| ```bash | ||
| npm install | ||
| npm run compile | ||
| npm run package | ||
| code --install-extension codewhale-vscode-0.9.11.vsix | ||
| npm test # compile + unit tests | ||
| npm run package # -> codewhale-vscode-<version>.vsix | ||
| code --install-extension codewhale-vscode-<version>.vsix | ||
| ``` | ||
|
|
||
| Configure `codewhale.commandPath`, `codewhale.runtimeHost`, | ||
| `codewhale.runtimePort`, `codewhale.runtimeToken`, and | ||
| `codewhale.agentViewRefreshIntervalSeconds` from VS Code settings. | ||
| Set the refresh interval to `0` to disable automatic read-only refreshes. | ||
| Settings: `codewhale.commandPath`, `codewhale.runtimeHost`, | ||
| `codewhale.runtimePort`, `codewhale.agentViewRefreshIntervalSeconds` | ||
| (`0` disables automatic refresh). Commands: **CodeWhale: Ask Codewhale** | ||
| (`ctrl+alt+c` from the editor, also on the editor context menu), | ||
| **CodeWhale: New Chat**, **CodeWhale: Set Runtime Token**, | ||
| **CodeWhale: Start Local Runtime**. | ||
|
|
||
| Keep the runtime on `127.0.0.1` unless you deliberately front it with trusted | ||
| local networking controls. | ||
|
|
||
| ## Not yet built | ||
|
|
||
| VS Code-native diff/merge review of agent file changes (blocked on the | ||
| runtime publishing a Files/Changes contract), provider/model switching from | ||
| the composer, retry/undo/restore buttons, and account sign-in surface. The | ||
| runtime's embedded browser client (`codewhale web`) remains the full-feature | ||
| fallback for those flows. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[INFO] Packaged extension includes dev-only .vscode launch/tasks configuration
.vscodeignoreexcludes source and tests but does not exclude.vscode/**.vsce packagewill therefore includelaunch.jsonandtasks.jsonin the VSIX, even though they are only for the local F5 development loop.