fix(ax): use declarative core options in core-agent
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
1db52ab1de
commit
4d278a5172
6 changed files with 9 additions and 8 deletions
|
|
@ -7,7 +7,7 @@ import (
|
|||
)
|
||||
|
||||
func Example_registerAppCommands() {
|
||||
c := core.New(core.WithOption("name", "core-agent"))
|
||||
c := core.New(core.WithOptions(core.NewOptions(core.Option{Key: "name", Value: "core-agent"})))
|
||||
registerAppCommands(c)
|
||||
|
||||
core.Println(len(c.Commands()))
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import (
|
|||
// newTestCore creates a minimal Core with app commands registered.
|
||||
func newTestCore(t *testing.T) *core.Core {
|
||||
t.Helper()
|
||||
c := core.New(core.WithOption("name", "core-agent"))
|
||||
c := core.New(core.WithOptions(core.NewOptions(core.Option{Key: "name", Value: "core-agent"})))
|
||||
c.App().Version = "test"
|
||||
registerAppCommands(c)
|
||||
c.Cli().SetOutput(&bytes.Buffer{})
|
||||
|
|
|
|||
|
|
@ -29,13 +29,13 @@ func main() {
|
|||
// core.Println(c.App().Version) // "dev" or linked version
|
||||
func newCoreAgent() *core.Core {
|
||||
c := core.New(
|
||||
core.WithOption("name", "core-agent"),
|
||||
core.WithOptions(core.NewOptions(core.Option{Key: "name", Value: "core-agent"})),
|
||||
core.WithService(agentic.ProcessRegister),
|
||||
core.WithService(agentic.Register),
|
||||
core.WithService(runner.Register),
|
||||
core.WithService(monitor.Register),
|
||||
core.WithService(brain.Register),
|
||||
core.WithName("mcp", registerMCPService),
|
||||
core.WithService(registerMCPService),
|
||||
)
|
||||
c.App().Version = appVersion()
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ import (
|
|||
|
||||
// registerMCPService builds the MCP service from registered AX subsystems.
|
||||
//
|
||||
// r := registerMCPService(c)
|
||||
// c := core.New(core.WithService(registerMCPService))
|
||||
// _, ok := core.ServiceFor[*mcp.Service](c, "mcp")
|
||||
func registerMCPService(c *core.Core) core.Result {
|
||||
if c == nil {
|
||||
return core.Result{Value: core.E("main.registerMCPService", "core is required", nil), OK: false}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import (
|
|||
)
|
||||
|
||||
func Example_registerMCPService() {
|
||||
result := registerMCPService(core.New(core.WithOption("name", "core-agent")))
|
||||
result := registerMCPService(core.New(core.WithOptions(core.NewOptions(core.Option{Key: "name", Value: "core-agent"}))))
|
||||
|
||||
core.Println(result.OK)
|
||||
// Output: true
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import (
|
|||
)
|
||||
|
||||
func TestMCP_RegisterMCPService_Good(t *testing.T) {
|
||||
result := registerMCPService(core.New(core.WithOption("name", "core-agent")))
|
||||
result := registerMCPService(core.New(core.WithOptions(core.NewOptions(core.Option{Key: "name", Value: "core-agent"}))))
|
||||
|
||||
require.True(t, result.OK)
|
||||
_, ok := result.Value.(*mcp.Service)
|
||||
|
|
@ -31,7 +31,7 @@ func TestMCP_RegisterMCPService_Bad(t *testing.T) {
|
|||
|
||||
func TestMCP_RegisterMCPService_Ugly(t *testing.T) {
|
||||
c := core.New(
|
||||
core.WithOption("name", "core-agent"),
|
||||
core.WithOptions(core.NewOptions(core.Option{Key: "name", Value: "core-agent"})),
|
||||
core.WithService(agentic.ProcessRegister),
|
||||
core.WithService(agentic.Register),
|
||||
core.WithService(monitor.Register),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue