From 5815ba24e2478b2801fab98163e72dd476e5c280 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Sun, 8 Mar 2026 18:20:05 -0700 Subject: [PATCH 01/36] Add pull request template with contribution notice and review checklist (#582) * Add PR template with contribution notice and review checklist - Add `.github/pull_request_template.md` - Set expectations that external PRs may not be reviewed or merged - Require clear change rationale plus UI before/after media when applicable * Add contribution policy notice and link detailed guidelines - add CONTRIBUTING.md with clear expectations for external PRs - update README to direct would-be contributors to CONTRIBUTING.md first --- .github/pull_request_template.md | 30 ++++++++++++++++ CONTRIBUTING.md | 61 ++++++++++++++++++++++++++++++++ README.md | 4 +++ 3 files changed, 95 insertions(+) create mode 100644 .github/pull_request_template.md create mode 100644 CONTRIBUTING.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000000..8b0c2224ae --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,30 @@ +## Before You Open This PR + +We are not actively accepting contributions right now. + +You can still open a PR, but please do so knowing there is a high chance we may close it without merging it, or never review it. + +Small, focused PRs are strongly preferred. Bug fixes are most likely to be merged. New features will most likely just annoy us. + +If you file a 1,000+ line PR with a bunch of new features, we will probably ban you from the repo going forward. + +## What Changed + +Describe the change clearly and keep scope tight. + +## Why This Change + +Explain the problem being solved and why this approach is the right one. + +## UI Changes + +If this PR changes anything resembling UI, include clear before/after images. + +If the change involves motion, transitions, or other behavior that is difficult to evaluate from screenshots alone, include a short video. + +## Checklist + +- [ ] This PR is small and focused. +- [ ] I explained what changed and why. +- [ ] I included clear before/after images for UI changes. +- [ ] I included a video for animation or interaction changes that need motion to evaluate. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..fb1992fe73 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,61 @@ +# Contributing + +## Read This First + +We are not actively accepting contributions right now. + +You can still open an issue or PR, but please do so knowing there is a high chance we close it, defer it forever, or never look at it. + +If that sounds annoying, that is because it is. This project is still early and we are trying to keep scope, quality, and direction under control. + +## What We Are Most Likely To Accept + +Small, focused bug fixes. + +Small reliability fixes. + +Small performance improvements. + +Tightly scoped maintenance work that clearly improves the project without changing its direction. + +## What We Are Least Likely To Accept + +Large PRs. + +Drive-by feature work. + +Opinionated rewrites. + +Anything that expands product scope without us asking for it first. + +If you open a 1,000+ line PR full of new features, we will probably close it quickly and remember that you ignored the clearly written instructions. + +## If You Still Want To Open A PR + +Keep it small. + +Explain exactly what changed. + +Explain exactly why the change should exist. + +Do not mix unrelated fixes together. + +If the PR makes anything resembling a UI change, include clear before/after images. + +If the change depends on motion, timing, transitions, or interaction details, include a short video. + +If we have to guess what changed, we are much less likely to review it. + +## Issues First + +If you are thinking about a non-trivial change, open an issue first. + +That still does not mean we will want the PR, but it gives you a chance to avoid wasting your time. + +## Be Realistic + +Opening a PR does not create an obligation on our side. + +We may close it. We may ignore it. We may ask you to shrink it. We may reimplement the idea ourselves later. + +If you are fine with that, proceed. diff --git a/README.md b/README.md index 1e37fb7819..03e81b5fb9 100644 --- a/README.md +++ b/README.md @@ -21,4 +21,8 @@ We are very very early in this project. Expect bugs. We are not accepting contributions yet. +## If you REALLY want to contribute still.... read this first + +Read [CONTRIBUTING.md](./CONTRIBUTING.md) before opening an issue or PR. + Need support? Join the [Discord](https://discord.gg/jn4EGJjrvv). From 17942787aa06070aa21ad6ae357e08f674383c4d Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Sun, 8 Mar 2026 18:21:31 -0700 Subject: [PATCH 02/36] fix: settings in sidebar, better add project flow (#584) * improvements * sidebar ui pt2 * back flow * fix back flow --- apps/web/src/components/Sidebar.tsx | 186 +++++++++++++++++++--------- 1 file changed, 125 insertions(+), 61 deletions(-) diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx index 2a96f9e9f3..2c3caa427e 100644 --- a/apps/web/src/components/Sidebar.tsx +++ b/apps/web/src/components/Sidebar.tsx @@ -1,8 +1,11 @@ import { + ArrowLeftIcon, ChevronRightIcon, FolderIcon, GitPullRequestIcon, + PlusIcon, RocketIcon, + SettingsIcon, SquarePenIcon, TerminalIcon, } from "lucide-react"; @@ -17,7 +20,7 @@ import { type ResolvedKeybindingsConfig, } from "@t3tools/contracts"; import { useMutation, useQueries, useQuery, useQueryClient } from "@tanstack/react-query"; -import { useNavigate, useParams } from "@tanstack/react-router"; +import { useLocation, useNavigate, useParams } from "@tanstack/react-router"; import { useAppSettings } from "../appSettings"; import { isElectron } from "../env"; import { APP_STAGE_LABEL } from "../branding"; @@ -278,6 +281,7 @@ export default function Sidebar() { (store) => store.clearProjectDraftThreadById, ); const navigate = useNavigate(); + const isOnSettings = useLocation({ select: (loc) => loc.pathname === "/settings" }); const { settings: appSettings } = useAppSettings(); const routeThreadId = useParams({ strict: false, @@ -293,6 +297,8 @@ export default function Sidebar() { const [newCwd, setNewCwd] = useState(""); const [isPickingFolder, setIsPickingFolder] = useState(false); const [isAddingProject, setIsAddingProject] = useState(false); + const [addProjectError, setAddProjectError] = useState(null); + const addProjectInputRef = useRef(null); const [renamingThreadId, setRenamingThreadId] = useState(null); const [renamingTitle, setRenamingTitle] = useState(""); const [expandedThreadListsByProject, setExpandedThreadListsByProject] = useState< @@ -486,6 +492,7 @@ export default function Sidebar() { const finishAddingProject = () => { setIsAddingProject(false); setNewCwd(""); + setAddProjectError(null); setAddingProject(false); }; @@ -512,12 +519,9 @@ export default function Sidebar() { await handleNewThread(projectId).catch(() => undefined); } catch (error) { setIsAddingProject(false); - toastManager.add({ - type: "error", - title: "Unable to add project", - description: - error instanceof Error ? error.message : "An error occurred while adding the project.", - }); + setAddProjectError( + error instanceof Error ? error.message : "An error occurred while adding the project.", + ); return; } finishAddingProject(); @@ -541,6 +545,8 @@ export default function Sidebar() { } if (pickedPath) { await addProjectFromPath(pickedPath); + } else { + addProjectInputRef.current?.focus(); } setIsPickingFolder(false); }; @@ -1025,6 +1031,95 @@ export default function Sidebar() { +
+ + Projects + + + { + setAddingProject((prev) => !prev); + setAddProjectError(null); + }} + /> + } + > + + + Add project + +
+ + {addingProject && ( +
+ {isElectron && ( + + )} +
+ { + setNewCwd(event.target.value); + setAddProjectError(null); + }} + onKeyDown={(event) => { + if (event.key === "Enter") handleAddProject(); + if (event.key === "Escape") { + setAddingProject(false); + setAddProjectError(null); + } + }} + autoFocus + /> + +
+ {addProjectError && ( +

+ {addProjectError} +

+ )} +
+ +
+
+ )} + {projects.map((project) => { const projectThreads = threads @@ -1288,68 +1383,37 @@ export default function Sidebar() { {projects.length === 0 && !addingProject && (
- No projects yet. -
- Add one to get started. + No projects yet
)}
- - {addingProject ? ( - <> -

- Add project -

- setNewCwd(event.target.value)} - onKeyDown={(event) => { - if (event.key === "Enter") handleAddProject(); - if (event.key === "Escape") setAddingProject(false); - }} - /> - {isElectron && ( - + + Back + + ) : ( + void navigate({ to: "/settings" })} + > + + Settings + )} -
- - -
- - ) : ( - - )} + +
); From 59e2944fb72d8ef8c3b55fec3be766abe48df820 Mon Sep 17 00:00:00 2001 From: 0x1f99d Date: Mon, 9 Mar 2026 12:24:56 +1100 Subject: [PATCH 03/36] fix(web): add dismiss button to thread error banner (#588) The thread error banner had no way to be dismissed. Users hitting unrecoverable errors (e.g. missing gh CLI during PR creation) were stuck with a persistent error banner and no way to clear it. Add a dismiss (X) button to ThreadErrorBanner using the existing AlertAction component, wired to clear the thread error via setThreadError(id, null). Closes #496 --- apps/web/src/components/ChatView.tsx | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 05b3eee271..b284523c52 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -123,7 +123,7 @@ import { } from "../keybindings"; import ChatMarkdown from "./ChatMarkdown"; import ThreadTerminalDrawer from "./ThreadTerminalDrawer"; -import { Alert, AlertDescription, AlertTitle } from "./ui/alert"; +import { Alert, AlertAction, AlertDescription, AlertTitle } from "./ui/alert"; import { BotIcon, ChevronDownIcon, @@ -3434,7 +3434,10 @@ export default function ChatView({ threadId }: ChatViewProps) { {/* Error banner */} - + setThreadError(activeThread.id, null)} + /> {/* Messages */} @@ -4095,7 +4098,13 @@ const ChatHeader = memo(function ChatHeader({ ); }); -const ThreadErrorBanner = memo(function ThreadErrorBanner({ error }: { error: string | null }) { +const ThreadErrorBanner = memo(function ThreadErrorBanner({ + error, + onDismiss, +}: { + error: string | null; + onDismiss?: () => void; +}) { if (!error) return null; return (
@@ -4104,6 +4113,18 @@ const ThreadErrorBanner = memo(function ThreadErrorBanner({ error }: { error: st {error} + {onDismiss && ( + + + + )}
); From d62ffa7560bffeb2509ed115eed31dd5bc231ca6 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Sun, 8 Mar 2026 18:27:04 -0700 Subject: [PATCH 04/36] pr changes pt2 --- .github/pull_request_template.md | 33 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 8b0c2224ae..76aac7e4d8 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,30 +1,33 @@ -## Before You Open This PR + ## What Changed -Describe the change clearly and keep scope tight. + -## Why This Change +## Why -Explain the problem being solved and why this approach is the right one. + ## UI Changes -If this PR changes anything resembling UI, include clear before/after images. - -If the change involves motion, transitions, or other behavior that is difficult to evaluate from screenshots alone, include a short video. + ## Checklist -- [ ] This PR is small and focused. -- [ ] I explained what changed and why. -- [ ] I included clear before/after images for UI changes. -- [ ] I included a video for animation or interaction changes that need motion to evaluate. +- [ ] This PR is small and focused +- [ ] I explained what changed and why +- [ ] I included before/after screenshots for any UI changes +- [ ] I included a video for animation/interaction changes From 18b6590d2e490bd73ba968b094dc221ffb7c0f67 Mon Sep 17 00:00:00 2001 From: "(CJ) Chukwudi Nwobodo" <142016413+chuks-qua@users.noreply.github.com> Date: Mon, 9 Mar 2026 01:36:52 +0000 Subject: [PATCH 05/36] feat(desktop): add spellcheck suggestions to context menu (#500) Wire up Electron's context-menu event on webContents to surface dictionary suggestions for misspelled words. Standard edit actions (Cut, Copy, Paste, Select All) appear in all context menus. Related to #473 --- apps/desktop/src/main.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts index 945f1d2790..a23fc8e4a3 100644 --- a/apps/desktop/src/main.ts +++ b/apps/desktop/src/main.ts @@ -1114,6 +1114,34 @@ function createWindow(): BrowserWindow { }, }); + window.webContents.on("context-menu", (event, params) => { + event.preventDefault(); + + const menuTemplate: MenuItemConstructorOptions[] = []; + + if (params.misspelledWord) { + for (const suggestion of params.dictionarySuggestions.slice(0, 5)) { + menuTemplate.push({ + label: suggestion, + click: () => window.webContents.replaceMisspelling(suggestion), + }); + } + if (params.dictionarySuggestions.length === 0) { + menuTemplate.push({ label: "No suggestions", enabled: false }); + } + menuTemplate.push({ type: "separator" }); + } + + menuTemplate.push( + { role: "cut", enabled: params.editFlags.canCut }, + { role: "copy", enabled: params.editFlags.canCopy }, + { role: "paste", enabled: params.editFlags.canPaste }, + { role: "selectAll", enabled: params.editFlags.canSelectAll }, + ); + + Menu.buildFromTemplate(menuTemplate).popup({ window }); + }); + window.webContents.setWindowOpenHandler(() => ({ action: "deny" })); window.on("page-title-updated", (event) => { event.preventDefault(); From 1c43bad705bd1d953fd168aa0b852c8b2d83ee84 Mon Sep 17 00:00:00 2001 From: Mubin Ansari Date: Mon, 9 Mar 2026 07:21:55 +0530 Subject: [PATCH 06/36] Add `delete` option for project actions (#223) Adds a delete button to the action edit dialog with a confirmation alert. Fixes pingdotgg/t3code#208. --- apps/web/src/components/ChatView.tsx | 34 ++++++++++++++ .../src/components/ProjectScriptsControl.tsx | 46 ++++++++++++++++++- 2 files changed, 79 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index b284523c52..a96b17bdb7 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -1621,6 +1621,36 @@ export default function ChatView({ threadId }: ChatViewProps) { }, [activeProject, persistProjectScripts], ); + const deleteProjectScript = useCallback( + async (scriptId: string) => { + if (!activeProject) return; + const nextScripts = activeProject.scripts.filter((script) => script.id !== scriptId); + + const deletedName = activeProject.scripts.find((s) => s.id === scriptId)?.name; + + try { + await persistProjectScripts({ + projectId: activeProject.id, + projectCwd: activeProject.cwd, + previousScripts: activeProject.scripts, + nextScripts, + keybinding: null, + keybindingCommand: commandForProjectScript(scriptId), + }); + toastManager.add({ + type: "success", + title: `Deleted action "${deletedName ?? "Unknown"}"`, + }); + } catch (error) { + toastManager.add({ + type: "error", + title: "Could not delete action", + description: error instanceof Error ? error.message : "An unexpected error occurred.", + }); + } + }, + [activeProject, persistProjectScripts], + ); const handleRuntimeModeChange = useCallback( (mode: RuntimeMode) => { @@ -3428,6 +3458,7 @@ export default function ChatView({ threadId }: ChatViewProps) { }} onAddProjectScript={saveProjectScript} onUpdateProjectScript={updateProjectScript} + onDeleteProjectScript={deleteProjectScript} onToggleDiff={onToggleDiff} /> @@ -4008,6 +4039,7 @@ interface ChatHeaderProps { onRunProjectScript: (script: ProjectScript) => void; onAddProjectScript: (input: NewProjectScriptInput) => Promise; onUpdateProjectScript: (scriptId: string, input: NewProjectScriptInput) => Promise; + onDeleteProjectScript: (scriptId: string) => Promise; onToggleDiff: () => void; } @@ -4027,6 +4059,7 @@ const ChatHeader = memo(function ChatHeader({ onRunProjectScript, onAddProjectScript, onUpdateProjectScript, + onDeleteProjectScript, onToggleDiff, }: ChatHeaderProps) { return ( @@ -4059,6 +4092,7 @@ const ChatHeader = memo(function ChatHeader({ onRunScript={onRunProjectScript} onAddScript={onAddProjectScript} onUpdateScript={onUpdateProjectScript} + onDeleteScript={onDeleteProjectScript} /> )} {activeProjectName && ( diff --git a/apps/web/src/components/ProjectScriptsControl.tsx b/apps/web/src/components/ProjectScriptsControl.tsx index 092f2d598a..437b3e78ef 100644 --- a/apps/web/src/components/ProjectScriptsControl.tsx +++ b/apps/web/src/components/ProjectScriptsControl.tsx @@ -14,7 +14,7 @@ import { SettingsIcon, WrenchIcon, } from "lucide-react"; -import React, { type FormEvent, type KeyboardEvent, useMemo, useState } from "react"; +import React, { type FormEvent, type KeyboardEvent, useCallback, useMemo, useState } from "react"; import { keybindingValueForCommand, @@ -27,6 +27,15 @@ import { } from "~/projectScripts"; import { shortcutLabelForCommand } from "~/keybindings"; import { isMacPlatform } from "~/lib/utils"; +import { + AlertDialog, + AlertDialogClose, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogPopup, + AlertDialogTitle, +} from "./ui/alert-dialog"; import { Button } from "./ui/button"; import { Dialog, @@ -84,6 +93,7 @@ interface ProjectScriptsControlProps { onRunScript: (script: ProjectScript) => void; onAddScript: (input: NewProjectScriptInput) => Promise | void; onUpdateScript: (scriptId: string, input: NewProjectScriptInput) => Promise | void; + onDeleteScript: (scriptId: string) => Promise | void; } function normalizeShortcutKeyToken(key: string): string | null { @@ -144,6 +154,7 @@ export default function ProjectScriptsControl({ onRunScript, onAddScript, onUpdateScript, + onDeleteScript, }: ProjectScriptsControlProps) { const addScriptFormId = React.useId(); const [editingScriptId, setEditingScriptId] = useState(null); @@ -155,6 +166,7 @@ export default function ProjectScriptsControl({ const [runOnWorktreeCreate, setRunOnWorktreeCreate] = useState(false); const [keybinding, setKeybinding] = useState(""); const [validationError, setValidationError] = useState(null); + const [deleteConfirmOpen, setDeleteConfirmOpen] = useState(false); const primaryScript = useMemo(() => { if (preferredScriptId) { @@ -247,6 +259,13 @@ export default function ProjectScriptsControl({ setDialogOpen(true); }; + const confirmDeleteScript = useCallback(() => { + if (!editingScriptId) return; + setDeleteConfirmOpen(false); + setDialogOpen(false); + void onDeleteScript(editingScriptId); + }, [editingScriptId, onDeleteScript]); + return ( <> {primaryScript ? ( @@ -440,6 +459,16 @@ export default function ProjectScriptsControl({ + {isEditing && ( + + )} + + + ); } From a20815ece6ea877a2b82072339f4bced98d757f7 Mon Sep 17 00:00:00 2001 From: 0x1f99d Date: Mon, 9 Mar 2026 12:56:29 +1100 Subject: [PATCH 07/36] fix(web): align sidebar logo with macOS traffic light buttons (#586) Adjust the Electron sidebar header to properly center the T3 wordmark with the native window controls. The logo was sitting ~2px too low and ~8px too close to the traffic lights. - Reduce wordmark container top margin from mt-2 (8px) to mt-1.5 (6px) - Increase Electron header left padding from 82px to 90px for proper traffic light clearance - Match the desktop update button margin to stay aligned Closes #564 --- apps/web/src/components/Sidebar.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx index 2c3caa427e..ecfd526acb 100644 --- a/apps/web/src/components/Sidebar.tsx +++ b/apps/web/src/components/Sidebar.tsx @@ -984,7 +984,7 @@ export default function Sidebar() { const wordmark = (
-
+
Code @@ -1000,7 +1000,7 @@ export default function Sidebar() { <> {isElectron ? ( <> - + {wordmark} {showDesktopUpdateButton && ( @@ -1011,7 +1011,7 @@ export default function Sidebar() { aria-label={desktopUpdateTooltip} aria-disabled={desktopUpdateButtonDisabled || undefined} disabled={desktopUpdateButtonDisabled} - className={`inline-flex size-7 ml-auto mt-2 items-center justify-center rounded-md text-muted-foreground transition-colors ${desktopUpdateButtonInteractivityClasses} ${desktopUpdateButtonClasses}`} + className={`inline-flex size-7 ml-auto mt-1.5 items-center justify-center rounded-md text-muted-foreground transition-colors ${desktopUpdateButtonInteractivityClasses} ${desktopUpdateButtonClasses}`} onClick={handleDesktopUpdateButtonClick} > From b7f954a9041ee4524552ad0993e8b7711c86ff8a Mon Sep 17 00:00:00 2001 From: "(CJ) Chukwudi Nwobodo" <142016413+chuks-qua@users.noreply.github.com> Date: Mon, 9 Mar 2026 01:58:25 +0000 Subject: [PATCH 08/36] Fix ChildProcess.spawn failing on Windows for .cmd shims (#495) * fix(scripts): enable shell mode on Windows for .cmd shim resolution On Windows, tools like `bun`, `npm`, `turbo`, and `bunx` are installed as `.cmd` shims. Node's `child_process.spawn` cannot resolve these without `shell: true`, causing `PlatformError: NotFound` on fresh builds where there is no Turbo cache. Add `shell: process.platform === "win32"` to all ChildProcess.make calls in cli.ts, dev-runner.ts, and build-desktop-artifact.ts. Closes #474 * docs: add comments explaining Windows shell spawn requirement * docs: add shell spawn comments to remaining call sites --- apps/server/scripts/cli.ts | 2 ++ scripts/build-desktop-artifact.ts | 6 ++++++ scripts/dev-runner.ts | 2 ++ 3 files changed, 10 insertions(+) diff --git a/apps/server/scripts/cli.ts b/apps/server/scripts/cli.ts index e5b5c0d00a..3eaa72ea8e 100644 --- a/apps/server/scripts/cli.ts +++ b/apps/server/scripts/cli.ts @@ -132,6 +132,7 @@ const buildCmd = Command.make( cwd: serverDir, stdout: config.verbose ? "inherit" : "ignore", stderr: "inherit", + // Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd). shell: process.platform === "win32", })`bun tsdown`, ); @@ -226,6 +227,7 @@ const publishCmd = Command.make( cwd: serverDir, stdout: config.verbose ? "inherit" : "ignore", stderr: "inherit", + // Windows needs shell mode to resolve .cmd shims. shell: process.platform === "win32", }), ); diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.ts index 8823b88513..c44109faea 100644 --- a/scripts/build-desktop-artifact.ts +++ b/scripts/build-desktop-artifact.ts @@ -580,6 +580,8 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* ( ChildProcess.make({ cwd: repoRoot, ...commandOutputOptions(options.verbose), + // Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd). + shell: process.platform === "win32", })`bun run build:desktop`, ); } @@ -642,6 +644,8 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* ( ChildProcess.make({ cwd: stageAppDir, ...commandOutputOptions(options.verbose), + // Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd). + shell: process.platform === "win32", })`bun install --production`, ); @@ -680,6 +684,8 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* ( cwd: stageAppDir, env: buildEnv, ...commandOutputOptions(options.verbose), + // Windows needs shell mode to resolve .cmd shims. + shell: process.platform === "win32", })`bunx electron-builder ${platformConfig.cliFlag} --${options.arch} --publish never`, ); diff --git a/scripts/dev-runner.ts b/scripts/dev-runner.ts index c72411e318..89d7a104cf 100644 --- a/scripts/dev-runner.ts +++ b/scripts/dev-runner.ts @@ -455,6 +455,8 @@ export function runDevRunnerWithInput(input: DevRunnerCliInput) { stderr: "inherit", env, extendEnv: false, + // Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd). + shell: process.platform === "win32", // Keep turbo in the same process group so terminal signals (Ctrl+C) // reach it directly. Effect defaults to detached: true on non-Windows, // which would put turbo in a new group and require manual forwarding. From 39f65703e7bd97df787ba45373ed75dddae9bb2f Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Sun, 8 Mar 2026 20:00:15 -0700 Subject: [PATCH 09/36] Add checkout and Node setup to updater publish workflow job (#605) - Ensure the updater publish job checks out the target ref - Initialize Node using the repository's package.json version file before downloading artifacts --- .github/workflows/release.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8e8cf0fdfc..d72fcbaf88 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -255,6 +255,16 @@ jobs: needs: [preflight, build, publish_cli] runs-on: ubuntu-24.04 steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ needs.preflight.outputs.ref }} + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version-file: package.json + - name: Download all desktop artifacts uses: actions/download-artifact@v4 with: From 42234b8f7cbe4465370fa0511f3fe26df2a2ae2e Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Sun, 8 Mar 2026 20:12:31 -0700 Subject: [PATCH 10/36] fix: plan mode ui overhaul (#596) * new plan mode started * review comments * more fixes --- apps/web/src/components/ChatView.tsx | 283 +++++++++++++++++------- apps/web/src/components/PlanSidebar.tsx | 267 ++++++++++++++++++++++ apps/web/src/proposedPlan.ts | 16 ++ 3 files changed, 486 insertions(+), 80 deletions(-) create mode 100644 apps/web/src/components/PlanSidebar.tsx diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index a96b17bdb7..259f055ef0 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -92,6 +92,8 @@ import { buildPlanImplementationThreadTitle, buildPlanImplementationPrompt, buildProposedPlanMarkdownFilename, + downloadPlanAsTextFile, + normalizePlanMarkdownForExport, proposedPlanTitle, resolvePlanFollowUpSubmission, } from "../proposedPlan"; @@ -122,6 +124,7 @@ import { shortcutLabelForCommand, } from "../keybindings"; import ChatMarkdown from "./ChatMarkdown"; +import PlanSidebar from "./PlanSidebar"; import ThreadTerminalDrawer from "./ThreadTerminalDrawer"; import { Alert, AlertAction, AlertDescription, AlertTitle } from "./ui/alert"; import { @@ -135,6 +138,7 @@ import { DiffIcon, EllipsisIcon, FolderClosedIcon, + ListTodoIcon, LockIcon, LockOpenIcon, Undo2Icon, @@ -291,21 +295,7 @@ function workToneClass(tone: "thinking" | "tool" | "info" | "error"): string { return "text-muted-foreground/40"; } -function normalizePlanMarkdownForExport(planMarkdown: string): string { - return `${planMarkdown.trimEnd()}\n`; -} -function downloadTextFile(filename: string, contents: string): void { - const blob = new Blob([contents], { type: "text/markdown;charset=utf-8" }); - const url = URL.createObjectURL(blob); - const anchor = document.createElement("a"); - anchor.href = url; - anchor.download = filename; - anchor.click(); - window.setTimeout(() => { - URL.revokeObjectURL(url); - }, 0); -} interface ExpandedImageItem { src: string; @@ -656,6 +646,12 @@ export default function ChatView({ threadId }: ChatViewProps) { const [pendingUserInputQuestionIndexByRequestId, setPendingUserInputQuestionIndexByRequestId] = useState>({}); const [expandedWorkGroups, setExpandedWorkGroups] = useState>({}); + const [planSidebarOpen, setPlanSidebarOpen] = useState(false); + // Tracks whether the user explicitly dismissed the sidebar for the active turn. + const planSidebarDismissedForTurnRef = useRef(null); + // When set, the thread-change reset effect will open the sidebar instead of closing it. + // Used by "Implement in new thread" to carry the sidebar-open intent across navigation. + const planSidebarOpenOnNextThreadRef = useRef(false); const [nowTick, setNowTick] = useState(() => Date.now()); const [terminalFocusRequestId, setTerminalFocusRequestId] = useState(0); const [composerHighlightedItemId, setComposerHighlightedItemId] = useState(null); @@ -1941,8 +1937,17 @@ export default function ChatView({ threadId }: ChatViewProps) { useEffect(() => { setExpandedWorkGroups({}); + if (planSidebarOpenOnNextThreadRef.current) { + planSidebarOpenOnNextThreadRef.current = false; + setPlanSidebarOpen(true); + } else { + setPlanSidebarOpen(false); + } + planSidebarDismissedForTurnRef.current = null; }, [activeThread?.id]); + + useEffect(() => { if (!composerMenuOpen) { setComposerHighlightedItemId(null); @@ -2955,6 +2960,13 @@ export default function ChatView({ threadId }: ChatViewProps) { interactionMode: nextInteractionMode, createdAt: messageCreatedAt, }); + // Optimistically open the plan sidebar when implementing (not refining). + // "default" mode here means the agent is executing the plan, which produces + // step-tracking activities that the sidebar will display. + if (nextInteractionMode === "default") { + planSidebarDismissedForTurnRef.current = null; + setPlanSidebarOpen(true); + } sendInFlightRef.current = false; } catch (err) { setOptimisticUserMessages((existing) => @@ -3063,6 +3075,8 @@ export default function ChatView({ threadId }: ChatViewProps) { .then(() => api.orchestration.getSnapshot()) .then((snapshot) => { syncServerReadModel(snapshot); + // Signal that the plan sidebar should open on the new thread. + planSidebarOpenOnNextThreadRef.current = true; return navigate({ to: "/$threadId", params: { threadId: nextThreadId }, @@ -3469,7 +3483,10 @@ export default function ChatView({ threadId }: ChatViewProps) { error={activeThread.error} onDismiss={() => setThreadError(activeThread.id, null)} /> - + {/* Main content area with optional plan sidebar */} +
+ {/* Chat column */} +
{/* Messages */}
) : showPlanFollowUpPrompt && activeProposedPlan ? ( @@ -3749,6 +3767,43 @@ export default function ChatView({ threadId }: ChatViewProps) { {runtimeMode === "full-access" ? "Full access" : "Supervised"} + + {/* Plan sidebar toggle */} + {(activePlan || activeProposedPlan || planSidebarOpen) ? ( + <> + + + + ) : null}
{/* Right side: send / stop button */} @@ -3915,6 +3970,27 @@ export default function ChatView({ threadId }: ChatViewProps) {
+
{/* end chat column */} + + {/* Plan sidebar */} + {planSidebarOpen ? ( + { + setPlanSidebarOpen(false); + // Track that the user explicitly dismissed for this turn so auto-open won't fight them. + const turnKey = activePlan?.turnId ?? activeProposedPlan?.turnId ?? null; + if (turnKey) { + planSidebarDismissedForTurnRef.current = turnKey; + } + }} + /> + ) : null} +
{/* end horizontal flex container */} + {isGitRepo && ( ; -} - -const PlanModePanel = memo(function PlanModePanel({ activePlan }: PlanModePanelProps) { - if (!activePlan) return null; - - return ( -
-
-
- Plan - - Updated {formatTimestamp(activePlan.createdAt)} - -
- {activePlan.explanation ? ( -

{activePlan.explanation}

- ) : null} -
- {activePlan.steps.map((step) => ( -
- - {step.status === "inProgress" - ? "In progress" - : step.status === "completed" - ? "Done" - : "Pending"} - -
{step.step}
-
- ))} -
-
-
- ); -}); - interface PendingUserInputPanelProps { pendingUserInputs: PendingUserInput[]; respondingRequestIds: ApprovalRequestId[]; answers: Record; questionIndex: number; onSelectOption: (questionId: string, optionLabel: string) => void; + onAdvance: () => void; } const ComposerPendingUserInputPanel = memo(function ComposerPendingUserInputPanel({ @@ -4337,6 +4365,7 @@ const ComposerPendingUserInputPanel = memo(function ComposerPendingUserInputPane answers, questionIndex, onSelectOption, + onAdvance, }: PendingUserInputPanelProps) { if (pendingUserInputs.length === 0) return null; const activePrompt = pendingUserInputs[0]; @@ -4350,6 +4379,7 @@ const ComposerPendingUserInputPanel = memo(function ComposerPendingUserInputPane answers={answers} questionIndex={questionIndex} onSelectOption={onSelectOption} + onAdvance={onAdvance} /> ); }); @@ -4360,42 +4390,135 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard( answers, questionIndex, onSelectOption, + onAdvance, }: { prompt: PendingUserInput; isResponding: boolean; answers: Record; questionIndex: number; onSelectOption: (questionId: string, optionLabel: string) => void; + onAdvance: () => void; }) { const progress = derivePendingUserInputProgress(prompt.questions, answers, questionIndex); const activeQuestion = progress.activeQuestion; + const autoAdvanceTimerRef = useRef(null); + + // Clear auto-advance timer on unmount + useEffect(() => { + return () => { + if (autoAdvanceTimerRef.current !== null) { + window.clearTimeout(autoAdvanceTimerRef.current); + } + }; + }, []); + + const selectOptionAndAutoAdvance = useCallback( + (questionId: string, optionLabel: string) => { + onSelectOption(questionId, optionLabel); + if (autoAdvanceTimerRef.current !== null) { + window.clearTimeout(autoAdvanceTimerRef.current); + } + autoAdvanceTimerRef.current = window.setTimeout(() => { + autoAdvanceTimerRef.current = null; + onAdvance(); + }, 200); + }, + [onSelectOption, onAdvance], + ); + + // Keyboard shortcut: number keys 1-9 select corresponding option and auto-advance. + // Works even when the Lexical composer (contenteditable) has focus — the composer + // doubles as a custom-answer field during user input, and when it's empty the digit + // keys should pick options instead of typing into the editor. + useEffect(() => { + if (!activeQuestion || isResponding) return; + const handler = (event: globalThis.KeyboardEvent) => { + if (event.metaKey || event.ctrlKey || event.altKey) return; + const target = event.target; + if ( + target instanceof HTMLInputElement || + target instanceof HTMLTextAreaElement + ) { + return; + } + // If the user has started typing a custom answer in the contenteditable + // composer, let digit keys pass through so they can type numbers. + if (target instanceof HTMLElement && target.isContentEditable) { + const hasCustomText = progress.customAnswer.length > 0; + if (hasCustomText) return; + } + const digit = Number.parseInt(event.key, 10); + if (Number.isNaN(digit) || digit < 1 || digit > 9) return; + const optionIndex = digit - 1; + if (optionIndex >= activeQuestion.options.length) return; + const option = activeQuestion.options[optionIndex]; + if (!option) return; + event.preventDefault(); + selectOptionAndAutoAdvance(activeQuestion.id, option.label); + }; + document.addEventListener("keydown", handler); + return () => document.removeEventListener("keydown", handler); + }, [activeQuestion, isResponding, selectOptionAndAutoAdvance, progress.customAnswer.length]); if (!activeQuestion) { return null; } return ( -
-
- - {questionIndex + 1}/{prompt.questions.length} {activeQuestion.header} - -
{activeQuestion.question}
+
+
+
+ {prompt.questions.length > 1 ? ( + + {questionIndex + 1}/{prompt.questions.length} + + ) : null} + + {activeQuestion.header} + +
-
- {activeQuestion.options.map((option) => { +

{activeQuestion.question}

+
+ {activeQuestion.options.map((option, index) => { const isSelected = progress.selectedOptionLabel === option.label; + const shortcutKey = index < 9 ? index + 1 : null; return ( - + {shortcutKey !== null ? ( + + {shortcutKey} + + ) : null} +
+ {option.label} + {option.description && option.description !== option.label ? ( + {option.description} + ) : null} +
+ {isSelected ? ( + + ) : null} + ); })}
@@ -4609,7 +4732,7 @@ const ProposedPlanCard = memo(function ProposedPlanCard({ const saveContents = normalizePlanMarkdownForExport(planMarkdown); const handleDownload = () => { - downloadTextFile(downloadFilename, saveContents); + downloadPlanAsTextFile(downloadFilename, saveContents); }; const openSaveDialog = () => { diff --git a/apps/web/src/components/PlanSidebar.tsx b/apps/web/src/components/PlanSidebar.tsx new file mode 100644 index 0000000000..5ab2f5e32c --- /dev/null +++ b/apps/web/src/components/PlanSidebar.tsx @@ -0,0 +1,267 @@ +import { memo, useState, useCallback } from "react"; +import { Badge } from "./ui/badge"; +import { Button } from "./ui/button"; +import { ScrollArea } from "./ui/scroll-area"; +import ChatMarkdown from "./ChatMarkdown"; +import { + CheckIcon, + ChevronDownIcon, + ChevronRightIcon, + EllipsisIcon, + LoaderIcon, + PanelRightCloseIcon, +} from "lucide-react"; +import { cn } from "~/lib/utils"; +import { formatTimestamp } from "../session-logic"; +import type { ActivePlanState } from "../session-logic"; +import type { LatestProposedPlanState } from "../session-logic"; +import { + proposedPlanTitle, + buildProposedPlanMarkdownFilename, + normalizePlanMarkdownForExport, + downloadPlanAsTextFile, +} from "../proposedPlan"; +import { Menu, MenuItem, MenuPopup, MenuTrigger } from "./ui/menu"; +import { readNativeApi } from "~/nativeApi"; +import { toastManager } from "./ui/toast"; + +function stepStatusIcon(status: string): React.ReactNode { + if (status === "completed") { + return ( + + + + ); + } + if (status === "inProgress") { + return ( + + + + ); + } + return ( + + + + ); +} + +interface PlanSidebarProps { + activePlan: ActivePlanState | null; + activeProposedPlan: LatestProposedPlanState | null; + markdownCwd: string | undefined; + workspaceRoot: string | undefined; + onClose: () => void; +} + +const PlanSidebar = memo(function PlanSidebar({ + activePlan, + activeProposedPlan, + markdownCwd, + workspaceRoot, + onClose, +}: PlanSidebarProps) { + const [proposedPlanExpanded, setProposedPlanExpanded] = useState(false); + const [isSavingToWorkspace, setIsSavingToWorkspace] = useState(false); + const [copied, setCopied] = useState(false); + + const planMarkdown = activeProposedPlan?.planMarkdown ?? null; + const planTitle = planMarkdown ? proposedPlanTitle(planMarkdown) : null; + + const handleCopyPlan = useCallback(() => { + if (!planMarkdown) return; + void navigator.clipboard.writeText(planMarkdown); + setCopied(true); + setTimeout(() => setCopied(false), 2000); + }, [planMarkdown]); + + const handleDownload = useCallback(() => { + if (!planMarkdown) return; + const filename = buildProposedPlanMarkdownFilename(planMarkdown); + downloadPlanAsTextFile(filename, normalizePlanMarkdownForExport(planMarkdown)); + }, [planMarkdown]); + + const handleSaveToWorkspace = useCallback(() => { + const api = readNativeApi(); + if (!api || !workspaceRoot || !planMarkdown) return; + const filename = buildProposedPlanMarkdownFilename(planMarkdown); + setIsSavingToWorkspace(true); + void api.projects + .writeFile({ + cwd: workspaceRoot, + relativePath: filename, + contents: normalizePlanMarkdownForExport(planMarkdown), + }) + .then((result) => { + toastManager.add({ + type: "success", + title: "Plan saved", + description: result.relativePath, + }); + }) + .catch((error) => { + toastManager.add({ + type: "error", + title: "Could not save plan", + description: + error instanceof Error ? error.message : "An error occurred.", + }); + }) + .then( + () => setIsSavingToWorkspace(false), + () => setIsSavingToWorkspace(false), + ); + }, [planMarkdown, workspaceRoot]); + + return ( +
+ {/* Header */} +
+
+ + Plan + + {activePlan ? ( + + {formatTimestamp(activePlan.createdAt)} + + ) : null} +
+
+ {planMarkdown ? ( + + + } + > + + + + + {copied ? "Copied!" : "Copy to clipboard"} + + Download as markdown + + Save to workspace + + + + ) : null} + +
+
+ + {/* Content */} + +
+ {/* Explanation */} + {activePlan?.explanation ? ( +

+ {activePlan.explanation} +

+ ) : null} + + {/* Plan Steps */} + {activePlan && activePlan.steps.length > 0 ? ( +
+

+ Steps +

+ {activePlan.steps.map((step) => ( +
+
+ {stepStatusIcon(step.status)} +
+

+ {step.step} +

+
+ ))} +
+ ) : null} + + {/* Proposed Plan Markdown */} + {planMarkdown ? ( +
+ + {proposedPlanExpanded ? ( +
+ +
+ ) : null} +
+ ) : null} + + {/* Empty state */} + {!activePlan && !planMarkdown ? ( +
+

+ No active plan yet. +

+

+ Plans will appear here when generated. +

+
+ ) : null} +
+
+
+ ); +}); + +export default PlanSidebar; +export type { PlanSidebarProps }; diff --git a/apps/web/src/proposedPlan.ts b/apps/web/src/proposedPlan.ts index 1550eb7de1..3bd4f62e60 100644 --- a/apps/web/src/proposedPlan.ts +++ b/apps/web/src/proposedPlan.ts @@ -49,3 +49,19 @@ export function buildProposedPlanMarkdownFilename(planMarkdown: string): string const title = proposedPlanTitle(planMarkdown); return `${sanitizePlanFileSegment(title ?? "plan")}.md`; } + +export function normalizePlanMarkdownForExport(planMarkdown: string): string { + return `${planMarkdown.trimEnd()}\n`; +} + +export function downloadPlanAsTextFile(filename: string, contents: string): void { + const blob = new Blob([contents], { type: "text/markdown;charset=utf-8" }); + const url = URL.createObjectURL(blob); + const anchor = document.createElement("a"); + anchor.href = url; + anchor.download = filename; + anchor.click(); + window.setTimeout(() => { + URL.revokeObjectURL(url); + }, 0); +} From 9b9006fed571dbeb1c810493500a679a49a2ba38 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Sun, 8 Mar 2026 20:30:01 -0700 Subject: [PATCH 11/36] Fix release finalize lockfile refresh (#608) * Add checkout and Node setup to release updater publish job - Ensure the updater publish job checks out the target ref - Initialize Node using the repository's package.json version file before downloading artifacts * Fix release finalize lockfile refresh --- .github/workflows/ci.yml | 20 ++++ .github/workflows/release.yml | 30 +----- package.json | 1 + scripts/release-smoke.ts | 113 +++++++++++++++++++++ scripts/update-release-package-versions.ts | 111 ++++++++++++++++++++ 5 files changed, 247 insertions(+), 28 deletions(-) create mode 100644 scripts/release-smoke.ts create mode 100644 scripts/update-release-package-versions.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 787e07bce7..8035a57ed8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,3 +69,23 @@ jobs: run: | test -f apps/desktop/dist-electron/preload.js grep -nE "desktopBridge|getWsUrl|PICK_FOLDER_CHANNEL|wsUrl" apps/desktop/dist-electron/preload.js + + release_smoke: + name: Release Smoke + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version-file: package.json + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version-file: package.json + + - name: Exercise release-only workflow steps + run: node scripts/release-smoke.ts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d72fcbaf88..1524675138 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -322,33 +322,7 @@ jobs: name: Update version strings env: RELEASE_VERSION: ${{ needs.preflight.outputs.version }} - run: | - node --input-type=module -e ' - import { appendFileSync, readFileSync, writeFileSync } from "node:fs"; - - const files = [ - "apps/server/package.json", - "apps/desktop/package.json", - "apps/web/package.json", - "packages/contracts/package.json", - ]; - - let changed = false; - for (const file of files) { - const packageJson = JSON.parse(readFileSync(file, "utf8")); - if (packageJson.version !== process.env.RELEASE_VERSION) { - packageJson.version = process.env.RELEASE_VERSION; - writeFileSync(file, `${JSON.stringify(packageJson, null, 2)}\n`); - changed = true; - } - } - - if (!changed) { - console.log("All package.json versions already match release version."); - } - - appendFileSync(process.env.GITHUB_OUTPUT, `changed=${changed}\n`); - ' + run: node scripts/update-release-package-versions.ts "$RELEASE_VERSION" --github-output - name: Format package.json files if: steps.update_versions.outputs.changed == 'true' @@ -356,7 +330,7 @@ jobs: - name: Refresh lockfile if: steps.update_versions.outputs.changed == 'true' - run: bun install + run: bun install --lockfile-only --ignore-scripts - name: Commit and push version bump if: steps.update_versions.outputs.changed == 'true' diff --git a/package.json b/package.json index 2fa94b5dab..be86eeb93e 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "dist:desktop:dmg:x64": "node scripts/build-desktop-artifact.ts --platform mac --target dmg --arch x64", "dist:desktop:linux": "node scripts/build-desktop-artifact.ts --platform linux --target AppImage --arch x64", "dist:desktop:win": "node scripts/build-desktop-artifact.ts --platform win --target nsis --arch x64", + "release:smoke": "node scripts/release-smoke.ts", "clean": "rm -rf node_modules apps/*/node_modules packages/*/node_modules apps/*/dist apps/*/dist-electron packages/*/dist .turbo apps/*/.turbo packages/*/.turbo", "sync:vscode-icons": "node scripts/sync-vscode-icons.mjs" }, diff --git a/scripts/release-smoke.ts b/scripts/release-smoke.ts new file mode 100644 index 0000000000..9e7595e619 --- /dev/null +++ b/scripts/release-smoke.ts @@ -0,0 +1,113 @@ +import { execFileSync } from "node:child_process"; +import { cpSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), ".."); + +const workspaceFiles = [ + "package.json", + "bun.lock", + "apps/server/package.json", + "apps/desktop/package.json", + "apps/web/package.json", + "apps/marketing/package.json", + "packages/contracts/package.json", + "packages/shared/package.json", + "scripts/package.json", +] as const; + +function copyWorkspaceManifestFixture(targetRoot: string): void { + for (const relativePath of workspaceFiles) { + const sourcePath = resolve(repoRoot, relativePath); + const destinationPath = resolve(targetRoot, relativePath); + mkdirSync(dirname(destinationPath), { recursive: true }); + cpSync(sourcePath, destinationPath); + } +} + +function writeMacManifestFixtures(targetRoot: string): { arm64Path: string; x64Path: string } { + const assetDirectory = resolve(targetRoot, "release-assets"); + mkdirSync(assetDirectory, { recursive: true }); + + const arm64Path = resolve(assetDirectory, "latest-mac.yml"); + const x64Path = resolve(assetDirectory, "latest-mac-x64.yml"); + + writeFileSync( + arm64Path, + `version: 9.9.9-smoke.0 +files: + - url: T3-Code-9.9.9-smoke.0-arm64.zip + sha512: arm64zip + size: 125621344 + - url: T3-Code-9.9.9-smoke.0-arm64.dmg + sha512: arm64dmg + size: 131754935 +path: T3-Code-9.9.9-smoke.0-arm64.zip +sha512: arm64zip +releaseDate: '2026-03-08T10:32:14.587Z' +`, + ); + + writeFileSync( + x64Path, + `version: 9.9.9-smoke.0 +files: + - url: T3-Code-9.9.9-smoke.0-x64.zip + sha512: x64zip + size: 132000112 + - url: T3-Code-9.9.9-smoke.0-x64.dmg + sha512: x64dmg + size: 138148807 +path: T3-Code-9.9.9-smoke.0-x64.zip +sha512: x64zip +releaseDate: '2026-03-08T10:36:07.540Z' +`, + ); + + return { arm64Path, x64Path }; +} + +function assertContains(haystack: string, needle: string, message: string): void { + if (!haystack.includes(needle)) { + throw new Error(message); + } +} + +const tempRoot = mkdtempSync(join(tmpdir(), "t3-release-smoke-")); + +try { + copyWorkspaceManifestFixture(tempRoot); + + execFileSync( + process.execPath, + [resolve(repoRoot, "scripts/update-release-package-versions.ts"), "9.9.9-smoke.0", "--root", tempRoot], + { + cwd: repoRoot, + stdio: "inherit", + }, + ); + + execFileSync("bun", ["install", "--lockfile-only", "--ignore-scripts"], { + cwd: tempRoot, + stdio: "inherit", + }); + + const lockfile = readFileSync(resolve(tempRoot, "bun.lock"), "utf8"); + assertContains(lockfile, `"version": "9.9.9-smoke.0"`, "Expected bun.lock to contain the smoke version."); + + const { arm64Path, x64Path } = writeMacManifestFixtures(tempRoot); + execFileSync(process.execPath, [resolve(repoRoot, "scripts/merge-mac-update-manifests.ts"), arm64Path, x64Path], { + cwd: repoRoot, + stdio: "inherit", + }); + + const mergedManifest = readFileSync(arm64Path, "utf8"); + assertContains(mergedManifest, "T3-Code-9.9.9-smoke.0-arm64.zip", "Merged manifest is missing the arm64 asset."); + assertContains(mergedManifest, "T3-Code-9.9.9-smoke.0-x64.zip", "Merged manifest is missing the x64 asset."); + + console.log("Release smoke checks passed."); +} finally { + rmSync(tempRoot, { recursive: true, force: true }); +} diff --git a/scripts/update-release-package-versions.ts b/scripts/update-release-package-versions.ts new file mode 100644 index 0000000000..7cdf13dd39 --- /dev/null +++ b/scripts/update-release-package-versions.ts @@ -0,0 +1,111 @@ +import { appendFileSync, readFileSync, writeFileSync } from "node:fs"; +import { resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +export const releasePackageFiles = [ + "apps/server/package.json", + "apps/desktop/package.json", + "apps/web/package.json", + "packages/contracts/package.json", +] as const; + +interface UpdateReleasePackageVersionsOptions { + readonly rootDir?: string; +} + +interface MutablePackageJson { + version?: string; + [key: string]: unknown; +} + +export function updateReleasePackageVersions( + version: string, + options: UpdateReleasePackageVersionsOptions = {}, +): { changed: boolean } { + const rootDir = resolve(options.rootDir ?? process.cwd()); + let changed = false; + + for (const relativePath of releasePackageFiles) { + const filePath = resolve(rootDir, relativePath); + const packageJson = JSON.parse(readFileSync(filePath, "utf8")) as MutablePackageJson; + if (packageJson.version === version) { + continue; + } + + packageJson.version = version; + writeFileSync(filePath, `${JSON.stringify(packageJson, null, 2)}\n`); + changed = true; + } + + return { changed }; +} + +function parseArgs(argv: ReadonlyArray): { + version: string; + rootDir: string | undefined; + writeGithubOutput: boolean; +} { + let version: string | undefined; + let rootDir: string | undefined; + let writeGithubOutput = false; + + for (let index = 0; index < argv.length; index += 1) { + const argument = argv[index]; + if (argument === undefined) { + continue; + } + + if (argument === "--github-output") { + writeGithubOutput = true; + continue; + } + + if (argument === "--root") { + rootDir = argv[index + 1]; + if (!rootDir) { + throw new Error("Missing value for --root."); + } + index += 1; + continue; + } + + if (argument.startsWith("--")) { + throw new Error(`Unknown argument: ${argument}`); + } + + if (version !== undefined) { + throw new Error("Only one release version can be provided."); + } + version = argument; + } + + if (!version) { + throw new Error( + "Usage: node scripts/update-release-package-versions.ts [--root ] [--github-output]", + ); + } + + return { version, rootDir, writeGithubOutput }; +} + +const isMain = process.argv[1] !== undefined && resolve(process.argv[1]) === fileURLToPath(import.meta.url); + +if (isMain) { + const { version, rootDir, writeGithubOutput } = parseArgs(process.argv.slice(2)); + const { changed } = updateReleasePackageVersions( + version, + rootDir === undefined ? {} : { rootDir }, + ); + + if (!changed) { + console.log("All package.json versions already match release version."); + } + + if (writeGithubOutput) { + const githubOutputPath = process.env.GITHUB_OUTPUT; + if (!githubOutputPath) { + throw new Error("GITHUB_OUTPUT is required when --github-output is set."); + } + appendFileSync(githubOutputPath, `changed=${changed}\n`); + } +} From 3738373aa5ff0fff074ecb95686ef952c209957e Mon Sep 17 00:00:00 2001 From: 0x1f99d Date: Mon, 9 Mar 2026 14:36:03 +1100 Subject: [PATCH 12/36] fix(server): use waitForPush in terminal event broadcast test to prevent flaky failure (#606) The terminal RPC test used raw waitForMessage to receive the expected terminal.event push, but a server.configUpdated push from the keybindings file watcher can arrive first depending on OS timing. Replace with the existing waitForPush helper that filters by channel. --- apps/server/src/wsServer.test.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/server/src/wsServer.test.ts b/apps/server/src/wsServer.test.ts index 285028cca6..80d57d7c6f 100644 --- a/apps/server/src/wsServer.test.ts +++ b/apps/server/src/wsServer.test.ts @@ -1333,9 +1333,7 @@ describe("WebSocket Server", () => { }; terminalManager.emitEvent(manualEvent); - const push = (await waitForMessage(ws)) as WsPush; - expect(push.type).toBe("push"); - expect(push.channel).toBe(WS_CHANNELS.terminalEvent); + const push = await waitForPush(ws, WS_CHANNELS.terminalEvent); expect((push.data as TerminalEvent).type).toBe("output"); }); From cd1c3df89cfa681622292f7f2a9777f81f8e2f10 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Sun, 8 Mar 2026 20:36:37 -0700 Subject: [PATCH 13/36] Add PR vouch workflow with trust-status labels (#602) * Add PR vouch workflow and trust-status labeling - Add `.github/workflows/pr-vouch.yml` to label PRs as trusted, unvouched, or denounced - Add `.github/VOUCHED.td` trust-list file for external contributors - Document automatic `vouch:*` labels and contributor expectations in `CONTRIBUTING.md` * Add vouch entries for trusted GitHub contributors - Append 16 GitHub accounts to `.github/VOUCHED.td` - Update trusted-voucher list used for PR labeling workflows --- .github/VOUCHED.td | 27 +++++ .github/workflows/pr-vouch.yml | 175 +++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 4 + 3 files changed, 206 insertions(+) create mode 100644 .github/VOUCHED.td create mode 100644 .github/workflows/pr-vouch.yml diff --git a/.github/VOUCHED.td b/.github/VOUCHED.td new file mode 100644 index 0000000000..cb9f78b92c --- /dev/null +++ b/.github/VOUCHED.td @@ -0,0 +1,27 @@ +# Trust list for this repository. +# +# External contributors listed here are treated as trusted by the vouch +# workflow. Collaborators with write access are automatically trusted and +# do not need to be duplicated in this file. +# +# Syntax: +# github:username +# -github:username reason for denouncement +# +# Keep entries sorted alphabetically. +github:adityavardhansharma +github:binbandit +github:chuks-qua +github:cursoragent +github:gbarros-dev +github:github-actions[bot] +github:hwanseoc +github:jamesx0416 +github:jasonLaster +github:JoeEverest +github:nmggithub +github:notkainoa +github:PatrickBauer +github:realAhmedRoach +github:shiroyasha9 +github:Yash-Singh1 diff --git a/.github/workflows/pr-vouch.yml b/.github/workflows/pr-vouch.yml new file mode 100644 index 0000000000..f38c93d44f --- /dev/null +++ b/.github/workflows/pr-vouch.yml @@ -0,0 +1,175 @@ +name: PR Vouch + +on: + pull_request_target: + types: [opened, reopened, synchronize, ready_for_review] + issue_comment: + types: [created] + push: + branches: + - main + paths: + - .github/VOUCHED.td + - .github/workflows/pr-vouch.yml + +permissions: + contents: read + issues: write + pull-requests: write + +jobs: + collect-targets: + name: Collect PR targets + runs-on: ubuntu-24.04 + outputs: + targets: ${{ steps.collect.outputs.targets }} + steps: + - id: collect + uses: actions/github-script@v7 + with: + script: | + if (context.eventName === "pull_request_target") { + const pr = context.payload.pull_request; + core.setOutput("targets", JSON.stringify([{ number: pr.number, user: pr.user.login }])); + return; + } + + if (context.eventName === "issue_comment") { + const issue = context.payload.issue; + const body = context.payload.comment?.body ?? ""; + if (!issue?.pull_request || !body.includes("/recheck-vouch")) { + core.setOutput("targets", "[]"); + return; + } + + core.setOutput( + "targets", + JSON.stringify([{ number: issue.number, user: issue.user.login }]), + ); + return; + } + + const pulls = await github.paginate(github.rest.pulls.list, { + owner: context.repo.owner, + repo: context.repo.repo, + state: "open", + per_page: 100, + }); + + const targets = pulls.map((pull) => ({ + number: pull.number, + user: pull.user.login, + })); + core.setOutput("targets", JSON.stringify(targets)); + + label: + name: Label PR ${{ matrix.target.number }} + needs: collect-targets + if: ${{ needs.collect-targets.outputs.targets != '[]' }} + runs-on: ubuntu-24.04 + concurrency: + group: pr-vouch-${{ matrix.target.number }} + cancel-in-progress: true + strategy: + fail-fast: false + matrix: + target: ${{ fromJson(needs.collect-targets.outputs.targets) }} + steps: + - id: vouch + name: Check PR author trust + uses: mitchellh/vouch/action/check-user@v1 + with: + user: ${{ matrix.target.user }} + allow-fail: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Sync PR labels + uses: actions/github-script@v7 + env: + PR_NUMBER: ${{ matrix.target.number }} + VOUCH_STATUS: ${{ steps.vouch.outputs.status }} + with: + script: | + const issueNumber = Number(process.env.PR_NUMBER); + const status = process.env.VOUCH_STATUS; + const managedLabels = [ + { + name: "vouch:trusted", + color: "1f883d", + description: "PR author is trusted by repo permissions or the VOUCHED list.", + }, + { + name: "vouch:unvouched", + color: "fbca04", + description: "PR author is not yet trusted in the VOUCHED list.", + }, + { + name: "vouch:denounced", + color: "d1242f", + description: "PR author is explicitly blocked by the VOUCHED list.", + }, + ]; + + const managedLabelNames = managedLabels.map((label) => label.name); + + for (const label of managedLabels) { + try { + const { data: existing } = await github.rest.issues.getLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: label.name, + }); + + if ( + existing.color !== label.color || + (existing.description ?? "") !== label.description + ) { + await github.rest.issues.updateLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: label.name, + color: label.color, + description: label.description, + }); + } + } catch (error) { + if (error.status !== 404) { + throw error; + } + + await github.rest.issues.createLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: label.name, + color: label.color, + description: label.description, + }); + } + } + + const nextLabelName = + status === "denounced" + ? "vouch:denounced" + : ["bot", "collaborator", "vouched"].includes(status) + ? "vouch:trusted" + : "vouch:unvouched"; + + const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issueNumber, + }); + + const preservedLabels = currentLabels + .map((label) => label.name) + .filter((name) => !managedLabelNames.includes(name)); + + await github.rest.issues.setLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issueNumber, + labels: [...preservedLabels, nextLabelName], + }); + + core.info(`PR #${issueNumber}: ${status} -> ${nextLabelName}`); diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fb1992fe73..2021ecdcb7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,6 +8,10 @@ You can still open an issue or PR, but please do so knowing there is a high chan If that sounds annoying, that is because it is. This project is still early and we are trying to keep scope, quality, and direction under control. +PRs are automatically labeled with a `vouch:*` trust status. + +If you are an external contributor, expect `vouch:unvouched` until we explicitly add you to [.github/VOUCHED.td](.github/VOUCHED.td). + ## What We Are Most Likely To Accept Small, focused bug fixes. From 412331aa61a9a38d61f17755d67ed0f8212920d2 Mon Sep 17 00:00:00 2001 From: 0x1f99d Date: Mon, 9 Mar 2026 14:39:41 +1100 Subject: [PATCH 14/36] fix(web): add missing v7 key to legacy localStorage cleanup list (#594) When the persisted state key was bumped from v7 to v8 in 689dda59, the v7 key was not added to LEGACY_PERSISTED_STATE_KEYS. Users who ran the app during the ~3-week v7 window retain a stale `t3code:renderer-state:v7` entry in localStorage that is never cleaned up. --- apps/web/src/store.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/web/src/store.ts b/apps/web/src/store.ts index 65c9665378..711e993e0f 100644 --- a/apps/web/src/store.ts +++ b/apps/web/src/store.ts @@ -25,6 +25,7 @@ export interface AppState { const PERSISTED_STATE_KEY = "t3code:renderer-state:v8"; const LEGACY_PERSISTED_STATE_KEYS = [ + "t3code:renderer-state:v7", "t3code:renderer-state:v6", "t3code:renderer-state:v5", "t3code:renderer-state:v4", From 8fe21d7583a21a19c98b0e24a64dd0d7029b41b0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 9 Mar 2026 03:43:56 +0000 Subject: [PATCH 15/36] chore(release): prepare v0.0.8 --- apps/desktop/package.json | 2 +- apps/server/package.json | 2 +- apps/web/package.json | 2 +- bun.lock | 8 ++++---- packages/contracts/package.json | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/desktop/package.json b/apps/desktop/package.json index a955b4297b..63632047b9 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -1,6 +1,6 @@ { "name": "@t3tools/desktop", - "version": "0.0.5", + "version": "0.0.8", "private": true, "main": "dist-electron/main.js", "scripts": { diff --git a/apps/server/package.json b/apps/server/package.json index 96413bde50..9678d2d6b4 100644 --- a/apps/server/package.json +++ b/apps/server/package.json @@ -1,6 +1,6 @@ { "name": "t3", - "version": "0.0.5", + "version": "0.0.8", "repository": { "type": "git", "url": "https://github.com/pingdotgg/t3code", diff --git a/apps/web/package.json b/apps/web/package.json index 2ed07bdff5..2db0cba69e 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -1,6 +1,6 @@ { "name": "@t3tools/web", - "version": "0.0.5", + "version": "0.0.8", "private": true, "type": "module", "scripts": { diff --git a/bun.lock b/bun.lock index ce4b7e7a1b..e71f9c24aa 100644 --- a/bun.lock +++ b/bun.lock @@ -14,7 +14,7 @@ }, "apps/desktop": { "name": "@t3tools/desktop", - "version": "0.0.5", + "version": "0.0.8", "dependencies": { "effect": "catalog:", "electron": "40.6.0", @@ -43,7 +43,7 @@ }, "apps/server": { "name": "t3", - "version": "0.0.5", + "version": "0.0.8", "bin": { "t3": "./dist/index.mjs", }, @@ -72,7 +72,7 @@ }, "apps/web": { "name": "@t3tools/web", - "version": "0.0.5", + "version": "0.0.8", "dependencies": { "@base-ui/react": "^1.2.0", "@lexical/react": "^0.41.0", @@ -116,7 +116,7 @@ }, "packages/contracts": { "name": "@t3tools/contracts", - "version": "0.0.5", + "version": "0.0.8", "dependencies": { "effect": "catalog:", }, diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 679a0ef369..b58e822081 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,6 +1,6 @@ { "name": "@t3tools/contracts", - "version": "0.0.5", + "version": "0.0.8", "private": true, "files": [ "dist" From 5bc79807ec33f0b7f3633ad6dc54fcedf0de3a73 Mon Sep 17 00:00:00 2001 From: Jason Laster Date: Sun, 8 Mar 2026 22:40:44 -0600 Subject: [PATCH 16/36] Add an encyclopedia of common terms (#613) --- .docs/encyclopedia.md | 180 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 .docs/encyclopedia.md diff --git a/.docs/encyclopedia.md b/.docs/encyclopedia.md new file mode 100644 index 0000000000..76df004e04 --- /dev/null +++ b/.docs/encyclopedia.md @@ -0,0 +1,180 @@ +# Encyclopedia + +This is a living glossary for T3 Code. It explains what common terms mean in this codebase. + +## Table of contents + +- [Project and workspace](#project-and-workspace) +- [Thread timeline](#thread-timeline) +- [Orchestration](#orchestration) +- [Provider runtime](#provider-runtime) +- [Checkpointing](#checkpointing) + +## Concepts + +### Project and workspace + +#### Project + +The top-level workspace record in the app. In [the orchestration contracts][1], a project has a `workspaceRoot`, a title, and one or more threads. See [workspace-layout.md][2]. + +#### Workspace root + +The root filesystem path for a project. In [the orchestration model][1], it is the base directory for branches and optional worktrees. See [workspace-layout.md][2]. + +#### Worktree + +A Git worktree used as an isolated workspace for a thread. If a thread has a `worktreePath` in [the contracts][1], it runs there instead of in the main working tree. Git operations live in [GitCore.ts][3]. + +### Thread timeline + +#### Thread + +The main durable unit of conversation and workspace history. In [the orchestration contracts][1], a thread holds messages, activities, checkpoints, and session-related state. See [projector.ts][4]. + +#### Turn + +A single user-to-assistant work cycle inside a thread. It starts with user input and ends when follow-up work like checkpointing settles. See [the contracts][1], [ProviderRuntimeIngestion.ts][5], and [CheckpointReactor.ts][6]. + +#### Activity + +A user-visible log item attached to a thread. In [the contracts][1], activities cover important non-message events like approvals, tool actions, and failures. They are projected into thread state in [projector.ts][4]. + +### Orchestration + +Orchestration is the server-side domain layer that turns runtime activity into stable app state. The main entry point is [OrchestrationEngine.ts][7], with core logic in [decider.ts][8] and [projector.ts][4]. + +#### Aggregate + +The domain object a command or event belongs to. In [the contracts][1], that is usually `project` or `thread`. See [decider.ts][8]. + +#### Command + +A typed request to change domain state. In [the contracts][1], commands are validated in [commandInvariants.ts][9] and turned into events by [decider.ts][8]. +Examples include `thread.create`, `thread.turn.start`, and `thread.checkpoint.revert`. + +#### Domain Event + +A persisted fact that something already happened. In [the contracts][1], events are the source of truth, and [projector.ts][4] shows how they are applied. +Examples include `thread.created`, `thread.message-sent`, and `thread.turn-diff-completed`. + +#### Decider + +The pure orchestration logic that turns commands plus current state into events. The core implementation is in [decider.ts][8], with preconditions in [commandInvariants.ts][9]. + +#### Projection + +A read-optimized view derived from events. See [projector.ts][4], [ProjectionPipeline.ts][11], and [ProjectionSnapshotQuery.ts][10]. + +#### Projector + +The logic that applies domain events to the read model or projection tables. See [projector.ts][4] and [ProjectionPipeline.ts][11]. + +#### Read model + +The current materialized view of orchestration state. In [the contracts][1], it holds projects, threads, messages, activities, checkpoints, and session state. See [ProjectionSnapshotQuery.ts][10] and [OrchestrationEngine.ts][7]. + +#### Reactor + +A side-effecting service that handles follow-up work after events or runtime signals. Examples include [CheckpointReactor.ts][6], [ProviderCommandReactor.ts][12], and [ProviderRuntimeIngestion.ts][5]. + +#### Receipt + +A lightweight typed runtime signal emitted when an async milestone completes. See [RuntimeReceiptBus.ts][13]. +Examples include `checkpoint.baseline.captured`, `checkpoint.diff.finalized`, and `turn.processing.quiesced`, which are emitted by flows such as [CheckpointReactor.ts][6]. + +#### Quiesced + +"Quiesced" means a turn has gone quiet and stable. In [the receipt schema][13], it means the follow-up work has settled, including work in [CheckpointReactor.ts][6]. + +### Provider runtime + +The live backend agent implementation and its event stream. The main service is [ProviderService.ts][14], the adapter contract is [ProviderAdapter.ts][15], and the overview is in [provider-architecture.md][16]. + +#### Provider + +The backend agent runtime that actually performs work. See [ProviderService.ts][14], [ProviderAdapter.ts][15], and [CodexAdapter.ts][17]. + +#### Session + +The live provider-backed runtime attached to a thread. Session shape is in [the orchestration contracts][1], and lifecycle is managed in [ProviderService.ts][14]. + +#### Runtime mode + +The safety/access mode for a thread or session. In [the contracts][1], the main values are `approval-required` and `full-access`. See [runtime-modes.md][18]. + +#### Interaction mode + +The agent interaction style for a thread. In [the contracts][1], the main values are `default` and `plan`. See [runtime-modes.md][18]. + +#### Assistant delivery mode + +Controls how assistant text reaches the thread timeline. In [the contracts][1], `streaming` updates incrementally and `buffered` delivers a completed result. See [ProviderService.ts][14]. + +#### Snapshot + +A point-in-time view of state. The word is used in multiple layers, including orchestration, provider, and checkpointing. See [ProjectionSnapshotQuery.ts][10], [ProviderAdapter.ts][15], and [CheckpointStore.ts][19]. + +### Checkpointing + +Checkpointing captures workspace state over time so the app can diff turns and restore earlier points. The main pieces are [CheckpointStore.ts][19], [CheckpointDiffQuery.ts][20], and [CheckpointReactor.ts][6]. + +#### Checkpoint + +A saved snapshot of a thread workspace at a particular turn. In practice it is a hidden Git ref in [CheckpointStore.ts][19] plus a projected summary from [ProjectionCheckpoints.ts][21]. Capture and lifecycle work happen in [CheckpointReactor.ts][6]. + +#### Checkpoint ref + +The durable identifier for a filesystem checkpoint, stored as a Git ref. It is typed in [the contracts][1], constructed in [Utils.ts][22], and used by [CheckpointStore.ts][19]. + +#### Checkpoint baseline + +The starting checkpoint for diffing a thread timeline. This flow is surfaced through [RuntimeReceiptBus.ts][13], coordinated in [CheckpointReactor.ts][6], and supported by [Utils.ts][22]. + +#### Checkpoint diff + +The patch difference between two checkpoints. Query logic lives in [CheckpointDiffQuery.ts][20], diff parsing lives in [Diffs.ts][23], and finalization is coordinated by [CheckpointReactor.ts][6]. + +#### Turn diff + +The file patch and changed-file summary for one turn. It is usually computed in [CheckpointDiffQuery.ts][20], represented in [the contracts][1], and recorded into thread state by [projector.ts][4]. + +## Practical Shortcuts + +- If you see `requested`, think "intent recorded". +- If you see `completed`, think "result applied". +- If you see `receipt`, think "async milestone signal". +- If you see `checkpoint`, think "workspace snapshot for diff/restore". +- If you see `quiesced`, think "all relevant follow-up work has gone idle". + +## Related Docs + +- [architecture.md][24] +- [provider-architecture.md][16] +- [runtime-modes.md][18] +- [workspace-layout.md][2] + +[1]: ../packages/contracts/src/orchestration.ts +[2]: ./workspace-layout.md +[3]: ../apps/server/src/git/Layers/GitCore.ts +[4]: ../apps/server/src/orchestration/projector.ts +[5]: ../apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts +[6]: ../apps/server/src/orchestration/Layers/CheckpointReactor.ts +[7]: ../apps/server/src/orchestration/Layers/OrchestrationEngine.ts +[8]: ../apps/server/src/orchestration/decider.ts +[9]: ../apps/server/src/orchestration/commandInvariants.ts +[10]: ../apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts +[11]: ../apps/server/src/orchestration/Layers/ProjectionPipeline.ts +[12]: ../apps/server/src/orchestration/Layers/ProviderCommandReactor.ts +[13]: ../apps/server/src/orchestration/Services/RuntimeReceiptBus.ts +[14]: ../apps/server/src/provider/Layers/ProviderService.ts +[15]: ../apps/server/src/provider/Services/ProviderAdapter.ts +[16]: ./provider-architecture.md +[17]: ../apps/server/src/provider/Layers/CodexAdapter.ts +[18]: ./runtime-modes.md +[19]: ../apps/server/src/checkpointing/Services/CheckpointStore.ts +[20]: ../apps/server/src/checkpointing/Services/CheckpointDiffQuery.ts +[21]: ../apps/server/src/persistence/Services/ProjectionCheckpoints.ts +[22]: ../apps/server/src/checkpointing/Utils.ts +[23]: ../apps/server/src/checkpointing/Diffs.ts +[24]: ./architecture.md From 812bb99f5c182351d0d899c9a88033d61fd7370a Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Sun, 8 Mar 2026 21:43:17 -0700 Subject: [PATCH 17/36] Add Noojuno to vouched --- .github/VOUCHED.td | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/VOUCHED.td b/.github/VOUCHED.td index cb9f78b92c..d1f2531767 100644 --- a/.github/VOUCHED.td +++ b/.github/VOUCHED.td @@ -20,6 +20,7 @@ github:jamesx0416 github:jasonLaster github:JoeEverest github:nmggithub +github:Noojuno github:notkainoa github:PatrickBauer github:realAhmedRoach From 651084e8c05bf6da329108b098e4fd81322ee785 Mon Sep 17 00:00:00 2001 From: Jono Kemball Date: Mon, 9 Mar 2026 17:43:35 +1300 Subject: [PATCH 18/36] fix: fix external link opening in desktop (#599) fixes #434 --- apps/desktop/src/main.ts | 44 +++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts index a23fc8e4a3..f17b6a8ddf 100644 --- a/apps/desktop/src/main.ts +++ b/apps/desktop/src/main.ts @@ -112,6 +112,25 @@ function formatErrorMessage(error: unknown): string { return String(error); } +function getSafeExternalUrl(rawUrl: unknown): string | null { + if (typeof rawUrl !== "string" || rawUrl.length === 0) { + return null; + } + + let parsedUrl: URL; + try { + parsedUrl = new URL(rawUrl); + } catch { + return null; + } + + if (parsedUrl.protocol !== "https:" && parsedUrl.protocol !== "http:") { + return null; + } + + return parsedUrl.toString(); +} + function writeDesktopStreamChunk( streamName: "stdout" | "stderr", chunk: unknown, @@ -1033,23 +1052,13 @@ function registerIpcHandlers(): void { ipcMain.removeHandler(OPEN_EXTERNAL_CHANNEL); ipcMain.handle(OPEN_EXTERNAL_CHANNEL, async (_event, rawUrl: unknown) => { - if (typeof rawUrl !== "string" || rawUrl.length === 0) { - return false; - } - - let parsedUrl: URL; - try { - parsedUrl = new URL(rawUrl); - } catch { - return false; - } - - if (parsedUrl.protocol !== "https:" && parsedUrl.protocol !== "http:") { + const externalUrl = getSafeExternalUrl(rawUrl); + if (!externalUrl) { return false; } try { - await shell.openExternal(parsedUrl.toString()); + await shell.openExternal(externalUrl); return true; } catch { return false; @@ -1142,7 +1151,14 @@ function createWindow(): BrowserWindow { Menu.buildFromTemplate(menuTemplate).popup({ window }); }); - window.webContents.setWindowOpenHandler(() => ({ action: "deny" })); + window.webContents.setWindowOpenHandler(({ url }) => { + const externalUrl = getSafeExternalUrl(url); + if (externalUrl) { + void shell.openExternal(externalUrl); + } + return { action: "deny" }; + }); + window.on("page-title-updated", (event) => { event.preventDefault(); window.setTitle(APP_DISPLAY_NAME); From 16f3490aee9ab9928ae7ac084117517495155e96 Mon Sep 17 00:00:00 2001 From: 0x1f99d Date: Mon, 9 Mar 2026 15:53:26 +1100 Subject: [PATCH 19/36] fix(ci): handle draft PR conversions in pr-vouch (#611) --- .github/workflows/pr-vouch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-vouch.yml b/.github/workflows/pr-vouch.yml index f38c93d44f..976a9a097e 100644 --- a/.github/workflows/pr-vouch.yml +++ b/.github/workflows/pr-vouch.yml @@ -2,7 +2,7 @@ name: PR Vouch on: pull_request_target: - types: [opened, reopened, synchronize, ready_for_review] + types: [opened, reopened, synchronize, ready_for_review, converted_to_draft] issue_comment: types: [created] push: From 8e8904a159e3b29fa1eae0e6f023872ef03a3f63 Mon Sep 17 00:00:00 2001 From: 0x1f99d Date: Mon, 9 Mar 2026 15:55:09 +1100 Subject: [PATCH 20/36] refactor(web): remove redundant double parse of diff route search params (#598) `rawSearch` is already the output of `parseDiffRouteSearch` via the `useSearch` select transform. The `useMemo` at line 760 re-parsed it through the same function with an unsafe `as Record` cast, producing an identical result. Use `rawSearch` directly instead. --- apps/web/src/components/ChatView.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 259f055ef0..51b300ba8e 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -753,11 +753,7 @@ export default function ChatView({ threadId }: ChatViewProps) { composerDraft.interactionMode ?? activeThread?.interactionMode ?? DEFAULT_INTERACTION_MODE; const isServerThread = serverThread !== undefined; const isLocalDraftThread = !isServerThread && localDraftThread !== undefined; - const diffSearch = useMemo( - () => parseDiffRouteSearch(rawSearch as Record), - [rawSearch], - ); - const diffOpen = diffSearch.diff === "1"; + const diffOpen = rawSearch.diff === "1"; const activeThreadId = activeThread?.id ?? null; const activeLatestTurn = activeThread?.latestTurn ?? null; const latestTurnSettled = isLatestTurnSettled(activeLatestTurn, activeThread?.session ?? null); From 4088b7ac3cddc1fc92ccf3f99e7a844c629ebad0 Mon Sep 17 00:00:00 2001 From: 0x1f99d Date: Mon, 9 Mar 2026 16:02:15 +1100 Subject: [PATCH 21/36] fix(desktop): use filesystem-friendly userData directory name (#607) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Electron derives the userData path from productName in package.json, which produces directories with spaces and parentheses on all platforms (e.g. ~/.config/T3 Code (Alpha) on Linux). This is hostile to shell usage and violates Linux XDG naming conventions. Override the userData path via app.setPath() before the ready event to use a clean lowercase name (t3code). If the legacy directory already exists it is used as-is so existing users keep their Chromium profile data (localStorage, cookies, sessions, cache). This follows the same pattern VS Code uses — keeping productName for display purposes while explicitly setting the data directory path. Closes #578 --- apps/desktop/src/main.ts | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts index f17b6a8ddf..2abce92ba9 100644 --- a/apps/desktop/src/main.ts +++ b/apps/desktop/src/main.ts @@ -50,6 +50,8 @@ const ROOT_DIR = Path.resolve(__dirname, "../../.."); const isDevelopment = Boolean(process.env.VITE_DEV_SERVER_URL); const APP_DISPLAY_NAME = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alpha)"; const APP_USER_MODEL_ID = "com.t3tools.t3code"; +const USER_DATA_DIR_NAME = isDevelopment ? "t3code-dev" : "t3code"; +const LEGACY_USER_DATA_DIR_NAME = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alpha)"; const COMMIT_HASH_PATTERN = /^[0-9a-f]{7,40}$/i; const COMMIT_HASH_DISPLAY_LENGTH = 12; const LOG_DIR = Path.join(STATE_DIR, "logs"); @@ -593,6 +595,34 @@ function resolveIconPath(ext: "ico" | "icns" | "png"): string | null { return resolveResourcePath(`icon.${ext}`); } +/** + * Resolve the Electron userData directory path. + * + * Electron derives the default userData path from `productName` in + * package.json, which currently produces directories with spaces and + * parentheses (e.g. `~/.config/T3 Code (Alpha)` on Linux). This is + * unfriendly for shell usage and violates Linux naming conventions. + * + * We override it to a clean lowercase name (`t3code`). If the legacy + * directory already exists we keep using it so existing users don't + * lose their Chromium profile data (localStorage, cookies, sessions). + */ +function resolveUserDataPath(): string { + const appDataBase = + process.platform === "win32" + ? process.env.APPDATA || Path.join(OS.homedir(), "AppData", "Roaming") + : process.platform === "darwin" + ? Path.join(OS.homedir(), "Library", "Application Support") + : process.env.XDG_CONFIG_HOME || Path.join(OS.homedir(), ".config"); + + const legacyPath = Path.join(appDataBase, LEGACY_USER_DATA_DIR_NAME); + if (FS.existsSync(legacyPath)) { + return legacyPath; + } + + return Path.join(appDataBase, USER_DATA_DIR_NAME); +} + function configureAppIdentity(): void { app.setName(APP_DISPLAY_NAME); const commitHash = resolveAboutCommitHash(); @@ -1187,6 +1217,11 @@ function createWindow(): BrowserWindow { return window; } +// Override Electron's userData path before the `ready` event so that +// Chromium session data uses a filesystem-friendly directory name. +// Must be called synchronously at the top level — before `app.whenReady()`. +app.setPath("userData", resolveUserDataPath()); + configureAppIdentity(); async function bootstrap(): Promise { From acd92f9b061b8638ef9cfe974dad19042b3762e8 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Mon, 9 Mar 2026 01:12:55 -0700 Subject: [PATCH 22/36] include sourcemaps --- apps/web/vite.config.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index 652ebea30e..86ca574aa0 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -4,6 +4,14 @@ import { tanstackRouter } from "@tanstack/router-plugin/vite"; import { defineConfig } from "vite"; const port = Number(process.env.PORT ?? 5733); +const sourcemapEnv = process.env.T3CODE_WEB_SOURCEMAP?.trim().toLowerCase(); + +const buildSourcemap = + sourcemapEnv === "0" || sourcemapEnv === "false" + ? false + : sourcemapEnv === "hidden" + ? "hidden" + : true; export default defineConfig({ plugins: [ @@ -42,5 +50,6 @@ export default defineConfig({ build: { outDir: "dist", emptyOutDir: true, + sourcemap: buildSourcemap, }, }); From c585128bbe0311615c58921909467f49600cb85f Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Mon, 9 Mar 2026 01:20:14 -0700 Subject: [PATCH 23/36] ARM ALWAYS FUCK YOU INTEL --- apps/marketing/src/pages/index.astro | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/marketing/src/pages/index.astro b/apps/marketing/src/pages/index.astro index 2ccef66cd1..425626c458 100644 --- a/apps/marketing/src/pages/index.astro +++ b/apps/marketing/src/pages/index.astro @@ -77,12 +77,10 @@ const ua = navigator.userAgent; if (/Win/i.test(ua)) return { os: "win", label: "Download for Windows" }; if (/Mac/i.test(ua)) { - const isArm = - /arm|aarch/i.test(navigator.platform ?? "") || ua.includes("ARM"); return { os: "mac", label: `Download for macOS`, - arch: isArm ? "arm64" : "x64", + arch: "arm64", }; } if (/Linux/i.test(ua)) return { os: "linux", label: "Download for Linux" }; From 304a14de7d6f0b9977c8ecc4bced5b5f359ce02e Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Mon, 9 Mar 2026 04:01:23 -0700 Subject: [PATCH 24/36] Fix users who installed intel builds on arm macs (#641) --- apps/desktop/src/main.ts | 19 ++++++- apps/desktop/src/runtimeArch.test.ts | 49 +++++++++++++++++++ apps/desktop/src/runtimeArch.ts | 40 +++++++++++++++ apps/desktop/src/updateMachine.test.ts | 18 ++++--- apps/desktop/src/updateMachine.ts | 11 +++-- apps/desktop/src/updateState.test.ts | 3 ++ apps/web/src/components/Sidebar.tsx | 34 +++++++++++++ .../components/desktopUpdate.logic.test.ts | 31 ++++++++++++ .../web/src/components/desktopUpdate.logic.ts | 19 +++++++ packages/contracts/src/ipc.ts | 11 +++++ 10 files changed, 224 insertions(+), 11 deletions(-) create mode 100644 apps/desktop/src/runtimeArch.test.ts create mode 100644 apps/desktop/src/runtimeArch.ts diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts index 2abce92ba9..03cf67cd6d 100644 --- a/apps/desktop/src/main.ts +++ b/apps/desktop/src/main.ts @@ -31,6 +31,7 @@ import { reduceDesktopUpdateStateOnNoUpdate, reduceDesktopUpdateStateOnUpdateAvailable, } from "./updateMachine"; +import { isArm64HostRunningIntelBuild, resolveDesktopRuntimeInfo } from "./runtimeArch"; fixPath(); @@ -80,7 +81,13 @@ let backendLogSink: RotatingFileSink | null = null; let restoreStdIoCapture: (() => void) | null = null; let destructiveMenuIconCache: Electron.NativeImage | null | undefined; -const initialUpdateState = (): DesktopUpdateState => createInitialDesktopUpdateState(app.getVersion()); +const desktopRuntimeInfo = resolveDesktopRuntimeInfo({ + platform: process.platform, + processArch: process.arch, + runningUnderArm64Translation: app.runningUnderARM64Translation === true, +}); +const initialUpdateState = (): DesktopUpdateState => + createInitialDesktopUpdateState(app.getVersion(), desktopRuntimeInfo); function logTimestamp(): string { return new Date().toISOString(); @@ -708,6 +715,7 @@ async function downloadAvailableUpdate(): Promise<{ accepted: boolean; completed } updateDownloadInFlight = true; setUpdateState(reduceDesktopUpdateStateOnDownloadStart(updateState)); + autoUpdater.disableDifferentialDownload = isArm64HostRunningIntelBuild(desktopRuntimeInfo); console.info("[desktop-updater] Downloading update..."); try { @@ -746,7 +754,7 @@ async function installDownloadedUpdate(): Promise<{ accepted: boolean; completed function configureAutoUpdater(): void { const enabled = shouldEnableAutoUpdates(); setUpdateState({ - ...createInitialDesktopUpdateState(app.getVersion()), + ...createInitialDesktopUpdateState(app.getVersion(), desktopRuntimeInfo), enabled, status: enabled ? "idle" : "disabled", }); @@ -780,8 +788,15 @@ function configureAutoUpdater(): void { autoUpdater.channel = DESKTOP_UPDATE_CHANNEL; autoUpdater.allowPrerelease = DESKTOP_UPDATE_ALLOW_PRERELEASE; autoUpdater.allowDowngrade = false; + autoUpdater.disableDifferentialDownload = isArm64HostRunningIntelBuild(desktopRuntimeInfo); let lastLoggedDownloadMilestone = -1; + if (isArm64HostRunningIntelBuild(desktopRuntimeInfo)) { + console.info( + "[desktop-updater] Apple Silicon host detected while running Intel build; updates will switch to arm64 packages.", + ); + } + autoUpdater.on("checking-for-update", () => { console.info("[desktop-updater] Looking for updates..."); }); diff --git a/apps/desktop/src/runtimeArch.test.ts b/apps/desktop/src/runtimeArch.test.ts new file mode 100644 index 0000000000..258a8fb215 --- /dev/null +++ b/apps/desktop/src/runtimeArch.test.ts @@ -0,0 +1,49 @@ +import { describe, expect, it } from "vitest"; + +import { isArm64HostRunningIntelBuild, resolveDesktopRuntimeInfo } from "./runtimeArch"; + +describe("resolveDesktopRuntimeInfo", () => { + it("detects Rosetta-translated Intel builds on Apple Silicon", () => { + const runtimeInfo = resolveDesktopRuntimeInfo({ + platform: "darwin", + processArch: "x64", + runningUnderArm64Translation: true, + }); + + expect(runtimeInfo).toEqual({ + hostArch: "arm64", + appArch: "x64", + runningUnderArm64Translation: true, + }); + expect(isArm64HostRunningIntelBuild(runtimeInfo)).toBe(true); + }); + + it("detects native Apple Silicon builds", () => { + const runtimeInfo = resolveDesktopRuntimeInfo({ + platform: "darwin", + processArch: "arm64", + runningUnderArm64Translation: false, + }); + + expect(runtimeInfo).toEqual({ + hostArch: "arm64", + appArch: "arm64", + runningUnderArm64Translation: false, + }); + expect(isArm64HostRunningIntelBuild(runtimeInfo)).toBe(false); + }); + + it("passes through non-mac builds without translation", () => { + const runtimeInfo = resolveDesktopRuntimeInfo({ + platform: "linux", + processArch: "x64", + runningUnderArm64Translation: true, + }); + + expect(runtimeInfo).toEqual({ + hostArch: "x64", + appArch: "x64", + runningUnderArm64Translation: false, + }); + }); +}); diff --git a/apps/desktop/src/runtimeArch.ts b/apps/desktop/src/runtimeArch.ts new file mode 100644 index 0000000000..7e4265afb0 --- /dev/null +++ b/apps/desktop/src/runtimeArch.ts @@ -0,0 +1,40 @@ +import type { DesktopRuntimeArch, DesktopRuntimeInfo } from "@t3tools/contracts"; + +interface ResolveDesktopRuntimeInfoInput { + readonly platform: NodeJS.Platform; + readonly processArch: string; + readonly runningUnderArm64Translation: boolean; +} + +function normalizeDesktopArch(arch: string): DesktopRuntimeArch { + if (arch === "arm64") return "arm64"; + if (arch === "x64") return "x64"; + return "other"; +} + +export function resolveDesktopRuntimeInfo( + input: ResolveDesktopRuntimeInfoInput, +): DesktopRuntimeInfo { + const appArch = normalizeDesktopArch(input.processArch); + + if (input.platform !== "darwin") { + return { + hostArch: appArch, + appArch, + runningUnderArm64Translation: false, + }; + } + + const hostArch = + appArch === "arm64" || input.runningUnderArm64Translation ? "arm64" : appArch; + + return { + hostArch, + appArch, + runningUnderArm64Translation: input.runningUnderArm64Translation, + }; +} + +export function isArm64HostRunningIntelBuild(runtimeInfo: DesktopRuntimeInfo): boolean { + return runtimeInfo.hostArch === "arm64" && runtimeInfo.appArch === "x64"; +} diff --git a/apps/desktop/src/updateMachine.test.ts b/apps/desktop/src/updateMachine.test.ts index 045bfaf8f4..620c683b82 100644 --- a/apps/desktop/src/updateMachine.test.ts +++ b/apps/desktop/src/updateMachine.test.ts @@ -13,11 +13,17 @@ import { reduceDesktopUpdateStateOnUpdateAvailable, } from "./updateMachine"; +const runtimeInfo = { + hostArch: "x64", + appArch: "x64", + runningUnderArm64Translation: false, +} as const; + describe("updateMachine", () => { it("clears transient errors when a check starts", () => { const state = reduceDesktopUpdateStateOnCheckStart( { - ...createInitialDesktopUpdateState("1.0.0"), + ...createInitialDesktopUpdateState("1.0.0", runtimeInfo), enabled: true, status: "error", message: "network", @@ -36,7 +42,7 @@ describe("updateMachine", () => { it("records a check failure without exposing an action", () => { const state = reduceDesktopUpdateStateOnCheckFailure( { - ...createInitialDesktopUpdateState("1.0.0"), + ...createInitialDesktopUpdateState("1.0.0", runtimeInfo), enabled: true, status: "checking", }, @@ -52,7 +58,7 @@ describe("updateMachine", () => { it("preserves available version on download failure for retry", () => { const state = reduceDesktopUpdateStateOnDownloadFailure( { - ...createInitialDesktopUpdateState("1.0.0"), + ...createInitialDesktopUpdateState("1.0.0", runtimeInfo), enabled: true, status: "downloading", availableVersion: "1.1.0", @@ -70,7 +76,7 @@ describe("updateMachine", () => { it("transitions to downloaded and then preserves install retry state", () => { const downloaded = reduceDesktopUpdateStateOnDownloadComplete( { - ...createInitialDesktopUpdateState("1.0.0"), + ...createInitialDesktopUpdateState("1.0.0", runtimeInfo), enabled: true, status: "downloading", availableVersion: "1.1.0", @@ -89,7 +95,7 @@ describe("updateMachine", () => { it("clears stale download state when no update is available", () => { const state = reduceDesktopUpdateStateOnNoUpdate( { - ...createInitialDesktopUpdateState("1.0.0"), + ...createInitialDesktopUpdateState("1.0.0", runtimeInfo), enabled: true, status: "error", availableVersion: "1.1.0", @@ -111,7 +117,7 @@ describe("updateMachine", () => { it("tracks available, download start, and progress cleanly", () => { const available = reduceDesktopUpdateStateOnUpdateAvailable( { - ...createInitialDesktopUpdateState("1.0.0"), + ...createInitialDesktopUpdateState("1.0.0", runtimeInfo), enabled: true, status: "checking", }, diff --git a/apps/desktop/src/updateMachine.ts b/apps/desktop/src/updateMachine.ts index 9c4e212657..f13b420281 100644 --- a/apps/desktop/src/updateMachine.ts +++ b/apps/desktop/src/updateMachine.ts @@ -1,12 +1,18 @@ -import type { DesktopUpdateState } from "@t3tools/contracts"; +import type { DesktopRuntimeInfo, DesktopUpdateState } from "@t3tools/contracts"; import { getCanRetryAfterDownloadFailure, nextStatusAfterDownloadFailure } from "./updateState"; -export function createInitialDesktopUpdateState(currentVersion: string): DesktopUpdateState { +export function createInitialDesktopUpdateState( + currentVersion: string, + runtimeInfo: DesktopRuntimeInfo, +): DesktopUpdateState { return { enabled: false, status: "disabled", currentVersion, + hostArch: runtimeInfo.hostArch, + appArch: runtimeInfo.appArch, + runningUnderArm64Translation: runtimeInfo.runningUnderArm64Translation, availableVersion: null, downloadedVersion: null, downloadPercent: null, @@ -152,4 +158,3 @@ export function reduceDesktopUpdateStateOnInstallFailure( canRetry: true, }; } - diff --git a/apps/desktop/src/updateState.test.ts b/apps/desktop/src/updateState.test.ts index e2bc9c6257..43b718bd00 100644 --- a/apps/desktop/src/updateState.test.ts +++ b/apps/desktop/src/updateState.test.ts @@ -12,6 +12,9 @@ const baseState: DesktopUpdateState = { enabled: true, status: "idle", currentVersion: "1.0.0", + hostArch: "x64", + appArch: "x64", + runningUnderArm64Translation: false, availableVersion: null, downloadedVersion: null, downloadPercent: null, diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx index ecfd526acb..894fde25e9 100644 --- a/apps/web/src/components/Sidebar.tsx +++ b/apps/web/src/components/Sidebar.tsx @@ -8,6 +8,7 @@ import { SettingsIcon, SquarePenIcon, TerminalIcon, + TriangleAlertIcon, } from "lucide-react"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { @@ -36,14 +37,18 @@ import { type DraftThreadEnvMode, useComposerDraftStore } from "../composerDraft import { selectThreadTerminalState, useTerminalStateStore } from "../terminalStateStore"; import { toastManager } from "./ui/toast"; import { + getArm64IntelBuildWarningDescription, getDesktopUpdateActionError, getDesktopUpdateButtonTooltip, isDesktopUpdateButtonDisabled, resolveDesktopUpdateButtonAction, + shouldShowArm64IntelBuildWarning, shouldHighlightDesktopUpdateError, shouldShowDesktopUpdateButton, shouldToastDesktopUpdateActionResult, } from "./desktopUpdate.logic"; +import { Alert, AlertAction, AlertDescription, AlertTitle } from "./ui/alert"; +import { Button } from "./ui/button"; import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./ui/collapsible"; import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip"; import { @@ -887,6 +892,12 @@ export default function Sidebar() { const desktopUpdateButtonAction = desktopUpdateState ? resolveDesktopUpdateButtonAction(desktopUpdateState) : "none"; + const showArm64IntelBuildWarning = + isElectron && shouldShowArm64IntelBuildWarning(desktopUpdateState); + const arm64IntelBuildWarningDescription = + desktopUpdateState && showArm64IntelBuildWarning + ? getArm64IntelBuildWarningDescription(desktopUpdateState) + : null; const desktopUpdateButtonInteractivityClasses = desktopUpdateButtonDisabled ? "cursor-not-allowed opacity-60" : "hover:bg-accent hover:text-foreground"; @@ -1030,6 +1041,29 @@ export default function Sidebar() { )} + {showArm64IntelBuildWarning && arm64IntelBuildWarningDescription ? ( + + + + Intel build on Apple Silicon + {arm64IntelBuildWarningDescription} + {desktopUpdateButtonAction !== "none" ? ( + + + + ) : null} + + + ) : null}
diff --git a/apps/web/src/components/desktopUpdate.logic.test.ts b/apps/web/src/components/desktopUpdate.logic.test.ts index f80c1f3e46..7fd362bf1d 100644 --- a/apps/web/src/components/desktopUpdate.logic.test.ts +++ b/apps/web/src/components/desktopUpdate.logic.test.ts @@ -2,11 +2,13 @@ import { describe, expect, it } from "vitest"; import type { DesktopUpdateActionResult, DesktopUpdateState } from "@t3tools/contracts"; import { + getArm64IntelBuildWarningDescription, getDesktopUpdateActionError, getDesktopUpdateButtonTooltip, isDesktopUpdateButtonDisabled, resolveDesktopUpdateButtonAction, shouldHighlightDesktopUpdateError, + shouldShowArm64IntelBuildWarning, shouldShowDesktopUpdateButton, shouldToastDesktopUpdateActionResult, } from "./desktopUpdate.logic"; @@ -15,6 +17,9 @@ const baseState: DesktopUpdateState = { enabled: true, status: "idle", currentVersion: "1.0.0", + hostArch: "x64", + appArch: "x64", + runningUnderArm64Translation: false, availableVersion: null, downloadedVersion: null, downloadPercent: null, @@ -171,4 +176,30 @@ describe("desktop update UI helpers", () => { }), ).toBe(false); }); + + it("shows an Apple Silicon warning for Intel builds under Rosetta", () => { + const state: DesktopUpdateState = { + ...baseState, + hostArch: "arm64", + appArch: "x64", + runningUnderArm64Translation: true, + }; + + expect(shouldShowArm64IntelBuildWarning(state)).toBe(true); + expect(getArm64IntelBuildWarningDescription(state)).toContain("Apple Silicon"); + expect(getArm64IntelBuildWarningDescription(state)).toContain("Intel build"); + }); + + it("changes the warning copy when a native build update is ready to download", () => { + const state: DesktopUpdateState = { + ...baseState, + hostArch: "arm64", + appArch: "x64", + runningUnderArm64Translation: true, + status: "available", + availableVersion: "1.1.0", + }; + + expect(getArm64IntelBuildWarningDescription(state)).toContain("Download the available update"); + }); }); diff --git a/apps/web/src/components/desktopUpdate.logic.ts b/apps/web/src/components/desktopUpdate.logic.ts index ab7b7cdc41..faf30883cc 100644 --- a/apps/web/src/components/desktopUpdate.logic.ts +++ b/apps/web/src/components/desktopUpdate.logic.ts @@ -32,10 +32,29 @@ export function shouldShowDesktopUpdateButton(state: DesktopUpdateState | null): return resolveDesktopUpdateButtonAction(state) !== "none"; } +export function shouldShowArm64IntelBuildWarning(state: DesktopUpdateState | null): boolean { + return state?.hostArch === "arm64" && state.appArch === "x64"; +} + export function isDesktopUpdateButtonDisabled(state: DesktopUpdateState | null): boolean { return state?.status === "downloading"; } +export function getArm64IntelBuildWarningDescription(state: DesktopUpdateState): string { + if (!shouldShowArm64IntelBuildWarning(state)) { + return "This install is using the correct architecture."; + } + + const action = resolveDesktopUpdateButtonAction(state); + if (action === "download") { + return "This Mac has Apple Silicon, but T3 Code is still running the Intel build under Rosetta. Download the available update to switch to the native Apple Silicon build."; + } + if (action === "install") { + return "This Mac has Apple Silicon, but T3 Code is still running the Intel build under Rosetta. Restart to install the downloaded Apple Silicon build."; + } + return "This Mac has Apple Silicon, but T3 Code is still running the Intel build under Rosetta. The next app update will replace it with the native Apple Silicon build."; +} + export function getDesktopUpdateButtonTooltip(state: DesktopUpdateState): string { if (state.status === "available") { return `Update ${state.availableVersion ?? "available"} ready to download`; diff --git a/packages/contracts/src/ipc.ts b/packages/contracts/src/ipc.ts index 92f5b502c9..db9bab415e 100644 --- a/packages/contracts/src/ipc.ts +++ b/packages/contracts/src/ipc.ts @@ -58,10 +58,21 @@ export type DesktopUpdateStatus = | "downloaded" | "error"; +export type DesktopRuntimeArch = "arm64" | "x64" | "other"; + +export interface DesktopRuntimeInfo { + hostArch: DesktopRuntimeArch; + appArch: DesktopRuntimeArch; + runningUnderArm64Translation: boolean; +} + export interface DesktopUpdateState { enabled: boolean; status: DesktopUpdateStatus; currentVersion: string; + hostArch: DesktopRuntimeArch; + appArch: DesktopRuntimeArch; + runningUnderArm64Translation: boolean; availableVersion: string | null; downloadedVersion: string | null; downloadPercent: number | null; From 4b6a0c433cb808a0ebdd30ec48e799b6543d2cc9 Mon Sep 17 00:00:00 2001 From: Sai Shankar Date: Mon, 9 Mar 2026 16:33:13 +0530 Subject: [PATCH 25/36] fix(web): fix native scrollbar being intercepted by sidebar rail on windows and linux (#618) the rail's 16px hit area at z-20 sits right where the native os scrollbar lives when the sidebar is in offcanvas mode and collapsed. this causes clicks and drags on the scrollbar to toggle the sidebar instead on windows and linux. scoping pointer-events-none to [data-collapsible=offcanvas][data-state=collapsed] fixes the interception without affecting icon mode where the rail needs to stay clickable. --- apps/web/src/components/ui/sidebar.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/ui/sidebar.tsx b/apps/web/src/components/ui/sidebar.tsx index 77826aeced..ba77bddc27 100644 --- a/apps/web/src/components/ui/sidebar.tsx +++ b/apps/web/src/components/ui/sidebar.tsx @@ -566,7 +566,8 @@ function SidebarRail({
- {addingProject && ( + {shouldShowProjectPathEntry && (
{isElectron && (
{canCollapse ? (
-
diff --git a/apps/web/src/components/Sidebar.logic.test.ts b/apps/web/src/components/Sidebar.logic.test.ts new file mode 100644 index 0000000000..8a5e11e1af --- /dev/null +++ b/apps/web/src/components/Sidebar.logic.test.ts @@ -0,0 +1,92 @@ +import { describe, expect, it } from "vitest"; + +import { hasUnseenCompletion, resolveThreadStatusPill } from "./Sidebar.logic"; + +function makeLatestTurn(overrides?: { + completedAt?: string | null; + startedAt?: string | null; +}): Parameters[0]["latestTurn"] { + return { + turnId: "turn-1" as never, + state: "completed", + assistantMessageId: null, + requestedAt: "2026-03-09T10:00:00.000Z", + startedAt: overrides?.startedAt ?? "2026-03-09T10:00:00.000Z", + completedAt: overrides?.completedAt ?? "2026-03-09T10:05:00.000Z", + }; +} + +describe("hasUnseenCompletion", () => { + it("returns true when a thread completed after its last visit", () => { + expect( + hasUnseenCompletion({ + latestTurn: makeLatestTurn(), + lastVisitedAt: "2026-03-09T10:04:00.000Z", + session: null, + }), + ).toBe(true); + }); +}); + +describe("resolveThreadStatusPill", () => { + const baseThread = { + latestTurn: null, + lastVisitedAt: undefined, + session: { + provider: "codex" as const, + status: "running" as const, + createdAt: "2026-03-09T10:00:00.000Z", + updatedAt: "2026-03-09T10:00:00.000Z", + orchestrationStatus: "running" as const, + }, + }; + + it("shows pending approval before all other statuses", () => { + expect( + resolveThreadStatusPill({ + thread: baseThread, + hasPendingApprovals: true, + hasPendingUserInput: true, + }), + ).toMatchObject({ label: "Pending Approval", pulse: false }); + }); + + it("shows awaiting input when plan mode is blocked on user answers", () => { + expect( + resolveThreadStatusPill({ + thread: baseThread, + hasPendingApprovals: false, + hasPendingUserInput: true, + }), + ).toMatchObject({ label: "Awaiting Input", pulse: false }); + }); + + it("falls back to working when the thread is actively running without blockers", () => { + expect( + resolveThreadStatusPill({ + thread: baseThread, + hasPendingApprovals: false, + hasPendingUserInput: false, + }), + ).toMatchObject({ label: "Working", pulse: true }); + }); + + it("shows completed when there is an unseen completion and no active blocker", () => { + expect( + resolveThreadStatusPill({ + thread: { + ...baseThread, + latestTurn: makeLatestTurn(), + lastVisitedAt: "2026-03-09T10:04:00.000Z", + session: { + ...baseThread.session, + status: "ready", + orchestrationStatus: "ready", + }, + }, + hasPendingApprovals: false, + hasPendingUserInput: false, + }), + ).toMatchObject({ label: "Completed", pulse: false }); + }); +}); diff --git a/apps/web/src/components/Sidebar.logic.ts b/apps/web/src/components/Sidebar.logic.ts new file mode 100644 index 0000000000..44626cf147 --- /dev/null +++ b/apps/web/src/components/Sidebar.logic.ts @@ -0,0 +1,76 @@ +import type { Thread } from "../types"; + +export interface ThreadStatusPill { + label: "Working" | "Connecting" | "Completed" | "Pending Approval" | "Awaiting Input"; + colorClass: string; + dotClass: string; + pulse: boolean; +} + +type ThreadStatusInput = Pick; + +export function hasUnseenCompletion(thread: ThreadStatusInput): boolean { + if (!thread.latestTurn?.completedAt) return false; + const completedAt = Date.parse(thread.latestTurn.completedAt); + if (Number.isNaN(completedAt)) return false; + if (!thread.lastVisitedAt) return true; + + const lastVisitedAt = Date.parse(thread.lastVisitedAt); + if (Number.isNaN(lastVisitedAt)) return true; + return completedAt > lastVisitedAt; +} + +export function resolveThreadStatusPill(input: { + thread: ThreadStatusInput; + hasPendingApprovals: boolean; + hasPendingUserInput: boolean; +}): ThreadStatusPill | null { + const { hasPendingApprovals, hasPendingUserInput, thread } = input; + + if (hasPendingApprovals) { + return { + label: "Pending Approval", + colorClass: "text-amber-600 dark:text-amber-300/90", + dotClass: "bg-amber-500 dark:bg-amber-300/90", + pulse: false, + }; + } + + if (hasPendingUserInput) { + return { + label: "Awaiting Input", + colorClass: "text-indigo-600 dark:text-indigo-300/90", + dotClass: "bg-indigo-500 dark:bg-indigo-300/90", + pulse: false, + }; + } + + if (thread.session?.status === "running") { + return { + label: "Working", + colorClass: "text-sky-600 dark:text-sky-300/80", + dotClass: "bg-sky-500 dark:bg-sky-300/80", + pulse: true, + }; + } + + if (thread.session?.status === "connecting") { + return { + label: "Connecting", + colorClass: "text-sky-600 dark:text-sky-300/80", + dotClass: "bg-sky-500 dark:bg-sky-300/80", + pulse: true, + }; + } + + if (hasUnseenCompletion(thread)) { + return { + label: "Completed", + colorClass: "text-emerald-600 dark:text-emerald-300/90", + dotClass: "bg-emerald-500 dark:bg-emerald-300/90", + pulse: false, + }; + } + + return null; +} diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx index 0e700369eb..fb2ccb2fec 100644 --- a/apps/web/src/components/Sidebar.tsx +++ b/apps/web/src/components/Sidebar.tsx @@ -28,8 +28,7 @@ import { APP_STAGE_LABEL } from "../branding"; import { newCommandId, newProjectId, newThreadId } from "../lib/utils"; import { useStore } from "../store"; import { isChatNewLocalShortcut, isChatNewShortcut, shortcutLabelForCommand } from "../keybindings"; -import { type Thread } from "../types"; -import { derivePendingApprovals } from "../session-logic"; +import { derivePendingApprovals, derivePendingUserInputs } from "../session-logic"; import { gitRemoveWorktreeMutationOptions, gitStatusQueryOptions } from "../lib/gitReactQuery"; import { serverConfigQueryOptions } from "../lib/serverReactQuery"; import { readNativeApi } from "../nativeApi"; @@ -68,6 +67,7 @@ import { } from "./ui/sidebar"; import { formatWorktreePathForDisplay, getOrphanedWorktreePathForThread } from "../worktreeCleanup"; import { isNonEmpty as isNonEmptyString } from "effect/String"; +import { resolveThreadStatusPill } from "./Sidebar.logic"; const EMPTY_KEYBINDINGS: ResolvedKeybindingsConfig = []; const THREAD_PREVIEW_LIMIT = 6; @@ -89,13 +89,6 @@ function formatRelativeTime(iso: string): string { return `${Math.floor(hours / 24)}d ago`; } -interface ThreadStatusPill { - label: "Working" | "Connecting" | "Completed" | "Pending Approval"; - colorClass: string; - dotClass: string; - pulse: boolean; -} - interface TerminalStatusIndicator { label: "Terminal process running"; colorClass: string; @@ -111,57 +104,6 @@ interface PrStatusIndicator { type ThreadPr = GitStatusResult["pr"]; -function hasUnseenCompletion(thread: Thread): boolean { - if (!thread.latestTurn?.completedAt) return false; - const completedAt = Date.parse(thread.latestTurn.completedAt); - if (Number.isNaN(completedAt)) return false; - if (!thread.lastVisitedAt) return true; - - const lastVisitedAt = Date.parse(thread.lastVisitedAt); - if (Number.isNaN(lastVisitedAt)) return true; - return completedAt > lastVisitedAt; -} - -function threadStatusPill(thread: Thread, hasPendingApprovals: boolean): ThreadStatusPill | null { - if (hasPendingApprovals) { - return { - label: "Pending Approval", - colorClass: "text-amber-600 dark:text-amber-300/90", - dotClass: "bg-amber-500 dark:bg-amber-300/90", - pulse: false, - }; - } - - if (thread.session?.status === "running") { - return { - label: "Working", - colorClass: "text-sky-600 dark:text-sky-300/80", - dotClass: "bg-sky-500 dark:bg-sky-300/80", - pulse: true, - }; - } - - if (thread.session?.status === "connecting") { - return { - label: "Connecting", - colorClass: "text-sky-600 dark:text-sky-300/80", - dotClass: "bg-sky-500 dark:bg-sky-300/80", - pulse: true, - }; - } - - if (hasUnseenCompletion(thread)) { - return { - label: "Completed", - colorClass: "text-emerald-600 dark:text-emerald-300/90", - dotClass: "bg-emerald-500 dark:bg-emerald-300/90", - pulse: false, - }; - } - - return null; -} - function terminalStatusFromRunningIds( runningTerminalIds: string[], ): TerminalStatusIndicator | null { @@ -321,6 +263,13 @@ export default function Sidebar() { } return map; }, [threads]); + const pendingUserInputByThreadId = useMemo(() => { + const map = new Map(); + for (const thread of threads) { + map.set(thread.id, derivePendingUserInputs(thread.activities).length > 0); + } + return map; + }, [threads]); const projectCwdById = useMemo( () => new Map(projects.map((project) => [project.id, project.cwd] as const)), [projects], @@ -1268,10 +1217,11 @@ export default function Sidebar() { {visibleThreads.map((thread) => { const isActive = routeThreadId === thread.id; - const threadStatus = threadStatusPill( + const threadStatus = resolveThreadStatusPill({ thread, - pendingApprovalByThreadId.get(thread.id) === true, - ); + hasPendingApprovals: pendingApprovalByThreadId.get(thread.id) === true, + hasPendingUserInput: pendingUserInputByThreadId.get(thread.id) === true, + }); const prStatus = prStatusIndicator(prByThreadId.get(thread.id) ?? null); const terminalStatus = terminalStatusFromRunningIds( selectThreadTerminalState(terminalStateByThreadId, thread.id) From b946f00f1a31f16a51f9bd1f579baf40c8eaed83 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 9 Mar 2026 09:42:19 -0700 Subject: [PATCH 33/36] Show Plan Ready status pill for settled plan threads - add "Plan Ready" sidebar status when a plan-mode turn is settled with a proposed plan - update sidebar logic tests to cover the new status and expanded thread inputs --- apps/web/src/components/Sidebar.logic.test.ts | 32 +++++++++++++++++++ apps/web/src/components/Sidebar.logic.ts | 28 ++++++++++++++-- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/Sidebar.logic.test.ts b/apps/web/src/components/Sidebar.logic.test.ts index 8a5e11e1af..d0216d0e40 100644 --- a/apps/web/src/components/Sidebar.logic.test.ts +++ b/apps/web/src/components/Sidebar.logic.test.ts @@ -20,8 +20,10 @@ describe("hasUnseenCompletion", () => { it("returns true when a thread completed after its last visit", () => { expect( hasUnseenCompletion({ + interactionMode: "default", latestTurn: makeLatestTurn(), lastVisitedAt: "2026-03-09T10:04:00.000Z", + proposedPlans: [], session: null, }), ).toBe(true); @@ -30,8 +32,10 @@ describe("hasUnseenCompletion", () => { describe("resolveThreadStatusPill", () => { const baseThread = { + interactionMode: "plan" as const, latestTurn: null, lastVisitedAt: undefined, + proposedPlans: [], session: { provider: "codex" as const, status: "running" as const, @@ -71,11 +75,39 @@ describe("resolveThreadStatusPill", () => { ).toMatchObject({ label: "Working", pulse: true }); }); + it("shows plan ready when a settled plan turn has a proposed plan ready for follow-up", () => { + expect( + resolveThreadStatusPill({ + thread: { + ...baseThread, + latestTurn: makeLatestTurn(), + proposedPlans: [ + { + id: "plan-1" as never, + turnId: "turn-1" as never, + createdAt: "2026-03-09T10:00:00.000Z", + updatedAt: "2026-03-09T10:05:00.000Z", + planMarkdown: "# Plan", + }, + ], + session: { + ...baseThread.session, + status: "ready", + orchestrationStatus: "ready", + }, + }, + hasPendingApprovals: false, + hasPendingUserInput: false, + }), + ).toMatchObject({ label: "Plan Ready", pulse: false }); + }); + it("shows completed when there is an unseen completion and no active blocker", () => { expect( resolveThreadStatusPill({ thread: { ...baseThread, + interactionMode: "default", latestTurn: makeLatestTurn(), lastVisitedAt: "2026-03-09T10:04:00.000Z", session: { diff --git a/apps/web/src/components/Sidebar.logic.ts b/apps/web/src/components/Sidebar.logic.ts index 44626cf147..e950d8de6e 100644 --- a/apps/web/src/components/Sidebar.logic.ts +++ b/apps/web/src/components/Sidebar.logic.ts @@ -1,13 +1,23 @@ import type { Thread } from "../types"; +import { findLatestProposedPlan, isLatestTurnSettled } from "../session-logic"; export interface ThreadStatusPill { - label: "Working" | "Connecting" | "Completed" | "Pending Approval" | "Awaiting Input"; + label: + | "Working" + | "Connecting" + | "Completed" + | "Pending Approval" + | "Awaiting Input" + | "Plan Ready"; colorClass: string; dotClass: string; pulse: boolean; } -type ThreadStatusInput = Pick; +type ThreadStatusInput = Pick< + Thread, + "interactionMode" | "latestTurn" | "lastVisitedAt" | "proposedPlans" | "session" +>; export function hasUnseenCompletion(thread: ThreadStatusInput): boolean { if (!thread.latestTurn?.completedAt) return false; @@ -63,6 +73,20 @@ export function resolveThreadStatusPill(input: { }; } + const hasPlanReadyPrompt = + !hasPendingUserInput && + thread.interactionMode === "plan" && + isLatestTurnSettled(thread.latestTurn, thread.session) && + findLatestProposedPlan(thread.proposedPlans, thread.latestTurn?.turnId ?? null) !== null; + if (hasPlanReadyPrompt) { + return { + label: "Plan Ready", + colorClass: "text-violet-600 dark:text-violet-300/90", + dotClass: "bg-violet-500 dark:bg-violet-300/90", + pulse: false, + }; + } + if (hasUnseenCompletion(thread)) { return { label: "Completed", From 9fdb45be1efb0e0b542a0dd78d868de6f71d7d4a Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 9 Mar 2026 09:13:52 -0700 Subject: [PATCH 34/36] Remove service tier setting from Codex flow and contracts - Drop `serviceTier` from orchestration/provider contracts and server dispatch paths - Remove service-tier app setting/UI and related resolver logic - Keep fast badge behavior tied to explicit fast-mode boolean --- .../Layers/ProviderCommandReactor.ts | 17 +++--- apps/server/src/orchestration/decider.ts | 1 - .../src/provider/Layers/CodexAdapter.ts | 1 - apps/web/src/appSettings.test.ts | 20 ++----- apps/web/src/appSettings.ts | 30 +--------- apps/web/src/components/ChatView.tsx | 19 +++--- apps/web/src/routes/_chat.settings.tsx | 58 ++----------------- packages/contracts/src/orchestration.ts | 5 -- packages/contracts/src/provider.ts | 3 - 9 files changed, 25 insertions(+), 129 deletions(-) diff --git a/apps/server/src/orchestration/Layers/ProviderCommandReactor.ts b/apps/server/src/orchestration/Layers/ProviderCommandReactor.ts index 2a72d59027..39f1376431 100644 --- a/apps/server/src/orchestration/Layers/ProviderCommandReactor.ts +++ b/apps/server/src/orchestration/Layers/ProviderCommandReactor.ts @@ -5,7 +5,6 @@ import { type OrchestrationEvent, type ProviderModelOptions, type ProviderKind, - type ProviderServiceTier, type ProviderStartOptions, type OrchestrationSession, ThreadId, @@ -205,7 +204,6 @@ const make = Effect.gen(function* () { readonly provider?: ProviderKind; readonly model?: string; readonly modelOptions?: ProviderModelOptions; - readonly serviceTier?: ProviderServiceTier | null; readonly providerOptions?: ProviderStartOptions; }, ) { @@ -241,7 +239,6 @@ const make = Effect.gen(function* () { : {}), ...(effectiveCwd ? { cwd: effectiveCwd } : {}), ...(desiredModel ? { model: desiredModel } : {}), - ...(options?.serviceTier !== undefined ? { serviceTier: options.serviceTier } : {}), ...(options?.modelOptions !== undefined ? { modelOptions: options.modelOptions } : {}), ...(options?.providerOptions !== undefined ? { providerOptions: options.providerOptions } : {}), ...(input?.resumeCursor !== undefined ? { resumeCursor: input.resumeCursor } : {}), @@ -328,7 +325,6 @@ const make = Effect.gen(function* () { readonly attachments?: ReadonlyArray; readonly provider?: ProviderKind; readonly model?: string; - readonly serviceTier?: ProviderServiceTier | null; readonly modelOptions?: ProviderModelOptions; readonly providerOptions?: ProviderStartOptions; readonly interactionMode?: "default" | "plan"; @@ -344,7 +340,6 @@ const make = Effect.gen(function* () { yield* ensureSessionForThread(input.threadId, input.createdAt, { ...(input.provider !== undefined ? { provider: input.provider } : {}), ...(input.model !== undefined ? { model: input.model } : {}), - ...(input.serviceTier !== undefined ? { serviceTier: input.serviceTier } : {}), ...(input.modelOptions !== undefined ? { modelOptions: input.modelOptions } : {}), ...(input.providerOptions !== undefined ? { providerOptions: input.providerOptions } : {}), }); @@ -365,7 +360,6 @@ const make = Effect.gen(function* () { ...(normalizedInput ? { input: normalizedInput } : {}), ...(normalizedAttachments.length > 0 ? { attachments: normalizedAttachments } : {}), ...(modelForTurn !== undefined ? { model: modelForTurn } : {}), - ...(input.serviceTier !== undefined ? { serviceTier: input.serviceTier } : {}), ...(input.modelOptions !== undefined ? { modelOptions: input.modelOptions } : {}), ...(input.interactionMode !== undefined ? { interactionMode: input.interactionMode } : {}), }); @@ -480,7 +474,6 @@ const make = Effect.gen(function* () { ...(message.attachments !== undefined ? { attachments: message.attachments } : {}), ...(event.payload.provider !== undefined ? { provider: event.payload.provider } : {}), ...(event.payload.model !== undefined ? { model: event.payload.model } : {}), - ...(event.payload.serviceTier !== undefined ? { serviceTier: event.payload.serviceTier } : {}), ...(event.payload.modelOptions !== undefined ? { modelOptions: event.payload.modelOptions } : {}), ...(event.payload.providerOptions !== undefined ? { providerOptions: event.payload.providerOptions } : {}), interactionMode: event.payload.interactionMode, @@ -639,9 +632,13 @@ const make = Effect.gen(function* () { return; } const cachedProviderOptions = threadProviderOptions.get(event.payload.threadId); - yield* ensureSessionForThread(event.payload.threadId, event.occurredAt, { - ...(cachedProviderOptions !== undefined ? { providerOptions: cachedProviderOptions } : {}), - }); + yield* ensureSessionForThread( + event.payload.threadId, + event.occurredAt, + cachedProviderOptions !== undefined + ? { providerOptions: cachedProviderOptions } + : undefined, + ); return; } case "thread.turn-start-requested": diff --git a/apps/server/src/orchestration/decider.ts b/apps/server/src/orchestration/decider.ts index 1c1ca4dd79..2218f88cf5 100644 --- a/apps/server/src/orchestration/decider.ts +++ b/apps/server/src/orchestration/decider.ts @@ -301,7 +301,6 @@ export const decideOrchestrationCommand = Effect.fn("decideOrchestrationCommand" messageId: command.message.messageId, ...(command.provider !== undefined ? { provider: command.provider } : {}), ...(command.model !== undefined ? { model: command.model } : {}), - ...(command.serviceTier !== undefined ? { serviceTier: command.serviceTier } : {}), ...(command.modelOptions !== undefined ? { modelOptions: command.modelOptions } : {}), ...(command.providerOptions !== undefined ? { providerOptions: command.providerOptions } : {}), assistantDeliveryMode: command.assistantDeliveryMode ?? DEFAULT_ASSISTANT_DELIVERY_MODE, diff --git a/apps/server/src/provider/Layers/CodexAdapter.ts b/apps/server/src/provider/Layers/CodexAdapter.ts index 9a6271b792..a31ba2907e 100644 --- a/apps/server/src/provider/Layers/CodexAdapter.ts +++ b/apps/server/src/provider/Layers/CodexAdapter.ts @@ -1354,7 +1354,6 @@ const makeCodexAdapter = (options?: CodexAdapterLiveOptions) => threadId: input.threadId, ...(input.input !== undefined ? { input: input.input } : {}), ...(input.model !== undefined ? { model: input.model } : {}), - ...(input.serviceTier !== undefined ? { serviceTier: input.serviceTier } : {}), ...(input.modelOptions?.codex?.reasoningEffort !== undefined ? { effort: input.modelOptions.codex.reasoningEffort } : {}), diff --git a/apps/web/src/appSettings.test.ts b/apps/web/src/appSettings.test.ts index 5ab5d3c90a..e07e116af7 100644 --- a/apps/web/src/appSettings.test.ts +++ b/apps/web/src/appSettings.test.ts @@ -4,7 +4,6 @@ import { getAppModelOptions, getSlashModelOptions, normalizeCustomModelSlugs, - resolveAppServiceTier, shouldShowFastTierIcon, resolveAppModelSelection, } from "./appSettings"; @@ -85,21 +84,10 @@ describe("getSlashModelOptions", () => { }); }); -describe("resolveAppServiceTier", () => { - it("maps automatic to no override", () => { - expect(resolveAppServiceTier("auto")).toBeNull(); - }); - - it("preserves explicit service tier overrides", () => { - expect(resolveAppServiceTier("fast")).toBe("fast"); - expect(resolveAppServiceTier("flex")).toBe("flex"); - }); -}); - describe("shouldShowFastTierIcon", () => { - it("shows the fast-tier icon only for gpt-5.4 on fast tier", () => { - expect(shouldShowFastTierIcon("gpt-5.4", "fast")).toBe(true); - expect(shouldShowFastTierIcon("gpt-5.4", "auto")).toBe(false); - expect(shouldShowFastTierIcon("gpt-5.3-codex", "fast")).toBe(false); + it("shows the fast-tier icon only for gpt-5.4 when fast mode is enabled", () => { + expect(shouldShowFastTierIcon("gpt-5.4", true)).toBe(true); + expect(shouldShowFastTierIcon("gpt-5.4", false)).toBe(false); + expect(shouldShowFastTierIcon("gpt-5.3-codex", true)).toBe(false); }); }); diff --git a/apps/web/src/appSettings.ts b/apps/web/src/appSettings.ts index e58f7af4a6..53177312cf 100644 --- a/apps/web/src/appSettings.ts +++ b/apps/web/src/appSettings.ts @@ -1,30 +1,11 @@ import { useCallback, useSyncExternalStore } from "react"; import { Option, Schema } from "effect"; -import { type ProviderKind, type ProviderServiceTier } from "@t3tools/contracts"; +import { type ProviderKind } from "@t3tools/contracts"; import { getDefaultModel, getModelOptions, normalizeModelSlug } from "@t3tools/shared/model"; const APP_SETTINGS_STORAGE_KEY = "t3code:app-settings:v1"; const MAX_CUSTOM_MODEL_COUNT = 32; export const MAX_CUSTOM_MODEL_LENGTH = 256; -export const APP_SERVICE_TIER_OPTIONS = [ - { - value: "auto", - label: "Automatic", - description: "Use Codex defaults without forcing a service tier.", - }, - { - value: "fast", - label: "Fast", - description: "Request the fast service tier when the model supports it.", - }, - { - value: "flex", - label: "Flex", - description: "Request the flex service tier when the model supports it.", - }, -] as const; -export type AppServiceTier = (typeof APP_SERVICE_TIER_OPTIONS)[number]["value"]; -const AppServiceTierSchema = Schema.Literals(["auto", "fast", "flex"]); const MODELS_WITH_FAST_SUPPORT = new Set(["gpt-5.4"]); const BUILT_IN_MODEL_SLUGS_BY_PROVIDER: Record> = { codex: new Set(getModelOptions("codex").map((option) => option.slug)), @@ -41,7 +22,6 @@ const AppSettingsSchema = Schema.Struct({ enableAssistantStreaming: Schema.Boolean.pipe( Schema.withConstructorDefault(() => Option.some(false)), ), - codexServiceTier: AppServiceTierSchema.pipe(Schema.withConstructorDefault(() => Option.some("auto"))), customCodexModels: Schema.Array(Schema.String).pipe( Schema.withConstructorDefault(() => Option.some([])), ), @@ -53,17 +33,13 @@ export interface AppModelOption { isCustom: boolean; } -export function resolveAppServiceTier(serviceTier: AppServiceTier): ProviderServiceTier | null { - return serviceTier === "auto" ? null : serviceTier; -} - export function shouldShowFastTierIcon( model: string | null | undefined, - serviceTier: AppServiceTier, + fastModeEnabled: boolean, ): boolean { const normalizedModel = normalizeModelSlug(model); return ( - resolveAppServiceTier(serviceTier) === "fast" && + fastModeEnabled && normalizedModel !== null && MODELS_WITH_FAST_SUPPORT.has(normalizedModel) ); diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 196dfebacc..eafabbb36b 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -205,9 +205,7 @@ import { readNativeApi } from "~/nativeApi"; import { getAppModelOptions, resolveAppModelSelection, - resolveAppServiceTier, shouldShowFastTierIcon, - type AppServiceTier, useAppSettings, } from "../appSettings"; import { @@ -785,8 +783,6 @@ export default function ChatView({ threadId }: ChatViewProps) { activeThread.messages.length > 0 || activeThread.session !== null), ); - const selectedServiceTierSetting = settings.codexServiceTier; - const selectedServiceTier = resolveAppServiceTier(selectedServiceTierSetting); const lockedProvider: ProviderKind | null = hasThreadStarted ? (sessionProvider ?? selectedProviderByThreadId ?? null) : null; @@ -1255,9 +1251,9 @@ export default function ChatView({ threadId }: ChatViewProps) { label: name, description: `${providerLabel} · ${slug}`, showFastBadge: - provider === "codex" && shouldShowFastTierIcon(slug, selectedServiceTierSetting), + provider === "codex" && shouldShowFastTierIcon(slug, selectedCodexFastModeEnabled), })); - }, [composerTrigger, searchableModelOptions, selectedServiceTierSetting, workspaceEntries]); + }, [composerTrigger, searchableModelOptions, selectedCodexFastModeEnabled, workspaceEntries]); const composerMenuOpen = Boolean(composerTrigger); const activeComposerMenuItem = useMemo( () => @@ -2665,7 +2661,6 @@ export default function ChatView({ threadId }: ChatViewProps) { attachments: turnAttachments, }, model: selectedModel || undefined, - serviceTier: selectedServiceTier, ...(selectedModelOptionsForDispatch ? { modelOptions: selectedModelOptionsForDispatch } : {}), @@ -3700,7 +3695,7 @@ export default function ChatView({ threadId }: ChatViewProps) { model={selectedModelForPickerWithCustomFallback} lockedProvider={lockedProvider} modelOptionsByProvider={modelOptionsByProvider} - serviceTierSetting={selectedServiceTierSetting} + fastModeEnabled={selectedCodexFastModeEnabled} onProviderModelChange={onProviderModelSelect} /> @@ -5548,7 +5543,7 @@ const ProviderModelPicker = memo(function ProviderModelPicker(props: { model: ModelSlug; lockedProvider: ProviderKind | null; modelOptionsByProvider: Record>; - serviceTierSetting: AppServiceTier; + fastModeEnabled: boolean; disabled?: boolean; onProviderModelChange: (provider: ProviderKind, model: ModelSlug) => void; }) { @@ -5578,10 +5573,10 @@ const ProviderModelPicker = memo(function ProviderModelPicker(props: { disabled={props.disabled} /> } - > + >
- - {MODEL_PROVIDER_SETTINGS.map((providerSettings) => { const provider = providerSettings.provider; const customModels = getCustomModelsForProvider(settings, provider); @@ -445,14 +400,9 @@ function SettingsRouteView() { key={`${provider}:${slug}`} className="flex items-center justify-between gap-3 rounded-lg border border-border bg-background px-3 py-2" > -
- {provider === "codex" && shouldShowFastTierIcon(slug, codexServiceTier) ? ( - - ) : null} - - {slug} - -
+ + {slug} +