feat(chat-gateway): private simplemsg send + history gateway routes (BotOS M4) - #16
Open
WuFenG-Hub wants to merge 2 commits into
Open
feat(chat-gateway): private simplemsg send + history gateway routes (BotOS M4)#16WuFenG-Hub wants to merge 2 commits into
WuFenG-Hub wants to merge 2 commits into
Conversation
added 2 commits
August 15, 2026 01:10
…BotOS M4) Add POST /api/idbots/chat/private-send and /api/idbots/chat/private-history to the local RPC gateway, backed by a pure chatGatewayRoutes module: - private-send: resolves the bot's wallet (mnemonic never exposed), resolves the peer's ECDH chat pubkey (local history then MetaID chain API), encrypts via sendEncryptedSimplemsg and broadcasts a /protocols/simplemsg pin through create-pin. Validation + typed errors; 64KB content cap. - private-history: read-only recent messages with a peer from private_chat_messages (newest last). Enables an external harness (botos-runner / DSH) to act as the MetaBot in private A2A conversations. 6/6 new tests (incl. a real ECDH encrypt round with create-pin capture), compile 0 errors, lint clean.
… chat) Exposes the group-chat transcript over the gateway so a DSH-side consumer can observe group conversations (Mega-Phase M4 R-M4.1). New deps hook listGroupChatMessagesForGateway (groupTaskService wrapper over GroupTaskStore.listGroupChatMessages — the same reader the UI uses; no wallet, no chain write). Route validates group_id + limits (default 50, cap 200) with optional before_id paging. 4 new tests; compile 0 errors, lint clean, chat-gateway suite 10/10.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BotOS Mega-Phase M4: two local RPC gateway routes that let an external harness
(botos-runner / DSH) act as a MetaBot in private A2A conversations — the
missing link between the harness and on-chain encrypted messaging.
POST /api/idbots/chat/private-send—{ metabot_id, to_global_meta_id, content, reply_pin? }:private_chat_messageshistory → MetaID chain API fallback),sendEncryptedSimplemsgand broadcasts a/protocols/simplemsgpin through the existingcreate-pinpath,{ success, pinId, txids, to }; validation + typed 400s; 64 KB content cap.POST /api/idbots/chat/private-history— read-only recent messages with a peer (newest last).Route logic lives in a new Electron-free module (
chatGatewayRoutes.ts) with injected deps (same pattern asmemoryGatewayRoutes.ts), so it is unit-testable under plainnode.Verification
npm run compile:electron— 0 errors.tests/chatGatewayRoutes.test.mjs— 6/6 pass, including a REAL ECDH encrypt round (mnemonic → shared-secret → encrypted payload) with create-pin capture proving the simplemsg payload shape (to,encrypt: 'ecdh',replyPin, content encrypted — never plaintext, mnemonic never exposed).tests/metaidRpcWalletRoutes.test.mjs— 16/16 pass (server boot unaffected).npx eslinton changed files — clean;git diff --checkclean.Notes
botos_run_skill/ runner) is external.