Files
kandev/apps/web/components/plugins/plugin-nav-items.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

37 lines
1.1 KiB
TypeScript

"use client";
import { IconPuzzle } from "@tabler/icons-react";
import { AppSidebarNavItem } from "@/components/app-sidebar/app-sidebar-nav-item";
import { usePluginRegistry } from "@/lib/plugins/registry";
type PluginNavItemsProps = {
collapsed: boolean;
};
/**
* Renders every plugin-registered "main" section nav item
* (`registry.registerNavItem(item)`) in the app sidebar, styled and behaving
* like a first-party `AppSidebarNavItem`. Plugin nav items don't carry a
* host icon component (only an opaque `icon` name string in the frozen
* contract), so every entry uses a generic puzzle-piece glyph.
*/
export function PluginNavItems({ collapsed }: PluginNavItemsProps) {
const registry = usePluginRegistry();
const items = registry.getNavItems().filter((item) => (item.section ?? "main") === "main");
return (
<>
{items.map((item) => (
<AppSidebarNavItem
key={item.id}
icon={IconPuzzle}
label={item.label}
href={item.path}
collapsed={collapsed}
testId={`plugin-nav-item-${item.id}`}
/>
))}
</>
);
}