agent/cmd/core-agent/main.go
Snider cb56cfb270 fix: initialise go-process for dispatch, fix Notification hook matcher
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-17 03:22:34 +00:00

50 lines
1.2 KiB
Go

package main
import (
"log"
"forge.lthn.ai/core/agent/pkg/agentic"
"forge.lthn.ai/core/agent/pkg/brain"
"forge.lthn.ai/core/cli/pkg/cli"
"forge.lthn.ai/core/go-process"
"forge.lthn.ai/core/go/pkg/core"
"forge.lthn.ai/core/mcp/pkg/mcp"
)
func main() {
if err := cli.Init(cli.Options{
AppName: "core-agent",
Version: "0.1.0",
}); err != nil {
log.Fatal(err)
}
mcpCmd := cli.NewCommand("mcp", "Start the MCP server on stdio", "", func(cmd *cli.Command, args []string) error {
// Initialise go-process so dispatch can spawn agents
c, err := core.New(core.WithName("process", process.NewService(process.Options{})))
if err != nil {
return cli.Wrap(err, "init core")
}
procSvc, err := core.ServiceFor[*process.Service](c, "process")
if err != nil {
return cli.Wrap(err, "get process service")
}
process.SetDefault(procSvc)
mcpSvc, err := mcp.New(
mcp.WithSubsystem(brain.NewDirect()),
mcp.WithSubsystem(agentic.NewPrep()),
)
if err != nil {
return cli.Wrap(err, "create MCP service")
}
return mcpSvc.Run(cmd.Context())
})
cli.RootCmd().AddCommand(mcpCmd)
if err := cli.Execute(); err != nil {
log.Fatal(err)
}
}