My_AI Relay — VS Code Extension
English · Français
Chat with your self-hosted My_AI assistant from VS Code,
over an end-to-end encrypted tunnel, with full workspace awareness.
The extension is a remote client. All inference, file processing, code
generation, and history live on the PC that hosts My_AI — VS Code only
sends prompts and renders replies through the encrypted Relay tunnel. This
means you can run the heavy LLM on a powerful desktop at home and connect to
it from any laptop, anywhere, with full reverse parity to the existing mobile
web UI.
Highlights
- 🔐 End-to-end encryption — AES-256-GCM over the public tunnel. The
Cloudflare/serveo/localhost.run server only ever sees ciphertext.
- 🌐 Multi-tunnel failover — cloudflared, serveo, and localhost.run run in
parallel on the host; the extension picks the first reachable one and falls
over automatically when one drops.
- 💾 Persistent connection — credentials stay encrypted in VS Code
SecretStorage. The extension reconnects automatically when the host Relay
comes back online, and disconnects when it shuts down.
- 🖼️ Same chat as mobile — UI, history, streaming, attachments, and
resume-on-reconnect behave exactly like the existing mobile Relay.
- 🧩 Workspace integration
- Auto-attach the active editor file to every message (toggle).
- "Send selection to My_AI" (Command Palette and editor context menu).
- "Send active file to My_AI".
- One-click Insert at cursor / Copy on every code block in replies.
Requirements
- VS Code ≥ 1.85.
- A My_AI host PC running the Relay (any machine where you can launch
My_AI). The Relay button is in the GUI's left sidebar.
- An Internet connection on both ends (the encrypted tunnel goes
through Cloudflare / serveo / localhost.run).
Quick start
1. Start the Relay on the host PC
- Launch My_AI on the PC where the model runs.
- Click the Relay button at the top-left of the sidebar.
- Wait until at least one tunnel is "active" (status turns green).
2. Copy the connection string
In the same Relay popup, click 🧩 Copier pour l'extension VS Code.
The string copied looks like:
https://gonicolas12.github.io/My_AI/router.html#d=…
It contains the list of public tunnels, the auth token, and the AES-256-GCM
key — all in the URL fragment, so nothing leaks to the tunnel server. Treat
it like a password.
3. Connect from VS Code
- Install the My_AI Relay extension.
- Open the My_AI Relay view in the Activity Bar (the small assistant
icon, by default on the left). On first activation the extension will
ask if you want to move the chat to the Secondary Side Bar (right
side, like GitHub Copilot Chat) — accept and VS Code will remember the
placement.
- Click Paste connection string… (or run My_AI Relay: Connect from the
Command Palette) and paste the string from step 2.
The chat is now live. The same conversation is visible on the host's GUI and
on any mobile that has scanned the QR code.
Tip — moving the chat later. VS Code's extension API only allows
custom views to be contributed to the Activity Bar or Panel; the
Secondary Side Bar is reserved for user-driven layout. If you missed the
initial prompt, run My_AI Relay: Move Chat to Secondary Side Bar from
the Command Palette, or right-click the My_AI Relay icon → "Move To" →
"Secondary Side Bar".
Workspace features
- Auto-attach active file — toggle in the chat header. Every message you
send will silently upload the currently active editor file before delivery.
Useful when you want the model to keep up with what you're working on.
- Send selection — Command Palette → My_AI Relay: Send Selection to
My_AI, or right-click in the editor. Fences the selection with the
current language for clean rendering.
- Send active file — Command Palette → My_AI Relay: Send Active File to
My_AI. Uploads the whole file as an attachment (PDF, DOCX, code, image…).
- Insert at cursor / Copy — every code block in an AI reply gets these
two buttons on hover.
Commands
| Command |
Description |
My_AI Relay: Connect |
Paste a connection string and start a session. |
My_AI Relay: Disconnect |
Close the current session (keeps credentials). |
My_AI Relay: Forget Saved Connection |
Delete credentials from SecretStorage. |
My_AI Relay: Send Selection to My_AI |
Send the editor selection as a message. |
My_AI Relay: Send Active File to My_AI |
Upload and send the current file. |
My_AI Relay: Toggle Auto-Attach Active File |
Toggle the auto-attach feature. |
My_AI Relay: Open Chat View |
Reveal the chat panel. |
Settings
| Setting |
Default |
Description |
myaiRelay.healthCheckIntervalSeconds |
10 |
Polling interval for tunnel health. |
myaiRelay.autoReconnect |
true |
Reconnect automatically when the host Relay restarts. |
myaiRelay.requestTimeoutSeconds |
15 |
Per-request HTTP timeout. |
Security model
- The connection string contains the AES key. Anyone with it can decrypt
every message of that Relay session. Don't share it.
- Credentials are persisted in VS Code's
SecretStorage
— encrypted by the OS keychain, scoped per machine + user.
- The tunnel server (Cloudflare / serveo / localhost.run) sees ciphertext
only. The IP of your host PC is hidden behind the tunnel.
- Stopping the Relay on the host PC invalidates the encryption key and the
tunnels. The extension detects this within ~30 s and shows "offline".
Troubleshooting
- "No tunnel reachable" — the host PC is offline, the Relay was stopped,
or your local network blocks all three providers. Try restarting the Relay.
- "E2EE decrypt failed" — the connection string is from a previous Relay
session (the AES key is regenerated on every Relay start). Copy a fresh
string and reconnect.
- Health check too sensitive — raise
myaiRelay.healthCheckIntervalSeconds if you have a flaky link.
Development
cd vscode_extension
npm install
npm run watch # esbuild in watch mode
# Press F5 in VS Code to launch an extension host
Package a VSIX:
npm run package
License
MIT © gonicolas12