Skip to content

🙌 OpenHands: AI-Driven Development

feat: add plugin picker to the new-conversation flow (#1482)

Hiep Lea8d29bced86e
diff --git a/__tests__/components/features/home/home-chat-launcher.test.tsx b/__tests__/components/features/home/home-chat-launcher.test.tsx
index c1230e4d05..2be5855942 100644
--- a/__tests__/components/features/home/home-chat-launcher.test.tsx
+++ b/__tests__/components/features/home/home-chat-launcher.test.tsx
@@ -198,6 +198,30 @@ vi.mock("#/components/features/home/home-git-control-bar-preview", () => ({
),
}));
+// Stub the picker modal: pressing it selects one plugin then closes, mirroring
+// the real modal's `onChange` + `onClose` contract. The picker catalog itself
+// is covered by plugin-picker.test.tsx.
+vi.mock("#/components/features/plugins/plugin-picker-modal", () => ({
+ PluginPickerModal: ({
+ onChange,
+ onClose,
+ }: {
+ onChange: (next: { source: string; ref: null; repo_path: null }[]) => void;
+ onClose: () => void;
+ }) => (
+ <button
+ type="button"
+ data-testid="stub-plugin-pick"
+ onClick={() => {
+ onChange([{ source: "github:o/a", ref: null, repo_path: null }]);
+ onClose();
+ }}
+ >
+ pick
+ </button>
+ ),
+}));
+
const renderLauncher = () =>
render(<HomeChatLauncher />, {
wrapper: ({ children }) => (
@@ -571,4 +595,29 @@ describe("HomeChatLauncher", () => {
),
);
});
+
+ it("attaches the picked plugins to the created conversation", async () => {
+ const createSpy = vi
+ .spyOn(AgentServerConversationService, "createConversation")
+ .mockResolvedValue(makeConversationResponse());
+
+ renderLauncher();
+ const user = userEvent.setup();
+
+ await user.click(screen.getByTestId("open-plugin-picker"));
+ await user.click(await screen.findByTestId("stub-plugin-pick"));
+ await user.click(screen.getByTestId("stub-chat-submit"));
+
+ await waitFor(() => expect(createSpy).toHaveBeenCalledTimes(1));
+ expect(createSpy).toHaveBeenCalledWith(
+ "hello world",
+ undefined,
+ [{ source: "github:o/a", ref: null, repo_path: null }],
+ null,
+ undefined,
+ undefined,
+ undefined,
+ undefined,
+ );
+ });
});
diff --git a/__tests__/components/features/plugins/plugin-picker.test.tsx b/__tests__/components/features/plugins/plugin-picker.test.tsx
new file mode 100644
index 0000000000..e29f39cb11
--- /dev/null
+++ b/__tests__/components/features/plugins/plugin-picker.test.tsx
@@ -0,0 +1,129 @@
+import { screen } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { renderWithProviders } from "test-utils";
+import PluginsService, { type MarketplacePlugin } from "#/api/plugins-service";
+import type { PluginSpec } from "#/api/conversation-service/agent-server-conversation-service.types";
+import { PluginPicker } from "#/components/features/plugins/plugin-picker";
+
+// The catalog hook's service constructs a typescript-client `PluginsClient` at
+// module load; stub it so importing the service never touches the real client.
+// Every test replaces `getPluginsMarketplace` itself, so the client is unused.
+vi.mock("@openhands/typescript-client/clients", () => ({
+ PluginsClient: vi.fn(),
+}));
+
+const alpha: MarketplacePlugin = {
+ name: "alpha",
+ description: "first plugin",
+ source: "github:o/a",
+ ref: null,
+ repo_path: "plugins/alpha",
+ installed: false,
+};
+const beta: MarketplacePlugin = {
+ name: "beta",
+ description: "second plugin",
+ source: "github:o/b",
+ ref: null,
+ repo_path: null,
+ installed: true,
+};
+const alphaSpec: PluginSpec = {
+ source: "github:o/a",
+ ref: null,
+ repo_path: "plugins/alpha",
+};
+
+function renderPicker(selected: PluginSpec[] = []) {
+ const onChange = vi.fn();
+ renderWithProviders(<PluginPicker selected={selected} onChange={onChange} />);
+ return { onChange };
+}
+
+describe("PluginPicker", () => {
+ beforeEach(() => {
+ vi.restoreAllMocks();
+ });
+
+ it("renders a selectable card for each catalog plugin", async () => {
+ vi.spyOn(PluginsService, "getPluginsMarketplace").mockResolvedValue([
+ alpha,
+ beta,
+ ]);
+
+ renderPicker();
+
+ expect(
+ await screen.findByTestId("plugin-picker-card-alpha"),
+ ).toBeInTheDocument();
+ expect(screen.getByTestId("plugin-picker-card-beta")).toBeInTheDocument();
+ });
+
+ it("reports the mapped PluginSpec when an unselected plugin is toggled on", async () => {
+ vi.spyOn(PluginsService, "getPluginsMarketplace").mockResolvedValue([
+ alpha,
+ ]);
+ const { onChange } = renderPicker([]);
+
+ await userEvent.click(
+ await screen.findByTestId("plugin-picker-toggle-alpha"),
+ );
+
+ expect(onChange).toHaveBeenCalledWith([alphaSpec]);
+ });
+
+ it("removes a plugin from the selection when toggled off", async () => {
+ vi.spyOn(PluginsService, "getPluginsMarketplace").mockResolvedValue([
+ alpha,
+ ]);
+ const { onChange } = renderPicker([alphaSpec]);
+
+ await userEvent.click(
+ await screen.findByTestId("plugin-picker-toggle-alpha"),
+ );
+
+ expect(onChange).toHaveBeenCalledWith([]);
+ });
+
+ it("shows the empty state when the catalog is empty", async () => {
+ vi.spyOn(PluginsService, "getPluginsMarketplace").mockResolvedValue([]);
+
+ renderPicker();
+
+ expect(
+ await screen.findByTestId("plugin-picker-empty"),
+ ).toBeInTheDocument();
+ });
+
+ it("shows the error state when the catalog fails to load", async () => {
+ vi.spyOn(PluginsService, "getPluginsMarketplace").mockRejectedValue(
+ new Error("unreachable"),
+ );
+
+ renderPicker();
+
+ expect(
+ await screen.findByTestId("plugin-picker-error"),
+ ).toBeInTheDocument();
+ });
+
+ it("filters the catalog by the search query", async () => {
+ vi.spyOn(PluginsService, "getPluginsMarketplace").mockResolvedValue([
+ alpha,
+ beta,
+ ]);
+
+ renderPicker();
+ await screen.findByTestId("plugin-picker-card-alpha");
+ await userEvent.type(
+ screen.getByTestId("plugin-picker-search-input"),
+ "alpha",
+ );
+
+ expect(screen.getByTestId("plugin-picker-card-alpha")).toBeInTheDocument();
+ expect(
+ screen.queryByTestId("plugin-picker-card-beta"),
+ ).not.toBeInTheDocument();
+ });
+});
diff --git a/__tests__/components/features/plugins/plugin-spec-identity.test.ts b/__tests__/components/features/plugins/plugin-spec-identity.test.ts
new file mode 100644
index 0000000000..9a9df00fc7
--- /dev/null
+++ b/__tests__/components/features/plugins/plugin-spec-identity.test.ts
@@ -0,0 +1,87 @@
+import { describe, expect, it } from "vitest";
+import type { MarketplacePlugin } from "#/api/plugins-service";
+import {
+ isPluginSelected,
+ marketplacePluginToSpec,
+ matchesPluginPickerSearch,
+ pluginSpecKey,
+ togglePluginSelection,
+} from "#/components/features/plugins/plugin-spec-identity";
+
+const catalogPlugin: MarketplacePlugin = {
+ name: "city-weather",
+ description: "Weather plugin",
+ source: "github:OpenHands/extensions",
+ ref: null,
+ repo_path: "plugins/city-weather",
+ installed: false,
+};
+
+describe("plugin-spec-identity", () => {
+ it("maps a catalog entry to attachable coordinates and drops parameters", () => {
+ // Arrange: a catalog entry that also carries non-coordinate fields.
+ // Act
+ const spec = marketplacePluginToSpec(catalogPlugin);
+
+ // Assert: only source/ref/repo_path survive — no name/description/parameters.
+ expect(spec).toEqual({
+ source: "github:OpenHands/extensions",
+ ref: null,
+ repo_path: "plugins/city-weather",
+ });
+ });
+
+ it("treats missing and explicit-null coordinates as the same identity", () => {
+ // Arrange / Act / Assert: an undefined ref and a null ref hash equally,
+ // so a catalog entry matches a stored spec regardless of which it used.
+ expect(pluginSpecKey({ source: "github:o/a" })).toBe(
+ pluginSpecKey({ source: "github:o/a", ref: null, repo_path: null }),
+ );
+ });
+
+ it("adds an unselected plugin to the selection", () => {
+ // Arrange
+ const selected = togglePluginSelection([], catalogPlugin);
+
+ // Assert
+ expect(selected).toEqual([
+ {
+ source: "github:OpenHands/extensions",
+ ref: null,
+ repo_path: "plugins/city-weather",
+ },
+ ]);
+ });
+
+ it("removes a plugin that is already selected", () => {
+ // Arrange: the selection already contains the plugin's coordinates.
+ const existing = marketplacePluginToSpec(catalogPlugin);
+
+ // Act: toggling the same plugin again removes it.
+ const selected = togglePluginSelection([existing], catalogPlugin);
+
+ // Assert
+ expect(selected).toEqual([]);
+ });
+
+ it("reports whether a plugin's coordinates are in the selection", () => {
+ // Arrange
+ const selection = [marketplacePluginToSpec(catalogPlugin)];
+
+ // Assert: present coordinates match; a different repo_path does not.
+ expect(isPluginSelected(selection, catalogPlugin)).toBe(true);
+ expect(
+ isPluginSelected(selection, {
+ ...catalogPlugin,
+ repo_path: "plugins/other",
+ }),
+ ).toBe(false);
+ });
+
+ it("filters case-insensitively by visible fields and matches everything when empty", () => {
+ // Assert: empty query keeps all; a query matches across name/description/source.
+ expect(matchesPluginPickerSearch(catalogPlugin, "")).toBe(true);
+ expect(matchesPluginPickerSearch(catalogPlugin, "WEATHER")).toBe(true);
+ expect(matchesPluginPickerSearch(catalogPlugin, "nonexistent")).toBe(false);
+ });
+});
diff --git a/src/components/features/home/home-chat-launcher.tsx b/src/components/features/home/home-chat-launcher.tsx
index f523496c23..6ff3a17558 100644
--- a/src/components/features/home/home-chat-launcher.tsx
+++ b/src/components/features/home/home-chat-launcher.tsx
@@ -25,6 +25,9 @@ import {
TOAST_OPTIONS,
} from "#/utils/custom-toast-handlers";
import { getWorkspacesUnsupportedMessage } from "#/utils/workspaces-compatibility";
+import type { PluginSpec } from "#/api/conversation-service/agent-server-conversation-service.types";
+import { PluginPickerModal } from "#/components/features/plugins/plugin-picker-modal";
+import { PluginPickerTrigger } from "#/components/features/plugins/plugin-picker-trigger";
import { HomeHeaderTitle } from "./home-header/home-header-title";
import { OpenLauncherButton } from "./open-launcher-button";
import { OpenWorkspaceDialog } from "./open-workspace-dialog";
@@ -46,6 +49,8 @@ export function HomeChatLauncher() {
const [pendingProvider, setPendingProvider] = useState<Provider | null>(null);
const [workspaceMode, setWorkspaceMode] =
useState<WorkspaceMode>("local_repo");
+ const [selectedPlugins, setSelectedPlugins] = useState<PluginSpec[]>([]);
+ const [isPluginPickerOpen, setIsPluginPickerOpen] = useState(false);
const { mutate: createConversation, isPending } = useCreateConversation();
const isCreatingElsewhere = useIsCreatingConversation();
@@ -108,6 +113,13 @@ export function HomeChatLauncher() {
};
}
+ // Explicitly-attached plugins are additive on top of any ambient set and
+ // are resolved from git at run time. Omitted entirely when none selected so
+ // nothing attaches unless the user picked it.
+ if (selectedPlugins.length > 0) {
+ variables = { ...variables, plugins: selectedPlugins };
+ }
+
// Loading toast gives the user a clear signal that the request is in
// flight; dismissed precisely once the mutation resolves.
const toastId = toast.loading(
@@ -217,7 +229,7 @@ export function HomeChatLauncher() {
/>
</div>
- <div className="flex justify-start">
+ <div className="flex items-center justify-start gap-2">
{hasSelection ? (
<HomeGitControlBarPreview
workspace={pendingWorkspace}
@@ -237,6 +249,11 @@ export function HomeChatLauncher() {
disabledTooltip={workspacesUnsupportedMessage}
/>
)}
+ <PluginPickerTrigger
+ count={selectedPlugins.length}
+ onClick={() => setIsPluginPickerOpen(true)}
+ disabled={isCreating}
+ />
</div>
{isLocal ? (
@@ -264,6 +281,14 @@ export function HomeChatLauncher() {
}}
/>
)}
+
+ {isPluginPickerOpen && (
+ <PluginPickerModal
+ selected={selectedPlugins}
+ onChange={setSelectedPlugins}
+ onClose={() => setIsPluginPickerOpen(false)}
+ />
+ )}
</div>
);
}
diff --git a/src/components/features/plugins/plugin-picker-card.tsx b/src/components/features/plugins/plugin-picker-card.tsx
new file mode 100644
index 0000000000..981b6e2f19
--- /dev/null
+++ b/src/components/features/plugins/plugin-picker-card.tsx
@@ -0,0 +1,73 @@
+import type { MarketplacePlugin } from "#/api/plugins-service";
+import { CirclePlusCheckToggle } from "#/components/shared/buttons/circle-plus-check-toggle";
+import { I18nKey } from "#/i18n/declaration";
+import { cn } from "#/utils/utils";
+import { extensionModuleCardPillClassName } from "#/utils/extension-module-card-classes";
+
+interface PluginPickerCardProps {
+ plugin: MarketplacePlugin;
+ isSelected: boolean;
+ isDisabled?: boolean;
+ onToggle: (selected: boolean) => void;
+}
+
+/** A single selectable plugin in the picker catalog (display + attach toggle). */
+export function PluginPickerCard({
+ plugin,
+ isSelected,
+ isDisabled = false,
+ onToggle,
+}: PluginPickerCardProps) {
+ return (
+ <div
+ data-testid={`plugin-picker-card-${plugin.name}`}
+ className={cn(
+ "flex min-w-0 items-start justify-between gap-3 rounded-lg bg-tertiary p-4",
+ )}
+ >
+ <div className="min-w-0 flex-1">
+ <h3
+ data-testid={`plugin-picker-name-${plugin.name}`}
+ className="truncate text-sm font-semibold text-white"
+ >
+ {plugin.name}
+ </h3>
+ <p
+ className="mt-0.5 min-w-0 truncate text-xs text-tertiary-alt"
+ title={plugin.source}
+ >
+ {plugin.source}
+ </p>
+ {plugin.description ? (
+ <p className="mt-1 line-clamp-2 text-xs text-tertiary-light">
+ {plugin.description}
+ </p>
+ ) : null}
+ {plugin.repo_path || plugin.ref ? (
+ <div className="mt-2 flex flex-wrap gap-1.5">
+ {plugin.repo_path ? (
+ <span className={extensionModuleCardPillClassName}>
+ {plugin.repo_path}
+ </span>
+ ) : null}
+ {plugin.ref ? (
+ <span className={extensionModuleCardPillClassName}>
+ @{plugin.ref}
+ </span>
+ ) : null}
+ </div>
+ ) : null}
+ </div>
+ <CirclePlusCheckToggle
+ testId={`plugin-picker-toggle-${plugin.name}`}
+ isSelected={isSelected}
+ isDisabled={isDisabled}
+ onToggle={onToggle}
+ enableLabelKey={I18nKey.BUTTON$ADD}
+ disableLabelKey={I18nKey.COMMON$REMOVE}
+ enableTooltipKey={I18nKey.BUTTON$ADD}
+ disableTooltipKey={I18nKey.COMMON$REMOVE}
+ />
+ </div>
+ );
+}
diff --git a/src/components/features/plugins/plugin-picker-modal.tsx b/src/components/features/plugins/plugin-picker-modal.tsx
new file mode 100644
index 0000000000..9f18fbbec8
--- /dev/null
+++ b/src/components/features/plugins/plugin-picker-modal.tsx
@@ -0,0 +1,70 @@
+import { useTranslation } from "react-i18next";
+import type { PluginSpec } from "#/api/conversation-service/agent-server-conversation-service.types";
+import { ModalBackdrop } from "#/components/shared/modals/modal-backdrop";
+import {
+ MODAL_MAX_WIDTH_VIEWPORT,
+ modalWidthClassName,
+} from "#/components/shared/modals/modal-body";
+import { ModalCloseButton } from "#/components/shared/modals/modal-close-button";
+import { BrandButton } from "#/components/features/settings/brand-button";
+import { I18nKey } from "#/i18n/declaration";
+import { Typography } from "#/ui/typography";
+import { cn } from "#/utils/utils";
+import { PluginPicker } from "./plugin-picker";
+
+interface PluginPickerModalProps {
+ selected: PluginSpec[];
+ onChange: (next: PluginSpec[]) => void;
+ onClose: () => void;
+}
+
+/** Modal shell around the reusable {@link PluginPicker} for the launcher flow. */
+export function PluginPickerModal({
+ selected,
+ onChange,
+ onClose,
+}: PluginPickerModalProps) {
+ const { t } = useTranslation("openhands");
+
+ return (
+ <ModalBackdrop onClose={onClose}>
+ <div
+ data-testid="plugin-picker-modal"
+ className={cn(
+ "relative flex max-h-[80vh] flex-col gap-4 rounded-xl border border-[var(--oh-border)] bg-base-secondary p-6",
+ modalWidthClassName("lg"),
+ MODAL_MAX_WIDTH_VIEWPORT,
+ )}
+ >
+ <ModalCloseButton onClose={onClose} testId="plugin-picker-close" />
+ <div className="pr-6">
+ <Typography.H2>{t(I18nKey.PLUGINS$PICKER_TITLE)}</Typography.H2>
+ <Typography.Text className="mt-1 block text-sm text-tertiary-light">
+ {t(I18nKey.PLUGINS$PICKER_SUBTITLE)}
+ </Typography.Text>
+ </div>
+
+ <div className="flex-1 overflow-y-auto custom-scrollbar">
+ <PluginPicker selected={selected} onChange={onChange} />
+ </div>
+
+ <div className="flex items-center justify-between border-t border-[var(--oh-border-subtle)] pt-4">
+ <Typography.Text className="text-sm text-tertiary-light">
+ {t(I18nKey.PLUGINS$PICKER_SELECTED_COUNT, {
+ count: selected.length,
+ })}
+ </Typography.Text>
+ <BrandButton
+ testId="plugin-picker-done"
+ type="button"
+ variant="primary"
+ onClick={onClose}
+ className="px-4"
+ >
+ {t(I18nKey.PLUGINS$PICKER_DONE)}
+ </BrandButton>
+ </div>
+ </div>
+ </ModalBackdrop>
+ );
+}
diff --git a/src/components/features/plugins/plugin-picker-trigger.tsx b/src/components/features/plugins/plugin-picker-trigger.tsx
new file mode 100644
index 0000000000..5964064616
--- /dev/null
+++ b/src/components/features/plugins/plugin-picker-trigger.tsx
@@ -0,0 +1,58 @@
+import { useTranslation } from "react-i18next";
+import PuzzleIcon from "#/icons/u-puzzle-piece.svg?react";
+import { I18nKey } from "#/i18n/declaration";
+import { cn } from "#/utils/utils";
+import {
+ formControlBorderClassName,
+ formControlSurfaceClassName,
+ formControlTransitionClassName,
+} from "#/utils/form-control-classes";
+
+interface PluginPickerTriggerProps {
+ /** Number of currently-attached plugins, shown as a badge when > 0. */
+ count: number;
+ onClick: () => void;
+ disabled?: boolean;
+}
+
+/** Pill button that opens the plugin picker; mirrors `OpenLauncherButton`. */
+export function PluginPickerTrigger({
+ count,
+ onClick,
+ disabled = false,
+}: PluginPickerTriggerProps) {
+ const { t } = useTranslation("openhands");
+
+ return (
+ <button
+ type="button"
+ data-testid="open-plugin-picker"
+ onClick={onClick}
+ disabled={disabled}
+ className={cn(
+ "flex flex-row items-center gap-2 rounded-full px-2.5 py-1 text-white",
+ formControlBorderClassName,
+ formControlSurfaceClassName,
+ formControlTransitionClassName,
+ disabled
+ ? "cursor-not-allowed opacity-50"
+ : "cursor-pointer hover:bg-surface-raised",
+ )}
+ >
+ <span className="flex h-4 w-4 shrink-0 items-center justify-center">
+ <PuzzleIcon width={16} height={16} className="shrink-0" aria-hidden />
+ </span>
+ <span className="text-sm font-normal leading-5">
+ {t(I18nKey.PLUGINS$PICKER_TRIGGER)}
+ </span>
+ {count > 0 ? (
+ <span
+ data-testid="plugin-picker-count"
+ className="inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-white px-1 text-[11px] font-semibold leading-none text-black"
+ >
+ {count}
+ </span>
+ ) : null}
+ </button>
+ );
+}
diff --git a/src/components/features/plugins/plugin-picker.tsx b/src/components/features/plugins/plugin-picker.tsx
new file mode 100644
index 0000000000..22362243c4
--- /dev/null
+++ b/src/components/features/plugins/plugin-picker.tsx
@@ -0,0 +1,137 @@
+import { useState } from "react";
+import { Search, X } from "lucide-react";
+import { useTranslation } from "react-i18next";
+import type { PluginSpec } from "#/api/conversation-service/agent-server-conversation-service.types";
+import { usePluginsMarketplace } from "#/hooks/query/use-plugins-marketplace";
+import { I18nKey } from "#/i18n/declaration";
+import { cn } from "#/utils/utils";
+import {
+ extensionModuleCardGridClassName,
+ extensionModuleCardGridContainerClassName,
+} from "#/utils/extension-module-card-classes";
+import { PluginPickerCard } from "./plugin-picker-card";
+import {
+ isPluginSelected,
+ matchesPluginPickerSearch,
+ togglePluginSelection,
+} from "./plugin-spec-identity";
+
+interface PluginPickerProps {
+ /** Currently-attached plugin references (controlled). */
+ selected: PluginSpec[];
+ /** Called with the next selection whenever the user toggles a plugin. */
+ onChange: (next: PluginSpec[]) => void;
+ /** Render the toggles read-only (e.g. while a parent submit is in flight). */
+ disabled?: boolean;
+}
+
+/**
+ * Reusable, controlled multi-select over the dynamic plugins catalog
+ * (`usePluginsMarketplace`). Selection lives in the parent as `PluginSpec[]`;
+ * this component only reads the catalog, filters it, and reports toggles. It is
+ * surface-agnostic so the new-conversation flow and the automations UI can both
+ * embed it. No install/enable/disable — that is the plugins management page.
+ */
+export function PluginPicker({
+ selected,
+ onChange,
+ disabled = false,
+}: PluginPickerProps) {
+ const { t } = useTranslation("openhands");
+ const { data: catalog, isLoading, isError } = usePluginsMarketplace();
+ const [search, setSearch] = useState("");
+
+ const visible = (catalog ?? []).filter((plugin) =>
+ matchesPluginPickerSearch(plugin, search),
+ );
+
+ const renderBody = () => {
+ if (isLoading) {
+ return (
+ <p
+ data-testid="plugin-picker-loading"
+ className="py-8 text-center text-sm text-tertiary-light"
+ >
+ {t(I18nKey.PLUGINS$PICKER_LOADING)}
+ </p>
+ );
+ }
+ if (isError) {
+ return (
+ <p
+ data-testid="plugin-picker-error"
+ className="py-8 text-center text-sm text-tertiary-light"
+ >
+ {t(I18nKey.PLUGINS$PICKER_ERROR)}
+ </p>
+ );
+ }
+ if (visible.length === 0) {
+ return (
+ <p
+ data-testid="plugin-picker-empty"
+ className="py-8 text-center text-sm text-tertiary-light"
+ >
+ {t(I18nKey.PLUGINS$PICKER_EMPTY)}
+ </p>
+ );
+ }
+ return (
+ <div className={extensionModuleCardGridContainerClassName}>
+ <div className={extensionModuleCardGridClassName}>
+ {visible.map((plugin) => (
+ <PluginPickerCard
+ key={`${plugin.source} ${plugin.ref ?? ""} ${plugin.repo_path ?? ""} ${plugin.name}`}
+ plugin={plugin}
+ isSelected={isPluginSelected(selected, plugin)}
+ isDisabled={disabled}
+ onToggle={() => onChange(togglePluginSelection(selected, plugin))}
+ />
+ ))}
+ </div>
+ </div>
+ );
+ };
+
+ return (
+ <div data-testid="plugin-picker" className="flex w-full flex-col gap-3">
+ <div
+ className={cn(
+ "relative flex min-w-0 items-center",
+ "rounded-lg border border-[var(--oh-border)] bg-base-secondary",
+ "transition-colors focus-within:border-white/40 focus-within:ring-1 focus-within:ring-white/20",
+ )}
+ >
+ <Search
+ className="ml-3 h-4 w-4 shrink-0 text-tertiary-alt"
+ aria-hidden
+ />
+ <input
+ data-testid="plugin-picker-search-input"
+ type="search"
+ value={search}
+ onChange={(e) => setSearch(e.target.value)}
+ placeholder={t(I18nKey.PLUGINS$PICKER_SEARCH_PLACEHOLDER)}
+ aria-label={t(I18nKey.PLUGINS$PICKER_SEARCH_PLACEHOLDER)}
+ className={cn(
+ "min-w-0 flex-1 border-0 bg-transparent outline-none",
+ "px-3 py-2 text-sm placeholder:text-tertiary-alt",
+ "[&::-webkit-search-cancel-button]:hidden",
+ )}
+ />
+ {search ? (
+ <button
+ type="button"
+ onClick={() => setSearch("")}
+ aria-label={t(I18nKey.MCP$SEARCH_CLEAR)}
+ className="mr-2 cursor-pointer rounded p-1 text-tertiary-alt hover:text-white"
+ >
+ <X className="h-4 w-4" aria-hidden />
+ </button>
+ ) : null}
+ </div>
+
+ {renderBody()}
+ </div>
+ );
+}
diff --git a/src/components/features/plugins/plugin-spec-identity.ts b/src/components/features/plugins/plugin-spec-identity.ts
new file mode 100644
index 0000000000..842edf133c
Binary files /dev/null and b/src/components/features/plugins/plugin-spec-identity.ts differ
diff --git a/src/i18n/translation.json b/src/i18n/translation.json
index 49d8a93b84..5f64150494 100644
--- a/src/i18n/translation.json
+++ b/src/i18n/translation.json
@@ -32945,6 +32945,23 @@
"uk": "Має починатися з літери, містити лише літери/цифри/підкреслення та мати від 1 до 64 символів",
"ca": "Ha de començar amb una lletra, contenir només lletres/números/guions baixos i tenir entre 1 i 64 caràcters"
},
+ "PLUGINS$PICKER_TRIGGER": {
+ "en": "Plugins",
+ "ja": "プラグイン",
+ "zh-CN": "插件",
+ "zh-TW": "外掛",
+ "ko-KR": "플러그인",
+ "no": "Plugins",
+ "it": "Plugin",
+ "pt": "Plugins",
+ "es": "Plugins",
+ "ar": "المكونات الإضافية",
+ "fr": "Plugins",
+ "tr": "Eklentiler",
+ "de": "Plugins",
+ "uk": "Плагіни",
+ "ca": "Connectors"
+ },
"CONVERSATION$SHOW_PLUGINS": {
"en": "Show Plugins",
"ja": "プラグインを表示",
@@ -32979,6 +32996,142 @@
"uk": "Плагіни",
"ca": "Connectors"
},
+ "PLUGINS$PICKER_TITLE": {
+ "en": "Attach plugins",
+ "ja": "プラグインを追加",
+ "zh-CN": "添加插件",
+ "zh-TW": "新增外掛程式",
+ "ko-KR": "플러그인 추가",
+ "no": "Legg til plugins",
+ "it": "Aggiungi plugin",
+ "pt": "Adicionar plugins",
+ "es": "Añadir complementos",
+ "ar": "إرفاق الإضافات",
+ "fr": "Ajouter des plugins",
+ "tr": "Eklenti ekle",
+ "de": "Plugins hinzufügen",
+ "uk": "Додати плагіни",
+ "ca": "Afegeix connectors"
+ },
+ "PLUGINS$PICKER_SUBTITLE": {
+ "en": "Select plugins to load when this conversation starts.",
+ "ja": "この会話の開始時に読み込むプラグインを選択します。",
+ "zh-CN": "选择此对话启动时要加载的插件。",
+ "zh-TW": "選擇此對話啟動時要載入的外掛程式。",
+ "ko-KR": "이 대화를 시작할 때 로드할 플러그인을 선택하세요.",
+ "no": "Velg plugins som skal lastes når denne samtalen starter.",
+ "it": "Seleziona i plugin da caricare all'avvio di questa conversazione.",
+ "pt": "Selecione os plugins a serem carregados quando esta conversa começar.",
+ "es": "Selecciona los complementos que se cargarán cuando comience esta conversación.",
+ "ar": "اختر الإضافات التي سيتم تحميلها عند بدء هذه المحادثة.",
+ "fr": "Sélectionnez les plugins à charger au démarrage de cette conversation.",
+ "tr": "Bu konuşma başladığında yüklenecek eklentileri seçin.",
+ "de": "Wählen Sie die Plugins aus, die beim Start dieser Unterhaltung geladen werden.",
+ "uk": "Виберіть плагіни, які завантажаться на початку цієї розмови.",
+ "ca": "Selecciona els connectors que es carregaran quan comenci aquesta conversa."
+ },
+ "PLUGINS$PICKER_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",
+ "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",
+ "ar": "ابحث في الإضافات بالاسم أو الوصف أو المصدر",
+ "fr": "Rechercher des plugins par nom, description ou source",
+ "tr": "Eklentileri ada, açıklamaya veya kaynağa göre arayın",
+ "de": "Plugins nach Name, Beschreibung oder Quelle suchen",
+ "uk": "Шукати плагіни за назвою, описом або джерелом",
+ "ca": "Cerca connectors per nom, descripció o origen"
+ },
+ "PLUGINS$PICKER_LOADING": {
+ "en": "Loading...",
+ "ja": "読み込み中...",
+ "zh-CN": "加载中...",
+ "zh-TW": "載入中...",
+ "ko-KR": "로딩 중...",
+ "no": "Laster...",
+ "it": "Caricamento in corso...",
+ "pt": "Carregando...",
+ "es": "Cargando...",
+ "ar": "جار التحميل...",
+ "fr": "Chargement...",
+ "tr": "Yükleniyor...",
+ "de": "Wird geladen...",
+ "uk": "Завантаження...",
+ "ca": "Carregant..."
+ },
+ "PLUGINS$PICKER_EMPTY": {
+ "en": "No plugins available.",
+ "ja": "利用可能なプラグインはありません。",
+ "zh-CN": "没有可用的插件。",
+ "zh-TW": "沒有可用的外掛程式。",
+ "ko-KR": "사용할 수 있는 플러그인이 없습니다.",
+ "no": "Ingen plugins tilgjengelig.",
+ "it": "Nessun plugin disponibile.",
+ "pt": "Nenhum plugin disponível.",
+ "es": "No hay complementos disponibles.",
+ "ar": "لا توجد إضافات متاحة.",
+ "fr": "Aucun plugin disponible.",
+ "tr": "Kullanılabilir eklenti yok.",
+ "de": "Keine Plugins verfügbar.",
+ "uk": "Немає доступних плагінів.",
+ "ca": "No hi ha connectors disponibles."
+ },
+ "PLUGINS$PICKER_ERROR": {
+ "en": "Couldn't load plugins.",
+ "ja": "プラグインを読み込めませんでした。",
+ "zh-CN": "无法加载插件。",
+ "zh-TW": "無法載入外掛程式。",
+ "ko-KR": "플러그인을 불러올 수 없습니다.",
+ "no": "Kunne ikke laste plugins.",
+ "it": "Impossibile caricare i plugin.",
+ "pt": "Não foi possível carregar os plugins.",
+ "es": "No se pudieron cargar los complementos.",
+ "ar": "تعذّر تحميل الإضافات.",
+ "fr": "Impossible de charger les plugins.",
+ "tr": "Eklentiler yüklenemedi.",
+ "de": "Plugins konnten nicht geladen werden.",
+ "uk": "Не вдалося завантажити плагіни.",
+ "ca": "No s'han pogut carregar els connectors."
+ },
+ "PLUGINS$PICKER_DONE": {
+ "en": "Done",
+ "ja": "完了",
+ "zh-CN": "完成",
+ "zh-TW": "完成",
+ "ko-KR": "완료",
+ "no": "Ferdig",
+ "it": "Fatto",
+ "pt": "Concluído",
+ "es": "Hecho",
+ "ar": "تم",
+ "fr": "Terminé",
+ "tr": "Bitti",
+ "de": "Fertig",
+ "uk": "Готово",
+ "ca": "Fet"
+ },
+ "PLUGINS$PICKER_SELECTED_COUNT": {
+ "en": "{{count}} selected",
+ "ja": "{{count}} 件選択中",
+ "zh-CN": "已选择 {{count}} 个",
+ "zh-TW": "已選擇 {{count}} 個",
+ "ko-KR": "{{count}}개 선택됨",
+ "no": "{{count}} valgt",
+ "it": "{{count}} selezionati",
+ "pt": "{{count}} selecionado(s)",
+ "es": "{{count}} seleccionado(s)",
+ "ar": "{{count}} محدد",
+ "fr": "{{count}} sélectionné(s)",
+ "tr": "{{count}} seçildi",
+ "de": "{{count}} ausgewählt",
+ "uk": "Вибрано {{count}}",
+ "ca": "{{count}} seleccionats"
+ },
"PLUGINS_MODAL$DESCRIPTION": {
"en": "Plugins explicitly attached when this conversation started.",
"ja": "この会話の開始時に明示的に添付されたプラグインです。",