agent/pkg/brain/brain.go
Snider 5f0878d93d fix(mcp): update Subsystem interface to match mcp v0.5.1 Service API
All RegisterTools and internal register*Tool methods updated from
*mcp.Server to *coremcp.Service. Tool registration calls updated to
use svc.Server() for SDK AddTool calls. Monitor subsystem updated
to store *coremcp.Service and access Server() for Sessions/ResourceUpdated.
Tests updated to create coremcp.Service via New() instead of raw SDK server.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-07 14:11:19 +01:00

54 lines
1.3 KiB
Go

// SPDX-License-Identifier: EUPL-1.2
// subsystem := brain.New(nil)
// core.Println(subsystem.Name()) // "brain"
package brain
import (
"context"
"dappco.re/go/agent/pkg/agentic"
core "dappco.re/go/core"
coremcp "dappco.re/go/mcp/pkg/mcp"
"dappco.re/go/mcp/pkg/mcp/ide"
)
// keyPath := core.JoinPath(home, ".claude", "brain.key")
//
// if readResult := fs.Read(keyPath); readResult.OK {
// apiKey = core.Trim(readResult.Value.(string))
// }
var fs = agentic.LocalFs()
func stringField(values map[string]any, key string) string {
return core.Sprint(values[key])
}
// core.E("brain", "bridge not available", nil)
var errBridgeNotAvailable = core.E("brain", "bridge not available", nil)
// subsystem := brain.New(nil)
// core.Println(subsystem.Name()) // "brain"
type Subsystem struct {
bridge *ide.Bridge
}
// subsystem := brain.New(nil)
// core.Println(subsystem.Name())
func New(bridge *ide.Bridge) *Subsystem {
return &Subsystem{bridge: bridge}
}
// name := subsystem.Name() // "brain"
func (s *Subsystem) Name() string { return "brain" }
// subsystem := brain.New(nil)
// subsystem.RegisterTools(svc)
func (s *Subsystem) RegisterTools(svc *coremcp.Service) {
s.registerBrainTools(svc)
}
// _ = subsystem.Shutdown(context.Background())
func (s *Subsystem) Shutdown(_ context.Context) error {
return nil
}