返回 CodeWhale
README.md
根目录 / extensions / vscode / README.md
1 # CodeWhale for VS Code
2
3 Official Codewhale extension: an agentic chat sidebar over the local Engine
4 Runtime API, with editor context, streaming turns, approvals, and terminal
5 parity.
6
7 ## What it does
8
9 **Chat sidebar** (primary view):
10
11 - create, switch, and resume Codewhale threads; every thread stays available
12 from the terminal and the embedded browser client
13 - stream turns live over the runtime's replayable SSE contract
14 (`GET /v1/threads/{id}/events?since_seq=…`) with automatic reconnection
15 - attach editor context as chips before sending: current selection,
16 active file, or Problems-panel diagnostics
17 - resolve tool approvals (allow / deny / remember) and clarification
18 questions inline, hydrated from the thread-detail snapshot so a reload
19 never strands pending work
20 - steer a running turn or stop it
21 - render agent replies as a safe Markdown subset; every code block gets
22 Copy and Insert-at-cursor actions
23 - open changed files from `file_change` items when the runtime includes a path
24
25 **Runtime view** (secondary): connection state, recent thread summaries,
26 restore points, and the original terminal launch helpers.
27
28 **Connection**: the extension attaches to `codewhale serve --http` on
29 `127.0.0.1:7878` by default, starts it in a visible terminal on request, and
30 never runs its own agent engine — the runtime is the single turn/event owner.
31
32 Editors that speak the Agent Client Protocol, such as Zed, do not need this
33 extension: see [Use Codewhale from your editor](https://github.com/codewhale-hq/Codewhale/blob/main/docs/ACP.md).
34
35 ## Security posture
36
37 - Runtime bearer tokens are stored in VS Code SecretStorage via
38 **CodeWhale: Set Runtime Token**; the legacy `codewhale.runtimeToken`
39 setting still works and is migrated into secret storage on first use.
40 - The webview renders with a strict CSP (`default-src 'none'`), and all
41 model output is HTML-escaped before any Markdown transform runs; links
42 must be http(s).
43 - The chat webview script is a static string — no runtime data is
44 interpolated into it.
45
46 ## Local use
47
48 ```bash
49 npm install
50 npm test # compile + unit tests
51 npm run package # -> codewhale-vscode-<version>.vsix
52 code --install-extension codewhale-vscode-<version>.vsix
53 ```
54
55 Settings: `codewhale.commandPath`, `codewhale.runtimeHost`,
56 `codewhale.runtimePort`, `codewhale.agentViewRefreshIntervalSeconds`
57 (`0` disables automatic refresh). Commands: **CodeWhale: Ask Codewhale**
58 (`ctrl+alt+c` from the editor, also on the editor context menu),
59 **CodeWhale: New Chat**, **CodeWhale: Set Runtime Token**,
60 **CodeWhale: Start Local Runtime**.
61
62 Keep the runtime on `127.0.0.1` unless you deliberately front it with trusted
63 local networking controls.
64
65 ## Not yet built
66
67 VS Code-native diff/merge review of agent file changes (blocked on the
68 runtime publishing a Files/Changes contract), provider/model switching from
69 the composer, retry/undo/restore buttons, and account sign-in surface. The
70 runtime's embedded browser client (`codewhale web`) remains the full-feature
71 fallback for those flows.
72
72 lines MARKDOWN