Skip to content

Commit 7ef46d9

Browse files
Merge branch 'main' into factory/issue-7212-a1794473966
2 parents 7c843d9 + 65c0195 commit 7ef46d9

280 files changed

Lines changed: 10052 additions & 1595 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/readme/hero.webp‎

142 KB
Loading

‎README.md‎

Lines changed: 67 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,153 +1,108 @@
1-
# T3 Code
1+
<p align="center">
2+
<a href="https://t3.codes">
3+
<img src="./assets/prod/t3-black-web-icon-192x192.png" width="80" height="80" alt="T3 Code logo" />
4+
</a>
5+
</p>
26

3-
T3 Code is an "agent harness control surface". It enables control of the agents on your machine with a best-in-class mobile app ([iOS](https://apps.apple.com/us/app/t3-code-remote-claude-more/id6787819824), [Android](https://play.google.com/store/apps/details?id=com.t3tools.t3code)), [web app](https://app.t3.codes) and [Electron-based desktop app](https://t3.codes).
7+
<h1 align="center">T3 Code</h1>
48

5-
Works with your subscriptions on Claude Code, Codex, Cursor, Grok Build, OpenCode, Google Antigravity, and fx. If they're set up on your computer, T3 Code can control them.
9+
<p align="center">The open-source control plane for coding agents.</p>
610

7-
## "Wait, what are you selling me?"
8-
9-
Nothing. We built T3 Code because we wanted the best possible development experience with agents. We were inspired by existing solutions like the Codex desktop app, Conductor, Claude Desktop and Cursor Glass, but none met our bar.
11+
<p align="center">
12+
<a href="https://t3.codes/download"><strong>Download</strong></a> ·
13+
<a href="https://apps.apple.com/us/app/t3-code-remote-claude-more/id6787819824">iOS</a> ·
14+
<a href="https://play.google.com/store/apps/details?id=com.t3tools.t3code">Android</a> ·
15+
<a href="https://app.t3.codes">Web</a> ·
16+
<a href="./docs/README.md">Docs</a> ·
17+
<a href="https://discord.gg/jn4EGJjrvv">Discord</a>
18+
</p>
1019

11-
We wanted something performant, remote-ready, and truly open. If we ever go the wrong direction, we want you to have everything you need to fork and build the editor that you want.
20+
<p align="center">
21+
<a href="https://t3.codes">
22+
<img src="./.github/readme/hero.webp" width="100%" alt="T3 Code on desktop with a finished Claude thread, next to the phone app asking to approve a command from Codex" />
23+
</a>
24+
</p>
1225

13-
## Installation
26+
T3 Code runs the coding agents on your machine and gives them one fast interface. Start a thread at your desk, then approve the next step from your phone.
1427

15-
> [!WARNING]
16-
> T3 Code currently supports Codex, Claude, Cursor, Grok Build, OpenCode, Antigravity, and fx. Install and authenticate at least one provider before use:
17-
>
18-
> - Codex: install [Codex CLI](https://developers.openai.com/codex/cli) and run `codex login`
19-
> - Claude: install [Claude Code](https://claude.com/product/claude-code) and run `claude auth login`
20-
> - Cursor: install [Cursor CLI](https://cursor.com/cli) and run `agent login`
21-
> - Grok Build: install [Grok Build CLI](https://x.ai/cli) and run `grok login`
22-
> - OpenCode: install [OpenCode](https://opencode.ai) and run `opencode auth login`
23-
> - Antigravity: enable it in Settings, then use **Install Antigravity** and **Sign in with Google**. No CLI is required.
24-
> - fx: install [fx](https://fx.sh) and run `fx login` on the machine running the T3 Code server ([setup guide](./docs/user/providers-fx.md))
28+
It works with Claude Code, Codex, Cursor, OpenCode, Grok Build, Antigravity, Kiro, Pi, Muse Code, fx, and any [ACP](./docs/user/providers-acp.md) agent. If an agent is set up on your computer, T3 Code can control it.
2529

26-
### Command line
30+
## What you get
2731

28-
```bash
29-
curl -fsSL https://t3.codes/install.sh | sh
30-
```
32+
- **Your subscriptions.** T3 Code does not resell tokens. It drives the agents you are already signed in to.
33+
- **Every agent in one place.** Change models in the middle of a thread. Let Claude hand a task to Codex.
34+
- **Desktop, web, and phone.** One server, and every client shows the same threads. There are apps for iOS and Android.
35+
- **Remote ready.** Run agents on any machine. Connect over your local network, Tailscale, or [T3 Connect](./docs/user/remote-access.md).
36+
- **Git built in.** Each thread can work in its own worktree. Review the diff, then commit, push, and open a pull request with one button.
37+
- **Fast.** Performance is a feature here. We measure it, and we treat a dropped frame as a bug.
38+
- **Open.** MIT licensed. If you don't like something, fork it.
3139

32-
On Windows, in PowerShell:
33-
34-
```powershell
35-
irm https://t3.codes/install.ps1 | iex
36-
```
37-
38-
Then run `t3` to start the server and open the local web app. `t3 service install` keeps it running in the background, `t3 update` moves to a newer release, and `t3 --help` has the full reference.
39-
40-
To try it once without installing, run `npx t3@latest`. It offers to install the `t3` command for you.
40+
## Install
4141

4242
### Desktop app
4343

44-
Install the latest version of the desktop app from [GitHub Releases](https://github.com/pingdotgg/t3code/releases), or from your favorite package registry:
44+
[Download T3 Code](https://t3.codes/download) for macOS, Windows, or Linux. You can also use a package manager:
4545

46-
#### Windows (`winget`)
46+
| Platform | Command |
47+
| -------------- | -------------------------------------------------------------------- |
48+
| macOS | `brew install --cask t3-code` |
49+
| Windows | `winget install T3Tools.T3Code` or `scoop install extras/t3code` |
50+
| Arch Linux | `yay -S t3code-bin` |
51+
| Nix | `nix profile add github:NixOS/nixpkgs/nixos-unstable#t3code` |
52+
| Debian, Ubuntu | `.deb` from [Releases](https://github.com/pingdotgg/t3code/releases) |
4753

48-
```bash
49-
winget install T3Tools.T3Code
50-
```
51-
52-
#### Windows (`scoop`)
53-
54-
```bash
55-
scoop install extras/t3code
56-
```
57-
58-
#### macOS (Homebrew)
59-
60-
```bash
61-
brew install --cask t3-code
62-
```
63-
64-
#### Debian, Ubuntu (`.deb`)
54+
### Command line
6555

66-
Download the `.deb` from [GitHub Releases](https://github.com/pingdotgg/t3code/releases), then:
56+
This installs the `t3` command. Run `t3` to start the server and open the web app.
6757

6858
```bash
69-
sudo apt install ./T3-Code-*.deb
59+
curl -fsSL https://t3.codes/install.sh | sh
7060
```
7161

72-
#### Arch Linux (AUR)
73-
74-
Stable:
62+
On Windows, in PowerShell:
7563

76-
```bash
77-
yay -S t3code-bin
64+
```powershell
65+
irm https://t3.codes/install.ps1 | iex
7866
```
7967

80-
Nightly:
68+
To try it once without an install, run `npx t3@latest`.
8169

82-
```bash
83-
yay -S t3code-nightly-bin
84-
```
70+
### Phone
8571

86-
The AUR packaging is maintained in this repository under [`packaging/aur`](./packaging/aur).
72+
Get the app from the [App Store](https://apps.apple.com/us/app/t3-code-remote-claude-more/id6787819824) or [Google Play](https://play.google.com/store/apps/details?id=com.t3tools.t3code). Then follow [remote access](./docs/user/remote-access.md) to connect it to your computer.
8773

88-
#### Nix (nixpkgs)
74+
### Sign in to an agent
8975

90-
```bash
91-
nix profile add github:NixOS/nixpkgs/nixos-unstable#t3code
92-
```
76+
T3 Code needs one agent that is installed and signed in. For example, install [Claude Code](https://claude.com/product/claude-code) and run `claude auth login`, or install [Codex CLI](https://developers.openai.com/codex/cli) and run `codex login`.
9377

94-
The package is maintained in [nixpkgs](https://github.com/NixOS/nixpkgs/tree/nixos-unstable/pkgs/by-name/t3/t3code)
95-
and includes the desktop app (`t3code-desktop`) and the `t3` command.
96-
See [Nix installation](./docs/user/install.md#nix-nixpkgs) for NixOS configuration and updates.
78+
[Provider setup](./docs/user/install.md#providers) has the steps for each agent. [Install T3 Code](./docs/user/install.md) covers nightly builds, AppImage, WSL, and NixOS.
9779

98-
## Some notes
80+
## "Wait, what are you selling me?"
9981

100-
We are very very early in this project. Expect bugs.
82+
Nothing. We built T3 Code because we wanted the best possible development experience with agents. We were inspired by existing solutions like the Codex desktop app, Conductor, Claude Desktop and Cursor Glass, but none met our bar.
10183

102-
We are (mostly) not accepting contributions yet. Small fixes may be considered. Big features will not be.
84+
We wanted something performant, remote-ready, and truly open. If we ever go the wrong direction, we want you to have everything you need to fork and build the tool that you want.
10385

10486
## Documentation
10587

106-
Full docs live in [docs/](./docs). There's no docs site yet.
107-
108-
- [FAQ](./docs/user/faq.md)
10988
- [Install and first run](./docs/user/install.md)
110-
- [Permission modes](./docs/user/permission-modes.md)
111-
- [Keyboard shortcuts](./docs/user/keybindings.md)
112-
- [Project settings](./docs/user/project-settings.md)
113-
- [Appearance preferences](./docs/user/appearance.md)
11489
- [Remote access from a phone or another machine](./docs/user/remote-access.md)
115-
- [Connect Claude Code, Codex, ChatGPT and other agents over MCP](./docs/user/outside-agents.md)
116-
- [Keeping app and server in sync](./docs/user/updating.md)
117-
- [Source control integrations](./docs/user/source-control.md)
118-
- Multiple accounts: [Codex](./docs/user/providers-codex.md) · [Claude](./docs/user/providers-claude.md)
119-
- [Run T3 Code as a background service](./docs/user/background-service.md)
120-
121-
Building from source? Start at [docs/internals/overview.md](./docs/internals/overview.md).
122-
123-
## If you REALLY want to contribute still.... read this first
124-
125-
### Install `vp`
126-
127-
T3 Code uses Vite+ so you'll need to install the global `vp` command-line tool.
128-
129-
#### macOS / Linux
130-
131-
```bash
132-
curl -fsSL https://vite.plus | bash
133-
```
134-
135-
#### Windows
136-
137-
```bash
138-
irm https://vite.plus/ps1 | iex
139-
```
90+
- [Permission modes](./docs/user/permission-modes.md)
91+
- [Source control](./docs/user/source-control.md)
92+
- [Connect outside agents over MCP](./docs/user/outside-agents.md)
93+
- [FAQ](./docs/user/faq.md)
14094

141-
Checkout their getting started guide for more information: https://viteplus.dev/guide/
95+
[All docs](./docs/README.md) has the full list.
14296

143-
### Install dependencies
97+
## Contributing
14498

145-
```bash
146-
vp i
147-
```
99+
We have limited review capacity. Small, focused fixes are the most likely to be merged. Features need an approved discussion first.
148100

149-
Read [CONTRIBUTING.md](./CONTRIBUTING.md) before reporting a bug or opening a PR.
101+
- Read [CONTRIBUTING.md](./CONTRIBUTING.md) before you report a bug or open a pull request.
102+
- Put feature requests in [Ideas](https://github.com/pingdotgg/t3code/discussions/categories/ideas).
103+
- Build from source with the [development runbook](./docs/operations/development.md#first-checkout). The [architecture overview](./docs/internals/overview.md) explains how it works.
104+
- Get help in [Discord](https://discord.gg/jn4EGJjrvv).
150105

151-
Have a feature request? Start an [Ideas discussion](https://github.com/pingdotgg/t3code/discussions/categories/ideas).
106+
## License
152107

153-
Need support? Join the [Discord](https://discord.gg/jn4EGJjrvv).
108+
[MIT](./LICENSE)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// @effect-diagnostics nodeBuiltinImport:off - Spawns a real process tree for /proc.
2+
import * as NodeChildProcess from "node:child_process";
3+
import * as NodeFS from "node:fs";
4+
import { assert, describe, it } from "@effect/vitest";
5+
6+
import { stopChildProcessesBeforeExit } from "./DesktopExitChildren.ts";
7+
8+
const isRunning = (pid: number) => {
9+
try {
10+
const stat = NodeFS.readFileSync(`/proc/${pid}/stat`, "utf8");
11+
return !"ZX".includes(stat.charAt(stat.lastIndexOf(")") + 2));
12+
} catch {
13+
return false;
14+
}
15+
};
16+
17+
describe.runIf(NodeFS.existsSync("/proc/self/task"))("stopChildProcessesBeforeExit", () => {
18+
it("terminates every child of the given process before returning", async () => {
19+
const parent = NodeChildProcess.spawn(
20+
"sh",
21+
["-c", "sleep 60 & echo $!; sleep 60 & echo $!; wait"],
22+
{ stdio: ["ignore", "pipe", "ignore"] },
23+
);
24+
try {
25+
const childPids = await new Promise<Array<number>>((resolve) => {
26+
let output = "";
27+
parent.stdout.on("data", (chunk: Buffer) => {
28+
output += chunk.toString();
29+
const pids = output.split("\n").filter(Boolean).map(Number);
30+
if (pids.length === 2) resolve(pids);
31+
});
32+
});
33+
assert.isTrue(childPids.every(isRunning));
34+
35+
assert.deepStrictEqual(stopChildProcessesBeforeExit(parent.pid!), []);
36+
37+
assert.isFalse(childPids.some(isRunning));
38+
} finally {
39+
parent.kill("SIGKILL");
40+
}
41+
});
42+
});
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// @effect-diagnostics nodeBuiltinImport:off - Runs synchronously in the process "exit" event, where nothing async completes.
2+
import * as NodeFS from "node:fs";
3+
4+
// Matches the backend's quit budget: SIGTERM, 5 s grace, SIGKILL, 1 s wait.
5+
const TERMINATE_GRACE_MS = 5_000;
6+
const KILL_WAIT_MS = 1_000;
7+
8+
const readProc = (path: string): string | undefined => {
9+
try {
10+
return NodeFS.readFileSync(path, "utf8");
11+
} catch {
12+
return undefined;
13+
}
14+
};
15+
16+
// Chromium launches helpers from its own threads, so each thread's children file is read.
17+
const childPids = (pid: number): ReadonlyArray<number> => {
18+
let tasks: ReadonlyArray<string>;
19+
try {
20+
tasks = NodeFS.readdirSync(`/proc/${pid}/task`);
21+
} catch {
22+
return [];
23+
}
24+
return tasks.flatMap((task) =>
25+
(readProc(`/proc/${pid}/task/${task}/children`) ?? "")
26+
.split(" ")
27+
.filter((value) => value.trim() !== "")
28+
.map(Number),
29+
);
30+
};
31+
32+
// A zombie has already released its memory mappings.
33+
const isRunning = (pid: number): boolean => {
34+
const stat = readProc(`/proc/${pid}/stat`);
35+
if (stat === undefined) return false;
36+
const state = stat.charAt(stat.lastIndexOf(")") + 2);
37+
return state !== "Z" && state !== "X";
38+
};
39+
40+
const signal = (pids: ReadonlyArray<number>, name: NodeJS.Signals) => {
41+
for (const pid of pids) {
42+
try {
43+
process.kill(pid, name);
44+
} catch {}
45+
}
46+
};
47+
48+
const waitUntilStopped = (pids: ReadonlyArray<number>, maxMs: number): ReadonlyArray<number> => {
49+
const tick = new Int32Array(new SharedArrayBuffer(4));
50+
let running = pids.filter(isRunning);
51+
for (let waited = 0; waited < maxMs && running.length > 0; waited += 10) {
52+
Atomics.wait(tick, 0, 0, 10);
53+
running = running.filter(isRunning);
54+
}
55+
return running;
56+
};
57+
58+
/**
59+
* Stops the main process's children while it is still alive. On an AppImage the image unmounts
60+
* as soon as main exits, so children left running then die with SIGBUS. Linux only (/proc).
61+
* Returns the pids that needed SIGKILL.
62+
*/
63+
export const stopChildProcessesBeforeExit = (pid: number): ReadonlyArray<number> => {
64+
const children = childPids(pid);
65+
signal(children, "SIGTERM");
66+
const survivors = waitUntilStopped(children, TERMINATE_GRACE_MS);
67+
signal(survivors, "SIGKILL");
68+
waitUntilStopped(survivors, KILL_WAIT_MS);
69+
return survivors;
70+
};

‎apps/desktop/src/app/DesktopLifecycle.ts‎

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import type * as Electron from "electron";
1212
import * as HostProcess from "@t3tools/shared/HostProcess";
1313

1414
import * as DesktopEnvironment from "./DesktopEnvironment.ts";
15+
import { stopChildProcessesBeforeExit } from "./DesktopExitChildren.ts";
1516
import { makeComponentLogger } from "./DesktopObservability.ts";
1617
import * as DesktopShutdown from "./DesktopShutdown.ts";
1718
import * as ElectronApp from "../electron/ElectronApp.ts";
@@ -69,15 +70,18 @@ function addScopedListener<Args extends ReadonlyArray<unknown>>(
6970
target: unknown,
7071
eventName: string,
7172
listener: (...args: Args) => void,
73+
options: { readonly prepend?: boolean } = {},
7274
): Effect.Effect<void, never, Scope.Scope> {
7375
const eventTarget = target as {
7476
on: (eventName: string, listener: (...args: Array<unknown>) => void) => unknown;
77+
prependListener: (eventName: string, listener: (...args: Array<unknown>) => void) => unknown;
7578
removeListener: (eventName: string, listener: (...args: Array<unknown>) => void) => unknown;
7679
};
7780
const untypedListener = listener as unknown as (...args: Array<unknown>) => void;
7881
return Effect.acquireRelease(
7982
Effect.sync(() => {
80-
eventTarget.on(eventName, untypedListener);
83+
if (options.prepend) eventTarget.prependListener(eventName, untypedListener);
84+
else eventTarget.on(eventName, untypedListener);
8185
}),
8286
() =>
8387
Effect.sync(() => {
@@ -300,6 +304,34 @@ export const make = DesktopLifecycle.of({
300304
);
301305
});
302306

307+
// Electron can exit without before-quit, e.g. when the X11/Wayland connection drops.
308+
// Children (the backend too) get SIGTERM while main still holds an AppImage mount open.
309+
// Prepended so the record is buffered before the trace sink's own exit flush runs.
310+
yield* addScopedListener(
311+
process,
312+
"exit",
313+
(exitCode: number) => {
314+
Effect.runSyncWith(context)(
315+
Effect.gen(function* () {
316+
const shutdown = yield* DesktopShutdown.DesktopShutdown;
317+
// "allowed" without a finished shutdown is the updater's quit; its relaunched app is a child.
318+
if (quit.phase === "allowed" || (yield* shutdown.isComplete)) return;
319+
const attributes = { exitCode, quitPhase: quit.phase };
320+
yield* Effect.gen(function* () {
321+
yield* logLifecycleError(
322+
"desktop main process exiting before shutdown completed",
323+
attributes,
324+
);
325+
if (environment.platform !== "linux") return;
326+
const killed = stopChildProcessesBeforeExit(process.pid);
327+
yield* Effect.annotateCurrentSpan({ killedChildPids: killed });
328+
}).pipe(Effect.withSpan("desktop.lifecycle.exit", { attributes }));
329+
}),
330+
);
331+
},
332+
{ prepend: true },
333+
);
334+
303335
if (environment.platform !== "win32") {
304336
yield* addScopedListener(process, "SIGINT", () => {
305337
quitFromSignal("SIGINT", runEffect, quit);

0 commit comments

Comments
 (0)