Skip to content

v0.3.0

Latest

Choose a tag to compare

@luantaraschi luantaraschi released this 19 Aug 02:53
· 7 commits to main since this release

Stop guessing how long to wait.

Added

  • A typing event. Feed it whatever presence your channel already emits, with runtime.typing({ conversationId }) or { type: 'typing', at } on the core, and an open turn stays open while the person composes. It never opens a turn, and maxWaitMs still caps it, so somebody who types without ever sending still gets an answer.
  • policyFor on createRuntime, for conversations that need different patience. It runs before the conversation is locked, so it may read a database.
  • npm run bench:sweep and 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.