feat: add message burst debouncing (MessageBatcher)

- Create MessageBatcher: debounce 600ms, adaptive delay for long chunks,
  max 8 messages/4000 chars before immediate flush, per (chatId, sender) key
- Integrate into trigger: text messages enqueued, slash commands and
  file/image bypass batching, locked projects respond immediately
- Add unit tests (8) for batcher lifecycle and edge cases
This commit is contained in:
2026-07-08 16:40:39 +08:00
parent 6227e1931b
commit ad65d93b2e
5 changed files with 492 additions and 151 deletions
+1
View File
@@ -103,6 +103,7 @@ async function triggerWithRunAgent(
logger: rt.logger,
authorizer: allowAllAuthorizer(),
runAgent,
messageBatcherOptions: { maxMessages: 1 },
});
await trigger(makeEvent(), rt);