From 7736f43ea92756a30e3306b29152c8970185f532 Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Sun, 24 May 2026 04:22:50 -0400 Subject: [PATCH] feat(ui-flow): emit bot-installed and slash-invoked UI events After install-bot-token and slash send-message, notify the Pear UI with structured sidecar messages for confirmation toasts and composer autofocus. Co-authored-by: Cursor --- index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 9ee0ae1..bd27153 100644 --- a/index.js +++ b/index.js @@ -661,16 +661,24 @@ async function dispatchUiMessage (platform, msg, hooks = {}) { return true } if (t === 'install-bot-token') { - await platform.installBotFromToken(msg.token) + const out = await platform.installBotFromToken(msg.token) + send({ + type: 'bot-installed', + botName: out?.bot?.name || null, + bot: out?.bot || null + }) pushState() return true } if (t === 'send-message') { + const trimmed = String(msg.content || '').trim() + const slashMatch = trimmed.match(/^\/([a-z0-9_-]+)/i) await platform.sendMessage(msg.content, { replyToId: msg.replyToId, attachmentIds: msg.attachmentIds, stickerNames: msg.stickerNames }) + if (slashMatch) send({ type: 'slash-invoked', name: slashMatch[1] }) pushState() return true }