From b439a615e5ea985ed6f7fac2f92c82045d191eeb Mon Sep 17 00:00:00 2001 From: Renfei Zhou Date: Sat, 21 Nov 2026 15:54:56 +0000 Subject: [PATCH 1/2] feat(contracts): fork client setting for file-link folder depth Adds fileLinkPathDepth (1 to 5, default 1) to the client settings. The stored field decodes any bad value to 1, so one bad value never fails the whole client-settings blob; the patch field stays strict. Co-Authored-By: Claude Opus 5.5 --- .../src/fork/fileLinkPathDepth.test.ts | 28 +++++++++++++++++++ .../contracts/src/fork/fileLinkPathDepth.ts | 12 ++++++++ packages/contracts/src/index.ts | 1 + packages/contracts/src/settings.ts | 4 +++ 4 files changed, 45 insertions(+) create mode 100644 packages/contracts/src/fork/fileLinkPathDepth.test.ts create mode 100644 packages/contracts/src/fork/fileLinkPathDepth.ts diff --git a/packages/contracts/src/fork/fileLinkPathDepth.test.ts b/packages/contracts/src/fork/fileLinkPathDepth.test.ts new file mode 100644 index 000000000000..b0248f4f5b6e --- /dev/null +++ b/packages/contracts/src/fork/fileLinkPathDepth.test.ts @@ -0,0 +1,28 @@ +import { describe, expect, it } from "@effect/vitest"; +import * as Schema from "effect/Schema"; + +import { ClientSettingsSchema } from "../settings.ts"; + +const decodeClientSettings = Schema.decodeUnknownSync(ClientSettingsSchema); +const encodeClientSettings = Schema.encodeSync(ClientSettingsSchema); + +describe("fileLinkPathDepth", () => { + it("defaults to the file name alone", () => { + expect(decodeClientSettings({}).fileLinkPathDepth).toBe(1); + }); + + it.each([9, 0, 2.5, "2", null, { depth: 2 }])( + "a bad stored depth %j decodes to 1 and keeps the other settings", + (fileLinkPathDepth) => { + const settings = decodeClientSettings({ fileLinkPathDepth, wordWrap: false }); + expect(settings.fileLinkPathDepth).toBe(1); + expect(settings.wordWrap).toBe(false); + }, + ); + + it("round-trips a valid depth", () => { + const settings = decodeClientSettings({ fileLinkPathDepth: 3 }); + expect(settings.fileLinkPathDepth).toBe(3); + expect(decodeClientSettings(encodeClientSettings(settings)).fileLinkPathDepth).toBe(3); + }); +}); diff --git a/packages/contracts/src/fork/fileLinkPathDepth.ts b/packages/contracts/src/fork/fileLinkPathDepth.ts new file mode 100644 index 000000000000..efc4ff724c3e --- /dev/null +++ b/packages/contracts/src/fork/fileLinkPathDepth.ts @@ -0,0 +1,12 @@ +import * as Effect from "effect/Effect"; +import * as Schema from "effect/Schema"; + +/** How many path segments a chat file link shows: 1 is the file name alone. */ +export const FileLinkPathDepth = Schema.Literals([1, 2, 3, 4, 5]); +export type FileLinkPathDepth = typeof FileLinkPathDepth.Type; + +/** The stored field: a bad value decodes to 1, so it can never fail the client settings. */ +export const StoredFileLinkPathDepth = FileLinkPathDepth.pipe( + Schema.catchDecoding(() => Effect.succeedSome(1 as const)), + Schema.withDecodingDefault(Effect.succeed(1 as const)), +); diff --git a/packages/contracts/src/index.ts b/packages/contracts/src/index.ts index a254f6c62afc..7e40025d6512 100644 --- a/packages/contracts/src/index.ts +++ b/packages/contracts/src/index.ts @@ -41,6 +41,7 @@ export * from "./fork/threadSubThreads.ts"; export * from "./fork/threadUserView.ts"; export * from "./fork/fyi.ts"; export * from "./fork/rightPanelMenu.ts"; +export * from "./fork/fileLinkPathDepth.ts"; export * from "./managedPolicy.ts"; export * from "./git.ts"; export * from "./vcs.ts"; diff --git a/packages/contracts/src/settings.ts b/packages/contracts/src/settings.ts index 8902e0776a96..0ae3a139092c 100644 --- a/packages/contracts/src/settings.ts +++ b/packages/contracts/src/settings.ts @@ -33,6 +33,7 @@ import { CompactWhenIdleSettingsPatch, } from "./fork/idleCompactionLevels.ts"; import { RightPanelMenuOverrides } from "./fork/rightPanelMenu.ts"; +import { FileLinkPathDepth, StoredFileLinkPathDepth } from "./fork/fileLinkPathDepth.ts"; import { CustomModelSetting, DEFAULT_TEXT_GENERATION_MODEL, @@ -622,6 +623,8 @@ export const ClientSettingsSchema = Schema.Struct({ rightPanelMenuOverrides: RightPanelMenuOverrides.pipe( Schema.withDecodingDefault(Effect.succeed({})), ), + // Fork: how many path segments chat file links show in this browser. + fileLinkPathDepth: StoredFileLinkPathDepth, }); export type ClientSettings = typeof ClientSettingsSchema.Type; @@ -2200,5 +2203,6 @@ export const ClientSettingsPatch = Schema.Struct({ wordWrap: Schema.optionalKey(Schema.Boolean), mathRenderingEnabled: Schema.optionalKey(Schema.Boolean), rightPanelMenuOverrides: Schema.optionalKey(RightPanelMenuOverrides), + fileLinkPathDepth: Schema.optionalKey(FileLinkPathDepth), }); export type ClientSettingsPatch = typeof ClientSettingsPatch.Type; From fc420db8ba2edc44ec334eb53dbb52e7a61788b3 Mon Sep 17 00:00:00 2001 From: Renfei Zhou Date: Sat, 21 Nov 2026 15:55:52 +0000 Subject: [PATCH 2/2] feat(web): fork setting for file-link folder depth Chat file links can show the last folders of their path before the file name, set per browser in Settings > Appearance > File link folders. The default keeps today's label. A file name that repeats in a message keeps its folder hint after the name and gets no prefix. CSS draws the folders as generated content, so the label text that thread find, copy and CSV read stays the same. The label box is right-to-left with the name first, so a narrow chip clips the folders' start before the name, and it stays inline so triple-click still selects the whole paragraph. Co-Authored-By: Claude Opus 5.5 --- README.md | 1 + apps/web/src/components/ChatMarkdown.tsx | 3 + apps/web/src/components/chat/FileTagChip.tsx | 6 +- .../src/components/chat/MarkdownFileLink.tsx | 8 ++- .../settings/AppearanceSettingsPanel.tsx | 2 + .../components/settings/SettingsPanels.tsx | 10 ++- .../src/components/settings/settingsSearch.ts | 6 ++ .../web/src/fork/FileLinkPathDepthSetting.tsx | 64 +++++++++++++++++++ apps/web/src/fork/FileLinkPathPrefix.tsx | 32 ++++++++++ .../fork/fileLinkPathDepth.browser.test.tsx | 63 ++++++++++++++++++ apps/web/src/fork/fileLinkPathDepth.test.ts | 45 +++++++++++++ apps/web/src/fork/fileLinkPathDepth.ts | 31 +++++++++ apps/web/src/fork/forkCopy.ts | 1 + 13 files changed, 269 insertions(+), 3 deletions(-) create mode 100644 apps/web/src/fork/FileLinkPathDepthSetting.tsx create mode 100644 apps/web/src/fork/FileLinkPathPrefix.tsx create mode 100644 apps/web/src/fork/fileLinkPathDepth.browser.test.tsx create mode 100644 apps/web/src/fork/fileLinkPathDepth.test.ts create mode 100644 apps/web/src/fork/fileLinkPathDepth.ts diff --git a/README.md b/README.md index 691759f807c4..69a0acfda1cb 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ This is a fork of T3 Code that integrates a few additional features, including: - **FYI messages between agents:** an agent can send another thread an FYI, a note of at most 16,000 characters that needs no action and starts no turn. The receiving agent gets it with its next turn; a running Claude Code thread gets it at its next tool call. An FYI counts as delivered only when the turn that carries it finishes: a turn that fails, is stopped, restarts or is reverted gives it back, so the agent may see it twice. When a thread has an FYI waiting and has been idle for 6 hours, T3 Code wakes it to deliver its FYIs, unless the thread is settled, archived, waiting for your answer or holds queued messages; a snoozed thread waits until its snooze ends. The 6 hours count from the thread's last turn, or from the reset of a usage limit that stopped it on the provider it still uses (or from the end of a snooze that ends after that reset), so an FYI to a thread that has been idle longer wakes it within minutes. A thread whose usage limit has no known reset time, or whose provider fails every turn, gets a failed wake every 6 hours while an FYI waits. A wake carries up to 16,000 characters of FYIs. The rest, and any that a wake gives back because it failed or you stopped it, get another wake after 6 more idle hours. A wake is a new turn, so **Resume** no longer continues a turn that ended before it. Settle or archive a thread to stop its wakes. The timeline marks these messages "FYI · waiting", "FYI · sent" while the turn that carries them runs, and "FYI" once it finished. - **Open server files by their path:** in a browser signed in to T3 Code at its own address, open `/` (such as `https://t3.example.com/home/ana/work/report.html`) to see that file read-only, for files under the server user's home folder and temp folder. A session needs the `filesystem:read` permission, and a signed-out browser gets a sign-in page. Text and code of any type show as plain text, and images, PDFs, audio and video show as themselves. A folder shows its `index.html`, or else a list of its files. Links ending in `:line` or `:line:col` open the file. Names that start with `.`, and T3 Code's own data folder, are not served. An HTML page runs in a sandboxed frame at the same address: its scripts run but cannot act as you in T3, and it loads files from its own folder and below for an hour, though its scripts cannot fetch them. A page directly in the home or temp folder loads no other files. An HTML page linked from another site, or any HTML page over plain HTTP, first shows an Open link. - **HTML pages from disk block their own network calls:** an HTML file that the file viewer, "Open in browser" or a server file path shows from disk runs its own scripts and loads scripts, styles, fonts and images over HTTPS. It cannot use fetch, XHR, WebSocket, EventSource, beacons or form posts, its frames cannot load other addresses, and audio and video play only from its own files or inline data. A page that fetches its data while it runs needs that data inline. An allowed load can still carry data in its URL, so these limits do not make an untrusted page safe. +- **Folders on file links:** Settings → Appearance → File link folders shows up to four folders before the file name on file links in messages and Markdown previews, such as `review-pipeline/glossary.md`, so you need not hover a link to see where the file is. Each browser, and the desktop app, keeps its own choice. A file name that repeats in one message keeps its folder hint after the name. - Enabling math rendering by default. - Other small fixes. diff --git a/apps/web/src/components/ChatMarkdown.tsx b/apps/web/src/components/ChatMarkdown.tsx index 39dbc684d25d..c4074b1ac357 100644 --- a/apps/web/src/components/ChatMarkdown.tsx +++ b/apps/web/src/components/ChatMarkdown.tsx @@ -241,6 +241,7 @@ import { } from "./chat/ChatMarkdownMedia"; import { MarkdownExternalLinkContent } from "./chat/MarkdownExternalLink"; import { MarkdownFileLink } from "./chat/MarkdownFileLink"; +import { useFileLinkPrefix } from "../fork/FileLinkPathPrefix"; import { canUseMarkdownFileShellActions } from "./chat/MarkdownFileLink.logic"; import { rehypeChipPunctuation } from "./chat/markdownChipPunctuation"; import { handleMarkdownFragmentClick, rehypeHeadingIds } from "./chat/markdownFragments"; @@ -769,6 +770,7 @@ function useChatMarkdownState({ const fileLinksKey = `${fileLinkSourcesKey(text, cwd, imageBaseDir, fileLinkPeerPaths, hostFileOrigins)}`; const { markdownFileLinkMetaByHref, inlineCodeFileLinkMetaByText, fileLinkParentSuffixByPath } = resolveFileLinkSources(fileLinksKey, cwd, imageBaseDir); + const fileLinkPrefix = useFileLinkPrefix(fileLinkParentSuffixByPath); const resolveThreadPullRequest = ( href: string, ): (ThreadPullRequestKey & { readonly url: string }) | null => { @@ -993,6 +995,7 @@ function useChatMarkdownState({ }, fileLinkParentSuffixByPath, )} + labelPrefix={fileLinkPrefix(fileLinkMeta)} copyMarkdown={copyMarkdown} theme={resolvedTheme} threadRef={threadRef} diff --git a/apps/web/src/components/chat/FileTagChip.tsx b/apps/web/src/components/chat/FileTagChip.tsx index ddb30cf7bcf7..e1c1e5cfb26e 100644 --- a/apps/web/src/components/chat/FileTagChip.tsx +++ b/apps/web/src/components/chat/FileTagChip.tsx @@ -1,12 +1,14 @@ import type { ReactNode } from "react"; import type { EnvironmentId } from "@t3tools/contracts"; import { ContextChipLabel } from "../ContextChip"; +import { FileLinkPathLabel } from "../../fork/FileLinkPathPrefix"; import { WorkspaceEntryIcon } from "./WorkspaceEntryIcon"; export function FileTagChipContent(props: { icon?: ReactNode; path: string; label: string; + labelPrefix?: string | undefined; theme: "light" | "dark"; environmentId?: EnvironmentId | null | undefined; cwd?: string | undefined; @@ -21,7 +23,9 @@ export function FileTagChipContent(props: { theme={props.theme} /> )} - {props.label} + + + ); } diff --git a/apps/web/src/components/chat/MarkdownFileLink.tsx b/apps/web/src/components/chat/MarkdownFileLink.tsx index 5b1e1e500704..a70c75265e39 100644 --- a/apps/web/src/components/chat/MarkdownFileLink.tsx +++ b/apps/web/src/components/chat/MarkdownFileLink.tsx @@ -44,6 +44,7 @@ interface MarkdownFileLinkProps { panelPath: string | null; line?: number | undefined; label: string; + labelPrefix?: string | undefined; copyMarkdown: string; theme: "light" | "dark"; threadRef?: ScopedThreadRef | undefined; @@ -70,6 +71,7 @@ export const MarkdownFileLink = memo(function MarkdownFileLink({ panelPath, line, label, + labelPrefix, copyMarkdown, theme, threadRef, @@ -349,6 +351,7 @@ export const MarkdownFileLink = memo(function MarkdownFileLink({ kind={chipKind} dir="ltr" render={} + aria-label={labelPrefix === undefined ? undefined : `${labelPrefix}${label}`} className={MARKDOWN_FILE_LINK_CLASS_NAME} data-markdown-copy={copyMarkdown} onClick={(event) => { @@ -376,6 +379,7 @@ export const MarkdownFileLink = memo(function MarkdownFileLink({ path={iconPath} environmentId={environmentId} label={label} + labelPrefix={labelPrefix} theme={theme} /> @@ -385,7 +389,7 @@ export const MarkdownFileLink = memo(function MarkdownFileLink({ kind={chipKind} dir="ltr" render={