Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Team bots: Bot access in Settings, and asking the owner to chat (#4062)
Milind Soni7124ebc4ff57
diff --git a/docs/team-cloud.md b/docs/team-cloud.mdindex 72d01dcd07..0d48f5fea0 100644--- a/docs/team-cloud.md+++ b/docs/team-cloud.md@@ -388,6 +388,17 @@ allow, folders), where it runs, its department, whom it answers to or directs, cdialog on a team; the conversation's copy and download sit at its foot. Someone who can only view a bot sees "Youcan view Payroll, not chat with it." where the composer would be (and in a room with that bot), opens its main chatrather than a new one of their own, and is offered no New conversation. Off a team none of this shows.+- **Bot access** (Settings, for a team's admins): every team bot down the side (each person's own MausBot stays out),+ each User across, and what everyone in the team gets; each cell is that person's level (the owner's says Owner), and+ the Everyone column sets it for everyone. The same sharing as the Share dialog, applied at once with Undo.+- **Asking to chat.** Beside "You can view Payroll" sits "Ask Ada to chat" (Ada owns it; "Ask an admin to chat" when+ nobody on the team does). `POST /api/bots/<id>/access-request` (anyone who can view the bot; someone who can chat+ already gets 409) puts an Allow / Not now card in the owner's inbox, or each admin's when the owner is gone+ (`server/host/access-requests.ts`). Asking again while a card waits sends nothing new. Allow, answered from the inbox+ or the card in its chat, gives Can chat at once, settles the same card in every other inbox, and tells the asker in+ their own inbox ("Ada let you chat with Payroll."); it takes effect only while the person answering can edit the bot.+ Not now changes nothing and tells nobody; they can ask again. The card is a set-answer question card+ (`card.accessRequest`), shown in each person's language, and its answer is always its own option.## One inbox per persondiff --git a/docs/verification/evidence/team-bot-access/ask-allowed-bob.png b/docs/verification/evidence/team-bot-access/ask-allowed-bob.pngnew file mode 100644index 0000000000..c92d9b5b1aBinary files /dev/null and b/docs/verification/evidence/team-bot-access/ask-allowed-bob.png differdiff --git a/docs/verification/evidence/team-bot-access/ask-bob-asked.png b/docs/verification/evidence/team-bot-access/ask-bob-asked.pngnew file mode 100644index 0000000000..33b2fb02f6Binary files /dev/null and b/docs/verification/evidence/team-bot-access/ask-bob-asked.png differdiff --git a/docs/verification/evidence/team-bot-access/ask-bob.png b/docs/verification/evidence/team-bot-access/ask-bob.pngnew file mode 100644index 0000000000..fd89e07508Binary files /dev/null and b/docs/verification/evidence/team-bot-access/ask-bob.png differdiff --git a/docs/verification/evidence/team-bot-access/ask-card-ada-inbox.png b/docs/verification/evidence/team-bot-access/ask-card-ada-inbox.pngnew file mode 100644index 0000000000..3aeae1a6a4Binary files /dev/null and b/docs/verification/evidence/team-bot-access/ask-card-ada-inbox.png differdiff --git a/docs/verification/evidence/team-bot-access/overview-admin-advanced-dark.png b/docs/verification/evidence/team-bot-access/overview-admin-advanced-dark.pngnew file mode 100644index 0000000000..ffccdaa95cBinary files /dev/null and b/docs/verification/evidence/team-bot-access/overview-admin-advanced-dark.png differdiff --git a/docs/verification/evidence/team-bot-access/overview-admin.png b/docs/verification/evidence/team-bot-access/overview-admin.pngnew file mode 100644index 0000000000..8e3fecbd4dBinary files /dev/null and b/docs/verification/evidence/team-bot-access/overview-admin.png differdiff --git a/docs/verification/team-bot-access.md b/docs/verification/team-bot-access.mdindex 8b47e49813..e45f120591 100644--- a/docs/verification/team-bot-access.md+++ b/docs/verification/team-bot-access.md@@ -7,8 +7,8 @@ and a level for each person added. Admins and the bot's owner always edit. The c## Driving it```sh-pnpm exec vitest run server/cloud-team-bot-access.e2e.test.ts server/bot-access.test.ts \- server/bot-visibility.test.ts src/components/bot-access/ShareBotDialog.dom.test.ts src/state/team-chats.test.ts+pnpm exec vitest run server/cloud-team-bot-access.e2e.test.ts server/bot-access.test.ts server/host/access-requests.test.ts \+ server/bot-visibility.test.ts src/components/bot-access src/state/team-chats.test.ts src/components/SettingsModal.groups.test.ts```- `server/cloud-team-bot-access.e2e.test.ts` starts a real Team Cloud (`OMB_CLOUD_ROLE=team`) with the Owner (Olive),@@ -23,10 +23,19 @@ pnpm exec vitest run server/cloud-team-bot-access.e2e.test.ts server/bot-access.visibility; Eve gets 404. A message another app relays (the guarded route's `onBehalfOf`) goes through only forsomeone who can chat. Bob's live stream gets his new level with no sharing in it, then ends when he is removed; theowner always edits, keeps editing after handing the bot on, and each person's own MausBot stays theirs. Bots made- before levels keep exactly what their visibility gave.+ before levels keep exactly what their visibility gave. Asking to chat: someone who can't see the bot gets 404 and its+ owner 409; Bob's ask puts one card in Dan's inbox (the owner's, not an admin's), asking again adds none, Bob can't+ answer it, Not now leaves him at Can view, a new ask and Allow give him Can chat, a conversation of his own and a+ line in his inbox; and an Allow from someone who can no longer edit the bot is refused.- `server/bot-access.test.ts` covers the level rules: the mapping from visibility and back, a member's level (owner,damaged sharing, `@domain` entries), each copy of a bot, what each route needs, each level's bot fields, a card thatchanges the bot, a relayed message, and who may be added.+- `server/host/access-requests.test.ts`: the admins decide when the owner is gone, one admin's Allow settles every+ copy, the owner alone decides while on the team, Not now gives nothing.+- `src/components/bot-access/AccessOverview.dom.test.ts`: Settings → Bot access lists each team bot (no one's own+ MausBot) by each User, the owner, levels below everyone's disabled, a cell or row applied at once with Undo; "Ask Cara+ to chat" asks and says so, "Ask an admin to chat" when nobody on the team owns the bot.+ `src/components/SettingsModal.groups.test.ts` shows the page to a team's admins only.- `src/components/bot-access/ShareBotDialog.dom.test.ts` drives the dialog: the owner first, each level, a change sentat once with Undo putting it back, adding a teammate, removing one, opening the bot to everyone, the read-only viewof someone who can't edit, and no button off a team.@@ -57,6 +66,12 @@ checkout of the code before levels.| Can chat |  || Can edit: the Share dialog |  || No access: not in the list |  |+| Bot access in Settings (Simple) |  |+| Bot access in Settings (Advanced) |  |+| Can view: ask the owner |  |+| Asked |  |+| The card in the owner's inbox |  |+| After Allow |  |## Not proven herediff --git a/scripts/verify-team-bot-access.ts b/scripts/verify-team-bot-access.tsindex 281d83164c..db4bb5195b 100644--- a/scripts/verify-team-bot-access.ts+++ b/scripts/verify-team-bot-access.ts@@ -19,6 +19,9 @@ const only = onlyAt === -1 ? null : new Set((process.argv[onlyAt + 1] ?? "").splconst CHROME = process.env.OMB_CDP_CHROME ?? "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";const [WIDTH, HEIGHT] = [1280, 800];const SUBJECT = /^\/api\/(?:bots|threads|groups|routines)\//;+/** The app's time-limited offer opens over the sidebar; its own Not now closes it. */+const DISMISS_OFFER = `(() => { const button = [...document.querySelectorAll('[data-notice="boat-offer"] button')].find((entry) => entry.textContent.trim() === "Not now");+ button?.click(); return Boolean(button); })()`;const PEOPLE = {olive: { email: "[email protected]", role: "owner" as const },@@ -85,6 +88,7 @@ async function openChrome(profile: string) {},async shoot(file: string) {await delay(700);+ if (await evaluate(DISMISS_OFFER)) await delay(500);const { data } = await send("Page.captureScreenshot", { format: "png" });writeFileSync(file, Buffer.from(data, "base64"));console.log(file);@@ -189,6 +193,38 @@ try {{ name: "member-none-eve", who: "eve", query: "mode=simple", act: async () => {await page.until(`!document.querySelector(${JSON.stringify(row)})`, "a sidebar without Payroll");} },+ { name: "overview-admin", who: "ada", query: "mode=simple", act: async () => {+ await page.click("[data-sidebar-account]", "the account menu");+ await page.until(`(() => { const item = [...document.querySelectorAll('[role=menuitem]')].find((entry) => entry.textContent.trim() === "Settings"); item?.click(); return Boolean(item); })()`, "Settings in the menu");+ await page.until("Boolean(document.querySelector('[data-access-overview]'))", "Bot access");+ await page.evaluate("document.querySelector('[data-settings-block=\"botAccess\"]').scrollIntoView({ block: 'start' }); true");+ } },+ { name: "overview-admin-advanced-dark", who: "ada", query: "mode=advanced&skin=midnight", act: async () => {+ await page.until(`(() => { const trigger = [...document.querySelectorAll('button')].find((entry) => entry.textContent.includes("[email protected]")); trigger?.click(); return Boolean(trigger); })()`, "the account menu");+ await page.until(`(() => { const item = [...document.querySelectorAll('[role=menuitem]')].find((entry) => entry.textContent.trim() === "Settings"); item?.click(); return Boolean(item); })()`, "Settings in the menu");+ await page.click("[data-settings-section='botAccess']", "Bot access in the rail");+ await page.until("Boolean(document.querySelector('[data-access-overview]'))", "Bot access");+ } },+ { name: "ask-bob", who: "bob", query: "mode=simple", act: async () => {+ await openPayroll();+ await page.until("Boolean(document.querySelector('[data-ask-to-chat]'))", "Ask to chat");+ } },+ { name: "ask-bob-asked", who: "bob", query: "mode=simple", act: async () => {+ await openPayroll();+ await page.click("[data-ask-to-chat]", "Ask to chat");+ await page.until("Boolean(document.querySelector('[data-ask-to-chat=asked]'))", "Asked");+ } },+ { name: "ask-card-ada-inbox", who: "ada", query: "mode=simple", act: async () => {+ await page.click('[data-sidebar-people] [data-person="[email protected]"]', "Ada's own row");+ await page.until("Boolean([...document.querySelectorAll('[data-inbox-choice], button')].find((entry) => entry.textContent.trim() === 'Allow'))", "the Allow button");+ }, after: async () => {+ await page.evaluate("[...document.querySelectorAll('[data-inbox-choice], button')].find((entry) => entry.textContent.trim() === 'Allow').click(); true");+ await page.until("![...document.querySelectorAll('[data-inbox-choice], button')].some((entry) => entry.textContent.trim() === 'Allow' && !entry.disabled)", "the ask answered");+ } },+ { name: "ask-allowed-bob", who: "bob", query: "mode=simple", act: async () => {+ await openPayroll();+ await page.until("!document.querySelector('[data-testid=view-only-composer]') && Boolean(document.querySelector('textarea'))", "Bob's composer");+ } },];let serving: Who | null = null;for (const shot of SHOTS.filter((entry) => !only || only.has(entry.name))) {diff --git a/server/cloud-team-bot-access.e2e.test.ts b/server/cloud-team-bot-access.e2e.test.tsindex 0bcb6a5757..a93d5d05b1 100644--- a/server/cloud-team-bot-access.e2e.test.ts+++ b/server/cloud-team-bot-access.e2e.test.ts@@ -312,3 +312,62 @@ describe("bots set up before levels", () => {expect((await botOf("dan", board.id))).toMatchObject({ yourAccess: "chat" });});});++describe("asking to chat", () => {+ type Row = { id: string; kind: string; tab: string; text: string; card?: { requestId?: string; accessRequest?: { botId: string; email: string }; answered?: string; answeredText?: string } };+ const inbox = async (who: string) => (await as(who, "GET", "/api/inbox")).body as { threadId: string; rows: Row[] };+ const asks = async (who: string, botId: string) => (await inbox(who)).rows.filter((row) => row.card?.accessRequest?.botId === botId);+ const answer = async (who: string, row: Row, message: string) => {+ const { threadId } = await inbox(who);+ return as(who, "POST", `/api/threads/${threadId}/respond`, { requestId: row.card!.requestId, behavior: "answer", message });+ };++ it("puts one Allow / Not now card in the owner's inbox; Not now changes nothing, Allow lets them chat at once and tells them", async () => {+ const made = await as("ada", "POST", "/api/bots", { name: "Ledger", reportsTo: DAN.email });+ expect(made.status, JSON.stringify(made.body)).toBe(201);+ const ledger = made.body.bot as Bot;+ expect((await share("ada", ledger.id, { everyone: "none", people: { [BOB.email]: "view" } })).status).toBe(200);+ expect((await as("cara", "POST", `/api/bots/${ledger.id}/access-request`)).status, "someone who can't see it").toBe(404);+ expect((await as("dan", "POST", `/api/bots/${ledger.id}/access-request`)).status, "its owner edits it already").toBe(409);++ const asked = await as("bob", "POST", `/api/bots/${ledger.id}/access-request`);+ expect(asked.status, JSON.stringify(asked.body)).toBe(201);+ expect(asked.body.asked).toEqual([{ email: DAN.email, name: "Dan" }]);+ expect((await as("bob", "POST", `/api/bots/${ledger.id}/access-request`)).body.asked, "asking again sends nothing new").toEqual([{ email: DAN.email, name: "Dan" }]);+ const [card] = await asks("dan", ledger.id);+ expect(await asks("dan", ledger.id)).toHaveLength(1);+ expect(card).toMatchObject({ kind: "ask", tab: "needs-you", card: { accessRequest: { botId: ledger.id, email: BOB.email } } });+ expect(await asks("ada", ledger.id), "the owner decides, not every admin").toEqual([]);+ const danInbox = (await inbox("dan")).threadId;+ expect((await as("bob", "POST", `/api/threads/${danInbox}/respond`, { requestId: card!.card!.requestId, behavior: "answer", message: "Allow" })).status, "the asker can't answer it").toBe(404);++ expect((await answer("dan", card!, "Not now")).status).toBe(200);+ expect((await botOf("bob", ledger.id))).toMatchObject({ yourAccess: "view" });+ expect((await asks("dan", ledger.id))[0]).toMatchObject({ tab: "done", card: { answeredText: "Not now" } });++ expect((await as("bob", "POST", `/api/bots/${ledger.id}/access-request`)).status, "a new ask after Not now").toBe(201);+ const again = (await asks("dan", ledger.id)).find((row) => !row.card?.answered)!;+ const allowed = await answer("dan", again, "Allow");+ expect(allowed.status, JSON.stringify(allowed.body)).toBe(200);+ expect(allowed.body).toMatchObject({ outcome: "allowed" });+ expect((await botOf("bob", ledger.id))).toMatchObject({ yourAccess: "chat" });+ expect((await botOf("dan", ledger.id))?.access?.people).toEqual({ [BOB.email]: "chat" });+ expect((await as("bob", "POST", `/api/bots/${ledger.id}/tasks`, { title: "Now mine" })).status).toBe(201);+ expect((await inbox("bob")).rows.some((row) => row.kind === "notice" && row.text === "Dan let you chat with Ledger.")).toBe(true);+ expect((await as("bob", "POST", `/api/bots/${ledger.id}/access-request`)).status).toBe(409);+ });++ it("lets only someone who can edit the bot allow it", async () => {+ const made = await as("ada", "POST", "/api/bots", { name: "Atlas", reportsTo: CARA.email });+ const atlas = made.body.bot as Bot;+ expect((await share("ada", atlas.id, { everyone: "none", people: { [EVE.email]: "view" } })).status).toBe(200);+ expect((await as("eve", "POST", `/api/bots/${atlas.id}/access-request`)).status).toBe(201);+ const [card] = await asks("cara", atlas.id);+ // Cara stops owning it before she answers: her Allow no longer lets anyone in.+ expect((await as("ada", "PUT", `/api/bots/${atlas.id}/reports-to`, { email: null })).status).toBe(200);+ expect((await as("ada", "PUT", `/api/bots/${atlas.id}/access`, { everyone: "none", people: { [EVE.email]: "view" } })).status).toBe(200);+ const refused = await answer("cara", card!, "Allow");+ expect(refused.status, JSON.stringify(refused.body)).toBe(403);+ expect((await botOf("eve", atlas.id))).toMatchObject({ yourAccess: "view" });+ });+});diff --git a/server/host/access-requests.test.ts b/server/host/access-requests.test.tsnew file mode 100644index 0000000000..6092482d03--- /dev/null+++ b/server/host/access-requests.test.ts@@ -0,0 +1,86 @@+import { describe, expect, it } from "vitest";++import type { BotAccessLevel } from "../../shared/bot-access.ts";+import type { Message } from "../store.ts";+import type { VisibleSet } from "../bot-visibility.ts";+import type { RequestAuth } from "../request-auth.ts";+import type { RouteContext } from "../routes/table.ts";+import type { BotRecord } from "../store.ts";+import { personKey } from "../person-key.ts";+import { createAccessRequests } from "./access-requests.ts";+import type { Delivery } from "./person-inbox.ts";++const OLIVE = { email: "[email protected]", role: "owner" as const };+const ADA = { email: "[email protected]", role: "admin" as const };+const BOB = { email: "[email protected]", role: "member" as const };+const key = (email: string) => personKey({ id: "", email });++function fixture(bot: Partial<BotRecord>) {+ const threads = new Map<string, Message[]>();+ const homes = new Map([OLIVE, ADA, BOB].map((person) => [key(person.email), `inbox-${person.email}`]));+ const levels: Record<string, BotAccessLevel> = { [OLIVE.email]: "edit", [ADA.email]: "edit", [BOB.email]: "view" };+ const writes: unknown[] = [];+ const record = { id: "ledger", name: "Ledger", threadId: "t-ledger", createdBy: "[email protected]", access: { everyone: "none", people: { [BOB.email]: "view" } }, ...bot } as BotRecord;+ const requests = createAccessRequests({+ team: { id: "team-acme", name: "Acme" } as never,+ store: () => ({+ bot: (id: string) => (id === record.id ? record : undefined),+ messagesFor: (threadId: string) => threads.get(threadId) ?? [],+ patchMessage: (threadId: string, id: string, patch: Partial<Message>) => {+ threads.set(threadId, (threads.get(threadId) ?? []).map((line) => (line.id === id ? { ...line, ...patch } : line)));+ return null;+ },+ }) as never,+ people: () => [OLIVE, ADA, BOB],+ profileName: () => undefined,+ inbox: () => ({+ deliver: (person: string, delivery: Delivery) => {+ const threadId = homes.get(person)!;+ threads.set(threadId, [...threads.get(threadId) ?? [], { id: `line-${threads.get(threadId)?.length ?? 0}`, role: "bot", kind: delivery.card ? "options" : "text", text: delivery.text, at: 0, ...(delivery.card ? { card: delivery.card } : {}) } as Message]);+ return { threadId };+ },+ personOf: (threadId: string) => [...homes].find(([, home]) => home === threadId)?.[0] ?? null,+ home: (person: string) => (homes.has(person) ? { threadId: homes.get(person)! } : null),+ }),+ visibleTo: (viewer) => ({ level: () => levels[viewer.email ?? ""] ?? "none" }) as unknown as VisibleSet,+ levelOf: (auth) => levels[auth.kind === "session" ? auth.session.email ?? "" : ""] ?? "none",+ writeAccess: (_bot, access) => { writes.push(access); return record; },+ });+ const ask = async (email: string) => {+ let answered: { status: number; body: unknown } | undefined;+ const auth = { kind: "session", session: { id: "s", email, membershipAuthority: "team" }, scopes: ["client"] } as unknown as RequestAuth;+ await requests.routes({ path: `/api/bots/${record.id}/access-request`, method: "POST", auth, res: {}, json: (_res: unknown, status: number, body: unknown) => { answered = { status, body }; } } as unknown as RouteContext);+ return answered!;+ };+ const cards = (email: string) => (threads.get(`inbox-${email}`) ?? []).filter((line) => line.card?.accessRequest);+ return { requests, ask, cards, writes, threads };+}++describe("asking to chat", () => {+ it("asks every admin when the bot's owner is no longer on the team, and one admin's Allow settles every copy", async () => {+ const { requests, ask, cards, writes } = fixture({});+ expect(await ask(BOB.email)).toMatchObject({ status: 201, body: { asked: [{ email: OLIVE.email }, { email: ADA.email }] } });+ expect((await ask(BOB.email)).status, "asked once").toBe(200);+ expect(cards(OLIVE.email)).toHaveLength(1);+ expect(cards(ADA.email)).toHaveLength(1);+ const card = cards(ADA.email)[0]!.card!;+ expect(requests.resolve(`inbox-${ADA.email}`, card.requestId!, "answer", "Allow")).toMatchObject({ status: 200, body: { outcome: "allowed" } });+ expect(writes).toEqual([{ everyone: "none", people: { [BOB.email]: "chat" } }]);+ expect(cards(OLIVE.email)[0]!.card).toMatchObject({ answered: "answer", answeredText: "Allow" });+ expect(requests.resolve(`inbox-${OLIVE.email}`, cards(OLIVE.email)[0]!.card!.requestId!, "answer", "Allow")?.status).toBe(409);+ });++ it("asks the owner alone while they are on the team, and Not now gives nothing", async () => {+ const { requests, ask, cards, writes } = fixture({ reportsTo: OLIVE.email });+ expect(await ask(BOB.email)).toMatchObject({ status: 201, body: { asked: [{ email: OLIVE.email }] } });+ expect(cards(ADA.email)).toEqual([]);+ expect(requests.resolve(`inbox-${OLIVE.email}`, cards(OLIVE.email)[0]!.card!.requestId!, "answer", "Not now")).toMatchObject({ body: { outcome: "declined" } });+ expect(writes).toEqual([]);+ expect(requests.resolve(`inbox-${OLIVE.email}`, "some-other-card", "answer", "Allow")).toBeNull();+ });++ it("refuses an ask from someone who can already chat", async () => {+ const { ask } = fixture({});+ expect((await ask(ADA.email)).status).toBe(409);+ });+});diff --git a/server/host/access-requests.ts b/server/host/access-requests.tsnew file mode 100644index 0000000000..edec2dc015--- /dev/null+++ b/server/host/access-requests.ts@@ -0,0 +1,115 @@+// Asking to chat with a team bot one can only view: POST /api/bots/<id>/access-request puts an Allow / Not now card in+// the inbox of the bot's owner (or of each admin, when nobody owns it). Allow gives the asker Can chat at once and tells+// them in their own inbox. Security: the route is client-scoped and the gate lets anyone who can view the bot reach it;+// the card's answer takes effect only while the person answering can edit the bot.+import { randomUUID } from "node:crypto";++import { ACCESS_REQUEST_OPTIONS, atLeast, type BotAccessLevel } from "../../shared/bot-access.ts";+import { botOwner, nameFromEmail } from "../../shared/bot-owner.ts";+import type { OptionCardData } from "../../shared/wire.ts";+import { accessOf, type Viewer, type VisibleSet } from "../bot-visibility.ts";+import type { CloudTeam, TeamRole } from "../cloud-team.ts";+import { personKey } from "../person-key.ts";+import type { RequestAuth } from "../request-auth.ts";+import { PASS, type RouteHandler } from "../routes/table.ts";+import type { BotRecord, Store } from "../store.ts";+import type { Delivery } from "./person-inbox.ts";++const ONE_BOT = /^\/api\/bots\/([\w-]{1,128})\/access-request$/;++export interface AccessRequestDeps {+ team: CloudTeam | null;+ /** index.ts's store, made after this host. */+ store(): Pick<Store, "bot" | "messagesFor" | "patchMessage">;+ /** The team's current members. */+ people(): ReadonlyArray<{ email: string; role: TeamRole }>;+ /** The name a member chose, when they chose one. */+ profileName(email: string): string | undefined;+ /** Every person's inbox, made after this host. */+ inbox(): {+ deliver(person: string, delivery: Delivery): { threadId: string } | null;+ personOf(threadId: string): string | null;+ home(person: string): { threadId: string } | null | undefined;+ };+ visibleTo(viewer: Viewer): VisibleSet;+ levelOf(auth: RequestAuth, botId: string): BotAccessLevel;+ writeAccess(bot: BotRecord, access: ReturnType<typeof accessOf>): BotRecord | null;+}++export function createAccessRequests(deps: AccessRequestDeps) {+ const personKeyOf = (email: string) => personKey({ id: "", email });+ const nameOf = (email: string) => deps.profileName(email)?.trim() || nameFromEmail(email);+ const levelFor = (person: { email: string; role: TeamRole }, botId: string) =>+ deps.visibleTo(person.role === "member" ? { kind: "member", email: person.email } : { kind: "all", email: person.email }).level(botId);+ const sessionEmail = (auth: RequestAuth) => auth.kind === "session" && auth.session.membershipAuthority === "team" ? auth.session.email?.trim().toLowerCase() ?? null : null;++ /** Who decides: the bot's owner while they are on the team, else every admin. */+ function deciders(bot: BotRecord): Array<{ email: string; role: TeamRole }> {+ const people = deps.people();+ const owner = botOwner(bot);+ const theirs = owner ? people.find((person) => person.email === owner) : undefined;+ return theirs ? [theirs] : people.filter((person) => person.role !== "member");+ }++ /** The open asks for this bot from this person, in the inbox of each admin and of the bot's owner. */+ function openAsks(bot: BotRecord, email: string) {+ const owner = botOwner(bot);+ return deps.people().filter((person) => person.role !== "member" || person.email === owner).flatMap((person) => {+ const home = deps.inbox().home(personKeyOf(person.email));+ const line = home ? deps.store().messagesFor(home.threadId).find((message) =>+ message.card?.accessRequest?.botId === bot.id && message.card.accessRequest.email === email && !message.card.answered && !message.card.dismissed) : undefined;+ return home && line ? [{ person, threadId: home.threadId, line }] : [];+ });+ }++ const routes: RouteHandler = async ({ res, path, method, auth, json }) => {+ const one = method === "POST" ? ONE_BOT.exec(path) : null;+ if (!one) return PASS;+ const bot = deps.store().bot(one[1]!);+ const email = sessionEmail(auth);+ if (!deps.team || !bot || !email) return json(res, 404, { error: "no such bot" });+ if (deps.levelOf(auth, bot.id) !== "view") return json(res, 409, { error: `You can already chat with ${bot.name}.` });+ const asked = openAsks(bot, email);+ if (asked.length) return json(res, 200, { asked: asked.map(({ person }) => ({ email: person.email, name: nameOf(person.email) })) });+ const name = nameOf(email);+ const card: OptionCardData = {+ title: `${name} asks to chat with ${bot.name}`,+ subtitle: `${name} can view ${bot.name}. Allow lets them chat with it and start their own conversations.`,+ options: [...ACCESS_REQUEST_OPTIONS], fixedOptions: true, requestType: "question",+ accessRequest: { botId: bot.id, botName: bot.name, email, name },+ };+ const reached = deciders(bot).filter((person) => deps.inbox().deliver(personKeyOf(person.email), {+ kind: "ask", from: { name, email }, text: card.subtitle, title: card.title, notify: "question", card: { ...card, requestId: `access-${randomUUID()}` },+ }));+ if (!reached.length) return json(res, 409, { error: `Nobody who can let you in has an inbox here yet. Ask an admin of ${deps.team.name}.` });+ return json(res, 201, { asked: reached.map((person) => ({ email: person.email, name: nameOf(person.email) })) });+ };++ /** Answers one of these cards, and the same ask in every other inbox; null for any other card. The person answering+ * is the inbox's own. */+ function resolve(threadId: string, requestId: string, behavior: string, message: unknown): { status: number; body: unknown } | null {+ const line = deps.store().messagesFor(threadId).find((candidate) => candidate.card?.requestId === requestId && candidate.card.accessRequest);+ const ask = line?.card?.accessRequest;+ if (!line?.card || !ask) return null;+ if (line.card.answered || line.card.dismissed) return { status: 409, body: { error: "This has already been answered." } };+ const allow = behavior === "allow" || (behavior === "answer" && message === ACCESS_REQUEST_OPTIONS[0]);+ const decider = deps.inbox().personOf(threadId);+ const person = deps.people().find((one) => personKeyOf(one.email) === decider);+ const bot = deps.store().bot(ask.botId);+ if (allow) {+ if (!bot || !person || levelFor(person, bot.id) !== "edit") return { status: 403, body: { error: `Only people who can edit ${ask.botName} can let someone chat with it.` } };+ const access = accessOf(bot);+ if (!atLeast(access.people[ask.email], "chat")) deps.writeAccess(bot, { everyone: access.everyone, people: { ...access.people, [ask.email]: "chat" } });+ deps.inbox().deliver(personKeyOf(ask.email), {+ kind: "notice", from: { name: nameOf(person.email), email: person.email },+ text: `${nameOf(person.email)} let you chat with ${bot.name}.`, title: `You can chat with ${bot.name}`, notify: "done",+ });+ }+ for (const open of [{ threadId, line }, ...(bot ? openAsks(bot, ask.email).filter((other) => other.threadId !== threadId) : [])]) {+ deps.store().patchMessage(open.threadId, open.line.id, { card: { ...open.line.card!, answered: "answer", answeredText: allow ? ACCESS_REQUEST_OPTIONS[0] : ACCESS_REQUEST_OPTIONS[1] } });+ }+ return { status: 200, body: { ok: true, outcome: allow ? "allowed" : "declined" } };+ }++ return { routes, resolve };+}diff --git a/server/host/person-inbox.ts b/server/host/person-inbox.tsindex 9a1d9e61ec..a1e49edb96 100644--- a/server/host/person-inbox.ts+++ b/server/host/person-inbox.ts@@ -210,10 +210,11 @@ export function createPersonInbox(deps: PersonInboxDeps) {const line = (item: Item) => store.messagesFor(item.threadId).find((message) => message.id === item.id);- /** The card that asked, in the conversation it was asked in; undefined once that conversation is gone. */- const asking = (item: Item) => item.requestId && item.origin+ /** The card that asked, in the conversation it was asked in; undefined once that conversation is gone. An ask that+ * came from no conversation (someone asking for access to a bot) is its own card. */+ const asking = (item: Item) => !item.requestId ? undefined : item.origin? store.messagesFor(item.origin.threadId).findLast((message) => message.card?.requestId === item.requestId && !message.inbox)- : undefined;+ : line(item);/** An ask waits on its person while its copy here and the card that asked are open, however either is answered or* closed. */const askWaits = (item: Item, copy = line(item)) => item.kind === "ask" && liveCardKind(copy?.card) !== null && liveCardKind(asking(item)?.card) !== null;diff --git a/server/index.ts b/server/index.tsindex 6c126741bc..7910ae5821 100644--- a/server/index.ts+++ b/server/index.ts@@ -276,7 +276,7 @@ import { computerKindForResource, ManagedDesktopPolicy, type ComputerKind } fromimport { hostedModelPolicy, HOSTED_MODEL_POLICY_HEADER } from "./hosted-models.ts";import { CLOUD_HOME_SECRET_KEYS, CLOUD_IGNORED_KEYS, cloudHomeConfiguration, cloudHomeOffersPlace, cloudHomePlaceRefusal, firstCloudTurnPatch } from "./cloud-home.ts";import { botBox, startBotBoxAtBoot } from "./bot-box/boot.ts"; import { brokerPath } from "./bot-box/broker-probe.ts";-import { createCloudSignedHost } from "./host/cloud-signed-host.ts"; import { createBotNameClash } from "./host/bot-name-clash.ts"; import { hiddenThreadRefusal, hideOthersSyncFolders } from "./host/team-private.ts"; import { createTeamMemberLeft } from "./host/team-member-left.ts"; import { createUploadOwners, uploadsFor } from "./host/member-uploads.ts"; import { createMemberOwnBot } from "./host/member-own-bot.ts"; import { createVisibilityHost } from "./host/visibility-host.ts"; import { createBotAccessHost, relayedSendRefusal } from "./host/bot-access-gate.ts"; import { createBotAccessRoutes } from "./routes/bot-access.ts";+import { createCloudSignedHost } from "./host/cloud-signed-host.ts"; import { createBotNameClash } from "./host/bot-name-clash.ts"; import { hiddenThreadRefusal, hideOthersSyncFolders } from "./host/team-private.ts"; import { createTeamMemberLeft } from "./host/team-member-left.ts"; import { createUploadOwners, uploadsFor } from "./host/member-uploads.ts"; import { createMemberOwnBot } from "./host/member-own-bot.ts"; import { createVisibilityHost } from "./host/visibility-host.ts"; import { createBotAccessHost, relayedSendRefusal } from "./host/bot-access-gate.ts"; import { createBotAccessRoutes, writeAccess } from "./routes/bot-access.ts"; import { createAccessRequests } from "./host/access-requests.ts";import { createCloudPower, registerCloudPower, wokeFromSleep, type CloudPower } from "./cloud-power.ts"; import { createSharedComputerRoutes } from "./routes/shared-computers.ts";import { lentCopies, noteSyncBotTurn } from "./routes/cloud-sync.ts"; import { mcpReconnectLine, retryBrokeredMcp } from "./bot-box/broker-mcp.ts";import { CLOUD_PERSONAL_REFUSAL, type CloudOwnership } from "./cloud-owner.ts"; import { memberLoginRefusal, personalMoveRefusal } from "./cloud-team.ts"; import { createCloudTeamHost, type MemberProfile } from "./host/cloud-team-host.ts"; import { engineHomes } from "./engine-homes/engine-homes.ts"; import { audienceMember, layerId, memberAudience } from "./audience.ts"; import { createPersonRooms, createRoomReads, type OwnGroupFrames } from "./host/room-reads.ts"; import { createMeRoutes } from "./routes/me.ts"; import { createTeamPhoneRoutes } from "./routes/team-phone.ts"; import { settleCloudHome } from "./cloud-home-settle.ts"; import { CLOUD_OUTSIDE_KEY, outsideDriven } from "./cloud-sharing.ts";@@ -1182,7 +1182,7 @@ async function answeringCardAs(auth: RequestAuth, threadId: string, requestId: s}const { viewerFor, threadOwner, visibleTo, forgetVisibility, threadShown, subjectVisible, hiddenRoutineTarget, roomFeedsBot, settleRoomFloor } = createVisibilityHost({ store: () => store, routines: () => routines,- team: Boolean(CLOUD_TEAM), audiencesFor: (viewer) => teamHost.audiencesFor(viewer), threadsReferencing }); if (CLOUD_TEAM) hideOthersSyncFolders(() => store.bots, threadShown); const botAccess = createBotAccessHost({ visibleFor: (auth) => visibleTo(viewerFor(auth)), store: () => store, routines: () => routines, threadOwner, routineWriter: (id) => cloudRoutineAuthors?.writer(id) }), { levelOf } = botAccess;+ team: Boolean(CLOUD_TEAM), audiencesFor: (viewer) => teamHost.audiencesFor(viewer), threadsReferencing }); if (CLOUD_TEAM) hideOthersSyncFolders(() => store.bots, threadShown); const botAccess = createBotAccessHost({ visibleFor: (auth) => visibleTo(viewerFor(auth)), store: () => store, routines: () => routines, threadOwner, routineWriter: (id) => cloudRoutineAuthors?.writer(id) }), { levelOf } = botAccess; const accessRequests = createAccessRequests({ team: CLOUD_TEAM, store: () => store, people: () => teamOwners.people?.list() ?? [], profileName: (email) => teamHost.people.profile(personKey({ id: "", email })).name, inbox: () => teamMessages.inbox, visibleTo, levelOf, writeAccess: (bot, access) => writeAccess({ store, publicGroupState, broadcast, audienceChanged }, bot, access) });function recentWorkFilter(threadId: string): { include?: (threadId: string) => boolean; privateThread?: (threadId: string) => boolean } {return CLOUD_TEAM ? { include: teamHost.readableFrom(threadId), privateThread: (id) => teamHost.privateTo(id) !== null } : CLOUD_HOME ? { include: cloudOwnerOnlyThread } : {};@@ -12260,7 +12260,7 @@ ROUTES.push(createBotMessageRoutes({routines: () => routines,fromPhone: phones.fromPhone, notePhoneSend: phones.noteSend,desktopManaged: DESKTOP_MANAGED, cloudHome: Boolean(CLOUD_HOME), DirectSendRefused,- acceptDirectSend, directSendRefusal, startTurn, usageTriggerFor, messageSender, cloudGuestSendRefusal, cloudThreadRefusal, relayRefusal: CLOUD_TEAM ? (bot, email) => relayedSendRefusal(bot, email, Boolean(email && teamOwners.people?.list().some((one) => one.email === email && one.role !== "member"))) : undefined,+ acceptDirectSend, directSendRefusal, startTurn, usageTriggerFor, messageSender, cloudGuestSendRefusal, cloudThreadRefusal, resolveAccessRequest: accessRequests.resolve, relayRefusal: CLOUD_TEAM ? (bot, email) => relayedSendRefusal(bot, email, Boolean(email && teamOwners.people?.list().some((one) => one.email === email && one.role !== "member"))) : undefined,cardAnswerRefusal, commandRememberRefusal, requestBehavior, requestedTaskBot, botForThread, threadBusy,botAtThreadCapacity, parksBehindCoordination, activeGroupTurnForBot, runningTurnInstance, engineSteersImages, resolveReplyTarget,turnSelection, policyModelRefusal, clearUnattended, drainQueuedSends, answeringCardAs, resolveAndSendTrust, resolveAndSendTeamSetup,@@ -12310,7 +12310,7 @@ ROUTES.push(createBotSettingsRoutes({requestedTaskBot, threadBusy, activeGroupTurnForBot, checkedModelSelection, engineSwitchNeedsAsk, readCursor,canManageCommandAllowlist, commandAllowlistResponse, cardAnswerRefusal, threadRead: teamMessages.seen, levelOf,}));-ROUTES.push(createBotOrderRoutes({ store, visibleFor: (auth) => visibleTo(viewerFor(auth)) }), createBotAccessRoutes({ team: CLOUD_TEAM, people: teamOwners.people, store, levelOf, wireBot, publicGroupState, broadcast, audienceChanged }));+ROUTES.push(createBotOrderRoutes({ store, visibleFor: (auth) => visibleTo(viewerFor(auth)) }), createBotAccessRoutes({ team: CLOUD_TEAM, people: teamOwners.people, store, levelOf, wireBot, publicGroupState, broadcast, audienceChanged }), accessRequests.routes);ROUTES.push(createBotPatchRoutes({store, cfg, registry, sessions, browserRuntime, browserLive, memoryUpkeep, cacheKeepWarm, hostedModels, supportsApprovalMode,routines: () => routines, activeVpsThreads,diff --git a/server/request-auth.ts b/server/request-auth.tsindex 169553706d..05626c7b05 100644--- a/server/request-auth.ts+++ b/server/request-auth.ts@@ -414,6 +414,8 @@ export const CLIENT_ALLOW: ReadonlyArray<{ methods: readonly string[]; path: Reg{ methods: ["PUT"], path: /^\/api\/bots\/[\w-]+\/reports-to$/ },// a Team Cloud bot's sharing: the handler lets only someone who can edit the bot change it{ methods: ["PUT"], path: /^\/api\/bots\/[\w-]+\/access$/ },+ // asking to chat with a team bot one can view: the handler puts a card in the inbox of whoever can let them in+ { methods: ["POST"], path: /^\/api\/bots\/[\w-]+\/access-request$/ },];export function requiredScope(method: string, path: string, features: { sharedComputers?: boolean } = {}): Scope {diff --git a/server/routes/bot-messages.ts b/server/routes/bot-messages.tsindex 3aa1fcdb03..588b51ff3a 100644--- a/server/routes/bot-messages.ts+++ b/server/routes/bot-messages.ts@@ -136,6 +136,8 @@ export interface BotMessageRouteDeps {typedCardAnswer?(auth: RequestAuth, threadId: string, text: string, target: Message | undefined, line: { sendId?: string; sender?: ResolvedSender }): Promise<{ status: number; message?: Message; error?: string } | null>;/** On a Team Cloud: why the person a relayed message names may not chat with this bot; null when they may. */relayRefusal?(bot: BotRecord, email: string | undefined): string | null;+ /** The answer to someone's ask to chat with a team bot; null for any other card. */+ resolveAccessRequest?(threadId: string, requestId: string, behavior: string, message: unknown): { status: number; body: unknown } | null;}/** External interfaces (the Slack worker) opt in. `onBehalfOf`, advertised by /api/health as@@ -529,6 +531,8 @@ export function createBotMessageRoutes(deps: BotMessageRouteDeps): RouteHandlerif (refusal) return json(res, 403, { error: refusal });}return await answeringCardAs(auth, bot.threadId, String(body.requestId), async () => {+ const access = deps.resolveAccessRequest?.(bot.threadId, String(body.requestId), behavior, body.message);+ if (access) return json(res, access.status, access.body);if (resolveAndSendTrust(res, bot.threadId, String(body.requestId), behavior)) return;if (await resolveAndSendTeamSetup(res, {botId: bot.id, threadId: bot.threadId, requestId: String(body.requestId), behavior,@@ -598,6 +602,8 @@ export function createBotMessageRoutes(deps: BotMessageRouteDeps): RouteHandlerif (refusal) return json(res, 403, { error: refusal });}return await answeringCardAs(auth, threadId, requestId, async () => {+ const access = deps.resolveAccessRequest?.(threadId, requestId, behavior, body.message);+ if (access) return json(res, access.status, access.body);if (resolveAndSendTrust(res, threadId, requestId, behavior)) return;const skillCard = store.messagesFor(threadId).find((message) => message.card?.requestId === requestId && message.card.skillRequest,diff --git a/shared/bot-access.ts b/shared/bot-access.tsindex 1016d4c3bb..50e0957739 100644--- a/shared/bot-access.ts+++ b/shared/bot-access.ts@@ -60,3 +60,10 @@ export function sameAccess(a: BotAccess, b: BotAccess): boolean {const left = Object.entries(a.people), right = b.people;return a.everyone === b.everyone && left.length === Object.keys(right).length && left.every(([entry, level]) => right[entry] === level);}++export interface AccessRequestCardField {+ /** Someone who can view a team bot asks the person this card is in front of to let them chat with it. */+ accessRequest?: { botId: string; botName: string; email: string; name: string };+}++export const ACCESS_REQUEST_OPTIONS = ["Allow", "Not now"] as const;diff --git a/shared/wire.ts b/shared/wire.tsindex a9e4312163..f9ad2274ac 100644--- a/shared/wire.ts+++ b/shared/wire.ts@@ -11,7 +11,7 @@ import type { BotBodyId } from "./bot-body.ts";import type { ReplyStyle } from "./reply-style.ts";import type { CredentialTargetId, CUSTOM_SECRET_TARGET, SecretDelivery } from "./credential-request.ts";import type { TeamSetupRequest } from "./team-setup.ts"; import type { DefaultBotFields, HelperIntroField } from "./default-bot.ts";-import type { SetupCardFields } from "./setup-card.ts"; import type { BugReportField } from "./devs-report-status.ts"; import type { BotAccessFields } from "./bot-access.ts";+import type { SetupCardFields } from "./setup-card.ts"; import type { BugReportField } from "./devs-report-status.ts"; import type { AccessRequestCardField, BotAccessFields } from "./bot-access.ts";import type { RoutineRequestCardData } from "./routine-request.ts"; import type { SavedStepsMark } from "./saved-steps.ts";import type { WebhookRequestCardData } from "./webhook-request.ts"; import type { WaitCardField, WaitLineField } from "./wait-request.ts"; import type { ComputerAskField } from "./computer-ask.ts";import type { AppEventAttempt, AppTrigger, AppTriggerRequestCardData, AppTriggerService } from "./app-triggers.ts";@@ -645,7 +645,7 @@ export function nextOpenThread<T extends OpenThreadCandidate>(tasks: readonly T[return [listed, open, own].map((candidates) => orderedThreadList(candidates)[0]).find((task) => task !== undefined);}-export interface OptionCardData extends WaitCardField, ComputerAskField {+export interface OptionCardData extends WaitCardField, ComputerAskField, AccessRequestCardField {/** calls: one per outbound call the card covers, in subtitle order. */outboundRequest?: { tool: string; app: string | null; calls?: Array<{ app: string | null; label: string }> };/** `revision`: the entry as it applied without a person, so Undo can tell it changed since. */diff --git a/src/components/NewConversationInstead.tsx b/src/components/NewConversationInstead.tsxindex 5fab4ef946..9b3781cf1a 100644--- a/src/components/NewConversationInstead.tsx+++ b/src/components/NewConversationInstead.tsx@@ -2,15 +2,17 @@ import { Eye } from "lucide-react";import { t } from "@/lib/i18n";import type { Bot } from "@/state/store";+import { AskToChat } from "./bot-access/AskToChat";/** In place of the composer where this person may not write: a Cloud guest in someone else's conversation, or a team* bot they can only view. */-export function NewConversationInstead({ bot, room = false, onNew }: { bot?: Pick<Bot, "name" | "yourAccess">; room?: boolean; onNew: () => void }) {+export function NewConversationInstead({ bot, room = false, onNew }: { bot?: Pick<Bot, "id" | "name" | "yourAccess" | "createdBy" | "reportsTo" | "defaultBot">; room?: boolean; onNew: () => void }) {if (bot?.yourAccess === "view") {return (- <div className="pointer-events-auto mx-5 mb-4 flex items-center gap-3 rounded-2xl border border-hairline/60 bg-raised px-4 py-3" data-testid="view-only-composer">+ <div className="pointer-events-auto mx-5 mb-4 flex flex-wrap items-center gap-3 rounded-2xl border border-hairline/60 bg-raised px-4 py-3" data-testid="view-only-composer"><Eye size={16} aria-hidden="true" className="shrink-0 text-ink-secondary" /><p className="min-w-0 flex-1 text-[13px] text-ink-secondary">{t(room ? "botAccess.viewOnlyRoom" : "botAccess.viewOnly", { bot: bot.name })}</p>+ <AskToChat bot={bot} /></div>);}diff --git a/src/components/QuestionCard.tsx b/src/components/QuestionCard.tsxindex 37d22f20a5..957c23f722 100644--- a/src/components/QuestionCard.tsx+++ b/src/components/QuestionCard.tsx@@ -28,6 +28,7 @@ import {} from "./AskCard";import { ExpandableText } from "./ExpandableText";import { useInboxOrigin } from "./InboxLine";+import { accessRequestWords, cardAnswerFor } from "./bot-access/access-card";export { isQuestionCard } from "@/lib/question-card";@@ -43,7 +44,8 @@ const TITLE_MAX = 160;export function cardQuestions(card: NonNullable<Message["card"]>): AskQuestion[] {if (card.questionRequest?.questions.length) return card.questionRequest.questions;if (!card.subtitle && !card.title) return [];- return [{ question: card.subtitle || card.title, options: card.options.map((label) => ({ label })), ...(card.fixedOptions && card.options.length ? { custom: false as const } : {}) }];+ const words = accessRequestWords(card);+ return [{ question: words?.question ?? (card.subtitle || card.title), options: (words?.options ?? card.options).map((label) => ({ label })), ...(card.fixedOptions && card.options.length ? { custom: false as const } : {}) }];}export function answersInOneTap(questions: readonly AskQuestion[]): boolean {@@ -124,7 +126,7 @@ export function QuestionCard({if (sending || !card?.requestId) return;const answers = questions.map((_, index) => answersOf(final[index] ?? EMPTY));if (answers.some((entry) => !entry.length)) return;- const message = card.questionRequest ? formatQuestionAnswers(questions, answers) : answers[0]![0]!;+ const message = card.questionRequest ? formatQuestionAnswers(questions, answers) : cardAnswerFor(card, answers[0]![0]!);if (!message) return;setFailed(false);setSent({ answer: message, ...(label ? { label } : {}) });diff --git a/src/components/SettingsModal.groups.test.ts b/src/components/SettingsModal.groups.test.tsindex 6b09efb80d..0a828093d1 100644--- a/src/components/SettingsModal.groups.test.ts+++ b/src/components/SettingsModal.groups.test.ts@@ -20,13 +20,14 @@ const fixture = vi.hoisted(() => ({dispatch: vi.fn(),switches: [] as ComponentProps<typeof Switch>[],ownerOrAdmin: null as boolean | null,+ config: {} as Record<string, unknown>,}));vi.mock("./DesktopCapabilities", () => ({ useDesktopCapabilities: () => ({ capabilities: {} }) }));vi.mock("@/state/store", async (importOriginal) => ({...await importOriginal<typeof import("@/state/store")>(),api: fixture.api,- useStore: () => ({ state: { appSettingsSection: fixture.section, instances: [] }, dispatch: fixture.dispatch }),+ useStore: () => ({ state: { appSettingsSection: fixture.section, instances: [], config: fixture.config }, dispatch: fixture.dispatch }),}));vi.mock("@/lib/thread-preferences", () => ({useShowThreads: () => fixture.showThreads,@@ -71,6 +72,7 @@ beforeEach(() => {fixture.advancedMode = true;fixture.switches = [];fixture.ownerOrAdmin = null;+ fixture.config = {};vi.stubGlobal("window", {});vi.stubGlobal("document", { documentElement: { dataset: {} } });setLocale("en");@@ -100,7 +102,7 @@ describe("Settings rail groups", () => {expect(SETTINGS_GROUPS.map((group) => group.id)).toEqual(["you", "ai", "computers", "account"]);const ids = SECTIONS.map((entry) => entry.id);expect(new Set(ids).size).toBe(ids.length);- expect(ids).toHaveLength(19); // 16 + the shared Skills library (AI group) + Logins (Devices) + Import (Account)+ expect(ids).toHaveLength(20); // 16 + the shared Skills library (AI group) + Logins (Devices) + Import and a team's Bot access (Account)for (const entry of SECTIONS) expect(SETTINGS_GROUPS.map((group) => group.id)).toContain(entry.group);});@@ -126,6 +128,17 @@ describe("Settings rail groups", () => {expect(Object.values(groups).flat()).not.toContain("cloudAccount");});+ it("gives a team's admins its Bot access page, and nobody else", () => {+ fixture.config = { team: { id: "team-acme", name: "Acme" }, cloudHome: true };+ fixture.ownerOrAdmin = true;+ expect(rail(render()).account).toContain("botAccess");+ fixture.ownerOrAdmin = false;+ expect(Object.values(rail(render())).flat()).not.toContain("botAccess");+ fixture.config = {};+ fixture.ownerOrAdmin = true;+ expect(Object.values(rail(render())).flat()).not.toContain("botAccess");+ });+it("shows a paired remote client only Appearance, Remote access and Servers", () => {vi.stubGlobal("window", { ogb: { remoteClient: { active: true }, environments: {}, organization: {}, cloudAccount: {} } });expect(rail(render())).toEqual({ you: ["appearance", "companion"], computers: ["desktopWorkspaces"] });diff --git a/src/components/SettingsModal.tsx b/src/components/SettingsModal.tsxindex 3277cc1805..daa3caf855 100644--- a/src/components/SettingsModal.tsx+++ b/src/components/SettingsModal.tsx@@ -21,6 +21,7 @@ import { CompanionSection } from "./CompanionSection";import { ServerPairingCard } from "./ServerPairingCard";import { PeopleSection } from "./PeopleSection";import { ActivitySection } from "./ActivitySection";+import { AccessOverview } from "./bot-access/AccessOverview";import { useOwnerOrAdmin } from "@/lib/use-owner-or-admin";import { currentPhonePairingTarget, phonePairingSettingsAction } from "@/lib/phone-pairing";import { CustomDomainSettings } from "./CustomDomainSettings";@@ -100,6 +101,7 @@ export const SECTIONS: Array<{{ id: "backups", group: "account", labelKey: "settings.section.backups", icon: Archive, keywords: ["export", "import", "restore", "full backup", "password", "recovery"] },{ id: "import", group: "account", labelKey: "settings.section.import", icon: Download, keywords: ["import", "grok", "grok bot", "x.ai", "cursor", "claude code", "codex", "gemini", "skills", "mcp", "tools", "bring"] },{ id: "people", group: "account", labelKey: "settings.section.people", icon: Users, keywords: ["people", "users", "invite", "sign in", "members", "admins", "access"] },+ { id: "botAccess", group: "account", labelKey: "settings.section.botAccess", icon: Users, keywords: ["access", "share", "sharing", "who can", "view", "chat", "edit", "permissions", "team", "members", "bots"] },{ id: "activity", group: "account", labelKey: "settings.section.activity", icon: ScrollText, keywords: ["activity", "audit", "log", "history", "who changed", "approvals", "decisions", "admin"] },{ id: "workspaces", group: "account", labelKey: "settings.section.workspaces", icon: Building2, keywords: ["clients", "tenants", "fleet", "workspaces", "installation", "installations"] },{ id: "experimental", group: "account", labelKey: "settings.section.experimental", icon: FlaskConical, keywords: ["early", "preview", "learn", "skill", "authoring"] },@@ -114,7 +116,7 @@ export type SimpleSettingsPage = {};export const SIMPLE_PAGES: SimpleSettingsPage[] = [- { id: "general", labelKey: "settings.section.general", icon: Settings, sections: ["general", "appearance", "people", "import", "organization", "activity"],+ { id: "general", labelKey: "settings.section.general", icon: Settings, sections: ["general", "appearance", "people", "botAccess", "import", "organization", "activity"],keywords: ["account", "theme", "looks", "open at login", "startup", "analytics", "advanced mode"] },{ id: "ai", labelKey: "settings.group.ai", icon: Sparkles, sections: ["engines", "connections"] },{ id: "computer", labelKey: "settings.simple.page.computer", icon: Monitor, sections: ["companion", "desktopWorkspaces", "computer", "logins"] },@@ -195,7 +197,8 @@ export function SettingsModal() {.filter((entry) => entry.id !== "cloudAccount" || Boolean(window.ogb?.cloudAccount || (window.ogb?.cloudPlan && state.config?.cloudHome === true))).filter((entry) => entry.id !== "workspaces" || workspacesAvailable(state.config)).filter((entry) => entry.id !== "people" || (!window.ogb && state.config?.cloudHome !== true))- .filter((entry) => entry.id !== "activity" || (!window.ogb && ownerOrAdmin === true));+ .filter((entry) => entry.id !== "activity" || (!window.ogb && ownerOrAdmin === true))+ .filter((entry) => entry.id !== "botAccess" || (Boolean(state.config?.team) && ownerOrAdmin === true));const availableSections = baseSections.filter((entry) => entry.id !== "skills" || skillsLibraryEnabled(state.config));const visibleSections = availableSections.filter((entry) => sectionMatches(entry, q));@@ -412,6 +415,8 @@ export function SettingsModal() {return <PeopleSection />;case "activity":return <ActivitySection />;+ case "botAccess":+ return <AccessOverview />;case "workspaces":return <WorkspacesSection />;default:diff --git a/src/components/SettingsSimplePages.tsx b/src/components/SettingsSimplePages.tsxindex 5c220eb233..121e6b61ae 100644--- a/src/components/SettingsSimplePages.tsx+++ b/src/components/SettingsSimplePages.tsx@@ -14,6 +14,7 @@ import { EnginesSettings } from "./EnginesSettings";import { LocalComputerSection } from "./LocalComputerSection";import { PeopleSection } from "./PeopleSection";import { ActivitySection } from "./ActivitySection";+import { AccessOverview } from "./bot-access/AccessOverview";import { BuiltInBrowserRow } from "./BrowserSettingsRows";import { LoginsSettings } from "./LoginsSettings";import { OrganizationSettings } from "./OrganizationSettings";@@ -91,6 +92,7 @@ export function SimpleGeneralPage({ has, peopleOpen, onLooks }: { has: Has; peop)}{has("import") && <SettingsGroup label={t("settings.section.import")} block="import"><AdminOnly><ImportSettings /></AdminOnly></SettingsGroup>}{has("organization") && <SettingsGroup label={t("settings.section.organization")} block="organization"><OrganizationSettings /></SettingsGroup>}+ {has("botAccess") && <SettingsGroup label={t("settings.section.botAccess")} block="botAccess"><AccessOverview /></SettingsGroup>}{has("activity") && <SettingsGroup label={t("settings.section.activity")} block="activity"><ActivitySection /></SettingsGroup>}<div data-settings-block="advanced-mode" className="scroll-mt-4"><SettingsRows><AdvancedModeRow simple /></SettingsRows>diff --git a/src/components/bot-access/AccessOverview.dom.test.ts b/src/components/bot-access/AccessOverview.dom.test.tsnew file mode 100644index 0000000000..704a7ff762--- /dev/null+++ b/src/components/bot-access/AccessOverview.dom.test.ts@@ -0,0 +1,105 @@+// @vitest-environment happy-dom+// Settings → Bot access in a real DOM: every team bot by every User, the owner, what everyone gets, a change applied at+// once with Undo; and a viewer's "Ask Ada to chat".+import { createElement } from "react";+import { flushSync } from "react-dom";+import { createRoot, type Root } from "react-dom/client";+import { afterEach, beforeEach, expect, it, vi } from "vitest";+import type { Bot } from "@/state/store";++const server = vi.hoisted(() => ({ calls: [] as Array<{ path: string; body: unknown }>, bots: [] as unknown[], answer: {} as unknown }));+vi.mock("@/state/store", async (importOriginal) => ({+ ...await importOriginal<typeof import("@/state/store")>(),+ api: vi.fn(async (path: string, init?: RequestInit) => {+ server.calls.push({ path, body: init?.body ? JSON.parse(String(init.body)) : undefined });+ return server.answer;+ }),+ useStore: () => ({ state: { config: { team: { id: "team-acme", name: "Acme" } }, bots: server.bots }, dispatch: vi.fn() }),+}));+vi.mock("../Avatar", () => ({ BotAvatar: () => null }));++const { setTeamPeople } = await import("@/state/team-people");+const { AccessOverview } = await import("./AccessOverview");+const { AskToChat } = await import("./AskToChat");++const ADA = { email: "[email protected]", name: "Ada", role: "admin" };+const BOB = { email: "[email protected]", name: "Bob", role: "member" };+const CARA = { email: "[email protected]", name: "Cara", role: "member" };+const bot = (fields: Partial<Bot>): Bot => ({+ id: "x", threadId: "t", name: "X", title: "", description: "", notifications: true, color: "teal", unread: false, messages: [],+ modelSelection: { instanceId: "claude", model: "claude-opus-5-5" }, yourAccess: "edit", createdBy: ADA.email, ...fields,+});+const payroll = bot({ id: "payroll", name: "Payroll", reportsTo: CARA.email, access: { everyone: "none", people: { [BOB.email]: "view" } } });+const helpdesk = bot({ id: "helpdesk", name: "Helpdesk", access: { everyone: "chat", people: {} } });+const bobsOwn = bot({ id: "bobs", name: "MausBot", defaultBot: { person: BOB.email } });++let host: HTMLDivElement;+let root: Root;+const settle = async () => { for (let i = 0; i < 4; i++) await new Promise((resolve) => setTimeout(resolve, 0)); };+const render = (node: ReturnType<typeof createElement>) => flushSync(() => root.render(node));+const select = (label: string) => document.querySelector<HTMLSelectElement>(`select[aria-label="${label}"]`)!;+const choose = (label: string, value: string) => {+ const field = select(label);+ field.value = value;+ field.dispatchEvent(new Event("change", { bubbles: true }));+};++beforeEach(() => {+ server.calls.length = 0;+ server.bots = [payroll, helpdesk, bobsOwn];+ server.answer = {};+ setTeamPeople({ people: [{ ...ADA, you: true }, BOB, CARA], me: { ...ADA, you: true }, admin: true, needsYou: [] });+ host = document.createElement("div");+ document.body.append(host);+ root = createRoot(host);+});+afterEach(() => {+ flushSync(() => root.unmount());+ host.remove();+ document.body.innerHTML = "";+ setTeamPeople(null);+});++it("lists each team bot with every User's level and what everyone gets, leaving out each person's own MausBot", () => {+ render(createElement(AccessOverview));+ expect([...document.querySelectorAll("[data-access-row]")].map((row) => row.getAttribute("data-access-row"))).toEqual(["helpdesk", "payroll"]);+ expect(select("Set for everyone: Payroll").value).toBe("none");+ expect(select("What Bob can do with Payroll").value).toBe("view");+ expect(document.querySelector('[data-access-row="payroll"] [data-access-cell="[email protected]"]')!.textContent).toBe("Owner");+ expect(select("What Bob can do with Helpdesk").value).toBe("chat");+ expect([...select("What Bob can do with Helpdesk").options].filter((option) => option.disabled).map((option) => option.value)).toEqual(["none", "view"]);+});++it("applies a cell or a whole row at once, with Undo", async () => {+ render(createElement(AccessOverview));+ choose("What Bob can do with Payroll", "edit");+ await settle();+ expect(server.calls.at(-1)).toEqual({ path: "/api/bots/payroll/access", body: { everyone: "none", people: { [BOB.email]: "edit" } } });+ const toast = document.querySelector<HTMLElement>("[data-access-toast]")!;+ expect(toast.textContent).toContain("Payroll: Bob · Can edit");+ toast.querySelector("button")!.click();+ await settle();+ expect(server.calls.at(-1)).toEqual({ path: "/api/bots/payroll/access", body: payroll.access });+ choose("What Bob can do with Payroll", "none");+ await settle();+ expect(server.calls.at(-1)!.body).toEqual({ everyone: "none", people: {} });+ choose("Set for everyone: Payroll", "view");+ await settle();+ expect(server.calls.at(-1)!.body).toEqual({ everyone: "view", people: { [BOB.email]: "view" } });+});++it("asks the bot's owner by name, then says it asked", async () => {+ server.answer = { asked: [{ email: CARA.email, name: "Cara" }] };+ render(createElement(AskToChat, { bot: payroll }));+ const button = host.querySelector<HTMLButtonElement>("[data-ask-to-chat]")!;+ expect(button.textContent).toBe("Ask Cara to chat");+ button.click();+ await settle();+ expect(server.calls).toEqual([{ path: "/api/bots/payroll/access-request", body: {} }]);+ expect(host.querySelector('[data-ask-to-chat="asked"]')!.textContent).toBe("Asked Cara");+});++it("asks the admins when nobody on the team owns the bot", () => {+ render(createElement(AskToChat, { bot: bot({ id: "orphan", createdBy: "[email protected]" }) }));+ expect(host.querySelector("[data-ask-to-chat]")!.textContent).toBe("Ask an admin to chat");+});diff --git a/src/components/bot-access/AccessOverview.tsx b/src/components/bot-access/AccessOverview.tsxnew file mode 100644index 0000000000..94c445a1df--- /dev/null+++ b/src/components/bot-access/AccessOverview.tsx@@ -0,0 +1,117 @@+import { useCallback, useState } from "react";++import { atLeast, BOT_ACCESS_LEVELS, type BotAccess, type BotAccessLevel } from "../../../shared/bot-access";+import { botOwner } from "../../../shared/bot-owner";+import { t } from "@/lib/i18n";+import { useStore, type Bot } from "@/state/store";+import { useTeamPeople, type TeamPerson } from "@/state/team-people";+import { BotAvatar } from "../Avatar";+import { Select } from "../Select";+import { PersonFace } from "../TeamOwner";+import { accessOfBot, levelLabel, saveAccess, withPerson } from "./access";+import { UndoToast, useTeamName } from "./ShareBotButton";++type Change = { botId: string; before: BotAccess; after: BotAccess; text: string };++/** The team's bots a person shares: each person's own MausBot is theirs alone and stays out. */+export const sharedBots = (bots: readonly Bot[]): Bot[] =>+ bots.filter((bot) => !bot.hidden && !bot.defaultBot?.person).sort((a, b) => a.name.localeCompare(b.name));++/** What a person may do with the bot by its sharing: the higher of everyone's and theirs. */+export function cellLevel(access: BotAccess, email: string): BotAccessLevel {+ const own = access.people[email];+ return own && atLeast(own, access.everyone) ? own : access.everyone;+}++/** Settings → Bot access on a team, for its admins: every team bot down the side, each User across with the level they+ * have, and what everyone in the team gets. The same sharing the bot's Share dialog changes, applied at once with Undo. */+export function AccessOverview() {+ const { state } = useStore();+ const team = useTeamPeople();+ const teamName = useTeamName();+ const [change, setChange] = useState<Change | null>(null);+ const [error, setError] = useState("");+ const settled = useCallback(() => setChange(null), []);+ if (!team || !teamName) return null;+ const members = team.people.filter((person) => person.role === "member").sort((a, b) => a.name.localeCompare(b.name));+ const bots = sharedBots(state.bots);++ const apply = async (bot: Bot, after: BotAccess, text: string) => {+ setError("");+ const before = accessOfBot(bot);+ try {+ await saveAccess(bot.id, after);+ setChange({ botId: bot.id, before, after, text });+ } catch (cause) {+ setError(cause instanceof Error ? cause.message : String(cause));+ }+ };++ return (+ <div className="flex flex-col gap-3" data-access-overview>+ <p className="text-[13px] leading-relaxed text-ink-secondary">{t("botAccess.overview.intro", { team: teamName })}</p>+ {bots.length === 0 ? <p className="text-[13px] text-ink-secondary">{t("botAccess.overview.noBots")}</p> : (+ <div className="max-w-full overflow-x-auto rounded-xl border border-hairline/40 bg-card">+ <table className="w-full border-collapse text-[13px]">+ <thead>+ <tr className="border-b border-hairline/40 text-left text-ink-secondary">+ <th scope="col" className="sticky left-0 z-[1] bg-card px-3 py-2 font-medium">{t("botAccess.overview.bot")}</th>+ <th scope="col" className="px-3 py-2 font-medium">{t("botAccess.everyone", { team: teamName })}</th>+ {members.map((person) => (+ <th key={person.email} scope="col" className="px-3 py-2 font-medium">+ <span className="flex items-center gap-1.5 whitespace-nowrap"><PersonFace person={person} size={18} />{person.name}</span>+ </th>+ ))}+ </tr>+ </thead>+ <tbody>+ {bots.map((bot) => <BotRow key={bot.id} bot={bot} members={members} teamName={teamName} apply={apply} />)}+ </tbody>+ </table>+ </div>+ )}+ {members.length === 0 && bots.length > 0 && <p className="text-[12px] text-ink-secondary">{t("botAccess.overview.noPeople")}</p>}+ <p className="text-[12px] text-ink-secondary">{t("botAccess.admins")}</p>+ {error && <p role="alert" className="text-[13px] text-danger">{error}</p>}+ {change && <UndoToast key={`${change.botId}:${change.text}:${JSON.stringify(change.after)}`} text={change.text}+ onUndo={() => saveAccess(change.botId, change.before)} onDone={settled} />}+ </div>+ );+}++function BotRow({ bot, members, teamName, apply }: {+ bot: Bot; members: TeamPerson[]; teamName: string; apply: (bot: Bot, after: BotAccess, text: string) => Promise<void>;+}) {+ const access = accessOfBot(bot);+ const owner = botOwner(bot);+ return (+ <tr className="border-b border-hairline/30 last:border-b-0" data-access-row={bot.id}>+ <th scope="row" className="sticky left-0 z-[1] bg-card px-3 py-1.5 text-left font-normal">+ <span className="flex items-center gap-2 whitespace-nowrap text-ink"><BotAvatar bot={bot} size={20} />{bot.name}</span>+ </th>+ <td className="px-3 py-1.5">+ <Select variant="ghost" aria-label={t("botAccess.overview.setForEveryone", { bot: bot.name })} value={access.everyone}+ onChange={(event) => {+ const everyone = event.target.value as BotAccessLevel;+ void apply(bot, { everyone, people: access.people }, t("botAccess.overview.toastEveryone", { bot: bot.name, team: teamName, level: levelLabel(everyone) }));+ }}>+ {BOT_ACCESS_LEVELS.map((level) => <option key={level} value={level}>{level === "none" ? t("botAccess.onlyAdded") : levelLabel(level)}</option>)}+ </Select>+ </td>+ {members.map((person) => (+ <td key={person.email} className="px-3 py-1.5" data-access-cell={person.email}>+ {person.email === owner ? <span className="whitespace-nowrap px-2.5 text-ink-secondary">{t("botAccess.owner")}</span> : (+ <Select variant="ghost" aria-label={t("botAccess.overview.cell", { name: person.name, bot: bot.name })} value={cellLevel(access, person.email)}+ onChange={(event) => {+ const level = event.target.value as BotAccessLevel;+ void apply(bot, withPerson(access, person.email, level === "none" || level === access.everyone ? null : level),+ t("botAccess.overview.toastPerson", { name: person.name, bot: bot.name, level: levelLabel(level) }));+ }}>+ {BOT_ACCESS_LEVELS.map((level) => <option key={level} value={level} disabled={!atLeast(level, access.everyone)}>{levelLabel(level)}</option>)}+ </Select>+ )}+ </td>+ ))}+ </tr>+ );+}diff --git a/src/components/bot-access/AskToChat.tsx b/src/components/bot-access/AskToChat.tsxnew file mode 100644index 0000000000..a97aad0030--- /dev/null+++ b/src/components/bot-access/AskToChat.tsx@@ -0,0 +1,43 @@+import { useState } from "react";++import { botOwner } from "../../../shared/bot-owner";+import { t } from "@/lib/i18n";+import { api, type Bot } from "@/state/store";+import { useTeamPeople } from "@/state/team-people";++type Asked = Array<{ email: string; name: string }>;++/** "Ask Ada to chat" for a team bot this person can only view: its owner gets an Allow / Not now card in their inbox (the+ * admins, when nobody on the team owns it), and Allow lets this person chat at once. */+export function AskToChat({ bot }: { bot: Pick<Bot, "id" | "createdBy" | "reportsTo" | "defaultBot"> }) {+ const team = useTeamPeople();+ const [asked, setAsked] = useState<Asked | null>(null);+ const [busy, setBusy] = useState(false);+ const [error, setError] = useState("");+ if (!team) return null;+ const ownerEmail = botOwner(bot);+ const owner = team.people.find((person) => person.email === ownerEmail);+ const whom = (people: Asked) => (people.length === 1 ? people[0]!.name : t("botAccess.theAdmins"));+ if (asked) return <span role="status" data-ask-to-chat="asked" className="shrink-0 text-[13px] text-ink-secondary">{t("botAccess.asked", { name: whom(asked) })}</span>;+ const ask = async () => {+ setBusy(true);+ setError("");+ try {+ const answer = await api<{ asked?: Asked }>(`/api/bots/${bot.id}/access-request`, { method: "POST", body: "{}" });+ setAsked(answer.asked ?? []);+ } catch (cause) {+ setError(cause instanceof Error ? cause.message : String(cause));+ } finally {+ setBusy(false);+ }+ };+ return (+ <>+ {error && <span role="alert" className="min-w-0 text-[12px] text-danger">{error}</span>}+ <button type="button" data-ask-to-chat disabled={busy} onClick={() => void ask()}+ className="shrink-0 rounded-full bg-accent px-3 py-1 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-60">+ {owner ? t("botAccess.ask", { name: owner.name }) : t("botAccess.askAdmins")}+ </button>+ </>+ );+}diff --git a/src/components/bot-access/access-card.ts b/src/components/bot-access/access-card.tsnew file mode 100644index 0000000000..8bed313b48--- /dev/null+++ b/src/components/bot-access/access-card.ts@@ -0,0 +1,18 @@+import type { Message } from "@/state/store";+import { t } from "@/lib/i18n";++type Card = Pick<NonNullable<Message["card"]>, "accessRequest" | "options">;++/** Someone's ask to chat with a bot, in this person's language: the question and its two choices. Null for any other+ * card, which shows its own words. */+export function accessRequestWords(card: Card | undefined): { question: string; options: string[] } | null {+ const ask = card?.accessRequest;+ if (!ask) return null;+ return { question: t("botAccess.request.question", { name: ask.name, bot: ask.botName }), options: [t("botAccess.request.allow"), t("botAccess.request.notNow")] };+}++/** What a tap on a shown choice answers: the card's own option at the same place, whatever language it was shown in. */+export function cardAnswerFor(card: Card | undefined, label: string): string {+ const at = accessRequestWords(card)?.options.indexOf(label) ?? -1;+ return at >= 0 ? card?.options[at] ?? label : label;+}diff --git a/src/components/inbox/InboxCard.tsx b/src/components/inbox/InboxCard.tsxindex 0a4559b011..520f0f0c0d 100644--- a/src/components/inbox/InboxCard.tsx+++ b/src/components/inbox/InboxCard.tsx@@ -14,6 +14,7 @@ import { ELEVATED_CARD } from "../elevated";import { InboxRowItem } from "./InboxRow";import { asMessage } from "./InboxReading";import { askOf, CARD_ROWS, choiceResponse, choicesOf, rowsIn, tabCounts } from "./inbox-view";+import { accessRequestWords } from "../bot-access/access-card";import { useInboxActions } from "./use-inbox-actions";/** Most choices a question shows as buttons on the card; one with more opens in the inbox. */@@ -49,7 +50,7 @@ function Answers({ row, view }: { row: InboxRow; view: InboxView }) {return (<div>{choices.length > 0 && choices.length <= CARD_CHOICES && (- <AskChoices choices={choices.map((label) => ({ label }))} label={row.card?.subtitle ?? row.text} sending={sending} tag="data-inbox-choice" onPick={pick} />+ <AskChoices choices={choices.map((label) => ({ label }))} label={accessRequestWords(row.card)?.question ?? row.card?.subtitle ?? row.text} sending={sending} tag="data-inbox-choice" onPick={pick} />)}<div className="mt-1.5 flex justify-end"><button type="button" data-inbox-action="reply" onClick={reading} className={ASK_QUIET_ANSWER}><CornerUpLeft size={15} aria-hidden="true" />{t("chat.reply")}</button>diff --git a/src/components/inbox/InboxReading.tsx b/src/components/inbox/InboxReading.tsxindex 0de188bd08..0c3e5fd22a 100644--- a/src/components/inbox/InboxReading.tsx+++ b/src/components/inbox/InboxReading.tsx@@ -13,7 +13,8 @@ import { InboxSender } from "../InboxLine";import { pendingApprovals, PendingApprovalActions, PendingApprovalPanel } from "../PendingApproval";import { QuestionCard } from "../QuestionCard";import { threadUpdatedLabel } from "../SidebarThreadRow";-import { askOf, closeResponse, subjectOf } from "./inbox-view";+import { askOf, closeResponse, subjectOf, textOf } from "./inbox-view";+import { accessRequestWords } from "../bot-access/access-card";import { useInboxActions } from "./use-inbox-actions";/** The line as the chat shows it, so an ask answers here with the very card it asks with in the chat. */@@ -69,7 +70,7 @@ export function InboxReading({ view, row, now }: { view: InboxView; row: InboxRo</div></header><div className="min-h-0 flex-1 space-y-3 overflow-y-auto px-4 py-3">- {!ask && <p className="whitespace-pre-wrap break-words text-[14px] leading-6 text-ink">{row.text}</p>}+ {!ask && <p className="whitespace-pre-wrap break-words text-[14px] leading-6 text-ink">{textOf(row)}</p>}{row.answers?.map((given) => (<p key={given.at} className="rounded-xl bg-ink/[0.045] px-3 py-2 text-[13px] text-ink-secondary"><span className="block text-[11px] font-medium text-ink-tertiary">{t(given.by === "assistant" ? "inbox.assistantAnswered" : "inbox.youReplied")}</span>@@ -78,7 +79,7 @@ export function InboxReading({ view, row, now }: { view: InboxView; row: InboxRo))}{row.tab === "done" && (<>- {row.kind === "ask" && <p className="whitespace-pre-wrap break-words text-[14px] leading-6 text-ink">{row.card?.subtitle ?? row.text}</p>}+ {row.kind === "ask" && <p className="whitespace-pre-wrap break-words text-[14px] leading-6 text-ink">{accessRequestWords(row.card)?.question ?? row.card?.subtitle ?? row.text}</p>}<p className="flex items-center gap-1.5 text-[13px] text-ink-secondary"><Check size={14} aria-hidden="true" />{settledLabel(row)}</p></>)}diff --git a/src/components/inbox/InboxRow.tsx b/src/components/inbox/InboxRow.tsxindex 8a77481ae8..5c7d8c8ae6 100644--- a/src/components/inbox/InboxRow.tsx+++ b/src/components/inbox/InboxRow.tsx@@ -7,7 +7,7 @@ import { t } from "@/lib/i18n";import type { LocaleKey } from "@/locales";import { InboxSender } from "../InboxLine";import { threadUpdatedLabel } from "../SidebarThreadRow";-import { quickActions, subjectOf, type QuickAction } from "./inbox-view";+import { quickActions, subjectOf, textOf, type QuickAction } from "./inbox-view";const ACTION_LOOK: Record<QuickAction, { Icon: LucideIcon; label: LocaleKey }> = {allow: { Icon: Check, label: "approval.action.allowOnce" },@@ -41,7 +41,7 @@ export function InboxRowItem({ row, now, onOpen, onAction, inCard = false }: {<span className={cn("shrink-0 truncate", inCard ? "w-[7.5rem]" : "w-[5.5rem] sm:w-[6.5rem]")}>{row.from.name}</span><span className="flex min-w-0 flex-1 items-baseline gap-1.5"><span className="max-w-[45%] shrink-0 truncate">{subject}</span>- <span className="min-w-0 truncate font-normal text-ink-tertiary">{row.text}</span>+ <span className="min-w-0 truncate font-normal text-ink-tertiary">{textOf(row)}</span></span><span className="shrink-0 text-[11px] font-normal tabular-nums text-ink-tertiary group-focus-within:invisible group-hover:invisible">{threadUpdatedLabel(row.at, now)}</span></button>diff --git a/src/components/inbox/inbox-view.ts b/src/components/inbox/inbox-view.tsindex be8d49f7ce..9220938f85 100644--- a/src/components/inbox/inbox-view.ts+++ b/src/components/inbox/inbox-view.ts@@ -3,6 +3,7 @@ import type { InboxRow, InboxTab, InboxView } from "../../../shared/inbox";import { liveCardKind } from "../../../shared/live-approval";import { t } from "@/lib/i18n";import { dismissResponse, type CardResponse } from "@/lib/card-answer";+import { accessRequestWords, cardAnswerFor } from "../bot-access/access-card";export const INBOX_TABS: readonly InboxTab[] = ["needs-you", "info", "done"];/** The Needs you lines the inbox's card in the chat shows, the newest first. */@@ -33,13 +34,16 @@ export const choicesOf = (row: InboxRow): string[] => {const card = row.card;if (askOf(row) !== "question" || !card) return [];if (card.questionRequest) return questionChoices(card.questionRequest.questions) ?? [];- return card.options;+ return accessRequestWords(card)?.options ?? card.options;};+/** What a line says: an ask for access in this person's language, anything else as it came. */+export const textOf = (row: InboxRow): string => accessRequestWords(row.card)?.question ?? row.text;+/** What a tap on one of a question's choices sends. */export function choiceResponse(row: InboxRow, label: string): CardResponse {const questions = row.card?.questionRequest?.questions;- return { behavior: "answer", message: questions ? formatQuestionAnswers(questions, [[label]]) : label };+ return { behavior: "answer", message: questions ? formatQuestionAnswers(questions, [[label]]) : cardAnswerFor(row.card, label) };}/** What closing a question without an answer sends; an approval closes as a deny. */diff --git a/src/locales/de.json b/src/locales/de.jsonindex fac6f2ecca..61461aca31 100644--- a/src/locales/de.json+++ b/src/locales/de.json@@ -2753,5 +2753,21 @@"botAccess.yours.chat": "Du darfst mit {bot} chatten und eigene Unterhaltungen mit ihm beginnen. Wer ihn bearbeiten darf, legt fest, wer Zugriff hat.","botAccess.yours.other": "Wer {bot} bearbeiten darf, legt fest, wer Zugriff hat.","botAccess.viewOnly": "Du darfst {bot} ansehen, aber nicht mit ihm chatten.",- "botAccess.viewOnlyRoom": "Du darfst {bot} nur ansehen: Du kannst diesen Raum lesen, aber nicht darin schreiben."+ "botAccess.viewOnlyRoom": "Du darfst {bot} nur ansehen: Du kannst diesen Raum lesen, aber nicht darin schreiben.",+ "botAccess.ask": "{name} fragen, ob du chatten darfst",+ "botAccess.askAdmins": "Einen Admin fragen, ob du chatten darfst",+ "botAccess.asked": "{name} gefragt",+ "botAccess.theAdmins": "die Admins",+ "botAccess.request.question": "{name} möchte mit {bot} chatten. „Erlauben“ lässt die Person mit dem Bot chatten und eigene Unterhaltungen beginnen.",+ "botAccess.request.allow": "Erlauben",+ "botAccess.request.notNow": "Jetzt nicht",+ "settings.section.botAccess": "Zugriff auf Bots",+ "botAccess.overview.intro": "Wer in {team} jeden Bot ansehen, mit ihm chatten und ihn bearbeiten darf. Änderungen gelten sofort.",+ "botAccess.overview.noBots": "Es gibt noch keine Team-Bots.",+ "botAccess.overview.noPeople": "Außer Admins ist noch niemand im Team.",+ "botAccess.overview.bot": "Bot",+ "botAccess.overview.setForEveryone": "Für alle festlegen: {bot}",+ "botAccess.overview.cell": "Was {name} mit {bot} darf",+ "botAccess.overview.toastEveryone": "{bot}: alle in {team} · {level}",+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}"}diff --git a/src/locales/en.json b/src/locales/en.jsonindex c880eb8555..d48f2b8b31 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -7254,5 +7254,21 @@"botAccess.yours.chat": "You can chat with {bot} and start your own conversations with it. People who can edit it choose who has access.","botAccess.yours.other": "People who can edit {bot} choose who has access.","botAccess.viewOnly": "You can view {bot}, not chat with it.",- "botAccess.viewOnlyRoom": "You can only view {bot}, so you can read this room but not write in it."+ "botAccess.viewOnlyRoom": "You can only view {bot}, so you can read this room but not write in it.",+ "botAccess.ask": "Ask {name} to chat",+ "botAccess.askAdmins": "Ask an admin to chat",+ "botAccess.asked": "Asked {name}",+ "botAccess.theAdmins": "the admins",+ "botAccess.request.question": "{name} asks to chat with {bot}. Allow lets them chat with it and start their own conversations.",+ "botAccess.request.allow": "Allow",+ "botAccess.request.notNow": "Not now",+ "settings.section.botAccess": "Bot access",+ "botAccess.overview.intro": "Who in {team} can view, chat with and edit each bot. Changes apply at once.",+ "botAccess.overview.noBots": "There are no team bots yet.",+ "botAccess.overview.noPeople": "Nobody but admins is on the team yet.",+ "botAccess.overview.bot": "Bot",+ "botAccess.overview.setForEveryone": "Set for everyone: {bot}",+ "botAccess.overview.cell": "What {name} can do with {bot}",+ "botAccess.overview.toastEveryone": "{bot}: everyone in {team} · {level}",+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}"}diff --git a/src/locales/es.json b/src/locales/es.jsonindex 5c0c1583e8..461abd5659 100644--- a/src/locales/es.json+++ b/src/locales/es.json@@ -5650,5 +5650,21 @@"botAccess.yours.chat": "Puedes chatear con {bot} y empezar tus propias conversaciones con él. Quienes pueden editarlo eligen quién tiene acceso.","botAccess.yours.other": "Quienes pueden editar {bot} eligen quién tiene acceso.","botAccess.viewOnly": "Puedes ver {bot}, pero no chatear con él.",- "botAccess.viewOnlyRoom": "Solo puedes ver {bot}, así que puedes leer este grupo pero no escribir en él."+ "botAccess.viewOnlyRoom": "Solo puedes ver {bot}, así que puedes leer este grupo pero no escribir en él.",+ "botAccess.ask": "Pedir a {name} poder chatear",+ "botAccess.askAdmins": "Pedir a un admin poder chatear",+ "botAccess.asked": "Se lo pediste a {name}",+ "botAccess.theAdmins": "los admins",+ "botAccess.request.question": "{name} pide chatear con {bot}. Permitir le deja chatear con él y empezar sus propias conversaciones.",+ "botAccess.request.allow": "Permitir",+ "botAccess.request.notNow": "Ahora no",+ "settings.section.botAccess": "Acceso a los bots",+ "botAccess.overview.intro": "Quién de {team} puede ver, chatear con y editar cada bot. Los cambios se aplican al instante.",+ "botAccess.overview.noBots": "Todavía no hay bots del equipo.",+ "botAccess.overview.noPeople": "Aún no hay nadie en el equipo aparte de los admins.",+ "botAccess.overview.bot": "Bot",+ "botAccess.overview.setForEveryone": "Elegir para todos: {bot}",+ "botAccess.overview.cell": "Lo que {name} puede hacer con {bot}",+ "botAccess.overview.toastEveryone": "{bot}: todo {team} · {level}",+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}"}diff --git a/src/locales/fr.json b/src/locales/fr.jsonindex 2511062388..d0ed78aeb4 100644--- a/src/locales/fr.json+++ b/src/locales/fr.json@@ -2701,5 +2701,21 @@"botAccess.yours.chat": "Vous pouvez discuter avec {bot} et commencer vos propres conversations avec lui. Les personnes qui peuvent le modifier choisissent qui y a accès.","botAccess.yours.other": "Les personnes qui peuvent modifier {bot} choisissent qui y a accès.","botAccess.viewOnly": "Vous pouvez voir {bot}, mais pas discuter avec lui.",- "botAccess.viewOnlyRoom": "Vous pouvez seulement voir {bot} : vous pouvez lire ce salon, mais pas y écrire."+ "botAccess.viewOnlyRoom": "Vous pouvez seulement voir {bot} : vous pouvez lire ce salon, mais pas y écrire.",+ "botAccess.ask": "Demander à {name} de pouvoir discuter",+ "botAccess.askAdmins": "Demander à un admin de pouvoir discuter",+ "botAccess.asked": "Demandé à {name}",+ "botAccess.theAdmins": "les admins",+ "botAccess.request.question": "{name} demande à discuter avec {bot}. Autoriser lui permet de discuter avec lui et de commencer ses propres conversations.",+ "botAccess.request.allow": "Autoriser",+ "botAccess.request.notNow": "Pas maintenant",+ "settings.section.botAccess": "Accès aux bots",+ "botAccess.overview.intro": "Qui dans {team} peut voir, discuter avec et modifier chaque bot. Les changements s'appliquent tout de suite.",+ "botAccess.overview.noBots": "Il n'y a pas encore de bots d'équipe.",+ "botAccess.overview.noPeople": "Il n'y a encore personne d'autre que les admins dans l'équipe.",+ "botAccess.overview.bot": "Bot",+ "botAccess.overview.setForEveryone": "Définir pour tous : {bot}",+ "botAccess.overview.cell": "Ce que {name} peut faire avec {bot}",+ "botAccess.overview.toastEveryone": "{bot} : tout {team} · {level}",+ "botAccess.overview.toastPerson": "{bot} : {name} · {level}"}diff --git a/src/locales/hi.json b/src/locales/hi.jsonindex 22d8a7dedd..036a98c2fe 100644--- a/src/locales/hi.json+++ b/src/locales/hi.json@@ -2701,5 +2701,21 @@"botAccess.yours.chat": "आप {bot} से चैट कर सकते हैं और इसके साथ अपनी बातचीत शुरू कर सकते हैं। जो इसे बदल सकते हैं, वही तय करते हैं कि ऐक्सेस किसके पास है।","botAccess.yours.other": "जो {bot} को बदल सकते हैं, वही तय करते हैं कि ऐक्सेस किसके पास है।","botAccess.viewOnly": "आप {bot} को देख सकते हैं, उससे चैट नहीं कर सकते।",- "botAccess.viewOnlyRoom": "आप {bot} को सिर्फ़ देख सकते हैं, इसलिए यह रूम पढ़ सकते हैं पर इसमें लिख नहीं सकते।"+ "botAccess.viewOnlyRoom": "आप {bot} को सिर्फ़ देख सकते हैं, इसलिए यह रूम पढ़ सकते हैं पर इसमें लिख नहीं सकते।",+ "botAccess.ask": "{name} से चैट की अनुमति माँगें",+ "botAccess.askAdmins": "किसी एडमिन से चैट की अनुमति माँगें",+ "botAccess.asked": "{name} से पूछ लिया",+ "botAccess.theAdmins": "एडमिन",+ "botAccess.request.question": "{name} {bot} से चैट करना चाहते हैं। अनुमति देने से वे इससे चैट कर सकेंगे और अपनी बातचीत शुरू कर सकेंगे।",+ "botAccess.request.allow": "अनुमति दें",+ "botAccess.request.notNow": "अभी नहीं",+ "settings.section.botAccess": "बॉट ऐक्सेस",+ "botAccess.overview.intro": "{team} में कौन हर बॉट को देख, उससे चैट और उसे बदल सकता है। बदलाव तुरंत लागू होते हैं।",+ "botAccess.overview.noBots": "अभी कोई टीम बॉट नहीं है।",+ "botAccess.overview.noPeople": "अभी टीम में एडमिन के अलावा कोई नहीं है।",+ "botAccess.overview.bot": "बॉट",+ "botAccess.overview.setForEveryone": "सबके लिए तय करें: {bot}",+ "botAccess.overview.cell": "{name} {bot} के साथ क्या कर सकते हैं",+ "botAccess.overview.toastEveryone": "{bot}: {team} में सभी · {level}",+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}"}diff --git a/src/locales/it.json b/src/locales/it.jsonindex 4cc9367f4c..abe5136730 100644--- a/src/locales/it.json+++ b/src/locales/it.json@@ -6347,5 +6347,21 @@"botAccess.yours.chat": "Puoi chattare con {bot} e iniziare le tue conversazioni con lui. Chi può modificarlo sceglie chi ha accesso.","botAccess.yours.other": "Chi può modificare {bot} sceglie chi ha accesso.","botAccess.viewOnly": "Puoi vedere {bot}, ma non chattare con lui.",- "botAccess.viewOnlyRoom": "Puoi solo vedere {bot}, quindi puoi leggere questa stanza ma non scriverci."+ "botAccess.viewOnlyRoom": "Puoi solo vedere {bot}, quindi puoi leggere questa stanza ma non scriverci.",+ "botAccess.ask": "Chiedi a {name} di poter chattare",+ "botAccess.askAdmins": "Chiedi a un amministratore di poter chattare",+ "botAccess.asked": "Chiesto a {name}",+ "botAccess.theAdmins": "gli amministratori",+ "botAccess.request.question": "{name} chiede di chattare con {bot}. Consenti gli permette di chattare e iniziare le proprie conversazioni.",+ "botAccess.request.allow": "Consenti",+ "botAccess.request.notNow": "Non ora",+ "settings.section.botAccess": "Accesso ai bot",+ "botAccess.overview.intro": "Chi in {team} può vedere, chattare con e modificare ogni bot. Le modifiche valgono subito.",+ "botAccess.overview.noBots": "Non ci sono ancora bot del team.",+ "botAccess.overview.noPeople": "Nel team ci sono ancora solo gli amministratori.",+ "botAccess.overview.bot": "Bot",+ "botAccess.overview.setForEveryone": "Imposta per tutti: {bot}",+ "botAccess.overview.cell": "Cosa può fare {name} con {bot}",+ "botAccess.overview.toastEveryone": "{bot}: tutti in {team} · {level}",+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}"}diff --git a/src/locales/ja.json b/src/locales/ja.jsonindex 1fd28cf017..bb53a79338 100644--- a/src/locales/ja.json+++ b/src/locales/ja.json@@ -6573,5 +6573,21 @@"botAccess.yours.chat": "{bot} とチャットし、自分の会話を始められます。アクセスできる人は、編集できる人が決めます。","botAccess.yours.other": "アクセスできる人は、{bot} を編集できる人が決めます。","botAccess.viewOnly": "{bot} は閲覧のみで、チャットはできません。",- "botAccess.viewOnlyRoom": "{bot} は閲覧のみのため、このルームは読めますが書き込めません。"+ "botAccess.viewOnlyRoom": "{bot} は閲覧のみのため、このルームは読めますが書き込めません。",+ "botAccess.ask": "{name} にチャットの許可を頼む",+ "botAccess.askAdmins": "管理者にチャットの許可を頼む",+ "botAccess.asked": "{name} に依頼しました",+ "botAccess.theAdmins": "管理者",+ "botAccess.request.question": "{name} が {bot} とのチャットを希望しています。許可すると、チャットや自分の会話の開始ができるようになります。",+ "botAccess.request.allow": "許可",+ "botAccess.request.notNow": "今はしない",+ "settings.section.botAccess": "ボットへのアクセス",+ "botAccess.overview.intro": "{team} の誰が各ボットを閲覧・チャット・編集できるか。変更はすぐに反映されます。",+ "botAccess.overview.noBots": "チームのボットはまだありません。",+ "botAccess.overview.noPeople": "チームにはまだ管理者しかいません。",+ "botAccess.overview.bot": "ボット",+ "botAccess.overview.setForEveryone": "全員に設定: {bot}",+ "botAccess.overview.cell": "{name} が {bot} でできること",+ "botAccess.overview.toastEveryone": "{bot}: {team} の全員 · {level}",+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}"}diff --git a/src/locales/ko.json b/src/locales/ko.jsonindex 4cd25145d1..702b6c705d 100644--- a/src/locales/ko.json+++ b/src/locales/ko.json@@ -7070,5 +7070,21 @@"settings.windowFrame.title": "창 프레임","settings.windowFrame.subtitle": "위쪽에 지금 있는 곳을 알려 주는 얇은 막대가 생기고, 채팅은 모서리가 둥근 카드 안에 보여요. 끄면 창이 예전 모습으로 돌아가요.","settings.windowFrame.restart": "{app}을(를) 다시 시작하면 적용돼요.",- "settings.windowFrame.restartNow": "지금 다시 시작"+ "settings.windowFrame.restartNow": "지금 다시 시작",+ "botAccess.ask": "{name}님에게 대화 허락 요청",+ "botAccess.askAdmins": "관리자에게 대화 허락 요청",+ "botAccess.asked": "{name}님에게 요청함",+ "botAccess.theAdmins": "관리자",+ "botAccess.request.question": "{name}님이 {bot}와 대화하길 원해요. 허용하면 대화하고 자신의 대화를 시작할 수 있어요.",+ "botAccess.request.allow": "허용",+ "botAccess.request.notNow": "나중에",+ "settings.section.botAccess": "봇 접근 권한",+ "botAccess.overview.intro": "{team}에서 누가 각 봇을 보고, 대화하고, 편집할 수 있는지예요. 변경 사항은 바로 적용돼요.",+ "botAccess.overview.noBots": "아직 팀 봇이 없어요.",+ "botAccess.overview.noPeople": "아직 팀에 관리자 말고는 아무도 없어요.",+ "botAccess.overview.bot": "봇",+ "botAccess.overview.setForEveryone": "모두에게 설정: {bot}",+ "botAccess.overview.cell": "{name}님이 {bot}로 할 수 있는 일",+ "botAccess.overview.toastEveryone": "{bot}: {team}의 모든 사람 · {level}",+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}"}diff --git a/src/locales/pl.json b/src/locales/pl.jsonindex ef488cc130..c4b4d88f5e 100644--- a/src/locales/pl.json+++ b/src/locales/pl.json@@ -6470,5 +6470,21 @@"botAccess.yours.chat": "Możesz rozmawiać z {bot} i zaczynać z nim własne rozmowy. O dostępie decydują osoby, które mogą go edytować.","botAccess.yours.other": "O dostępie decydują osoby, które mogą edytować {bot}.","botAccess.viewOnly": "Możesz wyświetlać {bot}, ale nie rozmawiać z nim.",- "botAccess.viewOnlyRoom": "Możesz tylko wyświetlać {bot}, więc możesz czytać ten pokój, ale nie pisać w nim."+ "botAccess.viewOnlyRoom": "Możesz tylko wyświetlać {bot}, więc możesz czytać ten pokój, ale nie pisać w nim.",+ "botAccess.ask": "Poproś {name} o możliwość rozmowy",+ "botAccess.askAdmins": "Poproś administratora o możliwość rozmowy",+ "botAccess.asked": "Poproszono: {name}",+ "botAccess.theAdmins": "administratorów",+ "botAccess.request.question": "{name} prosi o możliwość rozmowy z {bot}. Zezwól, aby mógł z nim rozmawiać i zaczynać własne rozmowy.",+ "botAccess.request.allow": "Zezwól",+ "botAccess.request.notNow": "Nie teraz",+ "settings.section.botAccess": "Dostęp do botów",+ "botAccess.overview.intro": "Kto w {team} może wyświetlać, rozmawiać z każdym botem i go edytować. Zmiany działają od razu.",+ "botAccess.overview.noBots": "Nie ma jeszcze botów zespołu.",+ "botAccess.overview.noPeople": "W zespole są na razie tylko administratorzy.",+ "botAccess.overview.bot": "Bot",+ "botAccess.overview.setForEveryone": "Ustaw dla wszystkich: {bot}",+ "botAccess.overview.cell": "Co {name} może robić z {bot}",+ "botAccess.overview.toastEveryone": "{bot}: wszyscy w {team} · {level}",+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}"}diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex 5e30e35448..77185a924a 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -6331,5 +6331,21 @@"botAccess.yours.chat": "Você pode conversar com {bot} e começar suas próprias conversas com ele. Quem pode editá-lo escolhe quem tem acesso.","botAccess.yours.other": "Quem pode editar {bot} escolhe quem tem acesso.","botAccess.viewOnly": "Você pode ver {bot}, mas não conversar com ele.",- "botAccess.viewOnlyRoom": "Você só pode ver {bot}, então pode ler este grupo, mas não escrever nele."+ "botAccess.viewOnlyRoom": "Você só pode ver {bot}, então pode ler este grupo, mas não escrever nele.",+ "botAccess.ask": "Pedir a {name} para conversar",+ "botAccess.askAdmins": "Pedir a um admin para conversar",+ "botAccess.asked": "Pedido a {name}",+ "botAccess.theAdmins": "os admins",+ "botAccess.request.question": "{name} pede para conversar com {bot}. Permitir deixa conversar com ele e começar as próprias conversas.",+ "botAccess.request.allow": "Permitir",+ "botAccess.request.notNow": "Agora não",+ "settings.section.botAccess": "Acesso aos bots",+ "botAccess.overview.intro": "Quem em {team} pode ver, conversar com e editar cada bot. As mudanças valem na hora.",+ "botAccess.overview.noBots": "Ainda não há bots da equipe.",+ "botAccess.overview.noPeople": "Ainda não há ninguém na equipe além dos admins.",+ "botAccess.overview.bot": "Bot",+ "botAccess.overview.setForEveryone": "Definir para todos: {bot}",+ "botAccess.overview.cell": "O que {name} pode fazer com {bot}",+ "botAccess.overview.toastEveryone": "{bot}: todos em {team} · {level}",+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}"}diff --git a/src/locales/ru.json b/src/locales/ru.jsonindex db307b8aa5..370ceac452 100644--- a/src/locales/ru.json+++ b/src/locales/ru.json@@ -6551,5 +6551,21 @@"botAccess.yours.chat": "Вы можете общаться с {bot} и начинать с ним свои разговоры. Кто имеет доступ, решают те, кто может его редактировать.","botAccess.yours.other": "Кто имеет доступ, решают те, кто может редактировать {bot}.","botAccess.viewOnly": "Вы можете просматривать {bot}, но не общаться с ним.",- "botAccess.viewOnlyRoom": "Вы можете только просматривать {bot}, поэтому можете читать эту комнату, но не писать в ней."+ "botAccess.viewOnlyRoom": "Вы можете только просматривать {bot}, поэтому можете читать эту комнату, но не писать в ней.",+ "botAccess.ask": "Попросить {name} разрешить общение",+ "botAccess.askAdmins": "Попросить администратора разрешить общение",+ "botAccess.asked": "Запрос отправлен: {name}",+ "botAccess.theAdmins": "администраторам",+ "botAccess.request.question": "{name} просит разрешения общаться с {bot}. «Разрешить» позволит общаться с ним и начинать свои разговоры.",+ "botAccess.request.allow": "Разрешить",+ "botAccess.request.notNow": "Не сейчас",+ "settings.section.botAccess": "Доступ к ботам",+ "botAccess.overview.intro": "Кто в {team} может просматривать, общаться с каждым ботом и редактировать его. Изменения действуют сразу.",+ "botAccess.overview.noBots": "Ботов команды пока нет.",+ "botAccess.overview.noPeople": "В команде пока только администраторы.",+ "botAccess.overview.bot": "Бот",+ "botAccess.overview.setForEveryone": "Задать для всех: {bot}",+ "botAccess.overview.cell": "Что {name} может делать с {bot}",+ "botAccess.overview.toastEveryone": "{bot}: все в {team} · {level}",+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}"}diff --git a/src/locales/tr.json b/src/locales/tr.jsonindex 48fd965d7c..ce0d5db7ed 100644--- a/src/locales/tr.json+++ b/src/locales/tr.json@@ -5141,5 +5141,21 @@"botAccess.yours.chat": "{bot} ile sohbet edebilir ve onunla kendi sohbetlerini başlatabilirsin. Kimin erişimi olacağını onu düzenleyebilenler seçer.","botAccess.yours.other": "Kimin erişimi olacağını {bot} botunu düzenleyebilenler seçer.","botAccess.viewOnly": "{bot} botunu görüntüleyebilirsin ama onunla sohbet edemezsin.",- "botAccess.viewOnlyRoom": "{bot} botunu yalnızca görüntüleyebildiğin için bu odayı okuyabilirsin ama yazamazsın."+ "botAccess.viewOnlyRoom": "{bot} botunu yalnızca görüntüleyebildiğin için bu odayı okuyabilirsin ama yazamazsın.",+ "botAccess.ask": "{name} kişisinden sohbet izni iste",+ "botAccess.askAdmins": "Bir yöneticiden sohbet izni iste",+ "botAccess.asked": "{name} kişisine soruldu",+ "botAccess.theAdmins": "yöneticiler",+ "botAccess.request.question": "{name}, {bot} ile sohbet etmek istiyor. İzin ver, onunla sohbet etmesini ve kendi sohbetlerini başlatmasını sağlar.",+ "botAccess.request.allow": "İzin ver",+ "botAccess.request.notNow": "Şimdi değil",+ "settings.section.botAccess": "Bot erişimi",+ "botAccess.overview.intro": "{team} ekibinde kimin her botu görüntüleyebileceği, onunla sohbet edebileceği ve onu düzenleyebileceği. Değişiklikler hemen geçerli olur.",+ "botAccess.overview.noBots": "Henüz ekip botu yok.",+ "botAccess.overview.noPeople": "Ekipte henüz yöneticilerden başka kimse yok.",+ "botAccess.overview.bot": "Bot",+ "botAccess.overview.setForEveryone": "Herkes için ayarla: {bot}",+ "botAccess.overview.cell": "{name}, {bot} ile neler yapabilir",+ "botAccess.overview.toastEveryone": "{bot}: {team} ekibindeki herkes · {level}",+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}"}diff --git a/src/locales/uk.json b/src/locales/uk.jsonindex 5941780f02..f2fa86f142 100644--- a/src/locales/uk.json+++ b/src/locales/uk.json@@ -3144,5 +3144,21 @@"botAccess.yours.chat": "Ви можете спілкуватися з {bot} і починати з ним власні розмови. Хто має доступ, вирішують ті, хто може його редагувати.","botAccess.yours.other": "Хто має доступ, вирішують ті, хто може редагувати {bot}.","botAccess.viewOnly": "Ви можете переглядати {bot}, але не спілкуватися з ним.",- "botAccess.viewOnlyRoom": "Ви можете лише переглядати {bot}, тож можете читати цю кімнату, але не писати в ній."+ "botAccess.viewOnlyRoom": "Ви можете лише переглядати {bot}, тож можете читати цю кімнату, але не писати в ній.",+ "botAccess.ask": "Попросити {name} дозволити спілкування",+ "botAccess.askAdmins": "Попросити адміністратора дозволити спілкування",+ "botAccess.asked": "Запит надіслано: {name}",+ "botAccess.theAdmins": "адміністраторам",+ "botAccess.request.question": "{name} просить дозволу спілкуватися з {bot}. «Дозволити» дає змогу спілкуватися з ним і починати власні розмови.",+ "botAccess.request.allow": "Дозволити",+ "botAccess.request.notNow": "Не зараз",+ "settings.section.botAccess": "Доступ до ботів",+ "botAccess.overview.intro": "Хто в {team} може переглядати, спілкуватися з кожним ботом і редагувати його. Зміни діють одразу.",+ "botAccess.overview.noBots": "Ботів команди ще немає.",+ "botAccess.overview.noPeople": "У команді поки що лише адміністратори.",+ "botAccess.overview.bot": "Бот",+ "botAccess.overview.setForEveryone": "Задати для всіх: {bot}",+ "botAccess.overview.cell": "Що {name} може робити з {bot}",+ "botAccess.overview.toastEveryone": "{bot}: усі в {team} · {level}",+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}"}diff --git a/src/locales/vi.json b/src/locales/vi.jsonindex dc13a076e9..9cf769e5b3 100644--- a/src/locales/vi.json+++ b/src/locales/vi.json@@ -5141,5 +5141,21 @@"botAccess.yours.chat": "Bạn có thể trò chuyện với {bot} và bắt đầu cuộc trò chuyện riêng với nó. Người có thể chỉnh sửa nó sẽ chọn ai có quyền truy cập.","botAccess.yours.other": "Người có thể chỉnh sửa {bot} sẽ chọn ai có quyền truy cập.","botAccess.viewOnly": "Bạn có thể xem {bot}, nhưng không thể trò chuyện với nó.",- "botAccess.viewOnlyRoom": "Bạn chỉ có thể xem {bot}, nên bạn đọc được phòng này nhưng không thể viết vào đó."+ "botAccess.viewOnlyRoom": "Bạn chỉ có thể xem {bot}, nên bạn đọc được phòng này nhưng không thể viết vào đó.",+ "botAccess.ask": "Xin {name} cho trò chuyện",+ "botAccess.askAdmins": "Xin quản trị viên cho trò chuyện",+ "botAccess.asked": "Đã xin {name}",+ "botAccess.theAdmins": "các quản trị viên",+ "botAccess.request.question": "{name} xin được trò chuyện với {bot}. Cho phép để họ trò chuyện với nó và bắt đầu cuộc trò chuyện riêng.",+ "botAccess.request.allow": "Cho phép",+ "botAccess.request.notNow": "Để sau",+ "settings.section.botAccess": "Quyền truy cập bot",+ "botAccess.overview.intro": "Ai trong {team} có thể xem, trò chuyện và chỉnh sửa từng bot. Thay đổi có hiệu lực ngay.",+ "botAccess.overview.noBots": "Chưa có bot nào của nhóm.",+ "botAccess.overview.noPeople": "Trong nhóm chưa có ai ngoài quản trị viên.",+ "botAccess.overview.bot": "Bot",+ "botAccess.overview.setForEveryone": "Đặt cho mọi người: {bot}",+ "botAccess.overview.cell": "{name} có thể làm gì với {bot}",+ "botAccess.overview.toastEveryone": "{bot}: mọi người trong {team} · {level}",+ "botAccess.overview.toastPerson": "{bot}: {name} · {level}"}diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.jsonindex 4810755be6..ce49d30063 100644--- a/src/locales/zh-tw.json+++ b/src/locales/zh-tw.json@@ -4532,5 +4532,21 @@"botAccess.yours.chat": "你可以和 {bot} 聊天,也可以和它開始自己的對話。能編輯它的人決定誰有存取權。","botAccess.yours.other": "能編輯 {bot} 的人決定誰有存取權。","botAccess.viewOnly": "你可以檢視 {bot},但不能和它聊天。",- "botAccess.viewOnlyRoom": "你只能檢視 {bot},所以可以閱讀這個聊天室,但不能在裡面發言。"+ "botAccess.viewOnlyRoom": "你只能檢視 {bot},所以可以閱讀這個聊天室,但不能在裡面發言。",+ "botAccess.ask": "請 {name} 允許你聊天",+ "botAccess.askAdmins": "請管理員允許你聊天",+ "botAccess.asked": "已請求 {name}",+ "botAccess.theAdmins": "管理員",+ "botAccess.request.question": "{name} 請求和 {bot} 聊天。允許後,對方可以和它聊天並開始自己的對話。",+ "botAccess.request.allow": "允許",+ "botAccess.request.notNow": "暫不",+ "settings.section.botAccess": "機器人存取權",+ "botAccess.overview.intro": "{team} 裡誰可以檢視、和哪個機器人聊天以及編輯它。變更立即生效。",+ "botAccess.overview.noBots": "還沒有團隊機器人。",+ "botAccess.overview.noPeople": "團隊裡除了管理員還沒有其他人。",+ "botAccess.overview.bot": "機器人",+ "botAccess.overview.setForEveryone": "為所有人設定:{bot}",+ "botAccess.overview.cell": "{name} 能對 {bot} 做什麼",+ "botAccess.overview.toastEveryone": "{bot}:{team} 的所有人 · {level}",+ "botAccess.overview.toastPerson": "{bot}:{name} · {level}"}diff --git a/src/locales/zh.json b/src/locales/zh.jsonindex f698f17ec5..42b2f76bfc 100644--- a/src/locales/zh.json+++ b/src/locales/zh.json@@ -3552,5 +3552,21 @@"botAccess.yours.chat": "你可以和 {bot} 聊天,也可以和它开始自己的对话。能编辑它的人决定谁有访问权限。","botAccess.yours.other": "能编辑 {bot} 的人决定谁有访问权限。","botAccess.viewOnly": "你可以查看 {bot},但不能和它聊天。",- "botAccess.viewOnlyRoom": "你只能查看 {bot},所以可以阅读这个聊天室,但不能在里面发言。"+ "botAccess.viewOnlyRoom": "你只能查看 {bot},所以可以阅读这个聊天室,但不能在里面发言。",+ "botAccess.ask": "请 {name} 允许你聊天",+ "botAccess.askAdmins": "请管理员允许你聊天",+ "botAccess.asked": "已请求 {name}",+ "botAccess.theAdmins": "管理员",+ "botAccess.request.question": "{name} 请求和 {bot} 聊天。允许后,对方可以和它聊天并开始自己的对话。",+ "botAccess.request.allow": "允许",+ "botAccess.request.notNow": "暂不",+ "settings.section.botAccess": "机器人访问权限",+ "botAccess.overview.intro": "{team} 里谁可以查看、和哪个机器人聊天以及编辑它。更改立即生效。",+ "botAccess.overview.noBots": "还没有团队机器人。",+ "botAccess.overview.noPeople": "团队里除了管理员还没有其他人。",+ "botAccess.overview.bot": "机器人",+ "botAccess.overview.setForEveryone": "为所有人设置:{bot}",+ "botAccess.overview.cell": "{name} 能对 {bot} 做什么",+ "botAccess.overview.toastEveryone": "{bot}:{team} 的所有人 · {level}",+ "botAccess.overview.toastPerson": "{bot}:{name} · {level}"}diff --git a/src/state/store.tsx b/src/state/store.tsxindex 4ae34d035e..cf2b0f3cf3 100644--- a/src/state/store.tsx+++ b/src/state/store.tsx@@ -75,7 +75,7 @@ import { reconcileSnapshotQueues, rememberConsumedQueueId, replaceBotQueues } frexport type { MausColor } from "@/lib/mascot";export type { RoutineRunCardData } from "../../shared/routine-run";-export interface OptionCardData extends Pick<WireOptionCard, "fixedOptions" | "webhookRequest" | "appTriggerRequest" | "yourComputer" | "computerAsk" | "waitRequest" | "stopped"> {+export interface OptionCardData extends Pick<WireOptionCard, "fixedOptions" | "webhookRequest" | "appTriggerRequest" | "yourComputer" | "computerAsk" | "waitRequest" | "stopped" | "accessRequest"> {title: string;subtitle: string;options: string[];@@ -531,7 +531,7 @@ export type AppSettingsSection =| "computer"| "logins"| "usage"- | "people"+ | "people" | "botAccess"| "activity"| "backups"| "workspaces"