Skip to content

Commit 480d6dd

Browse files
Dwiteclaude
andcommitted
Merge remote-tracking branch 'origin/main' into t3code/dictation-review-v2
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2 parents 6fe0e0e + d720210 commit 480d6dd

1,019 files changed

Lines changed: 77349 additions & 26101 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.

‎.coderabbit.config.ts‎

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,43 @@
1-
import { defineConfig } from "@coderabbitai/config";
1+
import { defineConfig, type CodeRabbitContext } from "@coderabbitai/config";
22

3-
export default defineConfig({
3+
const approvability = `Fail when a maintainer should read this pull request before CodeRabbit approves it, and name the rule and file. Fail if it:
4+
5+
- Changes a product default: a setting's default value, or what users get without opting in. Making a feature do what it already promises is a bug fix, not a default change.
6+
- Adds or broadens a directive that disables or suppresses a lint, type-checker, LSP, or other static-analysis diagnostic, including file-level, line-level, and configuration-level overrides.
7+
- Adds a subsystem or user workflow, or is a large refactor across apps or packages.
8+
- Changes packages/contracts or persisted data in a way that existing clients or stored data might not accept.
9+
- Changes authentication, pairing, credentials, secrets, or remote connection trust.
10+
- Adds or changes an external side effect, such as acting on GitHub, publishing a release, or calling a webhook.
11+
- Adds, upgrades, or patches a dependency.
12+
- Changes CI or release configuration, agent or contributor instructions, or any review tool's configuration, including .github/, AGENTS.md, CONTRIBUTING.md, .agents/, and .coderabbit.config.ts.
13+
14+
Otherwise pass. A focused bug fix, copy or layout fix, revert, or docs-only or test-only change passes unless a rule above applies. If you cannot decide, fail rather than report inconclusive. When failing, say that the pull request needs a maintainer's review.
15+
`;
16+
17+
// Org members and collaborators merge their own pull requests. On anyone else's, CodeRabbit
18+
// requests changes until its comments are resolved and its checks pass, then approves.
19+
const UNGATED_AUTHORS = new Set(["OWNER", "MEMBER", "COLLABORATOR"]);
20+
const isGated = ({ pr }: CodeRabbitContext) => !UNGATED_AUTHORS.has(pr?.authorAssociation ?? "");
21+
22+
export default defineConfig((ctx) => ({
423
reviews: {
524
high_level_summary: false,
625
review_status: false,
26+
request_changes_workflow: isGated(ctx),
27+
allow_author_approval: !isGated(ctx),
728
auto_review: {
829
enabled: true,
930
},
1031
pre_merge_checks: {
1132
docstrings: { mode: "off" },
33+
override_requested_reviewers_only: isGated(ctx),
34+
custom_checks: [
35+
{
36+
name: "Approvability",
37+
mode: isGated(ctx) ? "error" : "off",
38+
instructions: approvability,
39+
},
40+
],
1241
},
1342
path_filters: [
1443
// Vendored read-only reference checkouts of upstream Effect and Alchemy
@@ -34,4 +63,4 @@ export default defineConfig({
3463
],
3564
},
3665
},
37-
});
66+
}));

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ jobs:
255255
# No Electron setup here: `t3` (apps/server) has no Electron dependency
256256
# and none of its tests touch the runtime. Only the non-server `test`
257257
# job, which covers @t3tools/desktop, needs the download.
258+
- name: Install Chromium for server browser integration tests
259+
run: node apps/server/node_modules/playwright-core/cli.js install --with-deps --only-shell chromium
260+
258261
- name: Test
259262
env:
260263
T3CODE_TRANSFER_BUDGET_REPORT_PATH: ${{ runner.temp }}/t3code-transfer-budget.md

‎.github/workflows/release.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ jobs:
330330
# No Electron setup here: `t3` (apps/server) has no Electron dependency
331331
# and none of its tests touch the runtime. Only the non-server `test`
332332
# job, which covers @t3tools/desktop, needs the download.
333+
- name: Install Chromium for server browser integration tests
334+
run: node apps/server/node_modules/playwright-core/cli.js install --with-deps --only-shell chromium
335+
333336
- name: Test
334337
run: vp run --filter t3 test --shard ${{ matrix.shard }}/${{ strategy.job-total }}
335338

‎AGENTS.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ Architecture and its constraints: `docs/internals/overview.md`. Glossary: `docs/
150150
## Taste
151151

152152
- Complexity belongs at the adapter boundary. Orchestration stays pure, UI stays dumb.
153+
- Client mutations use `createEnvironmentRpcCommand`. Add protected methods to `CLIENT_GUARDED_RPC_SCOPES` in contracts and use the command's `permissionAtom` for UI availability. Grants are checked at execution against the destination environment; the server remains authoritative. Keep raw RPC clients inside `rpc/`, and extend the permission behavior tests when adding a protected method.
153154
- Server features are services; transports stay thin. A `ws.ts` RPC handler, HTTP route, or MCP tool decodes input, calls one service method, and maps errors. See [Effect services](docs/internals/effect-services.md).
154155
- `apps/web/src/components/ui` exports own their look. Pick a `variant` or `size`; do not restyle one with `className`. If none fits and the look is a generic concept, add a variant to the component; a look that belongs to one feature stays in that feature's own component, not in `components/ui`. Layout classes (width, flex, margin, position) belong on the parent. `shadcn/no-restyle` fails lint on violations. See [Web UI](docs/internals/web-ui.md).
155156
- Inferred types over annotations. `any` is the enemy.

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ Full docs live in [docs/](./docs). There's no docs site yet.
9494
- [Project settings](./docs/user/project-settings.md)
9595
- [Appearance preferences](./docs/user/appearance.md)
9696
- [Remote access from a phone or another machine](./docs/user/remote-access.md)
97+
- [Connect Claude Code, Codex, ChatGPT and other agents over MCP](./docs/user/outside-agents.md)
9798
- [Keeping app and server in sync](./docs/user/updating.md)
9899
- [Source control integrations](./docs/user/source-control.md)
99100
- Multiple accounts: [Codex](./docs/user/providers-codex.md) · [Claude](./docs/user/providers-claude.md)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<component type="desktop-application">
3+
<id>com.t3tools.t3code</id>
4+
<metadata_license>CC0-1.0</metadata_license>
5+
<project_license>MIT</project_license>
6+
<name>T3 Code</name>
7+
<summary>Desktop GUI for coding agents</summary>
8+
<developer id="com.t3tools">
9+
<name>T3 Tools Inc.</name>
10+
</developer>
11+
<description>
12+
<p>
13+
T3 Code is an open-source desktop app for coding agents. Work with your
14+
existing agent subscriptions, review code changes, and run commands in
15+
your projects.
16+
</p>
17+
<p>
18+
Connect from desktop, web, or mobile to continue working remotely.
19+
</p>
20+
</description>
21+
<launchable type="desktop-id">t3code.desktop</launchable>
22+
<icon type="stock">t3code</icon>
23+
<provides>
24+
<binary>t3code</binary>
25+
</provides>
26+
<categories>
27+
<category>Development</category>
28+
</categories>
29+
<url type="homepage">https://t3.codes</url>
30+
<url type="bugtracker">https://github.com/pingdotgg/t3code/issues</url>
31+
<url type="vcs-browser">https://github.com/pingdotgg/t3code</url>
32+
</component>
Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
import * as NodeServices from "@effect/platform-node/NodeServices";
2+
import { expect, it } from "@effect/vitest";
3+
import * as Effect from "effect/Effect";
4+
import * as FileSystem from "effect/FileSystem";
5+
import * as Option from "effect/Option";
6+
import * as Path from "effect/Path";
7+
import * as Sink from "effect/Sink";
8+
import * as Stream from "effect/Stream";
9+
import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner";
10+
11+
import * as DesktopCliCommand from "./DesktopCliCommand.ts";
12+
import * as DesktopCliShim from "./DesktopCliShim.ts";
13+
import * as DesktopEnvironment from "./DesktopEnvironment.ts";
14+
15+
const environmentFor = (
16+
path: Path.Path,
17+
input: { home: string; baseDir: string; platform?: NodeJS.Platform; isPackaged?: boolean },
18+
) =>
19+
DesktopEnvironment.DesktopEnvironment.of({
20+
path,
21+
platform: input.platform ?? "linux",
22+
isPackaged: input.isPackaged ?? true,
23+
homeDirectory: input.home,
24+
baseDir: input.baseDir,
25+
stateDir: path.join(input.baseDir, "userdata"),
26+
serverRoot: "/opt/T3 Code/resources/app.asar",
27+
appImagePath: Option.none(),
28+
} as unknown as DesktopEnvironment.DesktopEnvironment["Service"]);
29+
30+
/** The service for a packaged app; the launcher is written on Install. */
31+
const commandIn = (
32+
input: { home: string; baseDir?: string; platform?: NodeJS.Platform; isPackaged?: boolean },
33+
spawner?: ChildProcessSpawner.ChildProcessSpawner["Service"],
34+
) =>
35+
Effect.gen(function* () {
36+
const path = yield* Path.Path;
37+
const fs = yield* FileSystem.FileSystem;
38+
const baseDir = input.baseDir ?? path.join(input.home, ".t3");
39+
yield* fs.makeDirectory(path.join(baseDir, "userdata"), { recursive: true });
40+
const make = DesktopCliCommand.make.pipe(
41+
Effect.provideService(
42+
DesktopEnvironment.DesktopEnvironment,
43+
environmentFor(path, { ...input, baseDir }),
44+
),
45+
);
46+
return yield* spawner
47+
? make.pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner))
48+
: make;
49+
});
50+
51+
/** A PowerShell that keeps the user's PATH in memory and can be told to fail reads. */
52+
const fakePowerShell = (initial: string) => {
53+
const registry = { path: initial, failReads: false, writes: 0 };
54+
const spawner = ChildProcessSpawner.make((command) =>
55+
Effect.sync(() => {
56+
const { options } = command as unknown as {
57+
readonly options: { readonly env?: Record<string, string> };
58+
};
59+
const env = options.env ?? {};
60+
let exitCode = 0;
61+
let stdout = "";
62+
if (env.T3_SET === "1") {
63+
registry.path = env.T3_PATH ?? "";
64+
registry.writes += 1;
65+
} else if (registry.failReads) {
66+
exitCode = 1;
67+
} else {
68+
stdout = Buffer.from(registry.path, "utf8").toString("base64");
69+
}
70+
return ChildProcessSpawner.makeHandle({
71+
pid: ChildProcessSpawner.ProcessId(1),
72+
exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(exitCode)),
73+
isRunning: Effect.succeed(false),
74+
kill: () => Effect.void,
75+
unref: Effect.succeed(Effect.void),
76+
stdin: Sink.drain,
77+
stdout: Stream.make(new TextEncoder().encode(stdout)),
78+
stderr: Stream.empty,
79+
all: Stream.empty,
80+
getInputFd: () => Sink.drain,
81+
getOutputFd: () => Stream.empty,
82+
});
83+
}),
84+
);
85+
return { registry, spawner };
86+
};
87+
88+
it.layer(NodeServices.layer)("DesktopCliCommand", (it) => {
89+
it.effect("links the launcher onto PATH and removes only that link", () =>
90+
Effect.gen(function* () {
91+
const fs = yield* FileSystem.FileSystem;
92+
const path = yield* Path.Path;
93+
const home = yield* fs.makeTempDirectoryScoped();
94+
const command = yield* commandIn({ home });
95+
const link = path.join(home, ".local", "bin", "t3");
96+
97+
expect(yield* command.state).toEqual({ supported: true, installedPath: null, onPath: false });
98+
// Install writes the launcher itself, even when no local backend ever did.
99+
const installed = yield* command.install;
100+
expect(installed.installedPath).toBe(link);
101+
expect(yield* fs.readLink(link)).toBe(path.join(home, ".t3", "bin", "t3"));
102+
expect((yield* command.install).installedPath).toBe(link);
103+
104+
expect((yield* command.uninstall).installedPath).toBeNull();
105+
expect(yield* fs.exists(link)).toBe(false);
106+
// The launcher itself stays for setup commands.
107+
expect(yield* fs.exists(path.join(home, ".t3", "bin", "t3"))).toBe(true);
108+
}).pipe(Effect.scoped),
109+
);
110+
111+
it.effect("never replaces or removes a t3 it did not create", () =>
112+
Effect.gen(function* () {
113+
const fs = yield* FileSystem.FileSystem;
114+
const path = yield* Path.Path;
115+
const home = yield* fs.makeTempDirectoryScoped();
116+
const command = yield* commandIn({ home });
117+
const theirs = path.join(home, ".local", "bin", "t3");
118+
yield* fs.makeDirectory(path.dirname(theirs), { recursive: true });
119+
yield* fs.writeFileString(theirs, "npm's t3\n");
120+
// Even a broken link in the next folder is someone else's.
121+
yield* fs.makeDirectory(path.join(home, "bin"), { recursive: true });
122+
yield* fs.symlink(path.join(home, "gone"), path.join(home, "bin", "t3"));
123+
124+
const error = yield* Effect.flip(command.install);
125+
expect(error.message).toContain("Another t3 command is already installed");
126+
yield* command.uninstall;
127+
expect(yield* fs.readFileString(theirs)).toBe("npm's t3\n");
128+
expect(yield* fs.readLink(path.join(home, "bin", "t3"))).toBe(path.join(home, "gone"));
129+
}).pipe(Effect.scoped),
130+
);
131+
132+
it.effect("finds and removes a link left by a previous T3 home", () =>
133+
Effect.gen(function* () {
134+
const fs = yield* FileSystem.FileSystem;
135+
const path = yield* Path.Path;
136+
const home = yield* fs.makeTempDirectoryScoped();
137+
const before = yield* commandIn({ home, baseDir: path.join(home, "old-t3") });
138+
const link = (yield* before.install).installedPath;
139+
140+
const after = yield* commandIn({ home, baseDir: path.join(home, "new-t3") });
141+
expect((yield* after.state).installedPath).toBe(link);
142+
// Installing again points the link at this home's launcher.
143+
expect((yield* after.install).installedPath).toBe(link);
144+
expect(yield* fs.readLink(link!)).toBe(path.join(home, "new-t3", "bin", "t3"));
145+
yield* after.uninstall;
146+
expect(yield* fs.exists(path.join(home, ".local", "bin", "t3"))).toBe(false);
147+
expect(yield* fs.exists(path.join(home, "bin", "t3"))).toBe(false);
148+
}).pipe(Effect.scoped),
149+
);
150+
151+
it.effect("does not read a large binary another t3 links to", () =>
152+
Effect.gen(function* () {
153+
const fs = yield* FileSystem.FileSystem;
154+
const path = yield* Path.Path;
155+
const home = yield* fs.makeTempDirectoryScoped();
156+
// A big executable that happens to contain the marker text is still not ours.
157+
const binary = path.join(home, "native-t3");
158+
yield* fs.writeFileString(binary, `${"\0".repeat(64 * 1024)}${DesktopCliShim.MARKER}`);
159+
yield* fs.makeDirectory(path.join(home, ".local", "bin"), { recursive: true });
160+
yield* fs.symlink(binary, path.join(home, ".local", "bin", "t3"));
161+
const command = yield* commandIn({ home });
162+
expect((yield* command.state).installedPath).toBeNull();
163+
yield* command.uninstall;
164+
expect(yield* fs.readLink(path.join(home, ".local", "bin", "t3"))).toBe(binary);
165+
}).pipe(Effect.scoped),
166+
);
167+
168+
it.effect("reports when another t3 earlier on PATH would run instead", () =>
169+
Effect.gen(function* () {
170+
const fs = yield* FileSystem.FileSystem;
171+
const path = yield* Path.Path;
172+
const home = yield* fs.makeTempDirectoryScoped();
173+
const shadow = path.join(home, "shadow");
174+
yield* fs.makeDirectory(shadow);
175+
yield* fs.writeFileString(path.join(shadow, "t3"), "#!/bin/sh\n", { mode: 0o755 });
176+
const previous = process.env.PATH;
177+
process.env.PATH = [shadow, path.join(home, ".local", "bin")].join(":");
178+
yield* Effect.addFinalizer(() => Effect.sync(() => (process.env.PATH = previous)));
179+
180+
const command = yield* commandIn({ home });
181+
const installed = yield* command.install;
182+
expect(installed.installedPath).toBe(path.join(home, ".local", "bin", "t3"));
183+
expect(installed.onPath).toBe(false);
184+
yield* fs.remove(path.join(shadow, "t3"));
185+
expect((yield* command.state).onPath).toBe(true);
186+
}).pipe(Effect.scoped),
187+
);
188+
189+
it.effect("leaves the Windows PATH alone when it cannot be read", () =>
190+
Effect.gen(function* () {
191+
const fs = yield* FileSystem.FileSystem;
192+
const home = yield* fs.makeTempDirectoryScoped();
193+
const userPath = "C:\\Users\\Me\\npm;%USERPROFILE%\\tools";
194+
const { registry, spawner } = fakePowerShell(userPath);
195+
const command = yield* commandIn({ home, platform: "win32" }, spawner);
196+
197+
registry.failReads = true;
198+
const error = yield* Effect.flip(command.install);
199+
expect(error.message).toContain("left unchanged");
200+
expect(registry).toMatchObject({ path: userPath, writes: 0 });
201+
202+
registry.failReads = false;
203+
const launcherDir = DesktopCliShim.launcherPath(
204+
environmentFor(yield* Path.Path, { home, baseDir: `${home}/.t3`, platform: "win32" }),
205+
).replace(/[\\/]t3\.cmd$/, "");
206+
yield* command.install;
207+
expect(registry.path).toBe(`${userPath};${launcherDir}`);
208+
yield* command.uninstall;
209+
expect(registry.path).toBe(userPath);
210+
}).pipe(Effect.scoped),
211+
);
212+
213+
it.effect("does not claim or remove a Windows PATH entry the user added", () =>
214+
Effect.gen(function* () {
215+
const fs = yield* FileSystem.FileSystem;
216+
const path = yield* Path.Path;
217+
const home = yield* fs.makeTempDirectoryScoped();
218+
const launcherDir = path.dirname(
219+
DesktopCliShim.launcherPath(
220+
environmentFor(path, { home, baseDir: path.join(home, ".t3"), platform: "win32" }),
221+
),
222+
);
223+
const userPath = `C:\\Tools;${launcherDir}`;
224+
const { registry, spawner } = fakePowerShell(userPath);
225+
const command = yield* commandIn({ home, platform: "win32" }, spawner);
226+
227+
expect((yield* command.state).installedPath).toBeNull();
228+
yield* command.uninstall;
229+
expect(registry.path).toBe(userPath);
230+
}).pipe(Effect.scoped),
231+
);
232+
233+
it.effect("offers nothing for a development build", () =>
234+
Effect.gen(function* () {
235+
const fs = yield* FileSystem.FileSystem;
236+
const command = yield* commandIn({
237+
home: yield* fs.makeTempDirectoryScoped(),
238+
isPackaged: false,
239+
});
240+
expect((yield* command.state).supported).toBe(false);
241+
}).pipe(Effect.scoped),
242+
);
243+
});

0 commit comments

Comments
 (0)