Skip to content

🙌 OpenHands: AI-Driven Development

feat: show plugin contents in the plugin detail modal (#1690)

Hiep Le9a65d35f1ffa
diff --git a/__tests__/components/features/plugins/build-plugins-view-model.test.ts b/__tests__/components/features/plugins/build-plugins-view-model.test.ts
index 4a559c4ce1..898d59786c 100644
--- a/__tests__/components/features/plugins/build-plugins-view-model.test.ts
+++ b/__tests__/components/features/plugins/build-plugins-view-model.test.ts
@@ -104,4 +104,71 @@ describe("buildPluginsViewModel", () => {
expect(matchesPluginStatus(local, "local")).toBe(true);
expect(matchesPluginStatus(local, "available")).toBe(false);
});
+
+ it("prefers the installed copy's contents over the catalog's", () => {
+ const result = buildPluginsViewModel(
+ [
+ {
+ ...catalogPlugin,
+ path: "/cache/plugins/demo-plugin",
+ skills: [{ name: "catalog-skill" }],
+ files: ["catalog.md"],
+ },
+ ],
+ [
+ {
+ ...installedPlugin,
+ skills: [{ name: "installed-skill" }],
+ files: ["installed.md"],
+ },
+ ],
+ );
+
+ expect(result[0]).toMatchObject({
+ path: installedPlugin.install_path,
+ skills: [{ name: "installed-skill" }],
+ files: ["installed.md"],
+ });
+ });
+
+ it("falls back to the catalog's contents when the installed entry has none", () => {
+ const result = buildPluginsViewModel(
+ [
+ {
+ ...catalogPlugin,
+ path: "/cache/plugins/demo-plugin",
+ skills: [{ name: "catalog-skill" }],
+ files: ["catalog.md"],
+ },
+ ],
+ [installedPlugin],
+ );
+
+ expect(result[0]).toMatchObject({
+ path: "/cache/plugins/demo-plugin",
+ skills: [{ name: "catalog-skill" }],
+ files: ["catalog.md"],
+ });
+ });
+
+ it("carries a local plugin's contents into its entry", () => {
+ const result = buildPluginsViewModel(
+ [],
+ [],
+ [
+ {
+ ...localPlugin,
+ path: "/home/.agents/plugins/ambient-plugin",
+ skills: [{ name: "ambient-skill" }],
+ files: ["SKILL.md"],
+ },
+ ],
+ );
+
+ expect(result[0]).toMatchObject({
+ path: "/home/.agents/plugins/ambient-plugin",
+ skills: [{ name: "ambient-skill" }],
+ files: ["SKILL.md"],
+ });
+ });
});
diff --git a/__tests__/components/features/plugins/plugin-files-section.test.tsx b/__tests__/components/features/plugins/plugin-files-section.test.tsx
new file mode 100644
index 0000000000..31a0844fbb
--- /dev/null
+++ b/__tests__/components/features/plugins/plugin-files-section.test.tsx
@@ -0,0 +1,85 @@
+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 { PluginFilesSection } from "#/components/features/plugins/plugin-files-section";
+import PluginsService from "#/api/plugins-service";
+
+function renderFilesSection(files: string[] = ["README.md"]) {
+ return render(<PluginFilesSection basePath="/plugins/demo" files={files} />, {
+ wrapper: ({ children }) => (
+ <QueryClientProvider
+ client={
+ new QueryClient({ defaultOptions: { queries: { retry: false } } })
+ }
+ >
+ {children}
+ </QueryClientProvider>
+ ),
+ });
+}
+
+describe("PluginFilesSection", () => {
+ beforeEach(() => {
+ vi.restoreAllMocks();
+ });
+
+ it("fetches and shows a file's content when the file is clicked", async () => {
+ const user = userEvent.setup();
+ const contentSpy = vi
+ .spyOn(PluginsService, "getPluginFileContent")
+ .mockResolvedValue({ kind: "text", text: "# Demo readme" });
+
+ renderFilesSection();
+ await user.click(screen.getByTestId("file-tree-file-README.md"));
+
+ await waitFor(() =>
+ expect(screen.getByTestId("plugin-file-content")).toHaveTextContent(
+ "Demo readme",
+ ),
+ );
+ expect(contentSpy).toHaveBeenCalledWith("/plugins/demo", "README.md");
+ });
+
+ it("closes the content viewer when the selected file is clicked again", async () => {
+ const user = userEvent.setup();
+ vi.spyOn(PluginsService, "getPluginFileContent").mockResolvedValue({
+ kind: "text",
+ text: "# Demo readme",
+ });
+
+ renderFilesSection();
+ await user.click(screen.getByTestId("file-tree-file-README.md"));
+ await screen.findByTestId("plugin-file-content");
+ await user.click(screen.getByTestId("file-tree-file-README.md"));
+
+ expect(screen.queryByTestId("plugin-file-content")).not.toBeInTheDocument();
+ });
+
+ it("shows a binary notice instead of content for binary files", async () => {
+ const user = userEvent.setup();
+ vi.spyOn(PluginsService, "getPluginFileContent").mockResolvedValue({
+ kind: "binary",
+ text: null,
+ });
+
+ renderFilesSection(["logo.png"]);
+ await user.click(screen.getByTestId("file-tree-file-logo.png"));
+
+ expect(
+ await screen.findByText("FILES$BINARY_FALLBACK"),
+ ).toBeInTheDocument();
+ });
+
+ it("shows a load error when fetching the file fails", async () => {
+ const user = userEvent.setup();
+ vi.spyOn(PluginsService, "getPluginFileContent").mockRejectedValue(
+ new Error("unreachable"),
+ );
+
+ renderFilesSection();
+ await user.click(screen.getByTestId("file-tree-file-README.md"));
+
+ expect(await screen.findByText("FILES$LOAD_ERROR")).toBeInTheDocument();
+ });
+});
diff --git a/__tests__/routes/plugins-page.test.tsx b/__tests__/routes/plugins-page.test.tsx
index c5ab193e53..c471f58acc 100644
--- a/__tests__/routes/plugins-page.test.tsx
+++ b/__tests__/routes/plugins-page.test.tsx
@@ -185,6 +185,43 @@ describe("SkillsPluginsScreen", () => {
);
});
+ it("shows the plugin's bundled skills and files in the detail modal", async () => {
+ const user = userEvent.setup();
+ vi.spyOn(PluginsService, "getPluginsMarketplace").mockResolvedValue([
+ buildCatalogPlugin({
+ path: "/cache/plugins/demo-plugin",
+ skills: [{ name: "demo-plugin:review", description: "Review code" }],
+ files: ["README.md"],
+ }),
+ ]);
+
+ renderPluginsScreen();
+ await user.click(await screen.findByTestId("plugin-card-demo-plugin"));
+
+ expect(
+ await screen.findByTestId("plugin-bundled-skill-demo-plugin:review"),
+ ).toHaveTextContent("Review code");
+ expect(screen.getByTestId("file-tree-file-README.md")).toBeInTheDocument();
+ });
+
+ it("omits the contents sections when the plugin reports none", async () => {
+ const user = userEvent.setup();
+ vi.spyOn(PluginsService, "getPluginsMarketplace").mockResolvedValue([
+ buildCatalogPlugin(),
+ ]);
+
+ renderPluginsScreen();
+ await user.click(await screen.findByTestId("plugin-card-demo-plugin"));
+
+ await screen.findByTestId("plugin-detail-modal");
+ expect(
+ screen.queryByText("SETTINGS$PLUGINS_SKILLS_IN_BUNDLE"),
+ ).not.toBeInTheDocument();
+ expect(
+ screen.queryByTestId("plugin-files-section"),
+ ).not.toBeInTheDocument();
+ });
+
it("filters the list by the search query", async () => {
vi.spyOn(PluginsService, "getPluginsMarketplace").mockResolvedValue([
buildCatalogPlugin({ name: "alpha-plugin" }),
diff --git a/src/api/plugins-management-service.ts b/src/api/plugins-management-service.ts
index a910d9e8c1..68ffadf17b 100644
--- a/src/api/plugins-management-service.ts
+++ b/src/api/plugins-management-service.ts
@@ -1,11 +1,14 @@
import { PluginsClient } from "@openhands/typescript-client/clients";
import { getActiveBackend } from "./backend-registry/active-store";
import { getAgentServerClientOptions } from "./agent-server-client-options";
+import type { PluginBundledSkill } from "./plugins-service";
/**
* An installed plugin, as returned by the agent-server management router
* (`GET /api/plugins/installed`). Matches the typescript-client
- * `InstalledPluginInfo`.
+ * `InstalledPluginInfo`. The contents fields (`skills`, `files`, relative to
+ * `install_path`) are absent on older agent-servers and null when the
+ * installed plugin directory failed to load.
*/
export interface InstalledPluginInfo {
name: string;
@@ -17,6 +20,8 @@ export interface InstalledPluginInfo {
repo_path?: string | null;
installed_at: string;
install_path: string;
+ skills?: PluginBundledSkill[] | null;
+ files?: string[] | null;
}
/** Coordinates for installing a plugin from a git source or local path. */
diff --git a/src/api/plugins-service.test.ts b/src/api/plugins-service.test.ts
index d9e0923d82..78d4dbac11 100644
--- a/src/api/plugins-service.test.ts
+++ b/src/api/plugins-service.test.ts
@@ -1,5 +1,8 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
-import { PluginsClient } from "@openhands/typescript-client/clients";
+import {
+ FileClient,
+ PluginsClient,
+} from "@openhands/typescript-client/clients";
import {
setActiveSelection,
setRegisteredBackends,
@@ -8,10 +11,12 @@ import PluginsService from "./plugins-service";
vi.mock("@openhands/typescript-client/clients", () => ({
PluginsClient: vi.fn(),
+ FileClient: vi.fn(),
}));
const getPluginsMarketplace = vi.fn();
const getPlugins = vi.fn();
+const downloadFile = vi.fn();
const close = vi.fn();
function useBackend(kind: "local" | "cloud"): void {
@@ -107,3 +112,48 @@ describe("PluginsService.getLocalPlugins", () => {
expect(PluginsClient).not.toHaveBeenCalled();
});
});
+
+describe("PluginsService.getPluginFileContent", () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ vi.mocked(FileClient).mockImplementation(function MockFileClient() {
+ return { downloadFile, close } as unknown as FileClient;
+ } as unknown as typeof FileClient);
+ });
+
+ it("downloads the file under the plugin directory and decodes it as text", async () => {
+ useBackend("local");
+ downloadFile.mockResolvedValue(new TextEncoder().encode("# Hello").buffer);
+
+ const result = await PluginsService.getPluginFileContent(
+ "/plugins/demo",
+ "docs/README.md",
+ );
+
+ expect(result).toEqual({ kind: "text", text: "# Hello" });
+ expect(downloadFile).toHaveBeenCalledWith("/plugins/demo/docs/README.md");
+ });
+
+ it("flags content containing NUL bytes as binary", async () => {
+ useBackend("local");
+ downloadFile.mockResolvedValue(
+ new Uint8Array([0x89, 0x50, 0x00, 0x47]).buffer,
+ );
+
+ const result = await PluginsService.getPluginFileContent(
+ "/plugins/demo",
+ "logo.png",
+ );
+
+ expect(result).toEqual({ kind: "binary", text: null });
+ });
+
+ it("rejects on a cloud backend without calling the client", async () => {
+ useBackend("cloud");
+
+ await expect(
+ PluginsService.getPluginFileContent("/plugins/demo", "README.md"),
+ ).rejects.toThrow();
+ expect(FileClient).not.toHaveBeenCalled();
+ });
+});
diff --git a/src/api/plugins-service.ts b/src/api/plugins-service.ts
index 5522e0ca49..38e95116e4 100644
--- a/src/api/plugins-service.ts
+++ b/src/api/plugins-service.ts
@@ -1,11 +1,22 @@
-import { PluginsClient } from "@openhands/typescript-client/clients";
+import {
+ FileClient,
+ PluginsClient,
+} from "@openhands/typescript-client/clients";
import { getActiveBackend } from "./backend-registry/active-store";
import { getAgentServerClientOptions } from "./agent-server-client-options";
+/** Summary of a skill bundled in a plugin (agent-server `PluginSkillSummary`). */
+export interface PluginBundledSkill {
+ name: string;
+ description?: string | null;
+}
+
/**
* A plugin in the dynamic marketplace catalog, with attachable coordinates and
* install state. Matches the agent-server `MarketplacePluginInfo` / the
- * typescript-client `MarketplacePlugin`.
+ * typescript-client `MarketplacePlugin`. The contents fields (`path`, `skills`,
+ * `files`) are populated when the entry resolves to a directory in the
+ * server's local marketplace clone, and are absent on older agent-servers.
*/
export interface MarketplacePlugin {
name: string;
@@ -14,6 +25,9 @@ export interface MarketplacePlugin {
ref?: string | null;
repo_path?: string | null;
installed: boolean;
+ path?: string | null;
+ skills?: PluginBundledSkill[] | null;
+ files?: string[] | null;
}
/**
@@ -21,12 +35,33 @@ export interface MarketplacePlugin {
* found in the user's local plugin directories (e.g. `~/.agents/plugins`).
* These auto-load into conversations and are not managed via install/uninstall,
* so the Plugins page renders them as a read-only "Local" group. Matches the
- * typescript-client `PluginInfo`.
+ * typescript-client `PluginInfo`; the contents fields are absent on older
+ * agent-servers.
*/
export interface LocalPlugin {
name: string;
version: string;
description: string;
+ path?: string;
+ skills?: PluginBundledSkill[];
+ files?: string[];
+}
+
+/** Content of a single plugin file fetched for the detail-modal viewer. */
+export interface PluginFileContent {
+ kind: "text" | "binary";
+ text: string | null;
+}
+
+function isLikelyBinary(buffer: ArrayBuffer): boolean {
+ // Same heuristic git uses: presence of a NUL byte in the first ~8KB. Small
+ // private copy of `isLikelyBinary` in `use-workspace-file-content.ts` — that
+ // module is conversation-workspace-specific and heavy to import from here.
+ const view = new Uint8Array(buffer, 0, Math.min(buffer.byteLength, 8000));
+ for (let i = 0; i < view.length; i += 1) {
+ if (view[i] === 0) return true;
+ }
+ return false;
}
class PluginsService {
@@ -80,6 +115,36 @@ class PluginsService {
return [];
}
}
+
+ /**
+ * Fetch one plugin file's content for the detail-modal viewer. `basePath` is
+ * the plugin directory reported by the agent-server (`path`/`install_path`)
+ * and `relativePath` a POSIX path from the plugin's `files` listing.
+ *
+ * Local backend only — plugin files live on the local agent-server's disk.
+ * Errors propagate so the caller can render a load-error state.
+ */
+ static async getPluginFileContent(
+ basePath: string,
+ relativePath: string,
+ ): Promise<PluginFileContent> {
+ if (getActiveBackend().backend.kind === "cloud") {
+ throw new Error(
+ "Reading plugin files is only available on a local backend.",
+ );
+ }
+
+ const buffer = await new FileClient(
+ getAgentServerClientOptions(),
+ ).downloadFile(`${basePath}/${relativePath}`);
+ if (isLikelyBinary(buffer)) {
+ return { kind: "binary", text: null };
+ }
+ return {
+ kind: "text",
+ text: new TextDecoder("utf-8", { fatal: false }).decode(buffer),
+ };
+ }
}
export default PluginsService;
diff --git a/src/components/features/plugins/build-plugins-view-model.ts b/src/components/features/plugins/build-plugins-view-model.ts
index 7483440860..e3805c331a 100644
--- a/src/components/features/plugins/build-plugins-view-model.ts
+++ b/src/components/features/plugins/build-plugins-view-model.ts
@@ -1,4 +1,8 @@
-import type { MarketplacePlugin, LocalPlugin } from "#/api/plugins-service";
+import type {
+ MarketplacePlugin,
+ LocalPlugin,
+ PluginBundledSkill,
+} from "#/api/plugins-service";
import type { InstalledPluginInfo } from "#/api/plugins-management-service";
export type PluginStatusFilter = "all" | "installed" | "available" | "local";
@@ -26,6 +30,15 @@ export interface PluginViewModel {
* Read-only: it auto-loads into conversations and is not installed/managed.
*/
isLocal: boolean;
+ /**
+ * Plugin contents (`skills` bundled in the plugin, `files` relative to
+ * `path`). The three fields travel as a unit from one server response so the
+ * file viewer never joins a base path with another copy's file list; null
+ * when the server has no local copy or predates the contents fields.
+ */
+ path: string | null;
+ skills: PluginBundledSkill[] | null;
+ files: string[] | null;
}
/**
@@ -54,11 +67,17 @@ export function buildPluginsViewModel(
version: null,
inCatalog: true,
isLocal: false,
+ path: entry.path ?? null,
+ skills: entry.skills ?? null,
+ files: entry.files ?? null,
});
}
for (const entry of installed ?? []) {
const existing = byName.get(entry.name);
+ // Contents move as a unit: the installed copy is authoritative when it
+ // carries contents; otherwise (older agent-server) keep the catalog's.
+ const hasContents = entry.skills != null || entry.files != null;
byName.set(entry.name, {
name: entry.name,
description: existing?.description ?? entry.description ?? null,
@@ -70,6 +89,9 @@ export function buildPluginsViewModel(
version: entry.version ?? null,
inCatalog: existing?.inCatalog ?? false,
isLocal: false,
+ path: hasContents ? entry.install_path : (existing?.path ?? null),
+ skills: hasContents ? (entry.skills ?? null) : (existing?.skills ?? null),
+ files: hasContents ? (entry.files ?? null) : (existing?.files ?? null),
});
}
@@ -90,6 +112,9 @@ export function buildPluginsViewModel(
version: entry.version || null,
inCatalog: false,
isLocal: true,
+ path: entry.path ?? null,
+ skills: entry.skills ?? null,
+ files: entry.files ?? null,
});
}
diff --git a/src/components/features/plugins/plugin-detail-modal.tsx b/src/components/features/plugins/plugin-detail-modal.tsx
index c451873462..2aa9451cd5 100644
--- a/src/components/features/plugins/plugin-detail-modal.tsx
+++ b/src/components/features/plugins/plugin-detail-modal.tsx
@@ -3,11 +3,13 @@ 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 { SkillIconBadge } from "#/components/features/skills/skill-icon-badge";
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";
+import { PluginFilesSection } from "./plugin-files-section";
interface PluginDetailModalProps {
plugin: PluginViewModel;
@@ -40,7 +42,7 @@ export function PluginDetailModal({
<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"
+ className="relative flex w-[640px] max-w-[90vw] max-h-[85vh] flex-col rounded-xl border border-[var(--oh-border)] bg-base-secondary"
>
<ModalCloseButton
onClose={onClose}
@@ -103,6 +105,39 @@ export function PluginDetailModal({
)}
</SettingsSwitch>
) : null}
+
+ {plugin.skills?.length ? (
+ <section className="flex min-w-0 flex-col gap-2">
+ <h3 className="text-sm font-medium text-white">
+ {t(I18nKey.SETTINGS$PLUGINS_SKILLS_IN_BUNDLE)}
+ </h3>
+ <ul className="flex min-w-0 flex-col gap-2">
+ {plugin.skills.map((skill) => (
+ <li
+ key={skill.name}
+ data-testid={`plugin-bundled-skill-${skill.name}`}
+ className="flex items-start gap-3 rounded-lg border border-[var(--oh-border)] bg-[rgba(255,255,255,0.04)] px-3 py-2.5"
+ >
+ <SkillIconBadge skillName={skill.name} />
+ <div className="min-w-0 flex-1">
+ <p className="truncate text-sm font-semibold text-white">
+ {skill.name}
+ </p>
+ {skill.description ? (
+ <p className="mt-0.5 break-words text-xs leading-relaxed text-tertiary-light">
+ {skill.description}
+ </p>
+ ) : null}
+ </div>
+ </li>
+ ))}
+ </ul>
+ </section>
+ ) : null}
+
+ {plugin.path && plugin.files?.length ? (
+ <PluginFilesSection basePath={plugin.path} files={plugin.files} />
+ ) : null}
</div>
<footer className="flex flex-shrink-0 flex-wrap justify-end gap-2 px-6 pb-6 pt-4">
diff --git a/src/components/features/plugins/plugin-files-section.tsx b/src/components/features/plugins/plugin-files-section.tsx
new file mode 100644
index 0000000000..9e05e62104
--- /dev/null
+++ b/src/components/features/plugins/plugin-files-section.tsx
@@ -0,0 +1,93 @@
+import React from "react";
+import { useTranslation } from "react-i18next";
+import { I18nKey } from "#/i18n/declaration";
+import { FileTreeView } from "#/components/features/files-tab/file-tree-view";
+import { HighlightedSourceView } from "#/components/features/files-tab/highlighted-source-view";
+import { LoadingSpinner } from "#/components/shared/loading-spinner";
+import { usePluginFileContent } from "#/hooks/query/use-plugin-file-content";
+
+interface PluginFilesSectionProps {
+ /** Plugin directory on the agent-server (`path`/`install_path`). */
+ basePath: string;
+ /** File paths relative to `basePath`, as reported by the agent-server. */
+ files: string[];
+}
+
+/**
+ * "Files" section of the plugin detail modal: the plugin's file tree with an
+ * inline viewer for the selected file. Clicking the selected file again
+ * deselects it and closes the viewer.
+ */
+export function PluginFilesSection({
+ basePath,
+ files,
+}: PluginFilesSectionProps) {
+ const { t } = useTranslation("openhands");
+ const [selectedPath, setSelectedPath] = React.useState<string | null>(null);
+
+ // Derived rather than synced: a refetch that drops the selected file cannot
+ // leave a dangling selection.
+ const effectivePath =
+ selectedPath && files.includes(selectedPath) ? selectedPath : null;
+
+ const {
+ data: content,
+ isLoading,
+ isError,
+ } = usePluginFileContent(effectivePath ? basePath : null, effectivePath);
+
+ return (
+ <section
+ data-testid="plugin-files-section"
+ className="flex min-w-0 flex-col gap-2"
+ >
+ <h3 className="text-sm font-medium text-white">
+ {t(I18nKey.COMMON$FILES)}
+ </h3>
+ <div className="min-w-0 rounded-lg border border-[var(--oh-border)] bg-[rgba(255,255,255,0.04)]">
+ <div className="max-h-48 overflow-y-auto custom-scrollbar">
+ <FileTreeView
+ paths={files}
+ selectedPath={effectivePath}
+ onSelectFile={(path) =>
+ setSelectedPath((prev) => (prev === path ? null : path))
+ }
+ />
+ </div>
+ {effectivePath ? (
+ <div
+ data-testid="plugin-file-content"
+ className="flex h-60 min-w-0 flex-col border-t border-[var(--oh-border)]"
+ >
+ <p
+ className="truncate px-3 py-2 text-xs text-tertiary-alt"
+ title={effectivePath}
+ >
+ {effectivePath}
+ </p>
+ <div className="min-h-0 flex-1">
+ {isLoading ? (
+ <div className="flex h-full items-center justify-center">
+ <LoadingSpinner size="small" />
+ </div>
+ ) : isError ? (
+ <p className="px-3 py-2 text-xs text-tertiary-light">
+ {t(I18nKey.FILES$LOAD_ERROR)}
+ </p>
+ ) : content?.kind === "binary" ? (
+ <p className="px-3 py-2 text-xs text-tertiary-light">
+ {t(I18nKey.FILES$BINARY_FALLBACK)}
+ </p>
+ ) : (
+ <HighlightedSourceView
+ path={effectivePath}
+ text={content?.text ?? ""}
+ />
+ )}
+ </div>
+ </div>
+ ) : null}
+ </div>
+ </section>
+ );
+}
diff --git a/src/hooks/query/use-plugin-file-content.ts b/src/hooks/query/use-plugin-file-content.ts
new file mode 100644
index 0000000000..58d4404ab1
--- /dev/null
+++ b/src/hooks/query/use-plugin-file-content.ts
@@ -0,0 +1,23 @@
+import { useQuery } from "@tanstack/react-query";
+import PluginsService, { type PluginFileContent } from "#/api/plugins-service";
+
+/**
+ * Query hook for one plugin file's content, shown in the plugin detail
+ * modal's file viewer. Disabled until a file is selected. Local backend only
+ * (on cloud the plugins page carries no contents, so this never fires).
+ */
+export const usePluginFileContent = (
+ basePath: string | null,
+ relativePath: string | null,
+) =>
+ useQuery<PluginFileContent>({
+ queryKey: ["plugin-file-content", basePath, relativePath],
+ queryFn: () => {
+ if (!basePath || !relativePath) throw new Error("No file selected");
+ return PluginsService.getPluginFileContent(basePath, relativePath);
+ },
+ enabled: Boolean(basePath && relativePath),
+ retry: false,
+ staleTime: 1000 * 60 * 10, // 10 minutes
+ refetchOnWindowFocus: false,
+ });
diff --git a/src/i18n/translation.json b/src/i18n/translation.json
index 04b9ae1f43..459987e159 100644
--- a/src/i18n/translation.json
+++ b/src/i18n/translation.json
@@ -32078,6 +32078,23 @@
"tr": "Eklenti güncellendi.",
"uk": "Плагін оновлено."
},
+ "SETTINGS$PLUGINS_SKILLS_IN_BUNDLE": {
+ "en": "Skills in this plugin bundle",
+ "ja": "このプラグインバンドルに含まれるスキル",
+ "zh-CN": "此插件包中的技能",
+ "zh-TW": "此外掛程式套件中的技能",
+ "ko-KR": "이 플러그인 번들에 포함된 스킬",
+ "no": "Ferdigheter i denne plugin-pakken",
+ "ar": "المهارات في حزمة الإضافة هذه",
+ "de": "Fähigkeiten in diesem Plugin-Paket",
+ "fr": "Compétences incluses dans ce plugin",
+ "it": "Competenze incluse in questo plugin",
+ "pt": "Habilidades incluídas neste plugin",
+ "es": "Habilidades incluidas en este complemento",
+ "ca": "Habilitats incloses en aquest connector",
+ "tr": "Bu eklenti paketindeki yetenekler",
+ "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/vite.config.ts b/vite.config.ts
index f47b29e9e2..81cfee1488 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -60,6 +60,21 @@ const appBuildConfig = {
name: "vendor-styling",
test: /node_modules[\\/](@heroui[\\/]|tailwind-variants[\\/]|tailwind-merge[\\/]|clsx[\\/])/,
},
+ {
+ // Keep the markdown / syntax-highlight ecosystem
+ // (react-syntax-highlighter + refractor/lowlight/highlight.js and
+ // the unified/hast/mdast/micromark/vfile module tree it pulls in)
+ // in one un-size-split chunk. Same failure mode as vendor-styling
+ // above: once the file-viewer (HighlightedSourceView) is imported
+ // from a second route, the generic size-split vendor group slices
+ // this tree across chunk boundaries, so a vfile/unified module's
+ // interop `require` shim can evaluate before the chunk that defines
+ // it, throwing "TypeError: i is not a function" at module load and
+ // blanking the whole app (the shared home/conversation/files-tab
+ // chunk fails to load → route-module reload loop).
+ name: "vendor-markdown",
+ test: /node_modules[\\/](react-syntax-highlighter[\\/]|refractor[\\/]|lowlight[\\/]|highlight\.js[\\/]|hastscript[\\/]|(hast|mdast|unist|micromark|remark|rehype)[^\\/]*[\\/]|unified[\\/]|vfile[^\\/]*[\\/]|property-information[\\/]|(comma|space)-separated-tokens[\\/]|character-entities[^\\/]*[\\/]|(parse|stringify)-entities[\\/]|decode-named-character-reference[\\/]|bail[\\/]|trough[\\/]|is-plain-obj[\\/]|zwitch[\\/]|longest-streak[\\/]|ccount[\\/]|escape-string-regexp[\\/]|markdown-table[\\/]|devlop[\\/])/,
+ },
{
name: "vendor",
test: /node_modules[\\/]/,