mirror of
https://github.com/larsbaunwall/vscode-copilot-bridge.git
synced 2025-10-05 22:22:59 +00:00
- Implements VS Code extension per AGENTS.md specification
- OpenAI-style HTTP facade: POST /v1/chat/completions (SSE), GET /v1/models, GET /healthz
- JSON-RPC WebSocket server with methods: mcp.fs.read/list, mcp.search.code, mcp.symbols.list, mcp.edit.applyPatch, mcp.format.apply, mcp.imports.organize
- Copilot Chat integration via vscode.chat.requestChatAccess('copilot')
- Commands: bridge.enable/disable/status with status bar indicator
- Security: localhost-only binding, optional bearer token, read-only by default
- Policy enforcement via optional .agent-policy.yaml
- Ephemeral port management with globalState persistence
Co-Authored-By: Lars Baunwall <larslb@thinkability.dk>
|
||
|---|---|---|
| .. | ||
| dist | ||
| node_modules | ||
| src | ||
| .vscodeignore | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
Copilot Bridge (OpenAI Facade + JSON-RPC)
Overview
- Runs inside VS Code Desktop.
- Exposes an OpenAI-style HTTP API and a JSON-RPC WebSocket tool bus.
- Uses Copilot Chat via the VS Code Chat API per request.
Endpoints
- HTTP (OpenAI-like), bind to 127.0.0.1 by default:
- POST /v1/chat/completions (SSE)
- GET /v1/models
- GET /healthz
JSON-RPC (WebSocket)
- Methods:
- mcp.fs.read { path }
- mcp.fs.list { glob, limit }
- mcp.search.code { query, glob, maxResults }
- mcp.symbols.list { path }
- mcp.edit.applyPatch { unifiedDiff, verify? }
- mcp.format.apply { path }
- mcp.imports.organize { path }
Commands
- Copilot Bridge: Enable
- Copilot Bridge: Disable
- Copilot Bridge: Status
Settings
- bridge.enabled (false)
- bridge.bindAddress ("127.0.0.1")
- bridge.openai.port (0 random)
- bridge.rpc.port (0 random)
- bridge.token ("")
- bridge.readOnly (true)
- bridge.history.maxTurns (3)
Example curl curl -N -H "Content-Type: application/json" -d '{"model":"gpt-4o-copilot","stream":true,"messages":[{"role":"user","content":"hello"}]}' http://127.0.0.1:PORT/v1/chat/completions
Policy
- Optional .agent-policy.yaml at workspace root to allow/deny writes and shell.
- Writes are denied by default unless bridge.readOnly=false and policy allows.