diff --git a/README.md b/README.md
index 065617cc2009c..691759f807c48 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ This is a fork of T3 Code that integrates a few additional features, including:
- **Display mode per thread:** Right-click a thread and set Display mode to "Chat mode" to hide the agent's work and keep the chat simple: you see just your messages and the replies the agent sends to you with its `send_to_user` tool, and the agent answers each message where you wrote it, so a question in the main list gets its answer in the main list. "Normal mode" shows everything again. The mode applies in the web and desktop apps, not in the mobile app.
- To follow up on one of the agent's messages without filling the main list, point at it and choose Reply. The replies show in a Replies tab in the right panel (+ → Replies, or the reply line under the message), which has its own reply box, and the agent answers you there. Under a message with replies you see how many it has, how many are new, and a few generated words on what they are about. The agent names the message it answers by its id, with `send_to_user`. A Cite in the main list on a message that already has replies opens those replies and puts the quote in their reply box, unless the main box or the open reply box already has text; then the quote goes there, the main box first. A Cite on any other message goes into the main box. An agent reads the thread as you see it with its `t3_thread_user_view` tool, and to brief another agent in your own words it passes on the result's last line, which shows that agent the same messages and says if they changed since.
- In Chat mode the agent sends one reply per message you type, and before a long task it may first send a short "on it" note; a thin line parts two agent messages in a row. To say more, it rewrites its reply in place with its `replace_send_to_user` tool. A rewritten reply shows a small "Edited" mark, and in a sub-thread it counts as new.
- - "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.
+ - "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.
- Copy buttons on pages in the preview browser now put the copied text into your own clipboard.
diff --git a/apps/server/src/fork/displayModeWrap/DisplayModeCompactionNote.test.ts b/apps/server/src/fork/displayModeWrap/DisplayModeCompactionNote.test.ts
index e34238a5c6d57..43c633e8a49ec 100644
--- a/apps/server/src/fork/displayModeWrap/DisplayModeCompactionNote.test.ts
+++ b/apps/server/src/fork/displayModeWrap/DisplayModeCompactionNote.test.ts
@@ -61,7 +61,7 @@ it.layer(notes)("DisplayModeCompactionNote", (it) => {
(yield* toldRows).map((row) => [row.thread_id, row.mode_id]),
[
[chatId, "chat-replies@3"],
- [dashboardId, "normal+dashboard"],
+ [dashboardId, "normal+dashboard@2"],
[toldNormalId, "normal"],
[unknownToldId, "normal"],
],
diff --git a/apps/web/src/components/ChatMarkdown.tsx b/apps/web/src/components/ChatMarkdown.tsx
index 5ef27656de0d5..39dbc684d25d8 100644
--- a/apps/web/src/components/ChatMarkdown.tsx
+++ b/apps/web/src/components/ChatMarkdown.tsx
@@ -105,6 +105,7 @@ import { createIncrementalMarkdownPlugin } from "../markdown-incremental";
import { postWhiteboardHover, remarkWhiteboardLinks } from "../fork/whiteboard/markdown-whiteboard";
import { showBoardRef } from "../fork/whiteboard/boardChannel";
import { remarkEndLinksAtCjkPunctuation } from "../fork/cjkLinkEnd";
+import { DashboardLinkChip, parseDashboardHref } from "../fork/dashboard/dashboardLink";
import type { Pluggable, PluggableList } from "unified";
import { defaultUrlTransform } from "react-markdown";
import { parseAssistantCitationHref } from "@t3tools/shared/assistantCitations";
@@ -457,6 +458,7 @@ function markdownUrlTransform(href: string) {
if (parseThreadLinkHref(href)) return href;
if (isWindowsDrivePathHref(href)) return href;
if (href.startsWith("board://")) return href;
+ if (parseDashboardHref(href) !== null) return href;
if (isLocalEditorFileHref(href)) return href;
return rewriteMarkdownFileUriHref(href) ?? defaultUrlTransform(href);
}
@@ -1277,6 +1279,9 @@ const CHAT_MARKDOWN_COMPONENTS = {
{label ?? gt("Thread")}
);
}
+ if (href && parseDashboardHref(href)) {
+ return ;
+ }
const contextReference = href ? parseComposerContextHref(href) : null;
if (contextReference) {
const label = hastPlainTextDeep(node) || contextReference.contextId;
diff --git a/apps/web/src/fork/dashboard/ThreadDashboardPanel.browser.test.tsx b/apps/web/src/fork/dashboard/ThreadDashboardPanel.browser.test.tsx
index ab1b9e51f7080..d1277e9be29f7 100644
--- a/apps/web/src/fork/dashboard/ThreadDashboardPanel.browser.test.tsx
+++ b/apps/web/src/fork/dashboard/ThreadDashboardPanel.browser.test.tsx
@@ -14,8 +14,14 @@ import "~/index.css";
import { observeAssistantCitationCommentSource } from "../../components/chat/AssistantCitationSource";
import ChatMarkdown from "../../components/ChatMarkdown";
+import { toastManager } from "../../components/ui/toast";
import { render } from "../../../test/render";
-import { selectThreadRightPanelState, useRightPanelStore } from "../../rightPanelStore";
+import {
+ hostRightPanel,
+ selectActiveRightPanel,
+ selectThreadRightPanelState,
+ useRightPanelStore,
+} from "../../rightPanelStore";
import { DashboardCards } from "./ThreadDashboardPanel";
import { DashboardLinkScope, DashboardMarkdown } from "./dashboardMarkdown";
@@ -23,10 +29,19 @@ import { DashboardLinkScope, DashboardMarkdown } from "./dashboardMarkdown";
vi.mock(import("../../state/server"), async (original) => {
const actual = await original();
const { Atom } = await import("effect/reactivity");
+ const { DEFAULT_SERVER_SETTINGS } = await import("@t3tools/contracts");
const noConfig = Atom.make(null);
+ const settings = Atom.make({
+ ...DEFAULT_SERVER_SETTINGS,
+ threadDashboards: { "dashboard-thread": true, "side-chat": true },
+ });
return {
...actual,
- serverEnvironment: { ...actual.serverEnvironment, configValueAtom: (() => noConfig) as never },
+ serverEnvironment: {
+ ...actual.serverEnvironment,
+ configValueAtom: (() => noConfig) as never,
+ settingsValueAtom: (() => settings) as never,
+ },
};
});
vi.mock(import("../../state/session"), async (original) => {
@@ -512,3 +527,70 @@ describe("Dashboard file references match chat", () => {
expect(fileLinks(dashboardRoot)).toEqual(fileLinks(chat));
});
});
+
+describe("Dashboard links", () => {
+ const ref = (threadId: string) => ({ ...threadRef, threadId: ThreadId.make(threadId) });
+ const activePanel = (target: typeof threadRef) =>
+ selectActiveRightPanel(useRightPanelStore.getState().byThreadKey, target);
+ const openButton = () => page.getByRole("button", { name: "Open the Dashboard" });
+
+ it.each([
+ { from: "its own thread with the Dashboard on", thread: threadRef, host: null, toast: null },
+ {
+ from: "a thread with the Dashboard off",
+ thread: ref("plain-thread"),
+ host: null,
+ toast: "This thread's Dashboard is off",
+ },
+ {
+ from: "a side chat with its Dashboard on, hosted in another thread's panel",
+ thread: ref("side-chat"),
+ host: ref("host-thread"),
+ toast: "Open this thread on its own to see its Dashboard",
+ },
+ ])("a click from $from opens the Dashboard or says why not", async ({ thread, host, toast }) => {
+ using _hosted = host ? { [Symbol.dispose]: hostRightPanel(thread, host) } : null;
+ await using _screen = await render(
+ ,
+ );
+ await expect.element(openButton()).toHaveTextContent("Dashboard");
+ expect(openButton().element().getAttribute("data-markdown-copy")).toBe(
+ "[Dashboard](t3-dashboard:)",
+ );
+ using addToast = vi.spyOn(toastManager, "add");
+
+ await userEvent.click(openButton());
+
+ expect(activePanel(thread)).toBe(toast === null ? "dashboard" : null);
+ if (host) expect(activePanel(host)).toBeNull();
+ expect(addToast.mock.calls.map(([options]) => options.title)).toEqual(
+ toast === null ? [] : [toast],
+ );
+ });
+
+ it("shows a link to a slot in chat, and any Dashboard link in a slot, as its label", async () => {
+ await using screen = await render(
+ <>
+
+
+
+
+
+
+ >,
+ );
+ const chat = screen.container.querySelector("[data-renderer=chat]")!;
+ const slot = screen.container.querySelector("[data-renderer=dashboard]")!;
+ await vi.waitFor(() => expect(chat.textContent).toBe("Pick in decide."));
+ expect(slot.textContent).toBe("See the Dashboard.");
+ expect(screen.container.querySelector("a, button")).toBeNull();
+ });
+});
diff --git a/apps/web/src/fork/dashboard/dashboardLink.tsx b/apps/web/src/fork/dashboard/dashboardLink.tsx
new file mode 100644
index 0000000000000..0a481c8ea879c
--- /dev/null
+++ b/apps/web/src/fork/dashboard/dashboardLink.tsx
@@ -0,0 +1,66 @@
+import { scopedThreadKey } from "@t3tools/client-runtime/environment";
+import type { ScopedThreadRef } from "@t3tools/contracts";
+import { DASHBOARD_LINK_HREF } from "@t3tools/shared/displayModes";
+
+import { ContextChip, ContextChipLabel } from "../../components/ContextChip";
+import { hastPlainTextDeep } from "../../components/chat/markdownHast.logic";
+import { toastManager } from "../../components/ui/toast";
+import { requestWorkspaceFocus } from "../../lib/workspaceFocus";
+import {
+ rightPanelHostRef,
+ selectActiveRightPanel,
+ useRightPanelStore,
+} from "../../rightPanelStore";
+import { FORK_SURFACES, threadHasModeSurface } from "./dashboardSurface";
+
+/** "open" for the Dashboard link, "inert" for any other `t3-dashboard:` link, null otherwise. */
+export function parseDashboardHref(href: string | undefined): "open" | "inert" | null {
+ if (href === DASHBOARD_LINK_HREF) return "open";
+ return href?.startsWith(DASHBOARD_LINK_HREF) ? "inert" : null;
+}
+
+/** A Dashboard link's written text, or "Dashboard" when it has none of its own. */
+export function dashboardLinkLabel(node: unknown, href: string): string {
+ const written = hastPlainTextDeep(node).trim();
+ return written === "" || written === href ? "Dashboard" : written;
+}
+
+function openThreadDashboard(threadRef: ScopedThreadRef) {
+ // A hosted thread's actions open in its host's panel, which shows the host's Dashboard.
+ if (scopedThreadKey(rightPanelHostRef(threadRef)) !== scopedThreadKey(threadRef)) {
+ toastManager.add({ type: "info", title: "Open this thread on its own to see its Dashboard" });
+ return;
+ }
+ if (!threadHasModeSurface(threadRef, "dashboard")) {
+ toastManager.add({ type: "info", title: "This thread's Dashboard is off" });
+ return;
+ }
+ const store = useRightPanelStore.getState();
+ const alreadyShown = selectActiveRightPanel(store.byThreadKey, threadRef) === "dashboard";
+ store.open(threadRef, "dashboard");
+ // Opening an already active tab changes no panel state, so nothing else moves focus there.
+ if (alreadyShown) requestWorkspaceFocus({ area: "panel" });
+}
+
+/** A chat link to the thread's Dashboard: a chip that opens it, or plain text when it cannot. */
+export function DashboardLinkChip(props: {
+ readonly threadRef: ScopedThreadRef | undefined;
+ readonly node: unknown;
+ readonly href: string;
+}) {
+ const label = dashboardLinkLabel(props.node, props.href);
+ const { threadRef } = props;
+ if (parseDashboardHref(props.href) !== "open" || threadRef === undefined) return label;
+ const Icon = FORK_SURFACES.dashboard.icon;
+ return (
+ }
+ aria-label={label === "Dashboard" ? "Open the Dashboard" : `${label}. Open the Dashboard`}
+ data-markdown-copy={`[${label.replace(/[\\[\]*_`<>&]/g, "\\$&")}](${DASHBOARD_LINK_HREF})`}
+ onClick={() => openThreadDashboard(threadRef)}
+ >
+
+ {label}
+
+ );
+}
diff --git a/apps/web/src/fork/dashboard/dashboardMarkdown.tsx b/apps/web/src/fork/dashboard/dashboardMarkdown.tsx
index eda847928e188..f3eb24c13b2ad 100644
--- a/apps/web/src/fork/dashboard/dashboardMarkdown.tsx
+++ b/apps/web/src/fork/dashboard/dashboardMarkdown.tsx
@@ -29,6 +29,7 @@ import {
hostFileLinkLabel,
useHostFileOrigins,
} from "../hostFileLinks";
+import { dashboardLinkLabel, parseDashboardHref } from "./dashboardLink";
interface LinkScope {
readonly threadRef: ScopedThreadRef;
@@ -119,6 +120,8 @@ const renderMarkdown = createMarkdownRenderer({
a: function DashboardLink({ node, children, ...props }) {
const scope = use(DashboardLinkScope);
const { text, hostFileOrigins } = use(SlotCopyContext);
+ // The user is already on the Dashboard.
+ if (props.href && parseDashboardHref(props.href)) return dashboardLinkLabel(node, props.href);
const href = props.href ? normalizeHref(props.href) : "";
const linkPath = hostFileAnchorHref(href, node, hostFileOrigins);
const fileLinkMeta =
@@ -161,7 +164,7 @@ const renderMarkdown = createMarkdownRenderer({
},
urlTransform: (url) =>
rewriteMarkdownFileUriHref(url) ??
- (isWindowsDrivePathHref(url) ? url : defaultUrlTransform(url)),
+ (isWindowsDrivePathHref(url) || parseDashboardHref(url) ? url : defaultUrlTransform(url)),
});
/**
diff --git a/packages/shared/src/fork/displayModes/displayModes.test.ts b/packages/shared/src/fork/displayModes/displayModes.test.ts
index d7825663f5c9d..32bcdaa7f840b 100644
--- a/packages/shared/src/fork/displayModes/displayModes.test.ts
+++ b/packages/shared/src/fork/displayModes/displayModes.test.ts
@@ -604,7 +604,7 @@ describe("threadDisplay", () => {
describe("displayNote", () => {
const RULES =
- "They see this thread's Dashboard beside the chat, six slots in this order: decide (needs their decision), waiting, working, autoreview, humanreview, merged. Read it with dashboard_get. To change a slot, call dashboard_set with the slot's current text as old_text and the whole new text as new_text.";
+ "They see this thread's Dashboard beside the chat, six slots in this order: decide (needs their decision), waiting, working, autoreview, humanreview, merged. Read it with dashboard_get. To change a slot, call dashboard_set with the slot's current text as old_text and the whole new text as new_text. In your messages, the link [Dashboard](t3-dashboard:) opens it for them.";
const ON = `The user turned on this thread's Dashboard. ${RULES}`;
const OFF =
"The user turned off this thread's Dashboard. They no longer see it, and dashboard_get and dashboard_set are refused.";
@@ -615,16 +615,18 @@ describe("displayNote", () => {
const CHAT = CHAT_REPLIES_DISPLAY_MODE;
it.each | null]>([
- ["chat-replies@3+dashboard", "chat-replies", true, null],
+ ["chat-replies@3+dashboard@2", "chat-replies", true, null],
["normal", "chat-replies", false, [CHAT.notice]],
["normal", "normal", true, [ON]],
- ["chat-replies@3+dashboard", "chat-replies", false, [OFF]],
+ ["chat-replies@3+dashboard@2", "chat-replies", false, [OFF]],
["normal", "chat-replies", true, [CHAT.notice, ON]],
["chat-replies@3", "normal", true, [NORMAL.notice, ON]],
["unknown", "chat-replies", true, [CHAT.stateNotice, ON_STATE]],
["messages-dashboard", "chat-replies", true, [CHAT.stateNotice, ON_STATE]],
["messages-dashboard", "chat-replies", false, [CHAT.stateNotice, OFF_STATE]],
["chat-replies@2", "chat-replies", false, [CHAT.stateNotice, OFF_STATE]],
+ ["chat-replies@3+dashboard", "chat-replies", true, [CHAT.stateNotice, ON_STATE]],
+ ["chat-replies@3+dashboard", "chat-replies", false, [CHAT.stateNotice, OFF_STATE]],
])("brings an agent told %s up to %s with the Dashboard on: %s", (told, modeId, on, notes) => {
expect(displayNote(told, displayOf(resolveDisplayMode(modeId), on))).toBe(
notes?.join("\n") ?? null,
@@ -639,7 +641,7 @@ describe("displayNote", () => {
it("records what the agent was told in one key per display", () => {
expect([NORMAL_DISPLAY, displayOf(CHAT, true)].map(toldKey)).toEqual([
"normal",
- "chat-replies@3+dashboard",
+ "chat-replies@3+dashboard@2",
]);
});
});
diff --git a/packages/shared/src/fork/displayModes/displayModes.ts b/packages/shared/src/fork/displayModes/displayModes.ts
index de77b36785943..f44c119b5ac41 100644
--- a/packages/shared/src/fork/displayModes/displayModes.ts
+++ b/packages/shared/src/fork/displayModes/displayModes.ts
@@ -23,6 +23,7 @@ export const SEND_TO_USER_MAX_BYTES = 1_000;
export const ACK_MAX_BYTES = 200;
export const DASHBOARD_SET_TOOL_NAME = "dashboard_set";
export const DASHBOARD_GET_TOOL_NAME = "dashboard_get";
+export const DASHBOARD_LINK_HREF = "t3-dashboard:";
/** The kind of the context record that a user's reply carries: `{ first }`, the id of its sub-thread's first message. */
export const SUB_THREAD_RECORD_KIND = "fork-reply";
@@ -393,9 +394,16 @@ export interface ThreadDisplay {
export const NORMAL_DISPLAY: ThreadDisplay = { mode: NORMAL_DISPLAY_MODE, dashboard: false };
-/** What the server records once the agent knows `display`: the mode's `toldId`, then `+dashboard` when on. */
+// Bump when DASHBOARD_RULES changes, so threads told the old rules hear them again.
+const DASHBOARD_TOLD_ID = "dashboard@2";
+const DASHBOARD_RULES = `They see this thread's Dashboard beside the chat, six slots in this order: decide (needs their decision), waiting, working, autoreview, humanreview, merged. Read it with dashboard_get. To change a slot, call dashboard_set with the slot's current text as old_text and the whole new text as new_text. In your messages, the link [Dashboard](${DASHBOARD_LINK_HREF}) opens it for them.`;
+
+/**
+ * What the server records once the agent knows `display`: the mode's `toldId`, then
+ * `+${DASHBOARD_TOLD_ID}` when the Dashboard is on.
+ */
export function toldKey(display: ThreadDisplay): string {
- return display.dashboard ? `${display.mode.toldId}+dashboard` : display.mode.toldId;
+ return display.dashboard ? `${display.mode.toldId}+${DASHBOARD_TOLD_ID}` : display.mode.toldId;
}
/** Every display by its told key, so equal displays are one object and keep React identities stable. */
@@ -419,8 +427,6 @@ export function threadDisplay(
return DISPLAYS.get(toldKey({ mode, dashboard })) ?? NORMAL_DISPLAY;
}
-const DASHBOARD_RULES =
- "They see this thread's Dashboard beside the chat, six slots in this order: decide (needs their decision), waiting, working, autoreview, humanreview, merged. Read it with dashboard_get. To change a slot, call dashboard_set with the slot's current text as old_text and the whole new text as new_text.";
const DASHBOARD_ON_NOTICE = `The user turned on this thread's Dashboard. ${DASHBOARD_RULES}`;
const DASHBOARD_OFF_NOTICE =
"The user turned off this thread's Dashboard. They no longer see it, and dashboard_get and dashboard_set are refused.";
diff --git a/packages/shared/src/markdownPipeline.ts b/packages/shared/src/markdownPipeline.ts
index f86b56f3d0098..ae4dd6d26bdea 100644
--- a/packages/shared/src/markdownPipeline.ts
+++ b/packages/shared/src/markdownPipeline.ts
@@ -241,6 +241,7 @@ const CHAT_MARKDOWN_SANITIZE_SCHEMA = {
"t3-context",
THREAD_LINK_PROTOCOL,
"board",
+ "t3-dashboard",
// Scheme only: the renderer's URL transform checks the rest of the link shape.
...LOCAL_FILE_LINK_SCHEMES,
],