Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
feat(auth): one-click terminal sign-in card, and stop every bot's work without pausing
milind-soni19a23b824001
diff --git a/packages/phone-protocol/src/wire.ts b/packages/phone-protocol/src/wire.tsindex de0e006c02..295d15c5fa 100644--- a/packages/phone-protocol/src/wire.ts+++ b/packages/phone-protocol/src/wire.ts@@ -977,8 +977,8 @@ export type ServerFrame =| { kind: "app-trigger.deleted"; triggerId: string }| { kind: "app-trigger.service"; service: AppTriggerService }| { kind: "runtime"; event: RuntimeEvent }- /** An MCP server was added, changed or removed: a list of them is stale. */- | { kind: "mcp.changed" }+ /** An MCP server was added, changed or removed: a list of them is stale. `cli-login`: a terminal sign-in waits or was answered (admins only). */+ | { kind: "mcp.changed" } | { kind: "cli-login" }/** `surface` names what the frame shows: the bot's desktop (`computer`) or its built-in browser. */| { kind: "screen"; botId: string; threadId: string; png: string; mime?: string; surface?: "browser" | "computer" }/** A bot's computer is being set up or woken for a turn; the chat showsdiff --git a/server/cli-login.e2e.test.ts b/server/cli-login.e2e.test.tsnew file mode 100644index 0000000000..b638256311--- /dev/null+++ b/server/cli-login.e2e.test.ts@@ -0,0 +1,94 @@+import { createHash, randomBytes } from "node:crypto";+import { afterAll, beforeAll, describe, expect, it } from "vitest";++import { launchVerificationServer, type VerificationServer } from "../scripts/control-omb.ts";++describe("a terminal signs in with one click in the desktop app", () => {+ let fixture: VerificationServer;+ const owner = randomBytes(32).toString("base64url");+ const call = async (method: string, path: string, body?: unknown, headers: Record<string, string> = {}) => {+ const response = await fetch(`${fixture.info.url}${path}`, {+ method, headers: { "content-type": "application/json", ...headers }, ...(body === undefined ? {} : { body: JSON.stringify(body) }),+ });+ return { status: response.status, body: await response.json().catch(() => ({})) as Record<string, any> };+ };+ const asApp = (method: string, path: string, body?: unknown) => call(method, path, body, { "x-openmausbot-desktop-owner": owner, origin: fixture.info.url });+ const ask = async (scope?: "client") => {+ const verifier = randomBytes(32).toString("base64url");+ const verifierHash = createHash("sha256").update(verifier).digest("base64url");+ const started = await call("POST", "/api/auth/cli-login", { label: "openmausbot CLI on test", verifierHash, ...(scope ? { scope } : {}) });+ return { ...started, verifier, poll: (secret = verifier) => call("POST", `/api/auth/cli-login/${started.body.id}`, { verifier: secret }) };+ };++ beforeAll(async () => {+ // The launcher names its starter bot as the app would; every request in the tests below says who sends it.+ const realFetch = globalThis.fetch;+ globalThis.fetch = (input, init = {}) => realFetch(input, { ...init, headers: { ...Object.fromEntries(new Headers(init.headers)), "x-openmausbot-desktop-owner": owner } });+ try {+ fixture = await launchVerificationServer({ ...process.env, OMB_TEST_DESKTOP_OWNER_TOKEN: owner });+ } finally {+ globalThis.fetch = realFetch;+ }+ });+ afterAll(async () => {+ await fixture?.close();+ });++ it("keeps refusing a change from a program here without a session, and gives the terminal a session only after Allow", async () => {+ const made = await asApp("POST", "/api/bots", { name: "Test Bot 1", useDefaults: false, requireAvailableModel: false });+ expect(made.status).toBe(201);+ const botId = made.body.bot.id as string;+ expect((await call("DELETE", `/api/bots/${botId}`)).status).toBe(403);++ const request = await ask();+ expect(request.status).toBe(201);+ expect(request.body.code).toMatch(/^[A-Z0-9]{4}-[A-Z0-9]{4}$/);+ expect(request.body).not.toHaveProperty("token");++ const listed = await asApp("GET", "/api/auth/cli-login");+ expect(listed.body.requests).toEqual([expect.objectContaining({ id: request.body.id, code: request.body.code, local: true, scopes: ["admin", "client"], label: "openmausbot CLI on test" })]);+ expect(JSON.stringify(listed.body)).not.toContain(request.verifier);++ expect((await request.poll()).status).toBe(202);+ expect((await request.poll(randomBytes(32).toString("base64url"))).status).toBe(404);+ expect((await call("POST", `/api/auth/cli-login/${request.body.id}/allow`, {})).status).toBe(403);+ expect((await request.poll()).body.state).toBe("waiting");++ expect(await asApp("POST", `/api/auth/cli-login/${request.body.id}/allow`, {})).toMatchObject({ status: 200, body: { state: "allowed" } });+ const collected = await request.poll();+ expect(collected.status).toBe(200);+ expect(collected.body.token).toMatch(/^omb_sess_/);+ expect(collected.body.session.scopes).toEqual(["admin", "client"]);+ expect(collected.body.environment.environmentId).toEqual(expect.any(String));+ expect((await request.poll()).status).toBe(404);++ const bearer = { authorization: `Bearer ${collected.body.token}` };+ const second = await ask("client");+ expect(await call("POST", `/api/auth/cli-login/${second.body.id}/allow`, {}, bearer)).toMatchObject({ status: 200, body: { state: "allowed" } });+ const chatOnly = (await second.poll()).body;+ expect(chatOnly.session.scopes).toEqual(["client"]);+ expect((await call("POST", "/api/turns/stop", { all: true }, { authorization: `Bearer ${chatOnly.token}` })).status).toBe(403);+ expect((await call("POST", `/api/auth/cli-login/${second.body.id}/allow`, {}, { authorization: `Bearer ${chatOnly.token}` })).status).toBe(403);+ expect((await call("POST", "/api/turns/stop", { all: true })).status).toBe(403);+ expect(await call("POST", "/api/turns/stop", { all: true }, bearer)).toMatchObject({ status: 200, body: { stopped: 0 } });+ expect((await call("DELETE", `/api/bots/${botId}`, undefined, bearer)).status).toBe(200);+ });++ it("tells the terminal it was denied, refuses a web page, and caps how many may wait", async () => {+ const denied = await ask("client");+ expect((await asApp("GET", "/api/auth/cli-login")).body.requests[0].scopes).toEqual(["client"]);+ expect((await asApp("POST", `/api/auth/cli-login/${denied.body.id}/deny`, {})).status).toBe(200);+ expect(await denied.poll()).toMatchObject({ status: 403, body: { state: "denied" } });+ expect((await asApp("POST", `/api/auth/cli-login/${denied.body.id}/allow`, {})).status).toBe(404);++ const verifierHash = createHash("sha256").update("x".repeat(43)).digest("base64url");+ expect((await call("POST", "/api/auth/cli-login", { verifierHash }, { "sec-fetch-site": "cross-site", "sec-fetch-dest": "empty" })).status).toBe(403);++ const waiting = [];+ for (let index = 0; index < 2; index++) waiting.push(await ask());+ expect(waiting.map((request) => request.status)).toEqual([201, 201]);+ expect((await ask()).status).toBe(429);+ for (const request of waiting) await asApp("POST", `/api/auth/cli-login/${request.body.id}/deny`, {});+ expect((await asApp("GET", "/api/auth/cli-login")).body.requests).toEqual([]);+ });+});diff --git a/server/cloud-team-policy.ts b/server/cloud-team-policy.tsindex 4fc77ab4cd..7d4e45282b 100644--- a/server/cloud-team-policy.ts+++ b/server/cloud-team-policy.ts@@ -13,6 +13,7 @@ import { writeFileAtomic } from "./atomic.ts";import type { CloudHomeConfig } from "./cloud-home.ts";import type { CloudTeam } from "./cloud-team.ts";import type { ManagedDesktopPolicy, ManagedPolicy } from "./managed-policy.ts";+import { CLI_LOGIN_PATH } from "../shared/cli-login.ts";import { TEAM_PHONE_PAIRING_PATH } from "./routes/team-phone.ts";import type { SessionRegistry } from "./sessions.ts";@@ -87,7 +88,7 @@ export function teamManagedPolicy(document: TeamPolicyDocument, team: Pick<Cloud* the Admin itself, reach it, so refusing `/api/auth/pair` would lock the whole team out: there, only what a member's own* code opens counts as remote access (the sessions of those codes end when the limit lands: `closeMemberPhones`). */export function remoteAccessPaths(team: boolean): readonly string[] {- return team ? ["/api/auth/pairing", TEAM_PHONE_PAIRING_PATH] : ["/api/auth/pair", "/api/pair", "/api/auth/pairing", "/api/auth/email/start", "/api/auth/email/verify"];+ return team ? ["/api/auth/pairing", TEAM_PHONE_PAIRING_PATH, CLI_LOGIN_PATH] : ["/api/auth/pair", "/api/pair", "/api/auth/pairing", "/api/auth/email/start", "/api/auth/email/verify", CLI_LOGIN_PATH];}/** What a document's refusal says of itself, for the Rules page: which key, never a value. */diff --git a/server/host/bot-holds.test.ts b/server/host/bot-holds.test.tsindex 380f630371..2dfc39ab63 100644--- a/server/host/bot-holds.test.ts+++ b/server/host/bot-holds.test.ts@@ -95,9 +95,9 @@ describe("pausing every bot", () => {});describe("the pause routes", () => {- function call(routes: ReturnType<typeof createBotHoldRoutes>, method: string, body?: unknown) {+ function call(routes: ReturnType<typeof createBotHoldRoutes>, method: string, body?: unknown, path = "/api/paused") {const out: { status?: number; body?: Record<string, unknown> } = {};- return routes({ req: {} as never, res: {} as never, url: new URL("http://x/api/paused"), path: "/api/paused", method, auth: { kind: "loopback" } as never,+ return routes({ req: {} as never, res: {} as never, url: new URL(`http://x${path}`), path, method, auth: { kind: "loopback" } as never,json: ((_res: unknown, status: number, value: Record<string, unknown>) => { out.status = status; out.body = value; }) as never,readBody: (async () => body) as never,} as RouteContext).then(() => out);@@ -108,7 +108,7 @@ describe("the pause routes", () => {const holds = make();const stop = vi.fn(async (ids: readonly string[]) => ids.length);const audit = vi.fn();- const routes = createBotHoldRoutes({ holds, stop, audit,+ const routes = createBotHoldRoutes({ holds, stop, audit, bots: () => ["ada", "bo"],named: (kind, id) => (kind === "bot" ? ({ ada: "Ada", bo: "Bo" } as Record<string, string>)[id] ?? null : id === "Sales" ? "Sales" : null) });expect(await call(routes, "POST", { kind: "bot", id: "ada", paused: true })).toMatchObject({ status: 200, body: { bots: ["ada"], heldBots: ["ada"], stopped: 1 } });@@ -133,7 +133,7 @@ describe("the pause routes", () => {const stop = vi.fn(async (ids: readonly string[]) => ids.length);const audit = vi.fn();const named = vi.fn(() => null);- const routes = createBotHoldRoutes({ holds, stop, audit, named });+ const routes = createBotHoldRoutes({ holds, stop, audit, named, bots: () => ["ada", "bo", "cy", "di"] });expect(await call(routes, "POST", { kind: "all", paused: true })).toMatchObject({ status: 200, body: { all: true, bots: ["ada"], heldBots: ["ada", "bo", "cy", "di"], stopped: 3 } });expect(stop.mock.calls).toEqual([[["bo", "cy", "di"]]]);@@ -149,4 +149,21 @@ describe("the pause routes", () => {]);expect(await call(routes, "POST", { kind: "all" })).toMatchObject({ status: 400 });});++ it("stops every bot's work, or some bots', without pausing any of them", async () => {+ const { make } = setup();+ const holds = make();+ const stop = vi.fn(async (ids: readonly string[]) => ids.length * 2);+ const audit = vi.fn();+ const routes = createBotHoldRoutes({ holds, stop, audit, bots: () => ["ada", "bo"],+ named: (kind, id) => (kind === "bot" ? ({ ada: "Ada", bo: "Bo" } as Record<string, string>)[id] ?? null : null) });++ expect(await call(routes, "POST", { all: true }, "/api/turns/stop")).toEqual({ status: 200, body: { botIds: ["ada", "bo"], stopped: 4 } });+ expect(await call(routes, "POST", { botIds: ["bo", "bo"] }, "/api/turns/stop")).toEqual({ status: 200, body: { botIds: ["bo"], stopped: 2 } });+ expect(await call(routes, "POST", { botIds: ["bo", "nobody"] }, "/api/turns/stop")).toMatchObject({ status: 404, body: { missing: ["nobody"] } });+ expect(await call(routes, "POST", { all: false }, "/api/turns/stop")).toMatchObject({ status: 400 });+ expect(stop.mock.calls).toEqual([[["ada", "bo"]], [["bo"]]]);+ expect(holds.heldBots()).toEqual([]);+ expect(audit).not.toHaveBeenCalled();+ });});diff --git a/server/index.ts b/server/index.tsindex 36d0d7c3b8..9152332cc5 100644--- a/server/index.ts+++ b/server/index.ts@@ -117,7 +117,7 @@ import { vpsLeftBehindNotice, vpsNotChosenReason } from "./cloud-backend.ts";import * as composio from "./composio.ts";import { appSandboxRule, connectorCallFromFrame, connectorRefusalText, connectorScopeRefusalText, connectorUnrecognizedText, evaluateConnectorTools } from "./connector-verdict.ts";import { signInCardText } from "./connector-card-text.ts";-import { BOT_HELD_CODE, BOT_PAUSED_CODE } from "../shared/bot-limit.ts"; import { createBotHolds } from "./host/bot-holds.ts"; import { createBotHoldRoutes } from "./routes/bot-holds.ts"; import { createStarterAwake } from "./host/starter-awake.ts"; import { createStarterCaps } from "./host/starter-caps.ts"; import { createStarterAwakeRoutes } from "./routes/starter-awake.ts"; import { chiefOfStaffPrompt, chiefOfStaffSystemPrompt } from "./chief-of-staff.ts"; import { coordinateMessageMax, coordinateTooLong } from "./too-long.ts"; import { chiefAbsentFrom, createChiefRooms } from "./host/chief-rooms.ts"; import { chiefLevel, readTeamRolesWith } from "./chief-level.ts"; import { defaultBotRefusal, ensureDefaultBot } from "./default-bot.ts";+import { BOT_HELD_CODE, BOT_PAUSED_CODE } from "../shared/bot-limit.ts"; import { createBotHolds } from "./host/bot-holds.ts"; import { createBotHoldRoutes } from "./routes/bot-holds.ts"; import { createCliLogin } from "./routes/cli-login.ts"; import { createStarterAwake } from "./host/starter-awake.ts"; import { createStarterCaps } from "./host/starter-caps.ts"; import { createStarterAwakeRoutes } from "./routes/starter-awake.ts"; import { chiefOfStaffPrompt, chiefOfStaffSystemPrompt } from "./chief-of-staff.ts"; import { coordinateMessageMax, coordinateTooLong } from "./too-long.ts"; import { chiefAbsentFrom, createChiefRooms } from "./host/chief-rooms.ts"; import { chiefLevel, readTeamRolesWith } from "./chief-level.ts"; import { defaultBotRefusal, ensureDefaultBot } from "./default-bot.ts";import { buildRecall, recallRooms, recallThreadIds, withRecalled } from "./recall.ts";import { hostTimeZone, takesTurnClock, turnClockLine, withTurnClock } from "./turn-clock.ts";import { createMemoryUpkeep, dreamConversations, upkeepEnabled } from "./memory-upkeep.ts";@@ -12033,7 +12033,7 @@ const cloudMoveRoutes = createCloudMoveRoutes();// `workspaceAccess` is assigned at boot, after this line: read it per request.ROUTES.push(createHostedSlackRoutes({ bot: (id) => store.bot(id), hostedReady: () => Boolean(workspaceAccess) && entitled("admin") })); ROUTES.push(createStopLineRoutes());const orgInstallStatuses = () => orgLibrary?.installStatuses() ?? new Map();-ROUTES.push(createBotPresetRoutes({ presets: presetStore, orgStatuses: orgInstallStatuses })); ROUTES.push(createBotHoldRoutes({ holds: botHolds, named: (kind, id) => (kind === "bot" ? store.bot(id)?.name ?? null : store.sections.includes(id.trim()) ? id.trim() : null), stop: async (botIds) => { let stopped = 0; for (const botId of botIds) { for (const { threadId } of store.tasks(botId)) if (threadBusy(botId, threadId) || coordinator.activeDirect(threadId)) { await stopThreadForPerson(botId, threadId); stopped++; } for (const group of store.groups) if (roomThreadIds(group).some((threadId) => groupSpeakers.get(threadId)?.botId === botId)) { await interruptHeldMember(group.id, botId); stopped++; } } return stopped; }, audit: (entry, auth, req) => { if (!DESKTOP_MANAGED && adminActivityRecording()) appendAdminAction(DATA_DIR, { category: "bot", action: `${entry.kind}.${entry.paused ? "pause" : "resume"}`, target: { kind: entry.kind, id: entry.id, name: entry.name }, actor: adminActorFor(auth, req) }); } })); ROUTES.push(createWorkspaceBannerRoutes({ changed: () => broadcast({ kind: "config", ...configStatus() }) })); ROUTES.unshift(createUsageCapRoutes({ view: () => usageCapGate.view(), botExists: (botId) => Boolean(store.bot(botId)), save: (usageCaps) => { saveConfig({ usageCaps }); Object.assign(cfg, loadConfig()); } })); const starterAwakeRoutes = createStarterAwakeRoutes({ awake: starterAwake }); ROUTES.push(starterAwakeRoutes);+ROUTES.push(createBotPresetRoutes({ presets: presetStore, orgStatuses: orgInstallStatuses })); ROUTES.push(createBotHoldRoutes({ holds: botHolds, named: (kind, id) => (kind === "bot" ? store.bot(id)?.name ?? null : store.sections.includes(id.trim()) ? id.trim() : null), stop: async (botIds) => { let stopped = 0; for (const botId of botIds) { for (const { threadId } of store.tasks(botId)) if (threadBusy(botId, threadId) || coordinator.activeDirect(threadId)) { await stopThreadForPerson(botId, threadId); stopped++; } for (const group of store.groups) if (roomThreadIds(group).some((threadId) => groupSpeakers.get(threadId)?.botId === botId)) { await interruptHeldMember(group.id, botId); stopped++; } } return stopped; }, audit: (entry, auth, req) => { if (!DESKTOP_MANAGED && adminActivityRecording()) appendAdminAction(DATA_DIR, { category: "bot", action: `${entry.kind}.${entry.paused ? "pause" : "resume"}`, target: { kind: entry.kind, id: entry.id, name: entry.name }, actor: adminActorFor(auth, req) }); }, bots: () => store.bots.map((bot) => bot.id) })); const cliLogin = createCliLogin({ sessions, refusal: () => (HOSTED_WORKSPACE ? "Sign in through the workspace portal." : null), loopbackRefusal: () => (LOOPBACK.trust === "service" ? "on this shared server a program here may not ask to sign in: run openmausbot login on your own computer" : null), environment: () => environmentDescriptor({ environmentId: ENVIRONMENT_ID, ...TEAM_LABEL, desktopManaged: DESKTOP_MANAGED, emailSignIn: !CLOUD_HOME && emailSignIn.enabled(), sharedComputers: lendingEnabled(), cloudHome: Boolean(CLOUD_HOME), cloudTeam: CLOUD_TEAM !== null, ownHome: ownHome.takesMove() }), changed: () => broadcast({ kind: "cli-login" }, { adminOnly: true }), ...(CLOUD_TEAM ? { opened: (session) => teamHost.met(session) } : {}) }); ROUTES.push(cliLogin.routes); ROUTES.push(createWorkspaceBannerRoutes({ changed: () => broadcast({ kind: "config", ...configStatus() }) })); ROUTES.unshift(createUsageCapRoutes({ view: () => usageCapGate.view(), botExists: (botId) => Boolean(store.bot(botId)), save: (usageCaps) => { saveConfig({ usageCaps }); Object.assign(cfg, loadConfig()); } })); const starterAwakeRoutes = createStarterAwakeRoutes({ awake: starterAwake }); ROUTES.push(starterAwakeRoutes);ROUTES.push(createSharedComputerRoutes({ enabled: (auth) => lendingEnabled() || (ownerLends() && ownHome.owner(auth)), computers: sharedComputers, sessionLive: (id) => sessions.isLive(id), environmentId: ENVIRONMENT_ID,cloudHomeLender: CLOUD_HOME ? CLOUD_HOME_LENDER : null, principal: sessionLendingPrincipal, personKey: (session) => lendingPersonKey(session, ownHome.ownServer()), power: () => cloudPower, links: CLOUD_HOME ? deviceLinks : null, upgrades, asks: computerAsks?.asks ?? null, answerer: cardAnswererFor }));// `routines` is assigned at boot, so it is read per request.@@ -12550,7 +12550,7 @@ const handleRequest = async (req: IncomingMessage, res: ServerResponse) => {}if (await emailSignInRoute({ cloudHome: Boolean(CLOUD_HOME), emailSignIn, sessions, cookieName: SESSION_COOKIE, target: (r) => signInMailTarget(publicUrl(), requestOrigin(r)),environment: () => environmentDescriptor({ environmentId: ENVIRONMENT_ID, ...TEAM_LABEL, desktopManaged: DESKTOP_MANAGED, emailSignIn: true, sharedComputers: lendingEnabled() }) }, req, res, path, method)) return;- if ((cloudSigned && await cloudSigned({ req, res, url, path, method })) || chatApps.serveFile(req, res, path, method)) return;+ if ((cloudSigned && await cloudSigned({ req, res, url, path, method })) || chatApps.serveFile(req, res, path, method) || await cliLogin.open(req, res, path, method)) return;if (method === "POST" && path === "/api/auth/pair") {// JSON only: a cross-site HTML form cannot send this content type without a preflight, so no unused code is planted as a session.if (!/^application\/json\b/i.test(String(req.headers["content-type"] ?? ""))) {diff --git a/server/routes/bot-holds.ts b/server/routes/bot-holds.tsindex 00f6b118f5..af8886df3b 100644--- a/server/routes/bot-holds.ts+++ b/server/routes/bot-holds.ts@@ -1,5 +1,6 @@// Pausing a bot, a department or every bot: GET what is paused; POST {kind, id, paused} pauses or resumes one-// ({kind: "all", paused} every bot), and pausing also stops the work its bots are doing now. Admin-scope routes: on a Team Cloud only an owner or admin pauses.+// ({kind: "all", paused} every bot), and pausing also stops the work its bots are doing now. POST /api/turns/stop stops+// that work without pausing ({all: true} or {botIds}). Admin-scope routes: on a Team Cloud only an owner or admin pauses.import type { IncomingMessage } from "node:http";import { z } from "zod";@@ -13,6 +14,8 @@ export interface BotHoldRouteDeps {named(kind: "bot" | "department", id: string): string | null;/** Stops every running turn, routine run and hand-off of these bots; how many conversations it stopped. */stop(botIds: readonly string[]): Promise<number>;+ /** Every bot's id. */+ bots(): string[];/** Records the change in the admin activity log. */audit(entry: { kind: PauseKind; id: string; name: string; paused: boolean }, auth: RequestAuth, req: IncomingMessage): void;}@@ -21,11 +24,23 @@ const body = z.union([z.object({ kind: z.enum(["bot", "department"]), id: z.string().trim().min(1).max(200), paused: z.boolean() }).strict(),z.object({ kind: z.literal("all"), paused: z.boolean() }).strict(),]);+const stopBody = z.union([+ z.object({ all: z.literal(true) }).strict(),+ z.object({ botIds: z.array(z.string().trim().min(1).max(200)).min(1).max(1_000) }).strict(),+]);/** What the admin activity log names an all-bots pause by. */const ALL = { id: "all", name: "Every bot" };export function createBotHoldRoutes(deps: BotHoldRouteDeps): RouteHandler {return async ({ req, res, path, method, auth, json, readBody }) => {+ if (path === "/api/turns/stop" && method === "POST") {+ const parsed = stopBody.safeParse(await readBody(req, 64_000).catch(() => null));+ if (!parsed.success) return void json(res, 400, { error: "Send all: true, or botIds: the bots whose work to stop." });+ const botIds = "all" in parsed.data ? deps.bots() : [...new Set(parsed.data.botIds)];+ const missing = botIds.filter((id) => deps.named("bot", id) === null);+ if (missing.length) return void json(res, 404, { error: `No such bot: ${missing.join(", ")}.`, missing });+ return void json(res, 200, { botIds, stopped: await deps.stop(botIds) });+ }if (path !== "/api/paused") return PASS;if (method === "GET") return void json(res, 200, { ...deps.holds.state(), heldBots: deps.holds.heldBots() });if (method !== "POST") return PASS;diff --git a/server/routes/cli-login.test.ts b/server/routes/cli-login.test.tsnew file mode 100644index 0000000000..e0eadaca74--- /dev/null+++ b/server/routes/cli-login.test.ts@@ -0,0 +1,89 @@+import { createHash, randomBytes } from "node:crypto";+import { createServer, type Server } from "node:http";+import type { AddressInfo } from "node:net";+import { afterEach, describe, expect, it, vi } from "vitest";++import { json, readBody } from "../harness/http.ts";+import type { RequestAuth } from "../request-auth.ts";+import { createCliLogin, type CliLoginDeps } from "./cli-login.ts";++const OWNER: RequestAuth = { kind: "loopback", scopes: ["admin", "client"] };+const GUEST: RequestAuth = { kind: "loopback", scopes: ["client"], trust: "service" };++let server: Server | undefined;+afterEach(() => new Promise<void>((resolve) => (server ? server.close(() => resolve()) : resolve())));++/** The module behind a real listener: asking and polling go to `open` as before the gate, the rest to its routes as `auth`. */+async function listen(overrides: Partial<CliLoginDeps> = {}) {+ let now = 1_000_000;+ const revoked: string[] = [];+ const deps: CliLoginDeps = {+ sessions: {+ openPairing: vi.fn(() => ({ id: "p1", code: "C", credential: "omb_pair_credential", expiresAt: now + 60_000 })),+ exchange: vi.fn(() => ({ ok: true as const, token: "omb_sess_minted", session: { id: "s1", label: "t", scopes: ["admin", "client"], createdAt: now, lastSeenAt: now, expiresAt: now + 1 } as never })),+ revoke: vi.fn((id: string) => { revoked.push(id); return true; }),+ },+ refusal: () => null, loopbackRefusal: () => null, environment: () => ({ environmentId: "env" }), changed: vi.fn(),+ now: () => now, ...overrides,+ };+ const login = createCliLogin(deps);+ let auth: RequestAuth = OWNER;+ server = createServer(async (req, res) => {+ const path = new URL(req.url ?? "/", "http://x").pathname;+ if (await login.open(req, res, path, req.method ?? "GET")) return;+ await login.routes({ req, res, url: new URL(req.url ?? "/", "http://x"), path, method: req.method ?? "GET", auth, json, readBody });+ if (!res.writableEnded) json(res, 404, { error: "no route" });+ });+ await new Promise<void>((resolve) => server!.listen(0, "127.0.0.1", resolve));+ const base = `http://127.0.0.1:${(server!.address() as AddressInfo).port}`;+ const call = async (method: string, path: string, body?: unknown) => {+ const response = await fetch(`${base}${path}`, { method, headers: { "content-type": "application/json" }, ...(body === undefined ? {} : { body: JSON.stringify(body) }) });+ return { status: response.status, body: await response.json() as Record<string, any> };+ };+ const ask = async () => {+ const verifier = randomBytes(32).toString("base64url");+ const started = await call("POST", "/api/auth/cli-login", { verifierHash: createHash("sha256").update(verifier).digest("base64url") });+ return { ...started, poll: () => call("POST", `/api/auth/cli-login/${started.body.id}`, { verifier }) };+ };+ return { deps, call, ask, revoked, as: (next: RequestAuth) => { auth = next; }, later: (ms: number) => { now += ms; } };+}++describe("the terminal sign-in route", () => {+ it("refuses a program on a shared server's own machine, where that is a bot's shell", async () => {+ const { ask } = await listen({ loopbackRefusal: () => "on this shared server a program here may not ask to sign in" });+ expect(await ask()).toMatchObject({ status: 403, body: { error: expect.stringContaining("shared server") } });+ });++ it("lets one place hold two waiting requests, and only the owner or an admin answer them", async () => {+ const { ask, call, as } = await listen();+ const first = await ask();+ expect((await ask()).status).toBe(201);+ expect((await ask()).status).toBe(429);+ as(GUEST);+ expect((await call("GET", "/api/auth/cli-login")).status).toBe(403);+ expect((await call("POST", `/api/auth/cli-login/${first.body.id}/allow`, {})).status).toBe(403);+ expect((await first.poll()).status).toBe(202);+ });++ it("says why when the session cannot be made, and revokes one the terminal never collects", async () => {+ const failing = await listen();+ vi.mocked(failing.deps.sessions.openPairing).mockImplementationOnce(() => { throw Object.assign(new Error("Only an admin session can sign in to this Cloud."), { code: "cloud_personal" }); });+ const refused = await failing.ask();+ expect(await failing.call("POST", `/api/auth/cli-login/${refused.body.id}/allow`, {})).toMatchObject({ status: 403, body: { error: "Only an admin session can sign in to this Cloud." } });+ expect(await refused.poll()).toMatchObject({ status: 403, body: { state: "failed", error: "Only an admin session can sign in to this Cloud." } });++ const forgotten = await failing.ask();+ expect((await failing.call("POST", `/api/auth/cli-login/${forgotten.body.id}/allow`, {})).status).toBe(200);+ failing.later(3 * 60_000);+ expect((await forgotten.poll()).status).toBe(404);+ expect(failing.revoked).toEqual(["s1"]);+ });++ it("ends a request nobody answers after ten minutes", async () => {+ const { ask, call, later } = await listen();+ const request = await ask();+ later(10 * 60_000);+ expect((await request.poll()).status).toBe(404);+ expect((await call("GET", "/api/auth/cli-login")).body.requests).toEqual([]);+ });+});diff --git a/server/routes/cli-login.ts b/server/routes/cli-login.tsnew file mode 100644index 0000000000..b647b619a9--- /dev/null+++ b/server/routes/cli-login.ts@@ -0,0 +1,189 @@+// `openmausbot login`: a terminal asks, a person allows it in the app (or a browser signed in here), and the terminal+// gets a session. Asking and polling need no session; only Allow, an ordinary admin route behind the auth gate, mints one.+// Security: a request grants nothing by itself. Any program here (a bot's shell too) can ask, so the person and the+// matching code shown in both places are the boundary; asking is capped and every request ends after ten minutes.+import { createHash, randomBytes, randomInt, timingSafeEqual } from "node:crypto";+import type { IncomingMessage, ServerResponse } from "node:http";+import { z } from "zod";++import { CLI_LOGIN_PATH, type CliLoginWire } from "../../shared/cli-login.ts";+import { json, readBody } from "../harness/http.ts";+import { fromBrowser, isLoopbackHost, isProxied, ownerOrAdmin, requestSource } from "../request-auth.ts";+import { PAIRING_CODE_ALPHABET, type PublicSession, type SessionRegistry } from "../sessions.ts";+import { PASS, type RouteHandler } from "./table.ts";++export const CLI_LOGIN_TTL_MS = 10 * 60_000;+/** How long an allowed session waits for its terminal to collect it before it is revoked unused. */+const UNCOLLECTED_MS = 2 * 60_000;+const MAX_WAITING = 5;+const MAX_WAITING_PER_SOURCE = 2;+const POLL = /^\/api\/auth\/cli-login\/([\w-]{16,64})$/;+const ANSWER = /^\/api\/auth\/cli-login\/([\w-]{16,64})\/(allow|deny)$/;++interface CliLoginRequest extends CliLoginWire {+ verifierHash: Buffer;+ state: "waiting" | "allowed" | "denied" | "failed";+ token?: string;+ session?: PublicSession;+ error?: string;+ answeredAt?: number;+}++export interface CliLoginDeps {+ sessions: Pick<SessionRegistry, "openPairing" | "exchange" | "revoke">;+ /** Why this server takes no terminal sign-in at all (a hosted workspace's portal is its one sign-in), else null. */+ refusal(): string | null;+ /** Why a program on this server's own machine may not ask (where that is a bot's shell, never a person), else null. */+ loopbackRefusal(): string | null;+ environment(): unknown;+ /** The waiting list changed: tell the admins' windows. */+ changed(): void;+ /** A session this route made (a Team Cloud records who signed in). */+ opened?(session: PublicSession): void;+ now?(): number;+}++const startBody = z.object({+ label: z.string().max(200).optional(),+ scope: z.enum(["admin", "client"]).optional(),+ verifierHash: z.string().regex(/^[A-Za-z0-9_-]{43}$/),+}).strict();+const pollBody = z.object({ verifier: z.string().min(32).max(128) }).strict();++const digest = (value: string) => createHash("sha256").update(value).digest();+const cleanLabel = (value: string | undefined) =>+ (value ?? "").replace(/[\p{Cc}--]/gu, "").trim().slice(0, 80) || "openmausbot CLI";++/** Eight symbols from the pairing alphabet, `ABCD-EFGH`: shown in the terminal and on the card, never typed. */+function matchingCode(): string {+ const symbols = Array.from({ length: 8 }, () => PAIRING_CODE_ALPHABET[randomInt(PAIRING_CODE_ALPHABET.length)]);+ return `${symbols.slice(0, 4).join("")}-${symbols.slice(4).join("")}`;+}++const wire = (request: CliLoginRequest): CliLoginWire => ({+ id: request.id, code: request.code, label: request.label, scopes: [...request.scopes], local: request.local,+ source: request.source, createdAt: request.createdAt, expiresAt: request.expiresAt,+});++export function createCliLogin(deps: CliLoginDeps) {+ const now = deps.now ?? Date.now;+ const requests = new Map<string, CliLoginRequest>();++ const prune = (): boolean => {+ let changed = false;+ for (const [id, request] of requests) {+ const uncollected = request.state === "allowed" && now() - (request.answeredAt ?? 0) > UNCOLLECTED_MS;+ if (uncollected && request.session) deps.sessions.revoke(request.session.id);+ if (uncollected || (request.state !== "allowed" && now() >= request.expiresAt)) {+ requests.delete(id);+ changed ||= request.state === "waiting";+ }+ }+ return changed;+ };+ const waiting = () => {+ if (prune()) deps.changed();+ return [...requests.values()].filter((request) => request.state === "waiting").sort((a, b) => a.createdAt - b.createdAt);+ };++ async function start(req: IncomingMessage, res: ServerResponse): Promise<void> {+ if (!/^application\/json\b/i.test(String(req.headers["content-type"] ?? ""))) return void json(res, 415, { error: "send the sign-in request as JSON (content-type: application/json)" });+ if (fromBrowser(req)) return void json(res, 403, { error: "a terminal sign-in starts from the openmausbot command, not a web page" });+ const refusal = deps.refusal();+ if (refusal) return void json(res, 403, { error: refusal });+ const local = !isProxied(req) && isLoopbackHost(req.headers.host);+ const localRefusal = local ? deps.loopbackRefusal() : null;+ if (localRefusal) return void json(res, 403, { error: localRefusal });+ const parsed = startBody.safeParse(await readBody(req, 4_096).catch(() => null));+ if (!parsed.success) return void json(res, 400, { error: "send verifierHash (the SHA-256 of a secret only the terminal keeps, base64url), and optionally label and scope (admin or client)" });+ const source = requestSource(req);+ const open = waiting();+ if (open.length >= MAX_WAITING || open.filter((request) => request.source === source).length >= MAX_WAITING_PER_SOURCE) {+ return void json(res, 429, { error: "too many terminal sign-ins are waiting: allow or deny them in MausBot, or wait ten minutes" });+ }+ const at = now();+ const request: CliLoginRequest = {+ id: randomBytes(18).toString("base64url"),+ code: matchingCode(),+ label: cleanLabel(parsed.data.label),+ scopes: parsed.data.scope === "client" ? ["client"] : ["admin", "client"],+ local,+ source,+ createdAt: at,+ expiresAt: at + CLI_LOGIN_TTL_MS,+ verifierHash: Buffer.from(parsed.data.verifierHash, "base64url"),+ state: "waiting",+ };+ requests.set(request.id, request);+ deps.changed();+ json(res, 201, { id: request.id, code: request.code, expiresAt: request.expiresAt, intervalMs: 1_000 });+ }++ async function poll(req: IncomingMessage, res: ServerResponse, id: string): Promise<void> {+ if (!/^application\/json\b/i.test(String(req.headers["content-type"] ?? ""))) return void json(res, 415, { error: "send the poll as JSON (content-type: application/json)" });+ const parsed = pollBody.safeParse(await readBody(req, 1_024).catch(() => null));+ prune();+ const request = requests.get(id);+ const presented = parsed.success ? digest(parsed.data.verifier) : null;+ if (!request || !presented || presented.length !== request.verifierHash.length || !timingSafeEqual(presented, request.verifierHash)) {+ return void json(res, 404, { state: "gone", error: "no such sign-in request: it ended, or was never made here" });+ }+ if (request.state === "waiting") return void json(res, 202, { state: "waiting", expiresAt: request.expiresAt });+ requests.delete(id);+ if (request.state === "allowed") {+ return void json(res, 200, { state: "allowed", token: request.token, session: request.session, environment: deps.environment() });+ }+ json(res, 403, { state: request.state, error: request.state === "denied" ? "the sign-in was denied in MausBot" : request.error ?? "the sign-in could not be completed" });+ }++ /** Before the auth gate: asking and polling, which carry no session. Anything else under the path passes through. */+ async function open(req: IncomingMessage, res: ServerResponse, path: string, method: string): Promise<boolean> {+ if (method !== "POST") return false;+ if (path === CLI_LOGIN_PATH) {+ await start(req, res);+ return true;+ }+ const polled = POLL.exec(path);+ if (!polled) return false;+ await poll(req, res, polled[1]!);+ return true;+ }++ function allow(request: CliLoginRequest): void {+ let opened: ReturnType<typeof deps.sessions.openPairing>;+ try {+ opened = deps.sessions.openPairing({ scopes: request.scopes, label: request.label });+ } catch (error) {+ request.state = "failed";+ request.error = error instanceof Error ? error.message : String(error);+ return;+ }+ const exchanged = deps.sessions.exchange({ code: opened.credential, label: request.label, source: request.source });+ if (!exchanged.ok) {+ request.state = "failed";+ request.error = exchanged.error;+ return;+ }+ deps.opened?.(exchanged.session);+ Object.assign(request, { state: "allowed", token: exchanged.token, session: exchanged.session, answeredAt: now() });+ }++ const routes: RouteHandler = async ({ res, path, method, auth }) => {+ const answer = ANSWER.exec(path);+ if (path !== CLI_LOGIN_PATH && !answer) return PASS;+ if (!ownerOrAdmin(auth)) return void json(res, 403, { error: "only the owner or an admin allows a terminal" });+ if (!answer) {+ if (method !== "GET") return PASS;+ return void json(res, 200, { requests: waiting().map(wire) });+ }+ if (method !== "POST") return PASS;+ const request = waiting().find((candidate) => candidate.id === answer[1]);+ if (!request) return void json(res, 404, { error: "that sign-in request ended" });+ if (answer[2] === "deny") Object.assign(request, { state: "denied", answeredAt: now() });+ else allow(request);+ deps.changed();+ json(res, request.state === "failed" ? 403 : 200, request.state === "failed" ? { error: request.error } : { ok: true, state: request.state });+ };++ return { open, routes, waiting: () => waiting().map(wire) };+}diff --git a/shared/cli-login.ts b/shared/cli-login.tsnew file mode 100644index 0000000000..56ebbc1d45--- /dev/null+++ b/shared/cli-login.ts@@ -0,0 +1,16 @@+/** Where `openmausbot login` asks and polls; Allow and Deny are under it. */+export const CLI_LOGIN_PATH = "/api/auth/cli-login";++/** A terminal's `openmausbot login` waiting for the owner or an admin, as their window shows it: never its poll secret or a token. */+export interface CliLoginWire {+ id: string;+ /** Shown in the terminal too, so the person allows the terminal they are looking at. */+ code: string;+ label: string;+ scopes: Array<"admin" | "client">;+ /** Asked from this computer rather than over the network. */+ local: boolean;+ source: string;+ createdAt: number;+ expiresAt: number;+}diff --git a/src/App.tsx b/src/App.tsxindex c040d00e52..44d95d42d4 100644--- a/src/App.tsx+++ b/src/App.tsx@@ -33,6 +33,7 @@ import { NotificationRail, NotificationsPanel } from "@/components/Notificationsimport { useNotificationFeed } from "@/lib/notification-preferences";import { UpdateBanner } from "@/components/UpdateBanner";import { AppNotices } from "@/components/AppNotices";+import { CliLoginCard } from "@/components/CliLoginCard";import { AppGrantNotice } from "@/components/AppGrantPrompt";import { BotLimitPopup } from "@/components/BotLimitPopup";import { CloudAsleepStrip } from "@/components/CloudAsleepStrip";@@ -335,6 +336,7 @@ function Shell({ viewer }: { viewer: WelcomeViewer | null }) {<CloudSendStrip cloudHome={state.config?.cloudHome === true} /><HomeLine /><AppNotices quiet={paletteOpen || drawerOpen || Boolean(localVmWorkspaceBotId)} viewer={viewer} />+ <CliLoginCard /></>;return (<div data-look="app" className={cn("flex h-full flex-col", framed && "bg-frame")} onClickCapture={drawerOpen ? noteDrawerAction : undefined} onKeyDownCapture={drawerOpen ? noteDrawerAction : undefined}>diff --git a/src/components/CliLoginCard.dom.test.ts b/src/components/CliLoginCard.dom.test.tsnew file mode 100644index 0000000000..8a1a32bea9--- /dev/null+++ b/src/components/CliLoginCard.dom.test.ts@@ -0,0 +1,31 @@+// @vitest-environment happy-dom+import { act, createElement } from "react";+import { createRoot } from "react-dom/client";+import { afterEach, expect, it, vi } from "vitest";++import { setLocale } from "@/lib/i18n";+import { CliLoginPrompt } from "./CliLoginCard";++(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;+afterEach(() => { document.body.innerHTML = ""; vi.unstubAllGlobals(); });++it("shows the terminal's code and what it would get, and Allow answers that one request", async () => {+ setLocale("en");+ const waiting = { id: "req-1234567890abcdef", code: "KQ7M-X2PD", label: "openmausbot CLI on studio", scopes: ["admin", "client"], local: true, source: "127.0.0.1", createdAt: Date.now(), expiresAt: Date.now() + 600_000 };+ const fetchMock = vi.fn(async (_path: string, init?: RequestInit) => new Response(JSON.stringify(+ init?.method === "POST" ? { ok: true, state: "allowed" } : { requests: [waiting] }), { status: 200 }));+ vi.stubGlobal("fetch", fetchMock);+ const host = document.createElement("div"); document.body.append(host);+ const root = createRoot(host);+ await act(async () => { root.render(createElement(CliLoginPrompt)); });+ await act(async () => { await Promise.resolve(); });+ const card = document.querySelector<HTMLElement>("[data-notice='cli-login']")!;+ expect(card.textContent).toContain("A terminal wants to control MausBot");+ expect(card.querySelector("[data-cli-login-code]")!.textContent).toBe("KQ7M-X2PD");+ expect(card.textContent).toContain("Full control · openmausbot CLI on studio");+ const allow = [...card.querySelectorAll("button")].find((button) => button.textContent === "Allow")!;+ await act(async () => { allow.click(); });+ expect(fetchMock).toHaveBeenCalledWith("/api/auth/cli-login/req-1234567890abcdef/allow", expect.objectContaining({ method: "POST" }));+ expect(document.querySelector("[data-notice='cli-login']")).toBeNull();+ await act(async () => { root.unmount(); });+});diff --git a/src/components/CliLoginCard.tsx b/src/components/CliLoginCard.tsxnew file mode 100644index 0000000000..f4e906d230--- /dev/null+++ b/src/components/CliLoginCard.tsx@@ -0,0 +1,81 @@+import { useEffect, useState } from "react";+import { TerminalSquare } from "lucide-react";++import type { CliLoginWire } from "../../shared/cli-login";+import { t } from "@/lib/i18n";+import { listenLiveFrames } from "@/lib/live-events";+import { useOwnerOrAdmin } from "@/lib/use-owner-or-admin";+import { api } from "@/state/api";+import { NoticeCard, PRIMARY_BUTTON } from "./NoticeCard";++/** The oldest waiting request that has not run out, if any. */+export function cliLoginShown(requests: readonly CliLoginWire[], now: number): CliLoginWire | null {+ return requests.find((request) => request.expiresAt > now) ?? null;+}++function useWaitingCliLogins(): [CliLoginWire[], (id: string) => void] {+ const [requests, setRequests] = useState<CliLoginWire[]>([]);+ useEffect(() => {+ let alive = true;+ const load = () => void api<{ requests?: CliLoginWire[] }>("/api/auth/cli-login")+ .then((answer) => { if (alive) setRequests(answer.requests ?? []); })+ .catch(() => { if (alive) setRequests([]); });+ load();+ const stop = listenLiveFrames({ onFrame: (frame) => { if (frame.kind === "cli-login") load(); }, onMissedFrames: load });+ return () => { alive = false; stop(); };+ }, []);+ return [requests, (id) => setRequests((current) => current.filter((request) => request.id !== id))];+}++function useClock(until: number | undefined): number {+ const [now, setNow] = useState(Date.now);+ useEffect(() => {+ if (until === undefined) return;+ const timer = setTimeout(() => setNow(Date.now()), Math.max(0, until - Date.now()) + 50);+ return () => clearTimeout(timer);+ }, [until, now]);+ return now;+}++export function CliLoginPrompt() {+ const [requests, forget] = useWaitingCliLogins();+ const [busy, setBusy] = useState(false);+ const [failed, setFailed] = useState<string | null>(null);+ const now = useClock(requests.find((request) => request.expiresAt > Date.now())?.expiresAt);+ const request = cliLoginShown(requests, now);+ if (!request) return null;+ const answer = async (allow: boolean) => {+ setBusy(true);+ setFailed(null);+ try {+ await api(`/api/auth/cli-login/${encodeURIComponent(request.id)}/${allow ? "allow" : "deny"}`, { method: "POST", body: "{}" });+ forget(request.id);+ } catch (error) {+ setFailed(error instanceof Error ? error.message : String(error));+ } finally {+ setBusy(false);+ }+ };+ const chatOnly = !request.scopes.includes("admin");+ return <NoticeCard titleId="cli-login-title" notice="cli-login" icon={TerminalSquare} title={t("cliLogin.title")}+ dismissLabel={t("cliLogin.deny")} onDismiss={() => void answer(false)}>+ <p className="mt-1 text-[13px] text-ink-secondary">+ {request.local ? t("cliLogin.bodyHere") : t("cliLogin.bodyElsewhere", { source: request.source })}+ </p>+ <p data-cli-login-code className="my-2 font-mono text-[20px] font-semibold tracking-[0.2em]">{request.code}</p>+ <p className="mb-1 text-[12px] text-ink-secondary">{t("cliLogin.match")}</p>+ <p className="mb-3 text-[12px] text-ink-secondary">+ {chatOnly ? t("cliLogin.scopeChat") : t("cliLogin.scopeAll")} · {request.label}+ </p>+ <div className="flex flex-wrap items-center gap-3">+ <button type="button" className={PRIMARY_BUTTON} disabled={busy} onClick={() => void answer(true)}>{t("cliLogin.allow")}</button>+ <button type="button" className="py-2 text-[12px] text-ink-secondary hover:text-ink" disabled={busy} onClick={() => void answer(false)}>{t("cliLogin.deny")}</button>+ </div>+ {failed && <p role="alert" className="mt-2 text-[12px] text-danger">{failed}</p>}+ </NoticeCard>;+}++/** A terminal running `openmausbot login` waits here for one click. Only the owner or an admin sees it. */+export function CliLoginCard() {+ return useOwnerOrAdmin() === true ? <CliLoginPrompt /> : null;+}diff --git a/src/locales/en.json b/src/locales/en.jsonindex e731bc0afc..a275c44ad6 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -11186,5 +11186,13 @@"chat.unreadContext.images": "Image","chat.unreadContext.files": "File","chat.unreadContext.moreCitations": "and {count} more",- "inbox.settled.read": "Read"+ "inbox.settled.read": "Read",+ "cliLogin.title": "A terminal wants to control {app}",+ "cliLogin.bodyHere": "Someone ran openmausbot login in a terminal on this computer.",+ "cliLogin.bodyElsewhere": "Someone ran openmausbot login on another computer ({source}).",+ "cliLogin.match": "Allow it only if your terminal shows this same code.",+ "cliLogin.scopeAll": "Full control",+ "cliLogin.scopeChat": "Chat only",+ "cliLogin.allow": "Allow",+ "cliLogin.deny": "Deny"}diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex 3ad230d5db..cdfa75b234 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -11186,5 +11186,13 @@"imageGen.higgsfield.connected": "Conectado à sua conta da Higgsfield","imageGen.higgsfield.notConnected": "Não conectado, ou o login expirou","imageGen.higgsfield.help": "O {app} cria imagens com a conta da Higgsfield em que você entra em Plugins. Cada imagem gasta créditos dessa conta.",- "imageGen.higgsfield.open": "Abrir Plugins"+ "imageGen.higgsfield.open": "Abrir Plugins",+ "cliLogin.title": "Um terminal quer controlar o {app}",+ "cliLogin.bodyHere": "Alguém rodou openmausbot login em um terminal neste computador.",+ "cliLogin.bodyElsewhere": "Alguém rodou openmausbot login em outro computador ({source}).",+ "cliLogin.match": "Só permita se o seu terminal mostrar este mesmo código.",+ "cliLogin.scopeAll": "Controle total",+ "cliLogin.scopeChat": "Só conversa",+ "cliLogin.allow": "Permitir",+ "cliLogin.deny": "Recusar"}