Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ This is a fork of T3 Code that integrates a few additional features, including:
- While the agent works, Chat mode shows "Working for" and the time just above the message box, in the sub-thread where you last wrote to it in that run, or else in the main list.
- "Enable Dashboard", beside Display mode in the same menu, gives the thread a Dashboard in either mode: a Dashboard tab in the right panel (+ → Dashboard) with six status slots that the agent writes with its `dashboard_set` tool and reads with `dashboard_get`. Each slot shows how long ago it changed, and new text stays highlighted until you click the slot. Select text in a slot to quote it with Cite, as you would in a message. Agents can link to the Dashboard in their messages, and a click on the link opens it.
- Settings → Threads → New threads → Display mode picks the mode for threads you start from the message box in the web or desktop app. Threads that agents, scheduled tasks, side chats or the mobile app start open in Normal mode, and existing threads keep their mode.
- **Split the right panel in two:** drag a right-panel tab onto the left or right part of the panel's content and drop it to get two panes side by side, each with its own tabs, as with Windows Snap. Drag tabs between the panes, drag the line between them to resize (double-click resets it), and close or move away a pane's last tab to go back to one pane. The tab menu has Split right, Split left, Move to the other pane and Unsplit. New tabs open in the pane you last used. A narrow window shows all tabs in one strip and keeps the split for when there is room. A press anywhere on a tab now switches to it at once.
- **Drag links into the right panel:** drag a file from the Files tree, or a link from a chat message, onto a right-panel pane to open it there. Supported chat links are file, pull request, issue, thread, `board://`, Dashboard, and web links. Drop the item on a tab strip to open it at that spot. Drop the item on the left or right third of a single pane to split the panel on that side when there is room. If the item is already open in the other pane, the drop moves its tab to where you dropped it. A dropped file keeps a standalone Files tab open beside it. A plain click on a file still replaces the Files tab. A full pull request or issue URL opens as a pull request or issue tab when a click opens that kind of tab. Other web links, and pull request or issue links that do not, drag whenever the preview browser is available. Dropping one opens it in the preview browser, even when a plain click opens it in your system browser. Without a preview browser, those links do not drag to the panel. Folder rows in the Files tree, short references like `#42`, commit links, and web image and video URLs do not drag to the panel. A chat file link drags whenever a click opens it in the panel. A dropped file link opens what its click opens, in the pane you chose. It can open a workspace folder or a workspace image or video file. Dragging a Files row to a message box still adds an `@mention`. In the desktop app on Mac and Windows, file links in chat still drag out as files instead of dropping on the panel.
- **The work area:** everything right of the thread list is one area of panes, starting as one pane with a Chat tab for the selected thread. Drag a tab onto a pane's tab strip to move it there, onto an edge of a pane's content to split that side, or onto the middle to join that pane. The tab menu also has Split right and Split down. When there is one pane, a Split right button at the right end of the tab bar splits it and opens a New tab page. Panes split again in either direction. Drag the divider between two panes, or use the arrow keys on it, to resize. Double-click the divider to reset its size. Closing a pane's last tab closes the pane. Any pane with a message box (a Chat tab, a reply tab, or a side-thread tab) stays at least 360 px wide. Drag a same-project thread from the thread list into the area to open its chat as another Chat tab. File links in that chat open that thread's file as a tab beside it. You cannot drop another project's thread into the area, though dropping it on a message box still adds it as context. A thread link, chip, or header breadcrumb in a chat opens a same-project thread as a Chat tab beside the chat, and opens a thread of another project or environment on its own page. Subagents and side chats open as side-thread tabs beside the chat, as in upstream T3 Code. A Cmd or Ctrl click, a middle click, or "Open in main view" opens them on their own page. Reply, "N replies" on a message, or a sub-thread in the Replies list opens that sub-thread as its own tab. Opening one from the Replies list places it next to the list. Each thread keeps its own layout. The last Chat tab cannot close. Closing the selected thread's Chat removes it until + → Chat brings it back. Files, links, and diffs that open by themselves go beside the chat, never over it. A window 980 px wide or less shows every tab in one strip and keeps the panes for when there is room. The right panel's show, hide, and maximize controls are gone. A press anywhere on a tab switches to it at once. No tab is ever hidden except a browser or device tab playing in the floating mini player, a small floating window over the chat. "Preview: Toggle", picture-in-picture, and a device's Float move the tab into the mini player and keep the session. Closing the mini player, choosing "Open in panel", or using "Preview: Toggle" again puts the tab back in its pane. If the window or layout stops showing the Chat that holds the mini player, the tab goes back to its pane and the mini player closes. "Preview: Toggle" on an empty browser tab (a New tab page with no page loaded) closes that tab. "Diff: Toggle" closes the Diff tab when it is shown and opens it when it is not. Reopen Closed View can bring back a closed Diff tab. There is no terminal drawer under the Chat. Every terminal is a terminal tab in a pane. Project scripts and the Run button on a chat code block run in an idle terminal tab, or open a new terminal tab. A terminal that the server already runs for the thread (such as a worktree setup shell) shows as a background tab. "Terminal: Toggle" (Cmd+J or Ctrl+J) is gone, including from Settings → Keybindings. Split, new, and close terminal shortcuts act on the focused terminal tab. Drag a file from the Files tree, or a link from a chat message, onto a pane to open it there. Supported chat links are file, pull request, issue, thread, `board://`, Dashboard, and web links. Drop the item on a tab strip to open it at that spot, on one of a pane's four edges to split that side, or on the middle to add it to that pane. If the item is already open in another pane, the drop moves its tab there. If you press a key or click before a slow drop finishes opening, the item opens where a click would instead. A dropped file keeps a standalone Files tab open beside it. A plain click on a file still replaces the Files tab. A full pull request or issue URL opens as a pull request or issue tab when a click opens that kind of tab. Other web links, and pull request or issue links that do not open that kind of tab, drag whenever the preview browser is available. A drop opens those links in the preview browser even when a click opens them in the system browser. Without a preview browser, those links do not drag. Folder rows in the Files tree, short references like `#42`, commit links, and web image and video URLs do not drag. A chat file link drags whenever a click opens it in the work area. A dropped file link opens what its click opens, in the pane you chose, so it can open a workspace folder or a workspace image or video file. Dragging a Files row to a message box still adds an `@mention`. In the desktop app on Mac and Windows, file links in chat still drag out as files instead of dropping on a pane.
- Copy buttons on pages in the preview browser now put the copied text into your own clipboard.
- **Two preview browser modes:** Settings → Browser → Preview browser picks the browser the server runs for preview tabs. **T3 native** (fast) is the default. It runs chrome-headless-shell, Chrome's small build that runs without a window. **Chrome** (slow) runs full Chrome, for pages that don't work in T3 native. On platforms where T3 has no Chrome for Testing build (Google's Chrome build for test automation), both choices run T3 native. Switching closes the open preview tabs.
- **Compact when idle for Claude threads:** a choice in Settings → Providers → Advanced → Compact idle threads. Besides compacting before the prompt cache expires, it compacts a large idle Claude thread (default 400K tokens or more) a set time (default 15 minutes) after the last message or answer from a user or a bot, so the compaction runs while no one waits for a reply. The token counts and the wait are set right under the choice.
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/browser/BrowserSurfaceSlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useLayoutEffect, useRef } from "react";

