Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(mcp): point bots at connected Google Drive, Sheets and Docs instead of an MCP sign-in that cannot finish (#6994)
Milind Soni46b29b0a9179
diff --git a/server/cloud-connections-host.ts b/server/cloud-connections-host.tsindex ede03cb652..2f9ccb5f7a 100644--- a/server/cloud-connections-host.ts+++ b/server/cloud-connections-host.ts@@ -5,7 +5,7 @@ import { hostname } from "node:os";import { join } from "node:path";import { answerConnection, connectionFingerprints, launchersOnPath, listConnections, releaseConnection, signInDigest } from "./cloud-connections.ts";-import { createConnectionPrompt, type ConnectionPromptBot } from "./cloud-connections-prompt.ts";+import { createConnectionPrompt, type ConnectionPromptAppFor, type ConnectionPromptBot } from "./cloud-connections-prompt.ts";import { createStayedNotices, type StayedNoticesDeps } from "./cloud-connections-stayed.ts";import { movedFrom } from "./cloud-send-arrived.ts";import * as composio from "./composio.ts";@@ -101,7 +101,7 @@ export function createCloudConnectionsHost(deps: CloudConnectionsHostDeps) {return answerConnection(what.id, sources());},- prompt: (bot: ConnectionPromptBot, lent?: ReadonlyMap<string, string>): string => prompt?.(bot, lent) ?? "",+ prompt: (bot: ConnectionPromptBot, lent?: ReadonlyMap<string, string>, appFor?: ConnectionPromptAppFor): string => prompt?.(bot, lent, appFor) ?? "",/** What stayed on the person's computer: said when the move ends, and in the first conversation with each bot. */moved: (language?: string): void => stayed?.moved(language),personTurn: (bot: Parameters<NonNullable<typeof stayed>["personTurn"]>[0], threadId: string): void => stayed?.personTurn(bot, threadId),diff --git a/server/cloud-connections-prompt.test.ts b/server/cloud-connections-prompt.test.tsindex cd5b2fb7ab..078bcb3a74 100644--- a/server/cloud-connections-prompt.test.ts+++ b/server/cloud-connections-prompt.test.ts@@ -46,6 +46,41 @@ describe("what a bot on My Cloud is told about connections that need the person"expect(prompt({ mcpServers: ["dodo", "linear", "jira"] })).toBe("");});+ describe("a server that stands for a connected app", () => {+ const hosted = (app: string) => ({ type: "http", url: `https://api.cursor.com/rest-mcp/${app}/mcp`, headers: {}, enabled: true });+ const servers = {+ "google-drive": hosted("google-drive"),+ "google-sheets": hosted("google-sheets"),+ "google-slides": hosted("google-slides"),+ "google-docs": { type: "http", url: "https://docs-mcp.example/mcp", headers: {}, enabled: true },+ };+ const source: ConnectionPromptSources = { mcpServers: () => servers, mcpAuth: () => "needs-sign-in", composioConnected: async () => ({}) };+ const link = (name: string) => `sign in here: https://omb-u-1.fly.dev/?connect=mcp%3A${name}`;+ const apps: Record<string, { slug: string; label: string; connected: boolean }> = {+ "google-drive": { slug: "googledrive", label: "Google Drive", connected: true },+ "google-sheets": { slug: "googlesheets", label: "Google Sheets", connected: false },+ "google-docs": { slug: "googledocs", label: "Google Docs", connected: true },+ };+ const elsewhere = " When a task needs one, do not send the person to sign in to it; where a connected app is named, call COMPOSIO_MANAGE_CONNECTIONS for it, which shows the person a card to connect it, and end the turn; otherwise say so in plain words.";++ it("in a turn that can use the app: the app, and a sign-in link only where the server can sign in here", () => {+ const prompt = createConnectionPrompt(source, ORIGIN);+ expect(prompt({}, undefined, (name) => apps[name] ?? null)).toBe(+ " Not signed in on My Cloud, but connected here as connected apps: google-drive (Google Drive). When a task needs one, use that connected app through the composio tools instead; do not send the person to sign in to the server."+ + ` Not signed in on My Cloud yet, and also connected here as connected apps: google-docs (${link("google-docs")}; connected app: Google Docs). When a task needs one, use the connected app through the composio tools; give the server's link only when the task needs that server itself.`+ + " Can't be signed in from OpenMausBot (their sign-in works only in another app): google-sheets (connect Google Sheets as a connected app instead); google-slides." + elsewhere);+ });++ it("in a turn that cannot use the app (its tool selection, scopes, policy or no connected apps): no app, and still no link that cannot finish", () => {+ const prompt = createConnectionPrompt(source, ORIGIN);+ for (const appFor of [undefined, () => null]) {+ expect(prompt({}, undefined, appFor)).toBe(+ ` Not connected on My Cloud yet: google-docs (${link("google-docs")}). When a task needs one, say in plain words that it needs the person once on My Cloud and give its link; do not try another way.`+ + " Can't be signed in from OpenMausBot (their sign-in works only in another app): google-drive; google-sheets; google-slides." + elsewhere);+ }+ });+ });+it("connected apps assigned to the bot but not connected here, read in the background for the next turn", async () => {const source = sources({}, { gmail: false, slack: true });const prompt = createConnectionPrompt(source, ORIGIN);diff --git a/server/cloud-connections-prompt.ts b/server/cloud-connections-prompt.tsindex f873beb79e..05c2e6bbca 100644--- a/server/cloud-connections-prompt.ts+++ b/server/cloud-connections-prompt.ts@@ -6,6 +6,7 @@ import type { ConnectorToolGrant } from "../shared/wire.ts";import { toolkitName } from "./activity.ts";import type { McpAuthState } from "./mcp-oauth.ts";import { isRemoteMcpServer, parseStoredMcpServer } from "./mcp-registry.ts";+import { signsInOnlyElsewhere, type McpServerApp } from "./mcp-server-app.ts";import { stayedConnectors, stayedWhyText } from "./cloud-connections-stayed.ts";const COMPOSIO_TTL_MS = 20_000;@@ -24,10 +25,14 @@ export interface ConnectionPromptSources {export type ConnectionPromptBot = { mcpServers?: string[]; composio?: boolean; connectorTools?: Record<string, ConnectorToolGrant> };+/** The connected app a server stands for, when this turn could use that app instead: the same rule the turn's MCP servers+ * are swapped by (team-connections-host.ts `mcpServerApps`). */+export type ConnectionPromptAppFor = (name: string, url: string) => McpServerApp | null;+/** `origin`: My Cloud's public address, where `/?connect=<id>` opens the page that connects it. `lent`, in a turn: by* name, why each of the bot's servers that runs on the person's computer can't be reached now; one left out reaches the- * turn through that computer. */-export function createConnectionPrompt(sources: ConnectionPromptSources, origin: string): (bot: ConnectionPromptBot, lent?: ReadonlyMap<string, string>) => string {+ * turn through that computer. `appFor`, in a turn: the connected app each server stands for. */+export function createConnectionPrompt(sources: ConnectionPromptSources, origin: string): (bot: ConnectionPromptBot, lent?: ReadonlyMap<string, string>, appFor?: ConnectionPromptAppFor) => string {const known = new Map<string, { at: number; connected: boolean }>();let reading: Promise<void> | null = null;let failedAt = 0;@@ -47,8 +52,11 @@ export function createConnectionPrompt(sources: ConnectionPromptSources, origin:const link = (id: string) => `${origin}/?connect=${encodeURIComponent(id)}`;- return (bot, lent) => {+ return (bot, lent, appFor) => {const toConnect: string[] = [];+ const inApps: string[] = [];+ const alsoApps: string[] = [];+ const elsewhereOnly: string[] = [];const elsewhere = new Map<string, string[]>();for (const stayed of stayedConnectors(sources.mcpServers(), sources.programs?.() ?? [])) {if (bot.mcpServers !== undefined && !bot.mcpServers.includes(stayed.name)) continue;@@ -61,7 +69,14 @@ export function createConnectionPrompt(sources: ConnectionPromptSources, origin:const server = parsed.server;if (!server.runsOn && isRemoteMcpServer(server)) {const auth = sources.mcpAuth(name, server.url);- if (auth === "needs-sign-in" || (auth === "none" && server.oauth)) toConnect.push(`${name} (sign in here: ${link(`mcp:${name}`)})`);+ if (auth !== "needs-sign-in" && !(auth === "none" && server.oauth)) continue;+ const app = appFor?.(name, server.url) ?? null, signIn = `sign in here: ${link(`mcp:${name}`)}`;+ // A server that can only sign in elsewhere never gets a link; one that can keeps it beside its connected app.+ if (signsInOnlyElsewhere(server.url)) {+ if (app?.connected) inApps.push(`${name} (${app.label})`);+ else elsewhereOnly.push(app ? `${name} (connect ${app.label} as a connected app instead)` : name);+ } else if (app?.connected) alsoApps.push(`${name} (${signIn}; connected app: ${app.label})`);+ else toConnect.push(`${name} (${signIn})`);}}const granted = bot.composio === false ? [] : Object.keys(bot.connectorTools ?? {});@@ -70,6 +85,9 @@ export function createConnectionPrompt(sources: ConnectionPromptSources, origin:return [from ? ` You moved to My Cloud from the person's computer ${from}, with everything in OpenMausBot. What lives outside OpenMausBot stayed on ${from}: its other folders and files, passkeys, the person's own browser sessions and apps, Local VM disks and model servers on its home network. When a task needs one, use ${from} if it is lent to My Cloud and online; otherwise say in plain words that it stayed there.` : "",toConnect.length ? ` Not connected on My Cloud yet: ${toConnect.join("; ")}. When a task needs one, say in plain words that it needs the person once on My Cloud and give its link; do not try another way.` : "",+ inApps.length ? ` Not signed in on My Cloud, but connected here as connected apps: ${inApps.join("; ")}. When a task needs one, use that connected app through the composio tools instead; do not send the person to sign in to the server.` : "",+ alsoApps.length ? ` Not signed in on My Cloud yet, and also connected here as connected apps: ${alsoApps.join("; ")}. When a task needs one, use the connected app through the composio tools; give the server's link only when the task needs that server itself.` : "",+ elsewhereOnly.length ? ` Can't be signed in from OpenMausBot (their sign-in works only in another app): ${elsewhereOnly.join("; ")}. When a task needs one, do not send the person to sign in to it; where a connected app is named, call COMPOSIO_MANAGE_CONNECTIONS for it, which shows the person a card to connect it, and end the turn; otherwise say so in plain words.` : "",apps.length ? ` Assigned to this bot but not connected on My Cloud yet: ${apps.join(", ")}. When a task needs one, call COMPOSIO_MANAGE_CONNECTIONS for it, which shows the person a card to connect it, and end the turn.` : "",...(lent? (lent.size ? [` Runs on the person's own computer and can't be reached now: ${[...lent.values()].join(" ")} If a task needs one, tell the person that in plain words, and do not write your own replacement.`] : [])diff --git a/server/host/team-connections-host.test.ts b/server/host/team-connections-host.test.tsindex e9f89b7736..5384ab2bb4 100644--- a/server/host/team-connections-host.test.ts+++ b/server/host/team-connections-host.test.ts@@ -310,6 +310,13 @@ describe("apps each person connects", () => {expect(lookup("mail", "https://mail.example/mcp"), "an unknown server").toBeNull();});+ it("reads the servers as they are saved in the settings, for the turn's connection prompt", async () => {+ const host = await calendarConnected({ team: false });+ const saved: Record<string, unknown> = { broken: "not a server", local: { command: "npx" }, drive: { type: "http", url: "https://api.cursor.com/rest-mcp/google-drive/mcp", headers: {}, enabled: true } };+ expect(host.mcpServerApps(SCOUT, { ...open, servers: saved })!("drive", "https://api.cursor.com/rest-mcp/google-drive/mcp")).toEqual({ slug: "googledrive", label: "Google Drive", connected: false });+ expect(host.mcpServerApps(SCOUT, { ...open, servers: { broken: "not a server", local: { command: "npx" } } }), "no server stands for an app").toBeUndefined();+ });+it("does so on a Team Cloud for a team app on the team's bridge, never for a person's app", async () => {const host = await calendarConnected();expect(host.mcpServerApps(SCOUT, open)!("gmail", "")).toEqual({ slug: "gmail", label: "Gmail", connected: false });diff --git a/server/host/team-connections-host.ts b/server/host/team-connections-host.tsindex e9c79cd793..7ba87f0375 100644--- a/server/host/team-connections-host.ts+++ b/server/host/team-connections-host.ts@@ -280,9 +280,10 @@ export function createTeamConnectionsHost(deps: TeamConnectionsHostDeps) {* could not use that app: no connected-apps bridge in the turn or none its tool selection allows, a `person` app, one* its scopes or grants leave out, or one `blocked` refuses; a card only where it may call COMPOSIO_MANAGE_CONNECTIONS.* Undefined when no server stands for an app. Never waits: the apps connected are the ones read last. */- mcpServerApps(bot: Bot, input: { servers: Record<string, McpServerSpec>; bridged: boolean; blocked(slug: string): string | undefined }): ((name: string, url: string) => McpServerApp | null) | undefined {+ mcpServerApps(bot: Bot, input: { servers: Readonly<Record<string, unknown>>; bridged: boolean; blocked(slug: string): string | undefined }): ((name: string, url: string) => McpServerApp | null) | undefined {if (!input.bridged || bot.composio === false || !canUseMcpServer(bot.toolScope, "composio")) return undefined;- if (!Object.entries(input.servers).some(([name, spec]) => "url" in spec && typeof spec.url === "string" && knownMcpServerApp(name, spec.url))) return undefined;+ const urlOf = (spec: unknown) => (spec && typeof spec === "object" && "url" in spec && typeof spec.url === "string" ? spec.url : null);+ if (!Object.entries(input.servers).some(([name, spec]) => { const url = urlOf(spec); return url !== null && knownMcpServerApp(name, url); })) return undefined;const connected = connectedApps.get(appsKey())?.apps ?? [], apps = personApps();const card = allowsTool(bot.toolScope, { kind: "mcp", server: "composio", name: "COMPOSIO_MANAGE_CONNECTIONS" });return (name, url) => {diff --git a/server/index.ts b/server/index.tsindex 4a91a6a378..4831fa7cc6 100644--- a/server/index.ts+++ b/server/index.ts@@ -8271,7 +8271,7 @@ async function beginTurn({ id: "plan", label: "Surface", text: surfacePrompt({ computer: mountedComputer, browser: Boolean(integrations.browser) }, { pinned: plan.pinned, note: plan.note + vpsUnavailableNote + vmUpdateNote + (computerSkipped && plan.computer !== "off" ? computerSkippedNote(redactSecretsInText(computerSkipped)) : "") + (computerSelectionTurns.get(threadId)?.handoff && !integrations.browser ? HANDOFF_BROWSER_NOTE : ""), canSelect: computerSelectionTurns.has(threadId) && !computerSelectionTurns.get(threadId)?.handoff, selectionRules: !selectionRulesStable, cloudHome: Boolean(CLOUD_HOME), botOpened: plan.botOpened, ownComputer: CLOUD_HOME && integrations.agents && lendingEnabled() ? sharedComputers.known(CLOUD_HOME_LENDER, typingSession) : undefined, lentToServer: lentToServer(integrations.agents, { botId: bot.id, threadId, generation: dispatchClaimId }), thisComputer: !CLOUD_HOME && bot.computer !== "off" && !inheritedTeamComputer(bot) && shouldMountLocalComputer({ requested: "local", providerSupportsLocal: instance.adapter.capabilities.localComputerMcp === true }) ? { bot: bot.name, botId: bot.id, platform: process.platform } : undefined }) }, { id: "computer-selection", label: "Choosing a computer", text: selectionRulesStable ? computerSelectionPrompt({ cloudHome: Boolean(CLOUD_HOME) }) : "" },{ id: "cloud-home", label: "My Cloud", text: CLOUD_HOME ? cloudHomePrompt(Boolean(integrations.agents) && lendingEnabled(), syncedFolders(DATA_DIR), sharedComputers.known(CLOUD_HOME_LENDER, typingSession), CLOUD_PERSONAL) + firstHourHooks.prompt(bot.id, threadId) : "" }, phoneLinkPart(),{ id: "composio", label: "Connected apps", text: integrations.composio ? composioSystemPrompt(liveBot?.connectorTools ?? bot.connectorTools) + describeConnectorScopes((liveBot ?? bot).connectorScopes) : "" },- { id: "mcp", label: "MCP servers", text: customMcpPrompt(Object.keys(integrations.custom ?? {}), mcpServersHost.off(bot)) }, { id: "to-connect", label: "Connections to make", text: cloudConnections.prompt(liveBot ?? bot, lentMcp.lines(liveBot ?? bot, { botId: bot.id, threadId, generation: dispatchClaimId })) + teamConnections.prompt(threadId, dispatchClaimId, integrations) },+ { id: "mcp", label: "MCP servers", text: customMcpPrompt(Object.keys(integrations.custom ?? {}), mcpServersHost.off(bot)) }, { id: "to-connect", label: "Connections to make", text: cloudConnections.prompt(liveBot ?? bot, lentMcp.lines(liveBot ?? bot, { botId: bot.id, threadId, generation: dispatchClaimId }), teamConnections.mcpServerApps(liveBot ?? bot, { servers: cfg.mcpServers ?? {}, bridged: Boolean(integrations.composio), blocked: (slug) => managedPolicy.appsConnectRefusal([slug]) })) + teamConnections.prompt(threadId, dispatchClaimId, integrations) },{ id: "browser", label: "Browser", text: integrations.browser ? browserPromptFor(bot, Boolean(integrations.agents)) : "" },{ id: "data", label: "Data", text: integrations.data ? dataPrompt(bot.id, threadId, providerText) : "" },{ id: "email", label: "Email", text: instance.adapter.capabilities.emailMcp === true ? emailHost.prompt(liveBot ?? bot) : "" }, { id: "meetings", label: "Meetings", text: meetingsUnavailablePrompt({ agentsTools: Boolean(integrations.agents), cloudComputer: boat.boatConfigured(cfg) }) }, toolsOffPart(liveBot ?? bot),diff --git a/server/mcp-server-app.test.ts b/server/mcp-server-app.test.tsindex 3b4c28cce2..bb57f88437 100644--- a/server/mcp-server-app.test.ts+++ b/server/mcp-server-app.test.ts@@ -1,7 +1,7 @@import { describe, expect, it } from "vitest";import { CURATED_CONNECTOR_SLUGS } from "../shared/connector-curated.ts";-import { knownMcpServerApp } from "./mcp-server-app.ts";+import { knownMcpServerApp, signsInOnlyElsewhere } from "./mcp-server-app.ts";describe("the connected app an MCP server stands for", () => {it.each([@@ -13,6 +13,12 @@ describe("the connected app an MCP server stands for", () => {["google-calendar", "https://mcp.example/", "googlecalendar"],["googlecalendar-mcp", "https://mcp.example/", "googlecalendar"],["gcal", "not a url", "googlecalendar"],+ ["any name", "https://api.cursor.com/rest-mcp/google-drive/mcp", "googledrive"],+ ["any name", "https://api.cursor.com/rest-mcp/google-sheets/mcp", "googlesheets"],+ ["any name", "https://API.cursor.com/rest-mcp/google-docs/mcp", "googledocs"],+ ["google-drive", "https://mcp.example/", "googledrive"],+ ["Google_Sheets", "https://mcp.example/", "googlesheets"],+ ["googledocs-mcp", "https://mcp.example/", "googledocs"],])("knows %s at %s as %s", (name, url, slug) => {expect(knownMcpServerApp(name, url)?.slug).toBe(slug);});@@ -29,13 +35,26 @@ describe("the connected app an MCP server stands for", () => {["calendar", "https://cal.example/mcp"],["drive", "https://drivemcp.googleapis.com/mcp/v1"],["anything", "https://gmailmcp.googleapis.com.example/mcp"],+ ["anything", "https://api.cursor.com/rest-mcp/google-slides/mcp"],+ ["anything", "https://api.cursor.com/other/google-drive/mcp"],+ ["anything", "https://api.cursor.com.example/rest-mcp/google-drive/mcp"],+ ["drive-sync", "https://mcp.example/"],+ ["google-docs-export", "https://mcp.example/"],])("leaves %s at %s alone", (name, url) => {expect(knownMcpServerApp(name, url)).toBeNull();});it("names only apps the connected-apps catalog has", () => {- for (const [name, url] of [["gmail", ""], ["gcal", ""]] as const) {+ for (const [name, url] of [["gmail", ""], ["gcal", ""], ["google-drive", ""], ["google-sheets", ""], ["google-docs", ""]] as const) {expect(CURATED_CONNECTOR_SLUGS).toContain(knownMcpServerApp(name, url)!.slug);}});++ it("knows which servers can sign in only elsewhere, whatever app they are for", () => {+ expect(signsInOnlyElsewhere("https://api.cursor.com/rest-mcp/google-slides/mcp")).toBe(true);+ expect(signsInOnlyElsewhere("https://api.cursor.com/rest-mcp/google-drive/mcp")).toBe(true);+ expect(signsInOnlyElsewhere("https://api.cursor.com/other/google-drive/mcp")).toBe(false);+ expect(signsInOnlyElsewhere("https://mcp.example/rest-mcp/google-drive/mcp")).toBe(false);+ expect(signsInOnlyElsewhere("not a url")).toBe(false);+ });});diff --git a/server/mcp-server-app.ts b/server/mcp-server-app.tsindex 76cfb336f5..ed2444f959 100644--- a/server/mcp-server-app.ts+++ b/server/mcp-server-app.ts@@ -8,15 +8,45 @@ export interface McpServerApp { slug: string; label: string; connected: booleantype KnownApp = { slug: CuratedConnectorSlug; label: string };const GMAIL: KnownApp = { slug: "gmail", label: "Gmail" };const CALENDAR: KnownApp = { slug: "googlecalendar", label: "Google Calendar" };+const DRIVE: KnownApp = { slug: "googledrive", label: "Google Drive" };+const SHEETS: KnownApp = { slug: "googlesheets", label: "Google Sheets" };+const DOCS: KnownApp = { slug: "googledocs", label: "Google Docs" };const BY_HOST: Record<string, KnownApp> = { "gmailmcp.googleapis.com": GMAIL, "calendarmcp.googleapis.com": CALENDAR };+/** Another editor's hosted Google servers, `/rest-mcp/<app>/mcp`, which sign in only from that editor (Google refuses this+ * app's address as the sign-in's return address): one copied here stands for the connected app. */+const HOSTED: Record<string, Record<string, KnownApp>> = {+ "api.cursor.com": { "google-drive": DRIVE, "google-sheets": SHEETS, "google-docs": DOCS },+};/** At any other address, only a name that is the app's own: "gmail-filters" or "gcal2notion" is another tool. */const BY_NAME: ReadonlyArray<readonly [RegExp, KnownApp]> = [[/^gmail(?:[-_]mcp)?$/i, GMAIL],[/^(?:google[-_]?calendar|gcal(?:endar)?)(?:[-_]mcp)?$/i, CALENDAR],+ [/^google[-_]?drive(?:[-_]mcp)?$/i, DRIVE],+ [/^google[-_]?sheets(?:[-_]mcp)?$/i, SHEETS],+ [/^google[-_]?docs(?:[-_]mcp)?$/i, DOCS],];+/** The app path of a server at one of those hosted addresses, or undefined for any other address. */+function hostedPath(url: string): string | undefined {+ if (!URL.canParse(url)) return undefined;+ const { hostname, pathname } = new URL(url);+ if (!Object.hasOwn(HOSTED, hostname.toLowerCase())) return undefined;+ return /^\/rest-mcp\/([a-z-]+)(?:\/|$)/.exec(pathname)?.[1];+}++function hostedApp(url: string): KnownApp | undefined {+ const app = hostedPath(url);+ const apps = app === undefined ? undefined : HOSTED[new URL(url).hostname.toLowerCase()];+ return apps && app && Object.hasOwn(apps, app) ? apps[app] : undefined;+}++/** A server at one of those hosted addresses: its sign-in can never finish from here, whatever app it is for. */+export function signsInOnlyElsewhere(url: string): boolean {+ return hostedPath(url) !== undefined;+}+export function knownMcpServerApp(name: string, url: string): KnownApp | null {const host = URL.canParse(url) ? new URL(url).hostname.toLowerCase() : "";- return (Object.hasOwn(BY_HOST, host) ? BY_HOST[host] : undefined) ?? BY_NAME.find(([pattern]) => pattern.test(name))?.[1] ?? null;+ return (Object.hasOwn(BY_HOST, host) ? BY_HOST[host] : undefined) ?? hostedApp(url) ?? BY_NAME.find(([pattern]) => pattern.test(name))?.[1] ?? null;}