forked from pingdotgg/t3code
-
Notifications
You must be signed in to change notification settings - Fork 0
feat(vscode): add T3 Code VS Code extension #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
patroza
wants to merge
1
commit into
main
Choose a base branch
from
t3code/vscode-extension-pr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| .vscode/** | ||
| node_modules/** | ||
| src/** | ||
| tsconfig.json | ||
| vite.config.* | ||
| *.test.* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # T3 Code for VS Code | ||
|
|
||
|  | ||
|
|
||
| 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. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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": { | ||
| "@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" | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.