diff --git a/e2e/agentPluginsLayout.spec.ts b/e2e/agentPluginsLayout.spec.ts new file mode 100644 index 000000000..ceca57242 --- /dev/null +++ b/e2e/agentPluginsLayout.spec.ts @@ -0,0 +1,127 @@ +import type { AgentPluginCatalog, AgentPluginState } from "../src/bindings"; +import { expect, stubDesktop, test } from "./fixtures"; + +const makePlugin = (name: string, consentRequired: boolean): AgentPluginState => ({ + plugin: { + id: name, + name, + displayName: name, + version: "26.1021.31345", + description: "A plugin with a long description explaining what it can do for the agent in this workspace.", + marketplace: "context-engineering-marketplace-with-a-long-name", + source: "claudeUser", + scope: "user", + formats: ["claude", "codex", "copilot"], + rootPath: "/Users/dev/.claude/plugins/cache/context-engineering-marketplace/agent-plugin", + defaultEnabled: false, + approxTokens: 2550, + capabilities: { + skillCount: 17, + mcpCount: 1, + ruleCount: 2, + subagentCount: 3, + commandCount: 0, + hookFiles: consentRequired ? ["hooks/a-very-long-lifecycle-hook-file-name.json"] : [], + requiresConsent: consentRequired, + }, + valid: true, + }, + enabled: !consentRequired, + origin: consentRequired ? "consent" : "none", + consentRequired, +}); + +test("agent plugin metadata stays clear of enable and review controls at narrow widths", async ({ + workbench: page, +}) => { + const longName = "Context Engineering with an exceptionally long plugin display name"; + const catalog: AgentPluginCatalog = { + plugins: [makePlugin(longName, true), makePlugin("Frontend Design", false)], + marketplaces: [ + { + id: "official", + name: "claude-plugins-official", + source: "example/official", + scope: "user", + discovered: true, + }, + { + id: "community", + name: "context-engineering-marketplace-with-a-long-name", + source: "example/community", + scope: "user", + discovered: true, + }, + ], + projectedSkills: 17, + projectedMcpServers: 1, + projectedRules: 2, + }; + await stubDesktop(page); + await page.evaluate(async (catalog) => { + window.__ipc.handlers.agent_plugins_list = () => structuredClone(catalog); + window.__ipc.handlers.window_open_settings = () => { + throw { kind: "unavailable", message: "separate settings window disabled in browser test", detail: null }; + }; + const actionsModule = "/src/platform/actions.ts"; + const { executeAction } = await import(/* @vite-ignore */ actionsModule); + await executeAction("file.settings", "agents.plugins"); + }, catalog); + const dialog = page.getByRole("dialog", { name: "Settings", exact: true }); + await expect(dialog).toBeVisible(); + const group = dialog.getByRole("region", { name: "Claude Code · User" }); + const rows = group.getByRole("listitem"); + await expect(rows).toHaveCount(2); + const review = rows.first().getByRole("button", { name: "Review & Enable…" }); + await expect(review).toBeVisible(); + for (const width of [1120, 780, 580, 520]) { + await page.setViewportSize({ width, height: 760 }); + await expect(async () => { + const fit = await rows.evaluateAll((items) => + items.every((row) => { + const expand = row.querySelector("button[aria-expanded]")!; + const action = expand.nextElementSibling!; + const bounds = row.getBoundingClientRect(); + const a = expand.getBoundingClientRect(); + const b = action.getBoundingClientRect(); + const title = expand.querySelector("[title]")!.getBoundingClientRect(); + return ( + title.width > 0 && + a.right <= bounds.right + 1 && + b.right <= bounds.right + 1 && + (a.right <= b.left + 1 || a.bottom <= b.top + 1) && + expand.scrollWidth <= expand.clientWidth + 1 + ); + }), + ); + expect(fit).toBe(true); + }).toPass(); + if (process.env.SETTINGS_EVIDENCE) + await dialog.screenshot({ + path: `${process.env.SETTINGS_EVIDENCE}/plugins-${width}.png`, + animations: "disabled", + }); + } + + await rows + .first() + .getByRole("button", { name: new RegExp(longName) }) + .click(); + await expect(rows.first().getByText(catalog.plugins[0]!.plugin.marketplace!)).toBeVisible(); + await expect(rows.first().getByText(".claude-plugin · .codex-plugin · .plugin")).toBeVisible(); + await expect(rows.first().getByText(catalog.plugins[0]!.plugin.description, { exact: true })).toBeVisible(); + if (process.env.SETTINGS_EVIDENCE) { + await page.setViewportSize({ width: 1120, height: 760 }); + await page.evaluate(async () => { + const themePath = "/src/workbench/theme.ts"; + const { setTheme } = await import(/* @vite-ignore */ themePath); + await setTheme("dark"); + }); + await dialog.screenshot({ + path: `${process.env.SETTINGS_EVIDENCE}/plugins-expanded-dark.png`, + animations: "disabled", + }); + } + await review.click(); + await expect(page.getByRole("dialog", { name: /Approve Plugin Capabilities/ })).toBeVisible(); +}); diff --git a/src/features/agents/AgentPluginsPage.module.css b/src/features/agents/AgentPluginsPage.module.css index aa2f649d6..79fbcdac8 100644 --- a/src/features/agents/AgentPluginsPage.module.css +++ b/src/features/agents/AgentPluginsPage.module.css @@ -1,17 +1,49 @@ +/* Keep technical metadata from competing with the row's name and action. */ .row { min-height: var(--h-row); - padding-block: 2px; + padding: var(--space-1-5) var(--space-2); +} + +.expand { + align-items: flex-start; + min-width: 0; +} + +.expand > svg { + margin-top: var(--space-0-5); +} + +.titleRow { + display: flex; + align-items: baseline; + gap: var(--space-1-5); + min-width: 0; } .entryTitle { - flex-shrink: 0; + min-width: 0; color: var(--fg-strong); font-weight: 500; + overflow-wrap: anywhere; +} + +.titleRow .entryTitle { + overflow: hidden; + text-overflow: ellipsis; white-space: nowrap; } +.version { + flex: none; + max-width: 40%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + color: var(--fg-muted); + font-size: var(--fs-small); +} + .subtitle { - flex: 1; min-width: 0; color: var(--fg-muted); font-size: var(--fs-small); @@ -20,8 +52,81 @@ white-space: nowrap; } -.scopeSelect { - min-width: 120px; +.statusRow { + display: flex; + flex-wrap: wrap; + gap: var(--space-0-5) var(--space-2); + color: var(--warning); + font-size: var(--fs-small); + overflow-wrap: anywhere; +} + +.nativeHint { + display: flex; + align-items: center; + gap: var(--space-1); +} + +.nativeHint > svg, +.nativeHint > img { + flex-shrink: 0; +} + +.description { + color: var(--fg); + line-height: 1.45; + white-space: pre-wrap; + overflow-wrap: anywhere; +} + +.groupTitle { + flex-shrink: 0; + max-width: calc(100% - 48px); + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.groupPath { + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.rowControls { + justify-content: flex-end; +} + +@container settings-content (max-width: 360px) { + .reviewRow { + flex-wrap: wrap; + } + + .reviewRow .expand { + flex-basis: 100%; + } + + .version { + display: none; + } + + .groupToggle { + flex-wrap: wrap; + } + + .groupPath { + flex-basis: 100%; + padding-left: var(--space-4); + } + + .searchRow { + flex-wrap: wrap; + } + + .searchRow > :first-child { + flex-basis: 100%; + } } .controls { @@ -36,7 +141,7 @@ display: flex; flex-direction: column; gap: var(--space-2); - padding: 10px 12px; + padding: var(--space-2) var(--space-3); border-radius: var(--radius-control); background: var(--bg-elev); box-shadow: inset 0 0 0 1px var(--border); @@ -54,7 +159,8 @@ display: flex; align-items: center; flex-wrap: wrap; - gap: var(--space-1-5); + gap: var(--space-1) var(--space-3); + min-width: 0; } .summaryTitle { @@ -66,12 +172,15 @@ display: inline-flex; align-items: center; gap: var(--space-1); - padding: 2px 8px; - border-radius: var(--radius-small); - border: 1px solid var(--border); - background: var(--bg-app); + padding: 0; + border: 0; + background: none; color: var(--link); - font-size: var(--fs-tiny); + font-size: var(--fs-small); + text-align: left; + min-width: 0; + max-width: 100%; + overflow-wrap: anywhere; cursor: pointer; } @@ -98,14 +207,17 @@ display: inline-flex; align-items: center; gap: var(--space-1); - padding: 2px 7px; - border-radius: var(--radius-small); - background: var(--bg-app); - box-shadow: inset 0 0 0 1px var(--border); - font-size: var(--fs-tiny); + min-width: 0; + max-width: 100%; + font-size: var(--fs-small); color: var(--fg-secondary); } +.marketplaceChip > span:not(:first-child) { + overflow-wrap: anywhere; + min-width: 0; +} + .dialogBody { display: flex; flex-direction: column; diff --git a/src/features/agents/AgentPluginsPage.tsx b/src/features/agents/AgentPluginsPage.tsx index 51d5eac7c..15645ca73 100644 --- a/src/features/agents/AgentPluginsPage.tsx +++ b/src/features/agents/AgentPluginsPage.tsx @@ -213,38 +213,38 @@ export function AgentPluginsPage({ backend = defaultPluginsBackend }: { backend?
-
- - Active Bundle Projection - - - - -
+ + Active Bundle Projection + {backend.addMarketplace && ( )}
+
+ + + +
{catalog.marketplaces.length > 0 && (
@@ -289,7 +289,7 @@ export function AgentPluginsPage({ backend = defaultPluginsBackend }: { backend? />
-
+
@@ -438,41 +440,55 @@ function PluginCard({ const { plugin } = state; const summary = componentSummary(state, tx); const group = PLUGIN_SOURCE_GROUPS[plugin.source]; + const details = [summary, plugin.approxTokens > 0 ? `~${plugin.approxTokens}t` : ""].filter(Boolean).join(" · "); + const subtitle = [details, plugin.description].filter(Boolean).join(" · "); + const needsReview = state.consentRequired && !state.enabled; return (
-
- -
- {state.consentRequired && !state.enabled ? ( +
+ {needsReview ? ( )} {(plugin.capabilities.hookFiles?.length ?? 0) > 0 && ( - {(plugin.capabilities.hookFiles ?? []).join(", ")} + {(plugin.capabilities.hookFiles ?? []).join(", ")} )} @@ -573,8 +616,9 @@ function PluginCard({
{group.agent && ( - - {tx(group.label)} reads this bundle natively. + + + {tx(group.label)} reads this bundle natively. )}