Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/vscode/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.vscode/**
node_modules/**
src/**
tsconfig.json
vite.config.*
*.test.*
47 changes: 47 additions & 0 deletions apps/vscode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# T3 Code for VS Code

![T3 Code in VS Code](media/screenshot.jpg)

This package exposes T3 Code as a dedicated VS Code secondary-sidebar chat tab, alongside the
Claude Code, Chat, and Codex tabs. It connects directly to the same T3 Code server used by the web,
desktop, and mobile clients, so projects, threads, messages, turn state, and assistant streaming
remain synchronized. It also provides an optional native `@t3` participant inside VS Code Chat.

## Development

1. Start T3 Code (`pnpm dev`), which listens at `http://127.0.0.1:3773` by default.
2. Build the extension with `pnpm --filter t3-code build`.
3. Open this repository in VS Code, choose **Run Extension** from the Run and Debug view, and point
the extension-development host at `apps/vscode` if prompted.
4. Select the **T3 Code** tab in the secondary sidebar. Use **T3 Code: Open Chat** from the Command
Palette if the secondary sidebar is hidden.

The extension first uses the backend advertised by the T3 Desktop runtime beside its extension
host. This works independently in local, SSH, and other remote windows and avoids treating a
synced `127.0.0.1` setting as the same machine. For a fallback backend, set `t3Code.serverUrl`.
Remote servers can use **T3 Code: Set Server Bearer Token**; the token is stored in VS Code secret
storage and exchanged for a short-lived WebSocket ticket.

## Dedicated chat workflow

The T3 Code tab contains a worktree-scoped thread picker, synchronized transcript, context control,
and prompt composer. Select a thread to continue it on any T3 client, or use **+** to create one for
the open worktree. Enter sends; Shift+Enter inserts a newline.

The same operations are also available through the optional native Chat participant:

- `@t3 /threads` selects an existing thread whose worktree matches the open workspace folder.
- `@t3 /new` creates a synchronized thread (and a project when the folder is not registered yet).
- A normal `@t3` prompt continues the last selected thread, or the most recently updated matching
thread. If none exists, it creates one.
- `@t3 /history`, `/status`, and `/stop` inspect or control the selected server thread.

Active editor context is included by default and can be toggled from the composer, with
`@t3 /context`, or **T3 Code: Toggle Automatic Editor Context**. This preference is kept in VS Code's
extension state and never written to workspace settings. A non-empty
selection includes the exact character range; an empty selection includes the cursor line and
column. Explicit Chat references such as `#file` and attached selections are always included.

The **T3 Code: Ask About Selection** editor action opens Chat with `@t3` prefilled. Context is sent
as structured-looking provider context using workspace-relative paths and language-aware Markdown
fences. T3 Code clients present that envelope as a context reference rather than authored text.
Binary file added apps/vscode/media/screenshot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions apps/vscode/media/t3-code.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
203 changes: 203 additions & 0 deletions apps/vscode/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
{
"name": "t3-code",
"displayName": "T3 Code",
"version": "0.0.37",
"private": true,
"description": "A dedicated VS Code chat client for synchronized T3 Code threads.",
"categories": [
"AI",
"Chat",
"Other"
],
"publisher": "t3code",
"type": "module",
"main": "./dist/extension.cjs",
"scripts": {
"build": "esbuild src/extension.ts --bundle --platform=node --format=cjs --target=node20 --external:vscode --outfile=dist/extension.cjs && esbuild src/webview.ts --bundle --platform=browser --format=iife --target=es2022 --outfile=dist/webview.js",
"typecheck": "tsgo --noEmit",
"test": "vp test run"
},
"dependencies": {
Comment thread
patroza marked this conversation as resolved.
"@t3tools/client-runtime": "workspace:*",
"@t3tools/contracts": "workspace:*",
"@t3tools/shared": "workspace:*",
"dompurify": "^3.2.6",
"effect": "catalog:",
"marked": "^15.0.12"
},
"devDependencies": {
"@types/vscode": "1.95.0",
"esbuild": "^0.28.0",
"vite-plus": "catalog:"
},
"contributes": {
"viewsContainers": {
"activitybar": [
{
"id": "t3CodeViewContainer",
"title": "T3 Code",
"icon": "media/t3-code.svg",
"when": "t3Code.useActivityBar"
}
],
"secondarySidebar": [
{
"id": "t3CodeSecondaryViewContainer",
"title": "T3 Code",
"icon": "media/t3-code.svg",
"when": "!t3Code.useActivityBar"
}
]
},
"views": {
"t3CodeViewContainer": [
{
"id": "t3Code.chatView",
"type": "webview",
"name": "T3 Code",
"when": "t3Code.useActivityBar"
}
],
"t3CodeSecondaryViewContainer": [
{
"id": "t3Code.chatViewSecondary",
"type": "webview",
"name": "T3 Code",
"when": "!t3Code.useActivityBar"
}
]
},
"chatParticipants": [
{
"id": "t3-code.chat",
"name": "t3",
"fullName": "T3 Code",
"description": "Work with synchronized Codex, Claude, Cursor, Grok, and OpenCode threads.",
"isSticky": true,
"commands": [
{
"name": "new",
"description": "Create a thread for this worktree"
},
{
"name": "threads",
"description": "Choose a thread for this worktree"
},
{
"name": "history",
"description": "Show the synchronized thread history"
},
{
"name": "context",
"description": "Toggle automatic editor context"
},
{
"name": "stop",
"description": "Interrupt the active turn"
},
{
"name": "status",
"description": "Show connection and thread status"
}
]
}
],
"commands": [
{
"command": "t3Code.newThread",
"title": "T3 Code: New Thread for Worktree",
"category": "T3 Code"
},
{
"command": "t3Code.selectThread",
"title": "T3 Code: Select Worktree Thread",
"category": "T3 Code"
},
{
"command": "t3Code.askSelection",
"title": "T3 Code: Ask About Selection",
"category": "T3 Code",
"icon": "$(comment-discussion)"
},
{
"command": "t3Code.toggleEditorContext",
"title": "T3 Code: Toggle Automatic Editor Context",
"category": "T3 Code"
},
{
"command": "t3Code.showDiagnostics",
"title": "T3 Code: Show Diagnostics",
"category": "T3 Code"
},
{
"command": "t3Code.setBearerToken",
"title": "T3 Code: Set Server Bearer Token",
"category": "T3 Code"
},
{
"command": "t3Code.clearBearerToken",
"title": "T3 Code: Clear Server Bearer Token",
"category": "T3 Code"
},
{
"command": "t3Code.openChat",
"title": "T3 Code: Open Chat",
"category": "T3 Code"
}
],
"menus": {
"editor/context": [
{
"command": "t3Code.askSelection",
"group": "navigation@90",
"when": "editorHasSelection"
}
]
},
"configuration": {
"title": "T3 Code",
"properties": {
"t3Code.serverUrl": {
"type": "string",
"scope": "machine",
"default": "http://127.0.0.1:3773",
"description": "Fallback T3 Code server HTTP URL when no local T3 Desktop runtime is advertised. WebSocket and environment endpoints are derived from it."
},
"t3Code.defaultRuntimeMode": {
"type": "string",
"enum": [
"approval-required",
"auto-accept-edits",
"full-access"
],
"default": "full-access",
"description": "Runtime mode for new T3 Code threads."
},
"t3Code.desktopClientSettingsPath": {
"type": "string",
"default": "",
"description": "Optional path to T3 Desktop's client-settings.json for sharing provider and model favorites. The default auto-detects ~/.t3/userdata or ~/.t3/dev."
}
}
}
},
"activationEvents": [
"onChatParticipant:t3-code.chat",
"onCommand:t3Code.askSelection",
"onCommand:t3Code.clearBearerToken",
"onCommand:t3Code.newThread",
"onCommand:t3Code.openChat",
"onCommand:t3Code.selectThread",
"onCommand:t3Code.setBearerToken",
"onCommand:t3Code.showDiagnostics",
"onCommand:t3Code.toggleEditorContext",
"onView:t3Code.chatView",
"onView:t3Code.chatViewSecondary"
],
"extensionKind": [
"workspace"
],
"engines": {
"vscode": "^1.95.0"
}
}
Loading
Loading