feat(agent): adaptive tool timing with slow tool notification

Track per-tool execution time statistics in session metadata. When a tool
call exceeds its adaptive threshold (2x historical max, min 120s default),
send a direct outbound notification to the user.

- ToolTimingMap: parse/serialize/record/threshold from session metadata
- StartSlowTimer: fires once per tool call, auto-cancels on completion
- Team config: slow_tool toggle (default on, always direct, never leader)
- UI: toggle in team settings with i18n (en/vi/zh)
- Store: add GetSessionMetadata to session store interface
This commit is contained in:
viettranx
2026-03-19 13:35:57 +07:00
parent 0df619023c
commit 4e9f155a4c
12 changed files with 236 additions and 1 deletions
+3
View File
@@ -788,6 +788,9 @@ func runGateway() {
}
})
// Slow tool notification subscriber — direct outbound when tool exceeds adaptive threshold.
wireSlowToolNotifySubscriber(msgBus)
// Start inbound message consumer (channel → scheduler → agent → channel)
consumerTeamStore := pgStores.Teams