@devries-cameron20 / t3code Mirror · read-only / commits / 976a23161d
Fork 0

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, 08:15 UTC

fix(mobile): thread links show their thread's title (#26485)

Julius Marminge committed Nov 1, 2026 at 10:53 UTC 976a23161d3eeb2738a66993a40e7dd9aa98229a
2 files changed +20 -2
packages/shared/src/threadLinks.test.ts
+17 -1
@@ -1,4 +1,4 @@
1 -import { describe, expect, it } from "vite-plus/test";
1 +import { describe, expect, it, vi } from "vite-plus/test";
2 import { EnvironmentId, ThreadId, type ScopedThreadRef } from "@t3tools/contracts";
3
4 import {
@@ -143,6 +143,22 @@ describe("thread links", () => {
143 ).toEqual([ref("there", "t1"), ref("local", "t%3A2"), ref("local", "t:2")]);
144 });
145
146 + it("lists a message's thread links on runtimes whose matchAll omits named groups, such as Hermes", () => {
147 + const matchAll = String.prototype.matchAll;
148 + using _hermes = vi.spyOn(String.prototype, "matchAll").mockImplementation(function (
149 + this: string,
150 + regexp: RegExp,
151 + ) {
152 + return matchAll.call(this, regexp).map((match) => {
153 + delete match.groups;
154 + return match;
155 + });
156 + });
157 + expect(threadLinkRefs("<t3-thread://v2/local/t1> [a](t3-thread://v2/there/t2)", local)).toEqual(
158 + [ref("local", "t1"), ref("there", "t2")],
159 + );
160 + });
161 +
162 it("writes a titleless autolink that opens that exact thread", () => {
163 const link = formatThreadLink(ref("env-1", "thread:delegated-task:mcp%3A1"));
164 expect(link).toBe("<t3-thread://v2/env-1/thread:delegated-task:mcp%3A1>");
packages/shared/src/threadLinks.ts
+3 -1
@@ -97,7 +97,9 @@ export function threadLinkRefs(
97 messageEnvironmentId: EnvironmentId,
98 ): ReadonlyArray<ScopedThreadRef> {
99 const refs = new Map<string, ScopedThreadRef>();
100 - for (const match of markdown.matchAll(THREAD_LINK_OUTSIDE_CODE)) {
100 + // Hermes' matchAll yields matches without `groups`; exec keeps them.
101 + const pattern = new RegExp(THREAD_LINK_OUTSIDE_CODE);
102 + for (let match = pattern.exec(markdown); match !== null; match = pattern.exec(markdown)) {
103 const href = match.groups?.href ?? match.groups?.autolink;
104 const link = href === undefined ? null : parseThreadLinkHref(href);
105 if (link === null) continue;