Skip to content

Commit 6426434

Browse files
Merge remote-tracking branch 'origin/main' into fix/issue-33660
2 parents a3623ef + 8226715 commit 6426434

6 files changed

Lines changed: 95 additions & 17 deletions

File tree

‎.github/workflows/mobile-eas-production.yml‎

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,21 @@ jobs:
504504
with:
505505
ref: ${{ needs.production.outputs.android_sha }}
506506
fetch-depth: 0
507-
# Dependency scripts and the build run in this job; only Record build gets a token.
508-
persist-credentials: false
507+
508+
# Dependency scripts and the build run in this job; only Record build gets a token.
509+
# persist-credentials: false would clean up via `git submodule foreach`, which fails on .repos gitlinks.
510+
- name: Drop checkout credentials
511+
run: |
512+
git config --local --unset-all http.https://github.com/.extraheader || true
513+
{ git config --local --name-only --get-regexp '^includeif\.' || true; } | while read -r key; do
514+
path=$(git config --local --get "$key")
515+
git config --local --unset-all "$key"
516+
case "$path" in "$RUNNER_TEMP"/*) rm -f "$path" ;; esac
517+
done
518+
if git config --local --get-regexp '^(http\..*\.extraheader|includeif\.)'; then
519+
echo "::error::Checkout credentials are still configured"
520+
exit 1
521+
fi
509522
510523
# A queued run can follow a build of the same fingerprint; manual runs always build.
511524
- id: record
@@ -687,8 +700,21 @@ jobs:
687700
with:
688701
ref: ${{ needs.production.outputs.ios_sha }}
689702
fetch-depth: 0
690-
# Dependency scripts and the build run in this job; only Record build gets a token.
691-
persist-credentials: false
703+
704+
# Dependency scripts and the build run in this job; only Record build gets a token.
705+
# persist-credentials: false would clean up via `git submodule foreach`, which fails on .repos gitlinks.
706+
- name: Drop checkout credentials
707+
run: |
708+
git config --local --unset-all http.https://github.com/.extraheader || true
709+
{ git config --local --name-only --get-regexp '^includeif\.' || true; } | while read -r key; do
710+
path=$(git config --local --get "$key")
711+
git config --local --unset-all "$key"
712+
case "$path" in "$RUNNER_TEMP"/*) rm -f "$path" ;; esac
713+
done
714+
if git config --local --get-regexp '^(http\..*\.extraheader|includeif\.)'; then
715+
echo "::error::Checkout credentials are still configured"
716+
exit 1
717+
fi
692718
693719
# A queued run can follow a build of the same fingerprint; manual runs always build.
694720
- id: record

‎apps/desktop/src/electron/ElectronShell.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,21 @@ describe("ElectronShell", () => {
5454
}).pipe(Effect.provide(ElectronShell.layer)),
5555
);
5656

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+
5772
it.effect("opens local editor file deep links", () =>
5873
Effect.gen(function* () {
5974
openExternalMock.mockResolvedValue(undefined);

‎apps/desktop/src/electron/ElectronShell.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ const REMOTE_EDITOR_PROTOCOLS = new Set(
2121
}),
2222
);
2323

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+
2428
// Zed embeds [user@]host in the path; reject passwords and ports there.
2529
const ZED_SSH_PATHNAME = /^\/(?:[^/@:]+@)?[^/@:]+\/.*$/;
2630

@@ -46,6 +50,7 @@ export function parseSafeExternalUrl(rawUrl: unknown): Option.Option<string> {
4650
try {
4751
const url = new URL(rawUrl);
4852
return SAFE_WEB_PROTOCOLS.has(url.protocol) ||
53+
APP_LAUNCH_URLS.has(url.href) ||
4954
isRemoteEditorUrl(url) ||
5055
isLocalEditorFileUrl(url)
5156
? Option.some(url.href)

‎apps/web/src/components/mcp/UseInAnotherAppDialog.tsx‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,16 @@ function PrimaryAction({ app, mcpUrl }: { readonly app: McpApp; readonly mcpUrl:
662662
</div>
663663
);
664664
}
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+
};
666675
const handOff = async () => {
667676
if (copy !== null) {
668677
// 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:
678687
toastManager.add({
679688
type: "success",
680689
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
683693
? {}
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+
}),
685700
});
686701
}
687-
openLink(link);
702+
openApp();
688703
};
689704
return (
690705
<div className="space-y-2">

‎apps/web/src/components/mcp/mcpApps.test.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ describe("MCP app links", () => {
1818
expect(claude.searchParams.get("connectorUrl")).toBe(MCP_URL);
1919
});
2020

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.
2222
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)) {
2525
expect(new URL(url).protocol).toBe("https:");
2626
}
27+
expect(action?.appLink ?? null).toBe(app.id === "grok-bot" ? "grokbot://app" : null);
2728
});
2829
});

‎apps/web/src/components/mcp/mcpApps.ts‎

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import museLogo from "./logos/muse.png";
88
import openClawLogo from "./logos/openclaw.png";
99
import pokeLogo from "./logos/poke.png";
1010

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. */
1212
export type McpAppHandoff =
1313
/** Opens the app's add form with T3 Code filled in. */
1414
| { readonly kind: "open"; readonly link: (mcpUrl: string) => string }
@@ -18,6 +18,11 @@ export type McpAppHandoff =
1818
| {
1919
readonly kind: "copy-message";
2020
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;
2126
readonly message: (mcpUrl: string) => string;
2227
}
2328
/** Commands to run where the app runs. */
@@ -83,10 +88,12 @@ export const MCP_APPS: readonly McpApp[] = [
8388
id: "grok-bot",
8489
name: "Grok Bot",
8590
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.
8793
handoff: {
8894
kind: "copy-message",
8995
link: "https://x.ai/bot",
96+
appLink: () => "grokbot://app",
9097
message: (url) => `Add the MCP server ${url} and connect it.`,
9198
},
9299
steps: ["Send this message to any of your Grok Bots."],
@@ -182,19 +189,28 @@ export function mcpHandoffAction(app: McpApp, mcpUrl: string) {
182189
const { handoff } = app;
183190
switch (handoff.kind) {
184191
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+
};
186198
case "copy-url":
187199
return {
188200
label: `Copy URL and open ${app.name}`,
189201
link: handoff.link,
202+
appLink: null,
190203
copy: { text: mcpUrl, title: "URL copied" },
191204
};
192-
case "copy-message":
205+
case "copy-message": {
206+
const message = handoff.message(mcpUrl);
193207
return {
194208
label: `Copy message and open ${app.name}`,
195209
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" },
197212
};
213+
}
198214
case "commands":
199215
return null;
200216
}

0 commit comments

Comments
 (0)