1ba81a7cd0
Plugin `tools[]` overlapped with MCP, kandev's established mechanism for exposing tools to agents (`internal/mcp/`), and the `InvokeTool` path was never wired into agent tool sets — the `listTools` handler was listing-only. Rather than maintain a half-built parallel surface, remove it. If plugins ever contribute agent tools, they should feed through MCP, not a separate `InvokeTool` RPC. Removes: - proto `InvokeTool` RPC + `ToolRequest`/`ToolResponse`/`ToolContext` messages (regenerated `*.pb.go` / `*_grpc.pb.go`) - pkg/pluginsdk `InvokeTool` from the `Plugin` interface and `UnimplementedPlugin`, the Tool* Go-native types, and the `RemotePlugin`/`GRPCServer` dispatch - internal/plugins `Service.InvokeTool`, the `listTools` handler + `GET /api/plugins/tools` route, `PluginToolDTO`, and the manifest `Tools` field + tool-name uniqueness validation - frontend `PluginTool`/`PluginToolDTO` types, `listPluginTools`, and the manifest-card tools list - fixture/e2e `InvokeTool` echo impl and the `tools:` manifest block Test doubles that used the "crash" tool to exercise crash-restart now use a "crash" webhook key instead. Internal specs (GRPC-CONTRACT, spec) drop the tool RPC/feature; docs/public was already updated in #1774. Co-authored-by: Kandev Agent <agent@kandev.dev> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
59 lines
2.0 KiB
Go
59 lines
2.0 KiB
Go
package pluginsdk
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestUnimplementedPlugin_DefaultsAreNoOps(t *testing.T) {
|
|
var p UnimplementedPlugin
|
|
|
|
require.NoError(t, p.OnEvent(context.Background(), &Event{EventID: "e1"}))
|
|
|
|
webhookResp, err := p.HandleWebhook(context.Background(), &WebhookRequest{Path: "/x"})
|
|
require.NoError(t, err)
|
|
require.NotNil(t, webhookResp)
|
|
require.Equal(t, int32(404), webhookResp.Status)
|
|
}
|
|
|
|
func TestUnimplementedPlugin_SetHostThenHost(t *testing.T) {
|
|
var p UnimplementedPlugin
|
|
require.Nil(t, p.Host())
|
|
|
|
h := &fakeHost{}
|
|
p.SetHost(h)
|
|
require.Equal(t, h, p.Host())
|
|
}
|
|
|
|
// fakeHost is a minimal Host implementation used only to prove SetHost/Host
|
|
// wiring; broker-backed Host behavior is covered by the integration test in
|
|
// serve_test.go. It embeds UnimplementedHostData to satisfy the Host data
|
|
// API (ADR 0043) sub-accessors without wiring them.
|
|
type fakeHost struct {
|
|
UnimplementedHostData
|
|
}
|
|
|
|
func (f *fakeHost) GetState(context.Context, string, string, string) (map[string]any, bool, error) {
|
|
return nil, false, nil
|
|
}
|
|
func (f *fakeHost) SetState(context.Context, string, string, string, map[string]any) error {
|
|
return nil
|
|
}
|
|
func (f *fakeHost) DeleteState(context.Context, string, string, string) error { return nil }
|
|
func (f *fakeHost) ListState(context.Context, string, string) ([]StateEntry, error) {
|
|
return nil, nil
|
|
}
|
|
func (f *fakeHost) GetConfig(context.Context) (map[string]any, error) {
|
|
// Contract: empty non-nil map when no config has been set.
|
|
return map[string]any{}, nil
|
|
}
|
|
func (f *fakeHost) GetSecret(context.Context, string) (string, bool, error) { return "", false, nil }
|
|
func (f *fakeHost) SetSecret(context.Context, string, string) error { return nil }
|
|
func (f *fakeHost) DeleteSecret(context.Context, string) error { return nil }
|
|
func (f *fakeHost) RevealSecret(context.Context, string) (string, error) { return "", nil }
|
|
func (f *fakeHost) EmitEvent(context.Context, string, map[string]any) error { return nil }
|
|
|
|
var _ Host = (*fakeHost)(nil)
|