feat: panel side setting, hidden-file browsing, media previews, and video attachments #8047
ClosedHEREISCB(GitHub profile, opens in a new tab)wants to merge 3 commits into
main fromrefs/pull/8047/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- apps/web/src/components/ChatView.tsx line 5470Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -5444,14 +5460,10 @@5460+ );5461+ const optimisticAttachments = composerImagesSnapshot.map((image) => {5462+ const base = {5463+ id: image.id,54445464 name: image.name,54455465 mimeType: image.mimeType,54465466 sizeBytes: image.sizeBytes,5447- dataUrl: await readFileAsDataUrl(image.file),5448- })),5449- );5450- const optimisticAttachments = composerImagesSnapshot.map((image) => ({5451- type: "image" as const,5452- id: image.id,5453- name: image.name,5454- mimeType: image.mimeType,5455- sizeBytes: image.sizeBytes,5456- previewUrl: image.previewUrl,5457- }));5467+ previewUrl: image.previewUrl,5468+ };5469+ return image.type === "video"apps/server/src/orchestration/Normalizer.ts line 114OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -109,4 +110,5 @@109110 (attachment) =>110111 Effect.gen(function* () {111112 const parsed = parseBase64DataUrl(attachment.dataUrl);112- if (!parsed || !parsed.mimeType.startsWith("image/")) {113+ const expectedMimePrefix = attachment.type === "video" ? "video/" : "image/";114+ if (!parsed || !parsed.mimeType.startsWith(expectedMimePrefix)) {
- apps/web/src/components/files/FileBrowserPanel.tsx line 67Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -50,3 +52,14 @@5052 return entry.kind === "directory" ? `${entry.path}/` : entry.path;5153 }525455+const SHOW_HIDDEN_FILES_STORAGE_KEY = "t3code:file-browser-show-hidden";56+57+function ShowHiddenFilesButton(props: { showHidden: boolean; onToggle: () => void }) {58+ const label = props.showHidden ? "Hide hidden and ignored files" : "Show hidden and ignored files";59+ return (60+ <Tooltip>61+ <TooltipTrigger62+ render={63+ <Button64+ type="button"65+ variant="ghost"apps/web/src/components/chat/MessagesTimeline.tsx line 1020Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1017,4 +1017,4 @@10171017 key={image.id}10181018 className="overflow-hidden rounded-lg border border-border/80 bg-background/70"10191019 >1020- {image.previewUrl ? (1020+ {image.previewUrl && image.type === "video" ? (
- apps/web/src/components/ChatView.tsx line 2540Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -2526,10 +2531,10 @@25262531 continue;25272532 }252825332529- const serverPreviewUrls = serverMessage.attachments.flatMap((attachment) =>2530- attachment.type === "image" && attachment.previewUrl ? [attachment.previewUrl] : [],2534+ const serverPreviews = serverMessage.attachments.flatMap((attachment) =>2535+ attachment.previewUrl ? [{ previewUrl: attachment.previewUrl, type: attachment.type }] : [],25312536 );25322537 if (2533- serverPreviewUrls.length === 0 ||2534- serverPreviewUrls.length !== handoffPreviewUrls.length ||2535- serverPreviewUrls.some((previewUrl) => previewUrl.startsWith("blob:"))2538+ serverPreviews.length === 0 ||2539+ serverPreviews.length !== handoffPreviewUrls.length ||2540+ serverPreviews.some((preview) => preview.previewUrl.startsWith("blob:"))apps/web/src/components/chat/MessagesTimeline.tsx line 1029Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1017,4 +1017,13 @@10171017 key={image.id}10181018 className="overflow-hidden rounded-lg border border-border/80 bg-background/70"10191019 >1020- {image.previewUrl ? (1020+ {image.previewUrl && image.type === "video" ? (1021+ <video1022+ src={image.previewUrl}1023+ controls1024+ playsInline1025+ preload="metadata"1026+ aria-label={image.name}1027+ className="block h-auto max-h-[220px] w-full object-contain"1028+ />1029+ ) : image.previewUrl ? (
- apps/web/src/components/chat/ChatComposer.tsx lines 3228 to 3236Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -3161,4 +3189,12 @@31613189 key={image.id}31623190 className="relative h-16 w-16 overflow-hidden rounded-lg border border-border/80 bg-background"31633191 >3164- {image.previewUrl ? (3192+ {image.previewUrl && image.type === "video" ? (3193+ <video3194+ src={image.previewUrl}3195+ muted3196+ playsInline3197+ preload="metadata"3198+ aria-label={image.name}3199+ className="h-full w-full object-cover"3200+ />apps/web/src/components/chat/MessagesTimeline.tsx lines 1020 to 1028Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1017,4 +1017,12 @@10171017 key={image.id}10181018 className="overflow-hidden rounded-lg border border-border/80 bg-background/70"10191019 >1020- {image.previewUrl ? (1020+ {image.previewUrl && image.type === "video" ? (1021+ <video1022+ src={image.previewUrl}1023+ controls1024+ playsInline1025+ preload="metadata"1026+ aria-label={image.name}1027+ className="block h-auto max-h-[220px] w-full object-contain"1028+ />apps/web/src/components/ChatView.tsx lines 6588 to 6593Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -6568,4 +6584,9 @@65686584 composerBannerItems.length > 0 || Boolean(threadSyncPhase && !activeEnvironmentUnavailable);6569658565706586 return (6571- <div className="relative flex min-h-0 min-w-0 flex-1 overflow-hidden bg-background">6587+ <div6588+ className={cn(6589+ "relative flex min-h-0 min-w-0 flex-1 overflow-hidden bg-background",6590+ rightPanelDockedLeft && "flex-row-reverse",6591+ )}6592+ >
- @@ -148,12 +159,15 @@148159 </div>149160 );150161 }151162152163 return assetUrl._tag === "Success" ? (153164 <div className="flex min-h-0 flex-1 items-center justify-center overflow-auto p-4">154- <img155- className="max-h-full max-w-full object-contain"156- src={assetUrl.url}157- alt={props.alt}158- onError={() => setFailedUrl(assetUrl.url)}159- />165+ {props.kind === "image" ? (166+ <img167+ className="max-h-full max-w-full object-contain"168+ src={assetUrl.url}169+ alt={props.alt}170+ onError={() => setFailedUrl(assetUrl.url)}171+ />172+ ) : props.kind === "video" ? (173+ <videoapps/web/src/components/files/FileBrowserPanel.tsx line 73OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -50,3 +53,21 @@5053 return entry.kind === "directory" ? `${entry.path}/` : entry.path;5154 }525556+const SHOW_HIDDEN_FILES_STORAGE_KEY = "t3code:file-browser-show-hidden";57+58+function ShowHiddenFilesButton(props: { showHidden: boolean; onToggle: () => void }) {59+ const label = props.showHidden ? "Hide hidden and ignored files" : "Show hidden and ignored files";60+ return (61+ <Tooltip>62+ <TooltipTrigger63+ render={64+ <Toggle65+ pressed={props.showHidden}66+ onPressedChange={props.onToggle}67+ variant="ghost"68+ size="xs"69+ aria-label={label}70+ />71+ }72+ >73+ {props.showHidden ? <Eye /> : <EyeOff />}
- apps/web/src/components/files/FileBrowserPanel.tsx line 73OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -50,3 +53,21 @@5053 return entry.kind === "directory" ? `${entry.path}/` : entry.path;5154 }525556+const SHOW_HIDDEN_FILES_STORAGE_KEY = "t3code:file-browser-show-hidden";57+58+function ShowHiddenFilesButton(props: { showHidden: boolean; onToggle: () => void }) {59+ const label = props.showHidden ? "Hide hidden and ignored files" : "Show hidden and ignored files";60+ return (61+ <Tooltip>62+ <TooltipTrigger63+ render={64+ <Toggle65+ pressed={props.showHidden}66+ onPressedChange={props.onToggle}67+ variant="ghost"68+ size="xs"69+ aria-label={label}70+ />71+ }72+ >73+ {props.showHidden ? <Eye /> : <EyeOff />}@@ -148,12 +159,15 @@148159 </div>149160 );150161 }151162152163 return assetUrl._tag === "Success" ? (153164 <div className="flex min-h-0 flex-1 items-center justify-center overflow-auto p-4">154- <img155- className="max-h-full max-w-full object-contain"156- src={assetUrl.url}157- alt={props.alt}158- onError={() => setFailedUrl(assetUrl.url)}159- />165+ {props.kind === "image" ? (166+ <img167+ className="max-h-full max-w-full object-contain"168+ src={assetUrl.url}169+ alt={props.alt}170+ onError={() => setFailedUrl(assetUrl.url)}171+ />172+ ) : props.kind === "video" ? (173+ <video
- apps/web/src/components/ChatView.tsx line 2565Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -2553,6 +2551,15 @@2553- reject(new Error(`Failed to load server preview for ${messageId}.`));2554- image.addEventListener("load", handleLoad, { once: true });2555- image.addEventListener("error", handleError, { once: true });2556- image.src = previewUrl;2557- }),2558- ),2551+ serverPreviews.map(({ previewUrl, type }) => {2552+ // Only images are preload-verified; a video swaps to its asset URL2553+ // directly and the <video> element re-buffers from there.2554+ if (type !== "image") return Promise.resolve();2555+ return new Promise<void>((resolve, reject) => {2556+ const image = new Image();2557+ imageInstances.push(image);2558+ const handleLoad = () => resolve();2559+ const handleError = () =>2560+ reject(new Error(`Failed to load server preview for ${messageId}.`));2561+ image.addEventListener("load", handleLoad, { once: true });2562+ image.addEventListener("error", handleError, { once: true });2563+ image.src = previewUrl;2564+ });2565+ }),apps/web/src/components/ChatView.tsx line 5473Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -5444,14 +5463,10 @@5463+ id: image.id,54445464 name: image.name,54455465 mimeType: image.mimeType,54465466 sizeBytes: image.sizeBytes,5447- dataUrl: await readFileAsDataUrl(image.file),5448- })),5449- );5450- const optimisticAttachments = composerImagesSnapshot.map((image) => ({5451- type: "image" as const,5452- id: image.id,5453- name: image.name,5454- mimeType: image.mimeType,5455- sizeBytes: image.sizeBytes,5456- previewUrl: image.previewUrl,5457- }));5467+ previewUrl: image.previewUrl,5468+ };5469+ return image.type === "video"5470+ ? { type: "video" as const, ...base }5471+ : { type: "image" as const, ...base };5472+ });
- @@ -140 +140,21 @@140140141+// The search index honors gitignore, so ignored and dot-prefixed entries never142+// reach it. `includeHidden` listings walk the filesystem directly instead;143+// these two are still skipped so the tree stays usable.144+const HIDDEN_WALK_SKIP_DIRS = new Set([".git", "node_modules"]);145+const HIDDEN_WALK_MAX_ENTRIES = 25_000;146+147+async function walkWorkspaceEntries(148+ root: string,149+ join: (left: string, right: string) => string,150+): Promise<ProjectListEntriesResult> {151+ const entries: Array<ProjectListEntriesResult["entries"][number]> = [];152+ let truncated = false;153+ // Breadth-first so a truncated listing keeps the shallow structure intact.154+ const pendingDirs = [""];155+ for (let index = 0; index < pendingDirs.length && !truncated; index += 1) {156+ const relativeDir = pendingDirs[index]!;157+ let dirents: ReadonlyArray<{ readonly name: string; isDirectory(): boolean }>;158+ try {159+ dirents = await NodeFSP.readdir(join(root, relativeDir), { withFileTypes: true });160+ } catch {@@ -19,3 +19,9 @@1919 start it in the background. T3 Code opens another new thread and shows an **Open** action for the2020 thread that started. The new thread keeps the selected workspace mode and base branch. If **New2121 worktree** is selected, each background thread creates its own worktree.22+23+## Attachments24+25+Drop, paste, or pick images (GIF, JPEG, PNG, WebP) and videos (MP4, MOV, WebM) to attach them to a26+message. Up to 8 files per message; images over 10 MB are compressed to fit, videos can be up to27+25 MB. Attached videos play inline in the conversation. Coding agents cannot watch video directly,@@ -2517,3 +2530,6 @@25172530 const nextImages: ComposerImageAttachment[] = [];25182531 let compressionError: string | null = null;25192532 for (const file of acceptedFiles) {2533+ if (file.type.startsWith("video/")) {2534+ // Videos ship byte-for-byte; there is no client-side recompression.2535+ nextImages.push({@@ -1265,3 +1265,4 @@1265126512661266 for (const attachment of input.attachments ?? []) {12671267 if (attachment.type !== "image") {1268+ // Claude ingests no raw video; hand the agent the stored file's path.@@ -0,0 +1,12 @@1+# Workspace panel2+3+The tool panel (files, terminal, diff, browser preview, agents) docks to the right of the chat by4+default. Move it to the left side in **Settings → Appearance → Panel side**; the chat column then sits5+on the right.6+7+## Files8+9+The Files tab lists your workspace. The listing follows your `.gitignore`, so ignored files and10+some dotfiles are hidden by default. Use the eye toggle in the Files tab header to show hidden and11+ignored files (`.git` and `node_modules` stay hidden). Selecting an image, video, or audio file12+previews it inline; other files open as text.
- apps/web/src/components/settings/SettingsPanels.tsx line 1163Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1160,3 +1160,4 @@11601160 }11611161 />11621162 ) : null}1163+ <SettingsRow
- @@ -93,3 +93,11 @@9393 const { authGateState } = Route.useRouteContext();9494 const primaryEnvironmentAuthenticated = authGateState.status === "authenticated";959596+ // A file dropped outside an explicit drop target must not make the browser97+ // navigate to (and render) the file, replacing the app. Window-level98+ // preventDefault only suppresses that default; real drop targets handle99+ // their events first.100+ useEffect(() => {101+ const preventWindowFileDrop = (event: DragEvent) => {102+ event.preventDefault();103+ };
- @@ -2494,14 +2534,14 @@24942534 const acceptedFiles: File[] = [];24952535 let error: string | null = null;2536+ // Files the agent cannot receive inline (CSV, PDF, archives, oversized or2537+ // exotic media) are referenced by their path instead of rejected, so the2538+ // agent can open them with its own tools.2539+ const pathOnlyFiles: File[] = [];24962540 for (const file of files) {2497- if (!file.type.startsWith("image/")) {2498- error = `Unsupported file type for '${file.name}'. Please attach image files only.`;2499- continue;2500- }2501- if (!isProviderSendTurnSupportedImageMimeType(file.type)) {2502- error = `'${file.name}' is not a supported image type. Attach GIF, JPEG, PNG, or WebP images.`;2541+ if (!isInlineAttachableFile(file)) {2542+ pathOnlyFiles.push(file);25032543 continue;25042544 }25052545 if (reservedCount >= PROVIDER_SEND_TURN_MAX_ATTACHMENTS) {2506- error = `You can attach up to ${PROVIDER_SEND_TURN_MAX_ATTACHMENTS} images per message.`;2546+ error = `You can attach up to ${PROVIDER_SEND_TURN_MAX_ATTACHMENTS} files per message.`;25072547 break;
- @@ -209,7 +214,13 @@209214 }, [navigate, pathname]);210215211216 return (212- <SidebarProvider className="h-dvh! min-h-0!" defaultOpen style={sidebarProviderStyle}>217+ <SidebarProvider218+ // Docked right, the sidebar renders after the content in the flex row;219+ // the primitive already handles its own borders and rail per side.220+ className={cn("h-dvh! min-h-0!", sidebarSide === "right" && "flex-row-reverse")}221+ defaultOpen222+ style={sidebarProviderStyle}223+ >213224 <ProjectProjectionRetention />214225 <Sidebar215- side="left"226+ side={sidebarSide}@@ -6605,4 +6633,4 @@66056633 }66066634 keybindings={keybindings}66076635 availableEditors={availableEditors}6608- rightPanelOpen={rightPanelOpen}6636+ rightPanelOpen={rightPanelOpen && inlineRightPanelOwnsTitleBar}
- @@ -139,3 +143,4 @@139143 export function AppSidebarLayout({ children }: { children: ReactNode }) {140144 const navigate = useNavigate();141145 const legacySidebarEnabled = useLegacySidebarEnabled();146+ const sidebarSide = useClientSettings((settings) => settings.appSidebarSide);@@ -2493,10 +2533,10 @@24932533 let reservedCount = composerImagesRef.current.length + pendingCount;24942534 const acceptedFiles: File[] = [];24952535 let error: string | null = null;2536+ // Files the agent cannot receive inline (CSV, PDF, archives, oversized or2537+ // exotic media) are referenced by their path instead of rejected, so the2538+ // agent can open them with its own tools.2539+ const pathOnlyFiles: File[] = [];24962540 for (const file of files) {2497- if (!file.type.startsWith("image/")) {2498- error = `Unsupported file type for '${file.name}'. Please attach image files only.`;2499- continue;2500- }2501- if (!isProviderSendTurnSupportedImageMimeType(file.type)) {2502- error = `'${file.name}' is not a supported image type. Attach GIF, JPEG, PNG, or WebP images.`;2541+ if (!isInlineAttachableFile(file)) {2542+ pathOnlyFiles.push(file);@@ -2501,11 +2541,18 @@2501- if (!isProviderSendTurnSupportedImageMimeType(file.type)) {2502- error = `'${file.name}' is not a supported image type. Attach GIF, JPEG, PNG, or WebP images.`;2541+ if (!isInlineAttachableFile(file)) {2542+ pathOnlyFiles.push(file);25032543 continue;25042544 }25052545 if (reservedCount >= PROVIDER_SEND_TURN_MAX_ATTACHMENTS) {2506- error = `You can attach up to ${PROVIDER_SEND_TURN_MAX_ATTACHMENTS} images per message.`;2546+ error = `You can attach up to ${PROVIDER_SEND_TURN_MAX_ATTACHMENTS} files per message.`;25072547 break;25082548 }25092549 acceptedFiles.push(file);25102550 reservedCount += 1;25112551 }2552+2553+ if (pathOnlyFiles.length > 0) {2554+ const unresolvedNames = insertDroppedFilePaths(pathOnlyFiles);2555+ if (unresolvedNames.length > 0) {2556+ error = isElectron2557+ ? `Could not resolve a file path for ${unresolvedNames.join(", ")}.`2558+ : `${unresolvedNames.join(", ")} can't be attached here. Open the desktop app to reference files by path, or attach GIF, JPEG, PNG, or WebP images.`;@@ -1162,0 +1179,21 @@1179+ onValueChange={(value) => {1180+ if (value === "left" || value === "right") {1181+ updateSettings({ rightPanelSide: value });1182+ }1183+ }}1184+ >1185+ <SelectTrigger className="w-full sm:w-40" aria-label="Panel side">1186+ <SelectValue>{settings.rightPanelSide === "left" ? "Left" : "Right"}</SelectValue>1187+ </SelectTrigger>1188+ <SelectPopup align="end" alignItemWithTrigger={false}>1189+ <SelectItem hideIndicator value="right">1190+ Right1191+ </SelectItem>1192+ <SelectItem hideIndicator value="left">1193+ Left1194+ </SelectItem>1195+ </SelectPopup>1196+ </Select>1197+ }1198+ />1199+
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
65b66d91-059c-4e56-aae4-54165edfc88eYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Comment `@coderabbitai help` to get the list of available commands.