feat: desacoplar launcher del registro estatico de agentes
Introduce un registro global de reglas en agents/registry.go con Register() y GetRules(). Cada paquete de agente se auto-registra via init(), eliminando la necesidad de editar manualmente el map rulesRegistry en cmd/launcher/main.go. Cambios: - agents/registry.go: nuevo registro global con sync.RWMutex - agents/*/agent.go: cada agente llama agents.Register() en init() - agents/_template/agent.go: placeholder AGENT_ID_PLACEHOLDER para scaffold - cmd/launcher/main.go: elimina rulesRegistry, usa blank imports + agents.GetRules() para obtener reglas por agent ID Patron: init() + blank import (estandar Go: database/sql, image codecs) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,16 @@
|
||||
// Package _template es un agente plantilla (no lanzable).
|
||||
// Sirve como referencia canonica para crear nuevos agentes.
|
||||
// Al crear un nuevo agente, new-agent.sh reemplaza _template y AGENT_ID_PLACEHOLDER.
|
||||
package _template
|
||||
|
||||
import "github.com/enmanuel/agents/pkg/decision"
|
||||
import (
|
||||
"github.com/enmanuel/agents/agents"
|
||||
"github.com/enmanuel/agents/pkg/decision"
|
||||
)
|
||||
|
||||
func init() {
|
||||
agents.Register("AGENT_ID_PLACEHOLDER", Rules)
|
||||
}
|
||||
|
||||
// Rules devuelve las reglas de este agente (vacio para el template).
|
||||
func Rules() []decision.Rule {
|
||||
|
||||
Reference in New Issue
Block a user