2.3 KiB
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 |
|
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/requirements/plugins.md→ "Agent tool invocation" (POST{base_url}/tools/{name}, 30s timeout,{tool_call_id, input, context}→{output}), "External webhook proxy" (forward body+headers, addX-Plugin-Id,X-Webhook-Key), and the NEW UI proxy section (GET/POST{base_url}{ui.page.path}; stripX-Frame-Optionsand 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.mdand the reverse-proxy code there (Accept-Encoding handling + iframe-blocking header removal) and mirror the approach withhttputil.ReverseProxy+ModifyResponse.
Acceptance
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).internal/plugins/proxy.go:WebhookProxy(record, webhookKey) http.Handlerforwarding to{base_url}{endpoints.webhooks templated with key}, addingX-Plugin-Id/X-Webhook-Key, preserving method/body/query.UIProxy(record, page) http.Handlerreverse-proxying to{base_url}{page.path},ModifyResponsestripsX-Frame-Optionsand removesframe-ancestorsfrom CSP; rewrites relative redirects under the kandev proxy path.- 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.goapps/backend/internal/plugins/proxy.go+proxy_test.go(httptest upstream)
Verification
go test ./internal/plugins/...fromapps/backendmake -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.