Skip to content

Commit 1fbbf03

Browse files
only21milcodex
andauthored
fix(mobile): strip image and link punctuation from subagent previews (#23538)
Co-authored-by: GPT-6.1 Sol <[email protected]>
1 parent b47d71d commit 1fbbf03

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

‎apps/mobile/src/features/threads/subagent-card-presentation.test.ts‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
import * as DateTime from "effect/DateTime";
22
import { describe, expect, it } from "vite-plus/test";
3-
import { subagentCardElapsed } from "./subagent-card-presentation";
3+
import { subagentCardDetail, subagentCardElapsed } from "./subagent-card-presentation";
44

55
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+
615
const start = DateTime.makeUnsafe("2026-09-21T12:00:00Z");
716
const end = DateTime.makeUnsafe("2026-09-21T12:01:00Z");
817
const later = DateTime.makeUnsafe("2026-09-21T12:02:00Z");

‎apps/mobile/src/features/threads/subagent-card-presentation.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function subagentCardDetail(detail: string | null): string | null {
77
if (!detail || /^Child task ended with status\b/i.test(detail)) return null;
88
return (
99
detail
10-
.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1")
10+
.replace(/!?\[([^\]]+)\]\((?:\\.|[^\\()]|\((?:\\.|[^\\()])*\))*\)/g, "$1")
1111
.replace(/`/g, "")
1212
.replace(/^[ \t]*[-*][ \t]+/gm, "")
1313
.replace(/\s+/g, " ")

0 commit comments

Comments
 (0)