Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

10.8 KB
Raw Blame

Who can see, chat with and change each team bot

A Team Cloud bot is shared like a document: what everyone in the team gets (No access, Can view, Can chat or Can edit) and a level for each person added. Admins and the bot's owner always edit. The contract is in team-cloud.md.

Driving it

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/settings/settings-index.test.ts
  • server/cloud-team-bot-access.e2e.test.ts starts a real Team Cloud (OMB_CLOUD_ROLE=team) with the Owner (Olive), an Admin (Ada) and four Users paired with the Admin's signed claims, and the synthetic Claude CLI. Payroll is shared with Bob to view, Cara to chat and Dan to edit; Eve is not added. As each of them it tries every route a member reaches: the bot list (each copy's yourAccess, the sharing only on an editor's), its chat, export, a room with it, sending, a new conversation, stopping, compacting, editing a line, answering a card, Undo, a reaction, Always allow, Set me up, the browser, the bot's look and profile, its instructions, apps and admin-only fields, its sharing, a new routine for it or its room, someone else's routine and one's own, a new room with it, writing in, renaming and stopping its room. Bob gets 403 on every write and nothing behind it changes; Cara chats and keeps her own routine; Dan changes instructions, apps and sharing but not the approval level, folder, computer, department, Chief, peers or visibility; Eve gets 404. A message another app relays (the guarded route's onBehalfOf) goes through only for someone who can chat. Bob's live stream gets his new level with no sharing in it, then ends when he is removed; the owner 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. 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 that changes 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) with its owner, a plain summary and a stack of faces (+N past four); a row opens the Share dialog; the search takes a bot's name or owner; By person lists each User, and opening one gives their bots at the same level menus, with Remove only for their own access; the empty states; "Ask Cara to chat" asks and says so, "Ask an admin to chat" when nobody on the team owns the bot. src/components/settings/settings-index.test.ts and src/components/settings/SettingsWindow.test.ts show People, with its Bot access section, to a team's admins only, in both modes.
  • src/components/bot-access/ShareBotDialog.dom.test.ts drives the dialog: the owner first, each level on a real menu with its check, nothing below what everyone gets, a change sent at once with Undo putting it back, adding a teammate from the keyboard, removing one, general access and its level, Make owner behind a confirmation and only for whoever may hand the bot on, the read-only view of someone who can't edit, keys staying inside it over Settings, and no button off a team.

The pictures

node --experimental-strip-types scripts/verify-team-bot-access.ts --shots <dir>

It starts the same kind of Team Cloud, sets Payroll up through the routes, and photographs the whole app (scripts/testing/team-access-preview.tsx) in a headless Chrome with a throwaway profile, at 1280×800 at 2x, each page's every request sent as that person through the preview's proxy. It fails if the app is refused anything naming a bot, a room or a conversation while it is shown. The -dark pictures use the Midnight skin and the -390 ones a 390×844 window; the many-people and many-bots ones add six people to Payroll and bring the team to fifty bots. --before takes the same setup through the older visibility route, for a checkout of the code before levels.

Before After
The Share dialog
The Share dialog, dark
Someone who can only view
Bot access in Settings
Bot access in Settings, dark
The Share dialog
Dark, Simple
A level's menu
A level's menu, dark
The ⋯ menu
Make owner, confirming
Made owner, the one before still able to edit
Adding a teammate
A change, with Undo
Everyone in the team: the level at the row's end
Ten people: the list scrolls inside
390px
390px, a level's menu
390px, ten people
Bot access
By person
By person, dark
A person's bots, a level open
A person's bots, dark
Fifty bots
Searching, with ten people: +N past four
390px, by bot
390px, by person
390px, a person's bots
390px, fifty bots
Each level
Can view: the Share dialog
Can view: the Share dialog, dark
Can view: the Share dialog, 390px
Can view
Can chat
Can edit: the Share dialog
No access: not in the list
Can view: ask the owner
Asked
The card in the owner's inbox
After Allow

A new bot is its maker's until they share it

pnpm exec vitest run server/cloud-team-private-default.e2e.test.ts server/new-bot-sharing.test.ts server/host/share-notice.test.ts
OMB_UI_E2E=1 OMB_TEAM_PRIVATE_SHOTS=/tmp/private-shots pnpm exec vitest run scripts/testing/team-private-default-ui.e2e.test.ts

The first runs a real Team Cloud with an Owner, an Admin and two Users and makes a bot every way one comes to exist (New bot, a preset, a copy, a package, a backup, a bot a User moves in): each starts as Only people added with nobody added, another User gets 404 for it on every route that names it and never lists or finds it, a request that says who sees it wins, sharing it with one person puts one line in that person's inbox, and a new bot on this computer and on My Cloud carries no sharing at all. The store's test covers a bot a Chief makes (shared exactly as the Chief) and bots saved before this (unchanged). The second drives the real app in headless Chrome: a User's New bot is under Just me only, a User neither sees it nor reaches it, the header's Share adds her and shows her face beside it, she reads the line in her inbox and chats, a narrow header folds the faces into a count, the Templates form states General access preset to Just me, and /?connect=bots opens Bot access for an admin and nothing for a User.

A User makes a bot of their own too. The first test makes one as a User against the real routes: it is private and theirs, each setting an admin alone makes is refused by name at creation and on edit, the admin's saved New bot defaults stay out of it, another User gets 404, they share it, they delete it only while nobody else can use it, the team's bot limit refuses theirs in an admin's words, and server/cloud-team-rules.e2e.test.ts refuses a blocked engine on it. In the app run the maker is a User. Moving a bot in from My Cloud is driven through its routes in the first test and through the real move in server/team-move.e2e.test.ts.

Not proven here

  • No real Admin, phone, Slack worker or model was involved: the Admin's pairing is signed by the fixture, a relayed message is the guarded route called on loopback, and the engine is the synthetic CLI.
  • A routine a member wrote keeps its schedule when their level drops; its runs are the bot's (team-cloud.md "What a bot keeps per bot").
  • A reply to a line in a person's inbox goes back to the bot that asked even if they can only view it: the bot asked them.