refactor(ai): convert patrol to agentic tool-based execution

- Replace output-parsing approach with tool-based finding creation
- PatrolService now uses runAIAnalysis with proper scope handling
- Add tool event streaming (tool_start, tool_end) to patrol events
- Expose GetExecutor() on chat.Service for patrol integration
- Remove regex-based finding extraction in favor of patrol tools

The patrol now uses the same agentic loop as chat, with the LLM calling
patrol_report_finding to create findings rather than outputting JSON
that gets parsed. This is more reliable and consistent with the tool model.
This commit is contained in:
rcourtman
2026-01-28 23:18:58 +00:00
parent f83356b430
commit 1b1c9bb2a3
2 changed files with 567 additions and 1227 deletions
+8
View File
@@ -798,6 +798,14 @@ func (s *Service) GetBaseURL() string {
return ""
}
// GetExecutor returns the underlying tool executor so callers (e.g. patrol)
// can set session-scoped state like the PatrolFindingCreator before executing.
func (s *Service) GetExecutor() *tools.PulseToolExecutor {
s.mu.RLock()
defer s.mu.RUnlock()
return s.executor
}
// Provider setter methods
func (s *Service) SetAlertProvider(provider MCPAlertProvider) {
+559 -1227
View File
File diff suppressed because it is too large Load Diff