Skip to content

feat(bots): a bot on another computer can offer a message to your bots here - #2496

Merged
TheAnimatrix merged 6 commits into
masterfrom
issue-2490-offered-bot-messages
Nov 30, 2026
Merged

TheAnimatrix merged 6 commits into
masterfrom
issue-2490-offered-bot-messages

Conversation

@TheAnimatrix

@TheAnimatrix TheAnimatrix commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

When you use a bot on another computer one way (your PC uses the Mac, and the Mac has no access to the PC), that bot can't get a message to the PC's bots. "If the build breaks, tell Alpha" goes nowhere when Alpha lives on the PC you're writing from.

Change

A bot can now offer a message for a bot on the computer you're writing from. Nothing crosses from the Mac to the PC: the offer waits in the bot's chat, the PC reads it on the chat it already has open, and you send it from there, or not.

  • The tool. bot_offer({ message, to? }) is only in the bot's chat, and only works in a chat turn you started from another computer that takes offers. That computer says so with your message: its router adds offers: 1 to bots.chat.send (row version 3), only when the bot's computer lists that version, and a window can't set it. Any other turn gets offer_unsupported and words telling the bot to tell you instead. These turns include a message written on the Mac, a phone, an older PC, work, a schedule, a wake, or another bot's message. There is no wider fallback. Limits: 3 offers per turn, 2,000 characters and 6 KiB each. A retried tool call is the same offer.
  • Where it waits. It waits in the offering bot's chat as a notice with an offer card. The card names the device it is for, but that name never leaves the Mac. Each reader gets the card through offerCardFor: the device it is for sees it marked forYou, and every other device sees the words and where they wait, with no Send.
  • Send, on the PC. The card shows the exact words as plain text (no Markdown, no HTML), a pick of the PC's bots, and Send. Send (bots.remote.offerSend) only takes a person at a Mousse window on the PC. The command line, agents, bots and other computers get forbidden.
    • Before keeping anything, the PC checks the offer against its own copy of the chat (or reads that one row from the Mac), never against what the window says. It checks that the offer is the PC's and that the words match. Right before the commit, it checks that the Mac's bot is still listed and the Mac isn't blocked.
    • It keeps the message in one transaction on the PC, with one row per offer plus a receipt kept apart from every chat. A repeat answers "already sent" from the PC alone. That holds after a reconnect or a restart, with the Mac away, and after that chat is cleared or that bot is deleted. Sending the same offer to a second bot is refused.
    • The receiving bot must take offered messages. The PC keeps at most 30 an hour. A second Send while one is running is offer_busy.
  • What the receiving bot gets. A quiet notice in its chat, "Message from your bot Loki on Mac mini, sent by you", with the words quoted. It is marked as outside text, so the bot's memory doesn't treat it as yours. It starts no turn and answers nothing. The bot reads it with your next message to it.
  • States on the card. The card shows Send, then "Sent to Alpha", or the refusal in plain words, including the Mac being offline when the PC has no copy of the offer. If the answer to a Send was lost, the card looks the offer up on the PC before Send comes back.
  • Which bots take them. By default every bot takes offered messages.
    • Make private now also closes the bot to them. It closes them first and stops if that fails, so a bot never shows as private while it still takes them.
    • Only this computer can flip the switch; no other device has a row for it.
  • Moving a bot to another computer takes its offers without the device each was for, so they wait for no Send there.
    • About → Devices has a switch, "Messages from other computers' bots".
    • The setting is kept in <profile>/bots/offers.json. A file that can't be read closes every bot.
  • Docs. docs/bots.md has a new "Offered messages" part. The glossary has "Offered message"; the name "Inbox" is already taken by the Automations page.

How to review

  1. src/shared/bots/personal/offers.ts: the card, limits and refusal words.
  2. The sending side: BotEngine.offerBotMessage, turnOwnerToSave, the tool in appTools/bots.ts, and offerCardFor in RemoteBots.ts.
  3. The receiving side: BotRouter.offerSend and offerState, BotChatService.keepOffered, and BotOfferAccessStore. This is where the risk is: who may send, the checks before the commit, and the one-row dedupe.
  4. The UI: BotOfferCard.tsx, the switch in BotDevices.tsx, and Make private in botsStore.ts.

