mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-06-17 22:48:13 +00:00
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:
@@ -8,6 +8,7 @@ type TeamNotifyConfig struct {
|
||||
Progress bool `json:"progress"` // member updates progress
|
||||
Failed bool `json:"failed"` // task failed
|
||||
Completed bool `json:"completed"` // task completed
|
||||
SlowTool bool `json:"slow_tool"` // system alert when tool call exceeds adaptive threshold (always direct, never through leader)
|
||||
Mode string `json:"mode"` // "direct" (outbound) or "leader" (through leader agent)
|
||||
}
|
||||
|
||||
@@ -18,6 +19,7 @@ func DefaultTeamNotifyConfig() TeamNotifyConfig {
|
||||
Progress: true,
|
||||
Failed: true,
|
||||
Completed: true,
|
||||
SlowTool: true,
|
||||
Mode: "direct",
|
||||
}
|
||||
}
|
||||
@@ -35,6 +37,7 @@ func ParseTeamNotifyConfig(settings json.RawMessage) TeamNotifyConfig {
|
||||
Progress *bool `json:"progress"`
|
||||
Failed *bool `json:"failed"`
|
||||
Completed *bool `json:"completed"`
|
||||
SlowTool *bool `json:"slow_tool"`
|
||||
Mode string `json:"mode"`
|
||||
} `json:"notifications"`
|
||||
}
|
||||
@@ -54,6 +57,9 @@ func ParseTeamNotifyConfig(settings json.RawMessage) TeamNotifyConfig {
|
||||
if n.Completed != nil {
|
||||
cfg.Completed = *n.Completed
|
||||
}
|
||||
if n.SlowTool != nil {
|
||||
cfg.SlowTool = *n.SlowTool
|
||||
}
|
||||
if n.Mode == "leader" {
|
||||
cfg.Mode = "leader"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user