chat-rooms
Rooms where several of your bots talk with you: tag a bot with @, bots hand work to each other, and each room keeps memories of its own and starts over from a summary.
What it carries
Runs inside fxbot
fxbot/server.tsfxbot/page.js
Its page in fxbot shows this code, to read before you add it. Code runs with everything fxbot can reach.
Skills
- chat-room: How a chat room works when you're one of its bots, with the owner and other bots. The room sends it with your first turn there.
- room-handoff: Handing a piece of work to another bot in a chat room by tagging it, and checking what comes back. Read it before you tag a bot to do something.
- room-lead: Answering the owner's untagged messages as a chat room's lead, its first bot. The room sends it the first time you answer as the lead.
How to add it
- In fxbot, open Plugins, the puzzle button at the bottom of the sidebar, and choose Browse. fxbot's picks list chat-rooms.
- Choose it. Its page shows what it carries. Read the code under Runs inside fxbot.
- Choose Add.
More in Add a plugin.
Source
github.com/iammrduncan/fxbot/tree/main/plugins/chat-rooms
README
A plugin for fxbot: rooms where several of your bots talk with you, and with each other.
- Rooms in the sidebar lists your rooms, each with its bots' avatars. + makes one: name it, and pick its bots. The first one leads.
- Tagging: in a room,
@lists its bots and Everyone. A pick becomes a chip with the bot's avatar. - Who answers: a message wakes the bots it tags. One that tags no one wakes the lead, or every bot in order, by the room's setting.
- Handing on: a reply that tags another bot wakes that bot next. A reply that tags no one ends the round.
- Limits:
- at most 3 bots tagged per reply
- the room's limit of bot replies to one message, 10 by default: past it, bots stop tagging each other, and the ones already asked still answer
- Stop, which ends the reply being written and drops the rest
- What a bot is sent: each bot answers in a session of its own for the room, so a room stays out of the bot's own chat. Each turn it's sent:
- who it is, and who else is in the room
- the room's memories
- what was said since its last turn, the other bots' words quoted
- who woke it, and the replies left
- Memories, since 0.4.0: each room keeps notes of its own, such as what the room is for, what was decided there, and who does what. Every bot in the room reads them there, after its own memories and the team's, and not in its other chats.
- Memories, on a room, lists them, newest first, with who saved each one, and adds, edits, and deletes them.
- Bots save one with
chat-rooms_remember(withreplaces, to change one) and remove one withchat-rooms_forget, by itsroom-mem:<id>. Each finds its room from the bot's session, so it works only in a room. - Limits: a memory is at most 1,000 characters, and the newest that fit in 6,000 bytes go to each bot. Saving one that's there answers with it.
- Deleting a room deletes its memories, and removing the plugin removes them all.
- Starting over, since 0.5.0, as a bot's own chat does:
- Idle compaction: a room that sits idle past Settings › General › Idle compaction, with at least 120 KB of text since its last summary, is summarized while you're away. Its lead writes the summary, on Summarize with's model when you pick one. The room shows Compacted while idle, which opens to the summary. A message you send meanwhile calls it off.
/fresh: start a message with/fresh, and the room stops its turns, is summarized toward what you wrote next, shows Started over, then posts the rest./at the start of the message box lists it.- Then each bot's next turn there starts a new session, sent the room since the summary, with the summary in its instructions. Its earlier sessions stay, and
chat_historyfinds them. - On fxbot before 0.10.0, which has no idle compaction setting for plugins, rooms aren't compacted while idle. Before 0.6.0,
/freshsays the room can't be summarized.
- Skills: three,
chat-room,room-handoff, androom-lead, teach a bot how to work in a room. The room sendschat-roomwith a bot's first turn there, androom-leadwith the lead's first untagged turn. - Edit, on a room, changes its name, its bots and their order, what an untagged message does, and its replies per message, or deletes it.
- Order: drag a room in the sidebar to move it, with a mouse, or with a finger after a moment's hold. On fxbot before 0.7.0, rooms stay in the order they were made.
Add it from Plugins, where fxbot's list has it. It runs inside fxbot: read its code there before you add it. Only bots it's on for can be in a room. See Talk with several bots in a room.
On fxbot 0.4.0, which has neither fx.chats.cancel nor createPortal:
- Stop lets the reply being written finish.
- Chips in the message box show
@Namewithout the avatar.
For other plugins
Since 0.3.0, chat rooms provides, with fx.provide, for plugins that name it under needs:
roomOf(session): the room one of its sessions is for,{ id, name, untagged, replies, members }, or nullrooms(): every room
The room's header leaves a place, chat-rooms.room-header, which a plugin fills with app.slot; each part gets room. The computer uses both, for a room's computer. On fxbot 0.4, which has neither, the room works as in 0.2.0.
Files
| File | What it is |
|---|---|
plugin.json |
Its name, version, and parts |
package.json |
What the page is built from, ProseMirror, and "type": "module" for the server code |
fxbot/server.ts |
Its routes, under /api/plugins/chat-rooms/, who answers, the queue and its limits, Stop, and what a bot is sent |
fxbot/mentions.ts |
The mention token, <@bot:id> or <@all>, and @Name to token and back. The page and the server share it |
fxbot/migrations/ |
Its tables, in the schema plugin_chat_rooms |
fxbot/page.jsx |
The sidebar group, the room screen, and its settings |
fxbot/composer.jsx |
The message box: ProseMirror, the @ list, and chips |
fxbot/faces.jsx |
A mention's chip, and a room's bots, stacked |
fxbot/page.css |
The box's, the chips', and the stacks' styles, and ProseMirror's |
fxbot/page.js |
The page, built |
fxbot/page-licenses.txt |
The licenses of the packages page.js bundles |
skills/ |
chat-room, room-handoff, and room-lead |
Build the page
page.js is page.jsx bundled with rolldown, which comes with fxbot's packages. It's built without comments: ProseMirror's are long, and page.jsx keeps the plugin's own. Run these in this folder, in a checkout of fxbot, after changing the page or package.json:
npm install
npx rolldown fxbot/page.jsx --format cjs -e react -e react/jsx-runtime -e @fxbot/app --no-comments --file fxbot/page.js
React and @fxbot/app stay out of the bundle: the page hands over its own. When the bundled packages change, write fxbot/page-licenses.txt again from their LICENSE files.