Files
kandev/docs/plans/plugins/task-05-service.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.4 KiB

id, title, status, wave, depends_on, plan
id title status wave depends_on plan
task-05 Registry + service + lifecycle state machine + Provide pending 2
task-01
task-02
task-03
docs/plans/plugins/plan.md

Registry + service + lifecycle state machine + Provide

Title

The core plugin Service: in-memory registry loaded from the FS store, lifecycle state machine, and a Provide(...) constructor following the repo provider pattern.

Inputs

  • Spec docs/specs/plugins/spec.md → "State machine" (registered→active→ disabled→uninstalled, error branch), "Permissions", registration flow.
  • Depends on: internal/plugins/manifest (task-01), internal/plugins/store (task-02), internal/plugins/state (task-03).
  • Provider pattern reference: internal/jira/provider.go Provide(...) (*Service, cleanup, error) and how internal/backendapp/services.go initJiraService calls it.

Acceptance

  1. internal/plugins/registry.go: Registry wrapping map[string]*store.Record with mutex; Load() from FS store, Get, List, Add, Remove, SetStatus.
  2. internal/plugins/service.go: Service with methods Register(manifest) (*store.Record, store.Credentials, error), List(), Get(id), UpdateConfig(id, map), Uninstall(id), Enable(id), Disable(id), SetStatus(id, status), AuthenticatePlugin(apiKey) (*store.Record, error). Status transitions enforce the spec state machine (reject invalid transitions with a typed error).
  3. internal/plugins/provider.go: Provide(cfg, stateDB, secretAdapter, eventBus, log) (*Service, func() error, error) constructing FS store (dir ~/.kandev/plugins, overridable via cfg/env for tests), state store, registry (Load on startup). Health poller + delivery are wired in later tasks — expose setters/fields so task-06/07 can attach.
  4. Status enum + Status type in internal/plugins/types.go.

Files

  • apps/backend/internal/plugins/types.go
  • apps/backend/internal/plugins/registry.go + registry_test.go
  • apps/backend/internal/plugins/service.go + service_test.go
  • apps/backend/internal/plugins/provider.go + provider_test.go

Verification

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

Output contract

Report: state-machine transition table implemented, Provide signature (so wiring task-09 matches), extension points left for delivery/health. Do not edit manifest/store/state packages (import only).

Dependencies

task-01, task-02, task-03.