Skip to content

src/orchestrator/plugin.ts — the VxPlugin interface + installer

The integration seam. A plugin declares a name plus at least one capability; defineWorkspace({ plugins: [...] }) activates it. Core consults capabilities at fixed points and otherwise ignores plugins — behavior lives in the plugin package (vite-style), not in core.

CapabilityConsulted byContract
backend(ctx)cli/run.tsreturn a RunBackend or decline
cache(ctx)run setupreturn a CacheLayer wrapper or decline
telemetry(ctx)telemetry-host.tsreturn sink(s) or decline
eventSink(ctx)plugin-host.tsraw WireEvent consumer
setup(ctx)installPluginsvalidate config; throw UserError
teardown()end-of-runflush/close; crash-isolated, 3s-bounded
  • Decline-fast: every capability must return undefined cheaply when unconfigured — a plain run with declared-but-unconfigured plugins is zero-overhead (measured ~116ms unchanged).
  • setup throws fail the run with a clean error naming the plugin; everything else is crash-isolated (observability never breaks a run).
  • teardown() and EventSink.flush() ARE invoked at end-of-run (since 2026-07) — plugins may rely on them to drain buffers.