TypeScript
fix(mobile): strip image and link punctuation from subagent previews (#23538)
Victor Vogel1fbbf036812c
diff --git a/apps/mobile/src/features/threads/subagent-card-presentation.test.ts b/apps/mobile/src/features/threads/subagent-card-presentation.test.tsindex d0c673b868c..e77e76472b3 100644--- a/apps/mobile/src/features/threads/subagent-card-presentation.test.ts+++ b/apps/mobile/src/features/threads/subagent-card-presentation.test.ts@@ -1,8 +1,17 @@import * as DateTime from "effect/DateTime";import { describe, expect, it } from "vite-plus/test";-import { subagentCardElapsed } from "./subagent-card-presentation";+import { subagentCardDetail, subagentCardElapsed } from "./subagent-card-presentation";describe("subagent card", () => {+ it.each([+ [" Verified", "screenshot Verified"],+ ["[docs](https://en.wikipedia.org/wiki/T3_(protocol))", "docs"],+ ["[report](outputs/report%20(final).md)", "report"],+ ["[report](outputs/report\\(final.md)", "report"],+ ])("strips image and link markup from %s", (detail, expected) => {+ expect(subagentCardDetail(detail)).toBe(expected);+ });+const start = DateTime.makeUnsafe("2026-09-21T12:00:00Z");const end = DateTime.makeUnsafe("2026-09-21T12:01:00Z");const later = DateTime.makeUnsafe("2026-09-21T12:02:00Z");diff --git a/apps/mobile/src/features/threads/subagent-card-presentation.ts b/apps/mobile/src/features/threads/subagent-card-presentation.tsindex 08574b4b261..42e75c5cf21 100644--- a/apps/mobile/src/features/threads/subagent-card-presentation.ts+++ b/apps/mobile/src/features/threads/subagent-card-presentation.ts@@ -7,7 +7,7 @@ export function subagentCardDetail(detail: string | null): string | null {if (!detail || /^Child task ended with status\b/i.test(detail)) return null;return (detail- .replace(/\[([^\]]+)\]\([^)]*\)/g, "$1")+ .replace(/!?\[([^\]]+)\]\((?:\\.|[^\\()]|\((?:\\.|[^\\()])*\))*\)/g, "$1").replace(/`/g, "").replace(/^[ \t]*[-*][ \t]+/gm, "").replace(/\s+/g, " ")