Stop guessing how long to wait.
Added
- A
typingevent. Feed it whatever presence your channel already emits, withruntime.typing({ conversationId })or{ type: 'typing', at }on the core, and an open turn stays open while the person composes. It never opens a turn, andmaxWaitMsstill caps it, so somebody who types without ever sending still gets an answer. policyForoncreateRuntime, for conversations that need different patience. It runs before the conversation is locked, so it may read a database.npm run bench:sweepand Choosing quietMs.
Why this release exists
The 2500ms default was never measured. It is now. Across a thousand simulated conversations with realistic typing gaps, that default has the bot answering before the person has finished in 47% of bursts. At 6000ms it is 14%, and it avoids more model calls at the same time, so in that range waiting longer wins on both axes. Past 8000ms nothing further merges and the extra wait is pure latency.
A reasonable default for a messaging channel is 5000 to 6000. Better still, send the typing event and let the channel tell you.
Compatibility
deadline() now reads max(lastMessageAt, lastTypingAt). State written by earlier versions carries no lastTypingAt and keeps working unchanged.