agent/pkg/agentic/register.go
Snider 9f8a63ae21 feat: Register() factories + consume new core.New() API
Each package exposes Register(c *Core) Result for core.WithService():
- agentic.Register: creates PrepSubsystem, wires IPC handlers, lifecycle
- monitor.Register: creates Subsystem, wires IPC handler, lifecycle
- brain.Register: creates Direct, registers service

main.go updated for core.New() returning Result.
Ready for core.New(WithService(agentic.Register)) pattern.

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

34 lines
709 B
Go

// SPDX-License-Identifier: EUPL-1.2
package agentic
import (
core "dappco.re/go/core"
)
// Register is the service factory for core.WithService.
// It creates the PrepSubsystem, wires Core, registers lifecycle hooks,
// and registers IPC handlers — all during Core construction.
//
// core.New(
// core.WithService(agentic.Register),
// )
func Register(c *core.Core) core.Result {
prep := NewPrep()
prep.core = c
c.Service("agentic", core.Service{
OnStart: func() core.Result {
prep.StartRunner()
return core.Result{OK: true}
},
OnStop: func() core.Result {
prep.frozen = true
return core.Result{OK: true}
},
})
RegisterHandlers(c, prep)
return core.Result{OK: true}
}