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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user