Files
kandev/docs/plans/plugins/task-08-proxies.md
T
Kandev Agent c53f699714 feat: add plugin system with grpc runtime and native ui plugins
- go plugin backends ship as release tarballs (per-platform binaries, checksums) that
  kandev installs from url/upload or filesystem sideload+sync, then spawns and
  supervises via hashicorp/go-plugin (unix socket / loopback tcp+automtls)
- strict typed grpc contract (kandev.plugin.v1): DeliverEvent/InvokeTool/HandleWebhook
  plus a capability-gated host service (state, secrets, emit); author sdk in
  pkg/pluginsdk; packaging cli in cmd/plugin-pack
- native frontend bundles: window.registerKandevPlugin + registry/host loader with
  dynamic routes, nav items, slots and ws handlers; plugins settings page with
  install dialog, sync button and enable/disable/uninstall
- gated behind the plugins feature flag (prod off, dev/e2e on); covered by unit and
  integration tests plus playwright e2e against a real packaged fixture plugin

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 17:55:45 +01:00

2.3 KiB

id, title, status, wave, depends_on, plan
id title status wave depends_on plan
task-08 Tool invocation client + webhook & UI reverse proxies pending 2
task-05
docs/plans/plugins/plan.md

Tool invocation client + webhook & UI reverse proxies

Title

Outbound HTTP to plugins: tool invocation client (kandev→plugin), external webhook reverse proxy, and iframe UI page reverse proxy with header stripping.

Inputs

  • Spec docs/specs/plugins/spec.md → "Agent tool invocation" (POST {base_url}/tools/{name}, 30s timeout, {tool_call_id, input, context} → {output}), "External webhook proxy" (forward body+headers, add X-Plugin-Id,X-Webhook-Key), and the NEW UI proxy section (GET/POST {base_url}{ui.page.path}; strip X-Frame-Options and frame-restricting CSP from the plugin response so kandev can iframe it; inject nothing else).
  • Header-stripping precedent: read apps/backend/internal/agentctl/server/api/AGENTS.md and the reverse-proxy code there (Accept-Encoding handling + iframe-blocking header removal) and mirror the approach with httputil.ReverseProxy + ModifyResponse.

Acceptance

  1. internal/plugins/client.go: Client.InvokeTool(ctx, record, toolName, input, callCtx) (json.RawMessage, error), 30s timeout, non-2xx → typed error. Client.Health(ctx, record) error (used by task-07).
  2. internal/plugins/proxy.go: WebhookProxy(record, webhookKey) http.Handler forwarding to {base_url}{endpoints.webhooks templated with key}, adding X-Plugin-Id/X-Webhook-Key, preserving method/body/query.
  3. UIProxy(record, page) http.Handler reverse-proxying to {base_url}{page.path}, ModifyResponse strips X-Frame-Options and removes frame-ancestors from CSP; rewrites relative redirects under the kandev proxy path.
  4. Both proxies 404/503 when record is nil / not active (the handler layer task-09 passes only valid records; still guard).

Files

  • apps/backend/internal/plugins/client.go + client_test.go
  • apps/backend/internal/plugins/proxy.go + proxy_test.go (httptest upstream)

Verification

  • go test ./internal/plugins/... from apps/backend
  • make -C apps/backend lint

Output contract

Report: tool-call request/response shapes, exact headers stripped on UI proxy, redirect-rewrite behavior. Import task-05 types only; do not edit other tasks' files.

Dependencies

task-05.