feat(agent): add Projects + Compliance agents, webhook notifications
BOC CI/CD / Test (push) Failing after 2s
BOC CI/CD / Security Scan (push) Has been skipped
BOC CI/CD / Build & Push (push) Has been skipped
BOC CI/CD / Deploy to Staging (push) Has been skipped
BOC CI/CD / Deploy to Production (push) Has been skipped

- Add AgentFAB to ProjectsPage and CompliancePage
- Add AgentWebhookNotifier for agent events (activated, message, escalation, error)
- Webhook URL configurable via AGENT_WEBHOOK_URL env var
- Build fresh web-v2 dist
This commit is contained in:
Bernt
2026-08-12 09:42:37 +00:00
parent f259610f8c
commit 8cb26cdb15
6 changed files with 137 additions and 0 deletions
+11
View File
@@ -38,6 +38,7 @@ type AgentOrchestrator struct {
anthropicKey string
apiEndpoint string
dataProvider *AgentDataProvider
webhook *AgentWebhookNotifier
}
// NewAgentOrchestrator creates a new agent orchestrator
@@ -51,6 +52,7 @@ func NewAgentOrchestrator(db, ledgerDB *sql.DB) *AgentOrchestrator {
anthropicKey: key,
apiEndpoint: "https://api.anthropic.com/v1/messages",
dataProvider: NewAgentDataProvider(db, ledgerDB),
webhook: NewAgentWebhookNotifier(os.Getenv("AGENT_WEBHOOK_URL")),
}
}
@@ -100,6 +102,10 @@ func (o *AgentOrchestrator) HandleAgentChat(w http.ResponseWriter, r *http.Reque
svar, err := o.callAnthropic(enhancedPrompt, req.Meddelanden)
if err != nil {
log.Error().Err(err).Str("rum", req.Rum).Msg("Agent chat failed")
// Notify error
if o.webhook != nil {
o.webhook.NotifyAgentError(req.Rum, "", err.Error())
}
// Fallback to mock
mockSvar := generateMockResponse(req.Rum, req.Meddelanden)
respondWithJSON(w, AgentChatResponse{
@@ -110,6 +116,11 @@ func (o *AgentOrchestrator) HandleAgentChat(w http.ResponseWriter, r *http.Reque
return
}
// Notify message sent
if o.webhook != nil {
o.webhook.NotifyAgentMessage(req.Rum, "", "response")
}
respondWithJSON(w, AgentChatResponse{
Svar: svar,
Rum: req.Rum,