Skip to content

Commit 623d6ff

Browse files
TimCrookerclaude
andcommitted
Merge origin/main into feat/colorblind-diff-colors
Resolve modify/delete conflict on packages/contracts/src/settings.test.ts by accepting main's deletion — the file was removed in #1538 and the colorblind default is covered by the schema itself. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
2 parents ed8e1e5 + f47c1f1 commit 623d6ff

37 files changed

Lines changed: 1983 additions & 662 deletions

‎README.md‎

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,42 @@
22

33
T3 Code is a minimal web GUI for coding agents (currently Codex and Claude, more coming soon).
44

5-
## How to use
5+
## Installation
66

77
> [!WARNING]
8-
> You need to have [Codex CLI](https://github.com/openai/codex) installed and authorized for T3 Code to work.
8+
> T3 Code currently supports Codex and Claude.
9+
> Install and authenticate at least one provider before use:
10+
>
11+
> - Codex: install [Codex CLI](https://github.com/openai/codex) and run `codex login`
12+
> - Claude: install Claude Code and run `claude auth login`
13+
14+
### Run without installing
915

1016
```bash
1117
npx t3
1218
```
1319

14-
You can also just install the desktop app. It's cooler.
20+
### Desktop app
21+
22+
Install the latest version of the desktop app from [GitHub Releases](https://github.com/pingdotgg/t3code/releases), or from your favorite package registry:
23+
24+
#### Windows (`winget`)
25+
26+
```bash
27+
winget install T3Tools.T3Code
28+
```
29+
30+
#### macOS (Homebrew)
1531

16-
Install the [desktop app from the Releases page](https://github.com/pingdotgg/t3code/releases)
32+
```bash
33+
brew install --cask t3-code
34+
```
35+
36+
#### Arch Linux (AUR)
37+
38+
```bash
39+
yay -S t3code-bin
40+
```
1741

1842
## Some notes
1943

‎apps/desktop/src/confirmDialog.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export async function showDesktopConfirmDialog(
1414
const options = {
1515
type: "question" as const,
1616
buttons: ["No", "Yes"],
17-
defaultId: CONFIRM_BUTTON_INDEX,
17+
defaultId: 0,
1818
cancelId: 0,
1919
noLink: true,
2020
message: normalizedMessage,

‎apps/server/src/codexAppServerManager.test.ts‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,15 +310,28 @@ describe("readCodexAccountSnapshot", () => {
310310
});
311311
});
312312

313-
it("keeps spark enabled for api key accounts", () => {
313+
it("disables spark for api key accounts", () => {
314314
expect(
315315
readCodexAccountSnapshot({
316316
type: "apiKey",
317317
}),
318318
).toEqual({
319319
type: "apiKey",
320320
planType: null,
321-
sparkEnabled: true,
321+
sparkEnabled: false,
322+
});
323+
});
324+
325+
it("disables spark for unknown chatgpt plans", () => {
326+
expect(
327+
readCodexAccountSnapshot({
328+
type: "chatgpt",
329+
330+
}),
331+
).toEqual({
332+
type: "chatgpt",
333+
planType: "unknown",
334+
sparkEnabled: false,
322335
});
323336
});
324337
});
@@ -343,6 +356,16 @@ describe("resolveCodexModelForAccount", () => {
343356
}),
344357
).toBe("gpt-5.3-codex-spark");
345358
});
359+
360+
it("falls back from spark to default for api key auth", () => {
361+
expect(
362+
resolveCodexModelForAccount("gpt-5.3-codex-spark", {
363+
type: "apiKey",
364+
planType: null,
365+
sparkEnabled: false,
366+
}),
367+
).toBe("gpt-5.3-codex");
368+
});
346369
});
347370

