agent/pkg/brain/register.go
Snider adafee0f18 feat: use RegisterService + ServiceFor — proper instance lifecycle
- agentic.PrepSubsystem implements Startable/Stoppable
- monitor.Subsystem implements Startable/Stoppable (OnStartup/OnShutdown)
- Register factories use c.RegisterService() — auto-discovers interfaces
- Register factories return instances via Result.Value
- main.go uses ServiceFor[T]() instead of ConfigGet — typed retrieval
- No more c.Config().Set("x.instance") workaround

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-24 17:42:16 +00:00

19 lines
407 B
Go

// SPDX-License-Identifier: EUPL-1.2
package brain
import (
core "dappco.re/go/core"
)
// Register is the service factory for core.WithService.
// Brain is a stateless API proxy — no lifecycle hooks.
//
// core.New(
// core.WithService(brain.Register),
// )
func Register(c *core.Core) core.Result {
brn := NewDirect()
c.RegisterService("brain", brn)
return core.Result{Value: brn, OK: true}
}