The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 02:00 UTC
fix(clients): parse angle-bracketed thread link destinations (#30709)
Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Yash Singh <saiansh2525@gmail.com>
Zack Jackson committed
Nov 8, 2026 at 11:55 UTC
f558007b20926ba49a51dba158933a13f3f20c9e
4 files changed
+30
-2
apps/mobile/src/lib/enrichedLinkPresentation.test.ts
+12
@@ -103,4 +103,16 @@ describe("Enriched link presentation", () => {
103
]);
104
expect(threadChipTargets(here, "No links here.")).toEqual([]);
105
});
106
+
107
+ it("finds thread links with angle-bracketed destinations", () => {
108
+ const here = "env-here" as EnvironmentId;
109
+ expect(threadChipTargets(here, "See [A](<t3-thread://v2/env-here/thread_a>).")).toEqual([
110
+ {
111
+ href: "t3-thread://v2/env-here/thread_a",
112
+ environmentId: here,
113
+ threadId: "thread_a",
114
+ link: true,
115
+ },
116
+ ]);
117
+ });
118
});
apps/mobile/src/lib/enrichedLinkPresentation.ts
+1
-1
@@ -58,7 +58,7 @@ export function threadChipTargets(
58
): ReadonlyArray<ThreadChipTarget> {
59
const targets = new Map<string, ThreadChipTarget>();
60
if (hasThreadLinks(markdown)) {
61
- for (const [, href = ""] of markdown.matchAll(/\]\((t3-thread:\/\/v[12]\/[^\s)]+)\)/g)) {
61
+ for (const [, href = ""] of markdown.matchAll(/\]\(<?(t3-thread:\/\/v[12]\/[^\s>)]+)>?\)/g)) {
62
const link = parseThreadLinkHref(href);
63
if (link) {
64
targets.set(href, {
packages/shared/src/threadLinks.test.ts
+15
@@ -104,6 +104,21 @@ describe("thread links", () => {
104
).toBe("[There](t3-thread://v2/there/t1) and [Here](t3-thread://v2/local/t1)");
105
});
106
107
+ it("reads an angle-bracketed destination as the labeled link, not an autolink", () => {
108
+ const title = titlesIn({ local: { t1: "Here" }, there: { t1: "There" } });
109
+ expect(
110
+ relabelThreadLinks(
111
+ "[old](<t3-thread://v2/there/t1>) and [older](<t3-thread://v2/local/t1>)",
112
+ local,
113
+ title,
114
+ ),
115
+ ).toBe("[There](t3-thread://v2/there/t1) and [Here](t3-thread://v2/local/t1)");
116
+ expect(
117
+ relabelThreadLinks("[Kept label](<t3-thread://v2/local/t1>)", local, () => undefined),
118
+ ).toBe("Kept label");
119
+ expect(threadLinkRefs("[a](<t3-thread://v2/there/t2>)", local)).toEqual([ref("there", "t2")]);
120
+ });
121
+
122
it("turns a v2 link it cannot resolve into plain text, never the raw link", () => {
123
expect(
124
relabelThreadLinks(
packages/shared/src/threadLinks.ts
+2
-1
@@ -11,8 +11,9 @@ const HOSTED_PREFIX = `${DEFAULT_HOSTED_APP_URL}/threads/`;
11
const HOSTED_SEGMENT = "[A-Za-z0-9_%-]+";
12
const HOSTED_LINK = `${HOSTED_PREFIX.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&")}${HOSTED_SEGMENT}/${HOSTED_SEGMENT}`;
13
// Code comes first in the alternation so a link written inside a code span or fence is skipped.
14
+// A labeled link's destination may be angle-bracketed, as CommonMark allows: [label](<href>).
15
const THREAD_LINK_OUTSIDE_CODE = new RegExp(
15
- String.raw`(?<fence>(\`{3,}|~{3,})[\s\S]*?(?:\2|$))|(?<span>(\`+)[^\n]*?\4)|\[(?<label>[^\]\n]*)\]\((?<href>t3-thread:\/\/v[12]\/[^\s)]+|${HOSTED_LINK})\)|<(?<autolink>t3-thread:\/\/v[12]\/[^\s<>]+|${HOSTED_LINK})>|(?<bare>${HOSTED_LINK})(?![\w%/?#-])`,
16
+ String.raw`(?<fence>(\`{3,}|~{3,})[\s\S]*?(?:\2|$))|(?<span>(\`+)[^\n]*?\4)|\[(?<label>[^\]\n]*)\]\(<?(?<href>t3-thread:\/\/v[12]\/[^\s>)]+|${HOSTED_LINK})>?\)|<(?<autolink>t3-thread:\/\/v[12]\/[^\s<>]+|${HOSTED_LINK})>|(?<bare>${HOSTED_LINK})(?![\w%/?#-])`,
17
"g",
18
);
19