The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 25, 19:45 UTC
renames
Theo Browne committed
Feb 9, 2026 at 22:18 UTC
5120f7fec702a4bfd09ae64048ee99708247993a
38 files changed
+56
-56
AGENTS.md
+2
-2
@@ -14,7 +14,7 @@ If a tradeoff is required, choose correctness and robustness over short-term con
14
15
## Package Roles
16
- `apps/server`: Node.js WebSocket server. Wraps Codex app-server (JSON-RPC over stdio), serves the React web app, and manages provider sessions.
17
-- `apps/renderer`: React/Vite UI. Owns session UX, conversation/event rendering, and client-side state. Connects to the server via WebSocket.
17
+- `apps/web`: React/Vite UI. Owns session UX, conversation/event rendering, and client-side state. Connects to the server via WebSocket.
18
- `packages/contracts`: Shared Zod schemas and TypeScript contracts for provider events, WebSocket protocol, and model/session types.
19
20
## Codex App Server (Important)
@@ -24,7 +24,7 @@ How we use it in this codebase:
24
- Session startup/resume and turn lifecycle are brokered in `apps/server/src/codexAppServerManager.ts`.
25
- Provider dispatch and thread event logging are coordinated in `apps/server/src/providerManager.ts`.
26
- WebSocket server routes NativeApi methods in `apps/server/src/wsServer.ts`.
27
-- Renderer consumes provider event streams via WebSocket push on channel `providers.event`.
27
+- Web app consumes provider event streams via WebSocket push on channel `providers.event`.
28
29
Docs:
30
- Codex App Server docs: https://developers.openai.com/codex/sdk/#app-server
README.md
+7
-7
@@ -29,9 +29,9 @@ T3 Code runs as a **Node.js WebSocket server** that wraps `codex app-server` (JS
29
30
## Workspace layout
31
32
-- `/apps/server`: Node.js WebSocket server. Wraps Codex app-server, serves the built renderer, and opens the browser on start.
33
-- `/apps/renderer`: React + Vite UI. Session control, conversation, and provider event rendering. Connects to the server via WebSocket.
34
-- `/apps/desktop`: Electron shell. Spawns a desktop-scoped `t3` backend process and loads the shared renderer.
32
+- `/apps/server`: Node.js WebSocket server. Wraps Codex app-server, serves the built web app, and opens the browser on start.
33
+- `/apps/web`: React + Vite UI. Session control, conversation, and provider event rendering. Connects to the server via WebSocket.
34
+- `/apps/desktop`: Electron shell. Spawns a desktop-scoped `t3` backend process and loads the shared web app.
35
- `/packages/contracts`: Shared Zod schemas and TypeScript contracts for provider events, WebSocket protocol, and model/session types.
36
37
## Codex prerequisites
@@ -61,9 +61,9 @@ npx t3
61
62
- `bun run dev` — Starts contracts, server, and web dev tasks via Turborepo's parallel task runner.
63
- `bun run dev:server` — Starts just the WebSocket server (uses tsx for TS execution).
64
-- `bun run dev:web` — Starts just the Vite dev server for the renderer.
65
-- `bun run start` — Runs the production server (serves built renderer as static files).
66
-- `bun run build` — Builds contracts, renderer, and server through Turbo.
64
+- `bun run dev:web` — Starts just the Vite dev server for the web app.
65
+- `bun run start` — Runs the production server (serves built web app as static files).
66
+- `bun run build` — Builds contracts, web app, and server through Turbo.
67
- `bun run typecheck` — Strict TypeScript checks for all packages.
68
- `bun run test` — Runs workspace tests.
69
@@ -76,7 +76,7 @@ T3 Code has a global runtime mode switch in the chat toolbar:
76
77
## Provider architecture
78
79
-The renderer communicates with the server via WebSocket using a simple JSON-RPC-style protocol:
79
+The web app communicates with the server via WebSocket using a simple JSON-RPC-style protocol:
80
81
- **Request/Response**: `{ id, method, params }` → `{ id, result }` or `{ id, error }`
82
- **Push events**: `{ type: "push", channel, data }` for streaming provider events
apps/desktop/package.json
+1
-1
@@ -4,7 +4,7 @@
4
"private": true,
5
"main": "dist-electron/main.js",
6
"scripts": {
7
- "dev": "bun run --cwd ../server build && concurrently -k -n BUNDLE,RENDERER,ELECTRON \"bun run dev:bundle\" \"bun run --cwd ../renderer dev\" \"bun run dev:electron\"",
7
+ "dev": "bun run --cwd ../server build && concurrently -k -n BUNDLE,WEB,ELECTRON \"bun run dev:bundle\" \"bun run --cwd ../web dev\" \"bun run dev:electron\"",
8
"dev:bundle": "tsup --watch",
9
"dev:electron": "bun run scripts/dev-electron.mjs",
10
"build": "tsup",
apps/desktop/scripts/smoke-test.mjs
+1
-1
@@ -8,7 +8,7 @@ const rootDir = resolve(__dirname, "../../..");
8
const electronBin = resolve(desktopDir, "node_modules/.bin/electron");
9
const mainJs = resolve(desktopDir, "dist-electron/main.js");
10
11
-console.log("Building contracts + renderer + server + desktop...");
11
+console.log("Building contracts + web + server + desktop...");
12
execSync("bun run build", { cwd: rootDir, stdio: "inherit" });
13
14
console.log("\nLaunching Electron smoke test...");
apps/desktop/src/main.ts
+4
-4
@@ -14,7 +14,7 @@ fixPath();
14
const PICK_FOLDER_CHANNEL = "desktop:pick-folder";
15
const ROOT_DIR = path.resolve(__dirname, "../../..");
16
const BACKEND_ENTRY = path.join(ROOT_DIR, "apps/server/dist/index.js");
17
-const RENDERER_ENTRY = path.join(ROOT_DIR, "apps/renderer/dist/index.html");
17
+const WEB_ENTRY = path.join(ROOT_DIR, "apps/web/dist/index.html");
18
const STATE_DIR = path.join(os.homedir(), ".t3", "userdata");
19
const isDevelopment = Boolean(process.env.VITE_DEV_SERVER_URL);
20
@@ -167,10 +167,10 @@ function createWindow(): BrowserWindow {
167
if (isDevelopment) {
168
void window.loadURL(process.env.VITE_DEV_SERVER_URL as string);
169
} else {
170
- if (!fs.existsSync(RENDERER_ENTRY)) {
171
- throw new Error(`Renderer bundle missing at ${RENDERER_ENTRY}`);
170
+ if (!fs.existsSync(WEB_ENTRY)) {
171
+ throw new Error(`Web bundle missing at ${WEB_ENTRY}`);
172
}
173
- void window.loadFile(RENDERER_ENTRY);
173
+ void window.loadFile(WEB_ENTRY);
174
}
175
176
window.on("closed", () => {
apps/server/package.json
+1
-1
@@ -24,7 +24,7 @@
24
},
25
"devDependencies": {
26
"@t3tools/contracts": "workspace:*",
27
- "@t3tools/renderer": "workspace:*",
27
+ "@t3tools/web": "workspace:*",
28
"@types/node": "^22.10.2",
29
"@types/ws": "^8.5.13",
30
"tsup": "^8.3.5",
apps/server/scripts/bundle-client.mjs
+6
-6
@@ -1,5 +1,5 @@
1
/**
2
- * Copies the built renderer into dist/client/ so the published npm package
2
+ * Copies the built web app into dist/client/ so the published npm package
3
* includes the web UI. This runs as a post-build step.
4
*/
5
import fs from "node:fs";
@@ -7,15 +7,15 @@ import path from "node:path";
7
import { fileURLToPath } from "node:url";
8
9
const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
-const rendererDist = path.resolve(__dirname, "../../renderer/dist");
10
+const webDist = path.resolve(__dirname, "../../web/dist");
11
const target = path.resolve(__dirname, "../dist/client");
12
13
-if (!fs.existsSync(rendererDist)) {
13
+if (!fs.existsSync(webDist)) {
14
console.log(
15
- "⚠ Renderer dist not found — skipping client bundle. Run `bun run --cwd apps/renderer build` first.",
15
+ "⚠ Web dist not found — skipping client bundle. Run `bun run --cwd apps/web build` first.",
16
);
17
process.exit(0);
18
}
19
20
-fs.cpSync(rendererDist, target, { recursive: true });
21
-console.log("✓ Bundled renderer into dist/client");
20
+fs.cpSync(webDist, target, { recursive: true });
21
+console.log("✓ Bundled web app into dist/client");
apps/server/src/index.ts
+4
-4
@@ -84,8 +84,8 @@ function resolveStaticDir(): string | undefined {
84
// Not bundled — check monorepo layout
85
}
86
87
- // Monorepo layout: apps/server/dist/index.js → apps/renderer/dist/
88
- const monorepoClient = path.resolve(__dirname, "../../renderer/dist");
87
+ // Monorepo layout: apps/server/dist/index.js → apps/web/dist/
88
+ const monorepoClient = path.resolve(__dirname, "../../web/dist");
89
try {
90
const stat = fs.statSync(path.join(monorepoClient, "index.html"));
91
if (stat.isFile()) return monorepoClient;
@@ -109,8 +109,8 @@ async function main() {
109
const staticDir = devUrl ? undefined : resolveStaticDir();
110
111
if (!devUrl && !staticDir) {
112
- logger.warn("renderer bundle missing and no VITE_DEV_SERVER_URL; web UI unavailable", {
113
- hint: "Run `bun run --cwd apps/renderer build` or set VITE_DEV_SERVER_URL for dev mode.",
112
+ logger.warn("web bundle missing and no VITE_DEV_SERVER_URL; web UI unavailable", {
113
+ hint: "Run `bun run --cwd apps/web build` or set VITE_DEV_SERVER_URL for dev mode.",
114
});
115
}
116
apps/server/src/wsServer.ts
+1
-1
@@ -109,7 +109,7 @@ export function createServer(options: ServerOptions) {
109
return;
110
}
111
112
- // Serve static files from the renderer build
112
+ // Serve static files from the web app build
113
if (!staticDir) {
114
res.writeHead(503, { "Content-Type": "text/plain" });
115
res.end("No static directory configured and no dev URL set.");
apps/web/index.html
renamed
apps/web/package.json
renamed
+1
-1
@@ -1,5 +1,5 @@
1
{
2
- "name": "@t3tools/renderer",
2
+ "name": "@t3tools/web",
3
"version": "0.0.0",
4
"private": true,
5
"type": "module",
apps/web/src/App.tsx
renamed
apps/web/src/components/ChatMarkdown.tsx
renamed
apps/web/src/components/ChatView.tsx
renamed
apps/web/src/components/DiffPanel.tsx
renamed
apps/web/src/components/Sidebar.tsx
renamed
apps/web/src/env.ts
renamed
+1
-1
@@ -1,6 +1,6 @@
1
/**
2
* True when running inside the Electron preload bridge, false in a regular browser.
3
- * The preload script sets window.nativeApi via contextBridge before any renderer
3
+ * The preload script sets window.nativeApi via contextBridge before any web-app
4
* code executes, so this is reliable at module load time.
5
*/
6
export const isElectron =
apps/web/src/historyBootstrap.test.ts
renamed
apps/web/src/historyBootstrap.ts
renamed
apps/web/src/hooks/useTheme.ts
renamed
apps/web/src/index.css
renamed
apps/web/src/main.tsx
renamed
apps/web/src/model-logic.test.ts
renamed
apps/web/src/model-logic.ts
renamed
apps/web/src/persistenceSchema.test.ts
renamed
apps/web/src/persistenceSchema.ts
renamed
apps/web/src/session-logic.test.ts
renamed
apps/web/src/session-logic.ts
renamed
apps/web/src/store.test.ts
renamed
apps/web/src/store.ts
renamed
apps/web/src/types.ts
renamed
apps/web/src/vite-env.d.ts
renamed
apps/web/src/wsNativeApi.ts
renamed
apps/web/src/wsTransport.ts
renamed
apps/web/tsconfig.json
renamed
apps/web/vite.config.ts
renamed
+1
-1
@@ -12,7 +12,7 @@ export default defineConfig({
12
tailwindcss(),
13
],
14
define: {
15
- // In dev mode, tell the renderer where the WebSocket server lives
15
+ // In dev mode, tell the web app where the WebSocket server lives
16
"import.meta.env.VITE_WS_URL": JSON.stringify(
17
process.env.VITE_WS_URL ?? "",
18
),
bun.lock
+23
-23
@@ -28,8 +28,28 @@
28
"wait-on": "^8.0.2",
29
},
30
},
31
- "apps/renderer": {
32
- "name": "@t3tools/renderer",
31
+ "apps/server": {
32
+ "name": "t3",
33
+ "version": "0.1.0",
34
+ "bin": {
35
+ "t3": "./dist/index.js",
36
+ },
37
+ "dependencies": {
38
+ "open": "^10.1.0",
39
+ "ws": "^8.18.0",
40
+ },
41
+ "devDependencies": {
42
+ "@t3tools/contracts": "workspace:*",
43
+ "@t3tools/web": "workspace:*",
44
+ "@types/node": "^22.10.2",
45
+ "@types/ws": "^8.5.13",
46
+ "tsup": "^8.3.5",
47
+ "tsx": "^4.19.0",
48
+ "typescript": "^5.7.3",
49
+ },
50
+ },
51
+ "apps/web": {
52
+ "name": "@t3tools/web",
53
"version": "0.0.0",
54
"dependencies": {
55
"@t3tools/contracts": "workspace:*",
@@ -53,26 +73,6 @@
73
"vite": "^6.0.5",
74
},
75
},
56
- "apps/server": {
57
- "name": "t3",
58
- "version": "0.1.0",
59
- "bin": {
60
- "t3": "./dist/index.js",
61
- },
62
- "dependencies": {
63
- "open": "^10.1.0",
64
- "ws": "^8.18.0",
65
- },
66
- "devDependencies": {
67
- "@t3tools/contracts": "workspace:*",
68
- "@t3tools/renderer": "workspace:*",
69
- "@types/node": "^22.10.2",
70
- "@types/ws": "^8.5.13",
71
- "tsup": "^8.3.5",
72
- "tsx": "^4.19.0",
73
- "typescript": "^5.7.3",
74
- },
75
- },
76
"packages/contracts": {
77
"name": "@t3tools/contracts",
78
"version": "0.0.0",
@@ -294,7 +294,7 @@
294
295
"@t3tools/desktop": ["@t3tools/desktop@workspace:apps/desktop"],
296
297
- "@t3tools/renderer": ["@t3tools/renderer@workspace:apps/renderer"],
297
+ "@t3tools/web": ["@t3tools/web@workspace:apps/web"],
298
299
"@tailwindcss/node": ["@tailwindcss/node@4.1.18", "", { "dependencies": { "@jridgewell/remapping": "^2.3.4", "enhanced-resolve": "^5.18.3", "jiti": "^2.6.1", "lightningcss": "1.30.2", "magic-string": "^0.30.21", "source-map-js": "^1.2.1", "tailwindcss": "4.1.18" } }, "sha512-DoR7U1P7iYhw16qJ49fgXUlry1t4CpXeErJHnQ44JgTSKMaZUdf17cfn5mHchfJ4KRBZRFA/Coo+MUF5+gOaCQ=="],
300
package.json
+3
-3
@@ -6,14 +6,14 @@
6
"packages/*"
7
],
8
"scripts": {
9
- "dev": "T3CODE_LOG_WS_EVENTS=1 VITE_WS_URL=ws://localhost:3773 turbo run dev --ui=tui --filter=@t3tools/contracts --filter=@t3tools/renderer --filter=t3 --parallel",
9
+ "dev": "T3CODE_LOG_WS_EVENTS=1 VITE_WS_URL=ws://localhost:3773 turbo run dev --ui=tui --filter=@t3tools/contracts --filter=@t3tools/web --filter=t3 --parallel",
10
"dev:server": "bun run build:contracts && bun run --cwd apps/server dev",
11
- "dev:web": "VITE_WS_URL=ws://localhost:3773 bun run --cwd apps/renderer dev",
11
+ "dev:web": "VITE_WS_URL=ws://localhost:3773 bun run --cwd apps/web dev",
12
"dev:desktop": "bun run --cwd apps/desktop dev",
13
"start": "node apps/server/dist/index.js",
14
"start:desktop": "bun run --cwd apps/desktop start",
15
"build": "turbo run build",
16
- "build:desktop": "bun run build:contracts && bun run --cwd apps/renderer build && bun run --cwd apps/server build && bun run --cwd apps/desktop build",
16
+ "build:desktop": "bun run build:contracts && bun run --cwd apps/web build && bun run --cwd apps/server build && bun run --cwd apps/desktop build",
17
"typecheck": "turbo run typecheck",
18
"lint": "oxlint --report-unused-disable-directives",
19
"test": "turbo run test",