mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-10-15 12:15:16 +00:00
refactor: migrate built-in plugins to SDK-only interface
- Six-phase plan complete: webui/cli/healthcheck/pluginmgr/clawhubadapter now interact with the kernel exclusively via internal/sdk interfaces; all Configure() calls and package-level global injection removed - buildSDK in internal/plugin/registry.go is the single assembly point - Add internal/sdk/events.go exporting event types/constants - Fix ProviderManager cooldown sharing: LuaAdaptedProvider.Name() now returns the source name instead of lua_<adapter>, so multiple sources sharing an adapter (single script load via shared VM AdapterCache) no longer share failure-cooldown state - Verified: build/vet/tests green, deployed to homeagent.service with full plugin capability testing via local OpenAI-compatible mock
This commit is contained in:
@ -26,10 +26,12 @@ func (m *mockSettings) RegisterDef(def pubsdk.ConfigDef) {}
|
||||
func (m *mockSettings) Defs(prefix string) []*pubsdk.ConfigDef { return nil }
|
||||
func (m *mockSettings) Dump() map[string]interface{} { return nil }
|
||||
func (m *mockSettings) Plugins() []string { return nil }
|
||||
func (m *mockSettings) DefsCore(prefix string) []*sdk.ConfigDef { return nil }
|
||||
func (m *mockSettings) DefsPlugin(plugin, prefix string) []*sdk.ConfigDef { return nil }
|
||||
|
||||
func TestLaunchSidecarNoMainJS(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
sp, err := launchSidecar(tmpDir, "nonexistent")
|
||||
sp, err := launchSidecar(tmpDir, "nonexistent", "")
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
@ -50,7 +52,7 @@ func TestLaunchSidecarAndListTools(t *testing.T) {
|
||||
t.Fatalf("write test plugin: %v", err)
|
||||
}
|
||||
|
||||
sp, err := launchSidecar(tmpDir, "echoplugin")
|
||||
sp, err := launchSidecar(tmpDir, "echoplugin", "")
|
||||
if err != nil {
|
||||
t.Fatalf("launch sidecar: %v", err)
|
||||
}
|
||||
@ -92,7 +94,7 @@ func TestCallEchoTool(t *testing.T) {
|
||||
t.Fatalf("write test plugin: %v", err)
|
||||
}
|
||||
|
||||
sp, err := launchSidecar(tmpDir, "echoplugin")
|
||||
sp, err := launchSidecar(tmpDir, "echoplugin", "")
|
||||
if err != nil {
|
||||
t.Fatalf("launch sidecar: %v", err)
|
||||
}
|
||||
@ -124,7 +126,7 @@ func TestCallAddTool(t *testing.T) {
|
||||
t.Fatalf("write test plugin: %v", err)
|
||||
}
|
||||
|
||||
sp, err := launchSidecar(tmpDir, "echoplugin")
|
||||
sp, err := launchSidecar(tmpDir, "echoplugin", "")
|
||||
if err != nil {
|
||||
t.Fatalf("launch sidecar: %v", err)
|
||||
}
|
||||
@ -157,7 +159,7 @@ func TestCallNonexistentTool(t *testing.T) {
|
||||
t.Fatalf("write test plugin: %v", err)
|
||||
}
|
||||
|
||||
sp, err := launchSidecar(tmpDir, "echoplugin")
|
||||
sp, err := launchSidecar(tmpDir, "echoplugin", "")
|
||||
if err != nil {
|
||||
t.Fatalf("launch sidecar: %v", err)
|
||||
}
|
||||
@ -182,7 +184,7 @@ func TestConcurrentCalls(t *testing.T) {
|
||||
t.Fatalf("write test plugin: %v", err)
|
||||
}
|
||||
|
||||
sp, err := launchSidecar(tmpDir, "echoplugin")
|
||||
sp, err := launchSidecar(tmpDir, "echoplugin", "")
|
||||
if err != nil {
|
||||
t.Fatalf("launch sidecar: %v", err)
|
||||
}
|
||||
@ -217,7 +219,7 @@ func launchSimulator(t *testing.T, pluginDir, name string) *sidecarProcess {
|
||||
if err != nil {
|
||||
t.Fatalf("abs simulator path: %v", err)
|
||||
}
|
||||
sp, err := launchProcess("node", simPath, pluginDir, name)
|
||||
sp, err := launchProcess("node", simPath, pluginDir, name, "")
|
||||
if err != nil {
|
||||
t.Fatalf("launch simulator for %s: %v", name, err)
|
||||
}
|
||||
@ -338,8 +340,6 @@ func TestLoadOCPluginViaPluginStart(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
SimulatorDir = filepath.Join(t.TempDir(), ".simulator")
|
||||
|
||||
p := New("openclaw", skillsDir)
|
||||
|
||||
var registeredTools []string
|
||||
|
||||
Reference in New Issue
Block a user