5c807d76a0
Extracted from Cyrene main repo (backend/pkg/plugins + backend/plugin-manager). Contains SDK interfaces (Plugin/Tool/HostAPI), 13 built-in plugins, ToolRegistry with call log ring buffer, and Plugin Manager REST API service. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"log"
|
|
"net/http"
|
|
|
|
"git.yeij.top/AskaEth/Cyrene-Plugins/manager"
|
|
"git.yeij.top/AskaEth/Cyrene-Plugins/sdk"
|
|
)
|
|
|
|
type hostAPI struct {
|
|
registry *manager.ToolRegistry
|
|
}
|
|
|
|
func newHostAPI(registry *manager.ToolRegistry) *hostAPI {
|
|
return &hostAPI{registry: registry}
|
|
}
|
|
|
|
func (h *hostAPI) CallLLM(_ context.Context, _ []sdk.LLMMessage) (*sdk.LLMResponse, error) {
|
|
return nil, fmt.Errorf("LLM call not available in plugin host")
|
|
}
|
|
|
|
func (h *hostAPI) SearchMemory(_ context.Context, _, _ string, _ int) ([]sdk.MemoryEntry, error) {
|
|
return nil, fmt.Errorf("memory search not available in plugin host")
|
|
}
|
|
|
|
func (h *hostAPI) StoreMemory(_ context.Context, _ sdk.MemoryEntry) error {
|
|
return fmt.Errorf("memory store not available in plugin host")
|
|
}
|
|
|
|
func (h *hostAPI) Logger() sdk.Logger {
|
|
return log.Default()
|
|
}
|
|
|
|
func (h *hostAPI) GetConfig(key string) (string, error) {
|
|
return "", fmt.Errorf("config key not found: %s", key)
|
|
}
|
|
|
|
func (h *hostAPI) SetConfig(_, _ string) error { return nil }
|
|
|
|
func (h *hostAPI) PublishEvent(_ context.Context, _ map[string]interface{}) error { return nil }
|
|
|
|
func (h *hostAPI) HTTPClient() *http.Client {
|
|
return http.DefaultClient
|
|
}
|