Skip to content

Commit 8bcbe3f

Browse files
committed
chore: merge main into missed-run task branch
# Conflicts: # apps/server/src/provider/agentContextBudget.json # apps/server/src/scheduledTasks/ScheduledTaskService.ts # apps/web/src/components/settings/scheduledTasksSettings.logic.test.ts # docs/user/project-settings.md # packages/contracts/src/orchestratorMcp.ts
2 parents c1b086e + b50d8a1 commit 8bcbe3f

229 files changed

Lines changed: 7294 additions & 1111 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/scripts/ci-changes.cjs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ const EXTRA_OWNERS = [
2727
[/^native\/browser-secret\//, ["@t3tools/desktop"]],
2828
[/^native\/kde-snap-shot\//, ["@t3tools/desktop"]],
2929
[/^native\/libghostty-vt\//, ["@t3tools/web"]],
30+
// apps/server/src/cloud/ConnectReachability.test.ts checks the guide's headings.
31+
[/^docs\/user\/t3-connect-troubleshooting\.md$/, ["t3"]],
3032
];
3133
const RUST = /^native\/(resource-monitor|kde-snap-shot|hyprland-snap-shot)\//;
3234

@@ -92,11 +94,11 @@ function readWorkspace() {
9294

9395
// [] means inert; null means unknown and requires every job.
9496
function ownersOf(file, packages) {
95-
if (INERT.some((pattern) => pattern.test(file))) return [];
97+
const extra = EXTRA_OWNERS.flatMap(([pattern, names]) => (pattern.test(file) ? names : []));
98+
if (INERT.some((pattern) => pattern.test(file))) return extra;
9699
// A manifest can change dependencies or versions other packages read.
97100
if (path.posix.basename(file) === "package.json") return null;
98101
if (RUNS_EVERYTHING.some((pattern) => pattern.test(file))) return null;
99-
const extra = EXTRA_OWNERS.flatMap(([pattern, names]) => (pattern.test(file) ? names : []));
100102
// scripts/build-desktop-artifact.test.ts reads the crates' sources.
101103
if (RUST.test(file)) return ["@t3tools/scripts", ...extra];
102104

‎.macroscope/check-run-agents/ui-consistency.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The reference for how this codebase wants UI built is the composer banner system
4444

4545
- `ComposerBanner.tsx` exports one object of small slot components (`Root`, `Row`, `Icon`, `Content`, `Actions`, `Dismiss`, `Children`, and so on). Each slot owns its own Tailwind classes, exposes a `data-slot` attribute, takes `className` and spreads the rest of its props, and uses `cn` so callers can adjust without overriding. Variants and density are props on `Root`, not ad hoc class strings at call sites. Where a slot needs a real control it renders `Button` from `ui/` rather than a styled `<button>`.
4646
- `ComposerBannerStack.tsx` composes those slots into the ordered stack and owns only stack behavior (priority, expand and collapse, dismiss transitions).
47-
- Consumers such as `ComposerActivityStatus.tsx`, `ComposerStashBadge.tsx`, and `ComposerPlanFollowUpBanner.tsx` are a few lines of `<ComposerBanner.Row><ComposerBanner.Icon/><ComposerBanner.Content>…` with no styling of their own.
47+
- Consumers such as `ComposerPlanFollowUpBanner.tsx` are a few lines of `<ComposerBanner.Row><ComposerBanner.Icon/><ComposerBanner.Content>…` and style only their own content.
4848

4949
Hold new and changed UI to that shape:
5050

‎README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
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).
44

5-
Works with your subscriptions on Claude Code, Codex, Cursor, Grok Build, OpenCode, and Google Antigravity. If they're set up on your computer, T3 Code can control them.
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.
66

77
## "Wait, what are you selling me?"
88

@@ -13,14 +13,15 @@ We wanted something performant, remote-ready, and truly open. If we ever go the
1313
## Installation
1414

1515
> [!WARNING]
16-
> T3 Code currently supports Codex, Claude, Cursor, Grok Build, OpenCode, and Antigravity. Install and authenticate at least one provider before use:
16+
> T3 Code currently supports Codex, Claude, Cursor, Grok Build, OpenCode, Antigravity, and fx. Install and authenticate at least one provider before use:
1717
>
1818
> - Codex: install [Codex CLI](https://developers.openai.com/codex/cli) and run `codex login`
1919
> - Claude: install [Claude Code](https://claude.com/product/claude-code) and run `claude auth login`
2020
> - Cursor: install [Cursor CLI](https://cursor.com/cli) and run `agent login`
2121
> - Grok Build: install [Grok Build CLI](https://x.ai/cli) and run `grok login`
2222
> - OpenCode: install [OpenCode](https://opencode.ai) and run `opencode auth login`
2323
> - 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))
2425
2526
### Command line
2627

‎apps/desktop/src/preview/DesktopBrowserHost.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,7 @@ export const make = Effect.gen(function* () {
302302
if (tab.relay) return tab.relay;
303303
const { webContents, debugger: debuggee } = tab.debuggee;
304304
const send = (method: string, params: Record<string, unknown>, sessionId?: string) =>
305-
sessionId === undefined
306-
? sendPageCommand(webContents, debuggee, method, params)
307-
: debuggee.sendCommand(method, params, sessionId);
305+
sendPageCommand(webContents, debuggee, method, params, sessionId);
308306
const detachedOwners = new Set<string>();
309307
/** Viewers and recordings stream; the agent's own sessions never do. */
310308
const streamingOwners = new Set<string>();

‎apps/desktop/src/preview/GuestInput.test.ts‎

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import * as NodeVM from "node:vm";
2+
13
import { describe, expect, it, vi } from "vite-plus/test";
24

35
import { sendPageCommand, toKeyboardInputEvents } from "./GuestInput.ts";
@@ -42,6 +44,149 @@ describe("preview guest input", () => {
4244
expect(guest.sendCommand).not.toHaveBeenCalledWith("Input.insertText", expect.anything());
4345
});
4446

47+
it.each([
48+
{
49+
sessionId: undefined,
50+
method: "Input.dispatchMouseEvent",
51+
type: "mousePressed",
52+
outcome: "restore",
53+
},
54+
{
55+
sessionId: "child-frame",
56+
method: "Input.dispatchMouseEvent",
57+
type: "mousePressed",
58+
outcome: "restore",
59+
},
60+
{
61+
sessionId: undefined,
62+
method: "Input.dispatchTouchEvent",
63+
type: "touchStart",
64+
outcome: "restore",
65+
},
66+
{
67+
sessionId: undefined,
68+
method: "Input.dispatchMouseEvent",
69+
type: "mousePressed",
70+
outcome: "other-field",
71+
},
72+
{
73+
sessionId: undefined,
74+
method: "Input.dispatchMouseEvent",
75+
type: "mousePressed",
76+
outcome: "removed",
77+
},
78+
{
79+
sessionId: undefined,
80+
method: "Input.dispatchMouseEvent",
81+
type: "mousePressed",
82+
outcome: "failure",
83+
},
84+
])(
85+
"preserves host focus for $method in $sessionId with $outcome",
86+
async ({ sessionId, method, type, outcome }) => {
87+
const document = { activeElement: {} as object };
88+
const composer = {
89+
isConnected: true,
90+
focus: () => {
91+
document.activeElement = composer;
92+
},
93+
};
94+
const preview = { tagName: "WEBVIEW", getWebContentsId: () => 7 };
95+
const otherField = { tagName: "INPUT" };
96+
document.activeElement = composer;
97+
const context = NodeVM.createContext({ document });
98+
const host = {
99+
isDestroyed: () => false,
100+
executeJavaScript: async (script: string) => NodeVM.runInContext(script, context),
101+
};
102+
const guest = { id: 7, focusedFrame: null, hostWebContents: host };
103+
const debuggee = {
104+
sendCommand: async () => {
105+
document.activeElement = outcome === "other-field" ? otherField : preview;
106+
if (outcome === "removed") composer.isConnected = false;
107+
if (outcome === "failure") throw new Error("Pointer failed");
108+
return {};
109+
},
110+
};
111+
const result = sendPageCommand(
112+
guest as unknown as Electron.WebContents,
113+
debuggee as unknown as Electron.Debugger,
114+
method,
115+
{ type, x: 10, y: 10, button: "left" },
116+
sessionId,
117+
);
118+
if (outcome === "failure") await expect(result).rejects.toThrow("Pointer failed");
119+
else await result;
120+
expect(document.activeElement).toBe(
121+
outcome === "other-field" ? otherField : outcome === "removed" ? preview : composer,
122+
);
123+
expect(Object.keys(context)).toEqual(["document"]);
124+
},
125+
);
126+
127+
it.each([
128+
{
129+
method: "Input.dispatchMouseEvent",
130+
press: "mousePressed",
131+
release: "mouseReleased",
132+
failPress: false,
133+
},
134+
{
135+
method: "Input.dispatchTouchEvent",
136+
press: "touchStart",
137+
release: "touchEnd",
138+
failPress: false,
139+
},
140+
{
141+
method: "Input.dispatchMouseEvent",
142+
press: "mousePressed",
143+
release: "mouseReleased",
144+
failPress: true,
145+
},
146+
])(
147+
"keeps $method releases behind presses waiting for host focus, failed press: $failPress",
148+
async ({ method, press, release, failPress }) => {
149+
const captureStarted = Promise.withResolvers<void>();
150+
const finishCapture = Promise.withResolvers<void>();
151+
const events: Array<unknown> = [];
152+
const guest = {
153+
id: 7,
154+
focusedFrame: null,
155+
hostWebContents: {
156+
isDestroyed: () => false,
157+
executeJavaScript: async () => {
158+
captureStarted.resolve();
159+
await finishCapture.promise;
160+
},
161+
},
162+
};
163+
const debuggee = {
164+
sendCommand: async (_method: string, params: Record<string, unknown>) => {
165+
events.push(params["type"]);
166+
if (failPress && params["type"] === press) throw new Error("Press failed");
167+
return {};
168+
},
169+
};
170+
const send = (type: string) =>
171+
sendPageCommand(
172+
guest as unknown as Electron.WebContents,
173+
debuggee as unknown as Electron.Debugger,
174+
method,
175+
{ type },
176+
);
177+
const pressed = send(press);
178+
await captureStarted.promise;
179+
const released = send(release);
180+
finishCapture.resolve();
181+
const results = await Promise.allSettled([pressed, released]);
182+
expect(results.map((result) => result.status)).toEqual([
183+
failPress ? "rejected" : "fulfilled",
184+
"fulfilled",
185+
]);
186+
expect(events).toEqual([press, release]);
187+
},
188+
);
189+
45190
it("refuses input when a cross-site frame holds the unfocused page's focus", async () => {
46191
const guest = makeGuest({ focused: false, focusedDocument: false });
47192
await expect(guest.send("Input.insertText", { text: "secret" })).rejects.toThrow(

‎apps/desktop/src/preview/GuestInput.ts‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,78 @@ const evaluate = async (debuggee: Electron.Debugger, expression: string) => {
9292
return reply.result?.value;
9393
};
9494

95+
let focusSequence = 0;
96+
97+
/** A CDP pointer press focuses the guest's native view even with focus emulation enabled. */
98+
const sendPointerPress = async (
99+
webContents: Electron.WebContents,
100+
debuggee: Electron.Debugger,
101+
method: string,
102+
params: Record<string, unknown>,
103+
sessionId: string | undefined,
104+
) => {
105+
const host = webContents.hostWebContents;
106+
if (!host || host.isDestroyed() || webContents.focusedFrame) {
107+
return debuggee.sendCommand(method, params, sessionId);
108+
}
109+
const key = JSON.stringify(`__t3PreviewFocus${++focusSequence}`);
110+
await host.executeJavaScript(`(() => {
111+
const active = document.activeElement;
112+
if (!active || active === document.body || active.tagName === "WEBVIEW") return;
113+
globalThis[${key}] = () => {
114+
delete globalThis[${key}];
115+
const current = document.activeElement;
116+
if (active.isConnected && current?.tagName === "WEBVIEW" &&
117+
current.getWebContentsId() === ${webContents.id}) active.focus({ preventScroll: true });
118+
};
119+
})()`);
120+
try {
121+
return await debuggee.sendCommand(method, params, sessionId);
122+
} finally {
123+
if (!host.isDestroyed()) {
124+
await host.executeJavaScript(`globalThis[${key}]?.()`);
125+
}
126+
}
127+
};
128+
129+
const pointerCommands = new WeakMap<Electron.WebContents, Promise<unknown>>();
130+
131+
/** Focus capture crosses processes; later pointer events must not overtake the press. */
132+
const sendPointerCommand = async (
133+
webContents: Electron.WebContents,
134+
debuggee: Electron.Debugger,
135+
method: string,
136+
params: Record<string, unknown>,
137+
sessionId: string | undefined,
138+
) => {
139+
const previous = pointerCommands.get(webContents) ?? Promise.resolve();
140+
const current = previous
141+
.catch(() => {})
142+
.then(() =>
143+
params["type"] === "mousePressed" || params["type"] === "touchStart"
144+
? sendPointerPress(webContents, debuggee, method, params, sessionId)
145+
: debuggee.sendCommand(method, params, sessionId),
146+
);
147+
pointerCommands.set(webContents, current);
148+
try {
149+
return await current;
150+
} finally {
151+
if (pointerCommands.get(webContents) === current) pointerCommands.delete(webContents);
152+
}
153+
};
154+
95155
/** Sends one command to the guest's page, keeping reloads and input inside it. */
96156
export const sendPageCommand = async (
97157
webContents: Electron.WebContents,
98158
debuggee: Electron.Debugger,
99159
method: string,
100160
params: Record<string, unknown>,
161+
sessionId?: string,
101162
): Promise<unknown> => {
163+
if (method === "Input.dispatchMouseEvent" || method === "Input.dispatchTouchEvent") {
164+
return sendPointerCommand(webContents, debuggee, method, params, sessionId);
165+
}
166+
if (sessionId !== undefined) return debuggee.sendCommand(method, params, sessionId);
102167
// Electron's debugger routes Page.reload on a webview to its embedder window.
103168
if (method === "Page.reload") {
104169
if (params["ignoreCache"] === true) webContents.reloadIgnoringCache();

‎apps/desktop/src/snapShot/DesktopSnapShot.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ import * as DesktopClientSettings from "../settings/DesktopClientSettings.ts";
427427
import * as DesktopWindow from "../window/DesktopWindow.ts";
428428
import * as DesktopSnapShot from "./DesktopSnapShot.ts";
429429
import * as SnapShotAccessibility from "./SnapShotAccessibility.ts";
430+
import { CaptureSetupRequiredError } from "./linuxCaptureSession.ts";
430431

431432
const accessibilityApp = {
432433
byPid: accessibilityByPidMock,
@@ -1875,6 +1876,22 @@ it.effect("capture fails closed while snapshots are disabled", () => {
18751876
).pipe(Effect.provide(layerTest("win32")));
18761877
});
18771878

1879+
it.effect("points capture setup failures at SnapShot settings", () => {
1880+
vi.stubEnv("XDG_SESSION_TYPE", "wayland");
1881+
linuxCaptureMock.mockRejectedValueOnce(new CaptureSetupRequiredError("Install the helper."));
1882+
return Effect.scoped(
1883+
Effect.gen(function* () {
1884+
const service = yield* DesktopSnapShot.make;
1885+
yield* service.configure(enabledSettings());
1886+
const failure = yield* Effect.flip(service.capture);
1887+
assert.equal(failure.operation, "setup-required");
1888+
}),
1889+
).pipe(
1890+
Effect.provide(layerTest("linux", { makeDirectory: () => Effect.void })),
1891+
Effect.ensuring(Effect.sync(() => vi.unstubAllEnvs())),
1892+
);
1893+
});
1894+
18781895
it.effect(
18791896
"keeps saved preferences but rechecks access and shortcut delivery after changing desktops",
18801897
() => {

‎apps/desktop/src/snapShot/DesktopSnapShot.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import { niriSocketPath } from "./NiriSnapShot.ts";
5050
import { CaptureShortcutConfig, niriCaptureConfigPath } from "./CaptureShortcutConfig.ts";
5151
import type { PortalCaptureShortcut } from "./PortalCaptureShortcut.ts";
5252
import {
53+
CaptureSetupRequiredError,
5354
isGnomeCaptureSession,
5455
niriCaptureBinding,
5556
portalShortcutTrigger,
@@ -128,6 +129,7 @@ const DesktopSnapShotOperation = Schema.Literals([
128129
"disabled",
129130
"no-window-selected",
130131
"window-unavailable",
132+
"setup-required",
131133
"capture",
132134
]);
133135

@@ -155,6 +157,8 @@ export class DesktopSnapShotError extends Schema.TaggedError<DesktopSnapShotErro
155157
return "No window was selected.";
156158
case "window-unavailable":
157159
return "The active window is not available for capture.";
160+
case "setup-required":
161+
return "Finish SnapShot setup in Settings → SnapShots.";
158162
case "capture":
159163
return "Could not capture the active window.";
160164
}
@@ -164,9 +168,9 @@ export class DesktopSnapShotError extends Schema.TaggedError<DesktopSnapShotErro
164168
const isDesktopSnapShotError = Schema.is(DesktopSnapShotError);
165169

166170
function captureFailure(cause: unknown, captureId?: string): DesktopSnapShotError {
167-
return isDesktopSnapShotError(cause)
168-
? cause
169-
: new DesktopSnapShotError({ operation: "capture", captureId, cause });
171+
if (isDesktopSnapShotError(cause)) return cause;
172+
const operation = cause instanceof CaptureSetupRequiredError ? "setup-required" : "capture";
173+
return new DesktopSnapShotError({ operation, captureId, cause });
170174
}
171175

172176
export class DesktopSnapShot extends Context.Service<

0 commit comments

Comments
 (0)