Skip to content

Conversation

@konard
Copy link
Contributor

@konard konard commented Oct 30, 2025

Summary

This PR implements a complete VS Code extension that brings Deep Assistant AI capabilities directly into Visual Studio Code, with full support for web-based editors like github.dev and vscode.dev.

Key Features

Web Extension Support - Works seamlessly on github.dev and vscode.dev in the browser
Integrated Chat Interface - Beautiful chat panel in VS Code sidebar with VS Code theming
Multiple AI Models - Support for GPT-4o, Claude, DeepSeek, o1-preview, and more
API Integration - Connects to Deep Assistant API Gateway with token-based auth
Energy Tracking - Shows token usage and energy consumption
Dual Build - Separate bundles for desktop (Node.js) and web (WebWorker)

Implementation Details

Architecture

The extension follows VS Code's web extension guidelines:

  • Desktop Entry: src/extension.tsdist/extension.js (Node.js target)
  • Web Entry: src/web/extension.tsdist/web/extension.js (WebWorker target)
  • Shared Code: apiClient.ts and chatViewProvider.ts work in both environments

API Integration

Integrates with the api-gateway:

  • Uses /v1/chat/completions endpoint (OpenAI-compatible)
  • Bearer token authentication
  • Support for streaming and non-streaming responses
  • Error handling for 401 (invalid token) and 429 (insufficient balance)

File Structure

├── src/
│   ├── extension.ts           # Desktop extension entry
│   ├── web/
│   │   └── extension.ts       # Web extension entry
│   ├── apiClient.ts           # API integration layer
│   └── chatViewProvider.ts    # Chat UI with webview
├── dist/                      # Webpack output (gitignored for dev, needed for packaging)
│   ├── extension.js           # Desktop bundle
│   └── web/
│       └── extension.js       # Web bundle
├── resources/
│   └── icon.svg               # Extension icon
├── package.json               # Extension manifest
├── webpack.config.js          # Dual build config
├── tsconfig.json              # TypeScript config
├── .vscodeignore              # Extension packaging rules
└── EXTENSION_README.md        # User documentation

Commands

  • deepAssistant.chat - Open chat panel
  • deepAssistant.clearChat - Clear conversation history
  • deepAssistant.selectModel - Choose AI model
  • deepAssistant.showSettings - Open extension settings

Configuration

Users can configure:

  • deepAssistant.apiBaseUrl - API Gateway URL
  • deepAssistant.apiToken - Authentication token
  • deepAssistant.defaultModel - Preferred AI model
  • deepAssistant.systemMessage - Custom system prompt
  • deepAssistant.showTokenUsage - Display energy usage

Technical Highlights

  1. Web-Compatible HTTP - Uses Fetch API instead of Node.js http/https
  2. Webpack Bundling - Single-file bundles required for web extensions
  3. TypeScript Strict Mode - Type-safe code with full IDE support
  4. VS Code Theming - Webview uses CSS variables for consistent styling
  5. Responsive UI - Chat interface adapts to VS Code theme changes

Testing Instructions

Local Testing (Desktop)

# Install dependencies
npm install

# Compile extension
npm run compile

# Press F5 in VS Code to launch Extension Development Host

Web Testing (github.dev simulation)

# Compile web extension
npm run compile-web

# Test in browser
npx @vscode/test-web --browserType=chromium --extensionDevelopmentPath=.

Real github.dev Testing

  1. Build the extension: npm run package-web
  2. Serve over HTTPS: npx serve --cors -l 5000 --ssl-cert cert.pem --ssl-key key.pem
  3. Open any repo on github.dev
  4. Run: "Developer: Install Extension From Location..."
  5. Enter: https://localhost:5000

Future Enhancements

  • Streaming response support
  • Code snippet insertion from chat
  • File context sharing with AI
  • Conversation history persistence
  • Voice input/output integration
  • Image generation commands

Documentation

Fixes

Closes #26


🤖 This PR was created with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: undefined
@konard konard self-assigned this Oct 30, 2025
This commit implements a complete VS Code extension that integrates with
the Deep Assistant API Gateway, enabling AI assistance directly in VS Code
including web-based editors like github.dev and vscode.dev.

Features:
- Full web extension support for github.dev and vscode.dev
- Integrated chat interface in VS Code sidebar
- Support for multiple AI models (GPT-4o, Claude, DeepSeek, etc.)
- Token-based authentication and energy tracking
- Commands for chat, model selection, and settings
- Dual build configuration (desktop and web)

Technical implementation:
- TypeScript with strict mode
- Webpack bundling for both Node.js and WebWorker targets
- VS Code Webview API for chat interface
- Fetch API for web-compatible HTTP requests
- Configuration-based API endpoint and token management

Files added:
- package.json: Extension manifest with contributions
- src/extension.ts: Desktop extension entry point
- src/web/extension.ts: Web extension entry point
- src/apiClient.ts: API integration layer
- src/chatViewProvider.ts: Chat UI implementation
- webpack.config.js: Build configuration for both targets
- tsconfig.json, .eslintrc.json, .prettierrc.json: Development configs
- .vscodeignore: Extension packaging rules
- resources/icon.svg: Extension icon
- EXTENSION_README.md: Comprehensive documentation

Fixes #26

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] VS Code extension with support for Visual Studio Code web VS Code extension with support for Visual Studio Code web (github.dev, vscode.dev) Oct 30, 2025
@konard konard marked this pull request as ready for review October 30, 2025 05:23
@konard
Copy link
Contributor Author

konard commented Oct 30, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

📎 Log file uploaded as GitHub Gist (327KB)
🔗 View complete solution draft log


Now working session is ended, feel free to review and add any feedback on the solution draft.

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.

VS Code extension with support for Visual Studio Code web

2 participants