Files
synapbus/internal/agents/types.go
T
Algis DumbrisandClaude Opus 4.6 6afe1853ad feat(014): implement reactive agent triggering engine
- Migration 015: extends agents with trigger config, adds reactive_runs table
- Reactor engine: decision chain (mode, depth, budget, cooldown, sequential)
- Reactor store: SQLite persistence for runs with RFC3339 timestamps
- Reactor poller: K8s Job status polling (15s interval)
- Failure notifier: system DM to owner on job failure
- REST API: /api/runs, /api/runs/:id, /api/runs/:id/retry, /api/agents/reactive
- Agent model: trigger_mode, cooldown, budget, depth, k8s_image, pending_work
- K8s runner: GetClientset() for poller
- All 28 test packages pass (8 new reactor tests)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 17:42:48 +02:00

45 lines
1.4 KiB
Go

// Package agents provides agent registry and authentication for SynapBus.
package agents
import (
"encoding/json"
"time"
)
// Agent status constants.
const (
AgentStatusActive = "active"
AgentStatusInactive = "inactive"
)
// Trigger mode constants.
const (
TriggerModePassive = "passive"
TriggerModeReactive = "reactive"
TriggerModeDisabled = "disabled"
)
// Agent represents a registered entity that can send/receive messages.
type Agent struct {
ID int64 `json:"id"`
Name string `json:"name"`
DisplayName string `json:"display_name"`
Type string `json:"type"`
Capabilities json.RawMessage `json:"capabilities"`
OwnerID int64 `json:"owner_id"`
APIKeyHash string `json:"-"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// Reactive trigger fields
TriggerMode string `json:"trigger_mode"`
CooldownSeconds int `json:"cooldown_seconds"`
DailyTriggerBudget int `json:"daily_trigger_budget"`
MaxTriggerDepth int `json:"max_trigger_depth"`
K8sImage string `json:"k8s_image,omitempty"`
K8sEnvJSON string `json:"k8s_env_json,omitempty"`
K8sResourcePreset string `json:"k8s_resource_preset"`
PendingWork bool `json:"pending_work"`
}