@devries-cameron20 / t3code-1 / commits / 7f6ba5bd24
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): Grok Bot opens with the setup message filled in (#35565)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 12, 2026 at 11:56 UTC 7f6ba5bd24a44c1db35b543423478e1080395299
5 files changed +35 -14
apps/desktop/src/electron/ElectronShell.test.ts
+16 -4
@@ -54,18 +54,30 @@ describe("ElectronShell", () => {
54 }).pipe(Effect.provide(ElectronShell.layer)),
55 );
56
57 - it.effect("opens only the bare Grok Bot launch link", () =>
57 + it.effect("opens only the Grok Bot prompt link", () =>
58 Effect.gen(function* () {
59 openExternalMock.mockResolvedValue(undefined);
60
61 + const prompt = "grokbot://app/v1/prompt?text=Add%20the%20MCP%20server";
62 const electronShell = yield* ElectronShell.ElectronShell;
63 const results = yield* Effect.forEach(
63 - ["grokbot://app", "grokbot://app/v1/prompt?id=bot&text=hi", "grokbot://"],
64 + [
65 + prompt,
66 + "grokbot://app",
67 + "grokbot://app/v1/prompt?id=bot&text=hi",
68 + "grokbot://app/v1/prompt?text=a&text=b",
69 + "grokbot://app/v1/other?text=hi",
70 + "grokbot://app/v1/prompt?text=hi#x",
71 + "grokbot://:secret@app/v1/prompt?text=hi",
72 + "grokbot://user@app/v1/prompt?text=hi",
73 + "grokbot://other/v1/prompt?text=hi",
74 + "other://app/v1/prompt?text=hi",
75 + ],
76 (url) => electronShell.openExternal(url),
77 );
78
67 - assert.deepEqual(results, [true, false, false]);
68 - assert.deepEqual(openExternalMock.mock.calls, [["grokbot://app"]]);
79 + assert.deepEqual(results, [true, ...Array<boolean>(9).fill(false)]);
80 + assert.deepEqual(openExternalMock.mock.calls, [[prompt]]);
81 }).pipe(Effect.provide(ElectronShell.layer)),
82 );
83
apps/desktop/src/electron/ElectronShell.ts
+10 -3
@@ -21,9 +21,16 @@ const REMOTE_EDITOR_PROTOCOLS = new Set(
21 }),
22 );
23
24 -// "Use T3 Code in another app" opens these apps (apps/web/src/components/mcp/mcpApps.ts). List
24 +// "Use T3 Code in another app" opens these apps (apps/web/src/components/mcp/mcpApps.ts). Match
25 // each exact link shape the wizard sends, never a whole scheme.
26 -const APP_LAUNCH_URLS = new Set(["grokbot://app"]);
26 +const isAppLaunchUrl = (url: URL) =>
27 + url.protocol === "grokbot:" &&
28 + url.host === "app" &&
29 + url.pathname === "/v1/prompt" &&
30 + url.username.length === 0 &&
31 + url.password.length === 0 &&
32 + url.hash.length === 0 &&
33 + [...url.searchParams.keys()].join() === "text";
34
35 // Zed embeds [user@]host in the path; reject passwords and ports there.
36 const ZED_SSH_PATHNAME = /^\/(?:[^/@:]+@)?[^/@:]+\/.*$/;
@@ -50,7 +57,7 @@ export function parseSafeExternalUrl(rawUrl: unknown): Option.Option<string> {
57 try {
58 const url = new URL(rawUrl);
59 return SAFE_WEB_PROTOCOLS.has(url.protocol) ||
53 - APP_LAUNCH_URLS.has(url.href) ||
60 + isAppLaunchUrl(url) ||
61 isRemoteEditorUrl(url) ||
62 isLocalEditorFileUrl(url)
63 ? Option.some(url.href)
apps/web/src/components/mcp/UseInAnotherAppDialog.tsx
+1 -1
@@ -692,7 +692,7 @@ function PrimaryAction({ app, mcpUrl }: { readonly app: McpApp; readonly mcpUrl:
692 ? {}
693 : {
694 actionProps: {
695 - children: appLink === null ? `Open ${app.name}` : `Open ${app.name} on the web`,
695 + children: appLink === null ? `Open ${app.name}` : `Get ${app.name}`,
696 onClick: () => openLink(link),
697 },
698 }),
apps/web/src/components/mcp/mcpApps.test.ts
+5 -2
@@ -18,12 +18,15 @@ describe("MCP app links", () => {
18 expect(claude.searchParams.get("connectorUrl")).toBe(MCP_URL);
19 });
20
21 - // The desktop app opens only https links and the bare app launch links it lists.
21 + // The desktop app opens only https links and the app launch links it lists.
22 it.each(MCP_APPS.map((app) => [app.name, app] as const))("%s opens only https", (_, app) => {
23 const action = mcpHandoffAction(app, MCP_URL);
24 for (const url of [action?.link, app.docs].filter((value) => value != null)) {
25 expect(new URL(url).protocol).toBe("https:");
26 }
27 - expect(action?.appLink ?? null).toBe(app.id === "grok-bot" ? "grokbot://app" : null);
27 + // Grok Bot's app link prefills the message it copies.
28 + const appLink = action?.appLink == null ? null : new URL(action.appLink);
29 + expect(appLink?.protocol ?? null).toBe(app.id === "grok-bot" ? "grokbot:" : null);
30 + if (appLink) expect(appLink.searchParams.get("text")).toBe(action?.copy?.text);
31 });
32 });
apps/web/src/components/mcp/mcpApps.ts
+3 -4
@@ -20,7 +20,7 @@ export type McpAppHandoff =
20 readonly link: string;
21 /**
22 * Opens the installed app first, given the message; `link` is the fallback. The desktop
23 - * app opens only the link shapes `APP_LAUNCH_URLS` in ElectronShell lists.
23 + * app opens only the link shapes `isAppLaunchUrl` in ElectronShell accepts.
24 */
25 readonly appLink?: (message: string) => string;
26 readonly message: (mcpUrl: string) => string;
@@ -88,12 +88,11 @@ export const MCP_APPS: readonly McpApp[] = [
88 id: "grok-bot",
89 name: "Grok Bot",
90 logo: grokBotLogo,
91 - // No web chat, and no link that prefills a message yet (Grok Bot plans one), so the app
92 - // opens bare and the copied message is pasted in.
91 + // No web chat. The app link prefills the message only into an empty box, so it is copied too.
92 handoff: {
93 kind: "copy-message",
94 link: "https://x.ai/bot",
96 - appLink: () => "grokbot://app",
95 + appLink: (message) => `grokbot://app/v1/prompt?text=${encoded(message)}`,
96 message: (url) => `Add the MCP server ${url} and connect it.`,
97 },
98 steps: ["Send this message to any of your Grok Bots."],