348371
describe("startSession", () => {

‎apps/server/src/codexAppServerManager.ts‎

Lines changed: 10 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ import {
2626
isCodexCliVersionSupported,
2727
parseCodexCliVersion,
2828
} from "./provider/codexCliVersion";
29+
import {
30+
readCodexAccountSnapshot,
31+
resolveCodexModelForAccount,
32+
type CodexAccountSnapshot,
33+
} from "./provider/codexAccount";
34+
import { buildCodexInitializeParams, killCodexChildProcess } from "./provider/codexAppServer";
35+
36+
export { buildCodexInitializeParams } from "./provider/codexAppServer";
37+
export { readCodexAccountSnapshot, resolveCodexModelForAccount } from "./provider/codexAccount";
2938

3039
type PendingRequestKey = string;
3140

@@ -96,23 +105,6 @@ interface JsonRpcNotification {
96105
params?: unknown;
97106
}
98107

99-
type CodexPlanType =
100-
| "free"
101-
| "go"
102-
| "plus"
103-
| "pro"
104-
| "team"
105-
| "business"
106-
| "enterprise"
107-
| "edu"
108-
| "unknown";
109-
110-
interface CodexAccountSnapshot {
111-
readonly type: "apiKey" | "chatgpt" | "unknown";
112-
readonly planType: CodexPlanType | null;
113-
readonly sparkEnabled: boolean;
114-
}
115-
116108
export interface CodexAppServerSendTurnInput {
117109
readonly threadId: ThreadId;
118110
readonly input?: string;
@@ -162,50 +154,6 @@ const RECOVERABLE_THREAD_RESUME_ERROR_SNIPPETS = [
162154
"unknown thread",
163155
"does not exist",
164156
];
165-
const CODEX_DEFAULT_MODEL = "gpt-5.3-codex";
166-
const CODEX_SPARK_MODEL = "gpt-5.3-codex-spark";
167-
const CODEX_SPARK_DISABLED_PLAN_TYPES = new Set<CodexPlanType>(["free", "go", "plus"]);
168-
169-
function asObject(value: unknown): Record<string, unknown> | undefined {
170-
if (!value || typeof value !== "object") {
171-
return undefined;
172-
}
173-
return value as Record<string, unknown>;
174-
}
175-
176-
function asString(value: unknown): string | undefined {
177-
return typeof value === "string" ? value : undefined;
178-
}
179-
180-
export function readCodexAccountSnapshot(response: unknown): CodexAccountSnapshot {
181-
const record = asObject(response);
182-
const account = asObject(record?.account) ?? record;
183-
const accountType = asString(account?.type);
184-
185-
if (accountType === "apiKey") {
186-
return {
187-
type: "apiKey",
188-
planType: null,
189-
sparkEnabled: true,
190-
};
191-
}
192-
193-
if (accountType === "chatgpt") {
194-
const planType = (account?.planType as CodexPlanType | null) ?? "unknown";
195-
return {
196-
type: "chatgpt",
197-
planType,
198-
sparkEnabled: !CODEX_SPARK_DISABLED_PLAN_TYPES.has(planType),
199-
};
200-
}
201-
202-
return {
203-
type: "unknown",
204-
planType: null,
205-
sparkEnabled: true,
206-
};
207-
}
208-
209157
export const CODEX_PLAN_MODE_DEVELOPER_INSTRUCTIONS = `<collaboration_mode># Plan Mode (Conversational)
210158
211159
You work in 3 phases, and you should *chat your way* to a great plan before finalizing it. A great plan is very detailed-intent- and implementation-wise-so that it can be handed to another engineer or agent to be implemented right away. It must be **decision complete**, where the implementer does not need to make any decisions.
@@ -358,32 +306,13 @@ function mapCodexRuntimeMode(runtimeMode: RuntimeMode): {
358306
};
359307
}
360308

361-
export function resolveCodexModelForAccount(
362-
model: string | undefined,
363-
account: CodexAccountSnapshot,
364-
): string | undefined {
365-
if (model !== CODEX_SPARK_MODEL || account.sparkEnabled) {
366-
return model;
367-
}
368-
369-
return CODEX_DEFAULT_MODEL;
370-
}
371-
372309
/**
373310
* On Windows with `shell: true`, `child.kill()` only terminates the `cmd.exe`
374311
* wrapper, leaving the actual command running. Use `taskkill /T` to kill the
375312
* entire process tree instead.
376313
*/
377314
function killChildTree(child: ChildProcessWithoutNullStreams): void {
378-
if (process.platform === "win32" && child.pid !== undefined) {
379-
try {
380-
spawnSync("taskkill", ["/pid", String(child.pid), "/T", "/F"], { stdio: "ignore" });
381-
return;
382-
} catch {
383-
// fallback to direct kill
384-
}
385-
}
386-
child.kill();
315+
killCodexChildProcess(child);
387316
}
388317

389318
export function normalizeCodexModelSlug(
@@ -402,19 +331,6 @@ export function normalizeCodexModelSlug(
402331
return normalized;
403332
}
404333

405-
export function buildCodexInitializeParams() {
406-
return {
407-
clientInfo: {
408-
name: "t3code_desktop",
409-
title: "T3 Code Desktop",
410-
version: "0.1.0",
411-
},
412-
capabilities: {
413-
experimentalApi: true,
414-
},
415-
} as const;
416-
}
417-
418334
function buildCodexCollaborationMode(input: {
419335
readonly interactionMode?: "default" | "plan";
420336
readonly model?: string;

‎apps/server/src/git/Layers/ClaudeTextGeneration.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ import {
2929
sanitizeThreadTitle,
3030
toJsonSchemaObject,
3131
} from "../Utils.ts";
32-
import { normalizeClaudeModelOptions } from "../../provider/Layers/ClaudeProvider.ts";
32+
import { normalizeClaudeModelOptionsWithCapabilities } from "@t3tools/shared/model";
3333
import { ServerSettingsService } from "../../serverSettings.ts";
34+
import { getClaudeModelCapabilities } from "../../provider/Layers/ClaudeProvider.ts";
3435

3536
const CLAUDE_TIMEOUT_MS = 180_000;
3637

@@ -84,8 +85,8 @@ const makeClaudeTextGeneration = Effect.gen(function* () {
8485
}): Effect.Effect<S["Type"], TextGenerationError, S["DecodingServices"]> =>
8586
Effect.gen(function* () {
8687
const jsonSchemaStr = JSON.stringify(toJsonSchemaObject(outputSchemaJson));
87-
const normalizedOptions = normalizeClaudeModelOptions(
88-
modelSelection.model,
88+
const normalizedOptions = normalizeClaudeModelOptionsWithCapabilities(
89+
getClaudeModelCapabilities(modelSelection.model),
8990
modelSelection.options,
9091
);
9192
const settings = {

‎apps/server/src/git/Layers/CodexTextGeneration.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ import {
2828
sanitizeThreadTitle,
2929
toJsonSchemaObject,
3030
} from "../Utils.ts";
31-
import { normalizeCodexModelOptions } from "../../provider/Layers/CodexProvider.ts";
31+
import { getCodexModelCapabilities } from "../../provider/Layers/CodexProvider.ts";
3232
import { ServerSettingsService } from "../../serverSettings.ts";
33+
import { normalizeCodexModelOptionsWithCapabilities } from "@t3tools/shared/model";
3334

3435
const CODEX_GIT_TEXT_GENERATION_REASONING_EFFORT = "low";
3536
const CODEX_TIMEOUT_MS = 180_000;
@@ -156,8 +157,8 @@ const makeCodexTextGeneration = Effect.gen(function* () {
156157
).pipe(Effect.catch(() => Effect.undefined));
157158

158159
const runCodexCommand = Effect.gen(function* () {
159-
const normalizedOptions = normalizeCodexModelOptions(
160-
modelSelection.model,
160+
const normalizedOptions = normalizeCodexModelOptionsWithCapabilities(
161+
getCodexModelCapabilities(modelSelection.model),
161162
modelSelection.options,
162163
);
163164
const reasoningEffort =

0 commit comments

Comments
 (0)