import { acquireBrowserSurface } from "./browserSurfaceStore";
import { observeResize } from "../lib/observeResize";
import { WORK_AREA_LAYOUT_EVENT } from "../fork/workArea/workAreaView";

export function BrowserSurfaceSlot(props: {
readonly tabId: string;
Expand Down Expand Up @@ -68,10 +69,12 @@ export function BrowserSurfaceSlot(props: {
const stopObserving = observeResize(observed, update);
window.addEventListener("resize", update);
window.addEventListener("scroll", update, true);
window.addEventListener(WORK_AREA_LAYOUT_EVENT, update);
return () => {
stopObserving();
window.removeEventListener("resize", update);
window.removeEventListener("scroll", update, true);
window.removeEventListener(WORK_AREA_LAYOUT_EVENT, update);
if (updateRef.current === update) updateRef.current = null;
lease.release();
};
Expand Down
20 changes: 11 additions & 9 deletions apps/web/src/browser/openFileInPreview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import * as Schema from "effect/Schema";
import { AsyncResult } from "effect/reactivity";

import { resolveAssetUrl } from "~/assets/assetUrls";
import { captureOpenOrigin } from "~/fork/workArea/workAreaView";
import { isPreviewAvailableFor, previewRuntimeFor } from "~/browser/previewRuntime";
import {
applyPreviewServerSnapshot,
Expand Down Expand Up @@ -64,11 +65,10 @@ export async function openUrlInPreview<E>(input: {
readonly openPreview: OpenPreviewMutation<E>;
readonly profileId?: PreviewOpenInput["profileId"];
readonly background?: boolean;
/** Runs right after the panel opens the tab, in the same task as that write. */
readonly onOpened?: () => void;
}): Promise<AtomCommandResult<void, E | BrowserSettingsReadError>> {
// Read before any await: a side chat pane that unmounts meanwhile drops its host mapping.
const threadRef = rightPanelHostRef(input.threadRef);
const fromOrigin = captureOpenOrigin();
const defaults = await resolveBrowserDefaults().catch(
(cause: unknown) => new BrowserSettingsReadError({ cause }),
);
Expand Down Expand Up @@ -109,8 +109,7 @@ export async function openUrlInPreview<E>(input: {
return;
}
applyPreviewServerSnapshot(threadRef, snapshot);
useRightPanelStore.getState().openBrowser(threadRef, snapshot.tabId);
input.onOpened?.();
fromOrigin(() => useRightPanelStore.getState().openBrowser(threadRef, snapshot.tabId));
});
}

Expand Down Expand Up @@ -140,6 +139,7 @@ export async function openFileInPreview<AssetError, PreviewError>(input: {
);
}
const hostRef = rightPanelHostRef(input.threadRef);
const fromOrigin = captureOpenOrigin();
const insideWorkspace =
mediaFileReference(input.filePath, input.workspaceRoot).relativePath !== undefined;
const assetResult = await input.createAssetUrl({
Expand All @@ -161,9 +161,11 @@ export async function openFileInPreview<AssetError, PreviewError>(input: {
Cause.die(new Error("The environment returned an invalid asset URL.")),
);
}
return openUrlInPreview({
threadRef: hostRef,
url: assetUrl,
openPreview: input.openPreview,
});
return fromOrigin(() =>
openUrlInPreview({
threadRef: hostRef,
url: assetUrl,
openPreview: input.openPreview,
}),
);
}
6 changes: 5 additions & 1 deletion apps/web/src/browser/useOpenLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
squashAtomCommandFailure,
} from "@t3tools/client-runtime/state/runtime";
import { recordVisitForThread } from "~/browserHistoryStore";
import { captureOpenOrigin } from "~/fork/workArea/workAreaView";
import { readLocalApi } from "~/localApi";
import { previewEnvironment } from "~/state/preview";
import { useAtomCommand } from "~/state/use-atom-command";
Expand Down Expand Up @@ -34,14 +35,17 @@ export function useOpenLink(threadRef: ScopedThreadRef | null | undefined): (
const openPreview = useAtomCommand(previewEnvironment.open, { reportFailure: false });
return async (url, options = {}) => {
const targetThreadRef = options.threadRef ?? threadRef;
const fromOrigin = captureOpenOrigin();
const target = resolveLinkTarget({
url,
event: options.event ?? NO_MODIFIER,
preference: await resolveBrowserLinkTargetPreference(),
canOpenInApp: canOpenLinksInApp(targetThreadRef),
});
if (target === "app" && targetThreadRef) {
const result = await openUrlInPreview({ threadRef: targetThreadRef, url, openPreview });
const result = await fromOrigin(() =>
openUrlInPreview({ threadRef: targetThreadRef, url, openPreview }),
);
if (isAtomCommandInterrupted(result)) return;
if (result._tag === "Success") {
recordVisitForThread(targetThreadRef, url);
Expand Down
Loading
Loading