diff --git a/apps/mobile/src/features/threads/subagent-card-presentation.test.ts b/apps/mobile/src/features/threads/subagent-card-presentation.test.ts index d0c673b868ca2..e77e76472b34e 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([ + ["![screenshot](screenshots/shot.png) 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.ts index 08574b4b2613a..42e75c5cf214e 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, " ")