Verification

  • Safe because nothing is kept on the PC without a person at a PC window, and the offer is read from the PC's own copy of the chat, never from what the window sends. The proof is tests/netEngine/checks/offeredMessagesOneWay.test.ts: two real daemons paired one way through the engine. It shows:
    • The command line's Send is refused, and so is a forged offer id. Nothing is kept until a window sends it.
    • The offer is kept once. Repeats return the same message after the chat stream closes and reopens, after the PC's networking restarts, and with the Mac away.
    • Sending the same offer to another bot is refused.
    • A PC that doesn't say it takes offers (as an older one) gets the tool refused, with no other way to send.
    • The Mac never sends the PC a bot call.
  • tests/bots/offeredMessages.test.ts covers:
    • the tool's rules and its retry;
    • what each device sees of the card;
    • refusals: a message written on the Mac, an older Mac, a device taken off the bot, another bot's message turn, and the caps;
    • Send: the external notice that starts no turn, the replay, the refusals before commit, Make private, a recipient that is gone, a blocked sender, offline and busy, and the hourly cap.
  • tests/bots/botOfferAccessStore.test.ts covers the switch file, including that an unreadable file closes every bot. tests/renderer/botOfferCard.test.ts covers:
    • the card shows the exact words, with no Markdown or HTML drawn;
    • the lost-answer lookup, refusals and no recipients;
    • the inert copies;
    • Make private, and the About switch.
  • node scripts/verify.mjs <58 affected test files> --typecheck all ran on 2e3b24f: 2,211 tests. Three failed, all tables missing the new entries: bot_offer in the bots tool family, the pinned tool table, and the new switch wrongly listed among the Devices methods other devices may call. All three are fixed in f545dcb.
  • node scripts/verify.mjs tests/net/bridge/remote/botDeviceAccess.test.ts tests/bots/botMethodTable.test.ts tests/netEngine/allowlist.test.ts tests/bots/botsProtocolV2.test.ts tests/run/botAppTools.test.ts tests/run/toolAuthorityParity.test.ts tests/renderer/botOfferCard.test.ts tests/renderer/botDeviceControls.test.ts tests/renderer/botAboutPanel.test.ts tests/guiIpcThreadRouting.test.ts tests/bots/offeredMessages.test.ts tests/netEngine/checks/offeredMessagesOneWay.test.ts --typecheck all ran on f545dcb: 12 files and 250 tests pass, and both typechecks pass.
  • After the review, node scripts/verify.mjs tests/bots/offeredMessages.test.ts tests/renderer/botOfferCard.test.ts tests/netEngine/checks/offeredMessagesOneWay.test.ts tests/bots/botTransfer.test.ts tests/bots/botSystemInstructions.test.ts tests/renderer/botDeviceControls.test.ts tests/renderer/remoteBots.test.ts tests/renderer/composerWorkspaceToolbar.test.ts tests/renderer/botAboutPanel.test.ts tests/bots/botsProtocol.test.ts --typecheck all ran on 2d7f0d2: 10 files and 180 tests pass, and both typechecks pass. New checks cover a cleared chat and a deleted recipient, Make private's order and its failure, and a moved bot's offers.
  • The screenshots below come from the real chat view and About row, with the app's CSS, in Mousse Dark, rendered hidden. They caught the Send button drawn without its size in the chat, which is now fixed.
  • Not checked: the installed app on two real computers, and a real model choosing to call bot_offer.

Notes

The tool's description and the bots' guidance stay short and factual for now; wording that teaches bots when to offer goes through a design review in the next step. Still to come in that step: telling the Mac's chat whether the offer was sent, offers expiring, and Make private on another computer's bot closing offers there. #2489 touches many of the same files; whichever merges second resolves the overlap.

Review notes left for later:

  • A picture's path in the offered words shows that picture in the receiving bot's chat, as it already does for any message between bots, bot_send from another computer included. The owner sees the exact words before sending, and nothing leaves the PC.
  • The two-computer check reads the offer from the stream's first page, not from a live event on a chat that was already open. The live event passes the reader to the same projection (BotStreamSources.ts), but no test fails yet if it stops doing so.

Refs #2490

@TheAnimatrix

Copy link
Copy Markdown
Collaborator Author

Screenshots from the real chat view and About row, with the app's CSS, in Mousse Dark, rendered hidden.

On the PC, the computer the offer is for

Ready Sent Refused
Offer ready to send, Alpha picked Offer sent to Alpha Offer refused because it changed

Anywhere else (the Mac, or another device): the words and where it waits, with no Send.

Offer seen from another device

About → Devices

Before After
About Devices row before About Devices row with the offered messages switch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant