Documentation
¶
Index ¶
- type DiscoverySignature
- type EventType
- type HealthStatus
- type LifecycleManager
- type MatchCriteria
- type Registry
- type RegistryConfig
- type RegistryEvent
- type SchemaCache
- type SchemaCacheManager
- func (m *SchemaCacheManager) GetFullSchema(ctx context.Context, toolName string) (json.RawMessage, error)
- func (m *SchemaCacheManager) Invalidate(toolName string)
- func (m *SchemaCacheManager) InvalidateAll()
- func (m *SchemaCacheManager) SetFullSchema(ctx context.Context, toolName string, schema json.RawMessage)
- type ServerConfig
- type ServerEntry
- type ServerHandle
- type ServerState
- type ServerStats
- type ServerStatus
- type Tool
- type ToolEntry
- type ToolEvent
- type ToolEventType
- type ToolMatch
- type ToolRegistry
- type ToolSchemaRegistry
- type TransportType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiscoverySignature ¶ added in v0.2.0
type DiscoverySignature struct {
Name string `json:"name"`
Description string `json:"description"`
}
func NewDiscoverySignature ¶ added in v0.2.0
func NewDiscoverySignature(name, description string, fullSchema json.RawMessage) (*DiscoverySignature, error)
type HealthStatus ¶
type HealthStatus string
const ( HealthUnknown HealthStatus = "unknown" HealthHealthy HealthStatus = "healthy" HealthUnhealthy HealthStatus = "unhealthy" )
type LifecycleManager ¶
type LifecycleManager interface {
Start(ctx context.Context, config ServerConfig) (ServerHandle, error)
Stop(ctx context.Context, id string) error
Kill(ctx context.Context, id string) error
Restart(ctx context.Context, id string) error
Status(ctx context.Context, id string) (ServerStatus, error)
List(ctx context.Context) ([]ServerStatus, error)
Close()
}
func NewLifecycleManager ¶
func NewLifecycleManager(logger *slog.Logger) LifecycleManager
type MatchCriteria ¶
type MatchCriteria struct {
Capabilities []string
Transport TransportType
MinHealth HealthStatus
MaxLoad float64
}
type Registry ¶
type Registry interface {
Register(ctx context.Context, entry ServerEntry) error
Unregister(ctx context.Context, id string) error
Update(ctx context.Context, entry ServerEntry) error
Get(ctx context.Context, id string) (*ServerEntry, error)
List(ctx context.Context) ([]*ServerEntry, error)
FindByCapability(ctx context.Context, capability string) ([]*ServerEntry, error)
FindByTransport(ctx context.Context, transport TransportType) ([]*ServerEntry, error)
FindBest(ctx context.Context, criteria MatchCriteria) (*ServerEntry, error)
UpdateHealth(ctx context.Context, id string, health HealthStatus) error
ListUnhealthy(ctx context.Context) ([]*ServerEntry, error)
Save(ctx context.Context) error
Load(ctx context.Context) error
Subscribe(ch chan<- RegistryEvent) func()
}
type RegistryConfig ¶ added in v0.2.0
type RegistryConfig struct {
CompactByDefault bool `yaml:"compact_by_default"`
MaxSignatureBytes int `yaml:"max_signature_bytes"`
}
func LoadRegistryConfig ¶ added in v0.2.0
func LoadRegistryConfig(r io.Reader) (*RegistryConfig, error)
func (*RegistryConfig) Validate ¶ added in v0.2.0
func (c *RegistryConfig) Validate() error
type RegistryEvent ¶
type RegistryEvent struct {
Type EventType
Server *ServerEntry
Details string
}
type SchemaCache ¶ added in v0.2.0
type SchemaCache interface {
Get(key string) (json.RawMessage, bool)
Set(key string, schema json.RawMessage)
Delete(key string)
Clear()
}
func NewLRUSchemaCache ¶ added in v0.2.0
func NewLRUSchemaCache(maxSize int, maxAge time.Duration, onEvict func(key string, schema json.RawMessage)) SchemaCache
type SchemaCacheManager ¶ added in v0.2.0
type SchemaCacheManager struct {
// contains filtered or unexported fields
}
func NewSchemaCacheManager ¶ added in v0.2.0
func (*SchemaCacheManager) GetFullSchema ¶ added in v0.2.0
func (m *SchemaCacheManager) GetFullSchema(ctx context.Context, toolName string) (json.RawMessage, error)
func (*SchemaCacheManager) Invalidate ¶ added in v0.2.0
func (m *SchemaCacheManager) Invalidate(toolName string)
func (*SchemaCacheManager) InvalidateAll ¶ added in v0.2.0
func (m *SchemaCacheManager) InvalidateAll()
func (*SchemaCacheManager) SetFullSchema ¶ added in v0.2.0
func (m *SchemaCacheManager) SetFullSchema(ctx context.Context, toolName string, schema json.RawMessage)
type ServerConfig ¶
type ServerEntry ¶
type ServerEntry struct {
ID string
Config *ServerConfig
Address string
Transport TransportType
Capabilities []string
Health HealthStatus
Stats ServerStats
RegisteredAt time.Time
LastSeenAt time.Time
}
type ServerHandle ¶
type ServerHandle struct {
ID string
Config ServerConfig
PID int
}
type ServerState ¶
type ServerState string
const ( StateRunning ServerState = "running" StateStopped ServerState = "stopped" StateError ServerState = "error" StateStarting ServerState = "starting" )
type ServerStats ¶
type ServerStatus ¶
type Tool ¶ added in v0.2.0
type Tool struct {
Signature DiscoverySignature `json:"signature"`
FullSchema json.RawMessage `json:"full_schema,omitempty"`
ServerID string `json:"server_id"`
}
type ToolEvent ¶
type ToolEvent struct {
Type ToolEventType
ServerID string
ToolName string
Tool ToolEntry
}
type ToolEventType ¶
type ToolEventType int
const ( ToolEventRegistered ToolEventType = iota ToolEventUnregistered )
type ToolRegistry ¶
type ToolRegistry interface {
RegisterTool(ctx context.Context, serverID, toolName string) error
UnregisterTool(ctx context.Context, serverID, toolName string) error
GetToolServer(ctx context.Context, toolName string) (string, error)
SearchTools(ctx context.Context, query string) []ToolMatch
ListAllTools(ctx context.Context) []ToolEntry
SubscribeTools(ch chan<- ToolEvent) func()
}
func NewToolRegistry ¶
func NewToolRegistry(logger interface{ Debug(msg string, args ...any) }) ToolRegistry
type ToolSchemaRegistry ¶ added in v0.2.0
type ToolSchemaRegistry interface {
RegisterTool(ctx context.Context, tool Tool) error
UnregisterTool(ctx context.Context, serverID, toolName string) error
GetDiscoverySignatures() []DiscoverySignature
GetFullSchema(ctx context.Context, toolName string) (json.RawMessage, error)
RefreshManifest(ctx context.Context) error
}
func NewToolSchemaRegistry ¶ added in v0.2.0
func NewToolSchemaRegistry() ToolSchemaRegistry
type TransportType ¶
type TransportType string
const ( TransportStdio TransportType = "stdio" TransportHTTP TransportType = "http" TransportSSE TransportType = "sse" )
Click to show internal directories.
Click to hide internal directories.