Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(main): move sign-in settling and MCP message projection out of oversized files (#3761)
Milind Soni524d0d451bea
diff --git a/scripts/mcp-message-projection.ts b/scripts/mcp-message-projection.tsnew file mode 100644index 0000000000..ec40e5250d--- /dev/null+++ b/scripts/mcp-message-projection.ts@@ -0,0 +1,76 @@+// A conversation message as the OpenMausBot MCP server shows it to an agent: its text plus the state of any card on it.+export function isRecord(value: unknown): value is Record<string, any> {+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);+}++export function projectMessage(message: Record<string, any>) {+ const card = isRecord(message.card)+ ? {+ title: message.card.title,+ subtitle: message.card.subtitle,+ options: message.card.options,+ answered: message.card.answered,+ dismissed: message.card.dismissed,+ expired: message.card.expired,+ }+ : undefined;+ const tool = isRecord(message.tool)+ ? { name: message.tool.name, ok: message.tool.ok, spoken: message.tool.spoken, setup: message.tool.setup,+ ...(message.tool.terminal === true ? { terminal: true } : {}),+ }+ : undefined;+ const connector = isRecord(message.connector)+ ? {+ slug: message.connector.slug,+ label: message.connector.label,+ description: message.connector.description,+ status: message.connector.status,+ dismissed: message.connector.dismissed,+ resumed: message.connector.resumed,+ }+ : undefined;+ const secret = isRecord(message.secret)+ ? {+ target: message.secret.target,+ label: message.secret.label,+ description: message.secret.description,+ placeholder: message.secret.placeholder,+ helpUrl: message.secret.helpUrl,+ provided: message.secret.provided,+ dismissed: message.secret.dismissed,+ superseded: message.secret.superseded,+ resumed: message.secret.resumed,+ }+ : undefined;+ const signIn = isRecord(message.signIn)+ ? {+ site: message.signIn.site,+ url: message.signIn.url,+ place: message.signIn.place,+ reason: message.signIn.reason,+ done: message.signIn.done,+ cancelled: message.signIn.cancelled,+ superseded: message.signIn.superseded,+ answeredInChat: message.signIn.answeredInChat,+ resumed: message.signIn.resumed,+ }+ : undefined;+ return {+ id: message.id,+ at: message.at,+ role: message.role,+ kind: message.kind,+ text: message.text,+ from: message.from,+ replyToId: message.replyToId,+ reactions: message.reactions,+ steered: message.steered,+ queued: message.queued,+ ...(tool ? { tool } : {}),+ ...(card ? { card } : {}),+ ...(connector ? { connector } : {}),+ ...(secret ? { secret } : {}),+ ...(signIn ? { signIn } : {}), ...(message.widget ? { widget: message.widget } : {}), ...(message.app ? { app: message.app } : {}), ...(message.fromApp ? { fromApp: message.fromApp } : {}),+ ...(message.kind === "screen" ? { hasImage: Boolean(message.hasImage || message.png) } : {}),+ };+}diff --git a/scripts/mcp-server.ts b/scripts/mcp-server.tsindex 82b005430a..00a6468fae 100644--- a/scripts/mcp-server.ts+++ b/scripts/mcp-server.ts@@ -2,6 +2,7 @@// Model Context Protocol (MCP) server for OpenMausBot over JSON-RPC 2.0 stdio,// for external agents (Hermes, Claude Desktop, Cursor, etc.).import readline from "node:readline";+import { isRecord, projectMessage } from "./mcp-message-projection.ts";export function validateBaseUrl(url: string): string {const trimmed = url.replace(/\/+$/, "");@@ -477,9 +478,6 @@ function parsePositiveLimit(raw: unknown, fallback = 30, maximum = 200): numberreturn Number.isFinite(parsed) && parsed > 0 ? Math.min(parsed, maximum) : fallback;}-function isRecord(value: unknown): value is Record<string, any> {- return Boolean(value) && typeof value === "object" && !Array.isArray(value);-}function valueHasType(value: unknown, type: string): boolean {if (type === "null") return value === null;@@ -645,78 +643,6 @@ function projectChannel(channel: Record<string, any>) {};}-function projectMessage(message: Record<string, any>) {- const card = isRecord(message.card)- ? {- title: message.card.title,- subtitle: message.card.subtitle,- options: message.card.options,- answered: message.card.answered,- dismissed: message.card.dismissed,- expired: message.card.expired,- }- : undefined;- const tool = isRecord(message.tool)- ? { name: message.tool.name, ok: message.tool.ok, spoken: message.tool.spoken, setup: message.tool.setup,- ...(message.tool.terminal === true ? { terminal: true } : {}),- }- : undefined;- const connector = isRecord(message.connector)- ? {- slug: message.connector.slug,- label: message.connector.label,- description: message.connector.description,- status: message.connector.status,- dismissed: message.connector.dismissed,- resumed: message.connector.resumed,- }- : undefined;- const secret = isRecord(message.secret)- ? {- target: message.secret.target,- label: message.secret.label,- description: message.secret.description,- placeholder: message.secret.placeholder,- helpUrl: message.secret.helpUrl,- provided: message.secret.provided,- dismissed: message.secret.dismissed,- superseded: message.secret.superseded,- resumed: message.secret.resumed,- }- : undefined;- const signIn = isRecord(message.signIn)- ? {- site: message.signIn.site,- url: message.signIn.url,- place: message.signIn.place,- reason: message.signIn.reason,- done: message.signIn.done,- cancelled: message.signIn.cancelled,- superseded: message.signIn.superseded,- answeredInChat: message.signIn.answeredInChat,- resumed: message.signIn.resumed,- }- : undefined;- return {- id: message.id,- at: message.at,- role: message.role,- kind: message.kind,- text: message.text,- from: message.from,- replyToId: message.replyToId,- reactions: message.reactions,- steered: message.steered,- queued: message.queued,- ...(tool ? { tool } : {}),- ...(card ? { card } : {}),- ...(connector ? { connector } : {}),- ...(secret ? { secret } : {}),- ...(signIn ? { signIn } : {}), ...(message.widget ? { widget: message.widget } : {}), ...(message.app ? { app: message.app } : {}), ...(message.fromApp ? { fromApp: message.fromApp } : {}),- ...(message.kind === "screen" ? { hasImage: Boolean(message.hasImage || message.png) } : {}),- };-}-async function fleet(fetcher: (path: string, options?: RequestInit) => Promise<any>) {return fetcher("/api/bots?messages=0");}diff --git a/server/host/sign-in-settle.ts b/server/host/sign-in-settle.tsnew file mode 100644index 0000000000..10eae66d72--- /dev/null+++ b/server/host/sign-in-settle.ts@@ -0,0 +1,76 @@+// How a sign-in card settles: Done or Cancel on the card, a saved login filling it, or the person's own line in the+// conversation, which answers every sign-in request still open there.+import { savedLoginResumePrompt } from "../../shared/logins.ts";+import { signInOutcome, signInResumePrompt, signInWaits } from "../../shared/sign-in-request.ts";+import type { HandoffView } from "../coordinator.ts";+import type { BotRecord, Message, Store } from "../store.ts";+import type { Surface } from "../surface.ts";++export interface SignInSettleDeps {+ store: Pick<Store, "activePath" | "bot" | "patchMessage">;+ signInMessage(botId: string, threadId: string, messageId: string): Message | null;+ answerCardNode(threadId: string, messageId: string, text: string): boolean;+ releaseCardNode(threadId: string, messageId: string, reason: string): void;+ resumableCards(threadId: string, since: number): Array<{ id: string }>;+ parkedDirect(threadId: string): HandoffView | undefined;+ /** Ends the card's plea for help and returns the computers it held. */+ settleHelp(messageId: string): string[];+ handBackBrowser(bot: BotRecord, threadId: string): void;+ releaseComputer(key: string): void;+ computerKey(bot: BotRecord): string;+}++export type SignInSettled = { status: number; body: Record<string, unknown> };++export function createSignInSettle(deps: SignInSettleDeps) {+ const { store } = deps;++ /** The person is through with the place the card lent them: its plea goes, and the browser or computer goes back to the bot. */+ const handPlaceBack = (bot: BotRecord, threadId: string, messageId: string, place: Surface): void => {+ const pleaded = deps.settleHelp(messageId);+ if (place === "browser") deps.handBackBrowser(bot, threadId);+ else for (const key of pleaded.length ? pleaded : [deps.computerKey(bot)]) deps.releaseComputer(key);+ };++ const settle = (botId: string, threadId: string, messageId: string, outcome: "done" | "cancelled", saved?: { site: string }): SignInSettled => {+ const bot = store.bot(botId);+ const message = deps.signInMessage(botId, threadId, messageId);+ if (!bot || !message?.signIn) return { status: 404, body: { error: "no such sign-in request" } };+ const card = message.signIn;+ if (card.superseded) return { status: 409, body: { error: "this sign-in request was superseded by a newer one" } };+ if (card.answeredInChat) return { status: 409, body: { error: "this sign-in request was already answered in the chat" } };+ const settled = signInOutcome(card);+ if (settled && settled !== outcome) {+ return { status: 409, body: { error: `this sign-in request was already ${settled === "done" ? "marked done" : "cancelled"}` } };+ }+ if (settled && card.resumed) return { status: 200, body: { [outcome]: true, resumed: true } };+ if (!settled) handPlaceBack(bot, threadId, message.id, card.place);+ const savedLogin = saved?.site ?? card.savedLogin;+ const resumed = deps.answerCardNode(threadId, message.id, savedLogin ? savedLoginResumePrompt(savedLogin) : signInResumePrompt(card.site, outcome));+ store.patchMessage(threadId, message.id, {+ signIn: { ...card, ...(outcome === "done" ? { done: true } : { cancelled: true }), ...(savedLogin ? { savedLogin } : {}), ...(resumed ? { resumed: true, error: undefined } : {}) },+ });+ return { status: 200, body: { [outcome]: true, resumed, ...(savedLogin ? { saved: true, site: savedLogin } : {}) } };+ };++ /** The person's own line answers every sign-in request still open in their conversation, as Done would, and ends the+ * work parked on those cards: the turn the line starts goes on with the conversation, so nothing resumes it twice. */+ const answerInChat = (botId: string, threadId: string): void => {+ const bot = store.bot(botId);+ if (!bot) return;+ const answered: string[] = [];+ for (const message of store.activePath(threadId)) {+ const card = message.signIn;+ if (message.kind !== "signin" || !card || card.stopped || !signInWaits(card)) continue;+ handPlaceBack(bot, threadId, message.id, card.place);+ store.patchMessage(threadId, message.id, { signIn: { ...card, answeredInChat: true, error: undefined } });+ answered.push(message.id);+ }+ const parked = deps.parkedDirect(threadId);+ const card = parked?.cards?.find((id) => answered.includes(id));+ if (!parked || !card || deps.resumableCards(threadId, parked.startedAt ?? parked.createdAt).some((open) => parked.cards!.includes(open.id))) return;+ deps.releaseCardNode(threadId, card, "The person answered in the chat");+ };++ return { settle, answerInChat };+}diff --git a/server/index.ts b/server/index.tsindex 823c00efd6..a1412f5afb 100644--- a/server/index.ts+++ b/server/index.ts@@ -48,9 +48,10 @@ import {isCredentialTargetId,type CredentialTargetId,} from "../shared/credential-request.ts";-import { isPendingSignInRequest, normalizeSignInSite, signInFallbackText, signInOutcome, signInResumePrompt, signInWaits } from "../shared/sign-in-request.ts";+import { isPendingSignInRequest, normalizeSignInSite, signInFallbackText, signInOutcome, signInResumePrompt } from "../shared/sign-in-request.ts";import { createRoomTurnLevels } from "./room-turn-level.ts";+import { createSignInSettle } from "./host/sign-in-settle.ts";import { RoomMemberLock } from "./room-member-lock.ts";import { approvalHeldNote, approvalHeldReason, approvalModeForOrigin, autoVerdict, deliverFullAccessApproval, undeliveredApprovalTool } from "./auto-approve.ts";import { bindSafetyFloor, denyAtSafetyFloor, heldAtSafetyFloor, safetyFloorOn } from "./safety-floor-gate.ts";@@ -446,7 +447,7 @@ import { BotLogins, cardLoginPlace, cardSignInElsewhere, observeSignInPage, typeimport { relayFrame } from "./browser-relay.ts";import { browserEvidence, stepContext } from "./browser-steps.ts";import { parseLoginFields, parseTotpField, createLoginRoutes } from "./routes/logins.ts";-import { loginSite, savedLoginResumePrompt } from "../shared/logins.ts";+import { loginSite } from "../shared/logins.ts";import { browserRestartRefusal } from "./browser-live.ts";import { browserEngineStatus } from "./browser-engine.ts";import { chromeLauncher } from "./browser/chrome/launcher.ts";@@ -7547,7 +7548,7 @@ async function acceptDirectSend(});store.setTaskAskedAt(botId, threadId, message.at);handoffs.steered(threadId, steerTarget, instance?.instanceId, message.id);- answerSignInsInChat(botId, threadId);+ signInSettle.answerInChat(botId, threadId);return { ok: true as const, steered: true as const, threadId, message };}if (!current.busy) {@@ -7914,7 +7915,7 @@ async function startTurn(queueMicrotask(drainQueuedSends);return userMessage;}- if (personLine) answerSignInsInChat(bot.id, threadId);+ if (personLine) signInSettle.answerInChat(bot.id, threadId);const setupLine = takeSetupRequest(store, { botId: bot.id, threadId, line: userMessage, person: personLine, editedFrom: opts?.editedMessageId, mounted: instance.adapter.capabilities.agentsMcp === true }); if (setupLine) { userMessage = setupLine; providerText = setupTurnText(setupLine, usesNativeImageInput); } if (route.quickModel && !opts?.cardContinuation && userMessage.quickModel !== route.quickModel) userMessage = store.patchMessage(threadId, userMessage.id, { quickModel: route.quickModel }) ?? userMessage;const recoveryUserMessageId = opts?.coordination? store.activePath(threadId).findLast(m => m.role === "user" && m.kind === "text")?.id@@ -11960,53 +11961,12 @@ function signInMessage(botId: string, threadId: string, messageId: string): Messreturn message?.kind === "signin" && message.signIn ? message : null;}-function settleSignIn(botId: string, threadId: string, messageId: string, outcome: "done" | "cancelled", saved?: { site: string }):- { status: number; body: Record<string, unknown> } {- const bot = store.bot(botId);- const message = signInMessage(botId, threadId, messageId);- if (!bot || !message?.signIn) return { status: 404, body: { error: "no such sign-in request" } };- const card = message.signIn;- if (card.superseded) return { status: 409, body: { error: "this sign-in request was superseded by a newer one" } };- if (card.answeredInChat) return { status: 409, body: { error: "this sign-in request was already answered in the chat" } };- const settled = signInOutcome(card);- if (settled && settled !== outcome) {- return { status: 409, body: { error: `this sign-in request was already ${settled === "done" ? "marked done" : "cancelled"}` } };- }- if (settled && card.resumed) return { status: 200, body: { [outcome]: true, resumed: true } };- if (!settled) handSignInPlaceBack(bot, threadId, message.id, card.place);- const savedLogin = saved?.site ?? card.savedLogin;- const resumed = answerCardNode(threadId, message.id, savedLogin ? savedLoginResumePrompt(savedLogin) : signInResumePrompt(card.site, outcome));- store.patchMessage(threadId, message.id, {- signIn: { ...card, ...(outcome === "done" ? { done: true } : { cancelled: true }), ...(savedLogin ? { savedLogin } : {}), ...(resumed ? { resumed: true, error: undefined } : {}) },- });- return { status: 200, body: { [outcome]: true, resumed, ...(savedLogin ? { saved: true, site: savedLogin } : {}) } };-}--/** The person is through with the place the card lent them: its plea goes, and the browser or computer goes back to the bot. */-function handSignInPlaceBack(bot: BotRecord, threadId: string, messageId: string, place: Surface): void {- const pleaded = computerControl.settleHelp(messageId);- if (place === "browser") browserLive.handBack(currentBrowserSession(bot.id, bot.browserProfile, teamHost.browserAudience(threadId)));- else for (const key of pleaded.length ? pleaded : [botComputerControlKey(bot)]) computerControl.release(key);-}--/** The person's own line answers every sign-in request still open in their conversation, as Done would, and ends the- * work parked on those cards: the turn the line starts goes on with the conversation, so nothing resumes it twice. */-function answerSignInsInChat(botId: string, threadId: string): void {- const bot = store.bot(botId);- if (!bot) return;- const answered: string[] = [];- for (const message of store.activePath(threadId)) {- const card = message.signIn;- if (message.kind !== "signin" || !card || card.stopped || !signInWaits(card)) continue;- handSignInPlaceBack(bot, threadId, message.id, card.place);- store.patchMessage(threadId, message.id, { signIn: { ...card, answeredInChat: true, error: undefined } });- answered.push(message.id);- }- const parked = coordinator.parkedDirect(threadId);- const card = parked?.cards?.find((id) => answered.includes(id));- if (!parked || !card || resumableCards(threadId, parked.startedAt ?? parked.createdAt).some((open) => parked.cards!.includes(open.id))) return;- releaseCardNode(threadId, card, "The person answered in the chat");-}+const signInSettle = createSignInSettle({+ store, signInMessage, answerCardNode, releaseCardNode, resumableCards,+ parkedDirect: (threadId) => coordinator.parkedDirect(threadId), settleHelp: (messageId) => computerControl.settleHelp(messageId),+ handBackBrowser: (bot, threadId) => browserLive.handBack(currentBrowserSession(bot.id, bot.browserProfile, teamHost.browserAudience(threadId))),+ releaseComputer: (key) => computerControl.release(key), computerKey: botComputerControlKey,+});/** The open sign-in card the person is answering, and the page its bot's browser shows (null when none a login could fill). */async function signInCardPage(botId: string, threadId: string, messageId: string):@@ -12046,7 +12006,7 @@ async function saveLoginFromCard(botId: string, threadId: string, messageId: strconst place = cardLoginPlace(page.cardHost, page.observed, body.signInHost);logins.create({ ...place, username: fields.value.username ?? "", password: fields.value.password!, totp: totp.value ?? null, source: "card", bots: [botId] });const elsewhere = place.hosts.filter((host) => loginSite(host) !== place.site);- return settleSignIn(botId, threadId, messageId, "done", { site: [place.site, ...elsewhere].join(" and ") });+ return signInSettle.settle(botId, threadId, messageId, "done", { site: [place.site, ...elsewhere].join(" and ") });}/** Saved logins appear by site and username only. */@@ -12629,7 +12589,7 @@ ROUTES.push(createBotMemoryRoutes({const teamMoveIn = CLOUD_TEAM ? createTeamMoveIn({ team: CLOUD_TEAM, dataDir: DATA_DIR, sessions, store, routines: () => routines, library: () => readSkillLibraryIndex(), starters: threadStarters }) : null; const cloudSendOwner = (auth: RequestAuth) => teamMoveIn ? teamMoveIn.owner(auth) : CLOUD_HOME && auth.kind === "session" && auth.scopes.includes("admin") ? { person: actorKey(auth), name: cfg.profile?.name?.trim() || "User" } : null; const botMoves = CLOUD_PERSONAL ? createBotMoves({ store, routines: () => routines, webhooks: () => webhooks, appEvents: () => appTriggers.manager, busy: (id) => botHasActiveTurn(id) || Boolean(routines?.activeRunForBot(id)) }) : null; ROUTES.push(createBotMoveRoutes({ moves: botMoves, enabled: CLOUD_PERSONAL })); if (teamMoveIn) { ROUTES.unshift(teamMoveIn.guard); ROUTES.push(teamMoveIn.routes); teamOwners.backfill(teamMoveIn.list()); } ROUTES.push(createDeciderRoutes({ decider, extractor, config: () => cfg }), createTtsRoutes({ config: () => cfg }), createHelperSuggestionRoutes({ notNow: proactive.suggestionNotNow }), createSetupRequestRoutes({ store, language: () => appLanguage() ?? Intl.DateTimeFormat().resolvedOptions().locale, sendRefusal: cloudGuestSendRefusal, presser: (auth) => setupPresser(sharedMembership(), auth, messageSender(auth)), canSetUp: (botId, threadId) => registry.get(store.projectBotForTask(botId, threadId)?.modelSelection.instanceId ?? "")?.adapter.capabilities.agentsMcp === true, send: (auth, botId, threadId, text) => acceptDirectSend({ botId, threadId, text, sender: messageSender(auth), trigger: usageTriggerFor(auth), personPresent: auth.kind === "session" || DESKTOP_MANAGED }) }), createNotificationRoutes(undefined, threadShown, CLOUD_TEAM ? (auth, entry) => teamOwners.routing.notificationReaches(teamOwners.viewer(auth), entry) : undefined), createUpdateCheckRoutes({ check: serverUpdateChecker({ desktopManaged: DESKTOP_MANAGED, managed: Boolean(CLOUD_HOME || HOSTED_WORKSPACE) }) }), createTimeZoneRoutes({ adopts: Boolean(CLOUD_HOME), dataDir: DATA_DIR, changed: () => routines?.rescheduleLocalTimes() }), createCloudSendRoutes({ appVersion: serverVersion(), ...(CLOUD_TEAM ? { refusal: personalMoveRefusal(CLOUD_TEAM), scope: (auth) => teamMoveIn?.scope(auth) ?? null } : {}), bots: () => store.bots, messagesTail: (threadId, limit) => store.messagesTail(threadId, limit), skills: (bot) => listSkills(bot.id), logins, config: () => cfg, chats: { store, dataDir: DATA_DIR, owner: cloudSendOwner, ...(CLOUD_OWNER_KEY ? { ownerKey: CLOUD_OWNER_KEY } : {}), stamped: (threadId) => ownerOnlyCache.delete(threadId), instanceExists: (id) => Boolean(registry.get(id)), approvalSupported: (selection, mode) => supportsApprovalMode(selection, mode) }, cloudHome: Boolean(CLOUD_HOME), automations: { routines: () => routines, calls: () => calendarCalls, webhooks: () => webhooks, appEvents: () => appTriggers.manager }, connections: () => cloudConnections.connections(), connectionFingerprints: (nonce) => cloudConnections.fingerprints(nonce), move: { dataDir: DATA_DIR, store, routines: () => routines, calls: () => calendarCalls, webhooks: () => webhooks, appEvents: () => appTriggers.manager, claudeCodeSkills: () => (claudeUserSkillsEnabled(cfg) ? claudeCodeSkillInputs() : []), instanceExists: (id) => Boolean(registry.get(id)), owner: cloudSendOwner, ownRoutine: (routine, person) => { cloudRoutineAuthors?.record(routine.id, routine); cloudRoutineAuthors?.wrote(routine.id, person); }, arrived: () => ownerOnlyCache.clear(), teamMemory, aboutMe: () => cfg.profile?.aboutMe ?? "", saveAboutMe: (text) => { saveConfig({ profile: { ...cfg.profile, aboutMe: text } }); Object.assign(cfg, loadConfig()); broadcast({ kind: "config", ...configStatus() }); } } }), cloudConnections.routes, createTodayRoutes({ visibleFor: (auth) => visibleTo(viewerFor(auth)), ...(teamOwners.asks ? { asks: teamOwners.asks, messages: teamMessages.needsYou } : {}), sources: () => ({ bots: store.bots, groups: store.groups, routines, parked: coordinator.active(), engines: registry.instances().map((instance) => ({ instanceId: instance.instanceId, snapshot: registry.lastSnapshot(instance.instanceId) })) }) }), createInboxRoutes(teamMessages));if (CLOUD_TEAM) teamHost.adoptServerProfile(sessions.list().flatMap((session) => session.email ? [session.email] : []));ROUTES.push(createSidebarSectionRoutes({ store, teamComputers, maxBots: MAX_WORKSPACE_BOTS, assertTeamComputerChangeIdle, wireBot }), createPresenceRoutes({ isOwner: ownerOrAdmin, active: async (source, zone, language) => { const answer = await proactive.brief.active(source, zone, language); firstHourHooks.arrived(); return answer; }, ...(CLOUD_TEAM ? { member: teamMessages.arrived } : {}) }), createMeRoutes({ team: CLOUD_TEAM, session: (auth) => (auth.kind === "session" ? auth.session : null), profile: teamHost.memberProfile, save: teamHost.saveMemberProfile, seed: teamHost.seedMemberProfile, seeded: teamHost.seededFields, changed: () => broadcast({ kind: "config", ...configStatus() }) }), createTeamPhoneRoutes({ team: CLOUD_TEAM, sessions, publicBase: (req, auth) => publicUrl() ?? (auth.kind === "session" ? requestOrigin(req) : null) }),- createTeamConnectionRoutes({ host: teamConnections, cfg: () => cfg, composio, publicOrigin: CLOUD_HOME?.publicOrigin ?? null, record: (auth, row) => appendAdminAction(DATA_DIR, { ...row, actor: decisionActorFor(auth) }) }), createSignInCardRoutes({ settle: settleSignIn, saveLogin: (botId, threadId, messageId, body, auth) => CLOUD_TEAM && !auth.scopes.includes("admin") ? Promise.resolve({ status: 403 as const, body: { error: memberLoginRefusal(CLOUD_TEAM) } }) : saveLoginFromCard(botId, threadId, messageId, body), saveTarget: signInSaveTarget, threadVisible: (auth, threadId) => visibleTo(viewerFor(auth)).thread(threadId) }));+ createTeamConnectionRoutes({ host: teamConnections, cfg: () => cfg, composio, publicOrigin: CLOUD_HOME?.publicOrigin ?? null, record: (auth, row) => appendAdminAction(DATA_DIR, { ...row, actor: decisionActorFor(auth) }) }), createSignInCardRoutes({ settle: signInSettle.settle, saveLogin: (botId, threadId, messageId, body, auth) => CLOUD_TEAM && !auth.scopes.includes("admin") ? Promise.resolve({ status: 403 as const, body: { error: memberLoginRefusal(CLOUD_TEAM) } }) : saveLoginFromCard(botId, threadId, messageId, body), saveTarget: signInSaveTarget, threadVisible: (auth, threadId) => visibleTo(viewerFor(auth)).thread(threadId) }));ROUTES.push(createRoomHoldRoutes({group: (id) => store.group(id),setHold: (groupId, botId, held) => {