Skip to content

Commit b51229c

Browse files
committed
chore: merge main into provider documentation fix
2 parents c169520 + 71646e0 commit b51229c

831 files changed

Lines changed: 39789 additions & 4261 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const INERT = [
1414

1515
// Shared test setup and vendored mobile dependencies affect every package.
1616
const RUNS_EVERYTHING = [
17-
/^packages\/shared\/src\/(HostProcess|testing\/longTempDir)\.ts$/,
17+
/^packages\/shared\/src\/(HostProcess|testing\/(longTempDir|providerEnv))\.ts$/,
1818
/^apps\/mobile\/deps\//,
1919
];
2020

‎.github/scripts/thread-transfer-report.cjs‎

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -300,18 +300,28 @@ async function resolve({ github, context, core }) {
300300
core.setOutput("publish", "false");
301301
return;
302302
}
303-
const workflowRuns = await github.paginate(github.rest.actions.listWorkflowRuns, {
304-
owner,
305-
repo,
306-
workflow_id: source.workflow_id,
307-
branch: pull.base.ref,
308-
event: "push",
309-
status: "success",
310-
per_page: 100,
311-
});
303+
// One page each for the exact base and the newest runs; paging through
304+
// every successful main run costs up to ten requests to keep 20.
305+
const listRuns = async (filters) => {
306+
const { data } = await github.rest.actions.listWorkflowRuns({
307+
owner,
308+
repo,
309+
workflow_id: source.workflow_id,
310+
branch: pull.base.ref,
311+
event: "push",
312+
status: "success",
313+
per_page: 20,
314+
...filters,
315+
});
316+
return data.workflow_runs;
317+
};
318+
const [baseRuns, recentRuns] = await Promise.all([
319+
listRuns({ head_sha: pull.base.sha }),
320+
listRuns({}),
321+
]);
312322
const orderedRuns = [
313-
...workflowRuns.filter((run) => run.head_sha === pull.base.sha),
314-
...workflowRuns.filter((run) => run.head_sha !== pull.base.sha),
323+
...baseRuns,
324+
...recentRuns.filter((run) => run.head_sha !== pull.base.sha),
315325
].slice(0, 20);
316326

317327
let baselineRun;

‎.github/scripts/thread-transfer-report.test.cjs‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,18 @@ test("validates the fixed artifact schema", () => {
5555
test("resolves a fallback PR with a redacted head repo and exact main baseline", async () => {
5656
const outputs = {};
5757
const listWorkflowRunArtifacts = () => {};
58-
const listWorkflowRuns = () => {};
58+
// The exact base run sits far past the newest page of main CI runs.
59+
const mainRuns = Array.from({ length: 1_000 }, (_, index) => ({
60+
id: 1_000 - index,
61+
head_sha: index === 900 ? "base-sha" : `main-sha-${index}`,
62+
}));
63+
const listWorkflowRuns = async ({ head_sha, per_page }) => ({
64+
data: {
65+
workflow_runs: mainRuns
66+
.filter((run) => head_sha === undefined || run.head_sha === head_sha)
67+
.slice(0, per_page),
68+
},
69+
});
5970
const listPullRequestsAssociatedWithCommit = () => {};
6071
const github = {
6172
paginate: async (method, input) => {
@@ -77,9 +88,6 @@ test("resolves a fallback PR with a redacted head repo and exact main baseline",
7788
},
7889
];
7990
}
80-
if (method === listWorkflowRuns) {
81-
return [{ id: 1, head_sha: "base-sha" }];
82-
}
8391
throw new Error("unexpected pagination call");
8492
},
8593
rest: {
@@ -123,7 +131,7 @@ test("resolves a fallback PR with a redacted head repo and exact main baseline",
123131
assert.equal(outputs.publish, "true");
124132
assert.equal(outputs.pull_number, "5350");
125133
assert.equal(outputs.pr_artifact, "true");
126-
assert.equal(outputs.baseline_run_id, "1");
134+
assert.equal(outputs.baseline_run_id, "100");
127135
assert.equal(outputs.baseline_matches_base, "true");
128136
});
129137

‎.github/workflows/pr-vouch.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ permissions:
2020
jobs:
2121
collect-targets:
2222
name: Collect PR targets
23+
# Most comments are not recheck commands; skip them before a runner starts.
24+
if: >-
25+
github.event_name != 'issue_comment' ||
26+
(github.event.issue.pull_request && contains(github.event.comment.body, '/recheck-vouch'))
2327
runs-on: ubuntu-24.04
2428
outputs:
2529
targets: ${{ steps.collect.outputs.targets }}

‎.github/workflows/release-desktop.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,14 @@ jobs:
203203
native/hyprland-snap-shot/target/${{ inputs.rust_target }}/release/t3-hyprland-snap-shot
204204
key: linux-capture-helpers-${{ inputs.rust_target }}-${{ hashFiles('native/kde-snap-shot/Cargo.lock', 'native/kde-snap-shot/Cargo.toml', 'native/kde-snap-shot/src/**', 'native/hyprland-snap-shot/Cargo.lock', 'native/hyprland-snap-shot/Cargo.toml', 'native/hyprland-snap-shot/src/**', 'native/hyprland-snap-shot/protocols/**') }}
205205

206+
- name: Ensure Rosetta for macOS x64 bytecode generation
207+
if: inputs.platform == 'mac' && inputs.arch == 'x64'
208+
shell: bash
209+
run: |
210+
if [[ "$(uname -m)" == "arm64" ]] && ! /usr/bin/arch -x86_64 /usr/bin/true; then
211+
sudo /usr/sbin/softwareupdate --install-rosetta --agree-to-license
212+
fi
213+
206214
- name: Setup Rust
207215
if: steps.resource_monitor_cache.outputs.cache-hit != 'true' || (inputs.platform == 'linux' && steps.capture_helper_cache.outputs.cache-hit != 'true')
208216
uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable

‎.github/workflows/release.yml‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,12 @@ jobs:
395395
(github.event_name != 'schedule' || needs.resolve_commit.outputs.has_changes == 'true')
396396
runs-on: blacksmith-8vcpu-ubuntu-2404
397397
timeout-minutes: 5
398+
# Previews build any branch, but production admits only main and v* tags.
399+
# The empty name runs previews with no environment, so their Clerk and relay
400+
# ids come from .env.example. Everything else matches nightly: the tracing
401+
# read below needs only repository-level Cloudflare credentials.
398402
environment:
399-
name: production
403+
name: ${{ inputs.channel != 'preview' && 'production' || '' }}
400404
outputs:
401405
clerk_publishable_key: ${{ steps.public_config.outputs.clerk_publishable_key }}
402406
clerk_jwt_template: ${{ steps.public_config.outputs.clerk_jwt_template }}
@@ -462,9 +466,19 @@ jobs:
462466
- id: public_config
463467
name: Resolve production relay public config
464468
shell: bash
469+
env:
470+
PREVIEW: ${{ inputs.channel == 'preview' }}
465471
run: |
466472
set -euo pipefail
467473
474+
if [[ "$PREVIEW" == "true" ]]; then
475+
env_example() { sed -n "s|^T3CODE_$1=||p" .env.example; }
476+
CLERK_PUBLISHABLE_KEY="$(env_example CLERK_PUBLISHABLE_KEY)"
477+
CLERK_JWT_TEMPLATE="$(env_example CLERK_JWT_TEMPLATE)"
478+
CLERK_CLI_OAUTH_CLIENT_ID="$(env_example CLERK_CLI_OAUTH_CLIENT_ID)"
479+
RELAY_DOMAIN="$(sed -n 's|^T3CODE_RELAY_URL=https://||p' .env.example)"
480+
fi
481+
468482
relay_domain="${RELAY_DOMAIN:-}"
469483
if [[ -z "$relay_domain" && -n "${RELAY_API_ZONE_NAME:-}" ]]; then
470484
relay_domain="relay.$RELAY_API_ZONE_NAME"

‎AGENTS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# T3 Code
22

3-
T3 Code is a minimal GUI for coding agents. A Node WebSocket server wraps provider CLIs and agents (Codex, Claude Code, Cursor, Grok, OpenCode, Antigravity, Pi, Muse Code, fx) and serves web, desktop, and mobile clients.
3+
T3 Code is a minimal GUI for coding agents. A Node WebSocket server wraps provider CLIs and agents (Codex, Claude Code, Cursor, Grok, OpenCode, Antigravity, Kiro, Pi, Muse Code, fx) and serves web, desktop, and mobile clients.
44

55
You can think of T3 Code as an open source "bring-your-own-subscription" alternative to apps like Claude Desktop, Codex App, Cursor Glass and Conductor.
66

@@ -68,7 +68,7 @@ The most common defect in this repo is a change that works on the path you teste
6868

6969
- **Entry points.** A behavior reachable from the chat view is usually also reachable from Settings, the command palette, and a keybinding. Fixing one is not fixing the feature.
7070
- **Clients.** Web, desktop (wraps web, adds Electron shell/IPC), and mobile (React Native, separate navigation). Shared logic lives in `packages/client-runtime`
71-
- **Providers.** Codex, Claude, Cursor, Grok, OpenCode, Antigravity, Pi, Muse Code, and fx each have an adapter. Provider-shaped features need a decision per adapter, even if the decision is "not supported here".
71+
- **Providers.** Codex, Claude, Cursor, Grok, OpenCode, Antigravity, Kiro, Pi, Muse Code, and fx each have an adapter. Provider-shaped features need a decision per adapter, even if the decision is "not supported here".
7272
- **Agents.** A capability a user can trigger is usually one an agent should reach through MCP tools, and scheduled tasks run the same paths. That only works when it is a service method, not handler code.
7373
- **Contracts.** Anything crossing the wire is typed in `packages/contracts`. Change the schema and the server, web, mobile, and desktop all follow.
7474
- **Reverse states.** If you added a way in, add the way out and the way to see it. Snooze needs unsnooze. Close needs reopen. A one-way door is a bug.

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,16 @@ const bootstrap = Effect.gen(function* () {
245245
}
246246
yield* primaryBackend.start;
247247
yield* logBootstrapInfo("bootstrap backend start requested");
248+
// WSL-only fallback can change the primary endpoint before readiness.
249+
const config = yield* primaryBackend.currentConfig;
250+
if (
251+
!environment.isDevelopment &&
252+
!settings.wslOnly &&
253+
Option.isSome(config) &&
254+
Option.isNone(config.value.preflightFailure)
255+
) {
256+
yield* desktopWindow.ensureMain;
257+
}
248258
yield* appActivation.start.pipe(
249259
Effect.tap(() => logBootstrapInfo("desktop app control socket ready")),
250260
Effect.catch((error) => logStartupError("desktop app control socket unavailable", { error })),

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

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import * as Layer from "effect/Layer";
55
import * as Ref from "effect/Ref";
66
import * as TestClock from "effect/testing/TestClock";
77

8+
import * as HostProcess from "@t3tools/shared/HostProcess";
9+
810
import type * as Electron from "electron";
911

1012
import * as ElectronApp from "../electron/ElectronApp.ts";
@@ -20,6 +22,7 @@ function layerElectronApp(
2022
appListeners: Map<string, (...args: readonly unknown[]) => void>,
2123
quit: Effect.Effect<void> = Effect.void,
2224
exit: (code: number) => Effect.Effect<void> = () => Effect.void,
25+
relaunch: (options: Electron.RelaunchOptions) => Effect.Effect<void> = () => Effect.void,
2326
) {
2427
const registerListener = (eventName: string, listener: (...args: readonly unknown[]) => void) =>
2528
Effect.acquireRelease(
@@ -40,7 +43,7 @@ function layerElectronApp(
4043
requestSingleInstanceLock: Effect.succeed(true),
4144
quit,
4245
exit,
43-
relaunch: () => Effect.void,
46+
relaunch,
4447
setPath: () => Effect.void,
4548
setName: () => Effect.void,
4649
setAboutPanelOptions: () => Effect.void,
@@ -223,6 +226,50 @@ describe("DesktopLifecycle", () => {
223226
}),
224227
);
225228

229+
it.effect("relaunches without the app link that launched it", () =>
230+
Effect.gen(function* () {
231+
const relaunched = yield* Deferred.make<Electron.RelaunchOptions>();
232+
const layerEnvironment = Layer.succeed(DesktopEnvironment.DesktopEnvironment, {
233+
platform: "linux",
234+
isDevelopment: false,
235+
} as DesktopEnvironment.DesktopEnvironment["Service"]);
236+
const layer = DesktopLifecycle.layer.pipe(
237+
Layer.provideMerge(
238+
layerElectronApp(
239+
new Map(),
240+
Effect.void,
241+
() => Effect.void,
242+
(options) => Deferred.succeed(relaunched, options).pipe(Effect.asVoid),
243+
),
244+
),
245+
Layer.provideMerge(layerElectronTheme),
246+
Layer.provideMerge(layerElectronWindow()),
247+
Layer.provideMerge(layerDesktopWindow()),
248+
Layer.provideMerge(layerEnvironment),
249+
Layer.provideMerge(DesktopShutdown.layer),
250+
Layer.provideMerge(DesktopState.layer),
251+
);
252+
253+
const options = yield* Effect.gen(function* () {
254+
const lifecycle = yield* DesktopLifecycle.DesktopLifecycle;
255+
yield* (yield* DesktopShutdown.DesktopShutdown).markComplete;
256+
yield* lifecycle.relaunch("network access changed");
257+
return yield* Deferred.await(relaunched);
258+
}).pipe(
259+
Effect.provide(layer),
260+
Effect.provideService(HostProcess.ExecutablePath, "/opt/T3 Code/t3code"),
261+
Effect.provideService(HostProcess.Arguments, [
262+
"/opt/T3 Code/t3code",
263+
"--no-sandbox",
264+
"T3CODE://pair?token=spent",
265+
"t3code://new?prompt=hello",
266+
]),
267+
);
268+
269+
assert.deepEqual(options, { execPath: "/opt/T3 Code/t3code", args: ["--no-sandbox"] });
270+
}),
271+
);
272+
226273
it.effect("exits on a repeated quit only once shutdown has stalled", () =>
227274
Effect.gen(function* () {
228275
const appListeners = new Map<string, (...args: readonly unknown[]) => void>();

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ import * as Scope from "effect/Scope";
99

1010
import type * as Electron from "electron";
1111

12+
import * as HostProcess from "@t3tools/shared/HostProcess";
13+
1214
import * as DesktopEnvironment from "./DesktopEnvironment.ts";
1315
import { makeComponentLogger } from "./DesktopObservability.ts";
1416
import * as DesktopShutdown from "./DesktopShutdown.ts";
1517
import * as ElectronApp from "../electron/ElectronApp.ts";
18+
import * as ElectronProtocol from "../electron/ElectronProtocol.ts";
1619
import * as ElectronTheme from "../electron/ElectronTheme.ts";
1720
import * as ElectronWindow from "../electron/ElectronWindow.ts";
1821
import * as DesktopState from "./DesktopState.ts";
@@ -223,9 +226,12 @@ export const make = DesktopLifecycle.of({
223226
yield* electronApp.exit(75);
224227
return;
225228
}
229+
// Startup already acted on the app link that launched it; passing it on replays it.
230+
const appLinkPrefix = `${ElectronProtocol.getDesktopScheme(environment.isDevelopment)}:`;
231+
const args = yield* HostProcess.Arguments;
226232
yield* electronApp.relaunch({
227-
execPath: process.execPath,
228-
args: process.argv.slice(1),
233+
execPath: yield* HostProcess.ExecutablePath,
234+
args: args.slice(1).filter((arg) => !arg.toLowerCase().startsWith(appLinkPrefix)),
229235
});
230236
yield* electronApp.exit(0);
231237
}).pipe(

0 commit comments

Comments
 (0)