@devries-cameron20 / t3code-1 / commits / c666345bb9
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): subagent previews drop image marks and full link URLs (#29637)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Alex Southwell committed Nov 15, 2026 at 01:49 UTC c666345bb9a78704679aa93e57d6ff19dcf851b7
7 files changed +35 -41
apps/mobile/src/features/threads/SubagentRow.tsx
+4 -2
@@ -4,7 +4,10 @@ import {
4 resolveProviderInstanceDisplayName,
5 shouldShowInstanceBadge,
6 } from "@t3tools/client-runtime/state/provider-instance-display";
7 -import { resolveSubagentMetadata } from "@t3tools/client-runtime/state/subagent-display";
7 +import {
8 + resolveSubagentMetadata,
9 + subagentCardDetail,
10 +} from "@t3tools/client-runtime/state/subagent-display";
11 import { formatSubagentEffort } from "@t3tools/client-runtime/state/thread-execution";
12 import type { EnvironmentId, OrchestrationV2Subagent } from "@t3tools/contracts";
13 import type { ReactNode } from "react";
@@ -15,7 +18,6 @@ import { SymbolView } from "../../components/ui/AppSymbol";
18 import { ProviderIcon, ProviderInstanceIcon } from "../../components/ProviderIcon";
19 import { cn } from "../../lib/cn";
20 import { useEnvironmentServerConfig, useProject, useThreadShell } from "../../state/entities";
18 -import { subagentCardDetail } from "./subagent-card-presentation";
21 import { SUBAGENT_TONE_TEXT_CLASS, SubagentStatusDot } from "./SubagentStatusDot";
22 import { resolveSubagentRowPresentation } from "./threadAgentsPresentation";
23
apps/mobile/src/features/threads/subagent-card-presentation.test.ts
+1 -10
@@ -1,17 +1,8 @@
1 import * as DateTime from "effect/DateTime";
2 import { describe, expect, it } from "vite-plus/test";
3 -import { subagentCardDetail, subagentCardElapsed } from "./subagent-card-presentation";
3 +import { subagentCardElapsed } from "./subagent-card-presentation";
4
5 describe("subagent card", () => {
6 - it.each([
7 - ["![screenshot](screenshots/shot.png) Verified", "screenshot Verified"],
8 - ["[docs](https://en.wikipedia.org/wiki/T3_(protocol))", "docs"],
9 - ["[report](outputs/report%20(final).md)", "report"],
10 - ["[report](outputs/report\\(final.md)", "report"],
11 - ])("strips image and link markup from %s", (detail, expected) => {
12 - expect(subagentCardDetail(detail)).toBe(expected);
13 - });
14 -
6 const start = DateTime.makeUnsafe("2026-09-21T12:00:00Z");
7 const end = DateTime.makeUnsafe("2026-09-21T12:01:00Z");
8 const later = DateTime.makeUnsafe("2026-09-21T12:02:00Z");
apps/mobile/src/features/threads/subagent-card-presentation.ts
-12
@@ -3,18 +3,6 @@ import type { OrchestrationV2Subagent } from "@t3tools/contracts";
3 import { formatDuration } from "@t3tools/shared/orchestrationTiming";
4 import * as DateTime from "effect/DateTime";
5
6 -export function subagentCardDetail(detail: string | null): string | null {
7 - if (!detail || /^Child task ended with status\b/i.test(detail)) return null;
8 - return (
9 - detail
10 - .replace(/!?\[([^\]]+)\]\((?:\\.|[^\\()]|\((?:\\.|[^\\()])*\))*\)/g, "$1")
11 - .replace(/`/g, "")
12 - .replace(/^[ \t]*[-*][ \t]+/gm, "")
13 - .replace(/\s+/g, " ")
14 - .trim() || null
15 - );
16 -}
17 -
6 export function subagentCardElapsed(
7 agents: ReadonlyArray<Pick<OrchestrationV2Subagent, "status" | "startedAt" | "completedAt">>,
8 nowMs: number,
apps/mobile/src/features/threads/threadAgentsPresentation.ts
+1 -2
@@ -1,6 +1,7 @@
1 import {
2 formatSubagentDisplayTitle,
3 resolveSubagentMetadata,
4 + subagentCardDetail,
5 subagentDetailPreview,
6 } from "@t3tools/client-runtime/state/subagent-display";
7 import {
@@ -17,8 +18,6 @@ import type {
18 } from "@t3tools/contracts";
19 import { resolveSelectableModel } from "@t3tools/shared/model";
20
20 -import { subagentCardDetail } from "./subagent-card-presentation";
21 -
21 const PROMPT_TITLE_LIMIT = 80;
22
23 export type SubagentRowTone = "working" | "completed" | "failed" | "stopped";
apps/web/src/components/chat/V2LifecycleRow.tsx
+5 -14
@@ -20,7 +20,10 @@ import {
20 type HandoffTimelineRun,
21 resolveModelSwitchChange,
22 } from "@t3tools/client-runtime/handoff";
23 -import { formatSubagentDisplayTitle } from "@t3tools/client-runtime/state/subagent-display";
23 +import {
24 + formatSubagentDisplayTitle,
25 + subagentCardDetail,
26 +} from "@t3tools/client-runtime/state/subagent-display";
27 import {
28 ProviderDriverKind,
29 type ModelSelection,
@@ -193,17 +196,6 @@ const SETTLED_SUBAGENT_STATUSES = new Set<OrchestrationV2TurnItem["status"]>([
196 "interrupted",
197 ]);
198
196 -const GENERIC_CHILD_END = /^Child task ended with status\b/i;
197 -
198 -function plainDetail(text: string): string {
199 - return text
200 - .replace(/\[([^\]]+)\]\([^)]*\)/g, "$1")
201 - .replace(/`/g, "")
202 - .replace(/^[ \t]*[-*][ \t]+/gm, "")
203 - .replace(/\s+/g, " ")
204 - .trim();
205 -}
206 -
199 function isoOrNull(value: DateTime.Utc | null | undefined): string | null {
200 return value ? DateTime.formatIso(value) : null;
201 }
@@ -442,8 +434,7 @@ function SubagentTimelineLink(props: {
434 const progress = (agent?.progress ?? props.progress)?.trim();
435 const settled = SETTLED_SUBAGENT_STATUSES.has(status ?? liveStatus);
436 const rawDetail = settled ? result || progress : progress || result;
445 - const detail =
446 - rawDetail && !GENERIC_CHILD_END.test(rawDetail) ? plainDetail(rawDetail) || null : null;
437 + const detail = subagentCardDetail(rawDetail);
438 const failed = status === "failed";
439 const timing = {
440 status: liveStatus,
packages/client-runtime/src/state/subagentDisplay.test.ts
+12 -1
@@ -1,6 +1,6 @@
1 import { describe, expect, it } from "vite-plus/test";
2
3 -import { subagentDetailPreview } from "./subagentDisplay.js";
3 +import { subagentCardDetail, subagentDetailPreview } from "./subagentDisplay.js";
4
5 describe("subagentDetailPreview", () => {
6 it("prefers progress for live work and results for settled work", () => {
@@ -39,3 +39,14 @@ it("normalizes Unicode whitespace and ignores a large hidden suffix", () => {
39 "x".repeat(279) + "…",
40 );
41 });
42 +
43 +describe("subagentCardDetail", () => {
44 + it.each([
45 + ["![screenshot](screenshots/shot.png) Verified", "screenshot Verified"],
46 + ["[docs](https://en.wikipedia.org/wiki/T3_(protocol))", "docs"],
47 + ["[report](outputs/report%20(final).md)", "report"],
48 + ["[report](outputs/report\\(final.md)", "report"],
49 + ])("strips image and link markup from %s", (detail, expected) => {
50 + expect(subagentCardDetail(detail)).toBe(expected);
51 + });
52 +});
packages/client-runtime/src/state/subagentDisplay.ts
+12
@@ -146,3 +146,15 @@ export function subagentDetailPreview(input: {
146 }
147 return compact || null;
148 }
149 +
150 +export function subagentCardDetail(detail: string | null | undefined): string | null {
151 + if (!detail || /^Child task ended with status\b/i.test(detail)) return null;
152 + return (
153 + detail
154 + .replace(/!?\[([^\]]+)\]\((?:\\.|[^\\()]|\((?:\\.|[^\\()])*\))*\)/g, "$1")
155 + .replace(/`/g, "")
156 + .replace(/^[ \t]*[-*][ \t]+/gm, "")
157 + .replace(/\s+/g, " ")
158 + .trim() || null
159 + );
160 +}