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 <[email protected]>
This commit is contained in:
Raven Scott
2026-05-24 04:22:50 -04:00
co-authored by Cursor
parent c9ba4a10f2
commit 7736f43ea9
+9 -1
View File
@@ -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
}