Pulse/internal/ai/chat/service_additional_test.go
rcourtman badbad4464 refactor(ai): integrate patrol execution into chat service
- Add ExecutePatrolStream method to chat.Service for patrol-specific execution
- Create chat_service_adapter.go to bridge chat.Service to ai.ChatServiceProvider
- Remove standalone patrol.go and patrol_test.go from chat package
- Add PatrolRequest/PatrolResponse types to chat service
- Add context injection for recent message context

This allows patrol to use an isolated agentic loop with its own system prompt
while leveraging the common chat infrastructure.
2026-01-28 21:21:41 +00:00

40 lines
1,004 B
Go

package chat
import (
"context"
"testing"
"github.com/rcourtman/pulse-go-rewrite/internal/ai/tools"
)
func TestServiceSettersAndAutonomousMode(t *testing.T) {
executor := tools.NewPulseToolExecutor(tools.ExecutorConfig{})
loop := &AgenticLoop{}
service := &Service{
executor: executor,
agenticLoop: loop,
}
service.SetIncidentRecorderProvider(nil)
service.SetEventCorrelatorProvider(nil)
service.SetTopologyProvider(nil)
service.SetKnowledgeStoreProvider(nil)
service.SetAutonomousMode(true)
if !service.autonomousMode {
t.Fatalf("expected autonomousMode true")
}
if !loop.autonomousMode {
t.Fatalf("expected agentic loop to be autonomous")
}
}
func TestServiceExecuteCommand_NoExecutor(t *testing.T) {
service := &Service{}
_, _, err := service.ExecuteCommand(context.Background(), "ls", "")
if err == nil {
t.Fatalf("expected error when executor is unavailable")
}
}
// TestPatrolServiceSessionLifecycle was removed: it tested the deleted chat/patrol.go bridge.