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, 00:45 UTC
fix(web): "Use T3 Code in another app" opens the Grok Bot app (#33663)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 9, 2026 at 18:48 UTC
822671581383a357c5dc8d3ea9984b408c3e03c6
5 files changed
+65
-13
apps/desktop/src/electron/ElectronShell.test.ts
+15
@@ -54,6 +54,21 @@ describe("ElectronShell", () => {
54
}).pipe(Effect.provide(ElectronShell.layer)),
55
);
56
57
+ it.effect("opens only the bare Grok Bot launch link", () =>
58
+ Effect.gen(function* () {
59
+ openExternalMock.mockResolvedValue(undefined);
60
+
61
+ const electronShell = yield* ElectronShell.ElectronShell;
62
+ const results = yield* Effect.forEach(
63
+ ["grokbot://app", "grokbot://app/v1/prompt?id=bot&text=hi", "grokbot://"],
64
+ (url) => electronShell.openExternal(url),
65
+ );
66
+
67
+ assert.deepEqual(results, [true, false, false]);
68
+ assert.deepEqual(openExternalMock.mock.calls, [["grokbot://app"]]);
69
+ }).pipe(Effect.provide(ElectronShell.layer)),
70
+ );
71
+
72
it.effect("opens local editor file deep links", () =>
73
Effect.gen(function* () {
74
openExternalMock.mockResolvedValue(undefined);
apps/desktop/src/electron/ElectronShell.ts
+5
@@ -21,6 +21,10 @@ 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
25
+// each exact link shape the wizard sends, never a whole scheme.
26
+const APP_LAUNCH_URLS = new Set(["grokbot://app"]);
27
+
28
// Zed embeds [user@]host in the path; reject passwords and ports there.
29
const ZED_SSH_PATHNAME = /^\/(?:[^/@:]+@)?[^/@:]+\/.*$/;
30
@@ -46,6 +50,7 @@ export function parseSafeExternalUrl(rawUrl: unknown): Option.Option<string> {
50
try {
51
const url = new URL(rawUrl);
52
return SAFE_WEB_PROTOCOLS.has(url.protocol) ||
53
+ APP_LAUNCH_URLS.has(url.href) ||
54
isRemoteEditorUrl(url) ||
55
isLocalEditorFileUrl(url)
56
? Option.some(url.href)
apps/web/src/components/mcp/UseInAnotherAppDialog.tsx
+20
-5
@@ -662,7 +662,16 @@ function PrimaryAction({ app, mcpUrl }: { readonly app: McpApp; readonly mcpUrl:
662
</div>
663
);
664
}
665
- const { copy, link } = action;
665
+ const { copy, link, appLink } = action;
666
+ // The desktop app reports a link nothing opens and falls back; a browser cannot tell, and
667
+ // opens an app link in place (a new tab for it would stay blank), so its toast keeps the web.
668
+ const openApp = () => {
669
+ if (appLink === null) return openLink(link);
670
+ if (!isElectron) return window.location.assign(appLink);
671
+ void readLocalApi()
672
+ ?.shell.openExternal(appLink)
673
+ .catch(() => openLink(link));
674
+ };
675
const handOff = async () => {
676
if (copy !== null) {
677
// The app opens only once the copy lands, so it never gets an older clipboard.
@@ -678,13 +687,19 @@ function PrimaryAction({ app, mcpUrl }: { readonly app: McpApp; readonly mcpUrl:
687
toastManager.add({
688
type: "success",
689
title: copy.title,
681
- // A browser can block an open that follows the copy; this keeps a way through.
682
- ...(isElectron
690
+ // A browser can block an open that follows the copy, and no platform reliably reports an
691
+ // app link nothing handles (Linux says it opened), so these keep a way through.
692
+ ...(isElectron && appLink === null
693
? {}
684
- : { actionProps: { children: `Open ${app.name}`, onClick: () => openLink(link) } }),
694
+ : {
695
+ actionProps: {
696
+ children: appLink === null ? `Open ${app.name}` : `Open ${app.name} on the web`,
697
+ onClick: () => openLink(link),
698
+ },
699
+ }),
700
});
701
}
687
- openLink(link);
702
+ openApp();
703
};
704
return (
705
<div className="space-y-2">
apps/web/src/components/mcp/mcpApps.test.ts
+4
-3
@@ -18,11 +18,12 @@ describe("MCP app links", () => {
18
expect(claude.searchParams.get("connectorUrl")).toBe(MCP_URL);
19
});
20
21
- // The desktop app opens only http and https links.
21
+ // The desktop app opens only https links and the bare app launch links it lists.
22
it.each(MCP_APPS.map((app) => [app.name, app] as const))("%s opens only https", (_, app) => {
23
- const link = mcpHandoffAction(app, MCP_URL)?.link;
24
- for (const url of [link, app.docs].filter((value) => value != null)) {
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);
28
});
29
});
apps/web/src/components/mcp/mcpApps.ts
+21
-5
@@ -8,7 +8,7 @@ import museLogo from "./logos/muse.png";
8
import openClawLogo from "./logos/openclaw.png";
9
import pokeLogo from "./logos/poke.png";
10
11
-/** How the Connect step hands T3 Code's MCP URL to an app. Every link is https. */
11
+/** How the Connect step hands T3 Code's MCP URL to an app. Every `link` is https. */
12
export type McpAppHandoff =
13
/** Opens the app's add form with T3 Code filled in. */
14
| { readonly kind: "open"; readonly link: (mcpUrl: string) => string }
@@ -18,6 +18,11 @@ export type McpAppHandoff =
18
| {
19
readonly kind: "copy-message";
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.
24
+ */
25
+ readonly appLink?: (message: string) => string;
26
readonly message: (mcpUrl: string) => string;
27
}
28
/** Commands to run where the app runs. */
@@ -83,10 +88,12 @@ export const MCP_APPS: readonly McpApp[] = [
88
id: "grok-bot",
89
name: "Grok Bot",
90
logo: grokBotLogo,
86
- // The app has no web chat, and its prompt links need a Bot id.
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.
93
handoff: {
94
kind: "copy-message",
95
link: "https://x.ai/bot",
96
+ appLink: () => "grokbot://app",
97
message: (url) => `Add the MCP server ${url} and connect it.`,
98
},
99
steps: ["Send this message to any of your Grok Bots."],
@@ -182,19 +189,28 @@ export function mcpHandoffAction(app: McpApp, mcpUrl: string) {
189
const { handoff } = app;
190
switch (handoff.kind) {
191
case "open":
185
- return { label: `Open in ${app.name}`, link: handoff.link(mcpUrl), copy: null };
192
+ return {
193
+ label: `Open in ${app.name}`,
194
+ link: handoff.link(mcpUrl),
195
+ appLink: null,
196
+ copy: null,
197
+ };
198
case "copy-url":
199
return {
200
label: `Copy URL and open ${app.name}`,
201
link: handoff.link,
202
+ appLink: null,
203
copy: { text: mcpUrl, title: "URL copied" },
204
};
192
- case "copy-message":
205
+ case "copy-message": {
206
+ const message = handoff.message(mcpUrl);
207
return {
208
label: `Copy message and open ${app.name}`,
209
link: handoff.link,
196
- copy: { text: handoff.message(mcpUrl), title: "Message copied" },
210
+ appLink: handoff.appLink?.(message) ?? null,
211
+ copy: { text: message, title: "Message copied" },
212
};
213
+ }
214
case "commands":
215
return null;
216
}