Skip to content

🙌 OpenHands: AI-Driven Development

feat: build the Plugins management page (browse / install / enable-disable / uninstall) (#1476)

Hiep Le3520cf18215b
diff --git a/__tests__/components/features/plugins/add-plugin-modal.test.tsx b/__tests__/components/features/plugins/add-plugin-modal.test.tsx
new file mode 100644
index 0000000000..60cd096892
--- /dev/null
+++ b/__tests__/components/features/plugins/add-plugin-modal.test.tsx
@@ -0,0 +1,65 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { render, screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { AddPluginModal } from "#/components/features/plugins/add-plugin-modal";
+import PluginsManagementService from "#/api/plugins-management-service";
+
+function renderAddPluginModal(onClose = vi.fn()) {
+ render(<AddPluginModal onClose={onClose} />, {
+ wrapper: ({ children }) => (
+ <QueryClientProvider
+ client={
+ new QueryClient({ defaultOptions: { queries: { retry: false } } })
+ }
+ >
+ {children}
+ </QueryClientProvider>
+ ),
+ });
+ return { onClose };
+}
+
+describe("AddPluginModal", () => {
+ beforeEach(() => {
+ vi.restoreAllMocks();
+ });
+
+ it("installs the plugin with the entered source on submit", async () => {
+ const user = userEvent.setup();
+ const installSpy = vi
+ .spyOn(PluginsManagementService, "installPlugin")
+ .mockResolvedValue({
+ name: "weather",
+ version: "1.0.0",
+ description: "",
+ enabled: true,
+ source: "github:acme/weather",
+ resolved_ref: null,
+ repo_path: null,
+ installed_at: "2026-06-01T00:00:00Z",
+ install_path: "/home/.openhands/plugins/installed/weather",
+ });
+
+ renderAddPluginModal();
+ await user.type(
+ screen.getByTestId("add-plugin-source-input"),
+ "github:acme/weather",
+ );
+ await user.click(screen.getByTestId("add-plugin-submit"));
+
+ await waitFor(() =>
+ expect(installSpy).toHaveBeenCalledWith({
+ source: "github:acme/weather",
+ ref: null,
+ repo_path: null,
+ }),
+ );
+ });
+
+ it("disables the submit button while the source field is empty", () => {
+ renderAddPluginModal();
+
+ expect(screen.getByTestId("add-plugin-submit")).toBeDisabled();
+ });
+});
diff --git a/__tests__/components/features/plugins/build-plugins-view-model.test.ts b/__tests__/components/features/plugins/build-plugins-view-model.test.ts
new file mode 100644
index 0000000000..2a25150eb3
--- /dev/null
+++ b/__tests__/components/features/plugins/build-plugins-view-model.test.ts
@@ -0,0 +1,63 @@
+import { describe, expect, it } from "vitest";
+import { buildPluginsViewModel } from "#/components/features/plugins/build-plugins-view-model";
+import type { MarketplacePlugin } from "#/api/plugins-service";
+import type { InstalledPluginInfo } from "#/api/plugins-management-service";
+
+const catalogPlugin: MarketplacePlugin = {
+ name: "demo-plugin",
+ description: "Catalog description",
+ source: "github:OpenHands/extensions",
+ ref: null,
+ repo_path: "plugins/demo-plugin",
+ installed: false,
+};
+
+const installedPlugin: InstalledPluginInfo = {
+ name: "demo-plugin",
+ version: "2.0.0",
+ description: "Installed description",
+ enabled: false,
+ source: "github:OpenHands/extensions",
+ resolved_ref: "main",
+ repo_path: "plugins/demo-plugin",
+ installed_at: "2026-06-01T00:00:00Z",
+ install_path: "/home/.openhands/plugins/installed/demo-plugin",
+};
+
+describe("buildPluginsViewModel", () => {
+ it("merges a plugin present in both the catalog and the installed list into one installed entry", () => {
+ const result = buildPluginsViewModel([catalogPlugin], [installedPlugin]);
+
+ expect(result).toHaveLength(1);
+ expect(result[0]).toMatchObject({
+ name: "demo-plugin",
+ installed: true,
+ inCatalog: true,
+ enabled: false,
+ version: "2.0.0",
+ });
+ });
+
+ it("marks a catalog-only plugin as not installed", () => {
+ const result = buildPluginsViewModel([catalogPlugin], []);
+
+ expect(result).toHaveLength(1);
+ expect(result[0]).toMatchObject({
+ name: "demo-plugin",
+ installed: false,
+ inCatalog: true,
+ });
+ });
+
+ it("keeps an installed plugin that is absent from the catalog", () => {
+ const result = buildPluginsViewModel([], [installedPlugin]);
+
+ expect(result).toHaveLength(1);
+ expect(result[0]).toMatchObject({
+ name: "demo-plugin",
+ installed: true,
+ inCatalog: false,
+ enabled: false,
+ });
+ });
+});
diff --git a/__tests__/routes/plugins-page.test.tsx b/__tests__/routes/plugins-page.test.tsx
new file mode 100644
index 0000000000..3cf4057248
--- /dev/null
+++ b/__tests__/routes/plugins-page.test.tsx
@@ -0,0 +1,225 @@
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { render, screen, fireEvent, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import SkillsPluginsScreen from "#/routes/skills-plugins";
+import SettingsService from "#/api/settings-service/settings-service.api";
+import PluginsService, { type MarketplacePlugin } from "#/api/plugins-service";
+import PluginsManagementService, {
+ type InstalledPluginInfo,
+} from "#/api/plugins-management-service";
+import {
+ __resetActiveStoreForTests,
+ setActiveSelection,
+ setRegisteredBackends,
+} from "#/api/backend-registry/active-store";
+import type { Backend } from "#/api/backend-registry/types";
+import { MOCK_DEFAULT_USER_SETTINGS } from "#/mocks/handlers";
+import { ActiveBackendProvider } from "#/contexts/active-backend-context";
+
+const navigateMock = vi.fn();
+
+vi.mock("#/context/navigation-context", () => ({
+ useNavigation: () => ({
+ navigate: navigateMock,
+ currentPath: "/plugins",
+ conversationId: null,
+ isNavigating: false,
+ }),
+ NavigationProvider: ({ children }: { children: React.ReactNode }) => children,
+}));
+
+const localBackend: Backend = {
+ id: "local",
+ name: "Local",
+ host: "http://127.0.0.1:8001",
+ apiKey: "",
+ kind: "local",
+};
+
+function buildCatalogPlugin(
+ overrides: Partial<MarketplacePlugin> = {},
+): MarketplacePlugin {
+ return {
+ name: "demo-plugin",
+ description: "A demo plugin",
+ source: "github:OpenHands/extensions",
+ ref: null,
+ repo_path: "plugins/demo-plugin",
+ installed: false,
+ ...overrides,
+ };
+}
+
+function buildInstalledPlugin(
+ overrides: Partial<InstalledPluginInfo> = {},
+): InstalledPluginInfo {
+ return {
+ name: "demo-plugin",
+ version: "1.0.0",
+ description: "A demo plugin",
+ enabled: true,
+ source: "github:OpenHands/extensions",
+ resolved_ref: null,
+ repo_path: "plugins/demo-plugin",
+ installed_at: "2026-06-01T00:00:00Z",
+ install_path: "/home/.openhands/plugins/installed/demo-plugin",
+ ...overrides,
+ };
+}
+
+function renderPluginsScreen() {
+ return render(<SkillsPluginsScreen />, {
+ wrapper: ({ children }) => (
+ <QueryClientProvider
+ client={
+ new QueryClient({ defaultOptions: { queries: { retry: false } } })
+ }
+ >
+ <ActiveBackendProvider>{children}</ActiveBackendProvider>
+ </QueryClientProvider>
+ ),
+ });
+}
+
+describe("SkillsPluginsScreen", () => {
+ beforeEach(() => {
+ vi.restoreAllMocks();
+ navigateMock.mockReset();
+ __resetActiveStoreForTests();
+ setRegisteredBackends([localBackend]);
+ setActiveSelection({ backendId: localBackend.id });
+ vi.spyOn(SettingsService, "getSettings").mockResolvedValue(
+ MOCK_DEFAULT_USER_SETTINGS,
+ );
+ vi.spyOn(PluginsService, "getPluginsMarketplace").mockResolvedValue([]);
+ vi.spyOn(
+ PluginsManagementService,
+ "listInstalledPlugins",
+ ).mockResolvedValue([]);
+ });
+
+ it("renders an Install action for a catalog plugin that is not installed", async () => {
+ vi.spyOn(PluginsService, "getPluginsMarketplace").mockResolvedValue([
+ buildCatalogPlugin(),
+ ]);
+
+ renderPluginsScreen();
+
+ expect(
+ await screen.findByTestId("plugin-install-demo-plugin"),
+ ).toBeInTheDocument();
+ });
+
+ it("renders an enable/disable toggle reflecting state for an installed plugin", async () => {
+ vi.spyOn(
+ PluginsManagementService,
+ "listInstalledPlugins",
+ ).mockResolvedValue([buildInstalledPlugin({ enabled: true })]);
+
+ renderPluginsScreen();
+
+ const toggle = await screen.findByTestId("plugin-toggle-demo-plugin");
+ expect(toggle).toHaveAttribute("aria-checked", "true");
+ });
+
+ it("installs a catalog plugin with its coordinates when Install is clicked", async () => {
+ const user = userEvent.setup();
+ vi.spyOn(PluginsService, "getPluginsMarketplace").mockResolvedValue([
+ buildCatalogPlugin(),
+ ]);
+ const installSpy = vi
+ .spyOn(PluginsManagementService, "installPlugin")
+ .mockResolvedValue(buildInstalledPlugin());
+
+ renderPluginsScreen();
+ await user.click(await screen.findByTestId("plugin-install-demo-plugin"));
+
+ await waitFor(() =>
+ expect(installSpy).toHaveBeenCalledWith({
+ source: "github:OpenHands/extensions",
+ ref: null,
+ repo_path: "plugins/demo-plugin",
+ }),
+ );
+ });
+
+ it("toggles an installed plugin off via the card toggle", async () => {
+ const user = userEvent.setup();
+ vi.spyOn(
+ PluginsManagementService,
+ "listInstalledPlugins",
+ ).mockResolvedValue([buildInstalledPlugin({ enabled: true })]);
+ const toggleSpy = vi
+ .spyOn(PluginsManagementService, "setPluginEnabled")
+ .mockResolvedValue({ name: "demo-plugin", enabled: false });
+
+ renderPluginsScreen();
+ await user.click(await screen.findByTestId("plugin-toggle-demo-plugin"));
+
+ await waitFor(() =>
+ expect(toggleSpy).toHaveBeenCalledWith("demo-plugin", false),
+ );
+ });
+
+ it("uninstalls an installed plugin from the detail modal", async () => {
+ const user = userEvent.setup();
+ vi.spyOn(
+ PluginsManagementService,
+ "listInstalledPlugins",
+ ).mockResolvedValue([buildInstalledPlugin()]);
+ const uninstallSpy = vi
+ .spyOn(PluginsManagementService, "uninstallPlugin")
+ .mockResolvedValue({ message: "ok" });
+
+ renderPluginsScreen();
+ await user.click(await screen.findByTestId("plugin-card-demo-plugin"));
+ await user.click(
+ await screen.findByTestId("plugin-detail-uninstall-demo-plugin"),
+ );
+
+ await waitFor(() =>
+ expect(uninstallSpy).toHaveBeenCalledWith("demo-plugin"),
+ );
+ });
+
+ it("filters the list by the search query", async () => {
+ vi.spyOn(PluginsService, "getPluginsMarketplace").mockResolvedValue([
+ buildCatalogPlugin({ name: "alpha-plugin" }),
+ buildCatalogPlugin({ name: "beta-plugin" }),
+ ]);
+
+ renderPluginsScreen();
+ await screen.findByTestId("plugin-card-alpha-plugin");
+
+ fireEvent.change(screen.getByTestId("plugins-search-input"), {
+ target: { value: "beta" },
+ });
+
+ expect(
+ screen.queryByTestId("plugin-card-alpha-plugin"),
+ ).not.toBeInTheDocument();
+ expect(screen.getByTestId("plugin-card-beta-plugin")).toBeInTheDocument();
+ });
+
+ it("shows the empty state when there are no plugins", async () => {
+ renderPluginsScreen();
+
+ expect(await screen.findByTestId("plugins-empty")).toBeInTheDocument();
+ });
+
+ it("shows the no-match state when the search excludes everything", async () => {
+ vi.spyOn(PluginsService, "getPluginsMarketplace").mockResolvedValue([
+ buildCatalogPlugin(),
+ ]);
+
+ renderPluginsScreen();
+ await screen.findByTestId("plugin-card-demo-plugin");
+
+ fireEvent.change(screen.getByTestId("plugins-search-input"), {
+ target: { value: "no-such-plugin-xyz" },
+ });
+
+ expect(screen.getByTestId("plugins-no-match")).toBeInTheDocument();
+ });
+});
diff --git a/src/api/plugins-management-service.test.ts b/src/api/plugins-management-service.test.ts
new file mode 100644
index 0000000000..924abec5c4
--- /dev/null
+++ b/src/api/plugins-management-service.test.ts
@@ -0,0 +1,137 @@
+import { PluginsClient } from "@openhands/typescript-client/clients";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import {
+ __resetActiveStoreForTests,
+ setActiveSelection,
+ setRegisteredBackends,
+} from "#/api/backend-registry/active-store";
+import type { Backend } from "#/api/backend-registry/types";
+import PluginsManagementService from "#/api/plugins-management-service";
+
+vi.mock("@openhands/typescript-client/clients", () => ({
+ PluginsClient: vi.fn(),
+}));
+
+const listInstalledPlugins = vi.fn();
+const installPlugin = vi.fn();
+const setPluginEnabled = vi.fn();
+const uninstallPlugin = vi.fn();
+const refreshPlugin = vi.fn();
+const close = vi.fn();
+
+function useBackend(kind: "local" | "cloud"): void {
+ const backend: Backend = {
+ id: kind,
+ name: kind,
+ host: "http://127.0.0.1:8001",
+ apiKey: "session-key",
+ kind,
+ };
+ setRegisteredBackends([backend]);
+ setActiveSelection({ backendId: kind, orgId: null });
+}
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ __resetActiveStoreForTests();
+ vi.mocked(PluginsClient).mockImplementation(function MockPluginsClient() {
+ return {
+ listInstalledPlugins,
+ installPlugin,
+ setPluginEnabled,
+ uninstallPlugin,
+ refreshPlugin,
+ close,
+ } as unknown as PluginsClient;
+ } as unknown as typeof PluginsClient);
+});
+
+afterEach(() => {
+ __resetActiveStoreForTests();
+});
+
+const installedPlugin = {
+ name: "demo-plugin",
+ version: "1.0.0",
+ description: "A demo plugin",
+ enabled: true,
+ source: "github:OpenHands/extensions",
+ resolved_ref: null,
+ repo_path: "plugins/demo-plugin",
+ installed_at: "2026-06-01T00:00:00Z",
+ install_path: "/home/.openhands/plugins/installed/demo-plugin",
+};
+
+describe("PluginsManagementService", () => {
+ it("lists installed plugins from the local agent-server", async () => {
+ useBackend("local");
+ listInstalledPlugins.mockResolvedValue({ plugins: [installedPlugin] });
+
+ const result = await PluginsManagementService.listInstalledPlugins();
+
+ expect(result).toEqual([installedPlugin]);
+ expect(listInstalledPlugins).toHaveBeenCalledTimes(1);
+ });
+
+ it("returns an empty installed list on a cloud backend without calling the client", async () => {
+ useBackend("cloud");
+
+ const result = await PluginsManagementService.listInstalledPlugins();
+
+ expect(result).toEqual([]);
+ expect(PluginsClient).not.toHaveBeenCalled();
+ });
+
+ it("returns an empty installed list when the local request fails", async () => {
+ useBackend("local");
+ listInstalledPlugins.mockRejectedValue(new Error("unreachable"));
+
+ const result = await PluginsManagementService.listInstalledPlugins();
+
+ expect(result).toEqual([]);
+ });
+
+ it("forwards source, ref, and repo_path when installing a plugin", async () => {
+ useBackend("local");
+ installPlugin.mockResolvedValue(installedPlugin);
+
+ await PluginsManagementService.installPlugin({
+ source: "github:OpenHands/extensions",
+ ref: "main",
+ repo_path: "plugins/demo-plugin",
+ });
+
+ expect(installPlugin).toHaveBeenCalledWith({
+ source: "github:OpenHands/extensions",
+ ref: "main",
+ repo_path: "plugins/demo-plugin",
+ });
+ });
+
+ it("forwards the name and enabled flag when toggling a plugin", async () => {
+ useBackend("local");
+ setPluginEnabled.mockResolvedValue({ name: "demo-plugin", enabled: false });
+
+ await PluginsManagementService.setPluginEnabled("demo-plugin", false);
+
+ expect(setPluginEnabled).toHaveBeenCalledWith("demo-plugin", false);
+ });
+
+ it("forwards the plugin name when uninstalling", async () => {
+ useBackend("local");
+ uninstallPlugin.mockResolvedValue({ message: "ok" });
+
+ await PluginsManagementService.uninstallPlugin("demo-plugin");
+
+ expect(uninstallPlugin).toHaveBeenCalledWith("demo-plugin");
+ });
+
+ it("forwards the plugin name when refreshing", async () => {
+ useBackend("local");
+ refreshPlugin.mockResolvedValue({ message: "ok", plugin: installedPlugin });
+
+ await PluginsManagementService.refreshPlugin("demo-plugin");
+
+ expect(refreshPlugin).toHaveBeenCalledWith("demo-plugin");
+ });
+});
diff --git a/src/api/plugins-management-service.ts b/src/api/plugins-management-service.ts
new file mode 100644
index 0000000000..a910d9e8c1
--- /dev/null
+++ b/src/api/plugins-management-service.ts
@@ -0,0 +1,131 @@
+import { PluginsClient } from "@openhands/typescript-client/clients";
+import { getActiveBackend } from "./backend-registry/active-store";
+import { getAgentServerClientOptions } from "./agent-server-client-options";
+
+/**
+ * An installed plugin, as returned by the agent-server management router
+ * (`GET /api/plugins/installed`). Matches the typescript-client
+ * `InstalledPluginInfo`.
+ */
+export interface InstalledPluginInfo {
+ name: string;
+ version: string;
+ description: string | null;
+ enabled: boolean;
+ source: string;
+ resolved_ref?: string | null;
+ repo_path?: string | null;
+ installed_at: string;
+ install_path: string;
+}
+
+/** Coordinates for installing a plugin from a git source or local path. */
+export interface InstallPluginRequest {
+ source: string;
+ ref?: string | null;
+ repo_path?: string | null;
+ force?: boolean;
+}
+
+/**
+ * The slice of the typescript-client `PluginsClient` this service drives. The
+ * installed `@openhands/typescript-client` package does not yet export these
+ * management methods (they ship in typescript-client PRs #222/#223); narrowing
+ * to this local interface keeps `vitest` (types stripped) and `eslint` green
+ * until the client is republished, at which point the cast below can be dropped.
+ */
+interface PluginsManagementClient {
+ listInstalledPlugins(): Promise<{ plugins: InstalledPluginInfo[] }>;
+ installPlugin(request: InstallPluginRequest): Promise<InstalledPluginInfo>;
+ setPluginEnabled(
+ name: string,
+ enabled: boolean,
+ ): Promise<{ name: string; enabled: boolean }>;
+ uninstallPlugin(name: string): Promise<{ message: string }>;
+ refreshPlugin(
+ name: string,
+ ): Promise<{ message: string; plugin: InstalledPluginInfo }>;
+}
+
+function isCloudBackend(): boolean {
+ return getActiveBackend().backend.kind === "cloud";
+}
+
+function getManagementClient(): PluginsManagementClient {
+ return new PluginsClient(
+ getAgentServerClientOptions(),
+ ) as unknown as PluginsManagementClient;
+}
+
+/**
+ * Front-end management layer for installed plugins: list / install / enable /
+ * disable / uninstall / refresh. Kept separate from the read-only catalog
+ * service (`plugins-service.ts`), exactly as skills separate the marketplace
+ * catalog from install actions.
+ *
+ * Local backend only for now (per Appendix C Q5): installed plugins live on the
+ * local agent-server's `~/.openhands/plugins/installed/`. A cloud backend has no
+ * per-user installed store yet, so reads return an empty list and mutating
+ * actions throw (the UI also disables them on cloud).
+ */
+class PluginsManagementService {
+ static async listInstalledPlugins(): Promise<InstalledPluginInfo[]> {
+ if (isCloudBackend()) {
+ return [];
+ }
+
+ try {
+ const response = await getManagementClient().listInstalledPlugins();
+ return response.plugins ?? [];
+ } catch {
+ // Agent-server may predate the plugins router or be unreachable; surface
+ // an empty list rather than throwing (mirrors the catalog service).
+ return [];
+ }
+ }
+
+ static async installPlugin(
+ request: InstallPluginRequest,
+ ): Promise<InstalledPluginInfo> {
+ if (isCloudBackend()) {
+ throw new Error(
+ "Installing plugins is only available on a local backend.",
+ );
+ }
+ return getManagementClient().installPlugin(request);
+ }
+
+ static async setPluginEnabled(
+ name: string,
+ enabled: boolean,
+ ): Promise<{ name: string; enabled: boolean }> {
+ if (isCloudBackend()) {
+ throw new Error(
+ "Enabling and disabling plugins is only available on a local backend.",
+ );
+ }
+ return getManagementClient().setPluginEnabled(name, enabled);
+ }
+
+ static async uninstallPlugin(name: string): Promise<{ message: string }> {
+ if (isCloudBackend()) {
+ throw new Error(
+ "Uninstalling plugins is only available on a local backend.",
+ );
+ }
+ return getManagementClient().uninstallPlugin(name);
+ }
+
+ static async refreshPlugin(
+ name: string,
+ ): Promise<{ message: string; plugin: InstalledPluginInfo }> {
+ if (isCloudBackend()) {
+ throw new Error(
+ "Refreshing plugins is only available on a local backend.",
+ );
+ }
+ return getManagementClient().refreshPlugin(name);
+ }
+}
+
+export default PluginsManagementService;
diff --git a/src/components/features/plugins/add-plugin-modal.tsx b/src/components/features/plugins/add-plugin-modal.tsx
new file mode 100644
index 0000000000..f789f46a96
--- /dev/null
+++ b/src/components/features/plugins/add-plugin-modal.tsx
@@ -0,0 +1,121 @@
+import React from "react";
+import { useTranslation } from "react-i18next";
+import { ModalBackdrop } from "#/components/shared/modals/modal-backdrop";
+import { ModalCloseButton } from "#/components/shared/modals/modal-close-button";
+import { BrandButton } from "#/components/features/settings/brand-button";
+import { SettingsInput } from "#/components/features/settings/settings-input";
+import { useInstallPlugin } from "#/hooks/mutation/use-install-plugin";
+import { I18nKey } from "#/i18n/declaration";
+import { cn } from "#/utils/utils";
+import { modalTitleLgClassName } from "#/utils/modal-classes";
+
+interface AddPluginModalProps {
+ onClose: () => void;
+ onInstalled?: () => void;
+}
+
+export function AddPluginModal({ onClose, onInstalled }: AddPluginModalProps) {
+ const { t } = useTranslation("openhands");
+ const installPlugin = useInstallPlugin();
+
+ const [source, setSource] = React.useState("");
+ const [ref, setRef] = React.useState("");
+ const [repoPath, setRepoPath] = React.useState("");
+
+ const trimmedSource = source.trim();
+ const canSubmit = trimmedSource.length > 0 && !installPlugin.isPending;
+
+ const handleSubmit = (event: React.FormEvent) => {
+ event.preventDefault();
+ if (!canSubmit) return;
+
+ installPlugin.mutate(
+ {
+ source: trimmedSource,
+ ref: ref.trim() || null,
+ repo_path: repoPath.trim() || null,
+ },
+ {
+ onSuccess: () => {
+ onInstalled?.();
+ onClose();
+ },
+ },
+ );
+ };
+
+ return (
+ <ModalBackdrop
+ onClose={onClose}
+ aria-label={t(I18nKey.SETTINGS$PLUGINS_ADD_MODAL_TITLE)}
+ >
+ <form
+ onSubmit={handleSubmit}
+ data-testid="add-plugin-modal"
+ className="relative flex w-[520px] max-w-[90vw] max-h-[85vh] flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary"
+ >
+ <ModalCloseButton onClose={onClose} testId="add-plugin-modal-close" />
+
+ <header className="flex-shrink-0 px-6 pb-4 pt-6">
+ <h2 className={cn("pr-6", modalTitleLgClassName)}>
+ {t(I18nKey.SETTINGS$PLUGINS_ADD_MODAL_TITLE)}
+ </h2>
+ <p className="mt-4 text-sm text-tertiary-light">
+ {t(I18nKey.SETTINGS$PLUGINS_ADD_MODAL_INTRO)}
+ </p>
+ </header>
+
+ <div className="flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 custom-scrollbar">
+ <SettingsInput
+ testId="add-plugin-source-input"
+ label={t(I18nKey.SETTINGS$PLUGINS_SOURCE_LABEL)}
+ type="text"
+ value={source}
+ onChange={setSource}
+ placeholder={t(I18nKey.SETTINGS$PLUGINS_SOURCE_PLACEHOLDER)}
+ showRequiredTag
+ />
+ <SettingsInput
+ testId="add-plugin-ref-input"
+ label={t(I18nKey.SETTINGS$PLUGINS_REF_LABEL)}
+ type="text"
+ value={ref}
+ onChange={setRef}
+ showOptionalTag
+ />
+ <SettingsInput
+ testId="add-plugin-repo-path-input"
+ label={t(I18nKey.SETTINGS$PLUGINS_REPO_PATH_LABEL)}
+ type="text"
+ value={repoPath}
+ onChange={setRepoPath}
+ showOptionalTag
+ />
+ </div>
+
+ <footer className="flex flex-shrink-0 justify-end gap-2 px-6 pb-6 pt-4">
+ <BrandButton
+ type="button"
+ variant="secondary"
+ onClick={onClose}
+ testId="add-plugin-modal-dismiss"
+ >
+ {t(I18nKey.BUTTON$CLOSE)}
+ </BrandButton>
+ <BrandButton
+ type="submit"
+ variant="primary"
+ testId="add-plugin-submit"
+ isDisabled={!canSubmit}
+ >
+ {t(
+ installPlugin.isPending
+ ? I18nKey.SETTINGS$PLUGINS_INSTALLING
+ : I18nKey.SETTINGS$PLUGINS_INSTALL,
+ )}
+ </BrandButton>
+ </footer>
+ </form>
+ </ModalBackdrop>
+ );
+}
diff --git a/src/components/features/plugins/build-plugins-view-model.ts b/src/components/features/plugins/build-plugins-view-model.ts
new file mode 100644
index 0000000000..2c816dd2a6
--- /dev/null
+++ b/src/components/features/plugins/build-plugins-view-model.ts
@@ -0,0 +1,99 @@
+import type { MarketplacePlugin } from "#/api/plugins-service";
+import type { InstalledPluginInfo } from "#/api/plugins-management-service";
+
+export type PluginStatusFilter = "all" | "installed" | "available";
+
+/**
+ * A single row in the plugins management list, reconciling the dynamic
+ * marketplace catalog with the locally-installed plugins.
+ */
+export interface PluginViewModel {
+ name: string;
+ description: string | null;
+ source: string | null;
+ ref: string | null;
+ repoPath: string | null;
+ /** Installed on the local agent-server. */
+ installed: boolean;
+ /** Enabled (only meaningful when installed); enabled plugins auto-load. */
+ enabled: boolean;
+ /** Installed version, when known. */
+ version: string | null;
+ /** Present in the marketplace catalog. */
+ inCatalog: boolean;
+}
+
+/**
+ * Merge the marketplace catalog with the installed plugins into one
+ * de-duplicated list keyed by plugin name. The installed list is the source of
+ * truth for install/enable state and coordinates; the catalog supplies
+ * description/coordinates as a fallback. Installed plugins sort first, then
+ * alphabetically.
+ */
+export function buildPluginsViewModel(
+ marketplace: MarketplacePlugin[] | undefined,
+ installed: InstalledPluginInfo[] | undefined,
+): PluginViewModel[] {
+ const byName = new Map<string, PluginViewModel>();
+
+ for (const entry of marketplace ?? []) {
+ byName.set(entry.name, {
+ name: entry.name,
+ description: entry.description,
+ source: entry.source,
+ ref: entry.ref ?? null,
+ repoPath: entry.repo_path ?? null,
+ installed: entry.installed,
+ enabled: false,
+ version: null,
+ inCatalog: true,
+ });
+ }
+
+ for (const entry of installed ?? []) {
+ const existing = byName.get(entry.name);
+ byName.set(entry.name, {
+ name: entry.name,
+ description: existing?.description ?? entry.description ?? null,
+ source: entry.source ?? existing?.source ?? null,
+ ref: entry.resolved_ref ?? existing?.ref ?? null,
+ repoPath: entry.repo_path ?? existing?.repoPath ?? null,
+ installed: true,
+ enabled: entry.enabled,
+ version: entry.version ?? null,
+ inCatalog: existing?.inCatalog ?? false,
+ });
+ }
+
+ return Array.from(byName.values()).sort((a, b) => {
+ if (a.installed !== b.installed) return a.installed ? -1 : 1;
+ return a.name.localeCompare(b.name);
+ });
+}
+
+/** True when the plugin matches a free-text search query (empty query matches). */
+export function matchesPluginSearch(
+ plugin: PluginViewModel,
+ query: string,
+): boolean {
+ const trimmed = query.trim().toLowerCase();
+ if (!trimmed) return true;
+ const haystacks = [
+ plugin.name,
+ plugin.description ?? "",
+ plugin.source ?? "",
+ plugin.repoPath ?? "",
+ plugin.ref ?? "",
+ ];
+ return haystacks.some((value) => value.toLowerCase().includes(trimmed));
+}
+
+/** True when the plugin matches the install-state filter. */
+export function matchesPluginStatus(
+ plugin: PluginViewModel,
+ filter: PluginStatusFilter,
+): boolean {
+ if (filter === "installed") return plugin.installed;
+ if (filter === "available") return !plugin.installed;
+ return true;
+}
diff --git a/src/components/features/plugins/plugin-card.tsx b/src/components/features/plugins/plugin-card.tsx
new file mode 100644
index 0000000000..89cf69e99c
--- /dev/null
+++ b/src/components/features/plugins/plugin-card.tsx
@@ -0,0 +1,124 @@
+import React from "react";
+import { useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+import { cn } from "#/utils/utils";
+import { CirclePlusCheckToggle } from "#/components/shared/buttons/circle-plus-check-toggle";
+import { BrandButton } from "#/components/features/settings/brand-button";
+import {
+ extensionModuleCardInteractiveClassName,
+ extensionModuleCardPillClassName,
+ extensionModuleCardSurfaceClassName,
+} from "#/utils/extension-module-card-classes";
+import type { PluginViewModel } from "./build-plugins-view-model";
+
+interface PluginCardProps {
+ plugin: PluginViewModel;
+ /** A mutation targeting this plugin is in flight. */
+ isBusy?: boolean;
+ /** Management actions are unavailable (e.g. non-local backend). */
+ isDisabled?: boolean;
+ onOpen: () => void;
+ onInstall: () => void;
+ onToggle: (enabled: boolean) => void;
+}
+
+export function PluginCard({
+ plugin,
+ isBusy = false,
+ isDisabled = false,
+ onOpen,
+ onInstall,
+ onToggle,
+}: PluginCardProps) {
+ const { t } = useTranslation("openhands");
+
+ const handleKeyDown = (event: React.KeyboardEvent) => {
+ if (event.key === "Enter" || event.key === " ") {
+ event.preventDefault();
+ onOpen();
+ }
+ };
+
+ const handleInstall = (event?: React.MouseEvent<HTMLButtonElement>) => {
+ event?.stopPropagation();
+ onInstall();
+ };
+
+ return (
+ <div
+ data-testid={`plugin-card-${plugin.name}`}
+ role="button"
+ tabIndex={0}
+ onClick={onOpen}
+ onKeyDown={handleKeyDown}
+ className={cn(
+ "flex min-w-0 flex-col gap-3 overflow-hidden p-4",
+ extensionModuleCardSurfaceClassName,
+ extensionModuleCardInteractiveClassName,
+ )}
+ >
+ <header className="flex items-start justify-between gap-3">
+ <div className="min-w-0 flex-1">
+ <h3
+ data-testid={`plugin-name-${plugin.name}`}
+ className="truncate text-sm font-semibold text-white"
+ >
+ {plugin.name}
+ </h3>
+ {plugin.source ? (
+ <p
+ data-testid={`plugin-source-${plugin.name}`}
+ className="mt-0.5 min-w-0 truncate text-xs text-tertiary-alt"
+ title={plugin.source}
+ >
+ {plugin.source}
+ </p>
+ ) : null}
+ </div>
+
+ {plugin.installed ? (
+ <CirclePlusCheckToggle
+ testId={`plugin-toggle-${plugin.name}`}
+ isSelected={plugin.enabled}
+ isDisabled={isDisabled || isBusy}
+ onToggle={onToggle}
+ disableTooltipKey={I18nKey.COMMON$DISABLE}
+ />
+ ) : (
+ <BrandButton
+ type="button"
+ variant="secondary"
+ testId={`plugin-install-${plugin.name}`}
+ isDisabled={isDisabled || isBusy}
+ className="flex-shrink-0 whitespace-nowrap"
+ onClick={handleInstall}
+ >
+ {t(
+ isBusy
+ ? I18nKey.SETTINGS$PLUGINS_INSTALLING
+ : I18nKey.SETTINGS$PLUGINS_INSTALL,
+ )}
+ </BrandButton>
+ )}
+ </header>
+
+ {plugin.description ? (
+ <p
+ data-testid={`plugin-description-${plugin.name}`}
+ className="line-clamp-2 break-words text-xs leading-relaxed text-tertiary-light"
+ >
+ {plugin.description}
+ </p>
+ ) : null}
+
+ {plugin.installed && plugin.version ? (
+ <span
+ data-testid={`plugin-version-${plugin.name}`}
+ className={cn(extensionModuleCardPillClassName, "self-start")}
+ >
+ {t(I18nKey.SETTINGS$SKILLS_VERSION, { version: plugin.version })}
+ </span>
+ ) : null}
+ </div>
+ );
+}
diff --git a/src/components/features/plugins/plugin-detail-modal.tsx b/src/components/features/plugins/plugin-detail-modal.tsx
new file mode 100644
index 0000000000..d2f5385089
--- /dev/null
+++ b/src/components/features/plugins/plugin-detail-modal.tsx
@@ -0,0 +1,150 @@
+import { useTranslation } from "react-i18next";
+import { ModalBackdrop } from "#/components/shared/modals/modal-backdrop";
+import { ModalCloseButton } from "#/components/shared/modals/modal-close-button";
+import { BrandButton } from "#/components/features/settings/brand-button";
+import { SettingsSwitch } from "#/components/features/settings/settings-switch";
+import { I18nKey } from "#/i18n/declaration";
+import { cn } from "#/utils/utils";
+import { modalTitleLgClassName } from "#/utils/modal-classes";
+import { extensionModuleCardPillClassName } from "#/utils/extension-module-card-classes";
+import type { PluginViewModel } from "./build-plugins-view-model";
+
+interface PluginDetailModalProps {
+ plugin: PluginViewModel;
+ isBusy?: boolean;
+ isDisabled?: boolean;
+ onToggle: (enabled: boolean) => void;
+ onInstall: () => void;
+ onUninstall: () => void;
+ onRefresh: () => void;
+ onClose: () => void;
+}
+
+export function PluginDetailModal({
+ plugin,
+ isBusy = false,
+ isDisabled = false,
+ onToggle,
+ onInstall,
+ onUninstall,
+ onRefresh,
+ onClose,
+}: PluginDetailModalProps) {
+ const { t } = useTranslation("openhands");
+ const actionsDisabled = isDisabled || isBusy;
+
+ return (
+ <ModalBackdrop onClose={onClose} aria-label={plugin.name}>
+ <div
+ data-testid="plugin-detail-modal"
+ data-plugin-name={plugin.name}
+ className="relative flex w-[520px] max-w-[90vw] max-h-[85vh] flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary"
+ >
+ <ModalCloseButton
+ onClose={onClose}
+ testId="plugin-detail-modal-close"
+ />
+
+ <header className="flex-shrink-0 px-6 pb-4 pt-6">
+ <h2 className={cn("pr-6", modalTitleLgClassName)}>{plugin.name}</h2>
+ {plugin.source ? (
+ <p className="mt-1 break-all text-xs text-tertiary-alt">
+ {plugin.source}
+ </p>
+ ) : null}
+ </header>
+
+ <div className="flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-6 custom-scrollbar">
+ {plugin.description ? (
+ <p className="text-sm leading-relaxed text-tertiary-light">
+ {plugin.description}
+ </p>
+ ) : null}
+
+ <div className="flex flex-wrap gap-2">
+ {plugin.version ? (
+ <span className={extensionModuleCardPillClassName}>
+ {t(I18nKey.SETTINGS$SKILLS_VERSION, {
+ version: plugin.version,
+ })}
+ </span>
+ ) : null}
+ {plugin.ref ? (
+ <span className={extensionModuleCardPillClassName}>
+ {t(I18nKey.SETTINGS$PLUGINS_REF_LABEL)} {plugin.ref}
+ </span>
+ ) : null}
+ {plugin.repoPath ? (
+ <span className={extensionModuleCardPillClassName}>
+ {t(I18nKey.SETTINGS$PLUGINS_REPO_PATH_LABEL)} {plugin.repoPath}
+ </span>
+ ) : null}
+ </div>
+
+ {plugin.installed ? (
+ <SettingsSwitch
+ testId={`plugin-modal-toggle-${plugin.name}`}
+ isToggled={plugin.enabled}
+ onToggle={onToggle}
+ isDisabled={actionsDisabled}
+ togglePosition="right"
+ >
+ {t(
+ plugin.enabled
+ ? I18nKey.SETTINGS$SKILLS_ENABLED
+ : I18nKey.SETTINGS$SKILLS_DISABLED,
+ )}
+ </SettingsSwitch>
+ ) : null}
+ </div>
+
+ <footer className="flex flex-shrink-0 flex-wrap justify-end gap-2 px-6 pb-6 pt-4">
+ {plugin.installed ? (
+ <>
+ <BrandButton
+ type="button"
+ variant="secondary"
+ testId={`plugin-detail-refresh-${plugin.name}`}
+ isDisabled={actionsDisabled}
+ onClick={onRefresh}
+ >
+ {t(I18nKey.SETTINGS$PLUGINS_REFRESH)}
+ </BrandButton>
+ <BrandButton
+ type="button"
+ variant="secondary"
+ testId={`plugin-detail-uninstall-${plugin.name}`}
+ isDisabled={actionsDisabled}
+ onClick={onUninstall}
+ >
+ {t(I18nKey.SETTINGS$PLUGINS_UNINSTALL)}
+ </BrandButton>
+ </>
+ ) : (
+ <BrandButton
+ type="button"
+ variant="primary"
+ testId={`plugin-detail-install-${plugin.name}`}
+ isDisabled={actionsDisabled}
+ onClick={onInstall}
+ >
+ {t(
+ isBusy
+ ? I18nKey.SETTINGS$PLUGINS_INSTALLING
+ : I18nKey.SETTINGS$PLUGINS_INSTALL,
+ )}
+ </BrandButton>
+ )}
+ <BrandButton
+ type="button"
+ variant="secondary"
+ testId="plugin-detail-modal-dismiss"
+ onClick={onClose}
+ >
+ {t(I18nKey.BUTTON$CLOSE)}
+ </BrandButton>
+ </footer>
+ </div>
+ </ModalBackdrop>
+ );
+}
diff --git a/src/components/features/plugins/plugins-toolbar.tsx b/src/components/features/plugins/plugins-toolbar.tsx
new file mode 100644
index 0000000000..93ed064b4b
--- /dev/null
+++ b/src/components/features/plugins/plugins-toolbar.tsx
@@ -0,0 +1,94 @@
+import { Search, X } from "lucide-react";
+import { useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+import { cn } from "#/utils/utils";
+import type { PluginStatusFilter } from "./build-plugins-view-model";
+
+interface PluginsToolbarProps {
+ search: string;
+ onSearchChange: (value: string) => void;
+ statusFilter: PluginStatusFilter;
+ onStatusFilterChange: (filter: PluginStatusFilter) => void;
+}
+
+const STATUS_FILTERS: ReadonlyArray<{
+ value: PluginStatusFilter;
+ labelKey: I18nKey;
+}> = [
+ { value: "all", labelKey: I18nKey.SETTINGS$PLUGINS_FILTER_ALL },
+ { value: "installed", labelKey: I18nKey.SETTINGS$PLUGINS_FILTER_INSTALLED },
+ { value: "available", labelKey: I18nKey.SETTINGS$PLUGINS_FILTER_AVAILABLE },
+];
+
+export function PluginsToolbar({
+ search,
+ onSearchChange,
+ statusFilter,
+ onStatusFilterChange,
+}: PluginsToolbarProps) {
+ const { t } = useTranslation("openhands");
+
+ return (
+ <div data-testid="plugins-toolbar" className="flex items-stretch gap-2">
+ <div
+ className={cn(
+ "relative flex flex-1 min-w-0 items-center",
+ "rounded-lg border border-[var(--oh-border)] bg-base-secondary",
+ "focus-within:border-white/40 focus-within:ring-1 focus-within:ring-white/20",
+ "transition-colors",
+ )}
+ >
+ <Search
+ className="ml-3 h-4 w-4 shrink-0 text-tertiary-alt"
+ aria-hidden
+ />
+ <input
+ data-testid="plugins-search-input"
+ type="search"
+ value={search}
+ onChange={(e) => onSearchChange(e.target.value)}
+ placeholder={t(I18nKey.SETTINGS$PLUGINS_SEARCH_PLACEHOLDER)}
+ aria-label={t(I18nKey.SETTINGS$PLUGINS_SEARCH_PLACEHOLDER)}
+ className={cn(
+ "flex-1 min-w-0 bg-transparent border-0 outline-none",
+ "px-3 py-2 text-sm placeholder:text-tertiary-alt",
+ "[&::-webkit-search-cancel-button]:hidden",
+ )}
+ />
+ {search ? (
+ <button
+ type="button"
+ onClick={() => onSearchChange("")}
+ aria-label={t(I18nKey.MCP$SEARCH_CLEAR)}
+ className="mr-2 p-1 rounded text-tertiary-alt hover:text-white cursor-pointer"
+ >
+ <X className="h-4 w-4" aria-hidden />
+ </button>
+ ) : null}
+ </div>
+
+ <div
+ data-testid="plugins-status-filter"
+ className="flex shrink-0 items-center gap-1 rounded-lg border border-[var(--oh-border)] bg-base-secondary p-1"
+ >
+ {STATUS_FILTERS.map((filter) => (
+ <button
+ key={filter.value}
+ type="button"
+ data-testid={`plugins-filter-${filter.value}`}
+ aria-pressed={statusFilter === filter.value}
+ onClick={() => onStatusFilterChange(filter.value)}
+ className={cn(
+ "cursor-pointer rounded-md px-3 py-1 text-xs transition-colors",
+ statusFilter === filter.value
+ ? "bg-surface-raised text-white"
+ : "text-tertiary-alt hover:text-white",
+ )}
+ >
+ {t(filter.labelKey)}
+ </button>
+ ))}
+ </div>
+ </div>
+ );
+}
diff --git a/src/hooks/mutation/use-install-plugin.ts b/src/hooks/mutation/use-install-plugin.ts
new file mode 100644
index 0000000000..5fa2f6f0f5
--- /dev/null
+++ b/src/hooks/mutation/use-install-plugin.ts
@@ -0,0 +1,39 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { useTranslation } from "react-i18next";
+import PluginsManagementService, {
+ type InstallPluginRequest,
+} from "#/api/plugins-management-service";
+import { PLUGINS_QUERY_KEYS } from "#/hooks/query/query-keys";
+import { I18nKey } from "#/i18n/declaration";
+import {
+ displayErrorToast,
+ displaySuccessToast,
+} from "#/utils/custom-toast-handlers";
+import { retrieveAxiosErrorMessage } from "#/utils/retrieve-axios-error-message";
+
+/**
+ * Install a plugin from a git source or local path. Installing flips a catalog
+ * entry from available to installed, so both the installed list and the
+ * marketplace catalog are invalidated on success.
+ */
+export function useInstallPlugin() {
+ const queryClient = useQueryClient();
+ const { t } = useTranslation("openhands");
+
+ return useMutation({
+ mutationFn: (request: InstallPluginRequest) =>
+ PluginsManagementService.installPlugin(request),
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: PLUGINS_QUERY_KEYS.installed });
+ queryClient.invalidateQueries({
+ queryKey: PLUGINS_QUERY_KEYS.marketplace,
+ });
+ displaySuccessToast(t(I18nKey.SETTINGS$PLUGINS_INSTALL_SUCCESS));
+ },
+ onError: (error) => {
+ displayErrorToast(
+ retrieveAxiosErrorMessage(error) || t(I18nKey.ERROR$GENERIC),
+ );
+ },
+ });
+}
diff --git a/src/hooks/mutation/use-refresh-plugin.ts b/src/hooks/mutation/use-refresh-plugin.ts
new file mode 100644
index 0000000000..a5d330d974
--- /dev/null
+++ b/src/hooks/mutation/use-refresh-plugin.ts
@@ -0,0 +1,32 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { useTranslation } from "react-i18next";
+import PluginsManagementService from "#/api/plugins-management-service";
+import { PLUGINS_QUERY_KEYS } from "#/hooks/query/query-keys";
+import { I18nKey } from "#/i18n/declaration";
+import {
+ displayErrorToast,
+ displaySuccessToast,
+} from "#/utils/custom-toast-handlers";
+import { retrieveAxiosErrorMessage } from "#/utils/retrieve-axios-error-message";
+
+/**
+ * Update an installed plugin from its source. Version / resolved coordinates may
+ * change, so the installed list is invalidated on success.
+ */
+export function useRefreshPlugin() {
+ const queryClient = useQueryClient();
+ const { t } = useTranslation("openhands");
+
+ return useMutation({
+ mutationFn: (name: string) => PluginsManagementService.refreshPlugin(name),
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: PLUGINS_QUERY_KEYS.installed });
+ displaySuccessToast(t(I18nKey.SETTINGS$PLUGINS_REFRESH_SUCCESS));
+ },
+ onError: (error) => {
+ displayErrorToast(
+ retrieveAxiosErrorMessage(error) || t(I18nKey.ERROR$GENERIC),
+ );
+ },
+ });
+}
diff --git a/src/hooks/mutation/use-set-plugin-enabled.ts b/src/hooks/mutation/use-set-plugin-enabled.ts
new file mode 100644
index 0000000000..ef5b417fdf
--- /dev/null
+++ b/src/hooks/mutation/use-set-plugin-enabled.ts
@@ -0,0 +1,30 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { useTranslation } from "react-i18next";
+import PluginsManagementService from "#/api/plugins-management-service";
+import { PLUGINS_QUERY_KEYS } from "#/hooks/query/query-keys";
+import { I18nKey } from "#/i18n/declaration";
+import { displayErrorToast } from "#/utils/custom-toast-handlers";
+import { retrieveAxiosErrorMessage } from "#/utils/retrieve-axios-error-message";
+
+/**
+ * Enable or disable an installed plugin. Enabled installed plugins auto-load
+ * into new conversations (via the SDK auto-load wiring), so the enabled flag is
+ * the enforced source of truth — invalidate the installed list on success.
+ */
+export function useSetPluginEnabled() {
+ const queryClient = useQueryClient();
+ const { t } = useTranslation("openhands");
+
+ return useMutation({
+ mutationFn: ({ name, enabled }: { name: string; enabled: boolean }) =>
+ PluginsManagementService.setPluginEnabled(name, enabled),
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: PLUGINS_QUERY_KEYS.installed });
+ },
+ onError: (error) => {
+ displayErrorToast(
+ retrieveAxiosErrorMessage(error) || t(I18nKey.ERROR$GENERIC),
+ );
+ },
+ });
+}
diff --git a/src/hooks/mutation/use-uninstall-plugin.ts b/src/hooks/mutation/use-uninstall-plugin.ts
new file mode 100644
index 0000000000..3dbf63051b
--- /dev/null
+++ b/src/hooks/mutation/use-uninstall-plugin.ts
@@ -0,0 +1,36 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { useTranslation } from "react-i18next";
+import PluginsManagementService from "#/api/plugins-management-service";
+import { PLUGINS_QUERY_KEYS } from "#/hooks/query/query-keys";
+import { I18nKey } from "#/i18n/declaration";
+import {
+ displayErrorToast,
+ displaySuccessToast,
+} from "#/utils/custom-toast-handlers";
+import { retrieveAxiosErrorMessage } from "#/utils/retrieve-axios-error-message";
+
+/**
+ * Uninstall a plugin. The plugin returns to "available" in the catalog, so both
+ * the installed list and the marketplace catalog are invalidated on success.
+ */
+export function useUninstallPlugin() {
+ const queryClient = useQueryClient();
+ const { t } = useTranslation("openhands");
+
+ return useMutation({
+ mutationFn: (name: string) =>
+ PluginsManagementService.uninstallPlugin(name),
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: PLUGINS_QUERY_KEYS.installed });
+ queryClient.invalidateQueries({
+ queryKey: PLUGINS_QUERY_KEYS.marketplace,
+ });
+ displaySuccessToast(t(I18nKey.SETTINGS$PLUGINS_UNINSTALL_SUCCESS));
+ },
+ onError: (error) => {
+ displayErrorToast(
+ retrieveAxiosErrorMessage(error) || t(I18nKey.ERROR$GENERIC),
+ );
+ },
+ });
+}
diff --git a/src/hooks/query/query-keys.ts b/src/hooks/query/query-keys.ts
index 23150e9277..fdb9f74c42 100644
--- a/src/hooks/query/query-keys.ts
+++ b/src/hooks/query/query-keys.ts
@@ -30,6 +30,13 @@ export const LOCAL_WORKSPACES_QUERY_KEYS = {
all: ["local-workspaces"] as const,
} as const;
+export const PLUGINS_QUERY_KEYS = {
+ /** Dynamic marketplace catalog (used by `use-plugins-marketplace`). */
+ marketplace: ["plugins-marketplace"] as const,
+ /** Installed plugins from the local agent-server. */
+ installed: ["plugins-installed"] as const,
+} as const;
+
/** Cache configuration shared across all config-related queries */
export const CONFIG_CACHE_OPTIONS = {
staleTime: 1000 * 60 * 5, // 5 minutes
diff --git a/src/hooks/query/use-plugins.ts b/src/hooks/query/use-plugins.ts
new file mode 100644
index 0000000000..ad1edb7388
--- /dev/null
+++ b/src/hooks/query/use-plugins.ts
@@ -0,0 +1,17 @@
+import { useQuery } from "@tanstack/react-query";
+import PluginsManagementService, {
+ type InstalledPluginInfo,
+} from "#/api/plugins-management-service";
+import { PLUGINS_QUERY_KEYS } from "./query-keys";
+
+/**
+ * Query hook for the plugins installed on the local agent-server. Local-backend
+ * only — a cloud backend yields an empty list. Mirrors `useSkills`.
+ */
+export const usePlugins = () =>
+ useQuery<InstalledPluginInfo[]>({
+ queryKey: PLUGINS_QUERY_KEYS.installed,
+ queryFn: () => PluginsManagementService.listInstalledPlugins(),
+ staleTime: 1000 * 60 * 10, // 10 minutes
+ refetchOnWindowFocus: false,
+ });
diff --git a/src/i18n/translation.json b/src/i18n/translation.json
index a16cb918df..f2d97ab069 100644
--- a/src/i18n/translation.json
+++ b/src/i18n/translation.json
@@ -30157,6 +30157,363 @@
"uk": "Параметри конфігурації плагінів з'являться тут.",
"ca": "Les opcions de configuració dels connectors apareixeran aquí."
},
+ "SETTINGS$PLUGINS_PAGE_DESCRIPTION": {
+ "en": "Browse, install, enable, and uninstall plugins. Enabled plugins load automatically into new conversations.",
+ "ja": "プラグインの参照、インストール、有効化、アンインストールができます。有効なプラグインは新しい会話に自動的に読み込まれます。",
+ "zh-CN": "浏览、安装、启用和卸载插件。启用的插件会自动加载到新会话中。",
+ "zh-TW": "瀏覽、安裝、啟用和解除安裝外掛程式。已啟用的外掛程式會自動載入到新交談中。",
+ "ko-KR": "플러그인을 찾아보고 설치, 활성화, 제거할 수 있습니다. 활성화된 플러그인은 새 대화에 자동으로 로드됩니다.",
+ "no": "Bla gjennom, installer, aktiver og avinstaller plugins. Aktiverte plugins lastes automatisk inn i nye samtaler.",
+ "ar": "تصفّح الإضافات وثبّتها وفعّلها وأزل تثبيتها. تُحمّل الإضافات المفعّلة تلقائيًا في المحادثات الجديدة.",
+ "de": "Plugins durchsuchen, installieren, aktivieren und deinstallieren. Aktivierte Plugins werden automatisch in neue Unterhaltungen geladen.",
+ "fr": "Parcourez, installez, activez et désinstallez des plugins. Les plugins activés se chargent automatiquement dans les nouvelles conversations.",
+ "it": "Sfoglia, installa, abilita e disinstalla i plugin. I plugin abilitati vengono caricati automaticamente nelle nuove conversazioni.",
+ "pt": "Navegue, instale, ative e desinstale plugins. Os plugins ativados são carregados automaticamente em novas conversas.",
+ "es": "Explora, instala, activa y desinstala complementos. Los complementos activados se cargan automáticamente en las conversaciones nuevas.",
+ "ca": "Explora, instal·la, activa i desinstal·la connectors. Els connectors activats es carreguen automàticament a les converses noves.",
+ "tr": "Eklentileri görüntüleyin, kurun, etkinleştirin ve kaldırın. Etkin eklentiler yeni konuşmalara otomatik olarak yüklenir.",
+ "uk": "Переглядайте, встановлюйте, вмикайте та видаляйте плагіни. Увімкнені плагіни автоматично завантажуються в нові розмови."
+ },
+ "SETTINGS$PLUGINS_ADD_BUTTON": {
+ "en": "Add plugin",
+ "ja": "プラグインを追加",
+ "zh-CN": "添加插件",
+ "zh-TW": "新增外掛程式",
+ "ko-KR": "플러그인 추가",
+ "no": "Legg til plugin",
+ "ar": "إضافة مُلحَق",
+ "de": "Plugin hinzufügen",
+ "fr": "Ajouter un plugin",
+ "it": "Aggiungi plugin",
+ "pt": "Adicionar plugin",
+ "es": "Agregar complemento",
+ "ca": "Afegeix un connector",
+ "tr": "Eklenti ekle",
+ "uk": "Додати плагін"
+ },
+ "SETTINGS$PLUGINS_SEARCH_PLACEHOLDER": {
+ "en": "Search plugins by name, description, or source",
+ "ja": "名前、説明、ソースでプラグインを検索",
+ "zh-CN": "按名称、描述或来源搜索插件",
+ "zh-TW": "依名稱、描述或來源搜尋外掛程式",
+ "ko-KR": "이름, 설명 또는 소스로 플러그인 검색",
+ "no": "Søk etter plugins etter navn, beskrivelse eller kilde",
+ "ar": "ابحث في الإضافات بالاسم أو الوصف أو المصدر",
+ "de": "Plugins nach Name, Beschreibung oder Quelle suchen",
+ "fr": "Rechercher des plugins par nom, description ou source",
+ "it": "Cerca plugin per nome, descrizione o sorgente",
+ "pt": "Pesquisar plugins por nome, descrição ou origem",
+ "es": "Buscar complementos por nombre, descripción u origen",
+ "ca": "Cerca connectors per nom, descripció o origen",
+ "tr": "Eklentileri ada, açıklamaya veya kaynağa göre arayın",
+ "uk": "Шукати плагіни за назвою, описом або джерелом"
+ },
+ "SETTINGS$PLUGINS_NO_PLUGINS": {
+ "en": "No plugins found.",
+ "ja": "プラグインが見つかりません。",
+ "zh-CN": "未找到插件。",
+ "zh-TW": "找不到外掛程式。",
+ "ko-KR": "플러그인을 찾을 수 없습니다.",
+ "no": "Ingen plugins funnet.",
+ "ar": "لم يتم العثور على إضافات.",
+ "de": "Keine Plugins gefunden.",
+ "fr": "Aucun plugin trouvé.",
+ "it": "Nessun plugin trovato.",
+ "pt": "Nenhum plugin encontrado.",
+ "es": "No se encontraron complementos.",
+ "ca": "No s'ha trobat cap connector.",
+ "tr": "Eklenti bulunamadı.",
+ "uk": "Плагінів не знайдено."
+ },
+ "SETTINGS$PLUGINS_NO_MATCH": {
+ "en": "No plugins match your search.",
+ "ja": "検索に一致するプラグインがありません。",
+ "zh-CN": "没有匹配您搜索的插件。",
+ "zh-TW": "沒有符合搜尋的外掛程式。",
+ "ko-KR": "검색과 일치하는 플러그인이 없습니다.",
+ "no": "Ingen plugins samsvarer med søket ditt.",
+ "ar": "لا توجد إضافات تطابق بحثك.",
+ "de": "Keine Plugins stimmen mit Ihrer Suche überein.",
+ "fr": "Aucun plugin ne correspond à votre recherche.",
+ "it": "Nessun plugin corrisponde alla tua ricerca.",
+ "pt": "Nenhum plugin corresponde à sua pesquisa.",
+ "es": "Ningún complemento coincide con tu búsqueda.",
+ "ca": "Cap connector coincideix amb la cerca.",
+ "tr": "Aramanızla eşleşen eklenti yok.",
+ "uk": "Жоден плагін не відповідає вашому пошуку."
+ },
+ "SETTINGS$PLUGINS_INSTALL": {
+ "en": "Install",
+ "ja": "インストール",
+ "zh-CN": "安装",
+ "zh-TW": "安裝",
+ "ko-KR": "설치",
+ "no": "Installer",
+ "ar": "تثبيت",
+ "de": "Installieren",
+ "fr": "Installer",
+ "it": "Installa",
+ "pt": "Instalar",
+ "es": "Instalar",
+ "ca": "Instal·la",
+ "tr": "Kur",
+ "uk": "Встановити"
+ },
+ "SETTINGS$PLUGINS_INSTALLING": {
+ "en": "Installing…",
+ "ja": "インストール中…",
+ "zh-CN": "正在安装…",
+ "zh-TW": "正在安裝…",
+ "ko-KR": "설치 중…",
+ "no": "Installerer…",
+ "ar": "جارٍ التثبيت…",
+ "de": "Wird installiert…",
+ "fr": "Installation…",
+ "it": "Installazione…",
+ "pt": "Instalando…",
+ "es": "Instalando…",
+ "ca": "S'està instal·lant…",
+ "tr": "Kuruluyor…",
+ "uk": "Встановлення…"
+ },
+ "SETTINGS$PLUGINS_UNINSTALL": {
+ "en": "Uninstall",
+ "ja": "アンインストール",
+ "zh-CN": "卸载",
+ "zh-TW": "解除安裝",
+ "ko-KR": "제거",
+ "no": "Avinstaller",
+ "ar": "إزالة التثبيت",
+ "de": "Deinstallieren",
+ "fr": "Désinstaller",
+ "it": "Disinstalla",
+ "pt": "Desinstalar",
+ "es": "Desinstalar",
+ "ca": "Desinstal·la",
+ "tr": "Kaldır",
+ "uk": "Видалити"
+ },
+ "SETTINGS$PLUGINS_REFRESH": {
+ "en": "Update",
+ "ja": "更新",
+ "zh-CN": "更新",
+ "zh-TW": "更新",
+ "ko-KR": "업데이트",
+ "no": "Oppdater",
+ "ar": "تحديث",
+ "de": "Aktualisieren",
+ "fr": "Mettre à jour",
+ "it": "Aggiorna",
+ "pt": "Atualizar",
+ "es": "Actualizar",
+ "ca": "Actualitza",
+ "tr": "Güncelle",
+ "uk": "Оновити"
+ },
+ "SETTINGS$PLUGINS_FILTER_ALL": {
+ "en": "All",
+ "ja": "すべて",
+ "zh-CN": "全部",
+ "zh-TW": "全部",
+ "ko-KR": "전체",
+ "no": "Alle",
+ "ar": "الكل",
+ "de": "Alle",
+ "fr": "Tout",
+ "it": "Tutti",
+ "pt": "Todos",
+ "es": "Todos",
+ "ca": "Tot",
+ "tr": "Tümü",
+ "uk": "Усі"
+ },
+ "SETTINGS$PLUGINS_FILTER_INSTALLED": {
+ "en": "Installed",
+ "ja": "インストール済み",
+ "zh-CN": "已安装",
+ "zh-TW": "已安裝",
+ "ko-KR": "설치됨",
+ "no": "Installert",
+ "ar": "مثبّت",
+ "de": "Installiert",
+ "fr": "Installés",
+ "it": "Installati",
+ "pt": "Instalados",
+ "es": "Instalados",
+ "ca": "Instal·lats",
+ "tr": "Kurulu",
+ "uk": "Встановлені"
+ },
+ "SETTINGS$PLUGINS_FILTER_AVAILABLE": {
+ "en": "Available",
+ "ja": "利用可能",
+ "zh-CN": "可用",
+ "zh-TW": "可用",
+ "ko-KR": "사용 가능",
+ "no": "Tilgjengelig",
+ "ar": "متاح",
+ "de": "Verfügbar",
+ "fr": "Disponibles",
+ "it": "Disponibili",
+ "pt": "Disponíveis",
+ "es": "Disponibles",
+ "ca": "Disponibles",
+ "tr": "Mevcut",
+ "uk": "Доступні"
+ },
+ "SETTINGS$PLUGINS_REF_LABEL": {
+ "en": "Ref",
+ "ja": "リファレンス",
+ "zh-CN": "引用",
+ "zh-TW": "參考",
+ "ko-KR": "참조",
+ "no": "Ref",
+ "ar": "المرجع",
+ "de": "Ref",
+ "fr": "Réf",
+ "it": "Rif",
+ "pt": "Ref",
+ "es": "Ref",
+ "ca": "Ref",
+ "tr": "Referans",
+ "uk": "Посилання"
+ },
+ "SETTINGS$PLUGINS_REPO_PATH_LABEL": {
+ "en": "Path",
+ "ja": "パス",
+ "zh-CN": "路径",
+ "zh-TW": "路徑",
+ "ko-KR": "경로",
+ "no": "Sti",
+ "ar": "المسار",
+ "de": "Pfad",
+ "fr": "Chemin",
+ "it": "Percorso",
+ "pt": "Caminho",
+ "es": "Ruta",
+ "ca": "Camí",
+ "tr": "Yol",
+ "uk": "Шлях"
+ },
+ "SETTINGS$PLUGINS_ADD_MODAL_TITLE": {
+ "en": "Add a plugin",
+ "ja": "プラグインを追加",
+ "zh-CN": "添加插件",
+ "zh-TW": "新增外掛程式",
+ "ko-KR": "플러그인 추가",
+ "no": "Legg til en plugin",
+ "ar": "إضافة مُلحَق",
+ "de": "Plugin hinzufügen",
+ "fr": "Ajouter un plugin",
+ "it": "Aggiungi un plugin",
+ "pt": "Adicionar um plugin",
+ "es": "Agregar un complemento",
+ "ca": "Afegeix un connector",
+ "tr": "Eklenti ekle",
+ "uk": "Додати плагін"
+ },
+ "SETTINGS$PLUGINS_ADD_MODAL_INTRO": {
+ "en": "Install a plugin from a Git source or local path.",
+ "ja": "Git ソースまたはローカルパスからプラグインをインストールします。",
+ "zh-CN": "从 Git 来源或本地路径安装插件。",
+ "zh-TW": "從 Git 來源或本機路徑安裝外掛程式。",
+ "ko-KR": "Git 소스 또는 로컬 경로에서 플러그인을 설치합니다.",
+ "no": "Installer en plugin fra en Git-kilde eller lokal sti.",
+ "ar": "ثبّت إضافة من مصدر Git أو مسار محلي.",
+ "de": "Installieren Sie ein Plugin aus einer Git-Quelle oder einem lokalen Pfad.",
+ "fr": "Installez un plugin depuis une source Git ou un chemin local.",
+ "it": "Installa un plugin da una sorgente Git o un percorso locale.",
+ "pt": "Instale um plugin a partir de uma origem Git ou caminho local.",
+ "es": "Instala un complemento desde una fuente Git o una ruta local.",
+ "ca": "Instal·la un connector des d'una font Git o un camí local.",
+ "tr": "Bir Git kaynağından veya yerel yoldan eklenti kurun.",
+ "uk": "Встановіть плагін із джерела Git або локального шляху."
+ },
+ "SETTINGS$PLUGINS_SOURCE_LABEL": {
+ "en": "Source",
+ "ja": "ソース",
+ "zh-CN": "来源",
+ "zh-TW": "來源",
+ "ko-KR": "소스",
+ "no": "Kilde",
+ "ar": "المصدر",
+ "de": "Quelle",
+ "fr": "Source",
+ "it": "Sorgente",
+ "pt": "Origem",
+ "es": "Origen",
+ "ca": "Origen",
+ "tr": "Kaynak",
+ "uk": "Джерело"
+ },
+ "SETTINGS$PLUGINS_SOURCE_PLACEHOLDER": {
+ "en": "github:owner/repo, a Git URL, or a local path",
+ "ja": "github:owner/repo、Git URL、またはローカルパス",
+ "zh-CN": "github:owner/repo、Git URL 或本地路径",
+ "zh-TW": "github:owner/repo、Git URL 或本機路徑",
+ "ko-KR": "github:owner/repo, Git URL 또는 로컬 경로",
+ "no": "github:owner/repo, en Git-URL eller en lokal sti",
+ "ar": "github:owner/repo أو عنوان Git أو مسار محلي",
+ "de": "github:owner/repo, eine Git-URL oder ein lokaler Pfad",
+ "fr": "github:owner/repo, une URL Git ou un chemin local",
+ "it": "github:owner/repo, un URL Git o un percorso locale",
+ "pt": "github:owner/repo, uma URL Git ou um caminho local",
+ "es": "github:owner/repo, una URL de Git o una ruta local",
+ "ca": "github:owner/repo, un URL de Git o un camí local",
+ "tr": "github:owner/repo, bir Git URL'si veya yerel yol",
+ "uk": "github:owner/repo, URL-адреса Git або локальний шлях"
+ },
+ "SETTINGS$PLUGINS_INSTALL_SUCCESS": {
+ "en": "Plugin installed.",
+ "ja": "プラグインをインストールしました。",
+ "zh-CN": "插件已安装。",
+ "zh-TW": "外掛程式已安裝。",
+ "ko-KR": "플러그인이 설치되었습니다.",
+ "no": "Plugin installert.",
+ "ar": "تم تثبيت الإضافة.",
+ "de": "Plugin installiert.",
+ "fr": "Plugin installé.",
+ "it": "Plugin installato.",
+ "pt": "Plugin instalado.",
+ "es": "Complemento instalado.",
+ "ca": "Connector instal·lat.",
+ "tr": "Eklenti kuruldu.",
+ "uk": "Плагін встановлено."
+ },
+ "SETTINGS$PLUGINS_UNINSTALL_SUCCESS": {
+ "en": "Plugin uninstalled.",
+ "ja": "プラグインをアンインストールしました。",
+ "zh-CN": "插件已卸载。",
+ "zh-TW": "外掛程式已解除安裝。",
+ "ko-KR": "플러그인이 제거되었습니다.",
+ "no": "Plugin avinstallert.",
+ "ar": "تمت إزالة تثبيت الإضافة.",
+ "de": "Plugin deinstalliert.",
+ "fr": "Plugin désinstallé.",
+ "it": "Plugin disinstallato.",
+ "pt": "Plugin desinstalado.",
+ "es": "Complemento desinstalado.",
+ "ca": "Connector desinstal·lat.",
+ "tr": "Eklenti kaldırıldı.",
+ "uk": "Плагін видалено."
+ },
+ "SETTINGS$PLUGINS_REFRESH_SUCCESS": {
+ "en": "Plugin updated.",
+ "ja": "プラグインを更新しました。",
+ "zh-CN": "插件已更新。",
+ "zh-TW": "外掛程式已更新。",
+ "ko-KR": "플러그인이 업데이트되었습니다.",
+ "no": "Plugin oppdatert.",
+ "ar": "تم تحديث الإضافة.",
+ "de": "Plugin aktualisiert.",
+ "fr": "Plugin mis à jour.",
+ "it": "Plugin aggiornato.",
+ "pt": "Plugin atualizado.",
+ "es": "Complemento actualizado.",
+ "ca": "Connector actualitzat.",
+ "tr": "Eklenti güncellendi.",
+ "uk": "Плагін оновлено."
+ },
"SETTINGS$SKILLS_PAGE_DESCRIPTION": {
"en": "Discover skills to add to your workspace. Open a card for prompts, curl, and install flows. Search from the sidebar to filter the list. Enable or disable default skills. Disabled skills will not be loaded into agent context.",
"ja": "ワークスペースに追加するスキルを見つけましょう。カードを開いて、プロンプト、curl、インストール手順を確認できます。サイドバーから検索してリストを絞り込めます。デフォルトスキルの有効化・無効化が可能です。無効化されたスキルはエージェントコンテキストに読み込まれません。",
diff --git a/src/routes/skills-plugins.tsx b/src/routes/skills-plugins.tsx
index 158b17fc07..5f5a950f75 100644
--- a/src/routes/skills-plugins.tsx
+++ b/src/routes/skills-plugins.tsx
@@ -1,10 +1,110 @@
+import React from "react";
import { useTranslation } from "react-i18next";
import { ExtensionsNavigation } from "#/components/features/skills/extensions-navigation";
+import { PluginCard } from "#/components/features/plugins/plugin-card";
+import { PluginsToolbar } from "#/components/features/plugins/plugins-toolbar";
+import { PluginDetailModal } from "#/components/features/plugins/plugin-detail-modal";
+import { AddPluginModal } from "#/components/features/plugins/add-plugin-modal";
+import { BrandButton } from "#/components/features/settings/brand-button";
+import {
+ buildPluginsViewModel,
+ matchesPluginSearch,
+ matchesPluginStatus,
+ type PluginStatusFilter,
+ type PluginViewModel,
+} from "#/components/features/plugins/build-plugins-view-model";
+import { usePluginsMarketplace } from "#/hooks/query/use-plugins-marketplace";
+import { usePlugins } from "#/hooks/query/use-plugins";
+import { useInstallPlugin } from "#/hooks/mutation/use-install-plugin";
+import { useSetPluginEnabled } from "#/hooks/mutation/use-set-plugin-enabled";
+import { useUninstallPlugin } from "#/hooks/mutation/use-uninstall-plugin";
+import { useRefreshPlugin } from "#/hooks/mutation/use-refresh-plugin";
+import { useActiveBackend } from "#/contexts/active-backend-context";
import { I18nKey } from "#/i18n/declaration";
+import { cn } from "#/utils/utils";
import { settingsLikeMainScrollClassName } from "#/utils/settings-like-page-layout-classes";
+import {
+ extensionModuleCardGridClassName,
+ extensionModuleCardGridContainerClassName,
+ extensionModuleEmptyStateClassName,
+} from "#/utils/extension-module-card-classes";
export default function SkillsPluginsScreen() {
const { t } = useTranslation("openhands");
+ const { backend } = useActiveBackend();
+ const isLocal = backend.kind === "local";
+
+ const { data: marketplace, isLoading: marketplaceLoading } =
+ usePluginsMarketplace();
+ const { data: installed, isLoading: installedLoading } = usePlugins();
+
+ const installPlugin = useInstallPlugin();
+ const setPluginEnabled = useSetPluginEnabled();
+ const uninstallPlugin = useUninstallPlugin();
+ const refreshPlugin = useRefreshPlugin();
+
+ const [searchQuery, setSearchQuery] = React.useState("");
+ const [statusFilter, setStatusFilter] =
+ React.useState<PluginStatusFilter>("all");
+ const [selectedName, setSelectedName] = React.useState<string | null>(null);
+ const [showAddModal, setShowAddModal] = React.useState(false);
+
+ const plugins = React.useMemo(
+ () => buildPluginsViewModel(marketplace, installed),
+ [marketplace, installed],
+ );
+
+ const filteredPlugins = React.useMemo(
+ () =>
+ plugins.filter(
+ (plugin) =>
+ matchesPluginStatus(plugin, statusFilter) &&
+ matchesPluginSearch(plugin, searchQuery),
+ ),
+ [plugins, statusFilter, searchQuery],
+ );
+
+ const selectedPlugin = selectedName
+ ? (plugins.find((plugin) => plugin.name === selectedName) ?? null)
+ : null;
+
+ const isLoading = marketplaceLoading || installedLoading;
+
+ const pendingName =
+ (setPluginEnabled.isPending
+ ? setPluginEnabled.variables?.name
+ : undefined) ??
+ (uninstallPlugin.isPending ? uninstallPlugin.variables : undefined) ??
+ (refreshPlugin.isPending ? refreshPlugin.variables : undefined) ??
+ null;
+
+ const isPluginBusy = (plugin: PluginViewModel): boolean =>
+ pendingName === plugin.name ||
+ (installPlugin.isPending &&
+ installPlugin.variables?.source === plugin.source);
+
+ const handleInstall = (plugin: PluginViewModel) => {
+ if (!plugin.source) return;
+ installPlugin.mutate({
+ source: plugin.source,
+ ref: plugin.ref,
+ repo_path: plugin.repoPath,
+ });
+ };
+
+ const handleToggle = (plugin: PluginViewModel, enabled: boolean) => {
+ setPluginEnabled.mutate({ name: plugin.name, enabled });
+ };
+
+ const handleUninstall = (plugin: PluginViewModel) => {
+ uninstallPlugin.mutate(plugin.name, {
+ onSuccess: () => setSelectedName(null),
+ });
+ };
+
+ const handleRefresh = (plugin: PluginViewModel) => {
+ refreshPlugin.mutate(plugin.name);
+ };
return (
<div
@@ -12,16 +112,112 @@ export default function SkillsPluginsScreen() {
className="flex h-full gap-4 md:gap-6 md:pl-8 lg:gap-10 lg:pl-10"
>
<ExtensionsNavigation />
- <main className={settingsLikeMainScrollClassName}>
- <div className="mx-auto w-full min-w-0 max-w-[800px]">
- <div className="mb-4 min-w-0 space-y-1">
- <h2 className="text-xl font-medium leading-6 text-foreground">
- {t(I18nKey.SETTINGS$PLUGINS_TITLE)}
- </h2>
- <div className="max-w-2xl text-sm text-tertiary-light">
- {t(I18nKey.SETTINGS$PLUGINS_DESCRIPTION)}
+ <main className={cn(settingsLikeMainScrollClassName, "h-full")}>
+ <div className="mx-auto flex w-full min-w-0 max-w-[800px] flex-col gap-6">
+ <div className="flex min-w-0 items-start justify-between gap-4">
+ <div className="min-w-0 space-y-1">
+ <h2 className="text-xl font-semibold leading-6 text-foreground">
+ {t(I18nKey.SETTINGS$PLUGINS_TITLE)}
+ </h2>
+ <div
+ data-testid="plugins-settings-description"
+ className="max-w-2xl text-sm text-tertiary-light"
+ >
+ {t(I18nKey.SETTINGS$PLUGINS_PAGE_DESCRIPTION)}
+ </div>
</div>
+ <BrandButton
+ type="button"
+ variant="secondary"
+ testId="plugins-add-plugin-button"
+ isDisabled={!isLocal}
+ className="flex-shrink-0 whitespace-nowrap"
+ onClick={() => setShowAddModal(true)}
+ >
+ {t(I18nKey.SETTINGS$PLUGINS_ADD_BUTTON)}
+ </BrandButton>
</div>
+
+ {isLoading && (
+ <div className="flex flex-col gap-4">
+ {[1, 2, 3].map((i) => (
+ <div
+ key={i}
+ className="h-24 rounded-2xl bg-tertiary animate-pulse"
+ />
+ ))}
+ </div>
+ )}
+
+ {!isLoading && plugins.length === 0 && (
+ <div
+ data-testid="plugins-empty"
+ className={extensionModuleEmptyStateClassName}
+ >
+ <p className="text-sm text-tertiary-light">
+ {t(I18nKey.SETTINGS$PLUGINS_NO_PLUGINS)}
+ </p>
+ </div>
+ )}
+
+ {!isLoading && plugins.length > 0 && (
+ <>
+ <PluginsToolbar
+ search={searchQuery}
+ onSearchChange={setSearchQuery}
+ statusFilter={statusFilter}
+ onStatusFilterChange={setStatusFilter}
+ />
+ {filteredPlugins.length === 0 ? (
+ <div
+ data-testid="plugins-no-match"
+ className={extensionModuleEmptyStateClassName}
+ >
+ <p className="text-sm text-tertiary-light">
+ {t(I18nKey.SETTINGS$PLUGINS_NO_MATCH)}
+ </p>
+ </div>
+ ) : (
+ <section
+ className={cn(
+ "flex min-w-0 flex-col gap-3",
+ extensionModuleCardGridContainerClassName,
+ )}
+ >
+ <div className={extensionModuleCardGridClassName}>
+ {filteredPlugins.map((plugin) => (
+ <PluginCard
+ key={plugin.name}
+ plugin={plugin}
+ isBusy={isPluginBusy(plugin)}
+ isDisabled={!isLocal}
+ onOpen={() => setSelectedName(plugin.name)}
+ onInstall={() => handleInstall(plugin)}
+ onToggle={(enabled) => handleToggle(plugin, enabled)}
+ />
+ ))}
+ </div>
+ </section>
+ )}
+ </>
+ )}
+
+ {selectedPlugin && (
+ <PluginDetailModal
+ plugin={selectedPlugin}
+ isBusy={isPluginBusy(selectedPlugin)}
+ isDisabled={!isLocal}
+ onToggle={(enabled) => handleToggle(selectedPlugin, enabled)}
+ onInstall={() => handleInstall(selectedPlugin)}
+ onUninstall={() => handleUninstall(selectedPlugin)}
+ onRefresh={() => handleRefresh(selectedPlugin)}
+ onClose={() => setSelectedName(null)}
+ />
+ )}
+
+ {showAddModal && (
+ <AddPluginModal onClose={() => setShowAddModal(false)} />
+ )}
</div>
</main>
</div>