Free Code (
|
| Protocol Family | Native Capabilities |
|---|---|
Ollama Native (ollama) |
Local /api/chat NDJSON streaming, /api/tags discovery, custom ports (e.g. 11435), manual model IDs, native tool calls when supported |
OpenAI-Compatible Chat Completions (openai-compatible) |
Configurable base URL & editable base path (prevents /v1/v1/chat/completions), optional API key, SSE streaming, fragmented tool-call assembly, /models discovery, manual model IDs |
Anthropic Messages (anthropic) |
Native /v1/messages, x-api-key + anthropic-version, SSE content_block_* streaming, tool_use & tool_result blocks |
Gemini Native (gemini) |
Native v1beta/models/{model}:streamGenerateContent?alt=sse, x-goog-api-key header auth, functionCall / functionResponse, explicit finishReason & policy block reporting |
See docs/providers.md for concrete setup examples and docs/adding-an-adapter.md for implementing a new protocol family.
Enforced Local-Only Mode
Enable Local-Only in the Free Code sidebar header, via Command Palette (Free Code: Toggle Local-Only Mode), or via freeCode.localOnly.
- Enforced directly in the extension host transport layer (
src/security/transport.ts) across inference, model discovery, connection tests, and redirects. - Allows loopback destinations (
127.0.0.1,localhost,::1). Every resolved IP address is checked before connecting, HTTP redirects are intercepted and validated before following, and direct connections bypass system proxy environment variables (HTTP_PROXY/HTTPS_PROXY) so requests cannot be silently forwarded elsewhere. - Cloud fallback is never performed. If your local model server stops, Free Code displays the connection error and preserves your conversation and draft.
- Private LAN inference servers (RFC1918 / RFC4193) require explicit opt-in (
freeCode.allowLanServersor per-profileAllow LAN) and always display their destination host in the sidebar. - All sidebar webview assets are bundled with the extension (strict CSP, zero remote fonts, scripts, analytics, or external embedding services).
- Important distinction: Local-only mode governs Free Code's own network requests. An approved terminal command runs in your shell and can make its own network requests; Free Code displays this reminder whenever command approval is requested.
Local Windows, WSL, SSH, and Dev Containers
Free Code runs in the VS Code extension host and resolves endpoint URLs from whichever extension host executes the request:
- Local desktop window (Windows / macOS / Linux):
http://127.0.0.1:11434connects to the local machine's loopback interface. Paths with spaces, CRLF line endings, non-ASCII filenames, and PowerShell (powershell.exe/pwsh) are supported natively. - WSL Remote (
Remote - WSL): The extension host runs inside the WSL Linux distro.127.0.0.1resolves inside WSL (in WSL2 mirrored networking mode this reaches Windows loopback; in NAT mode point to the Windows host IP with explicit LAN permission enabled or run Ollama inside WSL). - Remote - SSH: The extension host runs on the remote SSH server.
127.0.0.1reaches services running on the remote server (or forwarded via SSH port forwardingssh -L/-R). - Dev Containers: The extension host runs inside the container.
127.0.0.1resolves to the container itself; to reach an Ollama/LM Studio instance running on the host machine, usehost.docker.internal(with Local-Only disabled and LAN allowed if it resolves to a private IP) or forward the port into the container's loopback.
Modes and Workspace Tools
- Ask (read-only): Answer questions using read-only tools (
read_architecture,list_files,search_text,read_file,read_diagnostics,inspect_git_changes,read_command_result). Write and command tools are strictly blocked by the extension host. - Plan (read-only + editable plan): Inspect files across repositories and draft an editable implementation plan. Click Approve Plan & Switch to Agent when ready.
- Agent: Inspect files, propose exact diffs (
propose_edit), apply approved edits via VS CodeWorkspaceEdit(apply_edit), create/rename/delete files with collision and unsaved-buffer checks, run approved shell commands (run_command) with bounded output and Stop cancellation, and verify results. - Smaller / Text-Only Models: Disable
Supports native tool calling(or rely on automatic fallback) to use<tool_call>file inspection plus the strictfreecode-proposalJSON edit-proposal workflow. Malformed JSON, unknown actions, invalid paths, or ordinary fenced code blocks never execute writes or commands.
Credentials & Privacy
- API keys and sensitive custom headers (
Authorization,X-API-Key, etc.) are stored exclusively in VS Code SecretStorage. - Secrets are stripped from ordinary settings, webview state, Output Channel logs, command output, and exported Markdown chats.
- Zero telemetry by default.
Development: Launching Extension Development Host (F5)
- Install dependencies and build:
npm install npm run build - Open this repository folder in VS Code.
- Press F5 (or run Run Free Code Extension (Extension Development Host) from the Run and Debug view).
- In the Extension Development Host window, open the Free Code (Winged-F) icon in the Activity Bar (or run
Free Code: Open Sidebarfrom the Command Palette) to launch the first-run setup flow.
Manual VSIX Installation
Build the VSIX package:
npm run package
Install the generated .vsix file via the VS Code CLI:
code --install-extension free-code-0.1.0.vsix
Or install manually in VS Code:
- Open the Extensions view (
Ctrl+Shift+X). - Click the
...menu in the top-right corner of the Extensions panel. - Choose Install from VSIX... and select
free-code-0.1.0.vsix. - Reload VS Code if prompted, then click the Free Code icon in the Activity Bar.
Commands (freeCode.*)
freeCode.open— Open SidebarfreeCode.newChat— New ChatfreeCode.configureProvider— Configure ProviderfreeCode.testConnection— Test Provider ConnectionfreeCode.explainSelection— Explain SelectionfreeCode.editSelection— Edit SelectionfreeCode.reviewDiff— Review Pending DifffreeCode.undoLastEdit— Undo Last Agent EditfreeCode.toggleLocalOnly— Toggle Local-Only Mode
Build & Test Scripts
| Script | Purpose |
|---|---|
npm run typecheck |
Strict TypeScript type checking (tsc --noEmit) |
npm run build |
Bundle extension host (dist/extension.js) and webview (dist/webview/main.js, styles.css) via esbuild |
npm run watch |
Watch mode for development |
npm test |
Run typecheck, build, and all deterministic unit & mock-provider E2E tests |
npm run test:integration |
Run VS Code Extension Host integration tests via @vscode/test-electron |
npm run package |
Build and package standalone free-code-0.1.0.vsix without dev dependencies |
Author
Sajjad Hossain — Full-Stack Software Engineer (Dhaka, Bangladesh)
- Email: sajjad19397@gmail.com
- GitHub: github.com/sajjadhossain67
- LinkedIn: linkedin.com/in/sajjad19397
- Portfolio: sajjad-hossain.netlify.app
License
MIT — see LICENSE.