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>
49 lines
1.6 KiB
Go
49 lines
1.6 KiB
Go
// Command fixtureplugin is a minimal kandev plugin backend built from
|
|
// pkg/pluginsdk, used only by internal/plugins/runtime's tests to exercise
|
|
// a real go-plugin subprocess spawn/handshake/DeliverEvent/crash-restart
|
|
// cycle end to end. It is built at test time (see
|
|
// internal/plugins/runtime/manager_test.go's TestMain) into a temp binary;
|
|
// it is never shipped.
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
|
|
"github.com/kandev/kandev/pkg/pluginsdk"
|
|
)
|
|
|
|
// fixturePlugin embeds UnimplementedPlugin (for Host injection via
|
|
// SetHost/Host) and overrides every RPC with test-observable behavior:
|
|
// - OnEvent records the last delivered event into Host state, so an
|
|
// out-of-process test can observe delivery by reading that state back
|
|
// through its own fake Host implementation.
|
|
// - HandleWebhook echoes the request body back as the response body,
|
|
// except webhook key "crash" which exits the process immediately (to
|
|
// exercise crash detection + restart).
|
|
type fixturePlugin struct {
|
|
pluginsdk.UnimplementedPlugin
|
|
}
|
|
|
|
func (p *fixturePlugin) OnEvent(ctx context.Context, e *pluginsdk.Event) error {
|
|
host := p.Host()
|
|
if host == nil {
|
|
return nil
|
|
}
|
|
return host.SetState(ctx, "instance", "", "last_event", map[string]any{
|
|
"event_type": e.EventType,
|
|
"event_id": e.EventID,
|
|
})
|
|
}
|
|
|
|
func (p *fixturePlugin) HandleWebhook(_ context.Context, req *pluginsdk.WebhookRequest) (*pluginsdk.WebhookResponse, error) {
|
|
if req.WebhookKey == "crash" {
|
|
os.Exit(1)
|
|
}
|
|
return &pluginsdk.WebhookResponse{Status: 200, Body: req.Body}, nil
|
|
}
|
|
|
|
func main() {
|
|
pluginsdk.Serve(&fixturePlugin{})
|
|
}
|