agent: emit typing as the live chat engine's chat.typing event (#232)
The bot's sendTyping still sent the legacy dedicated `type:"typing"` frame, which only the retired #feed renderer in shell.js paints — so the bot's "…is typing" indicator stopped showing once chat moved to the app engine. The live engine (apps/chat.js) owns typing as a relay-only ephemeral `chat.typing` event rendered into .chatapp-feed. Emit that shape (matching ctx.emitEphemeral, whose transport injects our name), and drop the legacy frame. #222 already makes bots ignore ephemeral frames, so no bot reacts to its own or another's typing beat.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2 files changed,
+15
−3
agent/runtime.mjs+11 −3changelog/2026-07-05-bot-typing-indicator.md+4 −0
diff --git a/agent/runtime.mjs b/agent/runtime.mjs| index dba4737..b7bd4a3 100644 |
| --- a/agent/runtime.mjs |
| +++ b/agent/runtime.mjs |
| @@ -425,9 +425,17 @@ export function runBot({ name, session, builtinPersona = "", builtinDocs = "", t |
| async function sendTyping(threadId, key, expiry = 15) { |
| try { |
| - // Same shape chat.js emits (see hub.go's "typing" relay). expiry 0 is the |
| - // explicit "stopped typing" signal. |
| - send({ type: "typing", thread_id: threadId, blob: await encrypt(key, { type: "typing", name, expiry }) }); |
| + // Match the live chat engine's typing wire shape: a relay-only ephemeral |
| + // `chat.typing` event (apps/chat.js's `ephemeral` hook), NOT the legacy |
| + // dedicated `type:"typing"` frame — that only feeds the retired #feed |
| + // renderer in shell.js, so the bot's typing indicator never showed in the |
| + // app. The transport injects our name; expiry 0 = the "stopped" signal. |
| + send({ |
| + type: "msg", |
| + thread_id: threadId, |
| + ephemeral: true, |
| + blob: await encrypt(key, { type: "chat.typing", name, expiry }), |
| + }); |
| } catch {} |
| } |
diff --git a/changelog/2026-07-05-bot-typing-indicator.md b/changelog/2026-07-05-bot-typing-indicator.md| new file mode 100644 |
| index 0000000..1316118 |
| --- /dev/null |
| +++ b/changelog/2026-07-05-bot-typing-indicator.md |
| @@ -0,0 +1,4 @@ |
| +The "…is typing" indicator is back for bots. When Eleven (or any bot) is composing |
| +a reply, you'll again see the little typing dots while it thinks — they'd quietly |
| +stopped showing after the chat moved to its new engine. The dots appear as soon as |
| +the bot starts and clear the moment its reply lands. |