Skip to content

Commit 45dd888

Browse files
authored
Merge branch 'main' into fix/diff-palette-counts
2 parents af107c8 + 611132c commit 45dd888

839 files changed

Lines changed: 58683 additions & 20682 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>

‎apps/desktop/src/backend/DesktopBackendConfiguration.test.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,16 +979,20 @@ describe("DesktopBackendConfiguration", () => {
979979

980980
const previousWslEnv = process.env.WSLENV;
981981
const previousDisabled = process.env.OTEL_SDK_DISABLED;
982+
const previousTelemetry = process.env.T3CODE_TELEMETRY_ENABLED;
982983
try {
983984
delete process.env.WSLENV;
984985
process.env.OTEL_SDK_DISABLED = "true";
986+
process.env.T3CODE_TELEMETRY_ENABLED = "false";
985987

986988
yield* Effect.gen(function* () {
987989
const configuration = yield* DesktopBackendConfiguration.DesktopBackendConfiguration;
988990
const config = yield* configuration.resolveWsl({ port: 5050, distro: null });
989991

990992
assert.equal(config.env.OTEL_SDK_DISABLED, "true");
991993
assert.include((config.env.WSLENV ?? "").split(":"), "OTEL_SDK_DISABLED");
994+
assert.equal(config.env.T3CODE_TELEMETRY_ENABLED, "false");
995+
assert.include((config.env.WSLENV ?? "").split(":"), "T3CODE_TELEMETRY_ENABLED");
992996
}).pipe(
993997
Effect.provide(
994998
DesktopBackendConfiguration.layer.pipe(
@@ -1009,6 +1013,7 @@ describe("DesktopBackendConfiguration", () => {
10091013
} finally {
10101014
restoreEnv("WSLENV", previousWslEnv);
10111015
restoreEnv("OTEL_SDK_DISABLED", previousDisabled);
1016+
restoreEnv("T3CODE_TELEMETRY_ENABLED", previousTelemetry);
10121017
}
10131018
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
10141019
);

‎apps/desktop/src/backend/DesktopBackendConfiguration.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ const DESKTOP_BACKEND_ENV_NAMES = [
101101
const WSL_FORWARDED_ENV_NAMES = [
102102
"OPENAI_API_KEY",
103103
"ANTHROPIC_API_KEY",
104+
"T3CODE_TELEMETRY_ENABLED",
104105
// Otherwise the WSL server keeps exporting to endpoints from the bootstrap.
105106
"T3CODE_OTEL_SDK_DISABLED",
106107
"OTEL_SDK_DISABLED",
@@ -568,6 +569,8 @@ const resolvePrimaryStartConfig = Effect.fn("desktop.backendConfiguration.resolv
568569
tailscaleServePort: backendExposure.tailscaleServePort,
569570
desktopTelemetryFd: 4,
570571
desktopTelemetryControlFd: 5,
572+
desktopBrowserFd: 6,
573+
desktopBrowserControlFd: 7,
571574
...Option.match(input.resourceMonitorPath, {
572575
onNone: () => ({}),
573576
onSome: (resourceMonitorPath) => ({ resourceMonitorPath }),

‎apps/desktop/src/backend/DesktopBackendManager.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import * as DesktopApp from "../app/DesktopApp.ts";
2727
import * as DesktopBackendPool from "./DesktopBackendPool.ts";
2828
import * as DesktopObservability from "../app/DesktopObservability.ts";
2929
import * as DesktopTelemetryPublisher from "../telemetry/DesktopTelemetryPublisher.ts";
30+
import * as DesktopBrowserHost from "../preview/DesktopBrowserHost.ts";
3031
import * as DesktopWslEnvironment from "../wsl/DesktopWslEnvironment.ts";
3132

3233
const decodeDesktopBackendBootstrap = Schema.decodeEffect(
@@ -173,6 +174,7 @@ function makeTestInstance(input: MakeInstanceInput) {
173174
updateCancellations: Stream.empty,
174175
...input.desktopTelemetryPublisher,
175176
}),
177+
DesktopBrowserHost.layer,
176178
DesktopWslEnvironment.layerTest(
177179
input.pruneRuntimes === undefined ? {} : { pruneRuntimes: input.pruneRuntimes },
178180
),

‎apps/desktop/src/backend/DesktopBackendManager.ts‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import { waitForHttpReady as waitForHttpReadyShared } from "@t3tools/shared/http
5252

5353
import * as DesktopObservability from "../app/DesktopObservability.ts";
5454
import * as DesktopTelemetryPublisher from "../telemetry/DesktopTelemetryPublisher.ts";
55+
import * as DesktopBrowserHost from "../preview/DesktopBrowserHost.ts";
5556
import * as DesktopWslEnvironment from "../wsl/DesktopWslEnvironment.ts";
5657

5758
const INITIAL_RESTART_DELAY = Duration.millis(500);
@@ -222,6 +223,10 @@ export type BackendProcessError = typeof BackendProcessError.Type;
222223

223224
interface RunBackendProcessOptions extends DesktopBackendStartConfig {
224225
readonly desktopTelemetryStream: Stream.Stream<Uint8Array>;
226+
/** Events for the desktop's browser tabs, written to `desktopBrowserFd`. */
227+
readonly desktopBrowserStream?: Stream.Stream<Uint8Array>;
228+
/** Each line the backend writes to `desktopBrowserControlFd`. */
229+
readonly onDesktopBrowserCommand?: (line: string) => Effect.Effect<void>;
225230
readonly onDesktopTelemetryControl?: (
226231
message: DesktopTelemetryControlMessageValue,
227232
) => Effect.Effect<void>;
@@ -472,6 +477,18 @@ export const runBackendProcess = Effect.fn("runBackendProcess")(function* (
472477
type: "output",
473478
};
474479
}
480+
if (
481+
options.bootstrap.desktopBrowserFd !== undefined &&
482+
options.desktopBrowserStream !== undefined
483+
) {
484+
additionalFds[`fd${options.bootstrap.desktopBrowserFd}`] = {
485+
type: "input",
486+
stream: options.desktopBrowserStream,
487+
};
488+
}
489+
if (options.bootstrap.desktopBrowserControlFd !== undefined) {
490+
additionalFds[`fd${options.bootstrap.desktopBrowserControlFd}`] = { type: "output" };
491+
}
475492
}
476493
const command = ChildProcess.make(options.executablePath, options.args, {
477494
cwd: options.cwd,
@@ -542,6 +559,26 @@ export const runBackendProcess = Effect.fn("runBackendProcess")(function* (
542559
Effect.forkScoped,
543560
);
544561
}
562+
if (
563+
options.bootstrap.desktopBrowserControlFd !== undefined &&
564+
options.onDesktopBrowserCommand !== undefined
565+
) {
566+
const browserFd = options.bootstrap.desktopBrowserControlFd;
567+
const handleCommand = options.onDesktopBrowserCommand;
568+
yield* handle.getOutputFd(browserFd).pipe(
569+
Stream.decodeText(),
570+
Stream.splitLines,
571+
Stream.filter((line) => line.length > 0),
572+
Stream.runForEach(handleCommand),
573+
Effect.catchCause((cause) =>
574+
logBackendProcessWarning("desktop browser command stream stopped", {
575+
fd: browserFd,
576+
cause: Cause.pretty(cause),
577+
}),
578+
),
579+
Effect.forkScoped,
580+
);
581+
}
545582
if (options.captureOutput) {
546583
const outputContext = {
547584
executablePath: options.executablePath,
@@ -642,6 +679,7 @@ export const makeBackendInstance = Effect.fn("makeBackendInstance")(function* (
642679
| HttpClient.HttpClient
643680
| DesktopObservability.DesktopBackendOutputLogFactory
644681
| DesktopTelemetryPublisher.DesktopTelemetryPublisher
682+
| DesktopBrowserHost.DesktopBrowserHost
645683
| DesktopWslEnvironment.DesktopWslEnvironment
646684
| Scope.Scope
647685
> {
@@ -650,6 +688,7 @@ export const makeBackendInstance = Effect.fn("makeBackendInstance")(function* (
650688
const backendOutputLogFactory = yield* DesktopObservability.DesktopBackendOutputLogFactory;
651689
const backendOutputLog = yield* backendOutputLogFactory.forInstance(spec.id);
652690
const desktopTelemetryPublisher = yield* DesktopTelemetryPublisher.DesktopTelemetryPublisher;
691+
const desktopBrowserHost = yield* DesktopBrowserHost.DesktopBrowserHost;
653692
const wslEnvironment = yield* DesktopWslEnvironment.DesktopWslEnvironment;
654693
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
655694
const httpClient = yield* HttpClient.HttpClient;
@@ -907,6 +946,9 @@ export const makeBackendInstance = Effect.fn("makeBackendInstance")(function* (
907946
const program = runBackendProcess({
908947
...config.value,
909948
desktopTelemetryStream: desktopTelemetryPublisher.encoded,
949+
// Only a bootstrap that names the browser fds (the local primary) gets them.
950+
desktopBrowserStream: desktopBrowserHost.events,
951+
onDesktopBrowserCommand: desktopBrowserHost.handleCommandLine,
910952
onDesktopTelemetryControl: (message) =>
911953
desktopTelemetryPublisher.handleControlForSource(spec.id, message),
912954
onStarted: Effect.fn("desktop.backendInstance.onStarted")(function* (pid) {

0 commit comments

Comments
 (0)