Files
kandev/apps/web/lib/plugins/plugin-boot-bridge.tsx
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

30 lines
975 B
TypeScript

"use client";
import { useEffect } from "react";
import { useAppStoreApi } from "@/components/state-provider";
import { useFeature } from "@/hooks/domains/features/use-feature";
import { bootPlugins } from "./boot";
import type { ActivePlugin } from "./types";
type PluginBootBridgeProps = {
plugins?: ActivePlugin[];
};
/**
* Mounted once at the app root (inside `StateProvider`, see `src/main.tsx`).
* Triggers `bootPlugins` as soon as the store + boot payload plugins are
* available. Renders nothing — `bootPlugins` itself guards against
* double-loading a store that has already booted, so repeated effect runs
* (StrictMode double-invoke, re-renders) are safe no-ops.
*/
export function PluginBootBridge({ plugins }: PluginBootBridgeProps) {
const store = useAppStoreApi();
const pluginsEnabled = useFeature("plugins");
useEffect(() => {
bootPlugins({ plugins }, store, pluginsEnabled);
}, [plugins, store, pluginsEnabled]);
return null;
}