dsagent-vscode is the VS Code extension for DSAgent. It provides chat (native participant + custom panel), session management, variables explorer, artifacts view, notebook sync, and HITL. It connects to a running DSAgent server (dsagent serve, default http://localhost:8000). The extension does not run the agent; it is a client only.
src/— Extension host (TypeScript):extension.ts— Activation: config,DSAgentClient, status bar, chat panel, tree providers, commands.api/client.ts— HTTP/WebSocket client for DSAgent API;api/types.ts— request/response types.providers/—chatViewProvider.ts,chatParticipant.ts,sessionsTreeProvider.ts,variablesTreeProvider.ts,artifactsTreeProvider.ts,notebookController.ts.services/—statusBar.ts,notebookSync.ts.commands/— Command registration and handlers.
webview-ui/— Webview UI (React + Vite): chat input, messages, plan view, code blocks, execution results. Built output inwebview-ui/dist/; extension loads it viawebview-ui/dist/index.html.package.json— Defines commands, views, settings (dsagent.serverUrl,dsagent.apiKey,dsagent.model,dsagent.hitlMode, etc.), chat participant, and activation events.
- Node 18+, npm. VS Code 1.85+ for API compatibility.
- Install:
npm installat repo root;cd webview-ui && npm installfor the webview. - Build:
npm run build— builds webview then extension (esbuild). Ornpm run build:webviewthennode esbuild.js --production. - Dev:
npm run dev— watch extension + webview (concurrently). - Lint:
npm run lint(ESLint onsrc). - Package:
npm run package(vsce) to produce.vsix.
- Extension uses DSAgentClient (
src/api/client.ts) to talk todsagent serve: REST for sessions, chat, kernel, artifacts, HITL; WebSocket for streaming where applicable. - Settings:
dsagent.serverUrl(defaulthttp://localhost:8000),dsagent.apiKey(if server hasDSAGENT_API_KEY). Config changes trigger reconnect inextension.ts. - Keep
src/api/types.tsand client methods aligned with dsagent’s HTTP API (docs/api/http-api.mdin the dsagent repo). Coordinate with dsagent and dsagent-ui when changing API contracts.
- Extension host: TypeScript, VS Code API (
vscode). UseExtensionContext.subscriptionsfor disposables. Avoid blocking the host; do I/O in async/await or event-driven code. - Webview: React in
webview-ui/src/. Build with Vite; extension serveswebview-ui/dist/. Message passing between host and webview viapostMessage/onDidReceiveMessageas in existing providers. - Config: Read with
vscode.workspace.getConfiguration('dsagent'); react to changes withvscode.workspace.onDidChangeConfiguration.
- Use VS Code “Launch Extension” (e.g.
.vscode/launch.json) to run the extension in a Development Host. Ensure dsagent serve is running so the extension can connect. - After changing webview code, rebuild with
npm run build:webviewor usenpm run devfor live rebuild during development.
- Start dsagent serve (from the dsagent project) on port 8000.
- In dsagent-vscode:
npm install, thennpm run buildornpm run dev. - Launch the extension from VS Code (Run and Debug → Launch Extension).
- Open Chat with
@dsagentor “DSAgent: Open Chat”; use Sessions/Variables/Artifacts views. For API or type changes, keep dsagent (and optionally dsagent-ui) in sync.